Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 174 additions & 42 deletions src/common/backends/imgui/launcher_imgui.cpp

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions src/common/launcher_binds.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static const char* kHotkeyKey[LNG_HK_COUNT] = {
"WindowBigger", "WindowSmaller", "VolumeUp", "VolumeDown",
"DisplayPerf", "ToggleRenderer",
"SolarBrighter", "SolarDimmer", "SolarLive",
"Rewind", "SaveStateMenu"
"Rewind", "SaveStateMenu", "TurboToggle"
};
// Built-in defaults (shown when config.ini has no line; "" = unbound).
static const char* kHotkeyDef[LNG_HK_COUNT] = {
Expand All @@ -211,7 +211,7 @@ static const char* kHotkeyDef[LNG_HK_COUNT] = {
* (psxrecomp host_keymap reads these from [KeyMap]). */
"", "", "Keypad +", "Keypad -", "F", "R",
"", "", "",
"F8", "F7"
"F8", "F7", "F9"
};

static void copy_str(char* d, size_t cap, const char* s) {
Expand Down Expand Up @@ -410,7 +410,12 @@ static void reload_hotkey_display(LauncherModel* m) {
char* hash = strchr(v, '#'); if (hash) *hash = 0;
size_t vl = strlen(v); while (vl && (v[vl-1] == ' ' || v[vl-1] == '\t')) v[--vl] = 0;
for (int h = 0; h < LNG_HK_COUNT; ++h)
if (ieq(p, klen, kHotkeyKey[h])) { copy_str(m->hotkeys[h], sizeof(m->hotkeys[h]), v); break; }
if (ieq(p, klen, kHotkeyKey[h])) {
const int unbound = !v[0] || ieq(v, strlen(v), "None") ||
ieq(v, strlen(v), "(unbound)");
copy_str(m->hotkeys[h], sizeof(m->hotkeys[h]), unbound ? "(unbound)" : v);
break;
}
}
free(text);
}
Expand Down Expand Up @@ -1450,6 +1455,10 @@ void launcher_binds_set_hotkey(LauncherModel* m, LngHotkey h, int keycode, int k
if (h < 0 || h >= LNG_HK_COUNT) return;
char val[64];
format_hotkey(keycode, kmod, val, sizeof(val));
keymap_write(kHotkeyKey[h], val);
// keycode 0 = explicit unbind. Write the literal "None" rather than an
// empty value: the PSX runtime treats a present-but-empty/None line as
// "the user cleared this" and skips its built-in default, whereas a
// missing line keeps the default.
keymap_write(kHotkeyKey[h], val[0] ? val : "None");
copy_str(m->hotkeys[h], sizeof(m->hotkeys[h]), val[0] ? val : "(unbound)");
}
23 changes: 22 additions & 1 deletion src/common/launcher_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const char* kHotkeyNames[LNG_HK_COUNT] = {
"Window bigger", "Window smaller", "Volume up", "Volume down",
"FPS readout", "Toggle renderer",
"Solar level up", "Solar level down", "Resume live solar",
"Rewind", "Save states menu"
"Rewind", "Save states menu", "Fast-forward toggle"
};
static const char* kViewNames[8] = {
"Dashboard", "Settings", "Controller", "Netplay", "Mods",
Expand Down Expand Up @@ -276,6 +276,7 @@ void launcher_model_init(LauncherModel* m,
m->has_texture_filter = game->has_texture_filter != 0;
m->has_fmv_filter = game->has_fmv_filter != 0;
m->has_screen_kind = game->has_screen_kind != 0;
m->has_scanlines = game->has_scanlines != 0;
m->has_frame_interp = game->has_frame_interp != 0;
m->has_spu_hq = game->has_spu_hq != 0;
m->has_rewind_depth = game->has_rewind_depth != 0;
Expand Down Expand Up @@ -1668,6 +1669,26 @@ const char* launcher_model_screen_kind_label(const LauncherModel* m) {
return names[clampi(m->s.screen_kind, 0, n - 1)];
}

void launcher_model_toggle_scanlines(LauncherModel* m) {
if (!m || !m->has_scanlines) return;
m->s.scanlines = !m->s.scanlines;
/* First time on with no persisted strength: seed the default so the slider
* has a value to show (and the effect is visible). */
if (m->s.scanlines && m->s.scanline_strength_pct == 0)
m->s.scanline_strength_pct = 50;
}

void launcher_model_set_scanline_strength_pct(LauncherModel* m, int pct) {
if (!m || !m->has_scanlines) return;
m->s.scanline_strength_pct = clampi(pct, 1, 100);
}

int launcher_model_scanline_strength_pct(const LauncherModel* m) {
if (!m) return 50;
int p = m->s.scanline_strength_pct;
return (p >= 1 && p <= 100) ? p : 50; /* 0 = unset -> default 50 */
}

void launcher_model_toggle_frame_interp(LauncherModel* m) {
m->s.frame_interp = !m->s.frame_interp;
}
Expand Down
5 changes: 5 additions & 0 deletions src/common/launcher_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef enum {
LNG_HK_SOLAR_BRIGHTER, LNG_HK_SOLAR_DIMMER, LNG_HK_SOLAR_LIVE,
LNG_HK_REWIND, /* PSX local rewind filmstrip → [KeyMap] Rewind */
LNG_HK_SAVE_STATE_MENU, /* PSX save-state slot menu → [KeyMap] SaveStateMenu */
LNG_HK_TURBO_TOGGLE, /* PSX press-to-latch fast-forward → [KeyMap] TurboToggle */
LNG_HK_COUNT
} LngHotkey;

Expand Down Expand Up @@ -378,6 +379,7 @@ typedef struct {
bool has_texture_filter;
bool has_fmv_filter;
bool has_screen_kind;
bool has_scanlines; // present-time scanline post-process (PSX)
bool has_frame_interp;
bool has_spu_hq;
bool has_rewind_depth;
Expand Down Expand Up @@ -759,6 +761,9 @@ void launcher_model_toggle_perspective_texturing(LauncherModel* m);
bool launcher_model_geometry_correction_inert(const LauncherModel* m);
void launcher_model_cycle_screen_kind(LauncherModel* m); // Raw/CRT/Composite/Trinitron
const char* launcher_model_screen_kind_label(const LauncherModel* m);
void launcher_model_toggle_scanlines(LauncherModel* m);
void launcher_model_set_scanline_strength_pct(LauncherModel* m, int pct); // clamps 1..100
int launcher_model_scanline_strength_pct(const LauncherModel* m); // effective (seeds 50)
void launcher_model_toggle_frame_interp(LauncherModel* m);
void launcher_model_cycle_interp_fps(LauncherModel* m); // {0,90,120,144,165,240} wrap
const char* launcher_model_interp_fps_label(const LauncherModel* m); // "Display refresh"/"90 fps"
Expand Down
4 changes: 3 additions & 1 deletion src/consoles/psx/psx_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ static const SystemProfile kSystemProfilePsx = {
(1u << LNG_HK_VOLUME_DOWN) |
(1u << LNG_HK_DISPLAY_PERF) |
RUI_PSX_REWIND_HOTKEY_MASK |
(1u << LNG_HK_SAVE_STATE_MENU)),
(1u << LNG_HK_SAVE_STATE_MENU) |
(1u << LNG_HK_TURBO_TOGGLE)),
/* panels_dashboard */ kPanelsDashboardPsx,
/* panels_settings */ kPanelsSettingsPsx,
/* panels_controller */ kPanelsControllerCommon,
Expand Down Expand Up @@ -161,6 +162,7 @@ static inline void launcher_profile_apply_psx(RecompLauncherCGameInfo* gi) {
gi->has_fmv_filter = 1; /* MDEC decodes video at native res; how it is
* scaled to the window is a player choice. */
gi->has_frame_interp = 0; gi->has_spu_hq = 1; gi->has_skip_fmv = 0;
gi->has_scanlines = 1; /* present-time CRT scanline post-process */
gi->has_turbo_loads = 1; gi->has_bios = 1;
gi->has_deadzone_pct = 1;
gi->has_rewind_depth = RECOMP_UI_PSX_HAS_REWIND ? 1 : 0;
Expand Down
18 changes: 18 additions & 0 deletions src/recomp_launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,15 @@ struct RecompLauncherCSettings {
* against the roster, falling back to disc 1. Appended additively. */
int disc_index;

/* Scanline post-process on/off (GameInfo.has_scanlines consoles). 0 = off
* (also the unset default, like rewind_enabled — the host default is off, so
* a zero-initialized host predating this field gets the right answer), 1 =
* on. Appended additively. */
int scanlines;
/* Scanline dark-gap depth as a percent. 0 = unset -> the model seeds 50; the
* effective range is 1..100. Stored as a percent (not 0..1) so the whole
* settings struct stays plain-int. Appended additively. */
int scanline_strength_pct;
/* NDS virtual stylus overlay. 0 is unset and means the launcher default
* for the console, which is enabled; 1 is explicitly enabled, -1 is
* explicitly disabled. Bindings live in assist_key_bind/assist_pad_bind so
Expand Down Expand Up @@ -1054,6 +1063,10 @@ struct RecompLauncherCSettings {

/* Hosts can #ifdef on this to stay source-compatible with older recomp-ui. */
#define RECOMP_LAUNCHER_HAS_FRAME_BLEND 1
/* Scanline post-process (Settings.scanlines / scanline_strength_pct,
* GameInfo.has_scanlines). Hosts #ifdef on this to stay source-compatible with
* older recomp-ui that lacks the fields. */
#define RECOMP_LAUNCHER_HAS_SCANLINES 1

// ---- host verification/inspection results (filled by the callbacks below) ----
// Plain-C structs so a host can implement the callbacks with zero launcher
Expand Down Expand Up @@ -1624,6 +1637,11 @@ typedef struct RecompLauncherCGameInfo {
int (*persist_setup_discs)(void* ctx, const char* const* disc_paths,
int disc_count, const char* bios_path);

/* Display row for Settings.scanlines / scanline_strength_pct: a present-time
* scanline post-process (a checkbox plus a strength slider). Only meaningful
* for a console whose runtime implements it (PSX); everything else leaves
* this 0 and the rows are absent. Appended for ABI stability. */
int has_scanlines;
/* NDS input convenience setting. When set, Settings shows a Virtual Stylus
* opt-out and the Controller page may expose host-owned bindings for it. */
int has_virtual_stylus;
Expand Down