[Decompilation] [th01] FUUIN.EXE: Move the final pieces of data to C land

100%.

Part of P0213, funded by Ember2528 and GhostRiderCog.
This commit is contained in:
nmlgc 2022-08-11 01:44:57 +02:00
parent 96e18b33be
commit 1fd32fad0f
5 changed files with 21 additions and 114 deletions

View File

@ -53,7 +53,7 @@ bin\th01\reiiden.exe: bin\piloadc.obj bin\th01\reiiden.obj th01\main_010.cpp th0
$**
|
bin\th01\fuuin.exe: bin\piloadc.obj bin\th01\fuuin.obj th01\fuuin_01.cpp bin\th01\input_mf.obj th01\fuuin_02.cpp th01\fuuin_03.cpp th01\fuuin_04.cpp bin\th01\vsync.obj bin\th01\ztext.obj bin\th01\initexit.obj bin\th01\graph.obj bin\th01\grppffx.obj th01\fuuin_10.cpp th01\f_imgd_f.cpp bin\th01\vplanset.obj th01\fuuin_11.cpp th01\2x_fuuin.cpp bin\th01\mdrv2.obj bin\th01\fuuinm.obj
bin\th01\fuuin.exe: bin\piloadc.obj th01\fuuinvar.cpp th01\fuuin_01.cpp bin\th01\fuuin.obj bin\th01\input_mf.obj th01\fuuin_02.cpp th01\fuuin_03.cpp th01\fuuin_04.cpp bin\th01\vsync.obj bin\th01\ztext.obj bin\th01\initexit.obj bin\th01\graph.obj bin\th01\grppffx.obj th01\fuuin_10.cpp th01\f_imgd_f.cpp bin\th01\vplanset.obj th01\fuuin_11.cpp th01\2x_fuuin.cpp bin\th01\mdrv2.obj bin\th01\fuuinm.obj
$(CC) $(CFLAGS) $(LARGE_LFLAGS) -3 -Z -DGAME=1 -DBINARY='E' -nbin\th01\ -eFUUIN.EXE @&&|
$**
|

15
th01/end/vars.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "platform.h"
#include "th01/common.h"
#include "th01/resident.hpp"
long score = 100000;
long score_highest = 100000;
long continues_total;
long continues_per_scene[SCENE_COUNT];
// ZUN bloat: 308 unused bytes… for 77 extra scenes, maybe?!
static int8_t unused[308];
char start_lives_extra;
end_sequence_t end_flag;
unsigned char rank;

View File

@ -18,15 +18,10 @@ extern "C" {
#include "th01/snd/mdrv2.h"
}
#undef RES_ID
bool16 end_init(void)
{
int i;
#define RES_ID RES_ID_0
extern const char RES_ID[];
resident_t __seg *sgm = ResData<resident_t>::exist(RES_ID);
#undef RES_ID
if(sgm) {
resident_t* resident = sgm;
if(resident->end_flag) {
@ -48,13 +43,11 @@ bool16 end_init(void)
resident->continues_total = 0;
resident->score_highest = 0;
} else {
extern const char ERROR_END_FLAG[];
puts(ERROR_END_FLAG);
puts("ERROR : end_flag is not ture !!");
return false;
}
} else {
extern const char ERROR_NO_RESDATA[];
puts(ERROR_NO_RESDATA);
puts("ERROR : cfg_id is not alloc!!");
return false;
}
return true;
@ -63,10 +56,7 @@ bool16 end_init(void)
bool16 end_resident_clear(void)
{
int i;
#define RES_ID RES_ID_1
extern const char RES_ID[];
resident_t __seg *sgm = ResData<resident_t>::exist(RES_ID);
#undef RES_ID
if(sgm) {
resident_t* resident = sgm;
resident->score = 0;
@ -83,9 +73,6 @@ bool16 end_resident_clear(void)
void main(int argc, const char *argv[])
{
extern char OP_PATH[];
extern char OP_ARG0[];
if(!mdrv2_resident()) {
return;
}
@ -110,5 +97,5 @@ void main(int argc, const char *argv[])
game_init();
end_and_verdict_and_regist_animate();
game_switch_binary();
execl(OP_PATH, OP_ARG0, nullptr, nullptr);
execl("op", "op", nullptr, nullptr);
}

1
th01/fuuinvar.cpp Normal file
View File

@ -0,0 +1 @@
#include "th01/end/vars.cpp"

View File

@ -14,7 +14,7 @@
; Application type: Executable 16bit
.386
.model use16 large _TEXT
.model use16 large
include ReC98.inc
include th01/th01.inc
@ -48,93 +48,8 @@ include libs/master.lib/gdc_outpw.asm
include libs/master.lib/random.asm
_TEXT ends
; ===========================================================================
; Segment type: Pure code
fuuin_01_TEXT segment byte public 'CODE' use16
fuuin_01_TEXT ends
; ===========================================================================
fuuin_02_TEXT segment byte public 'CODE' use16
fuuin_02_TEXT ends
; ===========================================================================
; Segment type: Pure code
fuuin_03_TEXT segment byte public 'CODE' use16
fuuin_03_TEXT ends
; ===========================================================================
; Segment type: Pure code
fuuin_04_TEXT segment byte public 'CODE' use16
fuuin_04_TEXT ends
; ===========================================================================
; Segment type: Pure code
vsync_TEXT segment byte public 'CODE' use16
vsync_TEXT ends
; ===========================================================================
ztext_TEXT segment byte public 'CODE' use16
ztext_TEXT ends
; ===========================================================================
; Segment type: Pure code
initexit_TEXT segment byte public 'CODE' use16
initexit_TEXT ends
; ===========================================================================
; Segment type: Pure code
graph_TEXT segment byte public 'CODE' use16
graph_TEXT ends
; ===========================================================================
grppffx_TEXT segment byte public 'CODE' use16
grppffx_TEXT ends
; ===========================================================================
PTN_GRP_GRZ segment byte public 'CODE' use16
PTN_GRP_GRZ ends
; ===========================================================================
SHARED segment byte public 'CODE' use16
SHARED ends
; ===========================================================================
; Segment type: Pure code
GRAPH_EX_TEXT segment byte public 'CODE' use16
GRAPH_EX_TEXT ends
; ===========================================================================
; Segment type: Pure code
mdrv2_TEXT segment byte public 'CODE' use16
mdrv2_TEXT ends
.data
public _score, _score_highest
public _RES_ID_0, _RES_ID_1, _ERROR_END_FLAG, _ERROR_NO_RESDATA
public _OP_PATH, _OP_ARG0
_score dd 100000
_score_highest dd 100000
_RES_ID_0 db 'ReiidenConfig',0
_ERROR_END_FLAG db 'ERROR : end_flag is not ture !!',0
_ERROR_NO_RESDATA db 'ERROR : cfg_id is not alloc!!',0
_RES_ID_1 db 'ReiidenConfig',0
_OP_PATH db 'op',0
_OP_ARG0 db 'op',0
; libs/master.lib/grp[data].asm
extern graph_VramSeg:word
extern graph_VramWords:word
@ -171,17 +86,6 @@ IDLEN EQU 10
; libs/master.lib/rand[data].asm
extern random_seed:dword
.data?
public _continues_total, _continues_per_scene
_continues_total dd ?
_continues_per_scene dd SCENE_COUNT dup(?)
db 308 dup(?)
public _start_lives_extra, _end_flag, _rank
_start_lives_extra db ?
_end_flag db ? ; ZUN symbol [Strings]
_rank db ?
; libs/master.lib/pal[bss].asm
extern Palettes:rgb_t:COLOR_COUNT