aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-12-23 22:09:06 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-12-23 22:09:06 +0100
commit2e6625481cd006d0a9d68285ce557f195030718e (patch)
tree5a65f290c20cde7a34ceb95fc40f0945ba5968d7 /libpsn00b
parent6c7512ff42805e9399dfee8b67e2f70fa55909d3 (diff)
downloadpsn00bsdk-2e6625481cd006d0a9d68285ce557f195030718e.tar.gz
Fix CdGetSector size inconsistency, update changelog
Diffstat (limited to 'libpsn00b')
-rw-r--r--libpsn00b/psxcd/cdgetsector.s3
-rw-r--r--libpsn00b/psxcd/isofs.c2
-rw-r--r--libpsn00b/psxcd/psxcd.c8
3 files changed, 7 insertions, 6 deletions
diff --git a/libpsn00b/psxcd/cdgetsector.s b/libpsn00b/psxcd/cdgetsector.s
index 9af3543..dbe95cb 100644
--- a/libpsn00b/psxcd/cdgetsector.s
+++ b/libpsn00b/psxcd/cdgetsector.s
@@ -18,7 +18,8 @@ CdGetSector:
# nop
lui $v0, 0x1
- srl $a1, 2
+# srl $a1, 2 # (the official implementation expects $a1/size
+ # to be in 32-bit words rather than bytes)
or $v0, $a1
sw $a0, D3_MADR($a2) # Set DMA base address and transfer length
sw $v0, D3_BCR($a2)
diff --git a/libpsn00b/psxcd/isofs.c b/libpsn00b/psxcd/isofs.c
index 29bbb76..d1c1b18 100644
--- a/libpsn00b/psxcd/isofs.c
+++ b/libpsn00b/psxcd/isofs.c
@@ -795,7 +795,7 @@ static void _scan_callback(int status, unsigned char *result)
{
if( status == CdlDataReady )
{
- CdGetSector((void*)_ses_scanbuff, 2048);
+ CdGetSector((void*)_ses_scanbuff, 512);
if( _ses_scanbuff[0] == 0x1 )
{
diff --git a/libpsn00b/psxcd/psxcd.c b/libpsn00b/psxcd/psxcd.c
index 74c6c1c..76415f9 100644
--- a/libpsn00b/psxcd/psxcd.c
+++ b/libpsn00b/psxcd/psxcd.c
@@ -255,7 +255,7 @@ static void _CdReadReadyCallback(int status, unsigned char *result)
CdGetSector((void*)_cd_read_addr, _cd_read_sector_sz);
// Increment destination address
- _cd_read_addr += _cd_read_sector_sz>>2;
+ _cd_read_addr += _cd_read_sector_sz;
// Subtract sector count
_cd_sector_count--;
@@ -290,15 +290,15 @@ int CdRead(int sectors, u_long *buf, int mode)
// Determine sector based on mode flags
if( mode & CdlModeSize0 )
{
- _cd_read_sector_sz = 2328;
+ _cd_read_sector_sz = 2328 / 4;
}
else if( mode & CdlModeSize1 )
{
- _cd_read_sector_sz = 2340;
+ _cd_read_sector_sz = 2340 / 4;
}
else
{
- _cd_read_sector_sz = 2048;
+ _cd_read_sector_sz = 2048 / 4;
}
_cd_read_counter = VSync(-1);