mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 09:05:06 +01:00
-fixed freeze when switching through game views
-fixed wrong banner sound played (issue 7)
This commit is contained in:
parent
05c007582d
commit
7905a0a9b0
@ -432,8 +432,6 @@ void CMenu::cleanup(bool ios_reload)
|
|||||||
{
|
{
|
||||||
m_cf.stopCoverLoader();
|
m_cf.stopCoverLoader();
|
||||||
|
|
||||||
CheckGameSoundThread(true);
|
|
||||||
|
|
||||||
_stopSounds();
|
_stopSounds();
|
||||||
|
|
||||||
if (!ios_reload)
|
if (!ios_reload)
|
||||||
@ -1511,8 +1509,8 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
|
|||||||
}
|
}
|
||||||
Sys_Test();
|
Sys_Test();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (withCF && m_gameSelected && m_gamesound_changed && (m_gameSoundHdr == NULL) && !m_gameSound.IsPlaying() && MusicPlayer::Instance()->GetVolume() == 0)
|
if (withCF && m_gameSelected && m_gamesound_changed && (!m_gameSoundHdr) && !m_gameSound.IsPlaying() && MusicPlayer::Instance()->GetVolume() == 0)
|
||||||
{
|
{
|
||||||
m_gameSound.Play(m_bnrSndVol);
|
m_gameSound.Play(m_bnrSndVol);
|
||||||
m_gamesound_changed = false;
|
m_gamesound_changed = false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef __MENU_HPP
|
#ifndef __MENU_HPP
|
||||||
#define __MENU_HPP
|
#define __MENU_HPP
|
||||||
//#define SHOWMEM 1
|
//#define SHOWMEM 1
|
||||||
//#define SHOWMEMGECKO
|
#define SHOWMEMGECKO
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
#include <ogc/pad.h>
|
#include <ogc/pad.h>
|
||||||
|
|
||||||
@ -932,14 +932,14 @@ private:
|
|||||||
static int _GCgameInstaller(void *obj);
|
static int _GCgameInstaller(void *obj);
|
||||||
wstringEx _optBoolToString(int b);
|
wstringEx _optBoolToString(int b);
|
||||||
void _stopSounds(void);
|
void _stopSounds(void);
|
||||||
//
|
|
||||||
static u32 _downloadCheatFileAsync(void *obj);
|
static u32 _downloadCheatFileAsync(void *obj);
|
||||||
//
|
|
||||||
void _playGameSound(void);
|
void _playGameSound(void);
|
||||||
void CheckGameSoundThread(bool force = false);
|
void CheckGameSoundThread(void);
|
||||||
void CheckThreads(bool force = false);
|
void CheckThreads(void);
|
||||||
static void _gameSoundThread(CMenu *m);
|
static void _gameSoundThread(CMenu *m);
|
||||||
//
|
|
||||||
static void _load_installed_cioses();
|
static void _load_installed_cioses();
|
||||||
//
|
//
|
||||||
struct SOption { const char id[10]; const wchar_t text[16]; };
|
struct SOption { const char id[10]; const wchar_t text[16]; };
|
||||||
|
@ -305,6 +305,7 @@ void CMenu::_game(bool launch)
|
|||||||
if (!launch)
|
if (!launch)
|
||||||
{
|
{
|
||||||
SetupInput();
|
SetupInput();
|
||||||
|
CheckGameSoundThread();
|
||||||
_playGameSound();
|
_playGameSound();
|
||||||
_showGame();
|
_showGame();
|
||||||
m_gameSelected = true;
|
m_gameSelected = true;
|
||||||
@ -320,6 +321,7 @@ void CMenu::_game(bool launch)
|
|||||||
|
|
||||||
if (startGameSound == -5)
|
if (startGameSound == -5)
|
||||||
{
|
{
|
||||||
|
CheckGameSoundThread();
|
||||||
_playGameSound();
|
_playGameSound();
|
||||||
_showGame();
|
_showGame();
|
||||||
}
|
}
|
||||||
@ -393,7 +395,6 @@ void CMenu::_game(bool launch)
|
|||||||
if (!m_locked)
|
if (!m_locked)
|
||||||
{
|
{
|
||||||
_hideGame();
|
_hideGame();
|
||||||
CheckGameSoundThread(true);
|
|
||||||
if (_wbfsOp(CMenu::WO_REMOVE_GAME))
|
if (_wbfsOp(CMenu::WO_REMOVE_GAME))
|
||||||
{
|
{
|
||||||
m_gameSound.Stop();
|
m_gameSound.Stop();
|
||||||
@ -849,7 +850,6 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
|||||||
IOS_Close(ESHandle);
|
IOS_Close(ESHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckGameSoundThread(true);
|
|
||||||
cleanup();
|
cleanup();
|
||||||
Close_Inputs();
|
Close_Inputs();
|
||||||
USBStorage_Deinit();
|
USBStorage_Deinit();
|
||||||
@ -979,7 +979,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
u32 cheatSize = 0, gameconfigSize = 0;
|
u32 cheatSize = 0, gameconfigSize = 0;
|
||||||
bool iosLoaded = false;
|
bool iosLoaded = false;
|
||||||
|
|
||||||
CheckGameSoundThread(true);
|
|
||||||
if (videoMode == 0) videoMode = (u8)min((u32)m_cfg.getInt("GENERAL", "video_mode", 0), ARRAY_SIZE(CMenu::_videoModes) - 1);
|
if (videoMode == 0) videoMode = (u8)min((u32)m_cfg.getInt("GENERAL", "video_mode", 0), ARRAY_SIZE(CMenu::_videoModes) - 1);
|
||||||
if (language == 0) language = min((u32)m_cfg.getInt("GENERAL", "game_language", 0), ARRAY_SIZE(CMenu::_languages) - 1);
|
if (language == 0) language = min((u32)m_cfg.getInt("GENERAL", "game_language", 0), ARRAY_SIZE(CMenu::_languages) - 1);
|
||||||
m_cfg.setString("GAMES", "current_item", id);
|
m_cfg.setString("GAMES", "current_item", id);
|
||||||
@ -1229,30 +1228,27 @@ void CMenu::_gameSoundThread(CMenu *m)
|
|||||||
Banner *banner = m->m_current_view == COVERFLOW_USB ?
|
Banner *banner = m->m_current_view == COVERFLOW_USB ?
|
||||||
_extractBnr(m->m_gameSoundHdr) : m->m_current_view == COVERFLOW_CHANNEL ?
|
_extractBnr(m->m_gameSoundHdr) : m->m_current_view == COVERFLOW_CHANNEL ?
|
||||||
_extractChannelBnr(m->m_gameSoundHdr->hdr.chantitle) : NULL;
|
_extractChannelBnr(m->m_gameSoundHdr->hdr.chantitle) : NULL;
|
||||||
|
SAFE_DELETE(m->m_gameSoundHdr);
|
||||||
|
|
||||||
if (banner == NULL || !banner->IsValid())
|
if (banner == NULL || !banner->IsValid())
|
||||||
{
|
{
|
||||||
gprintf("no valid banner found\n");
|
gprintf("no valid banner found\n");
|
||||||
SAFE_DELETE(banner);
|
SAFE_DELETE(banner);
|
||||||
m->m_gameSoundHdr = NULL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_extractBannerTitle(banner, GetLanguage(m->m_loc.getString(m->m_curLanguage, "gametdb_code", "EN").c_str()));
|
_extractBannerTitle(banner, GetLanguage(m->m_loc.getString(m->m_curLanguage, "gametdb_code", "EN").c_str()));
|
||||||
|
|
||||||
const u8 *soundBin = banner->GetFile((char *) "sound.bin", &sndSize);
|
const u8 *soundBin = banner->GetFile((char *) "sound.bin", &sndSize);
|
||||||
|
SAFE_DELETE(banner);
|
||||||
|
|
||||||
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");
|
||||||
SAFE_DELETE(banner);
|
|
||||||
m->m_gameSoundHdr = NULL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->m_gameSound.Load(soundBin, sndSize, false);
|
m->m_gameSound.Load(soundBin, sndSize, false);
|
||||||
SAFE_DELETE(banner);
|
|
||||||
m->m_gamesound_changed = true;
|
m->m_gamesound_changed = true;
|
||||||
m->m_gameSoundHdr = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenu::_playGameSound(void)
|
void CMenu::_playGameSound(void)
|
||||||
@ -1268,9 +1264,9 @@ void CMenu::_playGameSound(void)
|
|||||||
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void *)this, gameSoundThreadStack.get(), stack_size, 40);
|
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void *)this, gameSoundThreadStack.get(), stack_size, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenu::CheckGameSoundThread(bool force)
|
void CMenu::CheckGameSoundThread()
|
||||||
{
|
{
|
||||||
if (force || (m_gameSoundHdr == NULL && m_gameSoundThread != LWP_THREAD_NULL))
|
if (m_gameSoundHdr == NULL && m_gameSoundThread != LWP_THREAD_NULL)
|
||||||
{
|
{
|
||||||
if(LWP_ThreadIsSuspended(m_gameSoundThread))
|
if(LWP_ThreadIsSuspended(m_gameSoundThread))
|
||||||
LWP_ResumeThread(m_gameSoundThread);
|
LWP_ResumeThread(m_gameSoundThread);
|
||||||
@ -1282,9 +1278,9 @@ void CMenu::CheckGameSoundThread(bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenu::CheckThreads(bool force)
|
void CMenu::CheckThreads()
|
||||||
{
|
{
|
||||||
CheckGameSoundThread(force);
|
//CheckGameSoundThread(force);
|
||||||
//m_vid.CheckWaitThread(force);
|
//m_vid.CheckWaitThread(force);
|
||||||
#ifdef SHOWMEMGECKO
|
#ifdef SHOWMEMGECKO
|
||||||
mem1 = SYS_GetArena1Size();
|
mem1 = SYS_GetArena1Size();
|
||||||
|
Loading…
Reference in New Issue
Block a user