[XAM/XNOTIFY] - Fixes and more flags
- Properly set is_system in XamNotifyCreateListener - Save is_system for later use - Correct X_NOTIFICATION_ID - Add missing XNotificationID flags
This commit is contained in:
committed by
Radosław Gliński
parent
73e3caa5e1
commit
a6e92f43ea
@@ -10,7 +10,9 @@
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_threading.h"
|
||||
#include "xenia/kernel/xnotifylistener.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -27,7 +29,7 @@ uint32_t xeXamNotifyCreateListener(uint64_t mask, uint32_t is_system,
|
||||
|
||||
auto listener =
|
||||
object_ref<XNotifyListener>(new XNotifyListener(kernel_state()));
|
||||
listener->Initialize(mask, max_version);
|
||||
listener->Initialize(mask, is_system, max_version);
|
||||
|
||||
// Handle ref is incremented, so return that.
|
||||
uint32_t handle = listener->handle();
|
||||
@@ -37,7 +39,10 @@ uint32_t xeXamNotifyCreateListener(uint64_t mask, uint32_t is_system,
|
||||
|
||||
dword_result_t XamNotifyCreateListener_entry(qword_t mask,
|
||||
dword_t max_version) {
|
||||
return xeXamNotifyCreateListener(mask, 0, max_version);
|
||||
auto thread = kernel::XThread::GetCurrentThread();
|
||||
auto ctx = thread->thread_state()->context();
|
||||
auto type = xboxkrnl::xeKeGetCurrentProcessType(ctx);
|
||||
return xeXamNotifyCreateListener(mask, type == 2, max_version);
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(XamNotifyCreateListener, kNone, kImplemented);
|
||||
|
||||
|
||||
@@ -22,12 +22,14 @@ XNotifyListener::XNotifyListener(KernelState* kernel_state)
|
||||
|
||||
XNotifyListener::~XNotifyListener() {}
|
||||
|
||||
void XNotifyListener::Initialize(uint64_t mask, uint32_t max_version) {
|
||||
void XNotifyListener::Initialize(uint64_t mask, uint32_t is_system,
|
||||
uint32_t max_version) {
|
||||
assert_false(wait_handle_);
|
||||
|
||||
wait_handle_ = xe::threading::Event::CreateManualResetEvent(false);
|
||||
assert_not_null(wait_handle_);
|
||||
mask_ = mask;
|
||||
is_system_ = is_system;
|
||||
max_version_ = max_version;
|
||||
|
||||
kernel_state_->RegisterNotifyListener(this);
|
||||
@@ -109,8 +111,9 @@ object_ref<XNotifyListener> XNotifyListener::Restore(KernelState* kernel_state,
|
||||
notify->RestoreObject(stream);
|
||||
|
||||
auto mask = stream->Read<uint64_t>();
|
||||
auto is_system = stream->Read<uint32_t>();
|
||||
auto max_version = stream->Read<uint32_t>();
|
||||
notify->Initialize(mask, max_version);
|
||||
notify->Initialize(mask, is_system, max_version);
|
||||
|
||||
auto notification_count_ = stream->Read<size_t>();
|
||||
for (size_t i = 0; i < notification_count_; i++) {
|
||||
|
||||
@@ -48,9 +48,10 @@ class XNotifyListener : public XObject {
|
||||
~XNotifyListener() override;
|
||||
|
||||
uint64_t mask() const { return mask_; }
|
||||
uint32_t is_system() const { return is_system_; }
|
||||
uint32_t max_version() const { return max_version_; }
|
||||
|
||||
void Initialize(uint64_t mask, uint32_t max_version);
|
||||
void Initialize(uint64_t mask, uint32_t is_system, uint32_t max_version);
|
||||
|
||||
void EnqueueNotification(XNotificationID id, uint32_t data);
|
||||
bool DequeueNotification(XNotificationID* out_id, uint32_t* out_data);
|
||||
@@ -70,6 +71,7 @@ class XNotifyListener : public XObject {
|
||||
xe::global_critical_region global_critical_region_;
|
||||
std::vector<std::pair<XNotificationID, uint32_t>> notifications_;
|
||||
uint64_t mask_ = 0;
|
||||
uint32_t is_system_ = 0;
|
||||
uint32_t max_version_ = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user