From 5a337f173ba3f02c04064175daa30905d3d60f19 Mon Sep 17 00:00:00 2001 From: Issac332 <119879937+Issac8658@users.noreply.github.com> Date: Tue, 28 Apr 2026 19:02:02 +0300 Subject: [PATCH] windows build fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Я не знаю на сколько игра будет корректно работать в будущем с этими изменениями, но по крайней мере я добился того что бы оно хотя бы сбилдилось на винде под винду билдинг я проводил из под msys2 с помощью ninja(make у меня почему то запускал обычный cmd): Запускал `cmake` с аргументами `cmake -B build/ -G Ninja`(правда мне ещё пришлось указать путь до xxd, но скорее всего это я где то накосячил) и после `ninja` в `/build` --- CMakeLists.txt | 6 +++++- binding-mri/chroma-binding.cpp | 2 +- binding-mri/niko-binding.cpp | 12 +++++++++++- src/main.cpp | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ea250b..097cc84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,7 +337,11 @@ target_link_libraries(${PROJECT_NAME} ${PLATFORM_LIBRARIES} ${Ruby_LIBRARIES} Boost::boost ${Boost_LIBRARIES} - ${VORBISFILE_LIBRARIES}) + ${VORBISFILE_LIBRARIES} + + winmm + z + ) IF(APPLE) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) diff --git a/binding-mri/chroma-binding.cpp b/binding-mri/chroma-binding.cpp index f04089c..8d34df8 100644 --- a/binding-mri/chroma-binding.cpp +++ b/binding-mri/chroma-binding.cpp @@ -32,7 +32,7 @@ void _attemptLinkSdk() { _playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation"); INIT_SUCCESS &= _playAnimation != NULL; - Debug() << "Plugin method @" << (long)_playAnimation; + Debug() << "Plugin method @" << reinterpret_cast(_playAnimation); _openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation"); INIT_SUCCESS &= _openAnimation != NULL; diff --git a/binding-mri/niko-binding.cpp b/binding-mri/niko-binding.cpp index cff3953..41c13b8 100644 --- a/binding-mri/niko-binding.cpp +++ b/binding-mri/niko-binding.cpp @@ -142,7 +142,17 @@ RB_METHOD(nikoStart) POINT pos; pos.x = NIKO_X; pos.y = NIKO_Y; - ClientToScreen(syswindow.info.win.window, &pos); + + // idk if shState->rtData().window will work, i inserted it here so that project would at least be build + SDL_PropertiesID props = SDL_GetWindowProperties(shState->rtData().window); + + HWND hwnd = (HWND)SDL_GetPointerProperty( + props, + SDL_PROP_WINDOW_WIN32_HWND_POINTER, + NULL + ); + + ClientToScreen(hwnd, &pos); // Start process WCHAR path[MAX_PATH]; WCHAR args[MAX_PATH]; diff --git a/src/main.cpp b/src/main.cpp index 78c5c6c..41bb433 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -182,7 +182,7 @@ static void setGamePathInRegistry() { #if defined WIN32 // this logic is currently windows specific - char* dataDir = SDL_GetBasePath(); + const char* dataDir = SDL_GetBasePath(); if (dataDir){ HKEY key; long keyOpenError = RegOpenKey(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), &key); @@ -208,7 +208,7 @@ static void setGamePathInRegistry() { } RegCloseKey(key); } - SDL_free(dataDir); + SDL_free((void*)dataDir); } #endif //TODO handle this for Linux/Mac