diff options
-rw-r--r-- | frontend/libretro.c | 6 | ||||
-rw-r--r-- | frontend/libretro_core_options.h | 4 | ||||
-rw-r--r-- | frontend/main.c | 2 | ||||
-rw-r--r-- | libpcsxcore/cdrom.c | 3 | ||||
-rw-r--r-- | libpcsxcore/misc.c | 28 | ||||
-rw-r--r-- | libpcsxcore/plugins.c | 6 | ||||
-rw-r--r-- | libpcsxcore/ppf.c | 2 | ||||
-rw-r--r-- | libpcsxcore/psxbios.c | 15 |
8 files changed, 37 insertions, 29 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c index b8d17ab..bdf0829 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -962,11 +962,11 @@ static struct retro_disk_control_callback disk_control = { #define PATH_MAX 4096 #endif -static char base_dir[PATH_MAX]; +static char base_dir[1024]; static bool read_m3u(const char *file) { - char line[PATH_MAX]; + char line[1024]; char name[PATH_MAX]; FILE *f = fopen(file, "r"); if (!f) @@ -2130,7 +2130,7 @@ static int init_memcards(void) static void loadPSXBios(void) { const char *dir; - char path[256]; + char path[PATH_MAX]; unsigned useHLE = 0; const char *bios[] = { diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 6513e1c..f0bd902 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -77,11 +77,11 @@ struct retro_core_option_definition option_defs_us[] = { "Enable Second Memory Card (Shared)", "Enabled the memory card slot 2. This memory card is shared amongst all games.", { - { "disable", NULL }, + { "disabled", NULL }, { "enabled", NULL }, { NULL, NULL}, }, - "disable", + "disabled", }, { "pcsx_rearmed_pad1type", diff --git a/frontend/main.c b/frontend/main.c index c0bfd0f..81a68e3 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -870,7 +870,7 @@ static int _OpenPlugins(void) { if (Config.UseNet && !NetOpened) { netInfo info; - char path[MAXPATHLEN]; + char path[MAXPATHLEN * 2]; char dotdir[MAXPATHLEN]; MAKE_PATH(dotdir, "/.pcsx/plugins/", NULL); diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 17d65ab..a65ca54 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -877,7 +877,8 @@ void cdrInterrupt() { } cdr.Result[0] |= (cdr.Result[1] >> 4) & 0x08; - strncpy((char *)&cdr.Result[4], "PCSX", 4); + /* This adds the string "PCSX" in Playstation bios boot screen */ + memcpy((char *)&cdr.Result[4], "PCSX", 4); cdr.Stat = Complete; break; diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 433d4be..82e6b8b 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; @@ -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; diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index 4f52ed2..af7ebed 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -1064,7 +1064,7 @@ void CALLBACK clearDynarec(void) { int LoadPlugins() { int ret; - char Plugin[MAXPATHLEN]; + char Plugin[MAXPATHLEN * 2]; ReleasePlugins(); SysLibError(); @@ -1169,7 +1169,7 @@ int ReloadCdromPlugin() if (UsingIso()) { LoadCDRplugin(NULL); } else { - char Plugin[MAXPATHLEN]; + char Plugin[MAXPATHLEN * 2]; sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Cdr); if (LoadCDRplugin(Plugin) == -1) return -1; } @@ -1182,7 +1182,7 @@ void SetIsoFile(const char *filename) { IsoFile[0] = '\0'; return; } - strncpy(IsoFile, filename, MAXPATHLEN); + strncpy(IsoFile, filename, MAXPATHLEN - 1); } const char *GetIsoFile(void) { diff --git a/libpcsxcore/ppf.c b/libpcsxcore/ppf.c index edebdd0..f6ccfca 100644 --- a/libpcsxcore/ppf.c +++ b/libpcsxcore/ppf.c @@ -183,7 +183,7 @@ void BuildPPFCache() { char method, undo = 0, blockcheck = 0; int dizlen, dizyn; unsigned char ppfmem[512]; - char szPPF[MAXPATHLEN]; + char szPPF[MAXPATHLEN * 2]; int count, seekpos, pos; u32 anz; // use 32-bit to avoid stupid overflows s32 ladr, off, anx; diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 388d606..0121a7b 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -347,6 +347,7 @@ static inline void LoadRegs() { ptr = Mcd##mcd##Data + offset; \ memcpy(ptr, Ra1, length); \ FDesc[1 + mcd].offset += length; \ + SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, offset, length); \ if (FDesc[1 + mcd].mode & 0x8000) { \ DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \ DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \ @@ -2025,17 +2026,18 @@ void psxBios_UnDeliverEvent() { // 0x20 char ffile[64], *pfile; int nfile; -static void buopen(int mcd, u8 *ptr, u8 *cfg) + +static void buopen(int mcd, char *ptr, char *cfg) { int i; - u8 *fptr = ptr; + char *mcd_data = ptr; strcpy(FDesc[1 + mcd].name, Ra0+5); FDesc[1 + mcd].offset = 0; FDesc[1 + mcd].mode = a1; for (i=1; i<16; i++) { - fptr += 128; + const char *fptr = mcd_data + 128 * i; if ((*fptr & 0xF0) != 0x50) continue; if (strcmp(FDesc[1 + mcd].name, fptr+0xa)) continue; FDesc[1 + mcd].mcfile = i; @@ -2044,12 +2046,11 @@ static void buopen(int mcd, u8 *ptr, u8 *cfg) break; } if (a1 & 0x200 && v0 == -1) { /* FCREAT */ - fptr = ptr; for (i=1; i<16; i++) { int j, xor, nblk = a1 >> 16; - u8 *pptr, *fptr2; + char *pptr, *fptr2; + char *fptr = mcd_data + 128 * i; - fptr += 128; if ((*fptr & 0xF0) != 0xa0) continue; FDesc[1 + mcd].mcfile = i; @@ -2094,8 +2095,6 @@ static void buopen(int mcd, u8 *ptr, u8 *cfg) */ void psxBios_open() { // 0x32 - int i; - char *ptr; void *pa0 = Ra0; #ifdef PSXBIOS_LOG |