Skip to content

Commit 7d6b40a

Browse files
committed
good
1 parent 02552bc commit 7d6b40a

8 files changed

Lines changed: 174 additions & 54 deletions

File tree

.DS_Store

8 KB
Binary file not shown.

menu.cpp

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5151
#include "menu.h"
5252
#include "support/zaparoo/alt_launcher.h"
5353
#include "support/zaparoo/alt_launcher_menu.h"
54-
#include "support/zaparoo/display_menu.h"
54+
#include "support/zaparoo/launcher_pages.h"
5555
#include "support/zaparoo/menu_rbf.h"
5656
#include "user_io.h"
5757
#include "debug.h"
@@ -87,9 +87,13 @@ enum MENU
8787
MENU_MISC2,
8888

8989
// Right-side companion to System Settings on the alt-launcher menu core.
90-
// Hosts H/V offset adjustment and the CRT mode toggle.
91-
MENU_ZAPAROO_DISPLAY1,
92-
MENU_ZAPAROO_DISPLAY2,
90+
// Top "Zaparoo Launcher" page lists sub-pages (Video) and an exit row;
91+
// the Video sub-page hosts CRT mode + H/V centering offsets and binds
92+
// left/right arrows to value adjustment.
93+
MENU_ZAPAROO_LAUNCHER1,
94+
MENU_ZAPAROO_LAUNCHER2,
95+
MENU_ZAPAROO_VIDEO1,
96+
MENU_ZAPAROO_VIDEO2,
9397

9498
MENU_SELECT_INI1,
9599
MENU_SELECT_INI2,
@@ -6896,29 +6900,29 @@ void HandleUI(void)
68966900
}
68976901
else if (right && alt_launcher_configured())
68986902
{
6899-
menustate = MENU_ZAPAROO_DISPLAY1;
6903+
menustate = MENU_ZAPAROO_LAUNCHER1;
69006904
menusub = 0;
69016905
}
69026906

69036907
if (!hold_cnt && reboot_req) fpga_load_rbf(menu_rbf_name());
69046908
break;
69056909

69066910
/******************************************************************/
6907-
/* zaparoo display centering page (right-side sibling of System) */
6911+
/* zaparoo launcher pages (right-side sibling of System) */
69086912
/******************************************************************/
6909-
case MENU_ZAPAROO_DISPLAY1:
6913+
case MENU_ZAPAROO_LAUNCHER1:
69106914
if (!alt_launcher_configured())
69116915
{
69126916
menustate = MENU_NONE1;
69136917
break;
69146918
}
69156919
helptext_idx = 0;
69166920
parentstate = menustate;
6917-
display_menu_render(menusub, &menumask);
6918-
menustate = MENU_ZAPAROO_DISPLAY2;
6921+
launcher_page_render(menusub, &menumask);
6922+
menustate = MENU_ZAPAROO_LAUNCHER2;
69196923
break;
69206924

6921-
case MENU_ZAPAROO_DISPLAY2:
6925+
case MENU_ZAPAROO_LAUNCHER2:
69226926
if (menu)
69236927
{
69246928
menustate = MENU_NONE1;
@@ -6930,20 +6934,61 @@ void HandleUI(void)
69306934
menusub = 0;
69316935
break;
69326936
}
6933-
if (plus || minus)
6937+
if (right && menusub == 0)
69346938
{
6935-
display_menu_adjust(menusub, plus ? +1 : -1);
6936-
menustate = MENU_ZAPAROO_DISPLAY1;
6939+
menustate = MENU_ZAPAROO_VIDEO1;
6940+
menusub = 0;
69376941
break;
69386942
}
69396943
if (select)
69406944
{
6941-
if (!display_menu_handle_select(menusub))
6945+
int act = launcher_page_handle_select(menusub);
6946+
if (act == 1)
6947+
{
6948+
menustate = MENU_ZAPAROO_VIDEO1;
6949+
menusub = 0;
6950+
}
6951+
else if (act == 0)
69426952
{
69436953
menustate = MENU_NONE1;
6954+
}
6955+
}
6956+
break;
6957+
6958+
case MENU_ZAPAROO_VIDEO1:
6959+
if (!alt_launcher_configured())
6960+
{
6961+
menustate = MENU_NONE1;
6962+
break;
6963+
}
6964+
helptext_idx = 0;
6965+
parentstate = menustate;
6966+
video_page_render(menusub, &menumask);
6967+
menustate = MENU_ZAPAROO_VIDEO2;
6968+
break;
6969+
6970+
case MENU_ZAPAROO_VIDEO2:
6971+
if (menu)
6972+
{
6973+
menustate = MENU_ZAPAROO_LAUNCHER1;
6974+
menusub = 0;
6975+
break;
6976+
}
6977+
if (left || right || plus || minus)
6978+
{
6979+
video_page_adjust(menusub, (right || plus) ? +1 : -1);
6980+
menustate = MENU_ZAPAROO_VIDEO1;
6981+
break;
6982+
}
6983+
if (select)
6984+
{
6985+
if (!video_page_handle_select(menusub))
6986+
{
6987+
menustate = MENU_ZAPAROO_LAUNCHER1;
6988+
menusub = 0;
69446989
break;
69456990
}
6946-
menustate = MENU_ZAPAROO_DISPLAY1;
6991+
menustate = MENU_ZAPAROO_VIDEO1;
69476992
}
69486993
break;
69496994

support/.DS_Store

6 KB
Binary file not shown.

support/zaparoo/alt_launcher.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "file_io.h"
1616
#include "hardware.h"
1717
#include "input.h"
18+
#include "menu.h"
1819
#include "shmem.h"
1920
#include "user_io.h"
2021
#include "video.h"
@@ -349,6 +350,11 @@ static void spawn(void)
349350
input_switch(0);
350351
user_io_status_set("[9]", 1);
351352
}
353+
354+
// The launcher grabs input as soon as it starts. If the OSD is still
355+
// up (e.g. user toggled CRT mode or hit Reboot from System Settings),
356+
// it would trap input with no way to dismiss it — drop it now.
357+
if (menu_present()) MenuHide();
352358
}
353359

354360
bool alt_launcher_active(void)
@@ -439,6 +445,18 @@ void alt_launcher_poll(void)
439445
int sig = WIFSIGNALED(status) ? WTERMSIG(status) : 0;
440446
bool escaped = (exited && exit_status == 0) || sig == SIGTERM || sig == SIGINT;
441447
bool crashed = !escaped && (sig != 0 || (exited && exit_status != 0));
448+
// Any exit while in CRT mode drops back to HDMI / no launcher
449+
// for the rest of this session — respawning into CRT after the
450+
// user already left it is a UX trap. The persisted CRT
451+
// preference is intentionally untouched (return_to_normal_mode
452+
// only clears the in-memory s_native_crt), so the next reboot
453+
// honors whatever the user last set in System Settings.
454+
if (s_native_crt)
455+
{
456+
printf("alt_launcher: exited while in CRT mode, dropping to HDMI normal mode\n");
457+
return_to_normal_mode();
458+
return;
459+
}
442460
if (escaped)
443461
{
444462
printf("alt_launcher: exited, returning to normal mode until restart\n");

support/zaparoo/alt_launcher_menu.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ int alt_launcher_render_system_menu(int menusub, uint64_t *menumask,
2323
char s[256];
2424
int m = 0;
2525

26-
// Right arrow indicates a sibling page (Display Centering) accessible
27-
// via the right-arrow key — see MENU_ZAPAROO_DISPLAY1 in menu.cpp.
26+
// Right arrow indicates a sibling page (Zaparoo Launcher) accessible
27+
// via the right-arrow key — see MENU_ZAPAROO_LAUNCHER1 in menu.cpp.
2828
OsdSetTitle("System Settings", OSD_ARROW_LEFT | OSD_ARROW_RIGHT);
29-
*menumask = 0xF;
29+
*menumask = 0x1F;
3030

3131
OsdWrite(m++);
3232
sprintf(s, " MiSTer v%s", version + 5);
@@ -61,15 +61,16 @@ int alt_launcher_render_system_menu(int menusub, uint64_t *menumask,
6161

6262
OsdWrite(m++, " Remap keyboard \x16", menusub == 0);
6363
OsdWrite(m++, " Define joystick buttons \x16", menusub == 1);
64+
OsdWrite(m++, " Scripts \x16", menusub == 2);
6465

6566
OsdWrite(m++, "");
6667
int cr = m;
67-
OsdWrite(m++, " Reboot (hold \x16 cold reboot)", menusub == 2);
68+
OsdWrite(m++, " Reboot (hold \x16 cold reboot)", menusub == 3);
6869
*sysinfo_timer = 0;
6970
*reboot_req = 0;
7071

7172
while (m < OsdGetSize() - 1) OsdWrite(m++, "");
72-
OsdWrite(15, ALT_STD_EXIT, menusub == 3);
73+
OsdWrite(15, ALT_STD_EXIT, menusub == 4);
7374

7475
return cr;
7576
}
@@ -79,14 +80,15 @@ int alt_launcher_translate_system_select(int menusub)
7980
if (!alt_launcher_configured()) return menusub;
8081

8182
// Maps trimmed-menu menusub to upstream MENU_SYSTEM2 dispatch index:
82-
// 0 Remap -> 1, 1 Define joy -> 2, 2 Reboot -> 5, 3 Exit -> 6.
83-
// CRT mode lives on the Display Centering page now, not here.
84-
static const int map[] = { 1, 2, 5, 6 };
83+
// 0 Remap -> 1, 1 Define joy -> 2, 2 Scripts -> 3, 3 Reboot -> 5,
84+
// 4 Exit -> 6. CRT mode lives on the Zaparoo Launcher's Video
85+
// sub-page now, not here.
86+
static const int map[] = { 1, 2, 3, 5, 6 };
8587
if (menusub < 0 || menusub >= (int)(sizeof(map) / sizeof(map[0]))) return -1;
8688
return map[menusub];
8789
}
8890

8991
bool alt_launcher_system_holding_reboot(int menusub)
9092
{
91-
return alt_launcher_configured() && menusub == 2;
93+
return alt_launcher_configured() && menusub == 3;
9294
}

support/zaparoo/alt_launcher_menu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include <stdint.h>
55

66
// Trimmed System Settings menu for alt-launcher mode. The launcher is
7-
// the only "core" running on top of menu.rbf, so storage toggle,
8-
// scripts and the bundled help PDF are irrelevant — this layout
9-
// hides them and exposes only Remap(0), Define joy(1), CRT mode(2),
10-
// Reboot(3), Exit(4).
7+
// the only "core" running on top of menu.rbf, so storage toggle and
8+
// the bundled help PDF are irrelevant — this layout hides them and
9+
// exposes Remap(0), Define joy(1), Scripts(2), Reboot(3), Exit(4).
10+
// CRT mode lives on the Zaparoo Launcher's Video sub-page.
1111
//
1212
// All three helpers are no-ops / return safe defaults when
1313
// alt_launcher_configured() is false, so menu.cpp's hook sites can

support/zaparoo/launcher_pages.cpp

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,76 @@
1-
#include "display_menu.h"
1+
#include "launcher_pages.h"
22
#include "alt_launcher.h"
33
#include "osd.h"
44

55
#include <stdio.h>
66

7-
#define DISPLAY_STD_EXIT " exit"
7+
// Mirrors menu.cpp's STD_EXIT (a local #define there, kept in sync
8+
// here rather than re-exporting it via a header touch).
9+
#define LAUNCHER_STD_EXIT " exit"
810

9-
void display_menu_render(int menusub, uint64_t *menumask)
11+
void launcher_page_render(int menusub, uint64_t *menumask)
1012
{
1113
OsdSetSize(16);
12-
OsdSetTitle("Display Centering", OSD_ARROW_LEFT);
13-
*menumask = 0xF; // 4 entries: H, V, CRT, Exit
14+
OsdSetTitle("Zaparoo Launcher", OSD_ARROW_LEFT);
15+
*menumask = 0x3; // Video, Exit
16+
17+
int m = 0;
18+
OsdWrite(m++);
19+
OsdWrite(m++, "");
20+
OsdWrite(m++, "");
21+
OsdWrite(m++, "");
22+
OsdWrite(m++, "");
23+
24+
OsdWrite(m++, " Video \x16", menusub == 0);
25+
26+
while (m < OsdGetSize() - 1) OsdWrite(m++, "");
27+
OsdWrite(15, LAUNCHER_STD_EXIT, menusub == 1);
28+
}
29+
30+
int launcher_page_handle_select(int menusub)
31+
{
32+
switch (menusub)
33+
{
34+
case 0: return 1;
35+
case 1: return 0;
36+
default: return -1;
37+
}
38+
}
39+
40+
void video_page_render(int menusub, uint64_t *menumask)
41+
{
42+
OsdSetSize(16);
43+
// No arrow flags: left/right are bound to value adjustment on this
44+
// page, not sibling navigation.
45+
OsdSetTitle("Video", 0);
46+
*menumask = 0xF; // CRT, H Offset, V Offset, Exit
1447

1548
char s[64];
1649
int m = 0;
1750

1851
OsdWrite(m++);
1952
OsdWrite(m++, "");
2053
OsdWrite(m++, "");
21-
OsdWrite(m++, "");
2254

23-
sprintf(s, " H Offset: %+3d (-/+)", alt_launcher_h_offset());
55+
sprintf(s, " CRT mode: %-15s", alt_launcher_native_crt() ? "On" : "Off");
2456
OsdWrite(m++, s, menusub == 0);
2557

26-
sprintf(s, " V Offset: %+3d (-/+)", alt_launcher_v_offset());
58+
OsdWrite(m++, "");
59+
sprintf(s, " H Offset: %+3d", alt_launcher_h_offset());
2760
OsdWrite(m++, s, menusub == 1);
2861

29-
OsdWrite(m++, "");
30-
sprintf(s, " CRT mode: %-15s", alt_launcher_native_crt() ? "On" : "Off");
62+
sprintf(s, " V Offset: %+3d", alt_launcher_v_offset());
3163
OsdWrite(m++, s, menusub == 2);
3264

3365
while (m < OsdGetSize() - 1) OsdWrite(m++, "");
34-
OsdWrite(15, DISPLAY_STD_EXIT, menusub == 3);
66+
OsdWrite(15, LAUNCHER_STD_EXIT, menusub == 3);
3567
}
3668

37-
bool display_menu_handle_select(int menusub)
69+
bool video_page_handle_select(int menusub)
3870
{
3971
switch (menusub)
4072
{
41-
case 2:
73+
case 0:
4274
alt_launcher_toggle_crt();
4375
return true;
4476
case 3:
@@ -48,16 +80,19 @@ bool display_menu_handle_select(int menusub)
4880
}
4981
}
5082

51-
void display_menu_adjust(int menusub, int dir)
83+
void video_page_adjust(int menusub, int dir)
5284
{
5385
if (dir == 0) return;
5486
int8_t step = (int8_t)(dir > 0 ? 1 : -1);
5587
switch (menusub)
5688
{
5789
case 0:
58-
alt_launcher_set_h_offset((int8_t)(alt_launcher_h_offset() + step));
90+
alt_launcher_toggle_crt();
5991
break;
6092
case 1:
93+
alt_launcher_set_h_offset((int8_t)(alt_launcher_h_offset() + step));
94+
break;
95+
case 2:
6196
alt_launcher_set_v_offset((int8_t)(alt_launcher_v_offset() + step));
6297
break;
6398
default:

support/zaparoo/launcher_pages.h

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,38 @@
33
#include <stdbool.h>
44
#include <stdint.h>
55

6-
// Right-side companion to the trimmed System Settings menu. Hosts the
7-
// display centering controls (H/V offset) and the CRT mode toggle that
8-
// used to live next to Reboot in alt_launcher_render_system_menu.
6+
// Right-side companion to the trimmed System Settings menu, reachable
7+
// via the right arrow when alt_launcher_configured() is true. This file
8+
// hosts both pages of that companion: the top-level "Zaparoo Launcher"
9+
// page and the nested "Video" sub-page that owns the CRT mode toggle
10+
// plus the H/V centering offsets.
911
//
10-
// menusub layout: 0 = H offset, 1 = V offset, 2 = CRT mode, 3 = Exit.
12+
// The Video page binds left/right arrows to value adjustment instead of
13+
// sibling navigation, which is why it lives behind a sub-page rather
14+
// than directly under System Settings.
1115

12-
void display_menu_render(int menusub, uint64_t *menumask);
16+
// Top "Zaparoo Launcher" page. menusub layout: 0 = Video, 1 = Exit.
17+
void launcher_page_render(int menusub, uint64_t *menumask);
1318

14-
// Returns true if the press was consumed (re-render required without
15-
// dispatching to MENU_NONE1). Caller checks this before exiting.
16-
bool display_menu_handle_select(int menusub);
19+
// Translates a select press on the Launcher page.
20+
// 1 -> entered Video sub-page
21+
// 0 -> Exit pressed (close OSD)
22+
// -1 -> no-op
23+
int launcher_page_handle_select(int menusub);
1724

18-
// Adjust the highlighted offset row by `dir` (-1 / +1). No-op when the
19-
// current row is not an offset row.
20-
void display_menu_adjust(int menusub, int dir);
25+
// Video sub-page. menusub layout: 0 = CRT mode, 1 = H Offset,
26+
// 2 = V Offset, 3 = Exit.
27+
//
28+
// The OSD is closed automatically by the launcher spawn path (see
29+
// MenuHide() in spawn() in alt_launcher.cpp) when CRT toggling
30+
// triggers a respawn — these helpers don't need to signal that.
31+
void video_page_render(int menusub, uint64_t *menumask);
32+
33+
// Returns true if the press was consumed (re-render only); false when
34+
// Exit was selected (caller pops back to the Launcher page).
35+
bool video_page_handle_select(int menusub);
36+
37+
// Adjust the highlighted row by `dir` (-1 / +1). Toggles CRT mode on
38+
// the CRT row regardless of sign; ±1 on the H/V offset rows; no-op
39+
// elsewhere.
40+
void video_page_adjust(int menusub, int dir);

0 commit comments

Comments
 (0)