pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

[BUG]: CDVD: SCMD: cdvd.SCMDResult[0] not properly initialized

Open AKuHAK opened this issue 3 years ago • 0 comments

Describe the Bug

Some SCMD commands do not initialize properly cdvd.SCMDResult[0] . This affects SCMD 0x44, 0x45, 0x0A, 0x0B, 0x12, 0x13, 0x18, 0x37, 0x38, 0x3E, 0x42, 0x43

Reproduction Steps

Run Mekacon tester application with any of these SCMD, the first byte will contain random values. According to a comment on this line https://github.com/PCSX2/pcsx2/blob/9094ee0dc61affefacfdad642ddf6d1becb0602c/pcsx2/CDVD/CDVD.cpp#L2698 first byte mostly contains SCMD function status or status combinations. To resolve this problem, it is enough to add into each switch-case just before break: cdvd.SCMDResult[0] = 0;.

This behavior can be improved: if switch-case calls some function, someone can check this function return status, and according to that status return either 0 on success or 0x80 on failure.

Expected Behavior

After calling SetSCMDResultSize(n) all n bytes must be initialized.

PCSX2 Revision

9094ee0dc61affefacfdad642ddf6d1becb0602c

Operating System

Windows 11

If Linux - Specify Distro

No response

AKuHAK avatar Aug 28 '22 09:08 AKuHAK