aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpcsxcore/misc.c')
-rw-r--r--libpcsxcore/misc.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index 58170cf..d877513 100644
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -73,7 +73,7 @@ void mmssdd( char *b, char *p )
m = ((m / 10) << 4) | m % 10;
s = ((s / 10) << 4) | s % 10;
- d = ((d / 10) << 4) | d % 10;
+ d = ((d / 10) << 4) | d % 10;
p[0] = m;
p[1] = s;
@@ -180,7 +180,7 @@ int LoadCdrom() {
// is just below, do it here
fake_bios_gpu_setup();
- if (!Config.HLE) {
+ if (!Config.HLE && !Config.SlowBoot) {
// skip BIOS logos
psxRegs.pc = psxRegs.GPR.n.ra;
return 0;
@@ -191,7 +191,7 @@ int LoadCdrom() {
READTRACK();
// skip head and sub, and go to the root directory record
- dir = (struct iso_directory_record*) &buf[12+156];
+ dir = (struct iso_directory_record*) &buf[12+156];
mmssdd(dir->extent, (char*)time);
@@ -236,7 +236,7 @@ int LoadCdrom() {
psxRegs.pc = SWAP32(tmpHead.pc0);
psxRegs.GPR.n.gp = SWAP32(tmpHead.gp0);
- psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
+ psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
if (psxRegs.GPR.n.sp == 0) psxRegs.GPR.n.sp = 0x801fff00;
tmpHead.t_size = SWAP32(tmpHead.t_size);
@@ -275,7 +275,7 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) {
READTRACK();
// skip head and sub, and go to the root directory record
- dir = (struct iso_directory_record *)&buf[12 + 156];
+ dir = (struct iso_directory_record *)&buf[12 + 156];
mmssdd(dir->extent, (char*)time);
@@ -329,7 +329,7 @@ int CheckCdrom() {
strncpy(CdromLabel, buf + 52, 32);
// skip head and sub, and go to the root directory record
- dir = (struct iso_directory_record *)&buf[12 + 156];
+ dir = (struct iso_directory_record *)&buf[12 + 156];
mmssdd(dir->extent, (char *)time);
@@ -357,6 +357,14 @@ int CheckCdrom() {
return -1;
}
}
+ /* Workaround for Wild Arms EU/US which has non-standard string causing incorrect region detection */
+ if (exename[0] == 'E' && exename[1] == 'X' && exename[2] == 'E' && exename[3] == '\\') {
+ size_t offset = 4;
+ size_t i, len = strlen(exename) - offset;
+ for (i = 0; i < len; i++)
+ exename[i] = exename[i + offset];
+ exename[i] = '\0';
+ }
} else if (GetCdromFile(mdir, time, "PSX.EXE;1") != -1) {
strcpy(exename, "PSX.EXE;1");
strcpy(CdromId, "SLUS99999");
@@ -426,7 +434,7 @@ size_t fread_to_ram(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
void *tmp;
size_t ret = 0;
-
+
tmp = malloc(size * nmemb);
if (tmp) {
ret = fread(tmp, size, nmemb, stream);
@@ -445,8 +453,8 @@ int Load(const char *ExePath) {
u32 section_address, section_size;
void *mem;
- strncpy(CdromId, "SLUS99999", 9);
- strncpy(CdromLabel, "SLUS_999.99", 11);
+ strcpy(CdromId, "SLUS99999");
+ strcpy(CdromLabel, "SLUS_999.99");
tmpFile = fopen(ExePath, "rb");
if (tmpFile == NULL) {
@@ -461,14 +469,14 @@ int Load(const char *ExePath) {
section_size = SWAP32(tmpHead.t_size);
mem = PSXM(section_address);
if (mem != NULL) {
- fseek(tmpFile, 0x800, SEEK_SET);
+ fseek(tmpFile, 0x800, SEEK_SET);
fread_to_ram(mem, section_size, 1, tmpFile);
psxCpu->Clear(section_address, section_size / 4);
}
fclose(tmpFile);
psxRegs.pc = SWAP32(tmpHead.pc0);
psxRegs.GPR.n.gp = SWAP32(tmpHead.gp0);
- psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
+ psxRegs.GPR.n.sp = SWAP32(tmpHead.s_addr);
if (psxRegs.GPR.n.sp == 0)
psxRegs.GPR.n.sp = 0x801fff00;
retval = 0;
@@ -557,7 +565,7 @@ struct PcsxSaveFuncs SaveFuncs = {
zlib_open, zlib_read, zlib_write, zlib_seek, zlib_close
};
-static const char PcsxHeader[32] = "STv4 PCSX v" PACKAGE_VERSION;
+static const char PcsxHeader[32] = "STv4 PCSX v" PCSX_VERSION;
// Savestate Versioning!
// If you make changes to the savestate version, please increment the value below.
@@ -649,6 +657,11 @@ int LoadState(const char *file) {
if (Config.HLE)
psxBiosInit();
+#if defined(LIGHTREC)
+ if (Config.Cpu != CPU_INTERPRETER)
+ psxCpu->Clear(0, UINT32_MAX); //clear all
+ else
+#endif
psxCpu->Reset();
SaveFuncs.seek(f, 128 * 96 * 3, SEEK_CUR);
@@ -742,7 +755,7 @@ int RecvPcsxInfo() {
NET_recvData(&Config.Cpu, sizeof(Config.Cpu), PSE_NET_BLOCKING);
if (tmp != Config.Cpu) {
psxCpu->Shutdown();
-#ifdef PSXREC
+#if defined(NEW_DYNAREC) || defined(LIGHTREC)
if (Config.Cpu == CPU_INTERPRETER) psxCpu = &psxInt;
else psxCpu = &psxRec;
#else