From 5da7ac885738c88aa98cddd8bf4d256e1c3d36c2 Mon Sep 17 00:00:00 2001 From: Troy Schrapel Date: Sun, 3 Sep 2023 17:53:15 +0930 Subject: [PATCH] Fixed wasm build --- src/vrEmuTms9918.c | 6 ++++++ src/vrEmuTms9918.h | 12 +++++++++++- src/vrEmuTms9918Util.c | 12 ++++++++++-- src/vrEmuTms9918Util.h | 3 +-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/vrEmuTms9918.c b/src/vrEmuTms9918.c index 13e1a9a..70f37d7 100644 --- a/src/vrEmuTms9918.c +++ b/src/vrEmuTms9918.c @@ -22,6 +22,12 @@ #define __time_critical_func(fn) fn #endif +#ifndef WIN32 +#undef VR_EMU_TMS9918_DLLEXPORT +#define VR_EMU_TMS9918_DLLEXPORT +#endif + + #define VRAM_SIZE (1 << 14) /* 16KB */ #define VRAM_MASK (VRAM_SIZE - 1) /* 0x3fff */ diff --git a/src/vrEmuTms9918.h b/src/vrEmuTms9918.h index d42baf0..822da07 100644 --- a/src/vrEmuTms9918.h +++ b/src/vrEmuTms9918.h @@ -22,7 +22,13 @@ #if __EMSCRIPTEN__ #include -#define VR_EMU_TMS9918_DLLEXPORT EMSCRIPTEN_KEEPALIVE + #ifdef __cplusplus + #define VR_EMU_TMS9918_DLLEXPORT EMSCRIPTEN_KEEPALIVE extern "C" + #define VR_EMU_TMS9918_DLLEXPORT_CONST extern "C" +#else + #define VR_EMU_TMS9918_DLLEXPORT EMSCRIPTEN_KEEPALIVE extern + #define VR_EMU_TMS9918_DLLEXPORT_CONST extern +#endif #elif VR_TMS9918_EMU_COMPILING_DLL #define VR_EMU_TMS9918_DLLEXPORT __declspec(dllexport) #elif defined WIN32 && !defined VR_EMU_TMS9918_STATIC @@ -35,6 +41,10 @@ #endif #endif +#ifndef VR_EMU_TMS9918_DLLEXPORT_CONST +#define VR_EMU_TMS9918_DLLEXPORT_CONST VR_EMU_TMS9918_DLLEXPORT +#endif + #include #include diff --git a/src/vrEmuTms9918Util.c b/src/vrEmuTms9918Util.c index 55b81eb..9c3c393 100644 --- a/src/vrEmuTms9918Util.c +++ b/src/vrEmuTms9918Util.c @@ -11,11 +11,19 @@ #include "vrEmuTms9918Util.h" +#ifndef WIN32 +#undef VR_EMU_TMS9918_DLLEXPORT +#define VR_EMU_TMS9918_DLLEXPORT +#endif + +#undef VR_EMU_TMS9918_DLLEXPORT_CONST +#define VR_EMU_TMS9918_DLLEXPORT_CONST + + #define LAST_SPRITE_YPOS 0xD0 /* tms9918 palette */ -VR_EMU_TMS9918_DLLEXPORT -uint32_t vrEmuTms9918Palette[] = { +VR_EMU_TMS9918_DLLEXPORT_CONST uint32_t vrEmuTms9918Palette[] = { 0x00000000, /* transparent */ 0x000000ff, /* black */ 0x21c942ff, /* medium green */ diff --git a/src/vrEmuTms9918Util.h b/src/vrEmuTms9918Util.h index f00b390..ec2d591 100644 --- a/src/vrEmuTms9918Util.h +++ b/src/vrEmuTms9918Util.h @@ -48,8 +48,7 @@ /* * TMS9918 palette (RGBA) */ -VR_EMU_TMS9918_DLLEXPORT -uint32_t vrEmuTms9918Palette[]; +VR_EMU_TMS9918_DLLEXPORT_CONST uint32_t vrEmuTms9918Palette[]; /* * Write a register value