Skip to content

Commit 1fe84c6

Browse files
committed
Make launcher menu items wrap around + FIx menu stack weirdness in GB+Warioland
1 parent 8f7e1fa commit 1fe84c6

File tree

13 files changed

+42
-84
lines changed

13 files changed

+42
-84
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Retro-Go is composed of a launcher and several emulators.
1515
- More scaling options
1616
- Bilinear filtering
1717
- NES color palettes
18+
- NES PAL support
1819
- Smoother performance
1920
- Better compatibility
2021
- Fastforward

components/odroid/odroid_display.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static int8_t backlightLevels[] = {10, 25, 50, 75, 100};
5050
static int8_t backlightLevel = ODROID_BACKLIGHT_LEVEL2;
5151

5252
volatile int8_t displayScalingMode = ODROID_DISPLAY_SCALING_FILL;
53-
volatile int8_t displayUpdateMode = ODROID_DISPLAY_UPDATE_AUTO;
5453
volatile int8_t displayFilterMode = ODROID_DISPLAY_FILTER_NONE;
5554
volatile int8_t forceVideoRefresh = true;
5655

@@ -686,11 +685,6 @@ static inline int frame_diff(odroid_video_frame *frame, odroid_video_frame *prev
686685

687686
int partial_update_remaining = frame->width * frame->height * FULL_UPDATE_THRESHOLD;
688687

689-
if (displayUpdateMode == ODROID_DISPLAY_UPDATE_PARTIAL) // force partial update
690-
{
691-
partial_update_remaining = SCREEN_HEIGHT * SCREEN_WIDTH;
692-
}
693-
694688
uint32_t u32_pixel_mask = (pixel_mask << 24)|(pixel_mask << 16)|(pixel_mask << 8)|pixel_mask;
695689
uint16_t u32_blocks = (frame->width * frame->pixel_size / 4);
696690
uint16_t u32_pixels = 4 / frame->pixel_size;
@@ -964,8 +958,7 @@ void IRAM_ATTR odroid_display_write_frame(odroid_video_frame *frame)
964958
short IRAM_ATTR odroid_display_queue_update(odroid_video_frame *frame, odroid_video_frame *previousFrame)
965959
{
966960
// uint startTime = xthal_get_ccount();
967-
bool doPartialUpdate = displayUpdateMode != ODROID_DISPLAY_UPDATE_FULL
968-
&& previousFrame != NULL && !forceVideoRefresh;
961+
bool doPartialUpdate = previousFrame != NULL && !forceVideoRefresh;
969962

970963
short linesChanged = 0;
971964

@@ -1138,7 +1131,6 @@ void odroid_display_init()
11381131
backlightLevel = odroid_settings_Backlight_get();
11391132
displayScalingMode = odroid_settings_DisplayScaling_get();
11401133
displayFilterMode = odroid_settings_DisplayFilter_get();
1141-
// displayUpdateMode = odroid_settings_DisplayUpdateMode_get();
11421134

11431135
display_mutex = xSemaphoreCreateMutex();
11441136

components/odroid/odroid_display.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ typedef enum
3434
ODROID_DISPLAY_SCALING_COUNT
3535
} odroid_display_scaling;
3636

37-
typedef enum
38-
{
39-
ODROID_DISPLAY_UPDATE_AUTO = 0,
40-
ODROID_DISPLAY_UPDATE_FULL,
41-
ODROID_DISPLAY_UPDATE_PARTIAL,
42-
ODROID_DISPLAY_UPDATE_COUNT,
43-
} odroid_display_update_mode;
44-
4537
typedef enum
4638
{
4739
ODROID_DISPLAY_FILTER_NONE = 0x0,
@@ -77,7 +69,6 @@ typedef struct {
7769
} odroid_video_update;
7870

7971
extern volatile int8_t displayScalingMode;
80-
extern volatile int8_t displayUpdateMode;
8172
extern volatile int8_t displayFilterMode;
8273
extern volatile int8_t forceVideoRefresh;
8374

components/odroid/odroid_overlay.c

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -371,26 +371,6 @@ static bool audio_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_
371371
return event == ODROID_DIALOG_ENTER;
372372
}
373373

374-
static bool display_mode_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
375-
{
376-
int8_t max = ODROID_DISPLAY_UPDATE_COUNT - 1;
377-
int8_t prev = displayUpdateMode;
378-
379-
if (event == ODROID_DIALOG_PREV && --displayUpdateMode < 0) displayUpdateMode = 0; // max;
380-
if (event == ODROID_DIALOG_NEXT && ++displayUpdateMode > max) displayUpdateMode = max; // 0;
381-
382-
if (displayUpdateMode != prev) {
383-
odroid_settings_DisplayUpdateMode_set(displayUpdateMode);
384-
forceVideoRefresh = true;
385-
}
386-
387-
if (displayUpdateMode == ODROID_DISPLAY_UPDATE_AUTO) strcpy(option->value, "Auto");
388-
if (displayUpdateMode == ODROID_DISPLAY_UPDATE_FULL) strcpy(option->value, "Full");
389-
if (displayUpdateMode == ODROID_DISPLAY_UPDATE_PARTIAL) strcpy(option->value, "Partial");
390-
391-
return event == ODROID_DIALOG_ENTER;
392-
}
393-
394374
static bool filter_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
395375
{
396376
int8_t max = ODROID_DISPLAY_FILTER_COUNT - 1;
@@ -468,10 +448,9 @@ int odroid_overlay_settings_menu(odroid_dialog_choice_t *extra_options, int extr
468448

469449
int odroid_overlay_game_settings_menu(odroid_dialog_choice_t *extra_options, int extra_options_count)
470450
{
471-
odroid_dialog_choice_t options[12] = {
451+
static odroid_dialog_choice_t options[12] = {
472452
{10, "Scaling", "Full", 1, &scaling_update_cb},
473453
{12, "Filtering", "None", 1, &filter_update_cb}, // Interpolation
474-
// {11, "Update Mode", "Auto", 1, &display_mode_update_cb},
475454
{13, "Speed", "1x", 1, &speedup_update_cb},
476455
// {14, "", "", 1, NULL},
477456
};
@@ -496,26 +475,26 @@ int odroid_overlay_game_menu()
496475
odroid_display_lock();
497476
wait_all_keys_released();
498477

499-
odroid_dialog_choice_t choices[] = {
500-
{0, "Continue", "", 1, NULL},
501-
{3, "Save & Continue", "", 1, NULL},
502-
{4, "Save & Quit", "", 1, NULL},
503-
{2, "Reload", "", 1, NULL},
504-
{5, "Quit", "", 1, NULL},
478+
static odroid_dialog_choice_t choices[] = {
479+
// {0, "Continue", "", 1, NULL},
480+
{10, "Save & Continue", "", 1, NULL},
481+
{20, "Save & Quit", "", 1, NULL},
482+
{30, "Reload", "", 1, NULL},
483+
// {40, "Netplay", "", 1, NULL},
484+
{50, "Quit", "", 1, NULL},
505485
};
506486

507487
int r = odroid_overlay_dialog("Retro-Go", choices, sizeof(choices) / sizeof(choices[0]), 0);
508488
odroid_display_unlock();
509489

510-
if (r == 2) {
511-
// LoadState();
512-
esp_restart();
513-
} else if (r == 3) {
514-
SaveState();
515-
} else if (r == 4) {
516-
QuitEmulator(true);
517-
} else if (r == 5) {
518-
QuitEmulator(false);
490+
switch (r)
491+
{
492+
case 10: SaveState(); break;
493+
case 20: QuitEmulator(true); break;
494+
// case 30: LoadState(); break;
495+
case 30: esp_restart(); break;
496+
// case 40: odroid_netplay_init(); break;
497+
case 50: QuitEmulator(false); break;
519498
}
520499

521500
return r;

components/odroid/odroid_settings.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ static const char* NvsKey_Scaling = "Scaling";
2020
static const char* NvsKey_AudioSink = "AudioSink";
2121
static const char* NvsKey_Palette = "Palette";
2222
static const char* NvsKey_Region = "Region";
23-
static const char* NvsKey_DispUpdate = "DispUpdate";
2423
static const char* NvsKey_DispFilter = "DispFilter";
2524

2625
static nvs_handle my_handle;
@@ -214,14 +213,6 @@ void odroid_settings_DisplayScaling_set(int32_t value)
214213
odroid_settings_app_int32_set(NvsKey_Scaling, value);
215214
}
216215

217-
int32_t odroid_settings_DisplayUpdateMode_get()
218-
{
219-
return odroid_settings_app_int32_get(NvsKey_DispUpdate, ODROID_DISPLAY_UPDATE_AUTO);
220-
}
221-
void odroid_settings_DisplayUpdateMode_set(int32_t value)
222-
{
223-
odroid_settings_app_int32_set(NvsKey_DispUpdate, value);
224-
}
225216

226217
int32_t odroid_settings_DisplayFilter_get()
227218
{

components/odroid/odroid_settings.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ void odroid_settings_Palette_set(int32_t value);
5454
int32_t odroid_settings_DisplayScaling_get();
5555
void odroid_settings_DisplayScaling_set(int32_t value);
5656

57-
int32_t odroid_settings_DisplayUpdateMode_get();
58-
void odroid_settings_DisplayUpdateMode_set(int32_t value);
59-
6057
int32_t odroid_settings_DisplayFilter_get();
6158
void odroid_settings_DisplayFilter_set(int32_t value);
6259

gnuboy-go/components/gnuboy/lcd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,11 @@ void pal_set(int palette)
732732
pal_dirty();
733733
}
734734

735+
int pal_get()
736+
{
737+
return current_palette;
738+
}
739+
735740
void pal_dirty()
736741
{
737742
int i;

gnuboy-go/components/gnuboy/lcd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void pal_write_dmg(int i, int mapnum, byte d);
5454
void vram_write(int a, byte b);
5555
void pal_dirty();
5656
void pal_set(int palette);
57+
int pal_get();
5758
void vram_dirty();
5859
void lcd_reset();
5960
//void bg_scan_color();

gnuboy-go/components/gnuboy/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ inline void ioreg_write(byte r, byte b)
145145
break;
146146
case RI_SC:
147147
if ((b & 0x81) == 0x81)
148-
cpu.serial = 488; // 8 * 122 / 2
148+
cpu.serial = 1952; // 8 * 122us;
149149
else
150150
cpu.serial = 0;
151151
R_SC = b; /* & 0x7f; */

gnuboy-go/main/main.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,14 @@ void QuitEmulator(bool save)
205205
esp_restart();
206206
}
207207

208-
bool palette_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
208+
static bool palette_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
209209
{
210-
int pal = odroid_settings_Palette_get();
210+
int pal = pal_get();
211211
int max = 7;
212212

213213
if (event == ODROID_DIALOG_PREV) {
214-
pal = pal > 0 ? pal - 1 : max; }
214+
pal = pal > 0 ? pal - 1 : max;
215+
}
215216

216217
if (event == ODROID_DIALOG_NEXT) {
217218
pal = pal < max ? pal + 1 : 0;
@@ -231,7 +232,7 @@ bool palette_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t eve
231232
}
232233

233234

234-
bool rtc_t_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
235+
static bool rtc_t_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
235236
{
236237
if (option->id == 'd') {
237238
if (event == ODROID_DIALOG_PREV && --rtc.d < 0) rtc.d = 364;
@@ -256,14 +257,14 @@ bool rtc_t_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event
256257
return event == ODROID_DIALOG_ENTER;
257258
}
258259

259-
bool rtc_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
260+
static bool rtc_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
260261
{
261262
if (event == ODROID_DIALOG_ENTER) {
262-
odroid_dialog_choice_t choices[] = {
263+
static odroid_dialog_choice_t choices[] = {
263264
{'d', "Day", "000", 1, &rtc_t_update_cb},
264265
{'h', "Hour", "00", 1, &rtc_t_update_cb},
265-
{'m', "Min", "00", 1, &rtc_t_update_cb},
266-
{'s', "Sec", "00", 1, &rtc_t_update_cb},
266+
{'m', "Min", "00", 1, &rtc_t_update_cb},
267+
{'s', "Sec", "00", 1, &rtc_t_update_cb},
267268
};
268269
odroid_overlay_dialog("Set Clock", choices, 4, 0);
269270
}

gnuboy-go/sdkconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
232232
CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
233233
CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
234234
CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2048
235-
CONFIG_MAIN_TASK_STACK_SIZE=8192
235+
CONFIG_MAIN_TASK_STACK_SIZE=16384
236236
CONFIG_IPC_TASK_STACK_SIZE=1024
237237
CONFIG_TIMER_TASK_STACK_SIZE=4096
238238
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y

nesemu-go/main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void osd_getinput(void)
298298
else if (joystick.values[ODROID_INPUT_VOLUME]) {
299299
odroid_dialog_choice_t options[] = {
300300
{100, "Palette", "Default", 1, &palette_update_cb},
301-
{101, "", "", -1, NULL},
301+
// {101, "", "", -1, NULL},
302302
{101, "More...", "", 1, &advanced_settings_cb},
303303
};
304304
odroid_overlay_game_settings_menu(options, sizeof(options) / sizeof(options[0]));

retro-go/main/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ static bool font_size_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t e
2828
{
2929
int font_size = odroid_settings_int32_get("FontSize", 1);
3030
if (event == ODROID_DIALOG_PREV) {
31-
if (--font_size < 1) font_size = 1;
31+
if (--font_size < 1) font_size = 2;
3232
odroid_overlay_set_font_size(font_size);
3333
redraw_screen();
3434
}
3535
if (event == ODROID_DIALOG_NEXT) {
36-
if (++font_size > 2) font_size = 2;
36+
if (++font_size > 2) font_size = 1;
3737
odroid_overlay_set_font_size(font_size);
3838
redraw_screen();
3939
}
@@ -54,11 +54,11 @@ static bool hide_empty_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t
5454
static bool show_cover_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t event)
5555
{
5656
if (event == ODROID_DIALOG_PREV) {
57-
if (--show_cover < 0) show_cover = 0;
57+
if (--show_cover < 0) show_cover = 2;
5858
odroid_settings_int32_set("ShowCover", show_cover);
5959
}
6060
if (event == ODROID_DIALOG_NEXT) {
61-
if (++show_cover > 2) show_cover = 2;
61+
if (++show_cover > 2) show_cover = 0;
6262
odroid_settings_int32_set("ShowCover", show_cover);
6363
}
6464
if (show_cover == 0) strcpy(option->value, "No");
@@ -71,12 +71,12 @@ static bool color_shift_cb(odroid_dialog_choice_t *option, odroid_dialog_event_t
7171
{
7272
int max = gui_themes_count - 1;
7373
if (event == ODROID_DIALOG_PREV) {
74-
if (--theme < 0) theme = 0;
74+
if (--theme < 0) theme = max;
7575
odroid_settings_int32_set("Theme", theme);
7676
redraw_screen();
7777
}
7878
if (event == ODROID_DIALOG_NEXT) {
79-
if (++theme > max) theme = max;
79+
if (++theme > max) theme = 0;
8080
odroid_settings_int32_set("Theme", theme);
8181
redraw_screen();
8282
}

0 commit comments

Comments
 (0)