System: Add path/image to game change notification

This commit is contained in:
Connor McLaughlin 2021-02-21 16:53:14 +10:00
parent 77090865c1
commit 7501e89b7a
11 changed files with 30 additions and 17 deletions

View File

@ -597,9 +597,10 @@ void AndroidHostInterface::OnSystemDestroyed()
SetVibration(false); SetVibration(false);
} }
void AndroidHostInterface::OnRunningGameChanged() void AndroidHostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title)
{ {
CommonHostInterface::OnRunningGameChanged(); CommonHostInterface::OnRunningGameChanged(path, image, game_code, game_title);
ApplySettings(true); ApplySettings(true);
if (m_emulation_activity_object) if (m_emulation_activity_object)

View File

@ -85,7 +85,8 @@ protected:
void OnSystemPaused(bool paused) override; void OnSystemPaused(bool paused) override;
void OnSystemDestroyed() override; void OnSystemDestroyed() override;
void OnRunningGameChanged() override; void OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title) override;
private: private:
void EmulationThreadLoop(JNIEnv* env); void EmulationThreadLoop(JNIEnv* env);

View File

@ -172,7 +172,6 @@ void HostInterface::DestroySystem()
UpdateSoftwareCursor(); UpdateSoftwareCursor();
ReleaseHostDisplay(); ReleaseHostDisplay();
OnSystemDestroyed(); OnSystemDestroyed();
OnRunningGameChanged();
} }
void HostInterface::ReportError(const char* message) void HostInterface::ReportError(const char* message)
@ -471,7 +470,10 @@ void HostInterface::OnSystemPerformanceCountersUpdated() {}
void HostInterface::OnSystemStateSaved(bool global, s32 slot) {} void HostInterface::OnSystemStateSaved(bool global, s32 slot) {}
void HostInterface::OnRunningGameChanged() {} void HostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title)
{
}
void HostInterface::OnControllerTypeChanged(u32 slot) {} void HostInterface::OnControllerTypeChanged(u32 slot) {}

View File

@ -143,7 +143,8 @@ public:
/// This is the APK for Android builds, or the program directory for standalone builds. /// This is the APK for Android builds, or the program directory for standalone builds.
virtual std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) = 0; virtual std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) = 0;
virtual void OnRunningGameChanged(); virtual void OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title);
virtual void OnSystemPerformanceCountersUpdated(); virtual void OnSystemPerformanceCountersUpdated();
protected: protected:

View File

@ -913,6 +913,8 @@ void Shutdown()
s_media_playlist_filename.clear(); s_media_playlist_filename.clear();
s_cheat_list.reset(); s_cheat_list.reset();
s_state = State::Shutdown; s_state = State::Shutdown;
g_host_interface->OnRunningGameChanged(s_running_game_path, nullptr, s_running_game_code, s_running_game_title);
} }
bool CreateGPU(GPURenderer renderer) bool CreateGPU(GPURenderer renderer)
@ -1882,7 +1884,7 @@ void UpdateRunningGame(const char* path, CDImage* image)
g_texture_replacements.SetGameID(s_running_game_code); g_texture_replacements.SetGameID(s_running_game_code);
g_host_interface->OnRunningGameChanged(); g_host_interface->OnRunningGameChanged(s_running_game_path, image, s_running_game_code, s_running_game_title);
} }
bool CheckForSBIFile(CDImage* image) bool CheckForSBIFile(CDImage* image)

View File

@ -314,9 +314,10 @@ void NoGUIHostInterface::OnSystemDestroyed()
FullscreenUI::SystemDestroyed(); FullscreenUI::SystemDestroyed();
} }
void NoGUIHostInterface::OnRunningGameChanged() void NoGUIHostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title)
{ {
CommonHostInterface::OnRunningGameChanged(); CommonHostInterface::OnRunningGameChanged(path, image, game_code, game_title);
// TODO: Move to common // TODO: Move to common
if (g_settings.apply_game_settings) if (g_settings.apply_game_settings)

View File

@ -54,7 +54,8 @@ protected:
void OnSystemCreated() override; void OnSystemCreated() override;
void OnSystemPaused(bool paused) override; void OnSystemPaused(bool paused) override;
void OnSystemDestroyed() override; void OnSystemDestroyed() override;
void OnRunningGameChanged() override; void OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title) override;
void RequestExit() override; void RequestExit() override;
virtual void PollAndUpdate() override; virtual void PollAndUpdate() override;

View File

@ -701,9 +701,10 @@ void QtHostInterface::OnSystemPerformanceCountersUpdated()
System::GetAverageFrameTime(), System::GetWorstFrameTime()); System::GetAverageFrameTime(), System::GetWorstFrameTime());
} }
void QtHostInterface::OnRunningGameChanged() void QtHostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title)
{ {
CommonHostInterface::OnRunningGameChanged(); CommonHostInterface::OnRunningGameChanged(path, image, game_code, game_title);
applySettings(true); applySettings(true);
if (!System::IsShutdown()) if (!System::IsShutdown())

View File

@ -2,8 +2,8 @@
#include "common/event.h" #include "common/event.h"
#include "core/host_interface.h" #include "core/host_interface.h"
#include "core/system.h" #include "core/system.h"
#include "qtutils.h"
#include "frontend-common/common_host_interface.h" #include "frontend-common/common_host_interface.h"
#include "qtutils.h"
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QSettings> #include <QtCore/QSettings>
@ -202,7 +202,8 @@ protected:
void OnSystemPaused(bool paused) override; void OnSystemPaused(bool paused) override;
void OnSystemDestroyed() override; void OnSystemDestroyed() override;
void OnSystemPerformanceCountersUpdated() override; void OnSystemPerformanceCountersUpdated() override;
void OnRunningGameChanged() override; void OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title) override;
void OnSystemStateSaved(bool global, s32 slot) override; void OnSystemStateSaved(bool global, s32 slot) override;
void LoadSettings() override; void LoadSettings() override;

View File

@ -812,9 +812,10 @@ void CommonHostInterface::OnSystemDestroyed()
StopControllerRumble(); StopControllerRumble();
} }
void CommonHostInterface::OnRunningGameChanged() void CommonHostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title)
{ {
HostInterface::OnRunningGameChanged(); HostInterface::OnRunningGameChanged(path, image, game_code, game_title);
if (!System::IsShutdown()) if (!System::IsShutdown())
{ {

View File

@ -309,7 +309,8 @@ protected:
virtual void OnSystemCreated() override; virtual void OnSystemCreated() override;
virtual void OnSystemPaused(bool paused) override; virtual void OnSystemPaused(bool paused) override;
virtual void OnSystemDestroyed() override; virtual void OnSystemDestroyed() override;
virtual void OnRunningGameChanged() override; virtual void OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title) override;
virtual void OnControllerTypeChanged(u32 slot) override; virtual void OnControllerTypeChanged(u32 slot) override;
virtual std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const; virtual std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const;