mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-25 03:11:58 +01:00
-fixed bug in setting video mode
This commit is contained in:
parent
817a2b42d4
commit
3ade778445
@ -21,9 +21,7 @@
|
|||||||
type *name = (type*)(((u32)(_al__##name)) + ((alignment) - (( \
|
type *name = (type*)(((u32)(_al__##name)) + ((alignment) - (( \
|
||||||
(u32)(_al__##name))&((alignment)-1))))
|
(u32)(_al__##name))&((alignment)-1))))
|
||||||
|
|
||||||
GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle);
|
|
||||||
void __Disc_SetLowMem(void);
|
void __Disc_SetLowMem(void);
|
||||||
void __Disc_SetVMode(void);
|
|
||||||
void __Disc_SetTime(void);
|
void __Disc_SetTime(void);
|
||||||
void _unstub_start();
|
void _unstub_start();
|
||||||
u32 entryPoint;
|
u32 entryPoint;
|
||||||
@ -49,7 +47,8 @@ s32 BootChannel(u32 entry, u64 chantitle, u32 ios, u8 vidMode, bool vipatch, boo
|
|||||||
entryPoint = entry;
|
entryPoint = entry;
|
||||||
|
|
||||||
/* Select an appropriate video mode */
|
/* Select an appropriate video mode */
|
||||||
GXRModeObj * vmode = __Disc_SelectVMode(vidMode, chantitle);
|
u32 vmode_reg = 0;
|
||||||
|
GXRModeObj *vmode = Disc_SelectVMode(vidMode, chantitle, &vmode_reg);
|
||||||
|
|
||||||
/* Set time */
|
/* Set time */
|
||||||
__Disc_SetTime();
|
__Disc_SetTime();
|
||||||
@ -65,7 +64,7 @@ s32 BootChannel(u32 entry, u64 chantitle, u32 ios, u8 vidMode, bool vipatch, boo
|
|||||||
entrypoint appJump = (entrypoint)entryPoint;
|
entrypoint appJump = (entrypoint)entryPoint;
|
||||||
|
|
||||||
/* Set an appropriate video mode */
|
/* Set an appropriate video mode */
|
||||||
__Disc_SetVMode();
|
Disc_SetVMode(vmode, vmode_reg);
|
||||||
|
|
||||||
// IOS Version Check
|
// IOS Version Check
|
||||||
*(vu32*)0x80003140 = ((ios << 16)) | 0xFFFF;
|
*(vu32*)0x80003140 = ((ios << 16)) | 0xFFFF;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "fileOps.h"
|
#include "fileOps.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "memory/mem2.hpp"
|
#include "memory/mem2.hpp"
|
||||||
|
#include "loader/disc.h"
|
||||||
|
|
||||||
// for directory parsing and low-level file I/O
|
// for directory parsing and low-level file I/O
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -262,8 +263,8 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting)
|
|||||||
{
|
{
|
||||||
syssram *sram;
|
syssram *sram;
|
||||||
sram = __SYS_LockSram();
|
sram = __SYS_LockSram();
|
||||||
static GXRModeObj *rmode;
|
GXRModeObj *vmode = VIDEO_GetPreferredMode(0);
|
||||||
int memflag = 0;
|
int vmode_reg = 0;
|
||||||
|
|
||||||
if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3)
|
if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3)
|
||||||
sram->flags |= 0x80; //set progressive flag
|
sram->flags |= 0x80; //set progressive flag
|
||||||
@ -272,7 +273,7 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting)
|
|||||||
|
|
||||||
if(videomode == 1 || videomode == 3 || videomode == 5)
|
if(videomode == 1 || videomode == 3 || videomode == 5)
|
||||||
{
|
{
|
||||||
memflag = 1;
|
vmode_reg = 1;
|
||||||
sram->flags |= 0x01; // Set bit 0 to set the video mode to PAL
|
sram->flags |= 0x01; // Set bit 0 to set the video mode to PAL
|
||||||
sram->ntd |= 0x40; //set pal60 flag
|
sram->ntd |= 0x40; //set pal60 flag
|
||||||
}
|
}
|
||||||
@ -286,52 +287,40 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting)
|
|||||||
{
|
{
|
||||||
if(DMLCfg != NULL && videoSetting == 2)
|
if(DMLCfg != NULL && videoSetting == 2)
|
||||||
DMLCfg->VideoMode |= DML_VID_FORCE_PAL50;
|
DMLCfg->VideoMode |= DML_VID_FORCE_PAL50;
|
||||||
rmode = &TVPal528IntDf;
|
vmode = &TVPal528IntDf;
|
||||||
}
|
}
|
||||||
else if(videomode == 2)
|
else if(videomode == 2)
|
||||||
{
|
{
|
||||||
if(DMLCfg != NULL && videoSetting == 2)
|
if(DMLCfg != NULL && videoSetting == 2)
|
||||||
DMLCfg->VideoMode |= DML_VID_FORCE_NTSC;
|
DMLCfg->VideoMode |= DML_VID_FORCE_NTSC;
|
||||||
rmode = &TVNtsc480IntDf;
|
vmode = &TVNtsc480IntDf;
|
||||||
}
|
}
|
||||||
else if(videomode == 3)
|
else if(videomode == 3)
|
||||||
{
|
{
|
||||||
if(DMLCfg != NULL && videoSetting == 2)
|
if(DMLCfg != NULL && videoSetting == 2)
|
||||||
DMLCfg->VideoMode |= DML_VID_FORCE_PAL60;
|
DMLCfg->VideoMode |= DML_VID_FORCE_PAL60;
|
||||||
rmode = &TVEurgb60Hz480IntDf;
|
vmode = &TVEurgb60Hz480IntDf;
|
||||||
memflag = 5;
|
vmode_reg = 5;
|
||||||
}
|
}
|
||||||
else if(videomode == 4 ||videomode == 6)
|
else if(videomode == 4 ||videomode == 6)
|
||||||
{
|
{
|
||||||
if(DMLCfg != NULL && videoSetting == 2)
|
if(DMLCfg != NULL && videoSetting == 2)
|
||||||
DMLCfg->VideoMode |= DML_VID_FORCE_PROG;
|
DMLCfg->VideoMode |= DML_VID_FORCE_PROG;
|
||||||
rmode = &TVNtsc480Prog;
|
vmode = &TVNtsc480Prog;
|
||||||
}
|
}
|
||||||
else if(videomode == 5 || videomode == 7)
|
else if(videomode == 5 || videomode == 7)
|
||||||
{
|
{
|
||||||
if(DMLCfg != NULL && videoSetting == 2)
|
if(DMLCfg != NULL && videoSetting == 2)
|
||||||
DMLCfg->VideoMode |= DML_VID_FORCE_PROG;
|
DMLCfg->VideoMode |= DML_VID_FORCE_PROG;
|
||||||
rmode = &TVNtsc480Prog;
|
vmode = &TVNtsc480Prog;
|
||||||
memflag = 5;
|
vmode_reg = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
__SYS_UnlockSram(1); // 1 -> write changes
|
__SYS_UnlockSram(1); // 1 -> write changes
|
||||||
while(!__SYS_SyncSram());
|
while(!__SYS_SyncSram());
|
||||||
|
|
||||||
/* Set video mode register */
|
/* Set an appropriate video mode */
|
||||||
*(vu32 *)0x800000CC = memflag;
|
Disc_SetVMode(vmode, vmode_reg);
|
||||||
DCFlushRange((void *)(0x800000CC), 4);
|
|
||||||
|
|
||||||
/* Set video mode */
|
|
||||||
if (rmode != 0)
|
|
||||||
VIDEO_Configure(rmode);
|
|
||||||
|
|
||||||
/* Setup video */
|
|
||||||
VIDEO_SetBlack(TRUE);
|
|
||||||
VIDEO_Flush();
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
if(rmode->viTVMode & VI_NON_INTERLACE)
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 get_wii_language()
|
u8 get_wii_language()
|
||||||
|
@ -65,9 +65,9 @@ void __Disc_SetLowMem()
|
|||||||
memcpy((void *)Online_Check, (void *)Disc_ID, 4);
|
memcpy((void *)Online_Check, (void *)Disc_ID, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
|
GXRModeObj *Disc_SelectVMode(u8 videoselected, u64 chantitle, u32 *rmode_reg)
|
||||||
{
|
{
|
||||||
vmode = VIDEO_GetPreferredMode(0);
|
GXRModeObj *rmode = VIDEO_GetPreferredMode(0);
|
||||||
|
|
||||||
/* Get video mode configuration */
|
/* Get video mode configuration */
|
||||||
bool progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
bool progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||||
@ -78,19 +78,19 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
|
|||||||
case CONF_VIDEO_PAL:
|
case CONF_VIDEO_PAL:
|
||||||
if (CONF_GetEuRGB60() > 0)
|
if (CONF_GetEuRGB60() > 0)
|
||||||
{
|
{
|
||||||
vmode_reg = VI_EURGB60;
|
*rmode_reg = VI_EURGB60;
|
||||||
vmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
rmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vmode_reg = VI_PAL;
|
*rmode_reg = VI_PAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONF_VIDEO_MPAL:
|
case CONF_VIDEO_MPAL:
|
||||||
vmode_reg = VI_MPAL;
|
*rmode_reg = VI_MPAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONF_VIDEO_NTSC:
|
case CONF_VIDEO_NTSC:
|
||||||
vmode_reg = VI_NTSC;
|
*rmode_reg = VI_NTSC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
|
|||||||
case 'Y':
|
case 'Y':
|
||||||
if(CONF_GetVideo() != CONF_VIDEO_PAL)
|
if(CONF_GetVideo() != CONF_VIDEO_PAL)
|
||||||
{
|
{
|
||||||
vmode_reg = VI_PAL;
|
*rmode_reg = VI_PAL;
|
||||||
vmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
rmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// NTSC
|
// NTSC
|
||||||
@ -126,8 +126,8 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
|
|||||||
default:
|
default:
|
||||||
if(CONF_GetVideo() != CONF_VIDEO_NTSC)
|
if(CONF_GetVideo() != CONF_VIDEO_NTSC)
|
||||||
{
|
{
|
||||||
vmode_reg = VI_NTSC;
|
*rmode_reg = VI_NTSC;
|
||||||
vmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
rmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -135,43 +135,51 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
|
|||||||
case 1: // SYSTEM
|
case 1: // SYSTEM
|
||||||
break;
|
break;
|
||||||
case 2: // PAL50
|
case 2: // PAL50
|
||||||
vmode = &TVPal528IntDf;
|
rmode = &TVPal528IntDf;
|
||||||
vmode_reg = vmode->viTVMode >> 2;
|
*rmode_reg = rmode->viTVMode >> 2;
|
||||||
break;
|
break;
|
||||||
case 3: // PAL60
|
case 3: // PAL60
|
||||||
vmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
rmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||||
vmode_reg = progressive ? TVEurgb60Hz480Prog.viTVMode >> 2 : vmode->viTVMode >> 2;
|
*rmode_reg = progressive ? TVEurgb60Hz480Prog.viTVMode >> 2 : rmode->viTVMode >> 2;
|
||||||
break;
|
break;
|
||||||
case 4: // NTSC
|
case 4: // NTSC
|
||||||
vmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
rmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
||||||
vmode_reg = vmode->viTVMode >> 2;
|
*rmode_reg = rmode->viTVMode >> 2;
|
||||||
break;
|
break;
|
||||||
case 5: // PROGRESSIVE 480P
|
case 5: // PROGRESSIVE 480P
|
||||||
vmode = &TVNtsc480Prog;
|
rmode = &TVNtsc480Prog;
|
||||||
vmode_reg = Region == 'P' ? TVEurgb60Hz480Prog.viTVMode >> 2 : vmode->viTVMode >> 2;
|
*rmode_reg = Region == 'P' ? TVEurgb60Hz480Prog.viTVMode >> 2 : rmode->viTVMode >> 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return rmode;
|
||||||
return vmode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __Disc_SetVMode(void)
|
void Disc_SetVMode(GXRModeObj *rmode, u32 rmode_reg)
|
||||||
{
|
{
|
||||||
/* Set video mode register */
|
/* Set video mode register */
|
||||||
*(vu32 *)0x800000CC = vmode_reg;
|
*Video_Mode = rmode_reg;
|
||||||
DCFlushRange((void *)(0x800000CC), 4);
|
DCFlushRange((void*)Video_Mode, 4);
|
||||||
|
|
||||||
/* Set video mode */
|
/* Set video mode */
|
||||||
if(vmode != 0)
|
if(rmode != 0)
|
||||||
VIDEO_Configure(vmode);
|
VIDEO_Configure(rmode);
|
||||||
|
|
||||||
/* Setup video */
|
/* Setup video */
|
||||||
|
VIDEO_SetBlack(FALSE);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
if(rmode->viTVMode & VI_NON_INTERLACE)
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
else while(VIDEO_GetNextField())
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
|
/* Set black and flush */
|
||||||
VIDEO_SetBlack(TRUE);
|
VIDEO_SetBlack(TRUE);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
if(vmode->viTVMode & VI_NON_INTERLACE)
|
if(rmode->viTVMode & VI_NON_INTERLACE)
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
else while(VIDEO_GetNextField())
|
else while(VIDEO_GetNextField())
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
@ -363,7 +371,7 @@ s32 Disc_BootPartition()
|
|||||||
__Disc_SetTime();
|
__Disc_SetTime();
|
||||||
|
|
||||||
/* Set an appropriate video mode */
|
/* Set an appropriate video mode */
|
||||||
__Disc_SetVMode();
|
Disc_SetVMode(vmode, vmode_reg);
|
||||||
|
|
||||||
/* Shutdown IOS subsystems */
|
/* Shutdown IOS subsystems */
|
||||||
u32 level = IRQ_Disable();
|
u32 level = IRQ_Disable();
|
||||||
@ -411,7 +419,7 @@ void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 p
|
|||||||
__Disc_SetLowMem();
|
__Disc_SetLowMem();
|
||||||
|
|
||||||
/* Select an appropriate video mode */
|
/* Select an appropriate video mode */
|
||||||
__Disc_SelectVMode(vidMode, 0);
|
vmode = Disc_SelectVMode(vidMode, 0, &vmode_reg);
|
||||||
|
|
||||||
/* Run apploader */
|
/* Run apploader */
|
||||||
Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio, returnTo);
|
Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio, returnTo);
|
||||||
|
@ -106,6 +106,9 @@ s32 Disc_IsGC(void);
|
|||||||
s32 Disc_BootPartition();
|
s32 Disc_BootPartition();
|
||||||
s32 Disc_FindPartition(u64 *outbuf);
|
s32 Disc_FindPartition(u64 *outbuf);
|
||||||
|
|
||||||
|
GXRModeObj *Disc_SelectVMode(u8 videoselected, u64 chantitle, u32 *rmode_reg);
|
||||||
|
void Disc_SetVMode(GXRModeObj *rmode, u32 rmode_reg);
|
||||||
|
|
||||||
void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo);
|
void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user