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

XamSwapDisc Export #1261

Open
Wildenhaus opened this issue Nov 13, 2018 · 2 comments
Open

XamSwapDisc Export #1261

Wildenhaus opened this issue Nov 13, 2018 · 2 comments
Labels

Comments

@Wildenhaus
Copy link
Contributor

Wildenhaus commented Nov 13, 2018

Disc Swapping is not yet implemented as a Xam export. The operation seems to be super simple, although it is likely doing more under the hood.

XamSwapDisc takes three parameters:

  • dword_t disc_number
  • pointer_t<kernel::X_KEVENT> completion_handle
  • unknown_t error_string

The export is essentially just an event that resolves when the proper disc is inserted. We can manually mount the image being swapped, assign it the d: and game: symlinks, and invoke KeSetEvent(completion_handle, 1, 0) to signify that the game is swapped. This method is confirmed working for L.A. Noire.

The pointer type of completion_handle uses identifier 0xD00EBEEF and is currently unimplemented. It is, however, an XObject::kTypeEvent and resolving it does seem to work. It would be nice to have more information on this type.

It is possible that the original logic of XamSwapDisc used the 0x20 byte hash accompanied by each Media ID (found in the xex header) to verify the correct game.

Here's my prototype of how this can be implemented. When we have a game library manager, we could easily resolve the path of the proper image and swap when this export is invoked.

@Wildenhaus Wildenhaus changed the title Disc Swapping support XamSwapDisc Export Nov 13, 2018
@Prism019
Copy link
Contributor

Does this work when loading .xex's as well? From what I remember, title updates only work when loading .xex files, but someone please correct me if I'm wrong.

@Wildenhaus
Copy link
Contributor Author

Wildenhaus commented Nov 14, 2018

Does this work when loading .xex's as well?

If you decompress and decrypt both discs' xex files, you'll find that they are identical except for some hashes, media id, and disc number in the header. So as long as the proper files are in the mounted directory it should work just fine.

If you're referring to swapping xex files entirely (e.g. to dash or a different game), then no. That requires XamLoaderLaunchTitle.

@DrChat DrChat added the kernel label Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants