mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-24 02:41:55 +01:00
-thp videos now behave very similar to banners using a new drawing system (not fully tested, may not work correctly)
-you can use thp videos for plugins, just use the same name system like covers (the whole game name with extension for both thp and ogg), if wiiflow finds such a video it'll play it in plugin flow by default
This commit is contained in:
parent
18bab7faf5
commit
fad956006c
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* by Dimok
|
||||
* Copyright (C) 2010 by Dimok
|
||||
* (C) 2014 by FIX94
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
@ -31,36 +31,42 @@
|
||||
#include "gecko/gecko.hpp"
|
||||
|
||||
WiiMovie movie;
|
||||
|
||||
void WiiMovie::Init(const char *filepath)
|
||||
{
|
||||
Frame = NULL;
|
||||
BufferPos = 0;
|
||||
Buffer[0].thread = false;
|
||||
Buffer[1].thread = false;
|
||||
VideoFrameCount = 0;
|
||||
fps = 0.0f;
|
||||
ExitRequested = false;
|
||||
Playing = false;
|
||||
ThreadStack = NULL;
|
||||
rendered = false;
|
||||
gprintf("Opening video '%s'\n", filepath);
|
||||
//gprintf("Opening video '%s'\n", filepath);
|
||||
ReadThread = LWP_THREAD_NULL;
|
||||
vFile = fopen(filepath, "rb");
|
||||
if(!vFile)
|
||||
{
|
||||
gprintf("Open video failed\n");
|
||||
//gprintf("Open video failed\n");
|
||||
ExitRequested = true;
|
||||
return;
|
||||
}
|
||||
if(Video.Init(vFile) == false)
|
||||
{
|
||||
gprintf("Memory Allocation failed\n");
|
||||
//gprintf("Memory Allocation failed\n");
|
||||
ExitRequested = true;
|
||||
return;
|
||||
}
|
||||
fps = Video.getFps();
|
||||
inited = true;
|
||||
}
|
||||
|
||||
void WiiMovie::DeInit()
|
||||
{
|
||||
gprintf("Destructing WiiMovie object\n");
|
||||
if(inited == false)
|
||||
return;
|
||||
inited = false;
|
||||
//gprintf("Destructing WiiMovie object\n");
|
||||
Playing = false;
|
||||
ExitRequested = true;
|
||||
|
||||
@ -81,9 +87,15 @@ void WiiMovie::DeInit()
|
||||
if(vFile != NULL)
|
||||
fclose(vFile);
|
||||
vFile = NULL;
|
||||
Frame = NULL;
|
||||
TexHandle.Cleanup(Buffer[0]);
|
||||
TexHandle.Cleanup(Buffer[1]);
|
||||
Buffer[0].thread = false;
|
||||
Buffer[1].thread = false;
|
||||
BufferPos = 0;
|
||||
}
|
||||
|
||||
bool WiiMovie::Play(TexData *Background, bool loop)
|
||||
bool WiiMovie::Play(bool loop)
|
||||
{
|
||||
if(!vFile)
|
||||
return false;
|
||||
@ -92,21 +104,20 @@ bool WiiMovie::Play(TexData *Background, bool loop)
|
||||
if(!ThreadStack)
|
||||
return false;
|
||||
|
||||
gprintf("Start playing video\n");
|
||||
//gprintf("Start playing video\n");
|
||||
Video.loop = loop;
|
||||
Frame = Background;
|
||||
rendered = true;
|
||||
PlayTime.reset();
|
||||
Playing = true;
|
||||
|
||||
LWP_CreateThread(&ReadThread, UpdateThread, this, ThreadStack, 32768, LWP_PRIO_HIGHEST);
|
||||
gprintf("Reading frames thread started\n");
|
||||
Buffer[0].thread = false;
|
||||
Buffer[1].thread = false;
|
||||
LWP_CreateThread(&ReadThread, UpdateThread, this, ThreadStack, 32768, 60);
|
||||
//gprintf("Reading frames thread started\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
void WiiMovie::Stop()
|
||||
{
|
||||
gprintf("Stopping WiiMovie video\n");
|
||||
//gprintf("Stopping WiiMovie video\n");
|
||||
ExitRequested = true;
|
||||
}
|
||||
|
||||
@ -116,9 +127,13 @@ void * WiiMovie::UpdateThread(void *arg)
|
||||
while(!movie->ExitRequested)
|
||||
{
|
||||
movie->ReadNextFrame();
|
||||
if(movie->rendered == true)
|
||||
if(movie->Buffer[movie->BufferPos].thread == false)
|
||||
movie->LoadNextFrame();
|
||||
usleep(100);
|
||||
else if(movie->Frame->thread == false)
|
||||
{
|
||||
movie->Frame = &movie->Buffer[movie->BufferPos];
|
||||
movie->BufferPos ^= 1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -144,14 +159,19 @@ void WiiMovie::LoadNextFrame()
|
||||
|
||||
if(!VideoF.getData())
|
||||
return;
|
||||
if(TexHandle.fromTHP(Frame, VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
|
||||
rendered = false;
|
||||
TexData *CurFrame = &Buffer[BufferPos];
|
||||
if(TexHandle.fromTHP(CurFrame, VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
|
||||
{
|
||||
CurFrame->thread = true;
|
||||
Frame = CurFrame;
|
||||
BufferPos ^= 1;
|
||||
}
|
||||
VideoF.dealloc();
|
||||
}
|
||||
|
||||
bool WiiMovie::Continue()
|
||||
{
|
||||
if(!vFile || !Playing || Frame->data == NULL)
|
||||
if(!vFile || !Playing)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -10,13 +10,16 @@ using namespace std;
|
||||
class WiiMovie
|
||||
{
|
||||
public:
|
||||
WiiMovie() { inited = false; };
|
||||
void Init(const char * filepath);
|
||||
void DeInit();
|
||||
bool Play(TexData *Background, bool loop = false);
|
||||
bool Play(bool loop = false);
|
||||
void Stop();
|
||||
bool Continue();
|
||||
volatile bool loaded;
|
||||
volatile bool rendered;
|
||||
TexData *Frame; //our current texture
|
||||
TexData Buffer[2];
|
||||
u8 BufferPos;
|
||||
protected:
|
||||
static void * UpdateThread(void *arg);
|
||||
void FrameLoadLoop();
|
||||
@ -31,11 +34,21 @@ protected:
|
||||
float fps;
|
||||
Timer PlayTime;
|
||||
u32 VideoFrameCount;
|
||||
TexData *Frame;
|
||||
bool Playing;
|
||||
bool ExitRequested;
|
||||
bool inited;
|
||||
};
|
||||
|
||||
struct movieP
|
||||
{
|
||||
float x1;
|
||||
float y1;
|
||||
float x2;
|
||||
float y2;
|
||||
};
|
||||
extern struct movieP normalMoviePos;
|
||||
extern struct movieP zoomedMoviePos;
|
||||
extern struct movieP currentMoviePos;
|
||||
extern WiiMovie movie;
|
||||
|
||||
#endif
|
||||
|
@ -2651,19 +2651,17 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
|
||||
gamePath = strrchr(menuPath, '/') + 1;
|
||||
}
|
||||
else if(NoGameID(m_items[i].hdr->type))
|
||||
{
|
||||
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
||||
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
||||
if(m_items[i].hdr->type == TYPE_SOURCE)
|
||||
coverDir = "sourceflow";
|
||||
if(strrchr(m_items[i].hdr->path, '/') != NULL)
|
||||
gamePath = strrchr(m_items[i].hdr->path, '/') + 1;
|
||||
else
|
||||
gamePath = m_items[i].hdr->path;
|
||||
}
|
||||
else
|
||||
gamePath = m_items[i].hdr->id;
|
||||
{
|
||||
gamePath = getPathId(m_items[i].hdr);
|
||||
if(NoGameID(m_items[i].hdr->type))
|
||||
{
|
||||
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
||||
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
||||
if(m_items[i].hdr->type == TYPE_SOURCE)
|
||||
coverDir = "sourceflow";
|
||||
}
|
||||
}
|
||||
|
||||
FILE *file = NULL;
|
||||
if(gamePath != NULL)
|
||||
@ -2763,6 +2761,21 @@ void CCoverFlow::_dropHQLOD(int i)
|
||||
m_items[i].texture = newTex;
|
||||
}
|
||||
|
||||
const char *CCoverFlow::getPathId(const dir_discHdr *curHdr)
|
||||
{
|
||||
const char *gamePath = NULL;
|
||||
if(NoGameID(curHdr->type))
|
||||
{
|
||||
if(strrchr(curHdr->path, '/') != NULL)
|
||||
gamePath = strrchr(curHdr->path, '/') + 1;
|
||||
else
|
||||
gamePath = curHdr->path;
|
||||
}
|
||||
else
|
||||
gamePath = curHdr->id;
|
||||
return gamePath;
|
||||
}
|
||||
|
||||
CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
{
|
||||
if (!m_loadingCovers)
|
||||
@ -2781,20 +2794,18 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
|
||||
if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
|
||||
gamePath = strrchr(menuPath, '/') + 1;
|
||||
}
|
||||
else if(NoGameID(m_items[i].hdr->type))
|
||||
{
|
||||
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
||||
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
||||
if(m_items[i].hdr->type == TYPE_SOURCE)
|
||||
coverDir = "sourceflow";
|
||||
if(strrchr(m_items[i].hdr->path, '/') != NULL)
|
||||
gamePath = strrchr(m_items[i].hdr->path, '/') + 1;
|
||||
else
|
||||
gamePath = m_items[i].hdr->path;
|
||||
}
|
||||
else
|
||||
gamePath = m_items[i].hdr->id;
|
||||
|
||||
{
|
||||
gamePath = getPathId(m_items[i].hdr);
|
||||
if(NoGameID(m_items[i].hdr->type))
|
||||
{
|
||||
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
||||
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
||||
if(m_items[i].hdr->type == TYPE_SOURCE)
|
||||
coverDir = "sourceflow";
|
||||
}
|
||||
}
|
||||
|
||||
FILE *fp = NULL;
|
||||
if(gamePath != NULL)
|
||||
{
|
||||
|
@ -134,6 +134,7 @@ public:
|
||||
const dir_discHdr * getSpecificHdr(u32) const;
|
||||
wstringEx getTitle(void) const;
|
||||
u64 getChanTitle(void) const;
|
||||
const char *getPathId(const dir_discHdr *curHdr);
|
||||
//
|
||||
bool getRenderTex(void);
|
||||
void setRenderTex(bool);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "video.hpp"
|
||||
#include "pngu.h"
|
||||
#include "hw/Gekko.h"
|
||||
#include "WiiMovie.hpp"
|
||||
#include "gecko/gecko.hpp"
|
||||
#include "loader/sys.h"
|
||||
#include "loader/utils.h"
|
||||
@ -78,6 +79,10 @@ const float CVideo::_jitter8[8][2] = {
|
||||
{ 0.164216f, -0.054399f }
|
||||
};
|
||||
|
||||
struct movieP normalMoviePos = { 410, 31, 610, 181 };
|
||||
struct movieP zoomedMoviePos = { 0, 0, 640, 480 };
|
||||
struct movieP currentMoviePos = normalMoviePos;
|
||||
|
||||
const int CVideo::_stencilWidth = 128;
|
||||
const int CVideo::_stencilHeight = 128;
|
||||
|
||||
@ -747,6 +752,41 @@ void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
}
|
||||
|
||||
void DrawTexturePos(const TexData *tex)
|
||||
{
|
||||
Mtx modelViewMtx;
|
||||
GXTexObj texObj;
|
||||
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
GX_SetNumTexGens(1);
|
||||
GX_SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC);
|
||||
GX_SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLORNULL);
|
||||
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GX_SetBlendMode(GX_BM_NONE, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
GX_SetAlphaUpdate(GX_FALSE);
|
||||
GX_SetCullMode(GX_CULL_NONE);
|
||||
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
|
||||
guMtxIdentity(modelViewMtx);
|
||||
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
|
||||
GX_InitTexObj(&texObj, tex->data, tex->width, tex->height, tex->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GX_Position2f32(currentMoviePos.x1, currentMoviePos.y1);
|
||||
GX_TexCoord2f32(0.f, 0.f);
|
||||
GX_Position2f32(currentMoviePos.x2, currentMoviePos.y1);
|
||||
GX_TexCoord2f32(1.f, 0.f);
|
||||
GX_Position2f32(currentMoviePos.x2, currentMoviePos.y2);
|
||||
GX_TexCoord2f32(1.f, 1.f);
|
||||
GX_Position2f32(currentMoviePos.x1, currentMoviePos.y2);
|
||||
GX_TexCoord2f32(0.f, 1.f);
|
||||
GX_End();
|
||||
}
|
||||
|
||||
void CVideo::screensaver(u32 no_input, u32 max_no_input)
|
||||
{
|
||||
if(no_input == 0)
|
||||
|
@ -126,6 +126,7 @@ private:
|
||||
};
|
||||
|
||||
void DrawTexture(TexData * &tex);
|
||||
void DrawTexturePos(const TexData *tex);
|
||||
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
||||
|
||||
extern CVideo m_vid;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "gc/gc.hpp"
|
||||
#include "hw/Gekko.h"
|
||||
#include "gui/GameTDB.hpp"
|
||||
#include "gui/WiiMovie.hpp"
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/fs.h"
|
||||
@ -1959,11 +1960,21 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
CoverFlow.drawText(adjusting);
|
||||
}
|
||||
}
|
||||
if(m_fa.isLoaded())
|
||||
m_fa.draw();
|
||||
else if(m_banner.GetSelectedGame() && (!m_banner.GetInGameSettings() || (m_banner.GetInGameSettings() && m_bnr_settings)))
|
||||
m_banner.Draw();
|
||||
|
||||
if(m_gameSelected)
|
||||
{
|
||||
if(m_fa.isLoaded())
|
||||
m_fa.draw();
|
||||
else if(m_video_playing)
|
||||
{
|
||||
if(movie.Frame != NULL)
|
||||
{
|
||||
DrawTexturePos(movie.Frame);
|
||||
movie.Frame->thread = false;
|
||||
}
|
||||
}
|
||||
else if(m_banner.GetSelectedGame() && (!m_banner.GetInGameSettings() || (m_banner.GetInGameSettings() && m_bnr_settings)))
|
||||
m_banner.Draw();
|
||||
}
|
||||
m_btnMgr.draw();
|
||||
ScanInput();
|
||||
if(!m_vid.showingWaitMessage())
|
||||
@ -2033,7 +2044,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
{
|
||||
mem2old = mem2;
|
||||
gprintf("Mem2 Free: %u\n", mem2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1088,6 +1088,9 @@ public:
|
||||
u64 m_thrdTotal;
|
||||
void update_pThread(u64 added);
|
||||
private:
|
||||
void _cleanupBanner(bool gamechange = false);
|
||||
void _cleanupVideo();
|
||||
bool _startVideo();
|
||||
static int _pThread(void *obj);
|
||||
void _start_pThread(void);
|
||||
void _stop_pThread(void);
|
||||
|
@ -283,6 +283,7 @@ static u8 GetRequestedGameIOS(dir_discHdr *hdr)
|
||||
void CMenu::_hideGame(bool instant)
|
||||
{
|
||||
m_gameSelected = false;
|
||||
_cleanupVideo();
|
||||
m_fa.unload();
|
||||
CoverFlow.showCover();
|
||||
m_btnMgr.hide(m_gameBtnPlay, instant);
|
||||
@ -347,40 +348,88 @@ static void setLanguage(int l)
|
||||
configbytes[0] = 0xCD;
|
||||
}
|
||||
|
||||
void CMenu::_cleanupBanner(bool gamechange)
|
||||
{
|
||||
//banner
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
m_banner.DeleteBanner(gamechange);
|
||||
//movie
|
||||
_cleanupVideo();
|
||||
//fanart
|
||||
m_fa.unload();
|
||||
}
|
||||
|
||||
void CMenu::_cleanupVideo()
|
||||
{
|
||||
m_video_playing = false;
|
||||
movie.DeInit();
|
||||
}
|
||||
|
||||
bool CMenu::_startVideo()
|
||||
{
|
||||
char curId3[4];
|
||||
memset(curId3, 0, 4);
|
||||
const char *videoId = CoverFlow.getPathId(CoverFlow.getHdr());
|
||||
if(!NoGameID(CoverFlow.getHdr()->type))
|
||||
{ //id3
|
||||
memcpy(curId3, CoverFlow.getId(), 3);
|
||||
videoId = curId3;
|
||||
}
|
||||
const char *videoPath = fmt("%s/%s.thp", m_videoDir.c_str(), videoId);
|
||||
if(fsop_FileExist(videoPath))
|
||||
{
|
||||
m_gameSound.Stop();
|
||||
MusicPlayer.Stop();
|
||||
m_banner.SetShowBanner(false);
|
||||
/* Lets play the movie */
|
||||
movie.Init(videoPath);
|
||||
m_gameSound.Load(fmt("%s/%s.ogg", m_videoDir.c_str(), videoId));
|
||||
m_gameSound.SetVolume(m_cfg.getInt("GENERAL", "sound_volume_bnr", 255));
|
||||
m_video_playing = true;
|
||||
m_gameSound.Play();
|
||||
movie.Play(true); //video loops sound doesnt
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMenu::_game(bool launch)
|
||||
{
|
||||
m_gcfg1.load(fmt("%s/" GAME_SETTINGS1_FILENAME, m_settingsDir.c_str()));
|
||||
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false) && !NoGameID(CoverFlow.getHdr()->type);
|
||||
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false);
|
||||
if(NoGameID(CoverFlow.getHdr()->type))
|
||||
{
|
||||
m_zoom_banner = m_zoom_banner && fsop_FileExist(fmt("%s/%s.thp", m_videoDir.c_str(), CoverFlow.getPathId(CoverFlow.getHdr())));
|
||||
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
||||
}
|
||||
currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos);
|
||||
if(m_banner.GetZoomSetting() != m_zoom_banner)
|
||||
m_banner.ToogleZoom();
|
||||
|
||||
if(!launch)
|
||||
{
|
||||
SetupInput();
|
||||
_playGameSound();
|
||||
_showGame();
|
||||
m_gameSelected = true;
|
||||
_playGameSound();
|
||||
}
|
||||
|
||||
if(m_banner.GetZoomSetting() != m_zoom_banner)
|
||||
m_banner.ToogleZoom();
|
||||
|
||||
s8 startGameSound = 1;
|
||||
while(!m_exit)
|
||||
{
|
||||
if(startGameSound < 1)
|
||||
startGameSound++;
|
||||
|
||||
u64 chantitle = CoverFlow.getChanTitle();
|
||||
|
||||
if(startGameSound == -5)
|
||||
{
|
||||
_playGameSound();
|
||||
_showGame();
|
||||
}
|
||||
_mainLoopCommon(true);
|
||||
|
||||
if(startGameSound == 0)
|
||||
{
|
||||
m_gameSelected = true;
|
||||
startGameSound = 1;
|
||||
_playGameSound();
|
||||
}
|
||||
if(BTN_B_PRESSED && !m_locked && (m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)))
|
||||
{
|
||||
@ -395,9 +444,7 @@ void CMenu::_game(bool launch)
|
||||
}
|
||||
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
|
||||
{
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
m_banner.DeleteBanner();
|
||||
_cleanupBanner();
|
||||
break;
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (CoverFlow.getHdr()->type == TYPE_WII_GAME || CoverFlow.getHdr()->type == TYPE_GC_GAME || CoverFlow.getHdr()->type == TYPE_CHANNEL))
|
||||
@ -413,53 +460,17 @@ void CMenu::_game(bool launch)
|
||||
}
|
||||
else if(BTN_MINUS_PRESSED)
|
||||
{
|
||||
const char *videoPath = fmt("%s/%.3s.thp", m_videoDir.c_str(), CoverFlow.getId());
|
||||
if(fsop_FileExist(videoPath))
|
||||
if(m_video_playing)
|
||||
{
|
||||
GuiSound OggFile;
|
||||
m_gameSound.Stop();
|
||||
MusicPlayer.Stop();
|
||||
m_banner.SetShowBanner(false);
|
||||
_hideGame();
|
||||
/* Set Background empty */
|
||||
TexData EmptyBG;
|
||||
_setBg(EmptyBG, EmptyBG);
|
||||
/* Lets play the movie */
|
||||
movie.Init(videoPath);
|
||||
OggFile.Load(fmt("%s/%.3s.ogg", m_videoDir.c_str(), CoverFlow.getId()));
|
||||
OggFile.SetVolume(m_cfg.getInt("GENERAL", "sound_volume_bnr", 255));
|
||||
m_video_playing = true;
|
||||
m_banner.ReSetup_GX();
|
||||
m_vid.setup2DProjection();
|
||||
OggFile.Play();
|
||||
movie.Play(&m_curBg);
|
||||
while(!BTN_B_PRESSED && !BTN_A_PRESSED && !BTN_HOME_PRESSED && movie.Continue() == true)
|
||||
{
|
||||
/* Draw movie BG and render */
|
||||
if(movie.rendered == false)
|
||||
{
|
||||
_drawBg();
|
||||
m_vid.render();
|
||||
movie.rendered = true;
|
||||
}
|
||||
/* Check if we want to stop */
|
||||
WPAD_ScanPads();
|
||||
PAD_ScanPads();
|
||||
ButtonsPressed();
|
||||
}
|
||||
movie.DeInit();
|
||||
OggFile.FreeMemory();
|
||||
TexHandle.Cleanup(m_curBg);
|
||||
/* Finished, so lets re-setup the background */
|
||||
_setBg(m_gameBg, m_gameBgLQ);
|
||||
_updateBg();
|
||||
/* Get back into our coverflow */
|
||||
_showGame();
|
||||
m_video_playing = false;
|
||||
movie.DeInit();
|
||||
m_gameSound.FreeMemory();
|
||||
m_banner.SetShowBanner(true);
|
||||
if(!m_gameSound.IsPlaying())
|
||||
if(!m_gameSound.IsPlaying())
|
||||
startGameSound = -6;
|
||||
}
|
||||
else
|
||||
_startVideo();
|
||||
}
|
||||
else if((BTN_1_PRESSED) || (BTN_2_PRESSED))
|
||||
{
|
||||
@ -482,9 +493,7 @@ void CMenu::_game(bool launch)
|
||||
m_banner.SetShowBanner(false);
|
||||
if(_wbfsOp(WO_REMOVE_GAME))
|
||||
{
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
m_banner.DeleteBanner();
|
||||
_cleanupBanner();
|
||||
break;
|
||||
}
|
||||
m_banner.SetShowBanner(true);
|
||||
@ -499,15 +508,15 @@ void CMenu::_game(bool launch)
|
||||
m_gcfg1.setBool("ADULTONLY", _getId(), !m_gcfg1.getBool("ADULTONLY", _getId(), false));
|
||||
else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull))
|
||||
{
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
m_banner.DeleteBanner();
|
||||
_cleanupBanner();
|
||||
break;
|
||||
}
|
||||
else if((m_btnMgr.selected(m_gameBtnToogle) || m_btnMgr.selected(m_gameBtnToogleFull)) && !NoGameID(CoverFlow.getHdr()->type))
|
||||
else if((m_btnMgr.selected(m_gameBtnToogle) || m_btnMgr.selected(m_gameBtnToogleFull))
|
||||
&& (!NoGameID(CoverFlow.getHdr()->type) || m_video_playing))
|
||||
{
|
||||
m_zoom_banner = m_banner.ToogleZoom();
|
||||
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
||||
currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos);
|
||||
m_show_zone_game = false;
|
||||
m_btnMgr.hide(m_gameBtnPlayFull);
|
||||
m_btnMgr.hide(m_gameBtnBackFull);
|
||||
@ -530,9 +539,7 @@ void CMenu::_game(bool launch)
|
||||
{
|
||||
_hideGame();
|
||||
MusicPlayer.Stop();
|
||||
m_gameSound.FreeMemory();
|
||||
CheckGameSoundThread();
|
||||
m_banner.DeleteBanner();
|
||||
_cleanupBanner();
|
||||
dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr));
|
||||
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));
|
||||
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
||||
@ -569,7 +576,10 @@ void CMenu::_game(bool launch)
|
||||
/* Get Banner Title for Playlog */
|
||||
CurrentBanner.ClearBanner();
|
||||
if(hdr->type == TYPE_CHANNEL)
|
||||
{
|
||||
u64 chantitle = CoverFlow.getChanTitle();
|
||||
_extractChannelBnr(chantitle);
|
||||
}
|
||||
else if(hdr->type == TYPE_WII_GAME)
|
||||
_extractBnr(hdr);
|
||||
if(CurrentBanner.IsValid())
|
||||
@ -607,38 +617,31 @@ void CMenu::_game(bool launch)
|
||||
}
|
||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_UP_REPEAT || RIGHT_STICK_UP))
|
||||
{
|
||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
||||
CheckGameSoundThread();
|
||||
_cleanupBanner(true);
|
||||
CoverFlow.up();
|
||||
startGameSound = -10;
|
||||
}
|
||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT))
|
||||
{
|
||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
||||
CheckGameSoundThread();
|
||||
_cleanupBanner(true);
|
||||
CoverFlow.right();
|
||||
startGameSound = -10;
|
||||
}
|
||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_DOWN_REPEAT || RIGHT_STICK_DOWN))
|
||||
{
|
||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
||||
CheckGameSoundThread();
|
||||
_cleanupBanner(true);
|
||||
CoverFlow.down();
|
||||
startGameSound = -10;
|
||||
}
|
||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_LEFT_REPEAT || RIGHT_STICK_LEFT))
|
||||
{
|
||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
||||
CheckGameSoundThread();
|
||||
_cleanupBanner(true);
|
||||
CoverFlow.left();
|
||||
startGameSound = -10;
|
||||
}
|
||||
if(startGameSound == -10)
|
||||
{
|
||||
m_gameSound.Stop();
|
||||
m_gameSelected = false;
|
||||
m_fa.unload();
|
||||
m_banner.DeleteBanner(true);
|
||||
_setBg(m_gameBg, m_gameBgLQ);
|
||||
}
|
||||
if(m_show_zone_game && !m_zoom_banner)
|
||||
@ -1746,6 +1749,17 @@ u8 *GameSoundStack = NULL;
|
||||
u32 GameSoundSize = 0x10000; //64kb
|
||||
void CMenu::_playGameSound(void)
|
||||
{
|
||||
if(NoGameID(CoverFlow.getHdr()->type))
|
||||
{
|
||||
if(_startVideo())
|
||||
return;
|
||||
if(m_zoom_banner == true)
|
||||
{
|
||||
m_zoom_banner = m_banner.ToogleZoom();
|
||||
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
||||
currentMoviePos = normalMoviePos;
|
||||
}
|
||||
}
|
||||
m_gamesound_changed = false;
|
||||
if(m_bnrSndVol == 0)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user