Skip to content

Commit

Permalink
- Fix early boot video mode selection on PicoBoot.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Aug 24, 2024
1 parent 3c0c537 commit 3e2b72b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
1 change: 0 additions & 1 deletion cube/swiss/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ static void driveInfoCallback(s32 result, dvdcmdblk *block) {
/* Initialise Video, PAD, DVD, Font */
void Initialise (void)
{
VIDEO_Init ();
PAD_Init ();
DVD_Init();
DVD_InquiryAsync(&commandBlock, &driveInfo, driveInfoCallback);
Expand Down
40 changes: 26 additions & 14 deletions cube/swiss/source/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,23 @@ int getTVFormat() {
if(vmode == NULL) {
volatile unsigned short* vireg = (volatile unsigned short*)0xCC002000;
int format = (vireg[1] >> 8) & 3;
switch(format) {
case VI_NTSC:
return swissSettings.sramVideo == SYS_VIDEO_PAL ? VI_EURGB60 : VI_NTSC;
case VI_DEBUG:
switch(swissSettings.sramVideo) {
case SYS_VIDEO_PAL: return swissSettings.sram60Hz ? VI_EURGB60 : VI_PAL;
case SYS_VIDEO_MPAL: return VI_MPAL;
default: return VI_NTSC;
}
if(vireg[1] & 1) {
switch(format) {
case VI_NTSC:
return swissSettings.sramVideo == SYS_VIDEO_PAL ? VI_EURGB60 : VI_NTSC;
case VI_DEBUG:
switch(swissSettings.sramVideo) {
case SYS_VIDEO_PAL: return swissSettings.sram60Hz ? VI_EURGB60 : VI_PAL;
case SYS_VIDEO_MPAL: return VI_MPAL;
default: return VI_NTSC;
}
}
} else {
switch(swissSettings.sramVideo) {
case SYS_VIDEO_PAL: return swissSettings.sram60Hz ? VI_EURGB60 : VI_PAL;
case SYS_VIDEO_MPAL: return VI_MPAL;
default: return VI_NTSC;
}
}
return format;
}
Expand All @@ -75,12 +83,15 @@ int getTVFormat() {
int getScanMode() {
if(vmode == NULL) {
volatile unsigned short* vireg = (volatile unsigned short*)0xCC002000;
if(vireg[54] & 1)
if(vireg[1] & 1) {
if(vireg[54] & 1)
return VI_PROGRESSIVE;
else if((vireg[1] >> 2) & 1)
return VI_NON_INTERLACE;
} else if((vireg[55] & 1) && swissSettings.sramProgressive)
return VI_PROGRESSIVE;
else if((vireg[1] >> 2) & 1)
return VI_NON_INTERLACE;
else
return VI_INTERLACE;

return VI_INTERLACE;
}
return vmode->viTVMode & 3;
}
Expand Down Expand Up @@ -192,6 +203,7 @@ void updateVideoMode(GXRModeObj *m) {
m->viWidth = 704;
m->viXOrigin = 8;
}
VIDEO_Init ();
VIDEO_Configure (m);
VIDEO_Flush ();
}
Expand Down

0 comments on commit 3e2b72b

Please sign in to comment.