From dbfc62b5d44ab96c579e4cb0baff2efb2cfe771f Mon Sep 17 00:00:00 2001 From: Dniel97 Date: Thu, 19 Jun 2025 18:17:20 +0200 Subject: [PATCH] platform: fix dipsw settings not applying --- common/platform/platform.c | 4 ++-- common/platform/system.c | 13 ++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/common/platform/platform.c b/common/platform/platform.c index a769c97..c882760 100644 --- a/common/platform/platform.c +++ b/common/platform/platform.c @@ -82,13 +82,13 @@ HRESULT platform_hook_init( return hr; } - hr = system_init(&cfg->system, &cfg->vfs); + hr = epay_hook_init(&cfg->epay); if (FAILED(hr)) { return hr; } - hr = epay_hook_init(&cfg->epay); + hr = system_init(&cfg->system, &cfg->vfs); if (FAILED(hr)) { return hr; diff --git a/common/platform/system.c b/common/platform/system.c index 3baf5c1..c9dd1fd 100644 --- a/common/platform/system.c +++ b/common/platform/system.c @@ -110,7 +110,8 @@ static void system_save_sysfile(const wchar_t *sys_file) { uint8_t system = 0; uint8_t freeplay = 0; - HANDLE h_sysfile = CreateFileW(sys_file, GENERIC_READ | GENERIC_WRITE, 0, NULL, 0, 0, NULL); + // open the sysfile.dat for writing + HANDLE h_sysfile = CreateFileW(sys_file, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h_sysfile == INVALID_HANDLE_VALUE) { return; @@ -164,16 +165,6 @@ static void system_save_sysfile(const wchar_t *sys_file) { memcpy(system_info.data + 0x2800, block, BLOCK_SIZE); memcpy(system_info.data + 0x5800, block, BLOCK_SIZE); - // print the dip_switch_block in hex - /* - dprintf("System Block: "); - for (size_t i = 0; i < BLOCK_SIZE; i++) - { - dprintf("%02X ", ((uint8_t *)&system_info.dip_switch_block)[i]); - } - dprintf("\n"); - */ - WriteFile(h_sysfile, system_info.data, 0x6000, &sysfile_bytes_written, NULL); CloseHandle(h_sysfile);