mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 18:35:22 +00:00
Merge branch 'master' of git://github.com/libretro/RetroArch
This commit is contained in:
commit
f897552ee7
@ -48,7 +48,7 @@ ifeq ($(PERF_TEST), 1)
|
||||
LOCAL_CFLAGS += -DPERF_TEST
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_RGUI -DHAVE_SCREENSHOTS -DWANT_MINIZ -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -std=gnu99 -I../../../deps/miniz
|
||||
LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_RGUI -DHAVE_SCREENSHOTS -DWANT_MINIZ -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -std=gnu99 -I../../../deps/miniz
|
||||
|
||||
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 $(LOGGER_LDLIBS) -ldl
|
||||
|
||||
|
@ -1190,6 +1190,7 @@ static void android_input_set_keybinds(void *data, unsigned device,
|
||||
strlcpy(g_settings.input.device_names[port], "OUYA",
|
||||
sizeof(g_settings.input.device_names[port]));
|
||||
|
||||
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
||||
keycode_lut[AKEYCODE_DPAD_UP] |= ((RETRO_DEVICE_ID_JOYPAD_UP+1) << shift);
|
||||
keycode_lut[AKEYCODE_DPAD_DOWN] |= ((RETRO_DEVICE_ID_JOYPAD_DOWN+1) << shift);
|
||||
keycode_lut[AKEYCODE_DPAD_LEFT] |= ((RETRO_DEVICE_ID_JOYPAD_LEFT+1) << shift);
|
||||
@ -1592,8 +1593,9 @@ static void android_input_set_keybinds(void *data, unsigned device,
|
||||
static void android_input_poll(void *data)
|
||||
{
|
||||
int ident;
|
||||
uint64_t lifecycle_mask = (1ULL << RARCH_RESET) | (1ULL << RARCH_REWIND) | (1ULL << RARCH_FAST_FORWARD_KEY) | (1ULL << RARCH_FAST_FORWARD_HOLD_KEY) | (1ULL << RARCH_MUTE) | (1ULL << RARCH_SAVE_STATE_KEY) | (1ULL << RARCH_LOAD_STATE_KEY) | (1ULL << RARCH_STATE_SLOT_PLUS) | (1ULL << RARCH_STATE_SLOT_MINUS) | (1ULL << RARCH_QUIT_KEY) | (1ULL << RARCH_MENU_TOGGLE);
|
||||
uint64_t *lifecycle_state = &g_extern.lifecycle_state;
|
||||
*lifecycle_state &= ~((1ULL << RARCH_RESET) | (1ULL << RARCH_REWIND) | (1ULL << RARCH_FAST_FORWARD_KEY) | (1ULL << RARCH_FAST_FORWARD_HOLD_KEY) | (1ULL << RARCH_MUTE) | (1ULL << RARCH_SAVE_STATE_KEY) | (1ULL << RARCH_LOAD_STATE_KEY) | (1ULL << RARCH_STATE_SLOT_PLUS) | (1ULL << RARCH_STATE_SLOT_MINUS) | (1ULL << RARCH_QUIT_KEY));
|
||||
*lifecycle_state &= ~lifecycle_mask;
|
||||
|
||||
while ((ident = ALooper_pollAll((input_key_pressed_func(RARCH_PAUSE_TOGGLE)) ? -1 : 0,
|
||||
NULL, NULL, NULL)) >= 0)
|
||||
@ -1752,9 +1754,6 @@ static void android_input_poll(void *data)
|
||||
}
|
||||
else if (type_event == AINPUT_EVENT_TYPE_KEY)
|
||||
{
|
||||
if (debug_enable)
|
||||
snprintf(msg, sizeof(msg), "Pad %d : %d, ac = %d, src = %d.\n", state_id, keycode, action, source);
|
||||
|
||||
/* Hack - we have to decrease the unpacked value by 1
|
||||
* because we 'added' 1 to each entry in the LUT -
|
||||
* RETRO_DEVICE_ID_JOYPAD_B is 0
|
||||
@ -1764,20 +1763,25 @@ static void android_input_poll(void *data)
|
||||
int action = AKeyEvent_getAction(event);
|
||||
uint64_t *key = NULL;
|
||||
|
||||
if(input_state < (1ULL << RARCH_FIRST_META_KEY))
|
||||
if (debug_enable)
|
||||
snprintf(msg, sizeof(msg), "Pad %d : %d, ac = %d, src = %d.\n", state_id, keycode, action, source);
|
||||
|
||||
if (input_state < (1ULL << RARCH_FIRST_META_KEY))
|
||||
key = &state[state_id];
|
||||
else if(input_state)
|
||||
else if (input_state/* && action == AKEY_EVENT_ACTION_DOWN*/)
|
||||
key = &g_extern.lifecycle_state;
|
||||
|
||||
if(key != NULL)
|
||||
if (key != NULL)
|
||||
{
|
||||
if (action == AKEY_EVENT_ACTION_UP)
|
||||
// some controllers send both the up and down events at once when the button is released for "special" buttons, like menu buttons
|
||||
// work around that by only using down events for meta keys (which get cleared every poll anyway)
|
||||
if (action == AKEY_EVENT_ACTION_UP && !(input_state & lifecycle_mask))
|
||||
*key &= ~(input_state);
|
||||
else if (action == AKEY_EVENT_ACTION_DOWN)
|
||||
*key |= input_state;
|
||||
}
|
||||
|
||||
if((keycode == AKEYCODE_VOLUME_UP || keycode == AKEYCODE_VOLUME_DOWN) && keycode_lut[keycode] == 0)
|
||||
if ((keycode == AKEYCODE_VOLUME_UP || keycode == AKEYCODE_VOLUME_DOWN) && keycode_lut[keycode] == 0)
|
||||
handled = 0;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<activity android:name=".browser.LazyPopupMenu"></activity>
|
||||
<activity android:name=".browser.PopupMenuAbstract"></activity>
|
||||
<activity android:name=".browser.ReportIME"></activity>
|
||||
<activity android:name=".browser.IMEActivity"></activity>
|
||||
<activity android:name=".browser.HelpActivity"></activity>
|
||||
<activity android:name=".browser.FileWrapper"></activity>
|
||||
<activity android:name=".browser.DirectoryActivity"></activity>
|
||||
|
@ -123,10 +123,6 @@
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen android:title="Input Options" >
|
||||
<PreferenceCategory android:title="General" >
|
||||
<CheckBoxPreference android:title="Enable global configuration"
|
||||
android:summary="Enable global settings for all cores. Leave disabled if you want per-core settings."
|
||||
android:key="global_config_enable"
|
||||
android:defaultValue="true"/>
|
||||
<ListPreference
|
||||
android:entries="@array/back_options"
|
||||
android:entryValues="@array/back_options_values"
|
||||
@ -134,6 +130,17 @@
|
||||
android:summary="Select how you want the Back button to behave."
|
||||
android:title="Back behavior" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="IME" >
|
||||
<Preference
|
||||
android:summary="Sets IME to be used in-game."
|
||||
android:title="Set Input Method" >
|
||||
<intent
|
||||
android:targetClass="org.retroarch.browser.IMEActivity"
|
||||
android:targetPackage="org.retroarch" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="Configuration Autodetect" >
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
@ -468,6 +475,14 @@
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen android:title="Settings" >
|
||||
<PreferenceCategory android:title="Configuration style" >
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="global_config_enable"
|
||||
android:summary="Enable global settings for all cores. Leave disabled if you want per-core settings."
|
||||
android:title="Enable global configuration" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="General" >
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
|
@ -80,6 +80,10 @@ public class ConfigFile {
|
||||
public void setDouble(String key, double value) {
|
||||
map.put(key, Double.toString(value));
|
||||
}
|
||||
|
||||
public void setFloat(String key, float value) {
|
||||
map.put(key, Float.toString(value));
|
||||
}
|
||||
|
||||
public boolean keyExists(String key) {
|
||||
return map.containsKey(key);
|
||||
@ -108,6 +112,14 @@ public class ConfigFile {
|
||||
else
|
||||
throw new NumberFormatException();
|
||||
}
|
||||
|
||||
public float getFloat(String key) throws NumberFormatException {
|
||||
String str = getString(key);
|
||||
if (str != null)
|
||||
return Float.parseFloat(str);
|
||||
else
|
||||
throw new NumberFormatException();
|
||||
}
|
||||
|
||||
public boolean getBoolean(String key) {
|
||||
String str = getString(key);
|
||||
|
@ -9,7 +9,6 @@ import android.content.*;
|
||||
import android.app.*;
|
||||
import android.media.AudioManager;
|
||||
import android.os.*;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.widget.*;
|
||||
import android.view.*;
|
||||
|
||||
@ -107,7 +106,7 @@ public class DirectoryActivity extends Activity implements
|
||||
|
||||
private void finishWithPath(String path) {
|
||||
if (pathSettingKey != null && !pathSettingKey.isEmpty()) {
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences settings = MainMenuActivity.getPreferences();
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putString(pathSettingKey, path);
|
||||
editor.commit();
|
||||
|
@ -8,7 +8,6 @@ import android.content.SharedPreferences;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
@ -36,7 +35,7 @@ public class DisplayRefreshRateTest extends Activity {
|
||||
}
|
||||
|
||||
private void setFPSSetting(double fps) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.valueOf(fps).toString());
|
||||
edit.commit();
|
||||
@ -117,7 +116,7 @@ public class DisplayRefreshRateTest extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
String fps = prefs.getString("video_refresh_rate", "ERROR");
|
||||
Toast.makeText(this, "Refresh rate measured to: " + fps + " Hz.", Toast.LENGTH_LONG).show();
|
||||
super.onDestroy();
|
||||
|
16
android/phoenix/src/org/retroarch/browser/IMEActivity.java
Normal file
16
android/phoenix/src/org/retroarch/browser/IMEActivity.java
Normal file
@ -0,0 +1,16 @@
|
||||
package org.retroarch.browser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
public class IMEActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showInputMethodPicker();
|
||||
finish();
|
||||
}
|
||||
}
|
@ -11,12 +11,15 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.AssetManager;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioTrack;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
@ -31,25 +34,57 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
static private final String TAG = "MainMenu";
|
||||
static private String libretro_path;
|
||||
static private String libretro_name;
|
||||
|
||||
|
||||
private boolean globalConfigEnable = true;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void refreshPreferenceScreen() {
|
||||
readbackConfigFile();
|
||||
|
||||
setPreferenceScreen(null);
|
||||
addPreferencesFromResource(R.xml.prefs);
|
||||
|
||||
setCoreTitle(libretro_name);
|
||||
PreferenceManager.setDefaultValues(this, R.xml.prefs, false);
|
||||
|
||||
final CheckBoxPreference param = (CheckBoxPreference) findPreference("global_config_enable");
|
||||
globalConfigEnable = param.isChecked();
|
||||
param.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
updateConfigFile();
|
||||
globalConfigEnable = param.isChecked();
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("global_config_enable", param.isChecked());
|
||||
edit.commit();
|
||||
|
||||
refreshPreferenceScreen();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean usePerCoreConfig() {
|
||||
boolean config_same_as_native_lib_dir = libretro_path
|
||||
.equals(getApplicationInfo().nativeLibraryDir);
|
||||
|
||||
return !globalConfigEnable && !config_same_as_native_lib_dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Intent startedByIntent = getIntent();
|
||||
if (null != startedByIntent.getStringExtra("ROM")
|
||||
&& null != startedByIntent.getStringExtra("LIBRETRO")) {
|
||||
loadRomExternal(startedByIntent.getStringExtra("ROM"),
|
||||
startedByIntent.getStringExtra("LIBRETRO"));
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
addPreferencesFromResource(R.xml.prefs);
|
||||
PreferenceManager.setDefaultValues(this, R.xml.prefs, false);
|
||||
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
SharedPreferences prefs = getPreferences();
|
||||
|
||||
libretro_path = prefs.getString("libretro_path", getApplicationInfo().nativeLibraryDir);
|
||||
libretro_name = prefs.getString("libretro_name", "No core");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
refreshPreferenceScreen();
|
||||
|
||||
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
extractAssets();
|
||||
|
||||
@ -62,35 +97,20 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
.setTitle("Welcome to RetroArch")
|
||||
.setMessage(
|
||||
"This is your first time starting up RetroArch. RetroArch will now be preconfigured for the best possible gameplay experience.")
|
||||
.setPositiveButton("OK",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putBoolean("video_threaded", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
.setPositiveButton("OK", null);
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
|
||||
if (prefs.getString("libretro_path", "").isEmpty() == false) {
|
||||
libretro_path = prefs.getString("libretro_path", "");
|
||||
setCoreTitle("No core");
|
||||
|
||||
if (prefs.getString("libretro_name", "").isEmpty() == false) {
|
||||
libretro_name = prefs.getString("libretro_name", "No core");
|
||||
setCoreTitle(libretro_name);
|
||||
}
|
||||
} else {
|
||||
libretro_path = MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir;
|
||||
libretro_name = "No core";
|
||||
setCoreTitle("No core");
|
||||
Intent startedByIntent = getIntent();
|
||||
if (null != startedByIntent.getStringExtra("ROM")
|
||||
&& null != startedByIntent.getStringExtra("LIBRETRO")) {
|
||||
if (null == savedInstanceState
|
||||
|| !savedInstanceState.getBoolean("romexec"))
|
||||
loadRomExternal(startedByIntent.getStringExtra("ROM"),
|
||||
startedByIntent.getStringExtra("LIBRETRO"));
|
||||
else
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,19 +134,17 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
|
||||
public static final double getRefreshRate() {
|
||||
double rate = 0;
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
|
||||
.getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
String refresh_rate = prefs.getString("video_refresh_rate", "");
|
||||
if (!refresh_rate.isEmpty()) {
|
||||
try {
|
||||
rate = Double.parseDouble(refresh_rate);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e(TAG, "Cannot parse: " + refresh_rate + " as a double!");
|
||||
rate = MainMenuActivity.getInstance().getDisplayRefreshRate();
|
||||
rate = getInstance().getDisplayRefreshRate();
|
||||
}
|
||||
} else {
|
||||
rate = MainMenuActivity.getInstance().getDisplayRefreshRate();
|
||||
rate = getInstance().getDisplayRefreshRate();
|
||||
}
|
||||
|
||||
Log.i(TAG, "Using refresh rate: " + rate + " Hz.");
|
||||
@ -152,12 +170,29 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
|
||||
@TargetApi(17)
|
||||
public static int getLowLatencyOptimalSamplingRate() {
|
||||
AudioManager manager = (AudioManager) MainMenuActivity.getInstance()
|
||||
AudioManager manager = (AudioManager) getInstance()
|
||||
.getApplicationContext()
|
||||
.getSystemService(Context.AUDIO_SERVICE);
|
||||
return Integer.parseInt(manager
|
||||
.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE));
|
||||
}
|
||||
|
||||
@TargetApi(17)
|
||||
public static int getLowLatencyBufferSize() {
|
||||
AudioManager manager = (AudioManager) getInstance()
|
||||
.getApplicationContext()
|
||||
.getSystemService(Context.AUDIO_SERVICE);
|
||||
int buffersize = Integer.parseInt(manager
|
||||
.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER));
|
||||
Log.i(TAG, "Queried ideal buffer size (frames): " + buffersize);
|
||||
return buffersize;
|
||||
}
|
||||
|
||||
@TargetApi(17)
|
||||
public static boolean hasLowLatencyAudio() {
|
||||
PackageManager pm = getInstance().getPackageManager();
|
||||
return pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
|
||||
}
|
||||
|
||||
public static int getOptimalSamplingRate() {
|
||||
int ret;
|
||||
@ -170,27 +205,24 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
Log.i(TAG, "Using sampling rate: " + ret + " Hz");
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String sanitizeLibretroPath(String path) {
|
||||
String sanitized_name = path.substring(
|
||||
path.lastIndexOf("/") + 1,
|
||||
path.lastIndexOf("."));
|
||||
sanitized_name = sanitized_name.replace("neon", "");
|
||||
sanitized_name = sanitized_name.replace("libretro_", "");
|
||||
return sanitized_name;
|
||||
}
|
||||
|
||||
public static String getDefaultConfigPath() {
|
||||
String internal = System.getenv("INTERNAL_STORAGE");
|
||||
String external = System.getenv("EXTERNAL_STORAGE");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
|
||||
.getBaseContext());
|
||||
|
||||
boolean global_config_enable = prefs.getBoolean("global_config_enable",
|
||||
true);
|
||||
boolean config_same_as_native_lib_dir = libretro_path
|
||||
.equals(MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir);
|
||||
String append_path;
|
||||
if (!global_config_enable && (config_same_as_native_lib_dir == false)) {
|
||||
String sanitized_name = libretro_path.substring(
|
||||
libretro_path.lastIndexOf("/") + 1,
|
||||
libretro_path.lastIndexOf("."));
|
||||
sanitized_name = sanitized_name.replace("neon", "");
|
||||
sanitized_name = sanitized_name.replace("libretro_", "");
|
||||
append_path = File.separator + sanitized_name + "retroarch.cfg";
|
||||
if (getInstance().usePerCoreConfig()) {
|
||||
String sanitized_name = sanitizeLibretroPath(libretro_path);
|
||||
append_path = File.separator + sanitized_name + ".cfg";
|
||||
} else {
|
||||
append_path = File.separator + "retroarch.cfg";
|
||||
}
|
||||
@ -214,40 +246,138 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
else if (external != null
|
||||
&& new File(internal + append_path).canWrite())
|
||||
return external + append_path;
|
||||
else if ((MainMenuActivity.getInstance().getApplicationInfo().dataDir) != null)
|
||||
return (MainMenuActivity.getInstance().getApplicationInfo().dataDir)
|
||||
else if ((getInstance().getApplicationInfo().dataDir) != null)
|
||||
return (getInstance().getApplicationInfo().dataDir)
|
||||
+ append_path;
|
||||
else
|
||||
// emergency fallback, all else failed
|
||||
return "/mnt/sd" + append_path;
|
||||
}
|
||||
|
||||
public void updateConfigFile() {
|
||||
|
||||
private void readbackString(ConfigFile cfg, SharedPreferences.Editor edit, String key) {
|
||||
if (cfg.keyExists(key))
|
||||
edit.putString(key, cfg.getString(key));
|
||||
else
|
||||
edit.remove(key);
|
||||
}
|
||||
|
||||
private void readbackBool(ConfigFile cfg, SharedPreferences.Editor edit, String key) {
|
||||
if (cfg.keyExists(key))
|
||||
edit.putBoolean(key, cfg.getBoolean(key));
|
||||
else
|
||||
edit.remove(key);
|
||||
}
|
||||
|
||||
private void readbackDouble(ConfigFile cfg, SharedPreferences.Editor edit, String key) {
|
||||
if (cfg.keyExists(key))
|
||||
edit.putFloat(key, (float)cfg.getDouble(key));
|
||||
else
|
||||
edit.remove(key);
|
||||
}
|
||||
|
||||
private void readbackFloat(ConfigFile cfg, SharedPreferences.Editor edit, String key) {
|
||||
if (cfg.keyExists(key))
|
||||
edit.putFloat(key, cfg.getFloat(key));
|
||||
else
|
||||
edit.remove(key);
|
||||
}
|
||||
|
||||
private void readbackInt(ConfigFile cfg, SharedPreferences.Editor edit, String key) {
|
||||
if (cfg.keyExists(key))
|
||||
edit.putInt(key, cfg.getInt(key));
|
||||
else
|
||||
edit.remove(key);
|
||||
}
|
||||
|
||||
public void readbackConfigFile() {
|
||||
String path = getDefaultConfigPath();
|
||||
ConfigFile config;
|
||||
try {
|
||||
config = new ConfigFile(new File(getDefaultConfigPath()));
|
||||
config = new ConfigFile(new File(path));
|
||||
} catch (IOException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.i(TAG, "Config readback from: " + path);
|
||||
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
|
||||
readbackString(config, edit, "rgui_browser_directory");
|
||||
readbackString(config, edit, "savefile_directory");
|
||||
readbackString(config, edit, "savestate_directory");
|
||||
readbackBool(config, edit, "savefile_directory_enable"); // Ignored by RetroArch
|
||||
readbackBool(config, edit, "savestate_directory_enable"); // Ignored by RetroArch
|
||||
|
||||
readbackString(config, edit, "input_overlay");
|
||||
readbackBool(config, edit, "input_overlay_enable");
|
||||
readbackBool(config, edit, "video_scale_integer");
|
||||
readbackBool(config, edit, "video_smooth");
|
||||
readbackBool(config, edit, "video_threaded");
|
||||
readbackBool(config, edit, "rewind_enable");
|
||||
readbackBool(config, edit, "savestate_auto_load");
|
||||
readbackBool(config, edit, "savestate_auto_save");
|
||||
readbackDouble(config, edit, "video_refresh_rate");
|
||||
|
||||
readbackBool(config, edit, "audio_rate_control");
|
||||
readbackBool(config, edit, "audio_enable");
|
||||
// TODO: other audio settings
|
||||
|
||||
readbackDouble(config, edit, "input_overlay_opacity");
|
||||
readbackBool(config, edit, "input_autodetect_enable");
|
||||
readbackInt(config, edit, "input_back_behavior");
|
||||
|
||||
readbackBool(config, edit, "video_allow_rotate");
|
||||
readbackBool(config, edit, "video_font_enable");
|
||||
|
||||
readbackBool(config, edit, "video_vsync");
|
||||
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
public void updateConfigFile() {
|
||||
String path = getDefaultConfigPath();
|
||||
ConfigFile config;
|
||||
try {
|
||||
config = new ConfigFile(new File(path));
|
||||
} catch (IOException e) {
|
||||
config = new ConfigFile();
|
||||
}
|
||||
|
||||
Log.i(TAG, "Writing config to: " + path);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
|
||||
.getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
|
||||
config.setString("libretro_path", libretro_path);
|
||||
config.setString("libretro_name", libretro_name);
|
||||
setCoreTitle(libretro_name);
|
||||
|
||||
config.setString("rgui_browser_directory",
|
||||
prefs.getString("rgui_browser_directory", ""));
|
||||
config.setBoolean("global_config_enable",
|
||||
prefs.getBoolean("global_config_enable", true));
|
||||
config.setBoolean("audio_rate_control",
|
||||
prefs.getBoolean("audio_rate_control", true));
|
||||
config.setInt("audio_out_rate",
|
||||
MainMenuActivity.getOptimalSamplingRate());
|
||||
config.setInt("audio_latency",
|
||||
prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
||||
|
||||
int optimalRate = getOptimalSamplingRate();
|
||||
config.setInt("audio_out_rate", optimalRate);
|
||||
|
||||
// Refactor this entire mess and make this usable for per-core config
|
||||
if (android.os.Build.VERSION.SDK_INT >= 17) {
|
||||
int buffersize = getLowLatencyBufferSize();
|
||||
|
||||
boolean lowLatency = hasLowLatencyAudio();
|
||||
Log.i(TAG, "Audio is low latency: " + (lowLatency ? "yes" : "no"));
|
||||
|
||||
if (lowLatency && !prefs.getBoolean("audio_high_latency", false)) {
|
||||
config.setInt("audio_latency", 64);
|
||||
config.setInt("audio_block_frames", buffersize);
|
||||
} else {
|
||||
config.setInt("audio_latency", prefs.getBoolean(
|
||||
"audio_high_latency", false) ? 160 : 64);
|
||||
config.setInt("audio_block_frames", 0);
|
||||
}
|
||||
} else {
|
||||
config.setInt("audio_latency",
|
||||
prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
||||
}
|
||||
|
||||
config.setBoolean("audio_enable",
|
||||
prefs.getBoolean("audio_enable", true));
|
||||
config.setBoolean("video_smooth",
|
||||
@ -281,10 +411,12 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
"0")));
|
||||
|
||||
config.setDouble("video_refresh_rate",
|
||||
MainMenuActivity.getRefreshRate());
|
||||
getRefreshRate());
|
||||
config.setBoolean("video_threaded",
|
||||
prefs.getBoolean("video_threaded", true));
|
||||
|
||||
// Refactor these weird values - 'full', 'auto', 'square', whatever -
|
||||
// go by what we have in RGUI - makes maintaining state easier too
|
||||
String aspect = prefs.getString("video_aspect_ratio", "auto");
|
||||
if (aspect.equals("full")) {
|
||||
config.setBoolean("video_force_aspect", false);
|
||||
@ -312,9 +444,10 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
&& new File(shaderPath).exists());
|
||||
|
||||
boolean useOverlay = prefs.getBoolean("input_overlay_enable", true);
|
||||
config.setBoolean("input_overlay_enable", useOverlay); // Not used by RetroArch directly.
|
||||
if (useOverlay) {
|
||||
String overlayPath = prefs
|
||||
.getString("input_overlay", (MainMenuActivity.getInstance()
|
||||
.getString("input_overlay", (getInstance()
|
||||
.getApplicationInfo().dataDir)
|
||||
+ "/overlays/snes-landscape.cfg");
|
||||
config.setString("input_overlay", overlayPath);
|
||||
@ -323,7 +456,6 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
} else {
|
||||
config.setString("input_overlay", "");
|
||||
}
|
||||
|
||||
config.setString(
|
||||
"savefile_directory",
|
||||
prefs.getBoolean("savefile_directory_enable", false) ? prefs
|
||||
@ -340,7 +472,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
config.setBoolean("video_font_enable",
|
||||
prefs.getBoolean("video_font_enable", true));
|
||||
|
||||
config.setString("game_history_path", MainMenuActivity.getInstance()
|
||||
config.setString("game_history_path", getInstance()
|
||||
.getApplicationInfo().dataDir + "/retroarch-history.txt");
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
@ -354,11 +486,10 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
String confPath = getDefaultConfigPath();
|
||||
try {
|
||||
config.write(new File(confPath));
|
||||
config.write(new File(path));
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to save config file to: " + confPath);
|
||||
Log.e(TAG, "Failed to save config file to: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,20 +625,28 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static SharedPreferences getPreferences() {
|
||||
return PreferenceManager.getDefaultSharedPreferences(getInstance().getBaseContext());
|
||||
}
|
||||
|
||||
public void setModule(String core_path, String core_name) {
|
||||
updateConfigFile();
|
||||
|
||||
libretro_path = core_path;
|
||||
libretro_name = core_name;
|
||||
File libretro_path_file = new File(core_path);
|
||||
setCoreTitle((libretro_path_file.isDirectory() == true) ? "No core"
|
||||
: core_name);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("libretro_path", libretro_path);
|
||||
edit.putString("libretro_name", libretro_name);
|
||||
edit.commit();
|
||||
|
||||
if (usePerCoreConfig())
|
||||
refreshPreferenceScreen();
|
||||
else {
|
||||
setCoreTitle(libretro_name); // this still needs to be applied
|
||||
}
|
||||
}
|
||||
|
||||
public void setCoreTitle(String core_name) {
|
||||
@ -533,8 +672,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putString("video_refresh_rate", Double
|
||||
@ -557,8 +695,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putBoolean("input_overlay_enable",
|
||||
@ -580,8 +717,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putBoolean("input_overlay_enable",
|
||||
@ -602,8 +738,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences.Editor edit = prefs
|
||||
.edit();
|
||||
edit.putString("video_refresh_rate", Double
|
||||
@ -621,6 +756,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
"Device either not detected in list or doesn't have any optimal settings in our database.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
refreshPreferenceScreen();
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -663,7 +800,7 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
|
||||
myIntent.putExtra("LIBRETRO", libretro_path);
|
||||
myIntent.putExtra("CONFIGFILE",
|
||||
MainMenuActivity.getDefaultConfigPath());
|
||||
getDefaultConfigPath());
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
@ -672,8 +809,13 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadRomExternal(String rom, String core) {
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle data) {
|
||||
super.onSaveInstanceState(data);
|
||||
data.putBoolean("romexec", true);
|
||||
}
|
||||
|
||||
private void loadRomExternal(String rom, String core) {
|
||||
updateConfigFile();
|
||||
Intent myIntent = new Intent(this, RetroActivity.class);
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(),
|
||||
@ -682,9 +824,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
.show();
|
||||
myIntent.putExtra("ROM", rom);
|
||||
myIntent.putExtra("LIBRETRO", core);
|
||||
myIntent.putExtra("CONFIGFILE", MainMenuActivity.getDefaultConfigPath());
|
||||
myIntent.putExtra("CONFIGFILE", getDefaultConfigPath());
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,12 @@ import java.io.File;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class ROMActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
String startPath = prefs.getString("rgui_browser_directory", "");
|
||||
if (!startPath.isEmpty() && new File(startPath).exists())
|
||||
super.setStartDirectory(startPath);
|
||||
|
@ -4,7 +4,6 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.Display;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
@ -18,7 +17,7 @@ public class RefreshRateSetOS extends Activity {
|
||||
final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
final Display display = wm.getDefaultDisplay();
|
||||
double rate = display.getRefreshRate();
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.valueOf(rate).toString());
|
||||
edit.commit();
|
||||
|
@ -2,6 +2,7 @@ package org.retroarch.browser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
@ -9,7 +10,27 @@ public class ReportIME extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
new AlertDialog.Builder(this).setMessage(current_ime).setNeutralButton("Close", null).show();
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(),
|
||||
Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
|
||||
final Activity ctx = this;
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(this)
|
||||
.setMessage(current_ime)
|
||||
.setNeutralButton("Close",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
ctx.finish();
|
||||
}
|
||||
}).setCancelable(true)
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
ctx.finish();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,9 @@
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1080</int>
|
||||
<string key="IBDocument.SystemVersion">12D78</string>
|
||||
<string key="IBDocument.SystemVersion">12E55</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.37</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.39</string>
|
||||
<string key="IBDocument.HIToolboxVersion">626.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
@ -297,6 +297,28 @@
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="1225315">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">Go</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="715293634">
|
||||
<string key="NSTitle">Go</string>
|
||||
<array class="NSMutableArray" key="NSMenuItems">
|
||||
<object class="NSMenuItem" id="777071989">
|
||||
<reference key="NSMenu" ref="715293634"/>
|
||||
<string key="NSTitle">Cores Directory</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="713487014">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">Window</string>
|
||||
@ -397,11 +419,9 @@
|
||||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="439893737">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrameSize">{480, 360}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
@ -420,7 +440,7 @@
|
||||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="327272550">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSTextField" id="981013832">
|
||||
@ -428,7 +448,6 @@
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{17, 72}, {242, 17}}</string>
|
||||
<reference key="NSSuperview" ref="327272550"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="481701893"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:1535</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
@ -470,7 +489,6 @@
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{20, 45}, {239, 26}}</string>
|
||||
<reference key="NSSuperview" ref="327272550"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="59737118"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<int key="NSTag">1</int>
|
||||
@ -499,7 +517,7 @@
|
||||
<object class="NSComboTableView" key="NSTableView" id="845451530">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrameSize">{13, 0}</string>
|
||||
<string key="NSFrameSize">{15, 0}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:24</string>
|
||||
@ -508,7 +526,7 @@
|
||||
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
|
||||
<array class="NSMutableArray" key="NSTableColumns">
|
||||
<object class="NSTableColumn">
|
||||
<double key="NSWidth">10</double>
|
||||
<double key="NSWidth">12</double>
|
||||
<double key="NSMinWidth">10</double>
|
||||
<double key="NSMaxWidth">1000</double>
|
||||
<object class="NSTableHeaderCell" key="NSHeaderCell">
|
||||
@ -559,7 +577,7 @@
|
||||
</object>
|
||||
<double key="NSRowHeight">19</double>
|
||||
<string key="NSAction">tableViewAction:</string>
|
||||
<int key="NSTvFlags">-765427712</int>
|
||||
<int key="NSTvFlags">-767524864</int>
|
||||
<reference key="NSDelegate" ref="50876060"/>
|
||||
<reference key="NSDataSource" ref="50876060"/>
|
||||
<reference key="NSTarget" ref="50876060"/>
|
||||
@ -578,7 +596,6 @@
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{180, 13}, {82, 32}}</string>
|
||||
<reference key="NSSuperview" ref="327272550"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="404714727">
|
||||
@ -599,8 +616,6 @@
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{276, 89}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="981013832"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:21</string>
|
||||
</object>
|
||||
@ -787,6 +802,14 @@
|
||||
</object>
|
||||
<int key="connectionID">584</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">showCoresDirectory:</string>
|
||||
<reference key="source" ref="976324537"/>
|
||||
<reference key="destination" ref="777071989"/>
|
||||
</object>
|
||||
<int key="connectionID">588</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
@ -823,6 +846,7 @@
|
||||
<reference ref="379814623"/>
|
||||
<reference ref="448692316"/>
|
||||
<reference ref="265357942"/>
|
||||
<reference ref="1225315"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
@ -1339,6 +1363,27 @@
|
||||
<reference key="object" ref="257009827"/>
|
||||
<reference key="parent" ref="835318025"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">585</int>
|
||||
<reference key="object" ref="1225315"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="715293634"/>
|
||||
</array>
|
||||
<reference key="parent" ref="649796088"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">586</int>
|
||||
<reference key="object" ref="715293634"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="777071989"/>
|
||||
</array>
|
||||
<reference key="parent" ref="1225315"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">587</int>
|
||||
<reference key="object" ref="777071989"/>
|
||||
<reference key="parent" ref="715293634"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
@ -1417,6 +1462,9 @@
|
||||
<string key="579.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="582.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="585.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="586.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="587.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="72.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="73.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="79.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
@ -1428,7 +1476,7 @@
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">584</int>
|
||||
<int key="maxID">588</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@ -1443,6 +1491,39 @@
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">RetroArch_OSX</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="coreWasChosen:">id</string>
|
||||
<string key="showCoresDirectory:">id</string>
|
||||
<string key="showPreferences:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="coreWasChosen:">
|
||||
<string key="name">coreWasChosen:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="showCoresDirectory:">
|
||||
<string key="name">showCoresDirectory:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="showPreferences:">
|
||||
<string key="name">showPreferences:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="_coreSelectSheet">NSWindow</string>
|
||||
<string key="window">NSWindow</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="_coreSelectSheet">
|
||||
<string key="name">_coreSelectSheet</string>
|
||||
<string key="candidateClassName">NSWindow</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="window">
|
||||
<string key="name">window</string>
|
||||
<string key="candidateClassName">NSWindow</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/RetroArch_OSX.h</string>
|
||||
|
@ -82,7 +82,7 @@
|
||||
if (cb.numberOfItems)
|
||||
[cb selectItemAtIndex:0];
|
||||
else
|
||||
apple_display_alert(@"No libretro cores were found.", @"RetroArch");
|
||||
apple_display_alert(@"No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there.", @"RetroArch");
|
||||
|
||||
// Run RGUI if needed
|
||||
if (!_wantReload)
|
||||
@ -239,6 +239,11 @@
|
||||
}
|
||||
|
||||
#pragma mark Menus
|
||||
- (IBAction)showCoresDirectory:(id)sender
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] openFile:self.corePath];
|
||||
}
|
||||
|
||||
- (IBAction)showPreferences:(id)sender
|
||||
{
|
||||
[[[NSWindowController alloc] initWithWindowNibName:@"Settings"] window];
|
||||
|
@ -17,6 +17,53 @@
|
||||
#import "../RetroArch/RetroArch_Apple.h"
|
||||
#include "../RetroArch/setting_data.h"
|
||||
|
||||
struct settings fake_settings;
|
||||
struct global fake_extern;
|
||||
|
||||
static const void* associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
@interface RASettingCell : NSTableCellView
|
||||
@property (strong) NSString* stringValue;
|
||||
@property (nonatomic) IBOutlet NSNumber* numericValue;
|
||||
@property (nonatomic) bool booleanValue;
|
||||
@property (nonatomic) const rarch_setting_t* setting;
|
||||
@end
|
||||
|
||||
@implementation RASettingCell
|
||||
- (void)setSetting:(const rarch_setting_t *)aSetting
|
||||
{
|
||||
_setting = aSetting;
|
||||
|
||||
switch (aSetting->type)
|
||||
{
|
||||
case ST_INT: self.numericValue = @(*(int*)aSetting->value); break;
|
||||
case ST_FLOAT: self.numericValue = @(*(float*)aSetting->value); break;
|
||||
case ST_STRING: self.stringValue = @((const char*)aSetting->value); break;
|
||||
case ST_PATH: self.stringValue = @((const char*)aSetting->value); break;
|
||||
case ST_BOOL: self.booleanValue = *(bool*)aSetting->value; break;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)doBrowse:(id)sender
|
||||
{
|
||||
NSOpenPanel* panel = [NSOpenPanel new];
|
||||
[panel runModal];
|
||||
|
||||
if (panel.URLs.count == 1)
|
||||
self.stringValue = panel.URL.path;
|
||||
}
|
||||
|
||||
- (IBAction)valueChanged:(id)sender
|
||||
{
|
||||
printf("GABOR\n");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@protocol RASettingView
|
||||
@property const rarch_setting_t* setting;
|
||||
@end
|
||||
|
||||
@interface RASettingsDelegate : NSObject<NSTableViewDataSource, NSTableViewDelegate,
|
||||
NSOutlineViewDataSource, NSOutlineViewDelegate>
|
||||
@end
|
||||
@ -37,6 +84,9 @@
|
||||
NSMutableArray* thisSubGroup = nil;
|
||||
_settings = [NSMutableArray array];
|
||||
|
||||
memcpy(&fake_settings, &g_settings, sizeof(struct settings));
|
||||
memcpy(&fake_extern, &g_extern, sizeof(struct global));
|
||||
|
||||
for (int i = 0; setting_data[i].type; i ++)
|
||||
{
|
||||
switch (setting_data[i].type)
|
||||
@ -44,7 +94,7 @@
|
||||
case ST_GROUP:
|
||||
{
|
||||
thisGroup = [NSMutableArray array];
|
||||
objc_setAssociatedObject(thisGroup, "NAME", [NSString stringWithFormat:@"%s", setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(thisGroup, associated_name_tag, [NSString stringWithFormat:@"%s", setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -58,7 +108,7 @@
|
||||
case ST_SUB_GROUP:
|
||||
{
|
||||
thisSubGroup = [NSMutableArray array];
|
||||
objc_setAssociatedObject(thisSubGroup, "NAME", [NSString stringWithFormat:@"%s", setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(thisSubGroup, associated_name_tag, [NSString stringWithFormat:@"%s", setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -83,43 +133,60 @@
|
||||
|
||||
- (IBAction)close:(id)sender
|
||||
{
|
||||
#if 0
|
||||
config_file_t* conf = config_file_new(0);
|
||||
for (int i = 0; setting_data[i].type; i ++)
|
||||
{
|
||||
switch (setting_data[i].type)
|
||||
{
|
||||
case ST_BOOL: config_set_bool (conf, setting_data[i].name, * (bool*)setting_data[i].value); break;
|
||||
case ST_INT: config_set_int (conf, setting_data[i].name, * (int*)setting_data[i].value); break;
|
||||
case ST_FLOAT: config_set_float (conf, setting_data[i].name, *(float*)setting_data[i].value); break;
|
||||
case ST_PATH: config_set_string(conf, setting_data[i].name, (char*)setting_data[i].value); break;
|
||||
case ST_STRING: config_set_string(conf, setting_data[i].name, (char*)setting_data[i].value); break;
|
||||
case ST_HEX: break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
config_file_free(conf);
|
||||
#endif
|
||||
|
||||
[NSApplication.sharedApplication stopModal];
|
||||
[NSApplication.sharedApplication endSheet:_window returnCode:0];
|
||||
[_window orderOut:nil];
|
||||
}
|
||||
|
||||
- (void)readConfigFile:(const char*)path
|
||||
{
|
||||
config_file_t* conf = config_file_new(path);
|
||||
if (conf)
|
||||
{
|
||||
for (int i = 0; setting_data[i].type; i ++)
|
||||
{
|
||||
switch (setting_data[i].type)
|
||||
{
|
||||
case ST_BOOL: config_get_bool (conf, setting_data[i].name, (bool*)setting_data[i].value); break;
|
||||
case ST_INT: config_get_int (conf, setting_data[i].name, (int*)setting_data[i].value); break;
|
||||
case ST_FLOAT: config_get_float(conf, setting_data[i].name, (float*)setting_data[i].value); break;
|
||||
case ST_PATH: config_get_array(conf, setting_data[i].name, (char*)setting_data[i].value, setting_data[i].size); break;
|
||||
case ST_STRING: config_get_array(conf, setting_data[i].name, (char*)setting_data[i].value, setting_data[i].size); break;
|
||||
case ST_HEX: break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark View Builders
|
||||
- (NSView*)labelAccessoryFor:(NSString*)text onTable:(NSTableView*)table
|
||||
{
|
||||
NSTextField* result = [table makeViewWithIdentifier:@"label" owner:self];
|
||||
if (result == nil)
|
||||
{
|
||||
result = [NSTextField new];
|
||||
result.bordered = NO;
|
||||
result.drawsBackground = NO;
|
||||
result.identifier = @"label";
|
||||
}
|
||||
|
||||
RASettingCell* result = [table makeViewWithIdentifier:@"RALabelSetting" owner:nil];
|
||||
result.stringValue = text;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSView*)booleanAccessoryFor:(const rarch_setting_t*)setting onTable:(NSTableView*)table
|
||||
{
|
||||
NSButton* result = [table makeViewWithIdentifier:@"boolean" owner:self];
|
||||
|
||||
if (!result)
|
||||
{
|
||||
result = [NSButton new];
|
||||
result.buttonType = NSSwitchButton;
|
||||
result.title = @"";
|
||||
}
|
||||
|
||||
result.state = *(bool*)setting->value;
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Section Table
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView*)view
|
||||
{
|
||||
@ -128,7 +195,7 @@
|
||||
|
||||
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||
{
|
||||
return [self labelAccessoryFor:objc_getAssociatedObject(_settings[row], "NAME") onTable:tableView];
|
||||
return [self labelAccessoryFor:objc_getAssociatedObject(_settings[row], associated_name_tag) onTable:tableView];
|
||||
}
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||
@ -153,12 +220,16 @@
|
||||
return [item isKindOfClass:[NSArray class]];
|
||||
}
|
||||
|
||||
- (BOOL)validateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
||||
{
|
||||
if ([item isKindOfClass:[NSArray class]])
|
||||
{
|
||||
if ([tableColumn.identifier isEqualToString:@"title"])
|
||||
return [self labelAccessoryFor:objc_getAssociatedObject(item, "NAME") onTable:outlineView];
|
||||
return [self labelAccessoryFor:objc_getAssociatedObject(item, associated_name_tag) onTable:outlineView];
|
||||
else
|
||||
return [self labelAccessoryFor:[NSString stringWithFormat:@"%d items", (int)[item count]] onTable:outlineView];
|
||||
}
|
||||
@ -167,25 +238,20 @@
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"title"])
|
||||
return [self labelAccessoryFor:[NSString stringWithFormat:@"%s", setting->short_description] onTable:outlineView]; // < The outlineView will fill the value
|
||||
return [self labelAccessoryFor:@(setting->short_description) onTable:outlineView];
|
||||
else if([tableColumn.identifier isEqualToString:@"accessory"])
|
||||
{
|
||||
RASettingCell* s = nil;
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: return [self booleanAccessoryFor:setting onTable:outlineView];
|
||||
|
||||
case ST_PATH:
|
||||
case ST_STRING:
|
||||
return [self labelAccessoryFor:[NSString stringWithFormat:@"%s", (const char*)setting->value] onTable:outlineView];
|
||||
|
||||
case ST_INT:
|
||||
return [self labelAccessoryFor:[NSString stringWithFormat:@"%d", *(int*)setting->value] onTable:outlineView];
|
||||
|
||||
case ST_FLOAT:
|
||||
return [self labelAccessoryFor:[NSString stringWithFormat:@"%f", *(float*)setting->value] onTable:outlineView];
|
||||
|
||||
default: abort();
|
||||
case ST_BOOL: s = [outlineView makeViewWithIdentifier:@"RABooleanSetting" owner:nil]; break;
|
||||
case ST_INT: s = [outlineView makeViewWithIdentifier:@"RANumericSetting" owner:nil]; break;
|
||||
case ST_FLOAT: s = [outlineView makeViewWithIdentifier:@"RANumericSetting" owner:nil]; break;
|
||||
case ST_PATH: s = [outlineView makeViewWithIdentifier:@"RAPathSetting" owner:nil]; break;
|
||||
case ST_STRING: s = [outlineView makeViewWithIdentifier:@"RAStringSetting" owner:nil]; break;
|
||||
}
|
||||
s.setting = setting;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ typedef struct
|
||||
const char* name;
|
||||
|
||||
void* value;
|
||||
uint32_t size;
|
||||
|
||||
const char* short_description;
|
||||
const char* long_description;
|
||||
@ -40,18 +41,25 @@ typedef struct
|
||||
bool allow_blank;
|
||||
} rarch_setting_t;
|
||||
|
||||
#define START_GROUP(NAME) { ST_GROUP, NAME, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define END_GROUP() { ST_END_GROUP, 0, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define START_SUB_GROUP(NAME) { ST_SUB_GROUP, NAME, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define END_SUB_GROUP() { ST_END_SUB_GROUP, 0, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define START_GROUP(NAME) { ST_GROUP, NAME, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define END_GROUP() { ST_END_GROUP, 0, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_BOOL(TARGET, NAME, SHORT) { ST_BOOL, NAME, &TARGET, SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_INT(TARGET, NAME, SHORT) { ST_INT, NAME, &TARGET, SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_FLOAT(TARGET, NAME, SHORT) { ST_FLOAT, NAME, &TARGET, SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_PATH(TARGET, NAME, SHORT) { ST_PATH, NAME, &TARGET, SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_STRING(TARGET, NAME, SHORT) { ST_STRING, NAME, &TARGET, SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_HEX(TARGET, NAME, SHORT) { ST_HEX, NAME, &TARGET, SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
extern struct settings fake_settings;
|
||||
extern struct global fake_extern;
|
||||
|
||||
// HACK
|
||||
#define g_settings fake_settings
|
||||
#define g_extern fake_extern
|
||||
|
||||
#define START_GROUP(NAME) { ST_GROUP, NAME },
|
||||
#define END_GROUP() { ST_END_GROUP },
|
||||
#define START_SUB_GROUP(NAME) { ST_SUB_GROUP, NAME },
|
||||
#define END_SUB_GROUP() { ST_END_SUB_GROUP },
|
||||
#define START_GROUP(NAME) { ST_GROUP, NAME, 0, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define END_GROUP() { ST_END_GROUP, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_BOOL(TARGET, NAME, SHORT) { ST_BOOL, NAME, &TARGET, sizeof(TARGET), SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_INT(TARGET, NAME, SHORT) { ST_INT, NAME, &TARGET, sizeof(TARGET), SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_FLOAT(TARGET, NAME, SHORT) { ST_FLOAT, NAME, &TARGET, sizeof(TARGET), SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_PATH(TARGET, NAME, SHORT) { ST_PATH, NAME, &TARGET, sizeof(TARGET), SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_STRING(TARGET, NAME, SHORT) { ST_STRING, NAME, &TARGET, sizeof(TARGET), SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
#define CONFIG_HEX(TARGET, NAME, SHORT) { ST_HEX, NAME, &TARGET, sizeof(TARGET), SHORT, 0, 0, 0, 0.0, 0.0, false },
|
||||
|
||||
const rarch_setting_t setting_data[] =
|
||||
{
|
||||
@ -162,8 +170,8 @@ const rarch_setting_t setting_data[] =
|
||||
/* Input: Overlay */
|
||||
#ifdef HAVE_OVERLAY
|
||||
CONFIG_PATH(g_settings.input.overlay, "input_overlay", "Input Overlay")
|
||||
CONFIG_FLOAT(g_settings.input.overlay_opacity, "overlay_opacity", "Overlay Opacity")
|
||||
CONFIG_FLOAT(g_settings.input.overlay_scale, "overlay_scale", "Overlay Scale")
|
||||
CONFIG_FLOAT(g_settings.input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity")
|
||||
CONFIG_FLOAT(g_settings.input.overlay_scale, "input_overlay_scale", "Overlay Scale")
|
||||
#endif
|
||||
|
||||
/* Input: Android */
|
||||
@ -266,4 +274,8 @@ const rarch_setting_t setting_data[] =
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
// HACK
|
||||
#undef g_settings fake_settings
|
||||
#undef g_extern fake_extern
|
||||
|
||||
#endif
|
@ -110,6 +110,11 @@ char* ios_get_rarch_system_directory()
|
||||
return self.sections[indexPath.section][indexPath.row + 1];
|
||||
}
|
||||
|
||||
- (void)reset
|
||||
{
|
||||
self.sections = [NSMutableArray array];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
@ -303,7 +303,6 @@
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_PERFORMANCE_MODE",
|
||||
"-DWANT_RPNG",
|
||||
"-DHAVE_COREAUDIO",
|
||||
"-DHAVE_DYNAMIC",
|
||||
@ -358,7 +357,6 @@
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_PERFORMANCE_MODE",
|
||||
"-DRARCH_MOBILE",
|
||||
"-DHAVE_COREAUDIO",
|
||||
"-DHAVE_DYNAMIC",
|
||||
|
@ -367,7 +367,6 @@
|
||||
"-DLSB_FIRST",
|
||||
"-DHAVE_THREAD",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_PERFORMANCE_MODE",
|
||||
"-DRARCH_MOBILE",
|
||||
"-std=gnu99",
|
||||
"-DHAVE_COREAUDIO",
|
||||
@ -417,7 +416,6 @@
|
||||
"-DLSB_FIRST",
|
||||
"-DHAVE_THREAD",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_PERFORMANCE_MODE",
|
||||
"-DRARCH_MOBILE",
|
||||
"-std=gnu99",
|
||||
"-DHAVE_COREAUDIO",
|
||||
@ -458,7 +456,6 @@
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_PERFORMANCE_MODE",
|
||||
"-DRARCH_MOBILE",
|
||||
"-DHAVE_COREAUDIO",
|
||||
"-DHAVE_DYNAMIC",
|
||||
@ -501,7 +498,6 @@
|
||||
"-DINLINE=inline",
|
||||
"-DLSB_FIRST",
|
||||
"-D__LIBRETRO__",
|
||||
"-DRARCH_PERFORMANCE_MODE",
|
||||
"-DRARCH_MOBILE",
|
||||
"-DHAVE_COREAUDIO",
|
||||
"-DHAVE_DYNAMIC",
|
||||
|
@ -29,50 +29,47 @@
|
||||
{
|
||||
NSString* _path;
|
||||
NSMutableArray* _sectionNames;
|
||||
id<RADirectoryListDelegate> _delegate;
|
||||
}
|
||||
|
||||
+ (id)directoryListAtBrowseRoot
|
||||
{
|
||||
NSString* rootPath = RetroArch_iOS.get.documentsDirectory;
|
||||
NSString* ragPath = [rootPath stringByAppendingPathComponent:@"RetroArchGames"];
|
||||
RADirectoryList* list = [RADirectoryList directoryListForPath:path_is_directory(ragPath.UTF8String) ? ragPath : rootPath];
|
||||
return list;
|
||||
}
|
||||
|
||||
+ (id)directoryListForPath:(NSString*)path
|
||||
{
|
||||
// NOTE: Don't remove or ignore this abstraction, this function will be expanded when cover art comes back.
|
||||
return [[RADirectoryList alloc] initWithPath:path];
|
||||
}
|
||||
|
||||
- (id)initWithPath:(NSString*)path
|
||||
- (id)initWithPath:(NSString*)path delegate:(id<RADirectoryListDelegate>)delegate
|
||||
{
|
||||
_path = path;
|
||||
_delegate = delegate;
|
||||
|
||||
self = [super initWithStyle:UITableViewStylePlain];
|
||||
self.title = path.lastPathComponent;
|
||||
self.hidesHeaders = YES;
|
||||
|
||||
NSMutableArray *toolbarButtons = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
NSMutableArray *toolbarButtons = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
|
||||
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)];
|
||||
refreshButton.style = UIBarButtonItemStyleBordered;
|
||||
[toolbarButtons addObject:refreshButton];
|
||||
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)];
|
||||
refreshButton.style = UIBarButtonItemStyleBordered;
|
||||
[toolbarButtons addObject:refreshButton];
|
||||
|
||||
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
|
||||
[toolbarButtons addObject:flexibleSpace];
|
||||
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
|
||||
[toolbarButtons addObject:flexibleSpace];
|
||||
|
||||
UIBarButtonItem *newFolderButton = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:self action:@selector(createNewFolder)];
|
||||
[toolbarButtons addObject:newFolderButton];
|
||||
UIBarButtonItem *newFolderButton = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:self action:@selector(createNewFolder)];
|
||||
[toolbarButtons addObject:newFolderButton];
|
||||
|
||||
[[[RetroArch_iOS get] toolbar] setItems:toolbarButtons];
|
||||
[self setToolbarItems:toolbarButtons];
|
||||
|
||||
[self refresh];
|
||||
[[[RetroArch_iOS get] toolbar] setItems:toolbarButtons];
|
||||
[self setToolbarItems:toolbarButtons];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[self refresh];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated
|
||||
{
|
||||
[self reset];
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
static const char sectionNames[28] = { '/', '#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
|
||||
@ -127,37 +124,27 @@
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
RADirectoryItem* path = (RADirectoryItem*)[self itemForIndexPath:indexPath];
|
||||
|
||||
if(path.isDirectory)
|
||||
[[RetroArch_iOS get] pushViewController:[RADirectoryList directoryListForPath:path.path] animated:YES];
|
||||
else
|
||||
{
|
||||
if (access(_path.UTF8String, R_OK | W_OK | X_OK))
|
||||
apple_display_alert(@"The directory containing the selected file has limited permissions. This may "
|
||||
"prevent zipped games from loading, and will cause some cores to not function.", 0);
|
||||
|
||||
[[RetroArch_iOS get] pushViewController:[[RAModuleList alloc] initWithGame:path.path] animated:YES];
|
||||
}
|
||||
[_delegate directoryList:self itemWasSelected:[self itemForIndexPath:indexPath]];
|
||||
}
|
||||
|
||||
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
RADirectoryItem* path = (RADirectoryItem*)[self itemForIndexPath:indexPath];
|
||||
static NSString *CellIdentifier = @"path";
|
||||
static NSString* const cell_types[2] = { @"file", @"folder" };
|
||||
static NSString* const icon_types[2] = { @"ic_file", @"ic_dir" };
|
||||
static const UITableViewCellAccessoryType accessory_types[2] = { UITableViewCellAccessoryDetailDisclosureButton,
|
||||
UITableViewCellAccessoryDisclosureIndicator };
|
||||
RADirectoryItem* path = [self itemForIndexPath:indexPath];
|
||||
uint32_t type_id = path.isDirectory ? 1 : 0;
|
||||
|
||||
UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
||||
cell = (cell != nil) ? cell : [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
|
||||
cell.textLabel.text = [path.path lastPathComponent];
|
||||
cell.accessoryType = (path.isDirectory) ? UITableViewCellAccessoryDisclosureIndicator : UITableViewCellAccessoryNone;
|
||||
|
||||
if (path.isDirectory) {
|
||||
cell.imageView.image = [UIImage imageNamed:@"ic_dir"];
|
||||
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
||||
} else {
|
||||
cell.imageView.image = [UIImage imageNamed:@"ic_file"];
|
||||
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
|
||||
UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:cell_types[type_id]];
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cell_types[type_id]];
|
||||
cell.imageView.image = [UIImage imageNamed:icon_types[type_id]];
|
||||
cell.accessoryType = accessory_types[type_id];
|
||||
}
|
||||
|
||||
cell.textLabel.text = [path.path lastPathComponent];
|
||||
|
||||
return cell;
|
||||
}
|
||||
@ -224,15 +211,14 @@
|
||||
|
||||
@implementation RAModuleList
|
||||
{
|
||||
NSString* _game;
|
||||
id<RAModuleListDelegate> _delegate;
|
||||
}
|
||||
|
||||
- (id)initWithGame:(NSString*)path
|
||||
- (id)initWithGame:(NSString*)path delegate:(id<RAModuleListDelegate>)delegate
|
||||
{
|
||||
self = [super initWithStyle:UITableViewStyleGrouped];
|
||||
[self setTitle:[path lastPathComponent]];
|
||||
|
||||
_game = path;
|
||||
[self setTitle:path ? [path lastPathComponent] : @"Cores"];
|
||||
_delegate = delegate;
|
||||
|
||||
// Load the modules with their data
|
||||
NSArray* moduleList = [RAModuleInfo getModules];
|
||||
@ -242,8 +228,8 @@
|
||||
|
||||
for (RAModuleInfo* i in moduleList)
|
||||
{
|
||||
if ([i supportsFileAtPath:_game]) [supported addObject:i];
|
||||
else [other addObject:i];
|
||||
if (path && [i supportsFileAtPath:path]) [supported addObject:i];
|
||||
else [other addObject:i];
|
||||
}
|
||||
|
||||
if (supported.count > 1)
|
||||
@ -257,7 +243,7 @@
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
apple_run_core((RAModuleInfo*)[self itemForIndexPath:indexPath], _game.UTF8String);
|
||||
[_delegate moduleList:self itemWasSelected:[self itemForIndexPath:indexPath]];
|
||||
}
|
||||
|
||||
- (void)infoButtonTapped:(id)sender
|
||||
@ -363,21 +349,8 @@
|
||||
NSString *directoryPath = [currentDirectoryPath stringByAppendingPathComponent:cell.textLabel.text];
|
||||
NSString *newPath = [directoryPath stringByAppendingPathComponent:fileName];
|
||||
|
||||
BOOL didMove = [[NSFileManager defaultManager] moveItemAtPath:selectedFilePath toPath:newPath error:nil];
|
||||
|
||||
if (didMove) {
|
||||
NSArray *viewsControllers = [[self presentingViewController] childViewControllers];
|
||||
|
||||
// Searches for RADirectoryList instance and call the refresh method
|
||||
for (int i = 0; i < viewsControllers.count; i++) {
|
||||
if ([viewsControllers[i] isKindOfClass:[RADirectoryList class]]) {
|
||||
[viewsControllers[i] refresh];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (![[NSFileManager defaultManager] moveItemAtPath:selectedFilePath toPath:newPath error:nil])
|
||||
apple_display_alert(@"It was not possible to move the file", 0);
|
||||
}
|
||||
|
||||
[self dismissViewController];
|
||||
}
|
||||
|
@ -17,13 +17,16 @@
|
||||
#ifndef __RARCH_IOS_PLATFORM_H
|
||||
#define __RARCH_IOS_PLATFORM_H
|
||||
|
||||
#include "views.h"
|
||||
|
||||
@interface RAGameView : UIViewController
|
||||
+ (RAGameView*)get;
|
||||
- (void)openPauseMenu;
|
||||
- (void)closePauseMenu;
|
||||
@end
|
||||
|
||||
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform>
|
||||
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform,
|
||||
RADirectoryListDelegate, RAModuleListDelegate>
|
||||
|
||||
+ (RetroArch_iOS*)get;
|
||||
|
||||
|
@ -85,6 +85,7 @@ static void handle_touch_event(NSArray* touches)
|
||||
@implementation RetroArch_iOS
|
||||
{
|
||||
UIWindow* _window;
|
||||
NSString* _path;
|
||||
|
||||
bool _isGameTop, _isRomList;
|
||||
uint32_t _settingMenusInBackStack;
|
||||
@ -117,13 +118,8 @@ static void handle_touch_event(NSArray* touches)
|
||||
else if (!path_make_and_check_directory(self.systemDirectory.UTF8String, 0755, R_OK | W_OK | X_OK))
|
||||
apple_display_alert([NSString stringWithFormat:@"Failed to create or access system directory: %@", self.systemDirectory], 0);
|
||||
else
|
||||
{
|
||||
[self pushViewController:[RADirectoryList directoryListAtBrowseRoot] animated:YES];
|
||||
[self refreshSystemConfig];
|
||||
|
||||
if (apple_use_tv_mode)
|
||||
apple_run_core(nil, 0);
|
||||
}
|
||||
[self beginBrowsingForFile];
|
||||
|
||||
|
||||
// Warn if there are no cores present
|
||||
if ([RAModuleInfo getModules].count == 0)
|
||||
@ -140,6 +136,45 @@ static void handle_touch_event(NSArray* touches)
|
||||
apple_enter_stasis();
|
||||
}
|
||||
|
||||
#pragma mark Frontend Browsing Logic
|
||||
- (void)beginBrowsingForFile
|
||||
{
|
||||
NSString* rootPath = RetroArch_iOS.get.documentsDirectory;
|
||||
NSString* ragPath = [rootPath stringByAppendingPathComponent:@"RetroArchGames"];
|
||||
NSString* target = path_is_directory(ragPath.UTF8String) ? ragPath : rootPath;
|
||||
|
||||
[self pushViewController:[[RADirectoryList alloc] initWithPath:target delegate:self] animated:YES];
|
||||
|
||||
[self refreshSystemConfig];
|
||||
if (apple_use_tv_mode)
|
||||
apple_run_core(nil, 0);
|
||||
|
||||
}
|
||||
|
||||
- (bool)directoryList:(id)list itemWasSelected:(RADirectoryItem*)path
|
||||
{
|
||||
if(path.isDirectory)
|
||||
[[RetroArch_iOS get] pushViewController:[[RADirectoryList alloc] initWithPath:path.path delegate:self] animated:YES];
|
||||
else
|
||||
{
|
||||
_path = path.path;
|
||||
|
||||
if (access([path.path stringByDeletingLastPathComponent].UTF8String, R_OK | W_OK | X_OK))
|
||||
apple_display_alert(@"The directory containing the selected file has limited permissions. This may "
|
||||
"prevent zipped games from loading, and will cause some cores to not function.", 0);
|
||||
|
||||
[[RetroArch_iOS get] pushViewController:[[RAModuleList alloc] initWithGame:path.path delegate:self] animated:YES];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
- (bool)moduleList:(id)list itemWasSelected:(RAModuleInfo*)module
|
||||
{
|
||||
apple_run_core(module, _path.UTF8String);
|
||||
return true;
|
||||
}
|
||||
|
||||
// UINavigationControllerDelegate
|
||||
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
|
||||
{
|
||||
@ -259,7 +294,7 @@ static void handle_touch_event(NSArray* touches)
|
||||
ios_set_bluetooth_mode(objc_get_value_from_config(conf, @"ios_btmode", @"keyboard"));
|
||||
|
||||
bool val;
|
||||
apple_use_tv_mode = config_get_bool(conf, "ios_tv_mode", & val) && val;
|
||||
apple_use_tv_mode = config_get_bool(conf, "ios_tv_mode", &val) && val;
|
||||
|
||||
config_file_free(conf);
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
|
||||
|
||||
[NSArray arrayWithObjects:@"Input",
|
||||
subpath_setting(config, @"input_overlay", @"Input Overlay", @"", overlay_path, @"cfg"),
|
||||
range_setting(config, @"overlay_opacity", @"Overlay Opacity", @"1.0", 0.0, 1.0),
|
||||
range_setting(config, @"input_overlay_opacity", @"Overlay Opacity", @"1.0", 0.0, 1.0),
|
||||
group_setting(@"System Keys", [NSArray arrayWithObjects:
|
||||
// TODO: Many of these strings will be cut off on an iPhone
|
||||
[NSArray arrayWithObjects:@"System Keys",
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
- (id)initWithStyle:(UITableViewStyle)style;
|
||||
- (id)itemForIndexPath:(NSIndexPath*)indexPath;
|
||||
- (void)reset;
|
||||
@end
|
||||
|
||||
// browser.m
|
||||
@ -38,17 +39,22 @@
|
||||
@end
|
||||
|
||||
// browser.m
|
||||
@protocol RADirectoryListDelegate
|
||||
- (bool)directoryList:(id)list itemWasSelected:(RADirectoryItem*)path;
|
||||
@end
|
||||
|
||||
@interface RADirectoryList : RATableViewController <UIActionSheetDelegate>
|
||||
@property (nonatomic, weak) RADirectoryItem *selectedItem;
|
||||
|
||||
+ (id)directoryListAtBrowseRoot;
|
||||
+ (id)directoryListForPath:(NSString*)path;
|
||||
- (id)initWithPath:(NSString*)path;
|
||||
- (id)initWithPath:(NSString*)path delegate:(id<RADirectoryListDelegate>)delegate;
|
||||
@end
|
||||
|
||||
// browser.m
|
||||
@protocol RAModuleListDelegate
|
||||
- (bool)moduleList:(id)list itemWasSelected:(RAModuleInfo*)module;
|
||||
@end
|
||||
|
||||
@interface RAModuleList : RATableViewController
|
||||
- (id)initWithGame:(NSString*)path;
|
||||
- (id)initWithGame:(NSString*)path delegate:(id<RAModuleListDelegate>)delegate;
|
||||
@end
|
||||
|
||||
// browser.m
|
||||
|
@ -115,6 +115,8 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
||||
if (!sl)
|
||||
goto error;
|
||||
|
||||
RARCH_LOG("[SLES]: Requested audio latency: %d ms.", latency);
|
||||
|
||||
GOTO_IF_FAIL(slCreateEngine(&sl->engine_object, 0, NULL, 0, NULL, NULL));
|
||||
GOTO_IF_FAIL(SLObjectItf_Realize(sl->engine_object, SL_BOOLEAN_FALSE));
|
||||
GOTO_IF_FAIL(SLObjectItf_GetInterface(sl->engine_object, SL_IID_ENGINE, &sl->engine));
|
||||
@ -122,7 +124,11 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
||||
GOTO_IF_FAIL(SLEngineItf_CreateOutputMix(sl->engine, &sl->output_mix, 0, NULL, NULL));
|
||||
GOTO_IF_FAIL(SLObjectItf_Realize(sl->output_mix, SL_BOOLEAN_FALSE));
|
||||
|
||||
sl->buf_size = next_pow2(32 * latency);
|
||||
if (g_settings.audio.block_frames)
|
||||
sl->buf_size = g_settings.audio.block_frames * 4;
|
||||
else
|
||||
sl->buf_size = next_pow2(32 * latency);
|
||||
|
||||
sl->buf_count = (latency * 4 * out_rate + 500) / 1000;
|
||||
sl->buf_count = (sl->buf_count + sl->buf_size / 2) / sl->buf_size;
|
||||
|
||||
@ -137,7 +143,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
||||
for (unsigned i = 0; i < sl->buf_count; i++)
|
||||
sl->buffer[i] = sl->buffer_chunk + i * sl->buf_size;
|
||||
|
||||
RARCH_LOG("[SLES] : Setting audio latency: Block size = %u, Blocks = %u, Total = %u ...\n",
|
||||
RARCH_LOG("[SLES]: Setting audio latency: Block size = %u, Blocks = %u, Total = %u ...\n",
|
||||
sl->buf_size, sl->buf_count, sl->buf_size * sl->buf_count);
|
||||
|
||||
fmt_pcm.formatType = SL_DATAFORMAT_PCM;
|
||||
|
2
driver.h
2
driver.h
@ -19,7 +19,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "boolean.h"
|
||||
#include "libretro.h"
|
||||
#include "libretro_private.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "msvc/msvc_compat.h"
|
||||
|
43
dynamic.c
43
dynamic.c
@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include "boolean.h"
|
||||
#include "libretro.h"
|
||||
#include "libretro_private.h"
|
||||
#include "dynamic_dummy.h"
|
||||
|
||||
#ifdef NEED_DYNAMIC
|
||||
@ -93,8 +93,6 @@ unsigned (*pretro_get_region)(void);
|
||||
void *(*pretro_get_memory_data)(unsigned);
|
||||
size_t (*pretro_get_memory_size)(unsigned);
|
||||
|
||||
static bool environment_cb(unsigned cmd, void *data);
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
#if defined(__APPLE__)
|
||||
#define DYNAMIC_EXT "dylib"
|
||||
@ -397,7 +395,7 @@ void init_libretro_sym(bool dummy)
|
||||
|
||||
load_symbols(dummy);
|
||||
|
||||
pretro_set_environment(environment_cb);
|
||||
pretro_set_environment(rarch_environment_cb);
|
||||
}
|
||||
|
||||
void uninit_libretro_sym(void)
|
||||
@ -471,7 +469,7 @@ void dylib_close(dylib_t lib)
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool environment_cb(unsigned cmd, void *data)
|
||||
bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
@ -758,6 +756,41 @@ static bool environment_cb(unsigned cmd, void *data)
|
||||
break;
|
||||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_LIBRETRO_PATH:
|
||||
RARCH_LOG("Environ (Private) SET_LIBRETRO_PATH.\n");
|
||||
|
||||
if (path_file_exists((const char*)data))
|
||||
strlcpy(g_settings.libretro, (const char*)data, sizeof(g_settings.libretro));
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_EXEC:
|
||||
case RETRO_ENVIRONMENT_EXEC_ESCAPE:
|
||||
|
||||
if (data)
|
||||
strlcpy(g_extern.fullpath, (const char*)data, sizeof(g_extern.fullpath));
|
||||
else
|
||||
*g_extern.fullpath = '\0';
|
||||
|
||||
#if !defined( HAVE_DYNAMIC) && defined(RARCH_CONSOLE)
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN_START_GAME);
|
||||
#elif defined(HAVE_DYNAMIC)
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
|
||||
#endif
|
||||
|
||||
if (cmd == RETRO_ENVIRONMENT_EXEC_ESCAPE)
|
||||
{
|
||||
RARCH_LOG("Environ (Private) EXEC_ESCAPE.\n");
|
||||
g_extern.exec = true;
|
||||
}
|
||||
else
|
||||
RARCH_LOG("Environ (Private) EXEC.\n");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
||||
return false;
|
||||
|
@ -101,6 +101,8 @@ extern unsigned (*pretro_get_region)(void);
|
||||
extern void *(*pretro_get_memory_data)(unsigned);
|
||||
extern size_t (*pretro_get_memory_size)(unsigned);
|
||||
|
||||
extern bool rarch_environment_cb(unsigned cmd, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -63,9 +63,7 @@ static bool libretro_install_core(const char *path_prefix,
|
||||
return false;
|
||||
}
|
||||
|
||||
strlcpy(g_settings.libretro, new_path,
|
||||
sizeof(g_settings.libretro));
|
||||
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)new_path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -444,27 +444,18 @@ void load_menu_game_history(unsigned game_index)
|
||||
rom_history_get_index(rgui->history,
|
||||
game_index, &path, &core_path, &core_name);
|
||||
|
||||
strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro));
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)core_path);
|
||||
|
||||
if (path)
|
||||
{
|
||||
rgui->load_no_rom = false;
|
||||
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui->load_no_rom = true;
|
||||
*g_extern.fullpath = '\0';
|
||||
}
|
||||
|
||||
#if !defined( HAVE_DYNAMIC) && defined(RARCH_CONSOLE)
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN_START_GAME);
|
||||
#elif defined(HAVE_DYNAMIC)
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)path);
|
||||
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
libretro_free_system_info(&rgui->info);
|
||||
libretro_get_system_info(g_settings.libretro, &rgui->info, NULL);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1500,9 +1500,7 @@ static void rgui_settings_video_options_populate_entries(rgui_handle_t *rgui)
|
||||
rgui_list_push(rgui->selection_buf, "Integer Scale", RGUI_SETTINGS_VIDEO_INTEGER_SCALE, 0);
|
||||
rgui_list_push(rgui->selection_buf, "Aspect Ratio", RGUI_SETTINGS_VIDEO_ASPECT_RATIO, 0);
|
||||
rgui_list_push(rgui->selection_buf, "Custom Ratio", RGUI_SETTINGS_CUSTOM_VIEWPORT, 0);
|
||||
#ifndef RARCH_PERFORMANCE_MODE
|
||||
rgui_list_push(rgui->selection_buf, "Toggle Fullscreen", RGUI_SETTINGS_TOGGLE_FULLSCREEN, 0);
|
||||
#endif
|
||||
rgui_list_push(rgui->selection_buf, "Rotation", RGUI_SETTINGS_VIDEO_ROTATION, 0);
|
||||
rgui_list_push(rgui->selection_buf, "VSync", RGUI_SETTINGS_VIDEO_VSYNC, 0);
|
||||
rgui_list_push(rgui->selection_buf, "Hard GPU Sync", RGUI_SETTINGS_VIDEO_HARD_SYNC, 0);
|
||||
@ -1854,12 +1852,10 @@ static int video_option_toggle_setting(rgui_handle_t *rgui, unsigned setting, rg
|
||||
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
break;
|
||||
|
||||
#ifndef RARCH_PERFORMANCE_MODE
|
||||
case RGUI_SETTINGS_TOGGLE_FULLSCREEN:
|
||||
if (action == RGUI_ACTION_OK)
|
||||
rarch_set_fullscreen(!g_settings.video.fullscreen);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GEKKO
|
||||
case RGUI_SETTINGS_VIDEO_RESOLUTION:
|
||||
@ -2654,7 +2650,8 @@ int rgui_iterate(rgui_handle_t *rgui)
|
||||
// Core selection on non-console just updates directory listing.
|
||||
// Will take affect on new ROM load.
|
||||
#elif defined(GEKKO) && defined(HW_RVL)
|
||||
strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro)); // Is this supposed to be here?
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)path);
|
||||
|
||||
fill_pathname_join(g_extern.fullpath, default_paths.core_dir,
|
||||
SALAMANDER_FILE, sizeof(g_extern.fullpath));
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME);
|
||||
|
@ -460,7 +460,6 @@ static int select_file(void *data, uint64_t input)
|
||||
char extensions[128];
|
||||
char comment[128];
|
||||
char path[PATH_MAX];
|
||||
bool ret = true;
|
||||
bool pop_menu_stack = false;
|
||||
font_params_t font_parms = {0};
|
||||
|
||||
@ -495,7 +494,7 @@ static int select_file(void *data, uint64_t input)
|
||||
if (input & (1ULL << DEVICE_NAV_B))
|
||||
{
|
||||
if (filebrowser_iterate(rgui->browser, FILEBROWSER_ACTION_PATH_ISDIR))
|
||||
ret = filebrowser_iterate(rgui->browser, FILEBROWSER_ACTION_OK);
|
||||
filebrowser_iterate(rgui->browser, FILEBROWSER_ACTION_OK);
|
||||
else
|
||||
{
|
||||
strlcpy(path, rgui->browser->current_dir.path, sizeof(path));
|
||||
@ -560,7 +559,7 @@ static int select_file(void *data, uint64_t input)
|
||||
true, menu_texture->width, menu_texture->height, 1.0f);
|
||||
break;
|
||||
case LIBRETRO_CHOICE:
|
||||
strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro));
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)path);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1222,8 +1222,11 @@ HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
|
||||
wcstombs(str_buffer, (const wchar_t *)XuiListGetText(m_menulist, index), sizeof(str_buffer));
|
||||
if(path_file_exists(rgui->browser->list->elems[index].data))
|
||||
{
|
||||
snprintf(g_settings.libretro, sizeof(g_settings.libretro), "%s\\%s",
|
||||
rgui->browser->current_dir.directory_path, str_buffer);
|
||||
struct retro_variable var;
|
||||
var.key = "core_path";
|
||||
snprintf(var.value, sizeof(var.value), "%s\\%s", rgui->browser->current_dir.directory_path, str_buffer);
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, &var);
|
||||
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN);
|
||||
process_input_ret = -1;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../libretro.h"
|
||||
#include "../../libretro_private.h"
|
||||
|
||||
#include "../../console/rarch_console.h"
|
||||
#include "../../file.h"
|
||||
@ -367,7 +367,11 @@ static int system_process_args(int argc, char *argv[], void *args)
|
||||
// a big hack: sometimes salamander doesn't save the new core it loads on first boot,
|
||||
// so we make sure g_settings.libretro is set here
|
||||
if (!g_settings.libretro[0] && argc >= 1 && strrchr(argv[0], '/'))
|
||||
strlcpy(g_settings.libretro, strrchr(argv[0], '/') + 1, sizeof(g_settings.libretro));
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, path);
|
||||
}
|
||||
|
||||
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
{
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "../../boolean.h"
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "../../dynamic.h"
|
||||
#include "../../libretro_private.h"
|
||||
|
||||
static void get_environment_settings(int argc, char *argv[], void *args)
|
||||
{
|
||||
@ -28,7 +30,8 @@ static void get_environment_settings(int argc, char *argv[], void *args)
|
||||
|
||||
/* FIXME - should this apply for both BB10 and PB? */
|
||||
#if defined(__QNX__) && !defined(HAVE_BB10)
|
||||
strlcpy(g_settings.libretro, "app/native/lib", sizeof(g_settings.libretro));
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, (void*)"app/native/lib");
|
||||
|
||||
strlcpy(g_extern.config_path, "app/native/retroarch.cfg", sizeof(g_extern.config_path));
|
||||
strlcpy(g_settings.video.shader_dir, "app/native/shaders_glsl", sizeof(g_settings.video.shader_dir));
|
||||
#endif
|
||||
|
@ -201,6 +201,7 @@ struct settings
|
||||
char driver[32];
|
||||
bool enable;
|
||||
unsigned out_rate;
|
||||
unsigned block_frames;
|
||||
float in_rate;
|
||||
char device[PATH_MAX];
|
||||
unsigned latency;
|
||||
@ -471,6 +472,8 @@ struct global
|
||||
|
||||
msg_queue_t *msg_queue;
|
||||
|
||||
bool exec;
|
||||
|
||||
// Rewind support.
|
||||
state_manager_t *state_manager;
|
||||
void *state_buf;
|
||||
|
@ -284,7 +284,7 @@ static void gfx_ctx_destroy(void)
|
||||
|
||||
if (g_egl_ctx)
|
||||
{
|
||||
gfx_ctx_bind_api(g_api);
|
||||
gfx_ctx_bind_api(g_api, 0, 0);
|
||||
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(g_egl_dpy, g_egl_ctx);
|
||||
}
|
||||
@ -298,7 +298,7 @@ static void gfx_ctx_destroy(void)
|
||||
|
||||
if (g_egl_surf)
|
||||
{
|
||||
gfx_ctx_bind_api(g_api);
|
||||
gfx_ctx_bind_api(g_api, 0, 0);
|
||||
eglDestroySurface(g_egl_dpy, g_egl_surf);
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ static void gfx_ctx_destroy(void)
|
||||
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
gfx_ctx_bind_api(g_api);
|
||||
gfx_ctx_bind_api(g_api, 0, 0);
|
||||
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglTerminate(g_egl_dpy);
|
||||
}
|
||||
@ -405,7 +405,7 @@ static bool gfx_ctx_init_egl_image_buffer(const video_info_t *video)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gfx_ctx_bind_api(g_api);
|
||||
gfx_ctx_bind_api(g_api, 0, 0);
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx);
|
||||
|
||||
g_smooth = video->smooth;
|
||||
@ -424,7 +424,7 @@ fail:
|
||||
g_pbuff_surf = EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
gfx_ctx_bind_api(g_api);
|
||||
gfx_ctx_bind_api(g_api, 0, 0);
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx);
|
||||
|
||||
return false;
|
||||
@ -453,7 +453,7 @@ static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned
|
||||
vgImageSubData(g_egl_vgimage[index], frame, pitch, (rgb32 ? VG_sXRGB_8888 : VG_sRGB_565), 0, 0, width, height);
|
||||
*image_handle = eglBuffer[index];
|
||||
|
||||
gfx_ctx_bind_api(g_api);
|
||||
gfx_ctx_bind_api(g_api, 0, 0);
|
||||
eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx);
|
||||
|
||||
return ret;
|
||||
|
@ -472,10 +472,10 @@ static bool gfx_ctx_set_video_mode(
|
||||
if (!fullscreen)
|
||||
{
|
||||
SetMenu(g_hwnd, LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU)));
|
||||
RECT rcTemp = {0, 0, g_resize_height, 0x7FFF}; // 0x7FFF="Infinite" height
|
||||
RECT rcTemp = {0, 0, width, 0x7FFF}; // 0x7FFF = "Infinite" height
|
||||
SendMessage(g_hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rcTemp); // recalculate margin, taking possible menu wrap into account
|
||||
g_resize_height += rcTemp.top + rect.top; // extend by new top margin and substract previous margin
|
||||
SetWindowPos(g_hwnd, NULL, 0, 0, g_resize_width, g_resize_height, SWP_NOMOVE);
|
||||
unsigned menu_height = rcTemp.top + rect.top; // rect.top is negative after AdjustWindowRect().
|
||||
SetWindowPos(g_hwnd, NULL, 0, 0, width, height + menu_height, SWP_NOMOVE);
|
||||
}
|
||||
|
||||
if (!fullscreen || windowed_full)
|
||||
|
@ -35,6 +35,7 @@ static bool gl_init_font(void *data, const char *font_path, float font_size)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl->max_font_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -124,6 +125,11 @@ static void adjust_power_of_two(gl_t *gl, struct font_rect *geom)
|
||||
geom->pot_width = next_pow2(geom->width);
|
||||
geom->pot_height = next_pow2(geom->height);
|
||||
|
||||
if (geom->pot_width > gl->max_font_size)
|
||||
geom->pot_width = gl->max_font_size;
|
||||
if (geom->pot_height > gl->max_font_size)
|
||||
geom->pot_height = gl->max_font_size;
|
||||
|
||||
if ((geom->pot_width > gl->font_tex_w) || (geom->pot_height > gl->font_tex_h))
|
||||
{
|
||||
gl->font_tex_buf = (uint32_t*)realloc(gl->font_tex_buf,
|
||||
|
@ -207,6 +207,7 @@ typedef struct gl
|
||||
const gl_font_renderer_t *font_ctx;
|
||||
const font_renderer_driver_t *font_driver;
|
||||
GLuint font_tex;
|
||||
GLint max_font_size;
|
||||
int font_tex_w, font_tex_h;
|
||||
uint32_t *font_tex_buf;
|
||||
char font_last_msg[256];
|
||||
|
@ -357,6 +357,8 @@ enum retro_mod
|
||||
|
||||
// If set, this call is not part of the public libretro API yet. It can change or be removed at any time.
|
||||
#define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000
|
||||
// Environment callback to be used internally in frontend.
|
||||
#define RETRO_ENVIRONMENT_PRIVATE 0x20000
|
||||
|
||||
// Environment commands.
|
||||
#define RETRO_ENVIRONMENT_SET_ROTATION 1 // const unsigned * --
|
||||
@ -445,7 +447,7 @@ enum retro_mod
|
||||
// If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or NULL to retro_video_refresh_t.
|
||||
#define RETRO_ENVIRONMENT_GET_VARIABLE 15
|
||||
// struct retro_variable * --
|
||||
// Interface to aquire user-defined information from environment
|
||||
// Interface to acquire user-defined information from environment
|
||||
// that cannot feasibly be supported in a multi-system way.
|
||||
// 'key' should be set to a key which has already been set by SET_VARIABLES.
|
||||
// 'data' will be set to a value or NULL.
|
||||
@ -509,7 +511,7 @@ enum retro_mod
|
||||
// Lets the core know how much time has passed since last invocation of retro_run().
|
||||
// The frontend can tamper with the timing to fake fast-forward, slow-motion, frame stepping, etc.
|
||||
// In this case the delta time will use the reference value in frame_time_callback..
|
||||
|
||||
|
||||
|
||||
// Notifies libretro that audio data should be written.
|
||||
typedef void (*retro_audio_callback_t)(void);
|
||||
|
45
libretro_private.h
Normal file
45
libretro_private.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 2010-2013 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this libretro API header (libretro_private.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef LIBRETRO_PRIVATE_H__
|
||||
#define LIBRETRO_PRIVATE_H__
|
||||
|
||||
// Private additions to libretro. No API/ABI stability guaranteed.
|
||||
|
||||
#include "libretro.h"
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_LIBRETRO_PATH (RETRO_ENVIRONMENT_PRIVATE | 0)
|
||||
// const char * --
|
||||
// Sets the absolute path for the libretro core pointed to. RETRO_ENVIRONMENT_EXEC will use the last libretro core set with this call.
|
||||
// Returns false if file for absolute path could not be found.
|
||||
#define RETRO_ENVIRONMENT_EXEC (RETRO_ENVIRONMENT_PRIVATE | 1)
|
||||
// const char * --
|
||||
// Requests that this core is deinitialized, and a new core is loaded.
|
||||
// The libretro core used is set with SET_LIBRETRO_PATH, and path to game is passed in _EXEC. NULL means no game.
|
||||
#define RETRO_ENVIRONMENT_EXEC_ESCAPE (RETRO_ENVIRONMENT_PRIVATE | 2)
|
||||
// const char * --
|
||||
// Requests that this core is deinitialized, and a new core is loaded. It also escapes the main loop the core is currently
|
||||
// bound to.
|
||||
// The libretro core used is set with SET_LIBRETRO_PATH, and path to game is passed in _EXEC. NULL means no game.
|
||||
|
||||
#endif
|
||||
|
@ -9,19 +9,19 @@ overlay1_full_screen = true
|
||||
overlay2_full_screen = true
|
||||
|
||||
overlay0_descs = 14
|
||||
overlay0_desc0 = "left,44,702,rect,25,25"
|
||||
overlay0_desc1 = "right,162,702,rect,25,25"
|
||||
overlay0_desc2 = "up,102,643,rect,25,25"
|
||||
overlay0_desc3 = "down,102,761,rect,25,25"
|
||||
overlay0_desc0 = "left,42,700,rect,56,46"
|
||||
overlay0_desc1 = "right,148,700,rect,56,46"
|
||||
overlay0_desc2 = "up,96,646,rect,46,56"
|
||||
overlay0_desc3 = "down,96,758,rect,46,56"
|
||||
overlay0_desc4 = "select,55,491,rect,40,40"
|
||||
overlay0_desc5 = "start,423,491,rect,40,40"
|
||||
overlay0_desc6 = "b,317,726,radial,45,45"
|
||||
overlay0_desc7 = "a,420,655,radial,45,45"
|
||||
overlay0_desc6 = "b,317,726,radial,65,65"
|
||||
overlay0_desc7 = "a,420,655,radial,65,65"
|
||||
overlay0_desc8 = "overlay_next,240,490,radial,30,30"
|
||||
overlay0_desc9 = "left|up,44,643,radial,20,20"
|
||||
overlay0_desc10 = "left|down,44,761,radial,20,20"
|
||||
overlay0_desc11 = "right|up,162,643,radial,20,20"
|
||||
overlay0_desc12 = "right|down,162,761,radial,20,20"
|
||||
overlay0_desc9 = "left|up,24,634,radial,45,45"
|
||||
overlay0_desc10 = "left|down,24,772,radial,45,45"
|
||||
overlay0_desc11 = "right|up,160,634,radial,45,45"
|
||||
overlay0_desc12 = "right|down,160,772,radial,45,45"
|
||||
overlay0_desc13 = "menu_toggle,240,595,rect,40,28"
|
||||
|
||||
overlay1_descs = 11
|
||||
@ -39,4 +39,4 @@ overlay1_desc10 = "overlay_next,240,683,radial,25,25"
|
||||
|
||||
overlay2_descs = 1
|
||||
overlay2_rect = "0.47,0.9,0.11,0.08"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
|
@ -9,19 +9,19 @@ overlay1_full_screen = true
|
||||
overlay2_full_screen = true
|
||||
|
||||
overlay0_descs = 14
|
||||
overlay0_desc0 = "left,52,695,rect,25,25"
|
||||
overlay0_desc1 = "right,159,695,rect,25,25"
|
||||
overlay0_desc2 = "up,107,638,rect,25,25"
|
||||
overlay0_desc3 = "down,107,744,rect,25,25"
|
||||
overlay0_desc0 = "left,42,700,rect,56,46"
|
||||
overlay0_desc1 = "right,148,700,rect,56,46"
|
||||
overlay0_desc2 = "up,96,646,rect,46,56"
|
||||
overlay0_desc3 = "down,96,758,rect,46,56"
|
||||
overlay0_desc4 = "start,427,507,rect,40,40"
|
||||
overlay0_desc5 = "a,449,720,radial,25,25"
|
||||
overlay0_desc6 = "b,374,736,radial,25,25"
|
||||
overlay0_desc7 = "y,301,755,rect,25,25"
|
||||
overlay0_desc5 = "a,445,715,radial,35,55"
|
||||
overlay0_desc6 = "b,374,736,radial,35,55"
|
||||
overlay0_desc7 = "y,301,755,rect,35,55"
|
||||
overlay0_desc8 = "overlay_next,107,508,radial,40,40"
|
||||
overlay0_desc9 = "left|up,52,638,radial,25,25"
|
||||
overlay0_desc10 = "left|down,52,744,radial,25,25"
|
||||
overlay0_desc11 = "right|up,159,638,radial,25,25"
|
||||
overlay0_desc12 = "right|down,159,744,radial,25,25"
|
||||
overlay0_desc9 = "left|up,24,634,radial,45,45"
|
||||
overlay0_desc10 = "left|down,24,772,radial,45,45"
|
||||
overlay0_desc11 = "right|up,160,634,radial,45,45"
|
||||
overlay0_desc12 = "right|down,160,772,radial,45,45"
|
||||
overlay0_desc13 = "menu_toggle,240,575,rect,40,28"
|
||||
|
||||
overlay1_descs = 11
|
||||
@ -39,4 +39,4 @@ overlay1_desc10 = "overlay_next,240,683,radial,30,30"
|
||||
|
||||
overlay2_descs = 1
|
||||
overlay2_rect = "0.47,0.9,0.11,0.08"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
|
@ -9,10 +9,10 @@ overlay1_full_screen = true
|
||||
overlay2_full_screen = true
|
||||
|
||||
overlay0_descs = 17
|
||||
overlay0_desc0 = "left,52,695,rect,25,25"
|
||||
overlay0_desc1 = "right,159,695,rect,25,25"
|
||||
overlay0_desc2 = "up,107,638,rect,25,25"
|
||||
overlay0_desc3 = "down,107,744,rect,25,25"
|
||||
overlay0_desc0 = "left,42,700,rect,56,46"
|
||||
overlay0_desc1 = "right,148,700,rect,56,46"
|
||||
overlay0_desc2 = "up,96,646,rect,46,56"
|
||||
overlay0_desc3 = "down,96,758,rect,46,56"
|
||||
overlay0_desc4 = "start,427,507,rect,40,40"
|
||||
overlay0_desc5 = "a,449,720,radial,25,25"
|
||||
overlay0_desc6 = "b,374,736,radial,25,25"
|
||||
@ -21,10 +21,10 @@ overlay0_desc8 = "l,283,684,rect,21,21"
|
||||
overlay0_desc9 = "x,352,666,radial,21,21"
|
||||
overlay0_desc10 = "r,426,648,radial,21,21"
|
||||
overlay0_desc11 = "overlay_next,107,508,radial,40,40"
|
||||
overlay0_desc12 = "left|up,52,638,radial,25,25"
|
||||
overlay0_desc13 = "left|down,52,744,radial,25,25"
|
||||
overlay0_desc14 = "right|up,159,638,radial,25,25"
|
||||
overlay0_desc15 = "right|down,159,744,radial,25,25"
|
||||
overlay0_desc12 = "left|up,24,634,radial,45,45"
|
||||
overlay0_desc13 = "left|down,24,772,radial,45,45"
|
||||
overlay0_desc14 = "right|up,160,634,radial,45,45"
|
||||
overlay0_desc15 = "right|down,160,772,radial,45,45"
|
||||
overlay0_desc16 = "menu_toggle,240,575,rect,40,28"
|
||||
|
||||
overlay1_descs = 11
|
||||
@ -42,4 +42,4 @@ overlay1_desc10 = "overlay_next,240,683,radial,30,30"
|
||||
|
||||
overlay2_descs = 1
|
||||
overlay2_rect = "0.47,0.9,0.11,0.08"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
|
@ -9,19 +9,19 @@ overlay1_full_screen = true
|
||||
overlay2_full_screen = true
|
||||
|
||||
overlay0_descs = 14
|
||||
overlay0_desc0 = "left,39,701,rect,30,30"
|
||||
overlay0_desc1 = "right,156,701,rect,30,30"
|
||||
overlay0_desc2 = "up,97,641,rect,30,30"
|
||||
overlay0_desc3 = "down,97,758,rect,30,30"
|
||||
overlay0_desc4 = "select,55,485,rect,45,20"
|
||||
overlay0_desc5 = "start,425,485,rect,45,20"
|
||||
overlay0_desc6 = "b,309,702,radial,48,48"
|
||||
overlay0_desc7 = "a,424,702,radial,48,48"
|
||||
overlay0_desc0 = "left,42,700,rect,56,46"
|
||||
overlay0_desc1 = "right,148,700,rect,56,46"
|
||||
overlay0_desc2 = "up,96,646,rect,46,56"
|
||||
overlay0_desc3 = "down,96,758,rect,46,56"
|
||||
overlay0_desc4 = "select,55,485,rect,45,20"
|
||||
overlay0_desc5 = "start,425,485,rect,45,20"
|
||||
overlay0_desc6 = "b,309,698,radial,48,54"
|
||||
overlay0_desc7 = "a,424,698,radial,48,54"
|
||||
overlay0_desc8 = "overlay_next,241,492,radial,30,30"
|
||||
overlay0_desc9 = "left|up,39,641,radial,30,30"
|
||||
overlay0_desc10 = "left|down,39,758,radial,30,30"
|
||||
overlay0_desc11 = "right|up,156,641,radial,30,30"
|
||||
overlay0_desc12 = "right|down,156,758,radial,30,30"
|
||||
overlay0_desc9 = "left|up,28,638,radial,45,45"
|
||||
overlay0_desc10 = "left|down,28,768,radial,45,45"
|
||||
overlay0_desc11 = "right|up,160,638,radial,45,45"
|
||||
overlay0_desc12 = "right|down,160,768,radial,45,45"
|
||||
overlay0_desc13 = "menu_toggle,240,595,rect,40,28"
|
||||
|
||||
overlay1_descs = 11
|
||||
@ -39,4 +39,4 @@ overlay1_desc10 = "overlay_next,240,683,radial,25,25"
|
||||
|
||||
overlay2_descs = 1
|
||||
overlay2_rect = "0.47,0.9,0.11,0.08"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
|
@ -9,10 +9,10 @@ overlay1_full_screen = true
|
||||
overlay2_full_screen = true
|
||||
|
||||
overlay0_descs = 20
|
||||
overlay0_desc0 = "left,41,695,rect,25,25"
|
||||
overlay0_desc1 = "right,157,695,rect,25,25"
|
||||
overlay0_desc2 = "up,98,637,rect,25,25"
|
||||
overlay0_desc3 = "down,98,751,rect,25,25"
|
||||
overlay0_desc0 = "left,42,700,rect,56,46"
|
||||
overlay0_desc1 = "right,148,700,rect,56,46"
|
||||
overlay0_desc2 = "up,96,646,rect,46,56"
|
||||
overlay0_desc3 = "down,96,758,rect,46,56"
|
||||
overlay0_desc4 = "start,286,497,rect,35,17"
|
||||
overlay0_desc5 = "select,197,497,rect,35,17"
|
||||
overlay0_desc6 = "a,436,699,radial,35,35"
|
||||
@ -24,10 +24,10 @@ overlay0_desc11 = "l2,50,479,rect,50,27"
|
||||
overlay0_desc12 = "r,430,537,rect,50,27"
|
||||
overlay0_desc13 = "r2,430,479,rect,50,27"
|
||||
overlay0_desc14 = "overlay_next,240,578,radial,30,30"
|
||||
overlay0_desc15 = "left|up,41,637,radial,20,20"
|
||||
overlay0_desc16 = "left|down,41,751,radial,20,20"
|
||||
overlay0_desc17 = "right|up,157,637,radial,20,20"
|
||||
overlay0_desc18 = "right|down,157,751,radial,20,20"
|
||||
overlay0_desc15 = "left|up,20,638,radial,45,45"
|
||||
overlay0_desc16 = "left|down,20,768,radial,45,45"
|
||||
overlay0_desc17 = "right|up,160,638,radial,45,45"
|
||||
overlay0_desc18 = "right|down,166,768,radial,45,45"
|
||||
overlay0_desc19 = "menu_toggle,240,764,rect,25,20"
|
||||
|
||||
overlay1_descs = 11
|
||||
@ -45,4 +45,4 @@ overlay1_desc10 = "overlay_next,240,683,radial,25,25"
|
||||
|
||||
overlay2_descs = 1
|
||||
overlay2_rect = "0.47,0.9,0.11,0.08"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
|
@ -9,23 +9,23 @@ overlay1_full_screen = true
|
||||
overlay2_full_screen = true
|
||||
|
||||
overlay0_descs = 18
|
||||
overlay0_desc0 = "left,40,703,rect,30,30"
|
||||
overlay0_desc1 = "right,156,703,rect,30,30"
|
||||
overlay0_desc2 = "up,98,644,rect,30,30"
|
||||
overlay0_desc3 = "down,98,761,rect,30,30"
|
||||
overlay0_desc4 = "select,206,494,rect,30,30"
|
||||
overlay0_desc5 = "start,285,494,rect,30,30"
|
||||
overlay0_desc6 = "b,372,751,radial,35,35"
|
||||
overlay0_desc7 = "a,439,692,radial,35,35"
|
||||
overlay0_desc8 = "x,372,626,radial,35,35"
|
||||
overlay0_desc9 = "y,308,692,radial,35,35"
|
||||
overlay0_desc10 = "l,70,482,rect,70,30"
|
||||
overlay0_desc11 = "r,410,482,rect,70,30"
|
||||
overlay0_desc0 = "left,42,700,rect,56,46"
|
||||
overlay0_desc1 = "right,148,700,rect,56,46"
|
||||
overlay0_desc2 = "up,96,646,rect,46,56"
|
||||
overlay0_desc3 = "down,96,758,rect,46,56"
|
||||
overlay0_desc4 = "select,206,494,rect,30,30"
|
||||
overlay0_desc5 = "start,285,494,rect,30,30"
|
||||
overlay0_desc6 = "b,372,756,radial,90,90"
|
||||
overlay0_desc7 = "a,446,686,radial,90,90"
|
||||
overlay0_desc8 = "x,370,622,radial,90,90"
|
||||
overlay0_desc9 = "y,296,692,radial,90,90"
|
||||
overlay0_desc10 = "l,70,482,rect,70,30"
|
||||
overlay0_desc11 = "r,410,482,rect,70,30"
|
||||
overlay0_desc12 = "overlay_next,241,587,radial,30,30"
|
||||
overlay0_desc13 = "left|up,40,644,radial,30,30"
|
||||
overlay0_desc14 = "left|down,40,761,radial,30,30"
|
||||
overlay0_desc15 = "right|up,156,644,radial,30,30"
|
||||
overlay0_desc16 = "right|down,156,761,radial,30,30"
|
||||
overlay0_desc13 = "left|up,28,638,radial,45,45"
|
||||
overlay0_desc14 = "left|down,28,768,radial,45,45"
|
||||
overlay0_desc15 = "right|up,160,638,radial,45,45"
|
||||
overlay0_desc16 = "right|down,160,768,radial,45,45"
|
||||
overlay0_desc17 = "menu_toggle,240,760,radial,20,20"
|
||||
|
||||
overlay1_descs = 11
|
||||
@ -43,4 +43,4 @@ overlay1_desc10 = "overlay_next,240,683,radial,25,25"
|
||||
|
||||
overlay2_descs = 1
|
||||
overlay2_rect = "0.47,0.9,0.11,0.08"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
overlay2_desc0 = "overlay_next,16,16,radial,16,16"
|
||||
|
22
retroarch.c
22
retroarch.c
@ -45,10 +45,6 @@
|
||||
#include "msvc/msvc_compat.h"
|
||||
#endif
|
||||
|
||||
#if defined(RARCH_CONSOLE) && !defined(RARCH_PERFORMANCE_MODE)
|
||||
#define RARCH_PERFORMANCE_MODE
|
||||
#endif
|
||||
|
||||
// To avoid continous switching if we hold the button down, we require that the button must go from pressed,
|
||||
// unpressed back to pressed to be able to toggle between then.
|
||||
static void check_fast_forward_button(void)
|
||||
@ -1935,7 +1931,6 @@ static void check_savestates(bool immutable)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(RARCH_PERFORMANCE_MODE)
|
||||
void rarch_set_fullscreen(bool fullscreen)
|
||||
{
|
||||
g_settings.video.fullscreen = fullscreen;
|
||||
@ -1966,7 +1961,6 @@ static bool check_fullscreen(void)
|
||||
was_pressed = pressed;
|
||||
return toggle;
|
||||
}
|
||||
#endif
|
||||
|
||||
void rarch_state_slot_increase(void)
|
||||
{
|
||||
@ -2193,7 +2187,6 @@ static void check_movie(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(RARCH_PERFORMANCE_MODE)
|
||||
static void check_pause(void)
|
||||
{
|
||||
static bool old_state = false;
|
||||
@ -2266,7 +2259,6 @@ static void check_oneshot(void)
|
||||
g_extern.is_oneshot |= new_rewind_state && !old_rewind_state;
|
||||
old_rewind_state = new_rewind_state;
|
||||
}
|
||||
#endif
|
||||
|
||||
void rarch_game_reset(void)
|
||||
{
|
||||
@ -2565,7 +2557,6 @@ static void check_dsp_config(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(RARCH_PERFORMANCE_MODE)
|
||||
static void check_mute(void)
|
||||
{
|
||||
if (!g_extern.audio_active)
|
||||
@ -2628,7 +2619,6 @@ static void check_volume(void)
|
||||
|
||||
g_extern.audio_data.volume_gain = db_to_gain(g_extern.audio_data.volume_db);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
static void check_netplay_flip(void)
|
||||
@ -2700,10 +2690,8 @@ static void do_state_checks(void)
|
||||
#if defined(HAVE_SCREENSHOTS) && !defined(_XBOX)
|
||||
check_screenshot();
|
||||
#endif
|
||||
#if !defined(RARCH_PERFORMANCE_MODE)
|
||||
check_mute();
|
||||
check_volume();
|
||||
#endif
|
||||
|
||||
check_turbo();
|
||||
|
||||
@ -2719,7 +2707,6 @@ static void do_state_checks(void)
|
||||
if (!g_extern.netplay)
|
||||
{
|
||||
#endif
|
||||
#if !defined(RARCH_PERFORMANCE_MODE)
|
||||
check_pause();
|
||||
check_oneshot();
|
||||
|
||||
@ -2728,7 +2715,6 @@ static void do_state_checks(void)
|
||||
|
||||
if (g_extern.is_paused && !g_extern.is_oneshot)
|
||||
return;
|
||||
#endif
|
||||
|
||||
check_fast_forward_button();
|
||||
|
||||
@ -2759,9 +2745,7 @@ static void do_state_checks(void)
|
||||
else
|
||||
{
|
||||
check_netplay_flip();
|
||||
#if !defined(RARCH_PERFORMANCE_MODE)
|
||||
check_fullscreen();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -3059,6 +3043,12 @@ bool rarch_main_iterate(void)
|
||||
if (check_enter_rgui())
|
||||
return false; // Enter menu, don't exit.
|
||||
|
||||
if (g_extern.exec)
|
||||
{
|
||||
g_extern.exec = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
if (driver.command)
|
||||
rarch_cmd_pre_frame(driver.command);
|
||||
|
@ -196,6 +196,7 @@ void config_set_defaults(void)
|
||||
|
||||
g_settings.audio.enable = audio_enable;
|
||||
g_settings.audio.out_rate = out_rate;
|
||||
g_settings.audio.block_frames = 0;
|
||||
g_settings.audio.in_rate = out_rate;
|
||||
if (audio_device)
|
||||
strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device));
|
||||
@ -628,6 +629,7 @@ bool config_load_file(const char *path)
|
||||
// Audio settings.
|
||||
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
||||
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
||||
CONFIG_GET_INT(audio.block_frames, "audio_block_frames");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
CONFIG_GET_INT(audio.latency, "audio_latency");
|
||||
CONFIG_GET_BOOL(audio.sync, "audio_sync");
|
||||
|
Loading…
x
Reference in New Issue
Block a user