summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcamthesaxman <cameronghall@cox.net>2017-12-22 00:57:31 -0600
committercamthesaxman <cameronghall@cox.net>2017-12-22 00:57:31 -0600
commit2415720ea6760217355f286da83b9955c881bf1b (patch)
tree03486998989b00cfcc83d6504a39987c1d4f044e
parent71d3e605290b2069d3571478a3736b04d658decb (diff)
fix 0x2DFC in SaveBlock1
-rw-r--r--include/gba/macro.h6
-rw-r--r--include/global.h46
-rw-r--r--src/contest.c2
-rw-r--r--src/scene/new_game.c14
-rw-r--r--src/script_pokemon_util_80C4BF0.c4
5 files changed, 18 insertions, 54 deletions
diff --git a/include/gba/macro.h b/include/gba/macro.h
index d9d10c0a9..d9e6739b3 100644
--- a/include/gba/macro.h
+++ b/include/gba/macro.h
@@ -86,8 +86,8 @@
#define DmaCopyLarge(dmaNum, src, dest, size, block, bit) \
{ \
- const u8 *_src = src; \
- u8 *_dest = dest; \
+ const void *_src = src; \
+ void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
@@ -105,7 +105,7 @@
#define DmaClearLarge(dmaNum, dest, size, block, bit) \
{ \
- const u8 *_dest = dest; \
+ const void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
diff --git a/include/global.h b/include/global.h
index 330e047fd..d5b1bfa59 100644
--- a/include/global.h
+++ b/include/global.h
@@ -230,12 +230,6 @@ struct RamScript
struct RamScriptData data;
};
-struct SB1_2EFC_Struct
-{
- u16 var;
- u8 unknown[0x1E];
-};
-
struct EasyChatPair
{
u16 unk0_0:7;
@@ -530,26 +524,6 @@ union MauvilleMan
u8 filler[0x40]; // needed to pad out the struct
};
-struct Unk_SB_Access_Struct1
-{
- u8 filler0[0xF8];
- struct SB1_2EFC_Struct sb1_2EFC_struct[5];
-};
-
-struct Unk_SB_Access_Struct2
-{
- /*0x0000*/ struct SB1_2EFC_Struct sb1_2EFC_struct2[12]; // each is 0x20
- /*0x2F84*/ u8 filler[0x18];
-};
-
-/*0x2E04*/
-typedef union SB_Struct
-{
- struct Unk_SB_Access_Struct1 unkSB1;
- struct Unk_SB_Access_Struct2 unkSB2;
-} SB_Struct;
-// size is 0x198
-
struct UnknownSaveStruct2ABC
{
u8 val0;
@@ -634,12 +608,12 @@ struct RecordMixingGift
struct ContestWinner
{
- /*0x00*/ u32 unk0; // personality
- /*0x04*/ u32 unk4; // otId
- /*0x08*/ u16 unk8; // species
- /*0x0A*/ u8 unkA;
- /*0x0B*/ u8 unkB[0x16-0xB];
- /*0x16*/ u8 unk16[0x20-0x16];
+ /*0x00*/ u32 personality; // personality
+ /*0x04*/ u32 otId; // otId
+ /*0x08*/ u16 species; // species
+ /*0x0A*/ u8 contestCategory;
+ /*0x0B*/ u8 nickname[0x16-0xB];
+ /*0x16*/ u8 trainerName[0x20-0x16];
};
// there should be enough flags for all 412 slots
@@ -720,14 +694,8 @@ struct SaveBlock1 /* 0x02025734 */
/*0x2D90*/ u8 filler_2D90[0x4];
/*0x2D94*/ union MauvilleMan mauvilleMan;
/*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
-#if 0
- // I don't think this is right.
- /*0x2DFC*/ u8 filler_2DFC[0x8];
- /*0x2E04*/ SB_Struct sbStruct;
-#else
- /*0x2DFC*/ struct ContestWinner contestWinners[4];
+ /*0x2DFC*/ struct ContestWinner contestWinners[4]; // how long is this?
/*0x2E7C*/ u8 filler_2E7C[0x2F9C-0x2E7C];
-#endif
/*0x2F9C*/ struct DayCare daycare;
/*0x30B8*/ struct LinkBattleRecord linkBattleRecords[5];
/*0x3108*/ u8 filler_3108[8];
diff --git a/src/contest.c b/src/contest.c
index 210d09548..cd7efee7a 100644
--- a/src/contest.c
+++ b/src/contest.c
@@ -5574,7 +5574,7 @@ bool8 sub_80B2A7C(u8 a)
{
shared15DE0.personality = gContestMons[i].personality;
shared15DE0.otId = gContestMons[i].otId;
- shared15DE0.unk8 = gContestMons[i].species;
+ shared15DE0.species = gContestMons[i].species;
StringCopy(shared15DE0.nickname, gContestMons[i].nickname);
if (gIsLinkContest & 1)
StringCopy(shared15DE0.trainerName, gLinkPlayers[i].name);
diff --git a/src/scene/new_game.c b/src/scene/new_game.c
index e3d6996ac..98ef0853d 100644
--- a/src/scene/new_game.c
+++ b/src/scene/new_game.c
@@ -24,6 +24,7 @@
#include "rtc.h"
#include "script.h"
#include "secret_base.h"
+#include "text.h"
#include "tv.h"
EWRAM_DATA u8 gDifferentSaveFile = 0;
@@ -35,14 +36,10 @@ extern u16 gSaveFileStatus;
extern u8 gUnknown_0819FA81[];
-const struct SB1_2EFC_Struct gUnknown_08216604 =
+static const struct ContestWinner sEmptyContestWinner =
{
- 0x0000,
- {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- }
+ .nickname = {EOS},
+ .trainerName = {EOS},
};
void write_word_to_mem(u32 var, u8 *dataPtr)
@@ -89,8 +86,7 @@ void sub_8052DA8(void)
sub_80B2D1C();
for (i = 0; i < 5; i++)
- gSaveBlock1.contestWinners[i] = gUnknown_08216604;
- //gSaveBlock1.sbStruct.unkSB1.sb1_2EFC_struct[i] = gUnknown_08216604;
+ gSaveBlock1.contestWinners[8 + i] = sEmptyContestWinner;
}
void ZeroBattleTowerData(void)
diff --git a/src/script_pokemon_util_80C4BF0.c b/src/script_pokemon_util_80C4BF0.c
index dc48adc9b..1128e386d 100644
--- a/src/script_pokemon_util_80C4BF0.c
+++ b/src/script_pokemon_util_80C4BF0.c
@@ -111,7 +111,7 @@ void sub_80C4C78(void)
break;
}
- returnVar = gSaveBlock1.sbStruct.unkSB2.sb1_2EFC_struct2[var].var;
+ returnVar = gSaveBlock1.contestWinners[var].species;
if(returnVar == 0)
gSpecialVar_0x8004 = returnVar;
@@ -144,7 +144,7 @@ u8 sub_80C4D50(void)
int i;
for (i = 0; i < 5; i++)
- if (gSaveBlock1.sbStruct.unkSB2.sb1_2EFC_struct2[i + 8].var)
+ if (gSaveBlock1.contestWinners[i + 8].species != 0)
retVar++;
return retVar;