[Kernel] Notification ID Changes
Based off of pull request xenia-project#2047. Convert magic numbers numbers to enum to improve readability. Includes currently unused one for future use.
This commit is contained in:
committed by
Radosław Gliński
parent
5f5be06680
commit
0deafaf9f9
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -142,7 +143,8 @@ X_HRESULT XmpApp::XMPPlayTitlePlaylist(uint32_t playlist_handle,
|
||||
active_song_index_ = 0;
|
||||
state_ = State::kPlaying;
|
||||
OnStateChanged();
|
||||
kernel_state_->BroadcastNotification(kMsgPlaybackBehaviorChanged, 1);
|
||||
kernel_state_->BroadcastNotification(kNotificationXmpPlaybackBehaviorChanged,
|
||||
1);
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -202,7 +204,7 @@ X_HRESULT XmpApp::XMPPrevious() {
|
||||
}
|
||||
|
||||
void XmpApp::OnStateChanged() {
|
||||
kernel_state_->BroadcastNotification(kMsgStateChanged,
|
||||
kernel_state_->BroadcastNotification(kNotificationXmpStateChanged,
|
||||
static_cast<uint32_t>(state_));
|
||||
}
|
||||
|
||||
@@ -270,7 +272,8 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
playback_mode_ = static_cast<PlaybackMode>(uint32_t(args->playback_mode));
|
||||
repeat_mode_ = static_cast<RepeatMode>(uint32_t(args->repeat_mode));
|
||||
unknown_flags_ = args->flags;
|
||||
kernel_state_->BroadcastNotification(kMsgPlaybackBehaviorChanged, 0);
|
||||
kernel_state_->BroadcastNotification(
|
||||
kNotificationXmpPlaybackBehaviorChanged, 0);
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
case 0x00070009: {
|
||||
@@ -405,8 +408,8 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
uint32_t(args->controller), uint32_t(args->playback_client));
|
||||
|
||||
playback_client_ = PlaybackClient(uint32_t(args->playback_client));
|
||||
kernel_state_->BroadcastNotification(kMsgPlaybackControllerChanged,
|
||||
!args->playback_client);
|
||||
kernel_state_->BroadcastNotification(
|
||||
kNotificationXmpPlaybackControllerChanged, !args->playback_client);
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
case 0x0007001B: {
|
||||
|
||||
@@ -92,10 +92,6 @@ class XmpApp : public App {
|
||||
uint32_t buffer_length) override;
|
||||
|
||||
private:
|
||||
static const uint32_t kMsgStateChanged = 0x0A000001;
|
||||
static const uint32_t kMsgPlaybackBehaviorChanged = 0x0A000002;
|
||||
static const uint32_t kMsgPlaybackControllerChanged = 0x0A000003;
|
||||
|
||||
void OnStateChanged();
|
||||
|
||||
State state_;
|
||||
|
||||
@@ -79,7 +79,7 @@ X_RESULT xeXamDispatchDialog(T* dialog,
|
||||
uint32_t overlapped) {
|
||||
auto pre = []() {
|
||||
// Broadcast XN_SYS_UI = true
|
||||
kernel_state()->BroadcastNotification(0x9, true);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
|
||||
};
|
||||
auto run = [dialog, close_callback]() -> X_RESULT {
|
||||
X_RESULT result;
|
||||
@@ -103,7 +103,7 @@ X_RESULT xeXamDispatchDialog(T* dialog,
|
||||
auto post = []() {
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
// Broadcast XN_SYS_UI = false
|
||||
kernel_state()->BroadcastNotification(0x9, false);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||
};
|
||||
if (!overlapped) {
|
||||
pre();
|
||||
@@ -122,7 +122,7 @@ X_RESULT xeXamDispatchDialogEx(
|
||||
uint32_t overlapped) {
|
||||
auto pre = []() {
|
||||
// Broadcast XN_SYS_UI = true
|
||||
kernel_state()->BroadcastNotification(0x9, true);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
|
||||
};
|
||||
auto run = [dialog, close_callback](uint32_t& extended_error,
|
||||
uint32_t& length) -> X_RESULT {
|
||||
@@ -147,7 +147,7 @@ X_RESULT xeXamDispatchDialogEx(
|
||||
auto post = []() {
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
// Broadcast XN_SYS_UI = false
|
||||
kernel_state()->BroadcastNotification(0x9, false);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||
};
|
||||
if (!overlapped) {
|
||||
pre();
|
||||
@@ -166,12 +166,12 @@ X_RESULT xeXamDispatchHeadless(std::function<X_RESULT()> run_callback,
|
||||
uint32_t overlapped) {
|
||||
auto pre = []() {
|
||||
// Broadcast XN_SYS_UI = true
|
||||
kernel_state()->BroadcastNotification(0x9, true);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
|
||||
};
|
||||
auto post = []() {
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
// Broadcast XN_SYS_UI = false
|
||||
kernel_state()->BroadcastNotification(0x9, false);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||
};
|
||||
if (!overlapped) {
|
||||
pre();
|
||||
@@ -190,12 +190,12 @@ X_RESULT xeXamDispatchHeadlessEx(
|
||||
uint32_t overlapped) {
|
||||
auto pre = []() {
|
||||
// Broadcast XN_SYS_UI = true
|
||||
kernel_state()->BroadcastNotification(0x9, true);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
|
||||
};
|
||||
auto post = []() {
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
// Broadcast XN_SYS_UI = false
|
||||
kernel_state()->BroadcastNotification(0x9, false);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||
};
|
||||
if (!overlapped) {
|
||||
pre();
|
||||
@@ -215,7 +215,7 @@ template <typename T>
|
||||
X_RESULT xeXamDispatchDialogAsync(T* dialog,
|
||||
std::function<void(T*)> close_callback) {
|
||||
// Broadcast XN_SYS_UI = true
|
||||
kernel_state()->BroadcastNotification(0x9, true);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
|
||||
++xam_dialogs_shown_;
|
||||
|
||||
// Important to pass captured vars by value here since we return from this
|
||||
@@ -229,7 +229,7 @@ X_RESULT xeXamDispatchDialogAsync(T* dialog,
|
||||
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
// Broadcast XN_SYS_UI = false
|
||||
kernel_state()->BroadcastNotification(0x9, false);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||
});
|
||||
|
||||
return X_ERROR_SUCCESS;
|
||||
@@ -237,7 +237,7 @@ X_RESULT xeXamDispatchDialogAsync(T* dialog,
|
||||
|
||||
X_RESULT xeXamDispatchHeadlessAsync(std::function<void()> run_callback) {
|
||||
// Broadcast XN_SYS_UI = true
|
||||
kernel_state()->BroadcastNotification(0x9, true);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
|
||||
++xam_dialogs_shown_;
|
||||
|
||||
auto display_window = kernel_state()->emulator()->display_window();
|
||||
@@ -248,7 +248,7 @@ X_RESULT xeXamDispatchHeadlessAsync(std::function<void()> run_callback) {
|
||||
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
// Broadcast XN_SYS_UI = false
|
||||
kernel_state()->BroadcastNotification(0x9, false);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
|
||||
});
|
||||
|
||||
return X_ERROR_SUCCESS;
|
||||
@@ -696,8 +696,8 @@ dword_result_t XamShowMarketplaceUI_entry(dword_t user_index, dword_t ui_type,
|
||||
if (button == 0) {
|
||||
cvars::license_mask = 1;
|
||||
|
||||
// XN_LIVE_CONTENT_INSTALLED
|
||||
kernel_state()->BroadcastNotification(0x2000007, 0);
|
||||
kernel_state()->BroadcastNotification(
|
||||
kXNotificationIDLiveContentInstalled, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -544,7 +544,7 @@ DECLARE_XAM_EXPORT1(XamUserAreUsersFriends, kUserProfiles, kStub);
|
||||
|
||||
dword_result_t XamShowSigninUI_entry(dword_t users_needed, dword_t unk_mask) {
|
||||
// XN_SYS_UI (on)
|
||||
kernel_state()->BroadcastNotification(0x00000009, 1);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, 1);
|
||||
kernel_state()->UpdateUsedUserProfiles();
|
||||
// Mask values vary. Probably matching user types? Local/remote?
|
||||
// Games seem to sit and loop until we trigger this notification:
|
||||
@@ -560,10 +560,11 @@ dword_result_t XamShowSigninUI_entry(dword_t users_needed, dword_t unk_mask) {
|
||||
}
|
||||
|
||||
// XN_SYS_SIGNINCHANGED (players)
|
||||
kernel_state()->BroadcastNotification(0xA, user_mask);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemSignInChanged,
|
||||
user_mask);
|
||||
|
||||
// XN_SYS_UI (off)
|
||||
kernel_state()->BroadcastNotification(0x00000009, 0);
|
||||
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, 0);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamShowSigninUI, kUserProfiles, kStub);
|
||||
|
||||
Reference in New Issue
Block a user