Add more shader options.

This commit is contained in:
Themaister 2013-01-04 21:39:00 +01:00
parent 085a90d018
commit f886b3bc95
5 changed files with 100 additions and 17 deletions

View File

@ -25,6 +25,7 @@
<activity android:name="org.retroarch.browser.ROMActivity"></activity>
<activity android:name="org.retroarch.browser.ShaderActivity"></activity>
<activity android:name="org.retroarch.browser.Shader2Activity"></activity>
<activity android:name="org.retroarch.browser.OverlayActivity"></activity>
<activity android:name="android.app.NativeActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">

View File

@ -19,4 +19,20 @@
<item>1.60000</item>
<item>1.14286</item>
</string-array>
<string-array name="fbo_scales">
<item>1.0x</item>
<item>2.0x</item>
<item>3.0x</item>
<item>4.0x</item>
<item>5.0x</item>
</string-array>
<string-array name="fbo_scale_values">
<item>1.0</item>
<item>2.0</item>
<item>3.0</item>
<item>4.0</item>
<item>5.0</item>
</string-array>
</resources>

View File

@ -7,7 +7,7 @@
<CheckBoxPreference
android:defaultValue="false"
android:key="savestate_auto_save"
android:summary="Automatically saves and restores game state"
android:summary="Automatically saves and restores game state."
android:title="Auto save state" />
<CheckBoxPreference
android:defaultValue="false"
@ -21,12 +21,12 @@
<CheckBoxPreference
android:defaultValue="true"
android:key="video_smooth"
android:summary="Applies bilinear filter, smooths out edges"
android:summary="Applies bilinear filter, smooths out edges."
android:title="Bilinear filter" />
<CheckBoxPreference
android:defaultValue="true"
android:key="video_vsync"
android:summary="When set to enabled, prevents screen tearing"
android:summary="When set to enabled, prevents screen tearing."
android:title="VSync" />
<CheckBoxPreference
android:defaultValue="true"
@ -38,46 +38,84 @@
android:entries="@array/aspect_ratios"
android:entryValues="@array/aspect_values"
android:key="video_aspect_ratio"
android:summary="Aspect ratio to enforce"
android:summary="Aspect ratio to enforce."
android:title="Aspect ratio" />
</PreferenceCategory>
<PreferenceCategory android:title="Overlay" >
<CheckBoxPreference android:title="Enable"
<CheckBoxPreference
android:defaultValue="false"
android:key="input_overlay_enable"
android:defaultValue="false" />
android:title="Enable" />
<Preference
android:summary="Sets touchscreen overlay config"
android:summary="Sets touchscreen overlay config."
android:title="Input overlay" >
<intent
android:targetClass="org.retroarch.browser.OverlayActivity"
android:targetPackage="org.retroarch" />
</Preference>
</PreferenceCategory>
<PreferenceCategory android:title="Shaders" >
<CheckBoxPreference android:title="Enable"
<PreferenceCategory android:title="Shaders (1st pass)" >
<CheckBoxPreference
android:defaultValue="false"
android:key="video_shader_enable"
android:defaultValue="false" />
android:title="Enable" />
<Preference
android:summary="Sets GLES2 style XML shader"
android:summary="Sets GLES2 style XML shader."
android:title="XML shader" >
<intent
android:targetClass="org.retroarch.browser.ShaderActivity"
android:targetPackage="org.retroarch" />
</Preference>
</PreferenceCategory>
<PreferenceCategory android:title="Shaders (Multi-pass)" >
<CheckBoxPreference
android:defaultValue="false"
android:key="video_render_to_texture"
android:summary="Render first pass to texture (FBO). Stretch to screen with second shader."
android:title="Render to texture" />
<CheckBoxPreference
android:defaultValue="false"
android:key="video_second_pass_shader_enable"
android:summary="Enable custom shader for use after rendering to FBO."
android:title="Enable shader #2" />
<Preference
android:summary="Sets shader to use for second pass."
android:title="XML shader (2nd pass)" >
<intent
android:targetClass="org.retroarch.browser.Shader2Activity"
android:targetPackage="org.retroarch" />
</Preference>
<ListPreference
android:entries="@array/fbo_scales"
android:entryValues="@array/fbo_scale_values"
android:key="video_fbo_scale"
android:summary="Scale to use when rendering to FBO."
android:title="FBO scale" />
</PreferenceCategory>
<CheckBoxPreference
android:defaultValue="true"
android:key="video_second_pass_smooth"
android:summary="Use bilinear filtering on FBO texture on second pass."
android:title="Second pass bilinear" />
</PreferenceScreen>
<PreferenceScreen android:title="Audio Config" >
<PreferenceCategory android:title="General" >
<CheckBoxPreference
android:defaultValue="true"
android:key="audio_enable"
android:summary="Enable audio"
android:summary="Enable audio."
android:title="Audio enable" />
<CheckBoxPreference
android:defaultValue="true"
android:key="audio_rate_control"
android:summary="Enable dynamic rate control"
android:summary="Enable dynamic rate control."
android:title="Dynamic Rate Control" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>

View File

@ -49,7 +49,7 @@ public class RetroArch extends Activity implements
private IconAdapter<ModuleWrapper> adapter;
static private final int ACTIVITY_LOAD_ROM = 0;
static private String libretro_path;
static private final String TAG = "RetroArch";
static private final String TAG = "RetroArch-Phoenix";
private ConfigFile config;
public float getRefreshRate() {
@ -71,16 +71,16 @@ public class RetroArch extends Activity implements
private void extractAssets(AssetManager manager, String cacheDir, String relativePath, int level) throws IOException {
final String[] paths = manager.list(relativePath);
if (paths != null && paths.length > 0) { // Directory
Log.i(TAG, "Extracting assets directory: " + relativePath);
Log.d(TAG, "Extracting assets directory: " + relativePath);
for (final String path : paths)
extractAssets(manager, cacheDir, relativePath + (level > 0 ? File.separator : "") + path, level + 1);
} else { // File, extract.
Log.i(TAG, "Extracting assets file: " + relativePath);
Log.d(TAG, "Extracting assets file: " + relativePath);
String parentPath = new File(relativePath).getParent();
File parentFile = new File(cacheDir, parentPath);
Log.i(TAG, "Creating folder: " + parentFile.getAbsolutePath());
Log.d(TAG, "Creating folder: " + parentFile.getAbsolutePath());
parentFile.mkdirs(); // Doesn't throw.
byte[] asset = loadAsset(relativePath);
@ -221,6 +221,16 @@ public class RetroArch extends Activity implements
config.setString("video_bsnes_shader", "");
}
config.setBoolean("video_render_to_texture", prefs.getBoolean("video_render_to_texture", false));
config.setString("video_second_pass_shader",
prefs.getBoolean("video_second_pass_shader_enable", false) ?
config.getString("video_second_pass_shader") : "");
config.setBoolean("video_second_pass_smooth", prefs.getBoolean("video_second_pass_smooth", true));
config.setString("video_fbo_scale_x", prefs.getString("video_fbo_scale", "2.0"));
config.setString("video_fbo_scale_y", prefs.getString("video_fbo_scale", "2.0"));
config.setString("input_overlay",
prefs.getBoolean("input_overlay_enable", false) ?
prefs.getString("input_overlay", "") : "");

View File

@ -0,0 +1,18 @@
package org.retroarch.browser;
import java.io.File;
import android.os.Bundle;
public class Shader2Activity extends DirectoryActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
File shaderDir = new File(getCacheDir(), "Shaders");
if (shaderDir.exists())
super.setStartDirectory(shaderDir.getAbsolutePath());
super.addAllowedExt(".shader");
super.setPathSettingKey("video_second_pass_shader");
super.onCreate(savedInstanceState);
}
}