[Kernel] Rename NotifyListener to XNotifyListener to bring it in line with the naming scheme of kernel objects.
This commit is contained in:
parent
e38be4c294
commit
0d6bfc1a6b
|
@ -19,13 +19,13 @@
|
||||||
#include "xenia/base/string.h"
|
#include "xenia/base/string.h"
|
||||||
#include "xenia/cpu/processor.h"
|
#include "xenia/cpu/processor.h"
|
||||||
#include "xenia/emulator.h"
|
#include "xenia/emulator.h"
|
||||||
#include "xenia/kernel/notify_listener.h"
|
|
||||||
#include "xenia/kernel/user_module.h"
|
#include "xenia/kernel/user_module.h"
|
||||||
#include "xenia/kernel/util/shim_utils.h"
|
#include "xenia/kernel/util/shim_utils.h"
|
||||||
#include "xenia/kernel/xam/xam_module.h"
|
#include "xenia/kernel/xam/xam_module.h"
|
||||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
#include "xenia/kernel/xboxkrnl/xboxkrnl_module.h"
|
||||||
#include "xenia/kernel/xevent.h"
|
#include "xenia/kernel/xevent.h"
|
||||||
#include "xenia/kernel/xmodule.h"
|
#include "xenia/kernel/xmodule.h"
|
||||||
|
#include "xenia/kernel/xnotifylistener.h"
|
||||||
#include "xenia/kernel/xobject.h"
|
#include "xenia/kernel/xobject.h"
|
||||||
#include "xenia/kernel/xthread.h"
|
#include "xenia/kernel/xthread.h"
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ object_ref<XThread> KernelState::GetThreadByID(uint32_t thread_id) {
|
||||||
return retain_object(thread);
|
return retain_object(thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelState::RegisterNotifyListener(NotifyListener* listener) {
|
void KernelState::RegisterNotifyListener(XNotifyListener* listener) {
|
||||||
auto global_lock = global_critical_region_.Acquire();
|
auto global_lock = global_critical_region_.Acquire();
|
||||||
notify_listeners_.push_back(retain_object(listener));
|
notify_listeners_.push_back(retain_object(listener));
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ void KernelState::RegisterNotifyListener(NotifyListener* listener) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelState::UnregisterNotifyListener(NotifyListener* listener) {
|
void KernelState::UnregisterNotifyListener(XNotifyListener* listener) {
|
||||||
auto global_lock = global_critical_region_.Acquire();
|
auto global_lock = global_critical_region_.Acquire();
|
||||||
for (auto it = notify_listeners_.begin(); it != notify_listeners_.end();
|
for (auto it = notify_listeners_.begin(); it != notify_listeners_.end();
|
||||||
++it) {
|
++it) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Dispatcher;
|
||||||
class XHostThread;
|
class XHostThread;
|
||||||
class KernelModule;
|
class KernelModule;
|
||||||
class XModule;
|
class XModule;
|
||||||
class NotifyListener;
|
class XNotifyListener;
|
||||||
class XThread;
|
class XThread;
|
||||||
class UserModule;
|
class UserModule;
|
||||||
|
|
||||||
|
@ -158,8 +158,8 @@ class KernelState {
|
||||||
void OnThreadExit(XThread* thread);
|
void OnThreadExit(XThread* thread);
|
||||||
object_ref<XThread> GetThreadByID(uint32_t thread_id);
|
object_ref<XThread> GetThreadByID(uint32_t thread_id);
|
||||||
|
|
||||||
void RegisterNotifyListener(NotifyListener* listener);
|
void RegisterNotifyListener(XNotifyListener* listener);
|
||||||
void UnregisterNotifyListener(NotifyListener* listener);
|
void UnregisterNotifyListener(XNotifyListener* listener);
|
||||||
void BroadcastNotification(XNotificationID id, uint32_t data);
|
void BroadcastNotification(XNotificationID id, uint32_t data);
|
||||||
|
|
||||||
util::NativeList* dpc_list() { return &dpc_list_; }
|
util::NativeList* dpc_list() { return &dpc_list_; }
|
||||||
|
@ -196,7 +196,7 @@ class KernelState {
|
||||||
// Must be guarded by the global critical region.
|
// Must be guarded by the global critical region.
|
||||||
util::ObjectTable object_table_;
|
util::ObjectTable object_table_;
|
||||||
std::unordered_map<uint32_t, XThread*> threads_by_id_;
|
std::unordered_map<uint32_t, XThread*> threads_by_id_;
|
||||||
std::vector<object_ref<NotifyListener>> notify_listeners_;
|
std::vector<object_ref<XNotifyListener>> notify_listeners_;
|
||||||
bool has_notified_startup_ = false;
|
bool has_notified_startup_ = false;
|
||||||
|
|
||||||
uint32_t process_type_ = X_PROCTYPE_USER;
|
uint32_t process_type_ = X_PROCTYPE_USER;
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
#include "xenia/base/logging.h"
|
#include "xenia/base/logging.h"
|
||||||
#include "xenia/kernel/kernel_state.h"
|
#include "xenia/kernel/kernel_state.h"
|
||||||
#include "xenia/kernel/notify_listener.h"
|
|
||||||
#include "xenia/kernel/util/shim_utils.h"
|
#include "xenia/kernel/util/shim_utils.h"
|
||||||
#include "xenia/kernel/xam/xam_private.h"
|
#include "xenia/kernel/xam/xam_private.h"
|
||||||
|
#include "xenia/kernel/xnotifylistener.h"
|
||||||
#include "xenia/xbox.h"
|
#include "xenia/xbox.h"
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
|
@ -23,7 +23,7 @@ dword_result_t XamNotifyCreateListenerInternal(qword_t mask, dword_t unk,
|
||||||
// r4=1 may indicate user process?
|
// r4=1 may indicate user process?
|
||||||
|
|
||||||
auto listener =
|
auto listener =
|
||||||
object_ref<NotifyListener>(new NotifyListener(kernel_state()));
|
object_ref<XNotifyListener>(new XNotifyListener(kernel_state()));
|
||||||
listener->Initialize(mask);
|
listener->Initialize(mask);
|
||||||
|
|
||||||
// Handle ref is incremented, so return that.
|
// Handle ref is incremented, so return that.
|
||||||
|
@ -48,7 +48,7 @@ dword_result_t XNotifyGetNext(dword_t handle, dword_t match_id,
|
||||||
|
|
||||||
// Grab listener.
|
// Grab listener.
|
||||||
auto listener =
|
auto listener =
|
||||||
kernel_state()->object_table()->LookupObject<NotifyListener>(handle);
|
kernel_state()->object_table()->LookupObject<XNotifyListener>(handle);
|
||||||
if (!listener) {
|
if (!listener) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xenia/kernel/notify_listener.h"
|
#include "xenia/kernel/xnotifylistener.h"
|
||||||
|
|
||||||
#include "xenia/base/byte_stream.h"
|
#include "xenia/base/byte_stream.h"
|
||||||
#include "xenia/kernel/kernel_state.h"
|
#include "xenia/kernel/kernel_state.h"
|
||||||
|
@ -15,12 +15,12 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
NotifyListener::NotifyListener(KernelState* kernel_state)
|
XNotifyListener::XNotifyListener(KernelState* kernel_state)
|
||||||
: XObject(kernel_state, kTypeNotifyListener) {}
|
: XObject(kernel_state, kTypeNotifyListener) {}
|
||||||
|
|
||||||
NotifyListener::~NotifyListener() {}
|
XNotifyListener::~XNotifyListener() {}
|
||||||
|
|
||||||
void NotifyListener::Initialize(uint64_t mask) {
|
void XNotifyListener::Initialize(uint64_t mask) {
|
||||||
assert_false(wait_handle_);
|
assert_false(wait_handle_);
|
||||||
|
|
||||||
wait_handle_ = xe::threading::Event::CreateManualResetEvent(false);
|
wait_handle_ = xe::threading::Event::CreateManualResetEvent(false);
|
||||||
|
@ -29,7 +29,7 @@ void NotifyListener::Initialize(uint64_t mask) {
|
||||||
kernel_state_->RegisterNotifyListener(this);
|
kernel_state_->RegisterNotifyListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
|
void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
|
||||||
// Ignore if the notification doesn't match our mask.
|
// Ignore if the notification doesn't match our mask.
|
||||||
if ((mask_ & uint64_t(1ULL << (id >> 25))) == 0) {
|
if ((mask_ & uint64_t(1ULL << (id >> 25))) == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -47,7 +47,7 @@ void NotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) {
|
||||||
wait_handle_->Set();
|
wait_handle_->Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotifyListener::DequeueNotification(XNotificationID* out_id,
|
bool XNotifyListener::DequeueNotification(XNotificationID* out_id,
|
||||||
uint32_t* out_data) {
|
uint32_t* out_data) {
|
||||||
auto global_lock = global_critical_region_.Acquire();
|
auto global_lock = global_critical_region_.Acquire();
|
||||||
bool dequeued = false;
|
bool dequeued = false;
|
||||||
|
@ -65,7 +65,7 @@ bool NotifyListener::DequeueNotification(XNotificationID* out_id,
|
||||||
return dequeued;
|
return dequeued;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotifyListener::DequeueNotification(XNotificationID id,
|
bool XNotifyListener::DequeueNotification(XNotificationID id,
|
||||||
uint32_t* out_data) {
|
uint32_t* out_data) {
|
||||||
auto global_lock = global_critical_region_.Acquire();
|
auto global_lock = global_critical_region_.Acquire();
|
||||||
bool dequeued = false;
|
bool dequeued = false;
|
||||||
|
@ -84,7 +84,7 @@ bool NotifyListener::DequeueNotification(XNotificationID id,
|
||||||
return dequeued;
|
return dequeued;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotifyListener::Save(ByteStream* stream) {
|
bool XNotifyListener::Save(ByteStream* stream) {
|
||||||
SaveObject(stream);
|
SaveObject(stream);
|
||||||
|
|
||||||
stream->Write(mask_);
|
stream->Write(mask_);
|
||||||
|
@ -99,9 +99,9 @@ bool NotifyListener::Save(ByteStream* stream) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ref<NotifyListener> NotifyListener::Restore(KernelState* kernel_state,
|
object_ref<XNotifyListener> XNotifyListener::Restore(KernelState* kernel_state,
|
||||||
ByteStream* stream) {
|
ByteStream* stream) {
|
||||||
auto notify = new NotifyListener(nullptr);
|
auto notify = new XNotifyListener(nullptr);
|
||||||
notify->kernel_state_ = kernel_state;
|
notify->kernel_state_ = kernel_state;
|
||||||
|
|
||||||
notify->RestoreObject(stream);
|
notify->RestoreObject(stream);
|
||||||
|
@ -115,7 +115,7 @@ object_ref<NotifyListener> NotifyListener::Restore(KernelState* kernel_state,
|
||||||
notify->notifications_.insert(pair);
|
notify->notifications_.insert(pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
return object_ref<NotifyListener>(notify);
|
return object_ref<XNotifyListener>(notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace kernel
|
} // namespace kernel
|
|
@ -7,8 +7,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef XENIA_KERNEL_NOTIFY_LISTENER_H_
|
#ifndef XENIA_KERNEL_XNOTIFYLISTENER_H_
|
||||||
#define XENIA_KERNEL_NOTIFY_LISTENER_H_
|
#define XENIA_KERNEL_XNOTIFYLISTENER_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -21,12 +21,12 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
class NotifyListener : public XObject {
|
class XNotifyListener : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeNotifyListener;
|
static const Type kType = kTypeNotifyListener;
|
||||||
|
|
||||||
explicit NotifyListener(KernelState* kernel_state);
|
explicit XNotifyListener(KernelState* kernel_state);
|
||||||
~NotifyListener() override;
|
~XNotifyListener() override;
|
||||||
|
|
||||||
uint64_t mask() const { return mask_; }
|
uint64_t mask() const { return mask_; }
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class NotifyListener : public XObject {
|
||||||
bool DequeueNotification(XNotificationID id, uint32_t* out_data);
|
bool DequeueNotification(XNotificationID id, uint32_t* out_data);
|
||||||
|
|
||||||
bool Save(ByteStream* stream) override;
|
bool Save(ByteStream* stream) override;
|
||||||
static object_ref<NotifyListener> Restore(KernelState* kernel_state,
|
static object_ref<XNotifyListener> Restore(KernelState* kernel_state,
|
||||||
ByteStream* stream);
|
ByteStream* stream);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -56,4 +56,4 @@ class NotifyListener : public XObject {
|
||||||
} // namespace kernel
|
} // namespace kernel
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
#endif // XENIA_KERNEL_NOTIFY_LISTENER_H_
|
#endif // XENIA_KERNEL_XNOTIFYLISTENER_H_
|
|
@ -14,13 +14,13 @@
|
||||||
#include "xenia/base/byte_stream.h"
|
#include "xenia/base/byte_stream.h"
|
||||||
#include "xenia/base/clock.h"
|
#include "xenia/base/clock.h"
|
||||||
#include "xenia/kernel/kernel_state.h"
|
#include "xenia/kernel/kernel_state.h"
|
||||||
#include "xenia/kernel/notify_listener.h"
|
|
||||||
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
|
||||||
#include "xenia/kernel/xenumerator.h"
|
#include "xenia/kernel/xenumerator.h"
|
||||||
#include "xenia/kernel/xevent.h"
|
#include "xenia/kernel/xevent.h"
|
||||||
#include "xenia/kernel/xfile.h"
|
#include "xenia/kernel/xfile.h"
|
||||||
#include "xenia/kernel/xmodule.h"
|
#include "xenia/kernel/xmodule.h"
|
||||||
#include "xenia/kernel/xmutant.h"
|
#include "xenia/kernel/xmutant.h"
|
||||||
|
#include "xenia/kernel/xnotifylistener.h"
|
||||||
#include "xenia/kernel/xsemaphore.h"
|
#include "xenia/kernel/xsemaphore.h"
|
||||||
#include "xenia/kernel/xthread.h"
|
#include "xenia/kernel/xthread.h"
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ object_ref<XObject> XObject::Restore(KernelState* kernel_state, Type type,
|
||||||
case kTypeMutant:
|
case kTypeMutant:
|
||||||
return XMutant::Restore(kernel_state, stream);
|
return XMutant::Restore(kernel_state, stream);
|
||||||
case kTypeNotifyListener:
|
case kTypeNotifyListener:
|
||||||
return NotifyListener::Restore(kernel_state, stream);
|
return XNotifyListener::Restore(kernel_state, stream);
|
||||||
case kTypeSemaphore:
|
case kTypeSemaphore:
|
||||||
return XSemaphore::Restore(kernel_state, stream);
|
return XSemaphore::Restore(kernel_state, stream);
|
||||||
case kTypeSession:
|
case kTypeSession:
|
||||||
|
|
Loading…
Reference in New Issue