mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
Decomped GetExplorerMazeTeamName
Decomped by @slaw-22
This commit is contained in:
parent
bc95728e60
commit
1d020b7eff
|
|
@ -1,82 +1,8 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "main_02059118.inc"
|
||||
.include "main_02059224.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start WriteMonsterInfoToSave
|
||||
WriteMonsterInfoToSave: ; 0x02059118
|
||||
stmdb sp!, {r4, r5, r6, r7, r8, lr}
|
||||
sub sp, sp, #0x10
|
||||
mov r3, r0
|
||||
mov r2, r1
|
||||
add r0, sp, #0
|
||||
mov r1, r3
|
||||
bl sub_02050990
|
||||
ldr r6, _0205921C ; =TEAM_MEMBER_TABLE_PTR
|
||||
ldr r5, _02059220 ; =0x0000022B
|
||||
mov r8, #0
|
||||
add r7, sp, #0
|
||||
mov r4, #0x44
|
||||
_02059148:
|
||||
ldr r1, [r6]
|
||||
mov r0, r7
|
||||
mla r1, r8, r4, r1
|
||||
bl WriteMonsterToSave
|
||||
add r8, r8, #1
|
||||
cmp r8, r5
|
||||
blt _02059148
|
||||
ldr r1, _0205921C ; =TEAM_MEMBER_TABLE_PTR
|
||||
add r0, sp, #0
|
||||
ldr r1, [r1]
|
||||
mov r2, #0x40
|
||||
add r1, r1, #0x78
|
||||
add r1, r1, #0x9800
|
||||
bl CopyBitsTo
|
||||
ldr r1, _0205921C ; =TEAM_MEMBER_TABLE_PTR
|
||||
add r0, sp, #0
|
||||
ldr r1, [r1]
|
||||
mov r2, #4
|
||||
add r1, r1, #0x1880
|
||||
add r1, r1, #0x8000
|
||||
bl CopyBitsTo
|
||||
ldr r1, _0205921C ; =TEAM_MEMBER_TABLE_PTR
|
||||
add r0, sp, #0
|
||||
ldr r1, [r1]
|
||||
mov r2, #4
|
||||
add r1, r1, #0x81
|
||||
add r1, r1, #0x9800
|
||||
bl CopyBitsTo
|
||||
ldr r1, _0205921C ; =TEAM_MEMBER_TABLE_PTR
|
||||
add r0, sp, #0
|
||||
ldr r1, [r1]
|
||||
mov r2, #0x50
|
||||
add r1, r1, #0x82
|
||||
add r1, r1, #0x9800
|
||||
bl CopyBitsTo
|
||||
ldr r5, _0205921C ; =TEAM_MEMBER_TABLE_PTR
|
||||
mov r7, #0
|
||||
add r6, sp, #0
|
||||
mov r4, #0x44
|
||||
_020591E4:
|
||||
ldr r1, [r5]
|
||||
mov r0, r6
|
||||
add r1, r1, #0x98
|
||||
add r1, r1, #0x9800
|
||||
mla r1, r7, r4, r1
|
||||
bl WriteMonsterToSave
|
||||
add r7, r7, #1
|
||||
cmp r7, #4
|
||||
blt _020591E4
|
||||
add r0, sp, #0
|
||||
bl sub_020509BC
|
||||
ldr r0, [sp, #8]
|
||||
add sp, sp, #0x10
|
||||
ldmia sp!, {r4, r5, r6, r7, r8, pc}
|
||||
.align 2, 0
|
||||
_0205921C: .word TEAM_MEMBER_TABLE_PTR
|
||||
_02059220: .word 0x0000022B
|
||||
arm_func_end WriteMonsterInfoToSave
|
||||
|
||||
arm_func_start ReadMonsterInfoFromSave
|
||||
ReadMonsterInfoFromSave: ; 0x02059224
|
||||
stmdb sp!, {r4, r5, r6, r7, r8, lr}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
#include "item.h"
|
||||
#include "move.h"
|
||||
|
||||
#define MAX_GROUND_TEAM_MEMBERS 555
|
||||
|
||||
struct ground_move {
|
||||
// 0x0: flags: 1-byte bitfield
|
||||
// See move::flags0 for details
|
||||
|
|
@ -98,7 +100,7 @@ struct team_member_table {
|
|||
//
|
||||
// Subsequent entries are normal recruits. If a member is released, all subsequent members will
|
||||
// be shifted up, so there should be no gaps in the list.
|
||||
struct ground_monster members[555];
|
||||
struct ground_monster members[MAX_GROUND_TEAM_MEMBERS];
|
||||
// 0x936C: Currently active team members for each team, listed in team order. The first index is
|
||||
// the team ID (see enum team_id), the second is the roster index within the given team.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
#ifndef PMDSKY_MAIN_02059060_H
|
||||
#define PMDSKY_MAIN_02059060_H
|
||||
|
||||
struct WriteMonsterInfoToSave_struct {
|
||||
u32 unk0;
|
||||
u32 unk4;
|
||||
s32 result;
|
||||
u32 unkC;
|
||||
};
|
||||
|
||||
// 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
|
||||
|
|
@ -8,5 +15,6 @@ void GetExplorerMazeTeamName(u8 *dest);
|
|||
u64 sub_020590C0(void);
|
||||
void sub_020590DC(u64 param0);
|
||||
struct ground_monster* GetExplorerMazeMonster(s16 entry_number);
|
||||
s32 WriteMonsterInfoToSave(void* start_addr, u32 total_len);
|
||||
|
||||
#endif //PMDSKY_MAIN_02059060_H
|
||||
|
|
|
|||
2
main.lsf
2
main.lsf
|
|
@ -130,7 +130,7 @@ Static main
|
|||
Object asm/main_02058F24.o
|
||||
Object src/main_02058FA4.o
|
||||
Object src/main_02059060.o
|
||||
Object asm/main_02059118.o
|
||||
Object asm/main_02059224.o
|
||||
Object src/dungeon_init_2.o
|
||||
Object asm/main_0206A750.o
|
||||
Object src/main_0206C98C.o
|
||||
|
|
|
|||
|
|
@ -5,8 +5,12 @@
|
|||
|
||||
extern struct team_member_table *TEAM_MEMBER_TABLE_PTR;
|
||||
|
||||
s32 GetLanguageType(void);
|
||||
void StrncpySimpleNoPadSafe(u8* dest, const u8* src, u32 n);
|
||||
extern s32 GetLanguageType(void);
|
||||
extern void StrncpySimpleNoPadSafe(u8* dest, const u8* src, u32 n);
|
||||
extern void sub_02050990(struct WriteMonsterInfoToSave_struct *ptr, void *start_addr, u32 total_len);
|
||||
extern void WriteMonsterToSave(struct WriteMonsterInfoToSave_struct *write_info, struct ground_monster *monster);
|
||||
extern void CopyBitsTo(void *ctx, void *src, s32 nbits);
|
||||
extern void sub_020509BC(struct WriteMonsterInfoToSave_struct *ptr);
|
||||
|
||||
void GetExplorerMazeTeamName(u8 *dest)
|
||||
{
|
||||
|
|
@ -46,3 +50,29 @@ struct ground_monster* GetExplorerMazeMonster(s16 entry_number)
|
|||
{
|
||||
return TEAM_MEMBER_TABLE_PTR->explorer_maze_monsters + entry_number;
|
||||
}
|
||||
|
||||
s32 WriteMonsterInfoToSave(void* start_addr, u32 total_len)
|
||||
{
|
||||
struct WriteMonsterInfoToSave_struct local_struct;
|
||||
|
||||
sub_02050990(&local_struct, start_addr, total_len);
|
||||
|
||||
for (s32 i = 0; i < MAX_GROUND_TEAM_MEMBERS; i++)
|
||||
{
|
||||
WriteMonsterToSave(&local_struct, &TEAM_MEMBER_TABLE_PTR->members[i]);
|
||||
}
|
||||
|
||||
CopyBitsTo(&local_struct, &TEAM_MEMBER_TABLE_PTR->field_0x9878, 64);
|
||||
CopyBitsTo(&local_struct, &TEAM_MEMBER_TABLE_PTR->explorer_maze_team_native_language, 4);
|
||||
CopyBitsTo(&local_struct, &TEAM_MEMBER_TABLE_PTR->field_0x9881, 4);
|
||||
CopyBitsTo(&local_struct, &TEAM_MEMBER_TABLE_PTR->explorer_maze_team_name, 80);
|
||||
|
||||
for (s32 i = 0; i < 4; i++)
|
||||
{
|
||||
WriteMonsterToSave(&local_struct, &TEAM_MEMBER_TABLE_PTR->explorer_maze_monsters[i]);
|
||||
}
|
||||
|
||||
sub_020509BC(&local_struct);
|
||||
|
||||
return local_struct.result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,8 +157,6 @@ 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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user