Project

General

Profile

Actions

Emulator Issues #11407

open

VI registers differ for Wii games when booting game from Game List compared to booting game from Wii System Menu

Added by AdmiralCurtiss over 5 years ago. Updated over 5 years ago.

Status:
Accepted
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

I'm posting this here before making a PR because I'm not entirely sure if my methodology is correct and how this should be implemented. Someone who has a decent idea on how the VideoInterface is implemented in Dolphin commenting on this would be appreciated. In particular, I'd like to know how the current Preset() values have been determined, but any other comments are fine too.

A few weeks ago, when I was checking out XFB related code, I ran across a variation of my old 2520 PR (https://github.com/dolphin-emu/dolphin/pull/2520) where some PAL games expected the System Menu to set 60Hz for them. It seems that this is also the case for Progressive Scan: Some games will run interlaced even when the SYSCONF is set to 480p because they figure the System Menu has already switched to progressive before boot. This is almost impossible to notice in Dolphin, and I only saw it because I messed around with the ForceProgressive hack.

So I figured, well, we should probably fix that, who knows what it might affect. And then I thought about it a bit more and was like, maybe we should be more accurate in our boot sequence in general by setting all the VI registers to what the System Menu would when booting a game. And this led me here.

I wrote a custom homebrew program that reads the VI registers immediately upon boot and stores them to a file on the SD card, with some metadata about the current values in the SYSCONF. My first attempt was injecting that into a Wii disc and booting that via the Disc channel, but while that worked in Dolphin it turned out to be hard to replicate on hardware, so I made it into a WAD and then booted the installed channel from the System Menu. This is to avoid an intermediate Homebrew Channel or similar layer that could alter the registers in-between. It's hard to say if this gives completely accurate values, but it's the best I could come up with, and the results look fairly reasonable. I then just went though all* permutations of options affect the video output in the System Menu and got a nice set of data.

(*Well, most. All the horizontal image offsets were not tried with all other options, just some where it seemed to make a difference.)

My hardware test set was three separate Wii consoles: Two PAL ones and one NTSC-U one. I also used both a Composite and a Component cable to determine possible differences between those.

I've attached my collection of VI register dumps as well as the source for the homebrew.

Findings

These are my findings on what System Menu option correspond to what VI register values.

For reference, these registers are implemented in Dolphin in Source/Core/Core/HW/VideoInterface.cpp and VideoInterface.h. I've also listed the variable names for each register in those files.

A few notes:

Unless specified otherwise, "50Hz" means a refresh rate of 50Hz, regardless of video standard (but only used by PAL anyway)
Similarly, "60Hz" means a refresh rate of 60Hz, regardless of video standard (PAL or NTSC)
"interlaced" means either 576i (PAL only) or 480i (NTSC or PAL)
"progressive" means 480p (NTSC or PAL)

There is remarkably little difference between NTSC and PAL60 here, by the way. The only difference I can see is the XFB memory location, which is probably meaningless.

0x00 - 2 bytes - VTiming - m_VerticalTimingRegister

Affected by Hz and interlaced/progressive.

0005: 50Hz interlaced
0006: 60Hz interlaced
000C: 60Hz progressive

0x02 - 2 bytes - Control - m_DisplayControlRegister

Affected by Hz and interlaced/progressive.

0001: 60Hz interlaced
0005: 60Hz progressive
0101: 50Hz interlaced

0x04 - 4 bytes - HTiming0 - m_HTiming0

Affected by Hz.

476901AD: 60Hz
4B6A01B0: 50Hz

0x08 - 4 bytes - HTiming1 - m_HTiming1

This is affected by the horizontal picture shift setting in the Wii menu, the Hz, and the aspect ratio, giving it a possibility space of 68 different values.

The important values are:
030849C0: Offset 0, 60Hz, 4:3
031845C0: Offset 0, 60Hz, 16:9
03124FC0: Offset 0, 50Hz, 4:3
03224BC0: Offset 0, 50Hz, 16:9

See further down for all 68 values.

0x0C - 8 bytes - VBlank - m_VBlankTimingOdd, m_VBlankTimingEven

Affected by Hz and interlaced/progressive.

001101EA001001EB: 60Hz interlaced
0013024F00120250: 50Hz interlaced
002003D6002003D6: 60Hz progressive

0x14 - 8 bytes - Burst - m_BurstBlankingOdd, m_BurstBlankingEven

Affected by Hz and interlaced/progressive.

410C410C40ED40ED: 60Hz interlaced
4D2B4D6D4D8A4D4C: 50Hz interlaced
81D881D881D881D8: 60Hz progressive

0x1C - 16 bytes - XfbInfo - m_XFBInfoTop, m_3DFBInfoTop, m_XFBInfoBottom, m_3DFBInfoBottom

Affected by System Menu region, Hz, and interlaced/progressive. Somewhat arbitrary and changes, presumably, depending on what frame the game boots at, probably not necessary to set this as the Wii menu would. This might also or instead differ depending on the System Menu version rather than the console region, not entirely sure.

00D832600000000000D8326000000000: NTSC or PAL console 60Hz progressive
00D832600000000000D8376000000000: NTSC or PAL console 50Hz or 60Hz interlaced
00E11A800000000000E11A8000000000: NTSC console 60Hz progressive
00E11A800000000000E11F8000000000: NTSC console 60Hz interlaced
00E2C8800000000000E2C88000000000: PAL console 60Hz progressive
00E2C8800000000000E2CD8000000000: PAL console 50Hz or 60Hz interlaced

0x2C - 2 bytes - VBeam - Not directly stored in Dolphin, calculated from s_half_line_count.

Effectively random. I've seen values between 0001 and 03D5.

0x2E - 2 bytes - HBeam - Not directly stored in Dolphin, calculated from several other variables.

Effectively random. I've seen values between 0018 and 035D.

0x30 - 4 bytes - PreTrace - m_InterruptRegister[0]

Affected by Hz and interlaced/progressive.

110701AE: 60Hz interlaced
113901B1: 50Hz interlaced
120E0001: 60Hz progressive

0x34 - 4 bytes - PostTrace - m_InterruptRegister[1]

Constant.

10010001: Always

0x38 - 8 bytes - Interrupt - m_InterruptRegister[2], m_InterruptRegister[3]

Constant.

0001000100010001: Always

Note, if you boot via the System Menu in Dolphin, this is all zero instead.

0x40 - 8 bytes - Latch - m_LatchRegister[0], m_LatchRegister[1]

Constant.

0000000000000000: Always

0x48 - 2 bytes - PictConf - m_PictureConfiguration

Affected by interlaced/progressive.

2828: progressive
2850: interlaced

0x4A - 2 bytes - HScaleR - m_HorizontalScaling

Affected by Hz and screen aspect ratio.

10EF: 60Hz 16:9
10F1: 50Hz 16:9
10F5: 60Hz 4:3
10F7: 50Hz 4:3

0x4C - 28 bytes - Filter - m_FilterCoefTables

Constant.

1AE771F00DB4A57400C1188EC4C0CBE2FCECDECF13130F0800080C0F: Always

Note, a single bit is different when booting via the System Menu in Dolphin. The "0008" near the end is "0108" in Dolphin instead.

0x68 - 4 bytes - UnkAA - m_UnkAARegister

Constant.

00FF0000: Always

Is all zero in Dolphin instead.

0x6C - 2 bytes - Clock - m_Clock

Affected by interlaced/progressive.

0000: interlaced
0001: progressive

0x6E - 2 bytes - DTV - m_DTVStatus

Affected by type of cable plugged into the console.

0000: composite cable (cable does not support progressive scan)
0001: component cable (
cable supports progressive scan)

Note, according to the documentation another bit is set on NTSC-J systems, but I don't have a Japanese Wii to test this on.

Also note, this is implemented as a writable register without warning in Dolphin, does that make sense?

0x70 - 2 bytes - FBWidth - m_FBWidth

Constant.

0280: Always

0x72 - 4 bytes - BorderBlank - m_BorderHBlank

???

807A019C: Usually this value.
808501A4: Sometimes this value, only seen on one Wiis.

No idea what exactly affects this one. Probably doesn't matter though.

0x76 - 2 bytes - Nothing?

Constant.

00FF: Always

This reads as FFFF in Dolphin and is not mapped to any emulated register. libogc does have this address still in its VI register address space though, so dunno who is right here.

0x08 - 4 bytes - HTiming1 - m_HTiming1 [full list]

02F247C0: Offset -8, 50Hz, 4:3
02F648C0: Offset -7, 50Hz, 4:3
02FA49C0: Offset -6, 50Hz, 4:3
02FE4AC0: Offset -5, 50Hz, 4:3
03024BC0: Offset -4, 50Hz, 4:3
03064CC0: Offset -3, 50Hz, 4:3
030A4DC0: Offset -2, 50Hz, 4:3
030E4EC0: Offset -1, 50Hz, 4:3
03124FC0: Offset 0, 50Hz, 4:3
031650C0: Offset 1, 50Hz, 4:3
031A51C0: Offset 2, 50Hz, 4:3
031E52C0: Offset 3, 50Hz, 4:3
032253C0: Offset 4, 50Hz, 4:3
032654C0: Offset 5, 50Hz, 4:3
032A55C0: Offset 6, 50Hz, 4:3
032E56C0: Offset 7, 50Hz, 4:3
033257C0: Offset 8, 50Hz, 4:3

030243C0: Offset -8, 50Hz, 16:9
030644C0: Offset -7, 50Hz, 16:9
030A45C0: Offset -6, 50Hz, 16:9
030E46C0: Offset -5, 50Hz, 16:9
031247C0: Offset -4, 50Hz, 16:9
031648C0: Offset -3, 50Hz, 16:9
031A49C0: Offset -2, 50Hz, 16:9
031E4AC0: Offset -1, 50Hz, 16:9
03224BC0: Offset 0, 50Hz, 16:9
03264CC0: Offset 1, 50Hz, 16:9
032A4DC0: Offset 2, 50Hz, 16:9
032E4EC0: Offset 3, 50Hz, 16:9
03324FC0: Offset 4, 50Hz, 16:9
033650C0: Offset 5, 50Hz, 16:9
033A51C0: Offset 6, 50Hz, 16:9
033E52C0: Offset 7, 50Hz, 16:9
034253C0: Offset 8, 50Hz, 16:9

02E841C0: Offset -8, 60Hz, 4:3
02EC42C0: Offset -7, 60Hz, 4:3
02F043C0: Offset -6, 60Hz, 4:3
02F444C0: Offset -5, 60Hz, 4:3
02F845C0: Offset -4, 60Hz, 4:3
02FC46C0: Offset -3, 60Hz, 4:3
030047C0: Offset -2, 60Hz, 4:3
030448C0: Offset -1, 60Hz, 4:3
030849C0: Offset 0, 60Hz, 4:3
030C4AC0: Offset 1, 60Hz, 4:3
03104BC0: Offset 2, 60Hz, 4:3
03144CC0: Offset 3, 60Hz, 4:3
03184DC0: Offset 4, 60Hz, 4:3
031C4EC0: Offset 5, 60Hz, 4:3
03204FC0: Offset 6, 60Hz, 4:3
032450C0: Offset 7, 60Hz, 4:3
032851C0: Offset 8, 60Hz, 4:3

02F83DC0: Offset -8, 60Hz, 16:9
02FC3EC0: Offset -7, 60Hz, 16:9
03003FC0: Offset -6, 60Hz, 16:9
030440C0: Offset -5, 60Hz, 16:9
030841C0: Offset -4, 60Hz, 16:9
030C42C0: Offset -3, 60Hz, 16:9
031043C0: Offset -2, 60Hz, 16:9
031444C0: Offset -1, 60Hz, 16:9
031845C0: Offset 0, 60Hz, 16:9
031C46C0: Offset 1, 60Hz, 16:9
032047C0: Offset 2, 60Hz, 16:9
032448C0: Offset 3, 60Hz, 16:9
032849C0: Offset 4, 60Hz, 16:9
032C4AC0: Offset 5, 60Hz, 16:9
03304BC0: Offset 6, 60Hz, 16:9
03344CC0: Offset 7, 60Hz, 16:9
03384DC0: Offset 8, 60Hz, 16:9

Sidenote, the value in SYSCONF's IPL.DH is twice that of the value you actually set in the Wii Settings. So Wii Settings -8 => -16 in IPL.DH etc. Minimum is -8 and maximum is 8.


Files

wii-vi-register.7z (29 KB) wii-vi-register.7z AdmiralCurtiss, 09/30/2018 09:20 PM
vi-reg-dolphin-game-list-boot.png (19.5 KB) vi-reg-dolphin-game-list-boot.png AdmiralCurtiss, 09/30/2018 09:58 PM
Actions #1

Updated by AdmiralCurtiss over 5 years ago

Oh and for reference, this is what you currently get when booting the homebrew .dol directly. This isn't *completely wrong, but it's somewhat inconsistent with my findings; some values are set as if it was a 50Hz interlaced signal, some values are set as if it was a 60Hz interlaced signal, some values are set as if it was a 60Hz progressive signal, and some values match none of the values I found.

Actions #2

Updated by JMC4789 over 5 years ago

  • Status changed from New to Accepted

This is way to well written to not be accepted.

Actions

Also available in: Atom PDF