review remarks
This commit is contained in:
parent
cf3655bed1
commit
08dd615d37
|
@ -1398,7 +1398,7 @@ __declspec(noreturn) void CxbxKrnlInit
|
|||
CxbxResolveHostToFullPath(relative_path, "xbe's directory");
|
||||
|
||||
CxbxBasePathHandle = CreateFile(CxbxBasePath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
int CxbxTitleDeviceDriveIndex = -1;
|
||||
int CxbxCdrom0DeviceIndex = -1;
|
||||
bool isEmuDisk = _strnicmp(relative_path.c_str(), CxbxBasePath.c_str(), CxbxBasePath.size() - 1) == 0;
|
||||
// Check if title mounth path is already set. This may occur from early boot of Chihiro title.
|
||||
char title_mount_path[sizeof(szFilePath_Xbe)];
|
||||
|
@ -1415,9 +1415,10 @@ __declspec(noreturn) void CxbxKrnlInit
|
|||
|
||||
// TODO: Find a place to make permanent placement for DeviceCdrom0 that does not have disc loaded.
|
||||
if (tmp_buffer[0] != '\0') {
|
||||
CxbxTitleDeviceDriveIndex = CxbxRegisterDeviceHostPath(DeviceCdrom0, tmp_buffer);
|
||||
CxbxCdrom0DeviceIndex = CxbxRegisterDeviceHostPath(DeviceCdrom0, tmp_buffer);
|
||||
// Since Chihiro also map Mbfs to the same path as Cdrom0, we'll map it the same way.
|
||||
if (g_bIsChihiro) {
|
||||
CxbxRegisterDeviceHostPath(DriveMbfs, tmp_buffer);
|
||||
(void)CxbxRegisterDeviceHostPath(DriveMbfs, tmp_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1445,7 +1446,7 @@ __declspec(noreturn) void CxbxKrnlInit
|
|||
#else
|
||||
// HACK: It is a hack to override XDK's default mount to CdRom0 which may not exist when launch to dashboard directly.
|
||||
// Otherwise, titles may launch to dashboard, more specifically xbox live title, and back.
|
||||
if (CxbxTitleDeviceDriveIndex == -1 || lastFind != std::string::npos) {
|
||||
if (CxbxCdrom0DeviceIndex == -1 || lastFind != std::string::npos) {
|
||||
#endif
|
||||
CxbxCreateSymbolicLink(DriveD, relative_path);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ CRITICAL_SECTION dbgCritical;
|
|||
#endif
|
||||
|
||||
// Global Variable(s)
|
||||
HANDLE g_hCurDir = NULL;
|
||||
CHAR *g_strCurDrive= NULL;
|
||||
volatile thread_local bool g_bEmuException = false;
|
||||
static thread_local bool bOverrideEmuException;
|
||||
volatile bool g_bEmuSuspended = false;
|
||||
|
|
|
@ -63,9 +63,6 @@ extern volatile bool g_bEmuSuspended;
|
|||
// global exception patching address
|
||||
extern void * funcExclude[2048];
|
||||
|
||||
// partition emulation directory handles
|
||||
extern HANDLE g_hCurDir;
|
||||
extern CHAR *g_strCurDrive;
|
||||
extern HWND g_hEmuWindow;
|
||||
|
||||
#define GET_FRONT_WINDOW_HANDLE ((CxbxKrnl_hEmuParent != nullptr) ? CxbxKrnl_hEmuParent : g_hEmuWindow)
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
|
||||
#include <filesystem>
|
||||
|
||||
// partition emulation directory handles
|
||||
HANDLE g_hCurDir_hack = NULL; // HACK: We should not be depending on this variable. Instead, we should fix/implement Ob/Io objects such as IoCreateDevice.
|
||||
|
||||
// Default Xbox Partition Table
|
||||
#define PE_PARTFLAGS_IN_USE 0x80000000
|
||||
#define XBOX_SWAPPART1_LBA_START 0x400
|
||||
|
@ -433,7 +436,7 @@ NTSTATUS CxbxConvertFilePath(
|
|||
else if (RelativePath[0] == '$') {
|
||||
if (RelativePath.compare(0, 5, "$HOME") == 0) // "xbmp" needs this
|
||||
{
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir_hack);
|
||||
RelativePath.erase(0, 5); // Remove '$HOME'
|
||||
}
|
||||
else
|
||||
|
@ -441,7 +444,7 @@ NTSTATUS CxbxConvertFilePath(
|
|||
}
|
||||
// Check if the path starts with a relative path indicator :
|
||||
else if (RelativePath[0] == '.') {// "4x4 Evo 2" needs this
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir_hack);
|
||||
RelativePath.erase(0, 1); // Remove the '.'
|
||||
}
|
||||
else {
|
||||
|
@ -467,7 +470,7 @@ NTSTATUS CxbxConvertFilePath(
|
|||
}
|
||||
|
||||
if (NtSymbolicLinkObject != nullptr || !find_path.HostDirPath.empty()) {
|
||||
/// If found, then we can skip misc checks below.
|
||||
// If found, then we can skip misc checks below.
|
||||
}
|
||||
// Check if the path accesses a partition from Harddisk0 :
|
||||
else if (_strnicmp(RelativePath.c_str(), DeviceHarddisk0PartitionPrefix.c_str(), DeviceHarddisk0PartitionPrefix.length()) == 0) {
|
||||
|
@ -481,13 +484,13 @@ NTSTATUS CxbxConvertFilePath(
|
|||
// NOTE: RootDirectory cannot be ignored.
|
||||
// Any special handling for it should be done below.
|
||||
else if (*RootDirectory == nullptr) {
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir_hack);
|
||||
}
|
||||
else if (*RootDirectory == ObDosDevicesDirectory()) {
|
||||
// This is a special handle that tells the API that this is a DOS device
|
||||
// We can safely remove it and forward to the Xbe directory.
|
||||
// Test case GTA3
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
|
||||
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir_hack);
|
||||
}
|
||||
else if (*RootDirectory == ObWin32NamedObjectsDirectory()) {
|
||||
// NOTE: A handle of -4 on the Xbox signifies the path should be in the BaseNamedObjects namespace.
|
||||
|
@ -718,8 +721,9 @@ xbox::ntstatus_xt CxbxCreateSymbolicLink(std::string SymbolicLinkName, std::stri
|
|||
if (result != xbox::status_success) {
|
||||
SymbolicLinkObject->NtClose();
|
||||
}
|
||||
// TODO: Remove whole else if statement below, see g_hCurDir_hack's comment for remark.
|
||||
else if (SymbolicLinkObject->DriveLetter == CxbxAutoMountDriveLetter) {
|
||||
g_hCurDir = SymbolicLinkObject->RootDirectoryHandle;
|
||||
g_hCurDir_hack = SymbolicLinkObject->RootDirectoryHandle;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -811,8 +815,9 @@ NTSTATUS EmuNtSymbolicLinkObject::Init(std::string aSymbolicLinkName, std::strin
|
|||
if (DriveLetter >= 'A' && DriveLetter <= 'Z') {
|
||||
NtSymbolicLinkObjects[DriveLetter - 'A'] = NULL;
|
||||
NtDll::NtClose(RootDirectoryHandle);
|
||||
// TODO: Remove whole if statement below, see g_hCurDir_hack's comment for remark.
|
||||
if (DriveLetter == CxbxAutoMountDriveLetter) {
|
||||
g_hCurDir = NULL;
|
||||
g_hCurDir_hack = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue