summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-08-22 15:05:59 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-08-22 15:05:59 +0000
commitc9b34c524d3fea849eef4066b8fa77497c1b2597 (patch)
treed2c5abfda3c737145e2a9146679a577677f85c87
parent54e6ea3610e17cf16fde1472f73864db3b3b3cf5 (diff)
downloadpcsxr-c9b34c524d3fea849eef4066b8fa77497c1b2597.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@27235 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog8
-rw-r--r--gui/Gtk2Gui.c12
-rw-r--r--libpcsxcore/misc.c47
3 files changed, 51 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e5becef..6d0fbaf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,14 @@
August 22, 2009 dario86
- * libpcsxcore/cdrom.c: Demute the CD-DA by default.
+ * libpcsxcore/cdrom.c: Demute the CD-DA by default, which fixes the music
+ problem with Tekken 1.
August 22, 2009 Wei Mingzhi <weimingzhi@gmail.com>
- * libpcsxcore/misc.c: Also check for PSX.EXE in CheckCdrom().
+ * libpcsxcore/misc.c: Also check for PSX.EXE in CheckCdrom(). Added support
+ for CPE binaries. Returns -1 in Load() if EXE is not found. Print the
+ EXE loading error messages in console instead of a message box.
+ * gui/Gtk2Gui.c: Show files with .cpe extension in the Load EXE dialog box.
* debian/rules: Removed dh_desktop.
August 17, 2009 Wei Mingzhi <weimingzhi@gmail.com>
diff --git a/gui/Gtk2Gui.c b/gui/Gtk2Gui.c
index 723c0989..ad6254b8 100644
--- a/gui/Gtk2Gui.c
+++ b/gui/Gtk2Gui.c
@@ -479,11 +479,12 @@ void OnFile_RunExe() {
GtkFileFilter *exefilter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (exefilter, "*.exe");
gtk_file_filter_add_pattern (exefilter, "*.psx");
+ gtk_file_filter_add_pattern (exefilter, "*.cpe");
gtk_file_filter_set_name (exefilter, _("PlayStation Executable Files"));
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_chooser), exefilter);
GtkFileFilter *allfilter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (allfilter, "*");
- gtk_file_filter_set_name (allfilter, "All Files");
+ gtk_file_filter_set_name (allfilter, _("All Files"));
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_chooser), allfilter);
/* Set this to the config object and retain it - maybe LastUsedDir */
@@ -503,19 +504,16 @@ void OnFile_RunExe() {
LoadPlugins();
NetOpened = 0;
- /* TODO If a CDR plugin image has not been selected, then OpenPlugins() will prompt us to
- configure the plugin, even though we don't need it for EXE files. Need to pass a parameter
- or something */
if (OpenPlugins() == -1) {
- /* TODO Error message */
- SysRunGui();
g_free(file);
+ SysRunGui();
} else {
SysReset();
+
if (Load(file) == 0) {
+ g_free(file);
if (Config.Dbg) hdb_start();
psxCpu->Execute();
- g_free(file);
} else {
g_free(file);
ClosePlugins();
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index e49be10c..f1392299 100644
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -369,14 +369,16 @@ int Load(char *ExePath) {
EXE_HEADER tmpHead;
int type;
int retval = 0;
+ u8 opcode;
+ u32 section_address, section_size;
strncpy(CdromId, "SLUS99999", 9);
strncpy(CdromLabel, "SLUS_999.99", 11);
- tmpFile = fopen(ExePath,"rb");
+ tmpFile = fopen(ExePath, "rb");
if (tmpFile == NULL) {
- SysMessage(_("Error opening file: %s"), ExePath);
- retval = 0;
+ SysPrintf(_("Error opening file: %s.\n"), ExePath);
+ retval = -1;
} else {
type = PSXGetFileType(tmpFile);
switch (type) {
@@ -393,19 +395,50 @@ int Load(char *ExePath) {
retval = 0;
break;
case CPE_EXE:
- SysMessage(_("CPE files not supported."));
- retval = -1;
+ fseek(tmpFile, 6, SEEK_SET); /* Something tells me we should go to 4 and read the "08 00" here... */
+ do {
+ fread(&opcode, 1, 1, tmpFile);
+ switch (opcode) {
+ case 1: /* Section loading */
+ fread(&section_address, 4, 1, tmpFile);
+ fread(&section_size, 4, 1, tmpFile);
+ section_address = SWAPu32(section_address);
+ section_size = SWAPu32(section_size);
+#ifdef EMU_LOG
+ EMU_LOG("Loading %08X bytes from %08X to %08X\n", section_size, ftell(tmpFile), section_address);
+#endif
+ fread(PSXM(section_address), section_size, 1, tmpFile);
+ break;
+ case 3: /* register loading (PC only?) */
+ fseek(tmpFile, 2, SEEK_CUR); /* unknown field */
+ fread(&psxRegs.pc, 4, 1, tmpFile);
+ psxRegs.pc = SWAPu32(psxRegs.pc);
+ break;
+ case 0: /* End of file */
+ break;
+ default:
+ SysPrintf(_("Unknown CPE opcode %02x at position %08x.\n"), opcode, ftell(tmpFile) - 1);
+ retval = -1;
+ break;
+ }
+ } while (opcode != 0 && retval == 0);
break;
case COFF_EXE:
- SysMessage(_("COFF files not supported."));
+ SysPrintf(_("COFF files not supported.\n"));
retval = -1;
break;
case INVALID_EXE:
- SysMessage(_("This file does not appear to be a valid PSX file."));
+ SysPrintf(_("This file does not appear to be a valid PSX file.\n"));
retval = -1;
break;
}
}
+
+ if (retval != 0) {
+ CdromId[0] = '\0';
+ CdromLabel[0] = '\0';
+ }
+
return retval;
}