Move GFtgtGname out of librfu.h
This commit is contained in:
@@ -275,34 +275,6 @@
|
||||
// Status data for UNI-type communication (refer to gRfuSlotStatusUNI[x]->send.state)
|
||||
#define SLOT_STATE_SEND_UNI (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_UNI) // Transmitting
|
||||
|
||||
// TODO: move the 2 structs to some other header as they're declared by GF
|
||||
struct UnkLinkRfuStruct_02022B14Substruct
|
||||
{
|
||||
u16 unk_00_0:4;
|
||||
u16 unk_00_4:1;
|
||||
u16 unk_00_5:1;
|
||||
u16 unk_00_6:1;
|
||||
u16 isChampion:1;
|
||||
u16 hasNationalDex:1;
|
||||
u16 gameClear:1;
|
||||
u16 unk_01_2:4;
|
||||
u16 unk_01_6:2;
|
||||
u8 playerTrainerId[2];
|
||||
};
|
||||
|
||||
struct __attribute__((packed, aligned(2))) UnkLinkRfuStruct_02022B14
|
||||
{
|
||||
struct UnkLinkRfuStruct_02022B14Substruct unk_00;
|
||||
u8 unk_04[4];
|
||||
u16 species:10;
|
||||
u16 type:6;
|
||||
u8 unk_0a_0:7;
|
||||
u8 unk_0a_7:1;
|
||||
u8 playerGender:1;
|
||||
u8 level:7;
|
||||
u8 unk_0c;
|
||||
};
|
||||
|
||||
// the following structs are not documented in SDK
|
||||
struct RfuPacket8
|
||||
{
|
||||
|
||||
+31
-3
@@ -4,6 +4,34 @@
|
||||
#include "global.h"
|
||||
#include "librfu.h"
|
||||
|
||||
// RfuTgtData.gname is read as these structs.
|
||||
struct GFtgtGnameSub
|
||||
{
|
||||
u16 unk_00_0:4;
|
||||
u16 unk_00_4:1;
|
||||
u16 unk_00_5:1;
|
||||
u16 unk_00_6:1;
|
||||
u16 isChampion:1;
|
||||
u16 hasNationalDex:1;
|
||||
u16 gameClear:1;
|
||||
u16 unk_01_2:4;
|
||||
u16 unk_01_6:2;
|
||||
u8 playerTrainerId[2];
|
||||
};
|
||||
|
||||
struct __attribute__((packed, aligned(2))) GFtgtGname
|
||||
{
|
||||
struct GFtgtGnameSub unk_00;
|
||||
u8 unk_04[4];
|
||||
u16 species:10;
|
||||
u16 type:6;
|
||||
u8 unk_0a_0:7;
|
||||
u8 unk_0a_7:1;
|
||||
u8 playerGender:1;
|
||||
u8 level:7;
|
||||
u8 unk_0c;
|
||||
};
|
||||
|
||||
struct Padded_U8
|
||||
{
|
||||
u8 value;
|
||||
@@ -16,7 +44,7 @@ struct UnkLinkRfuStruct_02022B2C
|
||||
u16 unk_02;
|
||||
u8 unk_04;
|
||||
u16 unk_06;
|
||||
struct UnkLinkRfuStruct_02022B14 *unk_08;
|
||||
struct GFtgtGname *unk_08;
|
||||
u8 *unk_0c;
|
||||
u8 unk_10;
|
||||
u8 unk_11;
|
||||
@@ -143,7 +171,7 @@ void sub_80F8DC0(void);
|
||||
void sub_80FBB20(void);
|
||||
bool8 sub_80FA484(bool32 a0);
|
||||
void var_800D_set_xB(void);
|
||||
struct UnkLinkRfuStruct_02022B14 *sub_80F9800(void);
|
||||
struct GFtgtGname *sub_80F9800(void);
|
||||
void sub_80FCF34(void);
|
||||
void InitRFU(void);
|
||||
void sub_80FEB14(void);
|
||||
@@ -169,7 +197,7 @@ bool8 sub_80FC6E8(struct UnkRfuStruct_2_Sub_124 * a0, u8 *a1);
|
||||
bool8 sub_80FC63C(struct UnkRfuStruct_2_Sub_9e8 * a0, u8 *a1);
|
||||
u8 sub_80FEA34(u8 a0, u16 a1);
|
||||
void sub_80FDA30(u32 a0);
|
||||
void sub_80FCB54(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r3);
|
||||
void sub_80FCB54(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3);
|
||||
void rfu_syncVBlank_(void);
|
||||
s32 sub_80FD430(void (*func1)(u8, u8), void (*func2)(u16));
|
||||
void sub_80FEB3C(void);
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
#define GUARD_TRADE_H
|
||||
|
||||
#include "global.h"
|
||||
#include "librfu.h"
|
||||
#include "link_rfu.h"
|
||||
#include "constants/trade.h"
|
||||
|
||||
extern struct MailStruct gLinkPartnerMail[6];
|
||||
@@ -11,7 +11,7 @@ extern u8 gSelectedTradeMonPositions[2];
|
||||
extern const u16 gUnknown_826601C[];
|
||||
void CB2_ReturnFromLinkTrade(void);
|
||||
s32 sub_804FB34(void);
|
||||
s32 CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet);
|
||||
s32 GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct rfuPlayer, struct UnkLinkRfuStruct_02022B14Substruct rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet);
|
||||
s32 CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet);
|
||||
s32 GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet);
|
||||
|
||||
#endif //GUARD_TRADE_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
struct UnkStruct_Shared
|
||||
{
|
||||
struct UnkLinkRfuStruct_02022B14 field_0;
|
||||
struct GFtgtGname field_0;
|
||||
u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH];
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ struct TradeUnkStruct
|
||||
u32 personality;
|
||||
};
|
||||
|
||||
extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_203B064;
|
||||
extern struct GFtgtGnameSub gUnknown_203B064;
|
||||
extern u16 gUnionRoomOfferedSpecies;
|
||||
extern u8 gUnionRoomRequestedMonType;
|
||||
|
||||
|
||||
+15
-18
@@ -58,10 +58,7 @@ struct UnkRfuStruct_2
|
||||
/* 0x0fe */ u16 unk_fe;
|
||||
/* 0x100 */ u16 unk_100;
|
||||
/* 0x102 */ u8 unk_102;
|
||||
/* 0x103 */ u8 filler_103[0x10A - 0x103];
|
||||
/* 0x10A */ struct UnkLinkRfuStruct_02022B14 unk_10A;
|
||||
/* 0x11B */ u8 filler_;
|
||||
/* 0x11C */ u8 playerName[PLAYER_NAME_LENGTH];
|
||||
/* 0x104 */ struct RfuTgtData unk_104;
|
||||
/* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124;
|
||||
/* 0x6a0 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8;
|
||||
/* 0x8d4 */ struct UnkRfuStruct_2_Sub_c1c unk_c1c;
|
||||
@@ -112,7 +109,7 @@ static struct RfuAPIBuffer gRfuAPIBuffer;
|
||||
static u8 gUnknown_3001FF8[14];
|
||||
static u16 gUnknown_3002008[7];
|
||||
|
||||
struct UnkLinkRfuStruct_02022B14 gUnknown_3005440;
|
||||
struct GFtgtGname gUnknown_3005440;
|
||||
struct UnkRfuStruct_2 Rfu;
|
||||
u8 gUnknown_3005E00[PLAYER_NAME_LENGTH];
|
||||
|
||||
@@ -1033,7 +1030,7 @@ static void rfu_func_080F97B8(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct UnkLinkRfuStruct_02022B14 *sub_80F9800(void)
|
||||
struct GFtgtGname *sub_80F9800(void)
|
||||
{
|
||||
return &gUnknown_3005440;
|
||||
}
|
||||
@@ -1994,7 +1991,7 @@ static void sub_80FAF1C(void)
|
||||
|
||||
void sub_80FAF34(void)
|
||||
{
|
||||
memset(&gUnknown_3005440, 0, 0xD);
|
||||
memset(&gUnknown_3005440, 0, RFU_GAME_NAME_LENGTH);
|
||||
sub_80FCB54(&gUnknown_3005440, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -2107,7 +2104,7 @@ static void sub_80FB184(u8 a0, u8 unused1)
|
||||
{
|
||||
if ((gUnknown_3005E10.unk_14 >> i) & 1)
|
||||
{
|
||||
struct UnkLinkRfuStruct_02022B14 *structPtr = (void *)&gRfuLinkStatus->partner[i].gname;
|
||||
struct GFtgtGname *structPtr = (void *)&gRfuLinkStatus->partner[i].gname;
|
||||
if (structPtr->unk_0a_0 == sub_80F9800()->unk_0a_0)
|
||||
{
|
||||
Rfu.unk_cd1[i] = 0;
|
||||
@@ -2267,7 +2264,7 @@ static u8 sub_80FB5A0(s32 a0)
|
||||
{
|
||||
if ((a0 >> i) & 1)
|
||||
{
|
||||
struct UnkLinkRfuStruct_02022B14 *structPtr = (void *)&gRfuLinkStatus->partner[i].gname;
|
||||
struct GFtgtGname *structPtr = (void *)&gRfuLinkStatus->partner[i].gname;
|
||||
if (structPtr->unk_0a_0 == 0x45)
|
||||
ret |= (1 << i);
|
||||
}
|
||||
@@ -2565,7 +2562,7 @@ static u8 sub_80FBC70(const u8 *a0, u16 a1)
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
u16 trainerId = ReadU16(((struct UnkLinkRfuStruct_02022B14 *)gRfuLinkStatus->partner[i].gname)->unk_00.playerTrainerId);
|
||||
u16 trainerId = ReadU16(((struct GFtgtGname *)gRfuLinkStatus->partner[i].gname)->unk_00.playerTrainerId);
|
||||
if (sub_80FA44C(gRfuLinkStatus->partner[i].serialNo)
|
||||
&& !StringCompare(a0, gRfuLinkStatus->partner[i].uname)
|
||||
&& a1 == trainerId)
|
||||
@@ -2697,7 +2694,7 @@ void sub_80FBF54(const u8 *src, u16 trainerId)
|
||||
data[8] = trainerId;
|
||||
}
|
||||
|
||||
static bool32 sub_80FBF98(s16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr)
|
||||
static bool32 sub_80FBF98(s16 a1, struct GFtgtGname *structPtr)
|
||||
{
|
||||
if (sub_80F9800()->unk_0a_0 == 0x45)
|
||||
{
|
||||
@@ -2710,7 +2707,7 @@ static bool32 sub_80FBF98(s16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr)
|
||||
}
|
||||
else if (a1 == 0x44)
|
||||
{
|
||||
struct UnkLinkRfuStruct_02022B14 *structPtr2 = &Rfu.unk_10A;
|
||||
struct GFtgtGname *structPtr2 = (struct GFtgtGname *)&Rfu.unk_104.gname;
|
||||
if (structPtr2->species == SPECIES_EGG)
|
||||
{
|
||||
if (structPtr->species == structPtr2->species)
|
||||
@@ -2742,11 +2739,11 @@ static void sub_80FC028(u8 taskId)
|
||||
|
||||
if (Rfu.unk_ccd != 0 && gUnknown_3005E10.unk_06 == 0)
|
||||
{
|
||||
u16 trainerId = ReadU16(Rfu.unk_10A.unk_00.playerTrainerId);
|
||||
u8 id = sub_80FBC70(Rfu.playerName, trainerId);
|
||||
u16 trainerId = ReadU16(((struct GFtgtGname *)&Rfu.unk_104.gname)->unk_00.playerTrainerId);
|
||||
u8 id = sub_80FBC70(Rfu.unk_104.uname, trainerId);
|
||||
if (id != 0xFF)
|
||||
{
|
||||
if (!sub_80FBF98(gTasks[taskId].data[1], (struct UnkLinkRfuStruct_02022B14 *)&gRfuLinkStatus->partner[id].gname))
|
||||
if (!sub_80FBF98(gTasks[taskId].data[1], (struct GFtgtGname *)&gRfuLinkStatus->partner[id].gname))
|
||||
{
|
||||
if (gRfuLinkStatus->partner[id].slot != 0xFF && !sub_80FD610(gRfuLinkStatus->partner[id].id, 0x5A))
|
||||
{
|
||||
@@ -2763,14 +2760,14 @@ static void sub_80FC028(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80FC114(const u8 *name, struct UnkLinkRfuStruct_02022B14 *structPtr, u8 a2)
|
||||
void sub_80FC114(const u8 *name, struct GFtgtGname *structPtr, u8 a2)
|
||||
{
|
||||
u8 taskId, taskId2;
|
||||
|
||||
Rfu.unk_ccf = 0;
|
||||
Rfu.unk_f1 = 0;
|
||||
StringCopy(Rfu.playerName, name);
|
||||
memcpy(&Rfu.unk_10A, structPtr, 0xD);
|
||||
StringCopy(Rfu.unk_104.uname, name);
|
||||
memcpy(Rfu.unk_104.gname, structPtr, RFU_GAME_NAME_LENGTH);
|
||||
sub_80FEB3C();
|
||||
taskId = CreateTask(sub_80FC028, 2);
|
||||
gTasks[taskId].data[1] = a2;
|
||||
|
||||
+2
-2
@@ -3881,7 +3881,7 @@ static void CursorCB_Register(u8 taskId)
|
||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
|
||||
|
||||
switch (CanRegisterMonForTradingBoard(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_80F9800(), species2, species, obedience))
|
||||
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)sub_80F9800(), species2, species, obedience))
|
||||
{
|
||||
case CANT_REGISTER_MON:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
|
||||
@@ -3907,7 +3907,7 @@ static void CursorCB_Trade1(u8 taskId)
|
||||
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
|
||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_80F9800(), gUnknown_203B064, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
|
||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)sub_80F9800(), gUnknown_203B064, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
|
||||
|
||||
if (stringId != UR_TRADE_MSG_NONE)
|
||||
{
|
||||
|
||||
+2
-2
@@ -2763,7 +2763,7 @@ static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet)
|
||||
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub a0, struct GFtgtGnameSub a1, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet)
|
||||
{
|
||||
u8 r9 = a0.hasNationalDex;
|
||||
u8 r4 = a0.isChampion;
|
||||
@@ -2843,7 +2843,7 @@ int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, str
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species, u16 a2, u8 a3)
|
||||
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub a0, u16 species, u16 a2, u8 a3)
|
||||
{
|
||||
u8 canTradeEggAndNational = a0.hasNationalDex;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user