Skip to content

[WIP] Wii U memory map + .rpx hashing#515

Open
Loloseiz wants to merge 2 commits into
RetroAchievements:developfrom
Loloseiz:wii-u-memory-map
Open

[WIP] Wii U memory map + .rpx hashing#515
Loloseiz wants to merge 2 commits into
RetroAchievements:developfrom
Loloseiz:wii-u-memory-map

Conversation

@Loloseiz
Copy link
Copy Markdown

@Loloseiz Loloseiz commented May 5, 2026

I have mapped the Wii U virtual memory based on Cafe OS specifications and verified the bounds against Cemu's open-source allocator (coreinit_Memory.cpp).

  • MEM2 (2GB): 0x10000000 -> RC_MEMORY_TYPE_SYSTEM_RAM
  • MEM1 (32MB): 0xF4000000 -> RC_MEMORY_TYPE_VIRTUAL_RAM
  • Code/Heap (240MB): 0x01000000 -> RC_MEMORY_TYPE_READONLY

I saw Jamiras's previous concerns on the 3DS PR regarding the massive memory dumps, so I marked MEM1 as VIRTUAL_RAM and the Code segment as READONLY to restrict the default searchable pool strictly to the MEM2 block, not sure if much more can / needs to be done as of now.

I also implemented the ELF parser in hash_rom.c to identify and hash .rpx executables, along with custom unit tests.

Let me know if I should change something, I tried to follow the baseline set with previous functions and methods, hope this will be useful !

@Loloseiz Loloseiz marked this pull request as ready for review May 5, 2026 22:15
Copy link
Copy Markdown
Member

@Jamiras Jamiras left a comment

Choose a reason for hiding this comment

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

I really don't feel like we're in a position to support Wii U at this time (or any time soon).

{ 0x90000000U, 0xF3FFFFFFU, 0x90000000U, RC_MEMORY_TYPE_UNUSED, "Unused" },
{ 0xF4000000U, 0xF5FFFFFFU, 0xF4000000U, RC_MEMORY_TYPE_VIRTUAL_RAM, "MEM1" }
};
static const rc_memory_regions_t rc_memory_regions_wii_u = { _rc_memory_regions_wii_u, 5 };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I saw Jamiras's previous concerns on the 3DS PR regarding the massive memory dumps, so I marked MEM1 as VIRTUAL_RAM and the Code segment as READONLY to restrict the default searchable pool strictly to the MEM2 block, not sure if much more can / needs to be done as of now.

Excluding the 32MB MEM1 while still including the 2048MB MEM2 doesn't really seem like it would help much. I've been very reluctant to proceed with the 3DS PR because it's trying to expose 1/3 as much memory as this PR does.

When a user presses "New Search", we ask the core/emulator for all the memory expected by the memory map. This gets saved in a snapshot so when the user presses "Filter", we can identify which memory values changed. With a 2GB+ initial snapshot, and large subsets of that for each step of filtering, the host system will very quickly run out of memory before the developer is able to find the data they're looking for.

Comment thread src/rhash/hash_rom.c
return rc_hash_iterator_buffer(hash, iterator);
}

int rc_hash_wiiu(char hash[33], const rc_hash_iterator_t* iterator)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Conceptually, this should be rc_hash_wiiu_rpx. Most users will expect support for wux files, and this function won't handle those.

Additionally, wux processing should be in hash_disc.c, so there shouldn't be a common function that tries to support both.

image[2] = 'L';
image[3] = 'F';
image[5] = 0x02; /* Big Endian */
image[18] = 0x14; /* PowerPC */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These comments should be duplicated in the validation logic.


/* Wii U */
TEST(test_hash_wiiu_rpx);
TEST(test_hash_wiiu_invalid);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With the implied future support of wux files, this should be test_hash_wiiu_rpx_invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants