Closed GoogleCodeExporter closed 9 years ago
This is due to some weird behaviour in the game itself; namely that it performs
a 0-sized CDROM DMA (and expects it to transfer something!). To elaborate:
The game correctly locates a file on disc (DEMO/TITLE.ALL;1), commands the
CDROM to read it, and then performs a 0-sized CDROM DMA (ie. it writes
0x00010000 to D3_BCR) to read the file's header. From this it expects to see at
least 0x24B of data at the desired address, which it then uses to find the size
of the file. Since this is (incorrectly) all 0 bytes, it reads a size of 0,
and the loader routine fails due to underflowing the size, causing it to try to
load 4GB of data into the PSX memory.
On real PSX hardware, performing such a 0-sized CDROM (or OTC) DMA causes it to
read 0x10000 words (0x40000B), not 0! The data after the sector is padded with
a byte from the first sector (see the attached patch). This has been verified
on real hardware.
Attached is a patch (against latest SVN trunk (r722)) which correctly emulates
this behaviour, making Ape Escape work correctly.
This might fix other games too, and hopefully won't break any others...
Thanks to Martin Korth (nocash.emubase.de) for finding out the behaviour of
these DMAs on real hardware!
Original comment by tiber...@gmail.com
on 6 Aug 2013 at 12:33
Attachments:
I should mention that this 0-sized DMA seems to be due to a bug in the game
itself; it should be setting the amount of data to DMA for the last sector in
the loading routine's callback to 0x800, not 0.
Also, there are some obvious sound issues, for which turning the sound to mono
in the in-game options seems to help.
Original comment by tiber...@gmail.com
on 6 Aug 2013 at 12:45
Fixed in r725.
Original comment by tiber...@gmail.com
on 24 Oct 2013 at 9:27
how do you patch this??
Original comment by MatthewD...@gmail.com
on 7 Jul 2014 at 6:13
what do you actually do with that patch? i have this issue
Original comment by MatthewD...@gmail.com
on 7 Jul 2014 at 6:13
Original issue reported on code.google.com by
aget...@gmail.com
on 9 Jul 2013 at 10:45