summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common_syms/main.txt6
-rw-r--r--include/battle_controllers.h2
-rw-r--r--src/battle_controllers.c2
-rw-r--r--src/main.c26
4 files changed, 24 insertions, 12 deletions
diff --git a/common_syms/main.txt b/common_syms/main.txt
index af834cad8..b1f274b58 100644
--- a/common_syms/main.txt
+++ b/common_syms/main.txt
@@ -4,9 +4,9 @@ gMain
gKeyRepeatContinueDelay
gSoftResetDisabled
gIntrTable
-gUnknown_3003578
+sVcountAfterSound
gLinkVSyncDisabled
IntrMain_Buffer
-gUnknown_3003D80
-gUnknown_3003D84
+sVcountAtIntr
+sVcountBeforeSound
gPcmDmaCounter
diff --git a/include/battle_controllers.h b/include/battle_controllers.h
index 0cbda02c0..7dacb1343 100644
--- a/include/battle_controllers.h
+++ b/include/battle_controllers.h
@@ -185,7 +185,7 @@ extern struct UnusedControllerStruct gUnknown_2022870;
void HandleLinkBattleSetup(void);
void SetUpBattleVars(void);
void InitBtlControllers(void);
-void sub_800DD28(void);
+void TryReceiveLinkBattleData(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
// emitters
diff --git a/src/battle_controllers.c b/src/battle_controllers.c
index 80b415824..9b8ed77e8 100644
--- a/src/battle_controllers.c
+++ b/src/battle_controllers.c
@@ -481,7 +481,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
}
}
-void sub_800DD28(void)
+void TryReceiveLinkBattleData(void)
{
u8 i;
s32 j;
diff --git a/src/main.c b/src/main.c
index 1573a2c5b..2f039c23b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,9 +67,15 @@ IntrFunc gIntrTable[INTR_COUNT];
bool8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200];
u8 gPcmDmaCounter;
-u8 gUnknown_3003578;
-u8 gUnknown_3003D80;
-u8 gUnknown_3003D84;
+
+// These variables are not defined in RS or Emerald, and are never read.
+// They were likely used to debug the audio engine and VCount interrupt.
+// Define NDEBUG in include/config.h to remove these variables.
+#ifndef NDEBUG
+u8 sVcountAfterSound;
+u8 sVcountAtIntr;
+u8 sVcountBeforeSound;
+#endif
static IntrFunc * const sTimerIntrFunc = gIntrTable + 0x7;
@@ -369,11 +375,15 @@ static void VBlankIntr(void)
gPcmDmaCounter = gSoundInfo.pcmDmaCounter;
- gUnknown_3003D84 = REG_VCOUNT;
+#ifndef NDEBUG
+ sVcountBeforeSound = REG_VCOUNT;
+#endif
m4aSoundMain();
- gUnknown_3003578 = REG_VCOUNT;
+#ifndef NDEBUG
+ sVcountAfterSound = REG_VCOUNT;
+#endif
- sub_800DD28();
+ TryReceiveLinkBattleData();
Random();
UpdateWirelessStatusIndicatorSprite();
@@ -398,7 +408,9 @@ static void HBlankIntr(void)
static void VCountIntr(void)
{
- gUnknown_3003D80 = REG_VCOUNT;
+#ifndef NDEBUG
+ sVcountAtIntr = REG_VCOUNT;
+#endif
m4aSoundVSync();
INTR_CHECK |= INTR_FLAG_VCOUNT;
gMain.intrCheck |= INTR_FLAG_VCOUNT;