The main FindMinMax methods is perf critical so instead I created a separate function
to ensure the constness of the depth
Fix letter regression on Xenosaga3
Also refactor the default drive selection and GUI code so optical drive
detection is shared.
Note: This breaks the current config, but there's only one setting
anyway.
Don't use a RAW_READ_INFO struct when only the LARGE_INTEGER member is
used. Use SetFilePointerEx which is slightly simpler and doesn't require
checking GetLastError() in some circumstances to check whether the read
has actually failed.
Also use a mutex to prevent simultaneous access from both the read
thread and the keepalive thread to prevent overlapping SetFilePointerEx
calls from causing the wrong data to be read.
And print error messages should a failure occur.
Also set the max drive speed to 4x DVD and 24xCD (down from 8x DVD and
36x CD) - it seems to reduce pausing slightly since the drive doesn't
require as much time to spin up to the desired speed.
Also set the disc speed at the correct time - CDROM SET SPEED only stays
in effect till the disc is removed.
Also fix a memleak in CDVDopen when the drive cannot be accessed.
It's rather unnecessary to use the same ioctls multiple times per disc
when the info returned doesn't change. Just use each ioctl once and
read/calculate all the necessary info all at onace.
This also fixes an issue where the IOCTL_DVD_START_SESSION ioctl is
repeatedly used if the returned session ID is 0. The previous code
assumed that 0 was not a valid session ID and would repeatedly use the
ioctl to obtain a non-zero session ID. However, 0 is a valid session ID,
and it seems IOCTL_DVD_START_SESSION can repeatedly return a 0 session
ID even if the corresponding IOCTL_DVD_END_SESSION has not been called.
In our case, a DVD session is only necessary for DVD detection and
reading the physical format information. This fix seems to alter drive
speed behaviour.
There doesn't seem to be any issues calling CreateFile with
GENERIC_WRITE access (which is necessary for SPTI) on a standard user
account, so the SPTI code should work in all cases.
Adds separate bindings for each of the pad types (DualShock2,
Guitar,Pop'n Music). This allows the user to change the button
configuration to better suit the Guitar and Pop'n Music pads without
messing up the bindings already setup for the DS2.
Close#1576.