From e9e3b118c37eca294d274739f20db783ba5bf7ee Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Tue, 30 Jun 2009 08:42:26 +0000 Subject: various psxbios fixes by pcc git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@23853 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- ChangeLog | 11 +++++++++++ libpcsxcore/psxbios.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++-- plugins/peopsxgl/gpu.c | 2 +- 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 175ef966..0a623e60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +June 30, 2009 Peter Collingbourne + + * libpcsxcore/psxbios.c: Implemented psxBios_rename(). Interpret a file + path of the form buX0: as buX0:* in firstfile() and nextfile(). Ensure + that memory card data is saved when deleting a file. Advance the file + offset when a write or synchronous read occurs. + +June 30, 2009 Wei Mingzhi + + * plugins/peopsxgl/gpu.c: Changed a format string from %08lx to %08x. + June 30, 2009 Peter Collingbourne * plugins/dfcdrom/main.c: #include locale.h as well as libintl.h to allow diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 1de7e0bc..5d1ba48c 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -1412,6 +1412,7 @@ void psxBios_lseek() { // 0x33 memcpy(Ra1, ptr, a2); \ if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \ else v0 = a2; \ + FDesc[1 + mcd].offset += v0; \ DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \ DeliverEvent(0x81, 0x2); /* 0xf4000001, 0x0004 */ \ } @@ -1442,6 +1443,7 @@ void psxBios_read() { // 0x34 SysPrintf("write %d: %x,%x\n", FDesc[1 + mcd].mcfile, FDesc[1 + mcd].offset, a2); \ ptr = Mcd##mcd##Data + offset; \ memcpy(ptr, Ra1, a2); \ + FDesc[1 + mcd].offset += a2; \ SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, offset, a2); \ if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \ else v0 = a2; \ @@ -1512,7 +1514,9 @@ int nfile; nfile++; \ if ((*ptr & 0xF0) != 0x50) continue; \ ptr+= 0xa; \ - for (i=0; i<20; i++) { \ + if (pfile[0] == 0) { \ + strcpy(dir->name, ptr); \ + } else for (i=0; i<20; i++) { \ if (pfile[i] == ptr[i]) { \ dir->name[i] = ptr[i]; \ if (ptr[i] == 0) break; else continue; } \ @@ -1589,12 +1593,56 @@ void psxBios_nextfile() { // 43 pc0 = ra; } +#define burename(mcd) { \ + for (i=1; i<16; i++) { \ + int namelen, j, xor = 0; \ + ptr = Mcd##mcd##Data + 128 * i; \ + if ((*ptr & 0xF0) != 0x50) continue; \ + if (strcmp(Ra0+5, ptr+0xa)) continue; \ + namelen = strlen(Ra1+5); \ + memcpy(ptr+0xa, Ra1+5, namelen); \ + memset(ptr+0xa+namelen, 0, 0x75-namelen); \ + for (j=0; j<127; j++) xor^= ptr[j]; \ + ptr[127] = xor; \ + SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, 128 * i + 0xa, 0x76); \ + v0 = 1; \ + break; \ + } \ +} + +/* + * int rename(char *old, char *new); + */ + +void psxBios_rename() { // 44 + char *ptr; + int i; + +#ifdef PSXBIOS_LOG + PSXBIOS_LOG("psxBios_%s: %s,%s\n", biosB0n[0x44], Ra0, Ra1); +#endif + + v0 = 0; + + if (!strncmp(Ra0, "bu00", 4) && !strncmp(Ra1, "bu00", 4)) { + burename(1); + } + + if (!strncmp(Ra0, "bu10", 4) && !strncmp(Ra1, "bu10", 4)) { + burename(2); + } + + pc0 = ra; +} + + #define budelete(mcd) { \ for (i=1; i<16; i++) { \ ptr = Mcd##mcd##Data + 128 * i; \ if ((*ptr & 0xF0) != 0x50) continue; \ if (strcmp(Ra0+5, ptr+0xa)) continue; \ *ptr = (*ptr & 0xf) | 0xA0; \ + SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, 128 * i, 1); \ SysPrintf("delete %s\n", ptr+0xa); \ v0 = 1; \ break; \ @@ -2058,7 +2106,7 @@ void psxBiosInit() { //biosB0[0x41] = psxBios_format; biosB0[0x42] = psxBios_firstfile; biosB0[0x43] = psxBios_nextfile; - //biosB0[0x44] = psxBios_rename; + biosB0[0x44] = psxBios_rename; biosB0[0x45] = psxBios_delete; //biosB0[0x46] = psxBios_undelete; //biosB0[0x47] = psxBios_AddDevice; diff --git a/plugins/peopsxgl/gpu.c b/plugins/peopsxgl/gpu.c index 1ccf9a02..af600b30 100644 --- a/plugins/peopsxgl/gpu.c +++ b/plugins/peopsxgl/gpu.c @@ -305,7 +305,7 @@ char * GetConfigInfos(int hW) else strcat(pB," - not supported\r\n"); } else strcat(pB,"\r\n"); - sprintf(szTxt,"- Game fixes: %s [%08lx]\r\n",szO[bUseFixes],dwCfgFixes); + sprintf(szTxt,"- Game fixes: %s [%08x]\r\n",szO[bUseFixes],dwCfgFixes); strcat(pB,szTxt); //----------------------------------------------------// return pB; -- cgit v1.2.3