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

vWii Channel view fix #43

Open
wants to merge 1 commit into
base: enhanced
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ usbloader_gx/
/source/svnrev.c
/usbloader_gx.zip
/wiiload
/output
9 changes: 8 additions & 1 deletion source/SystemMenu/SystemMenuResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ bool SystemMenuResources::Init()
// determine resource cid
u16 idx = 0xffff;
tmd_content *contents = TMD_CONTENTS( p_tmd );

// Priiloader moves some system resources that we rely on from index 1 to index 9.
// In doing this it creates a 10th index (9) to contain the moved resources.
// If priiloader is installed, we need to look for content at index 9 instead of index 1.
bool hasVWiiPriiloader = p_tmd->num_contents == 10;
u16 targetIndex = hasVWiiPriiloader ? 9 : 1;
Copy link

Choose a reason for hiding this comment

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

Can we find a way to find out the offset on pattern matching, i.e. without any reference to the PriiLoader?
The current solution is fragile for future changes.

Copy link
Author

Choose a reason for hiding this comment

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

I was thinking the best solution would be to create a list of valid content Ids which represent the system menu resources we're looking for.

For example, here's the relevant tmd which contains an entry for the system menu resources on a regular wii

Content ID   Index  Type   Size                 SHA1 Hash
----------   -----  -----  ----                 ----------
150          0      0x0001 64                   529573fc8c6aa431c0a03c5c97bce9bd9af6ae7a
151          1      0x0001 6505767              ab8f9acdf2d0066c9d2dbc740cffc70804735797
9            2      0x8001 4559887              f5dd17b3200dd4d6be2b25b577c99e5f941b7324
10           3      0x8001 2669044              32b339cbbb507d502779259a7866995d030b1d88
11           4      0x8001 686468               5f1bb7b02794b14e88b72269a3376d23051dad1d
12           5      0x8001 3649020              4fad97fd4a288c47e0587f3bbd292379f8709eb9
89           6      0x8001 272512               293d734260ac99f4d3de75310a7d273466f6be08
90           7      0x8001 53216                534d2952fe2f664370d8364b9a0a0d1f55a05931
152          8      0x0001 3867904              26116613f624061ba99c8d1a299aaa6efa85670d

Content ID 151 contains what we need, and we could just look for that rather than a specific index.

I didn't go with this approach because I couldn't find the TMD for the wii mini or vWii. If somebody can provide me with the content ID for vWii, and wii mini I can go with that approach.

The existing solution referencing a specific index rather than content ID is also brittle, and in fact is why it broke 😅

Copy link
Author

Choose a reason for hiding this comment

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

I think we'd also need them per region so, some list of content Ids, 1 per wii type (vWii, wii mini, wii) per region (EU, JP, US, etc;)

Copy link

Choose a reason for hiding this comment

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

Well, how about asking for help on gbatemp? The probability of obtaining the information is probably greater than in a PR.

Copy link
Author

Choose a reason for hiding this comment

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

I probably will. You were just asking for a way to do this without using the index, and I was just elaborating.

Copy link

Choose a reason for hiding this comment

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


for( u16 i = 0; i < p_tmd->num_contents; i++ )
{
if( contents[ i ].index == 1 )
if( contents[ i ].index == targetIndex )
{
idx = i;
break;
Expand Down