Cleanup seqdrv

This commit is contained in:
Seeky 2021-06-25 21:32:25 +01:00
parent c38f53a1f2
commit 09521d38bf
7 changed files with 29 additions and 79 deletions

View File

@ -20,9 +20,6 @@ The project currently uses Codewarrior Version 4.1 build 60831, it's not known i
- To match string pools in incomplete files (since they affect asm), functions with strings that haven't been decompiled have temporary replacements that call a fake __dummy_string function to place these strings in the pool
- To match float pools in incomplete rel files, __dummy_float is used
## TTYD Support
TTYD was initially matched too for some of seqdrv, but this was abandoned based on the effort it would've taken to keep doing and also to find the right compiler version & flags for it too. The code that was matched still remains.
## Credits
- Various members of the TTYD community for their [documentation](https://github.com/PistonMiner/ttyd-tools) and for porting the demo symbol map to the final game
- The [PM64 decomp](https://github.com/ethteck/papermario) team for decompiling many of the same functions, which are useful to check against

View File

@ -1,4 +1,4 @@
set dolflags=-O4 -proc gekko -lang C99 -S -d GAME_SPM -w all -use_lmw_stmw on -fp hard -str pool -rostr -I- -i include -enc SJIS -inline all -sdata2 4
set dolflags=-O4 -proc gekko -lang C99 -S -w all -use_lmw_stmw on -fp hard -str pool -rostr -I- -i include -enc SJIS -inline all -sdata2 4
mwcceppc %dolflags% src/evtmgr.c
mwcceppc %dolflags% src/evtmgr_cmd.c
@ -16,6 +16,6 @@ mwcceppc %dolflags% src/system.c
mwcceppc %dolflags% src/windowdrv.c
mwcceppc %dolflags% src/wpadmgr.c
set relflags=-O4 -proc gekko -lang C99 -S -d GAME_SPM -w all -use_lmw_stmw on -fp hard -str pool -rostr -I- -i include -enc SJIS -inline all -sdata 0 -sdata2 0 -pool off -ordered-fp-compares
set relflags=-O4 -proc gekko -lang C99 -S -w all -use_lmw_stmw on -fp hard -str pool -rostr -I- -i include -enc SJIS -inline all -sdata 0 -sdata2 0 -pool off -ordered-fp-compares
mwcceppc %relflags% rel/dan.c

View File

@ -6,16 +6,13 @@
#include <common.h>
#define SEQ_COUNT 6
struct _SeqWork;
typedef void (SeqFunc)(struct _SeqWork *);
#ifdef GAME_SPM
#define SEQ_COUNT 6
#else
#define SEQ_COUNT 8
#endif
typedef struct {
typedef struct
{
SeqFunc * init;
SeqFunc * main;
SeqFunc * exit;

View File

@ -8,22 +8,6 @@
#include <common.h>
#include <seqdef.h>
/*
Functions:
==========
seqInit_SPMARIO yes (aka seqInit_MARIOSTORY)
seqMain yes (only matching spm 1:1, logic matching for ttyd)
seqSetSeq yes
seqGetSeq yes
seqGetPrevSeq yes (ttyd exclusive)
seqGetNextSeq yes (ttyd exclusive)
seqCheckSeq yes (ttyd exclusive)
Other:
======
Data matching except SeqWork missing fields (but those are not referenced in seqdrv.c code)
*/
enum SeqdrvSeq
{
SEQ_LOGO = 0,
@ -34,29 +18,19 @@ enum SeqdrvSeq
SEQ_LOAD
};
typedef struct _SeqWork {
typedef struct _SeqWork
{
s32 seq;
s32 stage;
char * p0;
char * p1;
u8 unknown_0x10[0x20 - 0x10];
#ifdef GAME_SPM
SeqFunc * afterFunc;
#endif
} SeqWork;
#ifdef GAME_SPM
void seqInit_SPMARIO(); // 8017bf2c
#else
void seqInit_MARIOSTORY();
#endif
void seqMain(); // 8017bf6c
void seqSetSeq(s32 seq, char * p0, char * p1); // 8017c074
s32 seqGetSeq(); // 8017c084
#ifndef GAME_SPM
s32 seqGetPrevSeq();
s32 seqGetNextSeq();
bool seqCheckSeq();
#endif
#endif

View File

@ -8,7 +8,6 @@
#include <seqdef.h>
#include <seqdrv.h>
#ifdef GAME_SPM
SeqDef seq_data[SEQ_COUNT] = {
{
.init = &seq_logoInit,
@ -41,4 +40,3 @@ SeqDef seq_data[SEQ_COUNT] = {
.exit = &seq_loadExit
}
};
#endif

View File

@ -10,69 +10,54 @@ static s32 prev_seq = -1; // 805ae0c0
static char * next_p0; // 805ae918 - seqMapName
static char * next_p1; // 805ae91c - seqDoorName
#ifdef GAME_SPM
void seqInit_SPMARIO() {
#else
void seqInit_MARIOSTORY() {
#endif
void seqInit_SPMARIO()
{
memset(&seqWork, 0, sizeof(seqWork));
now_seq = -1;
next_seq = -1;
prev_seq = -1;
}
void seqMain() {
if (next_seq != now_seq) {
if (now_seq != -1) {
void seqMain()
{
if (next_seq != now_seq)
{
if (now_seq != -1)
{
sysWaitDrawSync();
(*seq_data[now_seq].exit)(&seqWork);
}
prev_seq = now_seq;
memset(&seqWork, 0, sizeof(seqWork));
now_seq = next_seq;
seqWork.seq = next_seq;
seqWork.stage = 0;
seqWork.p0 = next_p0;
seqWork.p1 = next_p1;
#if GAME_SPM
seqWork.afterFunc = NULL;
#endif
(*seq_data[now_seq].init)(&seqWork);
}
(*seq_data[now_seq].main)(&seqWork);
#if GAME_SPM
if (seqWork.afterFunc != NULL) {
if (seqWork.afterFunc != NULL)
(*seqWork.afterFunc)(&seqWork);
}
#endif
}
void seqSetSeq(s32 seq, char * p0, char * p1) {
void seqSetSeq(s32 seq, char * p0, char * p1)
{
next_seq = seq;
next_p0 = p0;
next_p1 = p1;
}
s32 seqGetSeq() {
#ifdef GAME_SPM
s32 seqGetSeq()
{
return now_seq == -1 ? 0 : now_seq;
#else
return now_seq;
#endif
}
#ifndef GAME_SPM
s32 seqGetPrevSeq() {
return prev_seq;
}
s32 seqGetNextSeq() {
return next_seq;
}
bool seqCheckSeq() {
return next_seq != now_seq;
}
#endif

View File

@ -1 +0,0 @@
mwcceppc -O4 -proc gekko -lang C99 -S -w all -enc SJIS -I- -i include src/*.c