diff --git a/core/input/gamepad_device.h b/core/input/gamepad_device.h index 7768be5d9..1441d68ed 100644 --- a/core/input/gamepad_device.h +++ b/core/input/gamepad_device.h @@ -30,7 +30,7 @@ public: const std::string& name() { return _name; } int maple_port() { return _maple_port; } void set_maple_port(int port) { _maple_port = port; } - void gamepad_btn_input(u32 code, bool pressed); + virtual void gamepad_btn_input(u32 code, bool pressed); void gamepad_axis_input(u32 code, int value); virtual ~GamepadDevice() { save_mapping(); diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index d262eaf8c..c54eef962 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -442,6 +442,94 @@ static void detect_input_popup(int index, bool analog) ImGui::PopStyleVar(2); } +static void controller_mapping_popup(GamepadDevice *gamepad) +{ + if (ImGui::BeginPopupModal("Controller Mapping", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) + { + const float width = 350 * scaling; + const float height = 450 * scaling; + const float col0_width = ImGui::CalcTextSize("Right DPad Downxxx").x + ImGui::GetStyle().FramePadding.x * 2.0f + ImGui::GetStyle().ItemSpacing.x; + const float col1_width = width + - ImGui::GetStyle().GrabMinSize + - (col0_width + ImGui::GetStyle().ItemSpacing.x) + - (ImGui::CalcTextSize("Map").x + ImGui::GetStyle().FramePadding.x * 2.0f + ImGui::GetStyle().ItemSpacing.x); + + if (ImGui::Button("Done", ImVec2(100 * scaling, 30 * scaling))) + { + ImGui::CloseCurrentPopup(); + gamepad->save_mapping(); + } + ImGui::SetItemDefaultFocus(); + + char key_id[32]; + ImGui::BeginGroup(); + ImGui::Text(" Buttons "); + + ImGui::BeginChildFrame(ImGui::GetID("buttons"), ImVec2(width, height), ImGuiWindowFlags_None); + ImGui::Columns(3, "bindings", false); + ImGui::SetColumnWidth(0, col0_width); + ImGui::SetColumnWidth(1, col1_width); + for (int j = 0; j < ARRAY_SIZE(button_keys); j++) + { + sprintf(key_id, "key_id%d", j); + ImGui::PushID(key_id); + ImGui::Text("%s", button_names[j]); + ImGui::NextColumn(); + u32 code = gamepad->get_input_mapping()->get_button_code(button_keys[j]); + if (code != -1) + ImGui::Text("%d", code); + ImGui::NextColumn(); + if (ImGui::Button("Map")) + { + map_start_time = os_GetSeconds(); + ImGui::OpenPopup("Map Button"); + mapped_device = gamepad; + mapped_code = -1; + gamepad->detect_btn_input(&input_detected); + } + detect_input_popup(j, false); + ImGui::NextColumn(); + ImGui::PopID(); + } + ImGui::EndChildFrame(); + ImGui::EndGroup(); + + ImGui::SameLine(); + + ImGui::BeginGroup(); + ImGui::Text(" Analog Axes "); + ImGui::BeginChildFrame(ImGui::GetID("analog"), ImVec2(width, height), ImGuiWindowFlags_None); + ImGui::Columns(3, "bindings", false); + ImGui::SetColumnWidth(0, col0_width); + ImGui::SetColumnWidth(1, col1_width); + + for (int j = 0; j < ARRAY_SIZE(axis_keys); j++) + { + sprintf(key_id, "axis_id%d", j); + ImGui::PushID(key_id); + ImGui::Text("%s", axis_names[j]); + ImGui::NextColumn(); + u32 code = gamepad->get_input_mapping()->get_axis_code(axis_keys[j]); + if (code != -1) + ImGui::Text("%d", code); + ImGui::NextColumn(); + if (ImGui::Button("Map")) + { + map_start_time = os_GetSeconds(); + ImGui::OpenPopup("Map Axis"); + mapped_device = gamepad; + mapped_code = -1; + gamepad->detect_axis_input(&input_detected); + } + detect_input_popup(j, true); + ImGui::NextColumn(); + ImGui::PopID(); + } + ImGui::EndChildFrame(); + ImGui::EndGroup(); + ImGui::EndPopup(); + } +} static void gui_display_settings() { ImGui_Impl_NewFrame(); @@ -640,91 +728,8 @@ static void gui_display_settings() if (ImGui::Button("Map")) ImGui::OpenPopup("Controller Mapping"); - if (ImGui::BeginPopupModal("Controller Mapping", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) - { - const float width = 350 * scaling; - const float height = 450 * scaling; - const float col0_width = ImGui::CalcTextSize("Right DPad Downxxx").x + ImGui::GetStyle().FramePadding.x * 2.0f + ImGui::GetStyle().ItemSpacing.x; - const float col1_width = width - - ImGui::GetStyle().GrabMinSize - - (col0_width + ImGui::GetStyle().ItemSpacing.x) - - (ImGui::CalcTextSize("Map").x + ImGui::GetStyle().FramePadding.x * 2.0f + ImGui::GetStyle().ItemSpacing.x); + controller_mapping_popup(gamepad); - if (ImGui::Button("Done", ImVec2(100 * scaling, 30 * scaling))) - { - ImGui::CloseCurrentPopup(); - gamepad->save_mapping(); - } - ImGui::SetItemDefaultFocus(); - - char key_id[32]; - ImGui::BeginGroup(); - ImGui::Text(" Buttons "); - - ImGui::BeginChildFrame(ImGui::GetID("buttons"), ImVec2(width, height), ImGuiWindowFlags_None); - ImGui::Columns(3, "bindings", false); - ImGui::SetColumnWidth(0, col0_width); - ImGui::SetColumnWidth(1, col1_width); - for (int j = 0; j < ARRAY_SIZE(button_keys); j++) - { - sprintf(key_id, "key_id%d", j); - ImGui::PushID(key_id); - ImGui::Text("%s", button_names[j]); - ImGui::NextColumn(); - u32 code = gamepad->get_input_mapping()->get_button_code(button_keys[j]); - if (code != -1) - ImGui::Text("%d", code); - ImGui::NextColumn(); - if (ImGui::Button("Map")) - { - map_start_time = os_GetSeconds(); - ImGui::OpenPopup("Map Button"); - mapped_device = gamepad; - mapped_code = -1; - gamepad->detect_btn_input(&input_detected); - } - detect_input_popup(j, false); - ImGui::NextColumn(); - ImGui::PopID(); - } - ImGui::EndChildFrame(); - ImGui::EndGroup(); - - ImGui::SameLine(); - - ImGui::BeginGroup(); - ImGui::Text(" Analog Axes "); - ImGui::BeginChildFrame(ImGui::GetID("analog"), ImVec2(width, height), ImGuiWindowFlags_None); - ImGui::Columns(3, "bindings", false); - ImGui::SetColumnWidth(0, col0_width); - ImGui::SetColumnWidth(1, col1_width); - - for (int j = 0; j < ARRAY_SIZE(axis_keys); j++) - { - sprintf(key_id, "axis_id%d", j); - ImGui::PushID(key_id); - ImGui::Text("%s", axis_names[j]); - ImGui::NextColumn(); - u32 code = gamepad->get_input_mapping()->get_axis_code(axis_keys[j]); - if (code != -1) - ImGui::Text("%d", code); - ImGui::NextColumn(); - if (ImGui::Button("Map")) - { - map_start_time = os_GetSeconds(); - ImGui::OpenPopup("Map Axis"); - mapped_device = gamepad; - mapped_code = -1; - gamepad->detect_axis_input(&input_detected); - } - detect_input_popup(j, true); - ImGui::NextColumn(); - ImGui::PopID(); - } - ImGui::EndChildFrame(); - ImGui::EndGroup(); - ImGui::EndPopup(); - } ImGui::NextColumn(); ImGui::PopID(); } diff --git a/core/rend/gui.h b/core/rend/gui.h index edb3bd680..179e13fb1 100644 --- a/core/rend/gui.h +++ b/core/rend/gui.h @@ -16,6 +16,8 @@ You should have received a copy of the GNU General Public License along with reicast. If not, see . */ +#pragma once + void gui_init(); void gui_open_settings(); bool gui_is_open(); diff --git a/core/sdl/sdl_gamepad.h b/core/sdl/sdl_gamepad.h index afca7046b..f71fe4664 100644 --- a/core/sdl/sdl_gamepad.h +++ b/core/sdl/sdl_gamepad.h @@ -1,5 +1,6 @@ #include "../input/gamepad_device.h" #include "sdl.h" +#include "rend/gui.h" class DefaultInputMapping : public InputMapping { @@ -161,5 +162,13 @@ public: input_mapper = new MouseInputMapping(); } virtual ~SDLMouseGamepadDevice() {} + void gamepad_btn_input(u32 code, bool pressed) override + { + if (gui_is_open()) + // Don't register mouse clicks as gamepad presses when gui is open + // This makes the gamepad presses to be handled first and the mouse position to be ignored + // TODO Make this generic + return; + } }; diff --git a/shell/android-studio/reicast/src/main/AndroidManifest.xml b/shell/android-studio/reicast/src/main/AndroidManifest.xml index b699ab639..1018eaf8d 100644 --- a/shell/android-studio/reicast/src/main/AndroidManifest.xml +++ b/shell/android-studio/reicast/src/main/AndroidManifest.xml @@ -64,12 +64,6 @@ android:screenOrientation="sensorLandscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > - - = Build.VERSION_CODES.N) - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - startActivity(intent); - } else { - Intent intent = new Intent("com.reicast.EMULATOR", - uri, getApplicationContext(), GL2JNIActivity.class); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - startActivity(intent); - } + Intent intent = new Intent("com.reicast.EMULATOR", + uri, getApplicationContext(), GL2JNIActivity.class); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + startActivity(intent); } public void onFolderSelected(Uri uri) { 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 d9a209ef8..0194d6507 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 @@ -257,17 +257,6 @@ public class OptionsFragment extends Fragment { }); - OnCheckedChangeListener native_options = new OnCheckedChangeListener() { - - public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { - mPrefs.edit().putBoolean(Emulator.pref_nativeact, isChecked).apply(); - } - }; - CompoundButton native_opt = (CompoundButton) getView().findViewById(R.id.native_option); - native_opt.setChecked(mPrefs.getBoolean(Emulator.pref_nativeact, Emulator.nativeact)); - native_opt.setOnCheckedChangeListener(native_options); - OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, @@ -722,7 +711,6 @@ public class OptionsFragment extends Fragment { private void resetEmuSettings() { mPrefs.edit().remove(Emulator.pref_usereios).apply(); mPrefs.edit().remove(Config.pref_gamedetails).apply(); - 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_cable).apply(); @@ -747,6 +735,28 @@ public class OptionsFragment extends Fragment { mPrefs.edit().remove(Config.pref_renderdepth).apply(); mPrefs.edit().remove(Config.pref_theme).apply(); + + Emulator.usereios = false; + Emulator.dynarecopt = true; + Emulator.unstableopt = false; + Emulator.cable = 3; + Emulator.dcregion = 3; + Emulator.broadcast = 4; + Emulator.language = 6; + Emulator.limitfps = true; + Emulator.mipmaps = true; + Emulator.widescreen = false; + Emulator.frameskip = 0; + Emulator.pvrrender = 0; + Emulator.syncedrender = true; + Emulator.bootdisk = null; + Emulator.nosound = false; + Emulator.nobatch = false; + Emulator.customtextures = false; + Emulator.modvols = true; + Emulator.clipping = true; + Emulator.dynsafemode = true; + getActivity().finish(); } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GL2JNIView.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GL2JNIView.java index 25d2c9b2c..c06ecad75 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GL2JNIView.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/GL2JNIView.java @@ -28,7 +28,6 @@ import android.widget.Toast; import com.android.util.FileUtils; import com.reicast.emulator.Emulator; import com.reicast.emulator.GL2JNIActivity; -import com.reicast.emulator.GL2JNINative; import com.reicast.emulator.R; import com.reicast.emulator.config.Config; import com.reicast.emulator.emu.OnScreenMenu.FpsPopup; @@ -155,13 +154,9 @@ public class GL2JNIView extends GLSurfaceView // This is the game we are going to run fileName = newFileName; - if (Emulator.nativeact) { - if (GL2JNINative.syms != null) - JNIdc.data(1, GL2JNINative.syms); - } else { - if (GL2JNIActivity.syms != null) - JNIdc.data(1, GL2JNIActivity.syms); - } + if (GL2JNIActivity.syms != null) + JNIdc.data(1, GL2JNIActivity.syms); + JNIdc.init(fileName); JNIdc.query(ethd, context.getApplicationContext()); @@ -707,10 +702,6 @@ public class GL2JNIView extends GLSurfaceView ((GL2JNIActivity) context).getPad().joystick[0] = mPrefs.getBoolean( Gamepad.pref_js_merged + "_A", ((GL2JNIActivity) context).getPad().joystick[0]); - if (context instanceof GL2JNINative) - ((GL2JNINative) context).getPad().joystick[0] = mPrefs.getBoolean( - Gamepad.pref_js_merged + "_A", - ((GL2JNINative) context).getPad().joystick[0]); mPrefs.edit().putString(Config.game_title, reiosSoftware.trim()).apply(); } } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/OnScreenMenu.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/OnScreenMenu.java index e14a21079..ba0fc0c93 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/OnScreenMenu.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/OnScreenMenu.java @@ -1,29 +1,14 @@ package com.reicast.emulator.emu; -import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.view.Gravity; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup.LayoutParams; -import android.widget.Button; -import android.widget.LinearLayout; import android.widget.PopupWindow; -import android.widget.ScrollView; import android.widget.TextView; -import com.reicast.emulator.Emulator; import com.reicast.emulator.GL2JNIActivity; -import com.reicast.emulator.GL2JNINative; -import com.reicast.emulator.MainActivity; import com.reicast.emulator.R; -import com.reicast.emulator.config.Config; -import com.reicast.emulator.periph.VmuLcd; import java.util.Vector; @@ -32,9 +17,6 @@ public class OnScreenMenu { private Activity mContext; public OnScreenMenu(Activity context, SharedPreferences prefs) { - if (context instanceof GL2JNINative) { - this.mContext = context; - } if (context instanceof GL2JNIActivity) { this.mContext = context; } diff --git a/shell/android-studio/reicast/src/main/jni/Android.mk b/shell/android-studio/reicast/src/main/jni/Android.mk index 15e3fe060..23a6ffec3 100644 --- a/shell/android-studio/reicast/src/main/jni/Android.mk +++ b/shell/android-studio/reicast/src/main/jni/Android.mk @@ -113,8 +113,6 @@ else endif endif - - # # android has poor support for hardfp calling. # r9b+ is required, and it only works for internal calls @@ -134,14 +132,3 @@ endif #endif include $(BUILD_SHARED_LIBRARY) - -include $(CLEAR_VARS) - -LOCAL_MODULE := sexplay -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jni/src/XperiaPlay.c) -LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -LOCAL_STATIC_LIBRARIES := android_native_app_glue - -include $(BUILD_SHARED_LIBRARY) - -$(call import-module,android/native_app_glue) diff --git a/shell/android-studio/reicast/src/main/jni/src/XperiaPlay.c b/shell/android-studio/reicast/src/main/jni/src/XperiaPlay.c deleted file mode 100644 index 1376de807..000000000 --- a/shell/android-studio/reicast/src/main/jni/src/XperiaPlay.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2011, Sony Ericsson Mobile Communications AB. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the Sony Ericsson Mobile Communications AB nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define EXPORT_XPLAY __attribute__ ((visibility("default"))) - -#define TAG "reicast" -#define LOGW(...) ((void)__android_log_print( ANDROID_LOG_WARN, TAG, __VA_ARGS__ )) - -#undef NUM_METHODS -#define NUM_METHODS(x) (sizeof(x)/sizeof(*(x))) - -static JavaVM *jVM; - -typedef unsigned char BOOL; -#define FALSE 0 -#define TRUE 1 - -static jobject g_pActivity = 0; -static jmethodID javaOnNDKTouch = 0; -static jmethodID javaOnNDKKey = 0; - -static bool isXperiaPlay; - -/** - * Our saved state data. - */ -struct TOUCHSTATE -{ - int down; - int x; - int y; -}; - -/** - * Shared state for our app. - */ -struct ENGINE -{ - struct android_app* app; - int render; - int width; - int height; - int has_focus; - //ugly way to track touch states - struct TOUCHSTATE touchstate_screen[64]; - struct TOUCHSTATE touchstate_pad[64]; -}; - -void attach(){ - -} - -/** - * Process the next input event. - */ -static -int32_t -engine_handle_input( struct android_app* app, AInputEvent* event ) -{ - JNIEnv *jni; - (*jVM)->AttachCurrentThread(jVM, &jni, NULL); - - struct ENGINE* engine = (struct ENGINE*)app->userData; - if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_KEY){ - int device = AInputEvent_getDeviceId(event); - int action = AKeyEvent_getAction(event); - int keyCode = AKeyEvent_getKeyCode(event); - if(jni && g_pActivity){ - if((*jni)->ExceptionCheck(jni)) { - (*jni)->ExceptionDescribe(jni); - (*jni)->ExceptionClear(jni); - } - (*jni)->CallIntMethod(jni, g_pActivity, javaOnNDKKey, device, keyCode, action, AKeyEvent_getMetaState(event)); - if (!(keyCode == AKEYCODE_MENU || keyCode == AKEYCODE_BACK || keyCode == AKEYCODE_BUTTON_THUMBR || keyCode == AKEYCODE_VOLUME_UP || keyCode == AKEYCODE_VOLUME_DOWN || keyCode == AKEYCODE_BUTTON_SELECT)) { - return 1; - } - } - } else if( AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION ) { - int device = AInputEvent_getDeviceId( event ); - int nSourceId = AInputEvent_getSource( event ); - int nPointerCount = AMotionEvent_getPointerCount( event ); - int n; - - jboolean newTouch = JNI_TRUE; - for( n = 0 ; n < nPointerCount ; ++n ) - { - int nPointerId = AMotionEvent_getPointerId( event, n ); - int nAction = AMOTION_EVENT_ACTION_MASK & AMotionEvent_getAction( event ); - int nRawAction = AMotionEvent_getAction( event ); - - struct TOUCHSTATE *touchstate = 0; - if( nSourceId == AINPUT_SOURCE_TOUCHPAD ) { - touchstate = engine->touchstate_pad; - } else { - touchstate = engine->touchstate_screen; - } - - if( nAction == AMOTION_EVENT_ACTION_POINTER_DOWN || nAction == AMOTION_EVENT_ACTION_POINTER_UP ) - { - int nPointerIndex = (AMotionEvent_getAction( event ) & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; - nPointerId = AMotionEvent_getPointerId( event, nPointerIndex ); - } - - if( nAction == AMOTION_EVENT_ACTION_DOWN || nAction == AMOTION_EVENT_ACTION_POINTER_DOWN ) - { - touchstate[nPointerId].down = 1; - } - else if( nAction == AMOTION_EVENT_ACTION_UP || nAction == AMOTION_EVENT_ACTION_POINTER_UP || nAction == AMOTION_EVENT_ACTION_CANCEL ) - { - touchstate[nPointerId].down = 0; - } - - if (touchstate[nPointerId].down == 1) - { - touchstate[nPointerId].x = AMotionEvent_getX( event, n ); - touchstate[nPointerId].y = AMotionEvent_getY( event, n ); - } - - if( jni && g_pActivity && isXperiaPlay) { -// (*jni)->CallVoidMethod( jni, g_pActivity, javaOnNDKTouch, device, nSourceId, nRawAction, touchstate[nPointerId].x, touchstate[nPointerId].y, newTouch); - (*jni)->CallVoidMethod( jni, g_pActivity, javaOnNDKTouch, device, nSourceId, nRawAction, touchstate[nPointerId].x, touchstate[nPointerId].y); - } - newTouch = JNI_FALSE; - } - - if( isXperiaPlay ) { - return 1; - } else { - return 0; - } - } - return 0; -} - -/** - * Process the next main command. - */ -static -void -engine_handle_cmd( struct android_app* app, int32_t cmd ) -{ - struct ENGINE* engine = (struct ENGINE*)app->userData; - switch( cmd ) - { - case APP_CMD_SAVE_STATE: - // The system has asked us to save our current state. Do so if needed - break; - case APP_CMD_INIT_WINDOW: - // The window is being shown, get it ready. - if( engine->app->window != NULL ) - { - engine->has_focus = 1; - } - break; - - case APP_CMD_GAINED_FOCUS: - engine->has_focus = 1; - break; - - case APP_CMD_LOST_FOCUS: - // When our app loses focus, we stop rendering. - engine->render = 0; - engine->has_focus = 0; - //engine_draw_frame( engine ); - break; - } -} - -/** - * This is the main entry point of a native application that is using - * android_native_app_glue. It runs in its own thread, with its own - * event loop for receiving input events and doing other things (rendering). - */ -void -android_main( struct android_app* state ) -{ - struct ENGINE engine; - - memset( &engine, 0, sizeof(engine) ); - state->userData = &engine; - state->onAppCmd = engine_handle_cmd; - state->onInputEvent = engine_handle_input; - engine.app = state; - - //setup(state); - //JNIEnv *env; - //(*jVM)->AttachCurrentThread(jVM, &env, NULL); - - if( state->savedState != NULL ) - { - // We are starting with a previous saved state; restore from it. - } - // our 'main loop' - while( 1 ) - { - // Read all pending events. - int ident; - int events; - struct android_poll_source* source; - // If not rendering, we will block forever waiting for events. - // If rendering, we loop until all events are read, then continue - // to draw the next frame. - while( (ident = ALooper_pollAll( 250, NULL, &events, (void**)&source) ) >= 0 ) - { - // Process this event. - // This will call the function pointer android_app:nInputEvent() which in our case is - // engine_handle_input() - if( source != NULL ) - { - source->process( state, source ); - } - // Check if we are exiting. - if( state->destroyRequested != 0 ) - { - return; - } - //usleep(20000); //20 miliseconds - } - } -} - -static -int -RegisterNative( JNIEnv* env, jobject clazz, jboolean touchpad ) -{ - g_pActivity = (jobject)(*env)->NewGlobalRef( env, clazz ); - isXperiaPlay = (bool) touchpad; - return 0; -} - -static const JNINativeMethod activity_methods[] = -{ - { "RegisterNative", "(Z)I", (void*)RegisterNative }, -}; - -jint EXPORT_XPLAY JNICALL JNI_OnLoad(JavaVM * vm, void * reserved) -{ - JNIEnv *env; - jVM = vm; - if((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) - { - LOGW("%s - Failed to get the environment using GetEnv()", __FUNCTION__); - return -1; - } - const char* interface_path = "com/reicast/emulator/GL2JNINative"; - jclass java_activity_class = (*env)->FindClass( env, interface_path ); - - if( !java_activity_class ) - { - LOGW( "%s - Failed to get %s class reference", __FUNCTION__, interface_path ); - return -1; - } - - if( (*env)->RegisterNatives( env, java_activity_class, activity_methods, NUM_METHODS(activity_methods) ) != JNI_OK ) - { - LOGW( "%s - Failed to register native activity methods", __FUNCTION__ ); - return -1; - } - - char device_type[PROP_VALUE_MAX]; - __system_property_get("ro.product.model", device_type); - if( isXperiaPlay ) { - LOGW( "%s touchpad enabled", device_type ); - } else { - LOGW( "%s touchpad ignored", device_type ); - } - -// javaOnNDKTouch = (*env)->GetMethodID( env, java_activity_class, "OnNativeMotion", "(IIIIIZ)Z"); - javaOnNDKTouch = (*env)->GetMethodID( env, java_activity_class, "OnNativeMotion", "(IIIII)Z"); - javaOnNDKKey = (*env)->GetMethodID( env, java_activity_class, "OnNativeKeyPress", "(IIII)Z"); - - return JNI_VERSION_1_4; -} 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 692ad870e..2fdf75be4 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 @@ -217,34 +217,6 @@ android:layout_marginLeft="6dp" android:stretchColumns="*" > - - - - - - - - - - diff --git a/shell/android-studio/reicast/src/main/res/layout/bios_list_item.xml b/shell/android-studio/reicast/src/main/res/layout/bios_list_item.xml index 2b587ffc7..94976991e 100644 --- a/shell/android-studio/reicast/src/main/res/layout/bios_list_item.xml +++ b/shell/android-studio/reicast/src/main/res/layout/bios_list_item.xml @@ -25,7 +25,7 @@ android:layout_marginRight="6dp" android:layout_marginTop="2dp" android:scaleType="fitCenter" - app:srcCompat="@drawable/gdi" /> + app:srcCompat="@drawable/disk_unknown" /> - - - - - - - - - - diff --git a/shell/android-studio/reicast/src/main/res/values-da/strings.xml b/shell/android-studio/reicast/src/main/res/values-da/strings.xml index 5ccb6975e..2c9c5f6d5 100644 --- a/shell/android-studio/reicast/src/main/res/values-da/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-da/strings.xml @@ -24,7 +24,6 @@ Optimerings- og fejlfindingsopsætninger Eksperimentel (Kan medføre vidtspredt panik) Aktiver spil detaljer - Aktiver native interface Dynarec option Ustabile optimeringer DC region diff --git a/shell/android-studio/reicast/src/main/res/values-de/strings.xml b/shell/android-studio/reicast/src/main/res/values-de/strings.xml index 8cddf5112..ac371b1d8 100644 --- a/shell/android-studio/reicast/src/main/res/values-de/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-de/strings.xml @@ -31,7 +31,6 @@ Verwende reios-BIOS BIOS-Region (dc_flash[X].bin) Aktiviere Spiele-Details - Nativer Modus [Kein OSD] Dynarec-Optionen Instabile Optimierungen Kabeltyp diff --git a/shell/android-studio/reicast/src/main/res/values-fr/strings.xml b/shell/android-studio/reicast/src/main/res/values-fr/strings.xml index 8b2520cdb..8fd61cc01 100644 --- a/shell/android-studio/reicast/src/main/res/values-fr/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-fr/strings.xml @@ -30,7 +30,6 @@ Last Edit: 21 May 2014 Options d\'optimisations et de débogage Experimental (peut causer des crashs) Activer le détail des jeux - Activer l\'interface native Dynarec Optimisations instables Région du bios diff --git a/shell/android-studio/reicast/src/main/res/values-it/strings.xml b/shell/android-studio/reicast/src/main/res/values-it/strings.xml index 353bbd474..4dc3d2b4b 100644 --- a/shell/android-studio/reicast/src/main/res/values-it/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-it/strings.xml @@ -30,7 +30,6 @@ Opzioni di Ottimizzazione e di Debugging Opzioni Sperimentali (Possono causare problemi) Abilita i Dettagli del Gioco - Abilita Interfaccia Nativa Dynarec Ottimizzazioni Instabili Regione del DC diff --git a/shell/android-studio/reicast/src/main/res/values-jp/strings.xml b/shell/android-studio/reicast/src/main/res/values-jp/strings.xml index 0077cb091..4f33d4bf2 100644 --- a/shell/android-studio/reicast/src/main/res/values-jp/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-jp/strings.xml @@ -21,7 +21,6 @@ 最適化とデバッグの設定 実験的 - ネイティブインタフェースを使用 Dynarecの設定 不安定な最適化 DC地域 diff --git a/shell/android-studio/reicast/src/main/res/values-pt/strings.xml b/shell/android-studio/reicast/src/main/res/values-pt/strings.xml index 131e80365..31e85c90f 100644 --- a/shell/android-studio/reicast/src/main/res/values-pt/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-pt/strings.xml @@ -31,7 +31,6 @@ Usar reios BIOS Região da BIOS (dc_flash[X].bin) Habilitar detalhes do jogo - Modo nativo [Sem OSD] Habilitar Recompilador Dinâmico (Dynarec) Otimizações instáveis Tipo de cabo diff --git a/shell/android-studio/reicast/src/main/res/values-ru/strings.xml b/shell/android-studio/reicast/src/main/res/values-ru/strings.xml index 9e507f1af..af218f530 100644 --- a/shell/android-studio/reicast/src/main/res/values-ru/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values-ru/strings.xml @@ -33,7 +33,6 @@ Использовать reios BIOS Регион BIOS (dc_flash[X].bin) Информация об игре - Нативный режим (без индикации) Динамическая рекомпиляция Нестабильные оптимизации Тип кабеля 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 c7ba98990..d0a2ad66e 100644 --- a/shell/android-studio/reicast/src/main/res/values/strings.xml +++ b/shell/android-studio/reicast/src/main/res/values/strings.xml @@ -35,7 +35,6 @@ Use reios BIOS BIOS Region (dc_flash[X].bin) Enable Game Details - Native Gamepad Mode [No OSD] Dynamic Recompiler Unstable Optimisations Bypass Div Matching