From 82c70b1a73e17125228359fed373574ab1939a71 Mon Sep 17 00:00:00 2001 From: whitecum1488 Date: Thu, 2 Jul 2026 22:16:31 +0300 Subject: [PATCH] more Android Support! --- patches/mac/Info.plist.in | 2 +- src/config.cpp | 7 +++++-- src/main.cpp | 4 +--- src/meow.cpp | 22 +++++++++++++++------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/patches/mac/Info.plist.in b/patches/mac/Info.plist.in index ce22dce..929bac7 100644 --- a/patches/mac/Info.plist.in +++ b/patches/mac/Info.plist.in @@ -25,7 +25,7 @@ LSApplicationCategoryType public.app-category.games LSMinimumSystemVersion - 10.7 + 11 LSBackgroundOnly 0 NSHumanReadableCopyright diff --git a/src/config.cpp b/src/config.cpp index f4c87cf..2ea9794 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -165,13 +165,16 @@ void Config::read(int argc, char *argv[]){ #undef PO_DESC_ALL SE.sourceCount = clamp(SE.sourceCount, 1, 64); - + #ifdef __ANDROID__ + commonDataPath = prefPath(SDL_GetAndroidInternalStoragePath(), "/Sunshine"); + #else commonDataPath = prefPath(".", "Sunshine"); + #endif if(windowTitle == "") game.title = "OneShot: Sunshine"; game.scripts = "Data/xScripts.rxdata"; - + if(defScreenW == 640 || defScreenH == 480){ if (EnableSixteenByNine){ defScreenW = 1280; diff --git a/src/main.cpp b/src/main.cpp index 5c3581e..bdea6a1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -280,7 +280,6 @@ int main(int argc, char *argv[]){ } #endif - if (!conf.gameFolder.empty()){ if (chdir(conf.gameFolder.c_str()) != 0){ crash(Exception::MEOW, "Unable to switch into gameFolder %s", conf.gameFolder); @@ -289,12 +288,11 @@ int main(int argc, char *argv[]){ } std::string new_path = ModLoader(conf); - if(new_path != ""){ if (chdir(new_path.c_str()) != 0){ crash(Exception::MEOW, "Unable to switch into new gameFolder %s", new_path); return 0; - } + } } extern int screenMain(Config &conf); diff --git a/src/meow.cpp b/src/meow.cpp index 9a390f4..d3c2699 100644 --- a/src/meow.cpp +++ b/src/meow.cpp @@ -6,7 +6,6 @@ #include #include #include - #include "meow.h" #include "eventthread.h" #include "exception.h" @@ -23,7 +22,7 @@ #include #include #include - +#include #include #ifdef __LINUX__ @@ -56,7 +55,6 @@ void crash(Exception::Type t, const char *fmt, ...){ char *buf = (char*)SDL_malloc((size_t)len + 1); SDL_vsnprintf(buf, (size_t)len + 1, fmt, args); va_end(args); - SDL_snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash log? You can share the crash log with the developers and help resolve the issue.", buf); SDL_MessageBoxData messageboxdata = { .flags = SDL_MESSAGEBOX_ERROR, @@ -104,7 +102,7 @@ void crash(Exception::Type t, const char *fmt, ...){ out << "SDL_TTF(compiled) version: " << SDL_TTF_MAJOR_VERSION << "." << SDL_TTF_MINOR_VERSION << "." << SDL_TTF_MICRO_VERSION << std::endl; out << "Ruby version: " << RUBY_API_VERSION_CODE << std::endl; out << "ZLib version: " << ZLIB_VERSION << std::endl; - out << "OpenAL version: " << AL_VERSION << std::endl; + out << "OpenAL version: " << AL_VERSION << std::endl; out << "Boost versino: " << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl; out << "Pixman version: " << PIXMAN_VERSION_STRING << std::endl; out << "[Platform specific]" << std::endl; @@ -114,18 +112,28 @@ void crash(Exception::Type t, const char *fmt, ...){ out << "Detected OS: " << e.what() << std::endl; } if(!getenv("XDG_CURRENT_DESKTOP") == NULL){ - out << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << getenv("XDG_CURRENT_DESKTOP") << std::endl; + out << "Desktop enviroment(XDG_CURRENT_DESKTOP): " << getenv("XDG_CURRENT_DESKTOP") << std::endl; } #ifdef __ANDROID__ - out << "Android API version: " << android_get_device_api_level() << std::endl; + out << "Android API version: " << android_get_device_api_level() << std::endl; out << "External storage State: " << SDL_GetAndroidExternalStorageState() << std::endl; + out << "Internal storage path: " << SDL_GetAndroidInternalStoragePath() << std::endl; + out << "External Storage path: " << SDL_GetAndroidExternalStoragePath() << ats::endl; + out << "Cache path: " << SDL_GetAndroidCachePath() << std::endl; + out << " #elif __EMSCRIPTEN__ out << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl; out << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl; out << "Emscripten current stack pointer: " << emscripten_stack_get_current() << std::endl; out << "Emscripten number of free bytes left on the stack: " << emscripten_stack_get_free() << std::endl; #elif __PSP__ - out << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl; + out << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl; #endif + out << "Is ChromeBook? " << SDL_IsChromebook() << std::endl; + out << "Is Phone? " << SDL_IsPhone() << std::endl; + out << "Is Tablet? " << SDL_IsTablet() << std::endl; + out << "Is Samsung DeX? " << SDL_IsDeXMode() << std::endl; + out << "Is TV? " << SDL_IsTV() << std::endl; + out << "Is Ubuntu Touch? " << SDL_IsUbuntuTouch() << std::endl; out.close(); }else{ Debug() << "[CRASHLOG] Failed to write crashdump file";