aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--options.c36
-rw-r--r--options.h2
-rw-r--r--patches/gpsp/0002-core-options.patch51
-rw-r--r--patches/snes9x2005/0002-core-options.patch25
-rw-r--r--patches/snes9x2005/1000-frameskip-interval.patch15
6 files changed, 75 insertions, 66 deletions
diff --git a/README.md b/README.md
index 8e5f24e..9e28ac4 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,16 @@
picoarch uses libpicofe and SDL to create a small frontend to libretro cores. It's designed for small (320x240 2.0-2.4") screen, low-powered devices like the Trimui Model S (PowKiddy A66).
+## Running
+
+picoarch can be run by specifying the core library and the content to run:
+
+```
+./picoarch /path/to/core_name_libretro.so /path/to/game.gba
+```
+
+It does not have a built-in file browser, so both core and content must be specified on the command line.
+
## Building
The frontend can currently be built for the TrimUI Model S and Linux (useful for testing and debugging).
@@ -98,7 +108,7 @@ A few common changes will need to be made when you add cores, since TrimUI is no
Common changes include:
- Adding a `platform=trimui` target to the core Makefile
-- Modifying `libretro_core_options.h` to shorten text, add manual line breaks, and change defaults for small screen / low power devices
+- Modifying `libretro_core_options.h` to shorten text and change defaults for small screen / low power devices
- Hiding unnecessary core options and forcing different defaults
picoarch also keeps the running core name in a global variable. This can be used for:
diff --git a/options.c b/options.c
index 92918d4..2bac4b1 100644
--- a/options.c
+++ b/options.c
@@ -14,6 +14,8 @@ enum scale_filter scale_filter;
struct core_options core_options;
#define MAX_DESC_LEN 20
+#define MAX_LINE_LEN 52
+#define MAX_LINES 3
static void truncate(char *string, int max_len) {
size_t len = strlen(string) + 1;
@@ -22,6 +24,29 @@ static void truncate(char *string, int max_len) {
strncpy(&string[max_len - 4], "...\0", 4);
}
+static void wrap(char *string, size_t max_len, size_t max_lines) {
+ char *line = string;
+
+ for (int i = 1; i < max_lines; i++) {
+ char *p = line;
+ char *prev;
+ do {
+ prev = p;
+ p = strchr(prev+1, ' ');
+ } while (p && p - line < max_len);
+
+ if (!p && strlen(line) < max_len) break;
+
+ if (prev && prev != line) {
+ line = prev + 1;
+ *prev = '\n';
+ }
+ }
+ truncate(line, max_len);
+
+ return;
+}
+
static const char *blocked_options[] = { "gpsp_save_method", NULL};
static bool option_blocked(const char *key) {
@@ -65,7 +90,6 @@ void options_init(const struct retro_core_option_definition *defs) {
entry->def = &core_options.defs[i];
entry->value = options_default_index(entry->def->key);
entry->prev_value = entry->value;
- entry->info = entry->def->info;
entry->blocked = option_blocked(entry->def->key);
if (entry->blocked)
core_options.visible_len--;
@@ -81,6 +105,16 @@ void options_init(const struct retro_core_option_definition *defs) {
strncpy(entry->desc, entry->def->desc, len);
truncate(entry->desc, MAX_DESC_LEN);
+ len = strlen(entry->def->info) + 1;
+ entry->info = (char *)calloc(len, sizeof(char));
+ if (!entry->info) {
+ PA_ERROR("Error allocating description string\n");
+ options_free();
+ return;
+ }
+ strncpy(entry->info, entry->def->info, len);
+ wrap(entry->info, MAX_LINE_LEN, MAX_LINES);
+
for (j = 0; entry->def->values[j].value; j++)
;
j++; /* Make room for NULL entry */
diff --git a/options.h b/options.h
index 51838ef..908b7e5 100644
--- a/options.h
+++ b/options.h
@@ -16,7 +16,7 @@ struct core_option_entry {
char *desc;
char *retro_var_value;
bool blocked;
- const char *info;
+ char *info;
const char **options;
const struct retro_core_option_definition *def;
const struct retro_variable *var;
diff --git a/patches/gpsp/0002-core-options.patch b/patches/gpsp/0002-core-options.patch
index 086c5ed..752cfc5 100644
--- a/patches/gpsp/0002-core-options.patch
+++ b/patches/gpsp/0002-core-options.patch
@@ -1,15 +1,13 @@
diff --git a/libretro_core_options.h b/libretro_core_options.h
-index c23a2c3..ae3c70c 100644
+index c23a2c3..0ac55a9 100644
--- a/libretro_core_options.h
+++ b/libretro_core_options.h
-@@ -56,11 +56,13 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -56,11 +56,11 @@ struct retro_core_option_definition option_defs_us[] = {
{
"gpsp_bios",
"BIOS",
- "Choose the BIOS image to use. The official BIOS must be provided by the user. Using a non-official (or builtin) BIOS might result in incompatibility problems with some games. Best results are to be achieved with the official Nintendo BIOS.",
-+ "Choose the BIOS image to use. The official BIOS\n"
-+ "must be provided by the user. Using a builtin\n"
-+ "BIOS might result in compatibility problems.",
++ "Choose the BIOS image to use. The official BIOS must be provided by the user. Using a builtin BIOS might result in compatibility problems.",
{
- { "auto", "Auto select" },
- { "builtin", "Builtin BIOS" },
@@ -20,13 +18,12 @@ index c23a2c3..ae3c70c 100644
{ NULL, NULL },
},
"auto"
-@@ -68,10 +70,11 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -68,10 +68,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"gpsp_boot_mode",
"Boot mode",
- "Choose whether to boot the BIOS before the game or not. There's not much difference in either modes.",
-+ "Choose whether to boot the BIOS before the game\n"
-+ "or not.",
++ "Choose whether to boot the BIOS before the game or not.",
{
- { "game", "Boot to game" },
- { "bios", "Boot to BIOS" },
@@ -35,13 +32,12 @@ index c23a2c3..ae3c70c 100644
{ NULL, NULL },
},
"game"
-@@ -79,20 +82,23 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -79,20 +79,20 @@ struct retro_core_option_definition option_defs_us[] = {
{
"gpsp_frameskip",
"Frameskip",
- "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Auto (Threshold)' utilises the 'Frameskip Threshold (%)' setting. 'Fixed Interval' utilises the 'Frameskip Interval' setting.",
-+ "Skip frames to avoid audio crackling. Improves\n"
-+ "performance at the expense of visual smoothness.",
++ "Skip frames to avoid audio crackling. Improves performance at the expense of visual smoothness.",
{
{ "disabled", NULL },
{ "auto", "Auto" },
@@ -59,25 +55,22 @@ index c23a2c3..ae3c70c 100644
- "Frameskip Threshold (%)",
- "When 'Frameskip' is set to 'Auto (Threshold)', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.",
+ "FS Threshold (%)",
-+ "When 'Frameskip' is set to 'Threshold', sets\n"
-+ "how low the audio buffer can get before frames\n"
-+ "will be skipped.",
++ "When 'Frameskip' is set to 'Threshold', sets how low the audio buffer can get before frames will be skipped.",
{
{ "15", NULL },
{ "18", NULL },
-@@ -116,8 +122,9 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -116,8 +116,8 @@ struct retro_core_option_definition option_defs_us[] = {
},
{
"gpsp_frameskip_interval",
- "Frameskip Interval",
- "When 'Frameskip' is set to 'Fixed Interval', the value set here is the number of frames omitted after a frame is rendered - i.e. '0' = 60fps, '1' = 30fps, '2' = 15fps, etc.",
+ "FS Interval",
-+ "The maximum number of frames that can be skipped\n"
-+ "before a new frame is rendered.",
++ "The maximum number of frames that can be skipped before a new frame is rendered.",
{
{ "0", NULL },
{ "1", NULL },
-@@ -132,46 +139,49 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -132,40 +132,40 @@ struct retro_core_option_definition option_defs_us[] = {
{ "10", NULL },
{ NULL, NULL },
},
@@ -116,8 +109,7 @@ index c23a2c3..ae3c70c 100644
- "Backup Save Method (Restart)",
- "Choose the data format used for cartridge save files. 'gpSP' can be used for compatibility with the stand-alone version of gpSP. 'libretro' provides better integration with the frontend.",
+ "Save Format",
-+ "Choose the data format used for cartridge save\n"
-+ "files. Must restart to take effect.",
++ "Choose the data format used for cartridge save files. Must restart to take effect.",
{
{ "gpSP", NULL },
{ "libretro", NULL },
@@ -128,22 +120,3 @@ index c23a2c3..ae3c70c 100644
},
#if defined(HAVE_DYNAREC)
{
- "gpsp_drc",
- "Dynamic Recompiler",
-- "Dynamically recompile CPU instructions to native instructions. Greatly improves performance, but may reduce accuracy.",
-+ "Dynamically recompile CPU instructions to native\n"
-+ "instructions. Greatly improves performance, but\n"
-+ "may reduce accuracy.",
- {
- { "enabled", NULL },
- { "disabled", NULL },
-@@ -183,7 +193,8 @@ struct retro_core_option_definition option_defs_us[] = {
- {
- "gpsp_turbo_period",
- "Turbo Button Period",
-- "Specify the repeat interval (in frames) when holding down the Turbo A/B buttons.",
-+ "Specify the repeat interval (in frames) when\n"
-+ "holding down the Turbo A/B buttons.",
- {
- { "4", NULL },
- { "5", NULL },
diff --git a/patches/snes9x2005/0002-core-options.patch b/patches/snes9x2005/0002-core-options.patch
index 8fea741..7f43e83 100644
--- a/patches/snes9x2005/0002-core-options.patch
+++ b/patches/snes9x2005/0002-core-options.patch
@@ -1,25 +1,22 @@
diff --git a/libretro_core_options.h b/libretro_core_options.h
-index 032cefd..63e17ae 100644
+index 032cefd..b32864a 100644
--- a/libretro_core_options.h
+++ b/libretro_core_options.h
-@@ -57,7 +57,9 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -57,7 +57,7 @@ struct retro_core_option_definition option_defs_us[] = {
{
"catsfc_VideoMode",
"Console Region",
- "Specify which region the system is from. 'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.",
-+ "'PAL' is 50hz, 'NTSC' is 60hz. Games will run\n"
-+ "faster or slower than normal if the incorrect\n"
-+ "region is selected.",
++ "'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.",
{
{ "auto", "Auto" },
{ "NTSC", NULL },
-@@ -69,19 +71,22 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -69,19 +69,19 @@ struct retro_core_option_definition option_defs_us[] = {
{
"catsfc_frameskip",
"Frameskip",
- "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Manual' utilises the 'Frameskip Threshold (%)' setting.",
-+ "Skip frames to avoid audio crackling. Improves\n"
-+ "performance at the expense of visual smoothness.",
++ "Skip frames to avoid audio crackling. Improves performance at the expense of visual smoothness.",
{
{ "disabled", NULL },
{ "auto", "Auto" },
@@ -34,26 +31,22 @@ index 032cefd..63e17ae 100644
- "Frameskip Threshold (%)",
- "When 'Frameskip' is set to 'Manual', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.",
+ "FS Threshold (%)",
-+ "When 'Frameskip' is set to 'Threshold', sets\n"
-+ "how low the audio buffer can get before frames\n"
-+ "will be skipped.",
++ "When 'Frameskip' is set to 'Threshold', sets how low the audio buffer can get before frames will be skipped.",
{
{ "15", NULL },
{ "18", NULL },
-@@ -105,8 +110,10 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -105,8 +105,8 @@ struct retro_core_option_definition option_defs_us[] = {
},
{
"catsfc_overclock_cycles",
- "Reduce Slowdown (Hack, Unsafe, Restart)",
- "Many games for the SNES suffered from slowdown due to the weak main CPU. This option helps allievate that at the cost of possible bugs. COMPATIBLE: Reduce slowdown but keep as much game compatibility as much as possible. MAX: Reduce slowdown as much as possible but will break more games.",
+ "Overclock (Restart)",
-+ "Alleviate normal SNES slowdown. Compatible keeps\n"
-+ "as much compatibility as possible. Max will reduce\n"
-+ "more slowdown but break more games.",
++ "Alleviate normal SNES slowdown. Compatible keeps as much compatibility as possible. Max will reduce more slowdown but break more games.",
{
{ "disabled", NULL },
{ "compatible", "Compatible" },
-@@ -117,7 +124,7 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -117,7 +117,7 @@ struct retro_core_option_definition option_defs_us[] = {
},
{
"catsfc_reduce_sprite_flicker",
diff --git a/patches/snes9x2005/1000-frameskip-interval.patch b/patches/snes9x2005/1000-frameskip-interval.patch
index a0b6ef0..eb920c7 100644
--- a/patches/snes9x2005/1000-frameskip-interval.patch
+++ b/patches/snes9x2005/1000-frameskip-interval.patch
@@ -1,5 +1,5 @@
diff --git a/libretro.c b/libretro.c
-index c368d8f..f4675ed 100644
+index c368d8f..305adee 100644
--- a/libretro.c
+++ b/libretro.c
@@ -57,13 +57,11 @@ static int32_t samplerate = (((SNES_CLOCK_SPEED * 6) / (32 * ONE_APU_CYCLE)));
@@ -59,12 +59,12 @@ index c368d8f..f4675ed 100644
IPPU.RenderThisFrame = false;
frameskip_counter++;
diff --git a/libretro_core_options.h b/libretro_core_options.h
-index 8620a4a..dc79a38 100644
+index b32864a..b69d19a 100644
--- a/libretro_core_options.h
+++ b/libretro_core_options.h
-@@ -74,9 +74,9 @@ struct retro_core_option_definition option_defs_us[] = {
- "Skip frames to avoid audio crackling. Improves\n"
- "performance at the expense of visual smoothness.",
+@@ -71,9 +71,9 @@ struct retro_core_option_definition option_defs_us[] = {
+ "Frameskip",
+ "Skip frames to avoid audio crackling. Improves performance at the expense of visual smoothness.",
{
- { "disabled", NULL },
- { "auto", "Auto" },
@@ -75,15 +75,14 @@ index 8620a4a..dc79a38 100644
{ NULL, NULL },
},
"auto"
-@@ -108,6 +108,27 @@ struct retro_core_option_definition option_defs_us[] = {
+@@ -103,6 +103,26 @@ struct retro_core_option_definition option_defs_us[] = {
},
"33"
},
+ {
+ "catsfc_frameskip_interval",
+ "FS Interval",
-+ "The maximum number of frames that can be skipped\n"
-+ "before a new frame is rendered.",
++ "The maximum number of frames that can be skipped before a new frame is rendered.",
+ {
+ { "0", NULL },
+ { "1", NULL },