rewrite video system

-add original mode, unfiltered mode, zoom, 16:9 correction
-remove 2X and cheesy
This commit is contained in:
dborth 2008-10-23 08:18:40 +00:00
parent dbf7c30c81
commit 3407f9a794
9 changed files with 710 additions and 302 deletions

View File

@ -28,7 +28,10 @@ DefaultSettings ()
GCSettings.zapper = 0;
GCSettings.crosshair = 1;
GCSettings.slimit = 1;
GCSettings.screenscaler = 2;
GCSettings.NGCZoom = 0; // zooming default off
GCSettings.render = 2; // Unfiltered
GCSettings.widescreen = 0; // no aspect ratio correction
GCSettings.LoadMethod = METHOD_AUTO; // Auto, SD, DVD, USB, Network (SMB)
GCSettings.SaveMethod = METHOD_AUTO; // Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, Network (SMB)

View File

@ -32,9 +32,9 @@ enum {
};
struct SGCSettings{
int AutoLoad;
int AutoSave;
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
int AutoLoad;
int AutoSave;
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, SMB
char LoadFolder[200]; // Path to game files
char SaveFolder[200]; // Path to save files
@ -48,14 +48,16 @@ struct SGCSettings{
char smbgcid[20];
char smbsvid[20];
char smbshare[20];
int NGCZoom; // 0 - off, 1 - on
int VerifySaves;
int render; // 0 - original, 1 - filtered, 2 - unfiltered
int widescreen;
int currpal;
int timing;
int FSDisable;
int zapper;
int crosshair;
int slimit;
int screenscaler;
};
extern struct SGCSettings GCSettings;

View File

@ -99,7 +99,7 @@ int main(int argc, char *argv[])
PAD_Init();
initDisplay();
InitGCVideo ();
/*** Initialise freetype ***/
if (FT_Init ())
@ -141,11 +141,14 @@ int main(int argc, char *argv[])
while (1) // main loop
{
MainMenu(selectedMenu);
ResetVideo_Menu();
MainMenu(selectedMenu);
selectedMenu = 4; // return to game menu from now on
setFrameTimer(); // set frametimer method before emulation
FCEUI_SetVidSystem(GCSettings.timing);
FCEUI_SetSoundQuality(2); // 0 - low, 1 - high, 2 - high (alt.)
ResetVideo_Emu();
while(1) // emulation loop
{
@ -201,7 +204,7 @@ void FCEUD_Message(char *text)
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int32 Count)
{
PlaySound(Buffer, Count); // play sound
RenderFrame( (char *)XBuf, GCSettings.screenscaler); // output video frame
RenderFrame(XBuf); // output video frame
GetJoy(); // check controller input
}

View File

@ -95,7 +95,6 @@ int GCMemROM(int method, int size)
/*** Set internal sound information ***/
FCEUI_Sound(SAMPLERATE);
FCEUI_SetSoundVolume(100); // 0-100
FCEUI_SetSoundQuality(2); // 0 - low, 1 - high, 2 - high (alt.)
FCEUI_SetLowPass(0);
InitialisePads();

File diff suppressed because it is too large Load Diff

View File

@ -14,9 +14,13 @@
void clearscreen ();
void showscreen ();
void initDisplay();
void RenderFrame(char *XBuf, int style);
void InitGCVideo ();
void ResetVideo_Emu ();
void ResetVideo_Menu ();
void RenderFrame(unsigned char *XBuf);
void setFrameTimer();
void zoom (float speed);
void zoom_reset ();
// color palettes
#define MAXPAL 12

View File

@ -91,13 +91,15 @@ LoadManager ()
/****************************************************************************
* Emulator Menu
****************************************************************************/
static int emulatormenuCount = 6;
static int emulatormenuCount = 8;
static char emulatormenu[][50] = {
"Screen Scaler",
"Video Filtering",
"Video Scaling",
"Palette",
"8 Sprite Limit",
"Enable Zooming",
"Timing",
"8 Sprite Limit",
"Save Preferences",
"Back to Main Menu"
@ -112,28 +114,49 @@ EmulatorMenu ()
menu = 0;
while (quit == 0)
{
sprintf (emulatormenu[0], "Screen Scaler - %s",
(GCSettings.screenscaler == 0) ? "2x" : (GCSettings.screenscaler == 1) ? "Cheesy" : "GX");
// don't allow original render mode if progressive video mode detected
if (GCSettings.render==0 && progressive)
GCSettings.render++;
sprintf (emulatormenu[1], "Palette - %s",
if ( GCSettings.render == 0 )
sprintf (emulatormenu[0], "Video Rendering Original");
if ( GCSettings.render == 1 )
sprintf (emulatormenu[0], "Video Rendering Filtered");
if ( GCSettings.render == 2 )
sprintf (emulatormenu[0], "Video Rendering Unfiltered");
sprintf (emulatormenu[1], "Video Scaling %s",
GCSettings.widescreen == true ? "16:9 Correction" : "Default");
sprintf (emulatormenu[2], "Palette - %s",
GCSettings.currpal ? palettes[GCSettings.currpal-1].name : "Default");
sprintf (emulatormenu[2], "8 Sprite Limit - %s",
GCSettings.slimit == true ? " ON" : "OFF");
sprintf (emulatormenu[3], "Enable Zooming %s",
GCSettings.NGCZoom == true ? " ON" : "OFF");
sprintf (emulatormenu[3], "Timing - %s",
sprintf (emulatormenu[5], "Timing - %s",
GCSettings.timing == true ? " PAL" : "NTSC");
sprintf (emulatormenu[4], "8 Sprite Limit - %s",
GCSettings.slimit == true ? " ON" : "OFF");
ret = RunMenu (emulatormenu, emulatormenuCount, (char*)"Emulator Options", 16, -1);
switch (ret)
{
case 0: // screen scaler
if (++GCSettings.screenscaler > 2)
GCSettings.screenscaler = 0;
case 0:
GCSettings.render++;
if (GCSettings.render > 2 )
GCSettings.render = 0;
// reset zoom
zoom_reset ();
break;
case 1: // palette
case 1:
GCSettings.widescreen ^= 1;
break;
case 2: // palette
if ( ++GCSettings.currpal > MAXPAL )
GCSettings.currpal = 0;
@ -160,21 +183,25 @@ EmulatorMenu ()
}
break;
case 2: // 8 sprite limit
case 3:
GCSettings.NGCZoom ^= 1;
break;
case 4: // timing
GCSettings.timing ^= 1;
break;
case 5: // 8 sprite limit
GCSettings.slimit ^=1;
FCEUI_DisableSpriteLimitation(GCSettings.slimit);
break;
case 3: // timing
GCSettings.timing ^= 1;
break;
case 4:
case 6:
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
break;
case -1: // Button B
case 5:
case 7:
quit = 1;
break;

View File

@ -450,13 +450,26 @@ void GetJoy()
short i;
s8 gc_px = PAD_SubStickX (0);
s8 gc_py = PAD_SubStickY (0);
u32 jp = PAD_ButtonsHeld (0); // gamecube controller button info
#ifdef HW_RVL
s8 wm_sx = WPAD_StickX (0,1);
s8 wm_sy = WPAD_StickY (0,1);
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
#endif
/*** Check for video zoom ***/
if (GCSettings.NGCZoom)
{
if (gc_py < -36 || gc_py > 36)
zoom ((float) gc_py / -36);
#ifdef HW_RVL
if (wm_sy < -36 || wm_sy > 36)
zoom ((float) wm_sy / -36);
#endif
}
// request to go back to menu
if ((gc_px < -70) || ((jp & PAD_BUTTON_START) && (jp & PAD_BUTTON_A))
#ifdef HW_RVL

View File

@ -165,7 +165,9 @@ preparePrefsData (int method)
createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal));
createXMLSetting("timing", "Timing", toStr(GCSettings.timing));
createXMLSetting("slimit", "8 Sprite Limit", toStr(GCSettings.slimit));
createXMLSetting("screenscaler", "Screen Scaler", toStr(GCSettings.screenscaler));
createXMLSetting("NGCZoom", "C-Stick Zoom", toStr(GCSettings.NGCZoom));
createXMLSetting("render", "Video Filtering", toStr(GCSettings.render));
createXMLSetting("widescreen", "Aspect Ratio Correction", toStr(GCSettings.widescreen));
createXMLSection("Controller", "Controller Settings");
@ -283,7 +285,9 @@ decodePrefsData (int method)
loadXMLSettingInt(&GCSettings.timing, "timing");
loadXMLSettingInt(&GCSettings.FSDisable, "FSDisable");
loadXMLSettingInt(&GCSettings.slimit, "slimit");
loadXMLSettingInt(&GCSettings.screenscaler, "screenscaler");
loadXMLSettingInt(&GCSettings.NGCZoom, "NGCZoom");
loadXMLSettingInt(&GCSettings.render, "render");
loadXMLSettingInt(&GCSettings.widescreen, "widescreen");
loadXMLSettingInt(&GCSettings.zapper, "zapper");
loadXMLSettingInt(&GCSettings.crosshair, "crosshair");
// Controller Settings