Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: RGB output mode support #167

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

shizmob
Copy link

@shizmob shizmob commented Jan 28, 2024

The Wii arcade console (RVA-001) only has a VGA connector, no composite. This PR adds support to libogc for video output over that connector. It has the following caveats:

  • The RVA seems to be detected by the stock NAND boot programs by checking for the existence of /title/00000001/00000002/data/RVA.txt as opposed to some SC console type setting. As I was not quite sure how to factor this (there seems to be generally no console type detection in libogc), I left this out for now and the mode needs to be manually set using e.g.VIDEO_Configure(&TVRgb480Prog), and it is not returned by VIDEO_GetPreferredMode() (yet).
  • As the video encoder needs to be reconfigured when switching modes from and to RGB-capable modes, some internals were refactored to allow doing this. This likely also fixes issues stemming from switching to and from EURGB60 at runtime, if any.
  • I have tested this on an RVA, but not yet exhaustively with stock consoles from various regions, or e.g. an NDEV. I'm marking the PR WIP until this has been done.

Previously, the encoder was configured only once during VIDEO_Init(),
and would not be re-configured when VIDEO_Configure(mode) was called.
Since we can switch from a non-RGB to an RGB mode, we need to be able
to reconfigure the encoder at configure-time. This commit extends the
mode-switching mechanism to also allow scheduling for encoder setting
changes at run-time.

Moreover, since there are more RGB video modes than EURGB60, we extend
the mode struct with a flag to indicate whether the mode is RGB or not
or not for easy internal use. Adding it to the VI_TVMODE enumeration
was also considered, but decided against since it would break the
VIDEO_GetCurrentTvMode() ABI for EURGB60 modes.
This mode was used in the Wii arcade board (RVA-001). Detecting it
for use with VIDEO_GetPreferredMode() would require some logic
involving reading /title/00000001/00000002/data/RVA.txt since that
is the main method used to detect the board instead of SC.
Due to the relative clumsiness involved I decided to leave it out
for now.
@shizmob
Copy link
Author

shizmob commented Jan 29, 2024

Testing from other people who have access to Wiis is highly welcome by the way, as well as general review and comments on the PR. 👀

@DacoTaco
Copy link
Member

DacoTaco commented Jan 29, 2024

Hi @shizmob,
thanks for making this PR!

we are currently busy with other stuff related to gamecube/wii and will look at this later. so far, i would like to add support for the arcade hardware!

i do have a question. if you say nand boot programs check for that file, do you mean the piece of code that every title has that is loaded and started when the PPC is bootstrapped by IOS? (aka, run on 0x00003400). thats good to know if thats the case, though i wonder how it checks that. through IOS calls? i always thought that code only setup the PPC which is why it was so small

@shizmob
Copy link
Author

shizmob commented Jan 30, 2024

Hi, thanks for the response! Yes, according to WiiBrew it is the NAND boot program, the stub that's included with every title, that checks it. I just analyzed one to confirm, it seems to just call into IOS.

Of note is that while it sets some internal flag that later presumably gets used by OSGetConsoleType() or the like, all the software on the RVA-001 seems custom-built for it, and manually initialises the video to RGB mode using a separate function that is presumably in the VI library. I think we can do better though. :-)

@DacoTaco
Copy link
Member

hopefully we can do better, but checking the file might be a good idea if the VI wasn't init before. that said, i didn't see that file check in nandbootprogram yet. but then again, i never looked deep into it haha.

this kinda means that nand boot programs are not something they slapped on any dol, but build into them. cool!

is any testing still needed?

@DacoTaco
Copy link
Member

DacoTaco commented Aug 2, 2024

@shizmob : is this ready to be reviewed/merged? :)

@@ -65,6 +65,7 @@ typedef struct _gx_rmodeobj {
u16 viWidth;
u16 viHeight;
u32 xfbMode;
u8 rgb;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we do without this extra field, and assume that VI_TVMODE_DEBUG_PROG is always RGB?

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.

3 participants