From 6d702988af54cf45c8ceec15a04e5290b8401415 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 28 Mar 2024 21:45:59 +0100 Subject: [PATCH] [Maintenance] Remove `extern "C"` from more areas of code Covering every input function across all games. Part of P0278, funded by Yanga. --- th02/hardware/input_s.cpp | 3 --- th02/hardware/keydelay.cpp | 2 -- th02/main/dialog/dialog.cpp | 2 +- th02/maine_04.cpp | 2 +- th02/op/m_music.cpp | 19 +++++++++---------- th02/op_01.cpp | 2 -- th02/op_04.cpp | 2 -- th02/op_05.cpp | 2 +- th02_main.asm | 26 ++++++++++++------------- th02_maine.asm | 14 +++++++------- th03/cutscene/cutscene.cpp | 18 +++++++++++------- th03/hardware/inp_wait.cpp | 5 ++--- th03/hardware/input_s.cpp | 3 --- th03/hiscore/regist.cpp | 2 +- th03/inp_m_w.cpp | 3 --- th03_main.asm | 38 ++++++++++++++++++------------------- th03_mainl.asm | 14 +++++++------- th03_op.asm | 32 +++++++++++++++---------------- th04/end/entry.cpp | 4 +++- th04/hardware/input.inc | 4 ++-- th04/hardware/input_s.asm | 10 +++++----- th04/hardware/input_w.cpp | 3 --- th04/m_char.cpp | 2 ++ th04/main/dialog/shared.hpp | 2 +- th04/main/pause.asm | 2 +- th04/op/m_setup.cpp | 2 ++ th04/op/start.cpp | 2 ++ th04/zunsoft.asm | 8 ++++---- th04_main.asm | 20 +++++++++---------- th04_maine.asm | 16 ++++++++-------- th04_op.asm | 8 ++++---- th05/hardware/inp_h_w.cpp | 2 -- th05/m_char.cpp | 5 +++-- th05/op/start.cpp | 2 +- th05_main.asm | 18 +++++++++--------- th05_maine.asm | 12 ++++++------ th05_op.asm | 6 +++--- 37 files changed, 154 insertions(+), 163 deletions(-) diff --git a/th02/hardware/input_s.cpp b/th02/hardware/input_s.cpp index a0d59aa8..0a05e84b 100644 --- a/th02/hardware/input_s.cpp +++ b/th02/hardware/input_s.cpp @@ -3,7 +3,6 @@ #include "platform.h" #include "x86real.h" #include "pc98kbd.h" -extern "C" { #include "th02/hardware/input.hpp" inline uint8_t keygroup_sense(uint8_t group) { @@ -75,5 +74,3 @@ void input_sense(void) } } #pragma codestring "\x90" - -} diff --git a/th02/hardware/keydelay.cpp b/th02/hardware/keydelay.cpp index 21f51d0e..2d51e25d 100644 --- a/th02/hardware/keydelay.cpp +++ b/th02/hardware/keydelay.cpp @@ -2,9 +2,7 @@ #include "platform.h" #include "master.hpp" -extern "C" { #include "th02/hardware/input.hpp" -} #include "th02/hardware/frmdelay.h" int key_delay_sense(void) diff --git a/th02/main/dialog/dialog.cpp b/th02/main/dialog/dialog.cpp index 282180bc..e5f93fc6 100644 --- a/th02/main/dialog/dialog.cpp +++ b/th02/main/dialog/dialog.cpp @@ -10,9 +10,9 @@ #include "th02/common.h" #include "th02/resident.hpp" #include "th02/hardware/frmdelay.h" -extern "C" { #include "th02/hardware/input.hpp" #include "th02/hardware/pages.hpp" +extern "C" { #include "th02/snd/snd.h" } #include "th02/formats/dialog.hpp" diff --git a/th02/maine_04.cpp b/th02/maine_04.cpp index ff093af0..52023169 100644 --- a/th02/maine_04.cpp +++ b/th02/maine_04.cpp @@ -11,7 +11,6 @@ #include "th02/common.h" #include "th02/resident.hpp" #include "th02/hardware/frmdelay.h" -extern "C" { #include "th02/hardware/input.hpp" #include "th02/core/globals.hpp" #include "th02/gaiji/gaiji.h" @@ -24,6 +23,7 @@ extern "C" { long score_highest; scoredat_section_t hi; +extern "C" { void pascal scoredat_defaults_set(void) { int i; diff --git a/th02/op/m_music.cpp b/th02/op/m_music.cpp index 1ad23062..9d445714 100644 --- a/th02/op/m_music.cpp +++ b/th02/op/m_music.cpp @@ -10,23 +10,22 @@ #include "th02/v_colors.hpp" #include "th02/hardware/frmdelay.h" #include "th02/formats/musiccmt.hpp" +#if (GAME == 5) + #include "th05/hardware/input.h" +#elif (GAME == 4) + #include "th04/hardware/input.h" +#elif (GAME == 3) + #include "th03/hardware/input.h" +#else + #include "th02/hardware/input.hpp" +#endif extern "C" { #if (GAME >= 4) #include "th04/hardware/bgimage.hpp" #include "th04/hardware/grppsafx.h" - #if (GAME == 5) - #include "th05/hardware/input.h" - #else - #include "th04/hardware/input.h" - #endif #include "th04/snd/snd.h" #else #include "th01/hardware/grppsafx.h" - #if (GAME == 3) - #include "th03/hardware/input.h" - #else - #include "th02/hardware/input.hpp" - #endif #include "th02/snd/snd.h" #endif } diff --git a/th02/op_01.cpp b/th02/op_01.cpp index 1a5a0169..74749ec0 100644 --- a/th02/op_01.cpp +++ b/th02/op_01.cpp @@ -20,9 +20,7 @@ extern "C" { #include "th02/resident.hpp" #include "th02/hardware/frmdelay.h" #include "th02/hardware/grp_rect.h" -extern "C" { #include "th02/hardware/input.hpp" -} #include "th02/core/globals.hpp" #include "th02/core/zunerror.h" #include "th02/core/initexit.h" diff --git a/th02/op_04.cpp b/th02/op_04.cpp index aeeca8c2..1338b5d9 100644 --- a/th02/op_04.cpp +++ b/th02/op_04.cpp @@ -13,9 +13,7 @@ #include "th01/rank.h" #include "th02/common.h" #include "th02/hardware/frmdelay.h" -extern "C" { #include "th02/hardware/input.hpp" -} #include "th02/core/globals.hpp" #include "th02/formats/scoredat.hpp" #include "th02/gaiji/gaiji.h" diff --git a/th02/op_05.cpp b/th02/op_05.cpp index 74ab5a4a..15a2c77c 100644 --- a/th02/op_05.cpp +++ b/th02/op_05.cpp @@ -18,8 +18,8 @@ extern "C" { } #include "th02/hardware/frmdelay.h" #include "th02/hardware/grp_rect.h" -extern "C" { #include "th02/hardware/input.hpp" +extern "C" { #include "th02/formats/pi.h" } diff --git a/th02_main.asm b/th02_main.asm index 543e9382..783da082 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -1664,7 +1664,7 @@ loc_BA33: loc_BA3D: push TX_WHITE call gaiji_putsa - call _input_sense + call @input_sense$qv inc si cmp [bp+var_1], 0 jnz short loc_BA5C @@ -1943,7 +1943,7 @@ loc_BDA2: mov dx, _scroll_line mov bx, ax mov ss:[bx], dx - call _input_sense + call @input_sense$qv les bx, _resident cmp es:[bx+mikoconfig_t.demo_num], 0 jz short loc_BDCC @@ -2546,7 +2546,7 @@ loc_C3E5: ; --------------------------------------------------------------------------- loc_C3FB: - call _input_sense + call @input_sense$qv loc_C400: cmp _key_det, 0 @@ -2573,7 +2573,7 @@ loc_C400: mov di, 1 loc_C47A: - call _input_sense + call @input_sense$qv cmp [bp+var_2], 0 jnz short loc_C493 cmp _key_det, 0 @@ -6470,14 +6470,14 @@ main_01____TEXT ends SHARED segment word public 'CODE' use16 include th02/snd/snd.inc extern @ZUN_ERROR$Q11ZUN_ERROR_T:proc - extern _key_delay:proc + extern @key_delay$qv:proc extern MPN_LOAD:proc extern _mpn_free:proc extern _pi_load:proc extern @VECTOR2$QMIT1UCI:proc extern @VECTOR2_BETWEEN_PLUS$QIIIIUCMIT6I:proc extern @FRAME_DELAY$QI:proc - extern _input_sense:proc + extern @input_sense$qv:proc extern @game_exit$qv:proc extern _snd_mmd_resident:proc extern _snd_determine_mode:proc @@ -6706,7 +6706,7 @@ loc_FD5A: call _snd_se_update mov _key_det, 1 - call _key_delay + call @key_delay$qv pop si leave retn @@ -6842,7 +6842,7 @@ loc_FEB9: call _snd_se_update mov _key_det, 1 - call _key_delay + call @key_delay$qv pop si leave retn @@ -13173,7 +13173,7 @@ rika_end proc far call @dialog_pre$qv call @dialog_script_generic_part_anima$q17dialog_sequence_t pascal, DS_POSTBOSS call @stage_clear_bonus_animate$qv - call _key_delay + call @key_delay$qv call @overlay_stage_leave_animate$qv inc _stage_id mov _spark_accel_x, 0 @@ -15773,7 +15773,7 @@ meira_end proc far call @dialog_pre$qv call @dialog_script_generic_part_anima$q17dialog_sequence_t pascal, DS_POSTBOSS call @stage_clear_bonus_animate$qv - call _key_delay + call @key_delay$qv call @overlay_stage_leave_animate$qv inc _stage_id mov _spark_accel_x, 0 @@ -18446,7 +18446,7 @@ evileye_end proc far call @dialog_pre$qv call @dialog_script_generic_part_anima$q17dialog_sequence_t pascal, DS_POSTBOSS call @stage_extra_clear_bonus_animate$qv - call _key_delay + call @key_delay$qv les bx, _resident mov es:[bx+mikoconfig_t.stage], 7Fh mov eax, _score @@ -29033,7 +29033,7 @@ loc_1CA1D: jle short loc_1CA50 push 0FFFFh call sub_1C785 - call _key_delay + call @key_delay$qv jmp loc_1CD32 ; --------------------------------------------------------------------------- @@ -29157,7 +29157,7 @@ loc_1CB89: mov [bp+var_B], 0 loc_1CB8D: - call _input_sense + call @input_sense$qv cmp [bp+var_A], 0 jnz loc_1CCFE test byte ptr _key_det, INPUT_UP diff --git a/th02_maine.asm b/th02_maine.asm index 26710668..f41ae608 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -234,7 +234,7 @@ arg_6 = word ptr 0Ah ; --------------------------------------------------------------------------- loc_9660: - call _input_sense + call @input_sense$qv les bx, [bp+arg_2] add bx, si mov al, es:[bx] @@ -287,7 +287,7 @@ loc_96C4: ; --------------------------------------------------------------------------- loc_96CD: - call _input_sense + call @input_sense$qv cmp byte_F02B, 0 jz short loc_96E4 cmp _key_det, 0 @@ -2737,7 +2737,7 @@ loc_AF56: push 40h call sub_97F1 add sp, 6 - call _key_delay + call @key_delay$qv push 5 call palette_black_out nopcall sub_AFE7 @@ -2775,7 +2775,7 @@ sub_AFE7 proc far pop cx call _pi_put_8 c, 0, large 0 freePISlotLarge 0 - call _key_delay + call @key_delay$qv push 5 call palette_black_out @@ -2810,7 +2810,7 @@ sub_B07F proc far pop cx call _pi_put_8 c, 0, large 0 freePISlotLarge 0 - call _key_delay + call @key_delay$qv push 5 call palette_black_out @@ -2926,10 +2926,10 @@ maine_01_TEXT ends SHARED segment word public 'CODE' use16 include th02/snd/snd.inc extern _graph_putsa_fx:proc - extern _key_delay:proc + extern @key_delay$qv:proc extern _pi_load:proc extern @FRAME_DELAY$QI:proc - extern _input_sense:proc + extern @input_sense$qv:proc extern @game_exit$qv:proc extern _snd_mmd_resident:proc extern _snd_determine_mode:proc diff --git a/th03/cutscene/cutscene.cpp b/th03/cutscene/cutscene.cpp index fb6104c1..4541d1b0 100644 --- a/th03/cutscene/cutscene.cpp +++ b/th03/cutscene/cutscene.cpp @@ -22,28 +22,32 @@ #include "libs/kaja/kaja.h" #include "th02/v_colors.hpp" #include "th02/hardware/frmdelay.h" +#if (GAME == 5) + #include "th05/hardware/input.h" +#elif (GAME == 4) + #include "th04/hardware/input.h" +#else + #include "th03/hardware/input.h" + + // Let's rather not have this one global, since it might be wrong in an + // in-game context? + #define key_det input_sp +#endif extern "C" { #if (GAME == 5) #include "th04/hardware/bgimage.hpp" #include "th04/hardware/grppsafx.h" #include "th04/snd/snd.h" #include "th04/gaiji/gaiji.h" - #include "th05/hardware/input.h" #include "th05/formats/pi.hpp" #elif (GAME == 4) #include "th03/formats/pi.hpp" - #include "th04/hardware/input.h" #include "th04/hardware/grppsafx.h" #include "th04/snd/snd.h" #else #include "th01/hardware/grppsafx.h" - #include "th03/hardware/input.h" #include "th03/formats/pi.hpp" #include "th03/snd/snd.h" - - // Let's rather not have this one global, since it might be wrong in an - // in-game context? - #define key_det input_sp #endif } #include "th03/cutscene/cutscene.hpp" diff --git a/th03/hardware/inp_wait.cpp b/th03/hardware/inp_wait.cpp index 0220e0e9..d23af16d 100644 --- a/th03/hardware/inp_wait.cpp +++ b/th03/hardware/inp_wait.cpp @@ -4,9 +4,10 @@ #include "x86real.h" #include "master.hpp" #include "libs/kaja/kaja.h" -extern "C" { #include "th03/hardware/input.h" +extern "C" { #include "th03/snd/snd.h" +} #include "th02/snd/measure.hpp" bool16 pascal input_wait_for_ok_or_measure(int measure, unsigned int frames) @@ -35,5 +36,3 @@ bool16 pascal input_wait_for_ok(unsigned int frames) } while(vsync_Count1 < frames); return false; } - -} diff --git a/th03/hardware/input_s.cpp b/th03/hardware/input_s.cpp index 96115695..d333cf2d 100644 --- a/th03/hardware/input_s.cpp +++ b/th03/hardware/input_s.cpp @@ -5,7 +5,6 @@ #include "pc98kbd.h" #include "master.hpp" #include "platform/x86real/flags.hpp" -extern "C" { #include "th03/hardware/input.h" void input_reset_sense_key_held(void) @@ -143,5 +142,3 @@ void input_reset_sense_key_held(void) } while(1); } #pragma codestring "\x90" - -} diff --git a/th03/hiscore/regist.cpp b/th03/hiscore/regist.cpp index fb8b844b..8b0722b0 100644 --- a/th03/hiscore/regist.cpp +++ b/th03/hiscore/regist.cpp @@ -20,8 +20,8 @@ extern "C" { extern "C" { #include "th03/formats/cdg.h" #include "th03/formats/pi.hpp" -#include "th03/hardware/input.h" } +#include "th03/hardware/input.h" #include "th03/shiftjis/regist.hpp" #include "th03/formats/scoredat.hpp" diff --git a/th03/inp_m_w.cpp b/th03/inp_m_w.cpp index 59509a79..d1d881c7 100644 --- a/th03/inp_m_w.cpp +++ b/th03/inp_m_w.cpp @@ -3,7 +3,6 @@ #include "platform.h" #include "master.hpp" #include "th02/hardware/frmdelay.h" -extern "C" { #include "th03/hardware/input.h" /// Modes @@ -112,5 +111,3 @@ void pascal input_wait_for_change(int frames_to_wait) } } } - -} diff --git a/th03_main.asm b/th03_main.asm index 85bd39c0..7feea461 100644 --- a/th03_main.asm +++ b/th03_main.asm @@ -730,7 +730,7 @@ loc_9CD0: les bx, _resident cmp es:[bx+resident_t.demo_num], 0 jz short loc_9CF0 - setfarfp _input_mode, input_mode_attract + setfarfp _input_mode, @input_mode_attract$qv jmp loc_9D80 ; --------------------------------------------------------------------------- @@ -740,7 +740,7 @@ loc_9CF0: jz short loc_9D10 cmp es:[bx+resident_t.RESIDENT_is_cpu][0], 0 jz short loc_9D10 - setfarfp _input_mode, input_mode_cpu_vs_cpu + setfarfp _input_mode, @input_mode_cpu_vs_cpu$qv jmp short loc_9D80 ; --------------------------------------------------------------------------- @@ -748,7 +748,7 @@ loc_9D10: les bx, _resident cmp es:[bx+resident_t.RESIDENT_is_cpu][1], 0 jz short loc_9D29 - setfarfp _input_mode, input_mode_1p_vs_cpu + setfarfp _input_mode, @input_mode_1p_vs_cpu$qv jmp short loc_9D80 ; --------------------------------------------------------------------------- @@ -756,7 +756,7 @@ loc_9D29: les bx, _resident cmp es:[bx+resident_t.RESIDENT_is_cpu][0], 0 jz short loc_9D42 - setfarfp _input_mode, input_mode_cpu_vs_1p + setfarfp _input_mode, @input_mode_cpu_vs_1p$qv jmp short loc_9D80 ; --------------------------------------------------------------------------- @@ -764,7 +764,7 @@ loc_9D42: les bx, _resident cmp es:[bx+resident_t.key_mode], KM_KEY_KEY jnz short loc_9D5B - setfarfp _input_mode, input_mode_key_vs_key + setfarfp _input_mode, @input_mode_key_vs_key$qv jmp short loc_9D80 ; --------------------------------------------------------------------------- @@ -772,12 +772,12 @@ loc_9D5B: les bx, _resident cmp es:[bx+resident_t.key_mode], KM_JOY_KEY jnz short loc_9D74 - setfarfp _input_mode, input_mode_joy_vs_key + setfarfp _input_mode, @input_mode_joy_vs_key$qv jmp short loc_9D80 ; --------------------------------------------------------------------------- loc_9D74: - setfarfp _input_mode, input_mode_key_vs_joy + setfarfp _input_mode, @input_mode_key_vs_joy$qv loc_9D80: xor si, si @@ -4840,7 +4840,7 @@ loc_C7C8: ; --------------------------------------------------------------------------- loc_C7DB: - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv call @frame_delay$qi pascal, 1 loc_C7E7: @@ -4848,7 +4848,7 @@ loc_C7E7: jnz short loc_C7DB loc_C7EE: - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv test _input_sp.hi, high INPUT_Q jnz short loc_C7C1 test _input_sp.hi, high INPUT_CANCEL @@ -4858,7 +4858,7 @@ loc_C7EE: ; --------------------------------------------------------------------------- loc_C80A: - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv call @frame_delay$qi pascal, 1 loc_C816: @@ -5202,7 +5202,7 @@ loc_CA95: ; --------------------------------------------------------------------------- loc_CA99: - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv test _input_sp.hi, high INPUT_CANCEL jz short loc_CAA8 call sub_C7A5 @@ -8726,19 +8726,19 @@ SHARED segment word public 'CODE' use16 extern @game_exit$qv:proc extern @polar$qiii:proc extern @FRAME_DELAY$QI:proc - extern _input_reset_sense_key_held:proc + extern @input_reset_sense_key_held$qv:proc extern _snd_se_reset:proc extern SND_SE_PLAY:proc extern _snd_se_update:proc extern SND_KAJA_INTERRUPT:proc extern @GAME_INIT_MAIN$QNXUC:proc - extern INPUT_MODE_KEY_VS_KEY:proc - extern INPUT_MODE_JOY_VS_KEY:proc - extern INPUT_MODE_KEY_VS_JOY:proc - extern INPUT_MODE_1P_VS_CPU:proc - extern INPUT_MODE_CPU_VS_1P:proc - extern INPUT_MODE_CPU_VS_CPU:proc - extern INPUT_MODE_ATTRACT:proc + extern @INPUT_MODE_KEY_VS_KEY$QV:proc + extern @INPUT_MODE_JOY_VS_KEY$QV:proc + extern @INPUT_MODE_KEY_VS_JOY$QV:proc + extern @INPUT_MODE_1P_VS_CPU$QV:proc + extern @INPUT_MODE_CPU_VS_1P$QV:proc + extern @INPUT_MODE_CPU_VS_CPU$QV:proc + extern @INPUT_MODE_ATTRACT$QV:proc extern _hflip_lut_generate:proc extern @MRS_LOAD$QINXC:proc extern @MRS_FREE$QI:proc diff --git a/th03_mainl.asm b/th03_mainl.asm index f3775715..5755b077 100644 --- a/th03_mainl.asm +++ b/th03_mainl.asm @@ -200,7 +200,7 @@ loc_97FC: call sub_990C loc_9868: - call input_mode_interface + call @input_mode_interface$qv cmp _input_sp, INPUT_NONE jnz short loc_987D call @frame_delay$qi pascal, 1 @@ -592,7 +592,7 @@ loc_9C42: ; --------------------------------------------------------------------------- loc_9C4B: - call input_mode_interface + call @input_mode_interface$qv loc_9C50: cmp vsync_Count1, 60h @@ -966,7 +966,7 @@ loc_9FC8: call palette_black_in loc_A00B: - call input_mode_interface + call @input_mode_interface$qv test _input_sp.lo, low INPUT_LEFT jnz short loc_A01E test _input_sp.lo, low INPUT_RIGHT @@ -1215,7 +1215,7 @@ loc_B835: call @regist_rows_put$qv loc_B858: - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 les bx, _resident cmp es:[bx+resident_t.rem_credits], 0 jz short loc_B871 @@ -2603,7 +2603,7 @@ loc_C735: xor di, di loc_C781: - call input_mode_interface + call @input_mode_interface$qv call sub_BB51 call sub_BCD5 inc word_10BB2 @@ -2676,8 +2676,8 @@ include th02/snd/snd.inc extern GRAPH_PUTSA_FX:proc extern SND_DELAY_UNTIL_MEASURE:proc extern PI_LOAD:proc - extern INPUT_MODE_INTERFACE:proc - extern INPUT_WAIT_FOR_CHANGE:proc + extern @INPUT_MODE_INTERFACE$QV:proc + extern @INPUT_WAIT_FOR_CHANGE$QI:proc extern CDG_PUT_NOALPHA_8:proc extern _hflip_lut_generate:proc SHARED ends diff --git a/th03_op.asm b/th03_op.asm index 732a2fc0..9f8a547e 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -309,7 +309,7 @@ var_2 = word ptr -2 call sub_9B9D loc_9C1B: - call input_mode_interface + call @input_mode_interface$qv or si, si jnz short loc_9C7E test _input_sp.lo, low INPUT_UP @@ -463,7 +463,7 @@ sub_9E16 proc near ; --------------------------------------------------------------------------- loc_9E24: - call input_mode_interface + call @input_mode_interface$qv les bx, _resident inc es:[bx+resident_t.rand] inc si @@ -1279,7 +1279,7 @@ loc_A4BC: ; --------------------------------------------------------------------------- loc_A4D2: - call input_mode_interface + call @input_mode_interface$qv mov al, _in_option cbw or ax, ax @@ -2579,7 +2579,7 @@ sub_BA88 proc near mov byte_FC5B, 0 cmp es:[bx+resident_t.key_mode], KM_KEY_KEY jnz short loc_BAD4 - setfarfp _input_mode, input_mode_key_vs_key + setfarfp _input_mode, @input_mode_key_vs_key$qv jmp short loc_BAF9 ; --------------------------------------------------------------------------- @@ -2587,12 +2587,12 @@ loc_BAD4: les bx, _resident cmp es:[bx+resident_t.key_mode], KM_JOY_KEY jnz short loc_BAED - setfarfp _input_mode, input_mode_joy_vs_key + setfarfp _input_mode, @input_mode_joy_vs_key$qv jmp short loc_BAF9 ; --------------------------------------------------------------------------- loc_BAED: - setfarfp _input_mode, input_mode_key_vs_joy + setfarfp _input_mode, @input_mode_key_vs_joy$qv loc_BAF9: call @frame_delay$qi pascal, 16 @@ -2630,7 +2630,7 @@ loc_BB35: loc_BB37: push ax call p_cursor_put - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv call _input_mode push _input_mp_p1 push 0 @@ -2729,7 +2729,7 @@ sub_BC1F proc near mov _playchars[1], al mov byte_FC5A, 0 mov byte_FC5B, 0 - setfarfp _input_mode, input_mode_interface + setfarfp _input_mode, @input_mode_interface$qv xor si, si jmp loc_BD8B ; --------------------------------------------------------------------------- @@ -2743,7 +2743,7 @@ loc_BC69: call sub_B565 call sub_B636 call sub_B670 - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv call _input_mode push 0 cmp byte_FC5A, 0 @@ -2869,7 +2869,7 @@ sub_BD9A proc near mov _playchars[0], 0 mov byte_FC5A, 0 mov byte_FC5B, 1 - setfarfp _input_mode, input_mode_interface + setfarfp _input_mode, @input_mode_interface$qv mov word_FC62, 0 loc_BDC1: @@ -2891,7 +2891,7 @@ loc_BDDD: loc_BDDF: push ax call p_cursor_put - call _input_reset_sense_key_held + call @input_reset_sense_key_held$qv call _input_mode push _input_sp push 0 @@ -2973,7 +2973,7 @@ include th02/snd/snd.inc extern CDG_PUT_8:proc extern CDG_PUT_HFLIP_8:proc extern @FRAME_DELAY$QI:proc - extern _input_reset_sense_key_held:proc + extern @input_reset_sense_key_held$qv:proc extern PI_PALETTE_APPLY:proc extern PI_PUT_8:proc extern SND_KAJA_INTERRUPT:proc @@ -2983,10 +2983,10 @@ include th02/snd/snd.inc extern CDG_LOAD_ALL_NOALPHA:proc extern CDG_FREE:proc extern PI_LOAD:proc - extern INPUT_MODE_INTERFACE:proc - extern INPUT_MODE_KEY_VS_KEY:proc - extern INPUT_MODE_JOY_VS_KEY:proc - extern INPUT_MODE_KEY_VS_JOY:proc + extern @INPUT_MODE_INTERFACE$QV:proc + extern @INPUT_MODE_KEY_VS_KEY$QV:proc + extern @INPUT_MODE_JOY_VS_KEY$QV:proc + extern @INPUT_MODE_KEY_VS_JOY$QV:proc extern CDG_PUT_NOALPHA_8:proc extern _hflip_lut_generate:proc SHARED ends diff --git a/th04/end/entry.cpp b/th04/end/entry.cpp index 238715f0..7548c967 100644 --- a/th04/end/entry.cpp +++ b/th04/end/entry.cpp @@ -9,11 +9,13 @@ #include "th02/hardware/frmdelay.h" extern "C" { #include "th03/formats/cdg.h" +} #if (GAME == 4) + extern "C" { #include "th03/formats/pi.hpp" + } #include "th04/hardware/input.h" #endif -} #include "th03/formats/cfg_impl.hpp" #include "th03/core/initexit.h" #include "th03/cutscene/cutscene.hpp" diff --git a/th04/hardware/input.inc b/th04/hardware/input.inc index 38ea116b..6745723b 100644 --- a/th04/hardware/input.inc +++ b/th04/hardware/input.inc @@ -19,9 +19,9 @@ INPUT_MOVEMENT = \ INPUT_UP_LEFT or INPUT_UP_RIGHT or INPUT_DOWN_LEFT or INPUT_DOWN_RIGHT if GAME eq 5 -input_reset_sense_interface equ <_input_reset_sense_held> +input_reset_sense_interface equ <@input_reset_sense_held$qv> else -input_reset_sense_interface equ <_input_reset_sense> +input_reset_sense_interface equ <@input_reset_sense$qv> endif ; move_ret_t diff --git a/th04/hardware/input_s.asm b/th04/hardware/input_s.asm index be408730..f85a0a9a 100644 --- a/th04/hardware/input_s.asm +++ b/th04/hardware/input_s.asm @@ -32,14 +32,14 @@ else endm endif -public _input_reset_sense -_input_reset_sense label proc +public @input_reset_sense$qv +@input_reset_sense$qv label proc xor ax, ax mov _key_det, ax mov js_stat, ax -public _input_sense -_input_sense proc far +public @input_sense$qv +@input_sense$qv proc far xor ax, ax mov es, ax mov ah, byte ptr es:[KEYGROUP_7] @@ -154,7 +154,7 @@ if GAME eq 5 mov ax, _key_det endif retf -_input_sense endp +@input_sense$qv endp even end diff --git a/th04/hardware/input_w.cpp b/th04/hardware/input_w.cpp index f02845a2..6006e8e8 100644 --- a/th04/hardware/input_w.cpp +++ b/th04/hardware/input_w.cpp @@ -2,7 +2,6 @@ #include "platform.h" #include "th02/hardware/frmdelay.h" -extern "C" { #include "th04/hardware/input.h" void pascal input_wait_for_change(int frames_to_wait) @@ -34,5 +33,3 @@ void pascal input_wait_for_change(int frames_to_wait) } } } - -} diff --git a/th04/m_char.cpp b/th04/m_char.cpp index a42b80b8..3bb8325b 100644 --- a/th04/m_char.cpp +++ b/th04/m_char.cpp @@ -18,8 +18,10 @@ extern "C" { #include "th03/formats/pi.hpp" #include "th04/common.h" #include "th04/formats/scoredat.hpp" +} #include "th04/resident.hpp" #include "th04/hardware/input.h" +extern "C" { #include "th04/hardware/grppsafx.h" #include "th04/formats/cdg.h" #include "th04/snd/snd.h" diff --git a/th04/main/dialog/shared.hpp b/th04/main/dialog/shared.hpp index e6a08155..98d29ede 100644 --- a/th04/main/dialog/shared.hpp +++ b/th04/main/dialog/shared.hpp @@ -16,12 +16,12 @@ #include "th02/formats/tile.hpp" extern "C" { #include "th03/formats/cdg.h" +} #if (GAME == 5) #include "th05/hardware/input.h" #else #include "th04/hardware/input.h" #endif -} #include "th04/common.h" #if (GAME == 4) #include "th04/playchar.h" diff --git a/th04/main/pause.asm b/th04/main/pause.asm index b1cc9053..51068abe 100644 --- a/th04/main/pause.asm +++ b/th04/main/pause.asm @@ -18,7 +18,7 @@ _pause proc near call gaiji_putsa pascal, (26 shl 16) + 15, ds, offset gsSHUURYOU, TX_YELLOW @@menu_loop_start: - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 test _key_det.lo, low INPUT_UP jnz short @@select test _key_det.lo, low INPUT_DOWN diff --git a/th04/op/m_setup.cpp b/th04/op/m_setup.cpp index 5964518d..fc89f89e 100644 --- a/th04/op/m_setup.cpp +++ b/th04/op/m_setup.cpp @@ -18,7 +18,9 @@ extern "C" { #include "th03/formats/pi.hpp" #endif #include "th04/hardware/grppsafx.h" +} #include "th04/hardware/input.h" +extern "C" { #include "th04/snd/snd.h" #include "th04/op/op.hpp" } diff --git a/th04/op/start.cpp b/th04/op/start.cpp index d654dce6..d5f40293 100644 --- a/th04/op/start.cpp +++ b/th04/op/start.cpp @@ -5,7 +5,9 @@ extern "C" { #include "th02/formats/pi.h" #include "th04/common.h" #include "th04/playchar.h" +} #include "th04/hardware/input.h" +extern "C" { #include "th04/op/op.hpp" } #include "th04/op/start.hpp" diff --git a/th04/zunsoft.asm b/th04/zunsoft.asm index 7250a54f..ae7ea724 100644 --- a/th04/zunsoft.asm +++ b/th04/zunsoft.asm @@ -332,7 +332,7 @@ endif graph_accesspage 1 graph_showpage 0 if GAME eq 4 - call _input_reset_sense + call @input_reset_sense$qv endif xor di, di jmp @@more_frames? @@ -340,9 +340,9 @@ endif @@next_frame: if GAME eq 5 - call _input_reset_sense_held + call @input_reset_sense_held$qv else - call _input_sense + call @input_sense$qv endif cmp _key_det, INPUT_NONE jz short @@not_skipping @@ -423,7 +423,7 @@ frame_68: ; case 68 call _bgimage_put ; default call zunsoft_update_and_render if GAME eq 4 - call _input_reset_sense + call @input_reset_sense$qv endif @@2_frame_delay: diff --git a/th04_main.asm b/th04_main.asm index 625998fe..28bdd1e8 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -341,10 +341,10 @@ sub_AB88 proc near push si mov _slowdown_factor, 1 call @frame_delay$qi pascal, 1 - call main_01:far ptr _input_reset_sense + call @input_reset_sense$qv loc_AB9E: - call _input_sense + call @input_sense$qv call fp_23D90 test _key_det.hi, high INPUT_CANCEL jz short loc_ABBA @@ -396,7 +396,7 @@ loc_ABBA: call _overlay1 call _overlay2 call @playfield_shake_update_and_rende$qv - call main_01:far ptr _input_reset_sense + call @input_reset_sense$qv mov ax, vsync_Count1 cmp ax, _slowdown_factor jb short loc_AC56 @@ -3543,7 +3543,7 @@ loc_E5EF: cmp [bp+var_2], 14h jl short loc_E5C2 call gaiji_putsa pascal, (20 shl 16) + 12, ds, offset gGAMEOVER, TX_WHITE - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 call @overlay_wipe$qv call main_01:sub_E67A mov ah, 0 @@ -3627,10 +3627,10 @@ var_1 = byte ptr -1 push ax push TX_GREEN call gaiji_putca - call main_01:far ptr _input_reset_sense + call @input_reset_sense$qv loc_E703: - call _input_sense + call @input_sense$qv or si, si jnz short loc_E783 mov si, _key_det @@ -3697,7 +3697,7 @@ loc_E783: mov si, _key_det loc_E787: - call main_01:far ptr _input_reset_sense + call @input_reset_sense$qv call @frame_delay$qi pascal, 1 jmp loc_E703 ; --------------------------------------------------------------------------- @@ -10480,7 +10480,7 @@ include th02/snd/snd.inc extern VECTOR2:proc extern @FRAME_DELAY$QI:proc extern MPN_FREE:proc - extern INPUT_WAIT_FOR_CHANGE:proc + extern @INPUT_WAIT_FOR_CHANGE$QI:proc extern MPN_LOAD_PALETTE_SHOW:proc extern @POLAR$QIII:proc extern VECTOR2_AT:proc @@ -10490,8 +10490,8 @@ include th02/snd/snd.inc extern @game_exit$qv:proc extern @GAME_INIT_MAIN$QNXUC:proc extern CDG_PUT_NOALPHA_8:proc - extern _input_reset_sense:proc - extern _input_sense:proc + extern @input_reset_sense$qv:proc + extern @input_sense$qv:proc extern _snd_se_reset:proc extern SND_SE_PLAY:proc extern _snd_se_update:proc diff --git a/th04_maine.asm b/th04_maine.asm index 590ca9f4..a759f242 100644 --- a/th04_maine.asm +++ b/th04_maine.asm @@ -1635,7 +1635,7 @@ loc_C0AE: loc_C0CB: call graph_putsa_fx - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 push 2 call palette_black_out pop si @@ -2587,11 +2587,11 @@ loc_C9CB: call gaiji_putca xor di, di mov [bp+@@row], 0 - call far ptr _input_reset_sense + call @input_reset_sense$qv mov [bp+var_4], 1 loc_C9F6: - call _input_sense + call @input_sense$qv cmp [bp+var_4], 0 jnz loc_CB3B test _key_det.lo, low INPUT_MOVEMENT @@ -2780,7 +2780,7 @@ loc_CB67: mov [bp+var_9], 0 loc_CB6B: - call far ptr _input_reset_sense + call @input_reset_sense$qv call @frame_delay$qi pascal, 1 jmp loc_C9F6 ; --------------------------------------------------------------------------- @@ -2792,7 +2792,7 @@ loc_CB6B: loc_CB7F: call sub_C316 - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 loc_CB89: call super_free @@ -2916,7 +2916,7 @@ include th02/snd/snd.inc extern PI_PALETTE_APPLY:proc extern PI_PUT_8:proc extern PI_LOAD:proc - extern INPUT_WAIT_FOR_CHANGE:proc + extern @INPUT_WAIT_FOR_CHANGE$QI:proc extern @POLAR$QIII:proc extern SND_KAJA_INTERRUPT:proc extern SND_DELAY_UNTIL_MEASURE:proc @@ -2924,8 +2924,8 @@ include th02/snd/snd.inc extern SND_LOAD:proc extern GRAPH_PUTSA_FX:proc extern CDG_PUT_8:proc - extern _input_reset_sense:proc - extern _input_sense:proc + extern @input_reset_sense$qv:proc + extern @input_sense$qv:proc extern _bgimage_snap:proc extern _bgimage_free:proc extern BGIMAGE_PUT_RECT_16:proc diff --git a/th04_op.asm b/th04_op.asm index 0be82c3a..26717a7d 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -407,7 +407,7 @@ loc_CADA: call palette_black_in loc_CAE4: - call far ptr _input_reset_sense + call @input_reset_sense$qv call @frame_delay$qi pascal, 1 test _key_det.hi, high INPUT_OK jnz short loc_CB58 @@ -456,7 +456,7 @@ loc_CB58: call palette_black_in loc_CBB3: - call far ptr _input_reset_sense + call @input_reset_sense$qv call @frame_delay$qi pascal, 1 cmp _key_det, INPUT_NONE jnz short loc_CBB3 @@ -782,8 +782,8 @@ include th02/snd/snd.inc extern SND_KAJA_INTERRUPT:proc extern SND_DELAY_UNTIL_MEASURE:proc extern SND_LOAD:proc - extern _input_reset_sense:proc - extern _input_sense:proc + extern @input_reset_sense$qv:proc + extern @input_sense$qv:proc extern SND_SE_PLAY:proc extern _snd_se_update:proc extern _bgimage_snap:proc diff --git a/th05/hardware/inp_h_w.cpp b/th05/hardware/inp_h_w.cpp index 954a6f25..8a99b1d0 100644 --- a/th05/hardware/inp_h_w.cpp +++ b/th05/hardware/inp_h_w.cpp @@ -3,9 +3,7 @@ #include "platform.h" #include "master.hpp" #include "platform/x86real/flags.hpp" -extern "C" { #include "th05/hardware/input.h" -} #pragma option -k- diff --git a/th05/m_char.cpp b/th05/m_char.cpp index 20a0d816..f0cda846 100644 --- a/th05/m_char.cpp +++ b/th05/m_char.cpp @@ -20,8 +20,11 @@ extern "C" { #include "th04/sprites/op_cdg.hpp" #include "th05/resident.hpp" #include "th05/op/op.hpp" +} #include "th05/hardware/input.h" +extern "C" { #include "th05/formats/pi.hpp" +} #pragma option -a2 @@ -253,5 +256,3 @@ bool16 near playchar_menu(void) frame_delay(1); } } - -} diff --git a/th05/op/start.cpp b/th05/op/start.cpp index 5d414bf8..94a2e9a4 100644 --- a/th05/op/start.cpp +++ b/th05/op/start.cpp @@ -15,8 +15,8 @@ extern "C" { #include "th04/snd/snd.h" #include "th05/formats/pi.hpp" #include "th05/op/op.hpp" -#include "th05/hardware/input.h" } +#include "th05/hardware/input.h" #include "th04/op/start.hpp" #define resident_reset_last_highest_and_stage_scores() \ diff --git a/th05_main.asm b/th05_main.asm index fc76bddd..bf492f65 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -382,10 +382,10 @@ sub_AEA6 proc near mov bp, sp mov _slowdown_factor, 1 call @frame_delay$qi pascal, 1 - call far ptr _input_reset_sense + call @input_reset_sense$qv loc_AEBB: - call _input_sense + call @input_sense$qv call fp_2300E test _key_det.hi, high INPUT_CANCEL jz short loc_AED7 @@ -443,7 +443,7 @@ loc_AF2D: call _overlay1 call _overlay2 call @playfield_shake_update_and_rende$qv - call far ptr _input_reset_sense + call @input_reset_sense$qv mov al, _slowdown_caused_by_bullets mov ah, 0 push ax @@ -3570,7 +3570,7 @@ loc_FA18: cmp [bp+var_2], 14h jl short loc_F9EB call gaiji_putsa pascal, (20 shl 16) + 12, ds offset gGAMEOVER, TX_WHITE - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 call @overlay_wipe$qv call sub_FAA3 mov ah, 0 @@ -3656,7 +3656,7 @@ var_1 = byte ptr -1 call gaiji_putca loc_FB27: - call _input_reset_sense_held + call @input_reset_sense_held$qv or si, si jnz short loc_FBA7 mov si, _key_det @@ -7249,10 +7249,10 @@ include th02/snd/snd.inc extern SND_LOAD:proc extern SND_KAJA_INTERRUPT:proc extern @GAME_INIT_MAIN$QNXUC:proc - extern _input_reset_sense:proc - extern _input_sense:proc - extern _input_reset_sense_held:proc - extern INPUT_WAIT_FOR_CHANGE:proc + extern @input_reset_sense$qv:proc + extern @input_sense$qv:proc + extern @input_reset_sense_held$qv:proc + extern @INPUT_WAIT_FOR_CHANGE$QI:proc extern @FRAME_DELAY$QI:proc extern CDG_LOAD_ALL_NOALPHA:proc extern CDG_LOAD_ALL:proc diff --git a/th05_maine.asm b/th05_maine.asm index dcfd31a8..9c49053c 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -2108,7 +2108,7 @@ loc_C3AA: mov [bp+var_2], 1 loc_C3CD: - call _input_reset_sense_held + call @input_reset_sense_held$qv cmp [bp+var_2], 0 jnz loc_C58A test _key_det.lo, low INPUT_MOVEMENT @@ -2341,7 +2341,7 @@ loc_C5BE: loc_C5C3: call sub_B6A3 - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 loc_C5CD: call _bgimage_free @@ -3597,7 +3597,7 @@ public @verdict_animate$qv call sub_CA9B call @frame_delay$qi pascal, 64 call sub_D16F - call input_wait_for_change pascal, 0 + call @input_wait_for_change$qi pascal, 0 push 2 call palette_black_out pop bp @@ -5940,7 +5940,7 @@ loc_E6B4: mov [bp+var_4], 0 loc_E6DB: - call _input_reset_sense_held + call @input_reset_sense_held$qv cmp si, 256 jz short loc_E6EC cmp si, 257 @@ -6091,8 +6091,8 @@ include th02/snd/snd.inc extern PI_PUT_QUARTER_8:proc extern PI_PALETTE_APPLY:proc extern PI_FREE:proc - extern _input_reset_sense_held:proc - extern INPUT_WAIT_FOR_CHANGE:proc + extern @input_reset_sense_held$qv:proc + extern @INPUT_WAIT_FOR_CHANGE$QI:proc extern _snd_bgm_measure:proc extern @FRAME_DELAY$QI:proc extern CDG_LOAD_ALL_NOALPHA:proc diff --git a/th05_op.asm b/th05_op.asm index 951275a0..393f9616 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -369,7 +369,7 @@ loc_CC9F: call palette_black_in pascal, 1 loc_CCA9: - call _input_reset_sense_held + call @input_reset_sense_held$qv call @frame_delay$qi pascal, 1 test _key_det.hi, high INPUT_OK jnz short loc_CD17 @@ -413,7 +413,7 @@ loc_CD17: call palette_black_in pascal, 1 loc_CD64: - call _input_reset_sense_held + call @input_reset_sense_held$qv call @frame_delay$qi pascal, 1 cmp _key_det, INPUT_NONE jnz short loc_CD64 @@ -445,7 +445,7 @@ include th02/snd/snd.inc extern PI_PUT_8:proc extern PI_PALETTE_APPLY:proc extern PI_FREE:proc - extern _input_reset_sense_held:proc + extern @input_reset_sense_held$qv:proc extern SND_DELAY_UNTIL_MEASURE:proc extern @FRAME_DELAY$QI:proc SHARED ends