-proper cleanup of video now, no more greenscreens should come

on game booting
-moved partition read buffer on game boot to mem1, faster
This commit is contained in:
fix94.1 2012-05-17 12:47:27 +00:00
parent 0a90ae532e
commit f94e65a54d
6 changed files with 155 additions and 142 deletions

View File

@ -225,19 +225,21 @@ void CVideo::prepare(void)
void CVideo::cleanup(void) void CVideo::cleanup(void)
{ {
gprintf("Cleaning up video...\n"); gprintf("Cleaning up video...\n");
GX_InvVtxCache();
GX_InvalidateTexAll();
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK); VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[m_curFB], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK); render();
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[m_curFB], COLOR_BLACK);
render();
GX_DrawDone();
GX_AbortFrame();
VIDEO_SetBlack(TRUE);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
if(m_rmode->viTVMode & VI_NON_INTERLACE) if(m_rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync(); VIDEO_WaitVSync();
GX_AbortFrame();
GX_Flush();
for(u8 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i) for(u8 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i)
{ {
if(m_aaBuffer[i].get()) if(m_aaBuffer[i].get())
@ -248,10 +250,26 @@ void CVideo::cleanup(void)
if(m_defaultWaitMessages[i].data.get()) if(m_defaultWaitMessages[i].data.get())
m_defaultWaitMessages[i].data.release(); m_defaultWaitMessages[i].data.release();
} }
if(m_frameBuf[0] != NULL)
{
free(MEM_K1_TO_K0(m_frameBuf[0])); free(MEM_K1_TO_K0(m_frameBuf[0]));
m_frameBuf[0] = NULL;
}
if(m_frameBuf[1] != NULL)
{
free(MEM_K1_TO_K0(m_frameBuf[1])); free(MEM_K1_TO_K0(m_frameBuf[1]));
m_frameBuf[0] = NULL;
}
if(m_stencil != NULL)
{
MEM1_free(m_stencil); MEM1_free(m_stencil);
m_stencil = NULL;
}
if(m_fifo != NULL)
{
MEM1_free(m_fifo); MEM1_free(m_fifo);
m_fifo = NULL;
}
} }
void CVideo::prepareAAPass(int aaStep) void CVideo::prepareAAPass(int aaStep)

View File

@ -167,13 +167,6 @@ void __Disc_SetVMode(void)
/* Set video mode */ /* Set video mode */
if (disc_vmode != 0) if (disc_vmode != 0)
VIDEO_Configure(disc_vmode); VIDEO_Configure(disc_vmode);
/* Setup video */
VIDEO_SetBlack(TRUE);
VIDEO_Flush();
VIDEO_WaitVSync();
if(disc_vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
} }
void __Disc_SetTime(void) void __Disc_SetTime(void)
@ -187,7 +180,7 @@ s32 Disc_FindPartition(u64 *outbuf)
u64 offset = 0; u64 offset = 0;
u32 cnt; u32 cnt;
u32 *TMP_Buffer = (u32*)MEM2_alloc(0x20); u32 *TMP_Buffer = (u32*)MEM1_alloc(0x20);
if(!TMP_Buffer) if(!TMP_Buffer)
return -1; return -1;
@ -195,7 +188,7 @@ s32 Disc_FindPartition(u64 *outbuf)
s32 ret = WDVD_UnencryptedRead(TMP_Buffer, 0x20, PTABLE_OFFSET); s32 ret = WDVD_UnencryptedRead(TMP_Buffer, 0x20, PTABLE_OFFSET);
if(ret < 0) if(ret < 0)
{ {
MEM2_free(TMP_Buffer); MEM1_free(TMP_Buffer);
return ret; return ret;
} }
@ -205,7 +198,7 @@ s32 Disc_FindPartition(u64 *outbuf)
if(nb_partitions > 8) if(nb_partitions > 8)
{ {
MEM2_free(TMP_Buffer); MEM1_free(TMP_Buffer);
return -1; return -1;
} }
@ -215,7 +208,7 @@ s32 Disc_FindPartition(u64 *outbuf)
ret = WDVD_UnencryptedRead(TMP_Buffer, 0x20, table_offset); ret = WDVD_UnencryptedRead(TMP_Buffer, 0x20, table_offset);
if (ret < 0) if (ret < 0)
{ {
MEM2_free(TMP_Buffer); MEM1_free(TMP_Buffer);
return ret; return ret;
} }
@ -228,7 +221,7 @@ s32 Disc_FindPartition(u64 *outbuf)
if(!type) if(!type)
offset = TMP_Buffer[cnt * 2] << 2; offset = TMP_Buffer[cnt * 2] << 2;
} }
MEM2_free(TMP_Buffer); MEM1_free(TMP_Buffer);
/* No game partition found */ /* No game partition found */
if (!offset) if (!offset)

View File

@ -21,9 +21,9 @@ public:
T *get(void) const { return m_p; } T *get(void) const { return m_p; }
virtual void release(void) virtual void release(void)
{ {
if (m_refcount != NULL && --*m_refcount == 0) if (m_p != NULL && m_refcount != NULL && --*m_refcount == 0)
{ {
switch (m_srcAlloc) switch(m_srcAlloc)
{ {
case SRCALL_NEW: case SRCALL_NEW:
delete m_p; delete m_p;

View File

@ -479,13 +479,14 @@ void CMenu::cleanup(bool ios_reload)
MusicPlayer::DestroyInstance(); MusicPlayer::DestroyInstance();
SoundHandler::DestroyInstance(); SoundHandler::DestroyInstance();
soundDeinit(); soundDeinit();
__dsp_shutdown();
DeviceHandler::DestroyInstance();
if(!m_reload) if(!m_reload)
{
DeviceHandler::DestroyInstance();
__dsp_shutdown();
m_vid.cleanup(); m_vid.cleanup();
wiiLightOff(); wiiLightOff();
}
if (!ios_reload) if (!ios_reload)
{ {

View File

@ -1421,6 +1421,7 @@ void CMenu::_gameSoundThread(CMenu *m)
if (soundBin == NULL || (((IMD5Header *)soundBin)->fcc != 'IMD5' && ((IMD5Header *)soundBin)->fcc != 'RIFF')) if (soundBin == NULL || (((IMD5Header *)soundBin)->fcc != 'IMD5' && ((IMD5Header *)soundBin)->fcc != 'RIFF'))
{ {
gprintf("Failed to load banner sound!\n\n"); gprintf("Failed to load banner sound!\n\n");
if(soundBin != NULL)
delete soundBin; delete soundBin;
return; return;
} }

View File

@ -48,7 +48,7 @@ SoundHandler::SoundHandler()
return; return;
LWP_CreateThread(&SoundThread, UpdateThread, this, ThreadStack, 32768, 80); LWP_CreateThread(&SoundThread, UpdateThread, this, ThreadStack, 32768, 80);
//gprintf("SHND: Running sound thread\n"); gprintf("SHND: Running sound thread\n");
} }
SoundHandler::~SoundHandler() SoundHandler::~SoundHandler()
@ -260,7 +260,7 @@ void SoundHandler::InternalSoundUpdates()
{ {
u16 i = 0; u16 i = 0;
LWP_InitQueue(&ThreadQueue); LWP_InitQueue(&ThreadQueue);
while (!ExitRequested) while(!ExitRequested)
{ {
LWP_ThreadSleep(ThreadQueue); LWP_ThreadSleep(ThreadQueue);