mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 09:05:06 +01:00
-more memory clearing up, may fixed a bug in wait messages
This commit is contained in:
parent
7714c6e6d8
commit
907c68f074
@ -11,6 +11,7 @@ extern const u8 wait_02_png[];
|
|||||||
extern const u8 wait_03_png[];
|
extern const u8 wait_03_png[];
|
||||||
extern const u8 wait_04_png[];
|
extern const u8 wait_04_png[];
|
||||||
extern const u8 wait_05_png[];
|
extern const u8 wait_05_png[];
|
||||||
|
vector<STexture> m_defaultWaitMessages;
|
||||||
|
|
||||||
const float CVideo::_jitter2[2][2] = {
|
const float CVideo::_jitter2[2][2] = {
|
||||||
{ 0.246490f, 0.249999f },
|
{ 0.246490f, 0.249999f },
|
||||||
@ -224,20 +225,33 @@ void CVideo::prepare(void)
|
|||||||
void CVideo::cleanup(void)
|
void CVideo::cleanup(void)
|
||||||
{
|
{
|
||||||
gprintf("Cleaning up video...\n");
|
gprintf("Cleaning up video...\n");
|
||||||
for (u32 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i)
|
GX_InvVtxCache();
|
||||||
{
|
GX_InvalidateTexAll();
|
||||||
if(m_aaBuffer[i].get())
|
|
||||||
m_aaBuffer[i].release();
|
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK);
|
||||||
}
|
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
if(m_rmode->viTVMode & VI_NON_INTERLACE)
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
GX_AbortFrame();
|
GX_AbortFrame();
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
|
|
||||||
VIDEO_SetBlack(TRUE);
|
for(u8 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i)
|
||||||
VIDEO_Flush();
|
{
|
||||||
VIDEO_WaitVSync();
|
if(m_aaBuffer[i].get())
|
||||||
if (m_rmode->viTVMode & VI_NON_INTERLACE)
|
m_aaBuffer[i].release();
|
||||||
VIDEO_WaitVSync();
|
}
|
||||||
|
for(u8 i = 0; i < m_defaultWaitMessages.size(); i++)
|
||||||
|
{
|
||||||
|
if(m_defaultWaitMessages[i].data.get())
|
||||||
|
m_defaultWaitMessages[i].data.release();
|
||||||
|
}
|
||||||
|
free(MEM_K1_TO_K0(m_frameBuf[0]));
|
||||||
|
free(MEM_K1_TO_K0(m_frameBuf[1]));
|
||||||
|
MEM1_free(m_stencil);
|
||||||
|
MEM1_free(m_fifo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideo::prepareAAPass(int aaStep)
|
void CVideo::prepareAAPass(int aaStep)
|
||||||
@ -502,7 +516,6 @@ void CVideo::_showWaitMessages(CVideo *m)
|
|||||||
}
|
}
|
||||||
if (m->m_useWiiLight)
|
if (m->m_useWiiLight)
|
||||||
wiiLightOff();
|
wiiLightOff();
|
||||||
m->m_waitMessages.clear();
|
|
||||||
m->m_showingWaitMessages = false;
|
m->m_showingWaitMessages = false;
|
||||||
gprintf("Stop showing images\n");
|
gprintf("Stop showing images\n");
|
||||||
}
|
}
|
||||||
@ -530,13 +543,22 @@ void CVideo::CheckWaitThread(bool force)
|
|||||||
if(waitThreadStack.get())
|
if(waitThreadStack.get())
|
||||||
waitThreadStack.release();
|
waitThreadStack.release();
|
||||||
waitThread = LWP_THREAD_NULL;
|
waitThread = LWP_THREAD_NULL;
|
||||||
|
|
||||||
m_waitMessages.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideo::waitMessage(float delay)
|
void CVideo::waitMessage(float delay)
|
||||||
{
|
{
|
||||||
|
if(m_defaultWaitMessages.size() == 0)
|
||||||
|
{
|
||||||
|
STexture m_wTextures[5];
|
||||||
|
m_wTextures[0].fromPNG(wait_01_png);
|
||||||
|
m_wTextures[1].fromPNG(wait_02_png);
|
||||||
|
m_wTextures[2].fromPNG(wait_03_png);
|
||||||
|
m_wTextures[3].fromPNG(wait_04_png);
|
||||||
|
m_wTextures[4].fromPNG(wait_05_png);
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
m_defaultWaitMessages.push_back(m_wTextures[i]);
|
||||||
|
}
|
||||||
waitMessage(vector<STexture>(), delay);
|
waitMessage(vector<STexture>(), delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,14 +570,7 @@ void CVideo::waitMessage(const vector<STexture> &tex, float delay, bool useWiiLi
|
|||||||
|
|
||||||
if (tex.size() == 0)
|
if (tex.size() == 0)
|
||||||
{
|
{
|
||||||
STexture m_wTextures[5];
|
m_waitMessages = m_defaultWaitMessages;
|
||||||
m_wTextures[0].fromPNG(wait_01_png);
|
|
||||||
m_wTextures[1].fromPNG(wait_02_png);
|
|
||||||
m_wTextures[2].fromPNG(wait_03_png);
|
|
||||||
m_wTextures[3].fromPNG(wait_04_png);
|
|
||||||
m_wTextures[4].fromPNG(wait_05_png);
|
|
||||||
for (int i = 0; i < 5; i++)
|
|
||||||
m_waitMessages.push_back(m_wTextures[i]);
|
|
||||||
m_waitMessageDelay = 0.3f;
|
m_waitMessageDelay = 0.3f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -163,7 +163,6 @@ void __Disc_SetVMode(void)
|
|||||||
/* Set video mode register */
|
/* Set video mode register */
|
||||||
*(vu32 *)0x800000CC = vmode_reg;
|
*(vu32 *)0x800000CC = vmode_reg;
|
||||||
DCFlushRange((void *)(0x800000CC), 4);
|
DCFlushRange((void *)(0x800000CC), 4);
|
||||||
ICInvalidateRange((void *)(0x800000CC), 4);
|
|
||||||
|
|
||||||
/* Set video mode */
|
/* Set video mode */
|
||||||
if (disc_vmode != 0)
|
if (disc_vmode != 0)
|
||||||
@ -364,7 +363,6 @@ s32 Disc_BootPartition()
|
|||||||
__Disc_SetVMode();
|
__Disc_SetVMode();
|
||||||
|
|
||||||
/* Shutdown IOS subsystems */
|
/* Shutdown IOS subsystems */
|
||||||
__dsp_shutdown();
|
|
||||||
u32 level = IRQ_Disable();
|
u32 level = IRQ_Disable();
|
||||||
__IOS_ShutdownSubsystems();
|
__IOS_ShutdownSubsystems();
|
||||||
__exception_closeall();
|
__exception_closeall();
|
||||||
|
@ -467,17 +467,21 @@ void CMenu::init(void)
|
|||||||
void CMenu::cleanup(bool ios_reload)
|
void CMenu::cleanup(bool ios_reload)
|
||||||
{
|
{
|
||||||
m_cf.stopCoverLoader();
|
m_cf.stopCoverLoader();
|
||||||
|
m_cf.clear();
|
||||||
|
|
||||||
|
m_plugin.Cleanup();
|
||||||
|
|
||||||
_stopSounds();
|
_stopSounds();
|
||||||
|
|
||||||
if (!ios_reload)
|
if (!ios_reload)
|
||||||
m_cameraSound.release();
|
m_cameraSound.release();
|
||||||
|
|
||||||
m_plugin.Cleanup();
|
|
||||||
|
|
||||||
MusicPlayer::DestroyInstance();
|
MusicPlayer::DestroyInstance();
|
||||||
SoundHandler::DestroyInstance();
|
SoundHandler::DestroyInstance();
|
||||||
soundDeinit();
|
soundDeinit();
|
||||||
|
__dsp_shutdown();
|
||||||
|
|
||||||
|
DeviceHandler::DestroyInstance();
|
||||||
|
|
||||||
if(!m_reload)
|
if(!m_reload)
|
||||||
m_vid.cleanup();
|
m_vid.cleanup();
|
||||||
|
@ -1290,11 +1290,10 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
cleanup();
|
cleanup();
|
||||||
// wifi-gecko can no longer function after cleanup
|
// wifi-gecko can no longer function after cleanup
|
||||||
Close_Inputs();
|
Close_Inputs();
|
||||||
|
USBStorage_Deinit();
|
||||||
if(currentPartition == 0)
|
if(currentPartition == 0)
|
||||||
SDHC_Init();
|
SDHC_Init();
|
||||||
|
|
||||||
usleep(100 * 1000);
|
|
||||||
|
|
||||||
/* Find game partition offset */
|
/* Find game partition offset */
|
||||||
u64 offset;
|
u64 offset;
|
||||||
s32 ret = Disc_FindPartition(&offset);
|
s32 ret = Disc_FindPartition(&offset);
|
||||||
@ -1302,8 +1301,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio);
|
RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio);
|
||||||
DeviceHandler::DestroyInstance();
|
|
||||||
USBStorage_Deinit();
|
|
||||||
gprintf("Booting game\n");
|
gprintf("Booting game\n");
|
||||||
Disc_BootPartition();
|
Disc_BootPartition();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,10 @@ SoundHandler::~SoundHandler()
|
|||||||
LWP_JoinThread(SoundThread, NULL);
|
LWP_JoinThread(SoundThread, NULL);
|
||||||
SoundThread = LWP_THREAD_NULL;
|
SoundThread = LWP_THREAD_NULL;
|
||||||
if(ThreadStack != NULL)
|
if(ThreadStack != NULL)
|
||||||
|
{
|
||||||
MEM1_free(ThreadStack);
|
MEM1_free(ThreadStack);
|
||||||
|
ThreadStack = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ClearDecoderList();
|
ClearDecoderList();
|
||||||
gprintf("SHND: Stopped sound thread\n");
|
gprintf("SHND: Stopped sound thread\n");
|
||||||
@ -69,68 +72,71 @@ SoundHandler::~SoundHandler()
|
|||||||
SoundHandler * SoundHandler::Instance()
|
SoundHandler * SoundHandler::Instance()
|
||||||
{
|
{
|
||||||
if (instance == NULL)
|
if (instance == NULL)
|
||||||
{
|
|
||||||
instance = new SoundHandler();
|
instance = new SoundHandler();
|
||||||
}
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundHandler::DestroyInstance()
|
void SoundHandler::DestroyInstance()
|
||||||
{
|
{
|
||||||
if(instance)
|
if(instance)
|
||||||
{
|
{
|
||||||
delete instance;
|
delete instance;
|
||||||
}
|
instance = NULL;
|
||||||
instance = NULL;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundHandler::AddDecoder(int voice, const char * filepath)
|
void SoundHandler::AddDecoder(int voice, const char * filepath)
|
||||||
{
|
{
|
||||||
if(voice < 0 || voice >= MAX_DECODERS)
|
if(voice < 0 || voice >= MAX_DECODERS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(DecoderList[voice] != NULL)
|
if(DecoderList[voice] != NULL)
|
||||||
RemoveDecoder(voice);
|
RemoveDecoder(voice);
|
||||||
|
|
||||||
DecoderList[voice] = GetSoundDecoder(filepath);
|
DecoderList[voice] = GetSoundDecoder(filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundHandler::AddDecoder(int voice, const u8 * snd, int len)
|
void SoundHandler::AddDecoder(int voice, const u8 * snd, int len)
|
||||||
{
|
{
|
||||||
if(voice < 0 || voice >= MAX_DECODERS)
|
if(voice < 0 || voice >= MAX_DECODERS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (snd == NULL || len == 0)
|
if (snd == NULL || len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(DecoderList[voice] != NULL)
|
if(DecoderList[voice] != NULL)
|
||||||
RemoveDecoder(voice);
|
RemoveDecoder(voice);
|
||||||
|
|
||||||
DecoderList[voice] = GetSoundDecoder(snd, len);
|
DecoderList[voice] = GetSoundDecoder(snd, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundHandler::RemoveDecoder(int voice)
|
void SoundHandler::RemoveDecoder(int voice)
|
||||||
{
|
{
|
||||||
if(voice < 0 || voice >= MAX_DECODERS)
|
if(voice < 0 || voice >= MAX_DECODERS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(DecoderList[voice] != NULL)
|
if(DecoderList[voice] != NULL)
|
||||||
{
|
{
|
||||||
if(DecoderList[voice]->GetSoundType() == SOUND_OGG) delete ((OggDecoder *) DecoderList[voice]);
|
if(DecoderList[voice]->GetSoundType() == SOUND_OGG)
|
||||||
else if(DecoderList[voice]->GetSoundType() == SOUND_MP3) delete ((Mp3Decoder *) DecoderList[voice]);
|
delete ((OggDecoder *)DecoderList[voice]);
|
||||||
else if(DecoderList[voice]->GetSoundType() == SOUND_WAV) delete ((WavDecoder *) DecoderList[voice]);
|
else if(DecoderList[voice]->GetSoundType() == SOUND_MP3)
|
||||||
else if(DecoderList[voice]->GetSoundType() == SOUND_AIF) delete ((AifDecoder *) DecoderList[voice]);
|
delete ((Mp3Decoder *)DecoderList[voice]);
|
||||||
else if(DecoderList[voice]->GetSoundType() == SOUND_BNS) delete ((BNSDecoder *) DecoderList[voice]);
|
else if(DecoderList[voice]->GetSoundType() == SOUND_WAV)
|
||||||
else delete DecoderList[voice];
|
delete ((WavDecoder *)DecoderList[voice]);
|
||||||
|
else if(DecoderList[voice]->GetSoundType() == SOUND_AIF)
|
||||||
|
delete ((AifDecoder *)DecoderList[voice]);
|
||||||
|
else if(DecoderList[voice]->GetSoundType() == SOUND_BNS)
|
||||||
|
delete ((BNSDecoder *)DecoderList[voice]);
|
||||||
|
else
|
||||||
|
delete DecoderList[voice];
|
||||||
|
DecoderList[voice] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DecoderList[voice] = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundHandler::ClearDecoderList()
|
void SoundHandler::ClearDecoderList()
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i < MAX_DECODERS; ++i)
|
for(u32 i = 0; i < MAX_DECODERS; ++i)
|
||||||
RemoveDecoder(i);
|
RemoveDecoder(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool CheckMP3Signature(const u8 * buffer)
|
static inline bool CheckMP3Signature(const u8 * buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user