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

View File

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

View File

@ -21,9 +21,9 @@ public:
T *get(void) const { return m_p; }
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:
delete m_p;

View File

@ -479,13 +479,14 @@ void CMenu::cleanup(bool ios_reload)
MusicPlayer::DestroyInstance();
SoundHandler::DestroyInstance();
soundDeinit();
__dsp_shutdown();
DeviceHandler::DestroyInstance();
if(!m_reload)
{
DeviceHandler::DestroyInstance();
__dsp_shutdown();
m_vid.cleanup();
wiiLightOff();
}
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'))
{
gprintf("Failed to load banner sound!\n\n");
if(soundBin != NULL)
delete soundBin;
return;
}

View File

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