[Reduction] [th03/th04/th05] game_init_main

This commit is contained in:
wintiger0222 2019-11-20 04:08:50 +00:00 committed by nmlgc
parent 9b9f487d6c
commit 22bf71d170
8 changed files with 63 additions and 224 deletions

View File

@ -1,7 +1,9 @@
#if GAME >= 3
int game_init_op(const unsigned char *pf_fn);
int pascal game_init_main(const unsigned char *pf_fn);
#else
int game_init_op(void);
int pascal game_init_main(void);
#endif
void game_exit(void);

49
th02/initmain.asm Normal file
View File

@ -0,0 +1,49 @@
; (only covering TH03 and above)
public GAME_INIT_MAIN
game_init_main proc far
@@pf_fn = dword ptr 6
if GAME ge 4
PARAS equ <_mem_assign_paras>
else
PARAS = MEM_ASSIGN_PARAS_MAIN
endif
push bp
mov bp, sp
call mem_assign_dos pascal, PARAS
or ax, ax
jz short @@assign_success
mov ax, 1
pop bp
if GAME ge 3
retf 4
else
retf
endif
; ---------------------------------------------------------------------------
@@assign_success:
if GAME ge 4
mov bbufsiz, 1000h
endif
if GAME le 4
nopcall vram_planes_set
endif
call vsync_start
call egc_start
call graph_400line
call js_start
call pfstart pascal, large [bp+@@pf_fn]
if GAME ge 4
call bgm_init pascal, 2048
endif
xor ax, ax
pop bp
if GAME ge 3
retf 4
else
retf
endif
game_init_main endp

View File

@ -204,9 +204,7 @@ _envp = dword ptr 0Ch
push bp
mov bp, sp
push si
push ds
push offset aCOul ; "²Žžó2.dat"
call sub_ECD0
call game_init_main pascal, ds, offset aCOul
call sub_A346
or ax, ax
jz short loc_9775
@ -9247,38 +9245,7 @@ include th03/hardware/input_sense.asm
nop
include th02/snd/se.asm
include th02/snd/kajaint.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_ECD0 proc far
arg_0 = dword ptr 6
push bp
mov bp, sp
call mem_assign_dos pascal, MEM_ASSIGN_PARAS_MAIN
or ax, ax
jz short loc_ECE6
mov ax, 1
pop bp
retf 4
; ---------------------------------------------------------------------------
loc_ECE6:
nopcall vram_planes_set
call vsync_start
call egc_start
call graph_400line
call js_start
pushd [bp+arg_0]
call pfstart
xor ax, ax
pop bp
retf 4
sub_ECD0 endp
include th02/initmain.asm
include th02/formats/pi_slot_load.asm
include th03/hardware/input_modes.asm
include th03/hardware/input_wait.asm

View File

@ -932,9 +932,7 @@ _envp = dword ptr 0Ch
call sub_95F3
or ax, ax
jz locret_9F8B
push ds
push offset aCOul ; "²Žžó1.dat"
call sub_CEE0
call game_init_main pascal, ds, offset aCOul
call respal_exist
mov _snd_midi_active, 0
les bx, _yumeconfig
@ -5632,38 +5630,7 @@ include th02/formats/pi_slot_put.asm
include th03/formats/pi_slot_put_interlace.asm
include th02/snd/se.asm
include th02/snd/kajaint.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CEE0 proc far
arg_0 = dword ptr 6
push bp
mov bp, sp
call mem_assign_dos pascal, MEM_ASSIGN_PARAS_MAINL
or ax, ax
jz short loc_CEF6
mov ax, 1
pop bp
retf 4
; ---------------------------------------------------------------------------
loc_CEF6:
nopcall vram_planes_set
call vsync_start
call egc_start
call graph_400line
call js_start
pushd [bp+arg_0]
call pfstart
xor ax, ax
pop bp
retf 4
sub_CEE0 endp
include th02/initmain.asm
include th03/formats/cdg_load.asm
; =============== S U B R O U T I N E =======================================

View File

@ -293,9 +293,7 @@ _envp = dword ptr 0Ch
or ax, ax
jz short loc_AB86
mov _mem_assign_paras, MEM_ASSIGN_PARAS_MAIN
push ds
push offset aUmx ; "“Œ•ûŒ¶z.‹½"
call sub_13666
call game_init_main pascal, ds, offset aUmx
les bx, _humaconfig
mov eax, es:[bx+14h]
mov random_seed, eax
@ -15246,42 +15244,7 @@ include th04/snd/detmodes.asm
include th04/snd/load.asm
include th04/formats/cdg_put.asm
include th02/exit.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_13666 proc far
arg_0 = dword ptr 6
push bp
mov bp, sp
call mem_assign_dos pascal, _mem_assign_paras
or ax, ax
jz short loc_1367D
mov ax, 1
pop bp
retf 4
; ---------------------------------------------------------------------------
loc_1367D:
mov bbufsiz, 1000h
nopcall vram_planes_set
call vsync_start
call egc_start
call graph_400line
call js_start
pushd [bp+arg_0]
call pfstart
push 800h
call bgm_init
xor ax, ax
pop bp
retf 4
sub_13666 endp
; ---------------------------------------------------------------------------
include th02/initmain.asm
db 0
include th04/formats/cdg_put_noalpha.asm

View File

@ -260,9 +260,7 @@ _envp = dword ptr 0Ch
les bx, [bp+var_4]
mov es:[bx+4], al
mov _mem_assign_paras, MEM_ASSIGN_PARAS_MAINE
push ds
push offset aMSzlEd_dat ; "Œ¶z½ed.dat"
call sub_D43C
call game_init_main pascal, ds, offset aMSzlEd_dat
call gaiji_backup
push ds
push offset aGameft_bft ; "GAMEFT.bft"
@ -5349,42 +5347,7 @@ loc_D350:
include th04/formats/cdg_put.asm
include th02/exit.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_D43C proc far
arg_0 = dword ptr 6
push bp
mov bp, sp
call mem_assign_dos pascal, _mem_assign_paras
or ax, ax
jz short loc_D453
mov ax, 1
pop bp
retf 4
; ---------------------------------------------------------------------------
loc_D453:
mov bbufsiz, 1000h
nopcall vram_planes_set
call vsync_start
call egc_start
call graph_400line
call js_start
pushd [bp+arg_0]
call pfstart
push 800h
call bgm_init
xor ax, ax
pop bp
retf 4
sub_D43C endp
; ---------------------------------------------------------------------------
include th02/initmain.asm
db 0
include th04/hardware/input_sense.asm
include th04/snd/se.asm

View File

@ -339,9 +339,7 @@ _envp = dword ptr 0Ch
or ax, ax
jz short loc_AEA4
mov _mem_assign_paras, MEM_ASSIGN_PARAS_MAIN
push ds
push offset aKAIKIDAN2_DAT
call sub_14F86
call game_init_main pascal, ds, offset aKAIKIDAN2_DAT
les bx, _ksoconfig
mov eax, es:[bx+28h]
mov random_seed, eax
@ -14148,40 +14146,7 @@ include th04/math/vector1_at.asm
include th04/math/vector2_at.asm
include th05/snd/load.asm
include th05/snd/kajaint.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_14F86 proc far
arg_0 = dword ptr 6
push bp
mov bp, sp
call mem_assign_dos pascal, _mem_assign_paras
or ax, ax
jz short loc_14F9D
mov ax, 1
pop bp
retf 4
; ---------------------------------------------------------------------------
loc_14F9D:
mov bbufsiz, 1000h
call vsync_start
call egc_start
call graph_400line
call js_start
pushd [bp+arg_0]
call pfstart
push 800h
call bgm_init
xor ax, ax
pop bp
retf 4
sub_14F86 endp
include th02/initmain.asm
include th04/hardware/input_sense.asm
include th05/hardware/input_held.asm
include th05/hardware/input_wait.asm

View File

@ -345,9 +345,7 @@ _envp = dword ptr 0Ch
or ax, ax
jz loc_A693
mov _mem_assign_paras, MEM_ASSIGN_PARAS_MAINE
push ds
push offset aKaikidan1_dat
call sub_F0B4
call game_init_main pascal, ds, offset aKaikidan1_dat
les bx, _ksoconfig
mov al, es:[bx+12h]
mov ah, 0
@ -8680,42 +8678,7 @@ include th05/formats/pi_slot_load.asm
include th05/formats/pi_slot_put.asm
include th05/formats/pi_slot_palette_apply.asm
include th05/formats/pi_slot_free.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_F0B4 proc far
arg_0 = dword ptr 6
push bp
mov bp, sp
call mem_assign_dos pascal, _mem_assign_paras
or ax, ax
jz short loc_F0CB
mov ax, 1
pop bp
locret_F0C8:
retf 4
; ---------------------------------------------------------------------------
loc_F0CB:
mov bbufsiz, 1000h
call vsync_start
call egc_start
call graph_400line
call js_start
pushd [bp+arg_0]
call pfstart
push 800h
call bgm_init
xor ax, ax
pop bp
retf 4
sub_F0B4 endp
include th02/initmain.asm
include th04/hardware/input_sense.asm
include th05/hardware/input_held.asm
include th05/hardware/input_wait.asm