Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions config/RMCP01/module/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7199,16 +7199,16 @@ setToMMSuspensionUnk3__Q23Net10NetManagerFv = .text:0x00146554; // type:function
setDisconnectInfo__Q23Net10NetManagerFQ23Net14DisconnectTypel = .text:0x0014656C; // type:function size:0x94
getDisconnectInfo__Q23Net10NetManagerFv = .text:0x00146600; // type:function size:0x7C
resetDisconnectInfo__Q23Net10NetManagerFv = .text:0x0014667C; // type:function size:0x5C
getTimeDiff__Q23Net10NetManagerFv = .text:0x001466D8; // type:function size:0x60
matchMakingElapsedSeconds__Q23Net10NetManagerFv = .text:0x001466D8; // type:function size:0x60
fn_1_146738 = .text:0x00146738; // type:function size:0x58
fn_1_146790 = .text:0x00146790; // type:function size:0x28
fn_1_1467B8 = .text:0x001467B8; // type:function size:0x134
fn_1_1468EC = .text:0x001468EC; // type:function size:0xCC
fn_1_1469B8 = .text:0x001469B8; // type:function size:0x30
isConnectionStateIdleOrInMM__Q23Net10NetManagerFv = .text:0x001469E8; // type:function size:0xA8
isTaskExist__Q23Net10NetManagerFv = .text:0x00146A90; // type:function size:0x2C
isConnectionStateIdle__Q23Net10NetManagerFv = .text:0x00146ABC; // type:function size:0x90
hasFoundMatch__Q23Net10NetManagerFv = .text:0x00146B4C; // type:function size:0x40
isConnectionStateIdleOrInMM__Q23Net10NetManagerCFv = .text:0x001469E8; // type:function size:0xA8
isTaskThreadIdle__Q23Net10NetManagerFv = .text:0x00146A90; // type:function size:0x2C
isConnectionStateIdle__Q23Net10NetManagerCFv = .text:0x00146ABC; // type:function size:0x90
hasFoundMatch__Q23Net10NetManagerCFv = .text:0x00146B4C; // type:function size:0x40
fn_1_146B8C = .text:0x00146B8C; // type:function size:0xB8
setConnectionStateIdle__Q23Net10NetManagerFv = .text:0x00146C44; // type:function size:0xC
RKNetController_construct = .text:0x00146C50; // type:function size:0x3D8 scope:global align:4
Expand Down
17 changes: 7 additions & 10 deletions src/net/NetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void NetManager::resetDisconnectInfo() {
OSUnlockMutex(&m_mutex);
}

s32 NetManager::getTimeDiff() {
s32 NetManager::matchMakingElapsedSeconds() {
s32 time = m_matchMakingInfos[m_currMMInfo].m_MMStartTime;

// has to do u64 comparison
Expand All @@ -164,10 +164,10 @@ s32 NetManager::getTimeDiff() {
}

OSTime currTime = OSGetTime();
return ((s32)currTime - time) / OS_TIMER_CLOCK;
return OSTicksToSeconds((s32)currTime - time);
}

bool NetManager::isConnectionStateIdleOrInMM() {
bool NetManager::isConnectionStateIdleOrInMM() const {
bool idleOrMM = false;

switch (getConnectionState()) {
Expand All @@ -180,16 +180,13 @@ bool NetManager::isConnectionStateIdleOrInMM() {
return idleOrMM;
}

bool NetManager::isTaskExist() {
// checks if we've requested mainNetworkLoop
return m_taskThread->isTaskExist() ? false : true;
}
bool NetManager::isTaskThreadIdle() { return !m_taskThread->isTaskExist(); }

bool NetManager::isConnectionStateIdle() {
bool NetManager::isConnectionStateIdle() const {
return getConnectionState() == CONNECTION_STATE_IDLE;
}

bool NetManager::hasFoundMatch() {
bool NetManager::hasFoundMatch() const {
bool inMatch = false;

bool isMyAidInMatch = (1 << m_matchMakingInfos[m_currMMInfo].m_myAid) &
Expand All @@ -211,7 +208,7 @@ void NetManager::setConnectionState(ConnectionState connState) {
m_connectionState = connState;
}

NetManager::ConnectionState NetManager::getConnectionState() {
NetManager::ConnectionState NetManager::getConnectionState() const {
s32 code;
u32 type;
DWC_GetLastErrorEx(&code, &type);
Expand Down
12 changes: 6 additions & 6 deletions src/net/NetManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,23 @@ class NetManager {

void resetDisconnectInfo();

s32 getTimeDiff();
s32 matchMakingElapsedSeconds();

void initMMInfos();

bool isConnectionStateIdleOrInMM();
bool isConnectionStateIdleOrInMM() const;

bool isTaskExist();
bool isTaskThreadIdle();

bool isConnectionStateIdle();
bool isConnectionStateIdle() const;

bool hasFoundMatch();
bool hasFoundMatch() const;

void setConnectionStateIdle();

void setConnectionState(ConnectionState connState);

inline ConnectionState getConnectionState();
inline ConnectionState getConnectionState() const;

void* alloc(u32 size, s32 alignment);

Expand Down
7 changes: 3 additions & 4 deletions src/net/packets/RACEHEADER1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ static_assert(sizeof(RACEHEADER1Packet) == 0x28);

class RACEHEADER1Handler {
public:
static RACEHEADER1Handler *getInstance() {
return spInstance;
}

void setPrepared();

void reset();

static RACEHEADER1Handler *getInstance() {
return spInstance;
}
private:
bool m_prepared;
u8 _004[0x260 - 0x001];
Expand Down
1 change: 0 additions & 1 deletion src/net/packets/ROOM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ROOMHandler {
static ROOMHandler *getInstance() {
return spInstance;
}

private:
u8 _00[0x80 - 0x00];

Expand Down
6 changes: 2 additions & 4 deletions src/net/packets/USER.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ static_assert(sizeof(USERPacket) == 0xc0);

class USERHandler {
public:
void update();

static USERHandler *getInstance() {
return spInstance;
}

void update();

private:

u8 _000[0x9f0 - 0x000];

static USERHandler *spInstance;
Expand Down