Skip to content

Commit 66bf820

Browse files
committed
Tue 11 Feb 2020 08:48:21 EST - center preview text
1 parent 8b57297 commit 66bf820

File tree

5 files changed

+59
-48
lines changed

5 files changed

+59
-48
lines changed

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=
87-
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=y
88-
CONFIG_DEFAULT_MENU_KEY=
89-
CONFIG_COMBO_MENU_KEY=y
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=
9090
CONFIG_IN_GAME_MENU_YES=y
9191
CONFIG_IN_GAME_MENU_NO=
9292

Launchers/retro-esp32/main/includes/declarations.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
Helpers
3+
*/
4+
char *remove_ext (char* myStr, char extSep, char pathSep);
5+
16
/*
27
Debounce
38
*/

Launchers/retro-esp32/main/main.c

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -170,51 +170,54 @@
170170
/*
171171
METHODS
172172
*/
173-
//{#pragma region Debounce
174-
void debounce(int key) {
175-
draw_battery();
176-
draw_speaker();
177-
draw_contrast();
178-
while (gamepad.values[key]) odroid_input_gamepad_read(&gamepad);
179-
}
180-
//}#pragma endregion Debounce
181173

182-
char *remove_ext (char* myStr, char extSep, char pathSep) {
183-
char *retStr, *lastExt, *lastPath;
174+
//{#pragma region Helpers
175+
char *remove_ext (char* myStr, char extSep, char pathSep) {
176+
char *retStr, *lastExt, *lastPath;
184177

185-
// Error checks and allocate string.
178+
// Error checks and allocate string.
186179

187-
if (myStr == NULL) return NULL;
188-
if ((retStr = malloc (strlen (myStr) + 1)) == NULL) return NULL;
180+
if (myStr == NULL) return NULL;
181+
if ((retStr = malloc (strlen (myStr) + 1)) == NULL) return NULL;
189182

190-
// Make a copy and find the relevant characters.
183+
// Make a copy and find the relevant characters.
191184

192-
strcpy (retStr, myStr);
193-
lastExt = strrchr (retStr, extSep);
194-
lastPath = (pathSep == 0) ? NULL : strrchr (retStr, pathSep);
185+
strcpy (retStr, myStr);
186+
lastExt = strrchr (retStr, extSep);
187+
lastPath = (pathSep == 0) ? NULL : strrchr (retStr, pathSep);
195188

196-
// If it has an extension separator.
189+
// If it has an extension separator.
197190

198-
if (lastExt != NULL) {
199-
// and it's to the right of the path separator.
191+
if (lastExt != NULL) {
192+
// and it's to the right of the path separator.
200193

201-
if (lastPath != NULL) {
202-
if (lastPath < lastExt) {
203-
// then remove it.
194+
if (lastPath != NULL) {
195+
if (lastPath < lastExt) {
196+
// then remove it.
204197

205-
*lastExt = '\0';
206-
}
207-
} else {
208-
// Has extension separator with no path separator.
198+
*lastExt = '\0';
199+
}
200+
} else {
201+
// Has extension separator with no path separator.
209202

210-
*lastExt = '\0';
211-
}
212-
}
203+
*lastExt = '\0';
204+
}
205+
}
213206

214-
// Return the modified string.
207+
// Return the modified string.
215208

216-
return retStr;
217-
}
209+
return retStr;
210+
}
211+
//}#pragma endregion Helpers
212+
213+
//{#pragma region Debounce
214+
void debounce(int key) {
215+
draw_battery();
216+
draw_speaker();
217+
draw_contrast();
218+
while (gamepad.values[key]) odroid_input_gamepad_read(&gamepad);
219+
}
220+
//}#pragma endregion Debounce
218221

219222
//{#pragma region States
220223
void get_step_state() {
@@ -1225,6 +1228,7 @@ char *remove_ext (char* myStr, char extSep, char pathSep) {
12251228
void get_cover() {
12261229
preview_cover(false);
12271230
}
1231+
12281232
void preview_cover(bool error) {
12291233
ROM.crc = 0;
12301234

@@ -1246,7 +1250,6 @@ char *remove_ext (char* myStr, char extSep, char pathSep) {
12461250
ROM.crc = 1;
12471251
fclose(f);
12481252
} else {
1249-
printf("FILE NOT FOUND");
12501253
error = true;
12511254
}
12521255
}
@@ -1262,13 +1265,17 @@ char *remove_ext (char* myStr, char extSep, char pathSep) {
12621265
int y = POS.y+8;
12631266
ili9341_write_frame_rectangleLE(x, y, bw, bh, buffer);
12641267

1265-
draw_text(x + (error ? 30 : 40), y + (bh/2), error ? "NO PREVIEW" : "PREVIEW", false, false, false);
1268+
int center = x + bw/2;
1269+
center -= error ? 30 : 22;
1270+
1271+
draw_text(center, y + (bh/2) - 3, error ? "NO PREVIEW" : "PREVIEW", false, false, false);
12661272

12671273
if(ROM.crc == 1) {
12681274
usleep(20000);
12691275
draw_cover();
12701276
}
12711277
}
1278+
12721279
void draw_cover() {
12731280
printf("\n----- %s -----\n%s\n", __func__, "OPENNING");
12741281
char file[256] = "/sd/romart";
@@ -1297,7 +1304,6 @@ char *remove_ext (char* myStr, char extSep, char pathSep) {
12971304
fclose(f);
12981305
}
12991306
}
1300-
13011307
//}#pragma endregion Cover
13021308

13031309
//{#pragma region Animations

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=
86-
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=y
87-
CONFIG_DEFAULT_MENU_KEY=
88-
CONFIG_COMBO_MENU_KEY=y
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=
8989

9090
#
9191
# Partition Table

Launchers/retro-esp32/sdkconfig.old

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=
86-
CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32=y
87-
CONFIG_DEFAULT_MENU_KEY=
88-
CONFIG_COMBO_MENU_KEY=y
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=
8989

9090
#
9191
# Partition Table

0 commit comments

Comments
 (0)