-fixed greenscreen, moved mem2 init back (no idea what the problem

there was)
-fixed random game flickering on return to wiiflow, doesnt work
for everyone still ;)
-removed dsp deinit, dont see a reason for that anymore
This commit is contained in:
fix94.1 2012-05-18 22:22:05 +00:00
parent 322099c826
commit 55f8c0bf95
5 changed files with 11 additions and 43 deletions

View File

@ -107,13 +107,12 @@ void CVideo::setAA(u8 aa, bool alpha, int width, int height)
void CVideo::init(void) void CVideo::init(void)
{ {
VIDEO_Init(); VIDEO_Init();
VIDEO_SetBlack(TRUE);
m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9; m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9;
m_rmode = VIDEO_GetPreferredMode(NULL); m_rmode = VIDEO_GetPreferredMode(NULL);
u32 type = CONF_GetVideo(); u32 type = CONF_GetVideo();
m_rmode->viWidth = m_wide ? 700 : 672; m_rmode->viWidth = m_wide ? 700 : 672;
if(m_rmode == &TVPal576IntDfScale || m_rmode == &TVPal576ProgScale) if(m_rmode == &TVPal576IntDfScale || m_rmode == &TVPal576ProgScale)
m_50hz = true; m_50hz = true;
else else
@ -140,12 +139,8 @@ void CVideo::init(void)
m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode)); m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode)); m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
VIDEO_Configure(m_rmode); VIDEO_Configure(m_rmode);
m_curFB = 0;
VIDEO_SetBlack(TRUE);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); m_curFB = 0;
if (m_rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE); m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE);
memset(m_fifo, 0, DEFAULT_FIFO_SIZE); memset(m_fifo, 0, DEFAULT_FIFO_SIZE);
GX_Init(m_fifo, DEFAULT_FIFO_SIZE); GX_Init(m_fifo, DEFAULT_FIFO_SIZE);
@ -172,12 +167,18 @@ void CVideo::init(void)
GX_SetNumChans(0); GX_SetNumChans(0);
GX_SetZCompLoc(GX_ENABLE); GX_SetZCompLoc(GX_ENABLE);
setup2DProjection(); setup2DProjection();
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[m_curFB], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK);
render(); render();
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[m_curFB], COLOR_BLACK);
render(); render();
VIDEO_SetBlack(FALSE); VIDEO_SetBlack(FALSE);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync();
if(m_rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight); m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight);
memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight); memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight);
} }

View File

@ -142,23 +142,3 @@ void Sys_LoadMenu(void)
/* Return to the Wii system menu */ /* Return to the Wii system menu */
WII_ReturnToMenu(); //SYS_ResetSystem doesnt work properly with new libogc WII_ReturnToMenu(); //SYS_ResetSystem doesnt work properly with new libogc
} }
void __dsp_shutdown(void)
{
u32 tick;
_dspReg[5] = (DSPCR_DSPRESET|DSPCR_HALT);
_dspReg[27] &= ~0x8000;
while(_dspReg[5]&0x400);
while(_dspReg[5]&0x200);
_dspReg[5] = (DSPCR_DSPRESET|DSPCR_DSPINT|DSPCR_ARINT|DSPCR_AIINT|DSPCR_HALT);
_dspReg[0] = 0;
while((_SHIFTL(_dspReg[2],16,16)|(_dspReg[3]&0xffff))&0x80000000);
tick = gettick();
while((gettick()-tick)<44);
_dspReg[5] |= DSPCR_RES;
while(_dspReg[5]&DSPCR_RES);
}

View File

@ -18,17 +18,6 @@ extern "C" {
#define EXIT_TO_DISABLE 4 #define EXIT_TO_DISABLE 4
#define EXIT_TO_BOOTMII 5 #define EXIT_TO_BOOTMII 5
// DSPCR bits
#define DSPCR_DSPRESET 0x0800 // Reset DSP
#define DSPCR_DSPINT 0x0080 // * interrupt active (RWC)
#define DSPCR_ARINT 0x0020
#define DSPCR_AIINT 0x0008
#define DSPCR_HALT 0x0004 // halt DSP
#define DSPCR_RES 0x0001 // reset DSP
#define _SHIFTL(v, s, w) \
((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s)))
/* Prototypes */ /* Prototypes */
void Sys_Init(void); void Sys_Init(void);
void Sys_LoadMenu(void); void Sys_LoadMenu(void);
@ -36,7 +25,6 @@ extern "C" {
void Sys_Test(void); void Sys_Test(void);
void Sys_Exit(void); void Sys_Exit(void);
void Sys_ExitTo(int); void Sys_ExitTo(int);
void __dsp_shutdown(void);
void Open_Inputs(void); void Open_Inputs(void);
void Close_Inputs(void); void Close_Inputs(void);

View File

@ -37,12 +37,12 @@ int main(int argc, char **argv)
{ {
__exception_setreload(5); __exception_setreload(5);
MEM1_init((void*)0x80003f00, (void*)0x80b00000); MEM1_init((void*)0x80003f00, (void*)0x80b00000);
MEM2_init(52);
// Init video // Init video
CVideo vid; CVideo vid;
vid.init(); vid.init();
MEM2_init(52);
geckoinit = InitGecko(); geckoinit = InitGecko();
gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV); gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV);
vid.waitMessage(0.2f); vid.waitMessage(0.2f);

View File

@ -483,7 +483,6 @@ void CMenu::cleanup(bool ios_reload)
if(!m_reload) if(!m_reload)
{ {
DeviceHandler::DestroyInstance(); DeviceHandler::DestroyInstance();
__dsp_shutdown();
m_vid.cleanup(); m_vid.cleanup();
wiiLightOff(); wiiLightOff();
} }