clean up + warning and crasher fixes

This commit is contained in:
Shaun Inman 2023-03-20 19:39:51 -04:00
parent c61d6bb04c
commit 7882f9b9dd
6 changed files with 35 additions and 28 deletions

View file

@ -1,4 +1,5 @@
-supafaust_pixel_format = rgb565 -supafaust_pixel_format = rgb565
-supafaust_thread_affinity_emu = 0x0
bind Up = UP bind Up = UP
bind Down = DOWN bind Down = DOWN

View file

@ -586,7 +586,7 @@ int GFX_wrapText(TTF_Font* font, char* str, int max_width, int max_lines) {
if (!str) return 0; if (!str) return 0;
int line_width; int line_width;
int max_line_width; int max_line_width = 0;
char* line = str; char* line = str;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
@ -597,7 +597,7 @@ int GFX_wrapText(TTF_Font* font, char* str, int max_width, int max_lines) {
return line_width; return line_width;
} }
char* prev; char* prev = NULL;
char* tmp = line; char* tmp = line;
int lines = 1; int lines = 1;
int i = 0; int i = 0;
@ -1354,8 +1354,9 @@ static void POW_initOverlay(void) {
// // setup surface // // setup surface
// pow.overlay = SDL_CreateRGBSurfaceFrom(NULL,SCALE2(OVERLAY_WIDTH,OVERLAY_HEIGHT),OVERLAY_DEPTH,SCALE1(OVERLAY_PITCH), OVERLAY_RGBA_MASK); // pow.overlay = SDL_CreateRGBSurfaceFrom(NULL,SCALE2(OVERLAY_WIDTH,OVERLAY_HEIGHT),OVERLAY_DEPTH,SCALE1(OVERLAY_PITCH), OVERLAY_RGBA_MASK);
// uint32_t size = pow.overlay->h * pow.overlay->pitch; // uint32_t size = pow.overlay->h * pow.overlay->pitch;
// uint32_t offset = (gfx.finfo.smem_len - size)&(~4095); // uint32_t offset = (gfx.fb_info.size - size)&(~4095);
// pow.overlay->pixels = gfx.fb0_buffer + offset; // pow.overlay->pixels = gfx.fb_info.vadd + offset;
// memset(pow.overlay->pixels, 0xff, size);
// //
// // draw battery // // draw battery
// SDL_SetAlpha(gfx.assets, 0,0); // SDL_SetAlpha(gfx.assets, 0,0);
@ -1377,7 +1378,7 @@ static void POW_initOverlay(void) {
// //
// pow.oinfo.mem_off = offset; // pow.oinfo.mem_off = offset;
// pow.oinfo.mem_size = size; // pow.oinfo.mem_size = size;
// pow.oinfo.screen_width = VIRTUAL_WIDTH; // ??? // pow.oinfo.screen_width = PAGE_WIDTH; // ???
// pow.oinfo.color_mode = OWL_DSS_COLOR_ARGB32; // pow.oinfo.color_mode = OWL_DSS_COLOR_ARGB32;
// pow.oinfo.img_width = w; // pow.oinfo.img_width = w;
// pow.oinfo.img_height = h; // pow.oinfo.img_height = h;
@ -1396,7 +1397,7 @@ static void POW_initOverlay(void) {
// pow.oinfo.zorder = 3; // pow.oinfo.zorder = 3;
} }
static void POW_flipOverlay(void) { static void POW_flipOverlay(void) {
// if (pow.should_warn && pow.charge<=POW_LOW_CHARGE) ioctl(gfx.fb0_fd, OWLFB_OVERLAY_SETINFO, &pow.oargs); // if (pow.should_warn && pow.charge<=POW_LOW_CHARGE) ioctl(gfx.fd_fb, OWLFB_OVERLAY_SETINFO, &pow.oargs);
} }
static void POW_quitOverlay(void) { static void POW_quitOverlay(void) {
// if (pow.overlay) SDL_FreeSurface(pow.overlay); // if (pow.overlay) SDL_FreeSurface(pow.overlay);
@ -1406,7 +1407,7 @@ static void POW_quitOverlay(void) {
// pow.oargs.overlay_id = OVERLAY_ID; // pow.oargs.overlay_id = OVERLAY_ID;
// pow.oargs.overlay_type = OWLFB_OVERLAY_VIDEO; // pow.oargs.overlay_type = OWLFB_OVERLAY_VIDEO;
// pow.oargs.uintptr_overly_info = 0; // pow.oargs.uintptr_overly_info = 0;
// ioctl(gfx.fb0_fd, OWLFB_OVERLAY_DISABLE, &pow.oargs); // ioctl(gfx.fd_fb, OWLFB_OVERLAY_DISABLE, &pow.oargs);
} }
static void POW_updateBatteryStatus(void) { static void POW_updateBatteryStatus(void) {

View file

@ -8,7 +8,7 @@ CC = $(CROSS_COMPILE)gcc
CFLAGS = -marm -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -march=armv7-a -fomit-frame-pointer CFLAGS = -marm -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -march=armv7-a -fomit-frame-pointer
CFLAGS += -I. -I../common -I./libretro-common/include -DPLATFORM=\"$(UNION_PLATFORM)\" -Ofast CFLAGS += -I. -I../common -I./libretro-common/include -DPLATFORM=\"$(UNION_PLATFORM)\" -Ofast
LDFLAGS = -ldl -lSDL -lSDL_image -lSDL_ttf -lmsettings -lpthread -lz LDFLAGS = -ldl -lSDL -lSDL_image -lSDL_ttf -lmsettings -lpthread -lz
# CFLAGS += -Wall -Wno-unused-variable -Wno-unused-function # CFLAGS += -Wall -Wno-unused-variable -Wno-unused-function -Wno-format-overflow
# CFLAGS += -fsanitize=address -fno-common # CFLAGS += -fsanitize=address -fno-common
# LDFLAGS += -lasan # LDFLAGS += -lasan

View file

@ -1336,7 +1336,7 @@ static void OptionList_setOptionRawValue(OptionList* list, const char* key, int
LOG_info("\tRAW SET %s (%s) TO %s (%s)\n", item->name, item->key, item->labels[item->value], item->values[item->value]); LOG_info("\tRAW SET %s (%s) TO %s (%s)\n", item->name, item->key, item->labels[item->value], item->values[item->value]);
// if (list->on_set) list->on_set(list, key); // if (list->on_set) list->on_set(list, key);
} }
else printf("unknown option %s \n", key); fflush(stdout); else LOG_info("unknown option %s \n", key);
} }
static void OptionList_setOptionValue(OptionList* list, const char* key, const char* value) { static void OptionList_setOptionValue(OptionList* list, const char* key, const char* value) {
Option* item = OptionList_getOption(list, key); Option* item = OptionList_getOption(list, key);
@ -1346,7 +1346,7 @@ static void OptionList_setOptionValue(OptionList* list, const char* key, const c
LOG_info("\tSET %s (%s) TO %s (%s)\n", item->name, item->key, item->labels[item->value], item->values[item->value]); LOG_info("\tSET %s (%s) TO %s (%s)\n", item->name, item->key, item->labels[item->value], item->values[item->value]);
// if (list->on_set) list->on_set(list, key); // if (list->on_set) list->on_set(list, key);
} }
else printf("unknown option %s \n", key); fflush(stdout); else LOG_info("unknown option %s \n", key);
} }
// static void OptionList_setOptionVisibility(OptionList* list, const char* key, int visible) { // static void OptionList_setOptionVisibility(OptionList* list, const char* key, int visible) {
// Option* item = OptionList_getOption(list, key); // Option* item = OptionList_getOption(list, key);
@ -1506,6 +1506,7 @@ static void Input_init(const struct retro_input_descriptor *vars) {
static bool set_rumble_state(unsigned port, enum retro_rumble_effect effect, uint16_t strength) { static bool set_rumble_state(unsigned port, enum retro_rumble_effect effect, uint16_t strength) {
// TODO: handle other args? not sure I can // TODO: handle other args? not sure I can
VIB_setStrength(strength); VIB_setStrength(strength);
return 1;
} }
static bool environment_callback(unsigned cmd, void *data) { // copied from picoarch initially static bool environment_callback(unsigned cmd, void *data) { // copied from picoarch initially
// LOG_info("environment_callback: %i\n", cmd); // LOG_info("environment_callback: %i\n", cmd);
@ -1779,7 +1780,7 @@ static void MSG_init(void) {
char* chars[] = { "0","1","2","3","4","5","6","7","8","9","/",".","%","x","(",")", NULL }; char* chars[] = { "0","1","2","3","4","5","6","7","8","9","/",".","%","x","(",")", NULL };
char* c; char* c;
int i = 0; int i = 0;
while (c = chars[i]) { while ((c = chars[i])) {
digit = TTF_RenderUTF8_Blended(font.tiny, c, COLOR_WHITE); digit = TTF_RenderUTF8_Blended(font.tiny, c, COLOR_WHITE);
SDL_BlitSurface(digit, NULL, digits, &(SDL_Rect){ (i * DIGIT_WIDTH) + (DIGIT_WIDTH - digit->w)/2, (DIGIT_HEIGHT - digit->h)/2}); SDL_BlitSurface(digit, NULL, digits, &(SDL_Rect){ (i * DIGIT_WIDTH) + (DIGIT_WIDTH - digit->w)/2, (DIGIT_HEIGHT - digit->h)/2});
SDL_FreeSurface(digit); SDL_FreeSurface(digit);
@ -3115,6 +3116,7 @@ static int MenuList_freeItems(MenuList* list, int i) {
static int OptionFrontend_optionChanged(MenuList* list, int i) { static int OptionFrontend_optionChanged(MenuList* list, int i) {
MenuItem* item = &list->items[i]; MenuItem* item = &list->items[i];
Config_syncFrontend(i, item->value); Config_syncFrontend(i, item->value);
return MENU_CALLBACK_NOP;
} }
static MenuList OptionFrontend_menu = { static MenuList OptionFrontend_menu = {
.type = MENU_VAR, .type = MENU_VAR,
@ -3156,6 +3158,7 @@ static int OptionEmulator_optionChanged(MenuList* list, int i) {
item->values[item->value], option->values[item->value] item->values[item->value], option->values[item->value]
); );
OptionList_setOptionRawValue(&config.core, item->key, item->value); OptionList_setOptionRawValue(&config.core, item->key, item->value);
return MENU_CALLBACK_NOP;
} }
static int OptionEmulator_optionDetail(MenuList* list, int i) { static int OptionEmulator_optionDetail(MenuList* list, int i) {
MenuItem* item = &list->items[i]; MenuItem* item = &list->items[i];
@ -3232,7 +3235,7 @@ int OptionControls_bind(MenuList* list, int i) {
// NOTE: off by one because of the initial NONE value // NOTE: off by one because of the initial NONE value
for (int id=0; id<=LOCAL_BUTTON_COUNT; id++) { for (int id=0; id<=LOCAL_BUTTON_COUNT; id++) {
if (PAD_justPressed(1 << id-1)) { if (PAD_justPressed(1 << (id-1))) {
item->value = id; item->value = id;
button->local = id - 1; button->local = id - 1;
bound = 1; bound = 1;
@ -3302,7 +3305,7 @@ static int OptionShortcuts_bind(MenuList* list, int i) {
// NOTE: off by one because of the initial NONE value // NOTE: off by one because of the initial NONE value
for (int id=0; id<=LOCAL_BUTTON_COUNT; id++) { for (int id=0; id<=LOCAL_BUTTON_COUNT; id++) {
if (PAD_justPressed(1 << id-1)) { if (PAD_justPressed(1 << (id-1))) {
fflush(stdout); fflush(stdout);
item->value = id; item->value = id;
button->local = id - 1; button->local = id - 1;
@ -3342,6 +3345,7 @@ static char* getSaveDesc(void) {
case CONFIG_CONSOLE: return "Using console config."; break; case CONFIG_CONSOLE: return "Using console config."; break;
case CONFIG_GAME: return "Using game config."; break; case CONFIG_GAME: return "Using game config."; break;
} }
return NULL;
} }
static int OptionShortcuts_openMenu(MenuList* list, int i) { static int OptionShortcuts_openMenu(MenuList* list, int i) {
if (OptionShortcuts_menu.items==NULL) { if (OptionShortcuts_menu.items==NULL) {
@ -3639,8 +3643,8 @@ static int Menu_options(MenuList* list) {
else if (type==MENU_FIXED) { else if (type==MENU_FIXED) {
// NOTE: no need to calculate max width // NOTE: no need to calculate max width
int mw = screen->w - SCALE1(PADDING*2); int mw = screen->w - SCALE1(PADDING*2);
int lw,rw; // int lw,rw;
lw = rw = mw / 2; // lw = rw = mw / 2;
int ox,oy; int ox,oy;
ox = oy = SCALE1(PADDING); ox = oy = SCALE1(PADDING);
oy += SCALE1(PILL_SIZE); oy += SCALE1(PILL_SIZE);
@ -4394,7 +4398,6 @@ finish:
Config_quit(); Config_quit();
SDL_FreeSurface(screen);
MSG_quit(); MSG_quit();
QuitSettings(); QuitSettings();
POW_quit(); POW_quit();

View file

@ -99,10 +99,8 @@ int main(int argc, char* argv[]) {
struct cpu_opp* cpu = &cpu_opps[i]; struct cpu_opp* cpu = &cpu_opps[i];
if (clk>=cpu->clk) { if (clk>=cpu->clk) {
setcpu( cpu->clk, cpu->volt ); setcpu( cpu->clk, cpu->volt );
// TODO: this doesn't work...
char cmd[128]; char cmd[128];
sprintf(cmd, "echo %i > /tmp/cpu_freq\n", cpu->clk); sprintf(cmd, "echo %i > /tmp/cpu_freq\n", cpu->clk);
puts(cmd);
system(cmd); system(cmd);
break; break;
} }

View file

@ -12,23 +12,27 @@ Please see the README.txt in the zip file for installation and update instructio
------------------------------- -------------------------------
return to alpha
upload TF1 image to github
regressions:
hdmi is an unknown
lost in-game low battery overlay
BUG: BUG:
minui.elf treats bare tag rom folders as empty minui.elf treats bare tag rom folders as empty
rip out hdmi code rip out hdmi code
insert new de+ion code insert new de+ion code
test test test test test test
rewrite
selectScaler
restore overlay
hardware rev seeing weird crashes i wasn't seeing before
volumn and menu buttons no longer work SUPA on launch
headphone jack detection no longer works P8 on quit
booting doesn't work reliably
all of the above works fine on stock firmware
eggs cooked up ways to
under/overclock the cpu and
access more physical memory for the framebuffer
on unmodified stock :tada:
minarch minarch
some cores can only fast forward with prevent tearing off some cores can only fast forward with prevent tearing off