Skip to content

XLaunchXBE's descendant functions bugs #637

@RadWolfie

Description

@RadWolfie

I ran a test on:

nxdk/lib/hal/fileio.c

Lines 94 to 99 in 500354e

* d:\foo\bar.txt
* .\foo\bar.txt ==> d:\foo\bar.txt
* \foo\bar.txt ==> d:\foo\bar.txt
* foo\bar.txt ==> d:\foo\bar.txt
* \\.\D:\foo\bar.txt ==> d:\foo\bar.txt
* \??\c:\foo\bar.txt ==> c:\foo\bar.txt

And its output are:

d:\foo\bar.txt test output: \??\D:\foo\bar.txt
.\foo\bar.txt test output: \Device\Harddisk0\Partition1\foo\bar.txt
\foo\bar.txt test output: \Device\Harddisk0\Partition1\foo\bar.txt
foo\bar.txt test output: \Device\Harddisk0\Partition1\foo\bar.txt
\\.\D:\foo\bar.txt test output: \??\D:\foo\bar.txt
\??\d:\foo\bar.txt test output: \??\D:\foo\bar.txt

The more I look at output result... the more it doesn't make any sense to me. Retail console doesn't accept \??\D:\foo\bar.txt path when it should be absolute path. In my opinion, it warrant for rehaul work since nxdk is relying on its own partition table than retrieve full path by using NtOpenSymbolicLinkObject and NtQuerySymbolicLinkObject functions for any mounted drive letter had been done by the title itself. Plus title has the ability to choose which drive letter can be mount on any partitions and child directory.

Seems to be relative to #500 problem. If this whole information should be transfer to #500's post, then I'll transfer it. Below research was done first on a new ticket then realize there are more problems from internal functions.

Below is the original draft issue I made but turns out there are even more issues with nxdk's launch xbe's descendant functions.

If I read XLaunchXBEEx function correctly, it does not look right. From else statement below, it doesn't check for semicolon first incase title wish to set D:\ mount to a parent directory or above by default from reboot process just like retail titles compiled with XDK did. Having two or more semicolons will cause reboot to dashboard or error screen. (For me, it boots to dashboard.)

nxdk/lib/hal/xbox.c

Lines 69 to 86 in 500354e

if (!xbePath) {
launchDataPage->Header.dwLaunchDataType = LDT_LAUNCH_DASHBOARD;
} else {
XConvertDOSFilenameToXBOX(xbePath, launchDataPage->Header.szLaunchPath);
// one last thing... xbePath now looks like:
// \Device\Harddisk0\Partition2\blah\doom.xbe
// but it has to look like:
// \Device\Harddisk0\Partition2\blah;doom.xbe
char *lastSlash = strrchr(launchDataPage->Header.szLaunchPath, '\\');
if (!lastSlash) {
// if we couldn't find a trailing slash, the conversion to
// the xbox path mustn't have worked, so we will return
return;
}
*lastSlash = ';';
}

Beside above issue, I wasn't really sure if it must have semicolon until I ran another test again without any semicolon. The result return as:

LaunchDataPage->Header.szLaunchPath: \Device\Harddisk0\Partition1\Games\reboot\default.xbe
XeImageFileName: \Device\Harddisk0\Partition1\Games\reboot\default.xbe
\??\D: == \Device\Harddisk0\Partition1\Games\reboot\

vs unmodified nxdk:

LaunchDataPage->Header.szLaunchPath: \Device\Harddisk0\Partition1\Games\reboot;default.xbe
XeImageFileName: \Device\Harddisk0\Partition1\Games\reboot\default.xbe
\??\D: == \Device\Harddisk0\Partition1\Games\reboot

The only difference is without semicolon will include backslash whilst with will exclude backslash. But it doesn't affect D drive mounted to read/write contents since I can read the updated log files just fine. If a backslash existed at end of file, in xbox environment it is act as a directory than a "possible" file. Yet the xbox kernel knows to mount it as a directory than a file.


With that said, why semicolon character is a requirement if title doesn't set semicolon in its path to xbe? If I recall, it is entirely optional for title to choose alternative mount point for D drive letter on reboot process.

// if we couldn't find a trailing slash, the conversion to 
// the xbox path mustn't have worked, so we will return

In my opinion, this comment isn't correct. For example, you can have multiple xbes, or re-use the same xbe, from root directory without need to have semicolon character. However, it is also not a requirement as well for child directory wherever xbe file reside in too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions