A couple minor GUI bug fixes: - DaZ mode is now disabled for SSE1 CPUs, preventing a crash when trying to OK the setting or run the Emulator with default settings. - Emulator no longer tries to run games when a BIOS hasn't been configured (usually led to a crash).

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@410 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2008-12-11 04:08:26 +00:00 committed by Gregory Hainaut
parent 43720a2d27
commit c228e982cc
8 changed files with 51 additions and 15 deletions

View File

@ -2980,7 +2980,7 @@ void loadBiosRom(char *ext, u8 *dest) {
SysPrintf("**************\n\n\n"); SysPrintf("**************\n\n\n");
} }
void memReset() { int memReset() {
struct stat buf; struct stat buf;
char Bios[g_MaxPath]; char Bios[g_MaxPath];
FILE *fp; FILE *fp;
@ -2998,7 +2998,7 @@ void memReset() {
if (stat(Bios, &buf) == -1) { if (stat(Bios, &buf) == -1) {
SysMessage(_("Unable to load bios: '%s', PCSX2 can't run without that"), Bios); SysMessage(_("Unable to load bios: '%s', PCSX2 can't run without that"), Bios);
return; return 0;
} }
#ifdef PCSX2_VIRTUAL_MEM #ifdef PCSX2_VIRTUAL_MEM
@ -3048,6 +3048,7 @@ void memReset() {
#endif #endif
#endif #endif
return 1;
} }
void memSetKernelMode() { void memSetKernelMode() {

View File

@ -163,7 +163,7 @@ extern uptr *memLUTWU;
#define PSMu64(mem) (*(u64*)PSM(mem)) #define PSMu64(mem) (*(u64*)PSM(mem))
int memInit(); int memInit();
void memReset(); int memReset(); // returns FALSE on error
void memSetKernelMode(); void memSetKernelMode();
void memSetSupervisorMode(); void memSetSupervisorMode();
void memSetUserMode(); void memSetUserMode();

View File

@ -42,7 +42,7 @@
// --->> Path Utilities [PathUtil.c] // --->> Path Utilities [PathUtil.c]
#define g_MaxPath 512 #define g_MaxPath 255 // 255 is safer with antiquitated Win32 ASCII APIs.
extern int g_Error_PathTooLong; extern int g_Error_PathTooLong;
int isPathRooted( const char* path ); int isPathRooted( const char* path );

View File

@ -111,11 +111,11 @@ int cpuInit()
return ret; return ret;
} }
void cpuReset() int cpuReset()
{ {
Cpu->Reset(); Cpu->Reset();
memReset(); if( !memReset() ) return 0;
memset(&cpuRegs, 0, sizeof(cpuRegs)); memset(&cpuRegs, 0, sizeof(cpuRegs));
memset(&fpuRegs, 0, sizeof(fpuRegs)); memset(&fpuRegs, 0, sizeof(fpuRegs));
@ -139,6 +139,8 @@ void cpuReset()
vif1Reset(); vif1Reset();
rcntInit(); rcntInit();
psxReset(); psxReset();
return 1;
} }
void cpuShutdown() void cpuShutdown()

View File

@ -225,7 +225,7 @@ extern PCSX2_ALIGNED16_DECL(tlbs tlb[48]);
#endif #endif
int cpuInit(); int cpuInit();
void cpuReset(); int cpuReset();
void cpuShutdown(); void cpuShutdown();
void cpuException(u32 code, u32 bd); void cpuException(u32 code, u32 bd);
void cpuTlbMissR(u32 addr, u32 bd); void cpuTlbMissR(u32 addr, u32 bd);

View File

@ -20,7 +20,7 @@
#define __SYSTEM_H__ #define __SYSTEM_H__
int SysInit(); // Init mem and plugins int SysInit(); // Init mem and plugins
void SysReset(); // Resets mem int SysReset(); // Resets mem
void SysPrintf(const char *fmt, ...); // Printf used by bios syscalls void SysPrintf(const char *fmt, ...); // Printf used by bios syscalls
void SysMessage(const char *fmt, ...); // Message used to print msg to users void SysMessage(const char *fmt, ...); // Message used to print msg to users
void SysUpdate(); // Called on VBlank (to update i.e. pads) void SysUpdate(); // Called on VBlank (to update i.e. pads)

View File

@ -118,7 +118,7 @@ void RunExecute(int run) {
nDisableSC = 1; nDisableSC = 1;
if (needReset == 1) { if (needReset == 1) {
SysReset(); if( !SysReset() ) return;
} }
if( UseGui ) if( UseGui )
@ -1034,8 +1034,23 @@ BOOL APIENTRY AdvancedOptionsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
if (Config.sseMXCSR & 0x8000) CheckDlgButton(hDlg, IDC_EE_CHECK1, TRUE); if (Config.sseMXCSR & 0x8000) CheckDlgButton(hDlg, IDC_EE_CHECK1, TRUE);
if (Config.sseVUMXCSR & 0x8000) CheckDlgButton(hDlg, IDC_VU_CHECK1, TRUE); if (Config.sseVUMXCSR & 0x8000) CheckDlgButton(hDlg, IDC_VU_CHECK1, TRUE);
if( !cpucaps.hasStreamingSIMD2Extensions )
{
// SSE1 cpus do not support Denormals Are Zero flag.
Config.sseMXCSR &= ~0x0040;
Config.sseVUMXCSR &= ~0x0040;
EnableWindow( GetDlgItem( hDlg, IDC_EE_CHECK2 ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_VU_CHECK2 ), FALSE );
CheckDlgButton( hDlg, IDC_EE_CHECK2, FALSE );
CheckDlgButton( hDlg, IDC_VU_CHECK2, FALSE );
}
else
{
if (Config.sseMXCSR & 0x0040) CheckDlgButton(hDlg, IDC_EE_CHECK2, TRUE); if (Config.sseMXCSR & 0x0040) CheckDlgButton(hDlg, IDC_EE_CHECK2, TRUE);
if (Config.sseVUMXCSR & 0x0040) CheckDlgButton(hDlg, IDC_VU_CHECK2, TRUE); if (Config.sseVUMXCSR & 0x0040) CheckDlgButton(hDlg, IDC_VU_CHECK2, TRUE);
}
return TRUE; return TRUE;
@ -1079,6 +1094,14 @@ BOOL APIENTRY AdvancedOptionsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
Config.sseMXCSR = DEFAULT_sseMXCSR; Config.sseMXCSR = DEFAULT_sseMXCSR;
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR; Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
if( !cpucaps.hasStreamingSIMD2Extensions )
{
// SSE1 cpus do not support Denormals Are Zero flag.
Config.sseMXCSR &= ~0x0040;
Config.sseVUMXCSR &= ~0x0040;
}
CheckRadioButton(hDlg, IDC_EE_ROUNDMODE0, IDC_EE_ROUNDMODE3, IDC_EE_ROUNDMODE0 + ( (Config.sseMXCSR & 0x6000) >> 13)); CheckRadioButton(hDlg, IDC_EE_ROUNDMODE0, IDC_EE_ROUNDMODE3, IDC_EE_ROUNDMODE0 + ( (Config.sseMXCSR & 0x6000) >> 13));
CheckRadioButton(hDlg, IDC_VU_ROUNDMODE0, IDC_VU_ROUNDMODE3, IDC_VU_ROUNDMODE0 + ( (Config.sseVUMXCSR & 0x6000) >> 13)); CheckRadioButton(hDlg, IDC_VU_ROUNDMODE0, IDC_VU_ROUNDMODE3, IDC_VU_ROUNDMODE0 + ( (Config.sseVUMXCSR & 0x6000) >> 13));
@ -1774,11 +1797,12 @@ int SysInit() {
return 0; return 0;
} }
void SysReset() { int SysReset() {
if (sinit == 0) return; if (sinit == 0) return 1;
StatusSet(_("Resetting...")); StatusSet(_("Resetting..."));
cpuReset(); if( !cpuReset() ) return 0;
StatusSet(_("Ready")); StatusSet(_("Ready"));
return 1;
} }

View File

@ -1452,6 +1452,15 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
sseMXCSR &= 0xffff; // clear the upper 16 bits since they shouldn't be set sseMXCSR &= 0xffff; // clear the upper 16 bits since they shouldn't be set
sseVUMXCSR &= 0xffff; sseVUMXCSR &= 0xffff;
if( !cpucaps.hasStreamingSIMD2Extensions )
{
// SSE1 cpus do not support Denormals Are Zero flag (throws an exception
// if we don't mask them off)
sseMXCSR &= ~0x0040;
sseVUMXCSR &= ~0x0040;
}
g_sseMXCSR = sseMXCSR; g_sseMXCSR = sseMXCSR;
g_sseVUMXCSR = sseVUMXCSR; g_sseVUMXCSR = sseVUMXCSR;
// do NOT set Denormals-Are-Zero flag (charlie and chocfac messes up) // do NOT set Denormals-Are-Zero flag (charlie and chocfac messes up)