mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
audio fix, turn off lowpass, add timings (not working)
This commit is contained in:
parent
a4bbd222cc
commit
c900a87eaa
@ -16,7 +16,6 @@
|
|||||||
extern int NoWaiting;
|
extern int NoWaiting;
|
||||||
extern FCEUGI *GI;
|
extern FCEUGI *GI;
|
||||||
void DSMFix(unsigned int msg);
|
void DSMFix(unsigned int msg);
|
||||||
void StopSound(void);
|
|
||||||
|
|
||||||
extern int eoptions;
|
extern int eoptions;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ void
|
|||||||
DefaultSettings ()
|
DefaultSettings ()
|
||||||
{
|
{
|
||||||
GCSettings.currpal = 0;
|
GCSettings.currpal = 0;
|
||||||
GCSettings.timing = 0;
|
GCSettings.timing = 0; // 0 - NTSC, 1 - PAL
|
||||||
GCSettings.FSDisable = 1;
|
GCSettings.FSDisable = 1;
|
||||||
GCSettings.zapper = 0;
|
GCSettings.zapper = 0;
|
||||||
GCSettings.crosshair = 1;
|
GCSettings.crosshair = 1;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
void DefaultSettings ();
|
void DefaultSettings ();
|
||||||
|
|
||||||
#define VERSIONNUM "2.0.5"
|
#define VERSIONNUM "2.0.6"
|
||||||
#define VERSIONSTR "FCE Ultra GX 2.0.5"
|
#define VERSIONSTR "FCE Ultra GX 2.0.6"
|
||||||
|
|
||||||
#define NOTSILENT 0
|
#define NOTSILENT 0
|
||||||
#define SILENT 1
|
#define SILENT 1
|
||||||
@ -59,5 +59,6 @@ struct SGCSettings{
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern struct SGCSettings GCSettings;
|
extern struct SGCSettings GCSettings;
|
||||||
|
extern int ConfigRequested;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,32 +20,84 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#include "gcvideo.h"
|
#include "fceuconfig.h"
|
||||||
#include "pad.h"
|
|
||||||
#include "fceuload.h"
|
#include "fceuload.h"
|
||||||
|
#include "fceustate.h"
|
||||||
|
#include "fceuram.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "fceuconfig.h"
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "gcaudio.h"
|
#include "gcaudio.h"
|
||||||
|
#include "gcvideo.h"
|
||||||
|
#include "pad.h"
|
||||||
|
|
||||||
#ifdef WII_DVD
|
#ifdef WII_DVD
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char * nesrom = NULL;
|
unsigned char * nesrom = NULL;
|
||||||
extern bool romLoaded;
|
int ConfigRequested = 0;
|
||||||
bool isWii;
|
bool isWii;
|
||||||
|
|
||||||
uint8 *xbsave=NULL;
|
uint8 *xbsave=NULL;
|
||||||
|
|
||||||
|
long long prev;
|
||||||
|
long long now;
|
||||||
|
|
||||||
|
long long gettime();
|
||||||
|
u32 diff_usec(long long start,long long end);
|
||||||
|
|
||||||
|
extern bool romLoaded;
|
||||||
|
|
||||||
extern int cleanSFMDATA();
|
extern int cleanSFMDATA();
|
||||||
extern void ResetNES(void);
|
extern void ResetNES(void);
|
||||||
extern uint8 FDSBIOS[8192];
|
extern uint8 FDSBIOS[8192];
|
||||||
|
|
||||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* setFrameTimer()
|
||||||
|
* change frame timings depending on whether ROM is NTSC or PAL
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
int normaldiff;
|
||||||
|
|
||||||
|
void setFrameTimer()
|
||||||
|
{
|
||||||
|
if (GCSettings.timing) // PAL
|
||||||
|
{
|
||||||
|
if(vmode_60hz == 1)
|
||||||
|
normaldiff = 20000; // 50hz
|
||||||
|
else
|
||||||
|
normaldiff = 16667; // 60hz
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(vmode_60hz == 1)
|
||||||
|
normaldiff = 16667; // 60hz
|
||||||
|
else
|
||||||
|
normaldiff = 20000; // 50hz
|
||||||
|
}
|
||||||
|
FrameTimer = 0;
|
||||||
|
prev = gettime();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SyncSpeed()
|
||||||
|
{
|
||||||
|
now = gettime();
|
||||||
|
int diff = normaldiff - diff_usec(prev, now);
|
||||||
|
if (diff > 0) // ahead - take a nap
|
||||||
|
usleep(diff);
|
||||||
|
|
||||||
|
prev = now;
|
||||||
|
FrameTimer--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* main
|
||||||
|
* This is where it all happens!
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -62,6 +114,8 @@ int main(int argc, char *argv[])
|
|||||||
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PAD_Init();
|
||||||
|
|
||||||
initDisplay();
|
initDisplay();
|
||||||
|
|
||||||
/*** Initialise freetype ***/
|
/*** Initialise freetype ***/
|
||||||
@ -86,8 +140,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCEUI_SetVidSystem(0); // 0 - NTSC, 1 - PAL
|
FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON
|
||||||
FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON
|
|
||||||
|
|
||||||
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
|
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
|
||||||
cleanSFMDATA(); // clear state data
|
cleanSFMDATA(); // clear state data
|
||||||
@ -103,31 +156,57 @@ int main(int argc, char *argv[])
|
|||||||
selectedMenu = 3; // change to preferences menu
|
selectedMenu = 3; // change to preferences menu
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go to main menu
|
while (1) // main loop
|
||||||
MainMenu (selectedMenu);
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
{
|
||||||
uint8 *gfx;
|
MainMenu(selectedMenu);
|
||||||
int32 *sound;
|
selectedMenu = 4; // return to game menu from now on
|
||||||
int32 ssize;
|
|
||||||
|
|
||||||
FCEUI_Emulate(&gfx, &sound, &ssize, 0);
|
setFrameTimer(); // set frametimer method before emulation
|
||||||
xbsave = gfx;
|
FCEUI_SetVidSystem(GCSettings.timing);
|
||||||
FCEUD_Update(gfx, sound, ssize);
|
|
||||||
|
while(1) // emulation loop
|
||||||
|
{
|
||||||
|
uint8 *gfx;
|
||||||
|
int32 *sound;
|
||||||
|
int32 ssize;
|
||||||
|
|
||||||
|
FCEUI_Emulate(&gfx, &sound, &ssize, 0);
|
||||||
|
xbsave = gfx;
|
||||||
|
FCEUD_Update(gfx, sound, ssize);
|
||||||
|
|
||||||
|
if(ConfigRequested)
|
||||||
|
{
|
||||||
|
if (GCSettings.AutoSave == 1)
|
||||||
|
{
|
||||||
|
SaveRAM(GCSettings.SaveMethod, SILENT);
|
||||||
|
}
|
||||||
|
else if (GCSettings.AutoSave == 2)
|
||||||
|
{
|
||||||
|
SaveState(GCSettings.SaveMethod, SILENT);
|
||||||
|
}
|
||||||
|
else if(GCSettings.AutoSave == 3)
|
||||||
|
{
|
||||||
|
SaveRAM(GCSettings.SaveMethod, SILENT);
|
||||||
|
SaveState(GCSettings.SaveMethod, SILENT);
|
||||||
|
}
|
||||||
|
ConfigRequested = 0;
|
||||||
|
break; // leave emulation loop
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncSpeed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* FCEU Support Functions to be written
|
* FCEU Support Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
// File Control
|
// File Control
|
||||||
FILE *FCEUD_UTF8fopen(const char *n, const char *m)
|
FILE *FCEUD_UTF8fopen(const char *n, const char *m)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
//return(fopen(n,m));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// General Logging
|
// General Logging
|
@ -95,7 +95,7 @@ int GCMemROM(int method, int size)
|
|||||||
FCEUI_Sound(SAMPLERATE);
|
FCEUI_Sound(SAMPLERATE);
|
||||||
FCEUI_SetSoundVolume(100); // 0-100
|
FCEUI_SetSoundVolume(100); // 0-100
|
||||||
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high
|
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high
|
||||||
FCEUI_SetLowPass(1);
|
FCEUI_SetLowPass(0);
|
||||||
|
|
||||||
InitialisePads();
|
InitialisePads();
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void StopAudio()
|
|||||||
void PlaySound( int *Buffer, int count )
|
void PlaySound( int *Buffer, int count )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
s16 sample;
|
u16 sample;
|
||||||
u32 *dst = (u32 *)mixbuffer;
|
u32 *dst = (u32 *)mixbuffer;
|
||||||
|
|
||||||
for( i = 0; i < count; i++ )
|
for( i = 0; i < count; i++ )
|
||||||
|
@ -34,6 +34,8 @@ int FDSSwitchRequested;
|
|||||||
unsigned int *xfb[2]; /*** Framebuffer - used throughout ***/
|
unsigned int *xfb[2]; /*** Framebuffer - used throughout ***/
|
||||||
GXRModeObj *vmode;
|
GXRModeObj *vmode;
|
||||||
int screenheight;
|
int screenheight;
|
||||||
|
int vmode_60hz = 0;
|
||||||
|
bool progressive = false;
|
||||||
|
|
||||||
/*** Need something to hold the PC palette ***/
|
/*** Need something to hold the PC palette ***/
|
||||||
struct pcpal {
|
struct pcpal {
|
||||||
@ -52,6 +54,7 @@ static Mtx projectionMatrix,modelViewMatrix;
|
|||||||
void CheesyScale(unsigned char *XBuf);
|
void CheesyScale(unsigned char *XBuf);
|
||||||
int whichfb = 0;
|
int whichfb = 0;
|
||||||
int copynow = GX_FALSE;
|
int copynow = GX_FALSE;
|
||||||
|
u32 FrameTimer = 0;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* VideoThreading
|
* VideoThreading
|
||||||
@ -104,11 +107,12 @@ static void copy_to_xfb()
|
|||||||
{
|
{
|
||||||
if (copynow == GX_TRUE)
|
if (copynow == GX_TRUE)
|
||||||
{
|
{
|
||||||
GX_CopyDisp(xfb[whichfb],GX_TRUE);
|
GX_CopyDisp(xfb[whichfb],GX_TRUE);
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
copynow = GX_FALSE;
|
copynow = GX_FALSE;
|
||||||
}
|
}
|
||||||
SMBTimer++;
|
SMBTimer++;
|
||||||
|
FrameTimer++;
|
||||||
|
|
||||||
// FDS switch disk requested - need to eject, select, and insert
|
// FDS switch disk requested - need to eject, select, and insert
|
||||||
// but not all at once!
|
// but not all at once!
|
||||||
@ -292,6 +296,30 @@ void initDisplay()
|
|||||||
|
|
||||||
vmode = VIDEO_GetPreferredMode(NULL);
|
vmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
|
||||||
|
switch (vmode->viTVMode >> 2)
|
||||||
|
{
|
||||||
|
case VI_PAL:
|
||||||
|
// 576 lines (PAL 50Hz)
|
||||||
|
// display should be centered vertically (borders)
|
||||||
|
vmode = &TVPal574IntDfScale;
|
||||||
|
vmode->xfbHeight = 480;
|
||||||
|
vmode->viYOrigin = (VI_MAX_HEIGHT_PAL - 480)/2;
|
||||||
|
vmode->viHeight = 480;
|
||||||
|
|
||||||
|
vmode_60hz = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VI_NTSC:
|
||||||
|
// 480 lines (NTSC 60hz)
|
||||||
|
vmode_60hz = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// 480 lines (PAL 60Hz)
|
||||||
|
vmode_60hz = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
/* we have component cables, but the preferred mode is interlaced
|
/* we have component cables, but the preferred mode is interlaced
|
||||||
* why don't we switch into progressive?
|
* why don't we switch into progressive?
|
||||||
@ -300,6 +328,10 @@ void initDisplay()
|
|||||||
vmode = &TVNtsc480Prog;
|
vmode = &TVNtsc480Prog;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// check for progressive scan
|
||||||
|
if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
|
||||||
|
progressive = true;
|
||||||
|
|
||||||
VIDEO_Configure(vmode);
|
VIDEO_Configure(vmode);
|
||||||
|
|
||||||
screenheight = vmode->xfbHeight;
|
screenheight = vmode->xfbHeight;
|
||||||
@ -307,7 +339,6 @@ void initDisplay()
|
|||||||
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||||
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||||
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
|
||||||
VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
|
VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
|
||||||
VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
|
VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
|
||||||
VIDEO_SetNextFramebuffer (xfb[0]);
|
VIDEO_SetNextFramebuffer (xfb[0]);
|
||||||
@ -322,7 +353,6 @@ void initDisplay()
|
|||||||
VIDEO_SetPostRetraceCallback((VIRetraceCallback)UpdatePadsCB);
|
VIDEO_SetPostRetraceCallback((VIRetraceCallback)UpdatePadsCB);
|
||||||
VIDEO_SetPreRetraceCallback((VIRetraceCallback)copy_to_xfb);
|
VIDEO_SetPreRetraceCallback((VIRetraceCallback)copy_to_xfb);
|
||||||
|
|
||||||
PAD_Init();
|
|
||||||
StartGX();
|
StartGX();
|
||||||
|
|
||||||
InitVideoThread ();
|
InitVideoThread ();
|
||||||
@ -378,7 +408,6 @@ void RenderFrame(char *XBuf, int style)
|
|||||||
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
copynow = GX_TRUE;
|
|
||||||
|
|
||||||
// Return to caller, don't waste time waiting for vb
|
// Return to caller, don't waste time waiting for vb
|
||||||
LWP_ResumeThread (vbthread);
|
LWP_ResumeThread (vbthread);
|
||||||
|
@ -27,5 +27,8 @@ struct st_palettes {
|
|||||||
|
|
||||||
extern struct st_palettes palettes[];
|
extern struct st_palettes palettes[];
|
||||||
extern int FDSSwitchRequested;
|
extern int FDSSwitchRequested;
|
||||||
|
extern int vmode_60hz;
|
||||||
|
extern bool progressive;
|
||||||
|
extern u32 FrameTimer;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,7 +166,6 @@ EmulatorMenu ()
|
|||||||
|
|
||||||
case 3: // timing
|
case 3: // timing
|
||||||
GCSettings.timing ^= 1;
|
GCSettings.timing ^= 1;
|
||||||
FCEUI_SetVidSystem(GCSettings.timing);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include "pad.h"
|
#include "pad.h"
|
||||||
#include "gcaudio.h"
|
#include "gcaudio.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "fceustate.h"
|
|
||||||
#include "fceuram.h"
|
|
||||||
#include "gcvideo.h"
|
#include "gcvideo.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
|
|
||||||
@ -469,22 +467,7 @@ void GetJoy()
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
StopAudio();
|
StopAudio();
|
||||||
|
ConfigRequested = 1;
|
||||||
if (GCSettings.AutoSave == 1)
|
|
||||||
{
|
|
||||||
SaveRAM(GCSettings.SaveMethod, SILENT);
|
|
||||||
}
|
|
||||||
else if (GCSettings.AutoSave == 2)
|
|
||||||
{
|
|
||||||
SaveState(GCSettings.SaveMethod, SILENT);
|
|
||||||
}
|
|
||||||
else if(GCSettings.AutoSave == 3)
|
|
||||||
{
|
|
||||||
SaveRAM(GCSettings.SaveMethod, SILENT);
|
|
||||||
SaveState(GCSettings.SaveMethod, SILENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
MainMenu(4);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ decodePrefsData (int method)
|
|||||||
|
|
||||||
if(verMajor == '2' && verPoint < '3') // less than version 2.0.3
|
if(verMajor == '2' && verPoint < '3') // less than version 2.0.3
|
||||||
return false; // reset settings
|
return false; // reset settings
|
||||||
else if(verMajor > '2' || verMinor > '0' || verPoint > '5') // some future version
|
else if(verMajor > '2' || verMinor > '0' || verPoint > '6') // some future version
|
||||||
return false; // reset settings
|
return false; // reset settings
|
||||||
|
|
||||||
// File Settings
|
// File Settings
|
||||||
|
Loading…
Reference in New Issue
Block a user