Skip to content

Commit

Permalink
[Maintenance] Remove extern "C" from x86real.h and decomp.hpp
Browse files Browse the repository at this point in the history
One of those per delivery now, eh?

Part of P0189, funded by Arandui and Lmocinemod.
  • Loading branch information
nmlgc committed Apr 16, 2022
1 parent 22abdd1 commit a2358be
Show file tree
Hide file tree
Showing 74 changed files with 117 additions and 122 deletions.
14 changes: 7 additions & 7 deletions Pipeline/grzview.cpp
@@ -1,11 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
#include "platform.h"
#include "x86real.h"
#include "pc98.h"
#include "planar.h"
#include "master.hpp"
extern "C" {
#include <stdio.h>
#include <stdlib.h>
#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)
Expand Down
4 changes: 0 additions & 4 deletions decomp.hpp
Expand Up @@ -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 <class T> union StupidBytewiseWrapperAround {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions th01/end/pic.cpp
@@ -1,12 +1,14 @@
#pragma option -O-

extern "C" {
#include "th01/end/pic.hpp"

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
Expand All @@ -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();
Expand All @@ -45,5 +48,6 @@ void end_pic_show(int quarter)
}
egc_off();
}
}

#pragma option -O.
2 changes: 1 addition & 1 deletion th01/formats/grz.cpp
@@ -1,13 +1,13 @@
#pragma option -zCPTN_GRP_GRZ

extern "C" {
#include <mem.h>
#include <stddef.h>
#include "platform.h"
#include "x86real.h"
#include "pc98.h"
#include "planar.h"
#include "master.hpp"
extern "C" {
#include "th01/hardware/graph.h"
#include "th01/formats/grz.h"

Expand Down
2 changes: 1 addition & 1 deletion th01/fuuin_02.cpp
Expand Up @@ -5,7 +5,6 @@

#pragma option -O- -1 -Z-

extern "C" {
#include <io.h>
#include <stdio.h>
#include <string.h>
Expand All @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion th01/fuuin_04.cpp
Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions th01/fuuin_11.cpp
Expand Up @@ -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"
}
2 changes: 2 additions & 0 deletions 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;
Expand All @@ -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();
}
}
4 changes: 3 additions & 1 deletion 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();
Expand Down
2 changes: 1 addition & 1 deletion th01/main/boss/b20m.cpp
@@ -1,7 +1,6 @@
/// Makai Stage 20 Boss - Sariel
/// ----------------------------

extern "C" {
#include <stddef.h>
#include <stdlib.h>
#include <dos.h>
Expand All @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions th01/main/hud/hud.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -502,5 +503,3 @@ void hud_bg_snap_and_put(void)
hud_score_and_cardcombo_render();
fwnum_force_rerender = false;
}

extern "C" {
2 changes: 1 addition & 1 deletion 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"
}
Expand Down
2 changes: 1 addition & 1 deletion th01/main/stage/stageobj.cpp
@@ -1,4 +1,3 @@
extern "C" {
#include <stddef.h>
#include <malloc.h>
#include "platform.h"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion th01/main/stage/timer.cpp
@@ -1,4 +1,3 @@
extern "C" {
#include <stddef.h>
#include "platform.h"
#include "x86real.h"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion th01/main_010.cpp
Expand Up @@ -3,7 +3,6 @@
* 1st part of code segment #1 of TH01's REIIDEN.EXE
*/

extern "C" {
#include <stddef.h>
#include <stdio.h>
#include <string.h>
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions th01/main_07.cpp
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion th01/main_13.cpp
Expand Up @@ -5,13 +5,13 @@

#pragma option -2 -Z-

extern "C" {
#include <dos.h>
#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"

Expand Down
2 changes: 1 addition & 1 deletion th01/main_19.cpp
Expand Up @@ -5,7 +5,6 @@

#pragma option -d

extern "C" {
#include <io.h>
#include <stdio.h>
#include <string.h>
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion th01/main_23.cpp
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions th01/main_25.cpp
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions th01/main_32.cpp
Expand Up @@ -3,14 +3,14 @@
* Code segment #32 of TH01's REIIDEN.EXE
*/

extern "C" {
#include <stddef.h>
#include "platform.h"
#include "x86real.h"
#include "pc98.h"
#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"
Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion th01/op_01.cpp
Expand Up @@ -3,7 +3,6 @@
* Code segment #1 of TH01's OP.EXE
*/

extern "C" {
#include <mem.h>
#include <stdio.h>
#include "platform.h"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions th01/op_07.cpp
Expand Up @@ -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"
}
3 changes: 0 additions & 3 deletions th01/zunsoft.cpp
Expand Up @@ -3,16 +3,13 @@
* ZUN Soft logo used in TH01, TH02 and TH03
*/

extern "C" {
#include "platform.h"
#include "x86real.h"
#include "pc98.h"
#include "decomp.hpp"
#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
Expand Down

0 comments on commit a2358be

Please sign in to comment.