in-game menus now adapt to hdmi changes
This commit is contained in:
parent
f196202ce3
commit
f3bc6d68ea
5 changed files with 38 additions and 29 deletions
|
|
@ -384,6 +384,18 @@ SDL_Surface* GFX_resize(int w, int h, int pitch) {
|
|||
|
||||
return gfx.screen;
|
||||
}
|
||||
int GFX_autosize(SDL_Surface** screen, int* dirty) {
|
||||
static int had_hdmi = -1;
|
||||
int has_hdmi = GetHDMI();
|
||||
if (had_hdmi==has_hdmi) return 0;
|
||||
|
||||
*dirty = 1;
|
||||
if (has_hdmi) *screen = GFX_resize(HDMI_MENU_WIDTH,FIXED_HEIGHT,HDMI_MENU_WIDTH*FIXED_BPP);
|
||||
else *screen = GFX_resize(FIXED_WIDTH,FIXED_HEIGHT,FIXED_PITCH);
|
||||
had_hdmi = has_hdmi;
|
||||
|
||||
return 1;
|
||||
}
|
||||
static void POW_flipOverlay(void);
|
||||
void GFX_flip(SDL_Surface* screen) {
|
||||
// point framebuffer at the first line of the backbuffer
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ enum {
|
|||
|
||||
SDL_Surface* GFX_init(int mode);
|
||||
SDL_Surface* GFX_resize(int width, int height, int pitch);
|
||||
int GFX_autosize(SDL_Surface** screen, int* dirty);
|
||||
void GFX_setMode(int mode);
|
||||
void GFX_clear(SDL_Surface* screen);
|
||||
void GFX_clearAll(void);
|
||||
|
|
|
|||
|
|
@ -2995,12 +2995,15 @@ static int Menu_message(char* message) {
|
|||
if (PAD_justPressed(BTN_A) || PAD_justPressed(BTN_B)) break;
|
||||
|
||||
POW_update(&dirty, NULL, Menu_beforeSleep, Menu_afterSleep);
|
||||
|
||||
int resized = GFX_autosize(&screen, &dirty);
|
||||
if (dirty) {
|
||||
dirty = 0;
|
||||
if (!resized) GFX_clear(screen); // resizing clears the screen
|
||||
GFX_clear(screen);
|
||||
GFX_blitMessage(message, screen, NULL);
|
||||
GFX_blitButtonGroup((char*[]){ "A","OKAY", NULL }, screen, 1);
|
||||
GFX_flip(screen);
|
||||
dirty = 0;
|
||||
}
|
||||
else GFX_sync();
|
||||
}
|
||||
|
|
@ -3458,8 +3461,9 @@ static int Menu_options(MenuList* list) {
|
|||
|
||||
POW_update(&dirty, &show_settings, Menu_beforeSleep, Menu_afterSleep);
|
||||
|
||||
int resized = GFX_autosize(&screen, &dirty);
|
||||
if (dirty) {
|
||||
dirty = 0;
|
||||
if (!resized) GFX_clear(screen); // resizing clears the screen
|
||||
|
||||
GFX_clear(screen);
|
||||
GFX_blitHardwareGroup(screen, show_settings);
|
||||
|
|
@ -3676,6 +3680,7 @@ static int Menu_options(MenuList* list) {
|
|||
}
|
||||
|
||||
GFX_flip(screen);
|
||||
dirty = 0;
|
||||
}
|
||||
else GFX_sync();
|
||||
}
|
||||
|
|
@ -3711,13 +3716,13 @@ static void Menu_loop(void) {
|
|||
// TODO: can we use renderer.src_w/h to reverse the stretch regardless of HDMI status?
|
||||
// because we need an undeformed copy for save state screenshots
|
||||
SDL_Surface* backing = GFX_getBufferCopy();
|
||||
SDL_Surface* resized = SDL_CreateRGBSurface(SDL_SWSURFACE, FIXED_WIDTH,FIXED_HEIGHT,FIXED_DEPTH,0,0,0,0);
|
||||
SDL_Surface* snapshot = SDL_CreateRGBSurface(SDL_SWSURFACE, FIXED_WIDTH,FIXED_HEIGHT,FIXED_DEPTH,0,0,0,0);
|
||||
|
||||
if (backing->w==FIXED_WIDTH && backing->h==FIXED_HEIGHT) {
|
||||
SDL_BlitSurface(backing, NULL, resized, NULL);
|
||||
SDL_BlitSurface(backing, NULL, snapshot, NULL);
|
||||
}
|
||||
else {
|
||||
downsample(backing->pixels,resized->pixels,backing->w,backing->h,backing->pitch,resized->pitch);
|
||||
downsample(backing->pixels,snapshot->pixels,backing->w,backing->h,backing->pitch,snapshot->pitch);
|
||||
}
|
||||
|
||||
// TODO: move this to right before if (dirty) {} like in minui.elf
|
||||
|
|
@ -3903,7 +3908,7 @@ static void Menu_loop(void) {
|
|||
state_slot = menu.slot;
|
||||
State_write();
|
||||
status = STATUS_SAVE;
|
||||
SDL_Surface* preview = Menu_thumbnail(resized);
|
||||
SDL_Surface* preview = Menu_thumbnail(snapshot);
|
||||
SDL_RWops* out = SDL_RWFromFile(bmp_path, "wb");
|
||||
if (total_discs) {
|
||||
char* disc_path = disc_paths[disc];
|
||||
|
|
@ -3950,9 +3955,11 @@ static void Menu_loop(void) {
|
|||
|
||||
POW_update(&dirty, &show_setting, Menu_beforeSleep, Menu_afterSleep);
|
||||
|
||||
int resized = GFX_autosize(&screen, &dirty);
|
||||
if (dirty) {
|
||||
SDL_FillRect(screen, NULL, 0);
|
||||
SDL_BlitSurface(resized, NULL, screen, NULL);
|
||||
if (!resized) GFX_clear(screen); // resizing clears the screen
|
||||
|
||||
SDL_BlitSurface(snapshot, NULL, screen, NULL);
|
||||
SDL_BlitSurface(menu.overlay, NULL, screen, NULL);
|
||||
|
||||
int ox, oy;
|
||||
|
|
@ -4114,7 +4121,7 @@ static void Menu_loop(void) {
|
|||
}
|
||||
|
||||
SDL_FreeSurface(backing);
|
||||
SDL_FreeSurface(resized);
|
||||
SDL_FreeSurface(snapshot);
|
||||
POW_disableAutosleep();
|
||||
POW_warn(1);
|
||||
}
|
||||
|
|
@ -4212,8 +4219,6 @@ int main(int argc , char* argv[]) {
|
|||
Game_open(rom_path);
|
||||
if (!game.is_open) goto finish;
|
||||
|
||||
LOG_info("no way\n");
|
||||
|
||||
// restore configs
|
||||
Config_read();
|
||||
setOverclock(overclock);
|
||||
|
|
|
|||
|
|
@ -1325,21 +1325,9 @@ int main (int argc, char *argv[]) {
|
|||
|
||||
POW_update(&dirty, &show_setting, NULL, NULL);
|
||||
|
||||
static int had_hdmi = -1;
|
||||
int has_hdmi = GetHDMI();
|
||||
if (had_hdmi!=has_hdmi) dirty = 1;
|
||||
|
||||
int resized = GFX_autosize(&screen, &dirty);
|
||||
if (dirty) {
|
||||
if (had_hdmi!=has_hdmi) {
|
||||
if (has_hdmi) {
|
||||
screen = GFX_resize(HDMI_MENU_WIDTH,FIXED_HEIGHT,HDMI_MENU_WIDTH*FIXED_BPP);
|
||||
}
|
||||
else {
|
||||
screen = GFX_resize(FIXED_WIDTH,FIXED_HEIGHT,FIXED_PITCH);
|
||||
}
|
||||
had_hdmi = has_hdmi;
|
||||
}
|
||||
else GFX_clear(screen); // resizing clears the screen
|
||||
if (!resized) GFX_clear(screen); // resizing clears the screen
|
||||
|
||||
int ox;
|
||||
int oy;
|
||||
|
|
|
|||
11
todo.txt
11
todo.txt
|
|
@ -29,14 +29,17 @@ create a clean image to flash and install over
|
|||
add most recent uImage/kernel changes
|
||||
|
||||
hdmi
|
||||
minarch menus don't update when connected to hdmi
|
||||
need to figureout how to create a 4:3 thumb from a distorted framebuffer
|
||||
should be able to reconstruct it with screen->w|h and renderer.(src|dst)_(w|h)
|
||||
just need to downsample to a cropped region of the source
|
||||
does clock need GFX_autosize?
|
||||
ignore brightness shortcut when on hdmi
|
||||
figure out how to handle renderng the menus
|
||||
856x480 will get round circles but it's still blurry...
|
||||
it would be better if we could just go the full 1280x720 and change SCREEN_SCALE to 3...
|
||||
still getting through somehow...
|
||||
audio
|
||||
|
||||
minarch
|
||||
zip support
|
||||
can I support changing discs in multi-disc pbps?
|
||||
figure out how to handle different button mappings for cores with different modes
|
||||
eg. GG or SMS with picodrive
|
||||
move overrides to a text file that lives in the pak?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue