mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-06 08:09:19 +00:00
update Cheat files
This commit is contained in:
parent
9ab8c1e433
commit
cbfd634a4b
217 changed files with 2263 additions and 1880 deletions
|
@ -40,7 +40,6 @@ android {
|
|||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO If this is ever modified, change application_id in strings.xml
|
||||
applicationId "org.dolphinemu.dolphinemu"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
|
@ -74,6 +73,7 @@ android {
|
|||
signingConfig signingConfigs.release
|
||||
}
|
||||
|
||||
resValue 'string', 'app_name_suffixed', 'Dolphin Emulator'
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile(
|
||||
|
@ -86,13 +86,14 @@ android {
|
|||
// Signed by debug key disallowing distribution on Play Store.
|
||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||
debug {
|
||||
// TODO If this is ever modified, change application_id in debug/strings.xml
|
||||
resValue 'string', 'app_name_suffixed', 'Dolphin Debug'
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix '-debug'
|
||||
jniDebuggable true
|
||||
}
|
||||
|
||||
benchmark {
|
||||
resValue 'string', 'app_name_suffixed', 'Dolphin Benchmark'
|
||||
signingConfig signingConfigs.debug
|
||||
matchingFallbacks = ['release']
|
||||
debuggable false
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<application
|
||||
android:name=".DolphinApplication"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/app_name_suffixed"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
|
@ -97,7 +97,7 @@
|
|||
<activity
|
||||
android:name=".activities.CustomFilePickerActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/app_name_suffixed"
|
||||
android:theme="@style/Theme.Dolphin.FilePicker">
|
||||
|
||||
<intent-filter>
|
||||
|
|
|
@ -54,12 +54,11 @@ class DocumentProvider : DocumentsProvider() {
|
|||
|
||||
override fun queryRoots(projection: Array<String>?): Cursor {
|
||||
val result = MatrixCursor(projection ?: DEFAULT_ROOT_PROJECTION)
|
||||
rootDirectory = rootDirectory ?: DirectoryInitialization.getUserDirectoryPath(context)
|
||||
rootDirectory ?: return result
|
||||
|
||||
result.newRow().apply {
|
||||
add(DocumentsContract.Root.COLUMN_ROOT_ID, ROOT_ID)
|
||||
add(DocumentsContract.Root.COLUMN_TITLE, context!!.getString(R.string.app_name))
|
||||
add(DocumentsContract.Root.COLUMN_TITLE, context!!.getString(R.string.app_name_suffixed))
|
||||
add(DocumentsContract.Root.COLUMN_ICON, R.drawable.ic_dolphin)
|
||||
add(
|
||||
DocumentsContract.Root.COLUMN_FLAGS,
|
||||
|
@ -73,7 +72,6 @@ class DocumentProvider : DocumentsProvider() {
|
|||
|
||||
override fun queryDocument(documentId: String, projection: Array<String>?): Cursor {
|
||||
val result = MatrixCursor(projection ?: DEFAULT_DOCUMENT_PROJECTION)
|
||||
rootDirectory = rootDirectory ?: DirectoryInitialization.getUserDirectoryPath(context)
|
||||
rootDirectory ?: return result
|
||||
val file = documentIdToPath(documentId)
|
||||
appendDocument(file, result)
|
||||
|
@ -102,7 +100,9 @@ class DocumentProvider : DocumentsProvider() {
|
|||
documentId: String,
|
||||
mode: String,
|
||||
signal: CancellationSignal?
|
||||
): ParcelFileDescriptor {
|
||||
): ParcelFileDescriptor? {
|
||||
rootDirectory ?: return null
|
||||
|
||||
val file = documentIdToPath(documentId)
|
||||
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.parseMode(mode))
|
||||
}
|
||||
|
@ -111,7 +111,9 @@ class DocumentProvider : DocumentsProvider() {
|
|||
parentDocumentId: String,
|
||||
mimeType: String,
|
||||
displayName: String
|
||||
): String {
|
||||
): String? {
|
||||
rootDirectory ?: return null
|
||||
|
||||
val folder = documentIdToPath(parentDocumentId)
|
||||
val file = findFileNameForNewFile(File(folder, displayName))
|
||||
if (mimeType == DocumentsContract.Document.MIME_TYPE_DIR) {
|
||||
|
@ -122,56 +124,40 @@ class DocumentProvider : DocumentsProvider() {
|
|||
return pathToDocumentId(file)
|
||||
}
|
||||
|
||||
override fun copyDocument(sourceDocumentId: String, targetParentDocumentId: String): String {
|
||||
val file = documentIdToPath(sourceDocumentId)
|
||||
val target = documentIdToPath(targetParentDocumentId)
|
||||
val copy = copyRecursively(file, File(target, file.name))
|
||||
return pathToDocumentId(copy)
|
||||
}
|
||||
override fun deleteDocument(documentId: String) {
|
||||
rootDirectory ?: return
|
||||
|
||||
override fun removeDocument(documentId: String, parentDocumentId: String) {
|
||||
val file = documentIdToPath(documentId)
|
||||
file.deleteRecursively()
|
||||
}
|
||||
|
||||
override fun moveDocument(
|
||||
sourceDocumentId: String,
|
||||
sourceParentDocumentId: String,
|
||||
targetParentDocumentId: String
|
||||
): String {
|
||||
val copy = copyDocument(sourceDocumentId, targetParentDocumentId)
|
||||
val file = documentIdToPath(sourceDocumentId)
|
||||
file.delete()
|
||||
return copy
|
||||
override fun renameDocument(documentId: String, displayName: String): String? {
|
||||
rootDirectory ?: return null
|
||||
|
||||
val file = documentIdToPath(documentId)
|
||||
val dest = findFileNameForNewFile(File(file.parentFile, displayName))
|
||||
file.renameTo(dest)
|
||||
return pathToDocumentId(dest)
|
||||
}
|
||||
|
||||
override fun renameDocument(documentId: String, displayName: String): String {
|
||||
val file = documentIdToPath(documentId)
|
||||
file.renameTo(findFileNameForNewFile(File(file.parentFile, displayName)))
|
||||
return pathToDocumentId(file)
|
||||
}
|
||||
|
||||
override fun isChildDocument(parentDocumentId: String, documentId: String): Boolean {
|
||||
val file = documentIdToPath(documentId)
|
||||
val folder = documentIdToPath(parentDocumentId)
|
||||
return file.relativeToOrNull(folder) != null
|
||||
}
|
||||
override fun isChildDocument(parentDocumentId: String, documentId: String): Boolean
|
||||
= documentId.startsWith(parentDocumentId)
|
||||
|
||||
private fun appendDocument(file: File, cursor: MatrixCursor) {
|
||||
var flags = 0
|
||||
if (file.isDirectory && file.canWrite()) {
|
||||
flags = DocumentsContract.Document.FLAG_DIR_SUPPORTS_CREATE
|
||||
} else if (file.canWrite()) {
|
||||
flags = DocumentsContract.Document.FLAG_SUPPORTS_WRITE
|
||||
if (file.canWrite()) {
|
||||
flags = if (file.isDirectory) {
|
||||
DocumentsContract.Document.FLAG_DIR_SUPPORTS_CREATE
|
||||
} else {
|
||||
DocumentsContract.Document.FLAG_SUPPORTS_WRITE
|
||||
}
|
||||
flags = flags or DocumentsContract.Document.FLAG_SUPPORTS_DELETE
|
||||
flags = flags or DocumentsContract.Document.FLAG_SUPPORTS_REMOVE
|
||||
flags = flags or DocumentsContract.Document.FLAG_SUPPORTS_MOVE
|
||||
flags = flags or DocumentsContract.Document.FLAG_SUPPORTS_COPY
|
||||
flags = flags or DocumentsContract.Document.FLAG_SUPPORTS_RENAME
|
||||
// The system will handle copy + move for us
|
||||
}
|
||||
|
||||
val name = if (file == rootDirectory) {
|
||||
context!!.getString(R.string.app_name)
|
||||
context!!.getString(R.string.app_name_suffixed)
|
||||
} else {
|
||||
file.name
|
||||
}
|
||||
|
@ -217,22 +203,6 @@ class DocumentProvider : DocumentsProvider() {
|
|||
unusedFile = File("$pathWithoutExtension.$i.$extension")
|
||||
i++
|
||||
}
|
||||
return file
|
||||
}
|
||||
|
||||
private fun copyRecursively(src: File, dst: File): File {
|
||||
val actualDst = findFileNameForNewFile(dst)
|
||||
if (src.isDirectory) {
|
||||
actualDst.mkdirs()
|
||||
val children = src.listFiles()
|
||||
if (children !== null) {
|
||||
for (file in children) {
|
||||
copyRecursively(file, File(actualDst, file.name))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
src.copyTo(actualDst)
|
||||
}
|
||||
return actualDst
|
||||
return unusedFile
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ public final class MainActivity extends AppCompatActivity
|
|||
setInsets();
|
||||
ThemeHelper.enableStatusBarScrollTint(this, mBinding.appbarMain);
|
||||
|
||||
mBinding.toolbarMain.setTitle(R.string.app_name);
|
||||
setSupportActionBar(mBinding.toolbarMain);
|
||||
|
||||
// Set up the FAB.
|
||||
|
|
|
@ -137,12 +137,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCheat_loadCodes(JNIEnv* e
|
|||
jint revision)
|
||||
{
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini");
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
const Common::IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
|
||||
const std::vector<ActionReplay::ARCode> codes =
|
||||
ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
||||
|
@ -167,7 +167,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCh
|
|||
const std::string game_id = GetJString(env, jGameID);
|
||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
game_ini_local.Load(ini_path);
|
||||
ActionReplay::SaveCodes(&game_ini_local, vector);
|
||||
game_ini_local.Save(ini_path);
|
||||
|
|
|
@ -146,12 +146,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_GeckoCheat_loadCodes(JNIEnv
|
|||
jint revision)
|
||||
{
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini");
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
const Common::IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
|
||||
const std::vector<Gecko::GeckoCode> codes = Gecko::LoadCodes(game_ini_default, game_ini_local);
|
||||
|
||||
|
@ -175,7 +175,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_Geck
|
|||
const std::string game_id = GetJString(env, jGameID);
|
||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
game_ini_local.Load(ini_path);
|
||||
Gecko::SaveCodes(game_ini_local, vector);
|
||||
game_ini_local.Save(ini_path);
|
||||
|
|
|
@ -124,12 +124,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_PatchCheat_loadCodes(JNIEnv
|
|||
jint revision)
|
||||
{
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini");
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
const Common::IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
|
||||
std::vector<PatchEngine::Patch> patches;
|
||||
PatchEngine::LoadPatchSection("OnFrame", &patches, game_ini_default, game_ini_local);
|
||||
|
@ -154,7 +154,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_Patc
|
|||
const std::string game_id = GetJString(env, jGameID);
|
||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
game_ini_local.Load(ini_path);
|
||||
PatchEngine::SavePatchSection(&game_ini_local, vector);
|
||||
game_ini_local.Save(ini_path);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||
#include "jni/AndroidCommon/IDCache.h"
|
||||
|
||||
using Common::IniFile;
|
||||
|
||||
static IniFile::Section* GetSectionPointer(JNIEnv* env, jobject obj)
|
||||
{
|
||||
return reinterpret_cast<IniFile::Section*>(
|
||||
|
|
|
@ -91,7 +91,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
|||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||
|
||||
// Loading an empty IniFile section clears everything.
|
||||
IniFile::Section section;
|
||||
Common::IniFile::Section section;
|
||||
|
||||
controller->LoadConfig(§ion);
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
|
@ -103,7 +103,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
|||
{
|
||||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
ini.Load(GetJString(env, j_path));
|
||||
|
||||
controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
||||
|
@ -118,7 +118,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
|||
|
||||
File::CreateFullPath(path);
|
||||
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
|
||||
EmulatedControllerFromJava(env, obj)->SaveConfig(ini.GetOrCreateSection("Profile"));
|
||||
ini.Save(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue