From f45c4860a09061f30a54b3f1d4b6b705b99290d3 Mon Sep 17 00:00:00 2001 From: c64cryptoboy Date: Fri, 18 Sep 2026 06:13:04 -0700 Subject: [PATCH 1/2] fix(windows): repair MSVC conversions, byte literals and CRT linking --- platform/Windows/c64d/c64d.vcxproj | 8 ++++---- src/Emulators/vice/arch/menu_help.c | 12 ++++++------ src/Emulators/vice/root/infocontrib.h | 20 ++++++++++---------- src/Plugins/GoatTracker/CGT2Favorites.cpp | 10 ++++++---- src/Views/CViewFileBrowser.cpp | 1 + 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/platform/Windows/c64d/c64d.vcxproj b/platform/Windows/c64d/c64d.vcxproj index 3f0105ad..90774801 100644 --- a/platform/Windows/c64d/c64d.vcxproj +++ b/platform/Windows/c64d/c64d.vcxproj @@ -178,7 +178,7 @@ Windows - MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;msvcrtd.lib;dbghelp.lib;%(AdditionalDependencies) + MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;dbghelp.lib;%(AdditionalDependencies) @@ -198,7 +198,7 @@ Windows - MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;msvcrtd.lib;dbghelp.lib;%(AdditionalDependencies) + MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;dbghelp.lib;%(AdditionalDependencies) @@ -222,7 +222,7 @@ Windows true true - MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;msvcrt.lib;dbghelp.lib;mbedtls_bundle.lib;bcrypt.lib;%(AdditionalDependencies) + MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;dbghelp.lib;mbedtls_bundle.lib;bcrypt.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration @@ -248,7 +248,7 @@ Windows true true - MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;msvcrt.lib;dbghelp.lib;%(AdditionalDependencies) + MTImageCodecs.lib;SDL3.lib;version.lib;imm32.lib;setupapi.lib;winmm.lib;wsock32.lib;ws2_32.lib;Iphlpapi.lib;userenv.lib;psapi.lib;uSockets.lib;libuv.lib;dbghelp.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration diff --git a/src/Emulators/vice/arch/menu_help.c b/src/Emulators/vice/arch/menu_help.c index 73e157c5..fb4211b2 100644 --- a/src/Emulators/vice/arch/menu_help.c +++ b/src/Emulators/vice/arch/menu_help.c @@ -240,23 +240,23 @@ static void show_text(const char *text) case '`': string[x + z] = '\''; break; - case 'ä': + case '\344': string[x + z] = 'a'; break; case '~': string[x + z] = '-'; break; - case 'é': - case 'č': + case '\351': + case '\350': string[x + z] = 'e'; break; - case 'Ö': + case '\326': string[x + z] = 'O'; break; - case 'ö': + case '\366': string[x + z] = 'o'; break; - case 'ĺ': + case '\345': string[x + z] = 'a'; break; case '\t': diff --git a/src/Emulators/vice/root/infocontrib.h b/src/Emulators/vice/root/infocontrib.h index 29b2d1bb..0c2aa166 100644 --- a/src/Emulators/vice/root/infocontrib.h +++ b/src/Emulators/vice/root/infocontrib.h @@ -286,7 +286,7 @@ const char info_contrib_text[] = " Started the work on hardware-level 1541 emulation and wrote the\n" " new monitor introduced with VICE 0.15.\n" "\n" -" André Fachat \n" +" Andr\351 Fachat \n" " Copyright (C) 1996-2001\n" " Wrote the PET and CBM-II emulators, the CIA and VIA emulation,\n" " the IEEE488 interface, implemented the IEC serial bus in `xvic'\n" @@ -336,7 +336,7 @@ const char info_contrib_text[] = " Copyright (C) 2011-2017\n" " Provided the Spanish user interface translations.\n" "\n" -" Paul Dubé \n" +" Paul Dub\351 \n" " Copyright (C) 2004-2017\n" " Provided the French user interface translations.\n" "\n" @@ -437,7 +437,7 @@ const char info_contrib_text[] = " Implemented the SDL UI slider control and fixed some\n" " GP2X/Dingoo SDL UI issues.\n" "\n" -" István Fábián\n" +" Istv\341n F\341bi\341n\n" " Contributed a initial patch with the more correct 1541 bus\n" " timing code and which gave us hints for to improving the 1541\n" " emulation.\n" @@ -525,7 +525,7 @@ const char info_contrib_text[] = " driver, basic support for the OPENCBM library and some\n" " other patches.\n" "\n" -" Frank König \n" +" Frank K\366nig \n" " Contributed the Win32 joystick autofire feature.\n" "\n" " Bernd Kortz \n" @@ -564,7 +564,7 @@ const char info_contrib_text[] = " lvd \n" " Provided some monitor fixes.\n" "\n" -" Marko Mäkelä \n" +" Marko M\344kel\344 \n" " Wrote lots of CPU documentation. Wrote the VIC Flash Plugin\n" " cartridge emulation in xvic. Wrote the Ultimem cartridge\n" " emulation in xvic.\n" @@ -615,7 +615,7 @@ const char info_contrib_text[] = " Per Olofsson \n" " Digitalized the C64 colors used in the (old) default palette.\n" "\n" -" Lasse Öörni \n" +" Lasse \326\366rni \n" " Contributed the Windows Multimedia sound driver\n" "\n" " Stein Pedersen \n" @@ -648,7 +648,7 @@ const char info_contrib_text[] = " David Roden\n" " Fixed various issues related to ffmpeg settings.\n" "\n" -" Pablo Roldán \n" +" Pablo Rold\341n \n" " Contributed initial patch for VIC-II PAL-N model selection.\n" "\n" " Mathias Roslund \n" @@ -792,7 +792,7 @@ const char info_contrib_text[] = "\n" " Last but not least, a very special thank to Andreas Arens, Lutz\n" " Sammer, Edgar Tornig, Christian Bauer, Wolfgang Lorenz, Miha\n" -" Peternel, Per Hĺkan Sundell and David Horrocks for writing\n" +" Peternel, Per H\345kan Sundell and David Horrocks for writing\n" " cool emulators to compete with. :-)\n" "\n" "\n"; @@ -833,7 +833,7 @@ vice_team_t ex_team[] = { { "2000-2004", "Markus Brenner", "Markus Brenner " }, { "1999-2004", "Thomas Bretz", "Thomas Bretz " }, { "1997-2001", "Daniel Sladic", "Daniel Sladic " }, - { "1996-2001", "André Fachat", "André Fachat " }, + { "1996-2001", "Andr\351 Fachat", "Andr\351 Fachat " }, { "1996-1999", "Ettore Perazzoli", "Ettore Perazzoli " }, { "1993-1994, 1997-1999", "Teemu Rantanen", "Teemu Rantanen " }, { "1993-1996", "Jouko Valta", "Jouko Valta " }, @@ -854,7 +854,7 @@ vice_trans_t trans_team[] = { { "2009-2017", "Mikkel Holm Olsen", "Danish", "Mikkel Holm Olsen " }, { "2000-2017", "Martin Pottendorfer", "German", "Martin Pottendorfer " }, { "2011-2017", "Manuel Antonio Rodriguez Bas", "Spanish", "Manuel Antonio Rodriguez Bas " }, - { "2004-2017", "Paul Dubé", "French", "Paul Dubé " }, + { "2004-2017", "Paul Dub\351", "French", "Paul Dub\351 " }, { "2006-2017", "Czirkos Zoltan", "Hungarian", "Czirkos Zoltan " }, { "2006-2017", "Karai Csaba", "Hungarian", "Karai Csaba " }, { "2001-2017", "Andrea Musuruane", "Italian", "Andrea Musuruane " }, diff --git a/src/Plugins/GoatTracker/CGT2Favorites.cpp b/src/Plugins/GoatTracker/CGT2Favorites.cpp index 21c6e299..62d01294 100644 --- a/src/Plugins/GoatTracker/CGT2Favorites.cpp +++ b/src/Plugins/GoatTracker/CGT2Favorites.cpp @@ -151,8 +151,9 @@ void CGT2Favorites::Load() memset(&e.package, 0, sizeof(INSTRPACKAGE)); // displayName - if (entry["name"].type() == Hjson::Type::String) - e.displayName = (std::string)entry["name"]; + Hjson::Value displayNameValue = entry["name"]; + if (displayNameValue.type() == Hjson::Type::String) + e.displayName = static_cast(displayNameValue); // INSTR fields if (entry["ad"].defined()) e.package.instr.ad = (unsigned char)(int)entry["ad"]; @@ -161,9 +162,10 @@ void CGT2Favorites::Load() if (entry["gatetimer"].defined()) e.package.instr.gatetimer = (unsigned char)(int)entry["gatetimer"]; if (entry["firstwave"].defined()) e.package.instr.firstwave = (unsigned char)(int)entry["firstwave"]; - if (entry["instrname"].type() == Hjson::Type::String) + Hjson::Value instrumentNameValue = entry["instrname"]; + if (instrumentNameValue.type() == Hjson::Type::String) { - std::string n = (std::string)entry["instrname"]; + std::string n = static_cast(instrumentNameValue); strncpy(e.package.instr.name, n.c_str(), MAX_INSTRNAMELEN - 1); e.package.instr.name[MAX_INSTRNAMELEN - 1] = '\0'; } diff --git a/src/Views/CViewFileBrowser.cpp b/src/Views/CViewFileBrowser.cpp index db3fe43a..4c710271 100644 --- a/src/Views/CViewFileBrowser.cpp +++ b/src/Views/CViewFileBrowser.cpp @@ -6,6 +6,7 @@ #include #include #include "CSlrString.h" +#include "SYS_FileSystem.h" using namespace ImGui; From 7146599dddc21d278c93518879f562e78f8d6ca7 Mon Sep 17 00:00:00 2001 From: c64cryptoboy Date: Fri, 18 Sep 2026 07:32:56 -0700 Subject: [PATCH 2/2] fix(windows): use MSVC intrinsic for IDE64 USB lock --- src/Emulators/vice/c64/cart/ide64.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Emulators/vice/c64/cart/ide64.c b/src/Emulators/vice/c64/cart/ide64.c index 097ae965..ffb9077c 100644 --- a/src/Emulators/vice/c64/cart/ide64.c +++ b/src/Emulators/vice/c64/cart/ide64.c @@ -42,6 +42,10 @@ #include #include +#if defined(_MSC_VER) && !defined(__clang__) +#include +#endif + #include "alarm.h" #include "archdep.h" #include "ata.h" @@ -563,24 +567,31 @@ static int set_autodetect_size(int autodetect_size, void *param) * private helpers and never take the lock themselves, so there is no * re-entrancy. * - * Implemented as a GCC/Clang test-and-set spinlock: contention is two threads - * and the critical sections are short, while every toolchain that builds this - * window (GCC on Linux, Apple clang, and clang-cl on Windows) implements the - * builtin. Including the Windows synchronization headers from a vendored VICE + * Implemented as a test-and-set spinlock: contention is two threads and the + * critical sections are short. MSVC uses _InterlockedExchange; GCC and Clang + * use the __sync builtins. Including Windows synchronization headers from a vendored VICE * file is NOT an alternative: the app's compiles see a different preprocessor * setup than a normal Windows program and winnt.h refuses the empty target * architecture. */ static volatile long usb_server_lock_word = 0; static void usb_server_lock(void) { +#if defined(_MSC_VER) && !defined(__clang__) + while (_InterlockedExchange(&usb_server_lock_word, 1)) { +#else while (__sync_lock_test_and_set(&usb_server_lock_word, 1)) { +#endif while (usb_server_lock_word) { } } } static void usb_server_unlock(void) { +#if defined(_MSC_VER) && !defined(__clang__) + _InterlockedExchange(&usb_server_lock_word, 0); +#else __sync_lock_release(&usb_server_lock_word); +#endif } static void usbserver_activate(int);