diff --git a/meson.build b/meson.build index 8044ce1..988a6f4 100644 --- a/meson.build +++ b/meson.build @@ -57,10 +57,16 @@ configure_file( ) # Dependencies -lSDL2 = dependency('SDL2') +lSDL2 = dependency('SDL2', static: true) + +# Windows resources +# todo: gate this off if not on Windows +windows = import('windows') +WIN_RSRC = windows.compile_resources( + 'rsrc/WIN32/main.rc', +) # Hardware libraries -# Some are temporarily disabled while I get CMake up and running HW_SRC = { 'ADB': [ @@ -172,8 +178,9 @@ EMU_INC = include_directories([ # Just gonna do an SDL2 Mac Plus for now executable( 'microvmac', - sources: MAC_SRC['Plus'] + UI_SRC + EMU_SRC, + sources: MAC_SRC['Plus'] + UI_SRC + EMU_SRC + WIN_RSRC, dependencies: [lSDL2], include_directories: EMU_INC, + gui_app: true ) diff --git a/rsrc/WIN32/main.rc b/rsrc/WIN32/main.rc index 79b8953..0f68cab 100644 --- a/rsrc/WIN32/main.rc +++ b/rsrc/WIN32/main.rc @@ -6,8 +6,8 @@ ICO_DSK ICON DISCARDABLE "ICONDSKW.ico" ICO_ROM ICON DISCARDABLE "ICONROMW.ico" // Binary data -SONY_DRV RCDATA "SONYDRV.bin" -SONY_ICO RCDATA "SONYICO.bin" +SONY_DRV RCDATA "../SONYDRV.bin" +SONY_ICO RCDATA "../SONYICO.bin" // Version information VS_VERSION_INFO VERSIONINFO diff --git a/src/PATCHES/SONYDRV.c b/src/PATCHES/SONYDRV.c index f6cfb62..3658c07 100644 --- a/src/PATCHES/SONYDRV.c +++ b/src/PATCHES/SONYDRV.c @@ -6,6 +6,9 @@ #include #include #include "incbin/incbin.h" +#ifdef _MSC_VER +#include +#endif #include "EMCONFIG.h" #include "GLOBGLUE.h" @@ -19,21 +22,40 @@ #include "HW/SCREEN/SCRNEMDV.h" // Include binaries +#ifndef _MSC_VER INCBIN(SonyDriver, "rsrc/SONYDRV.bin"); INCBIN(SonyIcon, "rsrc/SONYICO.bin"); +#endif -#ifdef gSonyDriverData void Sony_LoadDriver(uint8_t *pto, int *size) { + #ifdef _MSC_VER + HRSRC hDrvInfo = FindResource(NULL, "SONY_DRV", RT_RCDATA); + HGLOBAL hDrv = LoadResource(NULL, hDrvInfo); + DWORD sDrv = SizeofResource(NULL, hDrvInfo); + void *pDrv = LockResource(hDrv); + memcpy(pto, pDrv, sDrv); + *size = sDrv; + #else memcpy(pto, gSonyDriverData, gSonyDriverSize); *size = gSonyDriverSize; + #endif } void Sony_LoadIcon(uint8_t *pto, int *icoSize) { disk_icon_addr = (pto - ROM) + kROM_Base; + #ifdef _MSC_VER + HRSRC hIcoInfo = FindResource(NULL, "SONY_ICO", RT_RCDATA); + HGLOBAL hIco = LoadResource(NULL, hIcoInfo); + DWORD sIco = SizeofResource(NULL, hIcoInfo); + void *pIco = LockResource(hIco); + memcpy(pto, pIco, sIco); + pto += sizeof(sIco); + #else memcpy(pto, gSonyIconData, gSonyIconSize); *icoSize = gSonyIconSize; + #endif } void Sony_TwiggyPatch(uint8_t *pto) @@ -73,11 +95,4 @@ void Sony_Install(void) // currently broken //ScreenHack_Install(&pto); -} -#else -// Can't load patches; just stub this out for now -void Sony_Install(void) -{ - return; -} -#endif \ No newline at end of file +} \ No newline at end of file