-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10885 from JosJuice/android-graphics-mods
Android: Add graphics mods support to GUI
- Loading branch information
Showing
24 changed files
with
477 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ndroid/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/GraphicsMod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
package org.dolphinemu.dolphinemu.features.cheats.model; | ||
|
||
import androidx.annotation.Keep; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
public class GraphicsMod extends ReadOnlyCheat | ||
{ | ||
@Keep | ||
private final long mPointer; | ||
|
||
// When a C++ GraphicsModGroup object is destroyed, it also destroys the GraphicsMods it owns. | ||
// To avoid getting dangling pointers, we keep a reference to the GraphicsModGroup here. | ||
@Keep | ||
private final GraphicsModGroup mParent; | ||
|
||
@Keep | ||
private GraphicsMod(long pointer, GraphicsModGroup parent) | ||
{ | ||
mPointer = pointer; | ||
mParent = parent; | ||
} | ||
|
||
public boolean supportsCreator() | ||
{ | ||
return true; | ||
} | ||
|
||
public boolean supportsNotes() | ||
{ | ||
return true; | ||
} | ||
|
||
public boolean supportsCode() | ||
{ | ||
return false; | ||
} | ||
|
||
@NonNull | ||
public native String getName(); | ||
|
||
@NonNull | ||
public native String getCreator(); | ||
|
||
@NonNull | ||
public native String getNotes(); | ||
|
||
public boolean getUserDefined() | ||
{ | ||
// Technically graphics mods can be user defined, but we don't support editing graphics mods | ||
// in the GUI, and editability is what this really controls | ||
return false; | ||
} | ||
|
||
public native boolean getEnabled(); | ||
|
||
@Override | ||
protected native void setEnabledImpl(boolean enabled); | ||
} |
27 changes: 27 additions & 0 deletions
27
...d/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/GraphicsModGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.dolphinemu.dolphinemu.features.cheats.model; | ||
|
||
import androidx.annotation.Keep; | ||
import androidx.annotation.NonNull; | ||
|
||
public class GraphicsModGroup | ||
{ | ||
@Keep | ||
private final long mPointer; | ||
|
||
@Keep | ||
private GraphicsModGroup(long pointer) | ||
{ | ||
mPointer = pointer; | ||
} | ||
|
||
@Override | ||
public native void finalize(); | ||
|
||
@NonNull | ||
public native GraphicsMod[] getMods(); | ||
|
||
public native void save(); | ||
|
||
@NonNull | ||
public static native GraphicsModGroup load(String gameId); | ||
} |
36 changes: 36 additions & 0 deletions
36
...roid/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/model/ReadOnlyCheat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
package org.dolphinemu.dolphinemu.features.cheats.model; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
public abstract class ReadOnlyCheat implements Cheat | ||
{ | ||
private Runnable mChangedCallback = null; | ||
|
||
public int trySet(@NonNull String name, @NonNull String creator, @NonNull String notes, | ||
@NonNull String code) | ||
{ | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
public void setEnabled(boolean enabled) | ||
{ | ||
setEnabledImpl(enabled); | ||
onChanged(); | ||
} | ||
|
||
public void setChangedCallback(@Nullable Runnable callback) | ||
{ | ||
mChangedCallback = callback; | ||
} | ||
|
||
protected void onChanged() | ||
{ | ||
if (mChangedCallback != null) | ||
mChangedCallback.run(); | ||
} | ||
|
||
protected abstract void setEnabledImpl(boolean enabled); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsDisabledWarningFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
package org.dolphinemu.dolphinemu.features.cheats.ui; | ||
|
||
import org.dolphinemu.dolphinemu.R; | ||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; | ||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; | ||
|
||
public class CheatsDisabledWarningFragment extends SettingDisabledWarningFragment | ||
{ | ||
public CheatsDisabledWarningFragment() | ||
{ | ||
super(BooleanSetting.MAIN_ENABLE_CHEATS, MenuTag.CONFIG_GENERAL, | ||
R.string.cheats_disabled_warning); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ava/org/dolphinemu/dolphinemu/features/cheats/ui/GraphicsModsDisabledWarningFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
package org.dolphinemu.dolphinemu.features.cheats.ui; | ||
|
||
import org.dolphinemu.dolphinemu.R; | ||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; | ||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; | ||
|
||
public class GraphicsModsDisabledWarningFragment extends SettingDisabledWarningFragment | ||
{ | ||
public GraphicsModsDisabledWarningFragment() | ||
{ | ||
super(BooleanSetting.GFX_MODS_ENABLE, MenuTag.ADVANCED_GRAPHICS, | ||
R.string.gfx_mods_disabled_warning); | ||
} | ||
} |
Oops, something went wrong.