From 86235bb4a36b9b1e3e2f81f6b54d8b9e96837cc6 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 23 Jul 2018 15:15:05 +0200 Subject: [PATCH 001/154] Float math in alpha calculation causes some punch-through textures to have alpha noise. --- core/rend/gles/gles.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 64c8f406a..48fa1ce1e 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -336,7 +336,11 @@ void main() \n\ } \n\ #endif\n\ #if cp_AlphaTest == 1 \n\ - if (cp_AlphaTestValue>color.a) discard;\n\ + color.a = round(color.a * 255.0) / 255.0; // Fixes noised cars in Jet Grind Radio \n\ + if (cp_AlphaTestValue>color.a) \n\ + discard;\n\ + else \n\ + color.a = 1.0; \n\ #endif \n\ //color.rgb=vec3(vtx_xyz.z/255.0);\n" #ifndef GLES From 2e08d7a6c9b038cd27d1335d87cb7915e6c35b95 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 23 Jul 2018 20:55:53 +0200 Subject: [PATCH 002/154] round() not available in GLES2. Using floor() instead --- core/rend/gles/gles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 48fa1ce1e..f650daf9d 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -336,7 +336,7 @@ void main() \n\ } \n\ #endif\n\ #if cp_AlphaTest == 1 \n\ - color.a = round(color.a * 255.0) / 255.0; // Fixes noised cars in Jet Grind Radio \n\ + color.a = floor(color.a * 255.0 + 0.5) / 255.0; // Fixes noised cars in Jet Grind Radio \n\ if (cp_AlphaTestValue>color.a) \n\ discard;\n\ else \n\ From 369ecf2db2f33eb54f2ca8c36c18e932ce06bac9 Mon Sep 17 00:00:00 2001 From: "Christoph \"baka0815\" Schwerdtfeger" Date: Sun, 12 Aug 2018 09:50:14 +0200 Subject: [PATCH 003/154] evdev: Print a warning if a key is not configured --- core/linux-dist/evdev.cpp | 44 +++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/core/linux-dist/evdev.cpp b/core/linux-dist/evdev.cpp index ce203c006..030992029 100644 --- a/core/linux-dist/evdev.cpp +++ b/core/linux-dist/evdev.cpp @@ -118,12 +118,13 @@ strstr(keycode.c_str(), "BTN_") != NULL || strstr(keycode.c_str(), "ABS_") != NULL) { - if(libevdev_available) + if (libevdev_available) { int type = ((strstr(keycode.c_str(), "ABS_") != NULL) ? EV_ABS : EV_KEY); code = libevdev_event_code_from_name(type, keycode.c_str()); } - if(code < 0) + + if (code < 0) { printf("evdev: failed to find keycode for '%s'\n", keycode.c_str()); } @@ -131,27 +132,34 @@ { printf("%s = %s (%d)\n", dc_key.c_str(), keycode.c_str(), code); } - return code; } - - code = cfg->get_int(section, dc_key, -1); - if(code >= 0) + else { - char* name = NULL; - if(libevdev_available) + code = cfg->get_int(section, dc_key, -1); + if(code >= 0) { - int type = ((strstr(dc_key.c_str(), "axis_") != NULL) ? EV_ABS : EV_KEY); - name = (char*)libevdev_event_code_get_name(type, code); - } - if (name != NULL) - { - printf("%s = %s (%d)\n", dc_key.c_str(), name, code); - } - else - { - printf("%s = %d\n", dc_key.c_str(), code); + char* name = NULL; + + if (libevdev_available) + { + int type = ((strstr(dc_key.c_str(), "axis_") != NULL) ? EV_ABS : EV_KEY); + name = (char*)libevdev_event_code_get_name(type, code); + } + + if (name != NULL) + { + printf("%s = %s (%d)\n", dc_key.c_str(), name, code); + } + else + { + printf("%s = %d\n", dc_key.c_str(), code); + } } } + + if (code < 0) + printf("WARNING: %s/%s not configured!\n", section.c_str(), dc_key.c_str()); + return code; } From 660713a934745a8a393a8fde1bd6248cbfd27a83 Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sun, 12 Aug 2018 09:21:49 -0400 Subject: [PATCH 004/154] Travis: increase depth over fetching full repo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b25bb68b5..dbbbf5810 100755 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ install: - test -z "$encrypted_c726d225a9d9_key" || mv debug.keystore ~/.android/debug.keystore before_script: script: -- git fetch --unshallow +- git fetch --depth 2 - cd shell/android-studio - export NUMBER_OF_PROCESSORS=2 - sudo chmod 755 travis-build.sh From 7029af98a356725a7b570fb4d393299ed72df827 Mon Sep 17 00:00:00 2001 From: "Christoph \"baka0815\" Schwerdtfeger" Date: Mon, 13 Aug 2018 13:10:59 +0200 Subject: [PATCH 005/154] evdev/dupcheck: Don't check unassigned buttons Also removes the trailing whitespaces. --- core/linux-dist/evdev.cpp | 44 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/core/linux-dist/evdev.cpp b/core/linux-dist/evdev.cpp index ce203c006..4d63e18cd 100644 --- a/core/linux-dist/evdev.cpp +++ b/core/linux-dist/evdev.cpp @@ -196,30 +196,34 @@ }; return mapping; } - + bool input_evdev_button_assigned(EvdevControllerMapping* mapping, int button) { - return ((mapping->Btn_A == button) - || (mapping->Btn_B == button) - || (mapping->Btn_C == button) - || (mapping->Btn_D == button) - || (mapping->Btn_X == button) - || (mapping->Btn_Y == button) - || (mapping->Btn_Z == button) - || (mapping->Btn_Start == button) - || (mapping->Btn_Escape == button) - || (mapping->Btn_DPad_Left == button) - || (mapping->Btn_DPad_Right == button) - || (mapping->Btn_DPad_Up == button) - || (mapping->Btn_DPad_Down == button) - || (mapping->Btn_DPad2_Left == button) - || (mapping->Btn_DPad2_Right == button) - || (mapping->Btn_DPad2_Up == button) - || (mapping->Btn_DPad2_Down == button) - || (mapping->Btn_Trigger_Left == button) + // Don't check unassigned buttons + if (button == -1) + return false; + + return ((mapping->Btn_A == button) + || (mapping->Btn_B == button) + || (mapping->Btn_C == button) + || (mapping->Btn_D == button) + || (mapping->Btn_X == button) + || (mapping->Btn_Y == button) + || (mapping->Btn_Z == button) + || (mapping->Btn_Start == button) + || (mapping->Btn_Escape == button) + || (mapping->Btn_DPad_Left == button) + || (mapping->Btn_DPad_Right == button) + || (mapping->Btn_DPad_Up == button) + || (mapping->Btn_DPad_Down == button) + || (mapping->Btn_DPad2_Left == button) + || (mapping->Btn_DPad2_Right == button) + || (mapping->Btn_DPad2_Up == button) + || (mapping->Btn_DPad2_Down == button) + || (mapping->Btn_Trigger_Left == button) || (mapping->Btn_Trigger_Right == button)); } - + bool input_evdev_button_duplicate_button(EvdevControllerMapping* mapping1, EvdevControllerMapping* mapping2) { return (input_evdev_button_assigned(mapping1, mapping2->Btn_A) From 7a178735d19b096f7e7ae0dd597dbdf151e90b25 Mon Sep 17 00:00:00 2001 From: "Christoph \"baka0815\" Schwerdtfeger" Date: Mon, 13 Aug 2018 13:46:29 +0200 Subject: [PATCH 006/154] Linux/Makefile: Disable legacy joystick support Fixes #773. --- shell/linux/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/shell/linux/Makefile b/shell/linux/Makefile index 77ce5e5b8..8c12bf177 100644 --- a/shell/linux/Makefile +++ b/shell/linux/Makefile @@ -2,7 +2,7 @@ LOCAL_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) FOR_LINUX :=1 #NO_REC := 1 #NO_REND := 1 -WEBUI :=1 +WEBUI :=1 USE_OSS := 1 #USE_PULSEAUDIO := 1 USE_EVDEV := 1 @@ -13,19 +13,19 @@ AS=${CC_PREFIX}as STRIP=${CC_PREFIX}strip LD=${CC} -MFLAGS := -ASFLAGS := +MFLAGS := +ASFLAGS := LDFLAGS := INCS := LIBS := -CFLAGS := +CFLAGS := CXXFLAGS := ifneq (, $(filter $(shell uname -s), FreeBSD OpenBSD NetBSD DragonFly)) CFLAGS += -DTARGET_BSD else USE_ALSA := 1 - USE_JOYSTICK := 1 +# USE_JOYSTICK := 1 endif # Platform auto-detection @@ -276,8 +276,8 @@ ifdef PGO_USE endif ifdef LTO_TEST - CFLAGS += -flto -fwhole-program - LDFLAGS +=-flto -fwhole-program + CFLAGS += -flto -fwhole-program + LDFLAGS +=-flto -fwhole-program endif ifdef USE_DISPMANX @@ -363,7 +363,7 @@ all: $(CPPFILES) $(EXECUTABLE) $(EXECUTABLE_STRIPPED) ifneq (,$(findstring gcwz,$(platform))) mksquashfs $(EXECUTABLE_STRIPPED) $(GCWZ_PKG_FILES) $(GCWZ_PKG) -all-root endif - + $(EXECUTABLE): $(OBJECTS) $(CXX) $(MFLAGS) $(EXTRAFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ @@ -373,13 +373,13 @@ $(EXECUTABLE_STRIPPED): $(EXECUTABLE) $(BUILDDIR)/%.build_obj : $(RZDCY_SRC_DIR)/%.cpp mkdir -p $(dir $@) $(CXX) $(EXTRAFLAGS) $(INCS) $(CFLAGS) $(MFLAGS) $(CXXFLAGS) $< -o $@ - + $(BUILDDIR)/%.build_obj : $(RZDCY_SRC_DIR)/%.c mkdir -p $(dir $@) $(CC) $(EXTRAFLAGS) $(INCS) $(CFLAGS) $< -o $@ $(BUILDDIR)/%.build_obj : $(RZDCY_SRC_DIR)/%.S - mkdir -p $(dir $@) + mkdir -p $(dir $@) $(AS) $(ASFLAGS) $(INCS) $< -o $@ install: $(EXECUTABLE) From c430a7906c4b832bd562d06590453b5ce3be42e8 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 13 Aug 2018 21:37:59 +0200 Subject: [PATCH 007/154] Block checks for rec-cpp --- core/rec-cpp/rec_cpp.cpp | 78 +++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/core/rec-cpp/rec_cpp.cpp b/core/rec-cpp/rec_cpp.cpp index 4732489fd..8987211ab 100644 --- a/core/rec-cpp/rec_cpp.cpp +++ b/core/rec-cpp/rec_cpp.cpp @@ -20,7 +20,6 @@ #define SHIL_MODE 2 #include "hw/sh4/dyna/shil_canonical.h" - #define MIPS_COUNTER 0 struct DynaRBI : RuntimeBlockInfo @@ -35,8 +34,6 @@ struct DynaRBI : RuntimeBlockInfo } }; - - int cycle_counter; extern int mips_counter; @@ -73,7 +70,6 @@ void ngen_init() { } - void ngen_GetFeatures(ngen_features* dst) { dst->InterpreterFallback = false; @@ -90,6 +86,11 @@ u32* GetRegPtr(u32 reg) return Sh4_int_GetRegisterPtr((Sh4RegType)reg); } +void ngen_blockcheckfail(u32 pc) { + printf("REC CPP: SMC invalidation at %08X\n", pc); + rdv_BlockCheckFail(pc); +} + class opcodeExec { public: virtual void execute() = 0; @@ -813,6 +814,44 @@ struct opcode_blockend : public opcodeExec { } }; +template +struct opcode_check_block : public opcodeExec { + RuntimeBlockInfo* block; + vector code; + void* ptr; + + opcodeExec* setup(RuntimeBlockInfo* block) { + this->block = block; + ptr = GetMemPtr(block->addr, 4); + code.resize(sz == -1 ? block->sh4_code_size : sz); + memcpy(&code[0], ptr, sz == -1 ? block->sh4_code_size : sz); + + return this; + } + + void execute() { + switch (sz) + { + case 4: + if (*(u32 *)ptr != *(u32 *)&code[0]) + ngen_blockcheckfail(block->addr); + break; + case 6: + if (*(u32 *)ptr != *(u32 *)&code[0] || *((u16 *)ptr + 2) != *((u16 *)&code[0] + 2)) + ngen_blockcheckfail(block->addr); + break; + case 8: + if (*(u32 *)ptr != *(u32 *)&code[0] || *((u32 *)ptr + 1) != *((u32 *)&code[0] + 1)) + ngen_blockcheckfail(block->addr); + break; + default: + if (memcmp(ptr, &code[0], block->sh4_code_size) != 0) + ngen_blockcheckfail(block->addr); + break; + } + } +}; + #if !defined(_DEBUG) #define DREP_1(x, phrase) if (x < cnt) ops[x]->execute(); else return; #define DREP_2(x, phrase) DREP_1(x, phrase) DREP_1(x+1, phrase) @@ -1163,8 +1202,8 @@ public: opcodeExec** ptrsg; void compile(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise) { - //we need an extra one for the end opcode - auto ptrs = fnnCtor_forreal(block->oplist.size() + 1)(block->guest_cycles); + //we need an extra one for the end opcode and optionally one more for block check + auto ptrs = fnnCtor_forreal(block->oplist.size() + 1 + (force_checks ? 1 : 0))(block->guest_cycles); ptrsg = ptrs.ptrs; @@ -1177,9 +1216,30 @@ public: emit_Skip(emit_FreeSpace()-16); } - for (size_t i = 0; i < block->oplist.size(); i++) { + size_t i = 0; + if (force_checks) + { + opcodeExec* op; + switch (block->sh4_code_size) + { + case 4: + op = (new opcode_check_block<4>())->setup(block); + break; + case 6: + op = (new opcode_check_block<6>())->setup(block); + break; + case 8: + op = (new opcode_check_block<8>())->setup(block); + break; + default: + op = (new opcode_check_block<-1>())->setup(block); + break; + } + ptrs.ptrs[i++] = op; + } + for (size_t opnum = 0; opnum < block->oplist.size(); opnum++, i++) { opcode_index = i; - shil_opcode& op = block->oplist[i]; + shil_opcode& op = block->oplist[opnum]; switch (op.op) { case shop_ifb: @@ -1454,7 +1514,7 @@ public: CASEWS(BET_Cond_1); } - ptrs.ptrs[block->oplist.size()] = op; + ptrs.ptrs[i] = op; } } From c612393cf3d504a6fa8184c0362360b33cfd8ded Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Wed, 15 Aug 2018 23:54:13 -0400 Subject: [PATCH 008/154] Android: process entire joystick event history --- .../com/reicast/emulator/GL2JNIActivity.java | 106 +++++++++--------- .../com/reicast/emulator/GL2JNINative.java | 98 ++++++++-------- 2 files changed, 108 insertions(+), 96 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index 4a083e9d7..b9348e8ed 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -232,8 +232,57 @@ public class GL2JNIActivity extends Activity { } } + private void processJoystickInput(MotionEvent event, Integer playerNum) { + // Joystick + if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { + // do other things with joystick + float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); + float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); + float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); + float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); + float L2 = event.getAxisValue(OuyaController.AXIS_L2); + float R2 = event.getAxisValue(OuyaController.AXIS_R2); + + if (!pad.joystick[playerNum]) { + pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; + pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; + pad.globalLS_X[playerNum] = LS_X; + pad.globalLS_Y[playerNum] = LS_Y; + } + + GL2JNIView.jx[playerNum] = (int) (LS_X * 126); + GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); + + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + + if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { + if (RS_Y > 0.25) { + handle_key(playerNum, pad.map[playerNum][0]/* A */, true); + pad.wasKeyStick[playerNum] = true; + } else if (RS_Y < 0.25) { + handle_key(playerNum, pad.map[playerNum][1]/* B */, true); + pad.wasKeyStick[playerNum] = true; + } else if (pad.wasKeyStick[playerNum]){ + handle_key(playerNum, pad.map[playerNum][0], false); + handle_key(playerNum, pad.map[playerNum][1], false); + pad.wasKeyStick[playerNum] = false; + } + } else { + if (RS_Y > 0.25) { + GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + } else if (RS_Y < 0.25) { + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); + } + } + } + } + @Override public boolean onGenericMotionEvent(MotionEvent event) { + Integer playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId()); if (playerNum == -1) { playerNum = pad.deviceDescriptor_PlayerNum @@ -246,59 +295,16 @@ public class GL2JNIActivity extends Activity { return false; if (!pad.compat[playerNum]) { - - // Joystick - if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { - - // do other things with joystick - float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); - float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); - float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); - float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); - float L2 = event.getAxisValue(OuyaController.AXIS_L2); - float R2 = event.getAxisValue(OuyaController.AXIS_R2); - - if (!pad.joystick[playerNum]) { - pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; - pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; - pad.globalLS_X[playerNum] = LS_X; - pad.globalLS_Y[playerNum] = LS_Y; - } - - GL2JNIView.jx[playerNum] = (int) (LS_X * 126); - GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); - - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - - if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { - if (RS_Y > 0.25) { - handle_key(playerNum, pad.map[playerNum][0]/* A */, true); - pad.wasKeyStick[playerNum] = true; - } else if (RS_Y < 0.25) { - handle_key(playerNum, pad.map[playerNum][1]/* B */, true); - pad.wasKeyStick[playerNum] = true; - } else if (pad.wasKeyStick[playerNum]){ - handle_key(playerNum, pad.map[playerNum][0], false); - handle_key(playerNum, pad.map[playerNum][1], false); - pad.wasKeyStick[playerNum] = false; - } - } else { - if (RS_Y > 0.25) { - GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - } else if (RS_Y < 0.25) { - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); - } - } + final int historySize = event.getHistorySize(); + for (int i = 0; i < historySize; i++) { + processJoystickInput(event, i); } - + processJoystickInput(event, -1); } + mView.pushInput(); - // Only handle Left Stick on an Xbox 360 controller if there was - // some actual motion on the stick, - // so otherwise the event can be handled as a DPAD event + // Only handle Left Stick on an Xbox 360 controller if there was actual + // motion on the stick, otherwise event can be handled as a DPAD event return (pad.joystick[playerNum] || (!(pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum]) || !(pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]))) && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 923b96ac7..0223ccd96 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -353,6 +353,54 @@ public class GL2JNINative extends NativeActivity { && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); } + private void processJoystickInput(MotionEvent event, Integer playerNum) { + // Joystick + if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { + // do other things with joystick + float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); + float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); + float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); + float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); + float L2 = event.getAxisValue(OuyaController.AXIS_L2); + float R2 = event.getAxisValue(OuyaController.AXIS_R2); + + if (!pad.joystick[playerNum]) { + pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; + pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; + pad.globalLS_X[playerNum] = LS_X; + pad.globalLS_Y[playerNum] = LS_Y; + } + + GL2JNIView.jx[playerNum] = (int) (LS_X * 126); + GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); + + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + + if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { + if (RS_Y > 0.25) { + handle_key(playerNum, pad.map[playerNum][0]/* A */, true); + pad.wasKeyStick[playerNum] = true; + } else if (RS_Y < 0.25) { + handle_key(playerNum, pad.map[playerNum][1]/* B */, true); + pad.wasKeyStick[playerNum] = true; + } else if (pad.wasKeyStick[playerNum]){ + handle_key(playerNum, pad.map[playerNum][0], false); + handle_key(playerNum, pad.map[playerNum][1], false); + pad.wasKeyStick[playerNum] = false; + } + } else { + if (RS_Y > 0.25) { + GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + } else if (RS_Y < 0.25) { + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); + } + } + } + } + @Override public boolean onGenericMotionEvent(MotionEvent event) { // Log.w("INPUT", event.toString() + " " + event.getSource()); @@ -371,53 +419,11 @@ public class GL2JNINative extends NativeActivity { return false; } if (!pad.compat[playerNum]) { - - // Joystick - if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { - - // do other things with joystick - float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); - float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); - float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); - float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); - float L2 = event.getAxisValue(OuyaController.AXIS_L2); - float R2 = event.getAxisValue(OuyaController.AXIS_R2); - - if (!pad.joystick[playerNum]) { - pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; - pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; - pad.globalLS_X[playerNum] = LS_X; - pad.globalLS_Y[playerNum] = LS_Y; - } - - GL2JNIView.jx[playerNum] = (int) (LS_X * 126); - GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); - - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - - if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { - if (RS_Y > 0.25) { - handle_key(playerNum, pad.map[playerNum][0]/* A */, true); - pad.wasKeyStick[playerNum] = true; - } else if (RS_Y < 0.25) { - handle_key(playerNum, pad.map[playerNum][1]/* B */, true); - pad.wasKeyStick[playerNum] = true; - } else if (pad.wasKeyStick[playerNum]){ - handle_key(playerNum, pad.map[playerNum][0], false); - handle_key(playerNum, pad.map[playerNum][1], false); - pad.wasKeyStick[playerNum] = false; - } - } else { - if (RS_Y > 0.25) { - GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - } else if (RS_Y < 0.25) { - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); - } - } + final int historySize = event.getHistorySize(); + for (int i = 0; i < historySize; i++) { + processJoystickInput(event, i); } + processJoystickInput(event, -1); } mView.pushInput(); if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]) From a3f585ea1cb43687d64d9afa0a5cdfde8d8c0f1c Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Thu, 16 Aug 2018 19:59:25 -0400 Subject: [PATCH 009/154] Port the dynarec safe flag from nullDC (See #84) --- core/hw/sh4/dyna/decoder.cpp | 5 +++- core/nullDC.cpp | 1 + core/types.h | 1 + .../java/com/reicast/emulator/Emulator.java | 4 +++ .../emulator/config/OptionsFragment.java | 18 ++++++++++++ .../java/com/reicast/emulator/emu/JNIdc.java | 1 + .../reicast/src/main/jni/src/Android.cpp | 6 ++++ .../res/layout-v14/configure_fragment.xml | 28 +++++++++++++++++++ .../main/res/layout/configure_fragment.xml | 28 +++++++++++++++++++ .../reicast/src/main/res/values/strings.xml | 1 + 10 files changed, 92 insertions(+), 1 deletion(-) diff --git a/core/hw/sh4/dyna/decoder.cpp b/core/hw/sh4/dyna/decoder.cpp index bd547cc97..ab6de73e1 100644 --- a/core/hw/sh4/dyna/decoder.cpp +++ b/core/hw/sh4/dyna/decoder.cpp @@ -690,7 +690,10 @@ u32 MatchDiv32(u32 pc , Sh4RegType ®1,Sh4RegType ®2 , Sh4RegType ®3) break; } - return match; + if (settings.dynarec.safemode) + return 0; + else + return match; } bool MatchDiv32u(u32 op,u32 pc) { diff --git a/core/nullDC.cpp b/core/nullDC.cpp index e4beb21cb..3006a004f 100755 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -247,6 +247,7 @@ void LoadSettings() settings.dynarec.Enable = cfgLoadInt("config","Dynarec.Enabled", 1)!=0; settings.dynarec.idleskip = cfgLoadInt("config","Dynarec.idleskip",1)!=0; settings.dynarec.unstable_opt = cfgLoadInt("config","Dynarec.unstable-opt",0); + settings.dynarec.safemode = cfgLoadInt("config","Dynarec.safemode",0); //disable_nvmem can't be loaded, because nvmem init is before cfg load settings.dreamcast.cable = cfgLoadInt("config","Dreamcast.Cable",3); settings.dreamcast.RTC = cfgLoadInt("config","Dreamcast.RTC",GetRTC_now()); diff --git a/core/types.h b/core/types.h index a682d2591..e846e8cee 100644 --- a/core/types.h +++ b/core/types.h @@ -624,6 +624,7 @@ struct settings_t bool Enable; bool idleskip; bool unstable_opt; + bool safemode; bool disable_nvmem; } dynarec; diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java index ce2d104e1..a37b7beaa 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/Emulator.java @@ -14,6 +14,7 @@ public class Emulator extends Application { public static final String pref_nativeact = "enable_native"; public static final String pref_dynarecopt = "dynarec_opt"; public static final String pref_unstable = "unstable_opt"; + public static final String pref_dynsafemode = "dyn_safemode"; public static final String pref_cable = "dc_cable"; public static final String pref_dcregion = "dc_region"; public static final String pref_broadcast = "dc_broadcast"; @@ -31,6 +32,7 @@ public class Emulator extends Application { public static boolean dynarecopt = true; public static boolean idleskip = true; public static boolean unstableopt = false; + public static boolean dynsafemode = false; public static int cable = 3; public static int dcregion = 3; public static int broadcast = 4; @@ -55,6 +57,7 @@ public class Emulator extends Application { public void getConfigurationPrefs(SharedPreferences mPrefs) { Emulator.dynarecopt = mPrefs.getBoolean(pref_dynarecopt, dynarecopt); Emulator.unstableopt = mPrefs.getBoolean(pref_unstable, unstableopt); + Emulator.dynsafemode = mPrefs.getBoolean(pref_dynsafemode, dynsafemode); Emulator.cable = mPrefs.getInt(pref_cable, cable); Emulator.dcregion = mPrefs.getInt(pref_dcregion, dcregion); Emulator.broadcast = mPrefs.getInt(pref_broadcast, broadcast); @@ -79,6 +82,7 @@ public class Emulator extends Application { JNIdc.dynarec(Emulator.dynarecopt ? 1 : 0); JNIdc.idleskip(Emulator.idleskip ? 1 : 0); JNIdc.unstable(Emulator.unstableopt ? 1 : 0); + JNIdc.safemode(Emulator.dynsafemode ? 1 : 0); JNIdc.cable(Emulator.cable); JNIdc.region(Emulator.dcregion); JNIdc.broadcast(Emulator.broadcast); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java index ed619ef59..ab72e5e0e 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java @@ -299,6 +299,23 @@ public class OptionsFragment extends Fragment { } unstable_opt.setOnCheckedChangeListener(unstable_option); + OnCheckedChangeListener safemode_option = new OnCheckedChangeListener() { + + public void onCheckedChanged(CompoundButton buttonView, + boolean isChecked) { + mPrefs.edit().putBoolean(Emulator.pref_dynsafemode, isChecked).apply(); + Emulator.dynsafemode = isChecked; + } + }; + CompoundButton safemode_opt = (CompoundButton) getView().findViewById( + R.id.dynarec_safemode); + if (Emulator.dynsafemode) { + safemode_opt.setChecked(true); + } else { + safemode_opt.setChecked(false); + } + safemode_opt.setOnCheckedChangeListener(safemode_option); + String[] cables = getResources().getStringArray( R.array.cable); Spinner cable_spnr = (Spinner) getView().findViewById( @@ -711,6 +728,7 @@ public class OptionsFragment extends Fragment { mPrefs.edit().remove(Emulator.pref_nativeact).apply(); mPrefs.edit().remove(Emulator.pref_dynarecopt).apply(); mPrefs.edit().remove(Emulator.pref_unstable).apply(); + mPrefs.edit().remove(Emulator.pref_dynsafemode).apply(); mPrefs.edit().remove(Emulator.pref_cable).apply(); mPrefs.edit().remove(Emulator.pref_dcregion).apply(); mPrefs.edit().remove(Emulator.pref_broadcast).apply(); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java index c8ff57266..7d3093bca 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java @@ -31,6 +31,7 @@ public final class JNIdc public static native void dynarec(int dynarec); public static native void idleskip(int idleskip); public static native void unstable(int unstable); + public static native void safemode(int safemode); public static native void cable(int cable); public static native void region(int region); public static native void broadcast(int broadcast); diff --git a/shell/android-studio/reicast/src/main/jni/src/Android.cpp b/shell/android-studio/reicast/src/main/jni/src/Android.cpp index f9799078f..f14384394 100644 --- a/shell/android-studio/reicast/src/main/jni/src/Android.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/Android.cpp @@ -48,6 +48,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_dynarec(JNIEnv *env,jobject obj, jint dynarec) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_idleskip(JNIEnv *env,jobject obj, jint idleskip) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_unstable(JNIEnv *env,jobject obj, jint unstable) __attribute__((visibility("default"))); + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_safemode(JNIEnv *env,jobject obj, jint safemode) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_cable(JNIEnv *env,jobject obj, jint cable) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_region(JNIEnv *env,jobject obj, jint region) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_broadcast(JNIEnv *env,jobject obj, jint broadcast) __attribute__((visibility("default"))); @@ -81,6 +82,11 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_unstable(JNIEnv *env, settings.dynarec.unstable_opt = unstable; } +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_safemode(JNIEnv *env,jobject obj, jint safemode) +{ + settings.dynarec.safemode = safemode; +} + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_cable(JNIEnv *env,jobject obj, jint cable) { settings.dreamcast.cable = cable; diff --git a/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml b/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml index ba05ab53c..13495f88b 100644 --- a/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml @@ -273,6 +273,34 @@ + + + + + + + + + + diff --git a/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml b/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml index 182e163dc..11395fbae 100644 --- a/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout/configure_fragment.xml @@ -273,6 +273,34 @@ + + + + + + + + + + diff --git a/shell/android-studio/reicast/src/main/res/values/strings.xml b/shell/android-studio/reicast/src/main/res/values/strings.xml index a9d1751dc..75be0700b 100644 --- a/shell/android-studio/reicast/src/main/res/values/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values/strings.xml @@ -38,6 +38,7 @@ Native Gamepad Mode [No OSD] Dynarec Options Unstable Optimisations + Dynarec Safemode Cable Type DC Region Broadcast From a01016d4ad3e754b0c327d9e67ef252414715660 Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Thu, 16 Aug 2018 22:09:16 -0400 Subject: [PATCH 010/154] Android: Only prompt for bios if NOT using reios --- .../java/com/reicast/emulator/FileBrowser.java | 3 +-- .../java/com/reicast/emulator/MainActivity.java | 16 +++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java index a72ad3ac2..fac533da5 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java @@ -175,9 +175,8 @@ public class FileBrowser extends Fragment { String temp = mPrefs.getString(Config.pref_home, null); if (temp == null || !new File(temp).isDirectory()) { showToastMessage(getActivity().getString(R.string.config_home), Snackbar.LENGTH_LONG); - } else { - installButtons(); } + installButtons(); if (!ImgBrowse && !games) { new LocateGames(R.array.flash).execute(home_directory); } else { diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java index dde0278ab..3998fd3e3 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java @@ -231,13 +231,15 @@ public class MainActivity extends AppCompatActivity implements String home_directory = mPrefs.getString(Config.pref_home, Environment.getExternalStorageDirectory().getAbsolutePath()); - if (!isBiosExisting(home_directory)) { - launchBIOSdetection(); - return; - } - if (!isFlashExisting(home_directory)) { - launchBIOSdetection(); - return; + if (!mPrefs.getBoolean(Emulator.pref_usereios, false)) { + if (!isBiosExisting(home_directory)) { + launchBIOSdetection(); + return; + } + if (!isFlashExisting(home_directory)) { + launchBIOSdetection(); + return; + } } JNIdc.config(home_directory); From e66b10ce301ae8086feb750ac021fdd939205ebd Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Thu, 16 Aug 2018 22:46:27 -0400 Subject: [PATCH 011/154] Android: Remove forced compatibility mode --- .../src/main/java/com/reicast/emulator/GL2JNIActivity.java | 7 ------- .../src/main/java/com/reicast/emulator/GL2JNINative.java | 7 ------- 2 files changed, 14 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index b9348e8ed..ecebb2904 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -76,13 +76,6 @@ public class GL2JNIActivity extends Activity { * catch (IOException e) { e.getMessage(); e.printStackTrace(); } */ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - pad.compat[0] = true; - pad.compat[1] = true; - pad.compat[2] = true; - pad.compat[3] = true; - } - String fileName = null; // Call parent onCreate() diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 0223ccd96..12b208793 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -75,13 +75,6 @@ public class GL2JNINative extends NativeActivity { app.getConfigurationPrefs(prefs); menu = new OnScreenMenu(GL2JNINative.this, prefs); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - pad.compat[0] = true; - pad.compat[1] = true; - pad.compat[2] = true; - pad.compat[3] = true; - } - String fileName = null; // Call parent onCreate() From b1f81bd54fb56acfa3d2addadd23bb39bef9170f Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Thu, 16 Aug 2018 23:39:59 -0400 Subject: [PATCH 012/154] Android: Do not process history index as player --- .../com/reicast/emulator/GL2JNIActivity.java | 18 +++++++++--------- .../com/reicast/emulator/GL2JNINative.java | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index ecebb2904..07869b2ae 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -225,16 +225,16 @@ public class GL2JNIActivity extends Activity { } } - private void processJoystickInput(MotionEvent event, Integer playerNum) { + private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { // Joystick if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { // do other things with joystick - float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); - float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); - float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); - float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); - float L2 = event.getAxisValue(OuyaController.AXIS_L2); - float R2 = event.getAxisValue(OuyaController.AXIS_R2); + float LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); + float LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); + float RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); + float RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); + float L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); + float R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); if (!pad.joystick[playerNum]) { pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; @@ -290,9 +290,9 @@ public class GL2JNIActivity extends Activity { if (!pad.compat[playerNum]) { final int historySize = event.getHistorySize(); for (int i = 0; i < historySize; i++) { - processJoystickInput(event, i); + processJoystickInput(event, playerNum, i); } - processJoystickInput(event, -1); + processJoystickInput(event, playerNum, -1); } mView.pushInput(); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 12b208793..291a21c7b 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -346,16 +346,16 @@ public class GL2JNINative extends NativeActivity { && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); } - private void processJoystickInput(MotionEvent event, Integer playerNum) { + private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { // Joystick if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { // do other things with joystick - float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); - float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); - float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); - float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); - float L2 = event.getAxisValue(OuyaController.AXIS_L2); - float R2 = event.getAxisValue(OuyaController.AXIS_R2); + float LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); + float LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); + float RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); + float RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); + float L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); + float R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); if (!pad.joystick[playerNum]) { pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; @@ -414,9 +414,9 @@ public class GL2JNINative extends NativeActivity { if (!pad.compat[playerNum]) { final int historySize = event.getHistorySize(); for (int i = 0; i < historySize; i++) { - processJoystickInput(event, i); + processJoystickInput(event, playerNum, i); } - processJoystickInput(event, -1); + processJoystickInput(event, playerNum, -1); } mView.pushInput(); if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]) From 632a5eb0650f2798d18b5e873609b799e1efa227 Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Fri, 17 Aug 2018 00:18:43 -0400 Subject: [PATCH 013/154] Android: Strip out broken Moga implementation --- .../reicast/libs/com.bda.controller.jar | Bin 30211 -> 0 bytes .../com/reicast/emulator/GL2JNIActivity.java | 72 +----- .../com/reicast/emulator/GL2JNINative.java | 80 +------ .../emulator/config/InputFragment.java | 57 +---- .../com/reicast/emulator/periph/Gamepad.java | 5 +- .../reicast/emulator/periph/MOGAInput.java | 224 ------------------ .../com/reicast/emulator/periph/MogaHack.java | 118 --------- 7 files changed, 13 insertions(+), 543 deletions(-) delete mode 100644 shell/android-studio/reicast/libs/com.bda.controller.jar delete mode 100644 shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MOGAInput.java delete mode 100644 shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MogaHack.java diff --git a/shell/android-studio/reicast/libs/com.bda.controller.jar b/shell/android-studio/reicast/libs/com.bda.controller.jar deleted file mode 100644 index f71dbece3486a143c4fe6feba4152a71587ebba6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30211 zcmbrl1CVUn7Oq*lY}>YN+qP|6yKLLGxy!a~yK0xQ%XoF}z1{ty-#h2_i_VA@kr5f0 zx#pbz_~t+67)xFX2pAav92^`VG)O=Y;D34{0{{cah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l_8>g!>JmWmK|km>)+=*Kj?<6pl4A|%;Kt#2;+?_Spk<< zop0ZENb343+1mZp(Y0lb0|GmN2}o|A!tS$g1yXQ_vIFCt?-A(ysX4Tb-E+0vrckQdeIN+*M^+Qrk;h~rAO9T6A*oz7jTPmyF>7Rdc}Aw@FgA0=W1Xr zILrJQfcrRoB;@);$mqug<7M|*ro+q1Z)_AYZ%X9UCUiYPCxxgWW{Z*dhgF~f=q*gm&TW3J?zEnc((7Bj4}frawNIi-=uLz%AK?=WgsY> zU7`fQ3c}P)#3|IrNd)Q)r)sjF`Y_Y+ZpsOc^Xeg6Y8>N9l+CfetQ^hznq*kUt5FH3 ztLH(>gfFpR6F& zQ=L$+@^2e)4kw?dD`IUv1QhG69@eI|Iguh+mXS}C2_;r*Zy=(EHEePc@z&HNd|c1mME_ z_p9|QMev{TpQ`0PlJM`whw>-cR^v^>)6;^#zhxl$Pfc(VYKf+&p>_-va zpW&YhCOxvc?-qga2l!t*=u^R=$Gn5@_JZ^efIq4({XEmBGCz-cMc<8#><_^IIN`4+ z{8X6ZQ6%WQL6iRy_en+3|DEywsE7G^@=puRe|(E&fa>yJyv2VTv0DAR z2?5;xzrp_+`DtP2<0Z>?s|F+&{2uvfG3Qe~rJon)X?@p^J8(GQh5Yw1e*FYbOP_vp z$UVRY`k&B$4g54u_{XK8<@yuwKmYuH^qZ&oJwGmuy72#Ij9)*&(?G(I1BR^_-tF&>vS} f*zA{p|AX4gN`L{1%z=P#0YA0SKtN0ukAM9i2(pxg diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index 07869b2ae..871227b95 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -28,7 +28,6 @@ import com.reicast.emulator.emu.OnScreenMenu.FpsPopup; import com.reicast.emulator.emu.OnScreenMenu.MainPopup; import com.reicast.emulator.emu.OnScreenMenu.VmuPopup; import com.reicast.emulator.periph.Gamepad; -import com.reicast.emulator.periph.MOGAInput; import com.reicast.emulator.periph.SipEmulator; import java.util.Arrays; @@ -42,7 +41,6 @@ public class GL2JNIActivity extends Activity { public MainPopup popUp; VmuPopup vmuPop; FpsPopup fpsPop; - MOGAInput moga = new MOGAInput(); private SharedPreferences prefs; private Gamepad pad = new Gamepad(); @@ -93,9 +91,6 @@ public class GL2JNIActivity extends Activity { prefs.getString(Gamepad.pref_player4, null), 3); pad.deviceDescriptor_PlayerNum.remove(null); - moga.onCreate(this, pad); - moga.mListener.setPlayerNum(1); - boolean controllerTwoConnected = false; boolean controllerThreeConnected = false; boolean controllerFourConnected = false; @@ -166,7 +161,10 @@ public class GL2JNIActivity extends Activity { } else if (InputDevice.getDevice(joy).getName() .contains(Gamepad.controllers_shield)) { pad.map[playerNum] = pad.getConsoleController(); - } else if (!pad.isActiveMoga[playerNum]) { // Ouya controller + } else if (InputDevice.getDevice(joy).getName() + .startsWith(Gamepad.controllers_moga)) { + pad.map[playerNum] = pad.getMogaController(); + } else { // Ouya controller pad.map[playerNum] = pad.getOUYAController(); } } else { @@ -303,65 +301,6 @@ public class GL2JNIActivity extends Activity { && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); } - public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) { - if (playerNum == null || playerNum == -1) - return false; - - if (!pad.compat[playerNum]) { - - // do other things with joystick - float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); - float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); - float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); - float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); - float L2 = event.getAxisValue(OuyaController.AXIS_L2); - float R2 = event.getAxisValue(OuyaController.AXIS_R2); - - if (!pad.joystick[playerNum]) { - pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; - pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; - pad.globalLS_X[playerNum] = LS_X; - pad.globalLS_Y[playerNum] = LS_Y; - } - - GL2JNIView.jx[playerNum] = (int) (LS_X * 126); - GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); - - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - - if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { - if (RS_Y > 0.25) { - handle_key(playerNum, pad.map[playerNum][0]/* A */, true); - pad.wasKeyStick[playerNum] = true; - } else if (RS_Y < 0.25) { - handle_key(playerNum, pad.map[playerNum][1]/* B */, true); - pad.wasKeyStick[playerNum] = true; - } else if (pad.wasKeyStick[playerNum]){ - handle_key(playerNum, pad.map[playerNum][0], false); - handle_key(playerNum, pad.map[playerNum][1], false); - pad.wasKeyStick[playerNum] = false; - } - } else { - if (RS_Y > 0.25) { - GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - } else if (RS_Y < 0.25) { - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); - } - } - - } - mView.pushInput(); - // Only handle Left Stick on an Xbox 360 controller if there was - // some actual motion on the stick, - // so otherwise the event can be handled as a DPAD event - return (pad.joystick[playerNum] || (!(pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum]) - || !(pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]))) - && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); - } - public boolean simulatedTouchEvent(int playerNum, float L2, float R2) { GL2JNIView.lt[playerNum] = (int) (L2 * 255); GL2JNIView.rt[playerNum] = (int) (R2 * 255); @@ -559,7 +498,6 @@ public class GL2JNIActivity extends Activity { super.onPause(); mView.onPause(); JNIdc.pause(); - moga.onPause(); } @Override @@ -567,7 +505,6 @@ public class GL2JNIActivity extends Activity { super.onDestroy(); mView.onDestroy(); JNIdc.destroy(); - moga.onDestroy(); } @Override @@ -579,6 +516,5 @@ public class GL2JNIActivity extends Activity { protected void onResume() { super.onResume(); mView.onResume(); - moga.onResume(); } } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 291a21c7b..d632c810d 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -28,7 +28,6 @@ import com.reicast.emulator.emu.OnScreenMenu.FpsPopup; import com.reicast.emulator.emu.OnScreenMenu.MainPopup; import com.reicast.emulator.emu.OnScreenMenu.VmuPopup; import com.reicast.emulator.periph.Gamepad; -import com.reicast.emulator.periph.MOGAInput; import com.reicast.emulator.periph.SipEmulator; import java.util.Arrays; @@ -42,7 +41,6 @@ public class GL2JNINative extends NativeActivity { public MainPopup popUp; VmuPopup vmuPop; FpsPopup fpsPop; - MOGAInput moga = new MOGAInput(); private SharedPreferences prefs; private Gamepad pad = new Gamepad(); @@ -92,9 +90,6 @@ public class GL2JNINative extends NativeActivity { prefs.getString(Gamepad.pref_player4, null), 3); pad.deviceDescriptor_PlayerNum.remove(null); - moga.onCreate(this, pad); - moga.mListener.setPlayerNum(1); - boolean controllerTwoConnected = false; boolean controllerThreeConnected = false; boolean controllerFourConnected = false; @@ -166,7 +161,10 @@ public class GL2JNINative extends NativeActivity { } else if (InputDevice.getDevice(joy).getName() .contains(Gamepad.controllers_shield)) { pad.map[playerNum] = pad.getConsoleController(); - } else if (!pad.isActiveMoga[playerNum]) { // Ouya controller + } else if (InputDevice.getDevice(joy).getName() + .startsWith(Gamepad.controllers_moga)) { + pad.map[playerNum] = pad.getMogaController(); + } else { // Ouya controller pad.map[playerNum] = pad.getOUYAController(); } } else{ @@ -287,65 +285,6 @@ public class GL2JNINative extends NativeActivity { LayoutParams.WRAP_CONTENT); } - public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) { - if (playerNum == null || playerNum == -1) - return false; - - if (!pad.compat[playerNum]) { - - // do other things with joystick - float LS_X = event.getAxisValue(OuyaController.AXIS_LS_X); - float LS_Y = event.getAxisValue(OuyaController.AXIS_LS_Y); - float RS_X = event.getAxisValue(OuyaController.AXIS_RS_X); - float RS_Y = event.getAxisValue(OuyaController.AXIS_RS_Y); - float L2 = event.getAxisValue(OuyaController.AXIS_L2); - float R2 = event.getAxisValue(OuyaController.AXIS_R2); - - if (!pad.joystick[playerNum]) { - pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; - pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; - pad.globalLS_X[playerNum] = LS_X; - pad.globalLS_Y[playerNum] = LS_Y; - } - - GL2JNIView.jx[playerNum] = (int) (LS_X * 126); - GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); - - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - - if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { - if (RS_Y > 0.25) { - handle_key(playerNum, pad.map[playerNum][0]/* A */, true); - pad.wasKeyStick[playerNum] = true; - } else if (RS_Y < 0.25) { - handle_key(playerNum, pad.map[playerNum][1]/* B */, true); - pad.wasKeyStick[playerNum] = true; - } else if (pad.wasKeyStick[playerNum]){ - handle_key(playerNum, pad.map[playerNum][0], false); - handle_key(playerNum, pad.map[playerNum][1], false); - pad.wasKeyStick[playerNum] = false; - } - } else { - if (RS_Y > 0.25) { - GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - } else if (RS_Y < 0.25) { - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); - } - } - - } - mView.pushInput(); - // Only handle Left Stick on an Xbox 360 controller if there was - // some actual motion on the stick, - // so otherwise the event can be handled as a DPAD event - return (pad.joystick[playerNum] || (!(pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum]) - || !(pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]))) - && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); - } - private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { // Joystick if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { @@ -421,9 +360,8 @@ public class GL2JNINative extends NativeActivity { mView.pushInput(); if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]) || (pad.previousLS_X[playerNum] == 0.0f && pad.previousLS_Y[playerNum] == 0.0f)) - // Only handle Left Stick on an Xbox 360 controller if there was - // some actual motion on the stick, - // so otherwise the event can be handled as a DPAD event + // Only handle Left Stick on an Xbox 360 controller if there was actual + // motion on the stick, otherwise event can be handled as a DPAD event return false; else return true; @@ -438,9 +376,6 @@ public class GL2JNINative extends NativeActivity { if (kc == pad.getSelectButtonCode()) { return false; } - if (pad.isActiveMoga[playerNum]) { - return false; - } boolean rav = false; for (int i = 0; i < pad.map[playerNum].length; i += 2) { @@ -574,7 +509,6 @@ public class GL2JNINative extends NativeActivity { super.onPause(); mView.onPause(); JNIdc.pause(); - moga.onPause(); } @Override @@ -582,7 +516,6 @@ public class GL2JNINative extends NativeActivity { super.onDestroy(); mView.onDestroy(); JNIdc.destroy(); - moga.onDestroy(); } @Override @@ -594,6 +527,5 @@ public class GL2JNINative extends NativeActivity { protected void onResume() { super.onResume(); mView.onResume(); - moga.onResume(); } } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/InputFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/InputFragment.java index cfa61c0fb..65dbbf869 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/InputFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/InputFragment.java @@ -1,6 +1,5 @@ package com.reicast.emulator.config; -import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; @@ -8,10 +7,8 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; -import android.os.Build; import android.os.Bundle; import android.os.Environment; -import android.os.Handler; import android.os.Vibrator; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; @@ -27,18 +24,12 @@ import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.SeekBar; -import android.widget.TableLayout; import android.widget.TextView; import android.widget.Toast; -import com.bda.controller.Controller; -import com.bda.controller.ControllerListener; -import com.bda.controller.MotionEvent; -import com.bda.controller.StateEvent; import com.reicast.emulator.MainActivity; import com.reicast.emulator.R; import com.reicast.emulator.periph.Gamepad; -import com.reicast.emulator.periph.MOGAInput; public class InputFragment extends Fragment { @@ -49,7 +40,6 @@ public class InputFragment extends Fragment { private CompoundButton micPluggedIntoFirstController; private Gamepad pad = new Gamepad(); - public MOGAInput moga = new MOGAInput(); Vibrator vib; // Container Activity must implement this interface @@ -66,9 +56,6 @@ public class InputFragment extends Fragment { @Override public void onViewCreated(View view, Bundle savedInstanceState) { - moga.onCreate(getActivity(), pad); - moga.mListener.setPlayerNum(1); - sharedPreferences = PreferenceManager .getDefaultSharedPreferences(getActivity()); @@ -422,13 +409,7 @@ public class InputFragment extends Fragment { if (keyCode == KeyEvent.KEYCODE_BACK) return false; - String descriptor = null; - if (pad.isActiveMoga[listenForButton]) { - MogaListener config = new MogaListener(listenForButton); - moga.mController.setListener(config, new Handler()); - descriptor = config.getController(); - } - descriptor = InputDevice.getDevice(event.getDeviceId()).getDescriptor(); + String descriptor = InputDevice.getDevice(event.getDeviceId()).getDescriptor(); if (descriptor == null) return false; @@ -495,40 +476,4 @@ public class InputFragment extends Fragment { updateControllers(); } - - private final class MogaListener implements ControllerListener { - - private int playerNum; - private String controllerId; - - public MogaListener(int playerNum) { - this.playerNum = playerNum; - } - - public void onKeyEvent(com.bda.controller.KeyEvent event) { - controllerId = String.valueOf(event.getControllerId()); - } - - public void onMotionEvent(MotionEvent arg0) { - - } - - public String getController() { - return controllerId; - } - - public void onStateEvent(StateEvent event) { - if (event.getState() == StateEvent.STATE_CONNECTION && - event.getAction() == MOGAInput.ACTION_CONNECTED) { - - int mControllerVersion = moga.mController - .getState(Controller.STATE_CURRENT_PRODUCT_VERSION); - - if (mControllerVersion == Controller.ACTION_VERSION_MOGA || - mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) { - pad.isActiveMoga[playerNum] = true; - } - } - } - } } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java index c47378a58..b761c1d92 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java @@ -48,6 +48,8 @@ public class Gamepad { public static final String controllers_xbox = "Microsoft X-Box 360 pad"; public static final String controllers_shield = "NVIDIA Corporation NVIDIA Controller"; public static final String controllers_gamekey = "gamekeyboard"; + public static final String controllers_moga = "Moga"; + public String[] portId = { "_A", "_B", "_C", "_D" }; public boolean[] compat = { false, false, false, false }; @@ -62,9 +64,6 @@ public class Gamepad { public SparseArray deviceId_deviceDescriptor = new SparseArray<>(); public HashMap deviceDescriptor_PlayerNum = new HashMap<>(); - public boolean isActiveMoga[] = { false, false, false, false }; - public boolean isMogaPro[] = { false, false, false, false }; - public SparseIntArray playerNumX = new SparseIntArray(); public boolean isOuyaOrTV; diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MOGAInput.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MOGAInput.java deleted file mode 100644 index 5d4217fd9..000000000 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MOGAInput.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.reicast.emulator.periph; - - -/******************************************************************************/ - -import android.app.Activity; -import android.content.SharedPreferences; -import android.os.Build; -import android.os.Handler; -import android.preference.PreferenceManager; -import android.util.Log; - -import com.bda.controller.Controller; -import com.bda.controller.ControllerListener; -import com.bda.controller.KeyEvent; -import com.bda.controller.MotionEvent; -import com.bda.controller.StateEvent; -import com.reicast.emulator.GL2JNIActivity; -import com.reicast.emulator.GL2JNINative; -import com.reicast.emulator.R; - -import java.util.Arrays; - -/******************************************************************************/ - -/* - - */ -public final class MOGAInput -{ - private SharedPreferences prefs; - - static final int DELAY = 1000 / 50; // 50 Hz - - public static final int ACTION_CONNECTED = Controller.ACTION_CONNECTED; - static final int ACTION_DISCONNECTED = Controller.ACTION_DISCONNECTED; - static final int ACTION_VERSION_MOGA = Controller.ACTION_VERSION_MOGA; - static final int ACTION_VERSION_MOGAPRO = Controller.ACTION_VERSION_MOGAPRO; - - public Controller mController = null; - public ExampleControllerListener mListener; - private String notify; - private Gamepad pad; - - private Activity act; - - public MOGAInput() - { - /* - mStates.put(StateEvent.STATE_CONNECTION, new ExampleInteger("STATE_CONNECTION......")); - mStates.put(StateEvent.STATE_POWER_LOW, new ExampleInteger("STATE_POWER_LOW......")); - mStates.put(StateEvent.STATE_CURRENT_PRODUCT_VERSION, new ExampleInteger("STATE_CURRENT_PRODUCT_VERSION")); - mStates.put(StateEvent.STATE_SUPPORTED_PRODUCT_VERSION, new ExampleInteger("STATE_SUPPORTED_PRODUCT_VERSION")); - - mKeys.put(KeyEvent.KEYCODE_DPAD_UP, new ExampleInteger("KEYCODE_DPAD_UP......")); - mKeys.put(KeyEvent.KEYCODE_DPAD_DOWN, new ExampleInteger("KEYCODE_DPAD_DOWN......")); - mKeys.put(KeyEvent.KEYCODE_DPAD_LEFT, new ExampleInteger("KEYCODE_DPAD_LEFT......")); - mKeys.put(KeyEvent.KEYCODE_DPAD_RIGHT, new ExampleInteger("KEYCODE_DPAD_RIGHT......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_A, new ExampleInteger("KEYCODE_BUTTON_A......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_B, new ExampleInteger("KEYCODE_BUTTON_B......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_X, new ExampleInteger("KEYCODE_BUTTON_X......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_Y, new ExampleInteger("KEYCODE_BUTTON_Y......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_L1, new ExampleInteger("KEYCODE_BUTTON_L1......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_R1, new ExampleInteger("KEYCODE_BUTTON_R1......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_L2, new ExampleInteger("KEYCODE_BUTTON_L2......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_R2, new ExampleInteger("KEYCODE_BUTTON_R2......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_THUMBL, new ExampleInteger("KEYCODE_BUTTON_THUMBL......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_THUMBR, new ExampleInteger("KEYCODE_BUTTON_THUMBR......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_START, new ExampleInteger("KEYCODE_BUTTON_START......")); - mKeys.put(KeyEvent.KEYCODE_BUTTON_SELECT, new ExampleInteger("KEYCODE_BUTTON_SELECT......")); - - mMotions.put(MotionEvent.AXIS_X, new ExampleFloat("AXIS_X.........")); - mMotions.put(MotionEvent.AXIS_Y, new ExampleFloat("AXIS_Y.........")); - mMotions.put(MotionEvent.AXIS_Z, new ExampleFloat("AXIS_Z.........")); - mMotions.put(MotionEvent.AXIS_RZ, new ExampleFloat("AXIS_RZ.......")); - mMotions.put(MotionEvent.AXIS_LTRIGGER, new ExampleFloat("AXIS_LTRIGGER.........")); - mMotions.put(MotionEvent.AXIS_RTRIGGER, new ExampleFloat("AXIS_RTRIGGER.........")); - */ - } - - public void onCreate(Activity act, Gamepad pad) { - this.act = act; - - this.pad = pad; - - prefs = PreferenceManager - .getDefaultSharedPreferences(act.getApplicationContext()); - - mController = Controller.getInstance(act); -// mController.init(); - MogaHack.init(mController, this.act); - mListener = new ExampleControllerListener(); - mController.setListener(mListener, new Handler()); - } - - public void onDestroy() - { - mController.exit(); - } - - public void onPause() - { - mController.onPause(); - } - - public void onResume() - { - mController.onResume(); - - /* - for(final Entry entry : mStates.entrySet()) - { - final int key = entry.getKey(); - final ExampleInteger value = entry.getValue(); - value.mValue = mController.getState(key); - } - - for(final Entry entry : mKeys.entrySet()) - { - final int key = entry.getKey(); - final ExampleInteger value = entry.getValue(); - value.mValue = mController.getKeyCode(key); - } - - for(final Entry entry : mMotions.entrySet()) - { - final int key = entry.getKey(); - final ExampleFloat value = entry.getValue(); - value.mValue = mController.getAxisValue(key); - } - */ - } - - public class ExampleControllerListener implements ControllerListener - { - int playerNum; - - public void setPlayerNum(int playerNum) { - this.playerNum = playerNum; - } - - public void onKeyEvent(KeyEvent event) - { - boolean keydown = false; - if (event.getAction() == KeyEvent.ACTION_DOWN) { - keydown = true; - } - if (act instanceof GL2JNIActivity) { - ((GL2JNIActivity) act).handle_key(playerNum, event.getKeyCode(), keydown); - } - if (act instanceof GL2JNINative) { - ((GL2JNINative) act).handle_key(playerNum, event.getKeyCode(), keydown); - } - } - - public void onMotionEvent(MotionEvent event) - { - if (act instanceof GL2JNIActivity) { - ((GL2JNIActivity) act).motionEventHandler(playerNum, event); - } - if (act instanceof GL2JNINative) { - ((GL2JNINative) act).motionEventHandler(playerNum, event); - } - } - - private void getCompatibilityMap(int playerNum, String id) { - pad.name[playerNum] = prefs.getInt("controller" + id, -1); - if (pad.name[playerNum] != -1) { - pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs); - } - } - - private void initJoyStickLayout(int playerNum) { - pad.globalLS_X[playerNum] = pad.previousLS_X[playerNum] = 0.0f; - pad.globalLS_Y[playerNum] = pad.previousLS_Y[playerNum] = 0.0f; - } - - private void notifyMogaConnected(final String notify, int playerNum) { - String id = pad.portId[playerNum]; - pad.custom[playerNum] = prefs.getBoolean("modified_key_layout" + id, false); - pad.compat[playerNum] = prefs.getBoolean("controller_compat" + id, false); - pad.joystick[playerNum] = prefs.getBoolean("separate_joystick" + id, false); - if (pad.compat[playerNum]) { - getCompatibilityMap(playerNum, id); - } else if (pad.custom[playerNum]) { - pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs); - } else { - pad.map[playerNum] = pad.getMogaController(); - } - initJoyStickLayout(playerNum); - } - - public void onStateEvent(StateEvent event) - { - Integer playerNum = Arrays.asList(pad.name).indexOf(event.getControllerId()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && playerNum == -1) { - playerNum = pad.deviceDescriptor_PlayerNum - .get(pad.deviceId_deviceDescriptor.get(event.getControllerId())); - } else { - playerNum = -1; - } - - if (playerNum == null || playerNum == -1) { - return; - } - - if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) { - int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION); - if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) { - pad.isMogaPro[playerNum] = true; - pad.isActiveMoga[playerNum] = true; - Log.d("com.reicast.emulator", act.getString(R.string.moga_pro_connect)); - } else if (mControllerVersion == Controller.ACTION_VERSION_MOGA) { - pad.isMogaPro[playerNum] = false; - pad.isActiveMoga[playerNum] = true; - Log.d("com.reicast.emulator", act.getString(R.string.moga_connect)); - } - if (pad.isActiveMoga[playerNum]) { - notifyMogaConnected(notify, playerNum); - } - } - } - } -} diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MogaHack.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MogaHack.java deleted file mode 100644 index ad6efdd54..000000000 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/MogaHack.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Mupen64PlusAE, an N64 emulator for the Android platform - * - * Copyright (C) 2013 Paul Lamb - * - * This file is part of Mupen64PlusAE. - * - * Mupen64PlusAE is free software: you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Mupen64PlusAE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Mupen64PlusAE. If - * not, see . - * - * Authors: Paul Lamb - */ -package com.reicast.emulator.periph; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ResolveInfo; -import android.content.pm.ServiceInfo; -import android.os.Build; -import android.util.Log; - -import com.bda.controller.Controller; -import com.bda.controller.IControllerService; - -import java.util.List; - -/** - * Temporary hack for crash in MOGA library on Lollipop. This hack can be removed once MOGA fixes - * their library. The actual issue is caused by the use of implicit service intents, which are - * illegal in Lollipop, as seen in the logcat message below. - * - *
- * {@code Service Intent must be explicit: Intent { act=com.bda.controller.IControllerService } }
- * 
- * - * @see MOGA developer site - * @see - * Discussion on explicit intents - */ -public class MogaHack -{ - public static void init( Controller controller, Context context ) - { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) - { - boolean mIsBound = false; - java.lang.reflect.Field fIsBound = null; - android.content.ServiceConnection mServiceConnection = null; - java.lang.reflect.Field fServiceConnection = null; - try - { - Class cMogaController = controller.getClass(); - fIsBound = cMogaController.getDeclaredField( "mIsBound" ); - fIsBound.setAccessible( true ); - mIsBound = fIsBound.getBoolean( controller ); - fServiceConnection = cMogaController.getDeclaredField( "mServiceConnection" ); - fServiceConnection.setAccessible( true ); - mServiceConnection = ( android.content.ServiceConnection ) fServiceConnection.get( controller ); - } - catch( NoSuchFieldException e ) - { - Log.e( "MogaHack", "MOGA Lollipop Hack NoSuchFieldException (get)", e ); - } - catch( IllegalAccessException e ) - { - Log.e( "MogaHack", "MOGA Lollipop Hack IllegalAccessException (get)", e ); - } - catch( IllegalArgumentException e ) - { - Log.e( "MogaHack", "MOGA Lollipop Hack IllegalArgumentException (get)", e ); - } - if( ( !mIsBound ) && ( mServiceConnection != null ) ) - { - // Convert implicit intent to explicit intent, see http://stackoverflow.com/a/26318757 - Intent intent = new Intent( IControllerService.class.getName() ); - List resolveInfos = context.getPackageManager().queryIntentServices( intent, 0 ); - if( resolveInfos == null || resolveInfos.size() != 1 ) - { - Log.e( "MogaHack", "Somebody is trying to intercept our intent. Disabling MOGA controller for security." ); - return; - } - ServiceInfo serviceInfo = resolveInfos.get( 0 ).serviceInfo; - String packageName = serviceInfo.packageName; - String className = serviceInfo.name; - intent.setComponent( new ComponentName( packageName, className ) ); - - // Start the service explicitly - context.startService( intent ); - context.bindService( intent, mServiceConnection, 1 ); - try - { - fIsBound.setBoolean( controller, true ); - } - catch( IllegalAccessException e ) - { - Log.e( "MogaHack", "MOGA Lollipop Hack IllegalAccessException (set)", e ); - } - catch( IllegalArgumentException e ) - { - Log.e( "MogaHack", "MOGA Lollipop Hack IllegalArgumentException (set)", e ); - } - } - } - else - { - controller.init(); - } - } -} From def787b829284acd3c534d15adfceabbd055bdfa Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Fri, 17 Aug 2018 00:27:07 -0400 Subject: [PATCH 014/154] Android: Look at all the conditionals you'll save --- .../com/reicast/emulator/MainActivity.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java index 3998fd3e3..eb71bcae7 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java @@ -379,38 +379,16 @@ public class MainActivity extends AppCompatActivity implements @Override protected void onPause() { super.onPause(); - InputFragment fragment = (InputFragment) getSupportFragmentManager() - .findFragmentByTag("INPUT_FRAG"); - if (fragment != null && fragment.isVisible()) { - if (fragment.moga != null) { - fragment.moga.onPause(); - } - } } @Override protected void onDestroy() { - InputFragment fragment = (InputFragment) getSupportFragmentManager() - .findFragmentByTag("INPUT_FRAG"); - if (fragment != null && fragment.isVisible()) { - if (fragment.moga != null) { - fragment.moga.onDestroy(); - } - } super.onDestroy(); } @Override protected void onResume() { super.onResume(); - InputFragment fragment = (InputFragment) getSupportFragmentManager() - .findFragmentByTag("INPUT_FRAG"); - if (fragment != null && fragment.isVisible()) { - if (fragment.moga != null) { - fragment.moga.onResume(); - } - } - CloudFragment cloudfragment = (CloudFragment) getSupportFragmentManager() .findFragmentByTag("CLOUD_FRAG"); if (cloudfragment != null && cloudfragment.isVisible()) { From ee00aeb4f0c15bc6e262b879677a8f53cdf27dbc Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Fri, 17 Aug 2018 01:14:08 -0400 Subject: [PATCH 015/154] Android: Only assign OUYA values to an OUYA --- .../com/reicast/emulator/GL2JNIActivity.java | 23 +++++++++++++------ .../com/reicast/emulator/GL2JNINative.java | 23 +++++++++++++------ .../com/reicast/emulator/periph/Gamepad.java | 20 +++++++++------- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index 871227b95..09d2dfbfb 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -61,7 +61,7 @@ public class GL2JNIActivity extends Activity { app.getConfigurationPrefs(prefs); menu = new OnScreenMenu(GL2JNIActivity.this, prefs); - pad.isOuyaOrTV = pad.IsOuyaOrTV(GL2JNIActivity.this); + pad.isOuyaOrTV = pad.IsOuyaOrTV(GL2JNIActivity.this, false); // pad.isNvidiaShield = pad.IsNvidiaShield(); /* @@ -227,12 +227,21 @@ public class GL2JNIActivity extends Activity { // Joystick if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { // do other things with joystick - float LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); - float LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); - float RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); - float RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); - float L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); - float R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); + float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); + float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); + float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); + float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); + float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); + + if (pad.IsOuyaOrTV(GL2JNIActivity.this, true)) { + LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); + LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); + RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); + RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); + L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); + R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + } if (!pad.joystick[playerNum]) { pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index d632c810d..979242bd9 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -64,7 +64,7 @@ public class GL2JNINative extends NativeActivity { } getWindow().takeSurface(null); - pad.isOuyaOrTV = pad.IsOuyaOrTV(GL2JNINative.this); + pad.isOuyaOrTV = pad.IsOuyaOrTV(GL2JNINative.this, false); // isNvidiaShield = Gamepad.IsNvidiaShield(); RegisterNative(false); @@ -289,12 +289,21 @@ public class GL2JNINative extends NativeActivity { // Joystick if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { // do other things with joystick - float LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); - float LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); - float RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); - float RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); - float L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); - float R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); + float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); + float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); + float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); + float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); + float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); + + if (pad.IsOuyaOrTV(GL2JNINative.this, true)) { + LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); + LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); + RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); + RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); + L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); + R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + } if (!pad.joystick[playerNum]) { pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java index b761c1d92..644676b04 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/periph/Gamepad.java @@ -150,15 +150,19 @@ public class Gamepad { }; } - public boolean IsOuyaOrTV(Context context) { - UiModeManager uiModeManager = (UiModeManager) - context.getSystemService(Context.UI_MODE_SERVICE); - if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { - return true; + public boolean IsOuyaOrTV(Context context, boolean ouya) { + if (ouya) { + return OuyaFacade.getInstance().isRunningOnOUYAHardware(); + } else { + UiModeManager uiModeManager = (UiModeManager) + context.getSystemService(Context.UI_MODE_SERVICE); + if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { + return true; + } + PackageManager pMan = context.getPackageManager(); + return pMan.hasSystemFeature(PackageManager.FEATURE_TELEVISION) + || OuyaFacade.getInstance().isRunningOnOUYAHardware(); } - PackageManager pMan = context.getPackageManager(); - return pMan.hasSystemFeature(PackageManager.FEATURE_TELEVISION) - || OuyaFacade.getInstance().isRunningOnOUYAHardware(); } public int getStartButtonCode() { From 2733b46bd7f8896f94c77ffa9c1ee9d0574097d2 Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Fri, 17 Aug 2018 02:26:18 -0400 Subject: [PATCH 016/154] Android: Verify device type before processing --- .../com/reicast/emulator/GL2JNIActivity.java | 108 +++++++++--------- .../com/reicast/emulator/GL2JNINative.java | 108 +++++++++--------- 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index 09d2dfbfb..bdd92ba34 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -224,58 +224,54 @@ public class GL2JNIActivity extends Activity { } private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { - // Joystick - if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { - // do other things with joystick - float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); - float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); - float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); - float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); - float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); - float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); + float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); + float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); + float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); + float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); + float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); + float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); - if (pad.IsOuyaOrTV(GL2JNIActivity.this, true)) { - LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); - LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); - RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); - RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); - L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); - R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + if (pad.IsOuyaOrTV(GL2JNIActivity.this, true)) { + LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); + LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); + RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); + RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); + L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); + R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + } + + if (!pad.joystick[playerNum]) { + pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; + pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; + pad.globalLS_X[playerNum] = LS_X; + pad.globalLS_Y[playerNum] = LS_Y; + } + + GL2JNIView.jx[playerNum] = (int) (LS_X * 126); + GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); + + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + + if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { + if (RS_Y > 0.25) { + handle_key(playerNum, pad.map[playerNum][0]/* A */, true); + pad.wasKeyStick[playerNum] = true; + } else if (RS_Y < 0.25) { + handle_key(playerNum, pad.map[playerNum][1]/* B */, true); + pad.wasKeyStick[playerNum] = true; + } else if (pad.wasKeyStick[playerNum]){ + handle_key(playerNum, pad.map[playerNum][0], false); + handle_key(playerNum, pad.map[playerNum][1], false); + pad.wasKeyStick[playerNum] = false; } - - if (!pad.joystick[playerNum]) { - pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; - pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; - pad.globalLS_X[playerNum] = LS_X; - pad.globalLS_Y[playerNum] = LS_Y; - } - - GL2JNIView.jx[playerNum] = (int) (LS_X * 126); - GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); - - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - - if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { - if (RS_Y > 0.25) { - handle_key(playerNum, pad.map[playerNum][0]/* A */, true); - pad.wasKeyStick[playerNum] = true; - } else if (RS_Y < 0.25) { - handle_key(playerNum, pad.map[playerNum][1]/* B */, true); - pad.wasKeyStick[playerNum] = true; - } else if (pad.wasKeyStick[playerNum]){ - handle_key(playerNum, pad.map[playerNum][0], false); - handle_key(playerNum, pad.map[playerNum][1], false); - pad.wasKeyStick[playerNum] = false; - } - } else { - if (RS_Y > 0.25) { - GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - } else if (RS_Y < 0.25) { - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); - } + } else { + if (RS_Y > 0.25) { + GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + } else if (RS_Y < 0.25) { + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); } } } @@ -295,11 +291,15 @@ public class GL2JNIActivity extends Activity { return false; if (!pad.compat[playerNum]) { - final int historySize = event.getHistorySize(); - for (int i = 0; i < historySize; i++) { - processJoystickInput(event, playerNum, i); + if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == + InputDevice.SOURCE_JOYSTICK && + event.getAction() == MotionEvent.ACTION_MOVE) { + final int historySize = event.getHistorySize(); + for (int i = 0; i < historySize; i++) { + processJoystickInput(event, playerNum, i); + } + processJoystickInput(event, playerNum, -1); } - processJoystickInput(event, playerNum, -1); } mView.pushInput(); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 979242bd9..55682c70c 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -286,58 +286,54 @@ public class GL2JNINative extends NativeActivity { } private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { - // Joystick - if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { - // do other things with joystick - float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); - float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); - float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); - float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); - float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); - float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); + float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); + float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); + float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); + float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); + float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); + float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); - if (pad.IsOuyaOrTV(GL2JNINative.this, true)) { - LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); - LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); - RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); - RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); - L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); - R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + if (pad.IsOuyaOrTV(GL2JNINative.this, true)) { + LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); + LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); + RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); + RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); + L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); + R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + } + + if (!pad.joystick[playerNum]) { + pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; + pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; + pad.globalLS_X[playerNum] = LS_X; + pad.globalLS_Y[playerNum] = LS_Y; + } + + GL2JNIView.jx[playerNum] = (int) (LS_X * 126); + GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); + + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + + if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { + if (RS_Y > 0.25) { + handle_key(playerNum, pad.map[playerNum][0]/* A */, true); + pad.wasKeyStick[playerNum] = true; + } else if (RS_Y < 0.25) { + handle_key(playerNum, pad.map[playerNum][1]/* B */, true); + pad.wasKeyStick[playerNum] = true; + } else if (pad.wasKeyStick[playerNum]){ + handle_key(playerNum, pad.map[playerNum][0], false); + handle_key(playerNum, pad.map[playerNum][1], false); + pad.wasKeyStick[playerNum] = false; } - - if (!pad.joystick[playerNum]) { - pad.previousLS_X[playerNum] = pad.globalLS_X[playerNum]; - pad.previousLS_Y[playerNum] = pad.globalLS_Y[playerNum]; - pad.globalLS_X[playerNum] = LS_X; - pad.globalLS_Y[playerNum] = LS_Y; - } - - GL2JNIView.jx[playerNum] = (int) (LS_X * 126); - GL2JNIView.jy[playerNum] = (int) (LS_Y * 126); - - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - - if (prefs.getBoolean(Gamepad.pref_js_rbuttons + pad.portId[playerNum], true)) { - if (RS_Y > 0.25) { - handle_key(playerNum, pad.map[playerNum][0]/* A */, true); - pad.wasKeyStick[playerNum] = true; - } else if (RS_Y < 0.25) { - handle_key(playerNum, pad.map[playerNum][1]/* B */, true); - pad.wasKeyStick[playerNum] = true; - } else if (pad.wasKeyStick[playerNum]){ - handle_key(playerNum, pad.map[playerNum][0], false); - handle_key(playerNum, pad.map[playerNum][1], false); - pad.wasKeyStick[playerNum] = false; - } - } else { - if (RS_Y > 0.25) { - GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); - GL2JNIView.lt[playerNum] = (int) (L2 * 255); - } else if (RS_Y < 0.25) { - GL2JNIView.rt[playerNum] = (int) (R2 * 255); - GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); - } + } else { + if (RS_Y > 0.25) { + GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); + GL2JNIView.lt[playerNum] = (int) (L2 * 255); + } else if (RS_Y < 0.25) { + GL2JNIView.rt[playerNum] = (int) (R2 * 255); + GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); } } } @@ -360,11 +356,15 @@ public class GL2JNINative extends NativeActivity { return false; } if (!pad.compat[playerNum]) { - final int historySize = event.getHistorySize(); - for (int i = 0; i < historySize; i++) { - processJoystickInput(event, playerNum, i); + if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == + InputDevice.SOURCE_JOYSTICK && + event.getAction() == MotionEvent.ACTION_MOVE) { + final int historySize = event.getHistorySize(); + for (int i = 0; i < historySize; i++) { + processJoystickInput(event, playerNum, i); + } + processJoystickInput(event, playerNum, -1); } - processJoystickInput(event, playerNum, -1); } mView.pushInput(); if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]) From 7dfc5b20c61fac57a6e525281733821f15834b1d Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Fri, 17 Aug 2018 23:39:50 -0400 Subject: [PATCH 017/154] Android: strip exceptions handled by Google --- .../reicast/emulator/debug/GenerateLogs.java | 49 ------------------- 1 file changed, 49 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GenerateLogs.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GenerateLogs.java index cc192b136..f42dd473d 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GenerateLogs.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GenerateLogs.java @@ -152,40 +152,7 @@ public class GenerateLogs extends AsyncTask { log.append(unHandledIOE); } try { - mLogcatProc = Runtime.getRuntime().exec( - new String[] { "logcat", "-ds", "AndroidRuntime:E" }); - reader = new BufferedReader(new InputStreamReader( - mLogcatProc.getInputStream())); String line; - log.append(separator); - log.append(separator); - log.append("AndroidRuntime Output"); - log.append(separator); - log.append(separator); - while ((line = reader.readLine()) != null) { - log.append(line); - log.append(separator); - } - reader.close(); - mLogcatProc = null; - reader = null; - int PID = android.os.Process.getUidForName("com.reicast.emulator"); - mLogcatProc = Runtime.getRuntime().exec( - new String[] { "logcat", "-d", "|", "grep " + PID }); - reader = new BufferedReader(new InputStreamReader( - mLogcatProc.getInputStream())); - log.append(separator); - log.append(separator); - log.append("Application Core Output"); - log.append(separator); - log.append(separator); - while ((line = reader.readLine()) != null) { - log.append(line); - log.append(separator); - } - reader.close(); - mLogcatProc = null; - reader = null; mLogcatProc = Runtime.getRuntime().exec( new String[] { "logcat", "-ds", "reicast:V" }); reader = new BufferedReader(new InputStreamReader( @@ -202,22 +169,6 @@ public class GenerateLogs extends AsyncTask { reader.close(); mLogcatProc = null; reader = null; - mLogcatProc = Runtime.getRuntime().exec( - new String[] { "logcat", "-ds", "GL2JNIView:E" }); - reader = new BufferedReader(new InputStreamReader( - mLogcatProc.getInputStream())); - log.append(separator); - log.append(separator); - log.append("Open GLES View Output"); - log.append(separator); - log.append(separator); - while ((line = reader.readLine()) != null) { - log.append(line); - log.append(separator); - } - reader.close(); - mLogcatProc = null; - reader = null; File memory = new File(mContext.getFilesDir(), "mem_alloc.txt"); if (memory.exists()) { log.append(separator); From 17788f68b9a5c225daf012342859c0e162f4f54c Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 18 Aug 2018 06:38:08 -0400 Subject: [PATCH 018/154] Android: push every joystick event, simplify return --- .../java/com/reicast/emulator/GL2JNIActivity.java | 10 +++++----- .../java/com/reicast/emulator/GL2JNINative.java | 13 +++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index bdd92ba34..4c42d4a58 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -274,6 +274,8 @@ public class GL2JNIActivity extends Activity { GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); } } + + mView.pushInput(); } @Override @@ -301,13 +303,11 @@ public class GL2JNIActivity extends Activity { processJoystickInput(event, playerNum, -1); } } - - mView.pushInput(); // Only handle Left Stick on an Xbox 360 controller if there was actual // motion on the stick, otherwise event can be handled as a DPAD event - return (pad.joystick[playerNum] || (!(pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum]) - || !(pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]))) - && (!(pad.previousLS_X[playerNum] == 0.0f) || !(pad.previousLS_Y[playerNum] == 0.0f)); + return (pad.joystick[playerNum] || (pad.globalLS_X[playerNum] != pad.previousLS_X[playerNum] + || pad.globalLS_Y[playerNum] != pad.previousLS_Y[playerNum])) + && (pad.previousLS_X[playerNum] != 0.0f || pad.previousLS_Y[playerNum] != 0.0f); } public boolean simulatedTouchEvent(int playerNum, float L2, float R2) { diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 55682c70c..e1af51c8f 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -336,6 +336,8 @@ public class GL2JNINative extends NativeActivity { GL2JNIView.lt[playerNum] = (int) (-(RS_Y) * 255); } } + + mView.pushInput(); } @Override @@ -366,14 +368,9 @@ public class GL2JNINative extends NativeActivity { processJoystickInput(event, playerNum, -1); } } - mView.pushInput(); - if (!pad.joystick[playerNum] && (pad.globalLS_X[playerNum] == pad.previousLS_X[playerNum] && pad.globalLS_Y[playerNum] == pad.previousLS_Y[playerNum]) - || (pad.previousLS_X[playerNum] == 0.0f && pad.previousLS_Y[playerNum] == 0.0f)) - // Only handle Left Stick on an Xbox 360 controller if there was actual - // motion on the stick, otherwise event can be handled as a DPAD event - return false; - else - return true; + return (pad.joystick[playerNum] || (pad.globalLS_X[playerNum] != pad.previousLS_X[playerNum] + || pad.globalLS_Y[playerNum] != pad.previousLS_Y[playerNum])) + && (pad.previousLS_X[playerNum] != 0.0f || pad.previousLS_Y[playerNum] != 0.0f); } return false; From c604ae167f6363893ba80d111ad860671d459410 Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 18 Aug 2018 07:40:15 -0400 Subject: [PATCH 019/154] Android: handle position -1 as generic motion --- .../com/reicast/emulator/GL2JNIActivity.java | 31 +++++++++++-------- .../com/reicast/emulator/GL2JNINative.java | 31 +++++++++++-------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index 4c42d4a58..f8bbc3ab1 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -223,21 +223,26 @@ public class GL2JNIActivity extends Activity { } } - private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { - float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); - float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); - float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); - float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); - float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); - float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); + float getAxisValues(MotionEvent event, int axis, int historyPos) { + return historyPos < 0 ? event.getAxisValue(axis) : + event.getHistoricalAxisValue(axis, historyPos); + } + + private void processJoystickInput(MotionEvent event, Integer playerNum, int historyPos) { + float LS_X = getAxisValues(event, MotionEvent.AXIS_X, historyPos); + float LS_Y = getAxisValues(event, MotionEvent.AXIS_Y, historyPos); + float RS_X = getAxisValues(event, MotionEvent.AXIS_RX, historyPos); + float RS_Y = getAxisValues(event, MotionEvent.AXIS_RY, historyPos); + float L2 = getAxisValues(event, MotionEvent.AXIS_LTRIGGER, historyPos); + float R2 = getAxisValues(event, MotionEvent.AXIS_RTRIGGER, historyPos); if (pad.IsOuyaOrTV(GL2JNIActivity.this, true)) { - LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); - LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); - RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); - RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); - L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); - R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + LS_X = getAxisValues(event, OuyaController.AXIS_LS_X, historyPos); + LS_Y = getAxisValues(event, OuyaController.AXIS_LS_Y, historyPos); + RS_X = getAxisValues(event, OuyaController.AXIS_RS_X, historyPos); + RS_Y = getAxisValues(event, OuyaController.AXIS_RS_Y, historyPos); + L2 = getAxisValues(event, OuyaController.AXIS_L2, historyPos); + R2 = getAxisValues(event, OuyaController.AXIS_R2, historyPos); } if (!pad.joystick[playerNum]) { diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index e1af51c8f..5823435f2 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -285,21 +285,26 @@ public class GL2JNINative extends NativeActivity { LayoutParams.WRAP_CONTENT); } - private void processJoystickInput(MotionEvent event, Integer playerNum, int index) { - float LS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_X, index); - float LS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_Y, index); - float RS_X = event.getHistoricalAxisValue(MotionEvent.AXIS_RX, index); - float RS_Y = event.getHistoricalAxisValue(MotionEvent.AXIS_RY, index); - float L2 = event.getHistoricalAxisValue(MotionEvent.AXIS_LTRIGGER, index); - float R2 = event.getHistoricalAxisValue(MotionEvent.AXIS_RTRIGGER, index); + float getAxisValues(MotionEvent event, int axis, int historyPos) { + return historyPos < 0 ? event.getAxisValue(axis) : + event.getHistoricalAxisValue(axis, historyPos); + } + + private void processJoystickInput(MotionEvent event, Integer playerNum, int historyPos) { + float LS_X = getAxisValues(event, MotionEvent.AXIS_X, historyPos); + float LS_Y = getAxisValues(event, MotionEvent.AXIS_Y, historyPos); + float RS_X = getAxisValues(event, MotionEvent.AXIS_RX, historyPos); + float RS_Y = getAxisValues(event, MotionEvent.AXIS_RY, historyPos); + float L2 = getAxisValues(event, MotionEvent.AXIS_LTRIGGER, historyPos); + float R2 = getAxisValues(event, MotionEvent.AXIS_RTRIGGER, historyPos); if (pad.IsOuyaOrTV(GL2JNINative.this, true)) { - LS_X = event.getHistoricalAxisValue(OuyaController.AXIS_LS_X, index); - LS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_LS_Y, index); - RS_X = event.getHistoricalAxisValue(OuyaController.AXIS_RS_X, index); - RS_Y = event.getHistoricalAxisValue(OuyaController.AXIS_RS_Y, index); - L2 = event.getHistoricalAxisValue(OuyaController.AXIS_L2, index); - R2 = event.getHistoricalAxisValue(OuyaController.AXIS_R2, index); + LS_X = getAxisValues(event, OuyaController.AXIS_LS_X, historyPos); + LS_Y = getAxisValues(event, OuyaController.AXIS_LS_Y, historyPos); + RS_X = getAxisValues(event, OuyaController.AXIS_RS_X, historyPos); + RS_Y = getAxisValues(event, OuyaController.AXIS_RS_Y, historyPos); + L2 = getAxisValues(event, OuyaController.AXIS_L2, historyPos); + R2 = getAxisValues(event, OuyaController.AXIS_R2, historyPos); } if (!pad.joystick[playerNum]) { From a2a3a11412625e9617990eea32b190b93a9e055b Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 18 Aug 2018 15:28:13 -0400 Subject: [PATCH 020/154] Android: Stop hiding git behind "luxury" handle --- .../com/reicast/emulator/AboutFragment.java | 47 +++---------------- .../src/main/res/layout/about_fragment.xml | 41 +++++----------- 2 files changed, 19 insertions(+), 69 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/AboutFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/AboutFragment.java index 9e88b6db2..5793f618a 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/AboutFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/AboutFragment.java @@ -1,12 +1,10 @@ package com.reicast.emulator; -import android.annotation.TargetApi; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import android.os.Handler; import android.support.constraint.ConstraintLayout; import android.support.design.widget.Snackbar; import android.support.graphics.drawable.VectorDrawableCompat; @@ -16,11 +14,7 @@ import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; -import android.widget.SlidingDrawer; -import android.widget.SlidingDrawer.OnDrawerOpenListener; import android.widget.TextView; import com.reicast.emulator.config.Config; @@ -44,10 +38,8 @@ import javax.net.ssl.HttpsURLConnection; public class AboutFragment extends Fragment { String buildId = ""; - SlidingDrawer slidingGithub; private ListView list; private GitAdapter adapter; - private Handler handler; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -91,20 +83,11 @@ public class AboutFragment extends Fragment { R.id.site_text); Linkify.addLinks(website, Linkify.ALL); - handler = new Handler(); - - slidingGithub = (SlidingDrawer) getView().findViewById( - R.id.slidingGithub); - slidingGithub.setOnDrawerOpenListener(new OnDrawerOpenListener() { - @TargetApi(Build.VERSION_CODES.HONEYCOMB) - public void onDrawerOpened() { - new retrieveGitTask().execute(Config.git_api); - } - }); + new retrieveGitTask().execute(Config.git_api); } - public class retrieveGitTask extends + private class retrieveGitTask extends AsyncTask>> { @Override @@ -174,23 +157,10 @@ public class AboutFragment extends Fragment { } } catch (JSONException e) { - handler.post(new Runnable() { - public void run() { - showToastMessage(getActivity().getString(R.string.git_broken), Snackbar.LENGTH_SHORT); - slidingGithub.close(); - } - }); e.printStackTrace(); } catch (Exception e) { - handler.post(new Runnable() { - public void run() { - showToastMessage(getActivity().getString(R.string.git_broken), Snackbar.LENGTH_SHORT); - slidingGithub.close(); - } - }); e.printStackTrace(); } - return commitList; } @@ -198,19 +168,14 @@ public class AboutFragment extends Fragment { protected void onPostExecute( ArrayList> commitList) { if (commitList != null && commitList.size() > 0) { - list = (ListView) getView().findViewById(R.id.list); + ListView list = (ListView) getView().findViewById(R.id.list); list.setSelector(R.drawable.list_selector); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); - adapter = new GitAdapter(getActivity(), commitList); + GitAdapter adapter = new GitAdapter(getActivity(), commitList); // Set adapter as specified collection list.setAdapter(adapter); - - list.setOnItemClickListener(new OnItemClickListener() { - public void onItemClick(AdapterView parent, View view, - int position, long id) { - slidingGithub.open(); - } - }); + } else { + showToastMessage(getActivity().getString(R.string.git_broken), Snackbar.LENGTH_SHORT); } } diff --git a/shell/android-studio/reicast/src/main/res/layout/about_fragment.xml b/shell/android-studio/reicast/src/main/res/layout/about_fragment.xml index 39b938be4..4d527cfab 100644 --- a/shell/android-studio/reicast/src/main/res/layout/about_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout/about_fragment.xml @@ -36,35 +36,20 @@ android:gravity="center" android:text="@string/app_site" android:autoLink="web"/> - - + + - - - - - - - - + android:divider="#b5b5b5" + android:dividerHeight="1dp" /> + From cd22816c1b12efd6d117b129f8525ed964b898ef Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 18 Aug 2018 15:28:41 -0400 Subject: [PATCH 021/154] Android: prevent auxilliary from overriding hardware --- .../src/main/java/com/reicast/emulator/GL2JNIActivity.java | 2 +- .../src/main/java/com/reicast/emulator/GL2JNINative.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java index f8bbc3ab1..367f2f604 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNIActivity.java @@ -270,7 +270,7 @@ public class GL2JNIActivity extends Activity { handle_key(playerNum, pad.map[playerNum][1], false); pad.wasKeyStick[playerNum] = false; } - } else { + } else if (L2 == 0 && R2 ==0) { if (RS_Y > 0.25) { GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); GL2JNIView.lt[playerNum] = (int) (L2 * 255); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java index 5823435f2..160750d87 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/GL2JNINative.java @@ -332,7 +332,7 @@ public class GL2JNINative extends NativeActivity { handle_key(playerNum, pad.map[playerNum][1], false); pad.wasKeyStick[playerNum] = false; } - } else { + } else if (L2 == 0 && R2 ==0) { if (RS_Y > 0.25) { GL2JNIView.rt[playerNum] = (int) (RS_Y * 255); GL2JNIView.lt[playerNum] = (int) (L2 * 255); From bde9f2768bed632a9a0588b4dd514720c8f3289c Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 18 Aug 2018 15:29:05 -0400 Subject: [PATCH 022/154] gitignore: Ignore local gradle configuration files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index db491f07a..abe6619da 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,5 @@ reicast-ios.xccheckout .idea *.iml .externalNativeBuild +gradle.properties shell/android-studio/reicast/src/main/assets/build From 8d9d40dffc8beb7be581e1389abd2a97765064be Mon Sep 17 00:00:00 2001 From: Ender's Games Date: Sat, 18 Aug 2018 21:28:44 -0400 Subject: [PATCH 023/154] Core: Changes provided by Android NDK compiler --- core/deps/libelf/elf64.cpp | 2 +- core/hw/mem/_vmem.cpp | 2 +- core/hw/naomi/naomi_cart.cpp | 2 +- core/hw/pvr/Renderer_if.cpp | 5 ++-- core/hw/pvr/drkPvr.cpp | 1 - core/hw/pvr/pvr_mem.cpp | 2 -- core/hw/pvr/pvr_sb_regs.cpp | 1 - core/hw/sh4/dyna/blockmanager.cpp | 4 +-- core/hw/sh4/sh4_opcode_list.cpp | 1 - core/imgread/cdi.cpp | 6 ++-- core/linux/common.cpp | 4 +-- core/reios/gdrom_hle.cpp | 24 +++++++-------- core/rend/gles/gles.cpp | 2 +- shell/android-studio/reicast/build.gradle | 1 + .../main/java/com/android/util/DreamTime.java | 9 ++---- .../main/java/com/android/util/FileUtils.java | 12 ++++---- .../com/reicast/emulator/CloudFragment.java | 6 +--- .../com/reicast/emulator/FileBrowser.java | 2 +- .../com/reicast/emulator/MainActivity.java | 3 -- .../emulator/config/OptionsFragment.java | 29 ++++++++++++------- .../reicast/emulator/debug/GitAdapter.java | 16 +++------- .../reicast/emulator/emu/GLCFactory14.java | 2 +- .../reicast/src/main/jni/src/Android.cpp | 4 --- .../reicast/src/main/jni/src/utils.cpp | 1 - .../src/main/res/drawable/background.xml | 5 ++-- .../res/layout-v14/configure_fragment.xml | 8 ++--- .../main/res/layout-v14/input_fragment.xml | 14 ++++----- .../src/main/res/layout/about_fragment.xml | 1 - .../src/main/res/layout/app_bar_main.xml | 2 +- .../src/main/res/layout/bios_list_item.xml | 2 +- .../src/main/res/layout/browser_fragment.xml | 5 ++-- .../res/layout/browser_fragment_header.xml | 2 +- .../src/main/res/layout/cloud_fragment.xml | 1 - .../main/res/layout/configure_fragment.xml | 8 ++--- .../src/main/res/layout/input_fragment.xml | 14 ++++----- .../src/main/res/layout/menu_popup_config.xml | 1 - .../src/main/res/layout/menu_popup_debug.xml | 1 - .../src/main/res/layout/menu_popup_main.xml | 1 - .../src/main/res/layout/spinner_selected.xml | 2 +- .../reicast/src/main/res/layout/webview.xml | 1 - .../src/main/res/values-da/strings.xml | 1 - .../src/main/res/values-de/strings.xml | 1 - .../src/main/res/values-fr/strings.xml | 3 +- .../src/main/res/values-it/strings.xml | 3 +- .../src/main/res/values-jp/strings.xml | 3 +- .../src/main/res/values-ko/strings.xml | 1 - .../src/main/res/values-pl/strings.xml | 1 - .../src/main/res/values-pt/strings.xml | 1 - .../src/main/res/values-ru/strings.xml | 1 - .../src/main/res/values-zh-rCN/strings.xml | 1 - .../src/main/res/values-zh/strings.xml | 1 - .../src/main/res/values/donottranslate.xml | 6 ++-- .../reicast/src/main/res/values/styles.xml | 2 +- 53 files changed, 95 insertions(+), 139 deletions(-) diff --git a/core/deps/libelf/elf64.cpp b/core/deps/libelf/elf64.cpp index 7366f7845..f69f6ccfe 100644 --- a/core/deps/libelf/elf64.cpp +++ b/core/deps/libelf/elf64.cpp @@ -157,7 +157,7 @@ elf64_getSectionName(void *elfFile, int i) struct Elf64_Shdr *sections = elf64_getSectionTable((Elf64_Header*)elfFile); char *str_table = elf64_getSegmentStringTable((Elf64_Header*)elfFile); if (str_table == NULL) { - return ""; + return (char*)""; } else { return str_table + sections[i].sh_name; } diff --git a/core/hw/mem/_vmem.cpp b/core/hw/mem/_vmem.cpp index 43e050c11..c7957eb0f 100644 --- a/core/hw/mem/_vmem.cpp +++ b/core/hw/mem/_vmem.cpp @@ -761,7 +761,7 @@ bool _vmem_reserve() //[0x10000000,0x20000000) -> unused unused_buffer(0x10000000,0x20000000); - printf("vmem reserve: base: %08X, aram: %08x, vram: %08X, ram: %08X\n",virt_ram_base,aica_ram.data,vram.data,mem_b.data); + printf("vmem reserve: base: %8s, aram: %8s, vram: %8s, ram: %8s\n",virt_ram_base,aica_ram.data,vram.data,mem_b.data); printf("Resetting mem\n"); diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index f1310fa14..49e707d00 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -50,7 +50,7 @@ bool naomi_cart_LoadRom(char* file) char* eon = strstr(line, "\n"); if (!eon) - printf("+Loading naomi rom that has no name\n", line); + printf("+Loading naomi rom that has no name\n"); else *eon = 0; diff --git a/core/hw/pvr/Renderer_if.cpp b/core/hw/pvr/Renderer_if.cpp index 5af14df8c..ec13030e5 100644 --- a/core/hw/pvr/Renderer_if.cpp +++ b/core/hw/pvr/Renderer_if.cpp @@ -318,7 +318,6 @@ void rend_start_render() } if (fCheckFrames) { - u8 v; u8 digest2[16]; int ch = fgetc(fCheckFrames); @@ -420,11 +419,11 @@ void rend_end_wait() bool rend_init() { - if (fLogFrames = fopen(settings.pvr.HashLogFile.c_str(), "wb")) { + if ((fLogFrames = fopen(settings.pvr.HashLogFile.c_str(), "wb"))) { printf("Saving frame hashes to: '%s'\n", settings.pvr.HashLogFile.c_str()); } - if (fCheckFrames = fopen(settings.pvr.HashCheckFile.c_str(), "rb")) { + if ((fCheckFrames = fopen(settings.pvr.HashCheckFile.c_str(), "rb"))) { printf("Comparing frame hashes against: '%s'\n", settings.pvr.HashCheckFile.c_str()); } diff --git a/core/hw/pvr/drkPvr.cpp b/core/hw/pvr/drkPvr.cpp index 50c88c05a..d372c910c 100644 --- a/core/hw/pvr/drkPvr.cpp +++ b/core/hw/pvr/drkPvr.cpp @@ -16,7 +16,6 @@ #include "pvr_regs.h" #include "pvr_mem.h" #include "Renderer_if.h" -#include void libPvr_LockedBlockWrite (vram_block* block,u32 addr) diff --git a/core/hw/pvr/pvr_mem.cpp b/core/hw/pvr/pvr_mem.cpp index 9d44f1693..98aa79ddf 100644 --- a/core/hw/pvr/pvr_mem.cpp +++ b/core/hw/pvr/pvr_mem.cpp @@ -13,7 +13,6 @@ //TODO : move code later to a plugin //TODO : Fix registers arrays , they must be smaller now doe to the way SB registers are handled -#include "types.h" #include "hw/holly/holly_intc.h" @@ -237,7 +236,6 @@ void TAWrite(u32 address,u32* data,u32 count) } #include "hw/sh4/sh4_mmr.h" -#include "hw/pvr/ta.h" void NOINLINE MemWrite32(void* dst, void* src) { diff --git a/core/hw/pvr/pvr_sb_regs.cpp b/core/hw/pvr/pvr_sb_regs.cpp index bb7b1a59d..75965622a 100644 --- a/core/hw/pvr/pvr_sb_regs.cpp +++ b/core/hw/pvr/pvr_sb_regs.cpp @@ -9,7 +9,6 @@ #include "hw/sh4/modules/dmac.h" #include "hw/sh4/sh4_mem.h" #include "pvr_sb_regs.h" -#include "types.h" #include "hw/sh4/sh4_mmr.h" #include "ta.h" diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index 51f9f02fb..f64c3e4c7 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -122,7 +122,7 @@ RuntimeBlockInfo* bm_GetBlock(void* dynarec_code) } else { - printf("bm_GetBlock(%08X) failed ..\n",dynarec_code); + printf("bm_GetBlock(%8s) failed ..\n",dynarec_code); return 0; } } @@ -510,7 +510,7 @@ void bm_PrintTopBlocks() sel_hops+=all_blocks[i]->host_opcodes*all_blocks[i]->runs; } - printf(" >-< %.2f%% covered in top 1% blocks\n",sel_hops/total_hops); + printf(" >-< %.2f%% covered in top 1%% blocks\n",sel_hops/total_hops); size_t i; for (i=all_blocks.size()/100;sel_hops/total_hops<50;i++) diff --git a/core/hw/sh4/sh4_opcode_list.cpp b/core/hw/sh4/sh4_opcode_list.cpp index 02ad57709..811e69b09 100644 --- a/core/hw/sh4/sh4_opcode_list.cpp +++ b/core/hw/sh4/sh4_opcode_list.cpp @@ -2,7 +2,6 @@ #include "interpr/sh4_opcodes.h" #include "sh4_opcode_list.h" #include "dyna/decoder_opcodes.h" -#include "types.h" #include "hw/sh4/dyna/shil.h" #include "reios/reios.h" diff --git a/core/imgread/cdi.cpp b/core/imgread/cdi.cpp index 913259406..ab1433f31 100644 --- a/core/imgread/cdi.cpp +++ b/core/imgread/cdi.cpp @@ -68,7 +68,7 @@ Disc* cdi_parse(const wchar* file) case 2 : default: printf("Mode2/"); break; } - printf("%d ",track.sector_size); + printf("%lu ",track.sector_size); printf("Pregap: %-3ld ",track.pregap_length); printf("Size: %-6ld ",track.length); @@ -122,7 +122,7 @@ Disc* cdi_parse(const wchar* file) else { - printf("Track position: %d\n",track.position + track.pregap_length * track.sector_size); + printf("Track position: %lu\n",track.position + track.pregap_length * track.sector_size); core_fseek(fsource, track.position, SEEK_SET); // fseek(fsource, track->pregap_length * track->sector_size, SEEK_CUR); // fseek(fsource, track->length * track->sector_size, SEEK_CUR); @@ -198,4 +198,4 @@ Disc* cdi_parse(const wchar* file) pfctoc_mod=0; return rv; -#endif \ No newline at end of file +#endif diff --git a/core/linux/common.cpp b/core/linux/common.cpp index ab5591557..8830668af 100644 --- a/core/linux/common.cpp +++ b/core/linux/common.cpp @@ -95,7 +95,7 @@ void fault_handler (int sn, siginfo_t * si, void *segfault_ctx) #endif else { - printf("SIGSEGV @ %p (fault_handler+0x%p) ... %p -> was not in vram\n", ctx.pc, ctx.pc - (unat)fault_handler, si->si_addr); + printf("SIGSEGV @ %u (fault_handler+0x%u) ... %p -> was not in vram\n", ctx.pc, ctx.pc - (unat)fault_handler, si->si_addr); die("segfault"); signal(SIGSEGV, SIG_DFL); } @@ -196,7 +196,7 @@ void VArray2::LockRegion(u32 offset,u32 size) u32 rv=mprotect (data+offset-inpage, size+inpage, PROT_READ ); if (rv!=0) { - printf("mprotect(%08X,%08X,R) failed: %d | %d\n",data+offset-inpage,size+inpage,rv,errno); + printf("mprotect(%8s,%08X,R) failed: %d | %d\n",data+offset-inpage,size+inpage,rv,errno); die("mprotect failed ..\n"); } diff --git a/core/reios/gdrom_hle.cpp b/core/reios/gdrom_hle.cpp index 24009dfeb..a43fbeb9a 100644 --- a/core/reios/gdrom_hle.cpp +++ b/core/reios/gdrom_hle.cpp @@ -110,7 +110,7 @@ void GD_HLE_Command(u32 cc, u32 prm) switch(cc) { case GDCC_GETTOC: - printf("GDROM:\t*FIXME* CMD GETTOC PRM:%X\n",cc,prm); + printf("GDROM:\t*FIXME* CMD GETTOC CC:%X PRM:%X\n",cc,prm); break; case GDCC_GETTOC2: @@ -118,12 +118,12 @@ void GD_HLE_Command(u32 cc, u32 prm) break; case GDCC_GETSES: - debugf("GDROM:\tGETSES PRM:%X\n", cc, prm); + debugf("GDROM:\tGETSES CC:%X PRM:%X\n", cc, prm); GDROM_HLE_ReadSES(r[5]); break; case GDCC_INIT: - printf("GDROM:\tCMD INIT PRM:%X\n",cc,prm); + printf("GDROM:\tCMD INIT CC:%X PRM:%X\n",cc,prm); break; case GDCC_PIOREAD: @@ -131,30 +131,30 @@ void GD_HLE_Command(u32 cc, u32 prm) break; case GDCC_DMAREAD: - debugf("GDROM:\tCMD DMAREAD PRM:%X\n", cc, prm); + debugf("GDROM:\tCMD DMAREAD CC:%X PRM:%X\n", cc, prm); GDROM_HLE_ReadDMA(r[5]); break; case GDCC_PLAY_SECTOR: - printf("GDROM:\tCMD PLAYSEC? PRM:%X\n",cc,prm); + printf("GDROM:\tCMD PLAYSEC? CC:%X PRM:%X\n",cc,prm); break; case GDCC_RELEASE: - printf("GDROM:\tCMD RELEASE? PRM:%X\n",cc,prm); + printf("GDROM:\tCMD RELEASE? CC:%X PRM:%X\n",cc,prm); break; - case GDCC_STOP: printf("GDROM:\tCMD STOP PRM:%X\n",cc,prm); break; - case GDCC_SEEK: printf("GDROM:\tCMD SEEK PRM:%X\n",cc,prm); break; - case GDCC_PLAY: printf("GDROM:\tCMD PLAY PRM:%X\n",cc,prm); break; - case GDCC_PAUSE:printf("GDROM:\tCMD PAUSE PRM:%X\n",cc,prm); break; + case GDCC_STOP: printf("GDROM:\tCMD STOP CC:%X PRM:%X\n",cc,prm); break; + case GDCC_SEEK: printf("GDROM:\tCMD SEEK CC:%X PRM:%X\n",cc,prm); break; + case GDCC_PLAY: printf("GDROM:\tCMD PLAY CC:%X PRM:%X\n",cc,prm); break; + case GDCC_PAUSE:printf("GDROM:\tCMD PAUSE CC:%X PRM:%X\n",cc,prm); break; case GDCC_READ: - printf("GDROM:\tCMD READ PRM:%X\n",cc,prm); + printf("GDROM:\tCMD READ CC:%X PRM:%X\n",cc,prm); break; case GDCC_GETSCD: - debugf("GDROM:\tGETSCD PRM:%X\n",cc,prm); + debugf("GDROM:\tGETSCD CC:%X PRM:%X\n",cc,prm); GDCC_HLE_GETSCD(r[5]); break; diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 64c8f406a..6c665bf4c 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -457,7 +457,7 @@ int screen_height; screen_width=w; screen_height=h; - printf("EGL config: %08X, %08X, %08X %dx%d\n",gl.setup.context,gl.setup.display,gl.setup.surface,w,h); + printf("EGL config: %p, %08X, %08X %dx%d\n",gl.setup.context,gl.setup.display,gl.setup.surface,w,h); return true; } diff --git a/shell/android-studio/reicast/build.gradle b/shell/android-studio/reicast/build.gradle index 77d9f5c4b..802a62da9 100644 --- a/shell/android-studio/reicast/build.gradle +++ b/shell/android-studio/reicast/build.gradle @@ -47,6 +47,7 @@ android { buildTypes { release { minifyEnabled false + zipAlignEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.release } diff --git a/shell/android-studio/reicast/src/main/java/com/android/util/DreamTime.java b/shell/android-studio/reicast/src/main/java/com/android/util/DreamTime.java index e25b1b3f3..d28ea0aeb 100644 --- a/shell/android-studio/reicast/src/main/java/com/android/util/DreamTime.java +++ b/shell/android-studio/reicast/src/main/java/com/android/util/DreamTime.java @@ -4,13 +4,10 @@ import java.util.Calendar; public class DreamTime { - private static long dreamRTC = ((20 * 365 + 5) * 86400) - 1; - public static long getDreamtime() { + long dreamRTC = ((20 * 365 + 5) * 86400) - 1; Calendar cal = Calendar.getInstance(); - int utcOffset = cal.get(Calendar.ZONE_OFFSET) - + cal.get(Calendar.DST_OFFSET); - return (System.currentTimeMillis() / 1000) + dreamRTC - + (utcOffset / 1000); + int utcOffset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); + return (System.currentTimeMillis() / 1000) + dreamRTC + (utcOffset / 1000); } } diff --git a/shell/android-studio/reicast/src/main/java/com/android/util/FileUtils.java b/shell/android-studio/reicast/src/main/java/com/android/util/FileUtils.java index d7a3305f5..110f06b87 100644 --- a/shell/android-studio/reicast/src/main/java/com/android/util/FileUtils.java +++ b/shell/android-studio/reicast/src/main/java/com/android/util/FileUtils.java @@ -24,6 +24,7 @@ import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.Vector; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -63,15 +64,14 @@ public class FileUtils { public Collection listFiles(File directory, FilenameFilter[] filter, int recurse) { - Vector files = new Vector(); + Vector files = new Vector<>(); File[] entries = directory.listFiles(); if (entries != null) { for (File entry : entries) { for (FilenameFilter filefilter : filter) { - if (filter == null - || filefilter.accept(directory, entry.getName())) { + if (filefilter.accept(directory, entry.getName())) { files.add(entry); } } @@ -90,7 +90,7 @@ public class FileUtils { SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(c); File dir = new File(mPrefs.getString(Config.pref_home, Environment.getExternalStorageDirectory().getAbsolutePath())); - SimpleDateFormat s = new SimpleDateFormat("yyyyMMddHHmmss"); + SimpleDateFormat s = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()); String timestamp = s.format(new Date()); File f = new File(dir.getAbsolutePath(), timestamp+".jpeg"); FileOutputStream out = new FileOutputStream(f); @@ -129,8 +129,6 @@ public class FileUtils { bt[(h-k-1)*w+j]=pix1; } } - - Bitmap sb=Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); - return sb; + return Bitmap.createBitmap(bt, w, h, Bitmap.Config.ARGB_8888); } } \ No newline at end of file diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/CloudFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/CloudFragment.java index 6918c7f24..6df27828f 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/CloudFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/CloudFragment.java @@ -212,13 +212,9 @@ class DropBoxClient { Editor edit = prefs.edit(); edit.putString("DBoxKey", key); edit.putString("DBoxSecret", secret); - edit.commit(); + edit.apply(); } - - - - private AndroidAuthSession buildSession() { AppKeyPair appKeyPair = new AppKeyPair(APP_KEY, APP_SECRET); AndroidAuthSession session; diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java index fac533da5..20e69c811 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/FileBrowser.java @@ -416,7 +416,7 @@ public class FileBrowser extends Fragment { private String heading; private File parent; - public navigate(FileBrowser context) { + navigate(FileBrowser context) { browser = new WeakReference<>(context); } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java index eb71bcae7..659d28b4c 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/MainActivity.java @@ -225,9 +225,6 @@ public class MainActivity extends AppCompatActivity implements } public void onGameSelected(Uri uri) { - if (Config.readOutput("uname -a").equals(getString(R.string.error_kernel))) { - showToastMessage(getString(R.string.unsupported), Snackbar.LENGTH_SHORT); - } String home_directory = mPrefs.getString(Config.pref_home, Environment.getExternalStorageDirectory().getAbsolutePath()); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java index ab72e5e0e..e2a5b9b71 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/config/OptionsFragment.java @@ -50,6 +50,7 @@ import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.lang.ref.WeakReference; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; @@ -132,7 +133,7 @@ public class OptionsFragment extends Fragment { Button mainBrowse = (Button) getView().findViewById(R.id.browse_main_path); mSpnrThemes = (Spinner) getView().findViewById(R.id.pick_button_theme); - new LocateThemes().execute(home_directory + "/themes"); + new LocateThemes(this).execute(home_directory + "/themes"); final EditText editBrowse = (EditText) getView().findViewById(R.id.main_path); editBrowse.setText(home_directory); @@ -156,7 +157,7 @@ public class OptionsFragment extends Fragment { } mPrefs.edit().putString(Config.pref_home, home_directory).apply(); JNIdc.config(home_directory); - new LocateThemes().execute(home_directory + "/themes"); + new LocateThemes(OptionsFragment.this).execute(home_directory + "/themes"); } } @@ -606,11 +607,17 @@ public class OptionsFragment extends Fragment { }); } - private final class LocateThemes extends AsyncTask> { + private static class LocateThemes extends AsyncTask> { + private WeakReference options; + + LocateThemes(OptionsFragment context) { + options = new WeakReference<>(context); + } + @Override protected List doInBackground(String... paths) { File storage = new File(paths[0]); - String[] mediaTypes = getResources().getStringArray(R.array.themes); + String[] mediaTypes = options.get().getResources().getStringArray(R.array.themes); FilenameFilter[] filter = new FilenameFilter[mediaTypes.length]; int i = 0; for (final String type : mediaTypes) { @@ -641,18 +648,18 @@ public class OptionsFragment extends Fragment { } themes[items.size()] = "None"; ArrayAdapter themeAdapter = new ArrayAdapter( - getActivity(), android.R.layout.simple_spinner_item, themes); + options.get().getActivity(), android.R.layout.simple_spinner_item, themes); themeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - mSpnrThemes.setAdapter(themeAdapter); - mSpnrThemes.setOnItemSelectedListener(new OnItemSelectedListener() { + options.get().mSpnrThemes.setAdapter(themeAdapter); + options.get().mSpnrThemes.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { String theme = String.valueOf(parentView.getItemAtPosition(position)); if (theme.equals("None")) { - mPrefs.edit().remove(Config.pref_theme).apply(); + options.get().mPrefs.edit().remove(Config.pref_theme).apply(); } else { - String theme_path = home_directory + "/themes/" + theme; - mPrefs.edit().putString(Config.pref_theme, theme_path).apply(); + String theme_path = options.get().home_directory + "/themes/" + theme; + options.get().mPrefs.edit().putString(Config.pref_theme, theme_path).apply(); } } @Override @@ -661,7 +668,7 @@ public class OptionsFragment extends Fragment { } }); } else { - mSpnrThemes.setEnabled(false); + options.get().mSpnrThemes.setEnabled(false); } } } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GitAdapter.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GitAdapter.java index 8808899b1..9103839ab 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GitAdapter.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/debug/GitAdapter.java @@ -34,13 +34,11 @@ import java.util.HashMap; public class GitAdapter extends BaseAdapter { - private static Activity activity; private ArrayList> data; private LayoutInflater inflater = null; private DisplayImageOptions options; - public GitAdapter(Activity a, ArrayList> d) { - activity = a; + public GitAdapter(Activity activity, ArrayList> d) { this.data = d; this.inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -141,16 +139,10 @@ public class GitAdapter extends BaseAdapter { WebView mWebView) { mWebView.getSettings().setSupportZoom(true); mWebView.getSettings().setBuiltInZoomControls(true); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - mWebView.getSettings().setDisplayZoomControls(false); - } + mWebView.getSettings().setDisplayZoomControls(false); mWebView.setInitialScale(1); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { - mWebView.getSettings().setUseWideViewPort(true); - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR_MR1) { - mWebView.getSettings().setLoadWithOverviewMode(true); - } + mWebView.getSettings().setUseWideViewPort(true); + mWebView.getSettings().setLoadWithOverviewMode(true); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setPluginState(PluginState.ON); mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GLCFactory14.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GLCFactory14.java index cc27b165f..18978e122 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GLCFactory14.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GLCFactory14.java @@ -161,7 +161,7 @@ public class GLCFactory14 { if (r == mRedSize && g == mGreenSize && b == mBlueSize && a == mAlphaSize) if (GL2JNIView.DEBUG) { - LOGW(String.format("Configuration %d:", i)); + LOGW(String.format(Locale.ENGLISH, "Configuration %d:", i)); printConfig(display, configs[i]); } return config; diff --git a/shell/android-studio/reicast/src/main/jni/src/Android.cpp b/shell/android-studio/reicast/src/main/jni/src/Android.cpp index f14384394..c73b3844a 100644 --- a/shell/android-studio/reicast/src/main/jni/src/Android.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/Android.cpp @@ -8,18 +8,14 @@ #include #include -#include #include "types.h" #include "profiler/profiler.h" -#include "cfg/cfg.h" #include "rend/TexCache.h" #include "hw/maple/maple_devs.h" #include "hw/maple/maple_if.h" #include "oslib/audiobackend_android.h" -#include "utils.h" - extern "C" { JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_config(JNIEnv *env,jobject obj,jstring dirName) __attribute__((visibility("default"))); diff --git a/shell/android-studio/reicast/src/main/jni/src/utils.cpp b/shell/android-studio/reicast/src/main/jni/src/utils.cpp index 76182accb..d3a44885f 100644 --- a/shell/android-studio/reicast/src/main/jni/src/utils.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/utils.cpp @@ -1,6 +1,5 @@ #include #include -#include extern "C" { #include "deps/libpng/png.h" } diff --git a/shell/android-studio/reicast/src/main/res/drawable/background.xml b/shell/android-studio/reicast/src/main/res/drawable/background.xml index 03ea5be22..ae833c037 100644 --- a/shell/android-studio/reicast/src/main/res/drawable/background.xml +++ b/shell/android-studio/reicast/src/main/res/drawable/background.xml @@ -1,6 +1,5 @@ - + @@ -9,7 +8,7 @@ \ No newline at end of file diff --git a/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml b/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml index 13495f88b..3ddbcdee5 100644 --- a/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout-v14/configure_fragment.xml @@ -523,7 +523,7 @@ @@ -599,7 +599,7 @@ @@ -628,7 +628,7 @@ @@ -657,7 +657,7 @@ diff --git a/shell/android-studio/reicast/src/main/res/layout-v14/input_fragment.xml b/shell/android-studio/reicast/src/main/res/layout-v14/input_fragment.xml index 263add193..62b5a2a8d 100644 --- a/shell/android-studio/reicast/src/main/res/layout-v14/input_fragment.xml +++ b/shell/android-studio/reicast/src/main/res/layout-v14/input_fragment.xml @@ -34,7 +34,7 @@