From 6406c4f258d6e398d1886822b6259e33048733e8 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sun, 19 Jul 2026 12:19:28 +0300 Subject: [PATCH] Fixing bug with save game, sounds, and some hints are out of screen on Android --- resources/w/ui/hud_step5ab.json | 4 ++-- resources/w/ui/hud_step5b.json | 4 ++-- resources/w/ui/portrait_screen_journal_item.json | 2 +- resources/w/ui_en/hud_step5ab.json | 4 ++-- resources/w/ui_en/hud_step5b.json | 4 ++-- .../w/ui_en/portrait_screen_journal_item.json | 2 +- src/AudioPlayerAsync.cpp | 2 +- src/Game.cpp | 2 +- src/utils/Utils.cpp | 16 ++++++++++++---- 9 files changed, 24 insertions(+), 16 deletions(-) diff --git a/resources/w/ui/hud_step5ab.json b/resources/w/ui/hud_step5ab.json index 96a0bfd..773cc4b 100644 --- a/resources/w/ui/hud_step5ab.json +++ b/resources/w/ui/hud_step5ab.json @@ -129,8 +129,8 @@ "name": "hint6b", "horizontal_gravity": "right", "vertical_gravity": "top", - "width": 738.75, - "height": 292.5, + "width": 630.4, + "height": 249.6, "x": 80, "y": 100, "texture": "resources/w/ui/img/Hint6b.png", diff --git a/resources/w/ui/hud_step5b.json b/resources/w/ui/hud_step5b.json index 403b46a..6dd0226 100644 --- a/resources/w/ui/hud_step5b.json +++ b/resources/w/ui/hud_step5b.json @@ -82,8 +82,8 @@ "name": "hint6b", "horizontal_gravity": "right", "vertical_gravity": "top", - "width": 738.75, - "height": 292.5, + "width": 630.4, + "height": 249.6, "x": 80, "y": 100, "texture": "resources/w/ui/img/Hint6b.png", diff --git a/resources/w/ui/portrait_screen_journal_item.json b/resources/w/ui/portrait_screen_journal_item.json index e899566..b87494d 100644 --- a/resources/w/ui/portrait_screen_journal_item.json +++ b/resources/w/ui/portrait_screen_journal_item.json @@ -60,7 +60,7 @@ "horizontal_gravity": "center", "vertical_gravity": "top", "text": "Главное Задание 1", - "fontSize": 56, + "fontSize": 40, "fontPath": "resources/fonts/DroidSans.ttf", "textCentered": false, "topAligned": false, diff --git a/resources/w/ui_en/hud_step5ab.json b/resources/w/ui_en/hud_step5ab.json index 76eb84d..fc3626b 100644 --- a/resources/w/ui_en/hud_step5ab.json +++ b/resources/w/ui_en/hud_step5ab.json @@ -129,8 +129,8 @@ "name": "hint6b", "horizontal_gravity": "right", "vertical_gravity": "top", - "width": 788, - "height": 276, + "width": 630.4, + "height": 220.8, "x": 80, "y": 100, "texture": "resources/w/ui_en/img/Hint6b.png", diff --git a/resources/w/ui_en/hud_step5b.json b/resources/w/ui_en/hud_step5b.json index f95ba0e..861020f 100644 --- a/resources/w/ui_en/hud_step5b.json +++ b/resources/w/ui_en/hud_step5b.json @@ -82,8 +82,8 @@ "name": "hint6b", "horizontal_gravity": "right", "vertical_gravity": "top", - "width": 788, - "height": 276, + "width": 630.4, + "height": 220.8, "x": 80, "y": 100, "texture": "resources/w/ui_en/img/Hint6b.png", diff --git a/resources/w/ui_en/portrait_screen_journal_item.json b/resources/w/ui_en/portrait_screen_journal_item.json index 1df1946..4cffc33 100644 --- a/resources/w/ui_en/portrait_screen_journal_item.json +++ b/resources/w/ui_en/portrait_screen_journal_item.json @@ -60,7 +60,7 @@ "horizontal_gravity": "center", "vertical_gravity": "top", "text": "", - "fontSize": 56, + "fontSize": 40, "fontPath": "resources/fonts/DroidSans.ttf", "textCentered": false, "topAligned": false, diff --git a/src/AudioPlayerAsync.cpp b/src/AudioPlayerAsync.cpp index 5292dca..2f1b1bc 100644 --- a/src/AudioPlayerAsync.cpp +++ b/src/AudioPlayerAsync.cpp @@ -106,7 +106,7 @@ void AudioPlayerAsync::playSoundAsync(const std::string& filePath, int loops, in return; } sound = Mix_LoadWAV_RW(rw, 1); // 1 means it will free rw automatically - FRG::logger() << "sound = Mix_LoadWAV_RW(rw, 1); just fired " << std::endl; + //FRG::logger() << "sound = Mix_LoadWAV_RW(rw, 1); just fired " << std::endl; #else sound = Mix_LoadWAV(filePath.c_str()); diff --git a/src/Game.cpp b/src/Game.cpp index fae1393..a5880e5 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -1217,7 +1217,7 @@ namespace FRG if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED) { const bool wasPortrait = Environment::width < Environment::height; - //FRG::logger() << "Window resized" << std::endl; + FRG::logger() << "Window resized" << std::endl; if (Environment::isHighDPIEnabled) { // Если High DPI включен, запрашиваем реальное физическое разрешение буфера int drawW, drawH; diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index 5501bdf..f2d550a 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -234,11 +234,11 @@ namespace FRG return file.good(); } else { - std::cerr << "[settings] Could not open " << filePath << " for writing" << std::endl; + logger() << "[settings] Could not open " << filePath << " for writing" << std::endl; } } catch (const fs::filesystem_error& e) { - std::cerr << "[settings] Filesystem error: " << e.what() << std::endl; + logger() << "[settings] Filesystem error: " << e.what() << std::endl; } return false; @@ -254,6 +254,14 @@ namespace FRG // Для Web монтируем IDBFS обычно в локальную папку /offline или /home/webuser // Чтобы не усложнять иерархию в IndexedDB, можно использовать фиксированный корень baseDir = "/offline"; +#elif defined(__ANDROID__) + char* prefPath = SDL_GetPrefPath("Fish Run Games", "Shadow Over Bishkek Demo"); + if (prefPath) { + fs::path p(prefPath); + SDL_free(prefPath); + return p; + } + baseDir = fs::current_path(); #elif defined(_WIN32) wchar_t* appDataPath = nullptr; if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &appDataPath))) { @@ -294,7 +302,7 @@ namespace FRG std::ifstream f(filePath, std::ios::in | std::ios::binary); if (!f.is_open()) { - std::cerr << "[settings] Could not open " << filePath << " for reading" << std::endl; + logger() << "[settings] Could not open " << filePath << " for reading" << std::endl; return ""; } @@ -303,7 +311,7 @@ namespace FRG std::istreambuf_iterator()); } catch (const fs::filesystem_error& e) { - std::cerr << "[settings] Filesystem error during read: " << e.what() << std::endl; + logger() << "[settings] Filesystem error during read: " << e.what() << std::endl; } return "";