summaryrefslogtreecommitdiff
path: root/libpcsxcore/ppf.c
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-01-12 02:51:29 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-01-12 02:51:29 +0000
commit27e8b5744ddab50cc9ef50b6ee1f3a94010a8cea (patch)
treec38e3e5475e499b769368cb34129c70f1e2a36f8 /libpcsxcore/ppf.c
parent9bbb363c552598dcec7d17c7e6386a6f405edcab (diff)
downloadpcsxr-27e8b5744ddab50cc9ef50b6ee1f3a94010a8cea.tar.gz
- Added -slowboot parameter.
- Load SBI file from patches/SLUS_xxx.xx.sbi instead. - Inlined the I-cache code for performance improvement. - Fixed endianness issue (not tested). git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@62024 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore/ppf.c')
-rw-r--r--libpcsxcore/ppf.c62
1 files changed, 60 insertions, 2 deletions
diff --git a/libpcsxcore/ppf.c b/libpcsxcore/ppf.c
index 45c8733c..d421d09e 100644
--- a/libpcsxcore/ppf.c
+++ b/libpcsxcore/ppf.c
@@ -1,7 +1,8 @@
-/* PPF Patch Support for PCSX-Reloaded
+/* PPF/SBI Support for PCSX-Reloaded
* Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
+ * Copyright (c) 2010, shalma.
*
- * Based on P.E.Op.S CDR Plugin by Pete Bernert.
+ * PPF code based on P.E.Op.S CDR Plugin by Pete Bernert.
* Copyright (c) 2002, Pete Bernert.
*
* This program is free software; you can redistribute it and/or modify
@@ -330,3 +331,60 @@ void BuildPPFCache() {
SysPrintf(_("Loaded PPF %d.0 patch: %s.\n"), method + 1, szPPF);
}
+
+// redump.org SBI files
+static u8 sbitime[256][3], sbicount;
+
+void LoadSBI() {
+ FILE *sbihandle;
+ char buffer[16], sbifile[MAXPATHLEN];
+
+ // Generate filename in the format of SLUS_123.45.sbi
+ buffer[0] = toupper(CdromId[0]);
+ buffer[1] = toupper(CdromId[1]);
+ buffer[2] = toupper(CdromId[2]);
+ buffer[3] = toupper(CdromId[3]);
+ buffer[4] = '_';
+ buffer[5] = CdromId[4];
+ buffer[6] = CdromId[5];
+ buffer[7] = CdromId[6];
+ buffer[8] = '.';
+ buffer[9] = CdromId[7];
+ buffer[10] = CdromId[8];
+ buffer[11] = '.';
+ buffer[12] = 's';
+ buffer[13] = 'b';
+ buffer[14] = 'i';
+ buffer[15] = '\0';
+
+ sprintf(sbifile, "%s%s", Config.PatchesDir, buffer);
+
+ // init
+ sbicount = 0;
+
+ sbihandle = fopen(sbifile, "rb");
+ if (sbihandle == NULL) return;
+
+ // 4-byte SBI header
+ fseek(sbihandle, 4, SEEK_SET);
+ while (!feof(sbihandle)) {
+ fread(sbitime[sbicount++], 1, 3, sbihandle);
+ fseek(sbihandle, 11, SEEK_CUR);
+ }
+
+ SysPrintf(_("Loaded SBI file: %s.\n"), sbifile);
+}
+
+boolean CheckSBI(const u8 *time) {
+ int lcv;
+
+ // both BCD format
+ for (lcv = 0; lcv < sbicount; lcv++) {
+ if (time[0] == sbitime[lcv][0] &&
+ time[1] == sbitime[lcv][1] &&
+ time[2] == sbitime[lcv][2])
+ return TRUE;
+ }
+
+ return FALSE;
+}