Android: add Load Custom Textures option

This commit is contained in:
Flyinghead 2018-12-31 08:52:50 +01:00
parent ecb689051f
commit 8532d1a032
9 changed files with 86 additions and 4 deletions

View File

@ -180,6 +180,8 @@ cThread webui_thd(&webui_th,0);
void LoadSpecialSettings()
{
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
printf("Game ID is [%s]\n", reios_product_number);
// Tony Hawk's Pro Skater 2
if (!strncmp("T13008D", reios_product_number, 7) || !strncmp("T13006N", reios_product_number, 7)
// Tony Hawk's Pro Skater 1
@ -213,6 +215,8 @@ void LoadSpecialSettings()
settings.rend.ExtraDepthScale = 10000;
}
#elif DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
printf("Game ID is [%s]\n", naomi_game_id);
if (!strcmp("METAL SLUG 6", naomi_game_id) || !strcmp("WAVE RUNNER GP", naomi_game_id))
{
printf("Enabling Dynarec safe mode for game %s\n", naomi_game_id);
@ -596,7 +600,6 @@ void LoadCustom()
char *reios_id = naomi_game_id;
char *reios_software_name = naomi_game_id;
#endif
printf("Game ID is [%s]\n", reios_id);
LoadSpecialSettings(); // Default per-game settings

View File

@ -28,6 +28,7 @@ public class Emulator extends Application {
public static final String pref_modvols = "modifier_volumes";
public static final String pref_bootdisk = "boot_disk";
public static final String pref_usereios = "use_reios";
public static final String pref_customtextures = "custom_textures";
public static boolean dynarecopt = true;
public static boolean idleskip = true;
@ -51,7 +52,8 @@ public class Emulator extends Application {
public static String bootdisk = null;
public static boolean usereios = false;
public static boolean nativeact = false;
public static boolean customtextures = false;
/**
* Load the user configuration from preferences
*
@ -73,6 +75,7 @@ public class Emulator extends Application {
Emulator.bootdisk = mPrefs.getString(pref_bootdisk, bootdisk);
Emulator.usereios = mPrefs.getBoolean(pref_usereios, usereios);
Emulator.nativeact = mPrefs.getBoolean(pref_nativeact, nativeact);
Emulator.customtextures = mPrefs.getBoolean(pref_customtextures, customtextures);
}
/**
@ -100,6 +103,7 @@ public class Emulator extends Application {
JNIdc.modvols(Emulator.modvols ? 1 : 0);
JNIdc.usereios(Emulator.usereios ? 1 : 0);
JNIdc.bootdisk(Emulator.bootdisk);
JNIdc.customtextures(Emulator.customtextures ? 1 : 0);
}
public void loadGameConfiguration(String gameId) {
@ -112,6 +116,7 @@ public class Emulator extends Application {
JNIdc.syncedrender(mPrefs.getBoolean(pref_syncedrender, syncedrender) ? 1 : 0);
JNIdc.modvols(mPrefs.getBoolean(pref_modvols, modvols) ? 1 : 0);
JNIdc.bootdisk(mPrefs.getString(pref_bootdisk, bootdisk));
JNIdc.customtextures(mPrefs.getBoolean(pref_customtextures, customtextures) ? 1 : 0);
}
static {

View File

@ -475,6 +475,15 @@ public class OptionsFragment extends Fragment {
synced_render.setChecked(mPrefs.getBoolean(Emulator.pref_syncedrender, Emulator.syncedrender));
synced_render.setOnCheckedChangeListener(synchronous);
OnCheckedChangeListener customtex = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPrefs.edit().putBoolean(Emulator.pref_customtextures, isChecked).apply();
}
};
CompoundButton custom_textures = (CompoundButton) getView().findViewById(R.id.customtex_option);
custom_textures.setChecked(mPrefs.getBoolean(Emulator.pref_customtextures, Emulator.customtextures));
custom_textures.setOnCheckedChangeListener(customtex);
final EditText bootdiskEdit = (EditText) getView().findViewById(R.id.boot_disk);
bootdiskEdit.setText(mPrefs.getString(Emulator.pref_bootdisk, Emulator.bootdisk));

View File

@ -49,6 +49,7 @@ public final class JNIdc
public static native void modvols(int volumes);
public static native void bootdisk(String disk);
public static native void usereios(int reios);
public static native void customtextures(int customtex);
public static void show_osd() {
JNIdc.vjoy(13, 1,0,0,0);

View File

@ -65,6 +65,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_syncedrender(JNIEnv *
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_modvols(JNIEnv *env,jobject obj, jint volumes) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_bootdisk(JNIEnv *env,jobject obj, jstring disk) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_usereios(JNIEnv *env,jobject obj, jint reios) __attribute__((visibility("default")));
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_customtextures(JNIEnv *env,jobject obj, jint customtex) __attribute__((visibility("default")));
};
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_dynarec(JNIEnv *env,jobject obj, jint dynarec)
@ -163,6 +164,11 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_usereios(JNIEnv *env,
settings.bios.UseReios = reios;
}
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_customtextures(JNIEnv *env,jobject obj, jint customtex)
{
settings.rend.CustomTextures = customtex;
}
void egl_stealcntx();
void SetApplicationPath(wchar *path);
void reios_init(int argc,wchar* argv[]);

View File

@ -668,7 +668,7 @@
android:gravity="center_vertical" >
<TextView
android:id="@+id/broadcast_text"
android:id="@+id/language_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
@ -776,6 +776,34 @@
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/customtex_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_customtex" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Switch
android:id="@+id/customtex_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -668,7 +668,7 @@
android:gravity="center_vertical" >
<TextView
android:id="@+id/broadcast_text"
android:id="@+id/language_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
@ -776,6 +776,34 @@
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/customtex_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_customtex" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Checkbox
android:id="@+id/customtex_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true" />
</LinearLayout>
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -45,6 +45,7 @@ Last Edit: 21 May 2014
<string name="select_software">Forcer le rendu logiciel</string>
<string name="select_sound">Désactiver le son de l\'émulateur</string>
<string name="select_depth">Rendu de profondeur</string>
<string name="select_customtex">Textures personnalisées</string>
<string name="games_listing">Liste des jeux disponibles</string>

View File

@ -56,6 +56,7 @@
<string name="select_sound">Disable Emulator Sound</string>
<string name="select_depth">View Rendering Depth</string>
<string name="boot_disk">Boot Disk (ie. Gameshark, Utopia)</string>
<string name="select_customtex">Load Custom Textures</string>
<string name="reset_emu">Reset Emu</string>
<string name="reset_emu_title">Reset Emulator Settings</string>