From 594d1c095966cdea13acc53ac57d2cbcbdecb0df Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 12 Oct 2020 21:52:02 +0200 Subject: [PATCH] Fix builds for Android --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ nall/foreach.hpp | 2 +- snes/libretro/libretro.cpp | 19 ++++++++++++++++--- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8dbea58..4179aa3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,8 @@ include: file: '/linux-x64.yml' - project: 'libretro-infrastructure/ci-templates' file: '/windows-x64-mingw.yml' + - project: 'libretro-infrastructure/ci-templates' + file: '/android-jni.yml' stages: - build-prepare @@ -30,3 +32,24 @@ libretro-build-windows-x64: - .libretro-windows-x64-mingw-make-default variables: MAKEFILE: Makefile + +# Android +android-armeabi-v7a: + extends: + - .core-defs + - .libretro-android-jni-armeabi-v7a + +android-arm64-v8a: + extends: + - .core-defs + - .libretro-android-jni-arm64-v8a + +android-x86_64: + extends: + - .core-defs + - .libretro-android-jni-x86_64 + +android-x86: + extends: + - .core-defs + - .libretro-android-jni-x86 diff --git a/nall/foreach.hpp b/nall/foreach.hpp index c0a6b1d..8c0bb96 100644 --- a/nall/foreach.hpp +++ b/nall/foreach.hpp @@ -12,7 +12,7 @@ #else #define foreach(iter, object) \ for(unsigned foreach_counter = 0, foreach_limit = container_size(object), foreach_once = 0, foreach_broken = 0; foreach_counter < foreach_limit && foreach_broken == 0; foreach_counter++, foreach_once = 0) \ - for(typeof(object[0u]) &iter = object[foreach_counter]; foreach_once == 0 && (foreach_broken = 1); foreach_once++, foreach_broken = 0) + for(__typeof__(object[0u]) &iter = object[foreach_counter]; foreach_once == 0 && (foreach_broken = 1); foreach_once++, foreach_broken = 0) #endif #endif diff --git a/snes/libretro/libretro.cpp b/snes/libretro/libretro.cpp index d1899be..104b1fb 100644 --- a/snes/libretro/libretro.cpp +++ b/snes/libretro/libretro.cpp @@ -311,16 +311,29 @@ void retro_get_system_info(struct retro_system_info *info) { } void retro_get_system_av_info(struct retro_system_av_info *info) { + struct retro_game_geometry geom; struct retro_system_timing timing = { 0.0, 32040.5 }; timing.fps = retro_get_region() == RETRO_REGION_NTSC ? 21477272.0 / 357366.0 : 21281370.0 / 425568.0; if (!interface.penviron(RETRO_ENVIRONMENT_GET_OVERSCAN, &interface.overscan)) interface.overscan = false; - struct retro_game_geometry geom = { 256, interface.overscan ? 239 : 224, 512, interface.overscan ? 478 : 448 }; + geom.base_width = 256; + if (interface.overscan) + { + geom.base_height = 239; + geom.max_height = 478; + } + else + { + geom.base_height = 224; + geom.max_height = 448; + } + geom.max_width = 512; + geom.aspect_ratio = 0.0f; - info->timing = timing; - info->geometry = geom; + info->timing = timing; + info->geometry = geom; } static bool snes_load_cartridge_normal(