+added 16:9 autocorrection option

~fixed ROM snapshot not being cleared when selecting directories
This commit is contained in:
ekeeke31 2009-05-14 12:32:20 +00:00
parent c35dee8ec1
commit cead1c2364
3 changed files with 77 additions and 71 deletions

View File

@ -198,34 +198,32 @@ int FileSelector(unsigned char *buffer)
while (!quit) while (!quit)
{ {
/* Ensure a file is selected */ /* ROM file snapshot/database */
if (!filelist[selection].flags) if (old != selection)
{ {
/* get ROM filename without extension */ old = selection;
sprintf (text, "%s", filelist[selection].filename);
if (strlen(text) >= 4) text[strlen(text) - 4] = 0;
/* ROM database informations */ /* delete previous texture if any */
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text); gxTextureClose(&bg_filesel[8].texture);
xml = fopen(fname, "rb"); bg_filesel[8].state &= ~IMAGE_VISIBLE;
if (xml) bg_filesel[6].state &= ~IMAGE_VISIBLE;
{
bg_filesel[6].state |= IMAGE_VISIBLE;
fclose(xml); /* TODO */
}
else
{
bg_filesel[6].state &= ~IMAGE_VISIBLE;
}
/* ROM snapshot */ if (!filelist[selection].flags)
if (old != selection)
{ {
old = selection; strcpy(action_select.comment,"Load ROM File");
/* delete previous texture if any */ /* get ROM filename without extension */
gxTextureClose(&bg_filesel[8].texture); sprintf (text, "%s", filelist[selection].filename);
bg_filesel[8].state &= ~IMAGE_VISIBLE; if (strlen(text) >= 4) text[strlen(text) - 4] = 0;
/* ROM database informations */
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text);
xml = fopen(fname, "rb");
if (xml)
{
bg_filesel[6].state |= IMAGE_VISIBLE;
fclose(xml); /* TODO */
}
/* open screenshot file */ /* open screenshot file */
sprintf (fname, "%s/snaps/%s.png", DEFAULT_PATH, text); sprintf (fname, "%s/snaps/%s.png", DEFAULT_PATH, text);
@ -233,19 +231,18 @@ int FileSelector(unsigned char *buffer)
if (snap) if (snap)
{ {
bg_filesel[8].texture = gxTextureOpenPNG(0,snap); bg_filesel[8].texture = gxTextureOpenPNG(0,snap);
fclose(snap);
if (bg_filesel[8].texture) bg_filesel[8].state |= IMAGE_VISIBLE; if (bg_filesel[8].texture) bg_filesel[8].state |= IMAGE_VISIBLE;
fclose(snap);
} }
} }
strcpy(action_select.comment,"Load ROM File");
}
else
{
/* update helper */
if (!strcmp(filelist[selection].filename,".."))
strcpy(action_select.comment,"Previous Directory");
else else
strcpy(action_select.comment,"Open Directory"); {
/* update helper */
if (!strcmp(filelist[selection].filename,".."))
strcpy(action_select.comment,"Previous Directory");
else
strcpy(action_select.comment,"Open Directory");
}
} }
/* Draw menu*/ /* Draw menu*/

View File

@ -246,12 +246,12 @@ static gui_item items_system[4] =
/* Video options menu */ /* Video options menu */
static gui_item items_video[8] = static gui_item items_video[8] =
{ {
{NULL,NULL,"Aspect: STRETCHED", "Select display aspect ratio", 52,132,276,48},
{NULL,NULL,"Display: PROGRESSIVE", "Select video mode type", 52,132,276,48}, {NULL,NULL,"Display: PROGRESSIVE", "Select video mode type", 52,132,276,48},
{NULL,NULL,"TV mode: 50/60Hz", "Select video refresh rate", 52,132,276,48}, {NULL,NULL,"TV mode: 50/60Hz", "Select video refresh rate", 52,132,276,48},
{NULL,NULL,"Bilinear Filter: OFF", "Enable/disable hardware filtering", 52,132,276,48}, {NULL,NULL,"Bilinear Filter: OFF", "Enable/disable hardware filtering", 52,132,276,48},
{NULL,NULL,"NTSC Filter: COMPOSITE","Enable/disable NTSC software filtering", 52,132,276,48}, {NULL,NULL,"NTSC Filter: COMPOSITE","Enable/disable NTSC software filtering", 52,132,276,48},
{NULL,NULL,"Borders: OFF", "Enable/disable original overscan emulation",52,132,276,48}, {NULL,NULL,"Borders: OFF", "Enable/disable original overscan emulation",52,132,276,48},
{NULL,NULL,"Aspect: ORIGINAL (4:3)","Select display aspect ratio", 52,132,276,48},
{NULL,NULL,"DISPLAY POSITION", "Adjust display position", 52,132,276,48}, {NULL,NULL,"DISPLAY POSITION", "Adjust display position", 52,132,276,48},
{NULL,NULL,"DISPLAY SIZE", "Adjust display size", 52,132,276,48} {NULL,NULL,"DISPLAY SIZE", "Adjust display size", 52,132,276,48}
}; };
@ -862,19 +862,21 @@ static void videomenu ()
gui_menu *m = &menu_video; gui_menu *m = &menu_video;
gui_item *items = m->items; gui_item *items = m->items;
sprintf (items[0].text, "Aspect: %s", config.aspect ? "ORIGINAL" : "STRETCHED"); if (config.render == 1) sprintf (items[0].text,"Display: INTERLACED");
if (config.render == 1) sprintf (items[1].text,"Display: INTERLACED"); else if (config.render == 2) sprintf (items[0].text, "Display: PROGRESSIVE");
else if (config.render == 2) sprintf (items[1].text, "Display: PROGRESSIVE"); else sprintf (items[0].text, "Display: ORIGINAL");
else sprintf (items[1].text, "Display: ORIGINAL"); if (config.tv_mode == 0) sprintf (items[1].text, "TV Mode: 60HZ");
if (config.tv_mode == 0) sprintf (items[2].text, "TV Mode: 60HZ"); else if (config.tv_mode == 1) sprintf (items[1].text, "TV Mode: 50HZ");
else if (config.tv_mode == 1) sprintf (items[2].text, "TV Mode: 50HZ"); else sprintf (items[1].text, "TV Mode: 50/60HZ");
else sprintf (items[2].text, "TV Mode: 50/60HZ"); sprintf (items[2].text, "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF");
sprintf (items[3].text, "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF"); if (config.ntsc == 1) sprintf (items[3].text, "NTSC Filter: COMPOSITE");
if (config.ntsc == 1) sprintf (items[4].text, "NTSC Filter: COMPOSITE"); else if (config.ntsc == 2) sprintf (items[3].text, "NTSC Filter: S-VIDEO");
else if (config.ntsc == 2) sprintf (items[4].text, "NTSC Filter: S-VIDEO"); else if (config.ntsc == 3) sprintf (items[3].text, "NTSC Filter: RGB");
else if (config.ntsc == 3) sprintf (items[4].text, "NTSC Filter: RGB"); else sprintf (items[3].text, "NTSC Filter: OFF");
else sprintf (items[4].text, "NTSC Filter: OFF"); sprintf (items[4].text, "Borders: %s", config.overscan ? " ON" : "OFF");
sprintf (items[5].text, "Borders: %s", config.overscan ? " ON" : "OFF"); if (config.aspect == 1) sprintf (items[5].text,"Aspect: ORIGINAL (4:3)");
else if (config.aspect == 2) sprintf (items[5].text, "Aspect: ORIGINAL (16:9)");
else sprintf (items[5].text, "Aspect: FIT SCREEN");
GUI_InitMenu(m); GUI_InitMenu(m);
GUI_SlideMenuTitle(m,strlen("Video ")); GUI_SlideMenuTitle(m,strlen("Video "));
@ -885,12 +887,7 @@ static void videomenu ()
switch (ret) switch (ret)
{ {
case 0: /*** config.aspect ratio ***/ case 0: /*** rendering ***/
config.aspect ^= 1;
sprintf (items[0].text, "Aspect: %s", config.aspect ? "ORIGINAL" : "STRETCHED");
break;
case 1: /*** rendering ***/
config.render = (config.render + 1) % 3; config.render = (config.render + 1) % 3;
if (config.render == 2) if (config.render == 2)
{ {
@ -905,38 +902,46 @@ static void videomenu ()
config.render = 0; config.render = 0;
} }
} }
if (config.render == 1) sprintf (items[1].text,"Display: INTERLACED"); if (config.render == 1) sprintf (items[0].text,"Display: INTERLACED");
else if (config.render == 2) sprintf (items[1].text, "Display: PROGRESSIVE"); else if (config.render == 2) sprintf (items[0].text, "Display: PROGRESSIVE");
else sprintf (items[1].text, "Display: ORIGINAL"); else sprintf (items[0].text, "Display: ORIGINAL");
if (config.tv_mode == 0) sprintf (items[2].text, "TV Mode: 60HZ"); if (config.tv_mode == 0) sprintf (items[1].text, "TV Mode: 60HZ");
else if (config.tv_mode == 1) sprintf (items[2].text, "TV Mode: 50HZ"); else if (config.tv_mode == 1) sprintf (items[1].text, "TV Mode: 50HZ");
else sprintf (items[2].text, "TV Mode: 50/60HZ"); else sprintf (items[1].text, "TV Mode: 50/60HZ");
break; break;
case 2: /*** tv mode ***/ case 1: /*** tv mode ***/
if (config.render != 2) config.tv_mode = (config.tv_mode + 1) % 3; if (config.render != 2) config.tv_mode = (config.tv_mode + 1) % 3;
if (config.tv_mode == 0) sprintf (items[2].text, "TV Mode: 60HZ"); if (config.tv_mode == 0) sprintf (items[1].text, "TV Mode: 60HZ");
else if (config.tv_mode == 1) sprintf (items[2].text, "TV Mode: 50HZ"); else if (config.tv_mode == 1) sprintf (items[1].text, "TV Mode: 50HZ");
else sprintf (items[2].text, "TV Mode: 50/60HZ"); else sprintf (items[1].text, "TV Mode: 50/60HZ");
break; break;
case 3: /*** bilinear filtering ***/ case 2: /*** bilinear filtering ***/
config.bilinear ^= 1; config.bilinear ^= 1;
sprintf (items[3].text, "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF"); sprintf (items[2].text, "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF");
break; break;
case 4: /*** NTSC filter ***/ case 3: /*** NTSC filter ***/
config.ntsc ++; config.ntsc ++;
if (config.ntsc > 3) config.ntsc = 0; if (config.ntsc > 3) config.ntsc = 0;
if (config.ntsc == 1) sprintf (items[4].text, "NTSC Filter: COMPOSITE"); if (config.ntsc == 1) sprintf (items[3].text, "NTSC Filter: COMPOSITE");
else if (config.ntsc == 2) sprintf (items[4].text, "NTSC Filter: S-VIDEO"); else if (config.ntsc == 2) sprintf (items[3].text, "NTSC Filter: S-VIDEO");
else if (config.ntsc == 3) sprintf (items[4].text, "NTSC Filter: RGB"); else if (config.ntsc == 3) sprintf (items[3].text, "NTSC Filter: RGB");
else sprintf (items[4].text, "NTSC Filter: OFF"); else sprintf (items[3].text, "NTSC Filter: OFF");
break; break;
case 5: /*** overscan emulation ***/ case 4: /*** overscan emulation ***/
config.overscan ^= 1; config.overscan ^= 1;
sprintf (items[5].text, "Borders: %s", config.overscan ? " ON" : "OFF"); sprintf (items[4].text, "Borders: %s", config.overscan ? " ON" : "OFF");
break;
case 5: /*** config.aspect ratio ***/
config.aspect ++;
if (config.aspect > 2) config.aspect = 0;
if (config.aspect == 1) sprintf (items[5].text,"Aspect: ORIGINAL (4:3)");
else if (config.aspect == 2) sprintf (items[5].text, "Aspect: ORIGINAL (16:9)");
else sprintf (items[5].text, "Aspect: FIT SCREEN");
break; break;
/* case 6: /* case 6:

View File

@ -466,6 +466,9 @@ static void gxResetScale(u32 width, u32 height)
else if (!vdp_pal && gc_pal && !config.render) yscale = yscale * 288 / 240; else if (!vdp_pal && gc_pal && !config.render) yscale = yscale * 288 / 240;
} }
/* 16/9 correction */
if (config.aspect & 2) xscale = (xscale * 3) / 4;
xshift = config.xshift; xshift = config.xshift;
yshift = 2 - vdp_pal + 2*(gc_pal & !config.render) + config.yshift; yshift = 2 - vdp_pal + 2*(gc_pal & !config.render) + config.yshift;
} }
@ -500,6 +503,7 @@ static void gxResetScale(u32 width, u32 height)
yshift *= 2; yshift *= 2;
} }
/* GX scaler (by default, use EFB maximal width) */ /* GX scaler (by default, use EFB maximal width) */
rmode->fbWidth = 640; rmode->fbWidth = 640;
if (!config.bilinear && !config.ntsc) if (!config.bilinear && !config.ntsc)