Sync wireless improvements

This commit is contained in:
GriffinR
2022-11-09 14:29:57 -05:00
parent 9e24fe6ec8
commit b3e75138da
24 changed files with 391 additions and 347 deletions

View File

@@ -2525,9 +2525,8 @@ u8 RfuGetStatus(void)
bool32 RfuHasErrored(void)
{
// RFU_STATUS_OK will underflow here intentionally
u32 var = RfuGetStatus() - 1;
if (var < RFU_STATUS_CONNECTION_ERROR)
u32 status = RfuGetStatus();
if (status == RFU_STATUS_FATAL_ERROR || status == RFU_STATUS_CONNECTION_ERROR)
return TRUE;
else
return FALSE;
@@ -2656,7 +2655,7 @@ static u8 GetPartnerIndexByNameAndTrainerID(const u8 *name, u16 id)
for (i = 0; i < RFU_CHILD_MAX; i++)
{
u16 trainerId = ReadU16(gRfuLinkStatus->partner[i].gname + 2);
u16 trainerId = ReadU16(((struct RfuGameData *)gRfuLinkStatus->partner[i].gname)->compatibility.playerTrainerId);
if (IsRfuSerialNumberValid(gRfuLinkStatus->partner[i].serialNo)
&& !StringCompare(name, gRfuLinkStatus->partner[i].uname)
&& id == trainerId)
@@ -2682,9 +2681,9 @@ static void RfuReqDisconnectSlot(u32 slot)
void RequestDisconnectSlotByTrainerNameAndId(const u8 *name, u16 id)
{
u8 var = GetPartnerIndexByNameAndTrainerID(name, id);
if (var != 0xFF)
RfuReqDisconnectSlot(1 << var);
u8 index = GetPartnerIndexByNameAndTrainerID(name, id);
if (index != 0xFF)
RfuReqDisconnectSlot(1 << index);
}
void Rfu_DisconnectPlayerById(u32 playerIdx)