mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Sync link_rfu_2.c
This commit is contained in:
parent
3f97763181
commit
e6f5c4f264
@ -3,12 +3,6 @@
|
||||
|
||||
#include "task.h"
|
||||
|
||||
// Exported type declarations
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
|
||||
void CreateTask_EnterCableClubSeat(TaskFunc taskFunc);
|
||||
u8 CreateTask_ReestablishCableClubLink(void);
|
||||
void CB2_ReturnFromCableClubBattle(void);
|
||||
|
@ -12,22 +12,18 @@
|
||||
#define USING_MINIGAME 8
|
||||
#define USING_BATTLE_TOWER 9
|
||||
|
||||
#define LINKUP_ONGOING 0
|
||||
#define LINKUP_SUCCESS 1
|
||||
#define LINKUP_SOMEONE_NOT_READY 2
|
||||
#define LINKUP_DIFF_SELECTIONS 3
|
||||
#define LINKUP_WRONG_NUM_PLAYERS 4
|
||||
#define LINKUP_FAILED 5
|
||||
#define LINKUP_CONNECTION_ERROR 6
|
||||
#define LINKUP_PLAYER_NOT_READY 7
|
||||
#define LINKUP_UNK8 8
|
||||
#define LINKUP_PARTNER_NOT_READY 9
|
||||
#define LINKUP_ONGOING 0
|
||||
#define LINKUP_SUCCESS 1
|
||||
#define LINKUP_SOMEONE_NOT_READY 2
|
||||
#define LINKUP_DIFF_SELECTIONS 3
|
||||
#define LINKUP_WRONG_NUM_PLAYERS 4
|
||||
#define LINKUP_FAILED 5
|
||||
#define LINKUP_CONNECTION_ERROR 6
|
||||
#define LINKUP_PLAYER_NOT_READY 7
|
||||
#define LINKUP_UNK8 8
|
||||
#define LINKUP_PARTNER_NOT_READY 9
|
||||
#define LINKUP_FAILED_CONTEST_GMODE 10
|
||||
#define LINKUP_FAILED_BATTLE_TOWER 11
|
||||
#define LINKUP_FOREIGN_GAME 12
|
||||
|
||||
#define LINK_BATTLE_TOWER_SAME_MON 1
|
||||
#define LINK_BATTLE_TOWER_SAME_MONS 2
|
||||
#define LINK_BATTLE_TOWER_DIFF_MODE 3
|
||||
#define LINKUP_FAILED_BATTLE_TOWER 11
|
||||
#define LINKUP_FOREIGN_GAME 12
|
||||
|
||||
#endif //GUARD_CONSTANTS_CABLE_CLUB_H
|
||||
|
@ -276,7 +276,6 @@ void CreateWirelessStatusIndicatorSprite(u8, u8);
|
||||
void sub_800ADF8(void);
|
||||
void SetWirelessCommType1(void);
|
||||
void CheckShouldAdvanceLinkState(void);
|
||||
void sub_8011BD0(void);
|
||||
u8 IsLinkMaster(void);
|
||||
void sub_800AC34(void);
|
||||
bool8 HandleLinkConnection(void);
|
||||
@ -288,11 +287,11 @@ u8 GetSioMultiSI(void);
|
||||
void sub_800AAF4(void);
|
||||
void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06);
|
||||
void sub_800B348(void);
|
||||
void sub_800B3A4(u32 who);
|
||||
void LinkPlayerFromBlock(u32 who);
|
||||
bool32 sub_800A07C(void);
|
||||
void ResetLinkPlayerCount(void);
|
||||
void sub_800AA04(u8 a0);
|
||||
void sub_800B4C0(void);
|
||||
void SetWirelessCommType0(void);
|
||||
bool32 sub_800B504(void);
|
||||
|
||||
extern u16 gLinkPartnersHeldKeys[6];
|
||||
|
@ -5,7 +5,18 @@
|
||||
#include "link.h"
|
||||
#include "AgbRfu_LinkManager.h"
|
||||
|
||||
// Exported type declarations
|
||||
#define RFU_COMMAND_0x4400 0x4400
|
||||
#define RFU_COMMAND_0x8800 0x8800
|
||||
#define RFU_COMMAND_0x8900 0x8900
|
||||
#define RFU_COMMAND_0xA100 0xA100
|
||||
#define RFU_COMMAND_0x7700 0x7700
|
||||
#define RFU_COMMAND_0x7800 0x7800
|
||||
#define RFU_COMMAND_0x6600 0x6600
|
||||
#define RFU_COMMAND_0x5F00 0x5F00
|
||||
#define RFU_COMMAND_0x2F00 0x2F00
|
||||
#define RFU_COMMAND_0xBE00 0xBE00
|
||||
#define RFU_COMMAND_0xEE00 0xEE00
|
||||
#define RFU_COMMAND_0xED00 0xED00
|
||||
|
||||
// RfuTgtData.gname is read as these structs.
|
||||
struct GFtgtGnameSub
|
||||
@ -67,34 +78,34 @@ struct UnkLinkRfuStruct_02022B44
|
||||
u8 fill_84[0x58];
|
||||
};
|
||||
|
||||
struct UnkRfuStruct_2_Sub_6c
|
||||
struct RfuBlockSend
|
||||
{
|
||||
/* 0x00 */ u16 unk_00;
|
||||
/* 0x02 */ u16 unk_02;
|
||||
/* 0x04 */ const u8 *unk_04;
|
||||
/* 0x08 */ u32 unk_08;
|
||||
/* 0x0c */ u32 unk_0c;
|
||||
/* 0x10 */ u8 unk_10;
|
||||
/* 0x11 */ u8 unk_11;
|
||||
/* 0x12 */ u8 unk_12;
|
||||
/* 0x00 */ u16 next;
|
||||
/* 0x02 */ u16 count;
|
||||
/* 0x04 */ const u8 *payload;
|
||||
/* 0x08 */ u32 receivedFlags;
|
||||
/* 0x0c */ u32 failedFlags;
|
||||
/* 0x10 */ bool8 sending;
|
||||
/* 0x11 */ u8 owner;
|
||||
/* 0x12 */ u8 receiving;
|
||||
};
|
||||
|
||||
struct UnkRfuStruct_2_Sub_124
|
||||
struct RfuRecvQueue
|
||||
{
|
||||
/* 0x000 */ u8 unk_00[32][70];
|
||||
/* 0x8c0 */ vu8 unk_8c0;
|
||||
/* 0x8c1 */ vu8 unk_8c1;
|
||||
/* 0x8c2 */ vu8 unk_8c2;
|
||||
/* 0x8c3 */ vu8 unk_8c3;
|
||||
/* 0x8c2 */ vu8 count;
|
||||
/* 0x8c3 */ vu8 full;
|
||||
};
|
||||
|
||||
struct UnkRfuStruct_2_Sub_9e8
|
||||
struct RfuSendQueue
|
||||
{
|
||||
/* 0x000 */ u8 unk_00[40][14];
|
||||
/* 0x230 */ vu8 unk_230;
|
||||
/* 0x231 */ vu8 unk_231;
|
||||
/* 0x232 */ vu8 unk_232;
|
||||
/* 0x233 */ vu8 unk_233;
|
||||
/* 0x232 */ vu8 count;
|
||||
/* 0x233 */ vu8 full;
|
||||
};
|
||||
|
||||
struct UnkRfuStruct_2_Sub_c1c
|
||||
@ -102,7 +113,7 @@ struct UnkRfuStruct_2_Sub_c1c
|
||||
/* 0x00 */ u8 unk_00[2][14];
|
||||
/* 0x1c */ vu8 unk_1c;
|
||||
/* 0x1d */ vu8 unk_1d;
|
||||
/* 0x1e */ vu8 unk_1e;
|
||||
/* 0x1e */ vu8 count;
|
||||
};
|
||||
|
||||
struct UnkRfuStruct_Sub_Unused
|
||||
@ -114,13 +125,13 @@ struct UnkRfuStruct_Sub_Unused
|
||||
/* 0x203 */ vu8 unk_203;
|
||||
};
|
||||
|
||||
struct UnkRfuStruct_2
|
||||
struct GFRfuManager
|
||||
{
|
||||
/* 0x000 */ void (*linkRfuCallback)(void);
|
||||
/* 0x004 */ u16 unk_04;
|
||||
/* 0x000 */ void (*callback)(void);
|
||||
/* 0x004 */ u16 state;
|
||||
/* 0x006 */ u8 filler_06[4];
|
||||
/* 0x00a */ u16 unk_0a;
|
||||
/* 0x00c */ u8 unk_0c;
|
||||
/* 0x00a */ u16 linkmanMsg;
|
||||
/* 0x00c */ u8 parentChild;
|
||||
/* 0x00d */ u8 playerCount;
|
||||
/* 0x00e */ u8 unk_0e;
|
||||
/* 0x00f */ u8 unk_0f;
|
||||
@ -130,19 +141,19 @@ struct UnkRfuStruct_2
|
||||
/* 0x04c */ u8 unk_4c[14];
|
||||
/* 0x05a */ u8 unk_5a;
|
||||
/* 0x05b */ u8 unk_5b;
|
||||
/* 0x05c */ u8 unk_5c[5];
|
||||
/* 0x061 */ u8 unk_61[5];
|
||||
/* 0x066 */ u8 unk_66;
|
||||
/* 0x067 */ u8 unk_67;
|
||||
/* 0x05c */ bool8 unk_5c[MAX_RFU_PLAYERS];
|
||||
/* 0x061 */ bool8 unk_61[MAX_RFU_PLAYERS];
|
||||
/* 0x066 */ u8 idleTaskId;
|
||||
/* 0x067 */ u8 searchTaskId;
|
||||
/* 0x068 */ u8 filler_68[4];
|
||||
/* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c;
|
||||
/* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5];
|
||||
/* 0x06c */ struct RfuBlockSend unk_6c;
|
||||
/* 0x080 */ struct RfuBlockSend unk_80[MAX_RFU_PLAYERS];
|
||||
/* 0x0e4 */ u8 unk_e4[5];
|
||||
/* 0x0e9 */ u8 unk_e9[5];
|
||||
/* 0x0ee */ vu8 unk_ee;
|
||||
/* 0x0ef */ u8 unk_ef;
|
||||
/* 0x0f0 */ u8 unk_f0;
|
||||
/* 0x0f1 */ u8 unk_f1;
|
||||
/* 0x0ee */ vu8 errorState;
|
||||
/* 0x0ef */ bool8 isShuttingDown;
|
||||
/* 0x0f0 */ u8 linkLossRecoveryState;
|
||||
/* 0x0f1 */ u8 errorStatus;
|
||||
/* 0x0f2 */ u16 unk_f2[6];
|
||||
/* 0x0fe */ u16 unk_fe;
|
||||
/* 0x100 */ u16 unk_100;
|
||||
@ -151,18 +162,18 @@ struct UnkRfuStruct_2
|
||||
/* 0x10A */ struct GFtgtGname unk_10A;
|
||||
u8 filler_;
|
||||
u8 playerName[PLAYER_NAME_LENGTH + 1];
|
||||
/* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124;
|
||||
/* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8;
|
||||
/* 0x124 */ struct RfuRecvQueue recvQueue;
|
||||
/* 0x9e8 */ struct RfuSendQueue sendQueue;
|
||||
/* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c;
|
||||
/* 0xc3c */ vu8 unk_c3c;
|
||||
/* 0xc3d */ u8 unk_c3d;
|
||||
/* 0xc3e */ vu8 unk_c3e;
|
||||
/* 0xc3e */ vu8 childSlot;
|
||||
/* 0xc3f */ u8 unk_c3f[70];
|
||||
/* 0xc85 */ u8 unk_c85;
|
||||
/* 0xc86 */ u8 unk_c86;
|
||||
/* 0xc87 */ u8 unk_c87[5][7][2];
|
||||
/* 0xccd */ u8 unk_ccd;
|
||||
/* 0xcce */ u8 unk_cce;
|
||||
/* 0xc87 */ u8 recvCmds[5][7][2];
|
||||
/* 0xccd */ u8 parentId;
|
||||
/* 0xcce */ u8 multiplayerId;
|
||||
/* 0xccf */ u8 unk_ccf;
|
||||
/* 0xcd0 */ vu8 unk_cd0;
|
||||
/* 0xcd1 */ u8 unk_cd1[4];
|
||||
@ -172,57 +183,48 @@ struct UnkRfuStruct_2
|
||||
/* 0xcdb */ vu8 unk_cdb;
|
||||
/* 0xcdc */ vu8 unk_cdc;
|
||||
/* 0xcdd */ u8 unk_cdd;
|
||||
/* 0xcde */ u8 unk_cde[4];
|
||||
/* 0xcde */ u8 linkPlayerIdx[RFU_CHILD_MAX];
|
||||
/* 0xce2 */ u8 unk_ce2;
|
||||
/* 0xce2 */ u8 unk_ce3;
|
||||
/* 0xce4 */ u8 unk_ce4;
|
||||
/* 0xce5 */ u8 unk_ce5;
|
||||
/* 0xce5 */ u8 unk_ce6;
|
||||
/* 0xce7 */ u8 unk_ce7;
|
||||
/* 0xce7 */ u8 acceptSlot_flag;
|
||||
/* 0xce8 */ u8 unk_ce8;
|
||||
/* 0xce9 */ u8 unk_ce9;
|
||||
/* 0xcea */ u8 unk_cea[4];
|
||||
/* 0xcee */ u8 unk_cee[4];
|
||||
}; // size = 0xcf4
|
||||
|
||||
struct UnkRfuStruct_8010A14
|
||||
{
|
||||
char unk_00[15];
|
||||
u8 unk_0f;
|
||||
u8 unk_10[4];
|
||||
struct LinkPlayer unk_14[5];
|
||||
u8 fill_a0[0x5c];
|
||||
};
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
extern struct GFtgtGname gUnknown_02022B14;
|
||||
extern u8 gUnknown_02022B22[];
|
||||
extern struct UnkRfuStruct_2 Rfu;
|
||||
extern struct GFtgtGname gHostRFUtgtGnameBuffer;
|
||||
extern u8 gHostRFUtgtUnameBuffer[];
|
||||
extern struct GFRfuManager Rfu;
|
||||
extern u8 gWirelessStatusIndicatorSpriteId;
|
||||
|
||||
// Exported ROM declarations
|
||||
void WipeTrainerNameRecords(void);
|
||||
void sub_800E700(void);
|
||||
void LinkRfu_Shutdown(void);
|
||||
void sub_800F6FC(u8 who);
|
||||
void sub_800F728(u8 who);
|
||||
void Rfu_SetBlockReceivedFlag(u8 who);
|
||||
void Rfu_ResetBlockReceivedFlag(u8 who);
|
||||
bool32 IsSendingKeysToRfu(void);
|
||||
void sub_800F804(void);
|
||||
void StartSendingKeysToRfu(void);
|
||||
void sub_800F850(void);
|
||||
u8 sub_800FCD8(void);
|
||||
bool32 sub_800FE84(const u8 *src, size_t size);
|
||||
u8 Rfu_GetBlockReceivedStatus(void);
|
||||
bool32 Rfu_InitBlockSend(const u8 *src, size_t size);
|
||||
void ClearLinkRfuCallback(void);
|
||||
u8 sub_80104F4(void);
|
||||
u8 rfu_get_multiplayer_id(void);
|
||||
u8 Rfu_GetLinkPlayerCount(void);
|
||||
u8 Rfu_GetMultiplayerId(void);
|
||||
bool8 sub_8010100(u8 a0);
|
||||
bool8 IsLinkRfuTaskFinished(void);
|
||||
bool8 Rfu_IsMaster(void);
|
||||
void task_add_05_task_del_08FA224_when_no_RfuFunc(void);
|
||||
void sub_8010434(void);
|
||||
void sub_800E604(void);
|
||||
void ResetLinkRfuGFLayer(void);
|
||||
void sub_800E174(void);
|
||||
void sub_800E6D0(void);
|
||||
void InitRFU(void);
|
||||
bool32 sub_8010EC0(void);
|
||||
bool32 sub_8010F1C(void);
|
||||
bool32 RfuIsErrorStatus1or2(void);
|
||||
@ -233,7 +235,7 @@ void sub_80111B0(bool32 a0);
|
||||
u8 RfuGetErrorStatus(void);
|
||||
struct GFtgtGname *GetHostRFUtgtGname(void);
|
||||
void UpdateGameData_GroupLockedIn(u8 a0);
|
||||
void sub_8011170(u32 a0);
|
||||
void GetLinkmanErrorParams(u32 a0);
|
||||
void RfuSetErrorStatus(u8 a0, u16 a1);
|
||||
u8 sub_801048C(bool32 a0);
|
||||
void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *buff1, u8 *buff2);
|
||||
@ -259,7 +261,7 @@ void UpdateGameDataWithActivitySpriteGendersFlag(u8 a0, u32 a1, u32 a2);
|
||||
void CreateTask_RfuReconnectWithParent(const u8 *src, u16 trainerId);
|
||||
void SetGnameBufferWonderFlags(bool32 a0, bool32 a1);
|
||||
void ClearAndInitHostRFUtgtGname(void);
|
||||
void sub_8010FCC(u32 a0, u32 a1, u32 a2);
|
||||
void SetTradeBoardRegisteredMonInfo(u32 type, u32 species, u32 level);
|
||||
void InitializeRfuLinkManager_EnterUnionRoom(void);
|
||||
void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2);
|
||||
bool32 IsUnionRoomListenTaskActive(void);
|
||||
@ -271,7 +273,8 @@ void sub_800EF7C(void);
|
||||
bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
|
||||
bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
|
||||
s32 sub_800E87C(u8 idx);
|
||||
void sub_8011BA4(void);
|
||||
void CreateTask_RfuIdle(void);
|
||||
void DestroyTask_RfuIdle(void);
|
||||
void sub_8010198(void);
|
||||
void sub_8011AC8(void);
|
||||
void LinkRfu_FatalError(void);
|
||||
@ -280,42 +283,17 @@ void sub_80104B0(void);
|
||||
void sub_8011A50(void);
|
||||
void sub_80110B8(u32 a0);
|
||||
bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2);
|
||||
void sub_800EAB4(void);
|
||||
void sub_800EAFC(void);
|
||||
void sub_800ED34(u16 unused);
|
||||
void sub_800EDBC(u16 unused);
|
||||
void sub_800F048(void);
|
||||
void sub_800F86C(u8 unused);
|
||||
void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data);
|
||||
void sub_800FD14(u16 command);
|
||||
void rfufunc_80F9F44(void);
|
||||
void sub_800FFB0(void);
|
||||
void rfufunc_80FA020(void);
|
||||
bool32 sub_8010454(u32 a0);
|
||||
void sub_8010528(void);
|
||||
void sub_8010750(void);
|
||||
s32 sub_80107A0(void);
|
||||
void sub_801084C(u8 taskId);
|
||||
void sub_80109E8(u16 a0);
|
||||
void sub_8010A70(void *a0);
|
||||
void sub_8010AAC(u8 taskId);
|
||||
void sub_8010D0C(u8 taskId);
|
||||
void sub_80115EC(s32 a0);
|
||||
u8 sub_8011CE4(const u8 *a0, u16 a1);
|
||||
void sub_8011D6C(u32 a0);
|
||||
void sub_8011E94(u32 a0, u32 a1);
|
||||
bool32 RfuSerialNumberIsValid(u32 serialNo);
|
||||
bool8 sub_8012224(void);
|
||||
void sub_801227C(void);
|
||||
void sub_801209C(u8 taskId);
|
||||
void sub_8011BF8(void);
|
||||
void sub_8011BA4(void);
|
||||
void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr);
|
||||
void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr);
|
||||
void sub_800D6C8(struct RfuRecvQueue *ptr);
|
||||
void sub_800D724(struct RfuSendQueue *ptr);
|
||||
void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr);
|
||||
void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2);
|
||||
void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2);
|
||||
bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2);
|
||||
bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2);
|
||||
void sub_800D7D8(struct RfuRecvQueue *q1, u8 *q2);
|
||||
void sub_800D888(struct RfuSendQueue *q1, u8 *q2);
|
||||
bool8 sub_800D934(struct RfuRecvQueue *q1, u8 *q2);
|
||||
bool8 sub_800D9DC(struct RfuSendQueue *q1, u8 *q2);
|
||||
void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2);
|
||||
bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2);
|
||||
void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2);
|
||||
|
@ -162,7 +162,6 @@ extern u8 gUnionRoomRequestedMonType;
|
||||
// Exported ROM declarations
|
||||
|
||||
u8 CreateTask_CreateTradeMenu(void);
|
||||
void nullsub_89(u8 taskId);
|
||||
void var_800D_set_xB(void);
|
||||
void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0);
|
||||
void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "battle_message.h"
|
||||
#include "cable_club.h"
|
||||
#include "link.h"
|
||||
#include "link_rfu.h"
|
||||
#include "party_menu.h"
|
||||
#include "pokemon.h"
|
||||
#include "recorded_battle.h"
|
||||
@ -827,7 +828,7 @@ void sub_8033648(void)
|
||||
|
||||
if (gReceivedRemoteLinkPlayers != 0 && (gBattleTypeFlags & BATTLE_TYPE_20))
|
||||
{
|
||||
sub_8011BD0();
|
||||
DestroyTask_RfuIdle();
|
||||
for (i = 0; i < GetLinkPlayerCount(); i++)
|
||||
{
|
||||
if (GetBlockReceivedStatus() & gBitTable[i])
|
||||
|
@ -1500,7 +1500,7 @@ static void sub_80808D4(void)
|
||||
switch (sBerryBlenderData->mainState)
|
||||
{
|
||||
case 0:
|
||||
sub_800B4C0();
|
||||
SetWirelessCommType0();
|
||||
sub_8080588();
|
||||
Blender_SetParticipantBerryData(0, gSpecialVar_ItemId);
|
||||
Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId);
|
||||
|
@ -842,7 +842,7 @@ void StartBerryCrush(MainCallback callback)
|
||||
SetMainCallback2(callback);
|
||||
Rfu.unk_10 = 0;
|
||||
Rfu.unk_12 = 0;
|
||||
Rfu.unk_ee = 1;
|
||||
Rfu.errorState = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -853,7 +853,7 @@ void StartBerryCrush(MainCallback callback)
|
||||
SetMainCallback2(callback);
|
||||
Rfu.unk_10 = 0;
|
||||
Rfu.unk_12 = 0;
|
||||
Rfu.unk_ee = 1;
|
||||
Rfu.errorState = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -863,7 +863,7 @@ void StartBerryCrush(MainCallback callback)
|
||||
SetMainCallback2(callback);
|
||||
Rfu.unk_10 = 0;
|
||||
Rfu.unk_12 = 0;
|
||||
Rfu.unk_ee = 1;
|
||||
Rfu.errorState = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
|
||||
if (!IsLinkTaskFinished())
|
||||
{
|
||||
if (++task->data[1] > 1800)
|
||||
sub_8011170(0x6000);
|
||||
GetLinkmanErrorParams(0x6000);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -488,7 +488,7 @@ static void rfu_CB_configGameData(u8 reqCommand, u16 reqResult)
|
||||
for (i = 0; i < RFU_GAME_NAME_LENGTH; ++i)
|
||||
gRfuLinkStatus->my.gname[i] = *gname_uname_p++;
|
||||
++gname_uname_p;
|
||||
for (i = 0; i < RFU_USER_NAME_LENGTH; ++i)
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH + 1; ++i)
|
||||
gRfuLinkStatus->my.uname[i] = *gname_uname_p++;
|
||||
}
|
||||
rfu_STC_REQ_callback(reqCommand, reqResult);
|
||||
@ -718,7 +718,7 @@ static void rfu_STC_readParentCandidateList(void)
|
||||
for (j = 0; j < RFU_GAME_NAME_LENGTH; ++j)
|
||||
target->gname[j] = *packet_p++;
|
||||
++packet_p;
|
||||
for (j = 0; j < RFU_USER_NAME_LENGTH; ++j)
|
||||
for (j = 0; j < PLAYER_NAME_LENGTH + 1; ++j)
|
||||
target->uname[j] = *packet_p++;
|
||||
++gRfuLinkStatus->findParentCount;
|
||||
}
|
||||
|
137
src/link.c
137
src/link.c
@ -124,8 +124,8 @@ EWRAM_DATA struct {
|
||||
u8 lastSendQueueCount;
|
||||
u8 unk_06;
|
||||
} sLinkErrorBuffer = {};
|
||||
EWRAM_DATA u16 gUnknown_02022B08 = 0;
|
||||
EWRAM_DATA void *gUnknown_02022B0C = NULL;
|
||||
static EWRAM_DATA u16 sUnknown_02022B08 = 0;
|
||||
static EWRAM_DATA void *sLinkErrorBgTilemapBuffer = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
@ -155,7 +155,7 @@ static void sub_800AE5C(void);
|
||||
static void CheckErrorStatus(void);
|
||||
static void CB2_PrintErrorMessage(void);
|
||||
static bool8 IsSioMultiMaster(void);
|
||||
static void sub_800B4A4(void);
|
||||
static void SetWirelessCommType0_Internal(void);
|
||||
static void DisableSerial(void);
|
||||
static void EnableSerial(void);
|
||||
static void CheckMasterOrSlave(void);
|
||||
@ -172,29 +172,29 @@ static void SendRecvDone(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal");
|
||||
const u32 gWirelessLinkDisplayGfx[] = INCBIN_U32("graphics/interface/wireless_link_display.4bpp.lz");
|
||||
const u32 gWirelessLinkDisplayTilemap[] = INCBIN_U32("graphics/interface/wireless_link_display.bin.lz");
|
||||
const u16 gLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal");
|
||||
const u16 gLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp");
|
||||
const u8 unkstring_82ed160[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}");
|
||||
const u16 g2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp");
|
||||
const struct BlockRequest gUnknown_082ED1A8[] = {
|
||||
static const u16 sWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal");
|
||||
static const u32 sWirelessLinkDisplayGfx[] = INCBIN_U32("graphics/interface/wireless_link_display.4bpp.lz");
|
||||
static const u32 sWirelessLinkDisplayTilemap[] = INCBIN_U32("graphics/interface/wireless_link_display.bin.lz");
|
||||
static const u16 sLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal");
|
||||
static const u16 sLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp");
|
||||
static const u8 sUnusedTransparentWhite[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}");
|
||||
static const u16 s2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp");
|
||||
static const struct BlockRequest sBlockRequests[] = {
|
||||
{gBlockSendBuffer, 200},
|
||||
{gBlockSendBuffer, 200},
|
||||
{gBlockSendBuffer, 100},
|
||||
{gBlockSendBuffer, 220},
|
||||
{gBlockSendBuffer, 40}
|
||||
};
|
||||
const u8 gBGControlRegs[] = {
|
||||
static const u8 sBGControlRegs[] = {
|
||||
REG_OFFSET_BG0CNT,
|
||||
REG_OFFSET_BG1CNT,
|
||||
REG_OFFSET_BG2CNT,
|
||||
REG_OFFSET_BG3CNT
|
||||
};
|
||||
const char gASCIIGameFreakInc[] = "GameFreak inc.";
|
||||
const char gASCIITestPrint[] = "TEST PRINT\nP0\nP1\nP2\nP3";
|
||||
const struct BgTemplate gUnknown_082ED1FC[] = {
|
||||
static const char sASCIIGameFreakInc[] = "GameFreak inc.";
|
||||
static const char sASCIITestPrint[] = "TEST PRINT\nP0\nP1\nP2\nP3";
|
||||
static const struct BgTemplate sLinkErrorBgTemplates[] = {
|
||||
{
|
||||
.bg = 0,
|
||||
.charBaseIndex = 2,
|
||||
@ -207,15 +207,36 @@ const struct BgTemplate gUnknown_082ED1FC[] = {
|
||||
.priority = 1
|
||||
}
|
||||
};
|
||||
const struct WindowTemplate gUnknown_082ED204[] = {
|
||||
{0x00, 0x00, 0x00, 0x1E, 0x05, 0x0F, 0x0002},
|
||||
{0x00, 0x00, 0x06, 0x1E, 0x07, 0x0F, 0x0098},
|
||||
{0x00, 0x00, 0x0D, 0x1E, 0x07, 0x0F, 0x016A},
|
||||
DUMMY_WIN_TEMPLATE
|
||||
static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 0,
|
||||
.tilemapTop = 0,
|
||||
.width = 30,
|
||||
.height = 5,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x002
|
||||
}, {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 0,
|
||||
.tilemapTop = 6,
|
||||
.width = 30,
|
||||
.height = 7,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x098
|
||||
}, {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 0,
|
||||
.tilemapTop = 13,
|
||||
.width = 30,
|
||||
.height = 7,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x16A
|
||||
}, DUMMY_WIN_TEMPLATE
|
||||
};
|
||||
|
||||
static const u8 sTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY };
|
||||
static const u8 sUnused_082ED224[] = {0x00, 0xff, 0xfe, 0xff, 0x00};
|
||||
static const u8 sUnused_082ED224[] = {0x00, 0xFF, 0xFE, 0xFF, 0x00};
|
||||
|
||||
// .text
|
||||
|
||||
@ -229,7 +250,7 @@ bool8 IsWirelessAdapterConnected(void)
|
||||
rfu_waitREQComplete();
|
||||
return TRUE;
|
||||
}
|
||||
sub_800B4A4();
|
||||
SetWirelessCommType0_Internal();
|
||||
CloseLink();
|
||||
RestoreSerialTimer3IntrHandlers();
|
||||
return FALSE;
|
||||
@ -242,8 +263,8 @@ void Task_DestroySelf(u8 taskId)
|
||||
|
||||
static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock, u16 a4)
|
||||
{
|
||||
LoadPalette(gLinkTestDigitsPal, paletteNum * 16, 0x20);
|
||||
DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * a4), sizeof gLinkTestDigitsGfx);
|
||||
LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20);
|
||||
DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * a4), sizeof sLinkTestDigitsGfx);
|
||||
gLinkTestBGInfo.screenBaseBlock = screenBaseBlock;
|
||||
gLinkTestBGInfo.paletteNum = paletteNum;
|
||||
gLinkTestBGInfo.dummy_8 = a4;
|
||||
@ -265,12 +286,12 @@ static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charB
|
||||
|
||||
void sub_80094EC(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock)
|
||||
{
|
||||
LoadPalette(gLinkTestDigitsPal, paletteNum * 16, 0x20);
|
||||
DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof gLinkTestDigitsGfx);
|
||||
LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20);
|
||||
DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof sLinkTestDigitsGfx);
|
||||
gLinkTestBGInfo.screenBaseBlock = screenBaseBlock;
|
||||
gLinkTestBGInfo.paletteNum = paletteNum;
|
||||
gLinkTestBGInfo.dummy_8 = 0;
|
||||
SetGpuReg(gBGControlRegs[bgNum], BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock));
|
||||
SetGpuReg(sBGControlRegs[bgNum], BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock));
|
||||
}
|
||||
|
||||
void LinkTestScreen(void)
|
||||
@ -536,8 +557,8 @@ static void ProcessRecvCmds(u8 unused)
|
||||
InitLocalLinkPlayer();
|
||||
block = &gLocalLinkPlayerBlock;
|
||||
block->linkPlayer = gLocalLinkPlayer;
|
||||
memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1);
|
||||
memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1);
|
||||
memcpy(block->magic1, sASCIIGameFreakInc, sizeof(block->magic1) - 1);
|
||||
memcpy(block->magic2, sASCIIGameFreakInc, sizeof(block->magic2) - 1);
|
||||
InitBlockSend(block, sizeof(*block));
|
||||
break;
|
||||
}
|
||||
@ -602,8 +623,8 @@ static void ProcessRecvCmds(u8 unused)
|
||||
linkPlayer->progressFlags = 0;
|
||||
}
|
||||
sub_800B524(linkPlayer);
|
||||
if (strcmp(block->magic1, gASCIIGameFreakInc) != 0
|
||||
|| strcmp(block->magic2, gASCIIGameFreakInc) != 0)
|
||||
if (strcmp(block->magic1, sASCIIGameFreakInc) != 0
|
||||
|| strcmp(block->magic2, sASCIIGameFreakInc) != 0)
|
||||
{
|
||||
SetMainCallback2(CB2_LinkError);
|
||||
}
|
||||
@ -629,7 +650,7 @@ static void ProcessRecvCmds(u8 unused)
|
||||
sub_800A418();
|
||||
break;
|
||||
case LINKCMD_0xCCCC:
|
||||
SendBlock(0, gUnknown_082ED1A8[gRecvCmds[i][1]].address, gUnknown_082ED1A8[gRecvCmds[i][1]].size);
|
||||
SendBlock(0, sBlockRequests[gRecvCmds[i][1]].address, sBlockRequests[gRecvCmds[i][1]].size);
|
||||
break;
|
||||
case LINKCMD_SEND_HELD_KEYS_2:
|
||||
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
|
||||
@ -709,7 +730,7 @@ void sub_8009F18(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_800F804();
|
||||
StartSendingKeysToRfu();
|
||||
}
|
||||
gLinkCallback = sub_8009F70;
|
||||
}
|
||||
@ -763,7 +784,7 @@ u8 GetLinkPlayerCount(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
return sub_80104F4();
|
||||
return Rfu_GetLinkPlayerCount();
|
||||
}
|
||||
return EXTRACT_PLAYER_COUNT(gLinkStatus);
|
||||
}
|
||||
@ -1046,7 +1067,7 @@ u8 GetMultiplayerId(void)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
return rfu_get_multiplayer_id();
|
||||
return Rfu_GetMultiplayerId();
|
||||
}
|
||||
return SIO_MULTI_CNT->id;
|
||||
}
|
||||
@ -1063,7 +1084,7 @@ bool8 SendBlock(u8 unused, const void *src, u16 size)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
return sub_800FE84(src, size);
|
||||
return Rfu_InitBlockSend(src, size);
|
||||
}
|
||||
return InitBlockSend(src, size);
|
||||
}
|
||||
@ -1096,7 +1117,7 @@ u8 GetBlockReceivedStatus(void)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
return sub_800FCD8();
|
||||
return Rfu_GetBlockReceivedStatus();
|
||||
}
|
||||
return (gBlockReceivedStatus[3] << 3) | (gBlockReceivedStatus[2] << 2) | (gBlockReceivedStatus[1] << 1) | (gBlockReceivedStatus[0] << 0);
|
||||
}
|
||||
@ -1105,7 +1126,7 @@ static void SetBlockReceivedFlag(u8 who)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
sub_800F6FC(who);
|
||||
Rfu_SetBlockReceivedFlag(who);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1121,7 +1142,7 @@ void ResetBlockReceivedFlags(void)
|
||||
{
|
||||
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
||||
{
|
||||
sub_800F728(i);
|
||||
Rfu_ResetBlockReceivedFlag(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1137,7 +1158,7 @@ void ResetBlockReceivedFlag(u8 who)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
sub_800F728(who);
|
||||
Rfu_ResetBlockReceivedFlag(who);
|
||||
}
|
||||
else if (gBlockReceivedStatus[who])
|
||||
{
|
||||
@ -1264,7 +1285,7 @@ static void Task_PrintTestData(u8 taskId)
|
||||
char sp[32];
|
||||
int i;
|
||||
|
||||
strcpy(sp, gASCIITestPrint);
|
||||
strcpy(sp, sASCIITestPrint);
|
||||
LinkTest_prntstr(sp, 5, 2);
|
||||
LinkTest_prnthex(gShouldAdvanceLinkState, 2, 1, 2);
|
||||
LinkTest_prnthex(gLinkStatus, 15, 1, 8);
|
||||
@ -1453,7 +1474,7 @@ void sub_800AC34(void)
|
||||
{
|
||||
if (gLinkCallback != NULL)
|
||||
{
|
||||
gUnknown_02022B08++;
|
||||
sUnknown_02022B08++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1508,7 +1529,7 @@ void sub_800AD10(void)
|
||||
{
|
||||
if (gLinkCallback != NULL)
|
||||
{
|
||||
gUnknown_02022B08++;
|
||||
sUnknown_02022B08++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1650,14 +1671,14 @@ void CB2_LinkError(void)
|
||||
{
|
||||
gWirelessCommType = 3;
|
||||
}
|
||||
sub_800E604();
|
||||
ResetLinkRfuGFLayer();
|
||||
}
|
||||
SetVBlankCallback(sub_80096BC);
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, gUnknown_082ED1FC, 2);
|
||||
gUnknown_02022B0C = tilemapBuffer = malloc(0x800);
|
||||
InitBgsFromTemplates(0, sLinkErrorBgTemplates, ARRAY_COUNT(sLinkErrorBgTemplates));
|
||||
sLinkErrorBgTilemapBuffer = tilemapBuffer = malloc(0x800);
|
||||
SetBgTilemapBuffer(1, tilemapBuffer);
|
||||
if (InitWindows(gUnknown_082ED204))
|
||||
if (InitWindows(sLinkErrorWindowTemplates))
|
||||
{
|
||||
DeactivateAllTextPrinters();
|
||||
reset_temp_tile_data_buffers();
|
||||
@ -1683,11 +1704,11 @@ void CB2_LinkError(void)
|
||||
|
||||
static void sub_800B080(void)
|
||||
{
|
||||
LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0);
|
||||
DecompressAndLoadBgGfxUsingHeap(1, gWirelessLinkDisplayGfx, FALSE, 0, 0);
|
||||
CopyToBgTilemapBuffer(1, gWirelessLinkDisplayTilemap, 0, 0);
|
||||
LoadBgTiles(0, s2BlankTilesGfx, 0x20, 0);
|
||||
DecompressAndLoadBgGfxUsingHeap(1, sWirelessLinkDisplayGfx, FALSE, 0, 0);
|
||||
CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
LoadPalette(gWirelessLinkDisplayPal, 0, 0x20);
|
||||
LoadPalette(sWirelessLinkDisplayPal, 0, 0x20);
|
||||
FillWindowPixelBuffer(0, PIXEL_FILL(0));
|
||||
FillWindowPixelBuffer(2, PIXEL_FILL(0));
|
||||
AddTextPrinterParameterized3(0, 3, 2, 6, sTextColors, 0, gText_CommErrorEllipsis);
|
||||
@ -1700,7 +1721,7 @@ static void sub_800B080(void)
|
||||
|
||||
static void sub_800B138(void)
|
||||
{
|
||||
LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0);
|
||||
LoadBgTiles(0, s2BlankTilesGfx, 0x20, 0);
|
||||
FillWindowPixelBuffer(1, PIXEL_FILL(0));
|
||||
FillWindowPixelBuffer(2, PIXEL_FILL(0));
|
||||
AddTextPrinterParameterized3(1, 3, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections);
|
||||
@ -1813,12 +1834,12 @@ void sub_800B348(void)
|
||||
InitLocalLinkPlayer();
|
||||
block = &gLocalLinkPlayerBlock;
|
||||
block->linkPlayer = gLocalLinkPlayer;
|
||||
memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1);
|
||||
memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1);
|
||||
memcpy(block->magic1, sASCIIGameFreakInc, sizeof(block->magic1) - 1);
|
||||
memcpy(block->magic2, sASCIIGameFreakInc, sizeof(block->magic2) - 1);
|
||||
memcpy(gBlockSendBuffer, block, sizeof(*block));
|
||||
}
|
||||
|
||||
void sub_800B3A4(u32 who)
|
||||
void LinkPlayerFromBlock(u32 who)
|
||||
{
|
||||
u8 who_ = who;
|
||||
struct LinkPlayerBlock *block;
|
||||
@ -1828,7 +1849,7 @@ void sub_800B3A4(u32 who)
|
||||
player = &gLinkPlayers[who_];
|
||||
*player = block->linkPlayer;
|
||||
sub_800B524(player);
|
||||
if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 || strcmp(block->magic2, gASCIIGameFreakInc) != 0)
|
||||
if (strcmp(block->magic1, sASCIIGameFreakInc) != 0 || strcmp(block->magic2, sASCIIGameFreakInc) != 0)
|
||||
{
|
||||
SetMainCallback2(CB2_LinkError);
|
||||
}
|
||||
@ -1871,7 +1892,7 @@ void SetWirelessCommType1(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800B4A4(void)
|
||||
static void SetWirelessCommType0_Internal(void)
|
||||
{
|
||||
if (gReceivedRemoteLinkPlayers == 0)
|
||||
{
|
||||
@ -1879,7 +1900,7 @@ static void sub_800B4A4(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800B4C0(void)
|
||||
void SetWirelessCommType0(void)
|
||||
{
|
||||
if (gReceivedRemoteLinkPlayers == 0)
|
||||
{
|
||||
|
2082
src/link_rfu_2.c
2082
src/link_rfu_2.c
File diff suppressed because it is too large
Load Diff
@ -165,7 +165,7 @@ const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
|
||||
SpriteCallbackDummy
|
||||
};
|
||||
|
||||
void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr)
|
||||
void sub_800D6C8(struct RfuRecvQueue *ptr)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
@ -179,11 +179,11 @@ void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr)
|
||||
}
|
||||
ptr->unk_8c1 = 0;
|
||||
ptr->unk_8c0 = 0;
|
||||
ptr->unk_8c2 = 0;
|
||||
ptr->unk_8c3 = 0;
|
||||
ptr->count = 0;
|
||||
ptr->full = FALSE;
|
||||
}
|
||||
|
||||
void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr)
|
||||
void sub_800D724(struct RfuSendQueue *ptr)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
@ -197,8 +197,8 @@ void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr)
|
||||
}
|
||||
ptr->unk_231 = 0;
|
||||
ptr->unk_230 = 0;
|
||||
ptr->unk_232 = 0;
|
||||
ptr->unk_233 = 0;
|
||||
ptr->count = 0;
|
||||
ptr->full = FALSE;
|
||||
}
|
||||
|
||||
void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr)
|
||||
@ -219,13 +219,13 @@ void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr)
|
||||
ptr->unk_203 = 0;
|
||||
}
|
||||
|
||||
void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
|
||||
void sub_800D7D8(struct RfuRecvQueue *q1, u8 *q2)
|
||||
{
|
||||
s32 i;
|
||||
u16 imeBak;
|
||||
u8 count;
|
||||
|
||||
if (q1->unk_8c2 < 32)
|
||||
if (q1->count < 32)
|
||||
{
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
@ -245,7 +245,7 @@ void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
|
||||
}
|
||||
q1->unk_8c0++;
|
||||
q1->unk_8c0 %= 32;
|
||||
q1->unk_8c2++;
|
||||
q1->count++;
|
||||
for (i = 0; i < 70; i++)
|
||||
{
|
||||
q2[i] = 0;
|
||||
@ -255,16 +255,16 @@ void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
|
||||
}
|
||||
else
|
||||
{
|
||||
q1->unk_8c3 = 1;
|
||||
q1->full = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
|
||||
void sub_800D888(struct RfuSendQueue *q1, u8 *q2)
|
||||
{
|
||||
s32 i;
|
||||
u16 imeBak;
|
||||
|
||||
if (q1->unk_232 < 40)
|
||||
if (q1->count < 40)
|
||||
{
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
@ -283,7 +283,7 @@ void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
|
||||
}
|
||||
q1->unk_230++;
|
||||
q1->unk_230 %= 40;
|
||||
q1->unk_232++;
|
||||
q1->count++;
|
||||
for (i = 0; i < 14; i++)
|
||||
{
|
||||
q2[i] = 0;
|
||||
@ -293,18 +293,18 @@ void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
|
||||
}
|
||||
else
|
||||
{
|
||||
q1->unk_233 = 1;
|
||||
q1->full = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
|
||||
bool8 sub_800D934(struct RfuRecvQueue *q1, u8 *q2)
|
||||
{
|
||||
u16 imeBak;
|
||||
s32 i;
|
||||
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
if (q1->unk_8c0 == q1->unk_8c1 || q1->unk_8c3 != 0)
|
||||
if (q1->unk_8c0 == q1->unk_8c1 || q1->full)
|
||||
{
|
||||
for (i = 0; i < 70; i++)
|
||||
{
|
||||
@ -319,17 +319,17 @@ bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
|
||||
}
|
||||
q1->unk_8c1++;
|
||||
q1->unk_8c1 %= 32;
|
||||
q1->unk_8c2--;
|
||||
q1->count--;
|
||||
REG_IME = imeBak;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
|
||||
bool8 sub_800D9DC(struct RfuSendQueue *q1, u8 *q2)
|
||||
{
|
||||
s32 i;
|
||||
u16 imeBak;
|
||||
|
||||
if (q1->unk_230 == q1->unk_231 || q1->unk_233 != 0)
|
||||
if (q1->unk_230 == q1->unk_231 || q1->full)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -341,7 +341,7 @@ bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
|
||||
}
|
||||
q1->unk_231++;
|
||||
q1->unk_231 %= 40;
|
||||
q1->unk_232--;
|
||||
q1->count--;
|
||||
REG_IME = imeBak;
|
||||
return TRUE;
|
||||
}
|
||||
@ -362,9 +362,9 @@ void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2)
|
||||
}
|
||||
q1->unk_1c++;
|
||||
q1->unk_1c %= 2;
|
||||
if (q1->unk_1e < 2)
|
||||
if (q1->count < 2)
|
||||
{
|
||||
q1->unk_1e++;
|
||||
q1->count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -377,7 +377,7 @@ bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
if (q1->unk_1e == 0)
|
||||
if (q1->count == 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -390,7 +390,7 @@ bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2)
|
||||
}
|
||||
q1->unk_1d++;
|
||||
q1->unk_1d %= 2;
|
||||
q1->unk_1e--;
|
||||
q1->count--;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -632,7 +632,7 @@ bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
|
||||
if (lman.parent_child == 1)
|
||||
{
|
||||
retVal = TRUE;
|
||||
if (sub_8010454(gRfuLinkStatus->partner[idx].serialNo) && ((gRfuLinkStatus->getNameFlag >> idx) & 1))
|
||||
if (RfuSerialNumberIsValid(gRfuLinkStatus->partner[idx].serialNo) && ((gRfuLinkStatus->getNameFlag >> idx) & 1))
|
||||
{
|
||||
memcpy(buff1, gRfuLinkStatus->partner[idx].gname, 0xD);
|
||||
memcpy(buff2, gRfuLinkStatus->partner[idx].uname, PLAYER_NAME_LENGTH + 1);
|
||||
@ -646,7 +646,7 @@ bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
|
||||
else
|
||||
{
|
||||
retVal = FALSE;
|
||||
if (sub_8010454(gRfuLinkStatus->partner[idx].serialNo))
|
||||
if (RfuSerialNumberIsValid(gRfuLinkStatus->partner[idx].serialNo))
|
||||
{
|
||||
memcpy(buff1, gRfuLinkStatus->partner[idx].gname, 0xD);
|
||||
memcpy(buff2, gRfuLinkStatus->partner[idx].uname, PLAYER_NAME_LENGTH + 1);
|
||||
@ -679,8 +679,8 @@ bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
|
||||
|
||||
void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *buff1, u8 *buff2)
|
||||
{
|
||||
memcpy(buff1, &gUnknown_02022B14, 0xD);
|
||||
memcpy(buff2, gUnknown_02022B22, 8);
|
||||
memcpy(buff1, &gHostRFUtgtGnameBuffer, 0xD);
|
||||
memcpy(buff2, gHostRFUtgtUnameBuffer, 8);
|
||||
}
|
||||
|
||||
void CreateWirelessStatusIndicatorSprite(u8 x, u8 y)
|
||||
|
@ -113,7 +113,7 @@ void AgbMain()
|
||||
InitIntrHandlers();
|
||||
m4aSoundInit();
|
||||
EnableVCountIntrAtLine150();
|
||||
sub_800E6D0();
|
||||
InitRFU();
|
||||
RtcInit();
|
||||
CheckForFlashMemory();
|
||||
InitMainCallbacks();
|
||||
|
@ -2913,7 +2913,7 @@ bool32 sub_808766C(void)
|
||||
static u32 GetLinkSendQueueLength(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
return Rfu.unk_9e8.unk_232;
|
||||
return Rfu.sendQueue.count;
|
||||
else
|
||||
return gLink.sendQueue.count;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ static bool32 sub_802C618(void);
|
||||
static bool32 sub_802C650(void);
|
||||
static void sub_802C688(int);
|
||||
static int sub_802C6B0(void);
|
||||
static bool32 sub_802C70C(void);
|
||||
static bool32 AreLinkQueuesEmpty(void);
|
||||
static int sub_802C73C(u8 *);
|
||||
static void sub_802C780(void);
|
||||
static int sub_802C790(int);
|
||||
@ -876,7 +876,7 @@ static bool32 sub_802B31C(void)
|
||||
gUnknown_02022CFC->unk8++;
|
||||
// fall through
|
||||
case 1:
|
||||
if (sub_802C70C())
|
||||
if (AreLinkQueuesEmpty())
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
@ -1146,7 +1146,7 @@ static bool32 sub_802B720(void)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sub_802C70C())
|
||||
if (AreLinkQueuesEmpty())
|
||||
{
|
||||
CreateTask(Task_LinkSave, 6);
|
||||
gUnknown_02022CFC->unk8++;
|
||||
@ -2025,9 +2025,9 @@ static int sub_802C6B0(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
static bool32 sub_802C70C(void)
|
||||
static bool32 AreLinkQueuesEmpty(void)
|
||||
{
|
||||
return !Rfu.unk_124.unk_8c2 && !Rfu.unk_9e8.unk_232;
|
||||
return !Rfu.recvQueue.count && !Rfu.sendQueue.count;
|
||||
}
|
||||
|
||||
static int sub_802C73C(u8 *arg0)
|
||||
|
@ -396,7 +396,7 @@ static void CB2_CreateTradeMenu(void)
|
||||
{
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
sub_8011BA4();
|
||||
CreateTask_RfuIdle();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -438,7 +438,7 @@ static void CB2_CreateTradeMenu(void)
|
||||
case 4:
|
||||
if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE)
|
||||
{
|
||||
sub_8011BD0();
|
||||
DestroyTask_RfuIdle();
|
||||
CalculatePlayerPartyCount();
|
||||
gMain.state++;
|
||||
sTradeMenuData->timer = 0;
|
||||
|
@ -2338,7 +2338,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
break;
|
||||
case 2:
|
||||
SetHostRFUtgtGname(IN_UNION_ROOM, 0, 0);
|
||||
sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_EnterUnionRoom();
|
||||
@ -2361,7 +2361,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
if (id >= PARTY_SIZE)
|
||||
{
|
||||
ResetUnionRoomTrade(&sUnionRoomTrade);
|
||||
sub_8010FCC(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
|
||||
ScheduleFieldMessageAndExit(sText_RegistrationCanceled);
|
||||
}
|
||||
else if (!RegisterTradeMonAndGetIsEgg(GetCursorSelectionMonId(), &sUnionRoomTrade))
|
||||
@ -2453,7 +2453,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 4:
|
||||
data->state = 11;
|
||||
UR_EnableScriptContext2AndFreezeObjectEvents();
|
||||
sub_8010FCC(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_NPCTALK | IN_UNION_ROOM, GetActivePartnerSpriteGenderParam(data), 0);
|
||||
break;
|
||||
}
|
||||
@ -2931,7 +2931,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case -2:
|
||||
case 18:
|
||||
ResetUnionRoomTrade(&sUnionRoomTrade);
|
||||
sub_8010FCC(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
|
||||
ScheduleFieldMessageAndExit(sText_RegistrationCanceled);
|
||||
break;
|
||||
default:
|
||||
@ -2942,7 +2942,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 55:
|
||||
sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
ScheduleFieldMessageAndExit(sText_RegistraionCompleted);
|
||||
break;
|
||||
case 44:
|
||||
@ -2961,7 +2961,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 56:
|
||||
if (PrintOnTextbox(&data->textState, sText_RegistrationCanceled2))
|
||||
{
|
||||
sub_8010FCC(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
|
||||
ResetUnionRoomTrade(&sUnionRoomTrade);
|
||||
HandleCancelTrade(TRUE);
|
||||
data->state = 4;
|
||||
@ -4265,7 +4265,7 @@ static void HandleCancelTrade(bool32 unlockObjs)
|
||||
gPlayerCurrActivity = 0;
|
||||
if (unlockObjs)
|
||||
{
|
||||
sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(IN_UNION_ROOM, 0, 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user