From 0c7625d48a0a4eb74ac8a8df545a170a1ae5e519 Mon Sep 17 00:00:00 2001 From: Henri Asseily Date: Fri, 19 Sep 2025 19:29:01 +0300 Subject: [PATCH 1/6] Visual Studio compilation fixes --- CMakeLists.txt | 7 +- libyaml/CMakeLists.txt | 4 + minizip/CMakeLists.txt | 4 + resource/CMakeResources.cmake | 2 +- source/CMakeLists.txt | 15 ++- source/StdAfx.h | 6 +- source/frontends/common2/CMakeLists.txt | 14 +++ source/frontends/common2/argparser.cpp | 6 +- source/frontends/common2/getopt.c | 109 +++++++++++++++++++++ source/frontends/common2/getopt.h | 39 ++++++++ source/frontends/docs/msvc.md | 29 ++++++ source/frontends/sdl/CMakeLists.txt | 23 ++++- source/frontends/sdl/imgui/sdldebugger.cpp | 22 ++++- source/frontends/sdl/processfile.cpp | 4 + source/frontends/sdl/sdlframe.cpp | 25 ++++- source/linux/duplicates/Keyboard.cpp | 9 +- source/linux/paddle.cpp | 2 + 17 files changed, 297 insertions(+), 23 deletions(-) create mode 100644 source/frontends/common2/getopt.c create mode 100644 source/frontends/common2/getopt.h create mode 100644 source/frontends/docs/msvc.md diff --git a/CMakeLists.txt b/CMakeLists.txt index b5523175b..3bc797630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # this is originally a Windows project, so it uses _DEBUG, not NDEBUG add_compile_definitions("$<$:_DEBUG>") -add_compile_options(-Werror=return-type -Wno-switch) +if (MSVC) + add_compile_options(/W4) +else() + add_compile_options(-Werror=return-type -Wno-switch) +endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") add_compile_options(-Werror=format -Wno-error=format-overflow -Wno-error=format-truncation -Wno-psabi) @@ -71,6 +75,7 @@ endif() if (BUILD_SA2) add_subdirectory(source/frontends/sdl) + set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT sa2) endif() if (NOT WIN32) diff --git a/libyaml/CMakeLists.txt b/libyaml/CMakeLists.txt index 6dbf542cd..736a285f6 100644 --- a/libyaml/CMakeLists.txt +++ b/libyaml/CMakeLists.txt @@ -24,3 +24,7 @@ target_include_directories(yaml PRIVATE target_compile_definitions(yaml PRIVATE HAVE_CONFIG_H ) + +if (MSVC) + target_compile_definitions(yaml PUBLIC YAML_DECLARE_STATIC) +endif() \ No newline at end of file diff --git a/minizip/CMakeLists.txt b/minizip/CMakeLists.txt index eeea60c88..f0bef1a11 100644 --- a/minizip/CMakeLists.txt +++ b/minizip/CMakeLists.txt @@ -14,3 +14,7 @@ add_library(minizip STATIC target_include_directories(minizip INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +find_package(ZLIB REQUIRED) + +target_link_libraries(minizip PRIVATE ZLIB::ZLIB) \ No newline at end of file diff --git a/resource/CMakeResources.cmake b/resource/CMakeResources.cmake index 920886b6f..41b64972e 100644 --- a/resource/CMakeResources.cmake +++ b/resource/CMakeResources.cmake @@ -43,7 +43,7 @@ function(add_resources out_var id) string(APPEND content_cpp_private "// ${in_f_bin}\n" "extern unsigned char ${symbol}[]\;\n" - "extern int ${symbol}_len\;\n" + "extern unsigned int ${symbol}_len\;\n" "\n") string(APPEND content_cpp_public " {${resource_id}, {${symbol}, ${symbol}_len}},\n") diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 162fd6c52..01e72b314 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -276,6 +276,7 @@ endif() target_link_libraries(appleii PUBLIC yaml minizip + apple2roms ) target_link_directories(appleii PUBLIC @@ -284,9 +285,19 @@ target_link_directories(appleii PUBLIC ${ZLIB_LIBRARY_DIRS} ) -target_compile_options(appleii PUBLIC - -Wno-multichar +if (MSVC) + target_compile_options(appleii PUBLIC + /wd4566 # disable multi-character constant warning ) + target_compile_definitions(appleii PRIVATE + NOMINMAX # to avoid conflicts with std::min/max + DISABLE_SPEECH_API # undefine because the original AppleWin speech API is not supported here + ) +else() + target_compile_options(appleii PUBLIC + -Wno-multichar + ) +endif() # wildcards (*.SYM) are not supported on Windows msys2 add_custom_command( diff --git a/source/StdAfx.h b/source/StdAfx.h index ace7cf68d..3ed48b7b9 100644 --- a/source/StdAfx.h +++ b/source/StdAfx.h @@ -45,8 +45,10 @@ #define SM_CXPADDEDBORDER 92 #endif -#ifndef __MINGW32__ -#define USE_SPEECH_API +#ifndef DISABLE_SPEECH_API +# ifndef __MINGW32__ +# define USE_SPEECH_API +# endif #endif #ifdef __MINGW32__ diff --git a/source/frontends/common2/CMakeLists.txt b/source/frontends/common2/CMakeLists.txt index f9b7ef306..cf8e7b542 100644 --- a/source/frontends/common2/CMakeLists.txt +++ b/source/frontends/common2/CMakeLists.txt @@ -45,6 +45,20 @@ target_link_libraries(common2 PRIVATE apple2roms ) +# ---- getopt for Windows (MSVC/MinGW on Win32) ---- +if (WIN32) + # Build the local getopt implementation and expose its headers to this target + target_sources(common2 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/getopt.c + ) + target_include_directories(common2 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + # Prevent from defining min/max macros, which break numeric_limits::min/max + target_compile_definitions(common2 PRIVATE NOMINMAX) +endif() + if (NOT WIN32) target_link_libraries(common2 PUBLIC windows diff --git a/source/frontends/common2/argparser.cpp b/source/frontends/common2/argparser.cpp index 346f61987..a813d46d8 100644 --- a/source/frontends/common2/argparser.cpp +++ b/source/frontends/common2/argparser.cpp @@ -6,7 +6,11 @@ #include "Memory.h" -#include +#ifdef _WIN32 +# include "frontends/common2/getopt.h" +#else +# include +#endif #include #include #include diff --git a/source/frontends/common2/getopt.c b/source/frontends/common2/getopt.c new file mode 100644 index 000000000..cfb275aad --- /dev/null +++ b/source/frontends/common2/getopt.c @@ -0,0 +1,109 @@ +#include "getopt.h" +#include +#include + +// For Windows MSVC only + +char *optarg = NULL; +int optind = 1, opterr = 1, optopt = '?'; + +static int optpos = 1; + +static int +_parse_short(int argc, char * const argv[], const char *optstring) +{ + char c = argv[optind][optpos]; + const char *cp = strchr(optstring, c); + + if (!cp) { + if (opterr) + fprintf(stderr, "unknown option -- %c\n", c); + if (argv[optind][++optpos] == '\0') { + optind++; + optpos = 1; + } + optopt = c; + return '?'; + } + if (cp[1] == ':') { + if (argv[optind][optpos+1] != '\0') { + optarg = &argv[optind][optpos+1]; + optind++; + } else if (++optind < argc) { + optarg = argv[optind++]; + } else { + optopt = c; + return (optstring[0] == ':') ? ':' : '?'; + } + optpos = 1; + } else { + if (argv[optind][++optpos] == '\0') { + optpos = 1; + optind++; + } + optarg = NULL; + } + return c; +} + +int getopt(int argc, char * const argv[], const char *optstring) +{ + if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') + return -1; + if (strcmp(argv[optind], "--") == 0) { + optind++; + return -1; + } + return _parse_short(argc, argv, optstring); +} + +int getopt_long(int argc, char * const argv[], const char *optstring, + const struct option *longopts, int *longindex) +{ + if (optind >= argc) return -1; + + if (argv[optind][0] == '-' && argv[optind][1] == '-') { + const char *name = argv[optind] + 2; + const char *eq = strchr(name, '='); + size_t len = eq ? (size_t)(eq - name) : strlen(name); + + for (int i = 0; longopts[i].name; i++) { + if (strncmp(name, longopts[i].name, len) == 0 + && len == strlen(longopts[i].name)) { + if (longindex) *longindex = i; + if (longopts[i].has_arg == no_argument) { + optarg = NULL; + } else if (longopts[i].has_arg == required_argument) { + if (eq) + optarg = (char*)eq+1; + else if (optind+1 < argc) + optarg = argv[++optind]; + else + return optopt = longopts[i].val, '?'; + } else if (longopts[i].has_arg == optional_argument) { + optarg = eq ? (char*)eq+1 : NULL; + } + optind++; + if (longopts[i].flag) { + *(longopts[i].flag) = longopts[i].val; + return 0; + } else { + return longopts[i].val; + } + } + } + /* no match */ + if (opterr) + fprintf(stderr, "unrecognized option '--%s'\n", name); + optind++; + return '?'; + } + /* fallback to short option parsing */ + return getopt(argc, argv, optstring); +} + +int getopt_long_only(int argc, char * const argv[], const char *optstring, + const struct option *longopts, int *longindex) +{ + return getopt_long(argc, argv, optstring, longopts, longindex); +} diff --git a/source/frontends/common2/getopt.h b/source/frontends/common2/getopt.h new file mode 100644 index 000000000..6c71713d1 --- /dev/null +++ b/source/frontends/common2/getopt.h @@ -0,0 +1,39 @@ +#ifndef GETOPT_H +#define GETOPT_H + +// For Windows MSVC only + +#ifdef __cplusplus +extern "C" { +#endif + +/* argument flags */ +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; + +/* globals */ +extern char *optarg; +extern int optind, opterr, optopt; + +/* functions */ +int getopt(int argc, char * const argv[], const char *optstring); + +int getopt_long(int argc, char * const argv[], const char *optstring, + const struct option *longopts, int *longindex); + +int getopt_long_only(int argc, char * const argv[], const char *optstring, + const struct option *longopts, int *longindex); + +#ifdef __cplusplus +} +#endif + +#endif /* GETOPT_H */ diff --git a/source/frontends/docs/msvc.md b/source/frontends/docs/msvc.md new file mode 100644 index 000000000..fb96ba41c --- /dev/null +++ b/source/frontends/docs/msvc.md @@ -0,0 +1,29 @@ +# Microsoft VisualStudio support + +## Why + +The original AppleWin project is built with Visual Studio. We now provide support for Visual Studio when building 'sa2', the SDL version of AppleWin. + +## Status + +`sa2` compiles under VisualStudio 2022. + +## Building + +Very **important** to install `vcpkg`. Refer to the Microsoft documentation. + +Install using `vcpkg` the following packages: +``` +vcpkg install sdl2 sdl2-image sdl2-ttf +vcpkg install zlib +vcpkg install boost +``` +Then configure: +``` +cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=C:\PATH_TO_VCPKG\scripts\buildsystems\vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DVCPKG_TARGET_TRIPLET=x64-windows -DBUILD_SA2=ON +``` +Then open the generated `build\applewin.sln` file in Visual Studio. + +## Running + +`sa2` should be the startup project that runs when you press F5. diff --git a/source/frontends/sdl/CMakeLists.txt b/source/frontends/sdl/CMakeLists.txt index 22af23242..d351c0763 100644 --- a/source/frontends/sdl/CMakeLists.txt +++ b/source/frontends/sdl/CMakeLists.txt @@ -10,6 +10,7 @@ find_package(SDL2 REQUIRED) # we should use find_package, but Ubuntu does not provide it for SDL2_image pkg_search_module(SDL2_IMAGE REQUIRED SDL2_image) +target_compile_features(common2 PUBLIC cxx_std_20) if ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") OR (${CMAKE_SYSTEM_NAME} MATCHES "Windows")) # only OpenGL supported on MacOS and Windows @@ -27,7 +28,6 @@ else() ) endif() - set(SOURCE_FILES main.cpp gamepad.cpp @@ -126,9 +126,24 @@ target_include_directories(sa2 PRIVATE ${IMGUI_CLUB_PATH}/imgui_memory_editor ) -target_compile_definitions(sa2 PRIVATE - IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" +if (MSVC) + target_compile_definitions(sa2 PRIVATE + NOMINMAX # to avoid conflicts with std::min/max + DISABLE_SPEECH_API # undefine because the original AppleWin speech API is not supported here + IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" + ) +else() + target_compile_definitions(sa2 PRIVATE + IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" ) +endif() + install(TARGETS sa2 - DESTINATION bin) + RUNTIME_DEPENDENCIES + PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" # skip Windows system DLLs + POST_EXCLUDE_REGEXES ".*system32/.*" # skip more system DLLs + RUNTIME DESTINATION bin + LIBRARY DESTINATION bin + ARCHIVE DESTINATION lib +) diff --git a/source/frontends/sdl/imgui/sdldebugger.cpp b/source/frontends/sdl/imgui/sdldebugger.cpp index 4c911b0b4..f614fcaa9 100644 --- a/source/frontends/sdl/imgui/sdldebugger.cpp +++ b/source/frontends/sdl/imgui/sdldebugger.cpp @@ -52,7 +52,15 @@ namespace // the latter comes from https://fontstruct.com/fontstructions/show/1912741/debug6502 switch (ch) { - case 0x00 ... 0x1F: // mouse text -> U+00C0 + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0A: case 0x0B: + case 0x0C: case 0x0D: case 0x0E: case 0x0F: + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1A: case 0x1B: + case 0x1C: case 0x1D: case 0x1E: case 0x1F: + // mouse text -> U+00C0 *out = 0xC3; ++out; *out = 0x80 + (ch - 0x00); @@ -62,7 +70,11 @@ namespace ++out; *out = 0xBF; break; - case 0x80 ... 0x8F: // bookmarks, not currently used -> U+00F0 + case 0x80: case 0x81: case 0x82: case 0x83: + case 0x84: case 0x85: case 0x86: case 0x87: + case 0x88: case 0x89: case 0x8A: case 0x8B: + case 0x8C: case 0x8D: case 0x8E: case 0x8F: + // bookmarks, not currently used -> U+00F0 *out = 0xC3; ++out; *out = 0xB0 + (ch - 0x80); @@ -79,9 +91,9 @@ namespace void safeDebuggerTextColored(int iColor, const char *text) { const size_t length = strlen(text); - char utf8[2 * length + 1]; // worst case is 2-bytes utf8 encoding - adjustMouseText(text, length, utf8); - debuggerTextColored(iColor, utf8); + std::string utf8(2 * length + 1, '\0'); // worst case is 2-bytes utf8 encoding + adjustMouseText(text, length, utf8.data()); + debuggerTextColored(iColor, utf8.c_str()); } void displayDisassemblyLine(const DisasmLine_t &line, const int bDisasmFormatFlags) diff --git a/source/frontends/sdl/processfile.cpp b/source/frontends/sdl/processfile.cpp index e0536d8f4..22d52dd77 100644 --- a/source/frontends/sdl/processfile.cpp +++ b/source/frontends/sdl/processfile.cpp @@ -14,6 +14,10 @@ #include #include +#ifdef _WIN32 +# define strcasecmp _stricmp +#endif + namespace { diff --git a/source/frontends/sdl/sdlframe.cpp b/source/frontends/sdl/sdlframe.cpp index b05d716e9..f997aecdc 100644 --- a/source/frontends/sdl/sdlframe.cpp +++ b/source/frontends/sdl/sdlframe.cpp @@ -91,7 +91,12 @@ namespace ch = 0x09; break; } - case SDLK_a ... SDLK_z: + case SDLK_a: case SDLK_b: case SDLK_c: case SDLK_d: case SDLK_e: + case SDLK_f: case SDLK_g: case SDLK_h: case SDLK_i: case SDLK_j: + case SDLK_k: case SDLK_l: case SDLK_m: case SDLK_n: case SDLK_o: + case SDLK_p: case SDLK_q: case SDLK_r: case SDLK_s: case SDLK_t: + case SDLK_u: case SDLK_v: case SDLK_w: case SDLK_x: case SDLK_y: + case SDLK_z: { // same logic as AW // CAPS is forced when the emulator starts @@ -576,9 +581,21 @@ namespace sa2 const char key = text.text[0]; switch (key) { - case 0x20 ... 0x40: - case 0x5b ... 0x60: - case 0x7b ... 0x7e: + // 0x20 ... 0x40 + case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: + case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: + case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: + case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: + case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: + case 0x39: case 0x3A: case 0x3B: case 0x3C: case 0x3D: + case 0x3E: case 0x3F: case 0x40: + + // 0x5B ... 0x60 + case 0x5B: case 0x5C: case 0x5D: case 0x5E: + case 0x5F: case 0x60: + + // 0x7B ... 0x7E + case 0x7B: case 0x7C: case 0x7D: case 0x7E: { // not the letters // this is very simple, but one cannot handle CRTL-key combination. diff --git a/source/linux/duplicates/Keyboard.cpp b/source/linux/duplicates/Keyboard.cpp index 737a0e2b8..0741da346 100644 --- a/source/linux/duplicates/Keyboard.cpp +++ b/source/linux/duplicates/Keyboard.cpp @@ -37,10 +37,13 @@ void addTextToBuffer(const char *text) addKeyToBuffer(0x0d); break; } - case 0x20 ... 0x7e: + default: { - addKeyToBuffer(*text); - break; + if (*text >= 0x20 && *text <= 0x7e) + { + addKeyToBuffer(*text); + break; + } } } ++text; diff --git a/source/linux/paddle.cpp b/source/linux/paddle.cpp index 8f88b60b6..879f9dff7 100644 --- a/source/linux/paddle.cpp +++ b/source/linux/paddle.cpp @@ -6,6 +6,8 @@ #include "CPU.h" #include "CopyProtectionDongles.h" +#include + namespace { unsigned __int64 g_nJoyCntrResetCycle = 0; // Abs cycle that joystick counters were reset From 85221604742521a7931308f12a3c2ce1958de7d2 Mon Sep 17 00:00:00 2001 From: Henri Asseily Date: Sat, 20 Sep 2025 18:48:07 +0300 Subject: [PATCH 2/6] Fix for XCode build --- source/frontends/sdl/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/frontends/sdl/CMakeLists.txt b/source/frontends/sdl/CMakeLists.txt index d351c0763..73a7a5ea0 100644 --- a/source/frontends/sdl/CMakeLists.txt +++ b/source/frontends/sdl/CMakeLists.txt @@ -127,11 +127,11 @@ target_include_directories(sa2 PRIVATE ) if (MSVC) - target_compile_definitions(sa2 PRIVATE + target_compile_definitions(sa2 PRIVATE NOMINMAX # to avoid conflicts with std::min/max DISABLE_SPEECH_API # undefine because the original AppleWin speech API is not supported here IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" - ) + ) else() target_compile_definitions(sa2 PRIVATE IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" @@ -143,6 +143,7 @@ install(TARGETS sa2 RUNTIME_DEPENDENCIES PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" # skip Windows system DLLs POST_EXCLUDE_REGEXES ".*system32/.*" # skip more system DLLs + FRAMEWORK DESTINATION Frameworks RUNTIME DESTINATION bin LIBRARY DESTINATION bin ARCHIVE DESTINATION lib From a7ba7166abe58297c45e18548aa886cdde95ec0c Mon Sep 17 00:00:00 2001 From: Henri Asseily Date: Sat, 20 Sep 2025 18:56:14 +0300 Subject: [PATCH 3/6] Added xcode readme --- source/frontends/docs/xcode.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 source/frontends/docs/xcode.md diff --git a/source/frontends/docs/xcode.md b/source/frontends/docs/xcode.md new file mode 100644 index 000000000..1a7fbe612 --- /dev/null +++ b/source/frontends/docs/xcode.md @@ -0,0 +1,23 @@ +# Apple Xcode support + +## Status + +Compiles cleanly under Xcode. + +## Building + +Configure: +Move to the top level directory of AppleWin +Create a `build` directory and configure (here to build the SDL version): +``` +mkdir build +cmake -G Xcode -B build -DBUILD_SA2=ON +``` +Then open the generated `build/applewin.xcodeproj` file in Xcode, or just type: +``` +open build/applewin.xcodeproj +``` + +## Running + +`sa2` should be inside build/Debug or build/Release depending on your choice. From 93410365af97bc2253b1443d5964d001e8f252a0 Mon Sep 17 00:00:00 2001 From: Henri Asseily Date: Sun, 21 Sep 2025 21:40:43 +0300 Subject: [PATCH 4/6] cleaner use of IMGUI_USER_CONFIG --- source/frontends/sdl/CMakeLists.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/frontends/sdl/CMakeLists.txt b/source/frontends/sdl/CMakeLists.txt index d351c0763..b37079e4f 100644 --- a/source/frontends/sdl/CMakeLists.txt +++ b/source/frontends/sdl/CMakeLists.txt @@ -126,19 +126,17 @@ target_include_directories(sa2 PRIVATE ${IMGUI_CLUB_PATH}/imgui_memory_editor ) +target_compile_definitions(sa2 PRIVATE + IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" +) + if (MSVC) target_compile_definitions(sa2 PRIVATE NOMINMAX # to avoid conflicts with std::min/max DISABLE_SPEECH_API # undefine because the original AppleWin speech API is not supported here - IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" - ) -else() - target_compile_definitions(sa2 PRIVATE - IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h" - ) + ) endif() - install(TARGETS sa2 RUNTIME_DEPENDENCIES PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" # skip Windows system DLLs From 72c9dcc7f1adf07130f4b81f8aa22a1b6d697cae Mon Sep 17 00:00:00 2001 From: Henri Asseily Date: Sun, 21 Sep 2025 21:41:21 +0300 Subject: [PATCH 5/6] If using MSVC, disable ncurses target --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bc797630..03094c477 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,8 +65,12 @@ if (BUILD_LIBRETRO OR BUILD_APPLEN OR BUILD_SA2) add_subdirectory(source/frontends/common2) endif() -if (BUILD_APPLEN) - add_subdirectory(source/frontends/ncurses) +if (NOT MSVC) + # ncurses is not supported on Windows MSVC, only on MSYS2/MinGW + # TODO: add support for Windows MSVC via PDCurses + if (BUILD_APPLEN) + add_subdirectory(source/frontends/ncurses) + endif() endif() if (BUILD_LIBRETRO) From d2ef6cca88e792b3926f9d630e2b6e6541ac897b Mon Sep 17 00:00:00 2001 From: Henri Asseily Date: Sun, 21 Sep 2025 21:41:44 +0300 Subject: [PATCH 6/6] Fix to allow C++17 to compile on MSVC --- source/frontends/sdl/sdlframe.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/frontends/sdl/sdlframe.cpp b/source/frontends/sdl/sdlframe.cpp index f997aecdc..1b5518a56 100644 --- a/source/frontends/sdl/sdlframe.cpp +++ b/source/frontends/sdl/sdlframe.cpp @@ -672,8 +672,7 @@ namespace sa2 const int sh = video.GetFrameBufferBorderlessHeight(); // initialise with defaults - common2::Geometry actual = { - .width = sw * 2, .height = sh * 2, .x = SDL_WINDOWPOS_UNDEFINED, .y = SDL_WINDOWPOS_UNDEFINED}; + common2::Geometry actual = { sw * 2, sh * 2, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED }; // add registry information loadGeometryFromRegistry("sa2", actual);