Skip to content

Commit 6eed2ce

Browse files
authored
Netcode progress (#300)
1 parent 1d03278 commit 6eed2ce

29 files changed

+776
-135
lines changed

config/RMCP01/module/splits.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,31 @@ ui/SectionAutogens.cpp:
164164
SectionDirector.o:
165165
.text start:0x001247CC end:0x00125B04
166166

167+
net/MiscPacketHandler.cpp:
168+
.text start:0x00142E54 end:0x00145484
169+
.bss start:0x00004870 end:0x00004878
170+
167171
net/NetManager.cpp:
168172
.text start:0x00145770 end:0x00149E98
169173
.data start:0x0000DD90 end:0x0000DDC8
170-
.bss start:0x000049F8 end:0x00004A00
174+
.bss start:0x00004878 end:0x00004A00
171175

172176
net/packets/ROOM.cpp:
173177
.text start:0x0014A6D4 end:0x0014AFA0
174178
.bss start:0x00004A00 end:0x00004A10
175179

180+
net/packets/EVENT.cpp:
181+
.text start:0x0014B134 end:0x0014BD38
182+
.bss start:0x00004A10 end:0x00004A18
183+
184+
net/packets/ITEM.cpp:
185+
.text start:0x0014BD38 end:0x0014FAD8
186+
.bss start:0x00004A18 end:0x00004A20
187+
188+
net/packets/SELECT.cpp:
189+
.text start:0x0014FAD8 end:0x001523C4
190+
.bss start:0x00004A20 end:0x00004A28
191+
176192
net/packets/USER.cpp:
177193
.text start:0x001523C4 end:0x00152DE0
178194
.bss start:0x00004A28 end:0x00004A30

config/RMCP01/module/symbols.txt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7146,8 +7146,8 @@ fn_1_143854 = .text:0x00143854; // type:function size:0xB0
71467146
fn_1_143904 = .text:0x00143904; // type:function size:0x5C
71477147
fn_1_143960 = .text:0x00143960; // type:function size:0x64
71487148
fn_1_1439C4 = .text:0x001439C4; // type:function size:0x64
7149-
fn_1_143A28 = .text:0x00143A28; // type:function size:0x18
7150-
fn_1_143A40 = .text:0x00143A40; // type:function size:0x58
7149+
clearAidFromUnkBitfield__Q23Net17MiscPacketHandlerFUl = .text:0x00143A28; // type:function size:0x18
7150+
__ct__Q23Net17MiscPacketHandlerFv = .text:0x00143A40; // type:function size:0x58
71517151
fn_1_143A98 = .text:0x00143A98; // type:function size:0x40
71527152
fn_1_143AD8 = .text:0x00143AD8; // type:function size:0x40
71537153
fn_1_143B18 = .text:0x00143B18; // type:function size:0x58
@@ -7165,7 +7165,7 @@ fn_1_1443A4 = .text:0x001443A4; // type:function size:0xC
71657165
fn_1_1443B0 = .text:0x001443B0; // type:function size:0xAC
71667166
fn_1_14445C = .text:0x0014445C; // type:function size:0x10
71677167
MiscPacketHandler_isPlayerConnected = .text:0x0014446C; // type:function size:0x88 scope:global align:4
7168-
MiscPacketHandler_isPlayerLocal = .text:0x001444F4; // type:function size:0x70 scope:global align:4
7168+
isPlayerLocal__Q23Net17MiscPacketHandlerFUl = .text:0x001444F4; // type:function size:0x70 scope:global align:4
71697169
fn_1_144564 = .text:0x00144564; // type:function size:0x6C
71707170
fn_1_1445D0 = .text:0x001445D0; // type:function size:0xB0
71717171
fn_1_144680 = .text:0x00144680; // type:function size:0xCC
@@ -7189,8 +7189,8 @@ startWWVSSearch__Q23Net10NetManagerFUc = .text:0x00145E00; // type:function size
71897189
startRegionalVSSearch__Q23Net10NetManagerFUc = .text:0x00145EBC; // type:function size:0xBC
71907190
startWWBattleSearch__Q23Net10NetManagerFUc = .text:0x00145F78; // type:function size:0xBC
71917191
startRegionalBattleSearch__Q23Net10NetManagerFUc = .text:0x00146034; // type:function size:0xBC
7192-
fn_1_1460F0 = .text:0x001460F0; // type:function size:0x130
7193-
fn_1_146220 = .text:0x00146220; // type:function size:0x130
7192+
joinFriendPublicVS__Q23Net10NetManagerFUlUc = .text:0x001460F0; // type:function size:0x130
7193+
joinFriendPublicBT__Q23Net10NetManagerFUlUc = .text:0x00146220; // type:function size:0x130
71947194
joinFriendRoom__Q23Net10NetManagerFUlUc = .text:0x00146350; // type:function size:0xD4
71957195
createFriendRoom__Q23Net10NetManagerFUc = .text:0x00146424; // type:function size:0xC0
71967196
resetRH1andROOM__Q23Net10NetManagerFv = .text:0x001464E4; // type:function size:0x58
@@ -7204,7 +7204,7 @@ fn_1_146738 = .text:0x00146738; // type:function size:0x58
72047204
fn_1_146790 = .text:0x00146790; // type:function size:0x28
72057205
fn_1_1467B8 = .text:0x001467B8; // type:function size:0x134
72067206
fn_1_1468EC = .text:0x001468EC; // type:function size:0xCC
7207-
fn_1_1469B8 = .text:0x001469B8; // type:function size:0x30
7207+
resetFriendData__Q23Net10NetManagerFUl = .text:0x001469B8; // type:function size:0x30
72087208
isConnectionStateIdleOrInMM__Q23Net10NetManagerCFv = .text:0x001469E8; // type:function size:0xA8
72097209
isTaskThreadIdle__Q23Net10NetManagerFv = .text:0x00146A90; // type:function size:0x2C
72107210
isConnectionStateIdle__Q23Net10NetManagerCFv = .text:0x00146ABC; // type:function size:0x90
@@ -7222,8 +7222,8 @@ RKNetController_trySendNextRACEPacket = .text:0x00147A7C; // type:function size:
72227222
fn_1_147C30 = .text:0x00147C30; // type:function size:0xE0
72237223
fn_1_147D10 = .text:0x00147D10; // type:function size:0x7C
72247224
setConnectionState__Q23Net10NetManagerFQ33Net10NetManager15ConnectionState = .text:0x00147D8C; // type:function size:0x8
7225-
getConnectionState__Q23Net10NetManagerFv = .text:0x00147D94; // type:function size:0x84
7226-
RKNetController_handleError = .text:0x00147E18; // type:function size:0x160 scope:global align:4
7225+
getConnectionState__Q23Net10NetManagerCFv = .text:0x00147D94; // type:function size:0x84
7226+
handleError__Q23Net10NetManagerFv = .text:0x00147E18; // type:function size:0x160 scope:global align:4
72277227
alloc__Q23Net10NetManagerFUll = .text:0x00147F78; // type:function size:0x88
72287228
free__Q23Net10NetManagerFPv = .text:0x00148000; // type:function size:0x64
72297229
SOAlloc__Q23Net10NetManagerFUlUl = .text:0x00148064; // type:function size:0x80
@@ -7237,15 +7237,15 @@ fn_1_1483B4 = .text:0x001483B4; // type:function size:0xBC
72377237
fn_1_148470 = .text:0x00148470; // type:function size:0xB4
72387238
fn_1_148524 = .text:0x00148524; // type:function size:0x20
72397239
fn_1_148544 = .text:0x00148544; // type:function size:0x4
7240-
fn_1_148548 = .text:0x00148548; // type:function size:0x1C
7240+
updateDWCServersAsyncCallback__Q23Net10NetManagerFUlUlPQ23Net10NetManager = .text:0x00148548; // type:function size:0x1C
72417241
fn_1_148564 = .text:0x00148564; // type:function size:0x4
7242-
fn_1_148568 = .text:0x00148568; // type:function size:0xC
7242+
DWCSetBuddyFriendCallback__Q23Net10NetManagerFUlPQ23Net10NetManager = .text:0x00148568; // type:function size:0xC
72437243
fn_1_148574 = .text:0x00148574; // type:function size:0x68
72447244
fn_1_1485DC = .text:0x001485DC; // type:function size:0x20C
72457245
NetManager_connect = .text:0x001487E8; // type:function size:0x1A0 scope:global align:4
72467246
initMMInfos__Q23Net10NetManagerFv = .text:0x00148988; // type:function size:0xA4
72477247
fn_1_148A2C = .text:0x00148A2C; // type:function size:0x1A0
7248-
fn_1_148BCC = .text:0x00148BCC; // type:function size:0xC4
7248+
resetFriends__Q23Net10NetManagerFv = .text:0x00148BCC; // type:function size:0xC4
72497249
fn_1_148C90 = .text:0x00148C90; // type:function size:0x12C
72507250
fn_1_148DBC = .text:0x00148DBC; // type:function size:0x448
72517251
fn_1_149204 = .text:0x00149204; // type:function size:0x64
@@ -7254,10 +7254,10 @@ fn_1_1492CC = .text:0x001492CC; // type:function size:0x244
72547254
fn_1_149510 = .text:0x00149510; // type:function size:0x178
72557255
fn_1_149688 = .text:0x00149688; // type:function size:0x48
72567256
RKNetController_processRACEPacket = .text:0x001496D0; // type:function size:0x13C scope:global align:4
7257-
fn_1_14980C = .text:0x0014980C; // type:function size:0x160
7258-
fn_1_14996C = .text:0x0014996C; // type:function size:0x38
7259-
RKNetController_getLocalPlayerId = .text:0x001499A4; // type:function size:0x24C scope:global align:4
7260-
fn_1_149BF0 = .text:0x00149BF0; // type:function size:0x110
7257+
updateAidMapping__Q23Net10NetManagerFv = .text:0x0014980C; // type:function size:0x160
7258+
resetPlayerIdToAidMap__Q23Net10NetManagerFv = .text:0x0014996C; // type:function size:0x38
7259+
getLocalPlayerId__Q23Net10NetManagerFUl = .text:0x001499A4; // type:function size:0x24C scope:global align:4
7260+
getFriendJoinableStatus__Q23Net10NetManagerCFUl = .text:0x00149BF0; // type:function size:0x110
72617261
RKNetController_updateStatusData = .text:0x00149D00; // type:function size:0x198 scope:global align:4
72627262
fn_1_149E98 = .text:0x00149E98; // type:function size:0x60
72637263
fn_1_149EF8 = .text:0x00149EF8; // type:function size:0x60
@@ -7298,7 +7298,7 @@ fn_1_14B004 = .text:0x0014B004; // type:function size:0x54
72987298
fn_1_14B058 = .text:0x0014B058; // type:function size:0x44
72997299
fn_1_14B09C = .text:0x0014B09C; // type:function size:0x40
73007300
fn_1_14B0DC = .text:0x0014B0DC; // type:function size:0x58
7301-
fn_1_14B134 = .text:0x0014B134; // type:function size:0x118
7301+
createStaticInstance__Q23Net12EVENTHandlerFv = .text:0x0014B134; // type:function size:0x118
73027302
fn_1_14B24C = .text:0x0014B24C; // type:function size:0x40
73037303
fn_1_14B28C = .text:0x0014B28C; // type:function size:0xEC
73047304
fn_1_14B378 = .text:0x0014B378; // type:function size:0x4
@@ -7315,7 +7315,7 @@ fn_1_14BC98 = .text:0x0014BC98; // type:function size:0x2C
73157315
fn_1_14BCC4 = .text:0x0014BCC4; // type:function size:0x38
73167316
fn_1_14BCFC = .text:0x0014BCFC; // type:function size:0x14
73177317
fn_1_14BD10 = .text:0x0014BD10; // type:function size:0x28
7318-
ITEMHandler_getStaticInstance = .text:0x0014BD38; // type:function size:0x27C scope:global align:4
7318+
createStaticInstance__Q23Net11ITEMHandlerFv = .text:0x0014BD38; // type:function size:0x27C scope:global align:4
73197319
fn_1_14BFB4 = .text:0x0014BFB4; // type:function size:0x40
73207320
ITEMHandler_construct = .text:0x0014BFF4; // type:function size:0x23C scope:global align:4
73217321
fn_1_14C230 = .text:0x0014C230; // type:function size:0x4
@@ -7367,7 +7367,7 @@ fn_1_15009C = .text:0x0015009C; // type:function size:0x20
73677367
fn_1_1500BC = .text:0x001500BC; // type:function size:0x1C
73687368
fn_1_1500D8 = .text:0x001500D8; // type:function size:0x1C
73697369
fn_1_1500F4 = .text:0x001500F4; // type:function size:0x24
7370-
fn_1_150118 = .text:0x00150118; // type:function size:0x8
7370+
getPlayerIdToAidMapping__Q23Net13SELECTHandlerCFv = .text:0x00150118; // type:function size:0x8
73717371
fn_1_150120 = .text:0x00150120; // type:function size:0x50
73727372
fn_1_150170 = .text:0x00150170; // type:function size:0x50
73737373
fn_1_1501C0 = .text:0x001501C0; // type:function size:0x50
@@ -7447,7 +7447,7 @@ setPrepared__Q23Net18RACEHEADER1HandlerFv = .text:0x001538C8; // type:function s
74477447
reset__Q23Net18RACEHEADER1HandlerFv = .text:0x001538D4; // type:function size:0x14C
74487448
fn_1_153A20 = .text:0x00153A20; // type:function size:0x338
74497449
fn_1_153D58 = .text:0x00153D58; // type:function size:0xA4
7450-
fn_1_153DFC = .text:0x00153DFC; // type:function size:0x210
7450+
courseValid__Q23Net18RACEHEADER1HandlerFv = .text:0x00153DFC; // type:function size:0x210
74517451
fn_1_15400C = .text:0x0015400C; // type:function size:0x18
74527452
fn_1_154024 = .text:0x00154024; // type:function size:0x18
74537453
fn_1_15403C = .text:0x0015403C; // type:function size:0x15C
@@ -7457,7 +7457,7 @@ fn_1_154314 = .text:0x00154314; // type:function size:0x108
74577457
fn_1_15441C = .text:0x0015441C; // type:function size:0x174
74587458
fn_1_154590 = .text:0x00154590; // type:function size:0xF8
74597459
fn_1_154688 = .text:0x00154688; // type:function size:0xF8
7460-
fn_1_154780 = .text:0x00154780; // type:function size:0xF8
7460+
getPlayerIdToAidMapping__Q23Net18RACEHEADER1HandlerCFv = .text:0x00154780; // type:function size:0xF8
74617461
fn_1_154878 = .text:0x00154878; // type:function size:0x170
74627462
fn_1_1549E8 = .text:0x001549E8; // type:function size:0x164
74637463
fn_1_154B4C = .text:0x00154B4C; // type:function size:0xF8
@@ -24511,15 +24511,15 @@ lbl_1_bss_4854 = .bss:0x00004854; // type:object size:0x4
2451124511
lbl_1_bss_4858 = .bss:0x00004858; // type:object size:0x8
2451224512
lbl_1_bss_4860 = .bss:0x00004860; // type:object size:0x8
2451324513
lbl_1_bss_4868 = .bss:0x00004868; // type:object size:0x8
24514-
lbl_1_bss_4870 = .bss:0x00004870; // type:object size:0x8 data:4byte
24514+
spInstance__Q23Net17MiscPacketHandler = .bss:0x00004870; // type:object size:0x8 data:4byte
2451524515
lbl_1_bss_4878 = .bss:0x00004878; // type:object size:0x80 data:4byte
2451624516
lbl_1_bss_48F8 = .bss:0x000048F8; // type:object size:0x100
2451724517
spInstance__Q23Net10NetManager = .bss:0x000049F8; // type:object size:0x8 data:4byte
2451824518
spInstance__Q23Net11ROOMHandler = .bss:0x00004A00; // type:object size:0x8 data:4byte
2451924519
lbl_1_bss_4A08 = .bss:0x00004A08; // type:object size:0x8 data:4byte
24520-
lbl_1_bss_4A10 = .bss:0x00004A10; // type:object size:0x8 data:4byte
24521-
lbl_1_bss_4A18 = .bss:0x00004A18; // type:object size:0x8 data:4byte
24522-
lbl_1_bss_4A20 = .bss:0x00004A20; // type:object size:0x8 data:4byte
24520+
spInstance__Q23Net12EVENTHandler = .bss:0x00004A10; // type:object size:0x8 data:4byte
24521+
spInstance__Q23Net11ITEMHandler = .bss:0x00004A18; // type:object size:0x8 data:4byte
24522+
spInstance__Q23Net13SELECTHandler = .bss:0x00004A20; // type:object size:0x8 data:4byte
2452324523
spInstance__Q23Net11USERHandler = .bss:0x00004A28; // type:object size:0x8 data:4byte
2452424524
lbl_1_bss_4A30 = .bss:0x00004A30; // type:object size:0x8 data:4byte
2452524525
spInstance__Q23Net18RACEHEADER1Handler = .bss:0x00004A38; // type:object size:0x8 data:4byte

configure.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,10 +793,14 @@ def MatchingFor(*versions):
793793
Object(Matching, "geo/BoxColManager.cpp"),
794794
Object(Matching, "geo/BoxColUnit.cpp"),
795795

796+
Object(NonMatching, "net/MiscPacketHandler.cpp"),
796797
Object(NonMatching, "net/NetManager.cpp"),
798+
Object(NonMatching, "net/packets/ROOM.cpp"),
799+
Object(NonMatching, "net/packets/EVENT.cpp"),
800+
Object(NonMatching, "net/packets/ITEM.cpp"),
801+
Object(NonMatching, "net/packets/SELECT.cpp"),
797802
Object(NonMatching, "net/packets/USER.cpp"),
798803
Object(NonMatching, "net/packets/RACEHEADER1.cpp"),
799-
Object(NonMatching, "net/packets/ROOM.cpp"),
800804
],
801805
},
802806
{

include/rk_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
#define MAX_PLAYER_COUNT 12
44
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
5+
6+
#define MAX_FRIEND_COUNT 30

lib/dwc/common/dwc_error.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "dwc_error.h"
22

3-
#include "dwci_error.h"
4-
53
//! @brief The last error code encountered.
64
//!
75
int stDwcErrorCode;
@@ -17,7 +15,7 @@ int DWC_GetLastError(int* errorCode) {
1715
return stDwcLastError;
1816
}
1917

20-
s32 DWC_GetLastErrorEx(s32* errorCode, u32* errorType) {
18+
s32 DWC_GetLastErrorEx(s32* errorCode, DWCErrorType* errorType) {
2119
if (errorCode)
2220
*errorCode = stDwcErrorCode;
2321
if (errorType) {
@@ -45,7 +43,7 @@ s32 DWC_GetLastErrorEx(s32* errorCode, u32* errorType) {
4543
*errorType = 1;
4644
break;
4745
case 1:
48-
case DWCErrorFatal:
46+
case DWC_ERROR_FATAL:
4947
*errorType = 7;
5048
break;
5149

@@ -74,21 +72,21 @@ s32 DWC_GetLastErrorEx(s32* errorCode, u32* errorType) {
7472
}
7573

7674
void DWC_ClearError() {
77-
if (stDwcLastError != DWCErrorFatal) {
78-
stDwcLastError = DWCErrorNone;
75+
if (stDwcLastError != DWC_ERROR_FATAL) {
76+
stDwcLastError = DWC_ERROR_NONE;
7977
stDwcErrorCode = 0;
8078
}
8179
}
8280

83-
int DWCi_IsError() { return stDwcLastError != DWCErrorNone; }
81+
int DWCi_IsError() { return stDwcLastError != DWC_ERROR_NONE; }
8482

8583
void DWCi_SetError(int lastError, int errorCode) {
86-
if (stDwcLastError != DWCErrorFatal) {
84+
if (stDwcLastError != DWC_ERROR_FATAL) {
8785
stDwcLastError = lastError;
8886
stDwcErrorCode = errorCode;
8987
}
9088
#ifdef DEBUG
91-
if (stDwcLastError == DWCErrorFatal)
89+
if (stDwcLastError == DWC_ERROR_FATAL)
9290
DWC_Printf(-1, "FATALERROR_SET\n");
9391
#endif
9492
}

lib/dwc/common/dwc_error.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
#include <rk_types.h>
44

5+
#include "dwci_error.h"
6+
57
#ifdef __cplusplus
68
extern "C" {
79
#endif
810

911
int DWC_GetLastError(int* errorCode);
10-
s32 DWC_GetLastErrorEx(s32* errorCode, u32* errorType);
12+
s32 DWC_GetLastErrorEx(s32* errorCode, DWCErrorType* errorType);
1113
void DWC_ClearError();
1214

1315
#ifdef __cplusplus

lib/dwc/common/dwci_error.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
extern "C" {
55
#endif
66

7-
enum dwcError { DWCErrorNone = 0, DWCErrorFatal = 9 };
7+
typedef enum {
8+
DWC_ERROR_NONE = 0,
9+
DWC_ERROR_TYPE_1 = 1,
10+
DWC_ERROR_TYPE_2 = 2,
11+
DWC_ERROR_TYPE_3 = 3,
12+
DWC_ERROR_TYPE_4 = 4,
13+
DWC_ERROR_TYPE_5 = 5,
14+
DWC_ERROR_TYPE_6 = 6,
15+
DWC_ERROR_TYPE_7 = 7,
16+
DWC_ERROR_FATAL = 9,
17+
} DWCErrorType;
818

919
//! @brief @return Return if there is an error.
1020
//!

src/net/FriendInfo.hpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#pragma once
2+
3+
// this maybe should go in NetManager
4+
5+
namespace Net {
6+
7+
enum FriendStatus {
8+
FRIEND_STATUS_IDLE = 0x0, // Is this any different than ONLINE?
9+
FRIEND_STATUS_ONLINE = 0x2,
10+
FRIEND_STATUS_OPEN_ROOM = 0x3, // or hosting
11+
FRIEND_STATUS_PLAYING_WITH_FRIENDS = 0x4,
12+
FRIEND_STATUS_PUBLIC_VS = 0x5,
13+
FRIEND_STATUS_PUBLIC_BT = 0x8,
14+
FRIEND_STATUS_FROOM_VS_HOST = 0xB,
15+
FRIEND_STATUS_FROOM_BATTLE_HOST = 0xC,
16+
FRIEND_STATUS_FROOM_VS_NON_HOST = 0xD,
17+
FRIEND_STATUS_FROOM_BATTLE_NON_HOST = 0xE,
18+
};
19+
20+
// The enums here are a little confusing and deserve some explanation
21+
// Whereas FriendStatus only makes a destinction between public and private
22+
// rooms, FriendJoinableStatus goes a bit further in whether you can join the
23+
// public room or not.
24+
enum FriendJoinableStatus {
25+
STATUS_NONE = 0x0,
26+
STATUS_OFFLINE = 0x1,
27+
STATUS_ONLINE = 0x2,
28+
STATUS_OPEN_ROOM = 0x3,
29+
STATUS_PLAYING_WITH_FRIEND = 0x4,
30+
STATUS_WW_VS = 0x5,
31+
STATUS_JOINABLE_REGIONAL_VS = 0x6,
32+
STATUS_UNJOINABLE_REGIONAL_VS = 0x7,
33+
STATUS_WW_BT = 0x8,
34+
STATUS_JOINABLE_REGIONAL_BT = 0x9,
35+
STATUS_UNJOINABLE_REGIONAL_BT = 0xA,
36+
STATUS_HOSTING_GP = 0xB,
37+
STATUS_HOSTING_BT = 0xC,
38+
STATUS_PLAYING_WITH_FRIENDS_RACE_COUNT = 0xD,
39+
STATUS_PLAYING_WITH_FRIEND_BATTLE_COUNT = 0xE,
40+
};
41+
42+
struct StatusData {
43+
u32 roomId; // note to self, this is the one used 80659680, not to be confused
44+
// with a similar field in matchMakingInfo
45+
s8 regionId;
46+
u8 status; // FriendStatus
47+
u8 playerCount;
48+
u8 currRace;
49+
};
50+
static_assert(sizeof(StatusData) == 0x8);
51+
52+
struct FriendInfo {
53+
StatusData statusData;
54+
u8 dwcFriendStatus; // Updated in NetManager::updateStatusDatas
55+
bool addedBack;
56+
u8 _a[0xc - 0xa];
57+
};
58+
static_assert(sizeof(FriendInfo) == 0xc);
59+
60+
} // namespace Net

src/net/MiscPacketHandler.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "MiscPacketHandler.hpp"
2+
3+
#include "net/NetManager.hpp"
4+
5+
#include "net/packets/EVENT.hpp"
6+
#include "net/packets/ITEM.hpp"
7+
8+
namespace Net {
9+
10+
void MiscPacketHandler::clearAidFromUnkBitfield(u32 aid) {
11+
m_unkBitfield_4 &= ~(1 << aid);
12+
}
13+
14+
MiscPacketHandler::MiscPacketHandler()
15+
: _000(0), m_unk1(false), m_unkBitfield_4(0), m_unkBitfield_8(0),
16+
m_unkBitfield_C(0), m_unk10(0), m_unk12(3000) {
17+
EVENTHandler::createStaticInstance();
18+
ITEMHandler::createStaticInstance();
19+
}
20+
21+
bool MiscPacketHandler::isPlayerLocal(u32 playerId) {
22+
bool isPlayerIdLocal = false;
23+
if (playerId == NetManager::getInstance()->getLocalPlayerId(0) ||
24+
playerId == NetManager::getInstance()->getLocalPlayerId(1)) {
25+
isPlayerIdLocal = true;
26+
}
27+
return isPlayerIdLocal;
28+
}
29+
30+
} // namespace Net

0 commit comments

Comments
 (0)