diff --git a/Android.mk b/Android.mk index f9575cdb36..f036619c9e 100644 --- a/Android.mk +++ b/Android.mk @@ -10,6 +10,7 @@ LOCAL_SRC_FILES :=\ android/native_audio.cpp \ audio/wav_read.cpp \ audio/mixer.cpp.arm \ + base/backtrace.cpp \ base/buffer.cpp \ base/display.cpp \ base/timeutil.cpp \ diff --git a/base/PCMain.cpp b/base/PCMain.cpp index cdc82135eb..732879c650 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -400,6 +400,8 @@ int main(int argc, char *argv[]) { SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); int mode; + float set_dpi = 1.0f; + float set_scale = 1.0f; #ifdef USING_GLES2 mode = SDL_SWSURFACE | SDL_FULLSCREEN; int set_xres = -1; @@ -409,7 +411,6 @@ int main(int argc, char *argv[]) { int set_xres = -1; int set_yres = -1; - float set_dpi = 1.0f; for (int i = 1; i < argc; i++) { if (!strcmp(argv[i],"--fullscreen")) mode |= SDL_FULLSCREEN; @@ -420,6 +421,8 @@ int main(int argc, char *argv[]) { } if (set_dpi == -2) set_dpi = parseFloat(argv[i]); + if (set_scale == -2) + set_scale = parseFloat(argv[i]); if (!strcmp(argv[i],"--xres")) set_xres = -2; @@ -427,6 +430,8 @@ int main(int argc, char *argv[]) { set_yres = -2; if (!strcmp(argv[i],"--dpi")) set_dpi = -2; + if (!strcmp(argv[i],"--scale")) + set_scale = -2; } #endif if (mode & SDL_FULLSCREEN) { @@ -438,13 +443,15 @@ int main(int argc, char *argv[]) { #endif } else { // set a sensible default resolution (2x) - pixel_xres = 480 * 2; - pixel_yres = 272 * 2; + pixel_xres = 480 * 2 * set_scale; + pixel_yres = 272 * 2 * set_scale; #ifdef PPSSPP g_Config.bFullScreen = false; #endif } + set_dpi = 1.0f / set_dpi; + if (!landscape) { std::swap(pixel_xres, pixel_yres); } diff --git a/base/backtrace.cpp b/base/backtrace.cpp index 92e3e2739f..08cfc4ddd6 100644 --- a/base/backtrace.cpp +++ b/base/backtrace.cpp @@ -1,8 +1,7 @@ #include "base/backtrace.h" -#ifdef __linux__ - -// LINUX ONLY +// The mac check doesn't seem to work right. +#if (!defined(ANDROID) && defined(__linux__)) || (defined(__APPLE__) && (defined(_M_IX86) || defined(_M_X64))) #include #include @@ -14,4 +13,12 @@ void PrintBacktraceToStderr() { backtrace_symbols_fd(backtrace_buffer, num_addrs, STDERR_FILENO); } +#else + +#include + +void PrintBacktraceToStderr() { + fprintf(stderr, "No backtrace available to print on this platform\n"); +} + #endif diff --git a/base/logging.h b/base/logging.h index 6c3a7b6690..fd876f5d7b 100644 --- a/base/logging.h +++ b/base/logging.h @@ -1,5 +1,7 @@ #pragma once +#include "backtrace.h" + // Simple wrapper around Android's logging interface that also allows other // implementations, and also some misc utilities. @@ -29,12 +31,14 @@ inline void Crash() { __asm { int 3 }; } #if defined(ARM) || defined(MIPS) inline void Crash() { + PrintBacktraceToStderr(); char *p = (char *)1337; *p = 1; } #else // TODO: 64-bit version inline void Crash() { + PrintBacktraceToStderr(); asm("int $0x3"); } #endif