Hacking Possible to Disable the Wii's (De)Flicker Filter?

Maeson

Well-Known Member
Member
Joined
Apr 3, 2013
Messages
1,179
Trophies
1
XP
3,379
Country
Spain
Darn, good job, NoobletCheese! I will look around in other games too this weekend.

The reset behaviour changes from game to game as you say, some literally reboot, others have like a quick start feature.

Edit: I found the exact string on the PAL version too, and in fact the string:
"2C 03 00 00 41 82 00 F8 89 04 00 00 38 00 00 00 89 44 00 01 38 60 00 00 51 00 07 3E 88 E4 00 06 51 40 26 36 89 04 00 0C 50 E3 07 3E 38 E0 00 00 51 07 07 3E 89 44 00 0D 89 64 00 07 39 00 00 00 51 47 26 36 89 44 00 02 89 24 00 12 51 63 26 36 51 40 45 2E 89 44 00 0E 51 28 07 3E 89 24 00 13 51 47 45 2E 89 44 00 03 51 28 26 36 89 24 00 14 51 40 64 26 89 44 00 0F 51 28 45 2E 89 24 00 15 51 47 64 26 89 44 00 04 89 64 00 08 51 28 64 26 51 40 83 1E 89 44 00 10 89 24 00 16 51 63 45 2E 89 64 00 09 51 47 83 1E 89 44 00 05 51 28 83 1E 89 24 00 11 51 63 64 26 89 64 00 0A 51 40 A2 16 89 44 00 0B 51 27 A2 16 88 84 00 17 39 20 00 01 51 63 83 1E 51 43 A2 16 50 88 A2 16 51 20 C0 0E 39 40 00 02 39 20 00 03 38 80 00 04 51 43 C0 0E 51 27 C0 0E 50 88 C0 0E 48 00 00 24 3D 00 01 66 3C 60 02 66 3C E0 03 66 3C 80 04 66 38 08 66 66 38 63 66 66 38 E7 66 66 39 04 66 66 3D 20 CC 01 39 40 00 61 99 49 80 00 2C 05 00 00 38 80 00 53 39 60 00 00 90 09 80 00 38 00 00 54 39 80 00 00 50 8B C0 0E 99 49 80 00 50 0C C0 0E 90 69 80 00 99 49 80 00 90 E9 80 00 99 49 80 00 91 09 80 00 41 82 00 40"

Is present in all main.dols I've looked into. This is great. I'll try more tomorrow, it's late already here.
 
Last edited by Maeson,

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
Next on the to-do list: patching VIConfigure to reliably set viTVMode and viWidth (since patching the GXRenderModeObjs is unreliable).

I believe you wanted to change viTVMode for Mega Man 9 which is stuck at 480i, and I'd like to adjust viWidth to correct some GameCube games, so this goes to the top of my priority list rather than finishing the defiltering tool (whose design requirements have now gone out the window anyway).

Curiously, Battalion Wars 2 has that telltale 9% horizontal squish associated with mapping square pixels to nonsquare 480i/p pixels, but seemingly only for its 2D assets (although I can't really tell tbh... the crosshair looks symmetrical, but other things are squished to heck).

edit: GXSetDither should be easily patchable too - it only has 1 boolean argument.
 
Last edited by NoobletCheese,
  • Like
Reactions: Maeson

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
I have been wanting to modify the filter values in WiiWare games for a long time and I have not been successful... the game is Cave Story (USA) (v258).
it worked!
the blur is finally gone

I have the same version of Cave Story and observe it has no filter when Wii is outputting 480p -- it's really razor sharp.

The game appears to be 4:3 only though... do I have a weird version of the game or was your Wii set to 480i?
 

QuintanaSonBlade

Member
Newcomer
Joined
Jul 23, 2020
Messages
8
Trophies
0
Age
38
Location
Argentina
XP
78
Country
Argentina
I have the same version of Cave Story and observe it has no filter when Wii is outputting 480p -- it's really razor sharp.

The game appears to be 4:3 only though... do I have a weird version of the game or was your Wii set to 480i?

My Wii setup is 480i official component cables and Sony bvm crt.
 
  • Like
Reactions: NoobletCheese

mive

Well-Known Member
Member
Joined
Jul 19, 2018
Messages
252
Trophies
0
Age
40
XP
598
Country
Germany
...
Is present in all main.dols I've looked into. This is great. I'll try more tomorrow, it's late already here.

all games i checked so far also do have the exact same hex sequence (so far I checked NFS Pro Street, Super Mario Galaxy, Worms Battle Island and Retro City Rampage DX+). so big thanks to @NoobletCheese as this seems to be the way to go

edit: if someone using linux, the easiest way to get the main.dol is probably via wfuse.
Just mount the wbfs or iso and navigate to the sys folder and copy main.dol to another dir
 
Last edited by mive,
  • Like
Reactions: NoobletCheese

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
Just for completeness, the full function looks like this which is just the concatenation of column 2 in post 118:

2C 03 00 00 41 82 00 F8 89 04 00 00 38 00 00 00 89 44 00 01 38 60 00 00 51 00 07 3E 88 E4 00 06 51 40 26 36 89 04 00 0C 50 E3 07 3E 38 E0 00 00 51 07 07 3E 89 44 00 0D 89 64 00 07 39 00 00 00 51 47 26 36 89 44 00 02 89 24 00 12 51 63 26 36 51 40 45 2E 89 44 00 0E 51 28 07 3E 89 24 00 13 51 47 45 2E 89 44 00 03 51 28 26 36 89 24 00 14 51 40 64 26 89 44 00 0F 51 28 45 2E 89 24 00 15 51 47 64 26 89 44 00 04 89 64 00 08 51 28 64 26 51 40 83 1E 89 44 00 10 89 24 00 16 51 63 45 2E 89 64 00 09 51 47 83 1E 89 44 00 05 51 28 83 1E 89 24 00 11 51 63 64 26 89 64 00 0A 51 40 A2 16 89 44 00 0B 51 27 A2 16 88 84 00 17 39 20 00 01 51 63 83 1E 51 43 A2 16 50 88 A2 16 51 20 C0 0E 39 40 00 02 39 20 00 03 38 80 00 04 51 43 C0 0E 51 27 C0 0E 50 88 C0 0E 48 00 00 24 3D 00 01 66 3C 60 02 66 3C E0 03 66 3C 80 04 66 38 08 66 66 38 63 66 66 38 E7 66 66 39 04 66 66 3D 20 CC 01 39 40 00 61 99 49 80 00 2C 05 00 00 38 80 00 53 39 60 00 00 90 09 80 00 38 00 00 54 39 80 00 00 50 8B C0 0E 99 49 80 00 50 0C C0 0E 90 69 80 00 99 49 80 00 90 E9 80 00 99 49 80 00 91 09 80 00 XX XX XX XX 88 86 00 00 88 06 00 04 50 8B 06 BE 88 66 00 01 50 0C 06 BE 88 A6 00 02 50 6B 35 32 88 66 00 05 88 86 00 03 50 AB 63 A6 88 06 00 06 50 6C 35 32 50 8B 92 1A 50 0C 63 A6 48 00 00 20 38 60 00 15 55 6B 00 26 50 6C 06 BE 38 00 00 16 50 6B 63 A6 50 0B 92 1A 55 8C 06 9A 3C 80 CC 01 38 A0 00 61 98 A4 80 00 38 00 00 00 80 62 YY YY 91 64 80 00 98 A4 80 00 91 84 80 00 B0 03 00 02 4E 80 00 20

X = the 4-byte (32-bit) instruction we're modifying
Y = the 2 bytes which mysteriously change from game to game

The instruction for Y is
8062YYYY lwz r3,YYYY(r2)

i.e when loading a word into register 3, the memory address offset of the source value changes from game to game.
 
Last edited by NoobletCheese,

Maeson

Well-Known Member
Member
Joined
Apr 3, 2013
Messages
1,179
Trophies
1
XP
3,379
Country
Spain
Interestingly, now that I tried with a bit more care (and starting a new file, because the one I had was in a stage with rain, wind and other effects in place constantly), Disaster: Day is another game that refuses to turn off the filter. Even changing the newly discovered string (while also having all the filters edited to be 00 00 15 16 15 00 00) it still has a filter!

Oh and I also confirm that this change is working on Battalion Wars 2.
 

Maeson

Well-Known Member
Member
Joined
Apr 3, 2013
Messages
1,179
Trophies
1
XP
3,379
Country
Spain
Generally speaking and on my personal experience, editing the vfilters themselves is enough for the majority of games, which is pretty reassuring.

If this last discovery is in pretty much all games, and it works with them (here's hoping) then doing it on a loader level might be much, much simpler, and only a few extra games will require extra steps.
 

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
Damn, thought we had this problem solved :(

I'll take a look at Day of Crisis and Fire Emblem once I have them.

In the meantime if you run those games in the Dolphin emulator you can toggle the 'disable copy filter' checkbox and see if there is any visual difference (edit: must check in tandem with 'enable progressive scan' to simulate Wii outputting 480i/480p as it can affect whether the game sets the filter).

If there is a visible difference, then it probably means there are more instances of GXSetCopyFilter to find and patch. Perhaps there are other .dol's in the iso which the game is using besides main.dol.

Or maybe different SDK versions of GXSetCopyFilter with different assembly code, which we may be able to discover with the PowerPC disassembly tool (this is the tool I used to dump the one in post #118).

edit: or maybe those games aren't even calling GXSetCopyFilter, but instead setting some variable like VAR_VFILTER_ON in main RAM. I suspect Dolphin might be doing it this way.
 
Last edited by NoobletCheese,

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
I still can't disable the Fire Emblem: Radiant Dawn filter, I set several parameters and I can't do it. Could someone make it?

Just tested it now (USA version).
By default the game has no filter when Wii is set to 480p.
After changing Wii system menu settings to 480i, the filter is active in the game.
After patching GXSetCopyFilter, I observe the filter is gone.
I observe the same behaviour on Dolphin.

Maybe you have the PAL version and it's behaving differently?

For example, maybe in the PAL version, the game never actually calls GXSetCopyFilter at all, so it just remains at whatever the current system setting is when you launched the game (which would be vfilter=on when Wii is set to 480i).

In this case the only way to fix it would be to somehow force a call to GXSetCopyFilter to turn it off. This may be possible...
 
  • Like
Reactions: QuintanaSonBlade

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
Disaster: Day is another game that refuses to turn off the filter. Even changing the newly discovered string (while also having all the filters edited to be 00 00 15 16 15 00 00) it still has a filter!

Indeed, it still has a filter -- but it's not the vfilter, which I'm 100% sure is being disabled as all graphics (game menus, wii sysmenus and 3d frustum) become clearer after patching.

Also Dolphin's 'disable copy filter' no longer has any effect after patching and rebuilding the ISO, and screenshots show the patched ISO is identical to the original ISO with Dolphin's 'disable copy filter'.

But there is definitely some other filter going on with this game. It's a little bit like the Xenoblade Chronicles case.

It could be antialiasing (i.e game is calling GXSetCopyFilter with aa=GX_TRUE) so I will try disabling that.

Or it could just be the developer's own bespoke pixel shader.

Curiously, I notice the filter seems to disappear when calling up the Wii sysmenu. eg. in the very first area, if you look at some of the high frequency rock textures while pressing home they become clearer.
 
Last edited by NoobletCheese,
  • Like
Reactions: XFlak and Maeson

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
Tried disabling aa by changing 2C030000418200F8 to 2C030000480000F8 in GXSetCopyFilter; no effect.

I believe the game is using a bloom filter that is creating this blurred effect, as it seems to be blowing out highlights and causing texture details in the rocks to become less detailed.

Original: https://i1.lensdump.com/i/Z2AAPq.png
Patched GXSetCopyFilter vf only: https://i1.lensdump.com/i/Z2AijA.png
Patched GXSetCopyFilter vf+aa: https://i2.lensdump.com/i/Z2AjdM.png
Bloom filter disabled on Wii Sysmenu? https://i2.lensdump.com/i/Z2A0MQ.png
 
  • Like
Reactions: Maeson

Maeson

Well-Known Member
Member
Joined
Apr 3, 2013
Messages
1,179
Trophies
1
XP
3,379
Country
Spain
Yeah, you're right about all that, text became clearer, so it's something to do with the way is designed I suppose. It's interesting you mention Xenoblade as both are made by the same developers, it's probably no coincidence.

Disabling the bloom would be going too far, if that's the culprit.
 

mive

Well-Known Member
Member
Joined
Jul 19, 2018
Messages
252
Trophies
0
Age
40
XP
598
Country
Germany
I made a quick python script which disables or reenables the GXSetCopyFilter for main.dol (*)

https://gist.github.com/vetzki/d61907f6ff7576febb31be9720cf9cfd

Code:
usage: py_disable_GXSetCopyFilter.py [-h] -i INPUT [-o OUTPUT] -c
                                     {disable,reenable}

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        input file
  -o OUTPUT, --output OUTPUT
                        output file (if none is specified input file gets
                        ovewritten)
  -c {disable,reenable}, --choice {disable,reenable}
                        disable or reenable filter

only tested on linux, need main.dol not wbfs or iso

(*)
searches only till
2C 03 00 00 41 82 00 F8 89 04 00 00 38 00 00 00 89 44 00 01 38 60 00 00 51 00 07 3E 88 E4 00 06 51 40 26 36 89 04 00 0C 50 E3 07 3E 38 E0 00 00 51 07 07 3E 89 44 00 0D 89 64 00 07 39 00 00 00 51 47 26 36 89 44 00 02 89 24 00 12 51 63 26 36 51 40 45 2E 89 44 00 0E 51 28 07 3E 89 24 00 13 51 47 45 2E 89 44 00 03 51 28 26 36 89 24 00 14 51 40 64 26 89 44 00 0F 51 28 45 2E 89 24 00 15 51 47 64 26 89 44 00 04 89 64 00 08 51 28 64 26 51 40 83 1E 89 44 00 10 89 24 00 16 51 63 45 2E 89 64 00 09 51 47 83 1E 89 44 00 05 51 28 83 1E 89 24 00 11 51 63 64 26 89 64 00 0A 51 40 A2 16 89 44 00 0B 51 27 A2 16 88 84 00 17 39 20 00 01 51 63 83 1E 51 43 A2 16 50 88 A2 16 51 20 C0 0E 39 40 00 02 39 20 00 03 38 80 00 04 51 43 C0 0E 51 27 C0 0E 50 88 C0 0E 48 00 00 24 3D 00 01 66 3C 60 02 66 3C E0 03 66 3C 80 04 66 38 08 66 66 38 63 66 66 38 E7 66 66 39 04 66 66 3D 20 CC 01 39 40 00 61 99 49 80 00 2C 05 00 00 38 80 00 53 39 60 00 00 90 09 80 00 38 00 00 54 39 80 00 00 50 8B C0 0E 99 49 80 00 50 0C C0 0E 90 69 80 00 99 49 80 00 90 E9 80 00 99 49 80 00 91 09 80 00 XX XX XX XX

not the whole function until
....
YY YY 91 64 80 00 98 A4 80 00 91 84 80 00 B0 03 00 02 4E 80 00 20
 
Last edited by mive,

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
I still can't disable the Fire Emblem: Radiant Dawn filter, I set several parameters and I can't do it. Could someone make it?
Just tested it now (USA version). By default the game has no filter when Wii is set to 480p. After changing Wii system menu settings to 480i, the filter is active in the game. After patching GXSetCopyFilter, I observe the filter is gone.

Just tested the PAL version on ULGX 1272 and Dolphin, and it is definitely working.
 

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
I look for that new string in my games (about 152) and found it in mostly all (Super Swing Golf USA don't have it) im gonna play them to see in how many the filters are off.

With Super Swing Golf it looks like the game executable isn't really sys/main.dol (239kB) but files/PangyaRev.dol (5674kB) which contains GXSetCopyFilter etc.

To list all dol files in a wbfs/iso:
Code:
wit files -s "C:\Games\Super Swing Golf.wbfs" --files "+*.dol"


edit: I'm not sure ULGX 'use alternate dol' will work with PangyaRev.dol as the game probably still needs to use main.dol as the entry point, so it probably requires rebuilding the entire wbfs/iso.

edit2: it seems there are more games that don't use main.dol:

Mortal Kombat Armageddon: MK7.dol
Red Steel: redsteel.dol
Medal of Honor 2: game.dol
House of the Dead 2: hod2.dol
SSX Blur: ssx.dol
Super Swing Golf: PangyaRev.dol
Wii Sports Resort: player.dol
Madden NFL 07: madden.dol
Madden NFL 08: maddens.dol
Metal Slug Anthology: ms6.dol
Metroid Prime: Trilogy: rs5mp1_p.dol

However the page I got these from seems to indicate 'use alternate DOL' should work. I will test and report back...

edit3: in the case of SSX Blur, there are GXSetCopyFilters in both its main.dol and ssx.dol, so it looks like the whole image needs to be rebuilt if it contains multiple dols.

When input file = Wii wbfs/iso, consider having an option so users can select what they want as the output: patched dol versus patched wbfs/iso

Definitely.
 
Last edited by NoobletCheese,

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
533
Trophies
0
Age
25
XP
1,083
Country
United States
Thanks for the answer, but ... how do I patch GXSetCopyFilter?

See post #119.

edit: apologies if I didn't explain enough -- I saw you were already patching WADs so I assumed you had the prerequisite knowledge. Basically you want to extract /sys/main.dol from the iso/wbfs using a tool such as WiiBackupFusion (GUI) or WIT (command line) using the command:
Code:
wit extract "C:\Games\Game.wbfs" "C:\Extracted" --files +/sys/main.dol --overwrite --flat

Then open it in a hex editor such as HxD and do a 'find and replace' on the string in post #119.

Then either:
a) copy the modified main.dol into /sys/ where WiiBackupFusion extracted the image to, then rebuild the image with WiiBackupFusion, or
b) rename main.dol to GameID.dol where GameID can be found from many places, such as gametdb.com/titles.txt, then copy to a folder on SD/USB drive and point the USB game loader to that folder and enable 'use alternate dol' for that game.

I'm working on a GUI to automate all this, but it's turning out to be way more complicated than I initially planned due to all these little caveats here and there (the goalposts keep moving). Aiming to have it finished in 2-3 weeks.
 
Last edited by NoobletCheese,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/@legolambs