Finish syncing link_rfu_2
This commit is contained in:
+28
-56
@@ -298,10 +298,8 @@ void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
||||
|
||||
for (i = 0; i < RECV_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
for (j = 0; j < RECV_QUEUE_SLOT_LENGTH; j++)
|
||||
{
|
||||
for (j = 0; j < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; j++)
|
||||
queue->slots[i][j] = 0;
|
||||
}
|
||||
}
|
||||
queue->send_slot = 0;
|
||||
queue->recv_slot = 0;
|
||||
@@ -316,10 +314,8 @@ void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
||||
|
||||
for (i = 0; i < SEND_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
for (j = 0; j < SEND_QUEUE_SLOT_LENGTH; j++)
|
||||
{
|
||||
for (j = 0; j < COMM_SLOT_LENGTH; j++)
|
||||
queue->slots[i][j] = 0;
|
||||
}
|
||||
}
|
||||
queue->send_slot = 0;
|
||||
queue->recv_slot = 0;
|
||||
@@ -356,26 +352,20 @@ void RfuRecvQueue_Enqueue(struct RfuRecvQueue *queue, u8 *src)
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
count = 0;
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i += RECV_QUEUE_SLOT_LENGTH / MAX_RFU_PLAYERS)
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i += COMM_SLOT_LENGTH)
|
||||
{
|
||||
if (src[i] == 0 && src[i + 1] == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count != MAX_RFU_PLAYERS)
|
||||
{
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
queue->slots[queue->recv_slot][i] = src[i];
|
||||
}
|
||||
queue->recv_slot++;
|
||||
queue->recv_slot %= RECV_QUEUE_NUM_SLOTS;
|
||||
queue->count++;
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
src[i] = 0;
|
||||
}
|
||||
}
|
||||
REG_IME = imeBak;
|
||||
}
|
||||
@@ -394,26 +384,20 @@ void RfuSendQueue_Enqueue(struct RfuSendQueue *queue, u8 *src)
|
||||
{
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
{
|
||||
if (src[i] != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i != SEND_QUEUE_SLOT_LENGTH)
|
||||
if (i != COMM_SLOT_LENGTH)
|
||||
{
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
queue->slots[queue->recv_slot][i] = src[i];
|
||||
}
|
||||
queue->recv_slot++;
|
||||
queue->recv_slot %= SEND_QUEUE_NUM_SLOTS;
|
||||
queue->count++;
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
src[i] = 0;
|
||||
}
|
||||
}
|
||||
REG_IME = imeBak;
|
||||
}
|
||||
@@ -432,17 +416,13 @@ bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue *queue, u8 *dest)
|
||||
REG_IME = 0;
|
||||
if (queue->recv_slot == queue->send_slot || queue->full)
|
||||
{
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
dest[i] = 0;
|
||||
}
|
||||
REG_IME = imeBak;
|
||||
return FALSE;
|
||||
}
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
dest[i] = queue->slots[queue->send_slot][i];
|
||||
}
|
||||
queue->send_slot++;
|
||||
queue->send_slot %= RECV_QUEUE_NUM_SLOTS;
|
||||
queue->count--;
|
||||
@@ -456,15 +436,11 @@ bool8 RfuSendQueue_Dequeue(struct RfuSendQueue *queue, u8 *dest)
|
||||
u16 imeBak;
|
||||
|
||||
if (queue->recv_slot == queue->send_slot || queue->full)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
dest[i] = queue->slots[queue->send_slot][i];
|
||||
}
|
||||
queue->send_slot++;
|
||||
queue->send_slot %= SEND_QUEUE_NUM_SLOTS;
|
||||
queue->count--;
|
||||
@@ -482,10 +458,8 @@ void RfuBackupQueue_Enqueue(struct RfuBackupQueue *queue, const u8 *dest)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < BACKUP_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
queue->slots[queue->recv_slot][i] = dest[i];
|
||||
}
|
||||
queue->recv_slot++;
|
||||
queue->recv_slot %= BACKUP_QUEUE_NUM_SLOTS;
|
||||
if (queue->count < BACKUP_QUEUE_NUM_SLOTS)
|
||||
@@ -509,10 +483,8 @@ bool8 RfuBackupQueue_Dequeue(struct RfuBackupQueue *queue, u8 *dest)
|
||||
}
|
||||
if (dest != NULL)
|
||||
{
|
||||
for (i = 0; i < BACKUP_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
dest[i] = queue->slots[queue->send_slot][i];
|
||||
}
|
||||
}
|
||||
queue->send_slot++;
|
||||
queue->send_slot %= BACKUP_QUEUE_NUM_SLOTS;
|
||||
@@ -672,30 +644,30 @@ static u8 GetConnectedChildStrength(u8 maxFlags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InitHostRFUtgtGname(struct RfuGameData *data, u8 activity, bool32 started, s32 child_sprite_genders)
|
||||
void InitHostRFUtgtGname(struct RfuGameData *data, u8 activity, bool32 startedActivity, s32 partnerInfo)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
data->unk_00.playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
data->compatibility.playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
}
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
data->child_sprite_gender[i] = child_sprite_genders;
|
||||
child_sprite_genders >>= 8;
|
||||
data->partnerInfo[i] = partnerInfo;
|
||||
partnerInfo >>= 8;
|
||||
}
|
||||
data->playerGender = gSaveBlock2Ptr->playerGender;
|
||||
data->activity = activity;
|
||||
data->started = started;
|
||||
data->unk_00.language = GAME_LANGUAGE;
|
||||
data->unk_00.version = GAME_VERSION;
|
||||
data->unk_00.hasNews = FALSE;
|
||||
data->unk_00.hasCard = FALSE;
|
||||
data->unk_00.unknown = FALSE;
|
||||
data->unk_00.isChampion = FlagGet(FLAG_SYS_CAN_LINK_WITH_RS);
|
||||
data->unk_00.hasNationalDex = IsNationalPokedexEnabled();
|
||||
data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
|
||||
data->startedActivity = startedActivity;
|
||||
data->compatibility.language = GAME_LANGUAGE;
|
||||
data->compatibility.version = GAME_VERSION;
|
||||
data->compatibility.hasNews = FALSE;
|
||||
data->compatibility.hasCard = FALSE;
|
||||
data->compatibility.unknown = FALSE;
|
||||
data->compatibility.isChampion = FlagGet(FLAG_SYS_CAN_LINK_WITH_RS);
|
||||
data->compatibility.hasNationalDex = IsNationalPokedexEnabled();
|
||||
data->compatibility.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -749,7 +721,7 @@ bool8 LinkRfu_GetNameIfCompatible(struct RfuGameData *gname, u8 *uname, u8 idx)
|
||||
bool8 LinkRfu_GetNameIfSerial7F7D(struct RfuGameData *gname, u8 *uname, u8 idx)
|
||||
{
|
||||
bool8 retVal = FALSE;
|
||||
if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_7F7D)
|
||||
if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_WONDER_DISTRIBUTOR)
|
||||
{
|
||||
memcpy(gname, gRfuLinkStatus->partner[idx].gname, RFU_GAME_NAME_LENGTH);
|
||||
memcpy(uname, gRfuLinkStatus->partner[idx].uname, RFU_USER_NAME_LENGTH);
|
||||
|
||||
Reference in New Issue
Block a user