[Kernel/XMP] Send correct notification when playback controller is changed

- Changed locked into playback_client enumerator
- Changed vague notification name to something more descriptive
This commit is contained in:
Gliniak 2021-11-08 09:24:04 +01:00 committed by Rick Gibbed
parent 1ba4fbec17
commit 20fe7bc4b7
2 changed files with 15 additions and 11 deletions

View File

@ -21,11 +21,11 @@ namespace apps {
XmpApp::XmpApp(KernelState* kernel_state)
: App(kernel_state, 0xFA),
state_(State::kIdle),
disabled_(0),
playback_client_(PlaybackClient::kTitle),
playback_mode_(PlaybackMode::kUnknown),
repeat_mode_(RepeatMode::kUnknown),
unknown_flags_(0),
volume_(0.0f),
volume_(1.0f),
active_playlist_(nullptr),
active_song_index_(0),
next_playlist_handle_(1),
@ -131,9 +131,8 @@ X_HRESULT XmpApp::XMPPlayTitlePlaylist(uint32_t playlist_handle,
playlist = it->second;
}
if (disabled_) {
// Ignored because we aren't enabled?
XELOGW("Ignoring XMPPlayTitlePlaylist because disabled");
if (playback_client_ == PlaybackClient::kSystem) {
XELOGW("XMPPlayTitlePlaylist: System playback is enabled!");
return X_E_SUCCESS;
}
@ -395,7 +394,7 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
struct {
xe::be<uint32_t> xmp_client;
xe::be<uint32_t> controller;
xe::be<uint32_t> locked;
xe::be<uint32_t> playback_client;
}* args = memory_->TranslateVirtual<decltype(args)>(buffer_ptr);
static_assert_size(decltype(*args), 12);
@ -403,10 +402,11 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
(args->xmp_client == 0x00000002 && args->controller == 0x00000000) ||
(args->xmp_client == 0x00000000 && args->controller == 0x00000001));
XELOGD("XMPSetPlaybackController({:08X}, {:08X})",
uint32_t(args->controller), uint32_t(args->locked));
uint32_t(args->controller), uint32_t(args->playback_client));
disabled_ = args->locked;
kernel_state_->BroadcastNotification(kMsgDisableChanged, disabled_);
playback_client_ = PlaybackClient(uint32_t(args->playback_client));
kernel_state_->BroadcastNotification(kMsgPlaybackControllerChanged,
!args->playback_client);
return X_E_SUCCESS;
}
case 0x0007001B: {

View File

@ -34,6 +34,10 @@ class XmpApp : public App {
kPlaying = 1,
kPaused = 2,
};
enum class PlaybackClient : uint32_t {
kSystem = 0,
kTitle = 1,
};
enum class PlaybackMode : uint32_t {
// kInOrder = ?,
kUnknown = 0,
@ -90,12 +94,12 @@ class XmpApp : public App {
private:
static const uint32_t kMsgStateChanged = 0x0A000001;
static const uint32_t kMsgPlaybackBehaviorChanged = 0x0A000002;
static const uint32_t kMsgDisableChanged = 0x0A000003;
static const uint32_t kMsgPlaybackControllerChanged = 0x0A000003;
void OnStateChanged();
State state_;
uint32_t disabled_;
PlaybackClient playback_client_;
PlaybackMode playback_mode_;
RepeatMode repeat_mode_;
uint32_t unknown_flags_;