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

Razor83

Well-Known Member
OP
Member
Joined
Dec 23, 2009
Messages
391
Trophies
1
XP
1,758
Country
Hi all,
It doesnt appear to be very well known, but all sixth gen consoles (DC, PS2, GC, XB) plus the Wii use whats called a "flicker filter" (Sometimes also refered to as a "deflicker filter") to 'blur' the lines on 480i video signals. The filters original purpose was to prevent fine details from 'flickering' up and down by one line when displaying in interlaced mode (480i) on a CRT TV.

To quote the GC/Wii SDK:-
SDK_Advanced_GX said:
18.3 Deflicker algorithm
Deflickering is typically used to solve two problems:
• To eliminate flickering of thin (one-pixel tall) horizontal lines for interlaced video display. A one-pixel tall
horizontal line will flicker at 30Hz as the TV interlaced video shows this line every other field.
• To perform simple antialiasing by rendering 480 lines at 60Hz in the frame buffer and deflickering to 240 lines
for interlaced display. This is basically 2-sample super sampling.
The vertical filter hardware is used for deflickering purposes, so antialiasing and deflickering are similar concepts.
Flicker filters made sense at the time due to CRT TV's being the primary display type. However nowadays flat panel displays are the norm, and they have to deinterlace 480i signals - so now the flicker filter is in fact detrimental to the video quality as it just 'blurs' multiple lines together resulting in a softer blurred looking image.

Now with a progessive signal (480p) the flicker filter should always be disabled, since there are no interlaced lines to flicker. However Nintendo did something odd - they instead created a new video mode that deliberately 'softens' the picture when in progressive scan mode.

This post from the Beyond3D Forums explains it:-
dfi said:
Ok, talking to a developer friend of mine, there are 2 specific wii/gcn API calls to turn on deflickering mode.

For interlaced displays, you call GXNtsc480IntDf().

For progressive scan displays, you call GXNtsc480ProgSoft().

Since anti-aliasing is really a side effect of deflickering and you don't actually deflicker anything in 480p, the api ends with "soft" in proscan, instead of "df" for interlaced displays.

Both the GameCube and Wii feature this flicker/softening filter, and certain games even allow you to turn the filter on or off in the options (Melee, Brawl and Pikmin 2 to name a few of them) On the GameCube you can use Swiss to disable the flicker filter, however on the Wii I have found no such option :(

Many backup loaders do give you the option to force the video mode, but they dont appear to give you the option to enable/disable the flicker/softness filter independantly. Is this something that could be added to backup loaders? Or is Wii homebrew 'dead' at this point?

Apologies for the length of this post, and thanks in advance for any help.
 
Last edited by Razor83, , Reason: Corrected fifth gen to sixth gen

SuperrSonic

Well-Known Member
Member
Joined
Dec 9, 2011
Messages
807
Trophies
1
XP
2,295
Country
Puerto Rico
If you get progressive video forcing to work in USB Loader GX, it should use the same mode as ULGX, which doesn't have df.

But since forcing compatibility is low, ULGX has the neat feature of loading a game's main.dol from the SD card. So if you have the game's dol, you can patch it as needed and test.

I actually do this to get dual audio in Smash without having two copies of the same game.

For df try opening the dol in a hex editor and look for either 08080A0C0A0808 or 04080c100c0804 and replace it with 00001516150000
 

ibai22ne

Member
Newcomer
Joined
Oct 20, 2019
Messages
6
Trophies
0
XP
169
Country
Spain
I read this post some time ago and decided to try disabling the df filtering editing the main.dol and loading it alternatively with usb laoder gx like you said for the last story (pal). When editing the file with the hex editor i replaced both values with the one you suggested and the game launch perfectly but the df filter is still on. Im doing this displaying the game on interlaced resolution (this game only supports 480i adn 480p) it seem that this method dosent work in this case. Any more ideas? Would be great to play this on my crt with a crisp image...
 
Last edited by ibai22ne,

SuperrSonic

Well-Known Member
Member
Joined
Dec 9, 2011
Messages
807
Trophies
1
XP
2,295
Country
Puerto Rico
When editing the file with the hex editor i replaced both values with the one you suggested and the game launch perfectly but the df filter is still on. it seem that this method dosent work in this case. Any more ideas?
You have to find the one that corresponds to the video mode used by the game. It's unclear from what you wrote if you just replaced a few instances or all instances.
 
  • Like
Reactions: ibai22ne

ibai22ne

Member
Newcomer
Joined
Oct 20, 2019
Messages
6
Trophies
0
XP
169
Country
Spain
You have to find the one that corresponds to the video mode used by the game. It's unclear from what you wrote if you just replaced a few instances or all instances.
I replaced all instances of both values. I have tried that again just in case with a new extracted boot.dol.
Also now i have replaced only one instance of one value at a time creating different versions of the main.dol. Tried it all of them with no results.
 
Last edited by ibai22ne,

denn11699

New Member
Newbie
Joined
Jan 27, 2020
Messages
3
Trophies
0
Age
25
XP
44
Country
Philippines
Thank you for this extracted the wbfs of resident evil 4 and dead rising ntsc edited the main.dol using hex editor and changed the values mentioned above and it worked. The picture looks sharp than before it was blurry. USB Loader GX must add this feature to force turn off the deflicker the nintendont has one.
 

Draxikor

Well-Known Member
Member
Joined
Apr 24, 2019
Messages
342
Trophies
0
XP
1,260
Country
Mexico
Thank you for this extracted the wbfs of resident evil 4 and dead rising ntsc edited the main.dol using hex editor and changed the values mentioned above and it worked. The picture looks sharp than before it was blurry. USB Loader GX must add this feature to force turn off the deflicker the nintendont has one.
Can you tell me how and which programs you use to extract the main dol from the WBFS?
 
Last edited by Draxikor,

Datmonkey

Member
Newcomer
Joined
Apr 14, 2017
Messages
16
Trophies
0
Age
46
XP
80
Country
I am also interested in this, how to extract and edit the wbfs.

Has there been any updates to wii loaders to turn off the filter directly before loading a game? Is there a difference to how gamecube games do this? Nintendont and Swiss has had this option for gc games for years.

Lastly, is there a database of which Wii games use the filter?
 

Draxikor

Well-Known Member
Member
Joined
Apr 24, 2019
Messages
342
Trophies
0
XP
1,260
Country
Mexico
I am also interested in this, how to extract and edit the wbfs.

Has there been any updates to wii loaders to turn off the filter directly before loading a game? Is there a difference to how gamecube games do this? Nintendont and Swiss has had this option for gc games for years.

Lastly, is there a database of which Wii games use the filter?
You need to use wii backup manager to revert the wbfs game to ISO, then you need to use wiiscrubber to extract the main.dol and then use a hex editor to change the hex lines to disable the filter, next you need to rename the main.dol to have the same ID from the game and put it on a folder in your USB or SD and on the loader choose the path and in the game options choose alternate loader in USD or USB save changes and done.
 

Datmonkey

Member
Newcomer
Joined
Apr 14, 2017
Messages
16
Trophies
0
Age
46
XP
80
Country
Thanks, I got it working!

I tried patching Resident Evil 4 Wii Edition and the difference was huge. I also tried Super Mario Galaxy, but it made no difference. I guess that Mario Galaxy doesn't use the filter in progressive mode?

It would be awesome to start building a database of some sort. I will keep on patching games and post here if/when I have the time.
 

Draxikor

Well-Known Member
Member
Joined
Apr 24, 2019
Messages
342
Trophies
0
XP
1,260
Country
Mexico
Thanks, I got it working!

I tried patching Resident Evil 4 Wii Edition and the difference was huge. I also tried Super Mario Galaxy, but it made no difference. I guess that Mario Galaxy doesn't use the filter in progressive mode?

It would be awesome to start building a database of some sort. I will keep on patching games and post here if/when I have the time.
In which part of RE4 you spot the differences? I do the process but don't see the difference.
 

Datmonkey

Member
Newcomer
Joined
Apr 14, 2017
Messages
16
Trophies
0
Age
46
XP
80
Country
I have played a couple of hours of RE4 now, and am really enjoying the sharper picture (and great motion controls!). But the game uses lots of dithering, which doesn't look that good. I am guessing the (de)flicker filter hides it normally, but without it, the dithering is too much.

Would it be possible to do a similar hex edit to remove the dithering? With Swiss it is possible to remove alpha dithering, so I was thinking this might also be possible?

btw I created a separate thread on the dithering https://gbatemp.net/threads/disable-dithering-via-hex-editing.558951/
 
  • Like
Reactions: ibai22ne

QuintanaSonBlade

Member
Newcomer
Joined
Jul 23, 2020
Messages
8
Trophies
0
Age
38
Location
Argentina
XP
78
Country
Argentina
This is amazing, I looked it up for years, finally I was able to edit the Hex parameters, thanks a lot SuperrSonic !.
Solo me gustaría agregar que algunos juegos todavía tienen el filtro activado como en el caso de Fire Emblem.
Now my question is this: is it possible to disable this filter in WiiWare games? I tried doing it with these steps ... Unpack the Cave Story wad with wadunpacker; I extracted the file 00000001.app and changed the extension to .dol and tried to change the Hex parameters but there were no results in the search ...
Any suggestion? Will the values to disable the filter be other?
Thank you all for this great contribution!
 

T0biasCZe

Well-Known Member
Member
Joined
Oct 4, 2019
Messages
213
Trophies
0
Age
18
XP
918
Country
Czech Republic
Does it work only with some games ? I tried it with Sonic Colours, I extracted the wbfs, replaced all the values and repacked the wbfs and loaded it, but it looks exactly the same
with patched main.dol:
upload_2021-2-9_19-57-0.png
original:
upload_2021-2-9_19-57-36.png
I have European/PAL version
 
Last edited by T0biasCZe,

Codemastershock

Well-Known Member
Member
Joined
Oct 14, 2013
Messages
277
Trophies
0
XP
1,067
Country
Brazil
Does it work only with some games ? I tried it with Sonic Colours, I extracted the wbfs, replaced all the values and repacked the wbfs and loaded it, but it looks exactly the same
with patched main.dol:
View attachment 245732
original:
View attachment 245733
I have European/PAL version
The american version at least dont use deflicker filter, it woudnt affect it.
 

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
532
Trophies
0
Age
25
XP
1,070
Country
United States
Ok, talking to a developer friend of mine, there are 2 specific wii/gcn API calls to turn on deflickering mode.
For interlaced displays, you call GXNtsc480IntDf().
For progressive scan displays, you call GXNtsc480ProgSoft().

According to USB Loader GX video patching code, there is also a third mode with suffix 'AA':

https://github.com/cyan06/usbloadergx/blob/master/source/patches/gamepatches.c said:
static GXRModeObj* vmodes[] = {
&TVNtsc480Int,
&TVNtsc480IntDf,
&TVNtsc480IntAa,
&TVNtsc480Prog,
&TVNtsc480ProgSoft,
&TVNtsc480ProgAa,


try opening the dol in a hex editor and look for either 08080A0C0A0808 or 04080c100c0804 and replace it with 00001516150000

Thank you, and I can confirm this works for Metroid: Other M and SSB: Brawl. In the case of latter, the game's deflicker setting no longer functions and the setting is always off.

However I wonder if other games are using Ntsc480ProgAa, and if you know of a hex code for patching it to Ntsc480Prog as well, or how to discover it?

edit: the definitions of modes can be found here starting at line 329.

I would be interested in making a simple GUI tool to automate the patching. i.e take an iso/wbfs as an input file, and spit out a patched [GameID].dol onto SD/USB for use by ULGX.
 
Last edited by NoobletCheese,

SuperrSonic

Well-Known Member
Member
Joined
Dec 9, 2011
Messages
807
Trophies
1
XP
2,295
Country
Puerto Rico
However I wonder if other games are using Ntsc480ProgAa, and if you know of a hex code for patching it to Ntsc480Prog as well, or how to discover it?

The only game I have that uses AA is Another Code R, this is based on two factors: the video mode used for 480p has AA enabled, and the screen is split into two chunks of 640x230 each or so I think, Dolphin reports 640x230/640x228 not sure how that works out.

This is the video mode used by the game if progressive scan is enabled:
Code:
16 0280 00E6 01C8 0011 000C 02AE 01C8 00000000 0000 0001 03020906030A03020906030A09020306090A09020306090A 04080C100C0804
The values of the video mode aren't always the ones used by the game, but in this case they are.
0280 = 640 width of the framebuffer
00E6 = 230 height of the EFB
01C8 = 456 height of the XFB
02AE = 686 VI width
0001 = AA is enabled

If you patch 0001 to 0 nothing happens, and if you lower the efb height to 228 it screws up the scaling and shows you exactly where the chunks are connected.
K0MZD7D.png
I guess the simplest way to know if the game really does this type of aa is to enable Immediately Present XFB in dolphin.
Using Free Look is also a way to spot where the chunks end/start.
 

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
532
Trophies
0
Age
25
XP
1,070
Country
United States
The only game I have that uses AA is Another Code R, this is based on two factors: the video mode used for 480p has AA enabled, and the screen is split into two chunks of 640x230 each or so I think, Dolphin reports 640x230/640x228 not sure how that works out.

This is the video mode used by the game if progressive scan is enabled:
Code:
16 0280 00E6 01C8 0011 000C 02AE 01C8 00000000 0000 0001 03020906030A03020906030A09020306090A09020306090A 04080C100C0804
The values of the video mode aren't always the ones used by the game, but in this case they are.
0280 = 640 width of the framebuffer
00E6 = 230 height of the EFB
01C8 = 456 height of the XFB
02AE = 686 VI width
0001 = AA is enabled

Thanks!

I see now that 04080C100C0804 is the vertical filter settings used by TVNtsc480ProgAa, so you were already patching it to TVNtsc480Prog's values.

But it seems ProgAa uses different 'sample points' than 480Prog though, so I'll try patching those too and see if it changes anything.
 

NoobletCheese

Well-Known Member
Member
Joined
Aug 12, 2018
Messages
532
Trophies
0
Age
25
XP
1,070
Country
United States
Breakthrough!

So the reason patching doesn't work for Mario Kart Wii (and probably other games) is because the game appears to be using its own custom vertical filter settings.

Custom filters found in main.dol for Mario Kart:

07070C0C0C0707
05050F0E0F0505

Change these to 00001516150000 and enjoy the cleaner graphics!

Just make sure they are preceded by a sampler pattern of either:

060606060606060606060606060606060606060606060606
03020906030A03020906030A09020306090A09020306090A

I didn't find any instances that weren't preceded by either of those, but it's just a safety measure to make sure it's a video mode that we're modifying.

It's possible that there could be games which use their own unique sampler pattern AND custom vertical filter, and those could be difficult to find. Searching for 0280 01E0 (640 480) may be helpful in those cases.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    straferz @ straferz: Anybody know why this is happening to my ACWW town...