New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for memory unit devices #2246
Conversation
0ddb7e8
to
de9913f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had not made a full review, there's some changes need some fixes before I can re-review again.
I notice there are bunch of dev1
and port1
and the like which is not suitable to be use and lead confusion. Intead of using dev# and port#, they are actually iterator (in most cases), so using iDev and iPort, or i_dev and i_port, are preferred to be used.
35578ce
to
09843d3
Compare
…functions and input gui related to MUs
…om slot connectivity
d63058d
to
b9b2213
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few code style changes and base on numerous to input mechanical not relative to memory unit devices. I recommended to perform full test with various titles that had been known to break in the past.
extern const std::string DriveZ; | ||
extern const std::string DevicePrefix; | ||
extern const std::string DeviceCdrom0; | ||
extern const std::string DeviceHarddisk0; | ||
extern const std::string DeviceMU; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally, DeviceMU should be move down to above DeviceMU0
. But I can understand the group purpose.
{ NULL, PORT_INVALID, XBOX_INPUT_DEVICE::DEVICE_INVALID, &g_InState[3], false, false, false, false, false, { 0, 0, 0, 0, 0 } }, | ||
}; | ||
// Protects access to xpp types | ||
std::atomic<bool> g_bXppGuard = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we need this additional guard?
// Guard against the unfortunate case where XGetDevices or XGetDeviceChanges have already checked for g_bIsDevicesInitializing
// and g_bIsDevicesEmulating and a thread switch happens to this function
Quote from while (g_bXppGuard) {}
line.
Can't we simply check both booleans than rely on additional variable, g_bXppGuard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UpdateXppState
is only called from ConstructHleInputDevice
and DestructHleInputDevice
, both of which set g_bIsDevicesEmulating
to true. The unfortunate case happens when XGetDevices
or XGetDeviceChanges
are called, find g_bIsDevicesEmulating = false
, proceed, but then a thread switch happens to UpdateXppState
. Without the guard, the latter will concurrently access the xpp type, which might cause issues depending on which xpp type XGetDevices
and XGetDeviceChanges
are using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Known titles experienced regression in the past has pass test by our tester.
This adds support for a new input device, the memory unit (MU), which becomes available in the input gui when selecting the duke or S controller. For this cxbxr will now create a new folder called EmuMu in the same location where EmuDisk is created, and inside EmuMu there will be 8 folders, one for each MU. Regarding the internal code changes, this implements
XMountMUA
,XMountMURootA
,XUnmountMU
,XReadMUMetaData
and extends the kernel functionsNtQueryVolumeInformationFile
,NtDeviceIoControlFile
andNtFsControlFile
to support MUs, in addition to the HDD. Below is a pic of the dashboard recognizing the MUs:Testing is welcome.