Skip to content

Commit 485b1d9

Browse files
Thu 21 Nov 2019 14:59:36 EST - PC Engine - Bug Fix
1 parent 33b364a commit 485b1d9

File tree

8 files changed

+154
-131
lines changed

8 files changed

+154
-131
lines changed

Components/odroid-go-pcengine-huexpress/odroid-go-common/components/odroid/odroid_hud.c

Lines changed: 78 additions & 75 deletions
Large diffs are not rendered by default.

Components/odroid-go-pcengine-huexpress/pcengine-go/main/main.c

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern char *syscard_filename;
3939
#include "../components/odroid/odroid_hud.h"
4040
int ACTION;
4141
#endif
42-
42+
4343
#define NOINLINE __attribute__ ((noinline))
4444

4545
const char* SD_BASE_PATH = "/sd";
@@ -70,7 +70,7 @@ void dump_heap_info_short() {
7070
}
7171

7272
void *my_special_alloc(unsigned char speed, unsigned char bytes, unsigned long size) {
73-
uint32_t caps = (speed?MALLOC_CAP_INTERNAL:MALLOC_CAP_SPIRAM) |
73+
uint32_t caps = (speed?MALLOC_CAP_INTERNAL:MALLOC_CAP_SPIRAM) |
7474
( bytes==1?MALLOC_CAP_8BIT:MALLOC_CAP_32BIT);
7575
/*
7676
if (speed) {
@@ -169,7 +169,7 @@ void videoTask_mode0_w336(void *arg) { VID_TASK(ili9341_write_frame_pcengine_mod
169169

170170
#ifdef MY_SND_AS_TASK
171171
#define AUDIO_SAMPLE_RATE (22050)
172-
#define AUDIO_BUFFER_SIZE (4096)
172+
#define AUDIO_BUFFER_SIZE (4096)
173173
//(1920*4)
174174
#define AUDIO_CHANNELS 6
175175
short *sbuf_mix[2];
@@ -179,7 +179,7 @@ void audioTask_mode0(void *arg) {
179179
audioTaskIsRunning = true;
180180
printf("%s: STARTED\n", __func__);
181181
uint8_t buf = 0;
182-
182+
183183
while(1)
184184
{
185185
if (xQueuePeek(audioQueue, &param, 0) == pdTRUE)
@@ -205,7 +205,7 @@ void audioTask_mode0(void *arg) {
205205
uchar lvol, rvol;
206206
lvol = (io.psg_volume >> 4) * 1.22;
207207
rvol = (io.psg_volume & 0x0F) * 1.22;
208-
208+
209209
short *p = sbuf_mix[buf];
210210
for (int i = 0;i < AUDIO_BUFFER_SIZE/2;i++)
211211
{
@@ -227,7 +227,7 @@ void audioTask_mode0(void *arg) {
227227
uchar lvol, rvol;
228228
lvol = (io.psg_volume >> 4) * 1.22;
229229
rvol = (io.psg_volume & 0x0F) * 1.22;
230-
230+
231231
short *p = sbuf_mix[buf];
232232
for (int i = 0;i < AUDIO_BUFFER_SIZE/2;i++)
233233
{
@@ -246,7 +246,7 @@ void audioTask_mode0(void *arg) {
246246
*(p+1) = rval;
247247
p+=2;
248248
}
249-
249+
250250
odroid_audio_submit((short*)sbuf_mix[buf], AUDIO_BUFFER_SIZE/4);
251251
buf = buf?0:1;
252252
}
@@ -285,13 +285,13 @@ NOINLINE void update_display_task(int width)
285285
printf("VIDEO: Task: Stop\n");
286286
StopVideo();
287287
printf("VIDEO: Task: Stop done\n");
288-
288+
289289
printf("VIDEO: Clear display\n");
290290
//odroid_display_lock();
291291
ili9341_clear(0);
292292
//odroid_display_unlock();
293293
}
294-
294+
295295
TaskFunction_t taskFunc;
296296
if (width == 224)
297297
taskFunc = &videoTask_mode0_w224;
@@ -331,12 +331,33 @@ void DoMenuHome(bool save)
331331
uint16_t* param = TASK_BREAK;
332332
void *exitAudioTask = NULL;
333333

334-
#ifdef CONFIG_IN_GAME_MENU_YES
334+
#ifdef CONFIG_IN_GAME_MENU_YES
335335
//odroid_display_lock();
336336
EmuAudio(false);
337337
hud_menu();
338-
printf("\nACTION:%d\n", ACTION);
338+
printf("\nACTION:%d\n", ACTION);
339339
switch(ACTION) {
340+
case 1:
341+
// Clear audio to prevent studdering
342+
printf("PowerDown: stopping audio.\n");
343+
#ifdef MY_SND_AS_TASK
344+
EmuAudio(false);
345+
odroid_audio_terminate();
346+
#endif
347+
348+
// Stop tasks
349+
printf("PowerDown: stopping tasks.\n");
350+
StopVideo();
351+
odroid_display_lock();
352+
odroid_sdcard_close();
353+
odroid_display_unlock();
354+
355+
gpio_set_level(GPIO_NUM_2, 0);
356+
// Set menu application
357+
odroid_system_application_set(8);
358+
// Reset
359+
esp_restart();
360+
break;
340361
case 3:
341362
case 4:
342363
hud_progress("Saving...", true);
@@ -347,11 +368,11 @@ void DoMenuHome(bool save)
347368
break;
348369
case 5:
349370
printf("\nDELETE ROM\n");
350-
break;
351-
}
352-
ili9341_clear(0);
371+
break;
372+
}
373+
ili9341_clear(0);
353374
EmuAudio(true);
354-
odroid_display_unlock();
375+
odroid_display_unlock();
355376
#else
356377
// Clear audio to prevent studdering
357378
printf("PowerDown: stopping audio.\n");
@@ -363,7 +384,7 @@ void DoMenuHome(bool save)
363384
// Stop tasks
364385
printf("PowerDown: stopping tasks.\n");
365386
StopVideo();
366-
//DoReboot(save);
387+
//DoReboot(save);
367388
DoReboot(false);
368389
#endif
369390
}
@@ -372,7 +393,7 @@ void DoMenuHome(bool save)
372393
NOINLINE void app_init(void)
373394
{
374395
printf("pcengine (%s-%s).\n", COMPILEDATE, GITREV);
375-
396+
376397
nvs_flash_init();
377398

378399
odroid_system_init();
@@ -390,22 +411,22 @@ NOINLINE void app_init(void)
390411

391412
/////
392413
check_boot_cause();
393-
414+
394415
esp_err_t r = odroid_sdcard_open(SD_BASE_PATH);
395416
if (r != ESP_OK)
396417
{
397418
odroid_display_show_sderr(ODROID_SD_ERR_NOCARD);
398419
abort();
399420
}
400-
421+
401422
//char *rom_file = odroid_ui_choose_file("/sd/roms/pce", "pce");
402423
char* rom_file = odroid_settings_RomFilePath_get();
403424
if (!rom_file)
404425
{
405426
printf("No file selected!\n");
406427
abort();
407428
}
408-
429+
409430
cart_name = (char *)my_special_alloc(false, 1, PATH_MAX_MY);
410431
short_cart_name = (char *)my_special_alloc(false, 1, PATH_MAX_MY);
411432
short_iso_name = (char *)my_special_alloc(false, 1, PATH_MAX_MY);
@@ -418,7 +439,7 @@ NOINLINE void app_init(void)
418439
ISO_filename = (char *)my_special_alloc(false, 1, PATH_MAX_MY);
419440
syscard_filename = (char *)my_special_alloc(false, 1, PATH_MAX_MY);
420441
cdsystem_path = (char *)my_special_alloc(false, 1, PATH_MAX_MY);
421-
442+
422443
spr_init_pos = (uint32 *)my_special_alloc(false, 4, 1024 * 4);
423444
SPM_raw = (uchar*)my_special_alloc(false, 1, XBUF_WIDTH * XBUF_HEIGHT);
424445
SPM = SPM_raw + XBUF_WIDTH * 64 + 32;
@@ -433,7 +454,7 @@ NOINLINE void app_init(void)
433454
strcpy(ISO_filename, "");
434455
strcpy(sav_basepath,"/sd/odroid/data");
435456
strcpy(sav_path,"pce");
436-
457+
437458
framebuffer[0] = my_special_alloc(false, 1, XBUF_WIDTH * XBUF_HEIGHT);
438459
// framebuffer[0] = heap_caps_malloc(XBUF_WIDTH * XBUF_HEIGHT, MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
439460
if (!framebuffer[0]) abort();
@@ -445,10 +466,10 @@ NOINLINE void app_init(void)
445466
printf("app_main: framebuffer[1]=%p\n", framebuffer[1]);
446467
memset(framebuffer[0], 0, XBUF_WIDTH * XBUF_HEIGHT);
447468
memset(framebuffer[1], 0, XBUF_WIDTH * XBUF_HEIGHT);
448-
469+
449470
my_palette = my_special_alloc(false, 1, 256 * sizeof(uint16_t));
450471
if (!my_palette) abort();
451-
472+
452473
XBuf = framebuffer[0];
453474
osd_gfx_buffer = XBuf + 32 + 64 * XBUF_WIDTH;
454475
#ifdef MY_GFX_AS_TASK
@@ -460,9 +481,9 @@ NOINLINE void app_init(void)
460481
#endif
461482

462483
QuickSaveSetBuffer(my_special_alloc(false, 1, 512));
463-
484+
464485
odroid_audio_init(odroid_settings_AudioSink_get(), AUDIO_SAMPLE_RATE);
465-
486+
466487
InitPCE(rom_file);
467488
osd_init_machine();
468489
#ifdef MY_GFX_AS_TASK
@@ -476,10 +497,10 @@ NOINLINE void app_init(void)
476497
for (int i = 0;i < AUDIO_CHANNELS; i++)
477498
{
478499
sbuf[i] = my_special_alloc(false, 1, AUDIO_BUFFER_SIZE/2);
479-
}
500+
}
480501
sbuf_mix[0] = my_special_alloc(false, 1, AUDIO_BUFFER_SIZE);
481502
sbuf_mix[1] = my_special_alloc(false, 1, AUDIO_BUFFER_SIZE);
482-
503+
483504
audioQueue = xQueueCreate(1, sizeof(uint16_t*));
484505
EmuAudio(true);
485506
printf("VIDEO: Task: Start done\n");
@@ -490,7 +511,7 @@ NOINLINE void app_loop(void)
490511
{
491512
printf("up and running\n");
492513
//if (!(*osd_gfx_driver_list[video_driver].init) ())
493-
odroid_ui_enter_loop();
514+
//odroid_ui_enter_loop();
494515
RunPCE();
495516
abort();
496517
}

Emulators/handy-go/sdkconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ CONFIG_MONITOR_BAUD=115200
8383
#
8484
# Retro ESP32 Configuration
8585
#
86-
CONFIG_LCD_DRIVER_CHIP_ODROID_GO=y
87-
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=
88-
CONFIG_DEFAULT_MENU_KEY=y
89-
CONFIG_COMBO_MENU_KEY=
86+
CONFIG_LCD_DRIVER_CHIP_ODROID_GO=
87+
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=y
88+
CONFIG_DEFAULT_MENU_KEY=
89+
CONFIG_COMBO_MENU_KEY=y
9090
CONFIG_IN_GAME_MENU_YES=y
9191
CONFIG_IN_GAME_MENU_NO=
9292

Launchers/retro-esp32/main/main.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
// Display
119119
ili9341_init();
120120
BRIGHTNESS = get_brightness();
121-
apply_brightness();
121+
apply_brightness();
122122

123123
// Joystick
124124
odroid_input_gamepad_init();
@@ -341,7 +341,7 @@
341341
int width = strlen(message)*5;
342342
int center = ceil((320)-(width))-48;
343343
y = 225;
344-
draw_text(center,y,message,false,false);
344+
draw_text(center,y,message,false,false);
345345
}
346346
//}#pragma endregion Settings
347347

@@ -489,7 +489,7 @@
489489
//ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, currentDuty);
490490
//ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
491491
//ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty, 1000);
492-
//ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE /*LEDC_FADE_NO_WAIT|LEDC_FADE_WAIT_DONE|LEDC_FADE_MAX*/);
492+
//ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE /*LEDC_FADE_NO_WAIT|LEDC_FADE_WAIT_DONE|LEDC_FADE_MAX*/);
493493
//ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty);
494494
//ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
495495
ledc_set_fade_time_and_start(
@@ -717,16 +717,16 @@
717717
case 8:
718718
dy = 0;
719719
break;
720-
case 7:
720+
case 7:
721721
case 6:
722722
case 5:
723723
dy = 16;
724724
break;
725-
case 4:
725+
case 4:
726726
case 3:
727727
case 2:
728728
dy = 32;
729-
break;
729+
break;
730730
case 1:
731731
case 0:
732732
dy = 48;
@@ -736,7 +736,7 @@
736736
int x = SCREEN.w - 72;
737737
int y = 8;
738738
int h = 16;
739-
int w = 16;
739+
int w = 16;
740740

741741
draw_mask(x,y,16,16);
742742

@@ -746,7 +746,7 @@
746746
i++;
747747
}
748748
}
749-
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
749+
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
750750
}
751751

752752
void draw_numbers() {
@@ -780,7 +780,7 @@
780780
//buffer[i] = SYSTEMS[e].system[r][c] == WHITE ? WHITE : GUI.bg;
781781
buffer[i] = SYSTEMS[STEP].color[r][c] == 0 ? GUI.bg : SYSTEMS[STEP].color[r][c];
782782
break;
783-
}
783+
}
784784
i++;
785785
}
786786
}
@@ -1174,7 +1174,6 @@
11741174
odroid_system_application_set(PROGRAMS[STEP-1]);
11751175
usleep(10000);
11761176
esp_restart();
1177-
11781177
}
11791178

11801179
void rom_resume() {

Launchers/retro-esp32/partitions.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ spectrum, 0, ota_4, 0x550000, 0x90000
1313
a26, 0, ota_5, 0x5E0000, 0x1a0000
1414
a78, 0, ota_6, 0x780000, 0xc0000
1515
lnx, 0, ota_7, 0x840000, 0xe0000
16-
pce, 0, ota_8, 0x920000, 0xb0000
17-
data_0, 0x40, 0x00, 0x9D0000, 0x400000
16+
pce, 0, ota_8, 0x920000, 0xc0000
17+
data_0, 0x40, 0x00, 0x9E0000, 0x400000
1818
#########################################################
1919

2020
# spectrum = 447,712 = 524288 = 90000
@@ -68,4 +68,4 @@ data_0, 0x40, 0x00, 0x9D0000, 0x400000
6868
# lnx, 0, ota_6, 0x840000, 0xe0000
6969
# pce, 0, ota_7, 0x920000, 0xb0000
7070
# data_0, 0x40, 0x00, 0x9D0000, 0x5D0000
71-
# #########################################################
71+
# #########################################################

Launchers/retro-esp32/sdkconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ CONFIG_MONITOR_BAUD=115200
8282
#
8383
# Retro ESP32 Configuration
8484
#
85-
CONFIG_LCD_DRIVER_CHIP_ODROID_GO=y
86-
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=
87-
CONFIG_DEFAULT_MENU_KEY=y
88-
CONFIG_COMBO_MENU_KEY=
85+
CONFIG_LCD_DRIVER_CHIP_ODROID_GO=
86+
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=y
87+
CONFIG_DEFAULT_MENU_KEY=
88+
CONFIG_COMBO_MENU_KEY=y
8989

9090
#
9191
# Partition Table

Launchers/retro-esp32/sdkconfig.old

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CONFIG_FLASH_ENCRYPTION_ENABLED=
3737
#
3838
# Serial flasher config
3939
#
40-
CONFIG_ESPTOOLPY_PORT="/dev/cu.SLAB_USBtoUART"
40+
CONFIG_ESPTOOLPY_PORT="/dev/cu.usbserial-A1015RV2"
4141
CONFIG_ESPTOOLPY_BAUD_115200B=
4242
CONFIG_ESPTOOLPY_BAUD_230400B=
4343
CONFIG_ESPTOOLPY_BAUD_921600B=y
@@ -82,10 +82,10 @@ CONFIG_MONITOR_BAUD=115200
8282
#
8383
# Retro ESP32 Configuration
8484
#
85-
CONFIG_LCD_DRIVER_CHIP_ODROID_GO=y
86-
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=
87-
CONFIG_DEFAULT_MENU_KEY=y
88-
CONFIG_COMBO_MENU_KEY=
85+
CONFIG_LCD_DRIVER_CHIP_ODROID_GO=
86+
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=y
87+
CONFIG_DEFAULT_MENU_KEY=
88+
CONFIG_COMBO_MENU_KEY=y
8989

9090
#
9191
# Partition Table

Odroid/odroid-go-firmware

0 commit comments

Comments
 (0)