mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-17 15:07:32 +01:00
android: Minimize frontend & convert to yuzu.
This commit is contained in:
parent
18527a8c42
commit
5e198d1421
@ -30,7 +30,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO If this is ever modified, change application_id in strings.xml
|
// TODO If this is ever modified, change application_id in strings.xml
|
||||||
applicationId "org.citra.citra_emu"
|
applicationId "org.yuzu.yuzu_emu"
|
||||||
minSdkVersion 28
|
minSdkVersion 28
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode autoVersion
|
versionCode autoVersion
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
package org.citra.citra_emu;
|
package org.yuzu.yuzu_emu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.citra.citra_emu">
|
package="org.yuzu.yuzu_emu">
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.touchscreen"
|
android:name="android.hardware.touchscreen"
|
||||||
android:required="false"/>
|
android:required="false"/>
|
||||||
@ -11,9 +11,6 @@
|
|||||||
<uses-feature android:glEsVersion="0x00030002" android:required="true" />
|
<uses-feature android:glEsVersion="0x00030002" android:required="true" />
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.opengles.aep" android:required="true" />
|
<uses-feature android:name="android.hardware.opengles.aep" android:required="true" />
|
||||||
<uses-feature
|
|
||||||
android:name="android.hardware.camera.any"
|
|
||||||
android:required="false" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
@ -23,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="org.citra.citra_emu.CitraApplication"
|
android:name="org.yuzu.yuzu_emu.YuzuApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
@ -33,8 +30,8 @@
|
|||||||
android:requestLegacyExternalStorage="true">
|
android:requestLegacyExternalStorage="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.citra.citra_emu.ui.main.MainActivity"
|
android:name="org.yuzu.yuzu_emu.ui.main.MainActivity"
|
||||||
android:theme="@style/CitraBase"
|
android:theme="@style/YuzuBase"
|
||||||
android:resizeableActivity="false">
|
android:resizeableActivity="false">
|
||||||
|
|
||||||
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
|
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
|
||||||
@ -46,22 +43,22 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.citra.citra_emu.features.settings.ui.SettingsActivity"
|
android:name="org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity"
|
||||||
android:configChanges="orientation|screenSize|uiMode"
|
android:configChanges="orientation|screenSize|uiMode"
|
||||||
android:theme="@style/CitraSettingsBase"
|
android:theme="@style/YuzuSettingsBase"
|
||||||
android:label="@string/preferences_settings"/>
|
android:label="@string/preferences_settings"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.citra.citra_emu.activities.EmulationActivity"
|
android:name="org.yuzu.yuzu_emu.activities.EmulationActivity"
|
||||||
android:resizeableActivity="false"
|
android:resizeableActivity="false"
|
||||||
android:theme="@style/CitraEmulationBase"
|
android:theme="@style/YuzuEmulationBase"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="landscape"/>
|
android:screenOrientation="landscape"/>
|
||||||
|
|
||||||
<service android:name="org.citra.citra_emu.utils.ForegroundService"/>
|
<service android:name="org.yuzu.yuzu_emu.utils.ForegroundService"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.citra.citra_emu.activities.CustomFilePickerActivity"
|
android:name="org.yuzu.yuzu_emu.activities.CustomFilePickerActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/FilePickerTheme">
|
android:theme="@style/FilePickerTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -70,16 +67,10 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<service android:name="org.yuzu.yuzu_emu.utils.DirectoryInitialization"/>
|
||||||
android:name="org.citra.citra_emu.features.cheats.ui.CheatsActivity"
|
|
||||||
android:exported="false"
|
|
||||||
android:theme="@style/CitraSettingsBase"
|
|
||||||
android:label="@string/cheats"/>
|
|
||||||
|
|
||||||
<service android:name="org.citra.citra_emu.utils.DirectoryInitialization"/>
|
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="org.citra.citra_emu.model.GameProvider"
|
android:name="org.yuzu.yuzu_emu.model.GameProvider"
|
||||||
android:authorities="${applicationId}.provider"
|
android:authorities="${applicationId}.provider"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
@ -97,3 +88,4 @@
|
|||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
// Copyright 2020 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
package org.citra.citra_emu.applets;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
|
|
||||||
public final class MiiSelector {
|
|
||||||
public static class MiiSelectorConfig implements java.io.Serializable {
|
|
||||||
public boolean enable_cancel_button;
|
|
||||||
public String title;
|
|
||||||
public long initially_selected_mii_index;
|
|
||||||
// List of Miis to display
|
|
||||||
public String[] mii_names;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MiiSelectorData {
|
|
||||||
public long return_code;
|
|
||||||
public int index;
|
|
||||||
|
|
||||||
private MiiSelectorData(long return_code, int index) {
|
|
||||||
this.return_code = return_code;
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MiiSelectorDialogFragment extends DialogFragment {
|
|
||||||
static MiiSelectorDialogFragment newInstance(MiiSelectorConfig config) {
|
|
||||||
MiiSelectorDialogFragment frag = new MiiSelectorDialogFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putSerializable("config", config);
|
|
||||||
frag.setArguments(args);
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
final Activity emulationActivity = Objects.requireNonNull(getActivity());
|
|
||||||
|
|
||||||
MiiSelectorConfig config =
|
|
||||||
Objects.requireNonNull((MiiSelectorConfig) Objects.requireNonNull(getArguments())
|
|
||||||
.getSerializable("config"));
|
|
||||||
|
|
||||||
// Note: we intentionally leave out the Standard Mii in the native code so that
|
|
||||||
// the string can get translated
|
|
||||||
ArrayList<String> list = new ArrayList<>();
|
|
||||||
list.add(emulationActivity.getString(R.string.standard_mii));
|
|
||||||
list.addAll(Arrays.asList(config.mii_names));
|
|
||||||
|
|
||||||
final int initialIndex = config.initially_selected_mii_index < list.size()
|
|
||||||
? (int) config.initially_selected_mii_index
|
|
||||||
: 0;
|
|
||||||
data.index = initialIndex;
|
|
||||||
AlertDialog.Builder builder =
|
|
||||||
new AlertDialog.Builder(emulationActivity)
|
|
||||||
.setTitle(config.title.isEmpty()
|
|
||||||
? emulationActivity.getString(R.string.mii_selector)
|
|
||||||
: config.title)
|
|
||||||
.setSingleChoiceItems(list.toArray(new String[]{}), initialIndex,
|
|
||||||
(dialog, which) -> {
|
|
||||||
data.index = which;
|
|
||||||
})
|
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
|
||||||
data.return_code = 0;
|
|
||||||
synchronized (finishLock) {
|
|
||||||
finishLock.notifyAll();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (config.enable_cancel_button) {
|
|
||||||
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
|
|
||||||
data.return_code = 1;
|
|
||||||
synchronized (finishLock) {
|
|
||||||
finishLock.notifyAll();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setCancelable(false);
|
|
||||||
return builder.create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MiiSelectorData data;
|
|
||||||
private static final Object finishLock = new Object();
|
|
||||||
|
|
||||||
private static void ExecuteImpl(MiiSelectorConfig config) {
|
|
||||||
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
|
||||||
|
|
||||||
data = new MiiSelectorData(0, 0);
|
|
||||||
|
|
||||||
MiiSelectorDialogFragment fragment = MiiSelectorDialogFragment.newInstance(config);
|
|
||||||
fragment.show(emulationActivity.getSupportFragmentManager(), "mii_selector");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MiiSelectorData Execute(MiiSelectorConfig config) {
|
|
||||||
NativeLibrary.sEmulationActivity.get().runOnUiThread(() -> ExecuteImpl(config));
|
|
||||||
|
|
||||||
synchronized (finishLock) {
|
|
||||||
try {
|
|
||||||
finishLock.wait();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
// Copyright 2020 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
package org.citra.citra_emu.camera;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
|
||||||
import org.citra.citra_emu.utils.PicassoUtils;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
// Used in native code.
|
|
||||||
public final class StillImageCameraHelper {
|
|
||||||
public static final int REQUEST_CAMERA_FILE_PICKER = 1;
|
|
||||||
private static final Object filePickerLock = new Object();
|
|
||||||
private static @Nullable
|
|
||||||
String filePickerPath;
|
|
||||||
|
|
||||||
// Opens file picker for camera.
|
|
||||||
public static @Nullable
|
|
||||||
String OpenFilePicker() {
|
|
||||||
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
|
||||||
|
|
||||||
// At this point, we are assuming that we already have permissions as they are
|
|
||||||
// needed to launch a game
|
|
||||||
emulationActivity.runOnUiThread(() -> {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK);
|
|
||||||
intent.setDataAndType(MediaStore.Images.Media.INTERNAL_CONTENT_URI, "image/*");
|
|
||||||
emulationActivity.startActivityForResult(
|
|
||||||
Intent.createChooser(intent,
|
|
||||||
emulationActivity.getString(R.string.camera_select_image)),
|
|
||||||
REQUEST_CAMERA_FILE_PICKER);
|
|
||||||
});
|
|
||||||
|
|
||||||
synchronized (filePickerLock) {
|
|
||||||
try {
|
|
||||||
filePickerLock.wait();
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return filePickerPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called from EmulationActivity.
|
|
||||||
public static void OnFilePickerResult(Intent result) {
|
|
||||||
filePickerPath = result == null ? null : result.getDataString();
|
|
||||||
|
|
||||||
synchronized (filePickerLock) {
|
|
||||||
filePickerLock.notifyAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Blocking call. Load image from file and crop/resize it to fit in width x height.
|
|
||||||
@Nullable
|
|
||||||
public static Bitmap LoadImageFromFile(String uri, int width, int height) {
|
|
||||||
return PicassoUtils.LoadBitmapFromFile(uri, width, height);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,138 +0,0 @@
|
|||||||
// Copyright 2021 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
package org.citra.citra_emu.disk_shader_cache;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
|
||||||
import org.citra.citra_emu.utils.Log;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class DiskShaderCacheProgress {
|
|
||||||
|
|
||||||
// Equivalent to VideoCore::LoadCallbackStage
|
|
||||||
public enum LoadCallbackStage {
|
|
||||||
Prepare,
|
|
||||||
Decompile,
|
|
||||||
Build,
|
|
||||||
Complete,
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Object finishLock = new Object();
|
|
||||||
private static ProgressDialogFragment fragment;
|
|
||||||
|
|
||||||
public static class ProgressDialogFragment extends DialogFragment {
|
|
||||||
ProgressBar progressBar;
|
|
||||||
TextView progressText;
|
|
||||||
AlertDialog dialog;
|
|
||||||
|
|
||||||
static ProgressDialogFragment newInstance(String title, String message) {
|
|
||||||
ProgressDialogFragment frag = new ProgressDialogFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString("title", title);
|
|
||||||
args.putString("message", message);
|
|
||||||
frag.setArguments(args);
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
final Activity emulationActivity = Objects.requireNonNull(getActivity());
|
|
||||||
|
|
||||||
final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title"));
|
|
||||||
final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message"));
|
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(emulationActivity);
|
|
||||||
View view = inflater.inflate(R.layout.dialog_progress_bar, null);
|
|
||||||
|
|
||||||
progressBar = view.findViewById(R.id.progress_bar);
|
|
||||||
progressText = view.findViewById(R.id.progress_text);
|
|
||||||
progressText.setText("");
|
|
||||||
|
|
||||||
setCancelable(false);
|
|
||||||
setRetainInstance(true);
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity);
|
|
||||||
builder.setTitle(title);
|
|
||||||
builder.setMessage(message);
|
|
||||||
builder.setView(view);
|
|
||||||
builder.setNegativeButton(android.R.string.cancel, null);
|
|
||||||
|
|
||||||
dialog = builder.create();
|
|
||||||
dialog.create();
|
|
||||||
|
|
||||||
dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setOnClickListener((v) -> emulationActivity.onBackPressed());
|
|
||||||
|
|
||||||
synchronized (finishLock) {
|
|
||||||
finishLock.notifyAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onUpdateProgress(String msg, int progress, int max) {
|
|
||||||
Objects.requireNonNull(getActivity()).runOnUiThread(() -> {
|
|
||||||
progressBar.setProgress(progress);
|
|
||||||
progressBar.setMax(max);
|
|
||||||
progressText.setText(String.format("%d/%d", progress, max));
|
|
||||||
dialog.setMessage(msg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void prepareDialog() {
|
|
||||||
NativeLibrary.sEmulationActivity.get().runOnUiThread(() -> {
|
|
||||||
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
|
||||||
fragment = ProgressDialogFragment.newInstance(emulationActivity.getString(R.string.loading), emulationActivity.getString(R.string.preparing_shaders));
|
|
||||||
fragment.show(emulationActivity.getSupportFragmentManager(), "diskShaders");
|
|
||||||
});
|
|
||||||
|
|
||||||
synchronized (finishLock) {
|
|
||||||
try {
|
|
||||||
finishLock.wait();
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loadProgress(LoadCallbackStage stage, int progress, int max) {
|
|
||||||
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
|
||||||
if (emulationActivity == null) {
|
|
||||||
Log.error("[DiskShaderCacheProgress] EmulationActivity not present");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (stage) {
|
|
||||||
case Prepare:
|
|
||||||
prepareDialog();
|
|
||||||
break;
|
|
||||||
case Decompile:
|
|
||||||
fragment.onUpdateProgress(emulationActivity.getString(R.string.preparing_shaders), progress, max);
|
|
||||||
break;
|
|
||||||
case Build:
|
|
||||||
fragment.onUpdateProgress(emulationActivity.getString(R.string.building_shaders), progress, max);
|
|
||||||
break;
|
|
||||||
case Complete:
|
|
||||||
// Workaround for when dialog is dismissed when the app is in the background
|
|
||||||
fragment.dismissAllowingStateLoss();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.model;
|
|
||||||
|
|
||||||
import androidx.annotation.Keep;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
public class Cheat {
|
|
||||||
@Keep
|
|
||||||
private final long mPointer;
|
|
||||||
|
|
||||||
private Runnable mEnabledChangedCallback = null;
|
|
||||||
|
|
||||||
@Keep
|
|
||||||
private Cheat(long pointer) {
|
|
||||||
mPointer = pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected native void finalize();
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public native String getName();
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public native String getNotes();
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public native String getCode();
|
|
||||||
|
|
||||||
public native boolean getEnabled();
|
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
|
||||||
setEnabledImpl(enabled);
|
|
||||||
onEnabledChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void setEnabledImpl(boolean enabled);
|
|
||||||
|
|
||||||
public void setEnabledChangedCallback(@Nullable Runnable callback) {
|
|
||||||
mEnabledChangedCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onEnabledChanged() {
|
|
||||||
if (mEnabledChangedCallback != null) {
|
|
||||||
mEnabledChangedCallback.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the code is valid, returns 0. Otherwise, returns the 1-based index
|
|
||||||
* for the line containing the error.
|
|
||||||
*/
|
|
||||||
public static native int isValidGatewayCode(@NonNull String code);
|
|
||||||
|
|
||||||
public static native Cheat createGatewayCode(@NonNull String name, @NonNull String notes,
|
|
||||||
@NonNull String code);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.model;
|
|
||||||
|
|
||||||
public class CheatEngine {
|
|
||||||
public static native Cheat[] getCheats();
|
|
||||||
|
|
||||||
public static native void addCheat(Cheat cheat);
|
|
||||||
|
|
||||||
public static native void removeCheat(int index);
|
|
||||||
|
|
||||||
public static native void updateCheat(int index, Cheat newCheat);
|
|
||||||
|
|
||||||
public static native void saveCheatFile();
|
|
||||||
}
|
|
@ -1,177 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.model;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
import androidx.lifecycle.ViewModel;
|
|
||||||
|
|
||||||
public class CheatsViewModel extends ViewModel {
|
|
||||||
private int mSelectedCheatPosition = -1;
|
|
||||||
private final MutableLiveData<Cheat> mSelectedCheat = new MutableLiveData<>(null);
|
|
||||||
private final MutableLiveData<Boolean> mIsAdding = new MutableLiveData<>(false);
|
|
||||||
private final MutableLiveData<Boolean> mIsEditing = new MutableLiveData<>(false);
|
|
||||||
|
|
||||||
private final MutableLiveData<Integer> mCheatAddedEvent = new MutableLiveData<>(null);
|
|
||||||
private final MutableLiveData<Integer> mCheatChangedEvent = new MutableLiveData<>(null);
|
|
||||||
private final MutableLiveData<Integer> mCheatDeletedEvent = new MutableLiveData<>(null);
|
|
||||||
private final MutableLiveData<Boolean> mOpenDetailsViewEvent = new MutableLiveData<>(false);
|
|
||||||
|
|
||||||
private Cheat[] mCheats;
|
|
||||||
private boolean mCheatsNeedSaving = false;
|
|
||||||
|
|
||||||
public void load() {
|
|
||||||
mCheats = CheatEngine.getCheats();
|
|
||||||
|
|
||||||
for (int i = 0; i < mCheats.length; i++) {
|
|
||||||
int position = i;
|
|
||||||
mCheats[i].setEnabledChangedCallback(() -> {
|
|
||||||
mCheatsNeedSaving = true;
|
|
||||||
notifyCheatUpdated(position);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveIfNeeded() {
|
|
||||||
if (mCheatsNeedSaving) {
|
|
||||||
CheatEngine.saveCheatFile();
|
|
||||||
mCheatsNeedSaving = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Cheat[] getCheats() {
|
|
||||||
return mCheats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<Cheat> getSelectedCheat() {
|
|
||||||
return mSelectedCheat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedCheat(Cheat cheat, int position) {
|
|
||||||
if (mIsEditing.getValue()) {
|
|
||||||
setIsEditing(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mSelectedCheat.setValue(cheat);
|
|
||||||
mSelectedCheatPosition = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<Boolean> getIsAdding() {
|
|
||||||
return mIsAdding;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<Boolean> getIsEditing() {
|
|
||||||
return mIsEditing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsEditing(boolean isEditing) {
|
|
||||||
mIsEditing.setValue(isEditing);
|
|
||||||
|
|
||||||
if (mIsAdding.getValue() && !isEditing) {
|
|
||||||
mIsAdding.setValue(false);
|
|
||||||
setSelectedCheat(null, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When a cheat is added, the integer stored in the returned LiveData
|
|
||||||
* changes to the position of that cheat, then changes back to null.
|
|
||||||
*/
|
|
||||||
public LiveData<Integer> getCheatAddedEvent() {
|
|
||||||
return mCheatAddedEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyCheatAdded(int position) {
|
|
||||||
mCheatAddedEvent.setValue(position);
|
|
||||||
mCheatAddedEvent.setValue(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startAddingCheat() {
|
|
||||||
mSelectedCheat.setValue(null);
|
|
||||||
mSelectedCheatPosition = -1;
|
|
||||||
|
|
||||||
mIsAdding.setValue(true);
|
|
||||||
mIsEditing.setValue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finishAddingCheat(Cheat cheat) {
|
|
||||||
if (!mIsAdding.getValue()) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsAdding.setValue(false);
|
|
||||||
mIsEditing.setValue(false);
|
|
||||||
|
|
||||||
int position = mCheats.length;
|
|
||||||
|
|
||||||
CheatEngine.addCheat(cheat);
|
|
||||||
|
|
||||||
mCheatsNeedSaving = true;
|
|
||||||
load();
|
|
||||||
|
|
||||||
notifyCheatAdded(position);
|
|
||||||
setSelectedCheat(mCheats[position], position);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When a cheat is edited, the integer stored in the returned LiveData
|
|
||||||
* changes to the position of that cheat, then changes back to null.
|
|
||||||
*/
|
|
||||||
public LiveData<Integer> getCheatUpdatedEvent() {
|
|
||||||
return mCheatChangedEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies that an edit has been made to the contents of the cheat at the given position.
|
|
||||||
*/
|
|
||||||
private void notifyCheatUpdated(int position) {
|
|
||||||
mCheatChangedEvent.setValue(position);
|
|
||||||
mCheatChangedEvent.setValue(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateSelectedCheat(Cheat newCheat) {
|
|
||||||
CheatEngine.updateCheat(mSelectedCheatPosition, newCheat);
|
|
||||||
|
|
||||||
mCheatsNeedSaving = true;
|
|
||||||
load();
|
|
||||||
|
|
||||||
notifyCheatUpdated(mSelectedCheatPosition);
|
|
||||||
setSelectedCheat(mCheats[mSelectedCheatPosition], mSelectedCheatPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When a cheat is deleted, the integer stored in the returned LiveData
|
|
||||||
* changes to the position of that cheat, then changes back to null.
|
|
||||||
*/
|
|
||||||
public LiveData<Integer> getCheatDeletedEvent() {
|
|
||||||
return mCheatDeletedEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies that the cheat at the given position has been deleted.
|
|
||||||
*/
|
|
||||||
private void notifyCheatDeleted(int position) {
|
|
||||||
mCheatDeletedEvent.setValue(position);
|
|
||||||
mCheatDeletedEvent.setValue(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteSelectedCheat() {
|
|
||||||
int position = mSelectedCheatPosition;
|
|
||||||
|
|
||||||
setSelectedCheat(null, -1);
|
|
||||||
|
|
||||||
CheatEngine.removeCheat(position);
|
|
||||||
|
|
||||||
mCheatsNeedSaving = true;
|
|
||||||
load();
|
|
||||||
|
|
||||||
notifyCheatDeleted(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<Boolean> getOpenDetailsViewEvent() {
|
|
||||||
return mOpenDetailsViewEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openDetailsView() {
|
|
||||||
mOpenDetailsViewEvent.setValue(true);
|
|
||||||
mOpenDetailsViewEvent.setValue(false);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,174 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.ui;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.Cheat;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.CheatsViewModel;
|
|
||||||
|
|
||||||
public class CheatDetailsFragment extends Fragment {
|
|
||||||
private View mRoot;
|
|
||||||
private ScrollView mScrollView;
|
|
||||||
private TextView mLabelName;
|
|
||||||
private EditText mEditName;
|
|
||||||
private EditText mEditNotes;
|
|
||||||
private EditText mEditCode;
|
|
||||||
private Button mButtonDelete;
|
|
||||||
private Button mButtonEdit;
|
|
||||||
private Button mButtonCancel;
|
|
||||||
private Button mButtonOk;
|
|
||||||
|
|
||||||
private CheatsViewModel mViewModel;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
|
||||||
@Nullable Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.fragment_cheat_details, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
mRoot = view.findViewById(R.id.root);
|
|
||||||
mScrollView = view.findViewById(R.id.scroll_view);
|
|
||||||
mLabelName = view.findViewById(R.id.label_name);
|
|
||||||
mEditName = view.findViewById(R.id.edit_name);
|
|
||||||
mEditNotes = view.findViewById(R.id.edit_notes);
|
|
||||||
mEditCode = view.findViewById(R.id.edit_code);
|
|
||||||
mButtonDelete = view.findViewById(R.id.button_delete);
|
|
||||||
mButtonEdit = view.findViewById(R.id.button_edit);
|
|
||||||
mButtonCancel = view.findViewById(R.id.button_cancel);
|
|
||||||
mButtonOk = view.findViewById(R.id.button_ok);
|
|
||||||
|
|
||||||
CheatsActivity activity = (CheatsActivity) requireActivity();
|
|
||||||
mViewModel = new ViewModelProvider(activity).get(CheatsViewModel.class);
|
|
||||||
|
|
||||||
mViewModel.getSelectedCheat().observe(getViewLifecycleOwner(),
|
|
||||||
this::onSelectedCheatUpdated);
|
|
||||||
mViewModel.getIsEditing().observe(getViewLifecycleOwner(), this::onIsEditingUpdated);
|
|
||||||
|
|
||||||
mButtonDelete.setOnClickListener(this::onDeleteClicked);
|
|
||||||
mButtonEdit.setOnClickListener(this::onEditClicked);
|
|
||||||
mButtonCancel.setOnClickListener(this::onCancelClicked);
|
|
||||||
mButtonOk.setOnClickListener(this::onOkClicked);
|
|
||||||
|
|
||||||
// On a portrait phone screen (or other narrow screen), only one of the two panes are shown
|
|
||||||
// at the same time. If the user is navigating using a d-pad and moves focus to an element
|
|
||||||
// in the currently hidden pane, we need to manually show that pane.
|
|
||||||
CheatsActivity.setOnFocusChangeListenerRecursively(view,
|
|
||||||
(v, hasFocus) -> activity.onDetailsViewFocusChange(hasFocus));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearEditErrors() {
|
|
||||||
mEditName.setError(null);
|
|
||||||
mEditCode.setError(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onDeleteClicked(View view) {
|
|
||||||
String name = mEditName.getText().toString();
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
|
|
||||||
builder.setMessage(getString(R.string.cheats_delete_confirmation, name));
|
|
||||||
builder.setPositiveButton(android.R.string.yes,
|
|
||||||
(dialog, i) -> mViewModel.deleteSelectedCheat());
|
|
||||||
builder.setNegativeButton(android.R.string.no, null);
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onEditClicked(View view) {
|
|
||||||
mViewModel.setIsEditing(true);
|
|
||||||
mButtonOk.requestFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onCancelClicked(View view) {
|
|
||||||
mViewModel.setIsEditing(false);
|
|
||||||
onSelectedCheatUpdated(mViewModel.getSelectedCheat().getValue());
|
|
||||||
mButtonDelete.requestFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onOkClicked(View view) {
|
|
||||||
clearEditErrors();
|
|
||||||
|
|
||||||
String name = mEditName.getText().toString();
|
|
||||||
String notes = mEditNotes.getText().toString();
|
|
||||||
String code = mEditCode.getText().toString();
|
|
||||||
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
mEditName.setError(getString(R.string.cheats_error_no_name));
|
|
||||||
mScrollView.smoothScrollTo(0, mLabelName.getTop());
|
|
||||||
return;
|
|
||||||
} else if (code.isEmpty()) {
|
|
||||||
mEditCode.setError(getString(R.string.cheats_error_no_code_lines));
|
|
||||||
mScrollView.smoothScrollTo(0, mEditCode.getBottom());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int validityResult = Cheat.isValidGatewayCode(code);
|
|
||||||
|
|
||||||
if (validityResult != 0) {
|
|
||||||
mEditCode.setError(getString(R.string.cheats_error_on_line, validityResult));
|
|
||||||
mScrollView.smoothScrollTo(0, mEditCode.getBottom());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Cheat newCheat = Cheat.createGatewayCode(name, notes, code);
|
|
||||||
|
|
||||||
if (mViewModel.getIsAdding().getValue()) {
|
|
||||||
mViewModel.finishAddingCheat(newCheat);
|
|
||||||
} else {
|
|
||||||
mViewModel.updateSelectedCheat(newCheat);
|
|
||||||
}
|
|
||||||
|
|
||||||
mButtonEdit.requestFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSelectedCheatUpdated(@Nullable Cheat cheat) {
|
|
||||||
clearEditErrors();
|
|
||||||
|
|
||||||
boolean isEditing = mViewModel.getIsEditing().getValue();
|
|
||||||
|
|
||||||
mRoot.setVisibility(isEditing || cheat != null ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
// If the fragment was recreated while editing a cheat, it's vital that we
|
|
||||||
// don't repopulate the fields, otherwise the user's changes will be lost
|
|
||||||
if (!isEditing) {
|
|
||||||
if (cheat == null) {
|
|
||||||
mEditName.setText("");
|
|
||||||
mEditNotes.setText("");
|
|
||||||
mEditCode.setText("");
|
|
||||||
} else {
|
|
||||||
mEditName.setText(cheat.getName());
|
|
||||||
mEditNotes.setText(cheat.getNotes());
|
|
||||||
mEditCode.setText(cheat.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onIsEditingUpdated(boolean isEditing) {
|
|
||||||
if (isEditing) {
|
|
||||||
mRoot.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
mEditName.setEnabled(isEditing);
|
|
||||||
mEditNotes.setEnabled(isEditing);
|
|
||||||
mEditCode.setEnabled(isEditing);
|
|
||||||
|
|
||||||
mButtonDelete.setVisibility(isEditing ? View.GONE : View.VISIBLE);
|
|
||||||
mButtonEdit.setVisibility(isEditing ? View.GONE : View.VISIBLE);
|
|
||||||
mButtonCancel.setVisibility(isEditing ? View.VISIBLE : View.GONE);
|
|
||||||
mButtonOk.setVisibility(isEditing ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.ui;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.CheatsViewModel;
|
|
||||||
import org.citra.citra_emu.ui.DividerItemDecoration;
|
|
||||||
|
|
||||||
public class CheatListFragment extends Fragment {
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
|
||||||
@Nullable Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.fragment_cheat_list, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
RecyclerView recyclerView = view.findViewById(R.id.cheat_list);
|
|
||||||
FloatingActionButton fab = view.findViewById(R.id.fab);
|
|
||||||
|
|
||||||
CheatsActivity activity = (CheatsActivity) requireActivity();
|
|
||||||
CheatsViewModel viewModel = new ViewModelProvider(activity).get(CheatsViewModel.class);
|
|
||||||
|
|
||||||
recyclerView.setAdapter(new CheatsAdapter(activity, viewModel));
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
|
||||||
recyclerView.addItemDecoration(new DividerItemDecoration(activity, null));
|
|
||||||
|
|
||||||
fab.setOnClickListener(v -> {
|
|
||||||
viewModel.startAddingCheat();
|
|
||||||
viewModel.openDetailsView();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.ui;
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.Cheat;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.CheatsViewModel;
|
|
||||||
|
|
||||||
public class CheatViewHolder extends RecyclerView.ViewHolder
|
|
||||||
implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
|
||||||
private final View mRoot;
|
|
||||||
private final TextView mName;
|
|
||||||
private final CheckBox mCheckbox;
|
|
||||||
|
|
||||||
private CheatsViewModel mViewModel;
|
|
||||||
private Cheat mCheat;
|
|
||||||
private int mPosition;
|
|
||||||
|
|
||||||
public CheatViewHolder(@NonNull View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
|
|
||||||
mRoot = itemView.findViewById(R.id.root);
|
|
||||||
mName = itemView.findViewById(R.id.text_name);
|
|
||||||
mCheckbox = itemView.findViewById(R.id.checkbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bind(CheatsActivity activity, Cheat cheat, int position) {
|
|
||||||
mCheckbox.setOnCheckedChangeListener(null);
|
|
||||||
|
|
||||||
mViewModel = new ViewModelProvider(activity).get(CheatsViewModel.class);
|
|
||||||
mCheat = cheat;
|
|
||||||
mPosition = position;
|
|
||||||
|
|
||||||
mName.setText(mCheat.getName());
|
|
||||||
mCheckbox.setChecked(mCheat.getEnabled());
|
|
||||||
|
|
||||||
mRoot.setOnClickListener(this);
|
|
||||||
mCheckbox.setOnCheckedChangeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick(View root) {
|
|
||||||
mViewModel.setSelectedCheat(mCheat, mPosition);
|
|
||||||
mViewModel.openDetailsView();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mCheat.setEnabled(isChecked);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.ui;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
import androidx.slidingpanelayout.widget.SlidingPaneLayout;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.Cheat;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.CheatsViewModel;
|
|
||||||
import org.citra.citra_emu.ui.TwoPaneOnBackPressedCallback;
|
|
||||||
|
|
||||||
public class CheatsActivity extends AppCompatActivity
|
|
||||||
implements SlidingPaneLayout.PanelSlideListener {
|
|
||||||
private CheatsViewModel mViewModel;
|
|
||||||
|
|
||||||
private SlidingPaneLayout mSlidingPaneLayout;
|
|
||||||
private View mCheatList;
|
|
||||||
private View mCheatDetails;
|
|
||||||
|
|
||||||
private View mCheatListLastFocus;
|
|
||||||
private View mCheatDetailsLastFocus;
|
|
||||||
|
|
||||||
public static void launch(Context context) {
|
|
||||||
Intent intent = new Intent(context, CheatsActivity.class);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
mViewModel = new ViewModelProvider(this).get(CheatsViewModel.class);
|
|
||||||
mViewModel.load();
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_cheats);
|
|
||||||
|
|
||||||
mSlidingPaneLayout = findViewById(R.id.sliding_pane_layout);
|
|
||||||
mCheatList = findViewById(R.id.cheat_list);
|
|
||||||
mCheatDetails = findViewById(R.id.cheat_details);
|
|
||||||
|
|
||||||
mCheatListLastFocus = mCheatList;
|
|
||||||
mCheatDetailsLastFocus = mCheatDetails;
|
|
||||||
|
|
||||||
mSlidingPaneLayout.addPanelSlideListener(this);
|
|
||||||
|
|
||||||
getOnBackPressedDispatcher().addCallback(this,
|
|
||||||
new TwoPaneOnBackPressedCallback(mSlidingPaneLayout));
|
|
||||||
|
|
||||||
mViewModel.getSelectedCheat().observe(this, this::onSelectedCheatChanged);
|
|
||||||
mViewModel.getIsEditing().observe(this, this::onIsEditingChanged);
|
|
||||||
onSelectedCheatChanged(mViewModel.getSelectedCheat().getValue());
|
|
||||||
|
|
||||||
mViewModel.getOpenDetailsViewEvent().observe(this, this::openDetailsView);
|
|
||||||
|
|
||||||
// Show "Up" button in the action bar for navigation
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
|
||||||
inflater.inflate(R.menu.menu_settings, menu);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
|
|
||||||
mViewModel.saveIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPanelSlide(@NonNull View panel, float slideOffset) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPanelOpened(@NonNull View panel) {
|
|
||||||
boolean rtl = ViewCompat.getLayoutDirection(panel) == ViewCompat.LAYOUT_DIRECTION_RTL;
|
|
||||||
mCheatDetailsLastFocus.requestFocus(rtl ? View.FOCUS_LEFT : View.FOCUS_RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPanelClosed(@NonNull View panel) {
|
|
||||||
boolean rtl = ViewCompat.getLayoutDirection(panel) == ViewCompat.LAYOUT_DIRECTION_RTL;
|
|
||||||
mCheatListLastFocus.requestFocus(rtl ? View.FOCUS_RIGHT : View.FOCUS_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onIsEditingChanged(boolean isEditing) {
|
|
||||||
if (isEditing) {
|
|
||||||
mSlidingPaneLayout.setLockMode(SlidingPaneLayout.LOCK_MODE_UNLOCKED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSelectedCheatChanged(Cheat selectedCheat) {
|
|
||||||
boolean cheatSelected = selectedCheat != null || mViewModel.getIsEditing().getValue();
|
|
||||||
|
|
||||||
if (!cheatSelected && mSlidingPaneLayout.isOpen()) {
|
|
||||||
mSlidingPaneLayout.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
mSlidingPaneLayout.setLockMode(cheatSelected ?
|
|
||||||
SlidingPaneLayout.LOCK_MODE_UNLOCKED : SlidingPaneLayout.LOCK_MODE_LOCKED_CLOSED);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onListViewFocusChange(boolean hasFocus) {
|
|
||||||
if (hasFocus) {
|
|
||||||
mCheatListLastFocus = mCheatList.findFocus();
|
|
||||||
if (mCheatListLastFocus == null)
|
|
||||||
throw new NullPointerException();
|
|
||||||
|
|
||||||
mSlidingPaneLayout.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDetailsViewFocusChange(boolean hasFocus) {
|
|
||||||
if (hasFocus) {
|
|
||||||
mCheatDetailsLastFocus = mCheatDetails.findFocus();
|
|
||||||
if (mCheatDetailsLastFocus == null)
|
|
||||||
throw new NullPointerException();
|
|
||||||
|
|
||||||
mSlidingPaneLayout.open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onSupportNavigateUp() {
|
|
||||||
onBackPressed();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openDetailsView(boolean open) {
|
|
||||||
if (open) {
|
|
||||||
mSlidingPaneLayout.open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setOnFocusChangeListenerRecursively(@NonNull View view,
|
|
||||||
View.OnFocusChangeListener listener) {
|
|
||||||
view.setOnFocusChangeListener(listener);
|
|
||||||
|
|
||||||
if (view instanceof ViewGroup) {
|
|
||||||
ViewGroup viewGroup = (ViewGroup) view;
|
|
||||||
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
|
||||||
View child = viewGroup.getChildAt(i);
|
|
||||||
setOnFocusChangeListenerRecursively(child, listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
package org.citra.citra_emu.features.cheats.ui;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.Cheat;
|
|
||||||
import org.citra.citra_emu.features.cheats.model.CheatsViewModel;
|
|
||||||
|
|
||||||
public class CheatsAdapter extends RecyclerView.Adapter<CheatViewHolder> {
|
|
||||||
private final CheatsActivity mActivity;
|
|
||||||
private final CheatsViewModel mViewModel;
|
|
||||||
|
|
||||||
public CheatsAdapter(CheatsActivity activity, CheatsViewModel viewModel) {
|
|
||||||
mActivity = activity;
|
|
||||||
mViewModel = viewModel;
|
|
||||||
|
|
||||||
mViewModel.getCheatAddedEvent().observe(activity, (position) -> {
|
|
||||||
if (position != null) {
|
|
||||||
notifyItemInserted(position);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mViewModel.getCheatUpdatedEvent().observe(activity, (position) -> {
|
|
||||||
if (position != null) {
|
|
||||||
notifyItemChanged(position);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mViewModel.getCheatDeletedEvent().observe(activity, (position) -> {
|
|
||||||
if (position != null) {
|
|
||||||
notifyItemRemoved(position);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public CheatViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
|
||||||
|
|
||||||
View cheatView = inflater.inflate(R.layout.list_item_cheat, parent, false);
|
|
||||||
addViewListeners(cheatView);
|
|
||||||
return new CheatViewHolder(cheatView);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull CheatViewHolder holder, int position) {
|
|
||||||
holder.bind(mActivity, getItemAt(position), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return mViewModel.getCheats().length;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addViewListeners(View view) {
|
|
||||||
// On a portrait phone screen (or other narrow screen), only one of the two panes are shown
|
|
||||||
// at the same time. If the user is navigating using a d-pad and moves focus to an element
|
|
||||||
// in the currently hidden pane, we need to manually show that pane.
|
|
||||||
CheatsActivity.setOnFocusChangeListenerRecursively(view,
|
|
||||||
(v, hasFocus) -> mActivity.onListViewFocusChange(hasFocus));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Cheat getItemAt(int position) {
|
|
||||||
return mViewModel.getCheats()[position];
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu;
|
package org.yuzu.yuzu_emu;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -24,9 +24,9 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -314,7 +314,7 @@ public final class NativeLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPortraitMode() {
|
public static boolean isPortraitMode() {
|
||||||
return CitraApplication.getAppContext().getResources().getConfiguration().orientation ==
|
return YuzuApplication.getAppContext().getResources().getConfiguration().orientation ==
|
||||||
Configuration.ORIENTATION_PORTRAIT;
|
Configuration.ORIENTATION_PORTRAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,10 +420,10 @@ public final class NativeLibrary {
|
|||||||
alertPromptButton = 0;
|
alertPromptButton = 0;
|
||||||
|
|
||||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.leftMargin = params.rightMargin = CitraApplication.getAppContext().getResources().getDimensionPixelSize(R.dimen.dialog_margin);
|
params.leftMargin = params.rightMargin = YuzuApplication.getAppContext().getResources().getDimensionPixelSize(R.dimen.dialog_margin);
|
||||||
|
|
||||||
// Set up the input
|
// Set up the input
|
||||||
alertPromptEditText = new EditText(CitraApplication.getAppContext());
|
alertPromptEditText = new EditText(YuzuApplication.getAppContext());
|
||||||
alertPromptEditText.setText(text);
|
alertPromptEditText.setText(text);
|
||||||
alertPromptEditText.setSingleLine();
|
alertPromptEditText.setSingleLine();
|
||||||
alertPromptEditText.setLayoutParams(params);
|
alertPromptEditText.setLayoutParams(params);
|
@ -2,7 +2,7 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
package org.citra.citra_emu;
|
package org.yuzu.yuzu_emu;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
@ -10,13 +10,13 @@ import android.app.NotificationManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import org.citra.citra_emu.model.GameDatabase;
|
import org.yuzu.yuzu_emu.model.GameDatabase;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization;
|
||||||
import org.citra.citra_emu.utils.PermissionsHandler;
|
import org.yuzu.yuzu_emu.utils.PermissionsHandler;
|
||||||
|
|
||||||
public class CitraApplication extends Application {
|
public class YuzuApplication extends Application {
|
||||||
public static GameDatabase databaseHelper;
|
public static GameDatabase databaseHelper;
|
||||||
private static CitraApplication application;
|
private static YuzuApplication application;
|
||||||
|
|
||||||
private void createNotificationChannel() {
|
private void createNotificationChannel() {
|
||||||
// Create the NotificationChannel, but only on API 26+ because
|
// Create the NotificationChannel, but only on API 26+ because
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.activities;
|
package org.yuzu.yuzu_emu.activities;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
@ -8,7 +8,7 @@ import androidx.annotation.Nullable;
|
|||||||
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
|
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
|
||||||
import com.nononsenseapps.filepicker.FilePickerActivity;
|
import com.nononsenseapps.filepicker.FilePickerActivity;
|
||||||
|
|
||||||
import org.citra.citra_emu.fragments.CustomFilePickerFragment;
|
import org.yuzu.yuzu_emu.fragments.CustomFilePickerFragment;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -1,9 +1,10 @@
|
|||||||
package org.citra.citra_emu.activities;
|
package org.yuzu.yuzu_emu.activities;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
@ -15,37 +16,31 @@ import android.view.Menu;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting;
|
||||||
import org.citra.citra_emu.features.cheats.ui.CheatsActivity;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity;
|
||||||
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsActivity;
|
import org.yuzu.yuzu_emu.fragments.EmulationFragment;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.fragments.MenuFragment;
|
||||||
import org.citra.citra_emu.camera.StillImageCameraHelper;
|
import org.yuzu.yuzu_emu.utils.ControllerMappingHelper;
|
||||||
import org.citra.citra_emu.fragments.EmulationFragment;
|
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
|
||||||
import org.citra.citra_emu.ui.main.MainActivity;
|
import org.yuzu.yuzu_emu.utils.ForegroundService;
|
||||||
import org.citra.citra_emu.utils.ControllerMappingHelper;
|
|
||||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
|
||||||
import org.citra.citra_emu.utils.FileBrowserHelper;
|
|
||||||
import org.citra.citra_emu.utils.FileUtil;
|
|
||||||
import org.citra.citra_emu.utils.ForegroundService;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.Manifest.permission.CAMERA;
|
import static android.Manifest.permission.CAMERA;
|
||||||
@ -53,6 +48,10 @@ import static android.Manifest.permission.RECORD_AUDIO;
|
|||||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||||
|
|
||||||
public final class EmulationActivity extends AppCompatActivity {
|
public final class EmulationActivity extends AppCompatActivity {
|
||||||
|
private static final String BACKSTACK_NAME_MENU = "menu";
|
||||||
|
|
||||||
|
private static final String BACKSTACK_NAME_SUBMENU = "submenu";
|
||||||
|
|
||||||
public static final String EXTRA_SELECTED_GAME = "SelectedGame";
|
public static final String EXTRA_SELECTED_GAME = "SelectedGame";
|
||||||
public static final String EXTRA_SELECTED_TITLE = "SelectedTitle";
|
public static final String EXTRA_SELECTED_TITLE = "SelectedTitle";
|
||||||
public static final int MENU_ACTION_EDIT_CONTROLS_PLACEMENT = 0;
|
public static final int MENU_ACTION_EDIT_CONTROLS_PLACEMENT = 0;
|
||||||
@ -60,61 +59,10 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
public static final int MENU_ACTION_ADJUST_SCALE = 2;
|
public static final int MENU_ACTION_ADJUST_SCALE = 2;
|
||||||
public static final int MENU_ACTION_EXIT = 3;
|
public static final int MENU_ACTION_EXIT = 3;
|
||||||
public static final int MENU_ACTION_SHOW_FPS = 4;
|
public static final int MENU_ACTION_SHOW_FPS = 4;
|
||||||
public static final int MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE = 5;
|
public static final int MENU_ACTION_RESET_OVERLAY = 6;
|
||||||
public static final int MENU_ACTION_SCREEN_LAYOUT_PORTRAIT = 6;
|
public static final int MENU_ACTION_SHOW_OVERLAY = 7;
|
||||||
public static final int MENU_ACTION_SCREEN_LAYOUT_SINGLE = 7;
|
public static final int MENU_ACTION_OPEN_SETTINGS = 8;
|
||||||
public static final int MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE = 8;
|
|
||||||
public static final int MENU_ACTION_SWAP_SCREENS = 9;
|
|
||||||
public static final int MENU_ACTION_RESET_OVERLAY = 10;
|
|
||||||
public static final int MENU_ACTION_SHOW_OVERLAY = 11;
|
|
||||||
public static final int MENU_ACTION_OPEN_SETTINGS = 12;
|
|
||||||
public static final int MENU_ACTION_LOAD_AMIIBO = 13;
|
|
||||||
public static final int MENU_ACTION_REMOVE_AMIIBO = 14;
|
|
||||||
public static final int MENU_ACTION_JOYSTICK_REL_CENTER = 15;
|
|
||||||
public static final int MENU_ACTION_DPAD_SLIDE_ENABLE = 16;
|
|
||||||
public static final int MENU_ACTION_OPEN_CHEATS = 17;
|
|
||||||
|
|
||||||
public static final int REQUEST_SELECT_AMIIBO = 2;
|
|
||||||
private static final int EMULATION_RUNNING_NOTIFICATION = 0x1000;
|
private static final int EMULATION_RUNNING_NOTIFICATION = 0x1000;
|
||||||
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_show_fps,
|
|
||||||
EmulationActivity.MENU_ACTION_SHOW_FPS);
|
|
||||||
buttonsActionsMap.append(R.id.menu_screen_layout_landscape,
|
|
||||||
EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE);
|
|
||||||
buttonsActionsMap.append(R.id.menu_screen_layout_portrait,
|
|
||||||
EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_PORTRAIT);
|
|
||||||
buttonsActionsMap.append(R.id.menu_screen_layout_single,
|
|
||||||
EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_SINGLE);
|
|
||||||
buttonsActionsMap.append(R.id.menu_screen_layout_sidebyside,
|
|
||||||
EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE);
|
|
||||||
buttonsActionsMap.append(R.id.menu_emulation_swap_screens,
|
|
||||||
EmulationActivity.MENU_ACTION_SWAP_SCREENS);
|
|
||||||
buttonsActionsMap
|
|
||||||
.append(R.id.menu_emulation_reset_overlay, EmulationActivity.MENU_ACTION_RESET_OVERLAY);
|
|
||||||
buttonsActionsMap
|
|
||||||
.append(R.id.menu_emulation_show_overlay, EmulationActivity.MENU_ACTION_SHOW_OVERLAY);
|
|
||||||
buttonsActionsMap
|
|
||||||
.append(R.id.menu_emulation_open_settings, EmulationActivity.MENU_ACTION_OPEN_SETTINGS);
|
|
||||||
buttonsActionsMap
|
|
||||||
.append(R.id.menu_emulation_amiibo_load, EmulationActivity.MENU_ACTION_LOAD_AMIIBO);
|
|
||||||
buttonsActionsMap
|
|
||||||
.append(R.id.menu_emulation_amiibo_remove, EmulationActivity.MENU_ACTION_REMOVE_AMIIBO);
|
|
||||||
buttonsActionsMap.append(R.id.menu_emulation_joystick_rel_center,
|
|
||||||
EmulationActivity.MENU_ACTION_JOYSTICK_REL_CENTER);
|
|
||||||
buttonsActionsMap.append(R.id.menu_emulation_dpad_slide_enable,
|
|
||||||
EmulationActivity.MENU_ACTION_DPAD_SLIDE_ENABLE);
|
|
||||||
buttonsActionsMap
|
|
||||||
.append(R.id.menu_emulation_open_cheats, EmulationActivity.MENU_ACTION_OPEN_CHEATS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private View mDecorView;
|
private View mDecorView;
|
||||||
private EmulationFragment mEmulationFragment;
|
private EmulationFragment mEmulationFragment;
|
||||||
private SharedPreferences mPreferences;
|
private SharedPreferences mPreferences;
|
||||||
@ -124,6 +72,8 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
private String mSelectedTitle;
|
private String mSelectedTitle;
|
||||||
private String mPath;
|
private String mPath;
|
||||||
|
|
||||||
|
private boolean mMenuVisible;
|
||||||
|
|
||||||
public static void launch(FragmentActivity activity, String path, String title) {
|
public static void launch(FragmentActivity activity, String path, String title) {
|
||||||
Intent launcher = new Intent(activity, EmulationActivity.class);
|
Intent launcher = new Intent(activity, EmulationActivity.class);
|
||||||
|
|
||||||
@ -172,7 +122,7 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
// Set these options now so that the SurfaceView the game renders into is the right size.
|
// Set these options now so that the SurfaceView the game renders into is the right size.
|
||||||
enableFullscreenImmersive();
|
enableFullscreenImmersive();
|
||||||
|
|
||||||
setTheme(R.style.CitraEmulationBase);
|
setTheme(R.style.YuzuEmulationBase);
|
||||||
|
|
||||||
setContentView(R.layout.activity_emulation);
|
setContentView(R.layout.activity_emulation);
|
||||||
|
|
||||||
@ -217,52 +167,7 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
NativeLibrary.PauseEmulation();
|
toggleMenu();
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.emulation_close_game)
|
|
||||||
.setMessage(R.string.emulation_close_game_message)
|
|
||||||
.setPositiveButton(android.R.string.yes, (dialogInterface, i) ->
|
|
||||||
{
|
|
||||||
mEmulationFragment.stopEmulation();
|
|
||||||
finish();
|
|
||||||
})
|
|
||||||
.setNegativeButton(android.R.string.cancel, (dialogInterface, i) ->
|
|
||||||
NativeLibrary.UnPauseEmulation())
|
|
||||||
.setOnCancelListener(dialogInterface ->
|
|
||||||
NativeLibrary.UnPauseEmulation())
|
|
||||||
.create()
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
||||||
switch (requestCode) {
|
|
||||||
case NativeLibrary.REQUEST_CODE_NATIVE_CAMERA:
|
|
||||||
if (grantResults[0] != PackageManager.PERMISSION_GRANTED &&
|
|
||||||
shouldShowRequestPermissionRationale(CAMERA)) {
|
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.camera)
|
|
||||||
.setMessage(R.string.camera_permission_needed)
|
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
NativeLibrary.CameraPermissionResult(grantResults[0] == PackageManager.PERMISSION_GRANTED);
|
|
||||||
break;
|
|
||||||
case NativeLibrary.REQUEST_CODE_NATIVE_MIC:
|
|
||||||
if (grantResults[0] != PackageManager.PERMISSION_GRANTED &&
|
|
||||||
shouldShowRequestPermissionRationale(RECORD_AUDIO)) {
|
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.microphone)
|
|
||||||
.setMessage(R.string.microphone_permission_needed)
|
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
NativeLibrary.MicPermissionResult(grantResults[0] == PackageManager.PERMISSION_GRANTED);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableFullscreenImmersive() {
|
private void enableFullscreenImmersive() {
|
||||||
@ -276,179 +181,13 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
View.SYSTEM_UI_FLAG_IMMERSIVE);
|
View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void handleMenuAction(int action) {
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
|
||||||
getMenuInflater().inflate(R.menu.menu_emulation, menu);
|
|
||||||
|
|
||||||
int layoutOptionMenuItem = R.id.menu_screen_layout_landscape;
|
|
||||||
switch (EmulationMenuSettings.getLandscapeScreenLayout()) {
|
|
||||||
case EmulationMenuSettings.LayoutOption_SingleScreen:
|
|
||||||
layoutOptionMenuItem = R.id.menu_screen_layout_single;
|
|
||||||
break;
|
|
||||||
case EmulationMenuSettings.LayoutOption_SideScreen:
|
|
||||||
layoutOptionMenuItem = R.id.menu_screen_layout_sidebyside;
|
|
||||||
break;
|
|
||||||
case EmulationMenuSettings.LayoutOption_MobilePortrait:
|
|
||||||
layoutOptionMenuItem = R.id.menu_screen_layout_portrait;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.findItem(layoutOptionMenuItem).setChecked(true);
|
|
||||||
menu.findItem(R.id.menu_emulation_joystick_rel_center).setChecked(EmulationMenuSettings.getJoystickRelCenter());
|
|
||||||
menu.findItem(R.id.menu_emulation_dpad_slide_enable).setChecked(EmulationMenuSettings.getDpadSlideEnable());
|
|
||||||
menu.findItem(R.id.menu_emulation_show_fps).setChecked(EmulationMenuSettings.getShowFps());
|
|
||||||
menu.findItem(R.id.menu_emulation_swap_screens).setChecked(EmulationMenuSettings.getSwapScreens());
|
|
||||||
menu.findItem(R.id.menu_emulation_show_overlay).setChecked(EmulationMenuSettings.getShowOverlay());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DisplaySavestateWarning() {
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
|
||||||
if (preferences.getBoolean("savestateWarningShown", false)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutInflater inflater = mEmulationFragment.requireActivity().getLayoutInflater();
|
|
||||||
View view = inflater.inflate(R.layout.dialog_checkbox, null);
|
|
||||||
CheckBox checkBox = view.findViewById(R.id.checkBox);
|
|
||||||
|
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.savestate_warning_title)
|
|
||||||
.setMessage(R.string.savestate_warning_message)
|
|
||||||
.setView(view)
|
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
|
||||||
preferences.edit().putBoolean("savestateWarningShown", checkBox.isChecked()).apply();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
||||||
super.onPrepareOptionsMenu(menu);
|
|
||||||
menu.findItem(R.id.menu_emulation_save_state).setVisible(false);
|
|
||||||
menu.findItem(R.id.menu_emulation_load_state).setVisible(false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("WrongConstant")
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
int action = buttonsActionsMap.get(item.getItemId(), -1);
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
// Edit the placement of the controls
|
|
||||||
case MENU_ACTION_EDIT_CONTROLS_PLACEMENT:
|
|
||||||
editControlsPlacement();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Enable/Disable specific buttons or the entire input overlay.
|
|
||||||
case MENU_ACTION_TOGGLE_CONTROLS:
|
|
||||||
toggleControls();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Adjust the scale of the overlay controls.
|
|
||||||
case MENU_ACTION_ADJUST_SCALE:
|
|
||||||
adjustScale();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Toggle the visibility of the Performance stats TextView
|
|
||||||
case MENU_ACTION_SHOW_FPS: {
|
|
||||||
final boolean isEnabled = !EmulationMenuSettings.getShowFps();
|
|
||||||
EmulationMenuSettings.setShowFps(isEnabled);
|
|
||||||
item.setChecked(isEnabled);
|
|
||||||
|
|
||||||
mEmulationFragment.updateShowFpsOverlay();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Sets the screen layout to Landscape
|
|
||||||
case MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE:
|
|
||||||
changeScreenOrientation(EmulationMenuSettings.LayoutOption_MobileLandscape, item);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Sets the screen layout to Portrait
|
|
||||||
case MENU_ACTION_SCREEN_LAYOUT_PORTRAIT:
|
|
||||||
changeScreenOrientation(EmulationMenuSettings.LayoutOption_MobilePortrait, item);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Sets the screen layout to Single
|
|
||||||
case MENU_ACTION_SCREEN_LAYOUT_SINGLE:
|
|
||||||
changeScreenOrientation(EmulationMenuSettings.LayoutOption_SingleScreen, item);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Sets the screen layout to Side by Side
|
|
||||||
case MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE:
|
|
||||||
changeScreenOrientation(EmulationMenuSettings.LayoutOption_SideScreen, item);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Swap the top and bottom screen locations
|
|
||||||
case MENU_ACTION_SWAP_SCREENS: {
|
|
||||||
final boolean isEnabled = !EmulationMenuSettings.getSwapScreens();
|
|
||||||
EmulationMenuSettings.setSwapScreens(isEnabled);
|
|
||||||
item.setChecked(isEnabled);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset overlay placement
|
|
||||||
case MENU_ACTION_RESET_OVERLAY:
|
|
||||||
resetOverlay();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Show or hide overlay
|
|
||||||
case MENU_ACTION_SHOW_OVERLAY: {
|
|
||||||
final boolean isEnabled = !EmulationMenuSettings.getShowOverlay();
|
|
||||||
EmulationMenuSettings.setShowOverlay(isEnabled);
|
|
||||||
item.setChecked(isEnabled);
|
|
||||||
|
|
||||||
mEmulationFragment.refreshInputOverlay();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MENU_ACTION_EXIT:
|
case MENU_ACTION_EXIT:
|
||||||
mEmulationFragment.stopEmulation();
|
mEmulationFragment.stopEmulation();
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_ACTION_OPEN_SETTINGS:
|
|
||||||
SettingsActivity.launch(this, SettingsFile.FILE_NAME_CONFIG, "");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_ACTION_LOAD_AMIIBO:
|
|
||||||
FileBrowserHelper.openFilePicker(this, REQUEST_SELECT_AMIIBO,
|
|
||||||
R.string.select_amiibo,
|
|
||||||
Collections.singletonList("bin"), false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_ACTION_REMOVE_AMIIBO:
|
|
||||||
RemoveAmiibo();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_ACTION_JOYSTICK_REL_CENTER:
|
|
||||||
final boolean isJoystickRelCenterEnabled = !EmulationMenuSettings.getJoystickRelCenter();
|
|
||||||
EmulationMenuSettings.setJoystickRelCenter(isJoystickRelCenterEnabled);
|
|
||||||
item.setChecked(isJoystickRelCenterEnabled);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_ACTION_DPAD_SLIDE_ENABLE:
|
|
||||||
final boolean isDpadSlideEnabled = !EmulationMenuSettings.getDpadSlideEnable();
|
|
||||||
EmulationMenuSettings.setDpadSlideEnable(isDpadSlideEnabled);
|
|
||||||
item.setChecked(isDpadSlideEnabled);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_ACTION_OPEN_CHEATS:
|
|
||||||
CheatsActivity.launch(this);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void changeScreenOrientation(int layoutOption, MenuItem item) {
|
|
||||||
item.setChecked(true);
|
|
||||||
NativeLibrary.NotifyOrientationChange(layoutOption, getWindowManager().getDefaultDisplay()
|
|
||||||
.getRotation());
|
|
||||||
EmulationMenuSettings.setLandscapeScreenLayout(layoutOption);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editControlsPlacement() {
|
private void editControlsPlacement() {
|
||||||
@ -462,6 +201,11 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
// Gets button presses
|
// Gets button presses
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
|
if (mMenuVisible || event.getKeyCode() == KeyEvent.KEYCODE_BACK)
|
||||||
|
{
|
||||||
|
return super.dispatchKeyEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
int action;
|
int action;
|
||||||
int button = mPreferences.getInt(InputBindingSetting.getInputButtonKey(event.getKeyCode()), event.getKeyCode());
|
int button = mPreferences.getInt(InputBindingSetting.getInputButtonKey(event.getKeyCode()), event.getKeyCode());
|
||||||
|
|
||||||
@ -492,49 +236,6 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
return NativeLibrary.onGamePadEvent(input.getDescriptor(), button, action);
|
return NativeLibrary.onGamePadEvent(input.getDescriptor(), button, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, result);
|
|
||||||
switch (requestCode) {
|
|
||||||
case StillImageCameraHelper.REQUEST_CAMERA_FILE_PICKER:
|
|
||||||
StillImageCameraHelper.OnFilePickerResult(resultCode == RESULT_OK ? result : null);
|
|
||||||
break;
|
|
||||||
case REQUEST_SELECT_AMIIBO:
|
|
||||||
// If the user picked a file, as opposed to just backing out.
|
|
||||||
if (resultCode == MainActivity.RESULT_OK) {
|
|
||||||
String[] selectedFiles = FileBrowserHelper.getSelectedFiles(result);
|
|
||||||
if (selectedFiles == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
onAmiiboSelected(selectedFiles[0]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onAmiiboSelected(String selectedFile) {
|
|
||||||
File file = new File(selectedFile);
|
|
||||||
boolean success = false;
|
|
||||||
try {
|
|
||||||
byte[] bytes = FileUtil.getBytesFromFile(file);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.amiibo_load_error)
|
|
||||||
.setMessage(R.string.amiibo_load_error_message)
|
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
|
||||||
.create()
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveAmiibo() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toggleControls() {
|
private void toggleControls() {
|
||||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
boolean[] enabledButtons = new boolean[14];
|
boolean[] enabledButtons = new boolean[14];
|
||||||
@ -630,8 +331,59 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean areCoordinatesOutside(@Nullable View view, float x, float y)
|
||||||
|
{
|
||||||
|
if (view == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect viewBounds = new Rect();
|
||||||
|
view.getGlobalVisibleRect(viewBounds);
|
||||||
|
return !viewBounds.contains(Math.round(x), Math.round(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event)
|
||||||
|
{
|
||||||
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN)
|
||||||
|
{
|
||||||
|
boolean anyMenuClosed = false;
|
||||||
|
|
||||||
|
Fragment submenu = getSupportFragmentManager().findFragmentById(R.id.frame_submenu);
|
||||||
|
if (submenu != null && areCoordinatesOutside(submenu.getView(), event.getX(), event.getY()))
|
||||||
|
{
|
||||||
|
closeSubmenu();
|
||||||
|
submenu = null;
|
||||||
|
anyMenuClosed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (submenu == null)
|
||||||
|
{
|
||||||
|
Fragment menu = getSupportFragmentManager().findFragmentById(R.id.frame_menu);
|
||||||
|
if (menu != null && areCoordinatesOutside(menu.getView(), event.getX(), event.getY()))
|
||||||
|
{
|
||||||
|
closeMenu();
|
||||||
|
anyMenuClosed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anyMenuClosed)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchGenericMotionEvent(MotionEvent event) {
|
public boolean dispatchGenericMotionEvent(MotionEvent event) {
|
||||||
|
if (mMenuVisible)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)) {
|
if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)) {
|
||||||
return super.dispatchGenericMotionEvent(event);
|
return super.dispatchGenericMotionEvent(event);
|
||||||
}
|
}
|
||||||
@ -747,9 +499,39 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Retention(SOURCE)
|
@Retention(SOURCE)
|
||||||
@IntDef({MENU_ACTION_EDIT_CONTROLS_PLACEMENT, MENU_ACTION_TOGGLE_CONTROLS, MENU_ACTION_ADJUST_SCALE,
|
@IntDef({MENU_ACTION_EDIT_CONTROLS_PLACEMENT, MENU_ACTION_TOGGLE_CONTROLS, MENU_ACTION_ADJUST_SCALE,
|
||||||
MENU_ACTION_EXIT, MENU_ACTION_SHOW_FPS, MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE,
|
MENU_ACTION_EXIT, MENU_ACTION_SHOW_FPS, MENU_ACTION_RESET_OVERLAY, MENU_ACTION_SHOW_OVERLAY, MENU_ACTION_OPEN_SETTINGS})
|
||||||
MENU_ACTION_SCREEN_LAYOUT_PORTRAIT, MENU_ACTION_SCREEN_LAYOUT_SINGLE, MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE,
|
|
||||||
MENU_ACTION_SWAP_SCREENS, MENU_ACTION_RESET_OVERLAY, MENU_ACTION_SHOW_OVERLAY, MENU_ACTION_OPEN_SETTINGS})
|
|
||||||
public @interface MenuAction {
|
public @interface MenuAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean closeSubmenu()
|
||||||
|
{
|
||||||
|
return getSupportFragmentManager().popBackStackImmediate(BACKSTACK_NAME_SUBMENU,
|
||||||
|
FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean closeMenu()
|
||||||
|
{
|
||||||
|
mMenuVisible = false;
|
||||||
|
return getSupportFragmentManager().popBackStackImmediate(BACKSTACK_NAME_MENU,
|
||||||
|
FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleMenu()
|
||||||
|
{
|
||||||
|
if (!closeMenu()) {
|
||||||
|
// Removing the menu failed, so that means it wasn't visible. Add it.
|
||||||
|
Fragment fragment = MenuFragment.newInstance();
|
||||||
|
getSupportFragmentManager().beginTransaction()
|
||||||
|
.setCustomAnimations(
|
||||||
|
R.animator.menu_slide_in_from_start,
|
||||||
|
R.animator.menu_slide_out_to_start,
|
||||||
|
R.animator.menu_slide_in_from_start,
|
||||||
|
R.animator.menu_slide_out_to_start)
|
||||||
|
.add(R.id.frame_menu, fragment)
|
||||||
|
.addToBackStack(BACKSTACK_NAME_MENU)
|
||||||
|
.commit();
|
||||||
|
mMenuVisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.adapters;
|
package org.yuzu.yuzu_emu.adapters;
|
||||||
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
@ -16,13 +16,13 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
import org.citra.citra_emu.model.GameDatabase;
|
import org.yuzu.yuzu_emu.model.GameDatabase;
|
||||||
import org.citra.citra_emu.ui.DividerItemDecoration;
|
import org.yuzu.yuzu_emu.ui.DividerItemDecoration;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
import org.citra.citra_emu.utils.PicassoUtils;
|
import org.yuzu.yuzu_emu.utils.PicassoUtils;
|
||||||
import org.citra.citra_emu.viewholders.GameViewHolder;
|
import org.yuzu.yuzu_emu.viewholders.GameViewHolder;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -99,7 +99,7 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
|
|||||||
holder.regions = mCursor.getString(GameDatabase.GAME_COLUMN_REGIONS);
|
holder.regions = mCursor.getString(GameDatabase.GAME_COLUMN_REGIONS);
|
||||||
holder.company = mCursor.getString(GameDatabase.GAME_COLUMN_COMPANY);
|
holder.company = mCursor.getString(GameDatabase.GAME_COLUMN_COMPANY);
|
||||||
|
|
||||||
final int backgroundColorId = isValidGame(holder.path) ? R.color.card_view_background : R.color.card_view_disabled;
|
final int backgroundColorId = isValidGame(holder.path) ? R.color.view_background : R.color.view_disabled;
|
||||||
View itemView = holder.getItemView();
|
View itemView = holder.getItemView();
|
||||||
itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), backgroundColorId));
|
itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), backgroundColorId));
|
||||||
} else {
|
} else {
|
@ -2,7 +2,7 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
package org.citra.citra_emu.applets;
|
package org.yuzu.yuzu_emu.applets;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -19,11 +19,11 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -107,14 +107,14 @@ public final class SoftwareKeyboard {
|
|||||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.leftMargin = params.rightMargin =
|
params.leftMargin = params.rightMargin =
|
||||||
CitraApplication.getAppContext().getResources().getDimensionPixelSize(
|
YuzuApplication.getAppContext().getResources().getDimensionPixelSize(
|
||||||
R.dimen.dialog_margin);
|
R.dimen.dialog_margin);
|
||||||
|
|
||||||
KeyboardConfig config = Objects.requireNonNull(
|
KeyboardConfig config = Objects.requireNonNull(
|
||||||
(KeyboardConfig) Objects.requireNonNull(getArguments()).getSerializable("config"));
|
(KeyboardConfig) Objects.requireNonNull(getArguments()).getSerializable("config"));
|
||||||
|
|
||||||
// Set up the input
|
// Set up the input
|
||||||
EditText editText = new EditText(CitraApplication.getAppContext());
|
EditText editText = new EditText(YuzuApplication.getAppContext());
|
||||||
editText.setHint(config.hint_text);
|
editText.setHint(config.hint_text);
|
||||||
editText.setSingleLine(!config.multiline_mode);
|
editText.setSingleLine(!config.multiline_mode);
|
||||||
editText.setLayoutParams(params);
|
editText.setLayoutParams(params);
|
||||||
@ -254,7 +254,7 @@ public final class SoftwareKeyboard {
|
|||||||
|
|
||||||
public static void ShowError(String error) {
|
public static void ShowError(String error) {
|
||||||
NativeLibrary.displayAlertMsg(
|
NativeLibrary.displayAlertMsg(
|
||||||
CitraApplication.getAppContext().getResources().getString(R.string.software_keyboard),
|
YuzuApplication.getAppContext().getResources().getString(R.string.software_keyboard),
|
||||||
error, false);
|
error, false);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.dialogs;
|
package org.yuzu.yuzu_emu.dialogs;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.InputDevice;
|
import android.view.InputDevice;
|
||||||
@ -8,8 +8,8 @@ import android.view.MotionEvent;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
public final class BooleanSetting extends Setting {
|
public final class BooleanSetting extends Setting {
|
||||||
private boolean mValue;
|
private boolean mValue;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
public final class FloatSetting extends Setting {
|
public final class FloatSetting extends Setting {
|
||||||
private float mValue;
|
private float mValue;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
public final class IntSetting extends Setting {
|
public final class IntSetting extends Setting {
|
||||||
private int mValue;
|
private int mValue;
|
@ -1,7 +1,7 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction for a setting item as read from / written to Citra's configuration ini files.
|
* Abstraction for a setting item as read from / written to yuzu's configuration ini files.
|
||||||
* These files generally consist of a key/value pair, though the type of value is ambiguous and
|
* These files generally consist of a key/value pair, though the type of value is ambiguous and
|
||||||
* must be inferred at read-time. The type of value determines which child of this class is used
|
* must be inferred at read-time. The type of value determines which child of this class is used
|
||||||
* to represent the Setting.
|
* to represent the Setting.
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsActivityView;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivityView;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -17,7 +17,6 @@ public class Settings {
|
|||||||
public static final String SECTION_PREMIUM = "Premium";
|
public static final String SECTION_PREMIUM = "Premium";
|
||||||
public static final String SECTION_CORE = "Core";
|
public static final String SECTION_CORE = "Core";
|
||||||
public static final String SECTION_SYSTEM = "System";
|
public static final String SECTION_SYSTEM = "System";
|
||||||
public static final String SECTION_CAMERA = "Camera";
|
|
||||||
public static final String SECTION_CONTROLS = "Controls";
|
public static final String SECTION_CONTROLS = "Controls";
|
||||||
public static final String SECTION_RENDERER = "Renderer";
|
public static final String SECTION_RENDERER = "Renderer";
|
||||||
public static final String SECTION_LAYOUT = "Layout";
|
public static final String SECTION_LAYOUT = "Layout";
|
||||||
@ -30,7 +29,7 @@ public class Settings {
|
|||||||
private static final Map<String, List<String>> configFileSectionsMap = new HashMap<>();
|
private static final Map<String, List<String>> configFileSectionsMap = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
configFileSectionsMap.put(SettingsFile.FILE_NAME_CONFIG, Arrays.asList(SECTION_PREMIUM, SECTION_CORE, SECTION_SYSTEM, SECTION_CAMERA, SECTION_CONTROLS, SECTION_RENDERER, SECTION_LAYOUT, SECTION_UTILITY, SECTION_AUDIO, SECTION_DEBUG));
|
configFileSectionsMap.put(SettingsFile.FILE_NAME_CONFIG, Arrays.asList(SECTION_PREMIUM, SECTION_CORE, SECTION_SYSTEM, SECTION_CONTROLS, SECTION_RENDERER, SECTION_LAYOUT, SECTION_UTILITY, SECTION_AUDIO, SECTION_DEBUG));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,7 +108,7 @@ public class Settings {
|
|||||||
|
|
||||||
public void saveSettings(SettingsActivityView view) {
|
public void saveSettings(SettingsActivityView view) {
|
||||||
if (TextUtils.isEmpty(gameId)) {
|
if (TextUtils.isEmpty(gameId)) {
|
||||||
view.showToastMessage(CitraApplication.getAppContext().getString(R.string.ini_saved), false);
|
view.showToastMessage(YuzuApplication.getAppContext().getString(R.string.ini_saved), false);
|
||||||
|
|
||||||
for (Map.Entry<String, List<String>> entry : configFileSectionsMap.entrySet()) {
|
for (Map.Entry<String, List<String>> entry : configFileSectionsMap.entrySet()) {
|
||||||
String fileName = entry.getKey();
|
String fileName = entry.getKey();
|
||||||
@ -123,7 +122,7 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// custom game settings
|
// custom game settings
|
||||||
view.showToastMessage(CitraApplication.getAppContext().getString(R.string.gameid_saved, gameId), false);
|
view.showToastMessage(YuzuApplication.getAppContext().getString(R.string.gameid_saved, gameId), false);
|
||||||
|
|
||||||
SettingsFile.saveCustomGameSettings(gameId, sections);
|
SettingsFile.saveCustomGameSettings(gameId, sections);
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model;
|
package org.yuzu.yuzu_emu.features.settings.model;
|
||||||
|
|
||||||
public final class StringSetting extends Setting {
|
public final class StringSetting extends Setting {
|
||||||
private String mValue;
|
private String mValue;
|
@ -1,11 +1,11 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.BooleanSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.BooleanSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.IntSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsFragmentView;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragmentView;
|
||||||
|
|
||||||
public final class CheckBoxSetting extends SettingsItem {
|
public final class CheckBoxSetting extends SettingsItem {
|
||||||
private boolean mDefaultValue;
|
private boolean mDefaultValue;
|
||||||
@ -59,7 +59,7 @@ public final class CheckBoxSetting extends SettingsItem {
|
|||||||
public IntSetting setChecked(boolean checked) {
|
public IntSetting setChecked(boolean checked) {
|
||||||
// Show a performance warning if the setting has been disabled
|
// Show a performance warning if the setting has been disabled
|
||||||
if (mShowPerformanceWarning && !checked) {
|
if (mShowPerformanceWarning && !checked) {
|
||||||
mView.showToastMessage(CitraApplication.getAppContext().getString(R.string.performance_warning), true);
|
mView.showToastMessage(YuzuApplication.getAppContext().getString(R.string.performance_warning), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSetting() == null) {
|
if (getSetting() == null) {
|
@ -1,7 +1,7 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||||
|
|
||||||
public final class DateTimeSetting extends SettingsItem {
|
public final class DateTimeSetting extends SettingsItem {
|
||||||
private String mDefaultValue;
|
private String mDefaultValue;
|
@ -1,6 +1,6 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
|
|
||||||
public final class HeaderSetting extends SettingsItem {
|
public final class HeaderSetting extends SettingsItem {
|
||||||
public HeaderSetting(String key, Setting setting, int titleId, int descriptionId) {
|
public HeaderSetting(String key, Setting setting, int titleId, int descriptionId) {
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
@ -6,12 +6,12 @@ import android.view.InputDevice;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
|
|
||||||
public final class InputBindingSetting extends SettingsItem {
|
public final class InputBindingSetting extends SettingsItem {
|
||||||
private static final String INPUT_MAPPING_PREFIX = "InputMapping";
|
private static final String INPUT_MAPPING_PREFIX = "InputMapping";
|
||||||
@ -108,7 +108,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Citra button code for the settings key.
|
* Returns the yuzu button code for the settings key.
|
||||||
*/
|
*/
|
||||||
private int getButtonCode() {
|
private int getButtonCode() {
|
||||||
switch (getKey()) {
|
switch (getKey()) {
|
||||||
@ -145,7 +145,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the settings key for the specified Citra button code.
|
* Returns the settings key for the specified yuzu button code.
|
||||||
*/
|
*/
|
||||||
private static String getButtonKey(int buttonCode) {
|
private static String getButtonKey(int buttonCode) {
|
||||||
switch (buttonCode) {
|
switch (buttonCode) {
|
||||||
@ -201,7 +201,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
*/
|
*/
|
||||||
public void removeOldMapping() {
|
public void removeOldMapping() {
|
||||||
// Get preferences editor
|
// Get preferences editor
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
// Try remove all possible keys we wrote for this setting
|
// Try remove all possible keys we wrote for this setting
|
||||||
@ -250,7 +250,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
*/
|
*/
|
||||||
private void WriteButtonMapping(String key) {
|
private void WriteButtonMapping(String key) {
|
||||||
// Get preferences editor
|
// Get preferences editor
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
// Remove mapping for another setting using this input
|
// Remove mapping for another setting using this input
|
||||||
@ -278,7 +278,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
*/
|
*/
|
||||||
private void WriteAxisMapping(int axis, int value) {
|
private void WriteAxisMapping(int axis, int value) {
|
||||||
// Get preferences editor
|
// Get preferences editor
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
// Cleanup old mapping
|
// Cleanup old mapping
|
||||||
@ -302,7 +302,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
*/
|
*/
|
||||||
public void onKeyInput(KeyEvent keyEvent) {
|
public void onKeyInput(KeyEvent keyEvent) {
|
||||||
if (!IsButtonMappingSupported()) {
|
if (!IsButtonMappingSupported()) {
|
||||||
Toast.makeText(CitraApplication.getAppContext(), R.string.input_message_analog_only, Toast.LENGTH_LONG).show();
|
Toast.makeText(YuzuApplication.getAppContext(), R.string.input_message_analog_only, Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,11 +324,11 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
public void onMotionInput(InputDevice device, InputDevice.MotionRange motionRange,
|
public void onMotionInput(InputDevice device, InputDevice.MotionRange motionRange,
|
||||||
char axisDir) {
|
char axisDir) {
|
||||||
if (!IsAxisMappingSupported()) {
|
if (!IsAxisMappingSupported()) {
|
||||||
Toast.makeText(CitraApplication.getAppContext(), R.string.input_message_button_only, Toast.LENGTH_LONG).show();
|
Toast.makeText(YuzuApplication.getAppContext(), R.string.input_message_button_only, Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
int button;
|
int button;
|
||||||
@ -354,7 +354,7 @@ public final class InputBindingSetting extends SettingsItem {
|
|||||||
* Sets the string to use in the configuration UI for the gamepad input.
|
* Sets the string to use in the configuration UI for the gamepad input.
|
||||||
*/
|
*/
|
||||||
private StringSetting setUiString(String ui) {
|
private StringSetting setUiString(String ui) {
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
if (getSetting() == null) {
|
if (getSetting() == null) {
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
public final class PremiumHeader extends SettingsItem {
|
public final class PremiumHeader extends SettingsItem {
|
||||||
public PremiumHeader() {
|
public PremiumHeader() {
|
@ -1,12 +1,12 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsFragmentView;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragmentView;
|
||||||
|
|
||||||
public final class PremiumSingleChoiceSetting extends SettingsItem {
|
public final class PremiumSingleChoiceSetting extends SettingsItem {
|
||||||
private int mDefaultValue;
|
private int mDefaultValue;
|
||||||
@ -15,7 +15,7 @@ public final class PremiumSingleChoiceSetting extends SettingsItem {
|
|||||||
private int mValuesId;
|
private int mValuesId;
|
||||||
private SettingsFragmentView mView;
|
private SettingsFragmentView mView;
|
||||||
|
|
||||||
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
|
|
||||||
public PremiumSingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
public PremiumSingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
||||||
int choicesId, int valuesId, int defaultValue, Setting setting, SettingsFragmentView view) {
|
int choicesId, int valuesId, int defaultValue, Setting setting, SettingsFragmentView view) {
|
||||||
@ -49,7 +49,7 @@ public final class PremiumSingleChoiceSetting extends SettingsItem {
|
|||||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
editor.putInt(getKey(), selection);
|
editor.putInt(getKey(), selection);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
mView.showToastMessage(CitraApplication.getAppContext().getString(R.string.design_updated), false);
|
mView.showToastMessage(YuzuApplication.getAppContext().getString(R.string.design_updated), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,8 +1,8 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ViewModel abstraction for an Item in the RecyclerView powering SettingsFragments.
|
* ViewModel abstraction for an Item in the RecyclerView powering SettingsFragments.
|
@ -1,7 +1,7 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.IntSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
|
|
||||||
public final class SingleChoiceSetting extends SettingsItem {
|
public final class SingleChoiceSetting extends SettingsItem {
|
||||||
private int mDefaultValue;
|
private int mDefaultValue;
|
@ -1,9 +1,9 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.FloatSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.FloatSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.IntSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
public final class SliderSetting extends SettingsItem {
|
public final class SliderSetting extends SettingsItem {
|
||||||
private int mMin;
|
private int mMin;
|
@ -1,7 +1,7 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||||
|
|
||||||
public class StringSingleChoiceSetting extends SettingsItem {
|
public class StringSingleChoiceSetting extends SettingsItem {
|
||||||
private String mDefaultValue;
|
private String mDefaultValue;
|
@ -1,6 +1,6 @@
|
|||||||
package org.citra.citra_emu.features.settings.model.view;
|
package org.yuzu.yuzu_emu.features.settings.model.view;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
|
|
||||||
public final class SubmenuSetting extends SettingsItem {
|
public final class SubmenuSetting extends SettingsItem {
|
||||||
private String mMenuKey;
|
private String mMenuKey;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -15,11 +15,11 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization;
|
||||||
import org.citra.citra_emu.utils.DirectoryStateReceiver;
|
import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver;
|
||||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
|
||||||
|
|
||||||
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView {
|
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView {
|
||||||
private static final String ARG_MENU_TAG = "menu_tag";
|
private static final String ARG_MENU_TAG = "menu_tag";
|
||||||
@ -172,17 +172,17 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.citra.citra_emu.features.settings.model.Settings getSettings() {
|
public org.yuzu.yuzu_emu.features.settings.model.Settings getSettings() {
|
||||||
return mPresenter.getSettings();
|
return mPresenter.getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSettings(org.citra.citra_emu.features.settings.model.Settings settings) {
|
public void setSettings(org.yuzu.yuzu_emu.features.settings.model.Settings settings) {
|
||||||
mPresenter.setSettings(settings);
|
mPresenter.setSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSettingsFileLoaded(org.citra.citra_emu.features.settings.model.Settings settings) {
|
public void onSettingsFileLoaded(org.yuzu.yuzu_emu.features.settings.model.Settings settings) {
|
||||||
SettingsFragmentView fragment = getFragment();
|
SettingsFragmentView fragment = getFragment();
|
||||||
|
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
@ -1,17 +1,17 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization.DirectoryInitializationState;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState;
|
||||||
import org.citra.citra_emu.utils.DirectoryStateReceiver;
|
import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
import org.citra.citra_emu.utils.ThemeUtil;
|
import org.yuzu.yuzu_emu.utils.ThemeUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public final class SettingsActivityPresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
prepareCitraDirectoriesIfNeeded();
|
prepareDirectoriesIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadSettingsUI() {
|
void loadSettingsUI() {
|
||||||
@ -59,12 +59,13 @@ public final class SettingsActivityPresenter {
|
|||||||
mView.onSettingsFileLoaded(mSettings);
|
mView.onSettingsFileLoaded(mSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareCitraDirectoriesIfNeeded() {
|
private void prepareDirectoriesIfNeeded() {
|
||||||
File configFile = new File(DirectoryInitialization.getUserDirectory() + "/config/" + SettingsFile.FILE_NAME_CONFIG + ".ini");
|
File configFile = new File(DirectoryInitialization.getUserDirectory() + "/config/" + SettingsFile.FILE_NAME_CONFIG + ".ini");
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
Log.error("Citra config file could not be found!");
|
Log.error(DirectoryInitialization.getUserDirectory() + "/config/" + SettingsFile.FILE_NAME_CONFIG + ".ini");
|
||||||
|
Log.error("yuzu config file could not be found!");
|
||||||
}
|
}
|
||||||
if (DirectoryInitialization.areCitraDirectoriesReady()) {
|
if (DirectoryInitialization.areDirectoriesReady()) {
|
||||||
loadSettingsUI();
|
loadSettingsUI();
|
||||||
} else {
|
} else {
|
||||||
mView.showLoading();
|
mView.showLoading();
|
||||||
@ -74,7 +75,7 @@ public final class SettingsActivityPresenter {
|
|||||||
directoryStateReceiver =
|
directoryStateReceiver =
|
||||||
new DirectoryStateReceiver(directoryInitializationState ->
|
new DirectoryStateReceiver(directoryInitializationState ->
|
||||||
{
|
{
|
||||||
if (directoryInitializationState == DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED) {
|
if (directoryInitializationState == DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED) {
|
||||||
mView.hideLoading();
|
mView.hideLoading();
|
||||||
loadSettingsUI();
|
loadSettingsUI();
|
||||||
} else if (directoryInitializationState == DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED) {
|
} else if (directoryInitializationState == DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED) {
|
@ -1,9 +1,9 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.utils.DirectoryStateReceiver;
|
import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction for the Activity that manages SettingsFragments.
|
* Abstraction for the Activity that manages SettingsFragments.
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -13,31 +13,31 @@ import android.widget.TimePicker;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.dialogs.MotionAlertDialog;
|
import org.yuzu.yuzu_emu.dialogs.MotionAlertDialog;
|
||||||
import org.citra.citra_emu.features.settings.model.FloatSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.FloatSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.IntSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.CheckBoxSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.DateTimeSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.PremiumSingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.PremiumSingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SliderSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.StringSingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.StringSingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SubmenuSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.CheckBoxSettingViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.CheckBoxSettingViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.DateTimeViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.DateTimeViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.HeaderViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.HeaderViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.InputBindingSettingViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.InputBindingSettingViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.PremiumViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.PremiumViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.SettingViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SettingViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.SingleChoiceViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SingleChoiceViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.SliderViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SliderViewHolder;
|
||||||
import org.citra.citra_emu.features.settings.ui.viewholder.SubmenuViewHolder;
|
import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SubmenuViewHolder;
|
||||||
import org.citra.citra_emu.ui.main.MainActivity;
|
import org.yuzu.yuzu_emu.ui.main.MainActivity;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -12,11 +12,11 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.ui.DividerItemDecoration;
|
import org.yuzu.yuzu_emu.ui.DividerItemDecoration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -7,24 +7,24 @@ import android.hardware.camera2.CameraCharacteristics;
|
|||||||
import android.hardware.camera2.CameraManager;
|
import android.hardware.camera2.CameraManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.SettingSection;
|
import org.yuzu.yuzu_emu.features.settings.model.SettingSection;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.CheckBoxSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.DateTimeSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.HeaderSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.HeaderSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.PremiumHeader;
|
import org.yuzu.yuzu_emu.features.settings.model.view.PremiumHeader;
|
||||||
import org.citra.citra_emu.features.settings.model.view.PremiumSingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.PremiumSingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SliderSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.StringSingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.StringSingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SubmenuSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -115,9 +115,6 @@ public final class SettingsFragmentPresenter {
|
|||||||
case Settings.SECTION_SYSTEM:
|
case Settings.SECTION_SYSTEM:
|
||||||
addSystemSettings(sl);
|
addSystemSettings(sl);
|
||||||
break;
|
break;
|
||||||
case Settings.SECTION_CAMERA:
|
|
||||||
addCameraSettings(sl);
|
|
||||||
break;
|
|
||||||
case Settings.SECTION_CONTROLS:
|
case Settings.SECTION_CONTROLS:
|
||||||
addInputSettings(sl);
|
addInputSettings(sl);
|
||||||
break;
|
break;
|
||||||
@ -145,7 +142,6 @@ public final class SettingsFragmentPresenter {
|
|||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_premium, 0, Settings.SECTION_PREMIUM));
|
sl.add(new SubmenuSetting(null, null, R.string.preferences_premium, 0, Settings.SECTION_PREMIUM));
|
||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_general, 0, Settings.SECTION_CORE));
|
sl.add(new SubmenuSetting(null, null, R.string.preferences_general, 0, Settings.SECTION_CORE));
|
||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_system, 0, Settings.SECTION_SYSTEM));
|
sl.add(new SubmenuSetting(null, null, R.string.preferences_system, 0, Settings.SECTION_SYSTEM));
|
||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_camera, 0, Settings.SECTION_CAMERA));
|
|
||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_controls, 0, Settings.SECTION_CONTROLS));
|
sl.add(new SubmenuSetting(null, null, R.string.preferences_controls, 0, Settings.SECTION_CONTROLS));
|
||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_graphics, 0, Settings.SECTION_RENDERER));
|
sl.add(new SubmenuSetting(null, null, R.string.preferences_graphics, 0, Settings.SECTION_RENDERER));
|
||||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_audio, 0, Settings.SECTION_AUDIO));
|
sl.add(new SubmenuSetting(null, null, R.string.preferences_audio, 0, Settings.SECTION_AUDIO));
|
||||||
@ -197,96 +193,6 @@ public final class SettingsFragmentPresenter {
|
|||||||
sl.add(new DateTimeSetting(SettingsFile.KEY_INIT_TIME, Settings.SECTION_SYSTEM, R.string.init_time, R.string.init_time_description, "2000-01-01 00:00:01", dateTime));
|
sl.add(new DateTimeSetting(SettingsFile.KEY_INIT_TIME, Settings.SECTION_SYSTEM, R.string.init_time, R.string.init_time_description, "2000-01-01 00:00:01", dateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCameraSettings(ArrayList<SettingsItem> sl) {
|
|
||||||
final Activity activity = mView.getActivity();
|
|
||||||
activity.setTitle(R.string.preferences_camera);
|
|
||||||
|
|
||||||
// Get the camera IDs
|
|
||||||
CameraManager cameraManager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
|
|
||||||
ArrayList<String> supportedCameraNameList = new ArrayList<>();
|
|
||||||
ArrayList<String> supportedCameraIdList = new ArrayList<>();
|
|
||||||
if (cameraManager != null) {
|
|
||||||
try {
|
|
||||||
for (String id : cameraManager.getCameraIdList()) {
|
|
||||||
final CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
|
|
||||||
if (Objects.requireNonNull(characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)) == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
|
|
||||||
continue; // Legacy cameras cannot be used with the NDK
|
|
||||||
}
|
|
||||||
|
|
||||||
supportedCameraIdList.add(id);
|
|
||||||
|
|
||||||
final int facing = Objects.requireNonNull(characteristics.get(CameraCharacteristics.LENS_FACING));
|
|
||||||
int stringId = R.string.camera_facing_external;
|
|
||||||
switch (facing) {
|
|
||||||
case CameraCharacteristics.LENS_FACING_FRONT:
|
|
||||||
stringId = R.string.camera_facing_front;
|
|
||||||
break;
|
|
||||||
case CameraCharacteristics.LENS_FACING_BACK:
|
|
||||||
stringId = R.string.camera_facing_back;
|
|
||||||
break;
|
|
||||||
case CameraCharacteristics.LENS_FACING_EXTERNAL:
|
|
||||||
stringId = R.string.camera_facing_external;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
supportedCameraNameList.add(String.format("%1$s (%2$s)", id, activity.getString(stringId)));
|
|
||||||
}
|
|
||||||
} catch (CameraAccessException e) {
|
|
||||||
Log.error("Couldn't retrieve camera list");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the names and values for display
|
|
||||||
ArrayList<String> cameraDeviceNameList = new ArrayList<>(Arrays.asList(activity.getResources().getStringArray(R.array.cameraDeviceNames)));
|
|
||||||
cameraDeviceNameList.addAll(supportedCameraNameList);
|
|
||||||
ArrayList<String> cameraDeviceValueList = new ArrayList<>(Arrays.asList(activity.getResources().getStringArray(R.array.cameraDeviceValues)));
|
|
||||||
cameraDeviceValueList.addAll(supportedCameraIdList);
|
|
||||||
|
|
||||||
final String[] cameraDeviceNames = cameraDeviceNameList.toArray(new String[]{});
|
|
||||||
final String[] cameraDeviceValues = cameraDeviceValueList.toArray(new String[]{});
|
|
||||||
|
|
||||||
final boolean haveCameraDevices = !supportedCameraIdList.isEmpty();
|
|
||||||
|
|
||||||
String[] imageSourceNames = activity.getResources().getStringArray(R.array.cameraImageSourceNames);
|
|
||||||
String[] imageSourceValues = activity.getResources().getStringArray(R.array.cameraImageSourceValues);
|
|
||||||
if (!haveCameraDevices) {
|
|
||||||
// Remove the last entry (ndk / Device Camera)
|
|
||||||
imageSourceNames = Arrays.copyOfRange(imageSourceNames, 0, imageSourceNames.length - 1);
|
|
||||||
imageSourceValues = Arrays.copyOfRange(imageSourceValues, 0, imageSourceValues.length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String defaultImageSource = haveCameraDevices ? "ndk" : "image";
|
|
||||||
|
|
||||||
SettingSection cameraSection = mSettings.getSection(Settings.SECTION_CAMERA);
|
|
||||||
|
|
||||||
Setting innerCameraImageSource = cameraSection.getSetting(SettingsFile.KEY_CAMERA_INNER_NAME);
|
|
||||||
Setting innerCameraConfig = asStringSetting(cameraSection.getSetting(SettingsFile.KEY_CAMERA_INNER_CONFIG));
|
|
||||||
Setting innerCameraFlip = cameraSection.getSetting(SettingsFile.KEY_CAMERA_INNER_FLIP);
|
|
||||||
sl.add(new HeaderSetting(null, null, R.string.inner_camera, 0));
|
|
||||||
sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_INNER_NAME, Settings.SECTION_CAMERA, R.string.image_source, R.string.image_source_description, imageSourceNames, imageSourceValues, defaultImageSource, innerCameraImageSource));
|
|
||||||
if (haveCameraDevices)
|
|
||||||
sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_INNER_CONFIG, Settings.SECTION_CAMERA, R.string.camera_device, R.string.camera_device_description, cameraDeviceNames, cameraDeviceValues, "_front", innerCameraConfig));
|
|
||||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_CAMERA_INNER_FLIP, Settings.SECTION_CAMERA, R.string.image_flip, 0, R.array.cameraFlipNames, R.array.cameraFlipValues, 0, innerCameraFlip));
|
|
||||||
|
|
||||||
Setting outerLeftCameraImageSource = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_NAME);
|
|
||||||
Setting outerLeftCameraConfig = asStringSetting(cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_CONFIG));
|
|
||||||
Setting outerLeftCameraFlip = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_FLIP);
|
|
||||||
sl.add(new HeaderSetting(null, null, R.string.outer_left_camera, 0));
|
|
||||||
sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_NAME, Settings.SECTION_CAMERA, R.string.image_source, R.string.image_source_description, imageSourceNames, imageSourceValues, defaultImageSource, outerLeftCameraImageSource));
|
|
||||||
if (haveCameraDevices)
|
|
||||||
sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_CONFIG, Settings.SECTION_CAMERA, R.string.camera_device, R.string.camera_device_description, cameraDeviceNames, cameraDeviceValues, "_back", outerLeftCameraConfig));
|
|
||||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_FLIP, Settings.SECTION_CAMERA, R.string.image_flip, 0, R.array.cameraFlipNames, R.array.cameraFlipValues, 0, outerLeftCameraFlip));
|
|
||||||
|
|
||||||
Setting outerRightCameraImageSource = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_NAME);
|
|
||||||
Setting outerRightCameraConfig = asStringSetting(cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_CONFIG));
|
|
||||||
Setting outerRightCameraFlip = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_FLIP);
|
|
||||||
sl.add(new HeaderSetting(null, null, R.string.outer_right_camera, 0));
|
|
||||||
sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_NAME, Settings.SECTION_CAMERA, R.string.image_source, R.string.image_source_description, imageSourceNames, imageSourceValues, defaultImageSource, outerRightCameraImageSource));
|
|
||||||
if (haveCameraDevices)
|
|
||||||
sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_CONFIG, Settings.SECTION_CAMERA, R.string.camera_device, R.string.camera_device_description, cameraDeviceNames, cameraDeviceValues, "_back", outerRightCameraConfig));
|
|
||||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_FLIP, Settings.SECTION_CAMERA, R.string.image_flip, 0, R.array.cameraFlipNames, R.array.cameraFlipValues, 0, outerRightCameraFlip));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addInputSettings(ArrayList<SettingsItem> sl) {
|
private void addInputSettings(ArrayList<SettingsItem> sl) {
|
||||||
mView.getActivity().setTitle(R.string.preferences_controls);
|
mView.getActivity().setTitle(R.string.preferences_controls);
|
||||||
|
|
||||||
@ -382,7 +288,7 @@ public final class SettingsFragmentPresenter {
|
|||||||
sl.add(new HeaderSetting(null, null, R.string.utility, 0));
|
sl.add(new HeaderSetting(null, null, R.string.utility, 0));
|
||||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_DUMP_TEXTURES, Settings.SECTION_UTILITY, R.string.dump_textures, R.string.dump_textures_description, false, dumpTextures));
|
sl.add(new CheckBoxSetting(SettingsFile.KEY_DUMP_TEXTURES, Settings.SECTION_UTILITY, R.string.dump_textures, R.string.dump_textures_description, false, dumpTextures));
|
||||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_CUSTOM_TEXTURES, Settings.SECTION_UTILITY, R.string.custom_textures, R.string.custom_textures_description, false, customTextures));
|
sl.add(new CheckBoxSetting(SettingsFile.KEY_CUSTOM_TEXTURES, Settings.SECTION_UTILITY, R.string.custom_textures, R.string.custom_textures_description, false, customTextures));
|
||||||
//Disabled until custom texture implementation gets rewrite, current one overloads RAM and crashes Citra.
|
//Disabled until custom texture implementation gets rewrite, current one overloads RAM and crashes yuzu.
|
||||||
//sl.add(new CheckBoxSetting(SettingsFile.KEY_PRELOAD_TEXTURES, Settings.SECTION_UTILITY, R.string.preload_textures, R.string.preload_textures_description, false, preloadTextures));
|
//sl.add(new CheckBoxSetting(SettingsFile.KEY_PRELOAD_TEXTURES, Settings.SECTION_UTILITY, R.string.preload_textures, R.string.preload_textures_description, false, preloadTextures));
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui;
|
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
@ -1,13 +1,13 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.CheckBoxSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
public final class CheckBoxSettingViewHolder extends SettingViewHolder {
|
public final class CheckBoxSettingViewHolder extends SettingViewHolder {
|
||||||
private CheckBoxSetting mItem;
|
private CheckBoxSetting mItem;
|
@ -1,13 +1,13 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.DateTimeSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
public final class DateTimeViewHolder extends SettingViewHolder {
|
public final class DateTimeViewHolder extends SettingViewHolder {
|
||||||
private DateTimeSetting mItem;
|
private DateTimeSetting mItem;
|
@ -1,11 +1,11 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
public final class HeaderViewHolder extends SettingViewHolder {
|
public final class HeaderViewHolder extends SettingViewHolder {
|
||||||
private TextView mHeaderName;
|
private TextView mHeaderName;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -6,10 +6,10 @@ import android.preference.PreferenceManager;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.InputBindingSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
public final class InputBindingSettingViewHolder extends SettingViewHolder {
|
public final class InputBindingSettingViewHolder extends SettingViewHolder {
|
||||||
private InputBindingSetting mItem;
|
private InputBindingSetting mItem;
|
@ -1,13 +1,13 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsFragmentView;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragmentView;
|
||||||
import org.citra.citra_emu.ui.main.MainActivity;
|
import org.yuzu.yuzu_emu.ui.main.MainActivity;
|
||||||
|
|
||||||
public final class PremiumViewHolder extends SettingViewHolder {
|
public final class PremiumViewHolder extends SettingViewHolder {
|
||||||
private TextView mHeaderName;
|
private TextView mHeaderName;
|
@ -1,11 +1,11 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.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;
|
private SettingsAdapter mAdapter;
|
@ -1,15 +1,15 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.PremiumSingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.PremiumSingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.view.StringSingleChoiceSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.StringSingleChoiceSetting;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
public final class SingleChoiceViewHolder extends SettingViewHolder {
|
public final class SingleChoiceViewHolder extends SettingViewHolder {
|
||||||
private SettingsItem mItem;
|
private SettingsItem mItem;
|
@ -1,12 +1,12 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SliderSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
public final class SliderViewHolder extends SettingViewHolder {
|
public final class SliderViewHolder extends SettingViewHolder {
|
||||||
private SliderSetting mItem;
|
private SliderSetting mItem;
|
@ -1,12 +1,12 @@
|
|||||||
package org.citra.citra_emu.features.settings.ui.viewholder;
|
package org.yuzu.yuzu_emu.features.settings.ui.viewholder;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SettingsItem;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||||
import org.citra.citra_emu.features.settings.model.view.SubmenuSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsAdapter;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter;
|
||||||
|
|
||||||
public final class SubmenuViewHolder extends SettingViewHolder {
|
public final class SubmenuViewHolder extends SettingViewHolder {
|
||||||
private SubmenuSetting mItem;
|
private SubmenuSetting mItem;
|
@ -1,20 +1,20 @@
|
|||||||
package org.citra.citra_emu.features.settings.utils;
|
package org.yuzu.yuzu_emu.features.settings.utils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.FloatSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.FloatSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.IntSetting;
|
||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.SettingSection;
|
import org.yuzu.yuzu_emu.features.settings.model.SettingSection;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsActivityView;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivityView;
|
||||||
import org.citra.citra_emu.utils.BiMap;
|
import org.yuzu.yuzu_emu.utils.BiMap;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
import org.ini4j.Wini;
|
import org.ini4j.Wini;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -164,11 +164,11 @@ public final class SettingsFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.error("[SettingsFile] File not found: " + ini.getAbsolutePath() + e.getMessage());
|
Log.error("[SettingsFile] File not found: " + e.getMessage());
|
||||||
if (view != null)
|
if (view != null)
|
||||||
view.onSettingsFileNotFound();
|
view.onSettingsFileNotFound();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.error("[SettingsFile] Error reading from: " + ini.getAbsolutePath() + e.getMessage());
|
Log.error("[SettingsFile] Error reading from: " + e.getMessage());
|
||||||
if (view != null)
|
if (view != null)
|
||||||
view.onSettingsFileNotFound();
|
view.onSettingsFileNotFound();
|
||||||
} finally {
|
} finally {
|
||||||
@ -176,7 +176,7 @@ public final class SettingsFile {
|
|||||||
try {
|
try {
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.error("[SettingsFile] Error closing: " + ini.getAbsolutePath() + e.getMessage());
|
Log.error("[SettingsFile] Error closing: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ public final class SettingsFile {
|
|||||||
writer.store();
|
writer.store();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.error("[SettingsFile] File not found: " + fileName + ".ini: " + e.getMessage());
|
Log.error("[SettingsFile] File not found: " + fileName + ".ini: " + e.getMessage());
|
||||||
view.showToastMessage(CitraApplication.getAppContext().getString(R.string.error_saving, fileName, e.getMessage()), false);
|
view.showToastMessage(YuzuApplication.getAppContext().getString(R.string.error_saving, fileName, e.getMessage()), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.fragments;
|
package org.yuzu.yuzu_emu.fragments;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -14,7 +14,7 @@ import androidx.core.content.FileProvider;
|
|||||||
|
|
||||||
import com.nononsenseapps.filepicker.FilePickerFragment;
|
import com.nononsenseapps.filepicker.FilePickerFragment;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.fragments;
|
package org.yuzu.yuzu_emu.fragments;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
@ -22,15 +22,15 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
import org.citra.citra_emu.overlay.InputOverlay;
|
import org.yuzu.yuzu_emu.overlay.InputOverlay;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization.DirectoryInitializationState;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState;
|
||||||
import org.citra.citra_emu.utils.DirectoryStateReceiver;
|
import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver;
|
||||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
public final class EmulationFragment extends Fragment implements SurfaceHolder.Callback, Choreographer.FrameCallback {
|
public final class EmulationFragment extends Fragment implements SurfaceHolder.Callback, Choreographer.FrameCallback {
|
||||||
private static final String KEY_GAMEPATH = "gamepath";
|
private static final String KEY_GAMEPATH = "gamepath";
|
||||||
@ -118,10 +118,10 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Choreographer.getInstance().postFrameCallback(this);
|
Choreographer.getInstance().postFrameCallback(this);
|
||||||
if (DirectoryInitialization.areCitraDirectoriesReady()) {
|
if (DirectoryInitialization.areDirectoriesReady()) {
|
||||||
mEmulationState.run(activity.isActivityRecreated());
|
mEmulationState.run(activity.isActivityRecreated());
|
||||||
} else {
|
} else {
|
||||||
setupCitraDirectoriesThenStartEmulation();
|
setupDirectoriesThenStartEmulation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||||||
super.onDetach();
|
super.onDetach();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCitraDirectoriesThenStartEmulation() {
|
private void setupDirectoriesThenStartEmulation() {
|
||||||
IntentFilter statusIntentFilter = new IntentFilter(
|
IntentFilter statusIntentFilter = new IntentFilter(
|
||||||
DirectoryInitialization.BROADCAST_ACTION);
|
DirectoryInitialization.BROADCAST_ACTION);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||||||
new DirectoryStateReceiver(directoryInitializationState ->
|
new DirectoryStateReceiver(directoryInitializationState ->
|
||||||
{
|
{
|
||||||
if (directoryInitializationState ==
|
if (directoryInitializationState ==
|
||||||
DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED) {
|
DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED) {
|
||||||
mEmulationState.run(activity.isActivityRecreated());
|
mEmulationState.run(activity.isActivityRecreated());
|
||||||
} else if (directoryInitializationState ==
|
} else if (directoryInitializationState ==
|
||||||
DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED) {
|
DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED) {
|
@ -0,0 +1,129 @@
|
|||||||
|
package org.yuzu.yuzu_emu.fragments;
|
||||||
|
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.SparseIntArray;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.color.MaterialColors;
|
||||||
|
import com.google.android.material.elevation.ElevationOverlayProvider;
|
||||||
|
|
||||||
|
import org.yuzu.yuzu_emu.R;
|
||||||
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
|
|
||||||
|
|
||||||
|
public final class MenuFragment extends Fragment implements View.OnClickListener
|
||||||
|
{
|
||||||
|
private static final String KEY_TITLE = "title";
|
||||||
|
private static final String KEY_WII = "wii";
|
||||||
|
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||||
|
|
||||||
|
private int mCutInset = 0;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MenuFragment newInstance()
|
||||||
|
{
|
||||||
|
MenuFragment fragment = new MenuFragment();
|
||||||
|
|
||||||
|
Bundle arguments = new Bundle();
|
||||||
|
fragment.setArguments(arguments);
|
||||||
|
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is primarily intended to account for any navigation bar at the bottom of the screen
|
||||||
|
private int getBottomPaddingRequired()
|
||||||
|
{
|
||||||
|
Rect visibleFrame = new Rect();
|
||||||
|
requireActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleFrame);
|
||||||
|
return visibleFrame.bottom - visibleFrame.top - getResources().getDisplayMetrics().heightPixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
View rootView = inflater.inflate(R.layout.fragment_ingame_menu, container, false);
|
||||||
|
|
||||||
|
LinearLayout options = rootView.findViewById(R.id.layout_options);
|
||||||
|
|
||||||
|
// mPauseEmulation = options.findViewById(R.id.menu_pause_emulation);
|
||||||
|
// mUnpauseEmulation = options.findViewById(R.id.menu_unpause_emulation);
|
||||||
|
//
|
||||||
|
// updatePauseUnpauseVisibility();
|
||||||
|
//
|
||||||
|
// if (!requireActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN))
|
||||||
|
// {
|
||||||
|
// options.findViewById(R.id.menu_overlay_controls).setVisibility(View.GONE);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!getArguments().getBoolean(KEY_WII, true))
|
||||||
|
// {
|
||||||
|
// options.findViewById(R.id.menu_refresh_wiimotes).setVisibility(View.GONE);
|
||||||
|
// }
|
||||||
|
|
||||||
|
int bottomPaddingRequired = getBottomPaddingRequired();
|
||||||
|
|
||||||
|
// Provide a safe zone between the navigation bar and Exit Emulation to avoid accidental touches
|
||||||
|
float density = getResources().getDisplayMetrics().density;
|
||||||
|
if (bottomPaddingRequired >= 32 * density)
|
||||||
|
{
|
||||||
|
bottomPaddingRequired += 32 * density;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bottomPaddingRequired > rootView.getPaddingBottom())
|
||||||
|
{
|
||||||
|
rootView.setPadding(rootView.getPaddingLeft(), rootView.getPaddingTop(),
|
||||||
|
rootView.getPaddingRight(), bottomPaddingRequired);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int childIndex = 0; childIndex < options.getChildCount(); childIndex++)
|
||||||
|
{
|
||||||
|
Button button = (Button) options.getChildAt(childIndex);
|
||||||
|
|
||||||
|
button.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
rootView.findViewById(R.id.menu_exit).setOnClickListener(this);
|
||||||
|
|
||||||
|
// mTitleText = rootView.findViewById(R.id.text_game_title);
|
||||||
|
// String title = getArguments().getString(KEY_TITLE, null);
|
||||||
|
// if (title != null)
|
||||||
|
// {
|
||||||
|
// mTitleText.setText(title);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR)
|
||||||
|
{
|
||||||
|
// rootView.post(() -> NativeLibrary.SetObscuredPixelsLeft(rootView.getWidth()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View button)
|
||||||
|
{
|
||||||
|
int action = buttonsActionsMap.get(button.getId());
|
||||||
|
EmulationActivity activity = (EmulationActivity) requireActivity();
|
||||||
|
activity.handleMenuAction(action);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.model;
|
package org.yuzu.yuzu_emu.model;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.model;
|
package org.yuzu.yuzu_emu.model;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -6,8 +6,8 @@ import android.database.Cursor;
|
|||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.model;
|
package org.yuzu.yuzu_emu.model;
|
||||||
|
|
||||||
import android.content.ContentProvider;
|
import android.content.ContentProvider;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
@ -8,8 +8,8 @@ import android.net.Uri;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.citra.citra_emu.BuildConfig;
|
import org.yuzu.yuzu_emu.BuildConfig;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an interface allowing Activities to interact with the SQLite database.
|
* Provides an interface allowing Activities to interact with the SQLite database.
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu.overlay;
|
package org.yuzu.yuzu_emu.overlay;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -25,11 +25,11 @@ import android.view.SurfaceView;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
import org.citra.citra_emu.NativeLibrary.ButtonState;
|
import org.yuzu.yuzu_emu.NativeLibrary.ButtonState;
|
||||||
import org.citra.citra_emu.NativeLibrary.ButtonType;
|
import org.yuzu.yuzu_emu.NativeLibrary.ButtonType;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -117,7 +117,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener {
|
|||||||
* within a SharedPreferences instance so that those values can be retrieved here.
|
* within a SharedPreferences instance so that those values can be retrieved here.
|
||||||
* <p>
|
* <p>
|
||||||
* This has a few benefits over the conventional way of storing the values
|
* This has a few benefits over the conventional way of storing the values
|
||||||
* (ie. within the Citra ini file).
|
* (ie. within the yuzu ini file).
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>No native calls</li>
|
* <li>No native calls</li>
|
||||||
* <li>Keeps Android-only values inside the Android environment</li>
|
* <li>Keeps Android-only values inside the Android environment</li>
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu.overlay;
|
package org.yuzu.yuzu_emu.overlay;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu.overlay;
|
package org.yuzu.yuzu_emu.overlay;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu.overlay;
|
package org.yuzu.yuzu_emu.overlay;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@ -13,8 +13,8 @@ import android.graphics.Rect;
|
|||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary.ButtonType;
|
import org.yuzu.yuzu_emu.NativeLibrary.ButtonType;
|
||||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
import org.yuzu.yuzu_emu.utils.EmulationMenuSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom {@link BitmapDrawable} that is capable
|
* Custom {@link BitmapDrawable} that is capable
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.ui;
|
package org.yuzu.yuzu_emu.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.ui;
|
package org.yuzu.yuzu_emu.ui;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.ui.main;
|
package org.yuzu.yuzu_emu.ui.main;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@ -12,19 +12,19 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsActivity;
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity;
|
||||||
import org.citra.citra_emu.model.GameProvider;
|
import org.yuzu.yuzu_emu.model.GameProvider;
|
||||||
import org.citra.citra_emu.ui.platform.PlatformGamesFragment;
|
import org.yuzu.yuzu_emu.ui.platform.PlatformGamesFragment;
|
||||||
import org.citra.citra_emu.utils.AddDirectoryHelper;
|
import org.yuzu.yuzu_emu.utils.AddDirectoryHelper;
|
||||||
import org.citra.citra_emu.utils.BillingManager;
|
import org.yuzu.yuzu_emu.utils.BillingManager;
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization;
|
||||||
import org.citra.citra_emu.utils.FileBrowserHelper;
|
import org.yuzu.yuzu_emu.utils.FileBrowserHelper;
|
||||||
import org.citra.citra_emu.utils.PermissionsHandler;
|
import org.yuzu.yuzu_emu.utils.PermissionsHandler;
|
||||||
import org.citra.citra_emu.utils.PicassoUtils;
|
import org.yuzu.yuzu_emu.utils.PicassoUtils;
|
||||||
import org.citra.citra_emu.utils.StartupHandler;
|
import org.yuzu.yuzu_emu.utils.StartupHandler;
|
||||||
import org.citra.citra_emu.utils.ThemeUtil;
|
import org.yuzu.yuzu_emu.utils.ThemeUtil;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
@ -1,14 +1,14 @@
|
|||||||
package org.citra.citra_emu.ui.main;
|
package org.yuzu.yuzu_emu.ui.main;
|
||||||
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import org.citra.citra_emu.BuildConfig;
|
import org.yuzu.yuzu_emu.BuildConfig;
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
import org.citra.citra_emu.model.GameDatabase;
|
import org.yuzu.yuzu_emu.model.GameDatabase;
|
||||||
import org.citra.citra_emu.utils.AddDirectoryHelper;
|
import org.yuzu.yuzu_emu.utils.AddDirectoryHelper;
|
||||||
|
|
||||||
public final class MainPresenter {
|
public final class MainPresenter {
|
||||||
public static final int REQUEST_ADD_DIRECTORY = 1;
|
public static final int REQUEST_ADD_DIRECTORY = 1;
|
||||||
@ -75,7 +75,7 @@ public final class MainPresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refeshGameList() {
|
public void refeshGameList() {
|
||||||
GameDatabase databaseHelper = CitraApplication.databaseHelper;
|
GameDatabase databaseHelper = YuzuApplication.databaseHelper;
|
||||||
databaseHelper.scanLibrary(databaseHelper.getWritableDatabase());
|
databaseHelper.scanLibrary(databaseHelper.getWritableDatabase());
|
||||||
mView.refresh();
|
mView.refresh();
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.ui.main;
|
package org.yuzu.yuzu_emu.ui.main;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction for the screen that shows on application launch.
|
* Abstraction for the screen that shows on application launch.
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.ui.platform;
|
package org.yuzu.yuzu_emu.ui.platform;
|
||||||
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -13,10 +13,10 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.adapters.GameAdapter;
|
import org.yuzu.yuzu_emu.adapters.GameAdapter;
|
||||||
import org.citra.citra_emu.model.GameDatabase;
|
import org.yuzu.yuzu_emu.model.GameDatabase;
|
||||||
|
|
||||||
public final class PlatformGamesFragment extends Fragment implements PlatformGamesView {
|
public final class PlatformGamesFragment extends Fragment implements PlatformGamesView {
|
||||||
private PlatformGamesPresenter mPresenter = new PlatformGamesPresenter(this);
|
private PlatformGamesPresenter mPresenter = new PlatformGamesPresenter(this);
|
||||||
@ -54,7 +54,7 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
|
|||||||
// Add swipe down to refresh gesture
|
// Add swipe down to refresh gesture
|
||||||
final SwipeRefreshLayout pullToRefresh = view.findViewById(R.id.refresh_grid_games);
|
final SwipeRefreshLayout pullToRefresh = view.findViewById(R.id.refresh_grid_games);
|
||||||
pullToRefresh.setOnRefreshListener(() -> {
|
pullToRefresh.setOnRefreshListener(() -> {
|
||||||
GameDatabase databaseHelper = CitraApplication.databaseHelper;
|
GameDatabase databaseHelper = YuzuApplication.databaseHelper;
|
||||||
databaseHelper.scanLibrary(databaseHelper.getWritableDatabase());
|
databaseHelper.scanLibrary(databaseHelper.getWritableDatabase());
|
||||||
refresh();
|
refresh();
|
||||||
pullToRefresh.setRefreshing(false);
|
pullToRefresh.setRefreshing(false);
|
@ -1,9 +1,9 @@
|
|||||||
package org.citra.citra_emu.ui.platform;
|
package org.yuzu.yuzu_emu.ui.platform;
|
||||||
|
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.model.GameDatabase;
|
import org.yuzu.yuzu_emu.model.GameDatabase;
|
||||||
import org.citra.citra_emu.utils.Log;
|
import org.yuzu.yuzu_emu.utils.Log;
|
||||||
|
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
import rx.schedulers.Schedulers;
|
import rx.schedulers.Schedulers;
|
||||||
@ -27,7 +27,7 @@ public final class PlatformGamesPresenter {
|
|||||||
private void loadGames() {
|
private void loadGames() {
|
||||||
Log.debug("[PlatformGamesPresenter] : Loading games...");
|
Log.debug("[PlatformGamesPresenter] : Loading games...");
|
||||||
|
|
||||||
GameDatabase databaseHelper = CitraApplication.databaseHelper;
|
GameDatabase databaseHelper = YuzuApplication.databaseHelper;
|
||||||
|
|
||||||
databaseHelper.getGames()
|
databaseHelper.getGames()
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.ui.platform;
|
package org.yuzu.yuzu_emu.ui.platform;
|
||||||
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
public interface Action1<T> {
|
public interface Action1<T> {
|
||||||
void call(T t);
|
void call(T t);
|
@ -1,12 +1,12 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.AsyncQueryHandler;
|
import android.content.AsyncQueryHandler;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import org.citra.citra_emu.model.GameDatabase;
|
import org.yuzu.yuzu_emu.model.GameDatabase;
|
||||||
import org.citra.citra_emu.model.GameProvider;
|
import org.yuzu.yuzu_emu.model.GameProvider;
|
||||||
|
|
||||||
public class AddDirectoryHelper {
|
public class AddDirectoryHelper {
|
||||||
private Context mContext;
|
private Context mContext;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -17,16 +17,16 @@ import com.android.billingclient.api.PurchasesUpdatedListener;
|
|||||||
import com.android.billingclient.api.SkuDetails;
|
import com.android.billingclient.api.SkuDetails;
|
||||||
import com.android.billingclient.api.SkuDetailsParams;
|
import com.android.billingclient.api.SkuDetailsParams;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
import org.citra.citra_emu.ui.main.MainActivity;
|
import org.yuzu.yuzu_emu.ui.main.MainActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BillingManager implements PurchasesUpdatedListener {
|
public class BillingManager implements PurchasesUpdatedListener {
|
||||||
private final String BILLING_SKU_PREMIUM = "citra.citra_emu.product_id.premium";
|
private final String BILLING_SKU_PREMIUM = "yuzu.yuzu_emu.product_id.premium";
|
||||||
|
|
||||||
private final Activity mActivity;
|
private final Activity mActivity;
|
||||||
private BillingClient mBillingClient;
|
private BillingClient mBillingClient;
|
||||||
@ -35,7 +35,7 @@ public class BillingManager implements PurchasesUpdatedListener {
|
|||||||
private boolean mIsServiceConnected = false;
|
private boolean mIsServiceConnected = false;
|
||||||
private Runnable mUpdateBillingCallback;
|
private Runnable mUpdateBillingCallback;
|
||||||
|
|
||||||
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
|
|
||||||
public BillingManager(Activity activity) {
|
public BillingManager(Activity activity) {
|
||||||
mActivity = activity;
|
mActivity = activity;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.view.InputDevice;
|
import android.view.InputDevice;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -14,7 +14,7 @@ import android.preference.PreferenceManager;
|
|||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -25,15 +25,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A service that spawns its own thread in order to copy several binary and shader files
|
* A service that spawns its own thread in order to copy several binary and shader files
|
||||||
* from the Citra APK to the external file system.
|
* from the yuzu APK to the external file system.
|
||||||
*/
|
*/
|
||||||
public final class DirectoryInitialization {
|
public final class DirectoryInitialization {
|
||||||
public static final String BROADCAST_ACTION = "org.citra.citra_emu.BROADCAST";
|
public static final String BROADCAST_ACTION = "org.yuzu.yuzu_emu.BROADCAST";
|
||||||
|
|
||||||
public static final String EXTRA_STATE = "directoryState";
|
public static final String EXTRA_STATE = "directoryState";
|
||||||
private static volatile DirectoryInitializationState directoryState = null;
|
private static volatile DirectoryInitializationState directoryState = null;
|
||||||
private static String userPath;
|
private static String userPath;
|
||||||
private static AtomicBoolean isCitraDirectoryInitializationRunning = new AtomicBoolean(false);
|
private static AtomicBoolean isDirectoryInitializationRunning = new AtomicBoolean(false);
|
||||||
|
|
||||||
public static void start(Context context) {
|
public static void start(Context context) {
|
||||||
// Can take a few seconds to run, so don't block UI thread.
|
// Can take a few seconds to run, so don't block UI thread.
|
||||||
@ -42,15 +42,15 @@ public final class DirectoryInitialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void init(Context context) {
|
private static void init(Context context) {
|
||||||
if (!isCitraDirectoryInitializationRunning.compareAndSet(false, true))
|
if (!isDirectoryInitializationRunning.compareAndSet(false, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (directoryState != DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED) {
|
if (directoryState != DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED) {
|
||||||
if (PermissionsHandler.hasWriteAccess(context)) {
|
if (PermissionsHandler.hasWriteAccess(context)) {
|
||||||
if (setCitraUserDirectory()) {
|
if (setUserDirectory()) {
|
||||||
initializeInternalStorage(context);
|
initializeInternalStorage(context);
|
||||||
NativeLibrary.CreateConfigFile();
|
NativeLibrary.CreateConfigFile();
|
||||||
directoryState = DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED;
|
directoryState = DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED;
|
||||||
} else {
|
} else {
|
||||||
directoryState = DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE;
|
directoryState = DirectoryInitializationState.CANT_FIND_EXTERNAL_STORAGE;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ public final class DirectoryInitialization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isCitraDirectoryInitializationRunning.set(false);
|
isDirectoryInitializationRunning.set(false);
|
||||||
sendBroadcastState(directoryState, context);
|
sendBroadcastState(directoryState, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +71,14 @@ public final class DirectoryInitialization {
|
|||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean areCitraDirectoriesReady() {
|
public static boolean areDirectoriesReady() {
|
||||||
return directoryState == DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED;
|
return directoryState == DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUserDirectory() {
|
public static String getUserDirectory() {
|
||||||
if (directoryState == null) {
|
if (directoryState == null) {
|
||||||
throw new IllegalStateException("DirectoryInitialization has to run at least once!");
|
throw new IllegalStateException("DirectoryInitialization has to run at least once!");
|
||||||
} else if (isCitraDirectoryInitializationRunning.get()) {
|
} else if (isDirectoryInitializationRunning.get()) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"DirectoryInitialization has to finish running first!");
|
"DirectoryInitialization has to finish running first!");
|
||||||
}
|
}
|
||||||
@ -87,11 +87,11 @@ public final class DirectoryInitialization {
|
|||||||
|
|
||||||
private static native void SetSysDirectory(String path);
|
private static native void SetSysDirectory(String path);
|
||||||
|
|
||||||
private static boolean setCitraUserDirectory() {
|
private static boolean setUserDirectory() {
|
||||||
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||||
File externalPath = Environment.getExternalStorageDirectory();
|
File externalPath = Environment.getExternalStorageDirectory();
|
||||||
if (externalPath != null) {
|
if (externalPath != null) {
|
||||||
userPath = externalPath.getAbsolutePath() + "/citra-emu";
|
userPath = externalPath.getAbsolutePath() + "/yuzu-emu";
|
||||||
Log.debug("[DirectoryInitialization] User Dir: " + userPath);
|
Log.debug("[DirectoryInitialization] User Dir: " + userPath);
|
||||||
// NativeLibrary.SetUserDirectory(userPath);
|
// NativeLibrary.SetUserDirectory(userPath);
|
||||||
return true;
|
return true;
|
||||||
@ -109,7 +109,7 @@ public final class DirectoryInitialization {
|
|||||||
String revision = NativeLibrary.GetGitRevision();
|
String revision = NativeLibrary.GetGitRevision();
|
||||||
if (!preferences.getString("sysDirectoryVersion", "").equals(revision)) {
|
if (!preferences.getString("sysDirectoryVersion", "").equals(revision)) {
|
||||||
// There is no extracted Sys directory, or there is a Sys directory from another
|
// There is no extracted Sys directory, or there is a Sys directory from another
|
||||||
// version of Citra that might contain outdated files. Let's (re-)extract Sys.
|
// version of yuzu that might contain outdated files. Let's (re-)extract Sys.
|
||||||
deleteDirectoryRecursively(sysDirectory);
|
deleteDirectoryRecursively(sysDirectory);
|
||||||
copyAssetFolder("Sys", sysDirectory, true, context);
|
copyAssetFolder("Sys", sysDirectory, true, context);
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ public final class DirectoryInitialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum DirectoryInitializationState {
|
public enum DirectoryInitializationState {
|
||||||
CITRA_DIRECTORIES_INITIALIZED,
|
YUZU_DIRECTORIES_INITIALIZED,
|
||||||
EXTERNAL_STORAGE_PERMISSION_NEEDED,
|
EXTERNAL_STORAGE_PERMISSION_NEEDED,
|
||||||
CANT_FIND_EXTERNAL_STORAGE
|
CANT_FIND_EXTERNAL_STORAGE
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
import org.citra.citra_emu.utils.DirectoryInitialization.DirectoryInitializationState;
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState;
|
||||||
|
|
||||||
public class DirectoryStateReceiver extends BroadcastReceiver {
|
public class DirectoryStateReceiver extends BroadcastReceiver {
|
||||||
Action1<DirectoryInitializationState> callback;
|
Action1<DirectoryInitializationState> callback;
|
@ -1,12 +1,12 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
|
|
||||||
public class EmulationMenuSettings {
|
public class EmulationMenuSettings {
|
||||||
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
|
|
||||||
// These must match what is defined in src/core/settings.h
|
// These must match what is defined in src/core/settings.h
|
||||||
public static final int LayoutOption_Default = 0;
|
public static final int LayoutOption_Default = 0;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -10,7 +10,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import com.nononsenseapps.filepicker.FilePickerActivity;
|
import com.nononsenseapps.filepicker.FilePickerActivity;
|
||||||
import com.nononsenseapps.filepicker.Utils;
|
import com.nononsenseapps.filepicker.Utils;
|
||||||
|
|
||||||
import org.citra.citra_emu.activities.CustomFilePickerActivity;
|
import org.yuzu.yuzu_emu.activities.CustomFilePickerActivity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
@ -4,7 +4,7 @@
|
|||||||
* Refer to the license.txt file included.
|
* Refer to the license.txt file included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
@ -14,8 +14,8 @@ import android.os.IBinder;
|
|||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service that shows a permanent notification in the background to avoid the app getting
|
* A service that shows a permanent notification in the background to avoid the app getting
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ import com.squareup.picasso.Picasso;
|
|||||||
import com.squareup.picasso.Request;
|
import com.squareup.picasso.Request;
|
||||||
import com.squareup.picasso.RequestHandler;
|
import com.squareup.picasso.RequestHandler;
|
||||||
|
|
||||||
import org.citra.citra_emu.NativeLibrary;
|
import org.yuzu.yuzu_emu.NativeLibrary;
|
||||||
|
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import org.citra.citra_emu.BuildConfig;
|
import org.yuzu.yuzu_emu.BuildConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains methods that call through to {@link android.util.Log}, but
|
* Contains methods that call through to {@link android.util.Log}, but
|
||||||
@ -8,7 +8,7 @@ import org.citra.citra_emu.BuildConfig;
|
|||||||
* levels in release builds.
|
* levels in release builds.
|
||||||
*/
|
*/
|
||||||
public final class Log {
|
public final class Log {
|
||||||
private static final String TAG = "Citra Frontend";
|
private static final String TAG = "Yuzu Frontend";
|
||||||
|
|
||||||
private Log() {
|
private Log() {
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapShader;
|
import android.graphics.BitmapShader;
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -6,8 +6,8 @@ import android.widget.ImageView;
|
|||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class PicassoUtils {
|
|||||||
if (mPicassoInitialized) {
|
if (mPicassoInitialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Picasso picassoInstance = new Picasso.Builder(CitraApplication.getAppContext())
|
Picasso picassoInstance = new Picasso.Builder(YuzuApplication.getAppContext())
|
||||||
.addRequestHandler(new GameIconRequestHandler())
|
.addRequestHandler(new GameIconRequestHandler())
|
||||||
.build();
|
.build();
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -7,8 +7,8 @@ import android.text.TextUtils;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
import org.citra.citra_emu.activities.EmulationActivity;
|
import org.yuzu.yuzu_emu.activities.EmulationActivity;
|
||||||
|
|
||||||
public final class StartupHandler {
|
public final class StartupHandler {
|
||||||
private static void handlePermissionsCheck(FragmentActivity parent) {
|
private static void handlePermissionsCheck(FragmentActivity parent) {
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.utils;
|
package org.yuzu.yuzu_emu.utils;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -6,11 +6,11 @@ import android.preference.PreferenceManager;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
import org.citra.citra_emu.CitraApplication;
|
import org.yuzu.yuzu_emu.YuzuApplication;
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile;
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||||
|
|
||||||
public class ThemeUtil {
|
public class ThemeUtil {
|
||||||
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext());
|
private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext());
|
||||||
|
|
||||||
private static void applyTheme(int designValue) {
|
private static void applyTheme(int designValue) {
|
||||||
switch (designValue) {
|
switch (designValue) {
|
@ -1,4 +1,4 @@
|
|||||||
package org.citra.citra_emu.viewholders;
|
package org.yuzu.yuzu_emu.viewholders;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -6,7 +6,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.citra.citra_emu.R;
|
import org.yuzu.yuzu_emu.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple class that stores references to views so that the GameAdapter doesn't need to
|
* A simple class that stores references to views so that the GameAdapter doesn't need to
|
@ -110,7 +110,7 @@ static Core::SystemResultStatus RunEmulation(const std::string& filepath) {
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jobject surf) {
|
jobject surf) {
|
||||||
s_surf = ANativeWindow_fromSurface(env, surf);
|
s_surf = ANativeWindow_fromSurface(env, surf);
|
||||||
@ -122,7 +122,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
|||||||
LOG_INFO(Frontend, "surface changed");
|
LOG_INFO(Frontend, "surface changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
ANativeWindow_release(s_surf);
|
ANativeWindow_release(s_surf);
|
||||||
s_surf = nullptr;
|
s_surf = nullptr;
|
||||||
@ -131,32 +131,32 @@ void Java_org_citra_citra_1emu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_DoFrame(JNIEnv* env, [[maybe_unused]] jclass clazz) {}
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_DoFrame(JNIEnv* env, [[maybe_unused]] jclass clazz) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_NotifyOrientationChange(JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_NotifyOrientationChange(JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jint layout_option,
|
jint layout_option,
|
||||||
jint rotation) {}
|
jint rotation) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_SetUserDirectory(
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_SetUserDirectory(
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz,
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz,
|
||||||
[[maybe_unused]] jstring j_directory) {}
|
[[maybe_unused]] jstring j_directory) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_UnPauseEmulation([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_UnPauseEmulation([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {}
|
[[maybe_unused]] jclass clazz) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_PauseEmulation([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_PauseEmulation([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {}
|
[[maybe_unused]] jclass clazz) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_StopEmulation([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_StopEmulation([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {}
|
[[maybe_unused]] jclass clazz) {}
|
||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_IsRunning([[maybe_unused]] JNIEnv* env,
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_IsRunning([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
return static_cast<jboolean>(!stop_run);
|
return static_cast<jboolean>(!stop_run);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadEvent([[maybe_unused]] JNIEnv* env,
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadEvent([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
[[maybe_unused]] jstring j_device,
|
[[maybe_unused]] jstring j_device,
|
||||||
jint j_button, jint action) {
|
jint j_button, jint action) {
|
||||||
@ -164,7 +164,7 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadEvent([[maybe_unused]]
|
|||||||
return static_cast<jboolean>(true);
|
return static_cast<jboolean>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadMoveEvent([[maybe_unused]] JNIEnv* env,
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadMoveEvent([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_device, jint axis,
|
jstring j_device, jint axis,
|
||||||
jfloat x, jfloat y) {
|
jfloat x, jfloat y) {
|
||||||
@ -183,83 +183,83 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadMoveEvent([[maybe_unus
|
|||||||
return static_cast<jboolean>(false);
|
return static_cast<jboolean>(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadAxisEvent([[maybe_unused]] JNIEnv* env,
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadAxisEvent([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_device, jint axis_id,
|
jstring j_device, jint axis_id,
|
||||||
jfloat axis_val) {
|
jfloat axis_val) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_onTouchEvent([[maybe_unused]] JNIEnv* env,
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchEvent([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jfloat x, jfloat y,
|
jfloat x, jfloat y,
|
||||||
jboolean pressed) {
|
jboolean pressed) {
|
||||||
return static_cast<jboolean>(emu_window->OnTouchEvent(x, y, pressed));
|
return static_cast<jboolean>(emu_window->OnTouchEvent(x, y, pressed));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_onTouchMoved([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchMoved([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz, jfloat x,
|
[[maybe_unused]] jclass clazz, jfloat x,
|
||||||
jfloat y) {
|
jfloat y) {
|
||||||
emu_window->OnTouchMoved(x, y);
|
emu_window->OnTouchMoved(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
jintArray Java_org_citra_citra_1emu_NativeLibrary_GetIcon([[maybe_unused]] JNIEnv* env,
|
jintArray Java_org_yuzu_yuzu_1emu_NativeLibrary_GetIcon([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
[[maybe_unused]] jstring j_file) {
|
[[maybe_unused]] jstring j_file) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetTitle([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetTitle([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
[[maybe_unused]] jstring j_filename) {
|
[[maybe_unused]] jstring j_filename) {
|
||||||
return env->NewStringUTF("");
|
return env->NewStringUTF("");
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetDescription([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetDescription([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_filename) {
|
jstring j_filename) {
|
||||||
return j_filename;
|
return j_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetGameId([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetGameId([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_filename) {
|
jstring j_filename) {
|
||||||
return j_filename;
|
return j_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetRegions([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetRegions([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
[[maybe_unused]] jstring j_filename) {
|
[[maybe_unused]] jstring j_filename) {
|
||||||
return env->NewStringUTF("");
|
return env->NewStringUTF("");
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetCompany([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetCompany([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
[[maybe_unused]] jstring j_filename) {
|
[[maybe_unused]] jstring j_filename) {
|
||||||
return env->NewStringUTF("");
|
return env->NewStringUTF("");
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetGitRevision([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetGitRevision([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_CreateConfigFile
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_CreateConfigFile
|
||||||
[[maybe_unused]] (JNIEnv* env, [[maybe_unused]] jclass clazz) {}
|
[[maybe_unused]] (JNIEnv* env, [[maybe_unused]] jclass clazz) {}
|
||||||
|
|
||||||
jint Java_org_citra_citra_1emu_NativeLibrary_DefaultCPUCore([[maybe_unused]] JNIEnv* env,
|
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_DefaultCPUCore([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z(
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z(
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, [[maybe_unused]] jstring j_file,
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, [[maybe_unused]] jstring j_file,
|
||||||
[[maybe_unused]] jstring j_savestate, [[maybe_unused]] jboolean j_delete_savestate) {}
|
[[maybe_unused]] jstring j_savestate, [[maybe_unused]] jboolean j_delete_savestate) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_ReloadSettings([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_ReloadSettings([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {}
|
[[maybe_unused]] jclass clazz) {}
|
||||||
|
|
||||||
jstring Java_org_citra_citra_1emu_NativeLibrary_GetUserSetting([[maybe_unused]] JNIEnv* env,
|
jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetUserSetting([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_game_id, jstring j_section,
|
jstring j_game_id, jstring j_section,
|
||||||
jstring j_key) {
|
jstring j_key) {
|
||||||
@ -274,7 +274,7 @@ jstring Java_org_citra_citra_1emu_NativeLibrary_GetUserSetting([[maybe_unused]]
|
|||||||
return env->NewStringUTF("");
|
return env->NewStringUTF("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_SetUserSetting([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_SetUserSetting([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_game_id, jstring j_section,
|
jstring j_game_id, jstring j_section,
|
||||||
jstring j_key, jstring j_value) {
|
jstring j_key, jstring j_value) {
|
||||||
@ -289,7 +289,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_SetUserSetting([[maybe_unused]] JNI
|
|||||||
env->ReleaseStringUTFChars(j_value, value.data());
|
env->ReleaseStringUTFChars(j_value, value.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_InitGameIni([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_InitGameIni([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_game_id) {
|
jstring j_game_id) {
|
||||||
std::string_view game_id = env->GetStringUTFChars(j_game_id, 0);
|
std::string_view game_id = env->GetStringUTFChars(j_game_id, 0);
|
||||||
@ -297,7 +297,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_InitGameIni([[maybe_unused]] JNIEnv
|
|||||||
env->ReleaseStringUTFChars(j_game_id, game_id.data());
|
env->ReleaseStringUTFChars(j_game_id, game_id.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
jdoubleArray Java_org_citra_citra_1emu_NativeLibrary_GetPerfStats([[maybe_unused]] JNIEnv* env,
|
jdoubleArray Java_org_yuzu_yuzu_1emu_NativeLibrary_GetPerfStats([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
jdoubleArray j_stats = env->NewDoubleArray(4);
|
jdoubleArray j_stats = env->NewDoubleArray(4);
|
||||||
|
|
||||||
@ -314,10 +314,10 @@ jdoubleArray Java_org_citra_citra_1emu_NativeLibrary_GetPerfStats([[maybe_unused
|
|||||||
return j_stats;
|
return j_stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_utils_DirectoryInitialization_SetSysDirectory(
|
void Java_org_yuzu_yuzu_1emu_utils_DirectoryInitialization_SetSysDirectory(
|
||||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, jstring j_path) {}
|
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, jstring j_path) {}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_Run__Ljava_lang_String_2([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz,
|
[[maybe_unused]] jclass clazz,
|
||||||
jstring j_path) {
|
jstring j_path) {
|
||||||
const std::string path = GetJString(env, j_path);
|
const std::string path = GetJString(env, j_path);
|
||||||
@ -333,7 +333,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2([[maybe_un
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_LogDeviceInfo([[maybe_unused]] JNIEnv* env,
|
void Java_org_yuzu_yuzu_1emu_NativeLibrary_LogDeviceInfo([[maybe_unused]] JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
LOG_INFO(Frontend, "yuzu Version: {}-{}", Common::g_scm_branch, Common::g_scm_desc);
|
LOG_INFO(Frontend, "yuzu Version: {}-{}", Common::g_scm_branch, Common::g_scm_desc);
|
||||||
LOG_INFO(Frontend, "Host OS: Android API level {}", android_get_device_api_level());
|
LOG_INFO(Frontend, "Host OS: Android API level {}", android_get_device_api_level());
|
||||||
|
@ -7,119 +7,119 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_UnPauseEmulation(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_UnPauseEmulation(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_PauseEmulation(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_PauseEmulation(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_StopEmulation(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_StopEmulation(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_citra_citra_1emu_NativeLibrary_IsRunning(JNIEnv* env,
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_IsRunning(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_citra_citra_1emu_NativeLibrary_onGamePadEvent(
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadEvent(
|
||||||
JNIEnv* env, jclass clazz, jstring j_device, jint j_button, jint action);
|
JNIEnv* env, jclass clazz, jstring j_device, jint j_button, jint action);
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_citra_citra_1emu_NativeLibrary_onGamePadMoveEvent(
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadMoveEvent(
|
||||||
JNIEnv* env, jclass clazz, jstring j_device, jint axis, jfloat x, jfloat y);
|
JNIEnv* env, jclass clazz, jstring j_device, jint axis, jfloat x, jfloat y);
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_citra_citra_1emu_NativeLibrary_onGamePadAxisEvent(
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadAxisEvent(
|
||||||
JNIEnv* env, jclass clazz, jstring j_device, jint axis_id, jfloat axis_val);
|
JNIEnv* env, jclass clazz, jstring j_device, jint axis_id, jfloat axis_val);
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_citra_citra_1emu_NativeLibrary_onTouchEvent(JNIEnv* env,
|
JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchEvent(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jfloat x, jfloat y,
|
jfloat x, jfloat y,
|
||||||
jboolean pressed);
|
jboolean pressed);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_onTouchMoved(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchMoved(JNIEnv* env,
|
||||||
jclass clazz, jfloat x,
|
jclass clazz, jfloat x,
|
||||||
jfloat y);
|
jfloat y);
|
||||||
|
|
||||||
JNIEXPORT jintArray JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetIcon(JNIEnv* env,
|
JNIEXPORT jintArray JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetIcon(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring j_file);
|
jstring j_file);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetTitle(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetTitle(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring j_filename);
|
jstring j_filename);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetDescription(
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetDescription(
|
||||||
JNIEnv* env, jclass clazz, jstring j_filename);
|
JNIEnv* env, jclass clazz, jstring j_filename);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetGameId(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetGameId(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring j_filename);
|
jstring j_filename);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetRegions(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetRegions(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring j_filename);
|
jstring j_filename);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetCompany(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetCompany(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring j_filename);
|
jstring j_filename);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetGitRevision(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetGitRevision(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SetUserDirectory(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SetUserDirectory(
|
||||||
JNIEnv* env, jclass clazz, jstring j_directory);
|
JNIEnv* env, jclass clazz, jstring j_directory);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_utils_DirectoryInitialization_SetSysDirectory(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_utils_DirectoryInitialization_SetSysDirectory(
|
||||||
JNIEnv* env, jclass clazz, jstring path_);
|
JNIEnv* env, jclass clazz, jstring path_);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SetSysDirectory(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SetSysDirectory(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring path);
|
jstring path);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_CreateConfigFile(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_CreateConfigFile(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_citra_citra_1emu_NativeLibrary_DefaultCPUCore(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_DefaultCPUCore(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SetProfiling(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SetProfiling(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jboolean enable);
|
jboolean enable);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_WriteProfileResults(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_WriteProfileResults(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_NotifyOrientationChange(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_NotifyOrientationChange(
|
||||||
JNIEnv* env, jclass clazz, jint layout_option, jint rotation);
|
JNIEnv* env, jclass clazz, jint layout_option, jint rotation);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_Run__Ljava_lang_String_2(
|
||||||
JNIEnv* env, jclass clazz, jstring j_path);
|
JNIEnv* env, jclass clazz, jstring j_path);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z(
|
Java_org_yuzu_yuzu_1emu_NativeLibrary_Run__Ljava_lang_String_2Ljava_lang_String_2Z(
|
||||||
JNIEnv* env, jclass clazz, jstring j_file, jstring j_savestate, jboolean j_delete_savestate);
|
JNIEnv* env, jclass clazz, jstring j_file, jstring j_savestate, jboolean j_delete_savestate);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SurfaceChanged(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jobject surf);
|
jobject surf);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_InitGameIni(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_InitGameIni(JNIEnv* env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jstring j_game_id);
|
jstring j_game_id);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_ReloadSettings(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_ReloadSettings(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SetUserSetting(
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SetUserSetting(
|
||||||
JNIEnv* env, jclass clazz, jstring j_game_id, jstring j_section, jstring j_key,
|
JNIEnv* env, jclass clazz, jstring j_game_id, jstring j_section, jstring j_key,
|
||||||
jstring j_value);
|
jstring j_value);
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetUserSetting(
|
JNIEXPORT jstring JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetUserSetting(
|
||||||
JNIEnv* env, jclass clazz, jstring game_id, jstring section, jstring key);
|
JNIEnv* env, jclass clazz, jstring game_id, jstring section, jstring key);
|
||||||
|
|
||||||
JNIEXPORT jdoubleArray JNICALL Java_org_citra_citra_1emu_NativeLibrary_GetPerfStats(JNIEnv* env,
|
JNIEXPORT jdoubleArray JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_GetPerfStats(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_LogDeviceInfo(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_LogDeviceInfo(JNIEnv* env,
|
||||||
jclass clazz);
|
jclass clazz);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="translationX"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="1280dp"
|
||||||
|
android:valueTo="0"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:duration="300"/>
|
||||||
|
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="alpha"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="1"
|
||||||
|
android:interpolator="@android:interpolator/accelerate_quad"
|
||||||
|
android:duration="300"/>
|
||||||
|
|
||||||
|
</set>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="translationX"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="-1280dp"
|
||||||
|
android:valueTo="0"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:duration="300"/>
|
||||||
|
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="alpha"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="1"
|
||||||
|
android:interpolator="@android:interpolator/accelerate_quad"
|
||||||
|
android:duration="300"/>
|
||||||
|
|
||||||
|
</set>
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- This animation is used ONLY when a submenu is replaced. -->
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="translationX"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="1280dp"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:duration="200"/>
|
||||||
|
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="alpha"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="1"
|
||||||
|
android:valueTo="0"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:duration="200"/>
|
||||||
|
|
||||||
|
</set>
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- This animation is used ONLY when a submenu is replaced. -->
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="translationX"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="-1280dp"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:duration="200"/>
|
||||||
|
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="alpha"
|
||||||
|
android:valueType="floatType"
|
||||||
|
android:valueFrom="1"
|
||||||
|
android:valueTo="0"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:duration="200"/>
|
||||||
|
|
||||||
|
</set>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user