Skip to content

Commit

Permalink
cdvdman: Fix for Samurai Warriors 2 and Warriors Orochi series. (#226)
Browse files Browse the repository at this point in the history
Some games, such as Warriors Orochi (USA), calls sceCdReadIOPMem()
with a logical IOP RAM address (in this specific game, the passed
pointer is a KSEG0 - a.k.a. Kernel Mode, Segment 0 - logical IOP
RAM address) as its third parameter, which normally is not an issue,
but on slim consoles (SCPH-75000 series and newer), the game crashes
when being run from USB media. Fix this issue by ensuring that the
provided pointer to IOP RAM is a physical address.

Note that a similar measure is applied in cdvd_readee() (see cdvdfsv.c line 807):

http://github.com/ifcaro/Open-PS2-Loader/blob/master/modules/iopcore/cdvdfsv/cdvdfsv.c#L807

As a side note, this fix should apply for related koei games (Warriors
Orochi 2 and Samurai Warriors 2 series), as those games do the same
thing as Warriors Orochi regarding sceCdReadIOPMem().
  • Loading branch information
luisdallos authored and ElPatas1 committed Oct 8, 2019
1 parent f112b26 commit 7320468
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/iopcore/cdvdman/cdvdman.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <usbd.h>
#include "ioman_add.h"

#include <defs.h>

#define MODNAME "cdvd_driver"
IRX_ID(MODNAME, 1, 1);

Expand Down Expand Up @@ -421,6 +423,7 @@ static int cdvdman_read(u32 lsn, u32 sectors, void *buf)
{
cdvdman_stat.status = CDVD_STAT_READ;

buf = (void *)PHYSADDR(buf);
#ifdef HDD_DRIVER //As of now, only the ATA interface requires this. We do this here to share cdvdman_buf.
if ((u32)(buf)&3) {
//For transfers to unaligned buffers, a double-copy is required to avoid stalling the device's DMA channel.
Expand Down

0 comments on commit 7320468

Please sign in to comment.