mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Core: SetOnStoppedCallback -> SetOnStateChangedCallback
This commit is contained in:
@ -98,7 +98,7 @@ static Common::Flag s_is_booting;
|
||||
static void* s_window_handle = nullptr;
|
||||
static std::string s_state_filename;
|
||||
static std::thread s_emu_thread;
|
||||
static StoppedCallbackFunc s_on_stopped_callback;
|
||||
static StateChangedCallbackFunc s_on_state_changed_callback;
|
||||
|
||||
static std::thread s_cpu_thread;
|
||||
static bool s_request_refresh_info = false;
|
||||
@ -455,14 +455,16 @@ static void EmuThread(std::unique_ptr<BootParameters> boot)
|
||||
{
|
||||
const SConfig& core_parameter = SConfig::GetInstance();
|
||||
s_is_booting.Set();
|
||||
if (s_on_state_changed_callback)
|
||||
s_on_state_changed_callback(State::Starting);
|
||||
Common::ScopeGuard flag_guard{[] {
|
||||
s_is_booting.Clear();
|
||||
s_is_started = false;
|
||||
s_is_stopping = false;
|
||||
s_wants_determinism = false;
|
||||
|
||||
if (s_on_stopped_callback)
|
||||
s_on_stopped_callback();
|
||||
if (s_on_state_changed_callback)
|
||||
s_on_state_changed_callback(State::Uninitialized);
|
||||
|
||||
INFO_LOG(CONSOLE, "Stop\t\t---- Shutdown complete ----");
|
||||
}};
|
||||
@ -685,6 +687,9 @@ void SetState(State state)
|
||||
PanicAlert("Invalid state");
|
||||
break;
|
||||
}
|
||||
|
||||
if (s_on_state_changed_callback)
|
||||
s_on_state_changed_callback(GetState());
|
||||
}
|
||||
|
||||
State GetState()
|
||||
@ -869,6 +874,8 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
||||
{
|
||||
s_frame_step = false;
|
||||
CPU::Break();
|
||||
if (s_on_state_changed_callback)
|
||||
s_on_state_changed_callback(Core::GetState());
|
||||
}
|
||||
}
|
||||
|
||||
@ -962,9 +969,9 @@ void Shutdown()
|
||||
HostDispatchJobs();
|
||||
}
|
||||
|
||||
void SetOnStoppedCallback(StoppedCallbackFunc callback)
|
||||
void SetOnStateChangedCallback(StateChangedCallbackFunc callback)
|
||||
{
|
||||
s_on_stopped_callback = std::move(callback);
|
||||
s_on_state_changed_callback = std::move(callback);
|
||||
}
|
||||
|
||||
void UpdateWantDeterminism(bool initial)
|
||||
|
Reference in New Issue
Block a user