Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.
Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
This commit is contained in:
parent
35d2a8cb36
commit
a47d20f8be
890 changed files with 11796 additions and 16664 deletions
|
|
@ -1,79 +0,0 @@
|
|||
#include "Utility/NMessageMgr.h"
|
||||
#include "Utility/NSyncObject.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
// STATIC: 0x0138D3EC
|
||||
// GLOBAL: gl_24361
|
||||
NMessageMgr* g_messageMgr;
|
||||
|
||||
// OFFSET: 0x00732BF0
|
||||
// FUNCTION: fn_07582
|
||||
NInter::~NInter() = default;
|
||||
|
||||
// OFFSET: 0x007359A0
|
||||
// FUNCTION: fn_07610
|
||||
NMessageMgr::NMessageMgr() : m_enabled(false) {
|
||||
InitializeCriticalSection(&this->m_criticalSection);
|
||||
this->m_enabled = true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00735920
|
||||
// FUNCTION: fn_07609
|
||||
NMessageMgr::~NMessageMgr() {
|
||||
DeleteCriticalSection(&this->m_criticalSection);
|
||||
}
|
||||
|
||||
// OFFSET: 0x007359A0
|
||||
// FUNCTION: fn_07610
|
||||
bool NMessageMgr::Initialize() {
|
||||
g_messageMgr = new (std::nothrow) NMessageMgr;
|
||||
if (!g_messageMgr) {
|
||||
return false;
|
||||
}
|
||||
if (!g_messageMgr->m_enabled) {
|
||||
delete g_messageMgr;
|
||||
g_messageMgr = nullptr;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00735A90
|
||||
// FUNCTION: fn_07611
|
||||
void NMessageMgr::Shutdown() {
|
||||
if (g_messageMgr) {
|
||||
delete g_messageMgr;
|
||||
g_messageMgr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00735AB0
|
||||
// FUNCTION: fn_07612
|
||||
bool NMessageMgr::Register(std::uint32_t objectId, NInter* object) {
|
||||
NSyncObject held(&this->m_criticalSection);
|
||||
return this->m_objects.emplace(objectId, object).second;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00735BC0
|
||||
// FUNCTION: fn_07613
|
||||
bool NMessageMgr::Send(std::uint32_t objectId, std::uint64_t argument, std::uint32_t id) {
|
||||
NSyncObject held(&this->m_criticalSection);
|
||||
auto object = this->m_objects.find(objectId);
|
||||
if (object == this->m_objects.end()) {
|
||||
return false;
|
||||
}
|
||||
// Original dispatch retains the recursive critical section across the callback.
|
||||
object->second->Receive(argument, id);
|
||||
return true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00735C60
|
||||
// FUNCTION: fn_07614
|
||||
void NMessageMgr::Unregister(std::uint32_t objectId, NInter* object) {
|
||||
NSyncObject held(&this->m_criticalSection);
|
||||
auto registered = this->m_objects.find(objectId);
|
||||
if (registered != this->m_objects.end() && registered->second == object) {
|
||||
this->m_objects.erase(registered);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue