[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: {
assert_true(!buffer_length || buffer_length == 8);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
uint32_t float_ptr = xe::load_and_swap<uint32_t>(
buffer + 4); // out ptr to 4b - floating point
assert_true(xmp_client == 0x00000002);
XELOGD("XMPGetVolume(%.8X)", float_ptr);
xe::store_and_swap<float>(memory_->TranslateVirtual(float_ptr), volume_);
struct {
xe::be<uint32_t> xmp_client;
xe::be<uint32_t> volume_ptr;
}* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
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;
}
case 0x0007000C: {
@ -349,14 +352,20 @@ X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return XMPDeleteTitlePlaylist(playlist_handle);
}
case 0x0007001A: {
// XMPSetPlaybackController
assert_true(!buffer_length || buffer_length == 12);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
uint32_t unk1 = xe::load_and_swap<uint32_t>(buffer + 4);
uint32_t enabled = xe::load_and_swap<uint32_t>(buffer + 8);
assert_true(xmp_client == 0x00000002);
assert_zero(unk1);
XELOGD("XMPSetEnabled(%.8X, %.8X)", unk1, enabled);
disabled_ = enabled;
struct {
xe::be<uint32_t> xmp_client;
xe::be<uint32_t> controller;
xe::be<uint32_t> locked;
}* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
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_) {
XMPStop(0);
}
@ -364,22 +373,29 @@ X_RESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return X_ERROR_SUCCESS;
}
case 0x0007001B: {
// XMPGetPlaybackController
assert_true(!buffer_length || buffer_length == 12);
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
uint32_t unk_ptr =
xe::load_and_swap<uint32_t>(buffer + 4); // out ptr to 4b - expect 0
uint32_t disabled_ptr = xe::load_and_swap<uint32_t>(
buffer + 8); // out ptr to 4b - expect 1 (to skip)
assert_true(xmp_client == 0x00000002);
XELOGD("XMPGetEnabled(%.8X, %.8X)", unk_ptr, disabled_ptr);
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(unk_ptr), 0);
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(disabled_ptr),
disabled_);
struct {
xe::be<uint32_t> xmp_client;
xe::be<uint32_t> controller_ptr;
xe::be<uint32_t> locked_ptr;
}* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
assert_true(args->xmp_client == 0x00000002);
XELOGD("XMPGetPlaybackController(%.8X, %.8X, %.8X)",
uint32_t(args->xmp_client), uint32_t(args->controller_ptr),
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.
xe::threading::Sleep(std::chrono::milliseconds(10));
return X_ERROR_SUCCESS;
}
case 0x00070029: {
// XMPGetPlaybackBehavior
assert_true(!buffer_length || buffer_length == 16);
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);