aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authornotaz2013-01-01 01:48:16 +0200
committernotaz2013-01-03 01:06:43 +0200
commiteaa895dc8ff02d63cf52b5d0faf0d8272a96a822 (patch)
tree2994f363d8873790a889aa2b0a9e8cc240d89ab7 /libpcsxcore
parent73b29eebea762ea3af6e27060e2b20cd8a58da91 (diff)
downloadpcsx_rearmed-eaa895dc8ff02d63cf52b5d0faf0d8272a96a822.tar.gz
pcsx_rearmed-eaa895dc8ff02d63cf52b5d0faf0d8272a96a822.tar.bz2
pcsx_rearmed-eaa895dc8ff02d63cf52b5d0faf0d8272a96a822.zip
sbi: update according to Nocash doc
no idea if it's correct though
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/ppf.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libpcsxcore/ppf.c b/libpcsxcore/ppf.c
index 6fcd5bc..0d80107 100644
--- a/libpcsxcore/ppf.c
+++ b/libpcsxcore/ppf.c
@@ -339,7 +339,7 @@ unsigned char *sbi_sectors;
int LoadSBI(const char *fname, int sector_count) {
char buffer[16];
FILE *sbihandle;
- u8 sbitime[3];
+ u8 sbitime[3], t;
int s;
sbihandle = fopen(fname, "rb");
@@ -352,9 +352,22 @@ int LoadSBI(const char *fname, int sector_count) {
// 4-byte SBI header
fread(buffer, 1, 4, sbihandle);
- while (!feof(sbihandle)) {
- fread(sbitime, 1, 3, sbihandle);
- fread(buffer, 1, 11, sbihandle);
+ while (1) {
+ s = fread(sbitime, 1, 3, sbihandle);
+ if (s != 3)
+ break;
+ fread(&t, 1, 1, sbihandle);
+ switch (t) {
+ default:
+ case 1:
+ s = 10;
+ break;
+ case 2:
+ case 3:
+ s = 3;
+ break;
+ }
+ fseek(sbihandle, s, SEEK_CUR);
s = MSF2SECT(btoi(sbitime[0]), btoi(sbitime[1]), btoi(sbitime[2]));
if (s < sector_count)