Default to Xbe Path if no symbolic links could be resolved

Fixes PathNotFound error in Rise of the Triad
Allows the audio to play!
This commit is contained in:
Luke Usher 2017-07-21 22:30:06 +01:00
parent 128e3706f8
commit 27b3b4031b
1 changed files with 15 additions and 17 deletions

View File

@ -249,6 +249,20 @@ NTSTATUS _CxbxConvertFilePath(
// else TODO : Turok requests 'gamedata.dat' without a preceding path, we probably need 'CurrentDir'-functionality
}
// Check if the path accesses a partition from Harddisk0 :
if (_strnicmp(RelativePath.c_str(), DeviceHarddisk0PartitionPrefix.c_str(), DeviceHarddisk0PartitionPrefix.length()) == 0)
{
XboxFullPath = RelativePath;
// Remove Harddisk0 prefix, in the hope that the remaining path might work :
RelativePath.erase(0, DeviceHarddisk0.length() + 1);
// And set Root to the folder containing the partition-folders :
*RootDirectory = CxbxBasePathHandle;
HostPath = CxbxBasePath;
} else {
// Finally, Assume relative to Xbe path
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
}
if (NtSymbolicLinkObject != NULL)
{
HostPath = NtSymbolicLinkObject->HostSymbolicLinkPath;
@ -265,22 +279,6 @@ NTSTATUS _CxbxConvertFilePath(
XboxFullPath = NtSymbolicLinkObject->XboxSymbolicLinkPath;
*RootDirectory = NtSymbolicLinkObject->RootDirectoryHandle;
}
else
{
// No symbolic link - as last resort, check if the path accesses a partition from Harddisk0 :
if (_strnicmp(RelativePath.c_str(), DeviceHarddisk0PartitionPrefix.c_str(), DeviceHarddisk0PartitionPrefix.length()) != 0)
{
EmuWarning((("Path not available : ") + OriginalPath).c_str());
return STATUS_UNRECOGNIZED_VOLUME; // TODO : Is this the correct error?
}
XboxFullPath = RelativePath;
// Remove Harddisk0 prefix, in the hope that the remaining path might work :
RelativePath.erase(0, DeviceHarddisk0.length() + 1);
// And set Root to the folder containing the partition-folders :
*RootDirectory = CxbxBasePathHandle;
HostPath = CxbxBasePath;
}
// Check for special case : Partition0
/* TODO : Translate this Dxbx code :
@ -332,7 +330,7 @@ NTSTATUS CxbxObjectAttributesToNT(
std::wstring RelativeHostPath;
NtDll::HANDLE RootDirectory = ObjectAttributes->RootDirectory;
// Handle special Xbox root directory constants
// Handle special root directory constants
if (RootDirectory == (NtDll::HANDLE)-4) {
RootDirectory = NULL;