System: Required changes for Android

pull/3357/head
Stenzek 1 month ago
parent e1cbb50c64
commit 9b8d2a88de
No known key found for this signature in database

@ -433,6 +433,7 @@ bool GPUThread::SleepGPUThread(bool allow_sleep)
void GPUThread::Internal::GPUThreadEntryPoint() void GPUThread::Internal::GPUThreadEntryPoint()
{ {
s_state.gpu_thread = Threading::ThreadHandle::GetForCallingThread(); s_state.gpu_thread = Threading::ThreadHandle::GetForCallingThread();
std::atomic_thread_fence(std::memory_order_release);
// Take a local copy of the FIFO, that way it's not ping-ponging between the threads. // Take a local copy of the FIFO, that way it's not ping-ponging between the threads.
u8* const command_fifo_data = s_state.command_fifo_data.get(); u8* const command_fifo_data = s_state.command_fifo_data.get();
@ -521,6 +522,8 @@ void GPUThread::Internal::GPUThreadEntryPoint()
s_state.command_fifo_read_ptr.store(read_ptr, std::memory_order_release); s_state.command_fifo_read_ptr.store(read_ptr, std::memory_order_release);
} }
s_state.gpu_thread = {};
} }
void GPUThread::Internal::DoRunIdle() void GPUThread::Internal::DoRunIdle()

@ -514,13 +514,14 @@ bool System::CPUThreadInitialize(Error* error, u32 async_worker_thread_count)
} }
#endif #endif
s_state.cpu_thread_handle = Threading::ThreadHandle::GetForCallingThread();
s_state.async_task_queue.SetWorkerCount(async_worker_thread_count);
// This will call back to Host::LoadSettings() -> ReloadSources(). // This will call back to Host::LoadSettings() -> ReloadSources().
LoadSettings(false); LoadSettings(false);
LogStartupInformation(); LogStartupInformation();
s_state.async_task_queue.SetWorkerCount(async_worker_thread_count);
GPUThread::Internal::ProcessStartup(); GPUThread::Internal::ProcessStartup();
if (g_settings.achievements_enabled) if (g_settings.achievements_enabled)
@ -545,6 +546,7 @@ void System::CPUThreadShutdown()
InputManager::CloseSources(); InputManager::CloseSources();
s_state.async_task_queue.SetWorkerCount(0); s_state.async_task_queue.SetWorkerCount(0);
s_state.cpu_thread_handle = {};
#ifdef _WIN32 #ifdef _WIN32
CoUninitialize(); CoUninitialize();
@ -556,6 +558,11 @@ const Threading::ThreadHandle& System::GetCPUThreadHandle()
return s_state.cpu_thread_handle; return s_state.cpu_thread_handle;
} }
void System::SetCPUThreadHandle(Threading::ThreadHandle handle)
{
s_state.cpu_thread_handle = std::move(handle);
}
void System::IdlePollUpdate() void System::IdlePollUpdate()
{ {
InputManager::PollSources(); InputManager::PollSources();
@ -1930,8 +1937,6 @@ bool System::Initialize(std::unique_ptr<CDImage> disc, DiscRegion disc_region, b
SIO::Initialize(); SIO::Initialize();
PCDrv::Initialize(); PCDrv::Initialize();
s_state.cpu_thread_handle = Threading::ThreadHandle::GetForCallingThread();
UpdateGTEAspectRatio(); UpdateGTEAspectRatio();
UpdateThrottlePeriod(); UpdateThrottlePeriod();
UpdateMemorySaveStateSettings(); UpdateMemorySaveStateSettings();
@ -4230,17 +4235,13 @@ bool System::CheckForRequiredSubQ(Error* error)
return true; return true;
} }
} }
#ifndef __ANDROID__
Error::SetStringFmt( Error::SetStringFmt(
error, error,
TRANSLATE_FS("System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n{0}: " TRANSLATE_FS("System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n{0}: "
"{1}\n\nYour dump is incomplete, you must add the SBI file to run this game. \n\nThe " "{1}\n\nYour dump is incomplete, you must add the SBI file to run this game. \n\nThe "
"name of the SBI file must match the name of the disc image."), "name of the SBI file must match the name of the disc image."),
s_state.running_game_serial, s_state.running_game_title); s_state.running_game_serial, s_state.running_game_title);
#else
// Shorter because no confirm messages.
Error::SetStringView(error, "The selected game requires a SBI file to run properly.");
#endif
return false; return false;
} }

@ -71,6 +71,9 @@ void CPUThreadShutdown();
/// Returns a handle to the CPU thread. /// Returns a handle to the CPU thread.
const Threading::ThreadHandle& GetCPUThreadHandle(); const Threading::ThreadHandle& GetCPUThreadHandle();
/// Changes the CPU thread handle, use with care.
void SetCPUThreadHandle(Threading::ThreadHandle handle);
/// Polls input, updates subsystems which are present while paused/inactive. /// Polls input, updates subsystems which are present while paused/inactive.
void IdlePollUpdate(); void IdlePollUpdate();

Loading…
Cancel
Save