summaryrefslogtreecommitdiff
path: root/arm9/src
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/src')
-rw-r--r--arm9/src/options.c110
-rw-r--r--arm9/src/overlay_manager.c (renamed from arm9/src/unk_02006234.c)9
-rw-r--r--arm9/src/sound.c2
-rw-r--r--arm9/src/unk_0200CA44.c20
-rw-r--r--arm9/src/unk_0202C144.c30
5 files changed, 141 insertions, 30 deletions
diff --git a/arm9/src/options.c b/arm9/src/options.c
new file mode 100644
index 00000000..296b398a
--- /dev/null
+++ b/arm9/src/options.c
@@ -0,0 +1,110 @@
+#include "global.h"
+#include "heap.h"
+#include "main.h"
+#include "MI_memory.h"
+#include "options.h"
+#include "player_data.h"
+
+#pragma thumb on
+
+struct Options * Options_new(u32 heap_id) {
+ struct Options * ret = AllocFromHeap(heap_id, sizeof(struct Options));
+ Options_init(ret);
+ return ret;
+}
+
+void Options_copy(struct Options * src, struct Options * dest) {
+ MI_CpuCopy8(src, dest, sizeof(struct Options));
+}
+
+void Options_init(struct Options * options) {
+ MI_CpuFill8(options, 0, sizeof(struct Options));
+
+ options->textSpeed = 1; // mid speed
+ options->soundMethod = 0; // stereo
+ options->battleStyle = 0; // shift
+ options->battleScene = 0; // on
+ options->buttonMode = 0; // normal
+ options->frame = 0; // frame 1
+}
+
+void Options_SetButtonModeOnMain(struct SaveBlock2 * sav2, u32 buttonMode) {
+ if (sav2 != NULL) {
+ buttonMode = Options_GetButtonMode(Sav2_PlayerData_GetOptionsAddr(sav2));
+ }
+
+ switch (buttonMode) {
+ case 1:
+ gMain.unk34 = 1;
+ break;
+ case 2:
+ gMain.unk34 = 3;
+ break;
+ case 0:
+ default:
+ gMain.unk34 = 0;
+ break;
+ }
+}
+
+u16 Options_GetTextSpeed(struct Options * options) {
+ return options->textSpeed;
+}
+
+void Options_SetTextSpeed(struct Options * options, u16 textSpeed) {
+ options->textSpeed = (u16)(u32)textSpeed;
+}
+
+u32 Options_GetTextFrameDelay(struct Options * options) {
+ u16 textSpeed = Options_GetTextSpeed(options);
+
+ if (textSpeed == 0) {
+ return 8;
+ }
+
+ if (textSpeed == 1) {
+ return 4;
+ }
+
+ return 1;
+}
+
+u16 Options_GetSoundMethod(struct Options * options) {
+ return options->soundMethod;
+}
+
+void Options_SetSoundMethod(struct Options * options, u16 soundMethod) {
+ options->soundMethod = (u16)(u32)soundMethod;
+}
+
+u16 Options_GetBattleScene(struct Options * options) {
+ return options->battleScene;
+}
+
+void Options_SetBattleScene(struct Options * options, u16 battleScene) {
+ options->battleScene = (u16)(u32)battleScene;
+}
+
+u16 Options_GetBattleStyle(struct Options * options) {
+ return options->battleStyle;
+}
+
+void Options_SetBattleStyle(struct Options * options, u16 battleStyle) {
+ options->battleStyle = (u16)(u32)battleStyle;
+}
+
+u16 Options_GetButtonMode(struct Options * options) {
+ return options->buttonMode;
+}
+
+void Options_SetButtonMode(struct Options * options, u16 buttonMode) {
+ options->buttonMode = (u16)(u32)buttonMode;
+}
+
+u16 Options_GetFrame(struct Options * options) {
+ return options->frame;
+}
+
+void Options_SetFrame(struct Options * options, u16 frame) {
+ options->frame = (u16)(u32)frame;
+}
diff --git a/arm9/src/unk_02006234.c b/arm9/src/overlay_manager.c
index a493311d..a59e15ac 100644
--- a/arm9/src/unk_02006234.c
+++ b/arm9/src/overlay_manager.c
@@ -2,14 +2,7 @@
#include "main.h"
#include "poke_overlay.h"
#include "heap.h"
-
-struct UnkStruct_02006234 * OverlayManager_new(struct Unk21DBE18 * ovly_mgr, int * a1, u32 heap_id); //todo header?
-void OverlayManager_delete(struct UnkStruct_02006234 * a0);
-void * OverlayManager_CreateAndGetData(struct UnkStruct_02006234 * a0, u32 size, u32 heap_id);
-void * OverlayManager_GetData(struct UnkStruct_02006234 * a0);
-void OverlayManager_FreeData(struct UnkStruct_02006234 * a0);
-int * OverlayManager_GetField18(struct UnkStruct_02006234 * a0);
-BOOL OverlayManager_Run(struct UnkStruct_02006234 * a0);
+#include "overlay_manager.h"
THUMB_FUNC struct UnkStruct_02006234 * OverlayManager_new(struct Unk21DBE18 * ovly_mgr, int * a1, u32 heap_id)
{
diff --git a/arm9/src/sound.c b/arm9/src/sound.c
index dd928287..a1e31bbd 100644
--- a/arm9/src/sound.c
+++ b/arm9/src/sound.c
@@ -38,7 +38,7 @@ void InitSoundData(void * a0, struct Options * a1)
FUN_020040A4(sdat);
UNK_02107070[1] = 0;
sdat->unk_BCD4C = a0;
- FUN_02004D60(a1->unk0_4);
+ FUN_02004D60(a1->soundMethod);
}
void DoSoundUpdateFrame(void)
diff --git a/arm9/src/unk_0200CA44.c b/arm9/src/unk_0200CA44.c
index fc4656b2..fd703cd3 100644
--- a/arm9/src/unk_0200CA44.c
+++ b/arm9/src/unk_0200CA44.c
@@ -2,30 +2,30 @@
#include "main.h"
#include "unk_0200CA44.h"
-extern void FUN_0201B60C(void *, void (*)(void *, void *), void *, void *);
+extern BOOL FUN_0201B60C(void *, void (*)(u32, void *), void *, void *);
extern void FUN_0201B6A0(s32);
-THUMB_FUNC void FUN_0200CA44(void (*r0)(void *, void *), void * r1, void * r2)
+THUMB_FUNC BOOL FUN_0200CA44(void (*r0)(u32, void *), void * r1, void * r2)
{
- FUN_0201B60C(gMain.unk18, r0, r1, r2);
+ return FUN_0201B60C(gMain.unk18, r0, r1, r2);
}
-THUMB_FUNC void FUN_0200CA60(void (*r0)(void *, void *), void * r1, void * r2)
+THUMB_FUNC BOOL FUN_0200CA60(void (*r0)(u32, void *), void * r1, void * r2)
{
- FUN_0201B60C(gMain.unk1C, r0, r1, r2);
+ return FUN_0201B60C(gMain.unk1C, r0, r1, r2);
}
-THUMB_FUNC void FUN_0200CA7C(void (*r0)(void *, void *), void * r1, void * r2)
+THUMB_FUNC BOOL FUN_0200CA7C(void (*r0)(u32, void *), void * r1, void * r2)
{
- FUN_0201B60C(gMain.unk24, r0, r1, r2);
+ return FUN_0201B60C(gMain.unk24, r0, r1, r2);
}
-THUMB_FUNC void FUN_0200CA98(void (*r0)(void *, void *), void * r1, void * r2)
+THUMB_FUNC BOOL FUN_0200CA98(void (*r0)(u32, void *), void * r1, void * r2)
{
- FUN_0201B60C(gMain.unk20, r0, r1, r2);
+ return FUN_0201B60C(gMain.unk20, r0, r1, r2);
}
-THUMB_FUNC void FUN_0200CAB4(s32 unk1)
+THUMB_FUNC void FUN_0200CAB4(s32 unk1) //bool?
{
FUN_0201B6A0(unk1);
}
diff --git a/arm9/src/unk_0202C144.c b/arm9/src/unk_0202C144.c
index 27125eb3..b7dd45aa 100644
--- a/arm9/src/unk_0202C144.c
+++ b/arm9/src/unk_0202C144.c
@@ -1,18 +1,26 @@
#include "global.h"
-#include "pokemon.h"
#include "pokedex.h"
-#include "save_block_2.h"
-#include "unk_02029FBO.h"
#include "poketch.h"
+#include "unk_02029FB0.h"
+#include "unk_0202C144.h"
-THUMB_FUNC void FUN_0202C144(struct SaveBlock2 *sav2, struct Pokemon *pokemon) {
- if (GetMonData(pokemon, MON_DATA_IS_EGG, NULL) == 0)
+#pragma thumb on
+
+extern struct UnkStruct_02029FB0 * FUN_02029FC8(struct SaveBlock2 * sav2);
+extern void FUN_0202A1C4(struct UnkStruct_02029FB0 * unk, struct Pokedex * pokedex, u16 species);
+
+void FUN_0202C144(struct SaveBlock2 * sav2, struct Pokemon * mon)
+{
+ u32 is_egg = GetMonData(mon, MON_DATA_IS_EGG, NULL);
+ if (!is_egg)
{
- struct Pokedex *pokedex = Sav2_Pokedex_get(sav2);
- void *unkSavStruct = FUN_02029FC8(sav2); /* SavArray_get(sav2, 20) */
+ struct Pokedex * pokedex = Sav2_Pokedex_get(sav2);
+ struct UnkStruct_02029FB0 * unk = FUN_02029FC8(sav2);
+ u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
+ FUN_0202A1C4(unk, pokedex, (u16)species);
+ Pokedex_SetMonCaughtFlag(pokedex, mon);
- FUN_0202A1C4(unkSavStruct, pokedex, GetMonData(pokemon, MON_DATA_SPECIES, NULL));
- Pokedex_SetMonCaughtFlag(pokedex, pokemon);
- Sav2_Poketch_PokemonHistoryAddMon(Sav2_Poketch_get(sav2), &pokemon->box);
+ struct SavePoketch * poketch = Sav2_Poketch_get(sav2);
+ Sav2_Poketch_PokemonHistoryAddMon(poketch, &mon->box);
}
-} \ No newline at end of file
+}