From a2358bef47fa83a0e6d47cd6b6428a341efe8c90 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sat, 2 Apr 2022 06:19:18 +0200 Subject: [PATCH] [Maintenance] Remove `extern "C"` from `x86real.h` and `decomp.hpp` One of those per delivery now, eh? Part of P0189, funded by Arandui and Lmocinemod. --- Pipeline/grzview.cpp | 14 +++++++------- decomp.hpp | 4 ---- th01/end/pic.cpp | 4 ++++ th01/formats/grz.cpp | 2 +- th01/fuuin_02.cpp | 2 +- th01/fuuin_04.cpp | 5 ++++- th01/fuuin_11.cpp | 4 ++-- th01/hardware/egcrect.cpp | 2 ++ th01/hardware/egcstart.cpp | 4 +++- th01/main/boss/b20m.cpp | 2 +- th01/main/hud/hud.cpp | 3 +-- th01/main/particle.cpp | 2 +- th01/main/stage/stageobj.cpp | 2 +- th01/main/stage/timer.cpp | 2 +- th01/main_010.cpp | 2 +- th01/main_07.cpp | 4 ++-- th01/main_13.cpp | 2 +- th01/main_19.cpp | 2 +- th01/main_23.cpp | 2 +- th01/main_25.cpp | 5 ++--- th01/main_32.cpp | 4 ++-- th01/op_01.cpp | 2 +- th01/op_07.cpp | 4 ++-- th01/zunsoft.cpp | 3 --- th02/core/initop.cpp | 2 +- th02/formats/pi_put.cpp | 2 +- th02/hardware/grp_rect.cpp | 2 +- th02/hardware/grppsafx.cpp | 2 +- th02/hardware/input_s.cpp | 2 +- th02/maine_05.cpp | 5 ++--- th02/op_01.cpp | 2 +- th02/op_03.cpp | 2 +- th02/op_05.cpp | 2 +- th02/op_06.cpp | 2 +- th02/snd/delaymea.cpp | 2 +- th02/snd/kajaint.cpp | 2 +- th02/snd/load.cpp | 2 +- th02/snd/se.cpp | 2 +- th02_maine.asm | 12 ++++++------ th03/core/exitmain.cpp | 2 +- th03/core/initop.cpp | 2 +- th03/formats/mrs.cpp | 3 --- th03/formats/pi_put_i.cpp | 2 +- th03/formats/pi_put_q.cpp | 2 +- th03/hardware/inp_wait.cpp | 2 +- th03/hardware/input_s.cpp | 2 +- th03/hiscore/regist.cpp | 2 +- th03/snd/delaymea.cpp | 2 +- th03/sprite16.cpp | 2 +- th04/formats/cdg_p_na.cpp | 4 ++-- th04/hardware/bgimage.cpp | 2 +- th04/hardware/egcrect.cpp | 2 +- th04/m_char.cpp | 2 +- th04/main/gather.cpp | 2 +- th04/main/scrolly3.cpp | 2 +- th04/maine011.cpp | 2 -- th04/snd/detmodes.cpp | 2 +- th04/snd/load.cpp | 2 +- th04_maine.asm | 6 +++--- th05/formats/cdg_p_nc.cpp | 4 ++-- th05/formats/cfg_lres.cpp | 2 +- th05/formats/pi_asm_1.asm | 10 +++++----- th05/formats/pi_asm_2.asm | 6 +++--- th05/formats/pi_cpp_1.cpp | 5 ++--- th05/formats/pi_cpp_2.cpp | 5 ++--- th05/hardware/inp_h_w.cpp | 2 +- th05/m_char.cpp | 2 +- th05/main/boss/render.cpp | 2 +- th05/maine011.cpp | 2 -- th05/op/piano_c.cpp | 2 +- th05/snd/delaymea.cpp | 4 ++-- th05/snd/load.cpp | 2 +- th05_maine.asm | 6 +++--- x86real.h | 13 ++++++++----- 74 files changed, 117 insertions(+), 122 deletions(-) diff --git a/Pipeline/grzview.cpp b/Pipeline/grzview.cpp index 376aeb54..b6814084 100644 --- a/Pipeline/grzview.cpp +++ b/Pipeline/grzview.cpp @@ -1,11 +1,11 @@ +#include +#include +#include "platform.h" +#include "x86real.h" +#include "pc98.h" +#include "planar.h" +#include "master.hpp" extern "C" { - #include - #include - #include "platform.h" - #include "x86real.h" - #include "pc98.h" - #include "planar.h" - #include "master.hpp" #include "th01/formats/grz.h" void grcg_setcolor_rmw(int col) diff --git a/decomp.hpp b/decomp.hpp index d4d2f24f..d14c60ba 100644 --- a/decomp.hpp +++ b/decomp.hpp @@ -27,8 +27,6 @@ out dx, ax; \ } -} // extern "C" was a mistake - // Should just be unwrapped wherever it appears. Code that directly uses T // would be much cleaner. template union StupidBytewiseWrapperAround { @@ -139,8 +137,6 @@ inline void poked_eax(Decomp_GS *sgm, Decomp_DI *off, uint8_t op) { #endif // ------------------------------------ -extern "C" { - // 32-bit ASM instructions not supported by Turbo C++ 4.0J's built-in // assembler. Makes no sense to compile with `#pragma inline` (and thus, // require a 16-bit TASM) just for those. diff --git a/th01/end/pic.cpp b/th01/end/pic.cpp index f192d9e4..630bdf7a 100644 --- a/th01/end/pic.cpp +++ b/th01/end/pic.cpp @@ -1,5 +1,6 @@ #pragma option -O- +extern "C" { #include "th01/end/pic.hpp" void pascal end_pics_load_palette_show(const char *fn) @@ -7,6 +8,7 @@ void pascal end_pics_load_palette_show(const char *fn) graph_accesspage_func(1); grp_put_palette_show(fn); } +} // Avoid symbol duplication... #define egc_start_copy egc_start_copy_1 @@ -19,6 +21,7 @@ static const screen_y_t PIC_TOP = ((RES_Y / 2) - (PIC_H / 2)); static const pixel_t PIC_VRAM_W = (PIC_W / BYTE_DOTS); +extern "C" { void end_pic_show(int quarter) { egc_start_copy(); @@ -45,5 +48,6 @@ void end_pic_show(int quarter) } egc_off(); } +} #pragma option -O. diff --git a/th01/formats/grz.cpp b/th01/formats/grz.cpp index 3fef161f..a71fa15f 100644 --- a/th01/formats/grz.cpp +++ b/th01/formats/grz.cpp @@ -1,6 +1,5 @@ #pragma option -zCPTN_GRP_GRZ -extern "C" { #include #include #include "platform.h" @@ -8,6 +7,7 @@ extern "C" { #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th01/hardware/graph.h" #include "th01/formats/grz.h" diff --git a/th01/fuuin_02.cpp b/th01/fuuin_02.cpp index e418b41c..a0d5796a 100644 --- a/th01/fuuin_02.cpp +++ b/th01/fuuin_02.cpp @@ -5,7 +5,6 @@ #pragma option -O- -1 -Z- -extern "C" { #include #include #include @@ -18,6 +17,7 @@ extern "C" { #include "twobyte.h" #include "master.hpp" #include "th01/rank.h" +extern "C" { #include "th01/hardware/graph.h" #include "th01/hardware/input.hpp" #include "th01/hiscore/scoredat.hpp" diff --git a/th01/fuuin_04.cpp b/th01/fuuin_04.cpp index 458cc600..1efaedb1 100644 --- a/th01/fuuin_04.cpp +++ b/th01/fuuin_04.cpp @@ -5,16 +5,17 @@ #pragma option -1 -Z- -extern "C" { #include "platform.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th01/formats/grp.h" #include "th01/hardware/graph.h" #include "th01/hardware/palette.h" #include "th01/hardware/vsync.h" #include "th01/end/type.h" +} #define TYPE_DELAY 3 #define TYPE_FX (15 | FX_WEIGHT_NORMAL) @@ -25,6 +26,8 @@ extern "C" { inline void optimization_barrier() {} +extern "C" { + // Special FUUIN.EXE version of frame_delay() that resets [vsync_frame] first. void frame_delay(unsigned int frames) { diff --git a/th01/fuuin_11.cpp b/th01/fuuin_11.cpp index 4e192210..e6d12c54 100644 --- a/th01/fuuin_11.cpp +++ b/th01/fuuin_11.cpp @@ -5,12 +5,12 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th01/hardware/graph.h" +} #include "th01/hardware/egcrect.cpp" -} diff --git a/th01/hardware/egcrect.cpp b/th01/hardware/egcrect.cpp index 1fef927b..5e6a975f 100644 --- a/th01/hardware/egcrect.cpp +++ b/th01/hardware/egcrect.cpp @@ -1,5 +1,6 @@ #include "th01/hardware/egcstart.cpp" +extern "C" { void egc_copy_rect_1_to_0_16(screen_x_t x, vram_y_t y, pixel_t w, pixel_t h) { register screen_x_t x_end = x; @@ -23,3 +24,4 @@ void egc_copy_rect_1_to_0_16(screen_x_t x, vram_y_t y, pixel_t w, pixel_t h) } egc_off(); } +} diff --git a/th01/hardware/egcstart.cpp b/th01/hardware/egcstart.cpp index c3fca280..8f2d8783 100644 --- a/th01/hardware/egcstart.cpp +++ b/th01/hardware/egcstart.cpp @@ -1,7 +1,9 @@ #include "decomp.hpp" +extern "C" { #include "th01/hardware/egc.h" +} -void pascal egc_start_copy(void) +void egc_start_copy(void) { egc_on(); egc_setup_copy(); diff --git a/th01/main/boss/b20m.cpp b/th01/main/boss/b20m.cpp index 4aa69135..60eee151 100644 --- a/th01/main/boss/b20m.cpp +++ b/th01/main/boss/b20m.cpp @@ -1,7 +1,6 @@ /// Makai Stage 20 Boss - Sariel /// ---------------------------- -extern "C" { #include #include #include @@ -17,6 +16,7 @@ extern "C" { #include "th01/math/overlap.hpp" #include "th01/math/polar.hpp" #include "th01/math/subpixel.hpp" +extern "C" { #include "th01/math/vector.hpp" #include "th01/hardware/frmdelay.h" #include "th01/hardware/graph.h" diff --git a/th01/main/hud/hud.cpp b/th01/main/hud/hud.cpp index 67ef1499..d097112c 100644 --- a/th01/main/hud/hud.cpp +++ b/th01/main/hud/hud.cpp @@ -4,6 +4,7 @@ #include "th01/common.h" #include "th01/resident.hpp" #include "th01/v_colors.hpp" +extern "C" { #include "th01/hardware/graph.h" #include "th01/main/vars.hpp" #include "th01/formats/ptn.hpp" @@ -502,5 +503,3 @@ void hud_bg_snap_and_put(void) hud_score_and_cardcombo_render(); fwnum_force_rerender = false; } - -extern "C" { diff --git a/th01/main/particle.cpp b/th01/main/particle.cpp index 0eafaddf..420f4f50 100644 --- a/th01/main/particle.cpp +++ b/th01/main/particle.cpp @@ -1,6 +1,6 @@ -extern "C" { #include "master.hpp" #include "x86real.h" +extern "C" { #include "th01/math/overlap.hpp" #include "th01/hardware/egc.h" } diff --git a/th01/main/stage/stageobj.cpp b/th01/main/stage/stageobj.cpp index 6deed96d..ded2caa4 100644 --- a/th01/main/stage/stageobj.cpp +++ b/th01/main/stage/stageobj.cpp @@ -1,4 +1,3 @@ -extern "C" { #include #include #include "platform.h" @@ -7,6 +6,7 @@ extern "C" { #include "planar.h" #include "master.hpp" #include "th01/common.h" +extern "C" { #include "th01/main/playfld.hpp" #include "th01/formats/ptn.hpp" #include "th01/formats/pf.hpp" diff --git a/th01/main/stage/timer.cpp b/th01/main/stage/timer.cpp index 38d40244..607a9a4a 100644 --- a/th01/main/stage/timer.cpp +++ b/th01/main/stage/timer.cpp @@ -1,4 +1,3 @@ -extern "C" { #include #include "platform.h" #include "x86real.h" @@ -9,6 +8,7 @@ extern "C" { #include "th01/common.h" #include "th01/resident.hpp" #include "th01/v_colors.hpp" +extern "C" { #include "th01/hardware/egc.h" #include "th01/hardware/graph.h" #include "th01/hardware/frmdelay.h" diff --git a/th01/main_010.cpp b/th01/main_010.cpp index 4fef5ab5..a929000e 100644 --- a/th01/main_010.cpp +++ b/th01/main_010.cpp @@ -3,7 +3,6 @@ * 1st part of code segment #1 of TH01's REIIDEN.EXE */ -extern "C" { #include #include #include @@ -15,6 +14,7 @@ extern "C" { #include "master.hpp" #include "pc98kbd.h" #include "twobyte.h" +extern "C" { #include "th01/hardware/frmdelay.h" #include "th01/hardware/graph.h" #include "th01/hardware/input.hpp" diff --git a/th01/main_07.cpp b/th01/main_07.cpp index f3e8f641..6dcac5f4 100644 --- a/th01/main_07.cpp +++ b/th01/main_07.cpp @@ -5,13 +5,13 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th01/hardware/graph.h" +} #include "th01/hardware/egcrect.cpp" #include "th01/formats/ptn_snap.cpp" -} diff --git a/th01/main_13.cpp b/th01/main_13.cpp index 507ed01d..93c3f4a9 100644 --- a/th01/main_13.cpp +++ b/th01/main_13.cpp @@ -5,13 +5,13 @@ #pragma option -2 -Z- -extern "C" { #include #include "platform.h" #include "pc98.h" #include "planar.h" #include "decomp.hpp" #include "master.hpp" +extern "C" { #include "th01/hardware/egc.h" #include "th01/hardware/graph.h" diff --git a/th01/main_19.cpp b/th01/main_19.cpp index 288ce92e..cd92dc12 100644 --- a/th01/main_19.cpp +++ b/th01/main_19.cpp @@ -5,7 +5,6 @@ #pragma option -d -extern "C" { #include #include #include @@ -17,6 +16,7 @@ extern "C" { #include "twobyte.h" #include "master.hpp" #include "th01/rank.h" +extern "C" { #include "th01/formats/grp.h" #include "th01/hardware/palette.h" #include "th01/hardware/input.hpp" diff --git a/th01/main_23.cpp b/th01/main_23.cpp index f5a73642..715a20de 100644 --- a/th01/main_23.cpp +++ b/th01/main_23.cpp @@ -3,10 +3,10 @@ * Code segment #23 of TH01's REIIDEN.EXE */ -extern "C" { #include "platform.h" #include "x86real.h" #include "master.hpp" +extern "C" { #include "th01/formats/grc.cpp" #include "th01/hardware/grcg8x8m.cpp" #include "th01/hardware/egc.h" diff --git a/th01/main_25.cpp b/th01/main_25.cpp index 8b2dece5..d69e5e6d 100644 --- a/th01/main_25.cpp +++ b/th01/main_25.cpp @@ -3,13 +3,12 @@ * Code segment #25 of TH01's REIIDEN.EXE */ -extern "C" { #include "platform.h" #include "pc98.h" #include "planar.h" +extern "C" { #include "th01/hardware/grppsafx.h" #include "th01/hardware/grppfnfx.cpp" -#include "th01/main/hud/hud.cpp" - } +#include "th01/main/hud/hud.cpp" diff --git a/th01/main_32.cpp b/th01/main_32.cpp index 0dd5a646..76c8f057 100644 --- a/th01/main_32.cpp +++ b/th01/main_32.cpp @@ -3,7 +3,6 @@ * Code segment #32 of TH01's REIIDEN.EXE */ -extern "C" { #include #include "platform.h" #include "x86real.h" @@ -11,6 +10,7 @@ extern "C" { #include "planar.h" #include "master.hpp" #include "th01/v_colors.hpp" +extern "C" { #include "th01/hardware/palette.h" #include "th01/hardware/graph.h" #include "th01/snd/mdrv2.h" @@ -19,8 +19,8 @@ extern "C" { #include "th01/main/debug.hpp" #include "th01/main/vars.hpp" #include "th01/main/player/orb.hpp" -#include "th01/main/player/shot.hpp" } +#include "th01/main/player/shot.hpp" #include "th01/main/hud/hud.hpp" #include "th01/main/boss/palette.hpp" diff --git a/th01/op_01.cpp b/th01/op_01.cpp index f8cf7638..50313125 100644 --- a/th01/op_01.cpp +++ b/th01/op_01.cpp @@ -3,7 +3,6 @@ * Code segment #1 of TH01's OP.EXE */ -extern "C" { #include #include #include "platform.h" @@ -13,6 +12,7 @@ extern "C" { #include "pc98kbd.h" #include "master.hpp" #include "th01/rank.h" +extern "C" { #include "th01/hardware/egc.h" #include "th01/hardware/frmdelay.h" #include "th01/hardware/graph.h" diff --git a/th01/op_07.cpp b/th01/op_07.cpp index a6669132..21af30e3 100644 --- a/th01/op_07.cpp +++ b/th01/op_07.cpp @@ -5,13 +5,13 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th01/hardware/graph.h" +} #include "th01/hardware/egcrect.cpp" #include "th01/formats/ptn_snap.cpp" -} diff --git a/th01/zunsoft.cpp b/th01/zunsoft.cpp index 837567af..57b3b725 100644 --- a/th01/zunsoft.cpp +++ b/th01/zunsoft.cpp @@ -3,7 +3,6 @@ * ZUN Soft logo used in TH01, TH02 and TH03 */ -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" @@ -11,8 +10,6 @@ extern "C" { #include "master.hpp" #include "th01/hardware/egc.h" #include "th01/math/polar.hpp" -#include "th01/math/vector.hpp" -} #define CIRCLE_COUNT 4 #define STAR_COUNT 50 diff --git a/th02/core/initop.cpp b/th02/core/initop.cpp index b72f79a0..7351ec88 100644 --- a/th02/core/initop.cpp +++ b/th02/core/initop.cpp @@ -1,9 +1,9 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "x86real.h" #include "master.hpp" +extern "C" { #include "th01/hardware/vplanset.h" #include "th02/shiftjis/fns.hpp" #include "th02/mem.h" diff --git a/th02/formats/pi_put.cpp b/th02/formats/pi_put.cpp index fb808876..d8d2655d 100644 --- a/th02/formats/pi_put.cpp +++ b/th02/formats/pi_put.cpp @@ -1,11 +1,11 @@ #pragma option -zCSHARED -3 -extern "C" { #include #include "platform.h" #include "x86real.h" #include "pc98.h" #include "master.hpp" +extern "C" { #include "th02/formats/pi.h" void DEFCONV pi_palette_apply(int slot) diff --git a/th02/hardware/grp_rect.cpp b/th02/hardware/grp_rect.cpp index d9708eeb..e3d8224a 100644 --- a/th02/hardware/grp_rect.cpp +++ b/th02/hardware/grp_rect.cpp @@ -1,11 +1,11 @@ #pragma option -zCSHARED -3 -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th02/hardware/grp_rect.h" void pascal graph_copy_rect_1_to_0_16( diff --git a/th02/hardware/grppsafx.cpp b/th02/hardware/grppsafx.cpp index e9ba5bca..d12ed065 100644 --- a/th02/hardware/grppsafx.cpp +++ b/th02/hardware/grppsafx.cpp @@ -1,6 +1,5 @@ #pragma option -zCSHARED -3 -extern "C" { #include #include #include "platform.h" @@ -8,6 +7,7 @@ extern "C" { #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th01/hardware/grppsafx.h" #include "th01/hardware/grppsafx.cpp" diff --git a/th02/hardware/input_s.cpp b/th02/hardware/input_s.cpp index 1a03e4c5..a0d59aa8 100644 --- a/th02/hardware/input_s.cpp +++ b/th02/hardware/input_s.cpp @@ -1,9 +1,9 @@ #pragma option -WX -zCSHARED -k- -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98kbd.h" +extern "C" { #include "th02/hardware/input.hpp" inline uint8_t keygroup_sense(uint8_t group) { diff --git a/th02/maine_05.cpp b/th02/maine_05.cpp index bcdc2ccf..dd54d1b9 100644 --- a/th02/maine_05.cpp +++ b/th02/maine_05.cpp @@ -3,7 +3,6 @@ * Code segment #5 of TH02's MAINE.EXE */ -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" @@ -11,7 +10,9 @@ extern "C" { #include "master.hpp" #include "th01/math/polar.hpp" #include "th02/math/vector.hpp" +extern "C" { #include "th02/hardware/frmdelay.h" +} void pascal near rotrect_draw(int rad, unsigned char angle) { @@ -75,5 +76,3 @@ void pascal rotrect_animate(char rot_speed, char start_angle) grcg_off(); palette_white(); } - -} diff --git a/th02/op_01.cpp b/th02/op_01.cpp index 73743c5b..5c415cb0 100644 --- a/th02/op_01.cpp +++ b/th02/op_01.cpp @@ -3,7 +3,6 @@ * Code segment #1 of TH02's OP.EXE */ -extern "C" { #include #include #include "platform.h" @@ -14,6 +13,7 @@ extern "C" { #include "libs/kaja/kaja.h" #include "th01/rank.h" #include "th01/math/clamp.hpp" +extern "C" { #include "th01/hardware/grppsafx.h" #include "th02/common.h" #include "th02/hardware/frmdelay.h" diff --git a/th02/op_03.cpp b/th02/op_03.cpp index 415a4fc7..7c205888 100644 --- a/th02/op_03.cpp +++ b/th02/op_03.cpp @@ -5,11 +5,11 @@ #pragma codestring "\x00" -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "master.hpp" +extern "C" { #include "th02/hardware/frmdelay.h" #include "th02/formats/pi.h" #include "th02/snd/snd.h" diff --git a/th02/op_05.cpp b/th02/op_05.cpp index b309ac2b..a4bf6540 100644 --- a/th02/op_05.cpp +++ b/th02/op_05.cpp @@ -3,13 +3,13 @@ * Code segment #5 of TH02's OP.EXE */ -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" #include "th01/math/clamp.hpp" +extern "C" { #include "th01/hardware/grppsafx.h" #include "th02/common.h" #include "th02/resident.hpp" diff --git a/th02/op_06.cpp b/th02/op_06.cpp index a2aeb855..f9e71e1e 100644 --- a/th02/op_06.cpp +++ b/th02/op_06.cpp @@ -3,7 +3,6 @@ * Code segment #6 of TH02's OP.EXE */ -extern "C" { #include #include "platform.h" #include "x86real.h" @@ -12,6 +11,7 @@ extern "C" { #include "master.hpp" #include "libs/kaja/kaja.h" #include "th01/math/polar.hpp" +extern "C" { #include "th01/hardware/grppsafx.h" #include "th02/math/vector.hpp" #include "th02/hardware/frmdelay.h" diff --git a/th02/snd/delaymea.cpp b/th02/snd/delaymea.cpp index 53537354..be3a6596 100644 --- a/th02/snd/delaymea.cpp +++ b/th02/snd/delaymea.cpp @@ -1,9 +1,9 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" +extern "C" { #include "th02/hardware/frmdelay.h" #include "th02/snd/snd.h" #include "th02/snd/measure.hpp" diff --git a/th02/snd/kajaint.cpp b/th02/snd/kajaint.cpp index 36292f00..68c682d2 100644 --- a/th02/snd/kajaint.cpp +++ b/th02/snd/kajaint.cpp @@ -4,10 +4,10 @@ #pragma option -zCSHARED #endif -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" +extern "C" { #if (GAME >= 4) #include "th04/snd/snd.h" #else diff --git a/th02/snd/load.cpp b/th02/snd/load.cpp index 3fe26fd7..68813473 100644 --- a/th02/snd/load.cpp +++ b/th02/snd/load.cpp @@ -1,9 +1,9 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" +extern "C" { #include "th02/snd/snd.h" extern char snd_load_fn[SND_FN_LEN]; diff --git a/th02/snd/se.cpp b/th02/snd/se.cpp index d34944db..7d4778ce 100644 --- a/th02/snd/se.cpp +++ b/th02/snd/se.cpp @@ -1,10 +1,10 @@ #pragma option -k- -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" #include "th02/snd/se_impl.hpp" +extern "C" { #if (GAME >= 4) #include "master.hpp" #include "th04/snd/snd.h" diff --git a/th02_maine.asm b/th02_maine.asm index 5cca6672..4b138cfe 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -604,7 +604,7 @@ loc_98DB: loc_98DE: mov si, ax mov di, 1F54h - call egc_start_copy + call @egc_start_copy$qv mov [bp+var_2], 0 jmp short loc_9930 ; --------------------------------------------------------------------------- @@ -698,7 +698,7 @@ loc_996B: shl dx, 4 add ax, dx mov di, ax - call egc_start_copy + call @egc_start_copy$qv mov [bp+var_2], 0 jmp short loc_99D2 ; --------------------------------------------------------------------------- @@ -787,7 +787,7 @@ loc_9A0D: mov ax, [bp+arg_2] imul ax, 50h add si, ax - call egc_start_copy + call @egc_start_copy$qv mov ax, [bp+arg_2] mov [bp+var_2], ax jmp short loc_9A68 @@ -2234,7 +2234,7 @@ arg_4 = word ptr 8 mov bp, sp push [bp+arg_4] push [bp+arg_0] - call rotrect_animate + call @rotrect_animate$qcc push 200064h push [bp+arg_2] call sub_9942 @@ -2957,8 +2957,8 @@ maine_04_TEXT ends ; =========================================================================== maine_05_TEXT segment byte public 'CODE' use16 - extern EGC_START_COPY:proc - extern ROTRECT_ANIMATE:proc + extern @egc_start_copy$qv:proc + extern @ROTRECT_ANIMATE$QCC:proc maine_05_TEXT ends .data diff --git a/th03/core/exitmain.cpp b/th03/core/exitmain.cpp index 5b43417f..5c53a915 100644 --- a/th03/core/exitmain.cpp +++ b/th03/core/exitmain.cpp @@ -1,10 +1,10 @@ #pragma option -zCSHARED -Z -extern "C" { #include #include "platform.h" #include "x86real.h" #include "master.hpp" +extern "C" { #include "th03/core/initexit.h" } diff --git a/th03/core/initop.cpp b/th03/core/initop.cpp index 70a984d6..72347d30 100644 --- a/th03/core/initop.cpp +++ b/th03/core/initop.cpp @@ -1,10 +1,10 @@ #pragma option -3 -extern "C" { #include #include "platform.h" #include "x86real.h" #include "master.hpp" +extern "C" { #include "th01/hardware/vplanset.h" #include "th03/core/initexit.h" diff --git a/th03/formats/mrs.cpp b/th03/formats/mrs.cpp index b4cb8657..3a6f2c70 100644 --- a/th03/formats/mrs.cpp +++ b/th03/formats/mrs.cpp @@ -1,6 +1,5 @@ #pragma option -zCSHARED -3 -extern "C" { #include #include "platform.h" #include "pc98.h" @@ -8,8 +7,6 @@ extern "C" { #include "decomp.hpp" #include "master.hpp" #include "th03/formats/hfliplut.h" -} - #include "th03/formats/mrs.hpp" #undef grcg_off diff --git a/th03/formats/pi_put_i.cpp b/th03/formats/pi_put_i.cpp index 71b57a83..02c3f0a2 100644 --- a/th03/formats/pi_put_i.cpp +++ b/th03/formats/pi_put_i.cpp @@ -1,11 +1,11 @@ #pragma option -zCSHARED -3 -Z -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th03/formats/pi.hpp" void pascal pi_put_interlace_8(screen_x_t left, vram_y_t top, int slot) diff --git a/th03/formats/pi_put_q.cpp b/th03/formats/pi_put_q.cpp index 7520bc86..e155c328 100644 --- a/th03/formats/pi_put_q.cpp +++ b/th03/formats/pi_put_q.cpp @@ -1,11 +1,11 @@ #pragma option -zCSHARED -3 -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th03/formats/pi.hpp" void pascal pi_put_quarter_8( diff --git a/th03/hardware/inp_wait.cpp b/th03/hardware/inp_wait.cpp index 922f88b8..9572cc4c 100644 --- a/th03/hardware/inp_wait.cpp +++ b/th03/hardware/inp_wait.cpp @@ -1,10 +1,10 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "x86real.h" #include "master.hpp" #include "libs/kaja/kaja.h" +extern "C" { #include "th03/hardware/input.h" #include "th03/snd/snd.h" #include "th02/snd/measure.hpp" diff --git a/th03/hardware/input_s.cpp b/th03/hardware/input_s.cpp index 42c4c30c..d2ded8c2 100644 --- a/th03/hardware/input_s.cpp +++ b/th03/hardware/input_s.cpp @@ -1,11 +1,11 @@ #pragma option -WX -zCSHARED -k- -extern "C" { #include "platform.h" #include "x86real.h" #include "decomp.hpp" #include "pc98kbd.h" #include "master.hpp" +extern "C" { #include "th03/hardware/input.h" void input_reset_sense_key_held(void) diff --git a/th03/hiscore/regist.cpp b/th03/hiscore/regist.cpp index 0e280704..d79f9acb 100644 --- a/th03/hiscore/regist.cpp +++ b/th03/hiscore/regist.cpp @@ -1,12 +1,12 @@ #pragma option -zPgroup_01 -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" #include "th01/rank.h" +extern "C" { #include "th01/hardware/grppsafx.h" #include "th02/hardware/frmdelay.h" #include "th03/common.h" diff --git a/th03/snd/delaymea.cpp b/th03/snd/delaymea.cpp index 16cf04b8..1aa4dcb2 100644 --- a/th03/snd/delaymea.cpp +++ b/th03/snd/delaymea.cpp @@ -1,9 +1,9 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" +extern "C" { #include "th02/hardware/frmdelay.h" #if (GAME >= 4) #include "th04/snd/snd.h" diff --git a/th03/sprite16.cpp b/th03/sprite16.cpp index f774d3c4..a58f5e26 100644 --- a/th03/sprite16.cpp +++ b/th03/sprite16.cpp @@ -5,7 +5,6 @@ #pragma option -zCSHARED -k- -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" @@ -13,6 +12,7 @@ extern "C" { #include "decomp.hpp" #include "master.hpp" #include "libs/sprite16/sprite16.h" +extern "C" { #include "th03/sprite16.hpp" void pascal sprite16_sprites_commit(void) diff --git a/th04/formats/cdg_p_na.cpp b/th04/formats/cdg_p_na.cpp index b52f3da5..cbd18f08 100644 --- a/th04/formats/cdg_p_na.cpp +++ b/th04/formats/cdg_p_na.cpp @@ -1,14 +1,14 @@ #pragma option -zCSHARED_ -extern "C" { #include #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" +extern "C" { #include "th04/formats/cdg.h" -#include "th04/formats/cdg_impl.hpp" } +#include "th04/formats/cdg_impl.hpp" void pascal cdg_put_noalpha_8(screen_x_t left, vram_y_t top, int slot) { diff --git a/th04/hardware/bgimage.cpp b/th04/hardware/bgimage.cpp index c0dd797a..7617e062 100644 --- a/th04/hardware/bgimage.cpp +++ b/th04/hardware/bgimage.cpp @@ -1,6 +1,5 @@ #pragma option -zCSHARED_ -k- -extern "C" { #include #include #include "platform.h" @@ -8,6 +7,7 @@ extern "C" { #include "planar.h" #include "decomp.hpp" #include "master.hpp" +extern "C" { #include "th04/hardware/bgimage.hpp" inline void memcpy_movsd( diff --git a/th04/hardware/egcrect.cpp b/th04/hardware/egcrect.cpp index ad55faca..79d6205b 100644 --- a/th04/hardware/egcrect.cpp +++ b/th04/hardware/egcrect.cpp @@ -1,12 +1,12 @@ #pragma option -zCSHARED_ -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "decomp.hpp" #include "master.hpp" +extern "C" { #include "th01/hardware/egc.h" #define graph_accesspage_1() \ diff --git a/th04/m_char.cpp b/th04/m_char.cpp index d2e49fcc..16e1f67c 100644 --- a/th04/m_char.cpp +++ b/th04/m_char.cpp @@ -5,7 +5,6 @@ #pragma option -zCop_01_TEXT -extern "C" { #include #include "platform.h" #include "x86real.h" @@ -13,6 +12,7 @@ extern "C" { #include "planar.h" #include "master.hpp" #include "th01/rank.h" +extern "C" { #include "th02/hardware/frmdelay.h" #include "th03/formats/pi.hpp" #include "th04/common.h" diff --git a/th04/main/gather.cpp b/th04/main/gather.cpp index a5a736e9..ceab26d6 100644 --- a/th04/main/gather.cpp +++ b/th04/main/gather.cpp @@ -1,9 +1,9 @@ -extern "C" { #include "platform.h" #include "pc98.h" #include "planar.h" #include "th01/math/subpixel.hpp" #include "th04/math/motion.hpp" +extern "C" { #include "th04/math/vector.hpp" #include "th04/hardware/grcg.h" #include "th04/main/scroll.hpp" diff --git a/th04/main/scrolly3.cpp b/th04/main/scrolly3.cpp index c6247040..1ea40e16 100644 --- a/th04/main/scrolly3.cpp +++ b/th04/main/scrolly3.cpp @@ -1,10 +1,10 @@ #pragma option -k- -G -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "th01/math/subpixel.hpp" +extern "C" { #include "th04/main/scroll.hpp" #define roll(y) \ diff --git a/th04/maine011.cpp b/th04/maine011.cpp index 949360c5..61240c8d 100644 --- a/th04/maine011.cpp +++ b/th04/maine011.cpp @@ -5,6 +5,4 @@ #pragma option -zCmaine_01_TEXT -extern "C" { #include "th04/end/box.cpp" -} diff --git a/th04/snd/detmodes.cpp b/th04/snd/detmodes.cpp index 5ef9320a..7f3737c1 100644 --- a/th04/snd/detmodes.cpp +++ b/th04/snd/detmodes.cpp @@ -1,9 +1,9 @@ #pragma option -zCSHARED -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" +extern "C" { #include "th04/snd/snd.h" int pascal snd_determine_modes(int req_bgm_mode, int req_se_mode) diff --git a/th04/snd/load.cpp b/th04/snd/load.cpp index 6b44b62f..49c493d3 100644 --- a/th04/snd/load.cpp +++ b/th04/snd/load.cpp @@ -1,10 +1,10 @@ #pragma option -zCSHARED -3 -Z- -extern "C" { #include "platform.h" #include "x86real.h" #include "master.hpp" #include "libs/kaja/kaja.h" +extern "C" { #include "th04/snd/snd.h" extern char snd_load_fn[SND_FN_LEN]; diff --git a/th04_maine.asm b/th04_maine.asm index d6f39ade..ee5e210b 100644 --- a/th04_maine.asm +++ b/th04_maine.asm @@ -932,7 +932,7 @@ sub_A73B endp maine_01_TEXT ends maine_01__TEXT segment byte public 'CODE' use16 - BOX_1_TO_0_MASKED procdesc pascal near \ + @BOX_1_TO_0_MASKED$Q10BOX_MASK_T procdesc pascal near \ mask:word ; =============== S U B R O U T I N E ======================================= @@ -951,7 +951,7 @@ sub_A815 proc near ; --------------------------------------------------------------------------- loc_A827: - call box_1_to_0_masked pascal, si + call @box_1_to_0_masked$q10box_mask_t pascal, si push word_124C0 call frame_delay inc si @@ -961,7 +961,7 @@ loc_A835: jl short loc_A827 loc_A83A: - call box_1_to_0_masked pascal, 4 + call @box_1_to_0_masked$q10box_mask_t pascal, 4 call egc_off pop si pop bp diff --git a/th05/formats/cdg_p_nc.cpp b/th05/formats/cdg_p_nc.cpp index 58b4fecf..2552d587 100644 --- a/th05/formats/cdg_p_nc.cpp +++ b/th05/formats/cdg_p_nc.cpp @@ -1,14 +1,14 @@ #pragma option -zCSHARED_ -extern "C" { #include #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" +extern "C" { #include "th04/formats/cdg.h" -#include "th04/formats/cdg_impl.hpp" } +#include "th04/formats/cdg_impl.hpp" void pascal cdg_put_nocolors_8(screen_x_t left, vram_y_t top, int slot) { diff --git a/th05/formats/cfg_lres.cpp b/th05/formats/cfg_lres.cpp index d9b92c2e..2a608d70 100644 --- a/th05/formats/cfg_lres.cpp +++ b/th05/formats/cfg_lres.cpp @@ -1,12 +1,12 @@ #pragma option -k- -extern "C" { #include "platform.h" #include "x86real.h" #include "master.hpp" #include "th04/common.h" #include "th04/score.h" #include "th05/resident.hpp" +extern "C" { #include "th04/formats/cfg.hpp" resident_t __seg* near cfg_load_resident_ptr(void) diff --git a/th05/formats/pi_asm_1.asm b/th05/formats/pi_asm_1.asm index f3aba7a0..f4633797 100644 --- a/th05/formats/pi_asm_1.asm +++ b/th05/formats/pi_asm_1.asm @@ -22,10 +22,10 @@ SHARED ends SHARED_ segment word public 'CODE' use16 assume cs:g_SHARED - _pi_mask_setup_egc_and_advance procdesc near + @pi_mask_setup_egc_and_advance$qv procdesc near -public PI_PUT_MASKED_8_ROWLOOP -pi_put_masked_8_rowloop proc near +public @PI_PUT_MASKED_8_ROWLOOP$QIIIUI +@pi_put_masked_8_rowloop$qiiiui proc near ; Can't use ARG, because the function doesn't `PUSH BP`! @@stride_packed = word ptr [bp+2] @@w = word ptr [bp+4] @@ -65,7 +65,7 @@ TEMP_ROW = RES_Y sub _pi_put_masked_vram_offset, PLANE_SIZE @@next_row: - call _pi_mask_setup_egc_and_advance + call @pi_mask_setup_egc_and_advance$qv mov ax, SEG_PLANE_B mov es, ax assume es:nothing @@ -93,7 +93,7 @@ TEMP_ROW = RES_Y dec @@h jnz short @@put_row retn 8 -pi_put_masked_8_rowloop endp +@pi_put_masked_8_rowloop$qiiiui endp SHARED_ ends diff --git a/th05/formats/pi_asm_2.asm b/th05/formats/pi_asm_2.asm index 1fb80f16..0226e12f 100644 --- a/th05/formats/pi_asm_2.asm +++ b/th05/formats/pi_asm_2.asm @@ -16,8 +16,8 @@ include th03/arg_bx.inc SHARED_ segment word public 'CODE' use16 assume cs:SHARED_ -public PI_PUT_8_ROWLOOP -pi_put_8_rowloop proc pascal near +public @PI_PUT_8_ROWLOOP$QIIIUI +@pi_put_8_rowloop$qiiiui proc pascal near ; Can't use ARG, because the function doesn't `PUSH BP`! @@stride_packed = word ptr [bp+2] @@w = word ptr [bp+4] @@ -50,7 +50,7 @@ pi_put_8_rowloop proc pascal near dec @@h jnz short @@put_row retn 8 -pi_put_8_rowloop endp +@pi_put_8_rowloop$qiiiui endp public PI_PALETTE_APPLY diff --git a/th05/formats/pi_cpp_1.cpp b/th05/formats/pi_cpp_1.cpp index 4f9f5cef..071fb0da 100644 --- a/th05/formats/pi_cpp_1.cpp +++ b/th05/formats/pi_cpp_1.cpp @@ -2,13 +2,14 @@ #pragma option -zCSHARED_ -extern "C" { #include #include "platform.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th05/formats/pi.hpp" +} #include "th05/formats/pi_impl.hpp" // Additionally takes: @@ -56,5 +57,3 @@ void pascal pi_put_quarter_masked_8( } #pragma codestring "\x90" - -} diff --git a/th05/formats/pi_cpp_2.cpp b/th05/formats/pi_cpp_2.cpp index 259b23cc..b242d9c1 100644 --- a/th05/formats/pi_cpp_2.cpp +++ b/th05/formats/pi_cpp_2.cpp @@ -2,14 +2,15 @@ #pragma option -zCSHARED_ -extern "C" { #include #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" +extern "C" { #include "th05/formats/pi.hpp" +} #include "th05/formats/pi_impl.hpp" extern dots16_t near *pi_mask_ptr; @@ -107,5 +108,3 @@ void pascal pi_put_quarter_8( pi_put_quarter_impl(slot, quarter, rowloop_func); #undef rowloop_func } - -} diff --git a/th05/hardware/inp_h_w.cpp b/th05/hardware/inp_h_w.cpp index f4a91841..e92b99b5 100644 --- a/th05/hardware/inp_h_w.cpp +++ b/th05/hardware/inp_h_w.cpp @@ -1,9 +1,9 @@ #pragma option -zCSHARED_ -extern "C" { #include "platform.h" #include "decomp.hpp" #include "master.hpp" +extern "C" { #include "th05/hardware/input.h" } diff --git a/th05/m_char.cpp b/th05/m_char.cpp index 49ad90d0..69173ca2 100644 --- a/th05/m_char.cpp +++ b/th05/m_char.cpp @@ -5,13 +5,13 @@ #pragma option -zCop_01_TEXT -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" #include "planar.h" #include "master.hpp" #include "th01/rank.h" +extern "C" { #include "th02/hardware/frmdelay.h" #include "th04/formats/cdg.h" #include "th04/hardware/bgimage.hpp" diff --git a/th05/main/boss/render.cpp b/th05/main/boss/render.cpp index 48e83702..e8602584 100644 --- a/th05/main/boss/render.cpp +++ b/th05/main/boss/render.cpp @@ -7,11 +7,11 @@ #include "x86real.h" #include "pc98.h" #include "planar.h" -extern "C" { #include "decomp.hpp" #include "master.hpp" #include "th01/math/area.hpp" #include "th01/math/subpixel.hpp" +extern "C" { #include "th04/hardware/grcg.h" #include "th04/math/vector.hpp" #include "th04/math/motion.hpp" diff --git a/th05/maine011.cpp b/th05/maine011.cpp index 8975a95d..5aef2a05 100644 --- a/th05/maine011.cpp +++ b/th05/maine011.cpp @@ -5,7 +5,6 @@ #pragma option -zCmaine_01_TEXT -extern "C" { #include "th04/end/box.cpp" /// String-to-color map @@ -29,4 +28,3 @@ extern unsigned char colmap_count; /// ------------------- extern unsigned char text_col; -} diff --git a/th05/op/piano_c.cpp b/th05/op/piano_c.cpp index da9f2312..515401a2 100644 --- a/th05/op/piano_c.cpp +++ b/th05/op/piano_c.cpp @@ -1,6 +1,5 @@ #pragma option -zCSHARED_ -k- -extern "C" { #include "platform.h" #include "x86real.h" #include "pc98.h" @@ -8,6 +7,7 @@ extern "C" { #include "decomp.hpp" #include "master.hpp" #include "libs/kaja/kaja.h" +extern "C" { #include "th05/op/piano.h" #include "th05/sprites/piano_l.hpp" diff --git a/th05/snd/delaymea.cpp b/th05/snd/delaymea.cpp index 4a39acef..53903990 100644 --- a/th05/snd/delaymea.cpp +++ b/th05/snd/delaymea.cpp @@ -1,13 +1,13 @@ #pragma option -zCSHARED_ -extern "C" { #include "platform.h" #include "x86real.h" #include "libs/kaja/kaja.h" +extern "C" { #include "th02/hardware/frmdelay.h" #include "th05/snd/snd.h" -#include "th02/snd/measure.hpp" } +#include "th02/snd/measure.hpp" int snd_bgm_measure(void) { diff --git a/th05/snd/load.cpp b/th05/snd/load.cpp index 14c621ee..246b1e28 100644 --- a/th05/snd/load.cpp +++ b/th05/snd/load.cpp @@ -1,12 +1,12 @@ #pragma option -zCSHARED_ -3 -extern "C" { #include #include "platform.h" #include "x86real.h" #include "decomp.hpp" #include "master.hpp" #include "libs/kaja/kaja.h" +extern "C" { #include "th05/snd/snd.h" extern char snd_load_fn[SND_FN_LEN]; diff --git a/th05_maine.asm b/th05_maine.asm index b29df47e..67cfa160 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -524,7 +524,7 @@ sub_A826 endp maine_01_TEXT ends maine_01__TEXT segment byte public 'CODE' use16 - BOX_1_TO_0_MASKED procdesc pascal near \ + @BOX_1_TO_0_MASKED$Q10BOX_MASK_T procdesc pascal near \ mask:word ; =============== S U B R O U T I N E ======================================= @@ -544,7 +544,7 @@ sub_A8EC proc near ; --------------------------------------------------------------------------- loc_A904: - call box_1_to_0_masked pascal, si + call @box_1_to_0_masked$q10box_mask_t pascal, si push word_15008 call frame_delay inc si @@ -554,7 +554,7 @@ loc_A912: jl short loc_A904 loc_A917: - call box_1_to_0_masked pascal, 4 + call @box_1_to_0_masked$q10box_mask_t pascal, 4 call egc_off push 1 call frame_delay diff --git a/x86real.h b/x86real.h index 8ff4799a..a40fd554 100644 --- a/x86real.h +++ b/x86real.h @@ -79,14 +79,17 @@ void segread(struct SREGS *__segp); /// ---------- #ifdef __cplusplus - void interrupt (__far * getvect(int __interruptno))(...); - void setvect(int __interruptno, void interrupt (__far *__isr)(...)); + extern "C" { + void interrupt (__far * getvect(int __interruptno))(...); + void setvect(int __interruptno, void interrupt (__far *__isr)(...)); + int int86(int __intno, union REGS *__inregs, union REGS *__outregs); + } #else - void interrupt (__far * getvect(int __interruptno))(); - void setvect(int __interruptno, void interrupt(__far *__isr)()); + void interrupt (__far * getvect(int __interruptno))(); + void setvect(int __interruptno, void interrupt(__far *__isr)()); + int int86(int __intno, union REGS *__inregs, union REGS *__outregs); #endif -int int86(int __intno, union REGS *__inregs, union REGS *__outregs); /// ---------- /// Segmented memory