-
-
Notifications
You must be signed in to change notification settings - Fork 119
Add support for sending GameID information to MemCardPRO GC #51
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
Open
Arrghus8
wants to merge
21
commits into
wiidev:enhanced
Choose a base branch
from
Arrghus8:enhanced
base: enhanced
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f4641ca
Add MemCardPro GameID support (using Swiss implementation)
jllottes d39bf64
Added "Off"/"Full ID"/"Short ID" options.
jllottes b3bbe92
Update README.md
Arrghus8 0e03757
Added "Off"/"Full ID"/"Short ID" options.
jllottes c8f1816
Replace spaces with tabs. Add Swiss copyright information to `MemCard…
jllottes fd79549
Replace spaces with tabs. Add Swiss copyright information to `MemCard…
jllottes 2751853
Replace spaces with tabs. Add Swiss copyright information to `MemCard…
jllottes 10539bb
Replace spaces with tabs. Add Swiss copyright information to `MemCard…
jllottes badf8c8
Send GameID information within `BootDevolution`, `BootNintendont`, an…
jllottes 2aeb648
Send GameID information within `BootDevolution`, `BootNintendont`, an…
jllottes 394fdea
Cleaning up, send GameID with (c)MIOS, fix `BootDIOSMIOS` GameID
jllottes 2b4a0b8
Cleaning up, send GameID with (c)MIOS, fix `BootDIOSMIOS` GameID
jllottes 2f8efe8
Cleaning up, send GameID with (c)MIOS, fix `BootDIOSMIOS` GameID
jllottes a82bc3c
Move "MemCardPro GameID" setting above "GameCube Mode" setting.
jllottes d6f41b6
Move "MemCardPro GameID" setting above "GameCube Mode" setting.
jllottes 830f876
Move "MemCardPro GameID" setting above "GameCube Mode" setting.
jllottes 468bf0c
Change setting name "MemCardPro GameID" -> "MemCard PRO Game ID"
jllottes 17eca89
Change setting name "MemCard PRO Game ID" -> "MemCard PRO GameID"
jllottes 7076bdc
Change setting name "MemCard PRO GameID" -> "MemCard PRO"
jllottes b1dfe4c
Move "MemCard PRO" setting below "GameCube Mode" in `LoaderSettings.cpp`
jllottes ed0959a
Fix incompability with MemCard PRO GC firmware 3.x.x
jllottes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,7 @@ | ||
| <p align="center"><a href="https://github.com/wiidev/usbloadergx/" title="USB Loader GX"><img src="data/web/logo.png"></a></p> | ||
| <p align="center"> | ||
| <a href="https://github.com/wiidev/usbloadergx/releases" title="Releases"><img src="https://img.shields.io/github/v/release/wiidev/usbloadergx?logo=github"></a> | ||
| <a href="https://github.com/wiidev/usbloadergx/actions" title="Actions"><img src="https://img.shields.io/github/actions/workflow/status/wiidev/usbloadergx/main.yml?branch=enhanced&logo=github"></a> | ||
| </p> | ||
|
|
||
| ## Description | ||
| USB Loader GX allows you to play Wii and GameCube games from a USB storage device or an SD card, launch other homebrew apps, create backups, use cheats in games, and a whole lot more. | ||
|
|
||
| ## Installation | ||
| 1. Extract the apps folder to the root of your SD card and replace any existing files. | ||
| 2. Install the [latest d2x cIOS](https://github.com/wiidev/d2x-cios/releases). | ||
| 3. Optional: Update wiitdb.xml by selecting the update option within the loaders settings menu. | ||
| 4. Optional: Install the loaders [forwarder channel](https://raw.githubusercontent.com/wiidev/usbloadergx/updates/USBLoaderGX_forwarder%5BUNEO%5D.wad), then go into `Loader Settings` and set `Return To` to `UNEO`. | ||
|
|
||
| ## d2x cIOS | ||
| 1. Use the correct cIOS package for your console — e.g., `d2x-v11-beta3` for the Wii and `d2x-v11-beta3-vWii` for the Wii U. | ||
| 2. When using the d2x cIOS installer, set the cIOS to the version that you downloaded — e.g., `d2x-v11-beta3`. | ||
| 3. Install the cIOS into each slot with the following settings. | ||
| Added support for sending GameID information to MemCard PRO GC. Based on the [implementation in Swiss](https://github.com/FIX94/Nintendont/commit/a186ea2715cdb877b3cc5b3d4269a18e2ace8d48). | ||
|
|
||
| ```` | ||
| Slot 248 base 38 | ||
| Slot 249 base 56 | ||
| Slot 250 base 57 | ||
| Slot 251 base 58 | ||
| ```` | ||
| There are three settings: | ||
| * `Off`: No GameID information is sent to the memory slots. | ||
| * `Full ID`: The full GameID is sent, including Company and Revision data (e.g. RSBE0100). This matches the Swiss naming convention. | ||
| * `Short ID`: A shortened ID is sent, omitting the Company and Revision data (e.g. RSBE). This matches the Nintendont Emulated Memory Card naming convention. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /* | ||
| From Swiss, mcp.c | ||
| */ | ||
|
|
||
| #include <stdbool.h> | ||
| #include <string.h> | ||
| #include <ogc/card.h> | ||
| #include <ogc/exi.h> | ||
| #include "usbloader/disc.h" | ||
| #include "MemCardPro.h" | ||
|
|
||
| static const char digits[] = "0123456789ABCDEF"; | ||
|
|
||
| s32 MCP_ProbeEx(s32 chan) | ||
| { | ||
| return CARD_ProbeEx(chan, NULL, NULL); | ||
| } | ||
|
|
||
| s32 MCP_GetDeviceID(s32 chan, u32 *id) | ||
| { | ||
| bool err = false; | ||
| u8 cmd[2]; | ||
|
|
||
| if (!EXI_Lock(chan, EXI_DEVICE_0, NULL)) return MCP_RESULT_BUSY; | ||
| if (!EXI_Select(chan, EXI_DEVICE_0, EXI_SPEED16MHZ)) { | ||
| EXI_Unlock(chan); | ||
| return MCP_RESULT_NOCARD; | ||
| } | ||
|
|
||
| cmd[0] = 0x8B; | ||
| cmd[1] = 0x00; | ||
|
|
||
| err |= !EXI_Imm(chan, cmd, 2, EXI_WRITE, NULL); | ||
| err |= !EXI_Sync(chan); | ||
| err |= !EXI_Imm(chan, id, 4, EXI_READ, NULL); | ||
| err |= !EXI_Sync(chan); | ||
| err |= !EXI_Deselect(chan); | ||
| EXI_Unlock(chan); | ||
|
|
||
| if (err) | ||
| return MCP_RESULT_NOCARD; | ||
| else if (*id >> 16 != 0x3842) | ||
| return MCP_RESULT_WRONGDEVICE; | ||
| else | ||
| return MCP_RESULT_READY; | ||
| } | ||
|
|
||
| s32 MCP_SetDiskID(s32 chan, const dvddiskid *diskID, bool shortID) | ||
| { | ||
| bool err = false; | ||
| u8 cmd[12]; | ||
|
|
||
| if (!EXI_Lock(chan, EXI_DEVICE_0, NULL)) return MCP_RESULT_BUSY; | ||
| if (!EXI_Select(chan, EXI_DEVICE_0, EXI_SPEED16MHZ)) { | ||
| EXI_Unlock(chan); | ||
| return MCP_RESULT_NOCARD; | ||
| } | ||
|
|
||
| memset(cmd, 0, sizeof(cmd)); | ||
| cmd[0] = 0x8B; | ||
| cmd[1] = 0x11; | ||
|
|
||
| if (diskID) { | ||
| memcpy(&cmd[2], diskID->gamename, 4); | ||
| if (!shortID) | ||
| { | ||
| memcpy(&cmd[6], diskID->company, 2); | ||
| cmd[8] = digits[diskID->disknum / 16]; | ||
| cmd[9] = digits[diskID->disknum % 16]; | ||
| cmd[10] = digits[diskID->gamever / 16]; | ||
| cmd[11] = digits[diskID->gamever % 16]; | ||
| }; | ||
| } | ||
|
|
||
| err |= !EXI_ImmEx(chan, cmd, sizeof(cmd), EXI_WRITE); | ||
| err |= !EXI_Deselect(chan); | ||
| EXI_Unlock(chan); | ||
|
|
||
| return err ? MCP_RESULT_NOCARD : MCP_RESULT_READY; | ||
| } | ||
|
|
||
| s32 MCP_SetDiskInfo(s32 chan, const char diskInfo[64]) | ||
| { | ||
| bool err = false; | ||
| u8 cmd[2]; | ||
|
|
||
| if (!EXI_Lock(chan, EXI_DEVICE_0, NULL)) return MCP_RESULT_BUSY; | ||
| if (!EXI_Select(chan, EXI_DEVICE_0, EXI_SPEED16MHZ)) { | ||
| EXI_Unlock(chan); | ||
| return MCP_RESULT_NOCARD; | ||
| } | ||
|
|
||
| cmd[0] = 0x8B; | ||
| cmd[1] = 0x13; | ||
|
|
||
| err |= !EXI_Imm(chan, cmd, 2, EXI_WRITE, NULL); | ||
| err |= !EXI_Sync(chan); | ||
| err |= !EXI_ImmEx(chan, (char *)diskInfo, 64, EXI_WRITE); | ||
| err |= !EXI_Deselect(chan); | ||
| EXI_Unlock(chan); | ||
|
|
||
| return err ? MCP_RESULT_NOCARD : MCP_RESULT_READY; | ||
| } | ||
|
|
||
| /* | ||
| From Swiss, gameid.c | ||
| */ | ||
|
|
||
| void gameID_early_set(const discHdr *header, bool shortID) | ||
| { | ||
| for (s32 chan = 0; chan < 2; chan++) { | ||
| u32 id; | ||
| s32 ret; | ||
|
|
||
| while ((ret = MCP_ProbeEx(chan)) == MCP_RESULT_BUSY); | ||
| if (ret < 0) continue; | ||
| while ((ret = MCP_GetDeviceID(chan, &id)) == MCP_RESULT_BUSY); | ||
| if (ret < 0) continue; | ||
| while ((ret = MCP_SetDiskID(chan, (dvddiskid *)header, shortID)) == MCP_RESULT_BUSY); | ||
| if (ret < 0) continue; | ||
| while ((ret = MCP_SetDiskInfo(chan, header->title)) == MCP_RESULT_BUSY); | ||
| if (ret < 0) continue; | ||
| } | ||
| } | ||
|
Arrghus8 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| From Swiss, mcp.h | ||
| */ | ||
|
|
||
| #ifndef __MCP_H__ | ||
| #define __MCP_H__ | ||
|
|
||
| #include <gctypes.h> | ||
| #include <ogc/dvd.h> | ||
| #include "usbloader/disc.h" | ||
|
|
||
| #define MCP_RESULT_READY 0 | ||
| #define MCP_RESULT_BUSY -1 | ||
| #define MCP_RESULT_WRONGDEVICE -2 | ||
| #define MCP_RESULT_NOCARD -3 | ||
| #define MCP_RESULT_FATAL_ERROR -128 | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| s32 MCP_ProbeEx(s32 chan); | ||
| s32 MCP_GetDeviceID(s32 chan, u32 *id); | ||
| s32 MCP_SetDiskID(s32 chan, const dvddiskid *diskID, bool shortID); | ||
| s32 MCP_SetDiskInfo(s32 chan, const char diskInfo[64]); | ||
| void gameID_early_set(const discHdr *header, bool shortID); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif | ||
|
Arrghus8 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.