mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
Reformat Android code
This commit is contained in:
@ -67,7 +67,8 @@ android {
|
||||
defaultConfig {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=RelWithDebInfo" // , "-DENABLE_GENERIC=ON"
|
||||
arguments "-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
||||
// , "-DENABLE_GENERIC=ON"
|
||||
abiFilters "arm64-v8a", "x86_64" //, "armeabi-v7a", "x86"
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,9 @@
|
||||
android:supportsRtl="true"
|
||||
android:isGame="true"
|
||||
android:banner="@drawable/banner_tv">
|
||||
<meta-data android:name="android.max_aspect" android:value="2.1" />
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.1"/>
|
||||
|
||||
<activity
|
||||
android:name=".ui.main.MainActivity"
|
||||
|
@ -7,13 +7,7 @@
|
||||
package org.dolphinemu.dolphinemu;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.content.res.AssetManager;
|
||||
import android.view.Surface;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
@ -218,7 +212,6 @@ public final class NativeLibrary
|
||||
* @param Device The input descriptor of the gamepad.
|
||||
* @param Button Key code identifying which button was pressed.
|
||||
* @param Action Mask identifying which action is happening (button pressed down, or button released).
|
||||
*
|
||||
* @return If we handled the button press.
|
||||
*/
|
||||
public static native boolean onGamePadEvent(String Device, int Button, int Action);
|
||||
@ -245,10 +238,10 @@ public final class NativeLibrary
|
||||
* @param Section The section key that the actual key is in.
|
||||
* @param Key The key to get the value from.
|
||||
* @param Default The value to return in the event the given key doesn't exist.
|
||||
*
|
||||
* @return the value stored at the key, or a default value if it doesn't exist.
|
||||
*/
|
||||
public static native String GetConfig(String configFile, String Section, String Key, String Default);
|
||||
public static native String GetConfig(String configFile, String Section, String Key,
|
||||
String Default);
|
||||
|
||||
/**
|
||||
* Sets a value to a key in the given ini config file.
|
||||
@ -333,22 +326,32 @@ public final class NativeLibrary
|
||||
|
||||
// Surface Handling
|
||||
public static native void SurfaceChanged(Surface surf);
|
||||
|
||||
public static native void SurfaceDestroyed();
|
||||
|
||||
/** Unpauses emulation from a paused state. */
|
||||
/**
|
||||
* Unpauses emulation from a paused state.
|
||||
*/
|
||||
public static native void UnPauseEmulation();
|
||||
|
||||
/** Pauses emulation. */
|
||||
/**
|
||||
* Pauses emulation.
|
||||
*/
|
||||
public static native void PauseEmulation();
|
||||
|
||||
/** Stops emulation. */
|
||||
/**
|
||||
* Stops emulation.
|
||||
*/
|
||||
public static native void StopEmulation();
|
||||
|
||||
/** Returns true if emulation is running (or is paused). */
|
||||
/**
|
||||
* Returns true if emulation is running (or is paused).
|
||||
*/
|
||||
public static native boolean IsRunning();
|
||||
|
||||
/**
|
||||
* Enables or disables CPU block profiling
|
||||
*
|
||||
* @param enable
|
||||
*/
|
||||
public static native void SetProfiling(boolean enable);
|
||||
@ -358,7 +361,9 @@ public final class NativeLibrary
|
||||
*/
|
||||
public static native void WriteProfileResults();
|
||||
|
||||
/** Native EGL functions not exposed by Java bindings **/
|
||||
/**
|
||||
* Native EGL functions not exposed by Java bindings
|
||||
**/
|
||||
public static native void eglBindAPI(int api);
|
||||
|
||||
/**
|
||||
@ -367,7 +372,9 @@ public final class NativeLibrary
|
||||
public static native void RefreshWiimotes();
|
||||
|
||||
private static boolean alertResult = false;
|
||||
public static boolean displayAlertMsg(final String caption, final String text, final boolean yesNo)
|
||||
|
||||
public static boolean displayAlertMsg(final String caption, final String text,
|
||||
final boolean yesNo)
|
||||
{
|
||||
Log.error("[NativeLibrary] Alert: " + text);
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
@ -434,7 +441,9 @@ public final class NativeLibrary
|
||||
{
|
||||
lock.wait();
|
||||
}
|
||||
catch (Exception e) { }
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (yesNo)
|
||||
|
@ -69,16 +69,19 @@ public class AppLinkActivity extends FragmentActivity
|
||||
directoryStateReceiver =
|
||||
new DirectoryStateReceiver(directoryInitializationState ->
|
||||
{
|
||||
if (directoryInitializationState == DirectoryInitializationService.DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
if (directoryInitializationState ==
|
||||
DirectoryInitializationService.DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
{
|
||||
play(playAction);
|
||||
}
|
||||
else if (directoryInitializationState == DirectoryInitializationService.DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED)
|
||||
else if (directoryInitializationState ==
|
||||
DirectoryInitializationService.DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED)
|
||||
{
|
||||
Toast.makeText(this, R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
else if (directoryInitializationState == DirectoryInitializationService.DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE)
|
||||
else if (directoryInitializationState ==
|
||||
DirectoryInitializationService.DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE)
|
||||
{
|
||||
Toast.makeText(this, R.string.external_storage_not_mounted, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
|
@ -21,7 +21,8 @@ public class CustomFilePickerActivity extends FilePickerActivity
|
||||
{
|
||||
AbstractFilePickerFragment<File> fragment = new CustomFilePickerFragment();
|
||||
// startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
|
||||
fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
|
||||
fragment.setArgs(
|
||||
startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
|
||||
mode, allowMultiple, allowCreateDir, allowExistingFile, singleClick);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -95,7 +95,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
MENU_ACTION_SAVE_SLOT6, MENU_ACTION_LOAD_SLOT1, MENU_ACTION_LOAD_SLOT2,
|
||||
MENU_ACTION_LOAD_SLOT3, MENU_ACTION_LOAD_SLOT4, MENU_ACTION_LOAD_SLOT5,
|
||||
MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC})
|
||||
public @interface MenuAction {
|
||||
public @interface MenuAction
|
||||
{
|
||||
}
|
||||
|
||||
public static final int MENU_ACTION_EDIT_CONTROLS_PLACEMENT = 0;
|
||||
@ -126,18 +127,28 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
|
||||
|
||||
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
static {
|
||||
buttonsActionsMap.append(R.id.menu_emulation_edit_layout, EmulationActivity.MENU_ACTION_EDIT_CONTROLS_PLACEMENT);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_toggle_controls, EmulationActivity.MENU_ACTION_TOGGLE_CONTROLS);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_adjust_scale, EmulationActivity.MENU_ACTION_ADJUST_SCALE);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_choose_controller, EmulationActivity.MENU_ACTION_CHOOSE_CONTROLLER);
|
||||
buttonsActionsMap.append(R.id.menu_refresh_wiimotes, EmulationActivity.MENU_ACTION_REFRESH_WIIMOTES);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_screenshot, EmulationActivity.MENU_ACTION_TAKE_SCREENSHOT);
|
||||
|
||||
static
|
||||
{
|
||||
buttonsActionsMap.append(R.id.menu_emulation_edit_layout,
|
||||
EmulationActivity.MENU_ACTION_EDIT_CONTROLS_PLACEMENT);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_toggle_controls,
|
||||
EmulationActivity.MENU_ACTION_TOGGLE_CONTROLS);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_emulation_adjust_scale, EmulationActivity.MENU_ACTION_ADJUST_SCALE);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_choose_controller,
|
||||
EmulationActivity.MENU_ACTION_CHOOSE_CONTROLLER);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_refresh_wiimotes, EmulationActivity.MENU_ACTION_REFRESH_WIIMOTES);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_emulation_screenshot, EmulationActivity.MENU_ACTION_TAKE_SCREENSHOT);
|
||||
|
||||
buttonsActionsMap.append(R.id.menu_quicksave, EmulationActivity.MENU_ACTION_QUICK_SAVE);
|
||||
buttonsActionsMap.append(R.id.menu_quickload, EmulationActivity.MENU_ACTION_QUICK_LOAD);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_save_root, EmulationActivity.MENU_ACTION_SAVE_ROOT);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_load_root, EmulationActivity.MENU_ACTION_LOAD_ROOT);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_emulation_save_root, EmulationActivity.MENU_ACTION_SAVE_ROOT);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_emulation_load_root, EmulationActivity.MENU_ACTION_LOAD_ROOT);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_save_1, EmulationActivity.MENU_ACTION_SAVE_SLOT1);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_save_2, EmulationActivity.MENU_ACTION_SAVE_SLOT2);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_save_3, EmulationActivity.MENU_ACTION_SAVE_SLOT3);
|
||||
@ -150,10 +161,12 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
buttonsActionsMap.append(R.id.menu_emulation_load_5, EmulationActivity.MENU_ACTION_LOAD_SLOT5);
|
||||
buttonsActionsMap.append(R.id.menu_change_disc, EmulationActivity.MENU_ACTION_CHANGE_DISC);
|
||||
buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_joystick_rel_center, EmulationActivity.MENU_ACTION_JOYSTICK_REL_CENTER);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_joystick_rel_center,
|
||||
EmulationActivity.MENU_ACTION_JOYSTICK_REL_CENTER);
|
||||
}
|
||||
|
||||
public static void launch(FragmentActivity activity, GameFile gameFile, int position, View sharedView)
|
||||
public static void launch(FragmentActivity activity, GameFile gameFile, int position,
|
||||
View sharedView)
|
||||
{
|
||||
Intent launcher = new Intent(activity, EmulationActivity.class);
|
||||
|
||||
@ -225,7 +238,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
});
|
||||
// Set these options now so that the SurfaceView the game renders into is the right size.
|
||||
enableFullscreenImmersive();
|
||||
Toast.makeText(this, getString(R.string.emulation_touch_button_help), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, getString(R.string.emulation_touch_button_help), Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -382,7 +396,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
BACKSTACK_NAME_MENU, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
mMenuVisible = false;
|
||||
|
||||
if (!result) {
|
||||
if (!result)
|
||||
{
|
||||
// Removing the menu failed, so that means it wasn't visible. Add it.
|
||||
Fragment fragment = MenuFragment.newInstance(mSelectedTitle);
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
@ -398,7 +413,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void exitWithAnimation() {
|
||||
public void exitWithAnimation()
|
||||
{
|
||||
runOnUiThread(() ->
|
||||
{
|
||||
Picasso.with(EmulationActivity.this)
|
||||
@ -408,14 +424,17 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
.load(mScreenPath)
|
||||
.noFade()
|
||||
.noPlaceholder()
|
||||
.into(mImageView, new Callback() {
|
||||
.into(mImageView, new Callback()
|
||||
{
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
public void onSuccess()
|
||||
{
|
||||
showScreenshot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
public void onError()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
});
|
||||
@ -452,7 +471,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
// Populate the checkbox value for joystick center on touch
|
||||
menu.findItem(R.id.menu_emulation_joystick_rel_center).setChecked(mPreferences.getBoolean("joystickRelCenter", true));
|
||||
menu.findItem(R.id.menu_emulation_joystick_rel_center)
|
||||
.setChecked(mPreferences.getBoolean("joystickRelCenter", true));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -663,36 +683,53 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
return NativeLibrary.onGamePadEvent(input.getDescriptor(), event.getKeyCode(), action);
|
||||
}
|
||||
|
||||
private void toggleControls() {
|
||||
private void toggleControls()
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
boolean[] enabledButtons = new boolean[14];
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.emulation_toggle_controls);
|
||||
if (sIsGameCubeGame || mPreferences.getInt("wiiController", 3) == 0) {
|
||||
for (int i = 0; i < enabledButtons.length; i++) {
|
||||
if (sIsGameCubeGame || mPreferences.getInt("wiiController", 3) == 0)
|
||||
{
|
||||
for (int i = 0; i < enabledButtons.length; i++)
|
||||
{
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleGc" + i, true);
|
||||
}
|
||||
builder.setMultiChoiceItems(R.array.gcpadButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleGc" + indexSelected, isChecked));
|
||||
} else if (mPreferences.getInt("wiiController", 3) == 4) {
|
||||
for (int i = 0; i < enabledButtons.length; i++) {
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleGc" + indexSelected, isChecked));
|
||||
}
|
||||
else if (mPreferences.getInt("wiiController", 3) == 4)
|
||||
{
|
||||
for (int i = 0; i < enabledButtons.length; i++)
|
||||
{
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleClassic" + i, true);
|
||||
}
|
||||
builder.setMultiChoiceItems(R.array.classicButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleClassic" + indexSelected, isChecked));
|
||||
} else {
|
||||
for (int i = 0; i < enabledButtons.length; i++) {
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleClassic" + indexSelected, isChecked));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < enabledButtons.length; i++)
|
||||
{
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleWii" + i, true);
|
||||
}
|
||||
if (mPreferences.getInt("wiiController", 3) == 3) {
|
||||
if (mPreferences.getInt("wiiController", 3) == 3)
|
||||
{
|
||||
builder.setMultiChoiceItems(R.array.nunchukButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
} else {
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.setMultiChoiceItems(R.array.wiimoteButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
}
|
||||
}
|
||||
builder.setNeutralButton(getString(R.string.emulation_toggle_all), (dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility());
|
||||
builder.setNeutralButton(getString(R.string.emulation_toggle_all),
|
||||
(dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility());
|
||||
builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) ->
|
||||
{
|
||||
editor.apply();
|
||||
@ -704,7 +741,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
private void adjustScale() {
|
||||
private void adjustScale()
|
||||
{
|
||||
LayoutInflater inflater = LayoutInflater.from(this);
|
||||
View view = inflater.inflate(R.layout.dialog_seekbar, null);
|
||||
|
||||
@ -714,16 +752,20 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
|
||||
seekbar.setMax(150);
|
||||
seekbar.setProgress(mPreferences.getInt("controlScale", 50));
|
||||
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
||||
{
|
||||
public void onStartTrackingTouch(SeekBar seekBar)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
||||
{
|
||||
value.setText(String.valueOf(progress + 50));
|
||||
}
|
||||
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
public void onStopTrackingTouch(SeekBar seekBar)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
@ -747,11 +789,13 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
private void chooseController() {
|
||||
private void chooseController()
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.emulation_choose_controller);
|
||||
builder.setSingleChoiceItems(R.array.controllersEntries, mPreferences.getInt("wiiController", 3),
|
||||
builder.setSingleChoiceItems(R.array.controllersEntries,
|
||||
mPreferences.getInt("wiiController", 3),
|
||||
(dialog, indexSelected) ->
|
||||
{
|
||||
editor.putInt("wiiController", indexSelected);
|
||||
@ -765,7 +809,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
|
||||
Toast.makeText(getApplication(), R.string.emulation_controller_changed, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplication(), R.string.emulation_controller_changed, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = builder.create();
|
||||
|
@ -12,10 +12,10 @@ import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
|
||||
import org.dolphinemu.dolphinemu.viewholders.GameViewHolder;
|
||||
|
||||
@ -152,9 +152,12 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle("Game Settings")
|
||||
.setItems(R.array.gameSettingsMenus, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
.setItems(R.array.gameSettingsMenus, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
switch (which)
|
||||
{
|
||||
case 0:
|
||||
SettingsActivity.launch(activity, MenuTag.CONFIG, gameId);
|
||||
break;
|
||||
@ -162,22 +165,27 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
|
||||
SettingsActivity.launch(activity, MenuTag.GRAPHICS, gameId);
|
||||
break;
|
||||
case 2:
|
||||
String path = DirectoryInitializationService.getUserDirectory() + "/GameSettings/" + gameId + ".ini";
|
||||
String path =
|
||||
DirectoryInitializationService.getUserDirectory() + "/GameSettings/" +
|
||||
gameId + ".ini";
|
||||
File gameSettingsFile = new File(path);
|
||||
if (gameSettingsFile.exists())
|
||||
{
|
||||
if (gameSettingsFile.delete())
|
||||
{
|
||||
Toast.makeText(view.getContext(), "Cleared settings for " + gameId, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(view.getContext(), "Cleared settings for " + gameId,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(view.getContext(), "Unable to clear settings for " + gameId, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(view.getContext(), "Unable to clear settings for " + gameId,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(view.getContext(), "No game settings to delete", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(view.getContext(), "No game settings to delete",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -198,7 +206,8 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
|
||||
RecyclerView.State state)
|
||||
{
|
||||
outRect.left = space;
|
||||
outRect.right = space;
|
||||
|
@ -14,11 +14,11 @@ import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
|
||||
import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder;
|
||||
|
||||
@ -80,7 +80,8 @@ public final class GameRowPresenter extends Presenter
|
||||
Context context = holder.cardParent.getContext();
|
||||
Drawable background = ContextCompat.getDrawable(context, backgroundId);
|
||||
holder.cardParent.setInfoAreaBackground(background);
|
||||
holder.cardParent.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
holder.cardParent.setOnLongClickListener(new View.OnLongClickListener()
|
||||
{
|
||||
@Override
|
||||
public boolean onLongClick(View view)
|
||||
{
|
||||
@ -99,9 +100,12 @@ public final class GameRowPresenter extends Presenter
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle("Game Settings")
|
||||
.setItems(R.array.gameSettingsMenus, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
.setItems(R.array.gameSettingsMenus, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
switch (which)
|
||||
{
|
||||
case 0:
|
||||
SettingsActivity.launch(activity, MenuTag.CONFIG, gameId);
|
||||
break;
|
||||
@ -109,22 +113,27 @@ public final class GameRowPresenter extends Presenter
|
||||
SettingsActivity.launch(activity, MenuTag.GRAPHICS, gameId);
|
||||
break;
|
||||
case 2:
|
||||
String path = DirectoryInitializationService.getUserDirectory() + "/GameSettings/" + gameId + ".ini";
|
||||
String path = DirectoryInitializationService.getUserDirectory() +
|
||||
"/GameSettings/" + gameId + ".ini";
|
||||
File gameSettingsFile = new File(path);
|
||||
if (gameSettingsFile.exists())
|
||||
{
|
||||
if (gameSettingsFile.delete())
|
||||
{
|
||||
Toast.makeText(view.getContext(), "Cleared settings for " + gameId, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(view.getContext(), "Cleared settings for " + gameId,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(view.getContext(), "Unable to clear settings for " + gameId, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(view.getContext(),
|
||||
"Unable to clear settings for " + gameId, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(view.getContext(), "No game settings to delete", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(view.getContext(), "No game settings to delete",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ package org.dolphinemu.dolphinemu.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ImageSpan;
|
||||
|
@ -5,14 +5,12 @@ import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import org.dolphinemu.dolphinemu.DolphinApplication;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
@ -41,7 +39,8 @@ public final class GameDetailsDialog extends DialogFragment
|
||||
GameFile gameFile = GameFileCacheService.addOrGet(getArguments().getString(ARG_GAME_PATH));
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
ViewGroup contents = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.dialog_game_details, null);
|
||||
ViewGroup contents = (ViewGroup) getActivity().getLayoutInflater()
|
||||
.inflate(R.layout.dialog_game_details, null);
|
||||
|
||||
final ImageView imageGameScreen = contents.findViewById(R.id.image_game_screen);
|
||||
CircleImageView circleBanner = contents.findViewById(R.id.circle_banner);
|
||||
|
@ -192,15 +192,19 @@ public final class MotionAlertDialog extends AlertDialog
|
||||
* @param motionRange MotionRange of the movement
|
||||
* @param axisDir Either '-' or '+'
|
||||
*/
|
||||
private void saveMotionInput(InputDevice device, InputDevice.MotionRange motionRange, char axisDir)
|
||||
private void saveMotionInput(InputDevice device, InputDevice.MotionRange motionRange,
|
||||
char axisDir)
|
||||
{
|
||||
String bindStr = "Device '" + device.getDescriptor() + "'-Axis " + motionRange.getAxis() + axisDir;
|
||||
String bindStr =
|
||||
"Device '" + device.getDescriptor() + "'-Axis " + motionRange.getAxis() + axisDir;
|
||||
String uiString = device.getName() + ": Axis " + motionRange.getAxis() + axisDir;
|
||||
|
||||
saveInput(bindStr, uiString);
|
||||
}
|
||||
|
||||
/** Save the input string to settings and SharedPreferences, then dismiss this Dialog. */
|
||||
/**
|
||||
* Save the input string to settings and SharedPreferences, then dismiss this Dialog.
|
||||
*/
|
||||
private void saveInput(String bind, String ui)
|
||||
{
|
||||
setting.setValue(bind);
|
||||
|
@ -24,7 +24,6 @@ public abstract class Setting
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The identifier used to write this setting to the ini file.
|
||||
*/
|
||||
public String getKey()
|
||||
@ -33,7 +32,6 @@ public abstract class Setting
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The name of the header under which this Setting should be written in the ini file.
|
||||
*/
|
||||
public String getSection()
|
||||
|
@ -35,9 +35,15 @@ public class Settings
|
||||
|
||||
static
|
||||
{
|
||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_DOLPHIN, Arrays.asList(SECTION_INI_CORE, SECTION_INI_INTERFACE, SECTION_BINDINGS, SECTION_ANALYTICS));
|
||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_GFX, Arrays.asList(SECTION_GFX_SETTINGS, SECTION_GFX_ENHANCEMENTS, SECTION_GFX_HACKS, SECTION_STEREOSCOPY));
|
||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_WIIMOTE, Arrays.asList(SECTION_WIIMOTE + 1, SECTION_WIIMOTE + 2, SECTION_WIIMOTE + 3, SECTION_WIIMOTE + 4));
|
||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_DOLPHIN,
|
||||
Arrays.asList(SECTION_INI_CORE, SECTION_INI_INTERFACE, SECTION_BINDINGS,
|
||||
SECTION_ANALYTICS));
|
||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_GFX,
|
||||
Arrays.asList(SECTION_GFX_SETTINGS, SECTION_GFX_ENHANCEMENTS, SECTION_GFX_HACKS,
|
||||
SECTION_STEREOSCOPY));
|
||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_WIIMOTE,
|
||||
Arrays.asList(SECTION_WIIMOTE + 1, SECTION_WIIMOTE + 2, SECTION_WIIMOTE + 3,
|
||||
SECTION_WIIMOTE + 4));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,8 @@ public final class CheckBoxSetting extends SettingsItem
|
||||
{
|
||||
private boolean mDefaultValue;
|
||||
|
||||
public CheckBoxSetting(String key, String section, int titleId, int descriptionId, boolean defaultValue, Setting setting)
|
||||
public CheckBoxSetting(String key, String section, int titleId, int descriptionId,
|
||||
boolean defaultValue, Setting setting)
|
||||
{
|
||||
super(key, section, setting, titleId, descriptionId);
|
||||
mDefaultValue = defaultValue;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Setting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;
|
||||
|
||||
/**
|
||||
* ViewModel abstraction for an Item in the RecyclerView powering SettingsFragments.
|
||||
@ -48,7 +48,6 @@ public abstract class SettingsItem
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The identifier for the backing Setting.
|
||||
*/
|
||||
public String getKey()
|
||||
@ -57,7 +56,6 @@ public abstract class SettingsItem
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The header under which the backing Setting belongs.
|
||||
*/
|
||||
public String getSection()
|
||||
@ -67,7 +65,6 @@ public abstract class SettingsItem
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The backing Setting, possibly null.
|
||||
*/
|
||||
public Setting getSetting()
|
||||
@ -87,7 +84,6 @@ public abstract class SettingsItem
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return A resource ID for a text string representing this Setting's name.
|
||||
*/
|
||||
public int getNameId()
|
||||
|
@ -12,7 +12,8 @@ public final class SingleChoiceSetting extends SettingsItem
|
||||
private int mValuesId;
|
||||
private MenuTag menuTag;
|
||||
|
||||
public SingleChoiceSetting(String key, String section, int titleId, int descriptionId, int choicesId, int valuesId, int defaultValue, Setting setting, MenuTag menuTag)
|
||||
public SingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
||||
int choicesId, int valuesId, int defaultValue, Setting setting, MenuTag menuTag)
|
||||
{
|
||||
super(key, section, setting, titleId, descriptionId);
|
||||
mValuesId = valuesId;
|
||||
@ -21,7 +22,8 @@ public final class SingleChoiceSetting extends SettingsItem
|
||||
this.menuTag = menuTag;
|
||||
}
|
||||
|
||||
public SingleChoiceSetting(String key, String section, int titleId, int descriptionId, int choicesId, int valuesId, int defaultValue, Setting setting)
|
||||
public SingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
||||
int choicesId, int valuesId, int defaultValue, Setting setting)
|
||||
{
|
||||
this(key, section, titleId, descriptionId, choicesId, valuesId, defaultValue, setting, null);
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.FloatSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.IntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Setting;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
public final class SliderSetting extends SettingsItem
|
||||
{
|
||||
@ -13,7 +13,8 @@ public final class SliderSetting extends SettingsItem
|
||||
|
||||
private String mUnits;
|
||||
|
||||
public SliderSetting(String key, String section, int titleId, int descriptionId, int max, String units, int defaultValue, Setting setting)
|
||||
public SliderSetting(String key, String section, int titleId, int descriptionId, int max,
|
||||
String units, int defaultValue, Setting setting)
|
||||
{
|
||||
super(key, section, setting, titleId, descriptionId);
|
||||
mMax = max;
|
||||
|
@ -10,7 +10,8 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||
private String[] mChoicesId;
|
||||
private String[] mValuesId;
|
||||
|
||||
public StringSingleChoiceSetting(String key, String section, int titleId, int descriptionId, String[] choicesId, String[] valuesId, String defaultValue, Setting setting)
|
||||
public StringSingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
||||
String[] choicesId, String[] valuesId, String defaultValue, Setting setting)
|
||||
{
|
||||
super(key, section, setting, titleId, descriptionId);
|
||||
mValuesId = valuesId;
|
||||
@ -54,16 +55,20 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||
}
|
||||
}
|
||||
|
||||
public int getSelectValueIndex() {
|
||||
public int getSelectValueIndex()
|
||||
{
|
||||
String selectedValue = getSelectedValue();
|
||||
for(int i=0;i<mValuesId.length;i++) {
|
||||
if(mValuesId[i].equals(selectedValue)) {
|
||||
for (int i = 0; i < mValuesId.length; i++)
|
||||
{
|
||||
if (mValuesId[i].equals(selectedValue))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a value to the backing int. If that int was previously null,
|
||||
* initializes a new one and returns it, so it can be added to the Hashmap.
|
||||
|
@ -7,7 +7,8 @@ public final class SubmenuSetting extends SettingsItem
|
||||
{
|
||||
private MenuTag mMenuKey;
|
||||
|
||||
public SubmenuSetting(String key, Setting setting, int titleId, int descriptionId, MenuTag menuKey)
|
||||
public SubmenuSetting(String key, Setting setting, int titleId, int descriptionId,
|
||||
MenuTag menuKey)
|
||||
{
|
||||
super(key, null, setting, titleId, descriptionId);
|
||||
mMenuKey = menuKey;
|
||||
|
@ -15,12 +15,9 @@ import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.SettingSection;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.utils.DirectoryStateReceiver;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView
|
||||
{
|
||||
private static final String ARG_MENU_TAG = "menu_tag";
|
||||
@ -102,7 +99,8 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||
|
||||
|
||||
@Override
|
||||
public void showSettingsFragment(MenuTag menuTag, Bundle extras, boolean addToStack, String gameID)
|
||||
public void showSettingsFragment(MenuTag menuTag, Bundle extras, boolean addToStack,
|
||||
String gameID)
|
||||
{
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
|
||||
@ -120,7 +118,8 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||
transaction.addToBackStack(null);
|
||||
mPresenter.addToStack();
|
||||
}
|
||||
transaction.replace(R.id.frame_content, SettingsFragment.newInstance(menuTag, gameID, extras), FRAGMENT_TAG);
|
||||
transaction.replace(R.id.frame_content, SettingsFragment.newInstance(menuTag, gameID, extras),
|
||||
FRAGMENT_TAG);
|
||||
|
||||
transaction.commit();
|
||||
}
|
||||
@ -137,7 +136,8 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDirectoryInitializationService(DirectoryStateReceiver receiver, IntentFilter filter)
|
||||
public void startDirectoryInitializationService(DirectoryStateReceiver receiver,
|
||||
IntentFilter filter)
|
||||
{
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(
|
||||
receiver,
|
||||
@ -197,7 +197,8 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSettingsFileLoaded(org.dolphinemu.dolphinemu.features.settings.model.Settings settings)
|
||||
public void onSettingsFileLoaded(
|
||||
org.dolphinemu.dolphinemu.features.settings.model.Settings settings)
|
||||
{
|
||||
SettingsFragmentView fragment = getFragment();
|
||||
|
||||
|
@ -84,17 +84,20 @@ public final class SettingsActivityPresenter
|
||||
directoryStateReceiver =
|
||||
new DirectoryStateReceiver(directoryInitializationState ->
|
||||
{
|
||||
if (directoryInitializationState == DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
if (directoryInitializationState ==
|
||||
DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
{
|
||||
mView.hideLoading();
|
||||
loadSettingsUI();
|
||||
}
|
||||
else if (directoryInitializationState == DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED)
|
||||
else if (directoryInitializationState ==
|
||||
DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED)
|
||||
{
|
||||
mView.showPermissionNeededHint();
|
||||
mView.hideLoading();
|
||||
}
|
||||
else if (directoryInitializationState == DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE)
|
||||
else if (directoryInitializationState ==
|
||||
DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE)
|
||||
{
|
||||
mView.showExternalStorageNotMountedHint();
|
||||
mView.hideLoading();
|
||||
|
@ -33,8 +33,8 @@ import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.SettingViewHold
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.SingleChoiceViewHolder;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.SliderViewHolder;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.SubmenuViewHolder;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -142,7 +142,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
mView.putSetting(setting);
|
||||
}
|
||||
|
||||
if (item.getKey().equals(SettingsFile.KEY_SKIP_EFB) || item.getKey().equals(SettingsFile.KEY_IGNORE_FORMAT))
|
||||
if (item.getKey().equals(SettingsFile.KEY_SKIP_EFB) ||
|
||||
item.getKey().equals(SettingsFile.KEY_IGNORE_FORMAT))
|
||||
{
|
||||
mView.putSetting(new BooleanSetting(item.getKey(), item.getSection(), !checked));
|
||||
}
|
||||
@ -215,13 +216,16 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
final MotionAlertDialog dialog = new MotionAlertDialog(mContext, item);
|
||||
dialog.setTitle(R.string.input_binding);
|
||||
dialog.setMessage(String.format(mContext.getString(R.string.input_binding_description), mContext.getString(item.getNameId())));
|
||||
dialog.setMessage(String.format(mContext.getString(R.string.input_binding_description),
|
||||
mContext.getString(item.getNameId())));
|
||||
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, mContext.getString(R.string.cancel), this);
|
||||
dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear), (dialogInterface, i) ->
|
||||
dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear),
|
||||
(dialogInterface, i) ->
|
||||
{
|
||||
item.setValue("");
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
SharedPreferences sharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.remove(item.getKey());
|
||||
editor.apply();
|
||||
@ -283,7 +287,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
}
|
||||
else if (scSetting.getKey().equals(SettingsFile.KEY_WIIMOTE_EXTENSION))
|
||||
{
|
||||
putExtensionSetting(which, Character.getNumericValue(scSetting.getSection().charAt(scSetting.getSection().length() - 1)));
|
||||
putExtensionSetting(which, Character.getNumericValue(
|
||||
scSetting.getSection().charAt(scSetting.getSection().length() - 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,19 +416,23 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
switch (which)
|
||||
{
|
||||
case 0:
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE, "OGL");
|
||||
gfxBackend =
|
||||
new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE, "OGL");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE, "Vulkan");
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE,
|
||||
"Vulkan");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE, "Software Renderer");
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE,
|
||||
"Software Renderer");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE, "Null");
|
||||
gfxBackend = new StringSetting(SettingsFile.KEY_VIDEO_BACKEND, Settings.SECTION_INI_CORE,
|
||||
"Null");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -432,7 +441,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
|
||||
private void putExtensionSetting(int which, int wiimoteNumber)
|
||||
{
|
||||
StringSetting extension = new StringSetting(SettingsFile.KEY_WIIMOTE_EXTENSION, Settings.SECTION_WIIMOTE + wiimoteNumber, mContext.getResources().getStringArray(R.array.wiimoteExtensionsEntries)[which]);
|
||||
StringSetting extension = new StringSetting(SettingsFile.KEY_WIIMOTE_EXTENSION,
|
||||
Settings.SECTION_WIIMOTE + wiimoteNumber,
|
||||
mContext.getResources().getStringArray(R.array.wiimoteExtensionsEntries)[which]);
|
||||
mView.putSetting(extension);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,8 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
return inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
}
|
||||
@ -118,13 +119,15 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSettingsFileLoaded(org.dolphinemu.dolphinemu.features.settings.model.Settings settings)
|
||||
public void onSettingsFileLoaded(
|
||||
org.dolphinemu.dolphinemu.features.settings.model.Settings settings)
|
||||
{
|
||||
mPresenter.setSettings(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passSettingsToActivity(org.dolphinemu.dolphinemu.features.settings.model.Settings settings)
|
||||
public void passSettingsToActivity(
|
||||
org.dolphinemu.dolphinemu.features.settings.model.Settings settings)
|
||||
{
|
||||
if (mActivity != null)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,8 @@ import android.view.View;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;
|
||||
|
||||
public abstract class SettingViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
|
||||
public abstract class SettingViewHolder extends RecyclerView.ViewHolder
|
||||
implements View.OnClickListener
|
||||
{
|
||||
private SettingsAdapter mAdapter;
|
||||
|
||||
|
@ -10,8 +10,8 @@ import org.dolphinemu.dolphinemu.features.settings.model.Setting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.SettingSection;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.StringSetting;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivityView;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.utils.BiMap;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
@ -245,7 +245,9 @@ public final class SettingsFile
|
||||
public static final String KEY_VIDEO_BACKEND_INDEX = "VideoBackendIndex";
|
||||
|
||||
private static BiMap<String, String> sectionsMap = new BiMap<>();
|
||||
static {
|
||||
|
||||
static
|
||||
{
|
||||
sectionsMap.add("Hardware", "Video_Hardware");
|
||||
sectionsMap.add("Settings", "Video_Settings");
|
||||
sectionsMap.add("Enhancements", "Video_Enhancements");
|
||||
@ -266,7 +268,8 @@ public final class SettingsFile
|
||||
* @param ini The ini file to load the settings from
|
||||
* @param view The current view.
|
||||
*/
|
||||
static HashMap<String, SettingSection> readFile(final File ini, boolean isCustomGame, SettingsActivityView view)
|
||||
static HashMap<String, SettingSection> readFile(final File ini, boolean isCustomGame,
|
||||
SettingsActivityView view)
|
||||
{
|
||||
HashMap<String, SettingSection> sections = new Settings.SettingsSectionMap();
|
||||
|
||||
@ -324,7 +327,8 @@ public final class SettingsFile
|
||||
return sections;
|
||||
}
|
||||
|
||||
public static HashMap<String, SettingSection> readFile(final String fileName, SettingsActivityView view)
|
||||
public static HashMap<String, SettingSection> readFile(final String fileName,
|
||||
SettingsActivityView view)
|
||||
{
|
||||
HashMap<String, SettingSection> sections = readFile(getSettingsFile(fileName), false, view);
|
||||
|
||||
@ -344,17 +348,20 @@ public final class SettingsFile
|
||||
* @param gameId the id of the game to load it's settings.
|
||||
* @param view The current view.
|
||||
*/
|
||||
public static HashMap<String, SettingSection> readCustomGameSettings(final String gameId, SettingsActivityView view)
|
||||
public static HashMap<String, SettingSection> readCustomGameSettings(final String gameId,
|
||||
SettingsActivityView view)
|
||||
{
|
||||
return readFile(getCustomGameSettingsFile(gameId), true, view);
|
||||
}
|
||||
|
||||
public static HashMap<String, SettingSection> readGenericGameSettings(final String gameId, SettingsActivityView view)
|
||||
public static HashMap<String, SettingSection> readGenericGameSettings(final String gameId,
|
||||
SettingsActivityView view)
|
||||
{
|
||||
return readFile(getGenericGameSettingsFile(gameId), true, view);
|
||||
}
|
||||
|
||||
public static HashMap<String, SettingSection> readGenericGameSettingsForAllRegions(final String gameId, SettingsActivityView view)
|
||||
public static HashMap<String, SettingSection> readGenericGameSettingsForAllRegions(
|
||||
final String gameId, SettingsActivityView view)
|
||||
{
|
||||
return readFile(getGenericGameSettingsForAllRegions(gameId), true, view);
|
||||
}
|
||||
@ -368,7 +375,8 @@ public final class SettingsFile
|
||||
* @param sections The HashMap containing the Settings we want to serialize.
|
||||
* @param view The current view.
|
||||
*/
|
||||
public static void saveFile(final String fileName, TreeMap<String, SettingSection> sections, SettingsActivityView view)
|
||||
public static void saveFile(final String fileName, TreeMap<String, SettingSection> sections,
|
||||
SettingsActivityView view)
|
||||
{
|
||||
File ini = getSettingsFile(fileName);
|
||||
|
||||
@ -394,7 +402,8 @@ public final class SettingsFile
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
Log.error("[SettingsFile] Bad encoding; please file a bug report: " + fileName + ".ini: " + e.getMessage());
|
||||
Log.error("[SettingsFile] Bad encoding; please file a bug report: " + fileName + ".ini: " +
|
||||
e.getMessage());
|
||||
if (view != null)
|
||||
view.showToastMessage("Error saving " + fileName + ".ini: " + e.getMessage());
|
||||
}
|
||||
@ -407,7 +416,8 @@ public final class SettingsFile
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveCustomGameSettings(final String gameId, final HashMap<String, SettingSection> sections)
|
||||
public static void saveCustomGameSettings(final String gameId,
|
||||
final HashMap<String, SettingSection> sections)
|
||||
{
|
||||
Set<String> sortedSections = new TreeSet<>(sections.keySet());
|
||||
|
||||
@ -421,7 +431,9 @@ public final class SettingsFile
|
||||
for (String settingKey : sortedKeySet)
|
||||
{
|
||||
Setting setting = settings.get(settingKey);
|
||||
NativeLibrary.SetUserSetting(gameId, mapSectionNameFromIni(section.getName()), setting.getKey(), setting.getValueAsString());
|
||||
NativeLibrary
|
||||
.SetUserSetting(gameId, mapSectionNameFromIni(section.getName()), setting.getKey(),
|
||||
setting.getValueAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -449,24 +461,30 @@ public final class SettingsFile
|
||||
@NonNull
|
||||
private static File getSettingsFile(String fileName)
|
||||
{
|
||||
return new File(DirectoryInitializationService.getUserDirectory() + "/Config/" + fileName + ".ini");
|
||||
return new File(
|
||||
DirectoryInitializationService.getUserDirectory() + "/Config/" + fileName + ".ini");
|
||||
}
|
||||
|
||||
private static File getGenericGameSettingsForAllRegions(String gameId)
|
||||
{
|
||||
// Use the first 3 chars from the gameId to load the generic game settings for all regions
|
||||
gameId = gameId.substring(0, 3);
|
||||
return new File(DirectoryInitializationService.getDolphinInternalDirectory() + "/GameSettings/" + gameId + ".ini");
|
||||
return new File(
|
||||
DirectoryInitializationService.getDolphinInternalDirectory() + "/GameSettings/" +
|
||||
gameId + ".ini");
|
||||
}
|
||||
|
||||
private static File getGenericGameSettingsFile(String gameId)
|
||||
{
|
||||
return new File(DirectoryInitializationService.getDolphinInternalDirectory() + "/GameSettings/" + gameId + ".ini");
|
||||
return new File(
|
||||
DirectoryInitializationService.getDolphinInternalDirectory() + "/GameSettings/" +
|
||||
gameId + ".ini");
|
||||
}
|
||||
|
||||
private static File getCustomGameSettingsFile(String gameId)
|
||||
{
|
||||
return new File(DirectoryInitializationService.getUserDirectory() + "/GameSettings/" + gameId + ".ini");
|
||||
return new File(
|
||||
DirectoryInitializationService.getUserDirectory() + "/GameSettings/" + gameId + ".ini");
|
||||
}
|
||||
|
||||
private static SettingSection sectionFromLine(String line, boolean isCustomGame)
|
||||
@ -499,11 +517,14 @@ public final class SettingsFile
|
||||
|
||||
public static void firstAnalyticsAdd(boolean enabled)
|
||||
{
|
||||
HashMap<String, SettingSection> dolphinSections = readFile(SettingsFile.FILE_NAME_DOLPHIN, null);
|
||||
HashMap<String, SettingSection> dolphinSections =
|
||||
readFile(SettingsFile.FILE_NAME_DOLPHIN, null);
|
||||
SettingSection analyticsSection = dolphinSections.get(Settings.SECTION_ANALYTICS);
|
||||
|
||||
Setting analyticsEnabled = new StringSetting(KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS, enabled ? "True" : "False");
|
||||
Setting analyticsFirstAsk = new StringSetting(KEY_ANALYTICS_PERMISSION_ASKED, Settings.SECTION_ANALYTICS, "True");
|
||||
Setting analyticsEnabled = new StringSetting(KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS,
|
||||
enabled ? "True" : "False");
|
||||
Setting analyticsFirstAsk =
|
||||
new StringSetting(KEY_ANALYTICS_PERMISSION_ASKED, Settings.SECTION_ANALYTICS, "True");
|
||||
|
||||
analyticsSection.putSetting(analyticsFirstAsk);
|
||||
analyticsSection.putSetting(analyticsEnabled);
|
||||
|
@ -157,25 +157,30 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
private void setupDolphinDirectoriesThenStartEmulation() {
|
||||
private void setupDolphinDirectoriesThenStartEmulation()
|
||||
{
|
||||
IntentFilter statusIntentFilter = new IntentFilter(
|
||||
DirectoryInitializationService.BROADCAST_ACTION);
|
||||
|
||||
directoryStateReceiver =
|
||||
new DirectoryStateReceiver(directoryInitializationState ->
|
||||
{
|
||||
if (directoryInitializationState == DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
if (directoryInitializationState ==
|
||||
DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
{
|
||||
mEmulationState.run(activity.isActivityRecreated());
|
||||
}
|
||||
else if (directoryInitializationState == DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED)
|
||||
else if (directoryInitializationState ==
|
||||
DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED)
|
||||
{
|
||||
Toast.makeText(getContext(), R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
else if (directoryInitializationState == DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE)
|
||||
else if (directoryInitializationState ==
|
||||
DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE)
|
||||
{
|
||||
Toast.makeText(getContext(), R.string.external_storage_not_mounted, Toast.LENGTH_SHORT)
|
||||
Toast.makeText(getContext(), R.string.external_storage_not_mounted,
|
||||
Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
@ -18,13 +18,19 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
|
||||
{
|
||||
private static final String KEY_TITLE = "title";
|
||||
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
static {
|
||||
buttonsActionsMap.append(R.id.menu_take_screenshot, EmulationActivity.MENU_ACTION_TAKE_SCREENSHOT);
|
||||
|
||||
static
|
||||
{
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_take_screenshot, EmulationActivity.MENU_ACTION_TAKE_SCREENSHOT);
|
||||
buttonsActionsMap.append(R.id.menu_quicksave, EmulationActivity.MENU_ACTION_QUICK_SAVE);
|
||||
buttonsActionsMap.append(R.id.menu_quickload, EmulationActivity.MENU_ACTION_QUICK_LOAD);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_save_root, EmulationActivity.MENU_ACTION_SAVE_ROOT);
|
||||
buttonsActionsMap.append(R.id.menu_emulation_load_root, EmulationActivity.MENU_ACTION_LOAD_ROOT);
|
||||
buttonsActionsMap.append(R.id.menu_refresh_wiimotes, EmulationActivity.MENU_ACTION_REFRESH_WIIMOTES);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_emulation_save_root, EmulationActivity.MENU_ACTION_SAVE_ROOT);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_emulation_load_root, EmulationActivity.MENU_ACTION_LOAD_ROOT);
|
||||
buttonsActionsMap
|
||||
.append(R.id.menu_refresh_wiimotes, EmulationActivity.MENU_ACTION_REFRESH_WIIMOTES);
|
||||
buttonsActionsMap.append(R.id.menu_change_disc, EmulationActivity.MENU_ACTION_CHANGE_DISC);
|
||||
buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT);
|
||||
}
|
||||
|
@ -22,23 +22,41 @@ public final class SaveLoadStateFragment extends Fragment implements View.OnClic
|
||||
|
||||
private static final String KEY_SAVEORLOAD = "saveorload";
|
||||
private static SparseIntArray saveButtonsActionsMap = new SparseIntArray();
|
||||
static {
|
||||
saveButtonsActionsMap.append(R.id.loadsave_state_button_1, EmulationActivity.MENU_ACTION_SAVE_SLOT1);
|
||||
saveButtonsActionsMap.append(R.id.loadsave_state_button_2, EmulationActivity.MENU_ACTION_SAVE_SLOT2);
|
||||
saveButtonsActionsMap.append(R.id.loadsave_state_button_3, EmulationActivity.MENU_ACTION_SAVE_SLOT3);
|
||||
saveButtonsActionsMap.append(R.id.loadsave_state_button_4, EmulationActivity.MENU_ACTION_SAVE_SLOT4);
|
||||
saveButtonsActionsMap.append(R.id.loadsave_state_button_5, EmulationActivity.MENU_ACTION_SAVE_SLOT5);
|
||||
saveButtonsActionsMap.append(R.id.loadsave_state_button_6, EmulationActivity.MENU_ACTION_SAVE_SLOT6);
|
||||
|
||||
static
|
||||
{
|
||||
saveButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_1, EmulationActivity.MENU_ACTION_SAVE_SLOT1);
|
||||
saveButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_2, EmulationActivity.MENU_ACTION_SAVE_SLOT2);
|
||||
saveButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_3, EmulationActivity.MENU_ACTION_SAVE_SLOT3);
|
||||
saveButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_4, EmulationActivity.MENU_ACTION_SAVE_SLOT4);
|
||||
saveButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_5, EmulationActivity.MENU_ACTION_SAVE_SLOT5);
|
||||
saveButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_6, EmulationActivity.MENU_ACTION_SAVE_SLOT6);
|
||||
}
|
||||
|
||||
private static SparseIntArray loadButtonsActionsMap = new SparseIntArray();
|
||||
static {
|
||||
loadButtonsActionsMap.append(R.id.loadsave_state_button_1, EmulationActivity.MENU_ACTION_LOAD_SLOT1);
|
||||
loadButtonsActionsMap.append(R.id.loadsave_state_button_2, EmulationActivity.MENU_ACTION_LOAD_SLOT2);
|
||||
loadButtonsActionsMap.append(R.id.loadsave_state_button_3, EmulationActivity.MENU_ACTION_LOAD_SLOT3);
|
||||
loadButtonsActionsMap.append(R.id.loadsave_state_button_4, EmulationActivity.MENU_ACTION_LOAD_SLOT4);
|
||||
loadButtonsActionsMap.append(R.id.loadsave_state_button_5, EmulationActivity.MENU_ACTION_LOAD_SLOT5);
|
||||
loadButtonsActionsMap.append(R.id.loadsave_state_button_6, EmulationActivity.MENU_ACTION_LOAD_SLOT6);
|
||||
|
||||
static
|
||||
{
|
||||
loadButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_1, EmulationActivity.MENU_ACTION_LOAD_SLOT1);
|
||||
loadButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_2, EmulationActivity.MENU_ACTION_LOAD_SLOT2);
|
||||
loadButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_3, EmulationActivity.MENU_ACTION_LOAD_SLOT3);
|
||||
loadButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_4, EmulationActivity.MENU_ACTION_LOAD_SLOT4);
|
||||
loadButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_5, EmulationActivity.MENU_ACTION_LOAD_SLOT5);
|
||||
loadButtonsActionsMap
|
||||
.append(R.id.loadsave_state_button_6, EmulationActivity.MENU_ACTION_LOAD_SLOT6);
|
||||
}
|
||||
|
||||
private SaveOrLoad mSaveOrLoad;
|
||||
|
||||
public static SaveLoadStateFragment newInstance(SaveOrLoad saveOrLoad)
|
||||
|
@ -1,11 +1,7 @@
|
||||
package org.dolphinemu.dolphinemu.model;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Environment;
|
||||
|
||||
import org.dolphinemu.dolphinemu.utils.CoverHelper;
|
||||
|
||||
public class GameFile
|
||||
{
|
||||
private long mPointer; // Do not rename or move without editing the native code
|
||||
@ -19,15 +15,25 @@ public class GameFile
|
||||
public native void finalize();
|
||||
|
||||
public native int getPlatform();
|
||||
|
||||
public native String getTitle();
|
||||
|
||||
public native String getDescription();
|
||||
|
||||
public native String getCompany();
|
||||
|
||||
public native int getCountry();
|
||||
|
||||
public native int getRegion();
|
||||
|
||||
public native String getPath();
|
||||
|
||||
public native String getGameId();
|
||||
|
||||
public native int[] getBanner();
|
||||
|
||||
public native int getBannerWidth();
|
||||
|
||||
public native int getBannerHeight();
|
||||
|
||||
public String getCoverPath()
|
||||
|
@ -61,6 +61,7 @@ public class GameFileCache
|
||||
|
||||
/**
|
||||
* Scans through the file system and updates the cache to match.
|
||||
*
|
||||
* @return true if the cache was modified
|
||||
*/
|
||||
public boolean scanLibrary(Context context)
|
||||
@ -81,9 +82,14 @@ public class GameFileCache
|
||||
}
|
||||
|
||||
public native GameFile[] getAllGames();
|
||||
|
||||
public native GameFile addOrGet(String gamePath);
|
||||
|
||||
private native boolean update(String[] folderPaths);
|
||||
|
||||
private native boolean updateAdditionalMetadata();
|
||||
|
||||
public native boolean load();
|
||||
|
||||
private native boolean save();
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
* @param context The current {@link Context}
|
||||
* @param bitmap The {@link Bitmap} to scale.
|
||||
* @param scale The scale factor for the bitmap.
|
||||
*
|
||||
* @return The scaled {@link Bitmap}
|
||||
*/
|
||||
public static Bitmap resizeBitmap(Context context, Bitmap bitmap, float scale)
|
||||
@ -137,11 +136,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
// If a pointer enters the bounds of a button, press that button.
|
||||
if (button.getBounds().contains((int)event.getX(pointerIndex), (int)event.getY(pointerIndex)))
|
||||
if (button.getBounds()
|
||||
.contains((int) event.getX(pointerIndex), (int) event.getY(pointerIndex)))
|
||||
{
|
||||
button.setPressedState(true);
|
||||
button.setTrackId(event.getPointerId(pointerIndex));
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.getId(), ButtonState.PRESSED);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.getId(),
|
||||
ButtonState.PRESSED);
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
@ -150,7 +151,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
if (button.getTrackId() == event.getPointerId(pointerIndex))
|
||||
{
|
||||
button.setPressedState(false);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.getId(), ButtonState.RELEASED);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.getId(),
|
||||
ButtonState.RELEASED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -167,7 +169,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
// Up, Down, Left, Right
|
||||
boolean[] pressed = {false, false, false, false};
|
||||
// If a pointer enters the bounds of a button, press that button.
|
||||
if (dpad.getBounds().contains((int)event.getX(pointerIndex), (int)event.getY(pointerIndex)))
|
||||
if (dpad.getBounds()
|
||||
.contains((int) event.getX(pointerIndex), (int) event.getY(pointerIndex)))
|
||||
{
|
||||
if (dpad.getBounds().top + (dpad.getHeight() / 3) > (int) event.getY(pointerIndex))
|
||||
pressed[0] = true;
|
||||
@ -181,11 +184,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
// Release the buttons first, then press
|
||||
for (int i = 0; i < pressed.length; i++)
|
||||
if (!pressed[i])
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.getId(i), ButtonState.RELEASED);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.getId(i),
|
||||
ButtonState.RELEASED);
|
||||
// Press buttons
|
||||
for (int i = 0; i < pressed.length; i++)
|
||||
if (pressed[i])
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.getId(i), ButtonState.PRESSED);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.getId(i),
|
||||
ButtonState.PRESSED);
|
||||
|
||||
setDpadState(dpad, pressed[0], pressed[1], pressed[2], pressed[3]);
|
||||
dpad.setTrackId(event.getPointerId(pointerIndex));
|
||||
@ -199,7 +204,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
dpad.setState(InputOverlayDrawableDpad.STATE_DEFAULT);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.getId(i), ButtonState.RELEASED);
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.getId(i),
|
||||
ButtonState.RELEASED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -240,7 +246,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
// If no button is being moved now, remember the currently touched button to move.
|
||||
if (mButtonBeingConfigured == null && button.getBounds().contains(fingerPositionX, fingerPositionY))
|
||||
if (mButtonBeingConfigured == null &&
|
||||
button.getBounds().contains(fingerPositionX, fingerPositionY))
|
||||
{
|
||||
mButtonBeingConfigured = button;
|
||||
mButtonBeingConfigured.onConfigureTouch(event);
|
||||
@ -260,7 +267,9 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
if (mButtonBeingConfigured == button)
|
||||
{
|
||||
// Persist button position by saving new place.
|
||||
saveControlPosition(mButtonBeingConfigured.getId(), mButtonBeingConfigured.getBounds().left, mButtonBeingConfigured.getBounds().top);
|
||||
saveControlPosition(mButtonBeingConfigured.getId(),
|
||||
mButtonBeingConfigured.getBounds().left,
|
||||
mButtonBeingConfigured.getBounds().top);
|
||||
mButtonBeingConfigured = null;
|
||||
}
|
||||
break;
|
||||
@ -275,7 +284,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
// If no button is being moved now, remember the currently touched button to move.
|
||||
if (mButtonBeingConfigured == null && dpad.getBounds().contains(fingerPositionX, fingerPositionY))
|
||||
if (mButtonBeingConfigured == null &&
|
||||
dpad.getBounds().contains(fingerPositionX, fingerPositionY))
|
||||
{
|
||||
mDpadBeingConfigured = dpad;
|
||||
mDpadBeingConfigured.onConfigureTouch(event);
|
||||
@ -295,7 +305,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
if (mDpadBeingConfigured == dpad)
|
||||
{
|
||||
// Persist button position by saving new place.
|
||||
saveControlPosition(mDpadBeingConfigured.getId(0), mDpadBeingConfigured.getBounds().left, mDpadBeingConfigured.getBounds().top);
|
||||
saveControlPosition(mDpadBeingConfigured.getId(0),
|
||||
mDpadBeingConfigured.getBounds().left, mDpadBeingConfigured.getBounds().top);
|
||||
mDpadBeingConfigured = null;
|
||||
}
|
||||
break;
|
||||
@ -308,7 +319,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
{
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
if (mJoystickBeingConfigured == null && joystick.getBounds().contains(fingerPositionX, fingerPositionY))
|
||||
if (mJoystickBeingConfigured == null &&
|
||||
joystick.getBounds().contains(fingerPositionX, fingerPositionY))
|
||||
{
|
||||
mJoystickBeingConfigured = joystick;
|
||||
mJoystickBeingConfigured.onConfigureTouch(event);
|
||||
@ -325,7 +337,9 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
if (mJoystickBeingConfigured != null)
|
||||
{
|
||||
saveControlPosition(mJoystickBeingConfigured.getId(), mJoystickBeingConfigured.getBounds().left, mJoystickBeingConfigured.getBounds().top);
|
||||
saveControlPosition(mJoystickBeingConfigured.getId(),
|
||||
mJoystickBeingConfigured.getBounds().left,
|
||||
mJoystickBeingConfigured.getBounds().top);
|
||||
mJoystickBeingConfigured = null;
|
||||
}
|
||||
break;
|
||||
@ -335,7 +349,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setDpadState(InputOverlayDrawableDpad dpad, boolean up, boolean down, boolean left, boolean right)
|
||||
private void setDpadState(InputOverlayDrawableDpad dpad, boolean up, boolean down, boolean left,
|
||||
boolean right)
|
||||
{
|
||||
if (up)
|
||||
{
|
||||
@ -369,40 +384,49 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleGc0", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_a, R.drawable.gcpad_a_pressed, ButtonType.BUTTON_A));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_a,
|
||||
R.drawable.gcpad_a_pressed, ButtonType.BUTTON_A));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc1", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_b, R.drawable.gcpad_b_pressed, ButtonType.BUTTON_B));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_b,
|
||||
R.drawable.gcpad_b_pressed, ButtonType.BUTTON_B));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc2", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_x, R.drawable.gcpad_x_pressed, ButtonType.BUTTON_X));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_x,
|
||||
R.drawable.gcpad_x_pressed, ButtonType.BUTTON_X));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc3", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_y, R.drawable.gcpad_y_pressed, ButtonType.BUTTON_Y));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_y,
|
||||
R.drawable.gcpad_y_pressed, ButtonType.BUTTON_Y));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc4", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_z, R.drawable.gcpad_z_pressed, ButtonType.BUTTON_Z));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_z,
|
||||
R.drawable.gcpad_z_pressed, ButtonType.BUTTON_Z));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc5", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_start, R.drawable.gcpad_start_pressed, ButtonType.BUTTON_START));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_start,
|
||||
R.drawable.gcpad_start_pressed, ButtonType.BUTTON_START));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc6", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_l, R.drawable.gcpad_l_pressed, ButtonType.TRIGGER_L));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_l,
|
||||
R.drawable.gcpad_l_pressed, ButtonType.TRIGGER_L));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc7", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_r, R.drawable.gcpad_r_pressed, ButtonType.TRIGGER_R));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_r,
|
||||
R.drawable.gcpad_r_pressed, ButtonType.TRIGGER_R));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc8", true))
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction, R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
ButtonType.BUTTON_UP, ButtonType.BUTTON_DOWN,
|
||||
ButtonType.BUTTON_LEFT, ButtonType.BUTTON_RIGHT));
|
||||
}
|
||||
@ -422,45 +446,54 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleWii0", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_a, R.drawable.wiimote_a_pressed, ButtonType.WIIMOTE_BUTTON_A));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_a,
|
||||
R.drawable.wiimote_a_pressed, ButtonType.WIIMOTE_BUTTON_A));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii1", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_b, R.drawable.wiimote_b_pressed, ButtonType.WIIMOTE_BUTTON_B));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_b,
|
||||
R.drawable.wiimote_b_pressed, ButtonType.WIIMOTE_BUTTON_B));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii2", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_one, R.drawable.wiimote_one_pressed, ButtonType.WIIMOTE_BUTTON_1));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_one,
|
||||
R.drawable.wiimote_one_pressed, ButtonType.WIIMOTE_BUTTON_1));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii3", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_two, R.drawable.wiimote_two_pressed, ButtonType.WIIMOTE_BUTTON_2));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_two,
|
||||
R.drawable.wiimote_two_pressed, ButtonType.WIIMOTE_BUTTON_2));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii4", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus, R.drawable.wiimote_plus_pressed, ButtonType.WIIMOTE_BUTTON_PLUS));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus,
|
||||
R.drawable.wiimote_plus_pressed, ButtonType.WIIMOTE_BUTTON_PLUS));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii5", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus, R.drawable.wiimote_minus_pressed, ButtonType.WIIMOTE_BUTTON_MINUS));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus,
|
||||
R.drawable.wiimote_minus_pressed, ButtonType.WIIMOTE_BUTTON_MINUS));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii6", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home, R.drawable.wiimote_home_pressed, ButtonType.WIIMOTE_BUTTON_HOME));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home,
|
||||
R.drawable.wiimote_home_pressed, ButtonType.WIIMOTE_BUTTON_HOME));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii7", true))
|
||||
{
|
||||
if (mPreferences.getInt("wiiController", 3) == 2)
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction, R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
ButtonType.WIIMOTE_RIGHT, ButtonType.WIIMOTE_LEFT,
|
||||
ButtonType.WIIMOTE_UP, ButtonType.WIIMOTE_DOWN));
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction, R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
ButtonType.WIIMOTE_UP, ButtonType.WIIMOTE_DOWN,
|
||||
ButtonType.WIIMOTE_LEFT, ButtonType.WIIMOTE_RIGHT));
|
||||
}
|
||||
@ -471,16 +504,19 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleWii8", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_c, R.drawable.nunchuk_c_pressed, ButtonType.NUNCHUK_BUTTON_C));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_c,
|
||||
R.drawable.nunchuk_c_pressed, ButtonType.NUNCHUK_BUTTON_C));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii9", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_z, R.drawable.nunchuk_z_pressed, ButtonType.NUNCHUK_BUTTON_Z));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_z,
|
||||
R.drawable.nunchuk_z_pressed, ButtonType.NUNCHUK_BUTTON_Z));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii10", true))
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed, ButtonType.NUNCHUK_STICK));
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
|
||||
ButtonType.NUNCHUK_STICK));
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,64 +524,78 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleClassic0", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_a, R.drawable.classic_a_pressed, ButtonType.CLASSIC_BUTTON_A));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_a,
|
||||
R.drawable.classic_a_pressed, ButtonType.CLASSIC_BUTTON_A));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic1", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_b, R.drawable.classic_b_pressed, ButtonType.CLASSIC_BUTTON_B));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_b,
|
||||
R.drawable.classic_b_pressed, ButtonType.CLASSIC_BUTTON_B));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic2", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_x, R.drawable.classic_x_pressed, ButtonType.CLASSIC_BUTTON_X));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_x,
|
||||
R.drawable.classic_x_pressed, ButtonType.CLASSIC_BUTTON_X));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic3", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_y, R.drawable.classic_y_pressed, ButtonType.CLASSIC_BUTTON_Y));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_y,
|
||||
R.drawable.classic_y_pressed, ButtonType.CLASSIC_BUTTON_Y));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic4", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus, R.drawable.wiimote_plus_pressed, ButtonType.CLASSIC_BUTTON_PLUS));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus,
|
||||
R.drawable.wiimote_plus_pressed, ButtonType.CLASSIC_BUTTON_PLUS));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic5", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus, R.drawable.wiimote_minus_pressed, ButtonType.CLASSIC_BUTTON_MINUS));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus,
|
||||
R.drawable.wiimote_minus_pressed, ButtonType.CLASSIC_BUTTON_MINUS));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic6", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home, R.drawable.wiimote_home_pressed, ButtonType.CLASSIC_BUTTON_HOME));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home,
|
||||
R.drawable.wiimote_home_pressed, ButtonType.CLASSIC_BUTTON_HOME));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic7", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_l, R.drawable.classic_l_pressed, ButtonType.CLASSIC_TRIGGER_L));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_l,
|
||||
R.drawable.classic_l_pressed, ButtonType.CLASSIC_TRIGGER_L));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic8", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_r, R.drawable.classic_r_pressed, ButtonType.CLASSIC_TRIGGER_R));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_r,
|
||||
R.drawable.classic_r_pressed, ButtonType.CLASSIC_TRIGGER_R));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic9", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zl, R.drawable.classic_zl_pressed, ButtonType.CLASSIC_BUTTON_ZL));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zl,
|
||||
R.drawable.classic_zl_pressed, ButtonType.CLASSIC_BUTTON_ZL));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic10", true))
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zr, R.drawable.classic_zr_pressed, ButtonType.CLASSIC_BUTTON_ZR));
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zr,
|
||||
R.drawable.classic_zr_pressed, ButtonType.CLASSIC_BUTTON_ZR));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic11", true))
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction, R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
R.drawable.gcwii_dpad_pressed_two_directions,
|
||||
ButtonType.CLASSIC_DPAD_UP, ButtonType.CLASSIC_DPAD_DOWN,
|
||||
ButtonType.CLASSIC_DPAD_LEFT, ButtonType.CLASSIC_DPAD_RIGHT));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic12", true))
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed, ButtonType.CLASSIC_STICK_LEFT));
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
|
||||
ButtonType.CLASSIC_STICK_LEFT));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic13", true))
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed, ButtonType.CLASSIC_STICK_RIGHT));
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
|
||||
ButtonType.CLASSIC_STICK_RIGHT));
|
||||
}
|
||||
}
|
||||
|
||||
@ -614,11 +664,10 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
* @param defaultResId The resource ID of the {@link Drawable} to get the {@link Bitmap} of (Default State).
|
||||
* @param pressedResId The resource ID of the {@link Drawable} to get the {@link Bitmap} of (Pressed State).
|
||||
* @param buttonId Identifier for determining what type of button the initialized InputOverlayDrawableButton represents.
|
||||
*
|
||||
* @return An {@link InputOverlayDrawableButton} with the correct drawing bounds set.
|
||||
*
|
||||
*/
|
||||
private static InputOverlayDrawableButton initializeOverlayButton(Context context, int defaultResId, int pressedResId, int buttonId)
|
||||
private static InputOverlayDrawableButton initializeOverlayButton(Context context,
|
||||
int defaultResId, int pressedResId, int buttonId)
|
||||
{
|
||||
// Resources handle for fetching the initial Drawable resource.
|
||||
final Resources res = context.getResources();
|
||||
@ -675,9 +724,12 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
scale /= 100;
|
||||
|
||||
// Initialize the InputOverlayDrawableButton.
|
||||
final Bitmap defaultStateBitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, defaultResId), scale);
|
||||
final Bitmap pressedStateBitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, pressedResId), scale);
|
||||
final InputOverlayDrawableButton overlayDrawable = new InputOverlayDrawableButton(res, defaultStateBitmap, pressedStateBitmap, buttonId);
|
||||
final Bitmap defaultStateBitmap =
|
||||
resizeBitmap(context, BitmapFactory.decodeResource(res, defaultResId), scale);
|
||||
final Bitmap pressedStateBitmap =
|
||||
resizeBitmap(context, BitmapFactory.decodeResource(res, pressedResId), scale);
|
||||
final InputOverlayDrawableButton overlayDrawable =
|
||||
new InputOverlayDrawableButton(res, defaultStateBitmap, pressedStateBitmap, buttonId);
|
||||
|
||||
// The X and Y coordinates of the InputOverlayDrawableButton on the InputOverlay.
|
||||
// These were set in the input overlay configuration menu.
|
||||
@ -708,7 +760,6 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
* @param buttonDown Identifier for the down button.
|
||||
* @param buttonLeft Identifier for the left button.
|
||||
* @param buttonRight Identifier for the right button.
|
||||
*
|
||||
* @return the initialized {@link InputOverlayDrawableDpad}
|
||||
*/
|
||||
private static InputOverlayDrawableDpad initializeOverlayDpad(Context context,
|
||||
@ -746,10 +797,16 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
scale /= 100;
|
||||
|
||||
// Initialize the InputOverlayDrawableDpad.
|
||||
final Bitmap defaultStateBitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, defaultResId), scale);
|
||||
final Bitmap pressedOneDirectionStateBitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, pressedOneDirectionResId), scale);
|
||||
final Bitmap pressedTwoDirectionsStateBitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, pressedTwoDirectionsResId), scale);
|
||||
final InputOverlayDrawableDpad overlayDrawable = new InputOverlayDrawableDpad(res, defaultStateBitmap,
|
||||
final Bitmap defaultStateBitmap =
|
||||
resizeBitmap(context, BitmapFactory.decodeResource(res, defaultResId), scale);
|
||||
final Bitmap pressedOneDirectionStateBitmap =
|
||||
resizeBitmap(context, BitmapFactory.decodeResource(res, pressedOneDirectionResId),
|
||||
scale);
|
||||
final Bitmap pressedTwoDirectionsStateBitmap =
|
||||
resizeBitmap(context, BitmapFactory.decodeResource(res, pressedTwoDirectionsResId),
|
||||
scale);
|
||||
final InputOverlayDrawableDpad overlayDrawable =
|
||||
new InputOverlayDrawableDpad(res, defaultStateBitmap,
|
||||
pressedOneDirectionStateBitmap, pressedTwoDirectionsStateBitmap,
|
||||
buttonUp, buttonDown, buttonLeft, buttonRight);
|
||||
|
||||
@ -779,10 +836,10 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
* @param defaultResInner Resource ID for the default inner image of the joystick (the one you actually move around).
|
||||
* @param pressedResInner Resource ID for the pressed inner image of the joystick.
|
||||
* @param joystick Identifier for which joystick this is.
|
||||
*
|
||||
* @return the initialized {@link InputOverlayDrawableJoystick}.
|
||||
*/
|
||||
private static InputOverlayDrawableJoystick initializeOverlayJoystick(Context context, int resOuter, int defaultResInner, int pressedResInner, int joystick)
|
||||
private static InputOverlayDrawableJoystick initializeOverlayJoystick(Context context,
|
||||
int resOuter, int defaultResInner, int pressedResInner, int joystick)
|
||||
{
|
||||
// Resources handle for fetching the initial Drawable resource.
|
||||
final Resources res = context.getResources();
|
||||
@ -796,7 +853,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
scale /= 100;
|
||||
|
||||
// Initialize the InputOverlayDrawableJoystick.
|
||||
final Bitmap bitmapOuter = resizeBitmap(context, BitmapFactory.decodeResource(res, resOuter), scale);
|
||||
final Bitmap bitmapOuter =
|
||||
resizeBitmap(context, BitmapFactory.decodeResource(res, resOuter), scale);
|
||||
final Bitmap bitmapInnerDefault = BitmapFactory.decodeResource(res, defaultResInner);
|
||||
final Bitmap bitmapInnerPressed = BitmapFactory.decodeResource(res, pressedResInner);
|
||||
|
||||
@ -893,28 +951,50 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
|
||||
// Each value is a percent from max X/Y stored as an int. Have to bring that value down
|
||||
// to a decimal before multiplying by MAX X/Y.
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-X", (((float)res.getInteger(R.integer.BUTTON_A_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-Y", (((float)res.getInteger(R.integer.BUTTON_A_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-X", (((float)res.getInteger(R.integer.BUTTON_B_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-Y", (((float)res.getInteger(R.integer.BUTTON_B_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-X", (((float)res.getInteger(R.integer.BUTTON_X_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-Y", (((float)res.getInteger(R.integer.BUTTON_X_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-X", (((float)res.getInteger(R.integer.BUTTON_Y_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-Y", (((float)res.getInteger(R.integer.BUTTON_Y_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Z + "-X", (((float)res.getInteger(R.integer.BUTTON_Z_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Z + "-Y", (((float)res.getInteger(R.integer.BUTTON_Z_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_UP + "-X", (((float)res.getInteger(R.integer.BUTTON_UP_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_UP + "-Y", (((float)res.getInteger(R.integer.BUTTON_UP_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-X", (((float)res.getInteger(R.integer.TRIGGER_L_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-Y", (((float)res.getInteger(R.integer.TRIGGER_L_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-X", (((float)res.getInteger(R.integer.TRIGGER_R_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-Y", (((float)res.getInteger(R.integer.TRIGGER_R_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_START + "-X", (((float)res.getInteger(R.integer.BUTTON_START_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_START + "-Y", (((float)res.getInteger(R.integer.BUTTON_START_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_C + "-X", (((float)res.getInteger(R.integer.STICK_C_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_C + "-Y", (((float)res.getInteger(R.integer.STICK_C_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_MAIN + "-X", (((float)res.getInteger(R.integer.STICK_MAIN_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_MAIN + "-Y", (((float)res.getInteger(R.integer.STICK_MAIN_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_A_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_A_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_B_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_B_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_X_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_X_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_Y_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_Y_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Z + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_Z_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_Z + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_Z_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_UP + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_UP_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_UP + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_UP_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-X",
|
||||
(((float) res.getInteger(R.integer.TRIGGER_L_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-Y",
|
||||
(((float) res.getInteger(R.integer.TRIGGER_L_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-X",
|
||||
(((float) res.getInteger(R.integer.TRIGGER_R_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-Y",
|
||||
(((float) res.getInteger(R.integer.TRIGGER_R_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_START + "-X",
|
||||
(((float) res.getInteger(R.integer.BUTTON_START_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.BUTTON_START + "-Y",
|
||||
(((float) res.getInteger(R.integer.BUTTON_START_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_C + "-X",
|
||||
(((float) res.getInteger(R.integer.STICK_C_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_C + "-Y",
|
||||
(((float) res.getInteger(R.integer.STICK_C_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_MAIN + "-X",
|
||||
(((float) res.getInteger(R.integer.STICK_MAIN_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.STICK_MAIN + "-Y",
|
||||
(((float) res.getInteger(R.integer.STICK_MAIN_Y) / 1000) * maxY));
|
||||
|
||||
// We want to commit right away, otherwise the overlay could load before this is saved.
|
||||
sPrefsEditor.commit();
|
||||
@ -941,35 +1021,60 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
|
||||
// Each value is a percent from max X/Y stored as an int. Have to bring that value down
|
||||
// to a decimal before multiplying by MAX X/Y.
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_A + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_A_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_A + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_A_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_B + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_B_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_B + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_B_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_1 + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_1_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_1 + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_1_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_2 + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_2_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_2 + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_2_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_Z + "-X", (((float) res.getInteger(R.integer.NUNCHUK_BUTTON_Z_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_Z + "-Y", (((float) res.getInteger(R.integer.NUNCHUK_BUTTON_Z_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_C + "-X", (((float) res.getInteger(R.integer.NUNCHUK_BUTTON_C_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_C + "-Y", (((float) res.getInteger(R.integer.NUNCHUK_BUTTON_C_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_MINUS + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_MINUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_MINUS + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_MINUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_PLUS + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_PLUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_PLUS + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_PLUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_UP + "-X", (((float) res.getInteger(R.integer.WIIMOTE_UP_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_UP + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_UP_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_HOME + "-X", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_HOME_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_HOME + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_BUTTON_HOME_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_STICK + "-X", (((float) res.getInteger(R.integer.NUNCHUK_STICK_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_STICK + "-Y", (((float) res.getInteger(R.integer.NUNCHUK_STICK_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_A + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_A_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_A + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_A_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_B + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_B_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_B + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_B_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_1 + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_1_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_1 + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_1_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_2 + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_2_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_2 + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_2_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_Z + "-X",
|
||||
(((float) res.getInteger(R.integer.NUNCHUK_BUTTON_Z_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_Z + "-Y",
|
||||
(((float) res.getInteger(R.integer.NUNCHUK_BUTTON_Z_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_C + "-X",
|
||||
(((float) res.getInteger(R.integer.NUNCHUK_BUTTON_C_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_BUTTON_C + "-Y",
|
||||
(((float) res.getInteger(R.integer.NUNCHUK_BUTTON_C_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_MINUS + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_MINUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_MINUS + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_MINUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_PLUS + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_PLUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_PLUS + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_PLUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_UP + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_UP_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_UP + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_UP_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_HOME + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_HOME_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_BUTTON_HOME + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_BUTTON_HOME_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_STICK + "-X",
|
||||
(((float) res.getInteger(R.integer.NUNCHUK_STICK_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.NUNCHUK_STICK + "-Y",
|
||||
(((float) res.getInteger(R.integer.NUNCHUK_STICK_Y) / 1000) * maxY));
|
||||
// Horizontal dpad
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_RIGHT + "-X", (((float) res.getInteger(R.integer.WIIMOTE_RIGHT_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_RIGHT + "-Y", (((float) res.getInteger(R.integer.WIIMOTE_RIGHT_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_RIGHT + "-X",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_RIGHT_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.WIIMOTE_RIGHT + "-Y",
|
||||
(((float) res.getInteger(R.integer.WIIMOTE_RIGHT_Y) / 1000) * maxY));
|
||||
|
||||
// We want to commit right away, otherwise the overlay could load before this is saved.
|
||||
sPrefsEditor.commit();
|
||||
}
|
||||
|
||||
private void wiiClassicDefaultOverlay()
|
||||
{
|
||||
SharedPreferences.Editor sPrefsEditor = mPreferences.edit();
|
||||
@ -991,34 +1096,62 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
|
||||
// Each value is a percent from max X/Y stored as an int. Have to bring that value down
|
||||
// to a decimal before multiplying by MAX X/Y.
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_A + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_A_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_A + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_A_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_B + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_B_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_B + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_B_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_X + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_X_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_X + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_X_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_Y + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_Y_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_Y + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_Y_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_MINUS + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_MINUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_MINUS + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_MINUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_PLUS + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_PLUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_PLUS + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_PLUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_HOME + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_HOME_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_HOME + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_HOME_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZL + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_ZL_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZL + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_ZL_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZR + "-X", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_ZR_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZR + "-Y", (((float)res.getInteger(R.integer.CLASSIC_BUTTON_ZR_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_DPAD_UP + "-X", (((float)res.getInteger(R.integer.CLASSIC_DPAD_UP_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_DPAD_UP + "-Y", (((float)res.getInteger(R.integer.CLASSIC_DPAD_UP_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_LEFT + "-X", (((float)res.getInteger(R.integer.CLASSIC_STICK_LEFT_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_LEFT + "-Y", (((float)res.getInteger(R.integer.CLASSIC_STICK_LEFT_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_RIGHT + "-X", (((float)res.getInteger(R.integer.CLASSIC_STICK_RIGHT_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_RIGHT + "-Y", (((float)res.getInteger(R.integer.CLASSIC_STICK_RIGHT_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_L + "-X", (((float)res.getInteger(R.integer.CLASSIC_TRIGGER_L_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_L + "-Y", (((float)res.getInteger(R.integer.CLASSIC_TRIGGER_L_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_R + "-X", (((float)res.getInteger(R.integer.CLASSIC_TRIGGER_R_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_R + "-Y", (((float)res.getInteger(R.integer.CLASSIC_TRIGGER_R_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_A + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_A_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_A + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_A_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_B + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_B_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_B + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_B_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_X + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_X_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_X + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_X_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_Y + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_Y_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_Y + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_Y_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_MINUS + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_MINUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_MINUS + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_MINUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_PLUS + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_PLUS_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_PLUS + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_PLUS_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_HOME + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_HOME_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_HOME + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_HOME_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZL + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_ZL_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZL + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_ZL_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZR + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_ZR_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_BUTTON_ZR + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_BUTTON_ZR_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_DPAD_UP + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_DPAD_UP_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_DPAD_UP + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_DPAD_UP_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_LEFT + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_STICK_LEFT_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_LEFT + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_STICK_LEFT_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_RIGHT + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_STICK_RIGHT_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_STICK_RIGHT + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_STICK_RIGHT_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_L + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_TRIGGER_L_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_L + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_TRIGGER_L_Y) / 1000) * maxY));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_R + "-X",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_TRIGGER_R_X) / 1000) * maxX));
|
||||
sPrefsEditor.putFloat(ButtonType.CLASSIC_TRIGGER_R + "-Y",
|
||||
(((float) res.getInteger(R.integer.CLASSIC_TRIGGER_R_Y) / 1000) * maxY));
|
||||
|
||||
// We want to commit right away, otherwise the overlay could load before this is saved.
|
||||
sPrefsEditor.commit();
|
||||
|
@ -38,7 +38,8 @@ public final class InputOverlayDrawableButton
|
||||
* @param pressedStateBitmap {@link Bitmap} to use with the pressed state Drawable.
|
||||
* @param buttonType Identifier for this type of button.
|
||||
*/
|
||||
public InputOverlayDrawableButton(Resources res, Bitmap defaultStateBitmap, Bitmap pressedStateBitmap, int buttonType)
|
||||
public InputOverlayDrawableButton(Resources res, Bitmap defaultStateBitmap,
|
||||
Bitmap pressedStateBitmap, int buttonType)
|
||||
{
|
||||
mDefaultStateBitmap = new BitmapDrawable(res, defaultStateBitmap);
|
||||
mPressedStateBitmap = new BitmapDrawable(res, pressedStateBitmap);
|
||||
@ -82,7 +83,8 @@ public final class InputOverlayDrawableButton
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
mControlPositionX += fingerPositionX - mPreviousTouchX;
|
||||
mControlPositionY += fingerPositionY - mPreviousTouchY;
|
||||
setBounds(mControlPositionX, mControlPositionY, getWidth() + mControlPositionX, getHeight() + mControlPositionY);
|
||||
setBounds(mControlPositionX, mControlPositionY, getWidth() + mControlPositionX,
|
||||
getHeight() + mControlPositionY);
|
||||
mPreviousTouchX = fingerPositionX;
|
||||
mPreviousTouchY = fingerPositionY;
|
||||
break;
|
||||
|
@ -77,7 +77,8 @@ public final class InputOverlayDrawableDpad
|
||||
{
|
||||
int px = mControlPositionX + (getWidth() / 2);
|
||||
int py = mControlPositionY + (getHeight() / 2);
|
||||
switch (mPressState) {
|
||||
switch (mPressState)
|
||||
{
|
||||
case STATE_DEFAULT:
|
||||
mDefaultStateBitmap.draw(canvas);
|
||||
break;
|
||||
@ -160,7 +161,8 @@ public final class InputOverlayDrawableDpad
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
mControlPositionX += fingerPositionX - mPreviousTouchX;
|
||||
mControlPositionY += fingerPositionY - mPreviousTouchY;
|
||||
setBounds(mControlPositionX, mControlPositionY, getWidth() + mControlPositionX, getHeight() + mControlPositionY);
|
||||
setBounds(mControlPositionX, mControlPositionY, getWidth() + mControlPositionX,
|
||||
getHeight() + mControlPositionY);
|
||||
mPreviousTouchX = fingerPositionX;
|
||||
mPreviousTouchY = fingerPositionY;
|
||||
break;
|
||||
@ -187,15 +189,18 @@ public final class InputOverlayDrawableDpad
|
||||
return mDefaultStateBitmap.getBounds();
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
public int getWidth()
|
||||
{
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
public int getHeight()
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
public void setState(int pressState) {
|
||||
public void setState(int pressState)
|
||||
{
|
||||
mPressState = pressState;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
package org.dolphinemu.dolphinemu.overlay;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
@ -111,7 +110,8 @@ public final class InputOverlayDrawableJoystick
|
||||
mBoundsBoxBitmap.setAlpha(255);
|
||||
if (reCenter)
|
||||
{
|
||||
getVirtBounds().offset((int)event.getX(pointerIndex) - getVirtBounds().centerX(), (int)event.getY(pointerIndex) - getVirtBounds().centerY());
|
||||
getVirtBounds().offset((int) event.getX(pointerIndex) - getVirtBounds().centerX(),
|
||||
(int) event.getY(pointerIndex) - getVirtBounds().centerY());
|
||||
}
|
||||
mBoundsBoxBitmap.setBounds(getVirtBounds());
|
||||
trackId = event.getPointerId(pointerIndex);
|
||||
@ -125,8 +125,10 @@ public final class InputOverlayDrawableJoystick
|
||||
axises[0] = axises[1] = 0.0f;
|
||||
mOuterBitmap.setAlpha(255);
|
||||
mBoundsBoxBitmap.setAlpha(0);
|
||||
setVirtBounds(new Rect(mOrigBounds.left, mOrigBounds.top, mOrigBounds.right, mOrigBounds.bottom));
|
||||
setBounds(new Rect(mOrigBounds.left, mOrigBounds.top, mOrigBounds.right, mOrigBounds.bottom));
|
||||
setVirtBounds(new Rect(mOrigBounds.left, mOrigBounds.top, mOrigBounds.right,
|
||||
mOrigBounds.bottom));
|
||||
setBounds(new Rect(mOrigBounds.left, mOrigBounds.top, mOrigBounds.right,
|
||||
mOrigBounds.bottom));
|
||||
SetInnerBounds();
|
||||
trackId = -1;
|
||||
}
|
||||
@ -248,11 +250,20 @@ public final class InputOverlayDrawableJoystick
|
||||
return mOuterBitmap.getBounds();
|
||||
}
|
||||
|
||||
private void setVirtBounds(Rect bounds) { mVirtBounds = bounds; }
|
||||
private void setVirtBounds(Rect bounds)
|
||||
{
|
||||
mVirtBounds = bounds;
|
||||
}
|
||||
|
||||
private void setOrigBounds(Rect bounds) { mOrigBounds = bounds; }
|
||||
private void setOrigBounds(Rect bounds)
|
||||
{
|
||||
mOrigBounds = bounds;
|
||||
}
|
||||
|
||||
private Rect getVirtBounds() { return mVirtBounds; }
|
||||
private Rect getVirtBounds()
|
||||
{
|
||||
return mVirtBounds;
|
||||
}
|
||||
|
||||
public int getWidth()
|
||||
{
|
||||
|
@ -32,7 +32,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
*/
|
||||
public final class DirectoryInitializationService extends IntentService
|
||||
{
|
||||
public static final String BROADCAST_ACTION = "org.dolphinemu.dolphinemu.DIRECTORY_INITIALIZATION";
|
||||
public static final String BROADCAST_ACTION =
|
||||
"org.dolphinemu.dolphinemu.DIRECTORY_INITIALIZATION";
|
||||
|
||||
public static final String EXTRA_STATE = "directoryState";
|
||||
private static volatile DirectoryInitializationState directoryState = null;
|
||||
@ -173,7 +174,8 @@ public final class DirectoryInitializationService extends IntentService
|
||||
}
|
||||
else if (isDolphinDirectoryInitializationRunning.get())
|
||||
{
|
||||
throw new IllegalStateException("DirectoryInitializationService has to finish running first!");
|
||||
throw new IllegalStateException(
|
||||
"DirectoryInitializationService has to finish running first!");
|
||||
}
|
||||
return userPath;
|
||||
|
||||
@ -187,7 +189,8 @@ public final class DirectoryInitializationService extends IntentService
|
||||
}
|
||||
else if (isDolphinDirectoryInitializationRunning.get())
|
||||
{
|
||||
throw new IllegalStateException("DirectoryInitializationService has to finish running first!");
|
||||
throw new IllegalStateException(
|
||||
"DirectoryInitializationService has to finish running first!");
|
||||
}
|
||||
return internalPath;
|
||||
|
||||
@ -218,13 +221,15 @@ public final class DirectoryInitializationService extends IntentService
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.error("[DirectoryInitializationService] Failed to copy asset file: " + asset + e.getMessage());
|
||||
Log.error("[DirectoryInitializationService] Failed to copy asset file: " + asset +
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void copyAssetFolder(String assetFolder, File outputFolder, Boolean overwrite)
|
||||
{
|
||||
Log.verbose("[DirectoryInitializationService] Copying Folder " + assetFolder + " to " + outputFolder);
|
||||
Log.verbose("[DirectoryInitializationService] Copying Folder " + assetFolder + " to " +
|
||||
outputFolder);
|
||||
|
||||
try
|
||||
{
|
||||
@ -236,13 +241,15 @@ public final class DirectoryInitializationService extends IntentService
|
||||
outputFolder.mkdir();
|
||||
createdFolder = true;
|
||||
}
|
||||
copyAssetFolder(assetFolder + File.separator + file, new File(outputFolder, file), overwrite);
|
||||
copyAssetFolder(assetFolder + File.separator + file, new File(outputFolder, file),
|
||||
overwrite);
|
||||
copyAsset(assetFolder + File.separator + file, new File(outputFolder, file), overwrite);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.error("[DirectoryInitializationService] Failed to copy asset folder: " + assetFolder + e.getMessage());
|
||||
Log.error("[DirectoryInitializationService] Failed to copy asset folder: " + assetFolder +
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,5 +265,6 @@ public final class DirectoryInitializationService extends IntentService
|
||||
}
|
||||
|
||||
private static native void CreateUserDirectories();
|
||||
|
||||
private static native void SetSysDirectory(String path);
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ public class SyncChannelJobService extends JobService
|
||||
+ " from TV Provider.");
|
||||
return channel.getId();
|
||||
}
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
while (cursor.moveToNext());
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
@ -2,9 +2,7 @@ package org.dolphinemu.dolphinemu.services;
|
||||
|
||||
import android.app.job.JobParameters;
|
||||
import android.app.job.JobService;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.PersistableBundle;
|
||||
|
@ -5,10 +5,15 @@ import android.content.Intent;
|
||||
|
||||
public final class USBPermService extends IntentService
|
||||
{
|
||||
public USBPermService() { super("USBPermService"); }
|
||||
public USBPermService()
|
||||
{
|
||||
super("USBPermService");
|
||||
}
|
||||
|
||||
// Needed when extending IntentService.
|
||||
// We don't care about the results of the intent handler for this.
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {}
|
||||
protected void onHandleIntent(Intent intent)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,13 @@ import android.widget.TextView;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
|
||||
public class CustomTitleView extends LinearLayout implements TitleViewAdapter.Provider {
|
||||
public class CustomTitleView extends LinearLayout implements TitleViewAdapter.Provider
|
||||
{
|
||||
private final TextView mTitleView;
|
||||
private final View mBadgeView;
|
||||
|
||||
private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter() {
|
||||
private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter()
|
||||
{
|
||||
@Override
|
||||
public View getSearchAffordanceView()
|
||||
{
|
||||
|
@ -17,12 +17,12 @@ import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.adapters.PlatformPagerAdapter;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.PlatformGamesView;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||
import org.dolphinemu.dolphinemu.utils.PermissionsHandler;
|
||||
import org.dolphinemu.dolphinemu.utils.StartupHandler;
|
||||
@ -181,10 +181,13 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
|
||||
{
|
||||
switch (requestCode)
|
||||
{
|
||||
case PermissionsHandler.REQUEST_CODE_WRITE_PERMISSION:
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
||||
{
|
||||
DirectoryInitializationService.startService(this);
|
||||
PlatformPagerAdapter platformPagerAdapter = new PlatformPagerAdapter(
|
||||
getSupportFragmentManager(), this);
|
||||
@ -193,7 +196,9 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||
mTabLayout.setupWithViewPager(mViewPager);
|
||||
mViewPager.setVisibility(View.VISIBLE);
|
||||
GameFileCacheService.startLoad(this);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(this, R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ import android.support.v4.content.LocalBroadcastManager;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.model.GameFileCache;
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
|
||||
public final class MainPresenter
|
||||
{
|
||||
|
@ -18,13 +18,13 @@ import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.adapters.GameRowPresenter;
|
||||
import org.dolphinemu.dolphinemu.adapters.SettingsRowPresenter;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.model.TvSettingsItem;
|
||||
import org.dolphinemu.dolphinemu.services.DirectoryInitializationService;
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||
import org.dolphinemu.dolphinemu.utils.PermissionsHandler;
|
||||
import org.dolphinemu.dolphinemu.utils.StartupHandler;
|
||||
@ -88,7 +88,8 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
||||
StartupHandler.setSessionTime(this);
|
||||
}
|
||||
|
||||
void setupUI() {
|
||||
void setupUI()
|
||||
{
|
||||
final FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
mBrowseFragment = new BrowseSupportFragment();
|
||||
fragmentManager
|
||||
@ -122,6 +123,7 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* MainView
|
||||
*/
|
||||
@ -186,13 +188,18 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
|
||||
{
|
||||
switch (requestCode)
|
||||
{
|
||||
case PermissionsHandler.REQUEST_CODE_WRITE_PERMISSION:
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
||||
{
|
||||
DirectoryInitializationService.startService(this);
|
||||
GameFileCacheService.startLoad(this);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(this, R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
@ -276,7 +283,8 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
||||
R.string.grid_menu_refresh));
|
||||
|
||||
// Create a header for this row.
|
||||
HeaderItem header = new HeaderItem(R.string.preferences_settings, getString(R.string.preferences_settings));
|
||||
HeaderItem header =
|
||||
new HeaderItem(R.string.preferences_settings, getString(R.string.preferences_settings));
|
||||
|
||||
return new ListRow(header, rowItems);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.dolphinemu.dolphinemu.ui.platform;
|
||||
|
||||
/** Enum to represent platform (eg GameCube, Wii). */
|
||||
/**
|
||||
* Enum to represent platform (eg GameCube, Wii).
|
||||
*/
|
||||
public enum Platform
|
||||
{
|
||||
GAMECUBE(0, "GameCube Games"),
|
||||
|
@ -11,11 +11,8 @@ import android.view.ViewGroup;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.adapters.GameAdapter;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class PlatformGamesFragment extends Fragment implements PlatformGamesView
|
||||
{
|
||||
private static final String ARG_PLATFORM = "platform";
|
||||
|
@ -1,9 +1,5 @@
|
||||
package org.dolphinemu.dolphinemu.ui.platform;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Abstraction for a screen representing a single platform's games.
|
||||
*/
|
||||
|
@ -20,8 +20,10 @@ public class Analytics
|
||||
{
|
||||
private static DirectoryStateReceiver directoryStateReceiver;
|
||||
|
||||
private static final String analyticsAsked = Settings.SECTION_ANALYTICS + "_" + SettingsFile.KEY_ANALYTICS_PERMISSION_ASKED;
|
||||
private static final String analyticsEnabled = Settings.SECTION_ANALYTICS + "_" + SettingsFile.KEY_ANALYTICS_ENABLED;
|
||||
private static final String analyticsAsked =
|
||||
Settings.SECTION_ANALYTICS + "_" + SettingsFile.KEY_ANALYTICS_PERMISSION_ASKED;
|
||||
private static final String analyticsEnabled =
|
||||
Settings.SECTION_ANALYTICS + "_" + SettingsFile.KEY_ANALYTICS_ENABLED;
|
||||
|
||||
private static final String DEVICE_MANUFACTURER = "DEVICE_MANUFACTURER";
|
||||
private static final String DEVICE_OS = "DEVICE_OS";
|
||||
@ -43,7 +45,8 @@ public class Analytics
|
||||
|
||||
directoryStateReceiver = new DirectoryStateReceiver(directoryInitializationState ->
|
||||
{
|
||||
if (directoryInitializationState == DirectoryInitializationService.DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
if (directoryInitializationState ==
|
||||
DirectoryInitializationService.DirectoryInitializationState.DOLPHIN_DIRECTORIES_INITIALIZED)
|
||||
{
|
||||
LocalBroadcastManager.getInstance(context).unregisterReceiver(directoryStateReceiver);
|
||||
directoryStateReceiver = null;
|
||||
|
@ -4,13 +4,18 @@ import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
/** Some controllers have incorrect mappings. This class has special-case fixes for them. */
|
||||
/**
|
||||
* Some controllers have incorrect mappings. This class has special-case fixes for them.
|
||||
*/
|
||||
public class ControllerMappingHelper
|
||||
{
|
||||
/** Some controllers report extra button presses that can be ignored. */
|
||||
/**
|
||||
* Some controllers report extra button presses that can be ignored.
|
||||
*/
|
||||
public static boolean shouldKeyBeIgnored(InputDevice inputDevice, int keyCode)
|
||||
{
|
||||
if (isDualShock4(inputDevice)) {
|
||||
if (isDualShock4(inputDevice))
|
||||
{
|
||||
// The two analog triggers generate analog motion events as well as a keycode.
|
||||
// We always prefer to use the analog values, so throw away the button press
|
||||
// Even though the triggers are L/R2, without mappings they generate L/R1 events.
|
||||
@ -19,7 +24,9 @@ public class ControllerMappingHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Scale an axis to be zero-centered with a proper range. */
|
||||
/**
|
||||
* Scale an axis to be zero-centered with a proper range.
|
||||
*/
|
||||
public static float scaleAxis(InputDevice inputDevice, int axis, float value)
|
||||
{
|
||||
if (isDualShock4(inputDevice))
|
||||
|
@ -3,7 +3,6 @@ package org.dolphinemu.dolphinemu.utils;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
|
@ -9,16 +9,20 @@ import org.dolphinemu.dolphinemu.services.DirectoryInitializationService.Directo
|
||||
|
||||
import rx.functions.Action1;
|
||||
|
||||
public class DirectoryStateReceiver extends BroadcastReceiver {
|
||||
public class DirectoryStateReceiver extends BroadcastReceiver
|
||||
{
|
||||
Action1<DirectoryInitializationState> callback;
|
||||
public DirectoryStateReceiver(Action1<DirectoryInitializationState> callback) {
|
||||
|
||||
public DirectoryStateReceiver(Action1<DirectoryInitializationState> callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
DirectoryInitializationState state = (DirectoryInitializationState) intent.getSerializableExtra(DirectoryInitializationService.EXTRA_STATE);
|
||||
DirectoryInitializationState state = (DirectoryInitializationState) intent
|
||||
.getSerializableExtra(DirectoryInitializationService.EXTRA_STATE);
|
||||
callback.call(state);
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +244,8 @@ public final class EGLHelper
|
||||
for (EGLConfig mEGLConfig : mEGLConfigs)
|
||||
{
|
||||
int[] attribVal = new int[1];
|
||||
boolean ret = mEGL.eglGetConfigAttrib(mDisplay, mEGLConfig, EGL10.EGL_RENDERABLE_TYPE, attribVal);
|
||||
boolean ret =
|
||||
mEGL.eglGetConfigAttrib(mDisplay, mEGLConfig, EGL10.EGL_RENDERABLE_TYPE, attribVal);
|
||||
if (ret)
|
||||
{
|
||||
if ((attribVal[0] & EGL_OPENGL_BIT) != 0)
|
||||
@ -303,7 +304,8 @@ public final class EGLHelper
|
||||
else
|
||||
NativeLibrary.eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
mEGLContext = mEGL.eglCreateContext(mDisplay, mEGLConfigs[0], EGL10.EGL_NO_CONTEXT, ctx_attribs);
|
||||
mEGLContext =
|
||||
mEGL.eglCreateContext(mDisplay, mEGLConfigs[0], EGL10.EGL_NO_CONTEXT, ctx_attribs);
|
||||
mEGLSurface = mEGL.eglCreatePbufferSurface(mDisplay, mEGLConfigs[0], attribs);
|
||||
mEGL.eglMakeCurrent(mDisplay, mEGLSurface, mEGLSurface, mEGLContext);
|
||||
mGL = (GL10) mEGLContext.getGL();
|
||||
@ -321,7 +323,6 @@ public final class EGLHelper
|
||||
* </ul>
|
||||
*
|
||||
* @param glEnum A symbolic constant within {@link GL10}.
|
||||
*
|
||||
* @return the string information represented by {@code glEnum}.
|
||||
*/
|
||||
public String glGetString(int glEnum)
|
||||
@ -343,7 +344,6 @@ public final class EGLHelper
|
||||
*
|
||||
* @param glEnum A symbolic GL constant
|
||||
* @param index The index of the string to return.
|
||||
*
|
||||
* @return the string information represented by {@code glEnum} and {@code index}.
|
||||
*/
|
||||
public String glGetStringi(int glEnum, int index)
|
||||
@ -378,7 +378,6 @@ public final class EGLHelper
|
||||
* Simplified call to {@link GL10#glGetIntegerv(int, int[], int)
|
||||
*
|
||||
* @param glEnum A symbolic GL constant.
|
||||
*
|
||||
* @return the integer information represented by {@code glEnum}.
|
||||
*/
|
||||
public int glGetInteger(int glEnum)
|
||||
|
@ -24,7 +24,8 @@ public final class FileBrowserHelper
|
||||
i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
|
||||
i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
|
||||
i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
|
||||
i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());
|
||||
i.putExtra(FilePickerActivity.EXTRA_START_PATH,
|
||||
Environment.getExternalStorageDirectory().getPath());
|
||||
|
||||
activity.startActivityForResult(i, MainPresenter.REQUEST_ADD_DIRECTORY);
|
||||
}
|
||||
@ -36,7 +37,8 @@ public final class FileBrowserHelper
|
||||
i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
|
||||
i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
|
||||
i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
|
||||
i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());
|
||||
i.putExtra(FilePickerActivity.EXTRA_START_PATH,
|
||||
Environment.getExternalStorageDirectory().getPath());
|
||||
|
||||
activity.startActivityForResult(i, requestCode);
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ import org.dolphinemu.dolphinemu.services.USBPermService;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Java_GCAdapter {
|
||||
public class Java_GCAdapter
|
||||
{
|
||||
public static UsbManager manager;
|
||||
static byte[] controller_payload = new byte[37];
|
||||
|
||||
@ -61,7 +62,11 @@ public class Java_GCAdapter {
|
||||
{
|
||||
usb_con.close();
|
||||
}
|
||||
public static int GetFD() { return usb_con.getFileDescriptor(); }
|
||||
|
||||
public static int GetFD()
|
||||
{
|
||||
return usb_con.getFileDescriptor();
|
||||
}
|
||||
|
||||
public static boolean QueryAdapter()
|
||||
{
|
||||
@ -86,11 +91,13 @@ public class Java_GCAdapter {
|
||||
usb_con.bulkTransfer(usb_in, init, init.length, 0);
|
||||
}
|
||||
|
||||
public static int Input() {
|
||||
public static int Input()
|
||||
{
|
||||
return usb_con.bulkTransfer(usb_in, controller_payload, controller_payload.length, 16);
|
||||
}
|
||||
|
||||
public static int Output(byte[] rumble) {
|
||||
public static int Output(byte[] rumble)
|
||||
{
|
||||
return usb_con.bulkTransfer(usb_out, rumble, 5, 16);
|
||||
}
|
||||
|
||||
@ -137,7 +144,9 @@ public class Java_GCAdapter {
|
||||
final Activity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
||||
if (emulationActivity != null)
|
||||
{
|
||||
emulationActivity.runOnUiThread(() -> Toast.makeText(emulationActivity, "GameCube Adapter couldn't be opened. Please re-plug the device.", Toast.LENGTH_LONG).show());
|
||||
emulationActivity.runOnUiThread(() -> Toast.makeText(emulationActivity,
|
||||
"GameCube Adapter couldn't be opened. Please re-plug the device.",
|
||||
Toast.LENGTH_LONG).show());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -41,7 +41,8 @@ public class Java_WiimoteAdapter
|
||||
for (Map.Entry<String, UsbDevice> pair : devices.entrySet())
|
||||
{
|
||||
UsbDevice dev = pair.getValue();
|
||||
if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID && dev.getVendorId() == NINTENDO_VENDOR_ID)
|
||||
if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID &&
|
||||
dev.getVendorId() == NINTENDO_VENDOR_ID)
|
||||
{
|
||||
if (!manager.hasPermission(dev))
|
||||
{
|
||||
@ -67,7 +68,8 @@ public class Java_WiimoteAdapter
|
||||
for (Map.Entry<String, UsbDevice> pair : devices.entrySet())
|
||||
{
|
||||
UsbDevice dev = pair.getValue();
|
||||
if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID && dev.getVendorId() == NINTENDO_VENDOR_ID)
|
||||
if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID &&
|
||||
dev.getVendorId() == NINTENDO_VENDOR_ID)
|
||||
{
|
||||
if (manager.hasPermission(dev))
|
||||
return true;
|
||||
@ -122,7 +124,8 @@ public class Java_WiimoteAdapter
|
||||
for (Map.Entry<String, UsbDevice> pair : devices.entrySet())
|
||||
{
|
||||
UsbDevice dev = pair.getValue();
|
||||
if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID && dev.getVendorId() == NINTENDO_VENDOR_ID)
|
||||
if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID &&
|
||||
dev.getVendorId() == NINTENDO_VENDOR_ID)
|
||||
{
|
||||
if (manager.hasPermission(dev))
|
||||
{
|
||||
|
@ -14,19 +14,24 @@ import org.dolphinemu.dolphinemu.R;
|
||||
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
|
||||
public class PermissionsHandler {
|
||||
public class PermissionsHandler
|
||||
{
|
||||
public static final int REQUEST_CODE_WRITE_PERMISSION = 500;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
public static boolean checkWritePermission(final FragmentActivity activity) {
|
||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
public static boolean checkWritePermission(final FragmentActivity activity)
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int hasWritePermission = ContextCompat.checkSelfPermission(activity, WRITE_EXTERNAL_STORAGE);
|
||||
|
||||
if (hasWritePermission != PackageManager.PERMISSION_GRANTED) {
|
||||
if (activity.shouldShowRequestPermissionRationale(WRITE_EXTERNAL_STORAGE)) {
|
||||
if (hasWritePermission != PackageManager.PERMISSION_GRANTED)
|
||||
{
|
||||
if (activity.shouldShowRequestPermissionRationale(WRITE_EXTERNAL_STORAGE))
|
||||
{
|
||||
showMessageOKCancel(activity, activity.getString(R.string.write_permission_needed),
|
||||
(dialog, which) -> activity.requestPermissions(new String[]{WRITE_EXTERNAL_STORAGE},
|
||||
REQUEST_CODE_WRITE_PERMISSION));
|
||||
@ -41,8 +46,10 @@ public class PermissionsHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean hasWriteAccess(Context context) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
public static boolean hasWriteAccess(Context context)
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
int hasWritePermission = ContextCompat.checkSelfPermission(context, WRITE_EXTERNAL_STORAGE);
|
||||
return hasWritePermission == PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
@ -50,12 +57,15 @@ public class PermissionsHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void showMessageOKCancel(final FragmentActivity activity, String message, DialogInterface.OnClickListener okListener) {
|
||||
private static void showMessageOKCancel(final FragmentActivity activity, String message,
|
||||
DialogInterface.OnClickListener okListener)
|
||||
{
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, okListener)
|
||||
.setNegativeButton(android.R.string.cancel, (dialogInterface, i) ->
|
||||
Toast.makeText(activity, R.string.write_permission_needed, Toast.LENGTH_SHORT).show())
|
||||
Toast.makeText(activity, R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
||||
.show())
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class PicassoUtils {
|
||||
public class PicassoUtils
|
||||
{
|
||||
public static void loadGameBanner(ImageView imageView, GameFile gameFile)
|
||||
{
|
||||
File cover = new File(gameFile.getCustomCoverPath());
|
||||
@ -59,6 +60,7 @@ public class PicassoUtils {
|
||||
CoverHelper.saveCover(((BitmapDrawable) imageView.getDrawable()).getBitmap(),
|
||||
gameFile.getCoverPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() // Second pass using US region
|
||||
{
|
||||
@ -74,9 +76,11 @@ public class PicassoUtils {
|
||||
@Override
|
||||
public void onSuccess()
|
||||
{
|
||||
CoverHelper.saveCover(((BitmapDrawable) imageView.getDrawable()).getBitmap(),
|
||||
CoverHelper.saveCover(
|
||||
((BitmapDrawable) imageView.getDrawable()).getBitmap(),
|
||||
gameFile.getCoverPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() // Third and last pass using EN region
|
||||
{
|
||||
@ -92,9 +96,12 @@ public class PicassoUtils {
|
||||
@Override
|
||||
public void onSuccess()
|
||||
{
|
||||
CoverHelper.saveCover(((BitmapDrawable) imageView.getDrawable()).getBitmap(),
|
||||
CoverHelper.saveCover(
|
||||
((BitmapDrawable) imageView.getDrawable())
|
||||
.getBitmap(),
|
||||
gameFile.getCoverPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError()
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ import android.graphics.drawable.VectorDrawable;
|
||||
import android.media.tv.TvContract;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.PersistableBundle;
|
||||
import android.support.annotation.AnyRes;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -25,7 +24,6 @@ import android.support.media.tv.Channel;
|
||||
import android.support.media.tv.TvContractCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||
import org.dolphinemu.dolphinemu.model.HomeScreenChannel;
|
||||
import org.dolphinemu.dolphinemu.services.SyncChannelJobService;
|
||||
@ -33,7 +31,6 @@ import org.dolphinemu.dolphinemu.services.SyncProgramsJobService;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -84,7 +81,8 @@ public class TvUtil
|
||||
do
|
||||
{
|
||||
channels.add(Channel.fromCursor(cursor));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
while (cursor.moveToNext());
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
@ -269,6 +267,7 @@ public class TvUtil
|
||||
}
|
||||
return subs;
|
||||
}
|
||||
|
||||
public static Boolean isLeanback(Context context)
|
||||
{
|
||||
return (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK));
|
||||
|
@ -1,17 +1,13 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
Reference in New Issue
Block a user