diff --git a/.travis.yml b/.travis.yml index 0fa910ce2..c87503575 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,27 +3,29 @@ notifications: language: android android: components: - - platform-tools - - tools - - build-tools-27.0.3 - - android-25 - - extra-google-m2repository - - extra-android-m2repository + - platform-tools + - tools + - build-tools-27.0.3 + - android-25 + - extra-google-m2repository + - extra-android-m2repository licenses: - - android-sdk-preview-license-.+ - - android-sdk-license-.+ + - android-sdk-preview-license-.+ + - android-sdk-license-.+ sudo: false before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ +- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock +- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ cache: directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache + - "$HOME/.gradle/caches/" + - "$HOME/.gradle/wrapper/" + - "$HOME/.android/build-cache" before_install: -- test -z "$encrypted_c726d225a9d9_key" || openssl aes-256-cbc -K $encrypted_c726d225a9d9_key -iv $encrypted_c726d225a9d9_iv - -in debug.keystore.enc -out debug.keystore -d +- test -z "$encrypted_c726d225a9d9_key" || openssl aes-256-cbc -K $encrypted_c726d225a9d9_key -iv $encrypted_c726d225a9d9_iv -in secure.tar.enc -out secure.tar -d +- test -z "$encrypted_c726d225a9d9_key" || tar -xvf secure.tar +- test -z "$encrypted_c726d225a9d9_key" || mv reicast-beta-cd.jks shell/android-studio/reicast-beta-cd.jks +- test -z "$encrypted_c726d225a9d9_key" || mv reicast-beta-cd.p12 shell/android-studio/reicast-beta-cd.p12 - GIT_HASH=`git log --pretty=format:'%h' -n 1` - GIT_BUILD=`git describe --all --always`-$GIT_HASH - mkdir "$ANDROID_HOME/licenses" || true @@ -44,7 +46,8 @@ before_script: script: - cd shell/android-studio - export NUMBER_OF_PROCESSORS=2 -- ./gradlew build +- "./gradlew build" +- test -z "$encrypted_c726d225a9d9_key" || ./travis-release.sh before_deploy: - cd ../../ - mkdir -p artifacts/$GIT_BUILD/ diff --git a/core/arm_emitter/E_DataOp.h b/core/arm_emitter/E_DataOp.h index 0bf896c32..c9d8dafcb 100755 --- a/core/arm_emitter/E_DataOp.h +++ b/core/arm_emitter/E_DataOp.h @@ -153,18 +153,21 @@ ADD.SP.REG 0x008D0000 for (int i=0;i<=30;i+=2) { u32 immv=(imm32<>(32-i)); + if (i == 0) + immv = imm32; if (immv<256) { return ((i/2)<<8) | immv; } } - + return -1; } static u32 ARMImmid8r4(u32 imm8r4) { u32 rv = ARMImmid8r4_enc(imm8r4); + verify(rv!=-1); return rv; } diff --git a/core/hw/arm7/arm7.cpp b/core/hw/arm7/arm7.cpp index b3bcec1bc..b878e8407 100644 --- a/core/hw/arm7/arm7.cpp +++ b/core/hw/arm7/arm7.cpp @@ -790,7 +790,7 @@ void armv_prof(OpType opt,u32 op,u32 flg); extern "C" void arm_dispatch(); extern "C" void arm_exit(); -extern "C" void DYNACALL arm_mainloop(u32 cycl); +extern "C" void DYNACALL arm_mainloop(u32 cycl, void* regs, void* entrypoints); extern "C" void DYNACALL arm_compilecode(); template @@ -1470,7 +1470,7 @@ naked void DYNACALL arm_compilecode() } } -naked void DYNACALL arm_mainloop(u32 cycl) +naked void DYNACALL arm_mainloop(u32 cycl, void* regs, void* entrypoints) { __asm { @@ -1590,8 +1590,13 @@ void armv_end(void* codestart, u32 cycl) SUB(r5,r5,cycl,true); else { - SUB(r5,r5,256); - SUB(r5,r5,cycl-256,true); + u32 togo = cycl; + while(ARMImmid8r4_enc(togo) == -1) + { + SUB(r5,r5,256); + togo -= 256; + } + SUB(r5,r5,togo,true); } JUMP((u32)&arm_exit,CC_MI); //statically predicted as not taken JUMP((u32)&arm_dispatch); @@ -1620,7 +1625,7 @@ void arm_Run(u32 CycleCount) for (int i=0;i<32;i++) { - arm_mainloop(CycleCount/32); + arm_mainloop(CycleCount/32, arm_Reg, EntryPoints); libAICA_TimeStep(); } diff --git a/core/rec-ARM/ngen_arm.S b/core/rec-ARM/ngen_arm.S index fddaded5f..b6c74dfbf 100644 --- a/core/rec-ARM/ngen_arm.S +++ b/core/rec-ARM/ngen_arm.S @@ -217,8 +217,8 @@ push {r4,r5,r8,r9,lr} ldr r8,Xarm_Reg @load cntx ldr r4,XEntryPoints @load lookup base #else - ldr r8,=arm_Reg @load cntx - ldr r4,=EntryPoints @load lookup base + mov r8,r1 @load cntx + mov r4,r2 @load lookup base #endif ldr r5,[r8,#192] @load cycle count diff --git a/core/rec-ARM/rec_arm.cpp b/core/rec-ARM/rec_arm.cpp index 12717931c..1f43e7745 100644 --- a/core/rec-ARM/rec_arm.cpp +++ b/core/rec-ARM/rec_arm.cpp @@ -1609,7 +1609,7 @@ void ngen_compile_opcode(RuntimeBlockInfo* block, shil_opcode* op, bool staging, if (op->rs2.is_imm()) { - if (!op->rs2.is_imm_u8()) + if (!is_i8r4(op->rs2._imm)) MOV32(rs2,(u32)op->rs2._imm); else is_imm=true; diff --git a/debug.keystore.enc b/debug.keystore.enc deleted file mode 100644 index 4db92ac6e..000000000 Binary files a/debug.keystore.enc and /dev/null differ diff --git a/secure.tar.enc b/secure.tar.enc new file mode 100644 index 000000000..36ae6a2df Binary files /dev/null and b/secure.tar.enc differ diff --git a/shell/android-studio/android-studio.iml b/shell/android-studio/android-studio.iml index a53647de1..0fe7ea9f6 100644 --- a/shell/android-studio/android-studio.iml +++ b/shell/android-studio/android-studio.iml @@ -1,19 +1,16 @@ - + - + - - + - - - - + + \ No newline at end of file diff --git a/shell/android-studio/app/build.gradle b/shell/android-studio/app/build.gradle index 012e979c2..3aae870bb 100644 --- a/shell/android-studio/app/build.gradle +++ b/shell/android-studio/app/build.gradle @@ -1,4 +1,19 @@ apply plugin: 'com.android.application' +apply plugin: 'com.github.triplet.play' + +def getVersionCode = { -> + def build_id = System.getenv("TRAVIS_JOB_ID") ?: "8" + return Integer.parseInt( build_id ) +} + +def getVersionName = { -> + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'describe', '--always' + standardOutput = stdout + } + return stdout.toString().trim() +} android { compileSdkVersion 25 @@ -8,8 +23,8 @@ android { applicationId "com.reicast.emulator" minSdkVersion 16 targetSdkVersion 25 - versionCode="7" - versionName="r7" + versionCode getVersionCode() + versionName getVersionName() vectorDrawables.useSupportLibrary = true ndk { @@ -20,17 +35,29 @@ android { } } + signingConfigs { + release { + storeFile file("../reicast-beta-cd.jks") + storePassword "notasecret" + keyAlias "reicast-upload-key" + keyPassword "notasecret" + } + } + buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + signingConfig signingConfigs.release } } + externalNativeBuild { ndkBuild { path 'src/main/jni/Android.mk' } } + lintOptions { abortOnError false } @@ -51,6 +78,12 @@ afterEvaluate { } } +play { + track = 'beta' + serviceAccountEmail = 'reicast-beta-cd@api-7801059239587459896-777757.iam.gserviceaccount.com' + pk12File = file('../reicast-beta-cd.p12') +} + dependencies { compile 'com.android.support:support-v4:25.4.0' compile 'com.android.support:appcompat-v7:25.4.0' @@ -64,3 +97,4 @@ dependencies { } compile fileTree(include: ['*.jar'], dir: 'libs') } + diff --git a/shell/android-studio/app/src/main/jni/src/Android.cpp b/shell/android-studio/app/src/main/jni/src/Android.cpp index 7d827a8fc..6f11de1da 100644 --- a/shell/android-studio/app/src/main/jni/src/Android.cpp +++ b/shell/android-studio/app/src/main/jni/src/Android.cpp @@ -339,8 +339,9 @@ int msgboxf(const wchar* Text,unsigned int Type,...) va_list Args; va_start(Args,Type); - vsprintf(S,Text,Args); + vsnprintf(S, 2048,Text,Args); va_end(Args); + puts(S); int byteCount = strlen(S); jbyteArray bytes = jenv->NewByteArray(byteCount); @@ -561,5 +562,8 @@ int push_vmu_screen(u8* buffer) void os_DebugBreak() { - //notify the parent thread about it ... + // TODO: notify the parent thread about it ... + + // Attach debugger here to figure out what went wrong + for(;;) ; } diff --git a/shell/android-studio/build.gradle b/shell/android-studio/build.gradle index 6c5cbc3b0..6955c9d9e 100644 --- a/shell/android-studio/build.gradle +++ b/shell/android-studio/build.gradle @@ -6,6 +6,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.github.triplet.gradle:play-publisher:1.2.2' } } diff --git a/shell/android-studio/travis-release.sh b/shell/android-studio/travis-release.sh new file mode 100755 index 000000000..b39952c31 --- /dev/null +++ b/shell/android-studio/travis-release.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -ev +echo travis release: pr = "${TRAVIS_PULL_REQUEST}" - branch = "${TRAVIS_BRANCH}" +if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then + if [ "${TRAVIS_BRANCH}" = "master" ]; then + ./gradlew publishApkRelease + fi +fi