From a9f587199abb1a4eee5336dd59e81cd3eeea8ec9 Mon Sep 17 00:00:00 2001 From: Cancerous Date: Thu, 9 Jan 2020 03:25:15 -0500 Subject: [PATCH] [Kernel] - Try to shut down XMP so games won't spam it's functions --- src/xenia/kernel/xam/apps/xmp_app.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xenia/kernel/xam/apps/xmp_app.cc b/src/xenia/kernel/xam/apps/xmp_app.cc index ec02f6acf..2433924be 100644 --- a/src/xenia/kernel/xam/apps/xmp_app.cc +++ b/src/xenia/kernel/xam/apps/xmp_app.cc @@ -20,7 +20,7 @@ namespace apps { XmpApp::XmpApp(KernelState* kernel_state) : App(kernel_state, 0xFA), state_(State::kIdle), - disabled_(0), + disabled_(1), playback_mode_(PlaybackMode::kUnknown), repeat_mode_(RepeatMode::kUnknown), unknown_flags_(0), @@ -38,7 +38,7 @@ X_RESULT XmpApp::XMPGetStatus(uint32_t state_ptr) { XELOGD("XMPGetStatus(%.8X)", state_ptr); xe::store_and_swap(memory_->TranslateVirtual(state_ptr), static_cast(state_)); - return X_ERROR_SUCCESS; + return X_ERROR_ACCESS_DENIED; } X_RESULT XmpApp::XMPCreateTitlePlaylist(uint32_t songs_ptr, uint32_t song_count, @@ -206,6 +206,9 @@ void XmpApp::OnStateChanged() { X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, uint32_t buffer_length) { + // Some stupid games will hammer this on a thread - induce a delay + // here to keep from starving real threads. + xe::threading::Sleep(std::chrono::milliseconds(1)); // NOTE: buffer_length may be zero or valid. auto buffer = memory_->TranslateVirtual(buffer_ptr); switch (message) { @@ -398,7 +401,7 @@ X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, 0); // Atrain spawns a thread 82437FD0 to call this in a tight loop forever. - xe::threading::Sleep(std::chrono::milliseconds(10)); + // xe::threading::Sleep(std::chrono::milliseconds(10)); return X_ERROR_SUCCESS; } case 0x00070029: {