Skip to content

Commit

Permalink
Fixed wasm build
Browse files Browse the repository at this point in the history
  • Loading branch information
visrealm committed Sep 3, 2023
1 parent 342a462 commit 5da7ac8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/vrEmuTms9918.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
12 changes: 11 additions & 1 deletion src/vrEmuTms9918.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@

#if __EMSCRIPTEN__
#include <emscripten.h>
#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
Expand All @@ -35,6 +41,10 @@
#endif
#endif

#ifndef VR_EMU_TMS9918_DLLEXPORT_CONST
#define VR_EMU_TMS9918_DLLEXPORT_CONST VR_EMU_TMS9918_DLLEXPORT
#endif

#include <stdint.h>
#include <stdbool.h>

Expand Down
12 changes: 10 additions & 2 deletions src/vrEmuTms9918Util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions src/vrEmuTms9918Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5da7ac8

Please sign in to comment.