Skip to content
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

Expands XLaunchXBE to allow caller to set LaunchData. #501

Merged
merged 1 commit into from
Mar 4, 2022

Conversation

abaire
Copy link
Contributor

@abaire abaire commented Sep 15, 2021

  • Adds an extended version of XLaunchXBE that allows the LaunchData member to be set on the persisted launch data struct.
  • Adds a helper method to retrieve the launch type and data (with handling of the launch-from-dashboard case).

Basic test at abaire/nxdk_launch_test

Note that there seems to be a bug in the handling of "D:" prefixed paths (see #500).

@thrimbor
Copy link
Member

thrimbor commented Jan 9, 2022

Do you have a specific use case for this code?
Not that I think what you're adding isn't useful, but that code is inherited from OpenXDK and has several fundamental flaws and limitations (some of which #500 hints at). We're slowly deprecating and replacing the old OpenXDK parts, and it might make sense to delay adding new features until we have come up with a better API.

@abaire
Copy link
Contributor Author

abaire commented Jan 9, 2022

Initially I had two use cases:
One was dusting off my old MAMEoX project to see if I can get it buildable w/ the nxdk (now that I'm more familiar with the nxdk I think this is still a ways away)

The other would be using a similar approach to MAMEoX in having a menu launcher and a series of worker XBEs in some of the tests I've been writing to aid xemu contributions (e.g., https://github.com/abaire/nxdk_pgraph_tests). There are a few tests that are reliant on having a clean boot state to be valid; though this may just be because I haven't figured out the right set of explicit commands to reset to initial state (e.g., the behavior of the fixed function pipeline when lighting is enabled in a BEGIN_END but no normals are explicitly provided w/ the vertex data).

That said, at the moment I'm already maintaining some patches on top of the nxdk to expose the internals of pbkit and I could always write info to a cache file so I'm not blocked by not having this functionality.

}
if (launchData) {
memcpy(launchDataPage->LaunchData, launchData, sizeof(launchDataPage->LaunchData));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If launchData is NULL the LaunchDataPage will still be allocated and point at zero-bytes; is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intentional that LaunchDataPage's LaunchData will be zero bytes (preserving the existing behavior).

lib/hal/xbox.c Outdated
if (LaunchDataPage == NULL)
void XLaunchXBEEx(const char *xbePath, const void *launchData)
{
if (LaunchDataPage == NULL) {
LaunchDataPage = MmAllocateContiguousMemory(0x1000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be using LaunchDataPageSize now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent point, done.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: What should happen to the LaunchDataPage here? Should the allocation be undone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it should, but I was conservative about preserving the existing behavior which does leave the LDP allocated and persisted.

@thrimbor
Copy link
Member

thrimbor commented Mar 2, 2022

I gave this another look (sorry for taking so long), and I think it's fine to merge this as is. There are a couple of design issues, but those stem from the original code, not your changes.
If there's no objection I'll merge it tomorrow.

@JayFoxRox
Copy link
Member

Commit prefix is incorrect; should be hal as its modifying old OpenXDK HAL code, not the newer nxdk lib.

@thrimbor
Copy link
Member

thrimbor commented Mar 4, 2022

I took the liberty of fixing that myself. Merging now.

@thrimbor thrimbor merged commit 32df109 into XboxDev:master Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants