Continue misc link documentation, rename reset_save_heap
This commit is contained in:
@@ -2069,7 +2069,7 @@ static bool32 CheckRecvCmdMatches(u16 recvCmd, u16 linkCmd, u16 rfuCmd)
|
||||
{
|
||||
if (gReceivedRemoteLinkPlayers && gWirelessCommType)
|
||||
{
|
||||
if ((recvCmd & 0xFF00) == rfuCmd)
|
||||
if ((recvCmd & RFUCMD_MASK) == rfuCmd)
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -3135,7 +3135,7 @@ static void UpdateBlenderCenter(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((gRecvCmds[0][BLENDER_COMM_INPUT_STATE] & 0xFF00) == RFUCMD_BLENDER_SEND_KEYS)
|
||||
if ((gRecvCmds[0][BLENDER_COMM_INPUT_STATE] & RFUCMD_MASK) == RFUCMD_BLENDER_SEND_KEYS)
|
||||
{
|
||||
sBerryBlender->progressBarValue = gRecvCmds[0][BLENDER_COMM_PROGRESS_BAR];
|
||||
sBerryBlender->arrowPos = gRecvCmds[0][BLENDER_COMM_ARROW_POS];
|
||||
|
||||
@@ -984,12 +984,12 @@ static u32 QuitBerryCrush(MainCallback exitCallback)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ERROR_EXIT(exitCallback) \
|
||||
{ \
|
||||
SetMainCallback2(exitCallback); \
|
||||
Rfu.unk_10 = 0; \
|
||||
Rfu.unk_12 = 0; \
|
||||
Rfu.errorState = 1; \
|
||||
#define ERROR_EXIT(exitCallback) \
|
||||
{ \
|
||||
SetMainCallback2(exitCallback); \
|
||||
Rfu.unk_10 = 0; \
|
||||
Rfu.unk_12 = 0; \
|
||||
Rfu.errorState = RFU_ERROR_STATE_1; \
|
||||
}
|
||||
|
||||
void StartBerryCrush(MainCallback exitCallback)
|
||||
@@ -2565,7 +2565,7 @@ static void HandlePartnerInput(struct BerryCrushGame *game)
|
||||
linkState = (struct BerryCrushGame_LinkState *)gRecvCmds[i];
|
||||
|
||||
// Skip player if we have not received a packet from them
|
||||
if ((linkState->rfuCmd & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((linkState->rfuCmd & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
continue;
|
||||
if (linkState->sendFlag != SEND_GAME_STATE)
|
||||
continue;
|
||||
@@ -2805,7 +2805,7 @@ static void RecvLinkData(struct BerryCrushGame *game)
|
||||
for (i = 0; i < game->playerCount; i++)
|
||||
game->players[i].inputState = INPUT_STATE_NONE;
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
{
|
||||
game->playedSound = FALSE;
|
||||
return;
|
||||
|
||||
@@ -3106,7 +3106,7 @@ static u32 RecvPacket_ReadyToStart(u32 playerId)
|
||||
{
|
||||
struct ReadyToStartPacket *packet;
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
packet = (void *)&gRecvCmds[playerId][1];
|
||||
@@ -3233,7 +3233,7 @@ static bool32 RecvPacket_GameState(u32 playerId,
|
||||
struct GameStatePacket *packet;
|
||||
struct DodrioGame_Berries *berries = &player->berries;
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
packet = (void *)&gRecvCmds[0][1];
|
||||
@@ -3310,7 +3310,7 @@ static bool32 RecvPacket_PickState(u32 playerId, u8 *pickState)
|
||||
{
|
||||
struct PickStatePacket *packet;
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
packet = (void *)&gRecvCmds[playerId][1];
|
||||
@@ -3341,7 +3341,7 @@ static bool32 RecvPacket_ReadyToEnd(u32 playerId)
|
||||
{
|
||||
struct ReadyToEndPacket *packet;
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
packet = (void *)&gRecvCmds[playerId][1];
|
||||
|
||||
@@ -1142,7 +1142,7 @@ void CB2_InitCopyrightScreenAfterBootup(void)
|
||||
{
|
||||
if (!SetUpCopyrightScreen())
|
||||
{
|
||||
SetSaveBlocksPointers(sub_815355C());
|
||||
SetSaveBlocksPointers(GetSaveBlocksPointersBaseOffset());
|
||||
ResetMenuAndMonGlobals();
|
||||
Save_ResetSaveCounters();
|
||||
Save_LoadGameData(SAVE_NORMAL);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "m4a.h"
|
||||
#include "malloc.h"
|
||||
#include "reset_save_heap.h"
|
||||
#include "reload_save.h"
|
||||
#include "save.h"
|
||||
#include "bg.h"
|
||||
#include "window.h"
|
||||
@@ -1705,7 +1705,7 @@ static void CB2_PrintErrorMessage(void)
|
||||
PlaySE(SE_PIN);
|
||||
gWirelessCommType = 0;
|
||||
sLinkErrorBuffer.disconnected = FALSE;
|
||||
sub_81700F8();
|
||||
ReloadSave();
|
||||
}
|
||||
}
|
||||
else if (gWirelessCommType == 2)
|
||||
|
||||
673
src/link_rfu_2.c
673
src/link_rfu_2.c
File diff suppressed because it is too large
Load Diff
@@ -719,7 +719,7 @@ bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
|
||||
bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
|
||||
{
|
||||
bool8 retVal = FALSE;
|
||||
if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_7F7D)
|
||||
if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_B)
|
||||
{
|
||||
memcpy(buff1, gRfuLinkStatus->partner[idx].gname, RFU_GAME_NAME_LENGTH);
|
||||
memcpy(buff2, gRfuLinkStatus->partner[idx].uname, PLAYER_NAME_LENGTH + 1);
|
||||
|
||||
@@ -71,6 +71,7 @@ void ClearSav1(void)
|
||||
CpuFill16(0, &gSaveblock1, sizeof(struct SaveBlock1) + sizeof(gSaveblock1_DMA));
|
||||
}
|
||||
|
||||
// Offset is the sum of the trainer id bytes
|
||||
void SetSaveBlocksPointers(u16 offset)
|
||||
{
|
||||
struct SaveBlock1** sav1_LocalVar = &gSaveBlock1Ptr;
|
||||
|
||||
@@ -3945,7 +3945,7 @@ static bool32 RecvPacket_MonInfo(int multiplayerId, struct PokemonJump_MonInfo *
|
||||
{
|
||||
struct MonInfoPacket packet;
|
||||
|
||||
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[multiplayerId][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
|
||||
@@ -4010,7 +4010,7 @@ static bool32 RecvPacket_LeaderState(struct PokemonJump_Player *player, struct P
|
||||
{
|
||||
struct LeaderStatePacket packet;
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
memcpy(&packet, &gRecvCmds[0][1], sizeof(packet));
|
||||
@@ -4057,7 +4057,7 @@ static bool32 RecvPacket_MemberStateToLeader(struct PokemonJump_Player *player,
|
||||
{
|
||||
struct MemberStatePacket packet;
|
||||
|
||||
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[multiplayerId][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
|
||||
@@ -4078,7 +4078,7 @@ static bool32 RecvPacket_MemberStateToMember(struct PokemonJump_Player *player,
|
||||
{
|
||||
struct MemberStatePacket packet;
|
||||
|
||||
if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET)
|
||||
if ((gRecvCmds[multiplayerId][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET)
|
||||
return FALSE;
|
||||
|
||||
memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
|
||||
|
||||
@@ -981,7 +981,7 @@ static void Task_DoRecordMixing(u8 taskId)
|
||||
|
||||
// Mixing Emerald records.
|
||||
case 6:
|
||||
if (!sub_801048C(FALSE))
|
||||
if (!Rfu_SetLinkRecovery(FALSE))
|
||||
{
|
||||
CreateTask(Task_LinkSave, 5);
|
||||
task->data[0]++;
|
||||
@@ -992,7 +992,7 @@ static void Task_DoRecordMixing(u8 taskId)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_801048C(TRUE);
|
||||
Rfu_SetLinkRecovery(TRUE);
|
||||
task->data[0] = 8;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
#include "overworld.h"
|
||||
#include "malloc.h"
|
||||
|
||||
void sub_81700F8(void)
|
||||
// Reloads the game, continuing from the point of the last save
|
||||
// Used to gracefully exit after a link connection error
|
||||
void ReloadSave(void)
|
||||
{
|
||||
u16 imeBackup;
|
||||
|
||||
imeBackup = REG_IME;
|
||||
u16 imeBackup = REG_IME;
|
||||
REG_IME = 0;
|
||||
RegisterRamReset(RESET_EWRAM);
|
||||
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_FORCED_BLANK);
|
||||
REG_IME = imeBackup;
|
||||
gMain.inBattle = FALSE;
|
||||
SetSaveBlocksPointers(sub_815355C());
|
||||
SetSaveBlocksPointers(GetSaveBlocksPointersBaseOffset());
|
||||
ResetMenuAndMonGlobals();
|
||||
Save_ResetSaveCounters();
|
||||
Save_LoadGameData(SAVE_NORMAL);
|
||||
44
src/save.c
44
src/save.c
@@ -126,16 +126,16 @@ static bool32 SetDamagedSectorBits(u8 op, u8 bit)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static u8 SaveWriteToFlash(u16 a1, const struct SaveSectionLocation *location)
|
||||
static u8 SaveWriteToFlash(u16 sectorId, const struct SaveSectionLocation *location)
|
||||
{
|
||||
u32 status;
|
||||
u16 i;
|
||||
|
||||
gFastSaveSection = &gSaveDataBuffer;
|
||||
|
||||
if (a1 != 0xFFFF) // for link
|
||||
if (sectorId != 0xFFFF) // for link
|
||||
{
|
||||
status = HandleWriteSector(a1, location);
|
||||
status = HandleWriteSector(sectorId, location);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,7 +169,7 @@ static u8 HandleWriteSector(u16 sectorId, const struct SaveSectionLocation *loca
|
||||
|
||||
sector = sectorId + gLastWrittenSector;
|
||||
sector %= SECTOR_SAVE_SLOT_LENGTH;
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
|
||||
data = location[sectorId].data;
|
||||
size = location[sectorId].size;
|
||||
@@ -292,7 +292,7 @@ static u8 ClearSaveData_2(u16 sectorId, const struct SaveSectionLocation *locati
|
||||
|
||||
sector = sectorId + gLastWrittenSector;
|
||||
sector %= SECTOR_SAVE_SLOT_LENGTH;
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
|
||||
data = location[sectorId].data;
|
||||
size = location[sectorId].size;
|
||||
@@ -362,7 +362,7 @@ static u8 sav12_xor_get(u16 sectorId, const struct SaveSectionLocation *location
|
||||
|
||||
sector = sectorId + gLastWrittenSector; // no sub 1?
|
||||
sector %= SECTOR_SAVE_SLOT_LENGTH;
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
|
||||
if (ProgramFlashByte(sector, sizeof(struct UnkSaveSection), 0x25))
|
||||
{
|
||||
@@ -385,7 +385,7 @@ static u8 sub_8152CAC(u16 sectorId, const struct SaveSectionLocation *location)
|
||||
|
||||
sector = sectorId + gLastWrittenSector - 1;
|
||||
sector %= SECTOR_SAVE_SLOT_LENGTH;
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
|
||||
if (ProgramFlashByte(sector, sizeof(struct UnkSaveSection), ((u8 *)gFastSaveSection)[sizeof(struct UnkSaveSection)]))
|
||||
{
|
||||
@@ -408,7 +408,7 @@ static u8 sub_8152D44(u16 sectorId, const struct SaveSectionLocation *location)
|
||||
|
||||
sector = sectorId + gLastWrittenSector - 1; // no sub 1?
|
||||
sector %= SECTOR_SAVE_SLOT_LENGTH;
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
|
||||
if (ProgramFlashByte(sector, sizeof(struct UnkSaveSection), 0x25))
|
||||
{
|
||||
@@ -446,12 +446,12 @@ static u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location)
|
||||
{
|
||||
u16 i;
|
||||
u16 checksum;
|
||||
u16 v3 = SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
u16 slotOffset = SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
u16 id;
|
||||
|
||||
for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
|
||||
{
|
||||
DoReadFlashWholeSection(i + v3, gFastSaveSection);
|
||||
DoReadFlashWholeSection(i + slotOffset, gFastSaveSection);
|
||||
id = gFastSaveSection->id;
|
||||
if (id == 0)
|
||||
gLastWrittenSector = i;
|
||||
@@ -824,27 +824,29 @@ u8 Save_LoadGameData(u8 saveType)
|
||||
return status;
|
||||
}
|
||||
|
||||
u16 sub_815355C(void)
|
||||
u16 GetSaveBlocksPointersBaseOffset(void)
|
||||
{
|
||||
u16 i, v3;
|
||||
u16 i, slotOffset;
|
||||
struct SaveSection* savSection;
|
||||
|
||||
savSection = gFastSaveSection = &gSaveDataBuffer;
|
||||
if (gFlashMemoryPresent != TRUE)
|
||||
return SAVE_STATUS_EMPTY;
|
||||
return 0;
|
||||
UpdateSaveAddresses();
|
||||
GetSaveValidStatus(gRamSaveSectionLocations);
|
||||
v3 = SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
|
||||
slotOffset = SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % NUM_SAVE_SLOTS);
|
||||
for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
|
||||
{
|
||||
DoReadFlashWholeSection(i + v3, gFastSaveSection);
|
||||
if (gFastSaveSection->id == 0)
|
||||
return savSection->data[10] +
|
||||
savSection->data[11] +
|
||||
savSection->data[12] +
|
||||
savSection->data[13];
|
||||
DoReadFlashWholeSection(i + slotOffset, gFastSaveSection);
|
||||
|
||||
// Base offset for SaveBlock2 is calculated using the trainer id
|
||||
if (gFastSaveSection->id == SECTOR_ID_SAVEBLOCK2)
|
||||
return savSection->data[offsetof(struct SaveBlock2, playerTrainerId[0])] +
|
||||
savSection->data[offsetof(struct SaveBlock2, playerTrainerId[1])] +
|
||||
savSection->data[offsetof(struct SaveBlock2, playerTrainerId[2])] +
|
||||
savSection->data[offsetof(struct SaveBlock2, playerTrainerId[3])];
|
||||
}
|
||||
return SAVE_STATUS_EMPTY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 TryReadSpecialSaveSection(u8 sector, u8* dst)
|
||||
|
||||
@@ -459,7 +459,7 @@ static void CB2_CreateTradeMenu(void)
|
||||
sTradeMenuData->timer = 0;
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_801048C(TRUE);
|
||||
Rfu_SetLinkRecovery(TRUE);
|
||||
SetLinkStandbyCallback();
|
||||
}
|
||||
}
|
||||
@@ -1709,7 +1709,7 @@ static void CancelTrade_2(void)
|
||||
|
||||
static void LinkTradeWaitForQueue(void)
|
||||
{
|
||||
if (!sub_801048C(FALSE) && GetNumQueuedActions() == 0)
|
||||
if (!Rfu_SetLinkRecovery(FALSE) && GetNumQueuedActions() == 0)
|
||||
{
|
||||
SetLinkStandbyCallback();
|
||||
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_START_LINK_TRADE;
|
||||
|
||||
@@ -680,7 +680,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
if (gReceivedRemoteLinkPlayers != 0)
|
||||
{
|
||||
if (IsActivityWithVariableGroupSize(gPlayerCurrActivity))
|
||||
sub_801103C();
|
||||
GetOtherPlayersInfoFlags();
|
||||
UpdateGameData_GroupLockedIn(TRUE);
|
||||
CreateTask_RunScriptAndFadeToActivity();
|
||||
Leader_DestroyResources(data);
|
||||
@@ -1291,7 +1291,7 @@ static void Task_ListenToWireless(u8 taskId)
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_JoinGroup();
|
||||
sub_80111B0(TRUE);
|
||||
RfuSetIgnoreError(TRUE);
|
||||
data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
|
||||
data->field_0 = AllocZeroed(16 * sizeof(struct UnkStruct_x20));
|
||||
data->state = 2;
|
||||
@@ -2894,7 +2894,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
ReceiveUnionRoomActivityPacket(uroom);
|
||||
if (UnionRoom_HandleContactFromOtherPlayer(uroom) && JOY_NEW(B_BUTTON))
|
||||
{
|
||||
sub_8011DE0(1);
|
||||
Rfu_DisconnectPlayerById(1);
|
||||
StringCopy(gStringVar4, sText_ChatEnded);
|
||||
uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
|
||||
}
|
||||
@@ -2908,9 +2908,9 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 0: // ACCEPT
|
||||
uroom->playerSendBuffer[0] = ACTIVITY_ACCEPT | IN_UNION_ROOM;
|
||||
if (gPlayerCurrActivity == (ACTIVITY_CHAT | IN_UNION_ROOM))
|
||||
UpdateGameData_SetActivity(gPlayerCurrActivity | IN_UNION_ROOM, sub_801100C(1), FALSE);
|
||||
UpdateGameData_SetActivity(gPlayerCurrActivity | IN_UNION_ROOM, GetLinkPlayerInfoFlags(1), FALSE);
|
||||
else
|
||||
UpdateGameData_SetActivity(gPlayerCurrActivity | IN_UNION_ROOM, sub_801100C(1), TRUE);
|
||||
UpdateGameData_SetActivity(gPlayerCurrActivity | IN_UNION_ROOM, GetLinkPlayerInfoFlags(1), TRUE);
|
||||
|
||||
uroom->field_8->arr[0].field_1B = 0;
|
||||
taskData[3] = 0;
|
||||
@@ -3213,7 +3213,7 @@ void SetUsingUnionRoomStartMenu(void)
|
||||
|
||||
static void ReceiveUnionRoomActivityPacket(struct WirelessLink_URoom *data)
|
||||
{
|
||||
if (gRecvCmds[1][1] != 0 && (gRecvCmds[1][0] & 0xFF00) == 0x2F00)
|
||||
if (gRecvCmds[1][1] != 0 && (gRecvCmds[1][0] & RFUCMD_MASK) == RFUCMD_SEND_PACKET)
|
||||
{
|
||||
data->recvActivityRequest[0] = gRecvCmds[1][1];
|
||||
if (gRecvCmds[1][1] == (ACTIVITY_TRADE | IN_UNION_ROOM))
|
||||
@@ -3282,7 +3282,7 @@ static void Task_InitUnionRoom(u8 taskId)
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_EnterUnionRoom();
|
||||
sub_80111B0(TRUE);
|
||||
RfuSetIgnoreError(TRUE);
|
||||
data->state = 2;
|
||||
break;
|
||||
case 2:
|
||||
@@ -3877,32 +3877,22 @@ static bool32 AreUnionRoomPlayerGnamesDifferent(struct WirelessGnameUnamePair *p
|
||||
s32 i;
|
||||
|
||||
if (pair1->gname.activity != pair2->gname.activity)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (pair1->gname.started != pair2->gname.started)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
if (pair1->gname.child_sprite_gender[i] != pair2->gname.child_sprite_gender[i])
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (pair1->gname.species != pair2->gname.species)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (pair1->gname.type != pair2->gname.type)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -4246,7 +4236,7 @@ static s32 GetChatLeaderActionRequestMessage(u8 *dst, u32 gender, u16 *activityD
|
||||
StringCopy(uroom->activityRequestStrbufs[1], gSpeciesNames[sUnionRoomTrade.playerSpecies]);
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
if (gRfuLinkStatus->partner[i].serialNo == 2)
|
||||
if (gRfuLinkStatus->partner[i].serialNo == RFU_SERIAL_A)
|
||||
{
|
||||
ConvertIntToDecimalStringN(uroom->activityRequestStrbufs[2], activityData[2], STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
StringCopy(uroom->activityRequestStrbufs[3], gSpeciesNames[activityData[1]]);
|
||||
|
||||
@@ -1198,7 +1198,7 @@ static void Chat_AskQuitChatting(void)
|
||||
sChat->funcState = 3;
|
||||
break;
|
||||
case 0:
|
||||
sub_80104B0();
|
||||
Rfu_StopPartnerSearch();
|
||||
PrepareSendBuffer_Disband(sChat->sendMessageBuffer);
|
||||
sChat->funcState = 4;
|
||||
sChat->tryQuitAgainTimer = 0;
|
||||
@@ -1819,7 +1819,7 @@ static void PrepareSendBuffer_Leave(u8 *buffer)
|
||||
buffer[0] = CHAT_MESSAGE_LEAVE;
|
||||
StringCopy(&buffer[1], gSaveBlock2Ptr->playerName);
|
||||
buffer[1 + (PLAYER_NAME_LENGTH + 1)] = sChat->multiplayerId;
|
||||
sub_8011A50();
|
||||
RfuSetNormalDisconnectMode();
|
||||
}
|
||||
|
||||
static void PrepareSendBuffer_Drop(u8 *buffer)
|
||||
@@ -2079,13 +2079,12 @@ static void Task_ReceiveChatMessage(u8 taskId)
|
||||
{
|
||||
if (GetLinkPlayerCount() == 2)
|
||||
{
|
||||
sub_80104B0();
|
||||
Rfu_StopPartnerSearch();
|
||||
sChat->exitType = 1;
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
sub_8011DE0(tCurrLinkPlayer);
|
||||
Rfu_DisconnectPlayerById(tCurrLinkPlayer);
|
||||
}
|
||||
|
||||
tState = 3;
|
||||
@@ -2104,7 +2103,7 @@ static void Task_ReceiveChatMessage(u8 taskId)
|
||||
if (!sub_8011A9C())
|
||||
{
|
||||
if (!sChat->multiplayerId)
|
||||
sub_80110B8(sChat->linkPlayerCount);
|
||||
SetUnionRoomChatPlayerData(sChat->linkPlayerCount);
|
||||
|
||||
tState = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user