From f2bf794996ba1b813f0e8babea64c49c48989348 Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Fri, 24 Oct 2008 16:14:54 +0000 Subject: [PATCH] modified horizontal scaler --- source/ngc/config.c | 3 +- source/ngc/config.h | 1 - source/ngc/gui/menu.c | 54 +++++++++++++++----------------- source/ngc/ngc.c | 10 +++--- source/ngc/ogc_input.c | 71 ++++++++++++++++++++---------------------- source/ngc/ogc_video.c | 33 +++++--------------- 6 files changed, 73 insertions(+), 99 deletions(-) diff --git a/source/ngc/config.c b/source/ngc/config.c index 4683fa7..ea70c87 100644 --- a/source/ngc/config.c +++ b/source/ngc/config.c @@ -4,7 +4,7 @@ #include #include -#define CONFIG_VERSION "GENPLUS 1.2.8 " +#define CONFIG_VERSION "GENPLUS 1.2.6 " t_config config; bool use_FAT; @@ -90,7 +90,6 @@ void set_config_defaults(void) config.render = VIDEO_HaveComponentCable() ? 2 : 0; config.ntsc = 0; config.bilinear = 1; - config.gxscaler = 2; /* controllers options */ ogc_input__set_defaults(); diff --git a/source/ngc/config.h b/source/ngc/config.h index 8840f6a..8b4fa0e 100644 --- a/source/ngc/config.h +++ b/source/ngc/config.h @@ -29,7 +29,6 @@ typedef struct uint8 overscan; uint8 render; uint8 ntsc; - uint8 gxscaler; uint8 bilinear; uint16 pad_keymap[4][MAX_KEYS]; uint32 wpad_keymap[4*3][MAX_KEYS]; diff --git a/source/ngc/gui/menu.c b/source/ngc/gui/menu.c index 4224219..f3a415f 100644 --- a/source/ngc/gui/menu.c +++ b/source/ngc/gui/menu.c @@ -314,8 +314,8 @@ void dispmenu () int ret; int quit = 0; int prevmenu = menu; - int count = 11; - char items[11][25]; + int count = 10; + char items[10][25]; strcpy (menutitle, "Press B to return"); menu = 0; @@ -331,19 +331,16 @@ void dispmenu () if (config.tv_mode == 0) sprintf (items[2], "TV Mode: 60HZ"); else if (config.tv_mode == 1) sprintf (items[2], "TV Mode: 50HZ"); else sprintf (items[2], "TV Mode: 50/60HZ"); - sprintf (items[3], "GX Filter: %s", config.bilinear ? " ON" : "OFF"); - if (config.gxscaler == 1) sprintf (items[4], "GX Scaler: 2X"); - else if (config.gxscaler == 2)sprintf (items[4], "GX Scaler: FULL"); - else sprintf (items[4], "GX Scaler: OFF"); - if (config.ntsc == 1) sprintf (items[5], "NTSC Filter: COMPOSITE"); - else if (config.ntsc == 2) sprintf (items[5], "NTSC Filter: S-VIDEO"); - else if (config.ntsc == 3) sprintf (items[5], "NTSC Filter: RGB"); - else sprintf (items[5], "NTSC Filter: OFF"); - sprintf (items[6], "Borders: %s", config.overscan ? " ON" : "OFF"); - sprintf (items[7], "Center X: %s%02d", config.xshift < 0 ? "-":"+", abs(config.xshift)); - 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); + sprintf (items[3], "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF"); + if (config.ntsc == 1) sprintf (items[4], "NTSC Filter: COMPOSITE"); + else if (config.ntsc == 2) sprintf (items[4], "NTSC Filter: S-VIDEO"); + else if (config.ntsc == 3) sprintf (items[4], "NTSC Filter: RGB"); + else sprintf (items[4], "NTSC Filter: OFF"); + sprintf (items[5], "Borders: %s", config.overscan ? " ON" : "OFF"); + sprintf (items[6], "Center X: %s%02d", config.xshift < 0 ? "-":"+", abs(config.xshift)); + sprintf (items[7], "Center Y: %s%02d", config.yshift < 0 ? "-":"+", abs(config.yshift)); + sprintf (items[8], "Scale X: %02d", xscale*2); + sprintf (items[9], "Scale Y: %02d", yscale*4); ret = domenu (&items[0], count, 1); @@ -382,44 +379,40 @@ void dispmenu () bitmap.viewport.changed = 1; break; - case 4: /*** GX scaler ***/ - config.gxscaler = (config.gxscaler + 1) % 3; - break; - - case 5: /*** NTSC filter ***/ + case 4: /*** NTSC filter ***/ config.ntsc ++; if (config.ntsc > 3) config.ntsc = 0; bitmap.viewport.changed = 1; break; - case 6: /*** overscan emulation ***/ + case 5: /*** overscan emulation ***/ config.overscan ^= 1; 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.changed = 1; break; - case 7: /*** Center X ***/ - case -9: + case 6: /*** Center X ***/ + case -8: if (ret<0) config.xshift --; else config.xshift ++; break; - case 8: /*** Center Y ***/ - case -10: + case 7: /*** Center Y ***/ + case -9: if (ret<0) config.yshift --; else config.yshift ++; break; - case 9: /*** Scale X ***/ - case -11: + case 8: /*** Scale X ***/ + case -10: if (config.aspect) break; if (ret<0) config.xscale --; else config.xscale ++; break; - case 10: /*** Scale Y ***/ - case -12: + case 9: /*** Scale Y ***/ + case -11: if (config.aspect) break; if (ret<0) config.yscale --; else config.yscale ++; @@ -872,6 +865,7 @@ int loadsavemenu (int which) } } #endif + fatEnableReadAhead (PI_DEFAULT, 6, 64); if (which == 1) quit = ManageState(ret-1,device); else if (which == 0) quit = ManageSRAM(ret-1,device); if (quit) return 1; @@ -978,6 +972,7 @@ void loadmenu () } } #endif + fatEnableReadAhead (PI_DEFAULT, 6, 64); quit = OpenSD(); break; @@ -1236,6 +1231,7 @@ void MainMenu () /*** Reinitialize GX ***/ ogc_video__reset(); + odd_frame = 1; #ifndef HW_RVL /*** Stop the DVD from causing clicks while playing ***/ diff --git a/source/ngc/ngc.c b/source/ngc/ngc.c index a1bc18f..c6fdc1a 100644 --- a/source/ngc/ngc.c +++ b/source/ngc/ngc.c @@ -126,11 +126,11 @@ int main (int argc, char *argv[]) /* Initialize SDCARD Interface (LibFAT) */ use_FAT = 0; - if (fatInitDefault() == true) - { - fatEnableReadAhead (PI_DEFAULT, 6, 64); - use_FAT = 1; - } +#ifdef HW_RVL + if (fatInit (8, false) == true) use_FAT = 1; +#else + if (fatInitDefault() == true) use_FAT = 1; +#endif /* Restore User Configuration */ set_config_defaults(); diff --git a/source/ngc/ogc_input.c b/source/ngc/ogc_input.c index 3471a15..effbb31 100644 --- a/source/ngc/ogc_input.c +++ b/source/ngc/ogc_input.c @@ -642,49 +642,46 @@ void ogc_input__set_defaults(void) /* default device assignation */ for (i=0; i 1) - { - /* assign wiimote */ - config.input[i].device = 1; - config.input[i].port = j; - } - } - } +#ifdef HW_RVL + int j; + for (i=0; i<4; i++) + { + /* 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 if not assigned */ - config.input[i].device = (config.input[i-4].device == 0) ? -1 : 0; + /* look for unassigned wiimotes */ + for (j=0; jfbWidth = (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; - } + /* GX filtering is disabled, VI handles full strecthing */ + if (!config.bilinear && (vwidth < 640)) rmode->fbWidth = vwidth; + else rmode->fbWidth = 640; /* Configure GX scaler and VI width */ if (xscale > (rmode->fbWidth/2)) @@ -543,7 +531,6 @@ void ogc_video__reset() VIDEO_WaitVSync(); if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); else while (VIDEO_GetNextField()) VIDEO_WaitVSync(); - odd_frame = 1; /* Configure GX */ 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() { int h, w; - + /* texture and bitmap buffers (buffers width is fixed to 720 pixels) */ long long int *dst = (long long int *)texturemem; long long int *src1 = (long long int *)(bitmap.data); /* line n */ @@ -597,8 +584,6 @@ void ogc_video__update() /* check if viewport has changed */ if (bitmap.viewport.changed) { - bitmap.viewport.changed = 0; - /* update texture size */ vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x; vheight = bitmap.viewport.h + 2 * bitmap.viewport.y; @@ -694,7 +679,7 @@ void ogc_video__init(void) */ vmode = VIDEO_GetPreferredMode(NULL); - /* adjust display settings */ + /* Adjust display settings */ switch (vmode->viTVMode >> 2) { case VI_PAL: /* 576 lines (PAL 50Hz) */ @@ -703,7 +688,6 @@ void ogc_video__init(void) TV60hz_240i.viTVMode = VI_TVMODE_EURGB60_INT; TV60hz_480i.viTVMode = VI_TVMODE_EURGB60_INT; config.tv_mode = 1; - gc_pal = 1; /* display should be centered vertically (borders) */ vmode = &TVPal574IntDfScale; @@ -718,10 +702,9 @@ void ogc_video__init(void) TV60hz_240i.viTVMode = VI_TVMODE_NTSC_INT; TV60hz_480i.viTVMode = VI_TVMODE_NTSC_INT; config.tv_mode = 0; - gc_pal = 0; #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; #endif break; @@ -735,7 +718,7 @@ void ogc_video__init(void) break; } - /* configure video mode */ + /* Configure video mode */ VIDEO_Configure (vmode); /* Configure the framebuffers (double-buffering) */ @@ -765,7 +748,7 @@ void ogc_video__init(void) VIDEO_WaitVSync(); VIDEO_WaitVSync(); - /* initialize GUI */ + /* Initialize GUI */ unpackBackdrop (); init_font();