diff --git a/android/native/jni/Android.mk b/android/native/jni/Android.mk index 7a2e6b963c..063c0aeb2e 100644 --- a/android/native/jni/Android.mk +++ b/android/native/jni/Android.mk @@ -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 diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index af59fbdb3b..a6410eaf40 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -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; } diff --git a/android/phoenix/.classpath b/android/phoenix/.classpath index c06dfcb8e5..51769745b2 100644 --- a/android/phoenix/.classpath +++ b/android/phoenix/.classpath @@ -1,7 +1,7 @@ - + diff --git a/android/phoenix/AndroidManifest.xml b/android/phoenix/AndroidManifest.xml index c44b3a1e1e..63935e0297 100644 --- a/android/phoenix/AndroidManifest.xml +++ b/android/phoenix/AndroidManifest.xml @@ -29,6 +29,7 @@ + diff --git a/android/phoenix/res/xml/prefs.xml b/android/phoenix/res/xml/prefs.xml index 4d696d8411..a63a383471 100644 --- a/android/phoenix/res/xml/prefs.xml +++ b/android/phoenix/res/xml/prefs.xml @@ -123,10 +123,6 @@ - + + + + + + + + + + + = 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); - } } diff --git a/android/phoenix/src/org/retroarch/browser/ROMActivity.java b/android/phoenix/src/org/retroarch/browser/ROMActivity.java index ed6cf81412..27a9e084b2 100644 --- a/android/phoenix/src/org/retroarch/browser/ROMActivity.java +++ b/android/phoenix/src/org/retroarch/browser/ROMActivity.java @@ -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); diff --git a/android/phoenix/src/org/retroarch/browser/RefreshRateSetOS.java b/android/phoenix/src/org/retroarch/browser/RefreshRateSetOS.java index b9479c80eb..cbef30d588 100644 --- a/android/phoenix/src/org/retroarch/browser/RefreshRateSetOS.java +++ b/android/phoenix/src/org/retroarch/browser/RefreshRateSetOS.java @@ -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(); diff --git a/android/phoenix/src/org/retroarch/browser/ReportIME.java b/android/phoenix/src/org/retroarch/browser/ReportIME.java index 1a85b393ee..c8f5d463b4 100644 --- a/android/phoenix/src/org/retroarch/browser/ReportIME.java +++ b/android/phoenix/src/org/retroarch/browser/ReportIME.java @@ -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(); } } diff --git a/apple/OSX/Settings.xib b/apple/OSX/Settings.xib index 1d5c744237..4d9255c61f 100644 --- a/apple/OSX/Settings.xib +++ b/apple/OSX/Settings.xib @@ -2,9 +2,9 @@ 1080 - 12D78 + 12E55 3084 - 1187.37 + 1187.39 626.00 com.apple.InterfaceBuilder.CocoaPlugin @@ -72,7 +72,7 @@ {148, 514} - + _NS:13 YES NO @@ -164,7 +164,7 @@ MC41AA - 17 + 30 104857600 @@ -222,7 +222,7 @@ - QSAAAEEgAABBmAAAQZgAAA + QSAAAEEgAABCAAAAQgAAAA 0.25 4 1 @@ -233,6 +233,7 @@ {{582, 13}, {75, 32}} + _NS:9 YES @@ -277,13 +278,15 @@ {471, 17} - + - - + + -2147483392 {{224, 0}, {16, 17}} + + _NS:18 @@ -350,7 +353,7 @@ 2 - 17 + 30 306216960 @@ -413,6 +416,7 @@ 4 + {{178, 61}, {473, 516}} @@ -424,7 +428,8 @@ - QSAAAEEgAABBmAAAQZgAAA + + QSAAAEEgAABCAAAAQgAAAA 0.25 4 1 @@ -493,45 +498,6 @@ 180 - - - textField - - - 274 - - - - 266 - {145, 17} - - - {250, 750} - YES - - 67108928 - 272631808 - Table View Cell - - - - 6 - System - controlColor - - - - - NO - - - {{1, 1}, {145, 17}} - - - - - 108 - dataSource @@ -558,7 +524,7 @@ 266 - {101, 17} + {{0, 7}, {101, 17}} {250, 750} @@ -566,22 +532,43 @@ 67108928 272631808 - Table View Cell + - + + 6 + System + controlColor + + NO - {{1, 1}, {101, 17}} + {{1, 1}, {101, 30}} 168 + + + value: stringValue + + + + + + value: stringValue + value + stringValue + 2 + + + 319 + textField @@ -592,15 +579,15 @@ 266 - {364, 17} + {{0, 7}, {364, 17}} - + {250, 750} YES - 67108928 - 272631808 - Table View Cell + 337641537 + 272631872 + String @@ -609,13 +596,265 @@ NO - {{105, 1}, {364, 17}} + {{105, 1}, {364, 30}} 172 + + + value: stringValue + + + + + + value: stringValue + value + stringValue + 2 + + + 240 + + + + textField + + + 274 + + + + 266 + {{0, 7}, {364, 17}} + + + {250, 750} + YES + + 337641537 + 272631872 + Int + + + + + + NO + + + {{105, 65}, {364, 30}} + + + + + 227 + + + + value: numericValue + + + + + + value: numericValue + value + numericValue + 2 + + + 241 + + + + value: booleanValue + + + 268 + {{1, 6}, {61, 18}} + + + _NS:9 + YES + + -2080374784 + 268435456 + + + _NS:9 + + 1211912448 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + NO + + + + 274 + + + + {{105, 33}, {364, 30}} + + + + + + value: booleanValue + value + booleanValue + 2 + + + 255 + + + + textField + + + 274 + + + + 266 + {{0, 7}, {320, 17}} + + + {250, 750} + YES + + 337641537 + 272631872 + + + + + + + NO + + + + 268 + {{319, -2}, {48, 32}} + + + _NS:9 + YES + + 67108864 + 134217728 + ... + + _NS:9 + + -2038284288 + 129 + + + 200 + 25 + + NO + + + {{105, 97}, {364, 30}} + + + + + 298 + + + + doBrowse: + + + + 312 + + + + value: stringValue + + + + + + value: stringValue + value + stringValue + 2 + + + 314 + + + + textField + + + 274 + + + + 266 + {{0, 7}, {145, 17}} + + + {250, 750} + YES + + 67108928 + 272631808 + + + + + + + NO + + + {{1, 1}, {145, 30}} + + + + + 326 + + + + value: stringValue + + + + + + value: stringValue + value + stringValue + 2 + + + 327 + @@ -658,22 +897,6 @@ - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 4 @@ -706,6 +929,38 @@ 24 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 4 @@ -722,20 +977,20 @@ 24 2 - - - 6 + + + 5 0 - + 6 1 - 20 + 8 1000 - 8 - 29 + 6 + 24 3 @@ -770,28 +1025,12 @@ 29 3 - - + + 5 0 - - 6 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - - - - 3 - 0 - 3 + 5 1 20 @@ -802,12 +1041,12 @@ 29 3 - + - 5 + 3 0 - 5 + 3 1 20 @@ -854,7 +1093,7 @@ - + @@ -868,75 +1107,6 @@ - - 105 - - - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 6 - 0 - - 6 - 1 - - 3 - - 1000 - - 8 - 29 - 3 - - - - 5 - 0 - - 5 - 1 - - 3 - - 1000 - - 8 - 29 - 3 - - - - - - 106 - - - - - - - - 107 - - - 116 @@ -994,7 +1164,10 @@ + + + @@ -1013,23 +1186,23 @@ - - - 10 + + + 6 0 - - 10 + + 6 1 - 0.0 + 3 1000 - 5 - 22 - 2 + 8 + 29 + 3 - + 5 0 @@ -1045,6 +1218,22 @@ 29 3 + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + @@ -1066,23 +1255,7 @@ - - - 6 - 0 - - 6 - 1 - - 3 - - 1000 - - 8 - 29 - 3 - - + 5 0 @@ -1098,7 +1271,7 @@ 29 3 - + 10 0 @@ -1114,6 +1287,22 @@ 22 2 + + + 6 + 0 + + 6 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + @@ -1136,94 +1325,497 @@ - 195 - - + 224 + + + + + + 6 + 0 + + 6 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 5 + 0 + + 5 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + - 196 + 225 + + + + + + + + 226 + + + + + 242 + + + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 5 + 0 + + 5 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + + + 249 + + + + + + 7 + 0 + + 0 + 1 + + 57 + + 1000 + + 3 + 9 + 1 + + + + + + 250 + + + + + 267 - 197 - + 268 + - 198 - - - - - 199 - - - - - 200 - - - - - 201 - - - - - 202 - - - - - 203 - - - - - 204 + 269 - 205 - - + 270 + + - 206 + 271 + + + + + 272 + + + + + 273 + + + + + 274 + + + + + 275 + + + + + 276 + + + + + 280 + + + + + 281 + + + + + 285 + + + + + 287 + + + + + 288 + + + + + 289 + + + + + 290 + + + + + 291 + + + + + 292 + + + + + 293 + + + + + 294 + + + + + 295 + + + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 6 + 0 + + 6 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 5 + 0 + + 5 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + + + + + 296 + + + + + + + + 297 + + + + + 300 + + + + + 303 + + + + + + 7 + 0 + + 0 + 1 + + 36 + + 1000 + + 3 + 9 + 1 + + + + + + 304 + + + + + 308 + + + + + 309 + + + + + 310 + + + + + 311 + + + + + 316 + + + + + 317 - + - 207 + 320 + + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 5 + 0 + + 5 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + + + + 321 - + - 208 - - + 322 + + - 209 - - + 323 + + - 210 - - + 324 + + + + + - 211 - - - - - 212 - - + 325 + + @@ -1234,15 +1826,6 @@ com.apple.InterfaceBuilder.CocoaPlugin {{357, 418}, {480, 270}} - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1261,58 +1844,133 @@ + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + RASettingCell - - + + + com.apple.InterfaceBuilder.CocoaPlugin + RALabelSetting com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + RASettingCell - - - + + + com.apple.InterfaceBuilder.CocoaPlugin + RAStringSetting com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + - - - + + + - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + RASettingCell + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + RANumericSetting + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + RASettingCell + + + + + com.apple.InterfaceBuilder.CocoaPlugin + RABooleanSetting + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + RASettingCell + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + RAPathSetting + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + RASettingCell + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + RALabelSetting + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1322,7 +1980,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1331,7 +1989,7 @@ - 212 + 327 @@ -1343,6 +2001,39 @@ ./Classes/NSLayoutConstraint.h + + RASettingCell + NSTableCellView + + id + id + + + + doBrowse: + id + + + valueChanged: + id + + + + numericValue + NSNumber + + + numericValue + + numericValue + NSNumber + + + + IBProjectSource + ./Classes/RASettingCell.h + + RASettingsDelegate NSObject @@ -1387,6 +2078,10 @@ IBCocoaFramework YES 3 + + NSSwitch + {15, 15} + YES diff --git a/apple/OSX/en.lproj/MainMenu.xib b/apple/OSX/en.lproj/MainMenu.xib index 4ebd04b3f9..908154abc8 100644 --- a/apple/OSX/en.lproj/MainMenu.xib +++ b/apple/OSX/en.lproj/MainMenu.xib @@ -2,9 +2,9 @@ 1080 - 12D78 + 12E55 3084 - 1187.37 + 1187.39 626.00 com.apple.InterfaceBuilder.CocoaPlugin @@ -297,6 +297,28 @@ + + + Go + + 2147483647 + + + submenuAction: + + Go + + + + Cores Directory + + 2147483647 + + + + + + Window @@ -397,11 +419,9 @@ - + 256 {480, 360} - - {{0, 0}, {2560, 1418}} {10000000000000, 10000000000000} @@ -420,7 +440,7 @@ - + 256 @@ -428,7 +448,6 @@ 268 {{17, 72}, {242, 17}} - _NS:1535 YES @@ -470,7 +489,6 @@ 268 {{20, 45}, {239, 26}} - _NS:9 1 @@ -499,7 +517,7 @@ 274 - {13, 0} + {15, 0} _NS:24 @@ -508,7 +526,7 @@ YES - 10 + 12 10 1000 @@ -559,7 +577,7 @@ 19 tableViewAction: - -765427712 + -767524864 @@ -578,7 +596,6 @@ 268 {{180, 13}, {82, 32}} - _NS:9 YES @@ -599,8 +616,6 @@ {276, 89} - - _NS:21 @@ -787,6 +802,14 @@ 584 + + + showCoresDirectory: + + + + 588 + @@ -823,6 +846,7 @@ + @@ -1339,6 +1363,27 @@ + + 585 + + + + + + + + 586 + + + + + + + + 587 + + + @@ -1417,6 +1462,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1428,7 +1476,7 @@ - 584 + 588 @@ -1443,6 +1491,39 @@ RetroArch_OSX NSObject + + id + id + id + + + + coreWasChosen: + id + + + showCoresDirectory: + id + + + showPreferences: + id + + + + NSWindow + NSWindow + + + + _coreSelectSheet + NSWindow + + + window + NSWindow + + IBProjectSource ./Classes/RetroArch_OSX.h diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 09580ca852..1f21d5aae8 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -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]; diff --git a/apple/OSX/settings.m b/apple/OSX/settings.m index 4bebfb07ec..e24d3bf7f9 100644 --- a/apple/OSX/settings.m +++ b/apple/OSX/settings.m @@ -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 @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; } } diff --git a/apple/RetroArch/setting_data.h b/apple/RetroArch/setting_data.h index e7f8246dc5..409c22e24b 100644 --- a/apple/RetroArch/setting_data.h +++ b/apple/RetroArch/setting_data.h @@ -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 \ No newline at end of file diff --git a/apple/RetroArch/utility.m b/apple/RetroArch/utility.m index 0836e9fdec..7875e69594 100644 --- a/apple/RetroArch/utility.m +++ b/apple/RetroArch/utility.m @@ -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 diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 6a1101970c..67e0df9ae7 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -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", diff --git a/apple/RetroArch_iOS.xcodeproj/project.pbxproj b/apple/RetroArch_iOS.xcodeproj/project.pbxproj index f94d43b805..f959691eb8 100644 --- a/apple/RetroArch_iOS.xcodeproj/project.pbxproj +++ b/apple/RetroArch_iOS.xcodeproj/project.pbxproj @@ -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", diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index 62b2808745..df557dda47 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -29,50 +29,47 @@ { NSString* _path; NSMutableArray* _sectionNames; + id _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)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 _delegate; } -- (id)initWithGame:(NSString*)path +- (id)initWithGame:(NSString*)path delegate:(id)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]; } diff --git a/apple/iOS/platform.h b/apple/iOS/platform.h index d7a55f4668..c7d01d7756 100644 --- a/apple/iOS/platform.h +++ b/apple/iOS/platform.h @@ -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 +@interface RetroArch_iOS : UINavigationController + (RetroArch_iOS*)get; diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index cfe1d8b391..e285f65e28 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -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); } diff --git a/apple/iOS/settings.m b/apple/iOS/settings.m index 54c860eaeb..ad84b67bfd 100644 --- a/apple/iOS/settings.m +++ b/apple/iOS/settings.m @@ -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", diff --git a/apple/iOS/views.h b/apple/iOS/views.h index 5b058b2ede..b2b5b887f5 100644 --- a/apple/iOS/views.h +++ b/apple/iOS/views.h @@ -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 @property (nonatomic, weak) RADirectoryItem *selectedItem; - -+ (id)directoryListAtBrowseRoot; -+ (id)directoryListForPath:(NSString*)path; -- (id)initWithPath:(NSString*)path; +- (id)initWithPath:(NSString*)path delegate:(id)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)delegate; @end // browser.m diff --git a/audio/opensl.c b/audio/opensl.c index 068e42a7a2..beffc5456b 100644 --- a/audio/opensl.c +++ b/audio/opensl.c @@ -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; diff --git a/driver.h b/driver.h index bc4cdd7d1a..026a6df0b4 100644 --- a/driver.h +++ b/driver.h @@ -19,7 +19,7 @@ #include #include "boolean.h" -#include "libretro.h" +#include "libretro_private.h" #include #include #include "msvc/msvc_compat.h" diff --git a/dynamic.c b/dynamic.c index 401b1f4e46..2f789ee5d6 100644 --- a/dynamic.c +++ b/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; diff --git a/dynamic.h b/dynamic.h index 6efa2722fb..198f81e39e 100644 --- a/dynamic.h +++ b/dynamic.h @@ -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 diff --git a/frontend/frontend.c b/frontend/frontend.c index 4a9093d4e1..4102b07fbb 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -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; } diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 69c66818a8..780be57a29 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -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 } diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index 3edeec1b08..7ae5533490 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -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); diff --git a/frontend/menu/rmenu.c b/frontend/menu/rmenu.c index 691232bad3..19aad8e7f3 100644 --- a/frontend/menu/rmenu.c +++ b/frontend/menu/rmenu.c @@ -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; } diff --git a/frontend/menu/rmenu_xui.cpp b/frontend/menu/rmenu_xui.cpp index 8b41252f44..815d7ca2fa 100644 --- a/frontend/menu/rmenu_xui.cpp +++ b/frontend/menu/rmenu_xui.cpp @@ -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; } diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c index 102514d0ab..2851e55b38 100644 --- a/frontend/platform/platform_gx.c +++ b/frontend/platform/platform_gx.c @@ -18,7 +18,7 @@ #include #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) { diff --git a/frontend/platform/platform_qnx.c b/frontend/platform/platform_qnx.c index 1f2e4f3080..d0864d7a0d 100644 --- a/frontend/platform/platform_qnx.c +++ b/frontend/platform/platform_qnx.c @@ -20,6 +20,8 @@ #include "../../boolean.h" #include #include +#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 diff --git a/general.h b/general.h index 702b8928f8..09364943c7 100644 --- a/general.h +++ b/general.h @@ -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; diff --git a/gfx/context/vc_egl_ctx.c b/gfx/context/vc_egl_ctx.c index b9097751ff..1db9a28f8b 100644 --- a/gfx/context/vc_egl_ctx.c +++ b/gfx/context/vc_egl_ctx.c @@ -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; diff --git a/gfx/context/wgl_ctx.c b/gfx/context/wgl_ctx.c index ec12ed8411..cb925263ea 100644 --- a/gfx/context/wgl_ctx.c +++ b/gfx/context/wgl_ctx.c @@ -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) diff --git a/gfx/fonts/gl_raster_font.c b/gfx/fonts/gl_raster_font.c index 644184e20e..657ad4a96c 100644 --- a/gfx/fonts/gl_raster_font.c +++ b/gfx/fonts/gl_raster_font.c @@ -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, diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 5e97a0a540..1d5f308d92 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -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]; diff --git a/libretro.h b/libretro.h index 72050e93d5..7b767fe6eb 100755 --- a/libretro.h +++ b/libretro.h @@ -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); diff --git a/libretro_private.h b/libretro_private.h new file mode 100644 index 0000000000..a393412911 --- /dev/null +++ b/libretro_private.h @@ -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 + diff --git a/media/overlays/gameboy-portrait.cfg b/media/overlays/gameboy-portrait.cfg index caa4266788..6239aa4105 100644 --- a/media/overlays/gameboy-portrait.cfg +++ b/media/overlays/gameboy-portrait.cfg @@ -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" \ No newline at end of file +overlay2_desc0 = "overlay_next,16,16,radial,16,16" diff --git a/media/overlays/genesis3-portrait.cfg b/media/overlays/genesis3-portrait.cfg index 86276708a4..36c148248e 100644 --- a/media/overlays/genesis3-portrait.cfg +++ b/media/overlays/genesis3-portrait.cfg @@ -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" \ No newline at end of file +overlay2_desc0 = "overlay_next,16,16,radial,16,16" diff --git a/media/overlays/genesis6-portrait.cfg b/media/overlays/genesis6-portrait.cfg index 8636715429..bdea9ec72d 100644 --- a/media/overlays/genesis6-portrait.cfg +++ b/media/overlays/genesis6-portrait.cfg @@ -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" \ No newline at end of file +overlay2_desc0 = "overlay_next,16,16,radial,16,16" diff --git a/media/overlays/nes-portrait.cfg b/media/overlays/nes-portrait.cfg index cdab629f09..ff940f1194 100644 --- a/media/overlays/nes-portrait.cfg +++ b/media/overlays/nes-portrait.cfg @@ -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" \ No newline at end of file +overlay2_desc0 = "overlay_next,16,16,radial,16,16" diff --git a/media/overlays/psx-portrait.cfg b/media/overlays/psx-portrait.cfg index a62183d0fa..2a5716a882 100644 --- a/media/overlays/psx-portrait.cfg +++ b/media/overlays/psx-portrait.cfg @@ -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" \ No newline at end of file +overlay2_desc0 = "overlay_next,16,16,radial,16,16" diff --git a/media/overlays/snes-portrait.cfg b/media/overlays/snes-portrait.cfg index 4eab5c8159..4426b49e91 100644 --- a/media/overlays/snes-portrait.cfg +++ b/media/overlays/snes-portrait.cfg @@ -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" \ No newline at end of file +overlay2_desc0 = "overlay_next,16,16,radial,16,16" diff --git a/retroarch.c b/retroarch.c index 8c1ceed1cd..e759fc99f4 100644 --- a/retroarch.c +++ b/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); diff --git a/settings.c b/settings.c index 4b9dd32237..8a9563e2e5 100644 --- a/settings.c +++ b/settings.c @@ -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");