more Android Support!

This commit is contained in:
whitecum1488 2026-07-02 22:16:31 +03:00
parent 767fc50cf5
commit 82c70b1a73
4 changed files with 22 additions and 13 deletions

View file

@ -25,7 +25,7 @@
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.games</string> <string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.7</string> <string>11</string>
<key>LSBackgroundOnly</key> <key>LSBackgroundOnly</key>
<string>0</string> <string>0</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>

View file

@ -165,13 +165,16 @@ void Config::read(int argc, char *argv[]){
#undef PO_DESC_ALL #undef PO_DESC_ALL
SE.sourceCount = clamp(SE.sourceCount, 1, 64); SE.sourceCount = clamp(SE.sourceCount, 1, 64);
#ifdef __ANDROID__
commonDataPath = prefPath(SDL_GetAndroidInternalStoragePath(), "/Sunshine");
#else
commonDataPath = prefPath(".", "Sunshine"); commonDataPath = prefPath(".", "Sunshine");
#endif
if(windowTitle == "") if(windowTitle == "")
game.title = "OneShot: Sunshine"; game.title = "OneShot: Sunshine";
game.scripts = "Data/xScripts.rxdata"; game.scripts = "Data/xScripts.rxdata";
if(defScreenW == 640 || defScreenH == 480){ if(defScreenW == 640 || defScreenH == 480){
if (EnableSixteenByNine){ if (EnableSixteenByNine){
defScreenW = 1280; defScreenW = 1280;

View file

@ -280,7 +280,6 @@ int main(int argc, char *argv[]){
} }
#endif #endif
if (!conf.gameFolder.empty()){ if (!conf.gameFolder.empty()){
if (chdir(conf.gameFolder.c_str()) != 0){ if (chdir(conf.gameFolder.c_str()) != 0){
crash(Exception::MEOW, "Unable to switch into gameFolder %s", conf.gameFolder); 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); std::string new_path = ModLoader(conf);
if(new_path != ""){ if(new_path != ""){
if (chdir(new_path.c_str()) != 0){ if (chdir(new_path.c_str()) != 0){
crash(Exception::MEOW, "Unable to switch into new gameFolder %s", new_path); crash(Exception::MEOW, "Unable to switch into new gameFolder %s", new_path);
return 0; return 0;
} }
} }
extern int screenMain(Config &conf); extern int screenMain(Config &conf);

View file

@ -6,7 +6,6 @@
#include <SDL3_sound/SDL_sound.h> #include <SDL3_sound/SDL_sound.h>
#include <SDL3_ttf/SDL_ttf.h> #include <SDL3_ttf/SDL_ttf.h>
#include <SDL3/SDL_video.h> #include <SDL3/SDL_video.h>
#include "meow.h" #include "meow.h"
#include "eventthread.h" #include "eventthread.h"
#include "exception.h" #include "exception.h"
@ -23,7 +22,7 @@
#include <boost/version.hpp> #include <boost/version.hpp>
#include <physfs.h> #include <physfs.h>
#include <pixman.h> #include <pixman.h>
#include <SDL3/SDL_system.h>
#include <boost/stacktrace.hpp> #include <boost/stacktrace.hpp>
#ifdef __LINUX__ #ifdef __LINUX__
@ -56,7 +55,6 @@ void crash(Exception::Type t, const char *fmt, ...){
char *buf = (char*)SDL_malloc((size_t)len + 1); char *buf = (char*)SDL_malloc((size_t)len + 1);
SDL_vsnprintf(buf, (size_t)len + 1, fmt, args); SDL_vsnprintf(buf, (size_t)len + 1, fmt, args);
va_end(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_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 = { SDL_MessageBoxData messageboxdata = {
.flags = SDL_MESSAGEBOX_ERROR, .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 << "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 << "Ruby version: " << RUBY_API_VERSION_CODE << std::endl;
out << "ZLib version: " << ZLIB_VERSION << 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 << "Boost versino: " << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl;
out << "Pixman version: " << PIXMAN_VERSION_STRING << std::endl; out << "Pixman version: " << PIXMAN_VERSION_STRING << std::endl;
out << "[Platform specific]" << 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; out << "Detected OS: " << e.what() << std::endl;
} }
if(!getenv("XDG_CURRENT_DESKTOP") == NULL){ 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__ #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__ #elif __EMSCRIPTEN__
out << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl; 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 end address of the stack: " << emscripten_stack_get_end() << std::endl;
out << "Emscripten current stack pointer: " << emscripten_stack_get_current() << 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; out << "Emscripten number of free bytes left on the stack: " << emscripten_stack_get_free() << std::endl;
#elif __PSP__ #elif __PSP__
out << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl; out << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl;
#endif #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(); out.close();
}else{ }else{
Debug() << "[CRASHLOG] Failed to write crashdump file"; Debug() << "[CRASHLOG] Failed to write crashdump file";