mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 03:46:42 +01:00
Merge pull request #12648 from mitaclaw/core-global-system
Core: Avoid (Some) Global System Accessor
This commit is contained in:
commit
f8fdaf9b94
@ -258,7 +258,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulati
|
|||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv*, jclass)
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv*, jclass)
|
||||||
{
|
{
|
||||||
HostThreadLock guard;
|
HostThreadLock guard;
|
||||||
Core::Stop();
|
Core::Stop(Core::System::GetInstance());
|
||||||
|
|
||||||
// Kick the waiting event
|
// Kick the waiting event
|
||||||
s_update_main_frame_event.Set();
|
s_update_main_frame_event.Set();
|
||||||
@ -586,11 +586,11 @@ static void Run(JNIEnv* env, std::unique_ptr<BootParameters>&& boot, bool riivol
|
|||||||
host_identity_guard.Unlock();
|
host_identity_guard.Unlock();
|
||||||
s_update_main_frame_event.Wait();
|
s_update_main_frame_event.Wait();
|
||||||
host_identity_guard.Lock();
|
host_identity_guard.Lock();
|
||||||
Core::HostDispatchJobs();
|
Core::HostDispatchJobs(Core::System::GetInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
s_game_metadata_is_valid = false;
|
s_game_metadata_is_valid = false;
|
||||||
Core::Shutdown();
|
Core::Shutdown(Core::System::GetInstance());
|
||||||
host_identity_guard.Unlock();
|
host_identity_guard.Unlock();
|
||||||
|
|
||||||
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(),
|
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(),
|
||||||
|
@ -146,7 +146,7 @@ bool BootCore(Core::System& system, std::unique_ptr<BootParameters> boot,
|
|||||||
|
|
||||||
system.Initialize();
|
system.Initialize();
|
||||||
|
|
||||||
Core::UpdateWantDeterminism(/*initial*/ true);
|
Core::UpdateWantDeterminism(system, /*initial*/ true);
|
||||||
|
|
||||||
if (system.IsWii())
|
if (system.IsWii())
|
||||||
{
|
{
|
||||||
|
@ -190,7 +190,7 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
|||||||
Host_TitleChanged();
|
Host_TitleChanged();
|
||||||
if (Core::IsRunning())
|
if (Core::IsRunning())
|
||||||
{
|
{
|
||||||
Core::UpdateTitle();
|
Core::UpdateTitle(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::AddLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
|
Config::AddLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
|
||||||
|
@ -120,7 +120,7 @@ static std::unique_ptr<MemoryWatcher> s_memory_watcher;
|
|||||||
|
|
||||||
struct HostJob
|
struct HostJob
|
||||||
{
|
{
|
||||||
std::function<void()> job;
|
std::function<void(Core::System&)> job;
|
||||||
bool run_after_stop;
|
bool run_after_stop;
|
||||||
};
|
};
|
||||||
static std::mutex s_host_jobs_lock;
|
static std::mutex s_host_jobs_lock;
|
||||||
@ -166,13 +166,13 @@ void FrameUpdateOnCPUThread()
|
|||||||
NetPlay::NetPlayClient::SendTimeBase();
|
NetPlay::NetPlayClient::SendTimeBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnFrameEnd()
|
void OnFrameEnd(Core::System& system)
|
||||||
{
|
{
|
||||||
#ifdef USE_MEMORYWATCHER
|
#ifdef USE_MEMORYWATCHER
|
||||||
if (s_memory_watcher)
|
if (s_memory_watcher)
|
||||||
{
|
{
|
||||||
ASSERT(IsCPUThread());
|
ASSERT(IsCPUThread());
|
||||||
CPUThreadGuard guard(Core::System::GetInstance());
|
const CPUThreadGuard guard(system);
|
||||||
|
|
||||||
s_memory_watcher->Step(guard);
|
s_memory_watcher->Step(guard);
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ bool Init(Core::System& system, std::unique_ptr<BootParameters> boot, const Wind
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Drain any left over jobs
|
// Drain any left over jobs
|
||||||
HostDispatchJobs();
|
HostDispatchJobs(system);
|
||||||
|
|
||||||
INFO_LOG_FMT(BOOT, "Starting core = {} mode", system.IsWii() ? "Wii" : "GameCube");
|
INFO_LOG_FMT(BOOT, "Starting core = {} mode", system.IsWii() ? "Wii" : "GameCube");
|
||||||
INFO_LOG_FMT(BOOT, "CPU Thread separate = {}", system.IsDualCoreMode() ? "Yes" : "No");
|
INFO_LOG_FMT(BOOT, "CPU Thread separate = {}", system.IsDualCoreMode() ? "Yes" : "No");
|
||||||
@ -279,7 +279,7 @@ static void ResetRumble()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called from GUI thread
|
// Called from GUI thread
|
||||||
void Stop() // - Hammertime!
|
void Stop(Core::System& system) // - Hammertime!
|
||||||
{
|
{
|
||||||
if (GetState() == State::Stopping || GetState() == State::Uninitialized)
|
if (GetState() == State::Stopping || GetState() == State::Uninitialized)
|
||||||
return;
|
return;
|
||||||
@ -294,9 +294,7 @@ void Stop() // - Hammertime!
|
|||||||
CallOnStateChangedCallbacks(State::Stopping);
|
CallOnStateChangedCallbacks(State::Stopping);
|
||||||
|
|
||||||
// Dump left over jobs
|
// Dump left over jobs
|
||||||
HostDispatchJobs();
|
HostDispatchJobs(system);
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
|
|
||||||
system.GetFifo().EmulatorState(false);
|
system.GetFifo().EmulatorState(false);
|
||||||
|
|
||||||
@ -354,7 +352,7 @@ static void CPUSetInitialExecutionState(bool force_paused = false)
|
|||||||
{
|
{
|
||||||
// The CPU starts in stepping state, and will wait until a new state is set before executing.
|
// The CPU starts in stepping state, and will wait until a new state is set before executing.
|
||||||
// SetState must be called on the host thread, so we defer it for later.
|
// SetState must be called on the host thread, so we defer it for later.
|
||||||
QueueHostJob([force_paused]() {
|
QueueHostJob([force_paused](Core::System&) {
|
||||||
bool paused = SConfig::GetInstance().bBootToPause || force_paused;
|
bool paused = SConfig::GetInstance().bBootToPause || force_paused;
|
||||||
SetState(paused ? State::Paused : State::Running);
|
SetState(paused ? State::Paused : State::Running);
|
||||||
Host_UpdateDisasmDialog();
|
Host_UpdateDisasmDialog();
|
||||||
@ -658,7 +656,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
|||||||
system.GetPowerPC().SetMode(PowerPC::CoreMode::Interpreter);
|
system.GetPowerPC().SetMode(PowerPC::CoreMode::Interpreter);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateTitle();
|
UpdateTitle(system);
|
||||||
|
|
||||||
// ENTER THE VIDEO THREAD LOOP
|
// ENTER THE VIDEO THREAD LOOP
|
||||||
if (system.IsDualCoreMode())
|
if (system.IsDualCoreMode())
|
||||||
@ -931,13 +929,12 @@ void Callback_NewField(Core::System& system)
|
|||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
#endif // USE_RETRO_ACHIEVEMENTS
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTitle()
|
void UpdateTitle(Core::System& system)
|
||||||
{
|
{
|
||||||
// Settings are shown the same for both extended and summary info
|
// Settings are shown the same for both extended and summary info
|
||||||
const std::string SSettings = fmt::format(
|
const std::string SSettings = fmt::format(
|
||||||
"{} {} | {} | {}", Core::System::GetInstance().GetPowerPC().GetCPUName(),
|
"{} {} | {} | {}", system.GetPowerPC().GetCPUName(), system.IsDualCoreMode() ? "DC" : "SC",
|
||||||
Core::System::GetInstance().IsDualCoreMode() ? "DC" : "SC", g_video_backend->GetDisplayName(),
|
g_video_backend->GetDisplayName(), Config::Get(Config::MAIN_DSP_HLE) ? "HLE" : "LLE");
|
||||||
Config::Get(Config::MAIN_DSP_HLE) ? "HLE" : "LLE");
|
|
||||||
|
|
||||||
std::string message = fmt::format("{} | {}", Common::GetScmRevStr(), SSettings);
|
std::string message = fmt::format("{} | {}", Common::GetScmRevStr(), SSettings);
|
||||||
if (Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE))
|
if (Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE))
|
||||||
@ -950,7 +947,7 @@ void UpdateTitle()
|
|||||||
Host_UpdateTitle(message);
|
Host_UpdateTitle(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown(Core::System& system)
|
||||||
{
|
{
|
||||||
// During shutdown DXGI expects us to handle some messages on the UI thread.
|
// During shutdown DXGI expects us to handle some messages on the UI thread.
|
||||||
// Therefore we can't immediately block and wait for the emu thread to shut
|
// Therefore we can't immediately block and wait for the emu thread to shut
|
||||||
@ -962,7 +959,7 @@ void Shutdown()
|
|||||||
s_emu_thread.join();
|
s_emu_thread.join();
|
||||||
|
|
||||||
// Make sure there's nothing left over in case we're about to exit.
|
// Make sure there's nothing left over in case we're about to exit.
|
||||||
HostDispatchJobs();
|
HostDispatchJobs(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddOnStateChangedCallback(StateChangedCallbackFunc callback)
|
int AddOnStateChangedCallback(StateChangedCallbackFunc callback)
|
||||||
@ -999,12 +996,11 @@ void CallOnStateChangedCallbacks(Core::State state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateWantDeterminism(bool initial)
|
void UpdateWantDeterminism(Core::System& system, bool initial)
|
||||||
{
|
{
|
||||||
// For now, this value is not itself configurable. Instead, individual
|
// For now, this value is not itself configurable. Instead, individual
|
||||||
// settings that depend on it, such as GPU determinism mode. should have
|
// settings that depend on it, such as GPU determinism mode. should have
|
||||||
// override options for testing,
|
// override options for testing,
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
bool new_want_determinism = system.GetMovie().IsMovieActive() || NetPlay::IsNetPlayRunning();
|
bool new_want_determinism = system.GetMovie().IsMovieActive() || NetPlay::IsNetPlayRunning();
|
||||||
if (new_want_determinism != s_wants_determinism || initial)
|
if (new_want_determinism != s_wants_determinism || initial)
|
||||||
{
|
{
|
||||||
@ -1025,7 +1021,7 @@ void UpdateWantDeterminism(bool initial)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueueHostJob(std::function<void()> job, bool run_during_stop)
|
void QueueHostJob(std::function<void(Core::System&)> job, bool run_during_stop)
|
||||||
{
|
{
|
||||||
if (!job)
|
if (!job)
|
||||||
return;
|
return;
|
||||||
@ -1041,7 +1037,7 @@ void QueueHostJob(std::function<void()> job, bool run_during_stop)
|
|||||||
Host_Message(HostMessageID::WMUserJobDispatch);
|
Host_Message(HostMessageID::WMUserJobDispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostDispatchJobs()
|
void HostDispatchJobs(Core::System& system)
|
||||||
{
|
{
|
||||||
// WARNING: This should only run on the Host Thread.
|
// WARNING: This should only run on the Host Thread.
|
||||||
// NOTE: This function is potentially re-entrant. If a job calls
|
// NOTE: This function is potentially re-entrant. If a job calls
|
||||||
@ -1061,7 +1057,7 @@ void HostDispatchJobs()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
guard.unlock();
|
guard.unlock();
|
||||||
job.job();
|
job.job(system);
|
||||||
guard.lock();
|
guard.lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool Init(Core::System& system, std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi);
|
bool Init(Core::System& system, std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi);
|
||||||
void Stop();
|
void Stop(Core::System& system);
|
||||||
void Shutdown();
|
void Shutdown(Core::System& system);
|
||||||
|
|
||||||
void DeclareAsCPUThread();
|
void DeclareAsCPUThread();
|
||||||
void UndeclareAsCPUThread();
|
void UndeclareAsCPUThread();
|
||||||
@ -156,7 +156,7 @@ void SaveScreenShot(std::string_view name);
|
|||||||
void DisplayMessage(std::string message, int time_in_ms);
|
void DisplayMessage(std::string message, int time_in_ms);
|
||||||
|
|
||||||
void FrameUpdateOnCPUThread();
|
void FrameUpdateOnCPUThread();
|
||||||
void OnFrameEnd();
|
void OnFrameEnd(Core::System& system);
|
||||||
|
|
||||||
// Run a function as the CPU thread.
|
// Run a function as the CPU thread.
|
||||||
//
|
//
|
||||||
@ -180,7 +180,7 @@ bool RemoveOnStateChangedCallback(int* handle);
|
|||||||
void CallOnStateChangedCallbacks(Core::State state);
|
void CallOnStateChangedCallbacks(Core::State state);
|
||||||
|
|
||||||
// Run on the Host thread when the factors change. [NOT THREADSAFE]
|
// Run on the Host thread when the factors change. [NOT THREADSAFE]
|
||||||
void UpdateWantDeterminism(bool initial = false);
|
void UpdateWantDeterminism(Core::System& system, bool initial = false);
|
||||||
|
|
||||||
// Queue an arbitrary function to asynchronously run once on the Host thread later.
|
// Queue an arbitrary function to asynchronously run once on the Host thread later.
|
||||||
// Threadsafe. Can be called by any thread, including the Host itself.
|
// Threadsafe. Can be called by any thread, including the Host itself.
|
||||||
@ -191,16 +191,16 @@ void UpdateWantDeterminism(bool initial = false);
|
|||||||
// NOTE: Make sure the jobs check the global state instead of assuming everything is
|
// NOTE: Make sure the jobs check the global state instead of assuming everything is
|
||||||
// still the same as when the job was queued.
|
// still the same as when the job was queued.
|
||||||
// NOTE: Jobs that are not set to run during stop will be discarded instead.
|
// NOTE: Jobs that are not set to run during stop will be discarded instead.
|
||||||
void QueueHostJob(std::function<void()> job, bool run_during_stop = false);
|
void QueueHostJob(std::function<void(Core::System&)> job, bool run_during_stop = false);
|
||||||
|
|
||||||
// Should be called periodically by the Host to run pending jobs.
|
// Should be called periodically by the Host to run pending jobs.
|
||||||
// WMUserJobDispatch will be sent when something is added to the queue.
|
// WMUserJobDispatch will be sent when something is added to the queue.
|
||||||
void HostDispatchJobs();
|
void HostDispatchJobs(Core::System& system);
|
||||||
|
|
||||||
void DoFrameStep();
|
void DoFrameStep();
|
||||||
|
|
||||||
void UpdateInputGate(bool require_focus, bool require_full_focus = false);
|
void UpdateInputGate(bool require_focus, bool require_full_focus = false);
|
||||||
|
|
||||||
void UpdateTitle();
|
void UpdateTitle(Core::System& system);
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@ -841,7 +841,7 @@ void VideoInterfaceManager::EndField(FieldType field, u64 ticks)
|
|||||||
|
|
||||||
g_perf_metrics.CountVBlank();
|
g_perf_metrics.CountVBlank();
|
||||||
VIEndFieldEvent::Trigger();
|
VIEndFieldEvent::Trigger();
|
||||||
Core::OnFrameEnd();
|
Core::OnFrameEnd(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purpose: Send VI interrupt when triggered
|
// Purpose: Send VI interrupt when triggered
|
||||||
|
@ -177,7 +177,7 @@ std::optional<IPCReply> BluetoothRealDevice::Open(const OpenRequest& request)
|
|||||||
"The emulated console will now stop.",
|
"The emulated console will now stop.",
|
||||||
m_last_open_error);
|
m_last_open_error);
|
||||||
}
|
}
|
||||||
Core::QueueHostJob(Core::Stop);
|
Core::QueueHostJob(&Core::Stop);
|
||||||
return IPCReply(IPC_ENOENT);
|
return IPCReply(IPC_ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ bool MovieManager::BeginRecordingInput(const ControllerTypeArray& controllers,
|
|||||||
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&header));
|
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&header));
|
||||||
|
|
||||||
if (Core::IsRunning())
|
if (Core::IsRunning())
|
||||||
Core::UpdateWantDeterminism();
|
Core::UpdateWantDeterminism(m_system);
|
||||||
};
|
};
|
||||||
Core::RunOnCPUThread(start_recording, true);
|
Core::RunOnCPUThread(start_recording, true);
|
||||||
|
|
||||||
@ -958,7 +958,7 @@ bool MovieManager::PlayInput(const std::string& movie_path,
|
|||||||
// Wiimotes cause desync issues if they're not reset before launching the game
|
// Wiimotes cause desync issues if they're not reset before launching the game
|
||||||
Wiimote::ResetAllWiimotes();
|
Wiimote::ResetAllWiimotes();
|
||||||
|
|
||||||
Core::UpdateWantDeterminism();
|
Core::UpdateWantDeterminism(m_system);
|
||||||
|
|
||||||
m_temp_input.resize(recording_file.GetSize() - 256);
|
m_temp_input.resize(recording_file.GetSize() - 256);
|
||||||
recording_file.ReadBytes(m_temp_input.data(), m_temp_input.size());
|
recording_file.ReadBytes(m_temp_input.data(), m_temp_input.size());
|
||||||
@ -1152,7 +1152,7 @@ void MovieManager::LoadInput(const std::string& movie_path)
|
|||||||
if (m_play_mode != PlayMode::Playing)
|
if (m_play_mode != PlayMode::Playing)
|
||||||
{
|
{
|
||||||
m_play_mode = PlayMode::Playing;
|
m_play_mode = PlayMode::Playing;
|
||||||
Core::UpdateWantDeterminism();
|
Core::UpdateWantDeterminism(m_system);
|
||||||
Core::DisplayMessage("Switched to playback", 2000);
|
Core::DisplayMessage("Switched to playback", 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1161,7 +1161,7 @@ void MovieManager::LoadInput(const std::string& movie_path)
|
|||||||
if (m_play_mode != PlayMode::Recording)
|
if (m_play_mode != PlayMode::Recording)
|
||||||
{
|
{
|
||||||
m_play_mode = PlayMode::Recording;
|
m_play_mode = PlayMode::Recording;
|
||||||
Core::UpdateWantDeterminism();
|
Core::UpdateWantDeterminism(m_system);
|
||||||
Core::DisplayMessage("Switched to recording", 2000);
|
Core::DisplayMessage("Switched to recording", 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1355,7 +1355,7 @@ void MovieManager::EndPlayInput(bool cont)
|
|||||||
// delete tmpInput;
|
// delete tmpInput;
|
||||||
// tmpInput = nullptr;
|
// tmpInput = nullptr;
|
||||||
|
|
||||||
Core::QueueHostJob([=] { Core::UpdateWantDeterminism(); });
|
Core::QueueHostJob([](Core::System& system) { Core::UpdateWantDeterminism(system); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,9 +316,9 @@ int main(int argc, char* argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
s_platform->MainLoop();
|
s_platform->MainLoop();
|
||||||
Core::Stop();
|
Core::Stop(Core::System::GetInstance());
|
||||||
|
|
||||||
Core::Shutdown();
|
Core::Shutdown(Core::System::GetInstance());
|
||||||
s_platform.reset();
|
s_platform.reset();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -78,7 +79,7 @@ void PlatformFBDev::MainLoop()
|
|||||||
while (IsRunning())
|
while (IsRunning())
|
||||||
{
|
{
|
||||||
UpdateRunningFlag();
|
UpdateRunningFlag();
|
||||||
Core::HostDispatchJobs();
|
Core::HostDispatchJobs(Core::System::GetInstance());
|
||||||
|
|
||||||
// TODO: Is this sleep appropriate?
|
// TODO: Is this sleep appropriate?
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
#include "Core/System.h"
|
||||||
#include "DolphinNoGUI/Platform.h"
|
#include "DolphinNoGUI/Platform.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -27,7 +29,7 @@ void PlatformHeadless::MainLoop()
|
|||||||
while (m_running.IsSet())
|
while (m_running.IsSet())
|
||||||
{
|
{
|
||||||
UpdateRunningFlag();
|
UpdateRunningFlag();
|
||||||
Core::HostDispatchJobs();
|
Core::HostDispatchJobs(Core::System::GetInstance());
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/System.h"
|
||||||
#include "VideoCommon/Present.h"
|
#include "VideoCommon/Present.h"
|
||||||
#include "VideoCommon/RenderBase.h"
|
#include "VideoCommon/RenderBase.h"
|
||||||
|
|
||||||
@ -225,7 +226,7 @@ void PlatformMacOS::MainLoop()
|
|||||||
while (IsRunning())
|
while (IsRunning())
|
||||||
{
|
{
|
||||||
UpdateRunningFlag();
|
UpdateRunningFlag();
|
||||||
Core::HostDispatchJobs();
|
Core::HostDispatchJobs(Core::System::GetInstance());
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
UpdateWindowPosition();
|
UpdateWindowPosition();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
@ -123,7 +124,7 @@ void PlatformWin32::MainLoop()
|
|||||||
while (IsRunning())
|
while (IsRunning())
|
||||||
{
|
{
|
||||||
UpdateRunningFlag();
|
UpdateRunningFlag();
|
||||||
Core::HostDispatchJobs();
|
Core::HostDispatchJobs(Core::System::GetInstance());
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
UpdateWindowPosition();
|
UpdateWindowPosition();
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ static constexpr auto X_None = None;
|
|||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -151,7 +152,7 @@ void PlatformX11::MainLoop()
|
|||||||
while (IsRunning())
|
while (IsRunning())
|
||||||
{
|
{
|
||||||
UpdateRunningFlag();
|
UpdateRunningFlag();
|
||||||
Core::HostDispatchJobs();
|
Core::HostDispatchJobs(Core::System::GetInstance());
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
UpdateWindowPosition();
|
UpdateWindowPosition();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/DolphinAnalytics.h"
|
#include "Core/DolphinAnalytics.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "DolphinQt/Host.h"
|
#include "DolphinQt/Host.h"
|
||||||
#include "DolphinQt/MainWindow.h"
|
#include "DolphinQt/MainWindow.h"
|
||||||
@ -179,7 +180,7 @@ int main(int argc, char* argv[])
|
|||||||
// Whenever the event loop is about to go to sleep, dispatch the jobs
|
// Whenever the event loop is about to go to sleep, dispatch the jobs
|
||||||
// queued in the Core first.
|
// queued in the Core first.
|
||||||
QObject::connect(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock,
|
QObject::connect(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock,
|
||||||
&app, &Core::HostDispatchJobs);
|
&app, [] { Core::HostDispatchJobs(Core::System::GetInstance()); });
|
||||||
|
|
||||||
std::optional<std::string> save_state_path;
|
std::optional<std::string> save_state_path;
|
||||||
if (options.is_set("save_state"))
|
if (options.is_set("save_state"))
|
||||||
@ -293,7 +294,7 @@ int main(int argc, char* argv[])
|
|||||||
retval = app.exec();
|
retval = app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Shutdown();
|
Core::Shutdown(Core::System::GetInstance());
|
||||||
UICommon::Shutdown();
|
UICommon::Shutdown();
|
||||||
Host::GetInstance()->deleteLater();
|
Host::GetInstance()->deleteLater();
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ bool MainWindow::RequestStop()
|
|||||||
{
|
{
|
||||||
if (!Core::IsRunning())
|
if (!Core::IsRunning())
|
||||||
{
|
{
|
||||||
Core::QueueHostJob([this] { OnStopComplete(); }, true);
|
Core::QueueHostJob([this](Core::System&) { OnStopComplete(); }, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1009,7 +1009,7 @@ bool MainWindow::RequestStop()
|
|||||||
|
|
||||||
void MainWindow::ForceStop()
|
void MainWindow::ForceStop()
|
||||||
{
|
{
|
||||||
Core::Stop();
|
Core::Stop(Core::System::GetInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Reset()
|
void MainWindow::Reset()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user