[WIP] Wii U memory map + .rpx hashing#515
Conversation
Jamiras
left a comment
There was a problem hiding this comment.
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 }; |
There was a problem hiding this comment.
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.
| return rc_hash_iterator_buffer(hash, iterator); | ||
| } | ||
|
|
||
| int rc_hash_wiiu(char hash[33], const rc_hash_iterator_t* iterator) |
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
These comments should be duplicated in the validation logic.
|
|
||
| /* Wii U */ | ||
| TEST(test_hash_wiiu_rpx); | ||
| TEST(test_hash_wiiu_invalid); |
There was a problem hiding this comment.
With the implied future support of wux files, this should be test_hash_wiiu_rpx_invalid.
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).0x10000000->RC_MEMORY_TYPE_SYSTEM_RAM0xF4000000->RC_MEMORY_TYPE_VIRTUAL_RAM0x01000000->RC_MEMORY_TYPE_READONLYI saw Jamiras's previous concerns on the 3DS PR regarding the massive memory dumps, so I marked MEM1 as
VIRTUAL_RAMand the Code segment asREADONLYto 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.cto identify and hash.rpxexecutables, 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 !