Skip to content

Commit

Permalink
Merge pull request #5 from citrusbolt/pr_linkdata2
Browse files Browse the repository at this point in the history
Document data for communicating both with the cartridge save file and the GameCube host
  • Loading branch information
GriffinRichards authored Mar 22, 2024
2 parents 183b40f + ecdc097 commit f28d2b8
Show file tree
Hide file tree
Showing 11 changed files with 886 additions and 780 deletions.
94 changes: 47 additions & 47 deletions payload/include/all.h
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
#ifndef GUARD_ALL_H
#define GUARD_ALL_H

struct UnkStruct868
struct ExternalEventData2
{
u32 a0;
u32 a4;
u32 a8_0:24;
u32 a11_0:1;
u32 a11_1:1;
u32 a11_2:1;
u32 a11_3:1;
u32 a11_4:4;
u32 a12:24;
u32 a15:8;
u32 unknownExternalDataFields1;
u32 unknownExternalDataFields2;
u32 currentPokeCoupons:24;
u32 gotGoldPokeCouponTitleReward:1;
u32 gotSilverPokeCouponTitleReward:1;
u32 gotBronzePokeCouponTitleReward:1;
u32 receivedAgetoCelebi:1;
u32 unknownExternalDataFields3:4;
u32 totalEarnedPokeCoupons:24;
u32 unknownExternalDataFields4:8;
};

struct UnkStruct81C
struct MonName
{
u8 str[10];
u32 unk826_0:3;
u32 unk826_1:1;
u32 unk826_2:1;
u32 unk826_3:1;
u32 unk826_4:2;
u32 playerId:3;
u32 isJapanese:1;
u32 isNidoranF:1;
u32 isNidoranM:1;
u32 gender:2;
};

struct UnkStruct24
struct MonData
{
u16 hp; // 0x24
u32 status:12; // 0x26
u32 unk27_0:1;
u32 unk27_1:1;
u32 unk27_2:1;
u32 unk27_3:1;
u16 heldItem; // 0x28
u16 unk2A;
u32 giveMaxPokerusDays:1;
u32 giveMaxPokerusStrain:1;
u32 setMailTo1:1;
u32 preserveHeldItem:1;
u32 heldItem:16; // 0x28
u16 unused;
u16 moves[MAX_MON_MOVES]; // 0x2C , 0x2E , 0x30, 0x32
u8 pps[MAX_MON_MOVES]; // 0x34-0x37
u8 unk38[320];
u8 textBuffer[320];
};

struct UnkStruct_02024960
struct MonLinkData
{
u32 unk_00:24;
u32 partyCountNibblefield:PARTY_SIZE * 4; // Like a bitfield, but every party member is represented by 4 bits. For example, a party of 4 would be represented by 0x00FFFF
u32 unk_03_0:7;
u32 unk_03_7:1;
u32 unk4:24;
u32 unk7:8;
u32 unk8;
u32 unkC;
u16 unk10;
u32 monCount:8;
u32 personality;
u32 otId;
u16 species;
u16 unk12;
u16 unk14[MAX_MON_MOVES];
u8 unk1C[MAX_MON_MOVES];
u16 moves[MAX_MON_MOVES];
u8 pps[MAX_MON_MOVES];
u16 unk20;
u8 unk22_0:4;
u8 unk22_4:4;
u8 unk23_0:4;
u8 unk23_4:4;
struct UnkStruct24 unk24[PARTY_SIZE];
struct UnkStruct81C unk81C[4];
struct MonData monData[PARTY_SIZE];
struct MonName monName[4];
u8 unk84C_00:1;
u8 unk84C_01:1;
u8 transferComplete:1;
u8 unk84C_02:1;
u8 unk84C_03:1;
u8 unk84C_1:4;
u32 unk84C_2:16;
u32 unk84C_3:8;
u32 unk850_1:8;
u8 monId:4;
u32 species2:16;
u32 speciesLowerByte:8;
u32 speciesUpperByte:8;
u32 unk850_2:24;
u32 *field854;
u32 *monPtr;
u8 unk_858;
u8 unk_859;
u8 numMonsToSelect;
u8 unk_85A;
u8 unk_85B;
u8 ALIGNED(4) field85C[12]; // Aligned for u32 copy
struct UnkStruct868 unk868;
u8 species3; // Only 1 byte, so can not contain a Hoenn species
u8 ALIGNED(4) giftRibbons[GIFT_RIBBONS_COUNT + 1]; // Aligned for u32 copy
struct ExternalEventData2 externalEventData;
u8 unk_878;
u8 unk_879;
u8 partyCount;
u8 unk_87A;
u8 unk_87B;
u8 unk_87C;
Expand All @@ -87,7 +87,7 @@ struct UnkStruct_02024960
u32 unk_880;
};

extern volatile struct UnkStruct_02024960 gUnknown_02024960;
extern volatile struct MonLinkData gMonLinkData;

#include "gflib/text.h"

Expand Down
1 change: 1 addition & 0 deletions payload/include/constants/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#define SYSTEM_FLAGS 0x800

#define FLAG_SYS_POKEDEX_GET (SYSTEM_FLAGS + 0x01)
#define FLAG_SYS_GAME_CLEAR (SYSTEM_FLAGS + 0x04)
#define FLAG_SYS_NATIONAL_DEX (SYSTEM_FLAGS + 0x36)
#define FLAG_SYS_RIBBON_GET (SYSTEM_FLAGS + 0x3B)
Expand Down
9 changes: 9 additions & 0 deletions payload/include/gba/io_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,15 @@
#define SIO_MULTI_DI_SHIFT 3
#define SIO_MULTI_DI_MASK 0x1

// joy bus
#define JOYCNT_RESET (1 << 0)
#define JOYCNT_RECV_CMPLT (1 << 1)
#define JOYCNT_TRAN_CMPLT (1 << 2)
#define JOYCNT_RESET_IRQ (1 << 6)

#define RCNT_JOYBUS1 (1 << 14)
#define RCNT_JOYBUS2 (1 << 15)

// keys
#define A_BUTTON 0x0001
#define B_BUTTON 0x0002
Expand Down
Loading

0 comments on commit f28d2b8

Please sign in to comment.