From 27e8b5744ddab50cc9ef50b6ee1f3a94010a8cea Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Wed, 12 Jan 2011 02:51:29 +0000 Subject: - 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 --- libpcsxcore/ppf.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) (limited to 'libpcsxcore/ppf.c') 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 . + * 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; +} -- cgit v1.2.3