[Kernel] Document XMP[G/S]etPlaybackController

This commit is contained in:
DrChat 2018-02-16 18:34:13 -06:00
parent 22929182e6
commit 766974c30a
1 changed files with 39 additions and 23 deletions

View File

@ -268,12 +268,15 @@ X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
} }
case 0x0007000B: { case 0x0007000B: {
assert_true(!buffer_length || buffer_length == 8); assert_true(!buffer_length || buffer_length == 8);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0); struct {
uint32_t float_ptr = xe::load_and_swap<uint32_t>( xe::be<uint32_t> xmp_client;
buffer + 4); // out ptr to 4b - floating point xe::be<uint32_t> volume_ptr;
assert_true(xmp_client == 0x00000002); }* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
XELOGD("XMPGetVolume(%.8X)", float_ptr);
xe::store_and_swap<float>(memory_->TranslateVirtual(float_ptr), volume_); assert_true(args->xmp_client == 0x00000002);
XELOGD("XMPGetVolume(%.8X)", uint32_t(args->volume_ptr));
xe::store_and_swap<float>(memory_->TranslateVirtual(args->volume_ptr),
volume_);
return X_ERROR_SUCCESS; return X_ERROR_SUCCESS;
} }
case 0x0007000C: { case 0x0007000C: {
@ -349,14 +352,20 @@ X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return XMPDeleteTitlePlaylist(playlist_handle); return XMPDeleteTitlePlaylist(playlist_handle);
} }
case 0x0007001A: { case 0x0007001A: {
// XMPSetPlaybackController
assert_true(!buffer_length || buffer_length == 12); assert_true(!buffer_length || buffer_length == 12);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0); struct {
uint32_t unk1 = xe::load_and_swap<uint32_t>(buffer + 4); xe::be<uint32_t> xmp_client;
uint32_t enabled = xe::load_and_swap<uint32_t>(buffer + 8); xe::be<uint32_t> controller;
assert_true(xmp_client == 0x00000002); xe::be<uint32_t> locked;
assert_zero(unk1); }* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
XELOGD("XMPSetEnabled(%.8X, %.8X)", unk1, enabled);
disabled_ = enabled; assert_true(args->xmp_client == 0x00000002);
assert_true(args->controller == 0x00000000);
XELOGD("XMPSetPlaybackController(%.8X, %.8X)", uint32_t(args->controller),
uint32_t(args->locked));
disabled_ = args->locked;
if (disabled_) { if (disabled_) {
XMPStop(0); XMPStop(0);
} }
@ -364,22 +373,29 @@ X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return X_ERROR_SUCCESS; return X_ERROR_SUCCESS;
} }
case 0x0007001B: { case 0x0007001B: {
// XMPGetPlaybackController
assert_true(!buffer_length || buffer_length == 12); assert_true(!buffer_length || buffer_length == 12);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0); struct {
uint32_t unk_ptr = xe::be<uint32_t> xmp_client;
xe::load_and_swap<uint32_t>(buffer + 4); // out ptr to 4b - expect 0 xe::be<uint32_t> controller_ptr;
uint32_t disabled_ptr = xe::load_and_swap<uint32_t>( xe::be<uint32_t> locked_ptr;
buffer + 8); // out ptr to 4b - expect 1 (to skip) }* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
assert_true(xmp_client == 0x00000002);
XELOGD("XMPGetEnabled(%.8X, %.8X)", unk_ptr, disabled_ptr); assert_true(args->xmp_client == 0x00000002);
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(unk_ptr), 0); XELOGD("XMPGetPlaybackController(%.8X, %.8X, %.8X)",
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(disabled_ptr), uint32_t(args->xmp_client), uint32_t(args->controller_ptr),
disabled_); uint32_t(args->locked_ptr));
xe::store_and_swap<uint32_t>(
memory_->TranslateVirtual(args->controller_ptr), 0);
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(args->locked_ptr),
0);
// Atrain spawns a thread 82437FD0 to call this in a tight loop forever. // 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; return X_ERROR_SUCCESS;
} }
case 0x00070029: { case 0x00070029: {
// XMPGetPlaybackBehavior
assert_true(!buffer_length || buffer_length == 16); assert_true(!buffer_length || buffer_length == 16);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0); uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
uint32_t playback_mode_ptr = xe::load_and_swap<uint32_t>(buffer + 4); uint32_t playback_mode_ptr = xe::load_and_swap<uint32_t>(buffer + 4);