mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-08-17 14:47:37 -05:00
GBA SaveBlock2 documentation
This commit is contained in:
7
include/constants/gba/global.h
Normal file
7
include/constants/gba/global.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef POKEPLATINUM_CONSTANTS_GBA_GLOBAL_H
|
||||
#define POKEPLATINUM_CONSTANTS_GBA_GLOBAL_H
|
||||
|
||||
#define GBA_TRAINER_ID_LEN 4
|
||||
#define GBA_PLAYER_NAME_LEN 7
|
||||
|
||||
#endif // POKEPLATINUM_CONSTANTS_GBA_GLOBAL_H
|
||||
@@ -12,6 +12,6 @@ BOOL ov97_02236280(void);
|
||||
int ov97_022362C8(void);
|
||||
int ov97_02236308(void);
|
||||
PokemonStorageGBA *ov97_02236340(void);
|
||||
void *ov97_02236350(void);
|
||||
void *GetGBASaveBlock2(void);
|
||||
|
||||
#endif // POKEPLATINUM_OV97_02235D18_H
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef POKEPLATINUM_OV97_0223635C_H
|
||||
#define POKEPLATINUM_OV97_0223635C_H
|
||||
|
||||
u32 ov97_0223635C(void);
|
||||
u8 *ov97_02236378(void);
|
||||
u32 GetGBAPlayerTrainerId(void);
|
||||
u8 *GetGBAPlayerName(void);
|
||||
|
||||
#endif // POKEPLATINUM_OV97_0223635C_H
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
#ifndef POKEPLATINUM_STRUCT_OV97_0223635C_H
|
||||
#define POKEPLATINUM_STRUCT_OV97_0223635C_H
|
||||
|
||||
#include "constants/gba/global.h"
|
||||
|
||||
// These fields are present at the beginning of RSE's and FRLG's SaveBlock2
|
||||
typedef struct {
|
||||
u8 unk_00[8];
|
||||
u8 unk_08;
|
||||
u8 unk_09;
|
||||
u8 unk_0A[4];
|
||||
u16 unk_0E;
|
||||
u8 unk_10;
|
||||
u8 unk_11;
|
||||
u8 unk_12;
|
||||
u8 unk_13;
|
||||
u16 unk_14_0 : 3;
|
||||
u16 unk_14_3 : 5;
|
||||
u16 unk_14_8 : 1;
|
||||
u16 unk_14_9 : 1;
|
||||
u16 unk_14_10 : 1;
|
||||
u16 unk_14_11 : 1;
|
||||
u16 : 4;
|
||||
} UnkStruct_ov97_0223635C;
|
||||
u8 playerName[GBA_PLAYER_NAME_LEN + 1];
|
||||
u8 playerGender;
|
||||
u8 specialSaveWarpFlags;
|
||||
u8 playerTrainerId[GBA_TRAINER_ID_LEN];
|
||||
u16 playTimeHours;
|
||||
u8 playTimeMinutes;
|
||||
u8 playTimeSeconds;
|
||||
u8 playTimeVBlanks;
|
||||
u8 optionsButtonMode;
|
||||
u16 optionsTextSpeed : 3;
|
||||
u16 optionsWindowFrameType : 5;
|
||||
u16 optionsSound : 1;
|
||||
u16 optionsBattleStyle : 1;
|
||||
u16 optionsBattleSceneOff : 1;
|
||||
u16 regionMapZoom : 1;
|
||||
u16 padding : 4;
|
||||
} GBASaveBlock2;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV97_0223635C_H
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "constants/catching_show.h"
|
||||
#include "constants/gba/global.h"
|
||||
#include "constants/gba/items.h"
|
||||
#include "constants/gba/pokemon.h"
|
||||
#include "constants/gba/species.h"
|
||||
@@ -275,7 +276,7 @@ static int ov97_02233B8C(UnkStruct_ov97_02234A2C *param0)
|
||||
case 0:
|
||||
ov97_02233D10(param0);
|
||||
transferData = SaveData_PalParkTransfer(param0->unk_10);
|
||||
sub_0202EFB8(transferData, ov97_0223635C());
|
||||
sub_0202EFB8(transferData, GetGBAPlayerTrainerId());
|
||||
v4->unk_00++;
|
||||
break;
|
||||
case 1:
|
||||
@@ -368,7 +369,7 @@ static void ov97_02233CE4(UnkStruct_ov97_02234A2C *param0)
|
||||
int v1;
|
||||
PalParkTransfer *transferData = SaveData_PalParkTransfer(param0->unk_10);
|
||||
|
||||
sub_0202EFB8(transferData, ov97_0223635C());
|
||||
sub_0202EFB8(transferData, GetGBAPlayerTrainerId());
|
||||
ResetLock(4);
|
||||
|
||||
v1 = SaveData_Save(param0->unk_10);
|
||||
@@ -1620,10 +1621,10 @@ static void ov97_02235344(UnkStruct_ov97_02234A2C *param0)
|
||||
Strbuf *v2;
|
||||
u16 v3[7 + 1];
|
||||
|
||||
ov97_0223936C(ov97_02236378(), v3, 7 + 1, ov97_02235DBC());
|
||||
ov97_0223936C(GetGBAPlayerName(), v3, GBA_PLAYER_NAME_LEN + 1, ov97_02235DBC());
|
||||
|
||||
v1 = StringTemplate_Default(78);
|
||||
v2 = Strbuf_Init(7 + 1, 78);
|
||||
v2 = Strbuf_Init(GBA_PLAYER_NAME_LEN + 1, 78);
|
||||
|
||||
Strbuf_CopyChars(v2, v3);
|
||||
StringTemplate_SetStrbuf(v1, 1, v2, 0, 1, GAME_LANGUAGE);
|
||||
@@ -1661,7 +1662,7 @@ static void ov97_022353CC(void *param0)
|
||||
static int ov97_02235408(UnkStruct_ov97_02234A2C *param0)
|
||||
{
|
||||
int v0;
|
||||
u32 v1;
|
||||
u32 gbaTrainerId;
|
||||
PalParkTransfer *transferData = SaveData_PalParkTransfer(param0->unk_10);
|
||||
|
||||
if (sub_0202F0E0(transferData) == 0) {
|
||||
@@ -1673,8 +1674,8 @@ static int ov97_02235408(UnkStruct_ov97_02234A2C *param0)
|
||||
return 4;
|
||||
}
|
||||
|
||||
v1 = ov97_0223635C();
|
||||
v0 = sub_0202F050(transferData, v1);
|
||||
gbaTrainerId = GetGBAPlayerTrainerId();
|
||||
v0 = sub_0202F050(transferData, gbaTrainerId);
|
||||
|
||||
if (v0 == 0) {
|
||||
v0 = (60 * 60 * 24) * 2;
|
||||
|
||||
@@ -477,7 +477,7 @@ PokemonStorageGBA *ov97_02236340(void)
|
||||
return &(Unk_ov97_0223F440->unk_6000);
|
||||
}
|
||||
|
||||
void *ov97_02236350(void)
|
||||
void *GetGBASaveBlock2(void)
|
||||
{
|
||||
return ov97_02235EF8(0);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
#include "overlay097/ov97_02235D18.h"
|
||||
#include "overlay097/struct_ov97_0223635C.h"
|
||||
|
||||
u32 ov97_0223635C(void)
|
||||
u32 GetGBAPlayerTrainerId(void)
|
||||
{
|
||||
UnkStruct_ov97_0223635C *v0 = ov97_02236350();
|
||||
return v0->unk_0A[3] << 24 | v0->unk_0A[2] << 16 | v0->unk_0A[1] << 8 | v0->unk_0A[0];
|
||||
GBASaveBlock2 *saveBlock2 = GetGBASaveBlock2();
|
||||
return saveBlock2->playerTrainerId[3] << 24 | saveBlock2->playerTrainerId[2] << 16 | saveBlock2->playerTrainerId[1] << 8 | saveBlock2->playerTrainerId[0];
|
||||
}
|
||||
|
||||
u8 *ov97_02236378(void)
|
||||
u8 *GetGBAPlayerName(void)
|
||||
{
|
||||
UnkStruct_ov97_0223635C *v0 = ov97_02236350();
|
||||
return v0->unk_00;
|
||||
GBASaveBlock2 *saveBlock2 = GetGBASaveBlock2();
|
||||
return saveBlock2->playerName;
|
||||
}
|
||||
|
||||
@@ -79,11 +79,11 @@ void BoxMonToTransferData(PalParkTransfer *transfer, BoxPokemon *boxMon, int slo
|
||||
Pokemon_FromBoxPokemon(boxMon, &transfer->mons[slot]);
|
||||
}
|
||||
|
||||
void sub_0202EFB8(PalParkTransfer *transferData, u32 param1)
|
||||
void sub_0202EFB8(PalParkTransfer *transferData, u32 gbaTrainerId)
|
||||
{
|
||||
int v0 = sub_0202EF40(transferData, param1);
|
||||
int v0 = sub_0202EF40(transferData, gbaTrainerId);
|
||||
|
||||
transferData->unk_288[v0] = param1;
|
||||
transferData->unk_288[v0] = gbaTrainerId;
|
||||
transferData->unk_2D8[v0] = GetTimestamp();
|
||||
transferData->unk_378 = OS_GetOwnerRtcOffset();
|
||||
|
||||
@@ -109,13 +109,13 @@ int GetPalParkTransferMonCount(const PalParkTransfer *transferData)
|
||||
return count;
|
||||
}
|
||||
|
||||
int sub_0202F050(const PalParkTransfer *transferData, u32 param1)
|
||||
int sub_0202F050(const PalParkTransfer *transferData, u32 gbaTrainerId)
|
||||
{
|
||||
int v0;
|
||||
s64 v1 = GetTimestamp();
|
||||
|
||||
for (v0 = 0; v0 < 20; v0++) {
|
||||
if (transferData->unk_288[v0] == param1) {
|
||||
if (transferData->unk_288[v0] == gbaTrainerId) {
|
||||
return v1 - transferData->unk_2D8[v0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user