Renamed data scripts to consistent naming scheme

Renamed `mus` to `libmus`
Discovered ClassData
Added `libmus,h`
Decompiled `ability_` functions
This commit is contained in:
Ogre 2023-09-12 01:04:41 +02:00
parent 0003efebb1
commit 7c766d07f9
12 changed files with 604 additions and 334 deletions

View File

@ -4,6 +4,7 @@
#include "include_asm.h"
#include <ultra64.h>
#include "libmus.h"
typedef u8 bool;
@ -296,8 +297,8 @@ extern u8 D_800A872C;
extern CharacterSlot CHARACTER_SLOT[];
typedef struct {
/* 0x00 */ const char* name;
typedef struct {
/* 0x00 */ char* name;
/* 0x04 */ u8 field_0x0;
/* 0x05 */ Element element;
/* 0x06 */ u8 field_0x2;
@ -314,9 +315,79 @@ typedef struct {
extern AbilityData ABILITY_DATA[];
Element ability_get_element(u8 index, u16 arg1, u16 arg2, s32 arg3, u16 arg4);
extern char* ability_get_name(u8 index);
extern Element ability_get_element(u8 index, u16 arg1, u16 arg2, s32 arg3, u16 arg4);
extern u16 func_8016FA34(u16, u16, u16, u16);
extern u16 func_8016FB50(u16, u16, u16, u16);
typedef struct {
/* 0x00 */ char* name;
/* 0x04 */ u8 field_0x4;
/* 0x05 */ u8 field_0x5;
/* 0x06 */ u8 field_0x6;
/* 0x07 */ u8 field_0x7;
/* 0x08 */ u16 field_0x8;
/* 0x0a */ u8 field_0xa;
/* 0x0b */ u8 field_0xb;
/* 0x0c */ u16 field_0xc;
/* 0x0e */ u8 field_0xe;
/* 0x0f */ u8 field_0xf;
/* 0x10 */ u16 field_0x10;
/* 0x12 */ u8 field_0x12;
/* 0x13 */ u8 field_0x13;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u8 field_0x16;
/* 0x17 */ u8 field_0x17;
/* 0x18 */ u16 field_0x18;
/* 0x1a */ u8 field_0x1a;
/* 0x1b */ u8 field_0x1b;
/* 0x1c */ u16 field_0x1c;
/* 0x1e */ u8 field_0x1e;
/* 0x1f */ u8 field_0x1f;
/* 0x20 */ u16 field_0x20;
/* 0x22 */ u8 field_0x22;
/* 0x23 */ u8 field_0x23;
/* 0x24 */ u8 field_0x24;
/* 0x25 */ u8 field_0x25;
/* 0x26 */ u8 field_0x26;
/* 0x27 */ u8 field_0x27;
/* 0x28 */ u8 field_0x28;
/* 0x29 */ u8 field_0x29;
/* 0x2a */ u8 field_0x2a;
/* 0x2b */ u8 field_0x2b;
/* 0x2c */ u8 field_0x2c;
/* 0x2d */ u8 field_0x2d;
/* 0x2e */ u16 field_0x2e;
/* 0x30 */ u16 field_0x30;
/* 0x32 */ u16 field_0x32;
/* 0x34 */ u16 field_0x34;
/* 0x36 */ u8 field_0x36;
/* 0x37 */ u8 field_0x37;
/* 0x38 */ u8 field_0x38;
/* 0x39 */ u8 field_0x39;
/* 0x3a */ u8 field_0x3a;
/* 0x3b */ u8 field_0x3b;
/* 0x3c */ u8 field_0x3c;
/* 0x3d */ u8 field_0x3d;
/* 0x3e */ u8 field_0x3e;
/* 0x3f */ u8 field_0x3f;
/* 0x40 */ u8 field_0x40;
/* 0x41 */ u8 field_0x41;
/* 0x42 */ u8 field_0x42;
/* 0x43 */ u8 field_0x43;
/* 0x44 */ u8 field_0x44;
/* 0x45 */ u8 field_0x45;
/* 0x46 */ u8 field_0x46;
/* 0x47 */ u8 field_0x47;
} ClassData; // size:0x48
extern ClassData CLASS_DATA[];
extern musConfig __MUS_CONFIG_8010A710;
#endif

View File

@ -11,6 +11,10 @@ typedef u8 ItemType;
#define ITEM_TYPE_GREATSWORD 2
#define ITEM_TYPE_THRUSTING_SWORD 3
typedef u16 ItemId;
#define ITEM_ID_GALLANT_DOLL 132
typedef struct {
/* 0x00 */ char* name;
/* 0x04 */ ItemType type;
@ -43,31 +47,34 @@ typedef struct {
} ItemData; // size:0x20
extern ItemData ITEM_DATA[];
extern s8 (*FP_ITEM_GET_RESISTANCE[])(u16 index);
extern s8 (*FP_ITEM_GET_RESISTANCE[])(ItemId index);
extern char* item_get_name(u16 index);
extern ItemType item_get_type(u16 index);
extern Element item_get_element(u16 index);
extern u8 item_get_field_0x2(u16 index);
extern u16 item_get_field_0x4(u16 index);
extern s8 item_get_field_0xc(u16 index);
extern s8 item_get_strength(u16 index);
extern s8 item_get_vitality(u16 index);
extern s8 item_get_intelligence(u16 index);
extern s8 item_get_mentality(u16 index);
extern s8 item_get_agility(u16 index);
extern s8 item_get_dexterity(u16 index);
extern s8 item_get_resistance_strike(u16 index);
extern s8 item_get_resistance_wind(u16 index);
extern s8 item_get_resistance_fire(u16 index);
extern s8 item_get_resistance_earth(u16 index);
extern s8 item_get_resistance_water(u16 index);
extern s8 item_get_resistance_holy(u16 index);
extern s8 item_get_resistance_dark(u16 index);
extern char* item_get_name(ItemId index);
extern ItemType item_get_type(ItemId index);
extern Element item_get_element(ItemId index);
extern u32 item_get_field_0x14_b68(u16 index);
extern u32 item_get_field_0x14_b46(u16 index);
extern u32 item_get_field_0x14_b24(u16 index);
extern u32 item_get_field_0x14_b12(u16 index);
extern u8 item_get_field_0x2(ItemId index);
extern u16 item_get_field_0x4(ItemId index);
extern s8 item_get_field_0xc(ItemId index);
extern s8 item_get_strength(ItemId index);
extern s8 item_get_vitality(ItemId index);
extern s8 item_get_intelligence(ItemId index);
extern s8 item_get_mentality(ItemId index);
extern s8 item_get_agility(ItemId index);
extern s8 item_get_dexterity(ItemId index);
extern s8 item_get_resistance_strike(ItemId index);
extern s8 item_get_resistance_wind(ItemId index);
extern s8 item_get_resistance_fire(ItemId index);
extern s8 item_get_resistance_earth(ItemId index);
extern s8 item_get_resistance_water(ItemId index);
extern s8 item_get_resistance_holy(ItemId index);
extern s8 item_get_resistance_dark(ItemId index);
extern u32 item_get_field_0x14_b68(ItemId index);
extern u32 item_get_field_0x14_b46(ItemId index);
extern u32 item_get_field_0x14_b24(ItemId index);
extern u32 item_get_field_0x14_b12(ItemId index);
#endif

134
include/libmus.h Normal file
View File

@ -0,0 +1,134 @@
#ifndef _LIBMUS_H_
#define _LIBMUS_H_
#include <ultra64.h>
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
typedef struct {
unsigned long control_flag;
int channels;
void *sched;
int thread_priority;
unsigned char *heap;
int heap_length;
unsigned char *ptr;
unsigned char *wbk;
void *default_fxbank;
int fifo_length;
int syn_updates;
int syn_output_rate;
int syn_rsp_cmds;
int syn_retraceCount;
int syn_num_dma_bufs;
int syn_dma_buf_size;
OSPiHandle *diskrom_handle;
} musConfig;
typedef enum {
MUSBOOL_OFF,
MUSBOOL_ON
} musBool;
typedef struct {
u64 *data;
int data_size;
u64 *ucode;
u64 *ucode_data;
} musTask;
typedef unsigned long musHandle;
typedef void (*LIBMUScb_marker)(musHandle, int);
typedef void (*LIBMUScb_install)(void);
typedef void (*LIBMUScb_waitframe)(void);
typedef void (*LIBMUScb_dotask)(musTask *);
typedef struct {
LIBMUScb_install install;
LIBMUScb_waitframe waitframe;
LIBMUScb_dotask dotask;
} musSched;
#define MUSCONTROL_RAM (1 << 0)
#define MUSFLAG_EFFECTS 1
#define MUSFLAG_SONGS 2
extern int MusInitialize(musConfig *config);
extern int MusSetFxType(int fxtype);
extern int MusSetSongFxChange(musBool onoff);
extern void MusSetMasterVolume(unsigned long flags, int volume);
extern musHandle MusStartSong(void *addr);
extern musHandle MusStartSongFromMarker(void *addr, int marker);
extern musHandle MusStartEffect(int number);
extern musHandle MusStartEffect2(int number, int volume, int pan,
int restartflag, int priority);
extern void MusStop(unsigned long flags, int speed);
extern int MusAsk(unsigned long flags);
extern int MusHandleAsk(musHandle handle);
extern int MusHandleStop(musHandle handle, int speed);
extern int MusHandleSetVolume(musHandle handle, int volume);
extern int MusHandleSetPan(musHandle handle, int pan);
extern int MusHandleSetFreqOffset(musHandle handle, float offset);
extern int MusHandleSetTempo(musHandle handle, int tempo);
extern int MusHandleSetReverb(musHandle handle, int reverb);
extern int MusHandlePause(musHandle handle);
extern int MusHandleUnPause(musHandle handle);
extern void* MusHandleGetPtrBank(musHandle handle);
extern void MusPtrBankInitialize(void *pbank, void *wbank);
extern void* MusPtrBankSetSingle(void *ipbank);
extern void MusPtrBankSetCurrent(void *ipbank);
extern void* MusPtrBankGetCurrent(void);
extern void MusFxBankInitialize(void *fxbank);
extern void MusFxBankSetSingle(void *ifxbank);
extern void MusFxBankSetCurrent(void *ifxbank);
extern void *MusFxBankGetCurrent(void);
extern int MusFxBankNumberOfEffects(void *ifxbank);
extern void MusFxBankSetPtrBank(void *ifxbank, void *ipbank);
extern void *MusFxBankGetPtrBank(void *ifxbank);
extern void MusFxBankSetSingle(void *ifxbank);
extern void MusSetScheduler(musSched *sched_list);
extern void MusSetMarkerCallback(void *callback);
extern int MusHandleWaveCount(musHandle handle);
extern unsigned short *MusHandleWaveAddress(musHandle handle);
#define MusBankInitialize(pbank, wbank) MusPtrBankInitialize(pbank, wbank)
#define MusBankStartSong(ipbank, addr) \
MusStartSong((addr) == (void *)MusPtrBankSetSingle(ipbank) ? (addr) : (addr))
#define MusBankStartEffect(ipbank, number) \
MusStartEffect((number) == (int)MusPtrBankSetSingle(ipbank) ? (number) \
: (number))
#define MusBankStartEffect2(ipbank, number, volume, pan, restartflag, \
priority) \
MusStartEffect2((number) == (int)MusPtrBankSetSingle(ipbank) ? (number) \
: (number), \
volume, pan, restartflag, priority)
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _LIBMUS_H_ */

View File

@ -77,7 +77,9 @@ segments:
- [0x11170, asm]
- [0x11440, asm]
- [0x11480, asm]
- [0x114F0, c, "mus"]
- [0x114F0, c, "libmus"]
- [0x155C0, asm]
- [0x15A20, asm]
- [0x15BD0, asm]

View File

@ -1,11 +1,9 @@
#include "common.h"
#include "libmus.h"
void __load_song(void*);
extern void Mus__unknown_80081DB4(const void* arg0, const void* arg1);
extern void func_80081F7C(const void* arg);
extern void MusFxBankSetPtrBank(const void*, const void*);
extern void MusFxBankInitialize(const void*);
extern const u8 n64_ptr_tables_v2_00_ROM_START;
extern const u8 n64_ptr_tables_v2_00_ROM_END;
@ -19,9 +17,9 @@ extern const u8 n64_wave_data_ROM_END;
extern const u8 n64_wave_table_00_ROM_START;
extern const u8 n64_wave_table_01_ROM_START;
extern const u8 D_8010A760;
extern const u8 D_80164770;
extern const u8 D_80104710;
extern u8 D_8010A760;
extern u8 D_80164770;
extern u8 D_80104710;
/* 3F1B0 800E9C20 */
void func_800E9C20(void)
@ -30,8 +28,8 @@ void func_800E9C20(void)
romCopy(&n64_ptr_tables_v2_01_ROM_START, &D_80104710, &n64_ptr_tables_v2_01_ROM_END - &n64_ptr_tables_v2_01_ROM_START);
romCopy(&n64_wave_data_ROM_START, &D_8010A760, &n64_wave_data_ROM_END - &n64_wave_data_ROM_START);
Mus__unknown_80081DB4(&D_80164770, &n64_wave_table_00_ROM_START);
Mus__unknown_80081DB4(&D_80104710, &n64_wave_table_01_ROM_START);
MusPtrBankInitialize(&D_80164770, &n64_wave_table_00_ROM_START);
MusPtrBankInitialize(&D_80104710, &n64_wave_table_01_ROM_START);
MusFxBankInitialize(&D_8010A760);
MusFxBankSetPtrBank(&D_8010A760, &D_80104710);

View File

@ -102,7 +102,10 @@ INCLUDE_ASM(const s32, "item", func_8016E230);
INCLUDE_ASM(const s32, "item", func_8016E338);
INCLUDE_ASM(const s32, "item", func_8016E440);
/* 44340 8016E440 */
char* ability_get_name(u8 index) {
return ABILITY_DATA[index].name;
}
/* 44358 8016E458 */
u8 func_8016E458(u8 index) {
@ -150,27 +153,27 @@ INCLUDE_ASM(const s32, "item", func_8016F540);
INCLUDE_ASM(const s32, "item", func_8016F560);
/* 45480 8016F580 */
u8 func_8016F580(u16 index) {
u8 func_8016F580(ItemId index) {
return ITEM_DATA[index].field_0x1b;
}
/* 45498 8016F598 */
u8 func_8016F598(u16 index) {
u8 func_8016F598(ItemId index) {
return ITEM_DATA[index].field_0x1c;
}
/* 454B0 8016F5B0 */
char* item_get_name(u16 index) {
char* item_get_name(ItemId index) {
return ITEM_DATA[index].name;
}
/* 454C8 8016F5C8 */
ItemType item_get_type(u16 index) {
ItemType item_get_type(ItemId index) {
return ITEM_DATA[index].type;
}
/* 454E0 8016F5E0 */
Element item_get_element(u16 index) {
Element item_get_element(ItemId index) {
Element element;
element = ITEM_DATA[index].element;
@ -181,24 +184,24 @@ Element item_get_element(u16 index) {
}
/* 45514 8016F614 */
u8 item_get_field_0x2(u16 index) {
u8 item_get_field_0x2(ItemId index) {
return ITEM_DATA[index].field_0x6;
}
/* 4552C 8016F62C */
u16 item_get_field_0x4(u16 index) {
u16 item_get_field_0x4(ItemId index) {
return ITEM_DATA[index].field_0x8;
}
/* 45544 8016F644 */
s8 item_get_field_0xc(u16 index) {
s8 item_get_field_0xc(ItemId index) {
return ITEM_DATA[index].field_0x10;
}
/* 4555C 8016F65C */
s8 item_get_strength(u16 index) {
s8 item_get_strength(ItemId index) {
s8 ret;
if (index == 132) {
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].strength / 20;
} else {
ret = ITEM_DATA[index].strength;
@ -207,9 +210,9 @@ s8 item_get_strength(u16 index) {
}
/* 455AC 8016F6AC */
s8 item_get_vitality(u16 index) {
s8 item_get_vitality(ItemId index) {
s8 ret;
if (index == 132) {
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].vitality / 20;
} else {
ret = ITEM_DATA[index].vitality;
@ -218,9 +221,9 @@ s8 item_get_vitality(u16 index) {
}
/* 455FC 8016F6FC */
s8 item_get_intelligence(u16 index) {
s8 item_get_intelligence(ItemId index) {
s8 ret;
if (index == 132) {
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].intelligence / 20;
} else {
ret = ITEM_DATA[index].intelligence;
@ -229,9 +232,9 @@ s8 item_get_intelligence(u16 index) {
}
/* 4564C 8016F74C */
s8 item_get_mentality(u16 index) {
s8 item_get_mentality(ItemId index) {
s8 ret;
if (index == 132) {
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].mentality / 20;
} else {
ret = ITEM_DATA[index].mentality;
@ -240,9 +243,9 @@ s8 item_get_mentality(u16 index) {
}
/* 4569C 8016F79C */
s8 item_get_agility(u16 index) {
s8 item_get_agility(ItemId index) {
s8 ret;
if (index == 132) {
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].agility / 20;
} else {
ret = ITEM_DATA[index].agility;
@ -251,9 +254,9 @@ s8 item_get_agility(u16 index) {
}
/* 456EC 8016F7EC */
s8 item_get_dexterity(u16 index) {
s8 item_get_dexterity(ItemId index) {
s8 ret;
if (index == 132) {
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].dexterity / 20;
} else {
ret = ITEM_DATA[index].dexterity;
@ -262,57 +265,57 @@ s8 item_get_dexterity(u16 index) {
}
/* 4573C 8016F83C */
s8 item_get_resistance_strike(u16 index) {
s8 item_get_resistance_strike(ItemId index) {
return ITEM_DATA[index].res_strike;
}
/* 45754 8016F854 */
s8 item_get_resistance_wind(u16 index) {
s8 item_get_resistance_wind(ItemId index) {
return ITEM_DATA[index].res_wind;
}
/* 4576C 8016F86C */
s8 item_get_resistance_fire(u16 index) {
s8 item_get_resistance_fire(ItemId index) {
return ITEM_DATA[index].res_fire;
}
/* 45784 8016F884 */
s8 item_get_resistance_earth(u16 index) {
s8 item_get_resistance_earth(ItemId index) {
return ITEM_DATA[index].res_earth;
}
/* 4579C 8016F89C */
s8 item_get_resistance_water(u16 index) {
s8 item_get_resistance_water(ItemId index) {
return ITEM_DATA[index].res_water;
}
/* 457B4 8016F8B4 */
s8 item_get_resistance_holy(u16 index) {
s8 item_get_resistance_holy(ItemId index) {
return ITEM_DATA[index].res_holy;
}
/* 457CC 8016F8CC */
s8 item_get_resistance_dark(u16 index) {
s8 item_get_resistance_dark(ItemId index) {
return ITEM_DATA[index].res_dark;
}
/* 457E4 8016F8E4 */
u32 item_get_field_0x14_b68(u16 index) {
u32 item_get_field_0x14_b68(ItemId index) {
return ITEM_DATA[index].field_0x18 >> 6;
}
/* 45800 8016F900 */
u32 item_get_field_0x14_b46(u16 index) {
u32 item_get_field_0x14_b46(ItemId index) {
return (ITEM_DATA[index].field_0x18 >> 4) & 3;
}
/* 45820 8016F920 */
u32 item_get_field_0x14_b24(u16 index) {
u32 item_get_field_0x14_b24(ItemId index) {
return (ITEM_DATA[index].field_0x18 >> 2) & 3;
}
/* 45840 8016F940 */
u32 item_get_field_0x14_b12(u16 index) {
u32 item_get_field_0x14_b12(ItemId index) {
return ITEM_DATA[index].field_0x18 & 3;
}

248
src/libmus.c Normal file
View File

@ -0,0 +1,248 @@
#include "common.h"
INCLUDE_ASM(const s32, "libmus", func_800810F0);
INCLUDE_ASM(const s32, "libmus", MusInitialize);
INCLUDE_ASM(const s32, "libmus", MusSetMasterVolume);
INCLUDE_ASM(const s32, "libmus", MusStartSong);
INCLUDE_ASM(const s32, "libmus", func_80081520);
INCLUDE_ASM(const s32, "libmus", func_80081770);
INCLUDE_ASM(const s32, "libmus", func_800817F0);
INCLUDE_ASM(const s32, "libmus", func_80081908);
INCLUDE_ASM(const s32, "libmus", __dma_load_loop_check);
INCLUDE_ASM(const s32, "libmus", func_80081A54);
INCLUDE_ASM(const s32, "libmus", func_80081B08);
INCLUDE_ASM(const s32, "libmus", func_80081B60);
INCLUDE_ASM(const s32, "libmus", func_80081BC0);
INCLUDE_ASM(const s32, "libmus", func_80081C30);
INCLUDE_ASM(const s32, "libmus", func_80081CA0);
INCLUDE_ASM(const s32, "libmus", func_80081D2C);
// INCLUDE_ASM(const s32, "libmus", MusPtrBankInitialize);
void MusPtrBankInitialize(void *pbank, void *wbank) {
func_8008350C();
if (musCurrentPtrBank == 0) {
musCurrentPtrBank = pbank;
}
}
void* func_80081DF0(void* arg0) {
if ((arg0 != NULL) && ((*(s32*)(arg0 + 0x10)) < 0)) {
D_800B1828 = arg0;
}
return D_800B1828;
}
void MusPtrBankSetCurrent(void* arg0) {
if ((arg0 != NULL) && ((*(s32*)(arg0 + 0x10)) < 0)) {
musCurrentPtrBank = arg0;
}
}
INCLUDE_ASM(const s32, "libmus", func_80081E3C);
INCLUDE_ASM(const s32, "libmus", func_80081E48);
INCLUDE_ASM(const s32, "libmus", MusHandlePause);
INCLUDE_ASM(const s32, "libmus", MusHandleUnpause);
INCLUDE_ASM(const s32, "libmus", MusSetFxType);
INCLUDE_ASM(const s32, "libmus", func_80081F20);
INCLUDE_ASM(const s32, "libmus", MusFxBankInitialize);
INCLUDE_ASM(const s32, "libmus", MusFxBankNumberOfEffects);
INCLUDE_ASM(const s32, "libmus", func_80082008);
INCLUDE_ASM(const s32, "libmus", func_80082014);
INCLUDE_ASM(const s32, "libmus", func_80082020);
INCLUDE_ASM(const s32, "libmus", MusFxBankSetPtrBank);
INCLUDE_ASM(const s32, "libmus", MusFxBankGetPtrBank);
INCLUDE_ASM(const s32, "libmus", func_8008203C);
INCLUDE_ASM(const s32, "libmus", func_80082048);
INCLUDE_ASM(const s32, "libmus", func_800820AC);
INCLUDE_ASM(const s32, "libmus", func_80082124);
INCLUDE_ASM(const s32, "libmus", func_80082130);
INCLUDE_ASM(const s32, "libmus", func_80082194);
INCLUDE_ASM(const s32, "libmus", func_80082214);
INCLUDE_ASM(const s32, "libmus", func_800822AC);
INCLUDE_ASM(const s32, "libmus", func_8008259C);
INCLUDE_ASM(const s32, "libmus", func_80082AE8);
INCLUDE_ASM(const s32, "libmus", func_80082B64);
INCLUDE_ASM(const s32, "libmus", func_80082CB8);
INCLUDE_ASM(const s32, "libmus", func_80082DC4);
INCLUDE_ASM(const s32, "libmus", func_80082E34);
INCLUDE_ASM(const s32, "libmus", __MusIntInitSweep);
INCLUDE_ASM(const s32, "libmus", func_8008302C);
INCLUDE_ASM(const s32, "libmus", func_800830E4);
INCLUDE_ASM(const s32, "libmus", func_8008313C);
INCLUDE_ASM(const s32, "libmus", func_800831A0);
INCLUDE_ASM(const s32, "libmus", func_80083264);
INCLUDE_ASM(const s32, "libmus", func_80083378);
INCLUDE_ASM(const s32, "libmus", func_8008350C);
INCLUDE_ASM(const s32, "libmus", func_800836A4);
INCLUDE_ASM(const s32, "libmus", func_80083738);
INCLUDE_ASM(const s32, "libmus", func_80083874);
INCLUDE_ASM(const s32, "libmus", func_80083A3C);
INCLUDE_ASM(const s32, "libmus", func_80083A74);
INCLUDE_ASM(const s32, "libmus", func_80083B24);
INCLUDE_ASM(const s32, "libmus", func_80083CCC);
INCLUDE_ASM(const s32, "libmus", func_80083F38);
INCLUDE_ASM(const s32, "libmus", func_80083F8C);
INCLUDE_ASM(const s32, "libmus", func_80083FAC);
INCLUDE_ASM(const s32, "libmus", func_80083FDC);
INCLUDE_ASM(const s32, "libmus", func_80083FFC);
INCLUDE_ASM(const s32, "libmus", func_80084008);
INCLUDE_ASM(const s32, "libmus", func_80084130);
INCLUDE_ASM(const s32, "libmus", func_80084214);
INCLUDE_ASM(const s32, "libmus", func_80084228);
INCLUDE_ASM(const s32, "libmus", func_8008424C);
INCLUDE_ASM(const s32, "libmus", func_800842BC);
INCLUDE_ASM(const s32, "libmus", func_80084330);
INCLUDE_ASM(const s32, "libmus", func_80084340);
INCLUDE_ASM(const s32, "libmus", func_80084370);
INCLUDE_ASM(const s32, "libmus", func_80084380);
INCLUDE_ASM(const s32, "libmus", func_80084390);
INCLUDE_ASM(const s32, "libmus", func_800843A0);
INCLUDE_ASM(const s32, "libmus", func_800843F8);
INCLUDE_ASM(const s32, "libmus", func_80084408);
INCLUDE_ASM(const s32, "libmus", func_80084414);
INCLUDE_ASM(const s32, "libmus", func_80084424);
INCLUDE_ASM(const s32, "libmus", func_80084430);
INCLUDE_ASM(const s32, "libmus", func_8008449C);
INCLUDE_ASM(const s32, "libmus", func_80084538);
INCLUDE_ASM(const s32, "libmus", func_80084560);
INCLUDE_ASM(const s32, "libmus", func_8008456C);
INCLUDE_ASM(const s32, "libmus", func_8008457C);
INCLUDE_ASM(const s32, "libmus", func_80084588);
INCLUDE_ASM(const s32, "libmus", func_8008459C);
INCLUDE_ASM(const s32, "libmus", func_800845B0);
INCLUDE_ASM(const s32, "libmus", func_800845B8);
INCLUDE_ASM(const s32, "libmus", func_80084600);
INCLUDE_ASM(const s32, "libmus", func_8008460C);
INCLUDE_ASM(const s32, "libmus", func_80084614);
INCLUDE_ASM(const s32, "libmus", func_80084684);
INCLUDE_ASM(const s32, "libmus", func_80084694);
INCLUDE_ASM(const s32, "libmus", func_800846E4);
INCLUDE_ASM(const s32, "libmus", func_80084734);
INCLUDE_ASM(const s32, "libmus", func_80084784);
INCLUDE_ASM(const s32, "libmus", func_80084794);
INCLUDE_ASM(const s32, "libmus", func_80084864);
INCLUDE_ASM(const s32, "libmus", func_800848A0);
INCLUDE_ASM(const s32, "libmus", func_800848B0);
INCLUDE_ASM(const s32, "libmus", func_800848F4);
INCLUDE_ASM(const s32, "libmus", func_80084964);
INCLUDE_ASM(const s32, "libmus", func_80084970);
INCLUDE_ASM(const s32, "libmus", func_800849D8);
INCLUDE_ASM(const s32, "libmus", func_80084C48);
INCLUDE_ASM(const s32, "libmus", func_80084C98);
INCLUDE_ASM(const s32, "libmus", func_80084DE0);
INCLUDE_ASM(const s32, "libmus", func_800850C0);
INCLUDE_ASM(const s32, "libmus", func_800850D8);
INCLUDE_ASM(const s32, "libmus", func_8008511C);
INCLUDE_ASM(const s32, "libmus", func_80085160);

248
src/mus.c
View File

@ -1,248 +0,0 @@
#include "common.h"
INCLUDE_ASM(const s32, "mus", func_800810F0);
INCLUDE_ASM(const s32, "mus", func_8008123C);
INCLUDE_ASM(const s32, "mus", MusSetMasterVolume);
INCLUDE_ASM(const s32, "mus", MusStartSong);
INCLUDE_ASM(const s32, "mus", func_80081520);
INCLUDE_ASM(const s32, "mus", func_80081770);
INCLUDE_ASM(const s32, "mus", func_800817F0);
INCLUDE_ASM(const s32, "mus", func_80081908);
INCLUDE_ASM(const s32, "mus", __dma_load_loop_check);
INCLUDE_ASM(const s32, "mus", func_80081A54);
INCLUDE_ASM(const s32, "mus", func_80081B08);
INCLUDE_ASM(const s32, "mus", func_80081B60);
INCLUDE_ASM(const s32, "mus", func_80081BC0);
INCLUDE_ASM(const s32, "mus", func_80081C30);
INCLUDE_ASM(const s32, "mus", func_80081CA0);
INCLUDE_ASM(const s32, "mus", func_80081D2C);
// INCLUDE_ASM(const s32, "mus", __something_music);
void Mus__unknown_80081DB4(void* arg0) {
func_8008350C();
if (musCurrentPtrBank == 0) {
musCurrentPtrBank = arg0;
}
}
void* func_80081DF0(void* arg0) {
if ((arg0 != NULL) && ((*(s32*)(arg0 + 0x10)) < 0)) {
D_800B1828 = arg0;
}
return D_800B1828;
}
void MusPtrBankSetCurrent(void* arg0) {
if ((arg0 != NULL) && ((*(s32*)(arg0 + 0x10)) < 0)) {
musCurrentPtrBank = arg0;
}
}
INCLUDE_ASM(const s32, "mus", func_80081E3C);
INCLUDE_ASM(const s32, "mus", func_80081E48);
INCLUDE_ASM(const s32, "mus", MusHandlePause);
INCLUDE_ASM(const s32, "mus", MusHandleUnpause);
INCLUDE_ASM(const s32, "mus", MusSetFxType);
INCLUDE_ASM(const s32, "mus", func_80081F20);
INCLUDE_ASM(const s32, "mus", MusFxBankInitialize);
INCLUDE_ASM(const s32, "mus", MusFxBankNumberOfEffects);
INCLUDE_ASM(const s32, "mus", func_80082008);
INCLUDE_ASM(const s32, "mus", func_80082014);
INCLUDE_ASM(const s32, "mus", func_80082020);
INCLUDE_ASM(const s32, "mus", MusFxBankSetPtrBank);
INCLUDE_ASM(const s32, "mus", MusFxBankGetPtrBank);
INCLUDE_ASM(const s32, "mus", func_8008203C);
INCLUDE_ASM(const s32, "mus", func_80082048);
INCLUDE_ASM(const s32, "mus", func_800820AC);
INCLUDE_ASM(const s32, "mus", func_80082124);
INCLUDE_ASM(const s32, "mus", func_80082130);
INCLUDE_ASM(const s32, "mus", func_80082194);
INCLUDE_ASM(const s32, "mus", func_80082214);
INCLUDE_ASM(const s32, "mus", func_800822AC);
INCLUDE_ASM(const s32, "mus", func_8008259C);
INCLUDE_ASM(const s32, "mus", func_80082AE8);
INCLUDE_ASM(const s32, "mus", func_80082B64);
INCLUDE_ASM(const s32, "mus", func_80082CB8);
INCLUDE_ASM(const s32, "mus", func_80082DC4);
INCLUDE_ASM(const s32, "mus", func_80082E34);
INCLUDE_ASM(const s32, "mus", __MusIntInitSweep);
INCLUDE_ASM(const s32, "mus", func_8008302C);
INCLUDE_ASM(const s32, "mus", func_800830E4);
INCLUDE_ASM(const s32, "mus", func_8008313C);
INCLUDE_ASM(const s32, "mus", func_800831A0);
INCLUDE_ASM(const s32, "mus", func_80083264);
INCLUDE_ASM(const s32, "mus", func_80083378);
INCLUDE_ASM(const s32, "mus", func_8008350C);
INCLUDE_ASM(const s32, "mus", func_800836A4);
INCLUDE_ASM(const s32, "mus", func_80083738);
INCLUDE_ASM(const s32, "mus", func_80083874);
INCLUDE_ASM(const s32, "mus", func_80083A3C);
INCLUDE_ASM(const s32, "mus", func_80083A74);
INCLUDE_ASM(const s32, "mus", func_80083B24);
INCLUDE_ASM(const s32, "mus", func_80083CCC);
INCLUDE_ASM(const s32, "mus", func_80083F38);
INCLUDE_ASM(const s32, "mus", func_80083F8C);
INCLUDE_ASM(const s32, "mus", func_80083FAC);
INCLUDE_ASM(const s32, "mus", func_80083FDC);
INCLUDE_ASM(const s32, "mus", func_80083FFC);
INCLUDE_ASM(const s32, "mus", func_80084008);
INCLUDE_ASM(const s32, "mus", func_80084130);
INCLUDE_ASM(const s32, "mus", func_80084214);
INCLUDE_ASM(const s32, "mus", func_80084228);
INCLUDE_ASM(const s32, "mus", func_8008424C);
INCLUDE_ASM(const s32, "mus", func_800842BC);
INCLUDE_ASM(const s32, "mus", func_80084330);
INCLUDE_ASM(const s32, "mus", func_80084340);
INCLUDE_ASM(const s32, "mus", func_80084370);
INCLUDE_ASM(const s32, "mus", func_80084380);
INCLUDE_ASM(const s32, "mus", func_80084390);
INCLUDE_ASM(const s32, "mus", func_800843A0);
INCLUDE_ASM(const s32, "mus", func_800843F8);
INCLUDE_ASM(const s32, "mus", func_80084408);
INCLUDE_ASM(const s32, "mus", func_80084414);
INCLUDE_ASM(const s32, "mus", func_80084424);
INCLUDE_ASM(const s32, "mus", func_80084430);
INCLUDE_ASM(const s32, "mus", func_8008449C);
INCLUDE_ASM(const s32, "mus", func_80084538);
INCLUDE_ASM(const s32, "mus", func_80084560);
INCLUDE_ASM(const s32, "mus", func_8008456C);
INCLUDE_ASM(const s32, "mus", func_8008457C);
INCLUDE_ASM(const s32, "mus", func_80084588);
INCLUDE_ASM(const s32, "mus", func_8008459C);
INCLUDE_ASM(const s32, "mus", func_800845B0);
INCLUDE_ASM(const s32, "mus", func_800845B8);
INCLUDE_ASM(const s32, "mus", func_80084600);
INCLUDE_ASM(const s32, "mus", func_8008460C);
INCLUDE_ASM(const s32, "mus", func_80084614);
INCLUDE_ASM(const s32, "mus", func_80084684);
INCLUDE_ASM(const s32, "mus", func_80084694);
INCLUDE_ASM(const s32, "mus", func_800846E4);
INCLUDE_ASM(const s32, "mus", func_80084734);
INCLUDE_ASM(const s32, "mus", func_80084784);
INCLUDE_ASM(const s32, "mus", func_80084794);
INCLUDE_ASM(const s32, "mus", func_80084864);
INCLUDE_ASM(const s32, "mus", func_800848A0);
INCLUDE_ASM(const s32, "mus", func_800848B0);
INCLUDE_ASM(const s32, "mus", func_800848F4);
INCLUDE_ASM(const s32, "mus", func_80084964);
INCLUDE_ASM(const s32, "mus", func_80084970);
INCLUDE_ASM(const s32, "mus", func_800849D8);
INCLUDE_ASM(const s32, "mus", func_80084C48);
INCLUDE_ASM(const s32, "mus", func_80084C98);
INCLUDE_ASM(const s32, "mus", func_80084DE0);
INCLUDE_ASM(const s32, "mus", func_800850C0);
INCLUDE_ASM(const s32, "mus", func_800850D8);
INCLUDE_ASM(const s32, "mus", func_8008511C);
INCLUDE_ASM(const s32, "mus", func_80085160);

View File

@ -1,3 +1,5 @@
STR_SERIFU_POSITION_X_ERROR = 0x8019E20C; // rom:0xEAF8C type:asciz
STR_IS_THE_NAME_ACCEPTABLE = 0x8018FDC4; // rom:0x65CC4 type:asciz
STR_MOVING_ON_TO_THE_NEXT_STAGE = 0x8018FDE4; // rom:0x65CE4 type:asciz
STR_NAME_INPUT = 0x80193A78; // type:asciz
@ -14,9 +16,26 @@ STR_MEN_UP = 0x8021E000; // rom:0x1B2310
STR_CANNOT_BE_USED = 0x8021DF80; // rom:0x1B2290
STR_PETRIFICATION = 0x8021DFA0; // rom:0x1B22B0
STR_PHYSICAL = 0x80187660; // rom:0x5D560 type:asciz
ELEMENT_NAMES = 0x80187BD4; // rom:0x5DAD4 type:u32
STR_ELEMENT_PHYSICAL = 0x80187660; // rom:0x5D560 type:asciz
STR_ELEMENT_WIND = 0x8018766C; // rom:0x5D56C type:asciz
STR_ELEMENT_FLAME = 0x80187674; // rom:0x5D574 type:asciz
STR_ELEMENT_EARTH = 0x8018767C; // rom:0x5D57C type:asciz
STR_ELEMENT_WATER = 0x80187684; // rom:0x5D584 type:asciz
STR_ELEMENT_VIRTUE = 0x8018768C; // rom:0x5D58C type:asciz
STR_ELEMENT_BANE = 0x80187694; // rom:0x5D594 type:asciz
STR_ELEMENT_DRAKONITE = 0x8018769C; // rom:0x5D59C type:asciz
STR_ELEMENT_VARIABLE = 0x801876A8; // rom:0x5D5A8 type:asciz
D_80187BD4 = 0x80187BD4; // rom:0x5DAD4 type:u32
CLASS_DATA = 0x80187C14; // rom:0x5DB14 size:0x48 type:u32
ITEM_TYPE_NAMES = 0x802130A4; // rom:0x164214 type:char*
FORMATION_COMMAND_NAMES = 0x8021315C; // rom:0x1642CC type:char*
ABILITY_DATA = 0x8018AA7C; // rom:0x6097C size:0x10
ability_get_name = 0x8016E440;
ability_get_element = 0x8016E470;
ITEM_DATA = 0x8018C40C; // size:0x20
@ -89,7 +108,7 @@ ITEM_NAME_SWORD_2 = 0x80212E50; // type:asciz rom:0x163FC0
ITEM_NAME_GREAT_SWORD_2 = 0x80212E58; // type:asciz rom:0x163FC8
ITEM_NAME_THRUSTING_SWORD_2 = 0x80212E64; // type:asciz rom:0x163FC8
ITEM_NAME_1HANDED_2 = 0x80212E74; // type:asciz rom:0x163FE4
ITEM_NAME_SHORT_SPEAR_2 = 0x80212EA4; // type:asciz rom:0x164014
ITEM_NAME_SHORT_SPEAR_2 = 0x80212EA4; // type:asciz rom:0x164014 size:0xbc
__PTR_BIG_STRUCT = 0x80196AF8; // type:u32
@ -365,13 +384,9 @@ osViModeNtscLan1 = 0x800AB960;
obInitControllers = 0x80089C60;
MusFxBankInitialize = 0x80081F7C; // rom:0x1237C
osUnmapTLBAll = 0x8009AB00;
osMapTLBRdb = 0x8009AAA0;
Mus__unknown_80081DB4 = 0x80081DB4;
__real_read_controller = 0x8008A42C;
__calls_romCopy_8009DA50 = 0x8009DA50;
__calls_romCopy_8009DAF4 = 0x8009DAF4;
@ -559,6 +574,18 @@ MusPtrBankSetCurrent = 0x80081E18;
__MusIntInitSweep = 0x80083010;
__MusIntMemMalloc = 0x80085ADC;
// Maybe incorrect, found them myself.
MusInitialize = 0x8008123C; // rom:0x1163C
MusFxBankInitialize = 0x80081F7C; // rom:0x1237C
MusPtrBankInitialize = 0x80081DB4;
n64_ptr_tables_v2_00_VRAM = 0x80164770; // rom:0xB9D00
n64_ptr_tables_v2_01_VRAM = 0x80104710; // rom:0x59CA0
n64_wave_data_VRAM = 0xD_8010A760; // rom:0x5FCF0
__MUS_CONFIG_8010A710 = 0x8010A710; // size:0x44
alSynAllocFX = 0x8008FF70;
alFxNew = 0x8008C694;
alFxParam = 0x8008EEA4;

View File

@ -5,22 +5,22 @@ from struct import unpack_from
NAME_VADDR_START = 0x8016AF80
NAME_ADDR_START = 0x40E80
def read_attack(index):
ATTACK_SIZE = 0x10
ATTACK_FORMAT = '>BBBBBBBBBBBBI'
ABILITY_DATA = 0x6097C
attack_start = 0x60980 + (index * ATTACK_SIZE)
attack_end = attack_start + ATTACK_SIZE
def read_ability(index):
ABILITY_SIZE = 0x10
ABILITY_FORMAT = '>IBBBBBBBBBBBB'
return unpack_from(ATTACK_FORMAT, read_rom(attack_start, attack_end))
ability_start = ABILITY_DATA + (index * ABILITY_SIZE)
ability_end = ability_start + ABILITY_SIZE
length = 0x6136B - 0x60980
return unpack_from(ABILITY_FORMAT, read_rom(ability_start, ability_end))
for i in range(0, 130):
for i in range(1, 130):
(field_0x0, element, field_0x2, field_0x3, field_0x4,
(name_vaddr, field_0x0, element, field_0x2, field_0x3, field_0x4,
field_0x5, field_0x6, field_0x7, field_0x8, field_0x9,
field_0xa, field_0xb, name_vaddr) = read_attack(i)
field_0xa, field_0xb) = read_ability(i)
name_addr_diff = (name_vaddr - NAME_VADDR_START) + NAME_ADDR_START
name = read_rom(name_addr_diff, name_addr_diff + 32).split(b'\0', 1)[0]

27
tools/class_data.py Normal file
View File

@ -0,0 +1,27 @@
from ob import read_rom, ELEMENT_NAME
from struct import unpack_from
NAME_VADDR_START = 0x8016AF80
NAME_ADDR_START = 0x40E80
CLASS_DATA = 0x5DB14
def read_class(index):
CLASS_SIZE = 0x48
CLASS_FORMAT = '>IH'
class_start = CLASS_DATA + (index * CLASS_SIZE)
class_end = class_start + CLASS_SIZE
return unpack_from(CLASS_FORMAT, read_rom(class_start, class_end))
for i in range(1, 10):
(name_vaddr, rest) = read_class(i)
name_addr_diff = (name_vaddr - NAME_VADDR_START) + NAME_ADDR_START
name = read_rom(name_addr_diff, name_addr_diff + 32).split(b'\0', 1)[0]
print(f"{name}:\t")
print(rest)

View File

@ -5,7 +5,7 @@ from struct import unpack_from, calcsize
NAME_VADDR_START = 0x8016AF80
NAME_ADDR_START = 0x40E80
ITEM_FORMAT = '>IBBBBHbbbbbbbbbbbbbbbbbbbbbb'
ITEM_FORMAT = '>IBBBBHbbbbbbbbbbbbbBBBBBBBBB'
def read_item(index):
ITEM_SIZE = 0x20
@ -24,6 +24,7 @@ ITEM_TYPE_NAME = {
3: "Thrusting Sword",
4: "1-Handed Hammer",
5: "2-Handed Hammer",
6: "Short Spear",
7: "Spear",
8: "Whip",
9: "Claw",
@ -63,7 +64,7 @@ for i in range(0, 279):
type_str = ITEM_TYPE_NAME[item_type] if item_type in ITEM_TYPE_NAME else f"Unknown({item_type})"
print(f"Name: {name}")
print(f"Name: {name} ({i})")
print(f"Type: {type_str}")
print(f"Element: {get_element_name(element)}")
print(f"STR: \t{strength} \tMEN: \t{mem}")