Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
clean up + warning and crasher fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaun Inman committed Mar 20, 2023
1 parent c61d6bb commit 7882f9b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 28 deletions.
1 change: 1 addition & 0 deletions skeleton/EXTRAS/Emus/rg35xx/SUPA.pak/default.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-supafaust_pixel_format = rgb565
-supafaust_thread_affinity_emu = 0x0

bind Up = UP
bind Down = DOWN
Expand Down
15 changes: 8 additions & 7 deletions src/common/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ int GFX_wrapText(TTF_Font* font, char* str, int max_width, int max_lines) {
if (!str) return 0;

int line_width;
int max_line_width;
int max_line_width = 0;
char* line = str;
char buffer[MAX_PATH];

Expand All @@ -597,7 +597,7 @@ int GFX_wrapText(TTF_Font* font, char* str, int max_width, int max_lines) {
return line_width;
}

char* prev;
char* prev = NULL;
char* tmp = line;
int lines = 1;
int i = 0;
Expand Down Expand Up @@ -1354,8 +1354,9 @@ static void POW_initOverlay(void) {
// // setup surface
// 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 offset = (gfx.finfo.smem_len - size)&(~4095);
// pow.overlay->pixels = gfx.fb0_buffer + offset;
// uint32_t offset = (gfx.fb_info.size - size)&(~4095);
// pow.overlay->pixels = gfx.fb_info.vadd + offset;
// memset(pow.overlay->pixels, 0xff, size);
//
// // draw battery
// SDL_SetAlpha(gfx.assets, 0,0);
Expand All @@ -1377,7 +1378,7 @@ static void POW_initOverlay(void) {
//
// pow.oinfo.mem_off = offset;
// 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.img_width = w;
// pow.oinfo.img_height = h;
Expand All @@ -1396,7 +1397,7 @@ static void POW_initOverlay(void) {
// pow.oinfo.zorder = 3;
}
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) {
// if (pow.overlay) SDL_FreeSurface(pow.overlay);
Expand All @@ -1406,7 +1407,7 @@ static void POW_quitOverlay(void) {
// pow.oargs.overlay_id = OVERLAY_ID;
// pow.oargs.overlay_type = OWLFB_OVERLAY_VIDEO;
// 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) {
Expand Down
2 changes: 1 addition & 1 deletion src/minarch/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 += -I. -I../common -I./libretro-common/include -DPLATFORM=\"$(UNION_PLATFORM)\" -Ofast
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
# LDFLAGS += -lasan

Expand Down
19 changes: 11 additions & 8 deletions src/minarch/minarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
// 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) {
Option* item = OptionList_getOption(list, key);
Expand All @@ -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]);
// 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) {
// Option* item = OptionList_getOption(list, key);
Expand Down Expand Up @@ -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) {
// TODO: handle other args? not sure I can
VIB_setStrength(strength);
return 1;
}
static bool environment_callback(unsigned cmd, void *data) { // copied from picoarch initially
// LOG_info("environment_callback: %i\n", cmd);
Expand Down Expand Up @@ -1779,7 +1780,7 @@ static void MSG_init(void) {
char* chars[] = { "0","1","2","3","4","5","6","7","8","9","/",".","%","x","(",")", NULL };
char* c;
int i = 0;
while (c = chars[i]) {
while ((c = chars[i])) {
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_FreeSurface(digit);
Expand Down Expand Up @@ -3115,6 +3116,7 @@ static int MenuList_freeItems(MenuList* list, int i) {
static int OptionFrontend_optionChanged(MenuList* list, int i) {
MenuItem* item = &list->items[i];
Config_syncFrontend(i, item->value);
return MENU_CALLBACK_NOP;
}
static MenuList OptionFrontend_menu = {
.type = MENU_VAR,
Expand Down Expand Up @@ -3156,6 +3158,7 @@ static int OptionEmulator_optionChanged(MenuList* list, int i) {
item->values[item->value], option->values[item->value]
);
OptionList_setOptionRawValue(&config.core, item->key, item->value);
return MENU_CALLBACK_NOP;
}
static int OptionEmulator_optionDetail(MenuList* list, int i) {
MenuItem* item = &list->items[i];
Expand Down Expand Up @@ -3232,7 +3235,7 @@ int OptionControls_bind(MenuList* list, int i) {

// NOTE: off by one because of the initial NONE value
for (int id=0; id<=LOCAL_BUTTON_COUNT; id++) {
if (PAD_justPressed(1 << id-1)) {
if (PAD_justPressed(1 << (id-1))) {
item->value = id;
button->local = id - 1;
bound = 1;
Expand Down Expand Up @@ -3302,7 +3305,7 @@ static int OptionShortcuts_bind(MenuList* list, int i) {

// NOTE: off by one because of the initial NONE value
for (int id=0; id<=LOCAL_BUTTON_COUNT; id++) {
if (PAD_justPressed(1 << id-1)) {
if (PAD_justPressed(1 << (id-1))) {
fflush(stdout);
item->value = id;
button->local = id - 1;
Expand Down Expand Up @@ -3342,6 +3345,7 @@ static char* getSaveDesc(void) {
case CONFIG_CONSOLE: return "Using console config."; break;
case CONFIG_GAME: return "Using game config."; break;
}
return NULL;
}
static int OptionShortcuts_openMenu(MenuList* list, int i) {
if (OptionShortcuts_menu.items==NULL) {
Expand Down Expand Up @@ -3639,8 +3643,8 @@ static int Menu_options(MenuList* list) {
else if (type==MENU_FIXED) {
// NOTE: no need to calculate max width
int mw = screen->w - SCALE1(PADDING*2);
int lw,rw;
lw = rw = mw / 2;
// int lw,rw;
// lw = rw = mw / 2;
int ox,oy;
ox = oy = SCALE1(PADDING);
oy += SCALE1(PILL_SIZE);
Expand Down Expand Up @@ -4394,7 +4398,6 @@ int main(int argc , char* argv[]) {

Config_quit();

SDL_FreeSurface(screen);
MSG_quit();
QuitSettings();
POW_quit();
Expand Down
2 changes: 0 additions & 2 deletions src/overclock/overclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ int main(int argc, char* argv[]) {
struct cpu_opp* cpu = &cpu_opps[i];
if (clk>=cpu->clk) {
setcpu( cpu->clk, cpu->volt );
// TODO: this doesn't work...
char cmd[128];
sprintf(cmd, "echo %i > /tmp/cpu_freq\n", cpu->clk);
puts(cmd);
system(cmd);
break;
}
Expand Down
24 changes: 14 additions & 10 deletions todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
minui.elf treats bare tag rom folders as empty

rip out hdmi code
insert new de+ion code
test test test
rewrite
selectScaler
restore overlay

hardware rev
volumn and menu buttons no longer work
headphone jack detection no longer works
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:
seeing weird crashes i wasn't seeing before
SUPA on launch
P8 on quit

minarch
some cores can only fast forward with prevent tearing off
Expand Down

0 comments on commit 7882f9b

Please sign in to comment.