mirror of https://github.com/PCSX2/pcsx2.git
Horrible, nasty workaround to the Linux cpu sseMXCSR bug.
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@354 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
e47f14f4d5
commit
acb1ab1c29
|
@ -83,6 +83,13 @@ void RunGui() {
|
||||||
StartGui();
|
StartGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixCPUState(void)
|
||||||
|
{
|
||||||
|
Config.sseMXCSR = LinuxsseMXCSR;
|
||||||
|
Config.sseVUMXCSR = LinuxsseVUMXCSR;
|
||||||
|
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
|
}
|
||||||
|
|
||||||
void OnDestroy(GtkObject *object, gpointer user_data) {
|
void OnDestroy(GtkObject *object, gpointer user_data) {
|
||||||
if (!destroy) OnFile_Exit(NULL, user_data);
|
if (!destroy) OnFile_Exit(NULL, user_data);
|
||||||
}
|
}
|
||||||
|
@ -133,6 +140,7 @@ void RunExecute(int run)
|
||||||
signal(SIGINT, SignalExit);
|
signal(SIGINT, SignalExit);
|
||||||
signal(SIGPIPE, SignalExit);
|
signal(SIGPIPE, SignalExit);
|
||||||
|
|
||||||
|
FixCPUState();
|
||||||
if (needReset == TRUE) {
|
if (needReset == TRUE) {
|
||||||
|
|
||||||
if( RunExe == 0 )
|
if( RunExe == 0 )
|
||||||
|
@ -156,6 +164,8 @@ void RunExecute(int run)
|
||||||
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
needReset = TRUE;
|
needReset = TRUE;
|
||||||
efile = 0;
|
efile = 0;
|
||||||
|
|
||||||
|
FixCPUState();
|
||||||
RunExecute(1);
|
RunExecute(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +177,8 @@ void OnRunElf_Ok(GtkButton* button, gpointer user_data) {
|
||||||
gtk_widget_destroy(FileSel);
|
gtk_widget_destroy(FileSel);
|
||||||
needReset = TRUE;
|
needReset = TRUE;
|
||||||
efile = 1;
|
efile = 1;
|
||||||
|
|
||||||
|
FixCPUState();
|
||||||
RunExecute(1);
|
RunExecute(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,6 +779,9 @@ void on_Speed_Hack_OK(GtkButton *button, gpointer user_data)
|
||||||
}
|
}
|
||||||
void setAdvancedOptions()
|
void setAdvancedOptions()
|
||||||
{
|
{
|
||||||
|
LinuxsseMXCSR = Config.sseMXCSR;
|
||||||
|
LinuxsseVUMXCSR = Config.sseVUMXCSR;
|
||||||
|
|
||||||
switch((Config.sseMXCSR & 0x6000) >> 13)
|
switch((Config.sseMXCSR & 0x6000) >> 13)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -818,34 +833,40 @@ void on_Advanced(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
|
||||||
void on_Advanced_Defaults(GtkButton *button, gpointer user_data)
|
void on_Advanced_Defaults(GtkButton *button, gpointer user_data)
|
||||||
{
|
{
|
||||||
Config.sseMXCSR = DEFAULT_sseMXCSR;
|
LinuxsseMXCSR = DEFAULT_sseMXCSR;
|
||||||
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
LinuxsseVUMXCSR = DEFAULT_sseVUMXCSR;
|
||||||
|
|
||||||
setAdvancedOptions();
|
setAdvancedOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Advanced_OK(GtkButton *button, gpointer user_data)
|
void on_Advanced_OK(GtkButton *button, gpointer user_data)
|
||||||
{
|
{
|
||||||
Config.sseMXCSR &= 0x1fbf;
|
LinuxsseMXCSR &= 0x1fbf;
|
||||||
Config.sseVUMXCSR &= 0x1fbf;
|
LinuxsseVUMXCSR &= 0x1fbf;
|
||||||
|
|
||||||
|
LinuxsseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
||||||
|
LinuxsseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
||||||
|
LinuxsseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Positive") ? FLAG_ROUND_POSITIVE : 0;
|
||||||
|
LinuxsseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Zero") ? FLAG_ROUND_ZERO : 0;
|
||||||
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
LinuxsseMXCSR = Config.sseMXCSR;
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
LinuxsseVUMXCSR = Config.sseVUMXCSR;
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Positive") ? FLAG_ROUND_POSITIVE : 0;
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Zero") ? FLAG_ROUND_ZERO : 0;
|
|
||||||
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
LinuxsseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
LinuxsseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Positive") ? FLAG_ROUND_POSITIVE : 0;
|
LinuxsseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Positive") ? FLAG_ROUND_POSITIVE : 0;
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Zero") ? FLAG_ROUND_ZERO : 0;
|
LinuxsseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Zero") ? FLAG_ROUND_ZERO : 0;
|
||||||
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "check_EE_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
LinuxsseMXCSR |= is_checked(AdvDlg, "check_EE_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "check_VU_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
LinuxsseVUMXCSR |= is_checked(AdvDlg, "check_VU_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
||||||
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "check_EE_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
LinuxsseMXCSR |= is_checked(AdvDlg, "check_EE_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "check_VU_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
LinuxsseVUMXCSR |= is_checked(AdvDlg, "check_VU_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
||||||
|
|
||||||
|
Config.sseMXCSR = LinuxsseMXCSR;
|
||||||
|
Config.sseVUMXCSR = LinuxsseVUMXCSR;
|
||||||
|
|
||||||
|
//SysPrintf("Advanced: Config.sseMXCSR = %x; Config.sseVUMXCSR = %x \n", Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,11 @@ extern int efile;
|
||||||
extern int g_SaveGSStream;
|
extern int g_SaveGSStream;
|
||||||
extern int g_ZeroGSOptions;
|
extern int g_ZeroGSOptions;
|
||||||
|
|
||||||
|
// Nasty, currently neccessary hack
|
||||||
|
extern u32 LinuxsseMXCSR;
|
||||||
|
extern u32 LinuxsseVUMXCSR;
|
||||||
|
extern void FixCPUState(void);
|
||||||
|
|
||||||
/* LnxMain */
|
/* LnxMain */
|
||||||
extern void InitLanguages();
|
extern void InitLanguages();
|
||||||
extern char *GetLanguageNext();
|
extern char *GetLanguageNext();
|
||||||
|
|
|
@ -195,7 +195,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
SysReset();
|
SysReset();
|
||||||
|
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
FixCPUState();
|
||||||
cpuExecuteBios();
|
cpuExecuteBios();
|
||||||
if (file) strcpy(elfname, file);
|
if (file) strcpy(elfname, file);
|
||||||
if (!efile) efile=GetPS2ElfName(elfname);
|
if (!efile) efile=GetPS2ElfName(elfname);
|
||||||
|
|
|
@ -29,6 +29,9 @@ extern "C" {
|
||||||
FILE *pref_file;
|
FILE *pref_file;
|
||||||
char *data;
|
char *data;
|
||||||
|
|
||||||
|
u32 LinuxsseMXCSR = DEFAULT_sseMXCSR;
|
||||||
|
u32 LinuxsseVUMXCSR = DEFAULT_sseVUMXCSR;
|
||||||
|
|
||||||
static void SetValue( const char *name, char *var)
|
static void SetValue( const char *name, char *var)
|
||||||
{
|
{
|
||||||
fprintf (pref_file,"%s = %s\n", name, var);
|
fprintf (pref_file,"%s = %s\n", name, var);
|
||||||
|
@ -102,11 +105,11 @@ int LoadConfig() {
|
||||||
|
|
||||||
GetValuel("Fixes", Config.GameFixes);
|
GetValuel("Fixes", Config.GameFixes);
|
||||||
|
|
||||||
Config.sseMXCSR = DEFAULT_sseMXCSR;
|
GetValuel("sseMXCSR", LinuxsseMXCSR);
|
||||||
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
GetValuel("sseVUMXCSR", LinuxsseVUMXCSR);
|
||||||
|
|
||||||
GetValuel("sseMXCSR", Config.sseMXCSR);
|
Config.sseMXCSR = LinuxsseMXCSR;
|
||||||
GetValuel("sseVUMXCSR", Config.sseVUMXCSR);
|
Config.sseVUMXCSR = LinuxsseVUMXCSR;
|
||||||
|
|
||||||
GetValuel("Patch", Config.Patch);
|
GetValuel("Patch", Config.Patch);
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,13 @@ void patchFunc_zerogs(char* cmd, char* param)
|
||||||
void SetRoundMode(u32 ee, u32 vu)
|
void SetRoundMode(u32 ee, u32 vu)
|
||||||
{
|
{
|
||||||
// don't set a state for interpreter only
|
// don't set a state for interpreter only
|
||||||
|
SysMessage("SetRoundMode: Config.sseMXCSR = %x; Config.sseVUMXCSR = %x \n", Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
|
|
||||||
#ifndef PCSX2_NORECBUILD
|
#ifndef PCSX2_NORECBUILD
|
||||||
SetCPUState( (Config.sseMXCSR & 0x9fff) | ee, (Config.sseVUMXCSR & 0x9fff) | vu);
|
SetCPUState( (Config.sseMXCSR & 0x9fff) | ee, (Config.sseVUMXCSR & 0x9fff) | vu);
|
||||||
|
#endif
|
||||||
|
#ifdef __LINUX__
|
||||||
|
LinuxsseMXCSR = Config.sseMXCSR;
|
||||||
|
LinuxsseVUMXCSR = Config.sseVUMXCSR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,11 @@ extern PatchTextTable cpuCore[];
|
||||||
extern IniPatch patch[ MAX_PATCH ];
|
extern IniPatch patch[ MAX_PATCH ];
|
||||||
extern int patchnumber;
|
extern int patchnumber;
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
// Nasty, currently neccessary hack
|
||||||
|
extern u32 LinuxsseMXCSR;
|
||||||
|
extern u32 LinuxsseVUMXCSR;
|
||||||
|
#endif
|
||||||
|
|
||||||
void applypatch( int place );
|
void applypatch( int place );
|
||||||
void inifile_read( char * name );
|
void inifile_read( char * name );
|
||||||
|
|
|
@ -1445,6 +1445,7 @@ u32 g_sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
||||||
|
|
||||||
void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
|
void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
|
||||||
{
|
{
|
||||||
|
//SysMessage("SetCPUState: Config.sseMXCSR = %x; Config.sseVUMXCSR = %x \n", Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
// SSE STATE //
|
// SSE STATE //
|
||||||
// WARNING: do not touch unless you know what you are doing
|
// WARNING: do not touch unless you know what you are doing
|
||||||
|
|
||||||
|
@ -1581,7 +1582,7 @@ int recInit( void )
|
||||||
g_MACFlagTransform[i] = macarr[i>>4]|(macarr[i&15]<<4);
|
g_MACFlagTransform[i] = macarr[i>>4]|(macarr[i&15]<<4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//SysMessage("recInit: Config.sseMXCSR = %x; Config.sseVUMXCSR = %x \n", Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1667,6 +1668,7 @@ static void execute( void )
|
||||||
g_EEFreezeRegs = 1;
|
g_EEFreezeRegs = 1;
|
||||||
|
|
||||||
// skip the POPs
|
// skip the POPs
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
fnptr = (u8*)pblock->pFnptr;
|
fnptr = (u8*)pblock->pFnptr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue