Decomped GetExplorerMazeTeamName

Decomped by @slaw-22
This commit is contained in:
AnonymousRandomPerson 2026-03-16 00:09:10 -04:00
parent 821490b861
commit 45b0de18d3
6 changed files with 52 additions and 43 deletions

View File

@ -31,7 +31,6 @@
.public EVENTS
.public EnableAllLearnableIqSkills
.public EnqueueRender3dTiling
.public ExplorerMazeMonsterExists
.public ExplorersOfSkyMain
.public FemaleToMaleForm
.public FindItemInInventory

View File

@ -1,46 +1,8 @@
.include "asm/macros.inc"
.include "main_02059060.inc"
.include "main_020590C0.inc"
.text
arm_func_start GetExplorerMazeTeamName
GetExplorerMazeTeamName: ; 0x02059060
stmdb sp!, {r3, r4, r5, lr}
ldr r1, _020590B8 ; =TEAM_MEMBER_TABLE_PTR
mov r5, r0
ldr r0, [r1]
add r0, r0, #0x1880
add r4, r0, #0x8000
bl ExplorerMazeMonsterExists
cmp r0, #0
beq _020590A8
bl GetLanguageType
ldrsb r1, [r4]
cmp r1, r0
bne _020590A8
mov r0, r5
add r1, r4, #2
#ifdef JAPAN
mov r2, #5
#else
mov r2, #0xa
#endif
bl StrncpySimpleNoPadSafe
ldmia sp!, {r3, r4, r5, pc}
_020590A8:
ldr r1, _020590BC ; =0x00000235
mov r0, r5
bl GetStringFromFileVeneer
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
_020590B8: .word TEAM_MEMBER_TABLE_PTR
#ifdef JAPAN
_020590BC: .word 0x000004C6
#else
_020590BC: .word 0x00000235
#endif
arm_func_end GetExplorerMazeTeamName
arm_func_start sub_020590C0
sub_020590C0: ; 0x020590C0
ldr r0, _020590D8 ; =TEAM_MEMBER_TABLE_PTR

9
include/main_02059060.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef PMDSKY_MAIN_02059060_H
#define PMDSKY_MAIN_02059060_H
// Returns the name of the explorer maze team. If the language of the team name is different from the
// language of selected in this game a default team name is written to the buffer instead.
// dest: [output] Buffer
void GetExplorerMazeTeamName(u8 *dest);
#endif //PMDSKY_MAIN_02059060_H

View File

@ -129,7 +129,8 @@ Static main
Object src/pokemon.o
Object asm/main_02058F24.o
Object src/main_02058FA4.o
Object asm/main_02059060.o
Object src/main_02059060.o
Object asm/main_020590C0.o
Object src/dungeon_init_2.o
Object asm/main_0206A750.o
Object src/main_0206C98C.o

33
src/main_02059060.c Normal file
View File

@ -0,0 +1,33 @@
#include "main_02059060.h"
#include "common.h"
#include "main_0202593C.h"
#include "main_02058FA4.h"
extern struct team_member_table *TEAM_MEMBER_TABLE_PTR;
s32 GetLanguageType(void);
void StrncpySimpleNoPadSafe(u8* dest, const u8* src, u32 n);
void GetExplorerMazeTeamName(u8 *dest)
{
s8 *explorer_maze_team_native_language = &TEAM_MEMBER_TABLE_PTR->explorer_maze_team_native_language;
if (ExplorerMazeMonsterExists())
{
if (GetLanguageType() == *explorer_maze_team_native_language)
{
u8 *explorer_maze_team_name = explorer_maze_team_native_language + 2;
#ifdef JAPAN
StrncpySimpleNoPadSafe(dest, explorer_maze_team_name, 5);
#else
StrncpySimpleNoPadSafe(dest, explorer_maze_team_name, 0xA);
#endif
return;
}
}
#ifdef JAPAN
GetStringFromFileVeneer(dest, 0x4C6);
#else
GetStringFromFileVeneer(dest, 0x235);
#endif
}

View File

@ -17,11 +17,13 @@ parser.add_argument('asm_file')
parser.add_argument('function_header')
parser.add_argument('-f', '--extract_file_name')
parser.add_argument('-n', '--nonmatching', action='store_true')
parser.add_argument('-nm', '--no_file_merge', action='store_false')
args = parser.parse_args()
function_location = args.asm_file
function_header = args.function_header
extract_file_name = args.extract_file_name
enable_file_merge = args.no_file_merge
nonmatching = args.nonmatching
if function_location.endswith('.s'):
@ -126,16 +128,17 @@ lsf_suffix = ''
if is_itcm:
lsf_suffix = ' (.itcm)'
SRC_LSF_PREFIX = '\tObject src/'
for i, line in enumerate(lsf_lines):
if line.endswith(f'{function_location}.o{lsf_suffix}\n'):
if remove_orig_file:
lsf_lines[i] = ''
prev_line = lsf_lines[i - 1]
if prev_line.startswith(SRC_LSF_PREFIX):
if prev_line.startswith(SRC_LSF_PREFIX) and enable_file_merge:
merge_prev_file = prev_line[len(SRC_LSF_PREFIX):]
if not include_new_asm_file and merge_prev_file is None:
next_line = lsf_lines[i + 1]
if next_line.startswith(SRC_LSF_PREFIX):
if next_line.startswith(SRC_LSF_PREFIX) and enable_file_merge:
merge_next_file = next_line[len(SRC_LSF_PREFIX):]
if merge_prev_file is None and merge_next_file is None:
lsf_lines[i] += f'\tObject src/{extract_file_name}.o{lsf_suffix}\n'
@ -154,6 +157,8 @@ def trim_merge_file_name(file_name: str) -> str:
merge_prev_file = trim_merge_file_name(merge_prev_file)
merge_next_file = trim_merge_file_name(merge_next_file)
print(merge_prev_file)
print(merge_next_file)
print('Updating', LSF_FILE_PATH)
with open(LSF_FILE_PATH, 'w') as lsf_file: