piratesephiroth / TeconmoonWiiVCInjector

Fork of the popular Wii Virtual Console Injector for Wii U by Teconmoon
138 stars 21 forks source link

Option for disabling deflicker filter? #44

Open jolteondude opened 5 months ago

jolteondude commented 5 months ago

Hello, is it possible to disable the deflicker filter through the WiiVC Injector? The Wii (and vWii) has a system level "blur" filter applied to everything, so I was wondering if I could turn off this filter to get the cleanest image possible for Wii games, like in some other homebrew applications like USB Loader GX.

(A screenshot taken from this video) gx

vaguerant commented 3 months ago

This would probably be possible for at least some games. I've done it manually by editing some of my games before injecting them. You'll need to unpack the game so you can access the main.dol file, then try to find the compiled GXSetCopyFilter() SDK function within the title. You'd usually do this by opening main.dol in a hex editor (such as HxD on Windows) and searching for the following:

99498000 90E98000 99498000 91098000 41820040

Each set of four bytes is a single assembly instruction, so you're looking at five instructions above. The last instruction, 41820040, is a conditional branch, meaning it might branch ahead if the right conditions are met. The target of this branch is the code which disables the copy filter, so we want this branch to be unconditional, i.e. always run. To do that, you can change 41820040 to 48000040. 4182 is a branch-if-equal, and 4800 is a simple branch, so that's the part you're changing. The last part, 0040, is the distance to branch. You don't want to change that part since it's already pointing to the right place.

With that done, any time the GXSetCopyFilter() function runs, it will force the copy filter to be disabled because that's what you've edited it to do.

This may not work for all games, because Wii games were being made for about eight years and the SDK received updates over that time, so there's not really any guarantee that the code was unchanged across all SDK versions and all Wii games. Still, this feature would in theory be doable for at least some games in an injection tool, since they involve unpacking the game anyway (meaning the main.dol is accessible). It would need a feature to scan through the main.dol looking for that pattern to patch then replacing that 4182 with 4800.