Skip to content

Commit

Permalink
krat0s: fix semaphores, add more debgging
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK committed Aug 11, 2023
1 parent 8252c64 commit a7519fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/iopcore/cdvdman/cdvdman.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ int sceCdSC(int code, int *param)
result = 1;
break;
default:
DPRINTF("sceCdSC unknown, code=0x%X param=0x%X \n", code, *param);
result = 1; // dummy result
}

Expand Down
6 changes: 6 additions & 0 deletions modules/iopcore/cdvdman/ioops.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ static int cdrom_ioctl(iop_file_t *f, u32 cmd, void *args)
{
register int r = 0;

DPRINTF("cdrom_ioctl 0x%X\n", cmd);

WaitSema(cdrom_io_sema);

if (cmd != 0x10000) // Spin Ctrl op
Expand All @@ -449,6 +451,7 @@ static int cdrom_devctl(iop_file_t *f, const char *name, int cmd, void *args, u3
int result;

WaitSema(cdrom_io_sema);
WaitEventFlag(cdvdman_stat.intr_ef, 1, WEF_AND, NULL);

result = 0;
switch (cmd) {
Expand Down Expand Up @@ -536,6 +539,7 @@ static int cdrom_devctl(iop_file_t *f, const char *name, int cmd, void *args, u3
result = cdvdman_stat.intr_ef;
break;
default:
DPRINTF("cdrom_devctl unknown, cmd=0x%X\n", cmd);
result = -EIO;
break;
}
Expand All @@ -553,6 +557,7 @@ static int cdrom_ioctl2(iop_file_t *f, int cmd, void *args, unsigned int arglen,
// There was a check here on whether the file was opened with mode 8.

WaitSema(cdrom_io_sema);
WaitEventFlag(cdvdman_stat.intr_ef, 1, WEF_AND, NULL);

switch (cmd) {
case CIOCSTREAMPAUSE:
Expand All @@ -565,6 +570,7 @@ static int cdrom_ioctl2(iop_file_t *f, int cmd, void *args, unsigned int arglen,
r = sceCdStStat();
break;
default:
DPRINTF("cdrom_ioctl2 unknown, cmd=0x%X\n", cmd);
r = -EINVAL;
}

Expand Down

0 comments on commit a7519fb

Please sign in to comment.