Merge branch 'master' of github.com:reicast/reicast-emulator
This commit is contained in:
commit
4a917a003e
|
@ -41,7 +41,7 @@ void SetCurrentTARC(u32 addr)
|
|||
|
||||
bool TryDecodeTARC()
|
||||
{
|
||||
verify((int)ta_ctx);
|
||||
verify(ta_ctx != 0);
|
||||
|
||||
if (vd_ctx == 0)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ bool TryDecodeTARC()
|
|||
|
||||
void VDecEnd()
|
||||
{
|
||||
verify((int)vd_ctx);
|
||||
verify(vd_ctx != 0);
|
||||
|
||||
vd_ctx->rend = vd_rc;
|
||||
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
android:versionCode="7"
|
||||
android:versionName="r7" >
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:xlargeScreens="true" />
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="19" />
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#BBDDDDDD"/>
|
||||
<corners android:radius="20dip"/>
|
||||
</shape>
|
|
@ -47,7 +47,7 @@
|
|||
android:id="@+id/settings_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
|
@ -109,7 +109,7 @@
|
|||
android:id="@+id/about_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
|
@ -170,7 +170,7 @@
|
|||
android:id="@+id/cloud_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="26dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
|
|
|
@ -2,22 +2,23 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/menuConfig"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="4dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:stretchColumns="*" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -25,6 +26,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_back" />
|
||||
</TableRow>
|
||||
|
@ -32,8 +34,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -41,6 +43,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_widescreen" />
|
||||
</TableRow>
|
||||
|
@ -48,8 +51,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -57,6 +60,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_frames_down" />
|
||||
</TableRow>
|
||||
|
@ -64,8 +68,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -73,6 +77,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_frames_up" />
|
||||
</TableRow>
|
||||
|
@ -80,8 +85,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -89,6 +94,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_frame_limit" />
|
||||
</TableRow>
|
||||
|
@ -96,8 +102,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -105,6 +111,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_audio" />
|
||||
</TableRow>
|
||||
|
@ -112,8 +119,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -121,6 +128,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_turbo" />
|
||||
</TableRow>
|
||||
|
|
|
@ -2,22 +2,23 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/menuDebug"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="4dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:stretchColumns="*" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -25,6 +26,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_back" />
|
||||
</TableRow>
|
||||
|
@ -32,8 +34,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -41,6 +43,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_clear_cache" />
|
||||
</TableRow>
|
||||
|
@ -48,8 +51,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -57,6 +60,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_profiler_one" />
|
||||
</TableRow>
|
||||
|
@ -64,8 +68,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -73,6 +77,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_profiler_two" />
|
||||
</TableRow>
|
||||
|
@ -80,8 +85,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -89,6 +94,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_print_stats" />
|
||||
</TableRow>
|
||||
|
|
|
@ -2,22 +2,23 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/menuMain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="4dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:stretchColumns="*" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<LinearLayout
|
||||
|
@ -30,8 +31,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -39,6 +40,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_disk" />
|
||||
</TableRow>
|
||||
|
@ -46,8 +48,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -55,6 +57,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_vmu_swap" />
|
||||
</TableRow>
|
||||
|
@ -62,8 +65,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -71,6 +74,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_options" />
|
||||
</TableRow>
|
||||
|
@ -78,8 +82,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -87,6 +91,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_debugging" />
|
||||
</TableRow>
|
||||
|
@ -94,8 +99,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -103,6 +108,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_screenshot" />
|
||||
</TableRow>
|
||||
|
@ -110,8 +116,8 @@
|
|||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#66000000"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
|
@ -119,6 +125,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded"
|
||||
android:ems="8"
|
||||
android:text="@string/popup_button_exit" />
|
||||
</TableRow>
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<string name="input">Input</string>
|
||||
<string name="about">About</string>
|
||||
<string name="rateme">Rate Me</string>
|
||||
<string name="messages">Test Suite</string>
|
||||
<string name="messages">Send Logs</string>
|
||||
<string name="cloud">Cloud VMU</string>
|
||||
|
||||
<string name="textOn">ON</string>
|
||||
|
|
|
@ -98,13 +98,7 @@ public class AboutFragment extends Fragment {
|
|||
slidingGithub.setOnDrawerOpenListener(new OnDrawerOpenListener() {
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public void onDrawerOpened() {
|
||||
retrieveGitTask queryGithub = new retrieveGitTask();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
queryGithub.executeOnExecutor(
|
||||
AsyncTask.THREAD_POOL_EXECUTOR, git_api);
|
||||
} else {
|
||||
queryGithub.execute(git_api);
|
||||
}
|
||||
new retrieveGitTask().execute(git_api);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -195,21 +195,9 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
|
||||
if (!ImgBrowse && !games) {
|
||||
LocateGames mLocateGames = new LocateGames(R.array.flash);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mLocateGames
|
||||
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, home_directory);
|
||||
new LocateGames(R.array.flash).execute(home_directory);
|
||||
} else {
|
||||
mLocateGames.execute(home_directory);
|
||||
}
|
||||
} else {
|
||||
LocateGames mLocateGames = new LocateGames(R.array.images);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mLocateGames
|
||||
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, game_directory);
|
||||
} else {
|
||||
mLocateGames.execute(game_directory);
|
||||
}
|
||||
new LocateGames(R.array.images).execute(game_directory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,14 +393,13 @@ public class FileBrowser extends Fragment {
|
|||
mCallback.onFolderSelected(game != null ? Uri
|
||||
.fromFile(game) : Uri.EMPTY);
|
||||
home_directory = game.getAbsolutePath().substring(0,
|
||||
game.getAbsolutePath().lastIndexOf(File.separator));
|
||||
game.getAbsolutePath().lastIndexOf(File.separator)).replace("/data", "");
|
||||
if (!DataDirectoryBIOS()) {
|
||||
MainActivity.showToastMessage(getActivity(),
|
||||
getActivity().getString(R.string.config_data, home_directory),
|
||||
Toast.LENGTH_LONG);
|
||||
}
|
||||
mPrefs.edit().putString("home_directory",
|
||||
home_directory.replace("/data", "")).commit();
|
||||
mPrefs.edit().putString("home_directory", home_directory).commit();
|
||||
JNIdc.config(home_directory.replace("/data", ""));
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +491,7 @@ public class FileBrowser extends Fragment {
|
|||
.putString(Config.pref_games,
|
||||
heading).commit();
|
||||
} else {
|
||||
home_directory = heading;
|
||||
home_directory = heading.replace("/data", "");
|
||||
mPrefs.edit()
|
||||
.putString(Config.pref_home,
|
||||
heading).commit();
|
||||
|
@ -544,12 +531,18 @@ public class FileBrowser extends Fragment {
|
|||
if (!data_directory.exists() || !data_directory.isDirectory()) {
|
||||
data_directory.mkdirs();
|
||||
File bios = new File(home_directory, "dc_boot.bin");
|
||||
boolean success = bios.renameTo(new File(home_directory + "/data", "dc_boot.bin"));
|
||||
boolean success = bios.renameTo(new File(home_directory, "data/dc_boot.bin"));
|
||||
File flash = new File(home_directory, "dc_flash.bin");
|
||||
success = flash.renameTo(new File(home_directory + "/data", "dc_flash.bin"));
|
||||
success = flash.renameTo(new File(home_directory, "data/dc_flash.bin"));
|
||||
return success;
|
||||
} else {
|
||||
File bios = new File(home_directory, "data/dc_boot.bin");
|
||||
File flash = new File(home_directory, "data/dc_flash.bin");
|
||||
if (bios.exists() && flash.exists()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public class GL2JNIActivity extends Activity {
|
|||
pad.deviceDescriptor_PlayerNum.remove(null);
|
||||
|
||||
moga.onCreate(this, pad);
|
||||
moga.mListener.setPlayerNum(1);
|
||||
|
||||
boolean controllerTwoConnected = false;
|
||||
boolean controllerThreeConnected = false;
|
||||
|
@ -314,7 +315,73 @@ public class GL2JNIActivity extends Activity {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
|
||||
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();
|
||||
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
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean simulatedTouchEvent(int playerNum, float L2, float R2) {
|
||||
|
|
|
@ -98,6 +98,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
pad.deviceDescriptor_PlayerNum.remove(null);
|
||||
|
||||
moga.onCreate(this, pad);
|
||||
moga.mListener.setPlayerNum(1);
|
||||
|
||||
boolean controllerTwoConnected = false;
|
||||
boolean controllerThreeConnected = false;
|
||||
|
@ -321,6 +322,73 @@ public class GL2JNINative extends NativeActivity {
|
|||
LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public boolean motionEventHandler(Integer playerNum, com.bda.controller.MotionEvent event) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
|
||||
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();
|
||||
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
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||
// Log.w("INPUT", event.toString() + " " + event.getSource());
|
||||
|
@ -402,7 +470,7 @@ public class GL2JNINative extends NativeActivity {
|
|||
|
||||
}
|
||||
|
||||
boolean handle_key(Integer playerNum, int kc, boolean down) {
|
||||
public boolean handle_key(Integer playerNum, int kc, boolean down) {
|
||||
if (playerNum == null || playerNum == -1)
|
||||
return false;
|
||||
if (kc == pad.getSelectButtonCode()) {
|
||||
|
|
|
@ -106,11 +106,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
public void uncaughtException(Thread t, Throwable error) {
|
||||
if (error != null) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
output.append("Thread:\n");
|
||||
for (StackTraceElement trace : t.getStackTrace()) {
|
||||
output.append(trace.toString() + "\n");
|
||||
}
|
||||
output.append("\nError:\n");
|
||||
output.append("UncaughtException:\n");
|
||||
for (StackTraceElement trace : error.getStackTrace()) {
|
||||
output.append(trace.toString() + "\n");
|
||||
}
|
||||
|
@ -349,14 +345,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
}
|
||||
|
||||
public void generateErrorLog() {
|
||||
GenerateLogs mGenerateLogs = new GenerateLogs(MainActivity.this);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mGenerateLogs.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
getFilesDir().getAbsolutePath());
|
||||
} else {
|
||||
mGenerateLogs.execute(getFilesDir().getAbsolutePath());
|
||||
}
|
||||
|
||||
new GenerateLogs(MainActivity.this).execute(getFilesDir().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -197,11 +197,14 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
public boolean isNetworkAvailable() {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) mContext
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
// NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
NetworkInfo mWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
NetworkInfo mMobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
// return activeNetworkInfo != null && activeNetworkInfo.isConnected();
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
if (mMobile != null && mWifi != null) {
|
||||
return mMobile.isAvailable() || mWifi.isAvailable();
|
||||
} else {
|
||||
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable getGameIcon() {
|
||||
|
|
|
@ -71,6 +71,7 @@ public class InputFragment extends Fragment {
|
|||
parentActivity = getActivity();
|
||||
|
||||
moga.onCreate(parentActivity, pad);
|
||||
moga.mListener.setPlayerNum(1);
|
||||
|
||||
sharedPreferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(parentActivity);
|
||||
|
|
|
@ -14,12 +14,14 @@ import android.os.Handler;
|
|||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import com.bda.controller.KeyEvent;
|
||||
|
||||
import com.bda.controller.KeyEvent;
|
||||
import com.bda.controller.Controller;
|
||||
import com.bda.controller.ControllerListener;
|
||||
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;
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -39,6 +41,7 @@ public final class MOGAInput
|
|||
static final int ACTION_VERSION_MOGAPRO = Controller.ACTION_VERSION_MOGAPRO;
|
||||
|
||||
public Controller mController = null;
|
||||
public ExampleControllerListener mListener;
|
||||
private String notify;
|
||||
private Gamepad pad;
|
||||
|
||||
|
@ -88,7 +91,8 @@ public final class MOGAInput
|
|||
|
||||
mController = Controller.getInstance(act);
|
||||
mController.init();
|
||||
mController.setListener(new ExampleControllerListener(), new Handler());
|
||||
mListener = new ExampleControllerListener();
|
||||
mController.setListener(mListener, new Handler());
|
||||
}
|
||||
|
||||
public void onDestroy()
|
||||
|
@ -129,19 +133,36 @@ public final class MOGAInput
|
|||
*/
|
||||
}
|
||||
|
||||
class ExampleControllerListener implements ControllerListener
|
||||
public class ExampleControllerListener implements ControllerListener
|
||||
{
|
||||
int playerNum;
|
||||
|
||||
public void setPlayerNum(int playerNum) {
|
||||
this.playerNum = playerNum;
|
||||
}
|
||||
|
||||
public void onKeyEvent(KeyEvent event)
|
||||
{
|
||||
// Handled by the primary controller interface
|
||||
// act.dispatchKeyEvent(new android.view.KeyEvent(0, 0, event.getAction(),
|
||||
// event.getKeyCode(), 0));
|
||||
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)
|
||||
{
|
||||
// Handled by the primary controller interface
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue