Skip to content

Simple WBFS partition stripping#4

Merged
encounter merged 17 commits into
encounter:mainfrom
mq1:strip-wbfs
Oct 16, 2025
Merged

Simple WBFS partition stripping#4
encounter merged 17 commits into
encounter:mainfrom
mq1:strip-wbfs

Conversation

@mq1

@mq1 mq1 commented Sep 11, 2025

Copy link
Copy Markdown
Contributor

This PR add a new Format::StrippedWbfs([bool; 64])

[bool; 64] is a index mask (if mask[partition_index] == true => the partition will be read as zeroes)

The existing api has not been altered

@encounter

Copy link
Copy Markdown
Owner

Thoughts on adding this to FormatOptions instead? From an API perspective, I don't think there should be a Format variant that can't be returned by the reader.

@encounter

Copy link
Copy Markdown
Owner

Also could you expand on the use-case a bit?

@mq1

mq1 commented Sep 12, 2025

Copy link
Copy Markdown
Contributor Author

Thoughts on adding this to FormatOptions instead? From an API perspective, I don't think there should be a Format variant that can't be returned by the reader.

That was my first thought, but then it will be a breaking change for the user facing api, and would require adapting the existing code for anyone using the lib


Also could you expand on the use-case a bit?

A gbatemp user pointed out that it may be helpful for playing games on Wiis with smaller drives

https://gbatemp.net/threads/personal-project-i-made-a-simple-backup-manager-for-wii-supporting-direct-rvz-conversion.674406/post-10719885


I asked usbloader_gx dev about it, he wrote the following

USB Loader GX offers 3 settings for game installation.

  1. Keep all partitions
  2. Remove the update partition (the default setting)
  3. Keep only the games partition

Only the third option can break things for some games. For example, a game might include a partition for a channel, and if you remove it, the game could crash if it tries to access that missing partition.

The loader defaults to removing the update partition because it's safe to do that and the space savings can be significant. For example, Worms Battle Islands can go from a 4.37GB ISO file to a 54MB WBFS file. But if you keep the update partition, it becomes a 234MB WBFS file instead. And for what? It's an update partition that you'll never use on a modded Wii.

@encounter

Copy link
Copy Markdown
Owner

That was my first thought, but then it will be a breaking change for the user facing api, and would require adapting the existing code for anyone using the lib

That's okay, since it's currently in v2.0.0-alpha! I will probably make the *Options structs #[non_exhaustive] so that we can add more in the future without causing API breakage.

The loader defaults to removing the update partition because it's safe to do that and the space savings can be significant. For example, Worms Battle Islands can go from a 4.37GB ISO file to a 54MB WBFS file. But if you keep the update partition, it becomes a 234MB WBFS file instead. And for what? It's an update partition that you'll never use on a modded Wii.

I agree with this, I think maybe the option could be "scrub_update_partition"? It may be a little more involved, but I imagine it could rewrite the partition table, avoid emitting embedded hashes (since it's modified), etc. I may have to finish the disc generation feature here.

nod has so far been focused on 1:1 conversions and keeping everything lossless, but having a scrub option definitely makes sense for utility purposes.

@mq1

mq1 commented Sep 13, 2025

Copy link
Copy Markdown
Contributor Author

Emitting embedded hashes may still be useful, rn I'm showing a "❓ Hashes don't match: the game has been altered\n\nIt can indicate that a partition has been removed or a potential data corruption" popup text when a checksum fails

@encounter encounter left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I like the current solution! I’ll have to test it out and think about the option itself a bit more. (e.g. should it be a more general scrub option and add more functionality to it over time? Or name it minimize_size to reflect the desired output rather than the process?)

Comment thread nod/src/write.rs Outdated
@encounter

Copy link
Copy Markdown
Owner

I updated this to use a ScrubLevel enum, like so:

ProcessOptions {
    processor_threads: 0,
    digest_crc32: true,
    digest_md5: false,
    digest_sha1: true,
    digest_xxh64: true,
    scrub: ScrubLevel::UpdatePartition,
}

Thoughts?

@mq1

mq1 commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

lgtm!

@encounter encounter merged commit 5f3ea3c into encounter:main Oct 16, 2025
18 checks passed
@mq1 mq1 deleted the strip-wbfs branch December 6, 2025 10:22
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