mirror of https://github.com/PCSX2/pcsx2.git
Linux: Reorganized the files to a somewhat familiar file structure. Adjusted some Linux code to be closer to the Windows version.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@443 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
081d533bc8
commit
57c8281242
|
@ -0,0 +1,62 @@
|
||||||
|
/* Pcsx2 - Pc Ps2 Emulator
|
||||||
|
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Linux.h"
|
||||||
|
|
||||||
|
GtkWidget *AboutDlg, *about_version , *about_authors, *about_greets;
|
||||||
|
|
||||||
|
void OnHelp_Help()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnHelpAbout_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy(AboutDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnHelp_About(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
char str[g_MaxPath];
|
||||||
|
GtkWidget *Label;
|
||||||
|
|
||||||
|
AboutDlg = create_AboutDlg();
|
||||||
|
gtk_window_set_title(GTK_WINDOW(AboutDlg), _("About"));
|
||||||
|
|
||||||
|
Label = lookup_widget(AboutDlg, "GtkAbout_LabelVersion");
|
||||||
|
|
||||||
|
// Include the SVN revision
|
||||||
|
if (SVN_REV != 0)
|
||||||
|
sprintf(str, _("PCSX2 For Linux\nVersion %s %s\n"), PCSX2_VERSION, SVN_REV);
|
||||||
|
else
|
||||||
|
//Use this instead for a non-svn version
|
||||||
|
sprintf(str, _("PCSX2 For Linux\nVersion %s\n"), PCSX2_VERSION);
|
||||||
|
|
||||||
|
gtk_label_set_text(GTK_LABEL(Label), str);
|
||||||
|
|
||||||
|
Label = lookup_widget(AboutDlg, "GtkAbout_LabelAuthors");
|
||||||
|
gtk_label_set_text(GTK_LABEL(Label), _(LabelAuthors));
|
||||||
|
|
||||||
|
Label = lookup_widget(AboutDlg, "GtkAbout_LabelGreets");
|
||||||
|
gtk_label_set_text(GTK_LABEL(Label), _(LabelGreets));
|
||||||
|
|
||||||
|
gtk_widget_show_all(AboutDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
|
@ -0,0 +1,160 @@
|
||||||
|
/* Pcsx2 - Pc Ps2 Emulator
|
||||||
|
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Linux.h"
|
||||||
|
|
||||||
|
GtkWidget *AdvDlg;
|
||||||
|
|
||||||
|
void setAdvancedOptions()
|
||||||
|
{
|
||||||
|
if (!cpucaps.hasStreamingSIMD2Extensions)
|
||||||
|
{
|
||||||
|
// SSE1 cpus do not support Denormals Are Zero flag.
|
||||||
|
|
||||||
|
Config.sseMXCSR &= ~FLAG_DENORMAL_ZERO;
|
||||||
|
Config.sseVUMXCSR &= ~FLAG_DENORMAL_ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ((Config.sseMXCSR & 0x6000) >> 13)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Round_Near", TRUE);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Round_Negative", TRUE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Round_Positive", TRUE);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Round_Zero", TRUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ((Config.sseVUMXCSR & 0x6000) >> 13)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Round_Near", TRUE);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Round_Negative", TRUE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Round_Positive", TRUE);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Round_Zero", TRUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (Config.eeOptions)
|
||||||
|
{
|
||||||
|
case FLAG_EE_CLAMP_NONE:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Clamp_None", TRUE);
|
||||||
|
break;
|
||||||
|
case FLAG_EE_CLAMP_NORMAL:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Clamp_Normal", TRUE);
|
||||||
|
break;
|
||||||
|
case FLAG_EE_CLAMP_EXTRA_PRESERVE:
|
||||||
|
set_checked(AdvDlg, "radio_EE_Clamp_Extra_Preserve", TRUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (Config.vuOptions)
|
||||||
|
{
|
||||||
|
case FLAG_VU_CLAMP_NONE:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Clamp_None", TRUE);
|
||||||
|
break;
|
||||||
|
case FLAG_VU_CLAMP_NORMAL:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Clamp_Normal", TRUE);
|
||||||
|
break;
|
||||||
|
case FLAG_VU_CLAMP_EXTRA:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Clamp_Extra", TRUE);
|
||||||
|
break;
|
||||||
|
case FLAG_VU_CLAMP_EXTRA_PRESERVE:
|
||||||
|
set_checked(AdvDlg, "radio_VU_Clamp_Extra_Preserve", TRUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
set_checked(AdvDlg, "check_EE_Flush_Zero", (Config.sseMXCSR & FLAG_FLUSH_ZERO) ? TRUE : FALSE);
|
||||||
|
set_checked(AdvDlg, "check_EE_Denormal_Zero", (Config.sseMXCSR & FLAG_DENORMAL_ZERO) ? TRUE : FALSE);
|
||||||
|
|
||||||
|
set_checked(AdvDlg, "check_VU_Flush_Zero", (Config.sseVUMXCSR & FLAG_FLUSH_ZERO) ? TRUE : FALSE);
|
||||||
|
set_checked(AdvDlg, "check_VU_Denormal_Zero", (Config.sseVUMXCSR & FLAG_DENORMAL_ZERO) ? TRUE : FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_Advanced(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
AdvDlg = create_AdvDlg();
|
||||||
|
|
||||||
|
setAdvancedOptions();
|
||||||
|
|
||||||
|
gtk_widget_show_all(AdvDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_Advanced_Defaults(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
Config.sseMXCSR = DEFAULT_sseMXCSR;
|
||||||
|
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
||||||
|
Config.eeOptions = DEFAULT_eeOptions;
|
||||||
|
Config.vuOptions = DEFAULT_vuOptions;
|
||||||
|
|
||||||
|
setAdvancedOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_Advanced_OK(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
Config.sseMXCSR &= 0x1fbf;
|
||||||
|
Config.sseVUMXCSR &= 0x1fbf;
|
||||||
|
Config.eeOptions = 0;
|
||||||
|
Config.vuOptions = 0;
|
||||||
|
|
||||||
|
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
||||||
|
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
||||||
|
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.sseMXCSR |= is_checked(AdvDlg, "check_EE_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
||||||
|
Config.sseMXCSR |= is_checked(AdvDlg, "check_EE_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
||||||
|
|
||||||
|
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
||||||
|
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
||||||
|
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Positive") ? FLAG_ROUND_POSITIVE : 0;
|
||||||
|
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Zero") ? FLAG_ROUND_ZERO : 0;
|
||||||
|
|
||||||
|
Config.sseVUMXCSR |= is_checked(AdvDlg, "check_VU_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
||||||
|
Config.sseVUMXCSR |= is_checked(AdvDlg, "check_VU_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
||||||
|
|
||||||
|
Config.eeOptions |= is_checked(AdvDlg, "radio_EE_Clamp_None") ? FLAG_EE_CLAMP_NONE : 0;
|
||||||
|
Config.eeOptions |= is_checked(AdvDlg, "radio_EE_Clamp_Normal") ? FLAG_EE_CLAMP_NORMAL : 0;
|
||||||
|
Config.eeOptions |= is_checked(AdvDlg, "radio_EE_Clamp_Extra_Preserve") ? FLAG_EE_CLAMP_EXTRA_PRESERVE : 0;
|
||||||
|
|
||||||
|
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_None") ? FLAG_VU_CLAMP_NONE : 0;
|
||||||
|
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_Normal") ? FLAG_VU_CLAMP_NORMAL : 0;
|
||||||
|
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_Extra") ? FLAG_VU_CLAMP_EXTRA : 0;
|
||||||
|
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_Extra_Preserve") ? FLAG_VU_CLAMP_EXTRA_PRESERVE : 0;
|
||||||
|
|
||||||
|
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
|
SaveConfig();
|
||||||
|
|
||||||
|
gtk_widget_destroy(AdvDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
|
@ -34,8 +34,10 @@ static bool GetComboText(GtkWidget *combo, char plist[255][255], char *conf)
|
||||||
char *tmp = (char*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
|
char *tmp = (char*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
|
||||||
|
|
||||||
if (tmp == NULL) return FALSE;
|
if (tmp == NULL) return FALSE;
|
||||||
for (i=2;i<255;i+=2) {
|
for (i = 2;i < 255;i += 2)
|
||||||
if (!strcmp(tmp, plist[i-1])) {
|
{
|
||||||
|
if (!strcmp(tmp, plist[i-1]))
|
||||||
|
{
|
||||||
strcpy(conf, plist[i-2]);
|
strcpy(conf, plist[i-2]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,8 @@ void OnConf_Gs(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Pads(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Pads(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
char file[255];
|
char file[255];
|
||||||
|
|
||||||
getcwd(file, ARRAYSIZE(file));
|
getcwd(file, ARRAYSIZE(file));
|
||||||
|
@ -120,7 +123,8 @@ void OnConf_Pads(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Spu2(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Spu2(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
char file[255];
|
char file[255];
|
||||||
|
|
||||||
getcwd(file, ARRAYSIZE(file));
|
getcwd(file, ARRAYSIZE(file));
|
||||||
|
@ -131,7 +135,8 @@ void OnConf_Spu2(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
chdir(file);
|
chdir(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Cdvd(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Cdvd(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
char file[255];
|
char file[255];
|
||||||
|
|
||||||
getcwd(file, ARRAYSIZE(file));
|
getcwd(file, ARRAYSIZE(file));
|
||||||
|
@ -142,7 +147,8 @@ void OnConf_Cdvd(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
chdir(file);
|
chdir(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Dev9(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Dev9(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
char file[255];
|
char file[255];
|
||||||
|
|
||||||
getcwd(file, ARRAYSIZE(file));
|
getcwd(file, ARRAYSIZE(file));
|
||||||
|
@ -153,7 +159,8 @@ void OnConf_Dev9(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
chdir(file);
|
chdir(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Usb(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Usb(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
char file[255];
|
char file[255];
|
||||||
|
|
||||||
getcwd(file, ARRAYSIZE(file));
|
getcwd(file, ARRAYSIZE(file));
|
||||||
|
@ -164,7 +171,8 @@ void OnConf_Usb(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
chdir(file);
|
chdir(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Fw(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Fw(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
char file[255];
|
char file[255];
|
||||||
|
|
||||||
getcwd(file, ARRAYSIZE(file));
|
getcwd(file, ARRAYSIZE(file));
|
||||||
|
@ -180,9 +188,12 @@ void SetActiveComboItem(GtkComboBox *widget,char plist[255][255], GList *list, c
|
||||||
GList *temp;
|
GList *temp;
|
||||||
int i = 0, pindex = 0, item = -1;
|
int i = 0, pindex = 0, item = -1;
|
||||||
|
|
||||||
if (strlen(conf) > 0) {
|
if (strlen(conf) > 0)
|
||||||
for (i=2;i<255;i+=2) {
|
{
|
||||||
if (!strcmp(conf, plist[i-2])) {
|
for (i = 2;i < 255;i += 2)
|
||||||
|
{
|
||||||
|
if (!strcmp(conf, plist[i-2]))
|
||||||
|
{
|
||||||
pindex = i - 1;
|
pindex = i - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +216,8 @@ void SetActiveComboItem(GtkComboBox *widget,char plist[255][255], GList *list, c
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), item);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Ok(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
applychanges = TRUE;
|
applychanges = TRUE;
|
||||||
|
|
||||||
if (!GetComboText(GSConfS.Combo, GSConfS.plist, Config.GS))
|
if (!GetComboText(GSConfS.Combo, GSConfS.plist, Config.GS))
|
||||||
|
@ -229,7 +241,8 @@ void OnConfConf_Ok(GtkButton *button, gpointer user_data) {
|
||||||
|
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
|
||||||
if (configuringplug == FALSE) {
|
if (configuringplug == FALSE)
|
||||||
|
{
|
||||||
ReleasePlugins();
|
ReleasePlugins();
|
||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
}
|
}
|
||||||
|
@ -239,99 +252,123 @@ void OnConfConf_Ok(GtkButton *button, gpointer user_data) {
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_GsConf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_GsConf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(GSConfS, Config.GS, "GSconfigure");
|
ConfPlugin(GSConfS, Config.GS, "GSconfigure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_GsTest(GtkButton *button, gpointer user_data) {
|
void OnConfConf_GsTest(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(GSConfS, Config.GS, "GStest");
|
TestPlugin(GSConfS, Config.GS, "GStest");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_GsAbout(GtkButton *button, gpointer user_data) {
|
void OnConfConf_GsAbout(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(GSConfS, Config.GS, "GSabout");
|
ConfPlugin(GSConfS, Config.GS, "GSabout");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Pad1Conf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Pad1Conf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(PAD1ConfS, Config.PAD1, "PADconfigure");
|
ConfPlugin(PAD1ConfS, Config.PAD1, "PADconfigure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Pad1Test(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Pad1Test(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(PAD1ConfS, Config.PAD1, "PADtest");
|
TestPlugin(PAD1ConfS, Config.PAD1, "PADtest");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Pad1About(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Pad1About(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(PAD1ConfS, Config.PAD1, "PADabout");
|
ConfPlugin(PAD1ConfS, Config.PAD1, "PADabout");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Pad2Conf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Pad2Conf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(PAD2ConfS, Config.PAD2, "PADconfigure");
|
ConfPlugin(PAD2ConfS, Config.PAD2, "PADconfigure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Pad2Test(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Pad2Test(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(PAD2ConfS, Config.PAD2, "PADtest");
|
TestPlugin(PAD2ConfS, Config.PAD2, "PADtest");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Pad2About(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Pad2About(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(PAD2ConfS, Config.PAD2, "PADabout");
|
ConfPlugin(PAD2ConfS, Config.PAD2, "PADabout");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Spu2Conf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Spu2Conf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(SPU2ConfS, Config.SPU2, "SPU2configure");
|
ConfPlugin(SPU2ConfS, Config.SPU2, "SPU2configure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Spu2Test(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Spu2Test(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(SPU2ConfS, Config.SPU2, "SPU2test");
|
TestPlugin(SPU2ConfS, Config.SPU2, "SPU2test");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Spu2About(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Spu2About(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(SPU2ConfS, Config.SPU2, "SPU2about");
|
ConfPlugin(SPU2ConfS, Config.SPU2, "SPU2about");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_CdvdConf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_CdvdConf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(CDVDConfS, Config.CDVD, "CDVDconfigure");
|
ConfPlugin(CDVDConfS, Config.CDVD, "CDVDconfigure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_CdvdTest(GtkButton *button, gpointer user_data) {
|
void OnConfConf_CdvdTest(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(CDVDConfS, Config.CDVD, "CDVDtest");
|
TestPlugin(CDVDConfS, Config.CDVD, "CDVDtest");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_CdvdAbout(GtkButton *button, gpointer user_data) {
|
void OnConfConf_CdvdAbout(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(CDVDConfS, Config.CDVD, "CDVDabout");
|
ConfPlugin(CDVDConfS, Config.CDVD, "CDVDabout");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Dev9Conf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Dev9Conf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(DEV9ConfS, Config.DEV9, "DEV9configure");
|
ConfPlugin(DEV9ConfS, Config.DEV9, "DEV9configure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Dev9Test(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Dev9Test(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(DEV9ConfS, Config.DEV9, "DEV9test");
|
TestPlugin(DEV9ConfS, Config.DEV9, "DEV9test");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_Dev9About(GtkButton *button, gpointer user_data) {
|
void OnConfConf_Dev9About(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(DEV9ConfS, Config.DEV9, "DEV9about");
|
ConfPlugin(DEV9ConfS, Config.DEV9, "DEV9about");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_UsbConf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_UsbConf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(USBConfS, Config.USB, "USBconfigure");
|
ConfPlugin(USBConfS, Config.USB, "USBconfigure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_UsbTest(GtkButton *button, gpointer user_data) {
|
void OnConfConf_UsbTest(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(USBConfS, Config.USB, "USBtest");
|
TestPlugin(USBConfS, Config.USB, "USBtest");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_UsbAbout(GtkButton *button, gpointer user_data) {
|
void OnConfConf_UsbAbout(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(USBConfS, Config.USB, "USBabout");
|
ConfPlugin(USBConfS, Config.USB, "USBabout");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_FWConf(GtkButton *button, gpointer user_data) {
|
void OnConfConf_FWConf(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(FWConfS, Config.FW, "FWconfigure");
|
ConfPlugin(FWConfS, Config.FW, "FWconfigure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_FWTest(GtkButton *button, gpointer user_data) {
|
void OnConfConf_FWTest(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
TestPlugin(FWConfS, Config.FW, "FWtest");
|
TestPlugin(FWConfS, Config.FW, "FWtest");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConfConf_FWAbout(GtkButton *button, gpointer user_data) {
|
void OnConfConf_FWAbout(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ConfPlugin(FWConfS, Config.FW, "FWabout");
|
ConfPlugin(FWConfS, Config.FW, "FWabout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +404,8 @@ static void ConfCreatePConf(const char *name, PluginConf *confs, char *config)
|
||||||
FindComboText(confs->Combo, confs->plist, confs->PluginNameList, config);
|
FindComboText(confs->Combo, confs->plist, confs->PluginNameList, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateConfDlg() {
|
void UpdateConfDlg()
|
||||||
|
{
|
||||||
FindPlugins();
|
FindPlugins();
|
||||||
|
|
||||||
ConfCreatePConf("Gs", &GSConfS, Config.GS);
|
ConfCreatePConf("Gs", &GSConfS, Config.GS);
|
||||||
|
@ -424,7 +462,8 @@ void OnConfConf_BiosPath(GtkButton *button, gpointer user_data)
|
||||||
UpdateConfDlg();
|
UpdateConfDlg();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
FindPlugins();
|
FindPlugins();
|
||||||
|
|
||||||
ConfDlg = create_ConfDlg();
|
ConfDlg = create_ConfDlg();
|
||||||
|
@ -437,7 +476,8 @@ void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ComboAddPlugin(char name[g_MaxPath], PluginConf *confs, u32 version, struct dirent *ent) {
|
static void ComboAddPlugin(char name[g_MaxPath], PluginConf *confs, u32 version, struct dirent *ent)
|
||||||
|
{
|
||||||
sprintf(name, "%s %ld.%ld.%ld", PS2EgetLibName(), (version >> 8)&0xff , version&0xff, (version >> 24)&0xff);
|
sprintf(name, "%s %ld.%ld.%ld", PS2EgetLibName(), (version >> 8)&0xff , version&0xff, (version >> 24)&0xff);
|
||||||
confs->plugins += 2;
|
confs->plugins += 2;
|
||||||
strcpy(confs->plist[confs->plugins-1], name);
|
strcpy(confs->plist[confs->plugins-1], name);
|
||||||
|
@ -445,7 +485,8 @@ static void ComboAddPlugin(char name[g_MaxPath], PluginConf *confs, u32 version,
|
||||||
confs->PluginNameList = g_list_append(confs->PluginNameList, confs->plist[confs->plugins-1]);
|
confs->PluginNameList = g_list_append(confs->PluginNameList, confs->plist[confs->plugins-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugins() {
|
void FindPlugins()
|
||||||
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *ent;
|
struct dirent *ent;
|
||||||
void *Handle;
|
void *Handle;
|
||||||
|
@ -459,11 +500,13 @@ void FindPlugins() {
|
||||||
USBConfS.PluginNameList = NULL; FWConfS.PluginNameList = NULL; BiosConfS.PluginNameList = NULL;
|
USBConfS.PluginNameList = NULL; FWConfS.PluginNameList = NULL; BiosConfS.PluginNameList = NULL;
|
||||||
|
|
||||||
dir = opendir(Config.PluginsDir);
|
dir = opendir(Config.PluginsDir);
|
||||||
if (dir == NULL) {
|
if (dir == NULL)
|
||||||
|
{
|
||||||
Msgbox::Alert("Could not open '%s' directory", params Config.PluginsDir);
|
Msgbox::Alert("Could not open '%s' directory", params Config.PluginsDir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while ((ent = readdir(dir)) != NULL) {
|
while ((ent = readdir(dir)) != NULL)
|
||||||
|
{
|
||||||
u32 version;
|
u32 version;
|
||||||
u32 type;
|
u32 type;
|
||||||
|
|
||||||
|
@ -578,7 +621,8 @@ void FindPlugins() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ent = readdir(dir)) != NULL) {
|
while ((ent = readdir(dir)) != NULL)
|
||||||
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
char description[50]; //2002-09-28 (Florin)
|
char description[50]; //2002-09-28 (Florin)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
#include "Linux.h"
|
#include "Linux.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
|
@ -41,7 +42,8 @@ void OnConf_Gs(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
void OnConf_Pads(GtkMenuItem *menuitem, gpointer user_data);
|
void OnConf_Pads(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data);
|
void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data);
|
void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkWidget *Combo;
|
GtkWidget *Combo;
|
||||||
GList *PluginNameList;
|
GList *PluginNameList;
|
||||||
char plist[255][255];
|
char plist[255][255];
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
/* Pcsx2 - Pc Ps2 Emulator
|
||||||
|
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Linux.h"
|
||||||
|
|
||||||
|
void OnCpu_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
u32 newopts = 0;
|
||||||
|
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec"))))
|
||||||
|
newopts |= PCSX2_EEREC;
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec"))))
|
||||||
|
newopts |= PCSX2_VU0REC;
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec"))))
|
||||||
|
newopts |= PCSX2_VU1REC;
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS"))))
|
||||||
|
newopts |= PCSX2_GSMULTITHREAD;
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal"))))
|
||||||
|
newopts |= PCSX2_FRAMELIMIT_NORMAL;
|
||||||
|
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit"))))
|
||||||
|
newopts |= PCSX2_FRAMELIMIT_LIMIT;
|
||||||
|
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitFS"))))
|
||||||
|
newopts |= PCSX2_FRAMELIMIT_SKIP;
|
||||||
|
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_VUSkip"))))
|
||||||
|
newopts |= PCSX2_FRAMELIMIT_VUSKIP;
|
||||||
|
|
||||||
|
Config.CustomFps = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "CustomFPSLimit")));
|
||||||
|
Config.CustomFrameSkip = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FrameThreshold")));
|
||||||
|
Config.CustomConsecutiveFrames = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesBeforeSkipping")));
|
||||||
|
Config.CustomConsecutiveSkip = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesToSkip")));
|
||||||
|
|
||||||
|
if (Config.Options != newopts)
|
||||||
|
{
|
||||||
|
SysRestorableReset();
|
||||||
|
|
||||||
|
if ((Config.Options&PCSX2_GSMULTITHREAD) ^(newopts&PCSX2_GSMULTITHREAD))
|
||||||
|
{
|
||||||
|
// Need the MTGS setting to take effect, so close out the plugins:
|
||||||
|
PluginsResetGS();
|
||||||
|
|
||||||
|
if (CHECK_MULTIGS)
|
||||||
|
Console::Notice("MTGS mode disabled.\n\tEnjoy the fruits of single-threaded simpicity.");
|
||||||
|
else
|
||||||
|
Console::Notice("MTGS mode enabled.\n\tWelcome to multi-threaded awesomeness. And random crashes.");
|
||||||
|
}
|
||||||
|
|
||||||
|
Config.Options = newopts;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
UpdateVSyncRate();
|
||||||
|
|
||||||
|
SaveConfig();
|
||||||
|
|
||||||
|
gtk_widget_destroy(CpuDlg);
|
||||||
|
if (MainWindow) gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
char str[512];
|
||||||
|
|
||||||
|
CpuDlg = create_CpuDlg();
|
||||||
|
gtk_window_set_title(GTK_WINDOW(CpuDlg), _("Configuration"));
|
||||||
|
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec")), !!CHECK_EEREC);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec")), !!CHECK_VU0REC);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec")), !!CHECK_VU1REC);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS")), !!CHECK_MULTIGS);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_NORMAL);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_LIMIT);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitFS")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_SKIP);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_VUSkip")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_VUSKIP);
|
||||||
|
|
||||||
|
sprintf(str, "Cpu Vendor: %s", cpuinfo.x86ID);
|
||||||
|
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_CpuVendor")), str);
|
||||||
|
sprintf(str, "Familly: %s", cpuinfo.x86Fam);
|
||||||
|
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_Family")), str);
|
||||||
|
sprintf(str, "Cpu Speed: %d MHZ", cpuinfo.cpuspeed);
|
||||||
|
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_CpuSpeed")), str);
|
||||||
|
|
||||||
|
strcpy(str, "Features: ");
|
||||||
|
if (cpucaps.hasMultimediaExtensions) strcat(str, "MMX");
|
||||||
|
if (cpucaps.hasStreamingSIMDExtensions) strcat(str, ",SSE");
|
||||||
|
if (cpucaps.hasStreamingSIMD2Extensions) strcat(str, ",SSE2");
|
||||||
|
if (cpucaps.hasStreamingSIMD3Extensions) strcat(str, ",SSE3");
|
||||||
|
if (cpucaps.hasAMD64BitArchitecture) strcat(str, ",x86-64");
|
||||||
|
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_Features")), str);
|
||||||
|
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "CustomFPSLimit")), (gdouble)Config.CustomFps);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FrameThreshold")), (gdouble)Config.CustomFrameSkip);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesBeforeSkipping")), (gdouble)Config.CustomConsecutiveFrames);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesToSkip")), (gdouble)Config.CustomConsecutiveSkip);
|
||||||
|
|
||||||
|
gtk_widget_show_all(CpuDlg);
|
||||||
|
if (MainWindow) gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
|
@ -19,7 +19,8 @@
|
||||||
#include "DebugDlg.h"
|
#include "DebugDlg.h"
|
||||||
using namespace R5900;
|
using namespace R5900;
|
||||||
|
|
||||||
void UpdateDebugger() {
|
void UpdateDebugger()
|
||||||
|
{
|
||||||
|
|
||||||
char *str;
|
char *str;
|
||||||
int i;
|
int i;
|
||||||
|
@ -28,17 +29,20 @@ void UpdateDebugger() {
|
||||||
DebugAdj->value = (gfloat)dPC / 4;
|
DebugAdj->value = (gfloat)dPC / 4;
|
||||||
gtk_list_store_clear(ListDVModel);
|
gtk_list_store_clear(ListDVModel);
|
||||||
|
|
||||||
for (i=0; i<23; i++) {
|
for (i = 0; i < 23; i++)
|
||||||
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
u32 *mem;
|
u32 *mem;
|
||||||
u32 pc = dPC + i * 4;
|
u32 pc = dPC + i * 4;
|
||||||
if (DebugMode) {
|
if (DebugMode)
|
||||||
|
{
|
||||||
mem = (u32*)PSXM(pc);
|
mem = (u32*)PSXM(pc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mem = (u32*)PSM(pc);
|
mem = (u32*)PSM(pc);
|
||||||
|
|
||||||
if (mem == NULL) {
|
if (mem == NULL)
|
||||||
|
{
|
||||||
sprintf(nullAddr, "%8.8lX:\tNULL MEMORY", pc);
|
sprintf(nullAddr, "%8.8lX:\tNULL MEMORY", pc);
|
||||||
str = nullAddr;
|
str = nullAddr;
|
||||||
}
|
}
|
||||||
|
@ -55,21 +59,24 @@ void UpdateDebugger() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_Close(GtkButton *button, gpointer user_data) {
|
void OnDebug_Close(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
ClosePlugins();
|
ClosePlugins();
|
||||||
gtk_widget_destroy(DebugWnd);
|
gtk_widget_destroy(DebugWnd);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_ScrollChange(GtkAdjustment *adj) {
|
void OnDebug_ScrollChange(GtkAdjustment *adj)
|
||||||
|
{
|
||||||
dPC = (u32)adj->value * 4;
|
dPC = (u32)adj->value * 4;
|
||||||
dPC &= ~0x3;
|
dPC &= ~0x3;
|
||||||
|
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSetPC_Ok(GtkButton *button, gpointer user_data) {
|
void OnSetPC_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(SetPCEntry));
|
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(SetPCEntry));
|
||||||
|
|
||||||
sscanf(str, "%lx", &dPC);
|
sscanf(str, "%lx", &dPC);
|
||||||
|
@ -81,13 +88,15 @@ void OnSetPC_Ok(GtkButton *button, gpointer user_data) {
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSetPC_Cancel(GtkButton *button, gpointer user_data) {
|
void OnSetPC_Cancel(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
gtk_widget_destroy(SetPCDlg);
|
gtk_widget_destroy(SetPCDlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_SetPC(GtkButton *button, gpointer user_data) {
|
void OnDebug_SetPC(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
SetPCDlg = create_SetPCDlg();
|
SetPCDlg = create_SetPCDlg();
|
||||||
|
|
||||||
SetPCEntry = lookup_widget(SetPCDlg, "GtkEntry_dPC");
|
SetPCEntry = lookup_widget(SetPCDlg, "GtkEntry_dPC");
|
||||||
|
@ -97,7 +106,8 @@ void OnDebug_SetPC(GtkButton *button, gpointer user_data) {
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSetBPA_Ok(GtkButton *button, gpointer user_data) {
|
void OnSetBPA_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(SetBPAEntry));
|
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(SetBPAEntry));
|
||||||
|
|
||||||
sscanf(str, "%lx", &dBPA);
|
sscanf(str, "%lx", &dBPA);
|
||||||
|
@ -109,13 +119,15 @@ void OnSetBPA_Ok(GtkButton *button, gpointer user_data) {
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSetBPA_Cancel(GtkButton *button, gpointer user_data) {
|
void OnSetBPA_Cancel(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
gtk_widget_destroy(SetBPADlg);
|
gtk_widget_destroy(SetBPADlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_SetBPA(GtkButton *button, gpointer user_data) {
|
void OnDebug_SetBPA(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
SetBPADlg = create_SetBPADlg();
|
SetBPADlg = create_SetBPADlg();
|
||||||
|
|
||||||
SetBPAEntry = lookup_widget(SetBPADlg, "GtkEntry_BPA");
|
SetBPAEntry = lookup_widget(SetBPADlg, "GtkEntry_BPA");
|
||||||
|
@ -125,7 +137,8 @@ void OnDebug_SetBPA(GtkButton *button, gpointer user_data) {
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSetBPC_Ok(GtkButton *button, gpointer user_data) {
|
void OnSetBPC_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(SetBPCEntry));
|
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(SetBPCEntry));
|
||||||
|
|
||||||
sscanf(str, "%lx", &dBPC);
|
sscanf(str, "%lx", &dBPC);
|
||||||
|
@ -136,13 +149,15 @@ void OnSetBPC_Ok(GtkButton *button, gpointer user_data) {
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSetBPC_Cancel(GtkButton *button, gpointer user_data) {
|
void OnSetBPC_Cancel(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
gtk_widget_destroy(SetBPCDlg);
|
gtk_widget_destroy(SetBPCDlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_SetBPC(GtkButton *button, gpointer user_data) {
|
void OnDebug_SetBPC(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
SetBPCDlg = create_SetBPCDlg();
|
SetBPCDlg = create_SetBPCDlg();
|
||||||
|
|
||||||
SetBPCEntry = lookup_widget(SetBPCDlg, "GtkEntry_BPC");
|
SetBPCEntry = lookup_widget(SetBPCDlg, "GtkEntry_BPC");
|
||||||
|
@ -152,34 +167,42 @@ void OnDebug_SetBPC(GtkButton *button, gpointer user_data) {
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_ClearBPs(GtkButton *button, gpointer user_data) {
|
void OnDebug_ClearBPs(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
dBPA = -1;
|
dBPA = -1;
|
||||||
dBPC = -1;
|
dBPC = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDumpC_Ok(GtkButton *button, gpointer user_data) {
|
void OnDumpC_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpCFEntry));
|
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpCFEntry));
|
||||||
u32 addrf, addrt;
|
u32 addrf, addrt;
|
||||||
|
|
||||||
sscanf(str, "%lx", &addrf); addrf&=~0x3;
|
sscanf(str, "%lx", &addrf);
|
||||||
|
addrf &= ~0x3;
|
||||||
str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpCTEntry));
|
str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpCTEntry));
|
||||||
sscanf(str, "%lx", &addrt); addrt&=~0x3;
|
sscanf(str, "%lx", &addrt);
|
||||||
|
addrt &= ~0x3;
|
||||||
|
|
||||||
f = fopen("dump.txt", "w");
|
f = fopen("dump.txt", "w");
|
||||||
if (f == NULL) return;
|
if (f == NULL) return;
|
||||||
|
|
||||||
while (addrf != addrt) {
|
while (addrf != addrt)
|
||||||
|
{
|
||||||
u32 *mem;
|
u32 *mem;
|
||||||
|
|
||||||
if (DebugMode) {
|
if (DebugMode)
|
||||||
|
{
|
||||||
mem = (u32*)PSXM(addrf);
|
mem = (u32*)PSXM(addrf);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
mem = (u32*)PSM(addrf);
|
mem = (u32*)PSM(addrf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem == NULL) {
|
if (mem == NULL)
|
||||||
|
{
|
||||||
sprintf(nullAddr, "%8.8lX:\tNULL MEMORY", addrf);
|
sprintf(nullAddr, "%8.8lX:\tNULL MEMORY", addrf);
|
||||||
str = nullAddr;
|
str = nullAddr;
|
||||||
}
|
}
|
||||||
|
@ -201,13 +224,15 @@ void OnDumpC_Ok(GtkButton *button, gpointer user_data) {
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDumpC_Cancel(GtkButton *button, gpointer user_data) {
|
void OnDumpC_Cancel(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
gtk_widget_destroy(DumpCDlg);
|
gtk_widget_destroy(DumpCDlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_DumpCode(GtkButton *button, gpointer user_data) {
|
void OnDebug_DumpCode(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
DumpCDlg = create_DumpCDlg();
|
DumpCDlg = create_DumpCDlg();
|
||||||
|
|
||||||
DumpCFEntry = lookup_widget(DumpCDlg, "GtkEntry_DumpCF");
|
DumpCFEntry = lookup_widget(DumpCDlg, "GtkEntry_DumpCF");
|
||||||
|
@ -218,25 +243,32 @@ void OnDebug_DumpCode(GtkButton *button, gpointer user_data) {
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDumpR_Ok(GtkButton *button, gpointer user_data) {
|
void OnDumpR_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpRFEntry));
|
char *str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpRFEntry));
|
||||||
u32 addrf, addrt;
|
u32 addrf, addrt;
|
||||||
|
|
||||||
sscanf(str, "%lx", &addrf); addrf&=~0x3;
|
sscanf(str, "%lx", &addrf);
|
||||||
|
addrf &= ~0x3;
|
||||||
str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpRTEntry));
|
str = (char*)gtk_entry_get_text(GTK_ENTRY(DumpRTEntry));
|
||||||
sscanf(str, "%lx", &addrt); addrt&=~0x3;
|
sscanf(str, "%lx", &addrt);
|
||||||
|
addrt &= ~0x3;
|
||||||
|
|
||||||
f = fopen("dump.txt", "w");
|
f = fopen("dump.txt", "w");
|
||||||
if (f == NULL) return;
|
if (f == NULL) return;
|
||||||
|
|
||||||
while (addrf != addrt) {
|
while (addrf != addrt)
|
||||||
|
{
|
||||||
u32 *mem;
|
u32 *mem;
|
||||||
u32 out;
|
u32 out;
|
||||||
|
|
||||||
if (DebugMode) {
|
if (DebugMode)
|
||||||
|
{
|
||||||
mem = (u32*)PSXM(addrf);
|
mem = (u32*)PSXM(addrf);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
mem = (u32*)PSM(addrf);
|
mem = (u32*)PSM(addrf);
|
||||||
}
|
}
|
||||||
if (mem == NULL) out = 0;
|
if (mem == NULL) out = 0;
|
||||||
|
@ -252,13 +284,15 @@ void OnDumpR_Ok(GtkButton *button, gpointer user_data) {
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDumpR_Cancel(GtkButton *button, gpointer user_data) {
|
void OnDumpR_Cancel(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
gtk_widget_destroy(DumpRDlg);
|
gtk_widget_destroy(DumpRDlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_RawDump(GtkButton *button, gpointer user_data) {
|
void OnDebug_RawDump(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
DumpRDlg = create_DumpRDlg();
|
DumpRDlg = create_DumpRDlg();
|
||||||
|
|
||||||
DumpRFEntry = lookup_widget(DumpRDlg, "GtkEntry_DumpRF");
|
DumpRFEntry = lookup_widget(DumpRDlg, "GtkEntry_DumpRF");
|
||||||
|
@ -269,32 +303,40 @@ void OnDebug_RawDump(GtkButton *button, gpointer user_data) {
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_Step(GtkButton *button, gpointer user_data) {
|
void OnDebug_Step(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
Cpu->Step();
|
Cpu->Step();
|
||||||
dPC = cpuRegs.pc;
|
dPC = cpuRegs.pc;
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_Skip(GtkButton *button, gpointer user_data) {
|
void OnDebug_Skip(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
cpuRegs.pc += 4;
|
cpuRegs.pc += 4;
|
||||||
dPC = cpuRegs.pc;
|
dPC = cpuRegs.pc;
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
int HasBreakPoint(u32 pc) {
|
int HasBreakPoint(u32 pc)
|
||||||
|
{
|
||||||
if (pc == dBPA) return 1;
|
if (pc == dBPA) return 1;
|
||||||
if (DebugMode == 0) {
|
if (DebugMode == 0)
|
||||||
|
{
|
||||||
if ((cpuRegs.cycle - 10) <= dBPC &&
|
if ((cpuRegs.cycle - 10) <= dBPC &&
|
||||||
(cpuRegs.cycle + 10) >= dBPC) return 1;
|
(cpuRegs.cycle + 10) >= dBPC) return 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((psxRegs.cycle - 100) <= dBPC &&
|
if ((psxRegs.cycle - 100) <= dBPC &&
|
||||||
(psxRegs.cycle + 100) >= dBPC) return 1;
|
(psxRegs.cycle + 100) >= dBPC) return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_Go(GtkButton *button, gpointer user_data) {
|
void OnDebug_Go(GtkButton *button, gpointer user_data)
|
||||||
for (;;) {
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
if (HasBreakPoint(cpuRegs.pc)) break;
|
if (HasBreakPoint(cpuRegs.pc)) break;
|
||||||
Cpu->Step();
|
Cpu->Step();
|
||||||
}
|
}
|
||||||
|
@ -302,25 +344,29 @@ void OnDebug_Go(GtkButton *button, gpointer user_data) {
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_Log(GtkButton *button, gpointer user_data) {
|
void OnDebug_Log(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
//Log = 1 - Log;
|
//Log = 1 - Log;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_EEMode(GtkToggleButton *togglebutton, gpointer user_data) {
|
void OnDebug_EEMode(GtkToggleButton *togglebutton, gpointer user_data)
|
||||||
|
{
|
||||||
DebugMode = 0;
|
DebugMode = 0;
|
||||||
dPC = cpuRegs.pc;
|
dPC = cpuRegs.pc;
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_IOPMode(GtkToggleButton *togglebutton, gpointer user_data) {
|
void OnDebug_IOPMode(GtkToggleButton *togglebutton, gpointer user_data)
|
||||||
|
{
|
||||||
DebugMode = 1;
|
DebugMode = 1;
|
||||||
dPC = psxRegs.pc;
|
dPC = psxRegs.pc;
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnMemWrite32_Ok(GtkButton *button, gpointer user_data) {
|
void OnMemWrite32_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
char *mem = (char*)gtk_entry_get_text(GTK_ENTRY(MemEntry));
|
char *mem = (char*)gtk_entry_get_text(GTK_ENTRY(MemEntry));
|
||||||
char *data = (char*)gtk_entry_get_text(GTK_ENTRY(DataEntry));
|
char *data = (char*)gtk_entry_get_text(GTK_ENTRY(DataEntry));
|
||||||
|
|
||||||
|
@ -331,13 +377,15 @@ void OnMemWrite32_Ok(GtkButton *button, gpointer user_data) {
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnMemWrite32_Cancel(GtkButton *button, gpointer user_data) {
|
void OnMemWrite32_Cancel(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
gtk_widget_destroy(MemWriteDlg);
|
gtk_widget_destroy(MemWriteDlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
gtk_widget_set_sensitive(DebugWnd, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_memWrite32(GtkButton *button, gpointer user_data) {
|
void OnDebug_memWrite32(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
MemWriteDlg = create_MemWrite32();
|
MemWriteDlg = create_MemWrite32();
|
||||||
|
|
||||||
MemEntry = lookup_widget(MemWriteDlg, "GtkEntry_Mem");
|
MemEntry = lookup_widget(MemWriteDlg, "GtkEntry_Mem");
|
||||||
|
@ -350,7 +398,8 @@ void OnDebug_memWrite32(GtkButton *button, gpointer user_data) {
|
||||||
UpdateDebugger();
|
UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDebug_Debugger(GtkMenuItem *menuitem, gpointer user_data) {
|
void OnDebug_Debugger(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
GtkWidget *scroll;
|
GtkWidget *scroll;
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
#include "Linux.h"
|
#include "Linux.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
|
|
|
@ -1,993 +0,0 @@
|
||||||
/* Pcsx2 - Pc Ps2 Emulator
|
|
||||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "GtkGui.h"
|
|
||||||
|
|
||||||
using namespace R5900;
|
|
||||||
|
|
||||||
void On_Dialog_Cancelled(GtkButton* button, gpointer user_data) {
|
|
||||||
gtk_widget_destroy((GtkWidget*)gtk_widget_get_toplevel ((GtkWidget*)button));
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartGui() {
|
|
||||||
GtkWidget *Menu;
|
|
||||||
GtkWidget *Item;
|
|
||||||
|
|
||||||
u32 i;
|
|
||||||
|
|
||||||
add_pixmap_directory(".pixmaps");
|
|
||||||
MainWindow = create_MainWindow();
|
|
||||||
|
|
||||||
if (SVN_REV != 0)
|
|
||||||
gtk_window_set_title(GTK_WINDOW(MainWindow), "PCSX2 "PCSX2_VERSION" "SVN_REV);
|
|
||||||
else
|
|
||||||
gtk_window_set_title(GTK_WINDOW(MainWindow), "PCSX2 "PCSX2_VERSION);
|
|
||||||
|
|
||||||
// status bar
|
|
||||||
pStatusBar = gtk_statusbar_new ();
|
|
||||||
gtk_box_pack_start (GTK_BOX(lookup_widget(MainWindow, "status_box")), pStatusBar, TRUE, TRUE, 0);
|
|
||||||
gtk_widget_show (pStatusBar);
|
|
||||||
|
|
||||||
gtk_statusbar_push(GTK_STATUSBAR(pStatusBar),0,
|
|
||||||
"F1 - save, F2 - next state, Shift+F2 - prev state, F3 - load, F8 - snapshot");
|
|
||||||
|
|
||||||
// add all the languages
|
|
||||||
Item = lookup_widget(MainWindow, "GtkMenuItem_Language");
|
|
||||||
Menu = gtk_menu_new();
|
|
||||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(Item), Menu);
|
|
||||||
|
|
||||||
for (i=0; i < langsMax; i++) {
|
|
||||||
Item = gtk_check_menu_item_new_with_label(ParseLang(langs[i].lang));
|
|
||||||
gtk_widget_show(Item);
|
|
||||||
gtk_container_add(GTK_CONTAINER(Menu), Item);
|
|
||||||
gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(Item), TRUE);
|
|
||||||
if (!strcmp(Config.Lang, langs[i].lang))
|
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item), TRUE);
|
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(Item), "activate",
|
|
||||||
GTK_SIGNAL_FUNC(OnLanguage),
|
|
||||||
(gpointer)(uptr)i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the appropriate menu items
|
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(MainWindow, "enable_console1")), Config.PsxOut);
|
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(MainWindow, "enable_patches1")), Config.Patch);
|
|
||||||
|
|
||||||
// disable anything not implemented or not working properly.
|
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(MainWindow, "patch_browser1")), FALSE);
|
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(MainWindow, "patch_finder2")), FALSE);
|
|
||||||
#ifndef PCSX2_DEVBUILD
|
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(MainWindow, "GtkMenuItem_Logging")), FALSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gtk_widget_show_all(MainWindow);
|
|
||||||
gtk_window_activate_focus(GTK_WINDOW(MainWindow));
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunGui() {
|
|
||||||
StartGui();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FixCPUState(void)
|
|
||||||
{
|
|
||||||
//Config.sseMXCSR = LinuxsseMXCSR;
|
|
||||||
//Config.sseVUMXCSR = LinuxsseVUMXCSR;
|
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDestroy(GtkObject *object, gpointer user_data) {}
|
|
||||||
|
|
||||||
gboolean OnDelete(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
|
||||||
{
|
|
||||||
pcsx2_exit();
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
int Pcsx2Configure() {
|
|
||||||
if (!UseGui) return 0;
|
|
||||||
|
|
||||||
configuringplug = TRUE;
|
|
||||||
MainWindow = NULL;
|
|
||||||
OnConf_Conf(NULL, 0);
|
|
||||||
configuringplug = FALSE;
|
|
||||||
|
|
||||||
return applychanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLanguage(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
ChangeLanguage(langs[(int)(uptr)user_data].lang);
|
|
||||||
gtk_widget_destroy(MainWindow);
|
|
||||||
gtk_main_quit();
|
|
||||||
while (gtk_events_pending()) gtk_main_iteration();
|
|
||||||
StartGui();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SignalExit(int sig) {
|
|
||||||
ClosePlugins();
|
|
||||||
pcsx2_exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExecuteCpu()
|
|
||||||
{
|
|
||||||
// Make sure any left-over recovery states are cleaned up.
|
|
||||||
safe_delete( g_RecoveryState );
|
|
||||||
|
|
||||||
// Destroy the window. Ugly thing.
|
|
||||||
gtk_widget_destroy(MainWindow);
|
|
||||||
gtk_main_quit();
|
|
||||||
while (gtk_events_pending()) gtk_main_iteration();
|
|
||||||
|
|
||||||
g_GameInProgress = true;
|
|
||||||
m_ReturnToGame = false;
|
|
||||||
|
|
||||||
signal(SIGINT, SignalExit);
|
|
||||||
signal(SIGPIPE, SignalExit);
|
|
||||||
|
|
||||||
// Make sure any left-over recovery states are cleaned up.
|
|
||||||
safe_delete( g_RecoveryState );
|
|
||||||
|
|
||||||
// Just in case they weren't initialized earlier (no harm in calling this multiple times)
|
|
||||||
if (OpenPlugins(NULL) == -1) return;
|
|
||||||
|
|
||||||
// this needs to be called for every new game! (note: sometimes launching games through bios will give a crc of 0)
|
|
||||||
if( GSsetGameCRC != NULL ) GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
|
|
||||||
|
|
||||||
// Optimization: We hardcode two versions of the EE here -- one for recs and one for ints.
|
|
||||||
// This is because recs are performance critical, and being able to inline them into the
|
|
||||||
// function here helps a small bit (not much but every small bit counts!).
|
|
||||||
|
|
||||||
g_EmulationInProgress = true;
|
|
||||||
g_ReturnToGui = false;
|
|
||||||
|
|
||||||
PCSX2_MEM_PROTECT_BEGIN();
|
|
||||||
|
|
||||||
if( CHECK_EEREC )
|
|
||||||
{
|
|
||||||
while( !g_ReturnToGui )
|
|
||||||
{
|
|
||||||
recExecute();
|
|
||||||
SysUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( !g_ReturnToGui )
|
|
||||||
{
|
|
||||||
Cpu->Execute();
|
|
||||||
SysUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PCSX2_MEM_PROTECT_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunExecute( const char* elf_file, bool use_bios )
|
|
||||||
{
|
|
||||||
|
|
||||||
// (air notes:)
|
|
||||||
// If you want to use the new to-memory savestate feature, take a look at the new
|
|
||||||
// RunExecute in WinMain.c, and secondly the CpuDlg.c or AdvancedDlg.cpp. The
|
|
||||||
// objects used are MemoryAlloc, memLoadingState, and memSavingState.
|
|
||||||
|
|
||||||
// It's important to make sure to reset the CPU and the plugins correctly, which is
|
|
||||||
// where the new RunExecute comes into play. It can be kind of tricky knowing
|
|
||||||
// when to call cpuExecuteBios and loadElfFile, and with what parameters.
|
|
||||||
|
|
||||||
// (or, as an alternative maybe we should switch to wxWidgets and have a unified
|
|
||||||
// cross platform gui?) - Air
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cpuReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
catch( std::exception& ex )
|
|
||||||
{
|
|
||||||
Msgbox::Alert( ex.what() );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OpenPlugins(NULL) == -1)
|
|
||||||
{
|
|
||||||
RunGui();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elf_file == NULL )
|
|
||||||
{
|
|
||||||
if (g_RecoveryState != NULL)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
memLoadingState( *g_RecoveryState ).FreezeAll();
|
|
||||||
}
|
|
||||||
catch( std::runtime_error& ex )
|
|
||||||
{
|
|
||||||
Msgbox::Alert(
|
|
||||||
"Gamestate recovery failed. Your game progress will be lost (sorry!)\n"
|
|
||||||
"\nError: %s\n", params ex.what() );
|
|
||||||
|
|
||||||
// Take the user back to the GUI...
|
|
||||||
safe_delete( g_RecoveryState );
|
|
||||||
ClosePlugins();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
safe_delete( g_RecoveryState );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Not recovering a state, so need to execute the bios and load the ELF information.
|
|
||||||
|
|
||||||
// if the elf_file is null we use the CDVD elf file.
|
|
||||||
// But if the elf_file is an empty string then we boot the bios instead.
|
|
||||||
|
|
||||||
char ename[g_MaxPath];
|
|
||||||
ename[0] = 0;
|
|
||||||
if( !use_bios )
|
|
||||||
GetPS2ElfName( ename );
|
|
||||||
|
|
||||||
loadElfFile( ename );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Custom ELF specified (not using CDVD).
|
|
||||||
// Run the BIOS and load the ELF.
|
|
||||||
|
|
||||||
loadElfFile( elf_file );
|
|
||||||
}
|
|
||||||
|
|
||||||
FixCPUState();
|
|
||||||
|
|
||||||
ExecuteCpu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
safe_free( g_RecoveryState );
|
|
||||||
ResetPlugins();
|
|
||||||
RunExecute( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnRunElf_Ok(GtkButton* button, gpointer user_data) {
|
|
||||||
gchar *File;
|
|
||||||
|
|
||||||
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
|
||||||
strcpy(elfname, File);
|
|
||||||
gtk_widget_destroy(FileSel);
|
|
||||||
|
|
||||||
RunExecute(elfname);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnRunElf_Cancel(GtkButton* button, gpointer user_data) {
|
|
||||||
gtk_widget_destroy(FileSel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnFile_LoadElf(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
GtkWidget *Ok,*Cancel;
|
|
||||||
|
|
||||||
FileSel = gtk_file_selection_new("Select Psx Elf File");
|
|
||||||
|
|
||||||
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
|
||||||
gtk_signal_connect (GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnRunElf_Ok), NULL);
|
|
||||||
gtk_widget_show(Ok);
|
|
||||||
|
|
||||||
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
|
||||||
gtk_signal_connect (GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnRunElf_Cancel), NULL);
|
|
||||||
gtk_widget_show(Cancel);
|
|
||||||
|
|
||||||
gtk_widget_show(FileSel);
|
|
||||||
gdk_window_raise(FileSel->window);
|
|
||||||
}
|
|
||||||
void pcsx2_exit()
|
|
||||||
{
|
|
||||||
DIR *dir;
|
|
||||||
struct dirent *ent;
|
|
||||||
void *Handle;
|
|
||||||
char plugin[g_MaxPath];
|
|
||||||
|
|
||||||
// with this the problem with plugins that are linked with the pthread
|
|
||||||
// library is solved
|
|
||||||
|
|
||||||
dir = opendir(Config.PluginsDir);
|
|
||||||
if (dir != NULL) {
|
|
||||||
while ((ent = readdir(dir)) != NULL) {
|
|
||||||
sprintf (plugin, "%s%s", Config.PluginsDir, ent->d_name);
|
|
||||||
|
|
||||||
if (strstr(plugin, ".so") == NULL) continue;
|
|
||||||
Handle = dlopen(plugin, RTLD_NOW);
|
|
||||||
if (Handle == NULL) continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("PCSX2 Quitting\n");
|
|
||||||
|
|
||||||
if (UseGui)
|
|
||||||
{
|
|
||||||
gtk_main_quit();
|
|
||||||
SysClose();
|
|
||||||
gtk_exit(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SysClose();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void OnFile_Exit(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
pcsx2_exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEmu_Run(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
if( g_EmulationInProgress )
|
|
||||||
ExecuteCpu();
|
|
||||||
else
|
|
||||||
RunExecute( NULL, true ); // boots bios if no savestate is to be recovered
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEmu_Reset(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
SysReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ResetMenuSlots(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
GtkWidget *Item;
|
|
||||||
char str[g_MaxPath];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<5; i++) {
|
|
||||||
sprintf(str, "GtkMenuItem_LoadSlot%d", i+1);
|
|
||||||
Item = lookup_widget(MainWindow, str);
|
|
||||||
if (Slots[i] == -1)
|
|
||||||
gtk_widget_set_sensitive(Item, FALSE);
|
|
||||||
else
|
|
||||||
gtk_widget_set_sensitive(Item, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*void UpdateMenuSlots(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
char str[g_MaxPath];
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for (i=0; i<5; i++) {
|
|
||||||
sprintf(str, SSTATES_DIR "/%8.8X.%3.3d", ElfCRC, i);
|
|
||||||
Slots[i] = CheckState(str);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void States_Load(string file, int num = -1 )
|
|
||||||
{
|
|
||||||
efile = 2;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// when we init joe it'll throw an UnsupportedStateVersion.
|
|
||||||
// So reset the cpu afterward so that trying to load a bum save
|
|
||||||
// doesn't fry the current emulation state.
|
|
||||||
gzLoadingState joe( file );
|
|
||||||
|
|
||||||
// Make sure the cpu and plugins are ready to be state-ified!
|
|
||||||
cpuReset();
|
|
||||||
OpenPlugins( NULL );
|
|
||||||
|
|
||||||
joe.FreezeAll();
|
|
||||||
}
|
|
||||||
catch( Exception::UnsupportedStateVersion& )
|
|
||||||
{
|
|
||||||
if( num != -1 )
|
|
||||||
Msgbox::Alert("Savestate slot %d is an unsupported version." , params num);
|
|
||||||
else
|
|
||||||
Msgbox::Alert( "%s : This is an unsupported savestate version." , params file.c_str());
|
|
||||||
|
|
||||||
// At this point the cpu hasn't been reset, so we can return
|
|
||||||
// control to the user safely...
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch( std::exception& ex )
|
|
||||||
{
|
|
||||||
if (num != -1)
|
|
||||||
Console::Error("Error occured while trying to load savestate slot %d", params num);
|
|
||||||
else
|
|
||||||
Console::Error("Error occured while trying to load savestate file: %d", params file.c_str());
|
|
||||||
|
|
||||||
Console::Error( "%s", params ex.what() );
|
|
||||||
|
|
||||||
// The emulation state is ruined. Might as well give them a popup and start the gui.
|
|
||||||
|
|
||||||
Msgbox::Alert(
|
|
||||||
"An error occured while trying to load the savestate data.\n"
|
|
||||||
"Pcsx2 emulation state has been reset."
|
|
||||||
);
|
|
||||||
|
|
||||||
cpuShutdown();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExecuteCpu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void States_Load(int num) {
|
|
||||||
string Text;
|
|
||||||
|
|
||||||
SaveState::GetFilename( Text, num );
|
|
||||||
|
|
||||||
struct stat buf;
|
|
||||||
if( stat(Text.c_str(), &buf ) == -1 )
|
|
||||||
{
|
|
||||||
Console::Notice( "Saveslot %d is empty.", params num );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
States_Load( Text, num );
|
|
||||||
}
|
|
||||||
|
|
||||||
void States_Save( string file, int num = -1 )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
gzSavingState(file).FreezeAll();
|
|
||||||
if( num != -1 )
|
|
||||||
Console::Notice("State saved to slot %d", params num );
|
|
||||||
else
|
|
||||||
Console::Notice( "State saved to file: %s", params file.c_str() );
|
|
||||||
}
|
|
||||||
catch( std::exception& ex )
|
|
||||||
{
|
|
||||||
if( num != -1 )
|
|
||||||
Msgbox::Alert("An error occurred while trying to save to slot %d", params num );
|
|
||||||
else
|
|
||||||
Msgbox::Alert("An error occurred while trying to save to file: %s", params file.c_str() );
|
|
||||||
|
|
||||||
Console::Error("Save state request failed with the following error:" );
|
|
||||||
Console::Error( "%s", params ex.what() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void States_Save(int num) {
|
|
||||||
string Text;
|
|
||||||
|
|
||||||
SaveState::GetFilename( Text, num );
|
|
||||||
States_Save( Text, num );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnStates_Load1(GtkMenuItem *menuitem, gpointer user_data) { States_Load(0); }
|
|
||||||
void OnStates_Load2(GtkMenuItem *menuitem, gpointer user_data) { States_Load(1); }
|
|
||||||
void OnStates_Load3(GtkMenuItem *menuitem, gpointer user_data) { States_Load(2); }
|
|
||||||
void OnStates_Load4(GtkMenuItem *menuitem, gpointer user_data) { States_Load(3); }
|
|
||||||
void OnStates_Load5(GtkMenuItem *menuitem, gpointer user_data) { States_Load(4); }
|
|
||||||
|
|
||||||
void OnLoadOther_Ok(GtkButton* button, gpointer user_data) {
|
|
||||||
gchar *File;
|
|
||||||
char str[g_MaxPath];
|
|
||||||
|
|
||||||
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
|
||||||
strcpy(str, File);
|
|
||||||
gtk_widget_destroy(FileSel);
|
|
||||||
|
|
||||||
States_Load( str );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLoadOther_Cancel(GtkButton* button, gpointer user_data) {
|
|
||||||
gtk_widget_destroy(FileSel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnStates_LoadOther(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
GtkWidget *Ok,*Cancel;
|
|
||||||
|
|
||||||
FileSel = gtk_file_selection_new(_("Select State File"));
|
|
||||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(FileSel), SSTATES_DIR "/");
|
|
||||||
|
|
||||||
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
|
||||||
gtk_signal_connect (GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnLoadOther_Ok), NULL);
|
|
||||||
gtk_widget_show(Ok);
|
|
||||||
|
|
||||||
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
|
||||||
gtk_signal_connect (GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnLoadOther_Cancel), NULL);
|
|
||||||
gtk_widget_show(Cancel);
|
|
||||||
|
|
||||||
gtk_widget_show(FileSel);
|
|
||||||
gdk_window_raise(FileSel->window);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnStates_Save1(GtkMenuItem *menuitem, gpointer user_data) { States_Save(0); }
|
|
||||||
void OnStates_Save2(GtkMenuItem *menuitem, gpointer user_data) { States_Save(1); }
|
|
||||||
void OnStates_Save3(GtkMenuItem *menuitem, gpointer user_data) { States_Save(2); }
|
|
||||||
void OnStates_Save4(GtkMenuItem *menuitem, gpointer user_data) { States_Save(3); }
|
|
||||||
void OnStates_Save5(GtkMenuItem *menuitem, gpointer user_data) { States_Save(4); }
|
|
||||||
|
|
||||||
void OnSaveOther_Ok(GtkButton* button, gpointer user_data) {
|
|
||||||
gchar *File;
|
|
||||||
char str[g_MaxPath];
|
|
||||||
|
|
||||||
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
|
||||||
strcpy(str, File);
|
|
||||||
gtk_widget_destroy(FileSel);
|
|
||||||
|
|
||||||
States_Save( str );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnSaveOther_Cancel(GtkButton* button, gpointer user_data) {
|
|
||||||
gtk_widget_destroy(FileSel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnStates_SaveOther(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
GtkWidget *Ok,*Cancel;
|
|
||||||
|
|
||||||
FileSel = gtk_file_selection_new(_("Select State File"));
|
|
||||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(FileSel), SSTATES_DIR "/");
|
|
||||||
|
|
||||||
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
|
||||||
gtk_signal_connect (GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnSaveOther_Ok), NULL);
|
|
||||||
gtk_widget_show(Ok);
|
|
||||||
|
|
||||||
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
|
||||||
gtk_signal_connect (GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnSaveOther_Cancel), NULL);
|
|
||||||
gtk_widget_show(Cancel);
|
|
||||||
|
|
||||||
gtk_widget_show(FileSel);
|
|
||||||
gdk_window_raise(FileSel->window);
|
|
||||||
}
|
|
||||||
|
|
||||||
//2002-09-28 (Florin)
|
|
||||||
void OnArguments_Ok(GtkButton *button, gpointer user_data) {
|
|
||||||
char *str;
|
|
||||||
|
|
||||||
str = (char*)gtk_entry_get_text(GTK_ENTRY(widgetCmdLine));
|
|
||||||
memcpy(args, str, g_MaxPath);
|
|
||||||
|
|
||||||
gtk_widget_destroy(CmdLine);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEmu_Arguments(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
GtkWidget *widgetCmdLine;
|
|
||||||
|
|
||||||
CmdLine = create_CmdLine();
|
|
||||||
gtk_window_set_title(GTK_WINDOW(CmdLine), _("Program arguments"));
|
|
||||||
|
|
||||||
widgetCmdLine = lookup_widget(CmdLine, "GtkEntry_dCMDLINE");
|
|
||||||
|
|
||||||
gtk_entry_set_text(GTK_ENTRY(widgetCmdLine), args);
|
|
||||||
gtk_widget_show_all(CmdLine);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCpu_Ok(GtkButton *button, gpointer user_data) {
|
|
||||||
u32 newopts = 0;
|
|
||||||
|
|
||||||
//Cpu->Shutdown();
|
|
||||||
//vu0Shutdown();
|
|
||||||
//vu1Shutdown();
|
|
||||||
|
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec"))))
|
|
||||||
newopts |= PCSX2_EEREC;
|
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec"))))
|
|
||||||
newopts |= PCSX2_VU0REC;
|
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec"))))
|
|
||||||
newopts |= PCSX2_VU1REC;
|
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS"))))
|
|
||||||
newopts |= PCSX2_GSMULTITHREAD;
|
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal"))))
|
|
||||||
newopts |= PCSX2_FRAMELIMIT_NORMAL;
|
|
||||||
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit"))))
|
|
||||||
newopts |= PCSX2_FRAMELIMIT_LIMIT;
|
|
||||||
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitFS"))))
|
|
||||||
newopts |= PCSX2_FRAMELIMIT_SKIP;
|
|
||||||
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_VUSkip"))))
|
|
||||||
newopts |= PCSX2_FRAMELIMIT_VUSKIP;
|
|
||||||
|
|
||||||
Config.CustomFps = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "CustomFPSLimit")));
|
|
||||||
Config.CustomFrameSkip = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FrameThreshold")));
|
|
||||||
Config.CustomConsecutiveFrames = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesBeforeSkipping")));
|
|
||||||
Config.CustomConsecutiveSkip = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesToSkip")));
|
|
||||||
|
|
||||||
if (Config.Options != newopts)
|
|
||||||
{
|
|
||||||
SysRestorableReset();
|
|
||||||
|
|
||||||
if ((Config.Options&PCSX2_GSMULTITHREAD) ^ (newopts&PCSX2_GSMULTITHREAD))
|
|
||||||
{
|
|
||||||
// Need the MTGS setting to take effect, so close out the plugins:
|
|
||||||
PluginsResetGS();
|
|
||||||
|
|
||||||
if (CHECK_MULTIGS)
|
|
||||||
Console::Notice( "MTGS mode disabled.\n\tEnjoy the fruits of single-threaded simpicity." );
|
|
||||||
else
|
|
||||||
Console::Notice( "MTGS mode enabled.\n\tWelcome to multi-threaded awesomeness. And random crashes." );
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.Options = newopts;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
UpdateVSyncRate();
|
|
||||||
|
|
||||||
SaveConfig();
|
|
||||||
|
|
||||||
gtk_widget_destroy(CpuDlg);
|
|
||||||
if (MainWindow) gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
char str[512];
|
|
||||||
|
|
||||||
CpuDlg = create_CpuDlg();
|
|
||||||
gtk_window_set_title(GTK_WINDOW(CpuDlg), _("Configuration"));
|
|
||||||
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec")), !!CHECK_EEREC);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec")), !!CHECK_VU0REC);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec")), !!CHECK_VU1REC);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS")), !!CHECK_MULTIGS);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal")), CHECK_FRAMELIMIT==PCSX2_FRAMELIMIT_NORMAL);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit")), CHECK_FRAMELIMIT==PCSX2_FRAMELIMIT_LIMIT);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitFS")), CHECK_FRAMELIMIT==PCSX2_FRAMELIMIT_SKIP);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_VUSkip")), CHECK_FRAMELIMIT==PCSX2_FRAMELIMIT_VUSKIP);
|
|
||||||
|
|
||||||
sprintf(str, "Cpu Vendor: %s", cpuinfo.x86ID);
|
|
||||||
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_CpuVendor")), str);
|
|
||||||
sprintf(str, "Familly: %s", cpuinfo.x86Fam);
|
|
||||||
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_Family")), str);
|
|
||||||
sprintf(str, "Cpu Speed: %d MHZ", cpuinfo.cpuspeed);
|
|
||||||
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_CpuSpeed")), str);
|
|
||||||
|
|
||||||
strcpy(str,"Features: ");
|
|
||||||
if(cpucaps.hasMultimediaExtensions) strcat(str,"MMX");
|
|
||||||
if(cpucaps.hasStreamingSIMDExtensions) strcat(str,",SSE");
|
|
||||||
if(cpucaps.hasStreamingSIMD2Extensions) strcat(str,",SSE2");
|
|
||||||
if(cpucaps.hasStreamingSIMD3Extensions) strcat(str,",SSE3");
|
|
||||||
if(cpucaps.hasAMD64BitArchitecture) strcat(str,",x86-64");
|
|
||||||
gtk_label_set_text(GTK_LABEL(lookup_widget(CpuDlg, "GtkLabel_Features")), str);
|
|
||||||
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "CustomFPSLimit")), (gdouble)Config.CustomFps);
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FrameThreshold")), (gdouble)Config.CustomFrameSkip);
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesBeforeSkipping")), (gdouble)Config.CustomConsecutiveFrames);
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(CpuDlg, "FramesToSkip")), (gdouble)Config.CustomConsecutiveSkip);
|
|
||||||
|
|
||||||
gtk_widget_show_all(CpuDlg);
|
|
||||||
if (MainWindow) gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLogging_Ok(GtkButton *button, gpointer user_data) {
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
|
||||||
GtkWidget *Btn;
|
|
||||||
char str[32];
|
|
||||||
int i, ret;
|
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<32; i++) {
|
|
||||||
if (((i > 16) && (i < 20)) || (i == 29))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
sprintf(str, "Log%d", i);
|
|
||||||
Btn = lookup_widget(LogDlg, str);
|
|
||||||
ret = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Btn));
|
|
||||||
if (ret) varLog|= 1<<i;
|
|
||||||
else varLog&=~(1<<i);
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveConfig();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gtk_widget_destroy(LogDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDebug_Logging(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
GtkWidget *Btn;
|
|
||||||
char str[32];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
LogDlg = create_Logging();
|
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<32; i++) {
|
|
||||||
if (((i > 16) && (i < 20)) || (i == 29))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
sprintf(str, "Log%d", i);
|
|
||||||
Btn = lookup_widget(LogDlg, str);
|
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(Btn), varLog & (1<<i));
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_show_all(LogDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnHelp_Help() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnHelpAbout_Ok(GtkButton *button, gpointer user_data) {
|
|
||||||
gtk_widget_destroy(AboutDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnHelp_About(GtkMenuItem *menuitem, gpointer user_data) {
|
|
||||||
char str[g_MaxPath];
|
|
||||||
GtkWidget *Label;
|
|
||||||
|
|
||||||
AboutDlg = create_AboutDlg();
|
|
||||||
gtk_window_set_title(GTK_WINDOW(AboutDlg), _("About"));
|
|
||||||
|
|
||||||
Label = lookup_widget(AboutDlg, "GtkAbout_LabelVersion");
|
|
||||||
|
|
||||||
// Include the SVN revision
|
|
||||||
if (SVN_REV !=0)
|
|
||||||
sprintf(str, _("PCSX2 For Linux\nVersion %s %s\n"), PCSX2_VERSION, SVN_REV);
|
|
||||||
else
|
|
||||||
//Use this instead for a non-svn version
|
|
||||||
sprintf(str, _("PCSX2 For Linux\nVersion %s\n"), PCSX2_VERSION);
|
|
||||||
|
|
||||||
gtk_label_set_text(GTK_LABEL(Label), str);
|
|
||||||
|
|
||||||
Label = lookup_widget(AboutDlg, "GtkAbout_LabelAuthors");
|
|
||||||
gtk_label_set_text(GTK_LABEL(Label), _(LabelAuthors));
|
|
||||||
|
|
||||||
Label = lookup_widget(AboutDlg, "GtkAbout_LabelGreets");
|
|
||||||
gtk_label_set_text(GTK_LABEL(Label), _(LabelGreets));
|
|
||||||
|
|
||||||
gtk_widget_show_all(AboutDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_patch_browser1_activate(GtkMenuItem *menuitem, gpointer user_data) {}
|
|
||||||
|
|
||||||
void on_patch_finder2_activate(GtkMenuItem *menuitem, gpointer user_data) {}
|
|
||||||
|
|
||||||
void on_enable_console1_activate (GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
Config.PsxOut=(int)gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
|
|
||||||
SaveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_enable_patches1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
Config.Patch=(int)gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
|
|
||||||
SaveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_Game_Fixes(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
GameFixDlg = create_GameFixDlg();
|
|
||||||
|
|
||||||
set_checked(GameFixDlg, "check_VU_Add_Sub", (Config.GameFixes & FLAG_VU_ADD_SUB));
|
|
||||||
set_checked(GameFixDlg, "check_FPU_Clamp", (Config.GameFixes & FLAG_FPU_CLAMP));
|
|
||||||
set_checked(GameFixDlg, "check_VU_Branch", (Config.GameFixes & FLAG_VU_BRANCH));
|
|
||||||
|
|
||||||
gtk_widget_show_all(GameFixDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_Game_Fix_OK(GtkButton *button, gpointer user_data)
|
|
||||||
{
|
|
||||||
|
|
||||||
Config.GameFixes = 0;
|
|
||||||
Config.GameFixes |= is_checked(GameFixDlg, "check_VU_Add_Sub") ? FLAG_VU_ADD_SUB : 0;
|
|
||||||
Config.GameFixes |= is_checked(GameFixDlg, "check_FPU_Clamp") ? FLAG_FPU_CLAMP : 0;
|
|
||||||
Config.GameFixes |= is_checked(GameFixDlg, "check_VU_Branch") ? FLAG_VU_BRANCH : 0;
|
|
||||||
|
|
||||||
SaveConfig();
|
|
||||||
gtk_widget_destroy(GameFixDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_Speed_Hacks(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
SpeedHacksDlg = create_SpeedHacksDlg();
|
|
||||||
|
|
||||||
switch (CHECK_EE_CYCLERATE)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
set_checked(SpeedHacksDlg, "check_default_cycle_rate", true);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
set_checked(SpeedHacksDlg, "check_1_5_cycle_rate", true);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
set_checked(SpeedHacksDlg, "check_2_cycle_rate", true);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
set_checked(SpeedHacksDlg, "check_3_cycle_rate", true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
set_checked(SpeedHacksDlg, "check_default_cycle_rate", true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_checked(SpeedHacksDlg, "check_iop_cycle_rate", CHECK_IOP_CYCLERATE);
|
|
||||||
set_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack", CHECK_WAITCYCLE_HACK);
|
|
||||||
set_checked(SpeedHacksDlg, "check_ESC_hack",CHECK_ESCAPE_HACK);
|
|
||||||
|
|
||||||
gtk_widget_show_all(SpeedHacksDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_Speed_Hack_OK(GtkButton *button, gpointer user_data)
|
|
||||||
{
|
|
||||||
Config.Hacks = 0;
|
|
||||||
|
|
||||||
if is_checked(SpeedHacksDlg, "check_default_cycle_rate")
|
|
||||||
Config.Hacks = 0;
|
|
||||||
else if is_checked(SpeedHacksDlg, "check_1_5_cycle_rate")
|
|
||||||
Config.Hacks = 1;
|
|
||||||
else if is_checked(SpeedHacksDlg, "check_2_cycle_rate")
|
|
||||||
Config.Hacks = 2;
|
|
||||||
else if is_checked(SpeedHacksDlg, "check_3_cycle_rate")
|
|
||||||
Config.Hacks = 3;
|
|
||||||
|
|
||||||
Config.Hacks |= is_checked(SpeedHacksDlg, "check_iop_cycle_rate") << 3;
|
|
||||||
Config.Hacks |= is_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack") << 4;
|
|
||||||
Config.Hacks |= is_checked(SpeedHacksDlg, "check_ESC_hack") << 10;
|
|
||||||
|
|
||||||
SaveConfig();
|
|
||||||
|
|
||||||
gtk_widget_destroy(SpeedHacksDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAdvancedOptions()
|
|
||||||
{
|
|
||||||
if( !cpucaps.hasStreamingSIMD2Extensions )
|
|
||||||
{
|
|
||||||
// SSE1 cpus do not support Denormals Are Zero flag.
|
|
||||||
|
|
||||||
Config.sseMXCSR &= ~FLAG_DENORMAL_ZERO;
|
|
||||||
Config.sseVUMXCSR &= ~FLAG_DENORMAL_ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch((Config.sseMXCSR & 0x6000) >> 13)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Round_Near", TRUE);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Round_Negative",TRUE);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Round_Positive", TRUE);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Round_Zero", TRUE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch((Config.sseVUMXCSR & 0x6000) >> 13)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Round_Near", TRUE);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Round_Negative",TRUE);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Round_Positive", TRUE);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Round_Zero", TRUE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch(Config.eeOptions)
|
|
||||||
{
|
|
||||||
case FLAG_EE_CLAMP_NONE:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Clamp_None", TRUE);
|
|
||||||
break;
|
|
||||||
case FLAG_EE_CLAMP_NORMAL:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Clamp_Normal",TRUE);
|
|
||||||
break;
|
|
||||||
case FLAG_EE_CLAMP_EXTRA_PRESERVE:
|
|
||||||
set_checked(AdvDlg, "radio_EE_Clamp_Extra_Preserve", TRUE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(Config.vuOptions)
|
|
||||||
{
|
|
||||||
case FLAG_VU_CLAMP_NONE:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Clamp_None", TRUE);
|
|
||||||
break;
|
|
||||||
case FLAG_VU_CLAMP_NORMAL:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Clamp_Normal",TRUE);
|
|
||||||
break;
|
|
||||||
case FLAG_VU_CLAMP_EXTRA:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Clamp_Extra", TRUE);
|
|
||||||
break;
|
|
||||||
case FLAG_VU_CLAMP_EXTRA_PRESERVE:
|
|
||||||
set_checked(AdvDlg, "radio_VU_Clamp_Extra_Preserve", TRUE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
set_checked(AdvDlg, "check_EE_Flush_Zero", (Config.sseMXCSR & FLAG_FLUSH_ZERO) ? TRUE : FALSE);
|
|
||||||
set_checked(AdvDlg, "check_EE_Denormal_Zero", (Config.sseMXCSR & FLAG_DENORMAL_ZERO) ? TRUE : FALSE);
|
|
||||||
|
|
||||||
set_checked(AdvDlg, "check_VU_Flush_Zero", (Config.sseVUMXCSR & FLAG_FLUSH_ZERO) ? TRUE : FALSE);
|
|
||||||
set_checked(AdvDlg, "check_VU_Denormal_Zero", (Config.sseVUMXCSR & FLAG_DENORMAL_ZERO) ? TRUE : FALSE);
|
|
||||||
}
|
|
||||||
void on_Advanced(GtkMenuItem *menuitem, gpointer user_data)
|
|
||||||
{
|
|
||||||
AdvDlg = create_AdvDlg();
|
|
||||||
|
|
||||||
setAdvancedOptions();
|
|
||||||
|
|
||||||
gtk_widget_show_all(AdvDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, FALSE);
|
|
||||||
gtk_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_Advanced_Defaults(GtkButton *button, gpointer user_data)
|
|
||||||
{
|
|
||||||
Config.sseMXCSR = DEFAULT_sseMXCSR;
|
|
||||||
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
|
||||||
Config.eeOptions = DEFAULT_eeOptions;
|
|
||||||
Config.vuOptions = DEFAULT_vuOptions;
|
|
||||||
|
|
||||||
setAdvancedOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_Advanced_OK(GtkButton *button, gpointer user_data)
|
|
||||||
{
|
|
||||||
Config.sseMXCSR &= 0x1fbf;
|
|
||||||
Config.sseVUMXCSR &= 0x1fbf;
|
|
||||||
Config.eeOptions = 0;
|
|
||||||
Config.vuOptions = 0;
|
|
||||||
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "radio_EE_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
|
||||||
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.sseMXCSR |= is_checked(AdvDlg, "check_EE_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
|
||||||
Config.sseMXCSR |= is_checked(AdvDlg, "check_EE_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
|
||||||
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Near") ? FLAG_ROUND_NEAR : 0;
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Negative") ? FLAG_ROUND_NEGATIVE : 0;
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Positive") ? FLAG_ROUND_POSITIVE : 0;
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "radio_VU_Round_Zero") ? FLAG_ROUND_ZERO : 0;
|
|
||||||
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "check_VU_Denormal_Zero") ? FLAG_DENORMAL_ZERO : 0;
|
|
||||||
Config.sseVUMXCSR |= is_checked(AdvDlg, "check_VU_Flush_Zero") ? FLAG_FLUSH_ZERO : 0;
|
|
||||||
|
|
||||||
Config.eeOptions |= is_checked(AdvDlg, "radio_EE_Clamp_None") ? FLAG_EE_CLAMP_NONE : 0;
|
|
||||||
Config.eeOptions |= is_checked(AdvDlg, "radio_EE_Clamp_Normal") ? FLAG_EE_CLAMP_NORMAL : 0;
|
|
||||||
Config.eeOptions |= is_checked(AdvDlg, "radio_EE_Clamp_Extra_Preserve") ? FLAG_EE_CLAMP_EXTRA_PRESERVE : 0;
|
|
||||||
|
|
||||||
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_None") ? FLAG_VU_CLAMP_NONE : 0;
|
|
||||||
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_Normal") ? FLAG_VU_CLAMP_NORMAL : 0;
|
|
||||||
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_Extra") ? FLAG_VU_CLAMP_EXTRA : 0;
|
|
||||||
Config.vuOptions |= is_checked(AdvDlg, "radio_VU_Clamp_Extra_Preserve") ? FLAG_VU_CLAMP_EXTRA_PRESERVE : 0;
|
|
||||||
|
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
|
||||||
SaveConfig();
|
|
||||||
|
|
||||||
gtk_widget_destroy(AdvDlg);
|
|
||||||
gtk_widget_set_sensitive(MainWindow, TRUE);
|
|
||||||
gtk_main_quit();
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
/* Pcsx2 - Pc Ps2 Emulator
|
|
||||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GTKGUI_H__
|
|
||||||
#define __GTKGUI_H__
|
|
||||||
|
|
||||||
|
|
||||||
#include "PrecompiledHeader.h"
|
|
||||||
#include "Linux.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "support.h"
|
|
||||||
#include "callbacks.h"
|
|
||||||
#include "interface.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool applychanges = FALSE;
|
|
||||||
bool configuringplug = FALSE;
|
|
||||||
bool UseGui = TRUE;
|
|
||||||
|
|
||||||
MemoryAlloc<u8>* g_RecoveryState = NULL;
|
|
||||||
bool g_GameInProgress = false; // Set TRUE if a game is actively running.
|
|
||||||
|
|
||||||
//static bool AccBreak = false;
|
|
||||||
static bool m_ReturnToGame = false; // set to exit the RunGui message pump
|
|
||||||
|
|
||||||
|
|
||||||
int efile = 0;
|
|
||||||
char elfname[g_MaxPath];
|
|
||||||
int Slots[5] = { -1, -1, -1, -1, -1 };
|
|
||||||
|
|
||||||
GtkWidget *CpuDlg;
|
|
||||||
|
|
||||||
// Functions Callbacks
|
|
||||||
void OnFile_LoadElf(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void OnFile_Exit(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void OnEmu_Run(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void OnEmu_Reset(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void OnEmu_Arguments(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void OnLanguage(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void OnHelp_Help();
|
|
||||||
void OnHelp_About(GtkMenuItem *menuitem, gpointer user_data);
|
|
||||||
void ExecuteCpu();
|
|
||||||
|
|
||||||
void StartGui();
|
|
||||||
void pcsx2_exit();
|
|
||||||
GtkWidget *MainWindow;
|
|
||||||
GtkWidget *pStatusBar = NULL, *Status_Box;
|
|
||||||
GtkWidget *CmdLine; //2002-09-28 (Florin)
|
|
||||||
GtkWidget *widgetCmdLine;
|
|
||||||
GtkWidget *LogDlg;
|
|
||||||
GtkWidget *FileSel;
|
|
||||||
GtkWidget *AboutDlg, *about_version , *about_authors, *about_greets;
|
|
||||||
|
|
||||||
void init_widgets();
|
|
||||||
|
|
||||||
GtkAccelGroup *AccelGroup;
|
|
||||||
|
|
||||||
GtkWidget *GameFixDlg, *SpeedHacksDlg, *AdvDlg;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
/* Pcsx2 - Pc Ps2 Emulator
|
||||||
|
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Linux.h"
|
||||||
|
|
||||||
|
GtkWidget *GameFixDlg, *SpeedHacksDlg;
|
||||||
|
|
||||||
|
void on_Game_Fixes(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GameFixDlg = create_GameFixDlg();
|
||||||
|
|
||||||
|
set_checked(GameFixDlg, "check_VU_Add_Sub", (Config.GameFixes & FLAG_VU_ADD_SUB));
|
||||||
|
set_checked(GameFixDlg, "check_FPU_Clamp", (Config.GameFixes & FLAG_FPU_CLAMP));
|
||||||
|
set_checked(GameFixDlg, "check_VU_Branch", (Config.GameFixes & FLAG_VU_BRANCH));
|
||||||
|
|
||||||
|
gtk_widget_show_all(GameFixDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_Game_Fix_OK(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
|
||||||
|
Config.GameFixes = 0;
|
||||||
|
Config.GameFixes |= is_checked(GameFixDlg, "check_VU_Add_Sub") ? FLAG_VU_ADD_SUB : 0;
|
||||||
|
Config.GameFixes |= is_checked(GameFixDlg, "check_FPU_Clamp") ? FLAG_FPU_CLAMP : 0;
|
||||||
|
Config.GameFixes |= is_checked(GameFixDlg, "check_VU_Branch") ? FLAG_VU_BRANCH : 0;
|
||||||
|
|
||||||
|
SaveConfig();
|
||||||
|
gtk_widget_destroy(GameFixDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_Speed_Hacks(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
SpeedHacksDlg = create_SpeedHacksDlg();
|
||||||
|
|
||||||
|
switch (CHECK_EE_CYCLERATE)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
set_checked(SpeedHacksDlg, "check_default_cycle_rate", true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
set_checked(SpeedHacksDlg, "check_1_5_cycle_rate", true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
set_checked(SpeedHacksDlg, "check_2_cycle_rate", true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
set_checked(SpeedHacksDlg, "check_3_cycle_rate", true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
set_checked(SpeedHacksDlg, "check_default_cycle_rate", true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_checked(SpeedHacksDlg, "check_iop_cycle_rate", CHECK_IOP_CYCLERATE);
|
||||||
|
set_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack", CHECK_WAITCYCLE_HACK);
|
||||||
|
set_checked(SpeedHacksDlg, "check_ESC_hack", CHECK_ESCAPE_HACK);
|
||||||
|
|
||||||
|
gtk_widget_show_all(SpeedHacksDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_Speed_Hack_OK(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
Config.Hacks = 0;
|
||||||
|
|
||||||
|
if is_checked(SpeedHacksDlg, "check_default_cycle_rate")
|
||||||
|
Config.Hacks = 0;
|
||||||
|
else if is_checked(SpeedHacksDlg, "check_1_5_cycle_rate")
|
||||||
|
Config.Hacks = 1;
|
||||||
|
else if is_checked(SpeedHacksDlg, "check_2_cycle_rate")
|
||||||
|
Config.Hacks = 2;
|
||||||
|
else if is_checked(SpeedHacksDlg, "check_3_cycle_rate")
|
||||||
|
Config.Hacks = 3;
|
||||||
|
|
||||||
|
Config.Hacks |= is_checked(SpeedHacksDlg, "check_iop_cycle_rate") << 3;
|
||||||
|
Config.Hacks |= is_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack") << 4;
|
||||||
|
Config.Hacks |= is_checked(SpeedHacksDlg, "check_ESC_hack") << 10;
|
||||||
|
|
||||||
|
SaveConfig();
|
||||||
|
|
||||||
|
gtk_widget_destroy(SpeedHacksDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
|
@ -54,6 +54,19 @@
|
||||||
#include "x86/ix86/ix86.h"
|
#include "x86/ix86/ix86.h"
|
||||||
#include "x86/iR5900.h"
|
#include "x86/iR5900.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "support.h"
|
||||||
|
#include "callbacks.h"
|
||||||
|
#include "interface.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Misc.c */
|
/* Misc.c */
|
||||||
extern void vu0Shutdown();
|
extern void vu0Shutdown();
|
||||||
extern void vu1Shutdown();
|
extern void vu1Shutdown();
|
||||||
|
@ -66,7 +79,6 @@ extern int g_SaveGSStream;
|
||||||
extern int g_ZeroGSOptions;
|
extern int g_ZeroGSOptions;
|
||||||
extern void FixCPUState(void);
|
extern void FixCPUState(void);
|
||||||
|
|
||||||
/* LnxMain */
|
|
||||||
extern void InitLanguages();
|
extern void InitLanguages();
|
||||||
extern char *GetLanguageNext();
|
extern char *GetLanguageNext();
|
||||||
extern void CloseLanguages();
|
extern void CloseLanguages();
|
||||||
|
@ -75,24 +87,23 @@ extern void StartGui();
|
||||||
extern void RunGui();
|
extern void RunGui();
|
||||||
extern int Pcsx2Configure();
|
extern int Pcsx2Configure();
|
||||||
extern GtkWidget *CpuDlg;
|
extern GtkWidget *CpuDlg;
|
||||||
extern void SysMessage(const char *fmt, ...);
|
|
||||||
|
|
||||||
/* Config.c */
|
|
||||||
extern int LoadConfig();
|
extern int LoadConfig();
|
||||||
extern void SaveConfig();
|
extern void SaveConfig();
|
||||||
|
|
||||||
/* GtkGui */
|
|
||||||
extern void init_widgets();
|
extern void init_widgets();
|
||||||
extern MemoryAlloc<u8>* g_RecoveryState;
|
extern MemoryAlloc<u8>* g_RecoveryState;
|
||||||
extern void SysRestorableReset();
|
extern void SysRestorableReset();
|
||||||
extern void SysDetect();
|
extern void SysDetect();
|
||||||
|
void SignalExit(int sig);
|
||||||
extern void RunExecute(const char* elf_file, bool use_bios = false);
|
extern void RunExecute(const char* elf_file, bool use_bios = false);
|
||||||
extern void ExecuteCpu();
|
extern void ExecuteCpu();
|
||||||
|
|
||||||
extern bool g_ReturnToGui; // set to exit the execution of the emulator and return control to the GUI
|
extern bool g_ReturnToGui; // set to exit the execution of the emulator and return control to the GUI
|
||||||
extern bool g_EmulationInProgress; // Set TRUE if a game is actively running (set to false on reset)
|
extern bool g_EmulationInProgress; // Set TRUE if a game is actively running (set to false on reset)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
char lang[g_MaxPath];
|
char lang[g_MaxPath];
|
||||||
} _langs;
|
} _langs;
|
||||||
|
|
||||||
|
@ -151,7 +162,8 @@ int Config_hacks_backup;
|
||||||
}
|
}
|
||||||
} */
|
} */
|
||||||
|
|
||||||
char ee_log_names[17][32] = {
|
char ee_log_names[17][32] =
|
||||||
|
{
|
||||||
"Cpu Log",
|
"Cpu Log",
|
||||||
"Mem Log",
|
"Mem Log",
|
||||||
"HW Log",
|
"HW Log",
|
||||||
|
@ -168,9 +180,11 @@ char ee_log_names[17][32] = {
|
||||||
"Sif Log",
|
"Sif Log",
|
||||||
"IPU Log",
|
"IPU Log",
|
||||||
"VU Micro Log",
|
"VU Micro Log",
|
||||||
"RPC Log" };
|
"RPC Log"
|
||||||
|
};
|
||||||
|
|
||||||
char iop_log_names[9][32] = {
|
char iop_log_names[9][32] =
|
||||||
|
{
|
||||||
"IOP Log",
|
"IOP Log",
|
||||||
"Mem Log",
|
"Mem Log",
|
||||||
"HW Log",
|
"HW Log",
|
||||||
|
@ -179,7 +193,8 @@ char iop_log_names[9][32] = {
|
||||||
"Pad Log",
|
"Pad Log",
|
||||||
"Gte Log",
|
"Gte Log",
|
||||||
"Cdr Log",
|
"Cdr Log",
|
||||||
"GPU Log" };
|
"GPU Log"
|
||||||
|
};
|
||||||
|
|
||||||
#define FLAG_VU_ADD_SUB 0x1
|
#define FLAG_VU_ADD_SUB 0x1
|
||||||
#define FLAG_VU_CLIP 0x2
|
#define FLAG_VU_CLIP 0x2
|
||||||
|
|
|
@ -16,14 +16,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include "LnxMain.h"
|
#include "LnxMain.h"
|
||||||
|
|
||||||
using namespace R5900;
|
using namespace R5900;
|
||||||
|
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
GtkWidget *FileSel;
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
TESTRUNARGS g_TestRun;
|
TESTRUNARGS g_TestRun;
|
||||||
|
@ -31,14 +29,8 @@ TESTRUNARGS g_TestRun;
|
||||||
|
|
||||||
GtkWidget *MsgDlg;
|
GtkWidget *MsgDlg;
|
||||||
|
|
||||||
static int sinit=0;
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
// These two status vars replace the old g_GameInProgress status var.
|
|
||||||
|
|
||||||
bool g_ReturnToGui = false; // set to exit the execution of the emulator and return control to the GUI
|
|
||||||
bool g_EmulationInProgress = false; // Set TRUE if a game is actively running (set to false on reset)
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
char elfname[g_MaxPath];
|
char elfname[g_MaxPath];
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -59,79 +51,101 @@ int main(int argc, char *argv[]) {
|
||||||
memset(&g_TestRun, 0, sizeof(g_TestRun));
|
memset(&g_TestRun, 0, sizeof(g_TestRun));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(i < argc) {
|
while (i < argc)
|
||||||
|
{
|
||||||
char* token = argv[i++];
|
char* token = argv[i++];
|
||||||
|
|
||||||
if( stricmp(token, "-help") == 0 || stricmp(token, "--help") == 0 || stricmp(token, "-h") == 0 ) {
|
if (stricmp(token, "-help") == 0 || stricmp(token, "--help") == 0 || stricmp(token, "-h") == 0)
|
||||||
|
{
|
||||||
//Msgbox::Alert( phelpmsg );
|
//Msgbox::Alert( phelpmsg );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-efile") == 0 ) {
|
else if (stricmp(token, "-efile") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
if( token != NULL ) {
|
if (token != NULL)
|
||||||
|
{
|
||||||
efile = atoi(token);
|
efile = atoi(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-nogui") == 0 ) {
|
else if (stricmp(token, "-nogui") == 0)
|
||||||
|
{
|
||||||
UseGui = FALSE;
|
UseGui = FALSE;
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-loadgs") == 0 ) {
|
else if (stricmp(token, "-loadgs") == 0)
|
||||||
|
{
|
||||||
g_pRunGSState = argv[i++];
|
g_pRunGSState = argv[i++];
|
||||||
}
|
}
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
else if( stricmp(token, "-image") == 0 ) {
|
else if (stricmp(token, "-image") == 0)
|
||||||
|
{
|
||||||
g_TestRun.pimagename = argv[i++];
|
g_TestRun.pimagename = argv[i++];
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-log") == 0 ) {
|
else if (stricmp(token, "-log") == 0)
|
||||||
|
{
|
||||||
g_TestRun.plogname = argv[i++];
|
g_TestRun.plogname = argv[i++];
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-logopt") == 0 ) {
|
else if (stricmp(token, "-logopt") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
if( token != NULL ) {
|
if (token != NULL)
|
||||||
|
{
|
||||||
if (token[0] == '0' && token[1] == 'x') token += 2;
|
if (token[0] == '0' && token[1] == 'x') token += 2;
|
||||||
sscanf(token, "%x", &varLog);
|
sscanf(token, "%x", &varLog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-frame") == 0 ) {
|
else if (stricmp(token, "-frame") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
if( token != NULL ) {
|
if (token != NULL)
|
||||||
|
{
|
||||||
g_TestRun.frame = atoi(token);
|
g_TestRun.frame = atoi(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-numimages") == 0 ) {
|
else if (stricmp(token, "-numimages") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
if( token != NULL ) {
|
if (token != NULL)
|
||||||
|
{
|
||||||
g_TestRun.numimages = atoi(token);
|
g_TestRun.numimages = atoi(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-jpg") == 0 ) {
|
else if (stricmp(token, "-jpg") == 0)
|
||||||
|
{
|
||||||
g_TestRun.jpgcapture = 1;
|
g_TestRun.jpgcapture = 1;
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-gs") == 0 ) {
|
else if (stricmp(token, "-gs") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_TestRun.pgsdll = token;
|
g_TestRun.pgsdll = token;
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-cdvd") == 0 ) {
|
else if (stricmp(token, "-cdvd") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_TestRun.pcdvddll = token;
|
g_TestRun.pcdvddll = token;
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-spu") == 0 ) {
|
else if (stricmp(token, "-spu") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_TestRun.pspudll = token;
|
g_TestRun.pspudll = token;
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-test") == 0 ) {
|
else if (stricmp(token, "-test") == 0)
|
||||||
|
{
|
||||||
g_TestRun.enabled = 1;
|
g_TestRun.enabled = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if( stricmp(token, "-pad") == 0 ) {
|
else if (stricmp(token, "-pad") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
printf("-pad ignored\n");
|
printf("-pad ignored\n");
|
||||||
}
|
}
|
||||||
else if( stricmp(token, "-loadgs") == 0 ) {
|
else if (stricmp(token, "-loadgs") == 0)
|
||||||
|
{
|
||||||
token = argv[i++];
|
token = argv[i++];
|
||||||
g_pRunGSState = token;
|
g_pRunGSState = token;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
file = token;
|
file = token;
|
||||||
printf("opening file %s\n", file);
|
printf("opening file %s\n", file);
|
||||||
}
|
}
|
||||||
|
@ -143,16 +157,19 @@ int main(int argc, char *argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make gtk thread safe if using MTGS
|
// make gtk thread safe if using MTGS
|
||||||
if( CHECK_MULTIGS ) {
|
if (CHECK_MULTIGS)
|
||||||
|
{
|
||||||
g_thread_init(NULL);
|
g_thread_init(NULL);
|
||||||
gdk_threads_init();
|
gdk_threads_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UseGui) {
|
if (UseGui)
|
||||||
|
{
|
||||||
gtk_init(NULL, NULL);
|
gtk_init(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadConfig() == -1) {
|
if (LoadConfig() == -1)
|
||||||
|
{
|
||||||
|
|
||||||
memset(&Config, 0, sizeof(Config));
|
memset(&Config, 0, sizeof(Config));
|
||||||
strcpy(Config.BiosDir, DEFAULT_BIOS_DIR "/");
|
strcpy(Config.BiosDir, DEFAULT_BIOS_DIR "/");
|
||||||
|
@ -170,7 +187,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
InitLanguages();
|
InitLanguages();
|
||||||
|
|
||||||
if( Config.PsxOut ) {
|
if (Config.PsxOut)
|
||||||
|
{
|
||||||
// output the help commands
|
// output the help commands
|
||||||
Console::WriteLn("\tF1 - save state");
|
Console::WriteLn("\tF1 - save state");
|
||||||
Console::WriteLn("\t(Shift +) F2 - cycle states");
|
Console::WriteLn("\t(Shift +) F2 - cycle states");
|
||||||
|
@ -186,14 +204,16 @@ int main(int argc, char *argv[]) {
|
||||||
if (!SysInit()) return 1;
|
if (!SysInit()) return 1;
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
if( g_pRunGSState ) {
|
if (g_pRunGSState)
|
||||||
|
{
|
||||||
LoadGSState(g_pRunGSState);
|
LoadGSState(g_pRunGSState);
|
||||||
SysClose();
|
SysClose();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (UseGui && (file == NULL)) {
|
if (UseGui && (file == NULL))
|
||||||
|
{
|
||||||
StartGui();
|
StartGui();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -213,11 +233,13 @@ int main(int argc, char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitLanguages() {
|
void InitLanguages()
|
||||||
|
{
|
||||||
char *lang;
|
char *lang;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
if (Config.Lang[0] == 0) {
|
if (Config.Lang[0] == 0)
|
||||||
|
{
|
||||||
strcpy(Config.Lang, "en");
|
strcpy(Config.Lang, "en");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +247,8 @@ void InitLanguages() {
|
||||||
strcpy(langs[0].lang, "en");
|
strcpy(langs[0].lang, "en");
|
||||||
dir = opendir(LANGS_DIR);
|
dir = opendir(LANGS_DIR);
|
||||||
|
|
||||||
while ((lang = GetLanguageNext()) != NULL) {
|
while ((lang = GetLanguageNext()) != NULL)
|
||||||
|
{
|
||||||
langs = (_langs*)realloc(langs, sizeof(_langs) * (i + 1));
|
langs = (_langs*)realloc(langs, sizeof(_langs) * (i + 1));
|
||||||
strcpy(langs[i].lang, lang);
|
strcpy(langs[i].lang, lang);
|
||||||
i++;
|
i++;
|
||||||
|
@ -235,11 +258,13 @@ void InitLanguages() {
|
||||||
langsMax = i;
|
langsMax = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *GetLanguageNext() {
|
char *GetLanguageNext()
|
||||||
|
{
|
||||||
struct dirent *ent;
|
struct dirent *ent;
|
||||||
|
|
||||||
if (dir == NULL) return NULL;
|
if (dir == NULL) return NULL;
|
||||||
for (;;) {
|
for (;;)
|
||||||
|
{
|
||||||
ent = readdir(dir);
|
ent = readdir(dir);
|
||||||
if (ent == NULL) return NULL;
|
if (ent == NULL) return NULL;
|
||||||
|
|
||||||
|
@ -251,251 +276,354 @@ char *GetLanguageNext() {
|
||||||
return ent->d_name;
|
return ent->d_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseLanguages() {
|
void CloseLanguages()
|
||||||
|
{
|
||||||
if (dir) closedir(dir);
|
if (dir) closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangeLanguage(char *lang) {
|
void ChangeLanguage(char *lang)
|
||||||
|
{
|
||||||
strcpy(Config.Lang, lang);
|
strcpy(Config.Lang, lang);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Quick macros for checking shift, control, alt, and caps lock. */
|
void OnMsg_Ok()
|
||||||
#define SHIFT_EVT(evt) ((evt == XK_Shift_L) || (evt == XK_Shift_R))
|
|
||||||
#define CTRL_EVT(evt) ((evt == XK_Control_L) || (evt == XK_Control_L))
|
|
||||||
#define ALT_EVT(evt) ((evt == XK_Alt_L) || (evt == XK_Alt_R))
|
|
||||||
#define CAPS_LOCK_EVT(evt) (evt == XK_Caps_Lock)
|
|
||||||
|
|
||||||
void KeyEvent(keyEvent* ev) {
|
|
||||||
static int shift = 0;
|
|
||||||
|
|
||||||
if (ev == NULL) return;
|
|
||||||
|
|
||||||
if( GSkeyEvent != NULL ) GSkeyEvent(ev);
|
|
||||||
|
|
||||||
if (ev->evt == KEYPRESS)
|
|
||||||
{
|
{
|
||||||
if (SHIFT_EVT(ev->key))
|
|
||||||
shift = 1;
|
|
||||||
if (CAPS_LOCK_EVT(ev->key))
|
|
||||||
{
|
|
||||||
//Set up anything we want to happen while caps lock is down.
|
|
||||||
//Config_hacks_backup = Config.Hacks;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ev->key)
|
|
||||||
{
|
|
||||||
case XK_F1: case XK_F2: case XK_F3: case XK_F4:
|
|
||||||
case XK_F5: case XK_F6: case XK_F7: case XK_F8:
|
|
||||||
case XK_F9: case XK_F10: case XK_F11: case XK_F12:
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ProcessFKeys(ev->key-XK_F1 + 1, shift);
|
|
||||||
}
|
|
||||||
catch( Exception::CpuStateShutdown& )
|
|
||||||
{
|
|
||||||
// Woops! Something was unrecoverable. Bummer.
|
|
||||||
// Let's give the user a RunGui!
|
|
||||||
|
|
||||||
g_EmulationInProgress = false;
|
|
||||||
g_ReturnToGui = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case XK_Escape:
|
|
||||||
signal(SIGINT, SIG_DFL);
|
|
||||||
signal(SIGPIPE, SIG_DFL);
|
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
|
||||||
if( g_SaveGSStream >= 3 ) {
|
|
||||||
g_SaveGSStream = 4;// gs state
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ClosePlugins();
|
|
||||||
if (!UseGui) exit(0);
|
|
||||||
|
|
||||||
// fixme: The GUI is now capable of recieving control back from the
|
|
||||||
// emulator. Which means that when I set g_ReturnToGui here, the emulation
|
|
||||||
// loop in ExecuteCpu() will exit. You should be able to set it up so
|
|
||||||
// that it returns control to the existing GTK event loop, instead of
|
|
||||||
// always starting a new one via RunGui(). (but could take some trial and
|
|
||||||
// error) -- (air)
|
|
||||||
g_ReturnToGui = true;
|
|
||||||
RunGui();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
GSkeyEvent(ev);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ev->evt == KEYRELEASE)
|
|
||||||
{
|
|
||||||
if (SHIFT_EVT(ev->key))
|
|
||||||
shift = 0;
|
|
||||||
if (CAPS_LOCK_EVT(ev->key))
|
|
||||||
{
|
|
||||||
//Release caps lock
|
|
||||||
//Config_hacks_backup = Config.Hacks;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnMsg_Ok() {
|
|
||||||
gtk_widget_destroy(MsgDlg);
|
gtk_widget_destroy(MsgDlg);
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysMessage(const char *fmt, ...) {
|
|
||||||
va_list list;
|
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
va_start(list,fmt);
|
void On_Dialog_Cancelled(GtkButton* button, gpointer user_data)
|
||||||
vsnprintf(msg,511,fmt,list);
|
{
|
||||||
msg[511] = '\0';
|
gtk_widget_destroy((GtkWidget*)gtk_widget_get_toplevel((GtkWidget*)button));
|
||||||
va_end(list);
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
Msgbox::Alert(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysInit()
|
void StartGui()
|
||||||
{
|
{
|
||||||
if( sinit ) return true;
|
GtkWidget *Menu;
|
||||||
sinit = true;
|
GtkWidget *Item;
|
||||||
|
|
||||||
mkdir(SSTATES_DIR, 0755);
|
u32 i;
|
||||||
mkdir(MEMCARDS_DIR, 0755);
|
|
||||||
|
|
||||||
mkdir(LOGS_DIR, 0755);
|
add_pixmap_directory(".pixmaps");
|
||||||
|
MainWindow = create_MainWindow();
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
if (SVN_REV != 0)
|
||||||
if( g_TestRun.plogname != NULL )
|
gtk_window_set_title(GTK_WINDOW(MainWindow), "PCSX2 "PCSX2_VERSION" "SVN_REV);
|
||||||
emuLog = fopen(g_TestRun.plogname, "w");
|
else
|
||||||
if( emuLog == NULL )
|
gtk_window_set_title(GTK_WINDOW(MainWindow), "PCSX2 "PCSX2_VERSION);
|
||||||
emuLog = fopen(LOGS_DIR "/emuLog.txt","wb");
|
|
||||||
|
// status bar
|
||||||
|
pStatusBar = gtk_statusbar_new();
|
||||||
|
gtk_box_pack_start(GTK_BOX(lookup_widget(MainWindow, "status_box")), pStatusBar, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_show(pStatusBar);
|
||||||
|
|
||||||
|
gtk_statusbar_push(GTK_STATUSBAR(pStatusBar), 0,
|
||||||
|
"F1 - save, F2 - next state, Shift+F2 - prev state, F3 - load, F8 - snapshot");
|
||||||
|
|
||||||
|
// add all the languages
|
||||||
|
Item = lookup_widget(MainWindow, "GtkMenuItem_Language");
|
||||||
|
Menu = gtk_menu_new();
|
||||||
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(Item), Menu);
|
||||||
|
|
||||||
|
for (i = 0; i < langsMax; i++)
|
||||||
|
{
|
||||||
|
Item = gtk_check_menu_item_new_with_label(ParseLang(langs[i].lang));
|
||||||
|
gtk_widget_show(Item);
|
||||||
|
gtk_container_add(GTK_CONTAINER(Menu), Item);
|
||||||
|
gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(Item), TRUE);
|
||||||
|
if (!strcmp(Config.Lang, langs[i].lang))
|
||||||
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item), TRUE);
|
||||||
|
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Item), "activate",
|
||||||
|
GTK_SIGNAL_FUNC(OnLanguage),
|
||||||
|
(gpointer)(uptr)i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the appropriate menu items
|
||||||
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(MainWindow, "enable_console1")), Config.PsxOut);
|
||||||
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(MainWindow, "enable_patches1")), Config.Patch);
|
||||||
|
|
||||||
|
// disable anything not implemented or not working properly.
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(MainWindow, "patch_browser1")), FALSE);
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(MainWindow, "patch_finder2")), FALSE);
|
||||||
|
#ifndef PCSX2_DEVBUILD
|
||||||
|
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget(MainWindow, "GtkMenuItem_Logging")), FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( emuLog != NULL )
|
gtk_widget_show_all(MainWindow);
|
||||||
setvbuf(emuLog, NULL, _IONBF, 0);
|
gtk_window_activate_focus(GTK_WINDOW(MainWindow));
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
PCSX2_MEM_PROTECT_BEGIN();
|
void RunGui()
|
||||||
SysDetect();
|
|
||||||
if( !SysAllocateMem() )
|
|
||||||
return false; // critical memory allocation failure;
|
|
||||||
|
|
||||||
SysAllocateDynarecs();
|
|
||||||
PCSX2_MEM_PROTECT_END();
|
|
||||||
|
|
||||||
while (LoadPlugins() == -1) {
|
|
||||||
if (Pcsx2Configure() == FALSE)
|
|
||||||
{
|
{
|
||||||
Msgbox::Alert("Configuration failed. Exiting.");
|
StartGui();
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
void FixCPUState(void)
|
||||||
}
|
|
||||||
|
|
||||||
void SysRestorableReset()
|
|
||||||
{
|
{
|
||||||
// already reset? and saved?
|
//Config.sseMXCSR = LinuxsseMXCSR;
|
||||||
if( !g_EmulationInProgress ) return;
|
//Config.sseVUMXCSR = LinuxsseVUMXCSR;
|
||||||
if( g_RecoveryState != NULL ) return;
|
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
g_RecoveryState = new MemoryAlloc<u8>( "Memory Savestate Recovery" );
|
|
||||||
memSavingState( *g_RecoveryState ).FreezeAll();
|
|
||||||
cpuShutdown();
|
|
||||||
g_EmulationInProgress = false;
|
|
||||||
}
|
|
||||||
catch( Exception::RuntimeError& ex )
|
|
||||||
{
|
|
||||||
Msgbox::Alert(
|
|
||||||
"Pcsx2 gamestate recovery failed. Some options may have been reverted to protect your game's state.\n"
|
|
||||||
"Error: %s", params ex.cMessage() );
|
|
||||||
safe_delete( g_RecoveryState );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysReset()
|
void OnDestroy(GtkObject *object, gpointer user_data) {}
|
||||||
{
|
|
||||||
if (!sinit) return;
|
|
||||||
|
|
||||||
g_EmulationInProgress = false;
|
gboolean OnDelete(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||||
|
{
|
||||||
|
pcsx2_exit();
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
int Pcsx2Configure()
|
||||||
|
{
|
||||||
|
if (!UseGui) return 0;
|
||||||
|
|
||||||
|
configuringplug = TRUE;
|
||||||
|
MainWindow = NULL;
|
||||||
|
OnConf_Conf(NULL, 0);
|
||||||
|
configuringplug = FALSE;
|
||||||
|
|
||||||
|
return applychanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnLanguage(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
ChangeLanguage(langs[(int)(uptr)user_data].lang);
|
||||||
|
gtk_widget_destroy(MainWindow);
|
||||||
|
gtk_main_quit();
|
||||||
|
while (gtk_events_pending()) gtk_main_iteration();
|
||||||
|
StartGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
safe_free(g_RecoveryState);
|
safe_free(g_RecoveryState);
|
||||||
|
|
||||||
ResetPlugins();
|
ResetPlugins();
|
||||||
|
RunExecute(NULL);
|
||||||
ElfCRC = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysClose() {
|
void OnRunElf_Ok(GtkButton* button, gpointer user_data)
|
||||||
if (sinit == 0) return;
|
{
|
||||||
cpuShutdown();
|
gchar *File;
|
||||||
|
|
||||||
|
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||||
|
strcpy(elfname, File);
|
||||||
|
gtk_widget_destroy(FileSel);
|
||||||
|
|
||||||
|
RunExecute(elfname);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnRunElf_Cancel(GtkButton* button, gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy(FileSel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnFile_LoadElf(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *Ok, *Cancel;
|
||||||
|
|
||||||
|
FileSel = gtk_file_selection_new("Select Psx Elf File");
|
||||||
|
|
||||||
|
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnRunElf_Ok), NULL);
|
||||||
|
gtk_widget_show(Ok);
|
||||||
|
|
||||||
|
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnRunElf_Cancel), NULL);
|
||||||
|
gtk_widget_show(Cancel);
|
||||||
|
|
||||||
|
gtk_widget_show(FileSel);
|
||||||
|
gdk_window_raise(FileSel->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pcsx2_exit()
|
||||||
|
{
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent *ent;
|
||||||
|
void *Handle;
|
||||||
|
char plugin[g_MaxPath];
|
||||||
|
|
||||||
|
// with this the problem with plugins that are linked with the pthread
|
||||||
|
// library is solved
|
||||||
|
|
||||||
|
dir = opendir(Config.PluginsDir);
|
||||||
|
if (dir != NULL)
|
||||||
|
{
|
||||||
|
while ((ent = readdir(dir)) != NULL)
|
||||||
|
{
|
||||||
|
sprintf(plugin, "%s%s", Config.PluginsDir, ent->d_name);
|
||||||
|
|
||||||
|
if (strstr(plugin, ".so") == NULL) continue;
|
||||||
|
Handle = dlopen(plugin, RTLD_NOW);
|
||||||
|
if (Handle == NULL) continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("PCSX2 Quitting\n");
|
||||||
|
|
||||||
|
if (UseGui)
|
||||||
|
{
|
||||||
|
gtk_main_quit();
|
||||||
|
SysClose();
|
||||||
|
gtk_exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SysClose();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalExit(int sig)
|
||||||
|
{
|
||||||
ClosePlugins();
|
ClosePlugins();
|
||||||
ReleasePlugins();
|
pcsx2_exit();
|
||||||
|
}
|
||||||
|
|
||||||
if (emuLog != NULL)
|
void OnFile_Exit(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
fclose(emuLog);
|
pcsx2_exit();
|
||||||
emuLog = NULL;
|
|
||||||
}
|
|
||||||
sinit=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysPrintf(const char *fmt, ...) {
|
void OnEmu_Run(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
va_list list;
|
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
va_start(list,fmt);
|
|
||||||
vsnprintf(msg,511,fmt,list);
|
|
||||||
msg[511] = '\0';
|
|
||||||
va_end(list);
|
|
||||||
|
|
||||||
Console::Write( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
void *SysLoadLibrary(const char *lib) {
|
|
||||||
return dlopen(lib, RTLD_NOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *SysLoadSym(void *lib, const char *sym) {
|
|
||||||
return dlsym(lib, sym);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *SysLibError() {
|
|
||||||
return dlerror();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SysCloseLibrary(void *lib) {
|
|
||||||
dlclose(lib);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SysUpdate() {
|
|
||||||
KeyEvent(PAD1keyEvent());
|
|
||||||
KeyEvent(PAD2keyEvent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SysRunGui() {
|
|
||||||
RunGui();
|
|
||||||
}
|
|
||||||
|
|
||||||
void *SysMmap(uptr base, u32 size)
|
|
||||||
{
|
{
|
||||||
u8 *Mem;
|
if (g_EmulationInProgress)
|
||||||
Mem = mmap((uptr*)base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
ExecuteCpu();
|
||||||
if (Mem == MAP_FAILED) Console::Notice("Mmap Failed!");
|
else
|
||||||
|
RunExecute(NULL, true); // boots bios if no savestate is to be recovered
|
||||||
|
|
||||||
return Mem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysMunmap(uptr base, u32 size)
|
void OnEmu_Reset(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
munmap((uptr*)base, size);
|
SysReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ResetMenuSlots(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *Item;
|
||||||
|
char str[g_MaxPath];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
sprintf(str, "GtkMenuItem_LoadSlot%d", i + 1);
|
||||||
|
Item = lookup_widget(MainWindow, str);
|
||||||
|
if (Slots[i] == -1)
|
||||||
|
gtk_widget_set_sensitive(Item, FALSE);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive(Item, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void UpdateMenuSlots(GtkMenuItem *menuitem, gpointer user_data) {
|
||||||
|
char str[g_MaxPath];
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (i=0; i<5; i++) {
|
||||||
|
sprintf(str, SSTATES_DIR "/%8.8X.%3.3d", ElfCRC, i);
|
||||||
|
Slots[i] = CheckState(str);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//2002-09-28 (Florin)
|
||||||
|
void OnArguments_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
str = (char*)gtk_entry_get_text(GTK_ENTRY(widgetCmdLine));
|
||||||
|
memcpy(args, str, g_MaxPath);
|
||||||
|
|
||||||
|
gtk_widget_destroy(CmdLine);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnEmu_Arguments(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *widgetCmdLine;
|
||||||
|
|
||||||
|
CmdLine = create_CmdLine();
|
||||||
|
gtk_window_set_title(GTK_WINDOW(CmdLine), _("Program arguments"));
|
||||||
|
|
||||||
|
widgetCmdLine = lookup_widget(CmdLine, "GtkEntry_dCMDLINE");
|
||||||
|
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(widgetCmdLine), args);
|
||||||
|
gtk_widget_show_all(CmdLine);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnLogging_Ok(GtkButton *button, gpointer user_data)
|
||||||
|
{
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
GtkWidget *Btn;
|
||||||
|
char str[32];
|
||||||
|
int i, ret;
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
if (((i > 16) && (i < 20)) || (i == 29))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sprintf(str, "Log%d", i);
|
||||||
|
Btn = lookup_widget(LogDlg, str);
|
||||||
|
ret = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Btn));
|
||||||
|
if (ret) varLog |= 1 << i;
|
||||||
|
else varLog &= ~(1 << i);
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveConfig();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gtk_widget_destroy(LogDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, TRUE);
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDebug_Logging(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *Btn;
|
||||||
|
char str[32];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
LogDlg = create_Logging();
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
if (((i > 16) && (i < 20)) || (i == 29))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sprintf(str, "Log%d", i);
|
||||||
|
Btn = lookup_widget(LogDlg, str);
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(Btn), varLog & (1 << i));
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_show_all(LogDlg);
|
||||||
|
gtk_widget_set_sensitive(MainWindow, FALSE);
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_patch_browser1_activate(GtkMenuItem *menuitem, gpointer user_data) {}
|
||||||
|
|
||||||
|
void on_patch_finder2_activate(GtkMenuItem *menuitem, gpointer user_data) {}
|
||||||
|
|
||||||
|
void on_enable_console1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
Config.PsxOut = (int)gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
|
||||||
|
SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_enable_patches1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
Config.Patch = (int)gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
|
||||||
|
SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,45 @@
|
||||||
|
|
||||||
#include "Linux.h"
|
#include "Linux.h"
|
||||||
|
|
||||||
char* g_pRunGSState = NULL;
|
extern char* g_pRunGSState;
|
||||||
|
|
||||||
|
void SignalExit(int sig);
|
||||||
|
bool applychanges = FALSE;
|
||||||
|
bool configuringplug = FALSE;
|
||||||
|
extern bool UseGui;
|
||||||
|
|
||||||
|
extern MemoryAlloc<u8>* g_RecoveryState;
|
||||||
|
extern bool g_ReturnToGui; // set to exit the execution of the emulator and return control to the GUI
|
||||||
|
extern bool g_EmulationInProgress; // Set TRUE if a game is actively running (set to false on reset)
|
||||||
|
|
||||||
|
int efile = 0;
|
||||||
|
char elfname[g_MaxPath];
|
||||||
|
int Slots[5] = { -1, -1, -1, -1, -1 };
|
||||||
|
|
||||||
|
GtkWidget *CpuDlg;
|
||||||
|
|
||||||
|
// Functions Callbacks
|
||||||
|
void OnFile_LoadElf(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void OnFile_Exit(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void OnEmu_Run(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void OnEmu_Reset(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void OnEmu_Arguments(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void OnLanguage(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void OnHelp_Help();
|
||||||
|
void OnHelp_About(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
void ExecuteCpu();
|
||||||
|
|
||||||
|
void StartGui();
|
||||||
|
void pcsx2_exit();
|
||||||
|
GtkWidget *MainWindow;
|
||||||
|
GtkWidget *pStatusBar = NULL, *Status_Box;
|
||||||
|
GtkWidget *CmdLine; //2002-09-28 (Florin)
|
||||||
|
GtkWidget *widgetCmdLine;
|
||||||
|
GtkWidget *LogDlg;
|
||||||
|
|
||||||
|
void init_widgets();
|
||||||
|
|
||||||
|
GtkAccelGroup *AccelGroup;
|
||||||
|
|
||||||
const char* phelpmsg =
|
const char* phelpmsg =
|
||||||
"\tpcsx2 [options] [file]\n\n"
|
"\tpcsx2 [options] [file]\n\n"
|
||||||
|
@ -50,4 +88,3 @@ const char* phelpmsg =
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,792 @@
|
||||||
|
/* Pcsx2 - Pc Ps2 Emulator
|
||||||
|
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Linux.h"
|
||||||
|
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
bool UseGui = true;
|
||||||
|
|
||||||
|
MemoryAlloc<u8>* g_RecoveryState = NULL;
|
||||||
|
MemoryAlloc<u8>* g_gsRecoveryState = NULL;
|
||||||
|
const char* g_pRunGSState = NULL;
|
||||||
|
|
||||||
|
bool g_ReturnToGui = false; // set to exit the execution of the emulator and return control to the GUI
|
||||||
|
bool g_EmulationInProgress = false; // Set TRUE if a game is actively running (set to false on reset)
|
||||||
|
|
||||||
|
static bool sinit = false;
|
||||||
|
GtkWidget *FileSel;
|
||||||
|
|
||||||
|
void SysPrintf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vsnprintf(msg, 511, fmt, list);
|
||||||
|
msg[511] = '\0';
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
Console::Write(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeyEvent(keyEvent* ev);
|
||||||
|
|
||||||
|
void SysUpdate()
|
||||||
|
{
|
||||||
|
KeyEvent(PAD1keyEvent());
|
||||||
|
KeyEvent(PAD2keyEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TryRecoverFromGsState()
|
||||||
|
{
|
||||||
|
if( g_gsRecoveryState != NULL )
|
||||||
|
{
|
||||||
|
s32 dummylen;
|
||||||
|
|
||||||
|
memLoadingState eddie( *g_gsRecoveryState );
|
||||||
|
eddie.FreezePlugin( "GS", gsSafeFreeze );
|
||||||
|
eddie.Freeze( dummylen ); // reads the length value recorded earlier.
|
||||||
|
eddie.gsFreeze();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecuteCpu()
|
||||||
|
{
|
||||||
|
// Make sure any left-over recovery states are cleaned up.
|
||||||
|
safe_delete( g_RecoveryState );
|
||||||
|
|
||||||
|
// Just in case they weren't initialized earlier (no harm in calling this multiple times)
|
||||||
|
if (OpenPlugins(NULL) == -1) return;
|
||||||
|
|
||||||
|
// this needs to be called for every new game!
|
||||||
|
// (note: sometimes launching games through bios will give a crc of 0)
|
||||||
|
|
||||||
|
if( GSsetGameCRC != NULL ) GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
|
||||||
|
|
||||||
|
TryRecoverFromGsState();
|
||||||
|
|
||||||
|
safe_delete( g_gsRecoveryState );
|
||||||
|
|
||||||
|
// Destroy the window. Ugly thing.
|
||||||
|
gtk_widget_destroy(MainWindow);
|
||||||
|
gtk_main_quit();
|
||||||
|
|
||||||
|
while (gtk_events_pending()) gtk_main_iteration();
|
||||||
|
|
||||||
|
g_EmulationInProgress = true;
|
||||||
|
g_ReturnToGui = false;
|
||||||
|
|
||||||
|
signal(SIGINT, SignalExit);
|
||||||
|
signal(SIGPIPE, SignalExit);
|
||||||
|
|
||||||
|
// Optimization: We hardcode two versions of the EE here -- one for recs and one for ints.
|
||||||
|
// This is because recs are performance critical, and being able to inline them into the
|
||||||
|
// function here helps a small bit (not much but every small bit counts!).
|
||||||
|
|
||||||
|
if (CHECK_EEREC)
|
||||||
|
{
|
||||||
|
while (!g_ReturnToGui)
|
||||||
|
{
|
||||||
|
recExecute();
|
||||||
|
SysUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (!g_ReturnToGui)
|
||||||
|
{
|
||||||
|
Cpu->Execute();
|
||||||
|
SysUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Runs an ELF image directly (ISO or ELF program or BIN)
|
||||||
|
// Used by Run::FromCD and such
|
||||||
|
void RunExecute(const char* elf_file, bool use_bios)
|
||||||
|
{
|
||||||
|
|
||||||
|
// (air notes:)
|
||||||
|
// If you want to use the new to-memory savestate feature, take a look at the new
|
||||||
|
// RunExecute in WinMain.c, and secondly the CpuDlg.c or AdvancedDlg.cpp. The
|
||||||
|
// objects used are MemoryAlloc, memLoadingState, and memSavingState.
|
||||||
|
|
||||||
|
// It's important to make sure to reset the CPU and the plugins correctly, which is
|
||||||
|
// where the new RunExecute comes into play. It can be kind of tricky knowing
|
||||||
|
// when to call cpuExecuteBios and loadElfFile, and with what parameters.
|
||||||
|
|
||||||
|
// (or, as an alternative maybe we should switch to wxWidgets and have a unified
|
||||||
|
// cross platform gui?) - Air
|
||||||
|
|
||||||
|
// Sounds like a good idea, at this point.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cpuReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
catch( Exception::BaseException& ex )
|
||||||
|
{
|
||||||
|
Msgbox::Alert( ex.cMessage() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OpenPlugins(NULL) == -1)
|
||||||
|
{
|
||||||
|
RunGui();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elf_file == NULL)
|
||||||
|
{
|
||||||
|
if (g_RecoveryState != NULL)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
memLoadingState(*g_RecoveryState).FreezeAll();
|
||||||
|
}
|
||||||
|
catch (std::runtime_error& ex)
|
||||||
|
{
|
||||||
|
Msgbox::Alert(
|
||||||
|
"Gamestate recovery failed. Your game progress will be lost (sorry!)\n"
|
||||||
|
"\nError: %s\n", params ex.what());
|
||||||
|
|
||||||
|
// Take the user back to the GUI...
|
||||||
|
safe_delete(g_RecoveryState);
|
||||||
|
ClosePlugins();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
safe_delete(g_RecoveryState);
|
||||||
|
}
|
||||||
|
else if( g_gsRecoveryState == NULL )
|
||||||
|
{
|
||||||
|
// Not recovering a state, so need to execute the bios and load the ELF information.
|
||||||
|
|
||||||
|
// if the elf_file is null we use the CDVD elf file.
|
||||||
|
// But if the elf_file is an empty string then we boot the bios instead.
|
||||||
|
|
||||||
|
char ename[g_MaxPath];
|
||||||
|
ename[0] = 0;
|
||||||
|
|
||||||
|
if (!use_bios) GetPS2ElfName(ename);
|
||||||
|
loadElfFile(ename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Custom ELF specified (not using CDVD).
|
||||||
|
// Run the BIOS and load the ELF.
|
||||||
|
|
||||||
|
loadElfFile(elf_file);
|
||||||
|
}
|
||||||
|
//FixCPUState();
|
||||||
|
ExecuteCpu();
|
||||||
|
}
|
||||||
|
|
||||||
|
class RecoveryMemSavingState : public memSavingState, Sealed
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~RecoveryMemSavingState() { }
|
||||||
|
RecoveryMemSavingState() : memSavingState( *g_RecoveryState )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void gsFreeze()
|
||||||
|
{
|
||||||
|
if (g_gsRecoveryState != NULL)
|
||||||
|
{
|
||||||
|
// just copy the data from src to dst.
|
||||||
|
// the normal savestate doesn't expect a length prefix for internal structures,
|
||||||
|
// so don't copy that part.
|
||||||
|
const u32 pluginlen = *((u32*)g_gsRecoveryState->GetPtr());
|
||||||
|
const u32 gslen = *((u32*)g_gsRecoveryState->GetPtr(pluginlen+4));
|
||||||
|
memcpy( m_memory.GetPtr(m_idx), g_gsRecoveryState->GetPtr(pluginlen+8), gslen );
|
||||||
|
m_idx += gslen;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
memSavingState::gsFreeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreezePlugin( const char* name, s32 (CALLBACK* freezer)(int mode, freezeData *data) )
|
||||||
|
{
|
||||||
|
if ((freezer == gsSafeFreeze) && (g_gsRecoveryState != NULL))
|
||||||
|
{
|
||||||
|
// Gs data is already in memory, so just copy from src to dest:
|
||||||
|
// length of the GS data is stored as the first u32, so use that to run the copy:
|
||||||
|
const u32 len = *((u32*)g_gsRecoveryState->GetPtr());
|
||||||
|
memcpy( m_memory.GetPtr(m_idx), g_gsRecoveryState->GetPtr(), len+4 );
|
||||||
|
m_idx += len+4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
memSavingState::FreezePlugin( name, freezer );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class RecoveryZipSavingState : public gzSavingState, Sealed
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~RecoveryZipSavingState() { }
|
||||||
|
RecoveryZipSavingState( const string& filename ) : gzSavingState( filename )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void gsFreeze()
|
||||||
|
{
|
||||||
|
if (g_gsRecoveryState != NULL)
|
||||||
|
{
|
||||||
|
// read data from the gsRecoveryState allocation instead of the GS, since the gs
|
||||||
|
// info was invalidated when the plugin was shut down.
|
||||||
|
|
||||||
|
// the normal savestate doesn't expect a length prefix for internal structures,
|
||||||
|
// so don't copy that part.
|
||||||
|
|
||||||
|
u32& pluginlen = *((u32*)g_gsRecoveryState->GetPtr(0));
|
||||||
|
u32& gslen = *((u32*)g_gsRecoveryState->GetPtr(pluginlen+4));
|
||||||
|
gzwrite( m_file, g_gsRecoveryState->GetPtr(pluginlen+4), gslen );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gzSavingState::gsFreeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreezePlugin( const char* name, s32 (CALLBACK* freezer)(int mode, freezeData *data) )
|
||||||
|
{
|
||||||
|
if ((freezer == gsSafeFreeze) && (g_gsRecoveryState != NULL))
|
||||||
|
{
|
||||||
|
// Gs data is already in memory, so just copy from there into the gzip file.
|
||||||
|
// length of the GS data is stored as the first u32, so use that to run the copy:
|
||||||
|
u32& len = *((u32*)g_gsRecoveryState->GetPtr());
|
||||||
|
gzwrite( m_file, g_gsRecoveryState->GetPtr(), len+4 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gzSavingState::FreezePlugin( name, freezer );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void States_Load(const string& file, int num = -1)
|
||||||
|
{
|
||||||
|
if( !Path::isFile( file ) )
|
||||||
|
{
|
||||||
|
Console::Notice( "Saveslot %d is empty.", params num );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
char Text[g_MaxPath];
|
||||||
|
gzLoadingState joe( file ); // this'll throw an StateLoadError_Recoverable.
|
||||||
|
|
||||||
|
// Make sure the cpu and plugins are ready to be state-ified!
|
||||||
|
cpuReset();
|
||||||
|
OpenPlugins( NULL );
|
||||||
|
|
||||||
|
joe.FreezeAll();
|
||||||
|
|
||||||
|
if( num != -1 )
|
||||||
|
sprintf (Text, _("*PCSX2*: Loaded State %d"), num);
|
||||||
|
else
|
||||||
|
sprintf (Text, _("*PCSX2*: Loaded State %s"), file.c_str());
|
||||||
|
|
||||||
|
//StatusBar_Notice( Text );
|
||||||
|
Console::Notice(Text);
|
||||||
|
|
||||||
|
if( GSsetGameCRC != NULL ) GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
|
||||||
|
}
|
||||||
|
catch( Exception::StateLoadError_Recoverable& ex)
|
||||||
|
{
|
||||||
|
if( num != -1 )
|
||||||
|
Console::Notice( "Could not load savestate from slot %d.\n\n%s", params num, ex.cMessage() );
|
||||||
|
else
|
||||||
|
Console::Notice( "Could not load savestate file: %s.\n\n%s", params file.c_str(), ex.cMessage() );
|
||||||
|
|
||||||
|
// At this point the cpu hasn't been reset, so we can return
|
||||||
|
// control to the user safely... (that's why we use a console notice instead of a popup)
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch( Exception::BaseException& ex )
|
||||||
|
{
|
||||||
|
// The emulation state is ruined. Might as well give them a popup and start the gui.
|
||||||
|
|
||||||
|
string message;
|
||||||
|
|
||||||
|
if( num != -1 )
|
||||||
|
ssprintf( message,
|
||||||
|
"Encountered an error while loading savestate from slot %d.\n", num );
|
||||||
|
else
|
||||||
|
ssprintf( message,
|
||||||
|
"Encountered an error while loading savestate from file: %s.\n", file.c_str() );
|
||||||
|
|
||||||
|
if( g_EmulationInProgress )
|
||||||
|
message += "Since the savestate load was incomplete, the emulator has been reset.\n";
|
||||||
|
|
||||||
|
message += "\nError: " + ex.Message();
|
||||||
|
|
||||||
|
Msgbox::Alert( message.c_str() );
|
||||||
|
SysClose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start emulating!
|
||||||
|
ExecuteCpu();
|
||||||
|
}
|
||||||
|
|
||||||
|
void States_Load(int num)
|
||||||
|
{
|
||||||
|
States_Load( SaveState::GetFilename( num ), num );
|
||||||
|
}
|
||||||
|
|
||||||
|
void States_Save( const string& file, int num = -1 )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string text;
|
||||||
|
RecoveryZipSavingState( file ).FreezeAll();
|
||||||
|
if( num != -1 )
|
||||||
|
ssprintf( text, _( "State saved to slot %d" ), num );
|
||||||
|
else
|
||||||
|
ssprintf( text, _( "State saved to file: %s" ), file.c_str() );
|
||||||
|
|
||||||
|
Console::Notice(text.c_str());
|
||||||
|
}
|
||||||
|
catch( Exception::BaseException& ex )
|
||||||
|
{
|
||||||
|
string message;
|
||||||
|
|
||||||
|
if( num != -1 )
|
||||||
|
ssprintf( message, "An error occurred while trying to save to slot %d\n", num );
|
||||||
|
else
|
||||||
|
ssprintf( message, "An error occurred while trying to save to file: %s\n", file.c_str() );
|
||||||
|
|
||||||
|
message += "Your emulation state has not been saved!\n\nError: " + ex.Message();
|
||||||
|
|
||||||
|
Console::Error( message.c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void States_Save(int num)
|
||||||
|
{
|
||||||
|
if( g_RecoveryState != NULL )
|
||||||
|
{
|
||||||
|
// State is already saved into memory, and the emulator (and in-progress flag)
|
||||||
|
// have likely been cleared out. So save from the Recovery buffer instead of
|
||||||
|
// doing a "standard" save:
|
||||||
|
|
||||||
|
string text;
|
||||||
|
SaveState::GetFilename( text, num );
|
||||||
|
gzFile fileptr = gzopen( text.c_str(), "wb" );
|
||||||
|
if( fileptr == NULL )
|
||||||
|
{
|
||||||
|
Msgbox::Alert( _("File permissions error while trying to save to slot %d"), params num );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gzwrite( fileptr, &g_SaveVersion, sizeof( u32 ) );
|
||||||
|
gzwrite( fileptr, g_RecoveryState->GetPtr(), g_RecoveryState->GetSizeInBytes() );
|
||||||
|
gzclose( fileptr );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !g_EmulationInProgress )
|
||||||
|
{
|
||||||
|
Msgbox::Alert( "You need to start a game first before you can save it's state." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
States_Save( SaveState::GetFilename( num ), num );
|
||||||
|
}
|
||||||
|
|
||||||
|
class JustGsSavingState : public memSavingState, Sealed
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~JustGsSavingState() { }
|
||||||
|
JustGsSavingState() : memSavingState( *g_gsRecoveryState )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// This special override saves the gs info to m_idx+4, and then goes back and
|
||||||
|
// writes in the length of data saved.
|
||||||
|
void gsFreeze()
|
||||||
|
{
|
||||||
|
int oldmidx = m_idx;
|
||||||
|
m_idx += 4;
|
||||||
|
memSavingState::gsFreeze();
|
||||||
|
if( IsSaving() )
|
||||||
|
{
|
||||||
|
s32& len = *((s32*)m_memory.GetPtr( oldmidx ));
|
||||||
|
len = (m_idx - oldmidx)-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void OnStates_Load1(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Load(0);
|
||||||
|
}
|
||||||
|
void OnStates_Load2(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Load(1);
|
||||||
|
}
|
||||||
|
void OnStates_Load3(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Load(2);
|
||||||
|
}
|
||||||
|
void OnStates_Load4(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Load(3);
|
||||||
|
}
|
||||||
|
void OnStates_Load5(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Load(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnLoadOther_Ok(GtkButton* button, gpointer user_data)
|
||||||
|
{
|
||||||
|
gchar *File;
|
||||||
|
char str[g_MaxPath];
|
||||||
|
|
||||||
|
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||||
|
strcpy(str, File);
|
||||||
|
gtk_widget_destroy(FileSel);
|
||||||
|
|
||||||
|
States_Load(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnLoadOther_Cancel(GtkButton* button, gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy(FileSel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnStates_LoadOther(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *Ok, *Cancel;
|
||||||
|
|
||||||
|
FileSel = gtk_file_selection_new(_("Select State File"));
|
||||||
|
gtk_file_selection_set_filename(GTK_FILE_SELECTION(FileSel), SSTATES_DIR "/");
|
||||||
|
|
||||||
|
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnLoadOther_Ok), NULL);
|
||||||
|
gtk_widget_show(Ok);
|
||||||
|
|
||||||
|
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnLoadOther_Cancel), NULL);
|
||||||
|
gtk_widget_show(Cancel);
|
||||||
|
|
||||||
|
gtk_widget_show(FileSel);
|
||||||
|
gdk_window_raise(FileSel->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnStates_Save1(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Save(0);
|
||||||
|
}
|
||||||
|
void OnStates_Save2(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Save(1);
|
||||||
|
}
|
||||||
|
void OnStates_Save3(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Save(2);
|
||||||
|
}
|
||||||
|
void OnStates_Save4(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Save(3);
|
||||||
|
}
|
||||||
|
void OnStates_Save5(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
States_Save(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSaveOther_Ok(GtkButton* button, gpointer user_data)
|
||||||
|
{
|
||||||
|
gchar *File;
|
||||||
|
char str[g_MaxPath];
|
||||||
|
|
||||||
|
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||||
|
strcpy(str, File);
|
||||||
|
gtk_widget_destroy(FileSel);
|
||||||
|
|
||||||
|
States_Save(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSaveOther_Cancel(GtkButton* button, gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy(FileSel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnStates_SaveOther(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *Ok, *Cancel;
|
||||||
|
|
||||||
|
FileSel = gtk_file_selection_new(_("Select State File"));
|
||||||
|
gtk_file_selection_set_filename(GTK_FILE_SELECTION(FileSel), SSTATES_DIR "/");
|
||||||
|
|
||||||
|
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnSaveOther_Ok), NULL);
|
||||||
|
gtk_widget_show(Ok);
|
||||||
|
|
||||||
|
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
||||||
|
gtk_signal_connect(GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnSaveOther_Cancel), NULL);
|
||||||
|
gtk_widget_show(Cancel);
|
||||||
|
|
||||||
|
gtk_widget_show(FileSel);
|
||||||
|
gdk_window_raise(FileSel->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quick macros for checking shift, control, alt, and caps lock. */
|
||||||
|
#define SHIFT_EVT(evt) ((evt == XK_Shift_L) || (evt == XK_Shift_R))
|
||||||
|
#define CTRL_EVT(evt) ((evt == XK_Control_L) || (evt == XK_Control_L))
|
||||||
|
#define ALT_EVT(evt) ((evt == XK_Alt_L) || (evt == XK_Alt_R))
|
||||||
|
#define CAPS_LOCK_EVT(evt) (evt == XK_Caps_Lock)
|
||||||
|
|
||||||
|
void KeyEvent(keyEvent* ev)
|
||||||
|
{
|
||||||
|
static int shift = 0;
|
||||||
|
|
||||||
|
if (ev == NULL) return;
|
||||||
|
|
||||||
|
if (GSkeyEvent != NULL) GSkeyEvent(ev);
|
||||||
|
|
||||||
|
if (ev->evt == KEYPRESS)
|
||||||
|
{
|
||||||
|
if (SHIFT_EVT(ev->key))
|
||||||
|
shift = 1;
|
||||||
|
if (CAPS_LOCK_EVT(ev->key))
|
||||||
|
{
|
||||||
|
//Set up anything we want to happen while caps lock is down.
|
||||||
|
//Config_hacks_backup = Config.Hacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (ev->key)
|
||||||
|
{
|
||||||
|
case XK_F1:
|
||||||
|
case XK_F2:
|
||||||
|
case XK_F3:
|
||||||
|
case XK_F4:
|
||||||
|
case XK_F5:
|
||||||
|
case XK_F6:
|
||||||
|
case XK_F7:
|
||||||
|
case XK_F8:
|
||||||
|
case XK_F9:
|
||||||
|
case XK_F10:
|
||||||
|
case XK_F11:
|
||||||
|
case XK_F12:
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ProcessFKeys(ev->key - XK_F1 + 1, shift);
|
||||||
|
}
|
||||||
|
catch (Exception::CpuStateShutdown&)
|
||||||
|
{
|
||||||
|
// Woops! Something was unrecoverable. Bummer.
|
||||||
|
// Let's give the user a RunGui!
|
||||||
|
|
||||||
|
g_EmulationInProgress = false;
|
||||||
|
g_ReturnToGui = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XK_Escape:
|
||||||
|
signal(SIGINT, SIG_DFL);
|
||||||
|
signal(SIGPIPE, SIG_DFL);
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
if (g_SaveGSStream >= 3)
|
||||||
|
{
|
||||||
|
g_SaveGSStream = 4;// gs state
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if( Config.closeGSonEsc )
|
||||||
|
{
|
||||||
|
safe_delete( g_gsRecoveryState );
|
||||||
|
safe_delete( g_RecoveryState );
|
||||||
|
g_gsRecoveryState = new MemoryAlloc<u8>();
|
||||||
|
JustGsSavingState eddie;
|
||||||
|
eddie.FreezePlugin( "GS", gsSafeFreeze ) ;
|
||||||
|
eddie.gsFreeze();
|
||||||
|
PluginsResetGS();
|
||||||
|
}
|
||||||
|
|
||||||
|
ClosePlugins();
|
||||||
|
|
||||||
|
if (!UseGui) exit(0);
|
||||||
|
|
||||||
|
// fixme: The GUI is now capable of recieving control back from the
|
||||||
|
// emulator. Which means that when I set g_ReturnToGui here, the emulation
|
||||||
|
// loop in ExecuteCpu() will exit. You should be able to set it up so
|
||||||
|
// that it returns control to the existing GTK event loop, instead of
|
||||||
|
// always starting a new one via RunGui(). (but could take some trial and
|
||||||
|
// error) -- (air)
|
||||||
|
|
||||||
|
// Easier said then done; running gtk in two threads at the same time can't be
|
||||||
|
// done, and working around that is pretty fiddly.
|
||||||
|
g_ReturnToGui = true;
|
||||||
|
RunGui();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
GSkeyEvent(ev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ev->evt == KEYRELEASE)
|
||||||
|
{
|
||||||
|
if (SHIFT_EVT(ev->key))
|
||||||
|
shift = 0;
|
||||||
|
if (CAPS_LOCK_EVT(ev->key))
|
||||||
|
{
|
||||||
|
//Release caps lock
|
||||||
|
//Config_hacks_backup = Config.Hacks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SysRestorableReset()
|
||||||
|
{
|
||||||
|
// already reset? and saved?
|
||||||
|
if( !g_EmulationInProgress ) return;
|
||||||
|
if( g_RecoveryState != NULL ) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_RecoveryState = new MemoryAlloc<u8>( "Memory Savestate Recovery" );
|
||||||
|
RecoveryMemSavingState().FreezeAll();
|
||||||
|
safe_delete( g_gsRecoveryState );
|
||||||
|
g_EmulationInProgress = false;
|
||||||
|
}
|
||||||
|
catch( Exception::RuntimeError& ex )
|
||||||
|
{
|
||||||
|
Msgbox::Alert(
|
||||||
|
"Pcsx2 gamestate recovery failed. Some options may have been reverted to protect your game's state.\n"
|
||||||
|
"Error: %s", params ex.cMessage() );
|
||||||
|
safe_delete( g_RecoveryState );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysReset()
|
||||||
|
{
|
||||||
|
if (!sinit) return;
|
||||||
|
|
||||||
|
g_EmulationInProgress = false;
|
||||||
|
safe_delete( g_RecoveryState );
|
||||||
|
safe_delete( g_gsRecoveryState );
|
||||||
|
ResetPlugins();
|
||||||
|
|
||||||
|
ElfCRC = 0;
|
||||||
|
|
||||||
|
// Note : No need to call cpuReset() here. It gets called automatically before the
|
||||||
|
// emulator resumes execution.
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SysInit()
|
||||||
|
{
|
||||||
|
if (sinit) return true;
|
||||||
|
sinit = true;
|
||||||
|
|
||||||
|
mkdir(SSTATES_DIR, 0755);
|
||||||
|
mkdir(MEMCARDS_DIR, 0755);
|
||||||
|
|
||||||
|
mkdir(LOGS_DIR, 0755);
|
||||||
|
|
||||||
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
if (g_TestRun.plogname != NULL)
|
||||||
|
emuLog = fopen(g_TestRun.plogname, "w");
|
||||||
|
if (emuLog == NULL)
|
||||||
|
emuLog = fopen(LOGS_DIR "/emuLog.txt", "wb");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (emuLog != NULL)
|
||||||
|
setvbuf(emuLog, NULL, _IONBF, 0);
|
||||||
|
|
||||||
|
PCSX2_MEM_PROTECT_BEGIN();
|
||||||
|
SysDetect();
|
||||||
|
if (!SysAllocateMem()) return false; // critical memory allocation failure;
|
||||||
|
|
||||||
|
SysAllocateDynarecs();
|
||||||
|
PCSX2_MEM_PROTECT_END();
|
||||||
|
|
||||||
|
while (LoadPlugins() == -1)
|
||||||
|
{
|
||||||
|
if (Pcsx2Configure() == FALSE)
|
||||||
|
{
|
||||||
|
Msgbox::Alert("Configuration failed. Exiting.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysClose()
|
||||||
|
{
|
||||||
|
if (sinit == 0) return;
|
||||||
|
cpuShutdown();
|
||||||
|
ClosePlugins();
|
||||||
|
ReleasePlugins();
|
||||||
|
|
||||||
|
if (emuLog != NULL)
|
||||||
|
{
|
||||||
|
fclose(emuLog);
|
||||||
|
emuLog = NULL;
|
||||||
|
}
|
||||||
|
sinit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *SysLoadLibrary(const char *lib)
|
||||||
|
{
|
||||||
|
return dlopen(lib, RTLD_NOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *SysLoadSym(void *lib, const char *sym)
|
||||||
|
{
|
||||||
|
return dlsym(lib, sym);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *SysLibError()
|
||||||
|
{
|
||||||
|
return dlerror();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysCloseLibrary(void *lib)
|
||||||
|
{
|
||||||
|
dlclose(lib);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysRunGui()
|
||||||
|
{
|
||||||
|
RunGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
void *SysMmap(uptr base, u32 size)
|
||||||
|
{
|
||||||
|
u8 *Mem;
|
||||||
|
Mem = mmap((uptr*)base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
||||||
|
if (Mem == MAP_FAILED) Console::Notice("Mmap Failed!");
|
||||||
|
|
||||||
|
return Mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysMunmap(uptr base, u32 size)
|
||||||
|
{
|
||||||
|
munmap((uptr*)base, size);
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,10 @@ INCLUDES = $(shell pkg-config --cflags gtk+-2.0) -I@srcdir@/../ -I@srcdir@/../
|
||||||
bin_PROGRAMS = pcsx2
|
bin_PROGRAMS = pcsx2
|
||||||
|
|
||||||
# the application source, library search path, and link libraries
|
# the application source, library search path, and link libraries
|
||||||
pcsx2_SOURCES = Pref.cpp interface.c ConfigDlg.cpp DebugDlg.cpp GtkGui.cpp LnxMain.cpp LnxConsole.cpp LnxThreads.cpp support.c
|
pcsx2_SOURCES = \
|
||||||
|
interface.c support.c LnxMain.cpp LnxThreads.cpp LnxConsole.cpp LnxSysExec.cpp \
|
||||||
|
AboutDlg.cpp ConfigDlg.cpp DebugDlg.cpp AdvancedDlg.cpp CpuDlg.cpp HacksDlg.cpp Pref.cpp \
|
||||||
|
GtkGui.h Linux.h LnxMain.h ConfigDlg.h DebugDlg.h interface.h callbacks.h memzero.h support.h
|
||||||
|
|
||||||
pcsx2_LDFLAGS =
|
pcsx2_LDFLAGS =
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,8 @@ static void SetValuel( const char *name, s32 var)
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoadConfig() {
|
int LoadConfig()
|
||||||
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
@ -108,7 +109,8 @@ int LoadConfig() {
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
if (Config.Lang[0]) {
|
if (Config.Lang[0])
|
||||||
|
{
|
||||||
extern int _nl_msg_cat_cntr;
|
extern int _nl_msg_cat_cntr;
|
||||||
|
|
||||||
setenv("LANGUAGE", Config.Lang, 1);
|
setenv("LANGUAGE", Config.Lang, 1);
|
||||||
|
@ -121,7 +123,8 @@ int LoadConfig() {
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void SaveConfig() {
|
void SaveConfig()
|
||||||
|
{
|
||||||
|
|
||||||
pref_file = fopen(cfgfile, "w");
|
pref_file = fopen(cfgfile, "w");
|
||||||
if (pref_file == NULL) return;
|
if (pref_file == NULL) return;
|
||||||
|
|
Loading…
Reference in New Issue