Fix Win32 resource file, SONYDRV patch on MSVC

This commit is contained in:
InvisibleUp 2023-04-01 15:37:43 -07:00
parent c5e382463a
commit 86b81e96fd
3 changed files with 36 additions and 14 deletions

View File

@ -57,10 +57,16 @@ configure_file(
) )
# Dependencies # 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 # Hardware libraries
# Some are temporarily disabled while I get CMake up and running
HW_SRC = { HW_SRC = {
'ADB': [ 'ADB': [
@ -172,8 +178,9 @@ EMU_INC = include_directories([
# Just gonna do an SDL2 Mac Plus for now # Just gonna do an SDL2 Mac Plus for now
executable( executable(
'microvmac', 'microvmac',
sources: MAC_SRC['Plus'] + UI_SRC + EMU_SRC, sources: MAC_SRC['Plus'] + UI_SRC + EMU_SRC + WIN_RSRC,
dependencies: [lSDL2], dependencies: [lSDL2],
include_directories: EMU_INC, include_directories: EMU_INC,
gui_app: true
) )

View File

@ -6,8 +6,8 @@ ICO_DSK ICON DISCARDABLE "ICONDSKW.ico"
ICO_ROM ICON DISCARDABLE "ICONROMW.ico" ICO_ROM ICON DISCARDABLE "ICONROMW.ico"
// Binary data // Binary data
SONY_DRV RCDATA "SONYDRV.bin" SONY_DRV RCDATA "../SONYDRV.bin"
SONY_ICO RCDATA "SONYICO.bin" SONY_ICO RCDATA "../SONYICO.bin"
// Version information // Version information
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO

View File

@ -6,6 +6,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "incbin/incbin.h" #include "incbin/incbin.h"
#ifdef _MSC_VER
#include <Windows.h>
#endif
#include "EMCONFIG.h" #include "EMCONFIG.h"
#include "GLOBGLUE.h" #include "GLOBGLUE.h"
@ -19,21 +22,40 @@
#include "HW/SCREEN/SCRNEMDV.h" #include "HW/SCREEN/SCRNEMDV.h"
// Include binaries // Include binaries
#ifndef _MSC_VER
INCBIN(SonyDriver, "rsrc/SONYDRV.bin"); INCBIN(SonyDriver, "rsrc/SONYDRV.bin");
INCBIN(SonyIcon, "rsrc/SONYICO.bin"); INCBIN(SonyIcon, "rsrc/SONYICO.bin");
#endif
#ifdef gSonyDriverData
void Sony_LoadDriver(uint8_t *pto, int *size) 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); memcpy(pto, gSonyDriverData, gSonyDriverSize);
*size = gSonyDriverSize; *size = gSonyDriverSize;
#endif
} }
void Sony_LoadIcon(uint8_t *pto, int *icoSize) void Sony_LoadIcon(uint8_t *pto, int *icoSize)
{ {
disk_icon_addr = (pto - ROM) + kROM_Base; 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); memcpy(pto, gSonyIconData, gSonyIconSize);
*icoSize = gSonyIconSize; *icoSize = gSonyIconSize;
#endif
} }
void Sony_TwiggyPatch(uint8_t *pto) void Sony_TwiggyPatch(uint8_t *pto)
@ -73,11 +95,4 @@ void Sony_Install(void)
// currently broken // currently broken
//ScreenHack_Install(&pto); //ScreenHack_Install(&pto);
} }
#else
// Can't load patches; just stub this out for now
void Sony_Install(void)
{
return;
}
#endif