pokeplatinum/src/unk_0207A6DC.c

689 lines
17 KiB
C
Raw Permalink Normal View History

2024-07-06 00:33:09 +00:00
#include "unk_0207A6DC.h"
2022-12-27 12:55:56 +00:00
#include <nitro.h>
#include <string.h>
#include "constants/battle.h"
#include "struct_decls/battle_system.h"
2024-07-06 00:33:09 +00:00
#include "struct_decls/struct_party_decl.h"
#include "struct_defs/chatot_cry.h"
2022-12-27 12:55:56 +00:00
#include "struct_defs/struct_02027F8C.h"
#include "struct_defs/struct_02039A58.h"
#include "struct_defs/struct_0207A778.h"
#include "struct_defs/struct_0207A81C.h"
#include "struct_defs/struct_0207ACB4.h"
#include "struct_defs/struct_0207AD40.h"
2024-07-06 00:33:09 +00:00
#include "struct_defs/trainer_data.h"
2022-12-27 12:55:56 +00:00
2024-07-06 00:33:09 +00:00
#include "battle/battle_io.h"
#include "battle/ov16_0223DF00.h"
2024-10-25 15:44:20 +00:00
#include "charcode_util.h"
2024-07-06 00:33:09 +00:00
#include "communication_system.h"
2023-01-21 17:51:49 +00:00
#include "heap.h"
2024-07-06 00:33:09 +00:00
#include "party.h"
#include "sys_task.h"
#include "sys_task_manager.h"
#include "trainer_info.h"
2022-12-27 12:55:56 +00:00
#include "unk_02027F84.h"
#include "unk_0202CC64.h"
#include "unk_0202F1D4.h"
#include "unk_02032798.h"
#include "unk_020363E8.h"
2024-07-06 00:33:09 +00:00
void sub_0207A81C(BattleSystem *param0, int param1, int param2, void *param3, u8 param4);
BOOL sub_0207A8F4(UnkStruct_0207A778 *param0, u32 param1);
BOOL sub_0207A960(UnkStruct_0207A778 *param0);
BOOL sub_0207A988(UnkStruct_0207A778 *param0);
BOOL sub_0207A9CC(UnkStruct_0207A778 *param0);
BOOL sub_0207A9F8(UnkStruct_0207A778 *param0);
BOOL sub_0207AA38(UnkStruct_0207A778 *param0);
BOOL sub_0207AA5C(UnkStruct_0207A778 *param0);
BOOL sub_0207AAA0(UnkStruct_0207A778 *param0);
BOOL sub_0207AAC8(UnkStruct_0207A778 *param0);
BOOL sub_0207AB9C(UnkStruct_0207A778 *param0, int param1);
BOOL sub_0207ABD0(UnkStruct_0207A778 *param0, int param1, int param2);
BOOL sub_0207AC28(UnkStruct_0207A778 *param0, int param1);
BOOL sub_0207AC54(UnkStruct_0207A778 *param0, int param1, int param2);
void sub_0207A744(void *param0);
BOOL sub_0207AB58(UnkStruct_0207A778 *param0);
BOOL sub_0207AAFC(UnkStruct_0207A778 *param0);
2022-12-27 12:55:56 +00:00
static int sub_0207A758(void);
static int sub_0207A75C(void);
static int sub_0207A764(void);
static int sub_0207A76C(void);
static int sub_0207A774(void);
static int sub_0207AE64(void);
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A778(int param0, void *param1, int param2);
static u8 *sub_0207A798(int param0, void *param1, int param2);
static u8 *sub_0207A7B8(int param0, void *param1, int param2);
static u8 *sub_0207A7D4(int param0, void *param1, int param2);
static u8 *sub_0207A7F4(int param0, void *param1, int param2);
static u8 *sub_0207A7FC(int param0, void *param1, int param2);
static u8 *sub_0207A804(int param0, void *param1, int param2);
static u8 *sub_0207A80C(int param0, void *param1, int param2);
static u8 *sub_0207A814(int param0, void *param1, int param2);
static void sub_0207A8A8(int param0, int param1, void *param2, void *param3);
static void sub_0207A934(int param0, int param1, void *param2, void *param3);
static void sub_0207A9BC(int param0, int param1, void *param2, void *param3);
static void sub_0207AA28(int param0, int param1, void *param2, void *param3);
static void sub_0207AA90(int param0, int param1, void *param2, void *param3);
static void sub_0207AB8C(int param0, int param1, void *param2, void *param3);
static void sub_0207AC18(int param0, int param1, void *param2, void *param3);
static void sub_0207ACA4(int param0, int param1, void *param2, void *param3);
static void sub_0207ADB4(int param0, int param1, void *param2, void *param3);
static void sub_0207ACB4(SysTask *param0, void *param1);
static void sub_0207AD40(SysTask *param0, void *param1);
static void sub_0207AE34(int param0, int param1, void *param2, void *param3);
static void sub_0207ADD4(TrainerInfo *param0, UnkStruct_02027F8C *param1, UnkStruct_02027F8C *param2);
2022-12-27 12:55:56 +00:00
2024-05-04 09:52:14 +00:00
static const CommCmdTable Unk_020F099C[] = {
2024-07-06 00:33:09 +00:00
{ sub_0207ADB4, sub_02032944, NULL },
{ sub_0207A8A8, sub_02032944, NULL },
{ sub_0207A934, sub_0207A758, NULL },
{ sub_0207A9BC, sub_0207A75C, sub_0207A778 },
{ sub_0207AA28, sub_0207A774, sub_0207A798 },
{ sub_0207AA90, sub_0207A764, sub_0207A7B8 },
{ sub_0207AB8C, sub_0207A76C, sub_0207A7D4 },
{ sub_0207AC18, sub_0207A774, sub_0207A7F4 },
{ sub_0207AC18, sub_0207A774, sub_0207A7FC },
{ sub_0207ACA4, sub_0207A764, sub_0207A804 },
{ sub_0207ACA4, sub_0207A764, sub_0207A80C },
{ sub_0207AE34, sub_0207AE64, sub_0207A814 }
2022-12-27 12:55:56 +00:00
};
2024-07-06 00:33:09 +00:00
void sub_0207A6DC(void *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-04 09:52:14 +00:00
int v0 = sizeof(Unk_020F099C) / sizeof(CommCmdTable);
2024-07-06 00:33:09 +00:00
BattleSystem *v1;
UnkStruct_0207ACB4 *v2;
UnkStruct_0207AD40 *v3;
2022-12-27 12:55:56 +00:00
v1 = (BattleSystem *)param0;
2022-12-27 12:55:56 +00:00
if (BattleSystem_BattleStatus(v1) & 0x10) {
2022-12-27 12:55:56 +00:00
return;
}
2023-02-02 20:51:39 +00:00
v2 = (UnkStruct_0207ACB4 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_0207ACB4));
v3 = (UnkStruct_0207AD40 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_0207AD40));
2022-12-27 12:55:56 +00:00
2024-04-18 18:42:02 +00:00
CommCmd_Init(Unk_020F099C, v0, param0);
2022-12-27 12:55:56 +00:00
v2->unk_00 = v1;
v2->unk_04 = 0;
v3->unk_00 = v1;
v3->unk_04 = 0;
ov16_0223F320(v1, &v2->unk_04);
ov16_0223F32C(v1, &v3->unk_04);
2023-10-13 00:34:05 +00:00
SysTask_Start(sub_0207ACB4, v2, 0);
SysTask_Start(sub_0207AD40, v3, 0);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
void sub_0207A744(void *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-04 09:52:14 +00:00
int v0 = sizeof(Unk_020F099C) / sizeof(CommCmdTable);
2024-04-18 18:42:02 +00:00
CommCmd_Init(Unk_020F099C, v0, param0);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static int sub_0207A758(void)
2022-12-27 12:55:56 +00:00
{
return 4;
}
2024-07-06 00:33:09 +00:00
static int sub_0207A75C(void)
2022-12-27 12:55:56 +00:00
{
2023-09-14 04:50:04 +00:00
return TrainerInfo_Size();
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static int sub_0207A764(void)
2022-12-27 12:55:56 +00:00
{
return Party_SaveSize();
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static int sub_0207A76C(void)
2022-12-27 12:55:56 +00:00
{
return 1000;
}
2024-07-06 00:33:09 +00:00
static int sub_0207A774(void)
2022-12-27 12:55:56 +00:00
{
return sizeof(TrainerData);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A778(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
2022-12-27 12:55:56 +00:00
if (v0->unk_00->battleType & BATTLE_TYPE_FRONTIER) {
return (u8 *)v0->unk_00->trainerInfo[param0 * 2];
2022-12-27 12:55:56 +00:00
} else {
return (u8 *)v0->unk_00->trainerInfo[param0];
2022-12-27 12:55:56 +00:00
}
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A798(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
2022-12-27 12:55:56 +00:00
if (v0->unk_00->battleType & BATTLE_TYPE_FRONTIER) {
return (u8 *)&v0->unk_00->trainerData[param0 * 2];
2022-12-27 12:55:56 +00:00
} else {
return (u8 *)&v0->unk_00->trainerData[param0];
2022-12-27 12:55:56 +00:00
}
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A7B8(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
2022-12-27 12:55:56 +00:00
if (v0->unk_00->battleType & BATTLE_TYPE_FRONTIER) {
return (u8 *)v0->unk_00->parties[param0 * 2];
2022-12-27 12:55:56 +00:00
} else {
return (u8 *)v0->unk_00->parties[param0];
2022-12-27 12:55:56 +00:00
}
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A7D4(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
2022-12-27 12:55:56 +00:00
if (v0->unk_00->battleType & BATTLE_TYPE_FRONTIER) {
return (u8 *)v0->unk_00->chatotCries[param0 * 2];
2022-12-27 12:55:56 +00:00
} else {
return (u8 *)v0->unk_00->chatotCries[param0];
2022-12-27 12:55:56 +00:00
}
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A7F4(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
return (u8 *)&v0->unk_00->trainerData[1];
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A7FC(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
return (u8 *)&v0->unk_00->trainerData[3];
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A804(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
return (u8 *)v0->unk_00->parties[1];
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A80C(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
return (u8 *)v0->unk_00->parties[3];
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static u8 *sub_0207A814(int param0, void *param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = param1;
2022-12-27 12:55:56 +00:00
return (u8 *)v0->unk_10[param0];
}
2024-07-06 00:33:09 +00:00
void sub_0207A81C(BattleSystem *param0, int param1, int param2, void *param3, u8 param4)
2022-12-27 12:55:56 +00:00
{
int v0;
2024-07-06 00:33:09 +00:00
UnkStruct_0207A81C *v1;
u8 *v2;
u8 *v3;
u16 *v4;
u16 *v5;
2022-12-27 12:55:56 +00:00
2023-02-02 20:51:39 +00:00
v1 = (UnkStruct_0207A81C *)Heap_AllocFromHeap(5, sizeof(UnkStruct_0207A81C));
2022-12-27 12:55:56 +00:00
v3 = ov16_0223E06C(param0);
v4 = ov16_0223E08C(param0);
v5 = ov16_0223E098(param0);
if (v4[0] + sizeof(UnkStruct_0207A81C) + param4 + 1 > 0x1000) {
v5[0] = v4[0];
v4[0] = 0;
}
v1->unk_00 = param1;
v1->unk_01 = param2;
v1->unk_02 = param4;
v2 = (u8 *)v1;
for (v0 = 0; v0 < sizeof(UnkStruct_0207A81C); v0++) {
v3[v4[0]] = v2[v0];
v4[0]++;
}
v2 = (u8 *)param3;
for (v0 = 0; v0 < param4; v0++) {
v3[v4[0]] = v2[v0];
v4[0]++;
}
2023-02-02 20:51:39 +00:00
Heap_FreeToHeap(v1);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static void sub_0207A8A8(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
BattleSystem *v0 = (BattleSystem *)param3;
2022-12-27 12:55:56 +00:00
int v1;
2024-07-06 00:33:09 +00:00
u8 *v2 = (u8 *)param2;
u8 *v3 = ov16_0223E074(v0);
u16 *v4 = ov16_0223E0B0(v0);
u16 *v5 = ov16_0223E0BC(v0);
2022-12-27 12:55:56 +00:00
if (v4[0] + param1 + 1 > 0x1000) {
v5[0] = v4[0];
v4[0] = 0;
}
for (v1 = 0; v1 < param1; v1++) {
v3[v4[0]] = v2[v1];
v4[0]++;
}
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207A8F4(UnkStruct_0207A778 *param0, u32 param1)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
Party *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(51) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-01 05:42:36 +00:00
return CommSys_SendData(24, (void *)&param1, 4);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static void sub_0207A934(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_00->systemVersion[param0] = *((u32 *)param2);
sub_0202FAA8(param0, v0->unk_00->systemVersion[param0]);
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207A960(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
TrainerInfo *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
v0 = (TrainerInfo *)&param0->unk_20[0];
TrainerInfo_Copy(param0->unk_00->trainerInfo[0], v0);
2022-12-27 12:55:56 +00:00
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207A988(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(52) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(25, (void *)&param0->unk_20[0], TrainerInfo_Size());
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static void sub_0207A9BC(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207A9CC(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
TrainerData *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
v0 = (TrainerData *)&param0->unk_20[0];
*v0 = param0->unk_00->trainerData[0];
2022-12-27 12:55:56 +00:00
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207A9F8(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(53) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(26, (void *)&param0->unk_20[0], sizeof(TrainerData));
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static void sub_0207AA28(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AA38(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
Party *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2023-01-29 09:23:57 +00:00
v0 = (Party *)&param0->unk_20[0];
Party_cpy(param0->unk_00->parties[0], v0);
2022-12-27 12:55:56 +00:00
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AA5C(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(54) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(27, (void *)&param0->unk_20[0], Party_SaveSize());
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static void sub_0207AA90(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AAA0(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
ChatotCry *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-01-27 04:43:50 +00:00
v0 = (ChatotCry *)&param0->unk_20[0];
CopyChatotCryData(v0, param0->unk_00->chatotCries[0]);
2022-12-27 12:55:56 +00:00
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AAC8(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(55) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(28, (void *)&param0->unk_20[0], 1000);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AAFC(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_02027F8C *v0;
TrainerInfo *v1;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
v0 = (UnkStruct_02027F8C *)&param0->unk_20[0];
if (param0->unk_00->battleType & BATTLE_TYPE_FRONTIER) {
v1 = param0->unk_00->trainerInfo[CommSys_CurNetId() * 2];
2022-12-27 12:55:56 +00:00
} else {
v1 = param0->unk_00->trainerInfo[CommSys_CurNetId()];
2022-12-27 12:55:56 +00:00
}
sub_0207ADD4(v1, param0->unk_00->unk_124, (UnkStruct_02027F8C *)param0->unk_20);
{
int v2;
for (v2 = 0; v2 < 4; v2++) {
2023-02-02 20:51:39 +00:00
param0->unk_10[v2] = Heap_AllocFromHeap(5, 136);
2022-12-27 12:55:56 +00:00
}
}
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AB58(UnkStruct_0207A778 *param0)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(56) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(33, (void *)param0->unk_20, 1000);
2022-12-27 12:55:56 +00:00
}
2024-07-06 00:33:09 +00:00
static void sub_0207AB8C(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AB9C(UnkStruct_0207A778 *param0, int param1)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
TrainerData *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
v0 = (TrainerData *)&param0->unk_20[0];
*v0 = param0->unk_00->trainerData[param1];
2022-12-27 12:55:56 +00:00
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207ABD0(UnkStruct_0207A778 *param0, int param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(param2) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
if (param1 == 1) {
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(29, (void *)&param0->unk_20[0], sizeof(TrainerData));
2022-12-27 12:55:56 +00:00
} else {
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(30, (void *)&param0->unk_20[0], sizeof(TrainerData));
2022-12-27 12:55:56 +00:00
}
}
2024-07-06 00:33:09 +00:00
static void sub_0207AC18(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AC28(UnkStruct_0207A778 *param0, int param1)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
Party *v0;
2022-12-27 12:55:56 +00:00
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2023-01-29 09:23:57 +00:00
v0 = (Party *)&param0->unk_20[0];
Party_cpy(param0->unk_00->parties[param1], v0);
2022-12-27 12:55:56 +00:00
return 1;
}
2024-07-06 00:33:09 +00:00
BOOL sub_0207AC54(UnkStruct_0207A778 *param0, int param1, int param2)
2022-12-27 12:55:56 +00:00
{
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
return 0;
}
2024-04-18 09:58:39 +00:00
if (CommTiming_IsSyncState(param2) == 0) {
2022-12-27 12:55:56 +00:00
return 0;
}
if (param1 == 1) {
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(31, (void *)&param0->unk_20[0], Party_SaveSize());
2022-12-27 12:55:56 +00:00
} else {
2024-05-13 20:25:40 +00:00
return CommSys_SendDataHuge(32, (void *)&param0->unk_20[0], Party_SaveSize());
2022-12-27 12:55:56 +00:00
}
}
2024-07-06 00:33:09 +00:00
static void sub_0207ACA4(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
void sub_0207ACB4(SysTask *param0, void *param1)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207ACB4 *v0 = (UnkStruct_0207ACB4 *)param1;
u8 *v1;
u16 *v2;
u16 *v3;
u16 *v4;
2022-12-27 12:55:56 +00:00
int v5;
v1 = ov16_0223E06C(v0->unk_00);
v2 = ov16_0223E080(v0->unk_00);
v3 = ov16_0223E08C(v0->unk_00);
v4 = ov16_0223E098(v0->unk_00);
switch (v0->unk_04) {
case 0:
2024-05-13 00:08:24 +00:00
if (CommSys_SendRingRemainingSize() != 264) {
2022-12-27 12:55:56 +00:00
break;
}
if (v2[0] == v3[0]) {
break;
}
if (v2[0] == v4[0]) {
v2[0] = 0;
v4[0] = 0;
}
v5 = sizeof(UnkStruct_0207A81C) + (v1[v2[0] + 2] | (v1[v2[0] + 3] << 8));
2024-04-01 05:42:36 +00:00
if (CommSys_SendData(23, (void *)&v1[v2[0]], v5) == 1) {
2022-12-27 12:55:56 +00:00
v2[0] += v5;
}
break;
default:
case 255:
2023-02-02 20:51:39 +00:00
Heap_FreeToHeap(param1);
2023-10-13 01:49:16 +00:00
SysTask_Done(param0);
2022-12-27 12:55:56 +00:00
break;
}
}
2024-07-06 00:33:09 +00:00
void sub_0207AD40(SysTask *param0, void *param1)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207AD40 *v0 = (UnkStruct_0207AD40 *)param1;
u8 *v1;
u16 *v2;
u16 *v3;
u16 *v4;
2022-12-27 12:55:56 +00:00
int v5;
v1 = ov16_0223E074(v0->unk_00);
v2 = ov16_0223E0A4(v0->unk_00);
v3 = ov16_0223E0B0(v0->unk_00);
v4 = ov16_0223E0BC(v0->unk_00);
switch (v0->unk_04) {
case 0:
if (v2[0] == v3[0]) {
break;
}
if (v2[0] == v4[0]) {
v2[0] = 0;
v4[0] = 0;
}
if (ov16_02266AE4(v0->unk_00, (void *)&v1[v2[0]]) == 1) {
v5 = sizeof(UnkStruct_0207A81C) + (v1[v2[0] + 2] | (v1[v2[0] + 3] << 8));
v2[0] += v5;
}
break;
default:
case 255:
2023-02-02 20:51:39 +00:00
Heap_FreeToHeap(param1);
2023-10-13 01:49:16 +00:00
SysTask_Done(param0);
2022-12-27 12:55:56 +00:00
break;
}
}
2024-07-06 00:33:09 +00:00
static void sub_0207ADB4(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
BattleSystem *v0 = (BattleSystem *)param3;
2022-12-27 12:55:56 +00:00
ov16_0223F338(v0, 255);
ov16_0223F344(v0, 255);
ov16_0223F350(v0, 1);
}
2024-07-06 00:33:09 +00:00
static void sub_0207ADD4(TrainerInfo *param0, UnkStruct_02027F8C *param1, UnkStruct_02027F8C *param2)
2022-12-27 12:55:56 +00:00
{
int v0;
CharCode_Copy(param2->unk_00, TrainerInfo_Name(param0));
2022-12-27 12:55:56 +00:00
2023-09-14 04:50:04 +00:00
param2->unk_10 = TrainerInfo_ID(param0);
param2->unk_14 = TrainerInfo_RegionCode(param0);
param2->unk_15 = TrainerInfo_GameCode(param0);
param2->unk_16 = TrainerInfo_Gender(param0);
2022-12-27 12:55:56 +00:00
for (v0 = 0; v0 < 16; v0++) {
param2->unk_18[v0] = param1[v0].unk_10;
param2->unk_58[v0] = param1[v0].unk_15;
param2->unk_68[v0] = param1[v0].unk_14;
param2->unk_78[v0] = param1[v0].unk_16;
}
}
2024-07-06 00:33:09 +00:00
void sub_0207AE34(int param0, int param1, void *param2, void *param3)
2022-12-27 12:55:56 +00:00
{
2024-07-06 00:33:09 +00:00
UnkStruct_0207A778 *v0 = (UnkStruct_0207A778 *)param3;
2022-12-27 12:55:56 +00:00
2024-04-01 06:26:15 +00:00
if (CommSys_CurNetId() != param0) {
2022-12-27 12:55:56 +00:00
sub_02027FEC(v0->unk_00->unk_124, (UnkStruct_02027F8C *)param2, 1, 5);
}
v0->unk_1020++;
}
2024-07-06 00:33:09 +00:00
static int sub_0207AE64(void)
2022-12-27 12:55:56 +00:00
{
return 136;
}