[Naming] [th03/th04/th05] .cfg file functions

This commit is contained in:
wintiger0222 2019-12-08 14:32:01 +09:00 committed by nmlgc
parent e219527964
commit 04f0491885
5 changed files with 63 additions and 57 deletions

View File

@ -1830,22 +1830,21 @@ _envp = dword ptr 0Ch
push bp
mov bp, sp
call sub_C273
call cfg_load
or ax, ax
jz short loc_B17E
jz short @@cfg_load_is_1
call _game_init_main
or ax, ax
jz short loc_B183
push 3
call zun_error
jz short @@game_init_main_is_0
call zun_error pascal, 3
loc_B17E:
@@cfg_load_is_1:
mov ax, 1
pop bp
retf
; ---------------------------------------------------------------------------
loc_B183:
@@game_init_main_is_0:
les bx, mikoconfig
cmp es:[bx+mikoconfig_t.bgm_mode], 1
jnz short loc_B19A
@ -3247,10 +3246,10 @@ RANDRING_NEXT_DEF 1
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public CFG_LOAD
cfg_load proc near
sub_C273 proc near
var_2 = word ptr -2
@@resident_sgm = word ptr -2
enter 2, 0
push ds
@ -3260,14 +3259,14 @@ var_2 = word ptr -2
push 0
call file_seek
push ss
lea ax, [bp+var_2]
lea ax, [bp+@@resident_sgm]
push ax
push 2
call file_read
call file_close
cmp [bp+var_2], 0
cmp [bp+@@resident_sgm], 0
jz short loc_C2F0
mov ax, [bp+var_2]
mov ax, [bp+@@resident_sgm]
mov word ptr mikoconfig+2, ax
mov word ptr mikoconfig, 0
les bx, mikoconfig
@ -3297,7 +3296,7 @@ loc_C2F0:
xor ax, ax
leave
retn
sub_C273 endp
cfg_load endp
; =============== S U B R O U T I N E =======================================

7
th03/cfg.h Normal file
View File

@ -0,0 +1,7 @@
void near pascal cfg_load(void);
// Saves the .CFG file, without changing its resident segment pointer.
void near pascal cfg_save(void);
// Like cfg_save(), but resets the resident segment pointer to zero.
void near pascal cfg_save_exit(void);

View File

@ -143,8 +143,8 @@ op_01_TEXT segment byte public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9908 proc near
public CFG_LOAD
cfg_load proc near
var_A = word ptr -0Ah
var_8 = byte ptr -8
@ -192,14 +192,14 @@ loc_996C:
mov es:[bx+0Bh], al
leave
retn
sub_9908 endp
cfg_load endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9980 proc near
public CFG_SAVE
cfg_save proc near
var_8 = byte ptr -8
var_7 = byte ptr -7
@ -227,14 +227,14 @@ var_6 = byte ptr -6
call file_close
leave
retn
sub_9980 endp
cfg_save endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_99C3 proc near
public CFG_SAVE_EXIT
cfg_save_exit proc near
var_8 = byte ptr -8
var_7 = byte ptr -7
@ -269,7 +269,7 @@ var_6 = byte ptr -6
call file_close
leave
retn
sub_99C3 endp
cfg_save_exit endp
; =============== S U B R O U T I N E =======================================
@ -417,7 +417,7 @@ loc_9B4E:
imul ax, 19h
add al, 46h ; 'F'
mov es:[bx+38h], al
call sub_9980
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_STOP
call game_exit
@ -629,7 +629,7 @@ loc_9D0A:
loc_9D19:
cmp [bp+var_2], 10h
jl short loc_9D0A
call sub_9980
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_STOP
call game_exit
@ -710,7 +710,7 @@ loc_9DDF:
jl short loc_9DD3
push 1
call palette_black_out
call sub_9980
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_STOP
call game_exit
@ -807,7 +807,7 @@ loc_9E9A:
loc_9EA6:
cmp si, 10h
jl short loc_9E9A
call sub_9980
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_STOP
call super_free
@ -1535,7 +1535,7 @@ loc_A468:
push ds
push offset aMikoft_bft ; "MIKOFT.bft"
call gaiji_entry_bfnt
call sub_9908
call cfg_load
les bx, _yumeconfig
cmp byte ptr es:[bx+28h], 80h
jb short loc_A497
@ -1598,7 +1598,7 @@ loc_A4EE:
loc_A4FE:
cmp byte_D952, 0
jz short loc_A4D2
call sub_99C3
call cfg_save_exit
call gaiji_restore
call text_clear
call game_exit_to_dos

View File

@ -161,8 +161,8 @@ op_01_TEXT segment byte public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A74C proc near
public CFG_LOAD
cfg_load proc near
var_C = word ptr -0Ch
var_A = byte ptr -0Ah
@ -230,14 +230,14 @@ loc_A7DE:
locret_A7EE:
leave
retn
sub_A74C endp
cfg_load endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A7F0 proc near
public CFG_SAVE
cfg_save proc near
var_8 = byte ptr -8
var_7 = byte ptr -7
@ -290,14 +290,14 @@ var_2 = byte ptr -2
call file_close
leave
retn
sub_A7F0 endp
cfg_save endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_A873 proc near
public CFG_SAVE_EXIT
cfg_save_exit proc near
var_A = byte ptr -0Ah
var_9 = byte ptr -9
@ -349,7 +349,7 @@ var_1 = byte ptr -1
call file_close
leave
retn
sub_A873 endp
cfg_save_exit endp
; =============== S U B R O U T I N E =======================================
@ -373,7 +373,7 @@ sub_A8F1 proc near
les bx, _humaconfig
mov byte ptr es:[bx+3Eh], 0
call sub_CCC8
call sub_A7F0
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_FADE, 10
call game_exit
@ -424,7 +424,7 @@ sub_A96C proc near
les bx, _humaconfig
mov byte ptr es:[bx+3Eh], 0
call sub_CCC8
call sub_A7F0
call cfg_save
call gaiji_restore
kajacall KAJA_SONG_FADE, 10
call game_exit
@ -509,7 +509,7 @@ loc_AA6E:
call super_free
freePISlotLarge 0
call sub_CCC8
call sub_A7F0
call cfg_save
call gaiji_restore
call game_exit
pushd 0
@ -1468,7 +1468,7 @@ loc_B3AB:
push ds
push offset aGameft_bft ; "GAMEFT.bft"
call gaiji_entry_bfnt
call sub_A74C
call cfg_load
les bx, _humaconfig
cmp byte ptr es:[bx+0Fh], 0FFh
jnz short loc_B3D3
@ -1551,7 +1551,7 @@ loc_B47B:
cmp byte_F3DC, 0
jz short loc_B43A
call sub_CCC8
call sub_A873
call cfg_save_exit
call gaiji_restore
call text_clear
call game_exit_to_dos

View File

@ -203,7 +203,7 @@ loc_A400:
cmp si, 8
jl short loc_A3CF
call sub_BC83
call sub_BB0E
call cfg_save
kajacall KAJA_SONG_FADE, 10
call game_exit
les bx, _ksoconfig
@ -285,7 +285,7 @@ loc_A4A0:
cmp si, 8
jl short loc_A46F
call sub_BC83
call sub_BB0E
call cfg_save
kajacall KAJA_SONG_FADE, 10
call game_exit
pushd 0
@ -407,7 +407,7 @@ loc_A5BF:
cmp si, 8
jl short loc_A5A8
call sub_BC83
call sub_BB0E
call cfg_save
push 1
call palette_black_out
call game_exit
@ -1400,7 +1400,7 @@ _envp = dword ptr 0Ch
call _getch
loc_AF7D:
call sub_BA94
call cfg_load
les bx, _ksoconfig
cmp byte ptr es:[bx+11h], 0FFh
jnz short loc_AF97
@ -1494,7 +1494,7 @@ loc_B058:
cmp byte_F072, 0
jz short loc_B00E
call sub_BC83
call sub_BB91
call cfg_save_exit
call text_clear
call game_exit_to_dos
call respal_free
@ -2258,8 +2258,8 @@ include th04/zunsoft.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_BA94 proc near
public CFG_LOAD
cfg_load proc near
var_C = word ptr -0Ch
var_A = byte ptr -0Ah
@ -2310,14 +2310,14 @@ loc_BAFC:
locret_BB0C:
leave
retn
sub_BA94 endp
cfg_load endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_BB0E proc near
public CFG_SAVE
cfg_save proc near
var_8 = byte ptr -8
var_7 = byte ptr -7
@ -2370,14 +2370,14 @@ var_2 = byte ptr -2
call file_close
leave
retn
sub_BB0E endp
cfg_save endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_BB91 proc near
public CFG_SAVE_EXIT
cfg_save_exit proc near
var_A = byte ptr -0Ah
var_9 = byte ptr -9
@ -2429,7 +2429,7 @@ var_1 = byte ptr -1
call file_close
leave
retn
sub_BB91 endp
cfg_save_exit endp
; =============== S U B R O U T I N E =======================================