NR/RVT-R dumping support (WIP) - #388
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Will try to review this week, Nintendo likes it complicated! |
superg
left a comment
There was a problem hiding this comment.
This looks good, just couple small things.
If it's tested, let's clean it up and merge.
| auto manufacturer = read_vector(manufacturer_path); | ||
| if(manufacturer.size() > sizeof(CMD_ParameterListHeader)) | ||
| { | ||
| auto idString = (const char*)&manufacturer[sizeof(CMD_ParameterListHeader) + 0x10]; |
There was a problem hiding this comment.
I like this detection better than what I had. Is there any structure definition for nintendo manufacturer or it's not reverse engineered?
| if(nintendo_key) | ||
| offset = (*nintendo_key ^ (psn >> 4 & 0xF)) * FORM1_DATA_SIZE + 7 * FORM1_DATA_SIZE + FORM1_DATA_SIZE / 2; | ||
| { | ||
| offset = *nintendo_key ^ (psn >> 4 & 0xF); |
There was a problem hiding this comment.
It's nit, but I'd do it like this:
offset = (*nintendo_key ^ (psn >> 4 & 0xF)) * FORM1_DATA_SIZE;
if(!nintendo_dev_disc)
offset += 7 * FORM1_DATA_SIZE + FORM1_DATA_SIZE / 2;
| // nintendo dev discs need manual descrambling | ||
| dvd::DataFrame df; | ||
| bool dmi_found = false; | ||
| for(uint8_t dmi_retries = 0; dmi_retries < 192; ++dmi_retries) | ||
| { | ||
| uint32_t dmi_address = 0x2E401 + dmi_retries * 0x10; | ||
| auto status = cmd_read_omnidrive(*ctx.sptd, (uint8_t *)&df, sizeof(dvd::DataFrame), 0x2E401, 1, OmniDrive_DiscType::DVD, true, false, false, OmniDrive_Subchannels::NONE, false); | ||
| if(status.status_code) | ||
| LOG("[PSN: {:X}] omnidrive: SCSI error ({})", 0x2E401, SPTD::StatusMessage(status)); | ||
| else | ||
| { | ||
| if (df.valid(9, true)) | ||
| { | ||
| df.descramble(9, true); | ||
| dmi_found = true; | ||
| } | ||
| else | ||
| LOG("[PSN: {:X}] omnidrive: invalid DMI, discarded", dmi_address); | ||
| } | ||
| } | ||
| if (dmi_found) | ||
| { | ||
| structure.resize(sizeof(CMD_ParameterListHeader) + FORM1_DATA_SIZE); | ||
| *(CMD_ParameterListHeader*)structure.data() = { .data_length = endian_swap((uint16_t)(FORM1_DATA_SIZE + 2)) }; | ||
| std::copy(df.main_data, df.main_data + FORM1_DATA_SIZE, structure.data() + sizeof(CMD_ParameterListHeader)); | ||
| } |
There was a problem hiding this comment.
Can you extract this as a function and use it for both DMI and PFI? I see only sector address is different, everything else looks the same.
Use/pass nintendo_key instead of 9
This is a WIP PR for dumping NR/RVT-R discs via an upcoming version of OmniDrive.
NR/RVT-R discs differ from normal Nintendo discs in the following ways:
splitwas modified to instead search forNintendoin the DMI, andEmuin the same string to detect a dev disc.dump, but I'm not sure if XGD3s with no video partition also appear like this? If so, logic will need to be changed.