Decomped GetScenarioBalance

This commit is contained in:
AnonymousRandomPerson
2025-10-23 23:01:56 -04:00
parent 3dc6341243
commit 6a30f7e9c1
7 changed files with 1215 additions and 1201 deletions

View File

@@ -1,36 +1,4 @@
#pragma once
.public _0209DFC8
.public _0209DFE8
.public _0209E008
.public _0209E010
.public _0209E011
.public ARM9_UNKNOWN_TABLE__NA_209E164
.public CopyBitsFrom
.public CopyBitsTo
.public Debug_Print0
.public FemaleToMaleForm
.public FileClose
.public FileRom_HandleOpen
.public FileRom_HandleRead
.public FileRom_HandleSeek
.public FileRom_InitDataTransfer
.public FileRom_StopDataTransfer
.public FileRom_Veneer_FileInit
.public GetDexNumber
.public GetGameMode
.public GLOBAL_PROGRESS_PTR
.public KAOMADO_FILEPATH
.public KAOMADO_STREAM
.public LoadScriptVariableValue
.public LoadScriptVariableValueAtIndex
.public MemAlloc
.public MemZero
.public PORTRAIT_LAYOUTS
.public SaveScriptVariableValue
.public SaveScriptVariableValueAtIndex
.public SetAdventureLogCompleted
.public sub_02050974
.public sub_02050990
.public sub_020509BC
.public VERSION_EXCLUSIVE_MONSTERS
.public ZinitScriptVariable

View File

@@ -0,0 +1,36 @@
#pragma once
.public ARM9_UNKNOWN_TABLE__NA_209E164
.public CopyBitsFrom
.public CopyBitsTo
.public Debug_Print0
.public FemaleToMaleForm
.public FileClose
.public FileRom_HandleOpen
.public FileRom_HandleRead
.public FileRom_HandleSeek
.public FileRom_InitDataTransfer
.public FileRom_StopDataTransfer
.public FileRom_Veneer_FileInit
.public GLOBAL_PROGRESS_PTR
.public GetDexNumber
.public GetGameMode
.public KAOMADO_FILEPATH
.public KAOMADO_STREAM
.public LoadScriptVariableValue
.public LoadScriptVariableValueAtIndex
.public MemAlloc
.public MemZero
.public PORTRAIT_LAYOUTS
.public SaveScriptVariableValue
.public SaveScriptVariableValueAtIndex
.public SetAdventureLogCompleted
.public VERSION_EXCLUSIVE_MONSTERS
.public ZinitScriptVariable
.public _0209DFC8
.public _0209DFE8
.public _0209E008
.public _0209E010
.public _0209E011
.public sub_02050974
.public sub_02050990
.public sub_020509BC

File diff suppressed because it is too large Load Diff

1146
asm/main_0204CBE8.s Normal file

File diff suppressed because it is too large Load Diff

12
include/main_0204CB94.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef PMDSKY_MAIN_0204CB94_H
#define PMDSKY_MAIN_0204CB94_H
// Returns the current SCENARIO_BALANCE value.
// The exact value returned depends on multiple factors:
// - If the first special episode is active, returns 1
// - If a different special episode is active, returns 3
// - If the SCENARIO_BALANCE_DEBUG variable is >= 0, returns its value
// - In all other cases, the value of the SCENARIO_BALANCE_FLAG variable is returned
u8 GetScenarioBalance();
#endif //PMDSKY_MAIN_0204CB94_H

View File

@@ -85,6 +85,8 @@ Static main
Object asm/main_0204C94C.o
Object src/dungeon_recruitment_3.o
Object asm/main_0204CA94.o
Object src/main_0204CB94.o
Object asm/main_0204CBE8.o
Object src/main_0204DA2C.o
Object asm/main_0204DB08.o
Object src/main_0204DD80.o

19
src/main_0204CB94.c Normal file
View File

@@ -0,0 +1,19 @@
#include "main_0204CB94.h"
#include "scripting.h"
u8 GetScenarioBalance()
{
s32 special_episode_type = LoadScriptVariableValue(0, VAR_EXECUTE_SPECIAL_EPISODE_TYPE);
if (special_episode_type == -1)
{
s32 scenario_balance = LoadScriptVariableValue(0, VAR_SCENARIO_BALANCE_DEBUG);
if (scenario_balance < 0)
scenario_balance = LoadScriptVariableValue(0, VAR_SCENARIO_BALANCE_FLAG);
return scenario_balance;
}
if (special_episode_type == EPISODE_BIDOOFS_WISH)
return 1;
return 3;
}