mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
rewrite video system
-add original mode, unfiltered mode, zoom, 16:9 correction -remove 2X and cheesy
This commit is contained in:
parent
dbf7c30c81
commit
3407f9a794
@ -28,7 +28,10 @@ DefaultSettings ()
|
|||||||
GCSettings.zapper = 0;
|
GCSettings.zapper = 0;
|
||||||
GCSettings.crosshair = 1;
|
GCSettings.crosshair = 1;
|
||||||
GCSettings.slimit = 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.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)
|
GCSettings.SaveMethod = METHOD_AUTO; // Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, Network (SMB)
|
||||||
|
@ -32,9 +32,9 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SGCSettings{
|
struct SGCSettings{
|
||||||
int AutoLoad;
|
int AutoLoad;
|
||||||
int AutoSave;
|
int AutoSave;
|
||||||
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
|
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
|
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 LoadFolder[200]; // Path to game files
|
||||||
char SaveFolder[200]; // Path to save files
|
char SaveFolder[200]; // Path to save files
|
||||||
@ -48,14 +48,16 @@ struct SGCSettings{
|
|||||||
char smbgcid[20];
|
char smbgcid[20];
|
||||||
char smbsvid[20];
|
char smbsvid[20];
|
||||||
char smbshare[20];
|
char smbshare[20];
|
||||||
|
int NGCZoom; // 0 - off, 1 - on
|
||||||
int VerifySaves;
|
int VerifySaves;
|
||||||
|
int render; // 0 - original, 1 - filtered, 2 - unfiltered
|
||||||
|
int widescreen;
|
||||||
int currpal;
|
int currpal;
|
||||||
int timing;
|
int timing;
|
||||||
int FSDisable;
|
int FSDisable;
|
||||||
int zapper;
|
int zapper;
|
||||||
int crosshair;
|
int crosshair;
|
||||||
int slimit;
|
int slimit;
|
||||||
int screenscaler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct SGCSettings GCSettings;
|
extern struct SGCSettings GCSettings;
|
||||||
|
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
PAD_Init();
|
PAD_Init();
|
||||||
|
|
||||||
initDisplay();
|
InitGCVideo ();
|
||||||
|
|
||||||
/*** Initialise freetype ***/
|
/*** Initialise freetype ***/
|
||||||
if (FT_Init ())
|
if (FT_Init ())
|
||||||
@ -141,11 +141,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (1) // main loop
|
while (1) // main loop
|
||||||
{
|
{
|
||||||
MainMenu(selectedMenu);
|
ResetVideo_Menu();
|
||||||
|
MainMenu(selectedMenu);
|
||||||
selectedMenu = 4; // return to game menu from now on
|
selectedMenu = 4; // return to game menu from now on
|
||||||
|
|
||||||
setFrameTimer(); // set frametimer method before emulation
|
setFrameTimer(); // set frametimer method before emulation
|
||||||
FCEUI_SetVidSystem(GCSettings.timing);
|
FCEUI_SetVidSystem(GCSettings.timing);
|
||||||
|
FCEUI_SetSoundQuality(2); // 0 - low, 1 - high, 2 - high (alt.)
|
||||||
|
ResetVideo_Emu();
|
||||||
|
|
||||||
while(1) // emulation loop
|
while(1) // emulation loop
|
||||||
{
|
{
|
||||||
@ -201,7 +204,7 @@ void FCEUD_Message(char *text)
|
|||||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int32 Count)
|
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int32 Count)
|
||||||
{
|
{
|
||||||
PlaySound(Buffer, Count); // play sound
|
PlaySound(Buffer, Count); // play sound
|
||||||
RenderFrame( (char *)XBuf, GCSettings.screenscaler); // output video frame
|
RenderFrame(XBuf); // output video frame
|
||||||
GetJoy(); // check controller input
|
GetJoy(); // check controller input
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ int GCMemROM(int method, int size)
|
|||||||
/*** Set internal sound information ***/
|
/*** Set internal sound information ***/
|
||||||
FCEUI_Sound(SAMPLERATE);
|
FCEUI_Sound(SAMPLERATE);
|
||||||
FCEUI_SetSoundVolume(100); // 0-100
|
FCEUI_SetSoundVolume(100); // 0-100
|
||||||
FCEUI_SetSoundQuality(2); // 0 - low, 1 - high, 2 - high (alt.)
|
|
||||||
FCEUI_SetLowPass(0);
|
FCEUI_SetLowPass(0);
|
||||||
|
|
||||||
InitialisePads();
|
InitialisePads();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -14,9 +14,13 @@
|
|||||||
|
|
||||||
void clearscreen ();
|
void clearscreen ();
|
||||||
void showscreen ();
|
void showscreen ();
|
||||||
void initDisplay();
|
void InitGCVideo ();
|
||||||
void RenderFrame(char *XBuf, int style);
|
void ResetVideo_Emu ();
|
||||||
|
void ResetVideo_Menu ();
|
||||||
|
void RenderFrame(unsigned char *XBuf);
|
||||||
void setFrameTimer();
|
void setFrameTimer();
|
||||||
|
void zoom (float speed);
|
||||||
|
void zoom_reset ();
|
||||||
|
|
||||||
// color palettes
|
// color palettes
|
||||||
#define MAXPAL 12
|
#define MAXPAL 12
|
||||||
|
@ -91,13 +91,15 @@ LoadManager ()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Emulator Menu
|
* Emulator Menu
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int emulatormenuCount = 6;
|
static int emulatormenuCount = 8;
|
||||||
static char emulatormenu[][50] = {
|
static char emulatormenu[][50] = {
|
||||||
|
|
||||||
"Screen Scaler",
|
"Video Filtering",
|
||||||
|
"Video Scaling",
|
||||||
"Palette",
|
"Palette",
|
||||||
"8 Sprite Limit",
|
"Enable Zooming",
|
||||||
"Timing",
|
"Timing",
|
||||||
|
"8 Sprite Limit",
|
||||||
|
|
||||||
"Save Preferences",
|
"Save Preferences",
|
||||||
"Back to Main Menu"
|
"Back to Main Menu"
|
||||||
@ -112,28 +114,49 @@ EmulatorMenu ()
|
|||||||
menu = 0;
|
menu = 0;
|
||||||
while (quit == 0)
|
while (quit == 0)
|
||||||
{
|
{
|
||||||
sprintf (emulatormenu[0], "Screen Scaler - %s",
|
// don't allow original render mode if progressive video mode detected
|
||||||
(GCSettings.screenscaler == 0) ? "2x" : (GCSettings.screenscaler == 1) ? "Cheesy" : "GX");
|
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");
|
GCSettings.currpal ? palettes[GCSettings.currpal-1].name : "Default");
|
||||||
|
|
||||||
sprintf (emulatormenu[2], "8 Sprite Limit - %s",
|
sprintf (emulatormenu[3], "Enable Zooming %s",
|
||||||
GCSettings.slimit == true ? " ON" : "OFF");
|
GCSettings.NGCZoom == true ? " ON" : "OFF");
|
||||||
|
|
||||||
sprintf (emulatormenu[3], "Timing - %s",
|
sprintf (emulatormenu[5], "Timing - %s",
|
||||||
GCSettings.timing == true ? " PAL" : "NTSC");
|
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);
|
ret = RunMenu (emulatormenu, emulatormenuCount, (char*)"Emulator Options", 16, -1);
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0: // screen scaler
|
case 0:
|
||||||
if (++GCSettings.screenscaler > 2)
|
GCSettings.render++;
|
||||||
GCSettings.screenscaler = 0;
|
if (GCSettings.render > 2 )
|
||||||
|
GCSettings.render = 0;
|
||||||
|
// reset zoom
|
||||||
|
zoom_reset ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // palette
|
case 1:
|
||||||
|
GCSettings.widescreen ^= 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // palette
|
||||||
if ( ++GCSettings.currpal > MAXPAL )
|
if ( ++GCSettings.currpal > MAXPAL )
|
||||||
GCSettings.currpal = 0;
|
GCSettings.currpal = 0;
|
||||||
|
|
||||||
@ -160,21 +183,25 @@ EmulatorMenu ()
|
|||||||
}
|
}
|
||||||
break;
|
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;
|
GCSettings.slimit ^=1;
|
||||||
FCEUI_DisableSpriteLimitation(GCSettings.slimit);
|
FCEUI_DisableSpriteLimitation(GCSettings.slimit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // timing
|
case 6:
|
||||||
GCSettings.timing ^= 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
|
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: // Button B
|
case -1: // Button B
|
||||||
case 5:
|
case 7:
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -450,13 +450,26 @@ void GetJoy()
|
|||||||
short i;
|
short i;
|
||||||
|
|
||||||
s8 gc_px = PAD_SubStickX (0);
|
s8 gc_px = PAD_SubStickX (0);
|
||||||
|
s8 gc_py = PAD_SubStickY (0);
|
||||||
u32 jp = PAD_ButtonsHeld (0); // gamecube controller button info
|
u32 jp = PAD_ButtonsHeld (0); // gamecube controller button info
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
s8 wm_sx = WPAD_StickX (0,1);
|
s8 wm_sx = WPAD_StickX (0,1);
|
||||||
|
s8 wm_sy = WPAD_StickY (0,1);
|
||||||
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
|
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
|
||||||
#endif
|
#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
|
// request to go back to menu
|
||||||
if ((gc_px < -70) || ((jp & PAD_BUTTON_START) && (jp & PAD_BUTTON_A))
|
if ((gc_px < -70) || ((jp & PAD_BUTTON_START) && (jp & PAD_BUTTON_A))
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
@ -165,7 +165,9 @@ preparePrefsData (int method)
|
|||||||
createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal));
|
createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal));
|
||||||
createXMLSetting("timing", "Timing", toStr(GCSettings.timing));
|
createXMLSetting("timing", "Timing", toStr(GCSettings.timing));
|
||||||
createXMLSetting("slimit", "8 Sprite Limit", toStr(GCSettings.slimit));
|
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");
|
createXMLSection("Controller", "Controller Settings");
|
||||||
|
|
||||||
@ -283,7 +285,9 @@ decodePrefsData (int method)
|
|||||||
loadXMLSettingInt(&GCSettings.timing, "timing");
|
loadXMLSettingInt(&GCSettings.timing, "timing");
|
||||||
loadXMLSettingInt(&GCSettings.FSDisable, "FSDisable");
|
loadXMLSettingInt(&GCSettings.FSDisable, "FSDisable");
|
||||||
loadXMLSettingInt(&GCSettings.slimit, "slimit");
|
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.zapper, "zapper");
|
||||||
loadXMLSettingInt(&GCSettings.crosshair, "crosshair");
|
loadXMLSettingInt(&GCSettings.crosshair, "crosshair");
|
||||||
// Controller Settings
|
// Controller Settings
|
||||||
|
Loading…
Reference in New Issue
Block a user