modified horizontal scaler

This commit is contained in:
ekeeke31 2008-10-24 16:14:54 +00:00
parent fa769d6c0f
commit f2bf794996
6 changed files with 73 additions and 99 deletions

View File

@ -4,7 +4,7 @@
#include <fat.h> #include <fat.h>
#include <sys/dir.h> #include <sys/dir.h>
#define CONFIG_VERSION "GENPLUS 1.2.8 " #define CONFIG_VERSION "GENPLUS 1.2.6 "
t_config config; t_config config;
bool use_FAT; bool use_FAT;
@ -90,7 +90,6 @@ void set_config_defaults(void)
config.render = VIDEO_HaveComponentCable() ? 2 : 0; config.render = VIDEO_HaveComponentCable() ? 2 : 0;
config.ntsc = 0; config.ntsc = 0;
config.bilinear = 1; config.bilinear = 1;
config.gxscaler = 2;
/* controllers options */ /* controllers options */
ogc_input__set_defaults(); ogc_input__set_defaults();

View File

@ -29,7 +29,6 @@ typedef struct
uint8 overscan; uint8 overscan;
uint8 render; uint8 render;
uint8 ntsc; uint8 ntsc;
uint8 gxscaler;
uint8 bilinear; uint8 bilinear;
uint16 pad_keymap[4][MAX_KEYS]; uint16 pad_keymap[4][MAX_KEYS];
uint32 wpad_keymap[4*3][MAX_KEYS]; uint32 wpad_keymap[4*3][MAX_KEYS];

View File

@ -314,8 +314,8 @@ void dispmenu ()
int ret; int ret;
int quit = 0; int quit = 0;
int prevmenu = menu; int prevmenu = menu;
int count = 11; int count = 10;
char items[11][25]; char items[10][25];
strcpy (menutitle, "Press B to return"); strcpy (menutitle, "Press B to return");
menu = 0; menu = 0;
@ -331,19 +331,16 @@ void dispmenu ()
if (config.tv_mode == 0) sprintf (items[2], "TV Mode: 60HZ"); if (config.tv_mode == 0) sprintf (items[2], "TV Mode: 60HZ");
else if (config.tv_mode == 1) sprintf (items[2], "TV Mode: 50HZ"); else if (config.tv_mode == 1) sprintf (items[2], "TV Mode: 50HZ");
else sprintf (items[2], "TV Mode: 50/60HZ"); else sprintf (items[2], "TV Mode: 50/60HZ");
sprintf (items[3], "GX Filter: %s", config.bilinear ? " ON" : "OFF"); sprintf (items[3], "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF");
if (config.gxscaler == 1) sprintf (items[4], "GX Scaler: 2X"); if (config.ntsc == 1) sprintf (items[4], "NTSC Filter: COMPOSITE");
else if (config.gxscaler == 2)sprintf (items[4], "GX Scaler: FULL"); else if (config.ntsc == 2) sprintf (items[4], "NTSC Filter: S-VIDEO");
else sprintf (items[4], "GX Scaler: OFF"); else if (config.ntsc == 3) sprintf (items[4], "NTSC Filter: RGB");
if (config.ntsc == 1) sprintf (items[5], "NTSC Filter: COMPOSITE"); else sprintf (items[4], "NTSC Filter: OFF");
else if (config.ntsc == 2) sprintf (items[5], "NTSC Filter: S-VIDEO"); sprintf (items[5], "Borders: %s", config.overscan ? " ON" : "OFF");
else if (config.ntsc == 3) sprintf (items[5], "NTSC Filter: RGB"); sprintf (items[6], "Center X: %s%02d", config.xshift < 0 ? "-":"+", abs(config.xshift));
else sprintf (items[5], "NTSC Filter: OFF"); sprintf (items[7], "Center Y: %s%02d", config.yshift < 0 ? "-":"+", abs(config.yshift));
sprintf (items[6], "Borders: %s", config.overscan ? " ON" : "OFF"); sprintf (items[8], "Scale X: %02d", xscale*2);
sprintf (items[7], "Center X: %s%02d", config.xshift < 0 ? "-":"+", abs(config.xshift)); sprintf (items[9], "Scale Y: %02d", yscale*4);
sprintf (items[8], "Center Y: %s%02d", config.yshift < 0 ? "-":"+", abs(config.yshift));
sprintf (items[9], "Scale X: %02d", xscale*2);
sprintf (items[10], "Scale Y: %02d", yscale*4);
ret = domenu (&items[0], count, 1); ret = domenu (&items[0], count, 1);
@ -382,44 +379,40 @@ void dispmenu ()
bitmap.viewport.changed = 1; bitmap.viewport.changed = 1;
break; break;
case 4: /*** GX scaler ***/ case 4: /*** NTSC filter ***/
config.gxscaler = (config.gxscaler + 1) % 3;
break;
case 5: /*** NTSC filter ***/
config.ntsc ++; config.ntsc ++;
if (config.ntsc > 3) config.ntsc = 0; if (config.ntsc > 3) config.ntsc = 0;
bitmap.viewport.changed = 1; bitmap.viewport.changed = 1;
break; break;
case 6: /*** overscan emulation ***/ case 5: /*** overscan emulation ***/
config.overscan ^= 1; config.overscan ^= 1;
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0; bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0; bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
bitmap.viewport.changed = 1; bitmap.viewport.changed = 1;
break; break;
case 7: /*** Center X ***/ case 6: /*** Center X ***/
case -9: case -8:
if (ret<0) config.xshift --; if (ret<0) config.xshift --;
else config.xshift ++; else config.xshift ++;
break; break;
case 8: /*** Center Y ***/ case 7: /*** Center Y ***/
case -10: case -9:
if (ret<0) config.yshift --; if (ret<0) config.yshift --;
else config.yshift ++; else config.yshift ++;
break; break;
case 9: /*** Scale X ***/ case 8: /*** Scale X ***/
case -11: case -10:
if (config.aspect) break; if (config.aspect) break;
if (ret<0) config.xscale --; if (ret<0) config.xscale --;
else config.xscale ++; else config.xscale ++;
break; break;
case 10: /*** Scale Y ***/ case 9: /*** Scale Y ***/
case -12: case -11:
if (config.aspect) break; if (config.aspect) break;
if (ret<0) config.yscale --; if (ret<0) config.yscale --;
else config.yscale ++; else config.yscale ++;
@ -872,6 +865,7 @@ int loadsavemenu (int which)
} }
} }
#endif #endif
fatEnableReadAhead (PI_DEFAULT, 6, 64);
if (which == 1) quit = ManageState(ret-1,device); if (which == 1) quit = ManageState(ret-1,device);
else if (which == 0) quit = ManageSRAM(ret-1,device); else if (which == 0) quit = ManageSRAM(ret-1,device);
if (quit) return 1; if (quit) return 1;
@ -978,6 +972,7 @@ void loadmenu ()
} }
} }
#endif #endif
fatEnableReadAhead (PI_DEFAULT, 6, 64);
quit = OpenSD(); quit = OpenSD();
break; break;
@ -1236,6 +1231,7 @@ void MainMenu ()
/*** Reinitialize GX ***/ /*** Reinitialize GX ***/
ogc_video__reset(); ogc_video__reset();
odd_frame = 1;
#ifndef HW_RVL #ifndef HW_RVL
/*** Stop the DVD from causing clicks while playing ***/ /*** Stop the DVD from causing clicks while playing ***/

View File

@ -126,11 +126,11 @@ int main (int argc, char *argv[])
/* Initialize SDCARD Interface (LibFAT) */ /* Initialize SDCARD Interface (LibFAT) */
use_FAT = 0; use_FAT = 0;
if (fatInitDefault() == true) #ifdef HW_RVL
{ if (fatInit (8, false) == true) use_FAT = 1;
fatEnableReadAhead (PI_DEFAULT, 6, 64); #else
use_FAT = 1; if (fatInitDefault() == true) use_FAT = 1;
} #endif
/* Restore User Configuration */ /* Restore User Configuration */
set_config_defaults(); set_config_defaults();

View File

@ -642,49 +642,46 @@ void ogc_input__set_defaults(void)
/* default device assignation */ /* default device assignation */
for (i=0; i<MAX_DEVICES; i++) for (i=0; i<MAX_DEVICES; i++)
{ {
#ifdef HW_RVL /* set gamepad as default */
if (i < 4) config.input[i].device = (i < 4) ? 0 : -1;
{ config.input[i].port = i%4;
/* autodetect connected controller */ }
exp = 255;
WPAD_Probe(i, &exp);
if (exp <= WPAD_EXP_CLASSIC)
{
/* set expansion controller (or wiimote if no expansion) as default */
config.input[i].device = exp + 1;
config.input[i].port = i;
}
else
{
/* set gamepad as default */
config.input[i].device = 0;
config.input[i].port = i;
/* look for unassigned wiimotes */ #ifdef HW_RVL
int j; int j;
for (j=0; j<i; j++) for (i=0; i<4; i++)
{ {
/* expansion is used, wiimote is free */ /* autodetect connected controller */
if (config.input[j].device > 1) exp = 255;
{ WPAD_Probe(i, &exp);
/* assign wiimote */ if (exp <= WPAD_EXP_CLASSIC)
config.input[i].device = 1; {
config.input[i].port = j; /* set expansion controller (or wiimote if no expansion) as default */
} config.input[i].device = exp + 1;
} config.input[i].port = i;
}
} }
else else
{ {
/* set gamepad if not assigned */ /* look for unassigned wiimotes */
config.input[i].device = (config.input[i-4].device == 0) ? -1 : 0; for (j=0; j<i; j++)
{
/* classic is used, wiimote is free */
if (config.input[j].device == (WPAD_EXP_CLASSIC + 1))
{
/* assign wiimote */
config.input[i].device = 1;
config.input[i].port = j;
}
}
} }
#else
/* set gamepad as default */
config.input[i].device = (i < 4) ? 0 : -1;
#endif
} }
for (i=4; i<MAX_DEVICES; i++)
{
/* set gamepad if not assigned */
config.input[i].device = (config.input[i%4].device == 0) ? -1 : 0;
}
#endif
} }
void ogc_input__update(void) void ogc_input__update(void)

View File

@ -396,21 +396,9 @@ static void gxScale(GXRModeObj *rmode)
{ {
int scale = 0; int scale = 0;
/* First configure EFB width */ /* GX filtering is disabled, VI handles full strecthing */
switch (config.gxscaler) if (!config.bilinear && (vwidth < 640)) rmode->fbWidth = vwidth;
{ else rmode->fbWidth = 640;
case 0: /* let VI handles upscaling completely */
rmode->fbWidth = (vwidth <= 640) ? vwidth : 640;
break;
case 1: /* GX only doubles original width */
rmode->fbWidth = (vwidth*2 <= 640) ? (vwidth*2) : ((vwidth <= 640) ? vwidth : 640);
break;
case 2: /* GX upscale up to max EFB width (640 pixels) */
rmode->fbWidth = 640;
break;
}
/* Configure GX scaler and VI width */ /* Configure GX scaler and VI width */
if (xscale > (rmode->fbWidth/2)) if (xscale > (rmode->fbWidth/2))
@ -543,7 +531,6 @@ void ogc_video__reset()
VIDEO_WaitVSync(); VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
else while (VIDEO_GetNextField()) VIDEO_WaitVSync(); else while (VIDEO_GetNextField()) VIDEO_WaitVSync();
odd_frame = 1;
/* Configure GX */ /* Configure GX */
GX_SetViewport (0.0F, 0.0F, rmode->fbWidth, rmode->efbHeight, 0.0F, 1.0F); GX_SetViewport (0.0F, 0.0F, rmode->fbWidth, rmode->efbHeight, 0.0F, 1.0F);
@ -586,7 +573,7 @@ void ogc_video__reset()
void ogc_video__update() void ogc_video__update()
{ {
int h, w; int h, w;
/* texture and bitmap buffers (buffers width is fixed to 720 pixels) */ /* texture and bitmap buffers (buffers width is fixed to 720 pixels) */
long long int *dst = (long long int *)texturemem; long long int *dst = (long long int *)texturemem;
long long int *src1 = (long long int *)(bitmap.data); /* line n */ long long int *src1 = (long long int *)(bitmap.data); /* line n */
@ -597,8 +584,6 @@ void ogc_video__update()
/* check if viewport has changed */ /* check if viewport has changed */
if (bitmap.viewport.changed) if (bitmap.viewport.changed)
{ {
bitmap.viewport.changed = 0;
/* update texture size */ /* update texture size */
vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x; vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x;
vheight = bitmap.viewport.h + 2 * bitmap.viewport.y; vheight = bitmap.viewport.h + 2 * bitmap.viewport.y;
@ -694,7 +679,7 @@ void ogc_video__init(void)
*/ */
vmode = VIDEO_GetPreferredMode(NULL); vmode = VIDEO_GetPreferredMode(NULL);
/* adjust display settings */ /* Adjust display settings */
switch (vmode->viTVMode >> 2) switch (vmode->viTVMode >> 2)
{ {
case VI_PAL: /* 576 lines (PAL 50Hz) */ case VI_PAL: /* 576 lines (PAL 50Hz) */
@ -703,7 +688,6 @@ void ogc_video__init(void)
TV60hz_240i.viTVMode = VI_TVMODE_EURGB60_INT; TV60hz_240i.viTVMode = VI_TVMODE_EURGB60_INT;
TV60hz_480i.viTVMode = VI_TVMODE_EURGB60_INT; TV60hz_480i.viTVMode = VI_TVMODE_EURGB60_INT;
config.tv_mode = 1; config.tv_mode = 1;
gc_pal = 1;
/* display should be centered vertically (borders) */ /* display should be centered vertically (borders) */
vmode = &TVPal574IntDfScale; vmode = &TVPal574IntDfScale;
@ -718,10 +702,9 @@ void ogc_video__init(void)
TV60hz_240i.viTVMode = VI_TVMODE_NTSC_INT; TV60hz_240i.viTVMode = VI_TVMODE_NTSC_INT;
TV60hz_480i.viTVMode = VI_TVMODE_NTSC_INT; TV60hz_480i.viTVMode = VI_TVMODE_NTSC_INT;
config.tv_mode = 0; config.tv_mode = 0;
gc_pal = 0;
#ifndef HW_RVL #ifndef HW_RVL
/* force 480p on GameCube if the Component Cable is present */ /* force 480p on NTSC GameCube if the Component Cable is present */
if (VIDEO_HaveComponentCable()) vmode = &TVNtsc480Prog; if (VIDEO_HaveComponentCable()) vmode = &TVNtsc480Prog;
#endif #endif
break; break;
@ -735,7 +718,7 @@ void ogc_video__init(void)
break; break;
} }
/* configure video mode */ /* Configure video mode */
VIDEO_Configure (vmode); VIDEO_Configure (vmode);
/* Configure the framebuffers (double-buffering) */ /* Configure the framebuffers (double-buffering) */
@ -765,7 +748,7 @@ void ogc_video__init(void)
VIDEO_WaitVSync(); VIDEO_WaitVSync();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
/* initialize GUI */ /* Initialize GUI */
unpackBackdrop (); unpackBackdrop ();
init_font(); init_font();