From e18eaf666d96f9fed7a14d1d8cd0ddad6d09795e Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Thu, 12 Jul 2018 11:10:11 +0200 Subject: [PATCH] Support for 2448-byte sectors Pier Solar and the Great Architects CDI uses an unknown type 4 sector of 2448 bytes. This hack allows the CDI to be read. Not sure about the correctness. --- core/deps/chdpsr/cdipsr.cpp | 4 +++- core/imgread/common.h | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/deps/chdpsr/cdipsr.cpp b/core/deps/chdpsr/cdipsr.cpp index dcb054187..cd250f587 100644 --- a/core/deps/chdpsr/cdipsr.cpp +++ b/core/deps/chdpsr/cdipsr.cpp @@ -85,7 +85,9 @@ void CDI_read_track (FILE *fsource, image_s *image, track_s *track) case 0 : track->sector_size = 2048; break; case 1 : track->sector_size = 2336; break; case 2 : track->sector_size = 2352; break; - default: printf("Unsupported sector size"); + case 4 : track->sector_size = 2448; break; + default: printf("Unsupported sector size. value %ld\n", track->sector_size_value); + break; } if (track->mode > 2) printf( "Unsupported format: Track mode not supported"); diff --git a/core/imgread/common.h b/core/imgread/common.h index cccafde49..b793ec96c 100644 --- a/core/imgread/common.h +++ b/core/imgread/common.h @@ -72,6 +72,7 @@ enum SectorFormat SECFMT_2048_MODE1, //2048 user byte, form1 sector SECFMT_2048_MODE2_FORM1, //2048 user bytes, form2m1 sector SECFMT_2336_MODE2, //2336 user bytes, + SECFMT_2448_MODE2, //2048 user bytes, ? SYNC (12) | HEAD (4) | sub-head (8) | data (2048) | edc (4) | ecc (276) + subcodes (96) ? }; enum SubcodeFormat @@ -168,7 +169,7 @@ struct Disc void ReadSectors(u32 FAD,u32 count,u8* dst,u32 fmt) { - u8 temp[2352]; + u8 temp[2448]; SectorFormat secfmt; SubcodeFormat subfmt; @@ -192,9 +193,14 @@ struct Disc printf("GDR:fmt=2352;secfmt=2048\n"); memcpy(dst,temp,2048); } + else if (fmt==2048 && secfmt==SECFMT_2448_MODE2) + { + // Pier Solar and the Great Architects + ConvertSector(temp, dst, 2448, fmt, FAD); + } else { - printf("ERROR: UNABLE TO CONVERT SECTOR. THIS IS FATAL."); + printf("ERROR: UNABLE TO CONVERT SECTOR. THIS IS FATAL. Format: %d Sector format: %d\n", fmt, secfmt); //verify(false); } } @@ -286,6 +292,8 @@ struct RawTrackFile : TrackFile *sector_type=SECFMT_2048_MODE2_FORM1; else if (fmt==2336) *sector_type=SECFMT_2336_MODE2; + else if (fmt==2448) + *sector_type=SECFMT_2448_MODE2; else { verify(false);