Skip to content
Open
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
46 changes: 45 additions & 1 deletion src/net/packets/USER.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
#include "USER.hpp"

namespace Net {}
#include "net/NetManager.hpp"

#include <string.h>

extern "C" {
void fn_1_152498(void*);
void fn_1_152B08(void*);
s32 RFLGetAsyncStatus();
}

namespace Net {

void USERHandler::update() {
if (NetManager::getInstance()->hasFoundMatch()) {
if (*(u8*)this == 0) {
fn_1_152498(this);
}
} else {
if (*(u8*)this != 0) {
*(u8*)this = 0;
*(u32*)((char*)this + 0x9e0) = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use class memebers instead of direct casts

*(u32*)((char*)this + 0x9e4) = 0;
*(u32*)((char*)this + 0x9e8) = 0;
memset((char*)this + 0x8, 0, 0xc0);
u32 i;
char* p = (char*)this + 0xc8;
for (i = 0; i < 0xc; i++) {
memset(p, 0, 0xc0);
p += 0xc0;
}
}
}
if (*(u8*)this != 0) {
fn_1_152B08(this);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be a member function of USERHandler?

if (*(s32*)((char*)this + 0x9dc) == 1) {
if (RFLGetAsyncStatus() != 6) {
*(u32*)((char*)this + 0x9e0) = *(u32*)((char*)this + 0x9e8);
*(u32*)((char*)this + 0x9e8) = 0;
*(u32*)((char*)this + 0x9dc) = 0;
}
}
}
}

} // namespace Net