mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 21:54:15 +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
|
* Copyright (C) 2010 by Dimok
|
||||||
* by Dimok
|
* (C) 2014 by FIX94
|
||||||
*
|
*
|
||||||
* This software is provided 'as-is', without any express or implied
|
* This software is provided 'as-is', without any express or implied
|
||||||
* warranty. In no event will the authors be held liable for any
|
* warranty. In no event will the authors be held liable for any
|
||||||
@ -31,36 +31,42 @@
|
|||||||
#include "gecko/gecko.hpp"
|
#include "gecko/gecko.hpp"
|
||||||
|
|
||||||
WiiMovie movie;
|
WiiMovie movie;
|
||||||
|
|
||||||
void WiiMovie::Init(const char *filepath)
|
void WiiMovie::Init(const char *filepath)
|
||||||
{
|
{
|
||||||
|
Frame = NULL;
|
||||||
|
BufferPos = 0;
|
||||||
|
Buffer[0].thread = false;
|
||||||
|
Buffer[1].thread = false;
|
||||||
VideoFrameCount = 0;
|
VideoFrameCount = 0;
|
||||||
fps = 0.0f;
|
fps = 0.0f;
|
||||||
ExitRequested = false;
|
ExitRequested = false;
|
||||||
Playing = false;
|
Playing = false;
|
||||||
ThreadStack = NULL;
|
ThreadStack = NULL;
|
||||||
rendered = false;
|
//gprintf("Opening video '%s'\n", filepath);
|
||||||
gprintf("Opening video '%s'\n", filepath);
|
|
||||||
ReadThread = LWP_THREAD_NULL;
|
ReadThread = LWP_THREAD_NULL;
|
||||||
vFile = fopen(filepath, "rb");
|
vFile = fopen(filepath, "rb");
|
||||||
if(!vFile)
|
if(!vFile)
|
||||||
{
|
{
|
||||||
gprintf("Open video failed\n");
|
//gprintf("Open video failed\n");
|
||||||
ExitRequested = true;
|
ExitRequested = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Video.Init(vFile) == false)
|
if(Video.Init(vFile) == false)
|
||||||
{
|
{
|
||||||
gprintf("Memory Allocation failed\n");
|
//gprintf("Memory Allocation failed\n");
|
||||||
ExitRequested = true;
|
ExitRequested = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fps = Video.getFps();
|
fps = Video.getFps();
|
||||||
|
inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiiMovie::DeInit()
|
void WiiMovie::DeInit()
|
||||||
{
|
{
|
||||||
gprintf("Destructing WiiMovie object\n");
|
if(inited == false)
|
||||||
|
return;
|
||||||
|
inited = false;
|
||||||
|
//gprintf("Destructing WiiMovie object\n");
|
||||||
Playing = false;
|
Playing = false;
|
||||||
ExitRequested = true;
|
ExitRequested = true;
|
||||||
|
|
||||||
@ -81,9 +87,15 @@ void WiiMovie::DeInit()
|
|||||||
if(vFile != NULL)
|
if(vFile != NULL)
|
||||||
fclose(vFile);
|
fclose(vFile);
|
||||||
vFile = NULL;
|
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)
|
if(!vFile)
|
||||||
return false;
|
return false;
|
||||||
@ -92,21 +104,20 @@ bool WiiMovie::Play(TexData *Background, bool loop)
|
|||||||
if(!ThreadStack)
|
if(!ThreadStack)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gprintf("Start playing video\n");
|
//gprintf("Start playing video\n");
|
||||||
Video.loop = loop;
|
Video.loop = loop;
|
||||||
Frame = Background;
|
|
||||||
rendered = true;
|
|
||||||
PlayTime.reset();
|
PlayTime.reset();
|
||||||
Playing = true;
|
Playing = true;
|
||||||
|
Buffer[0].thread = false;
|
||||||
LWP_CreateThread(&ReadThread, UpdateThread, this, ThreadStack, 32768, LWP_PRIO_HIGHEST);
|
Buffer[1].thread = false;
|
||||||
gprintf("Reading frames thread started\n");
|
LWP_CreateThread(&ReadThread, UpdateThread, this, ThreadStack, 32768, 60);
|
||||||
|
//gprintf("Reading frames thread started\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiiMovie::Stop()
|
void WiiMovie::Stop()
|
||||||
{
|
{
|
||||||
gprintf("Stopping WiiMovie video\n");
|
//gprintf("Stopping WiiMovie video\n");
|
||||||
ExitRequested = true;
|
ExitRequested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,9 +127,13 @@ void * WiiMovie::UpdateThread(void *arg)
|
|||||||
while(!movie->ExitRequested)
|
while(!movie->ExitRequested)
|
||||||
{
|
{
|
||||||
movie->ReadNextFrame();
|
movie->ReadNextFrame();
|
||||||
if(movie->rendered == true)
|
if(movie->Buffer[movie->BufferPos].thread == false)
|
||||||
movie->LoadNextFrame();
|
movie->LoadNextFrame();
|
||||||
usleep(100);
|
else if(movie->Frame->thread == false)
|
||||||
|
{
|
||||||
|
movie->Frame = &movie->Buffer[movie->BufferPos];
|
||||||
|
movie->BufferPos ^= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -144,14 +159,19 @@ void WiiMovie::LoadNextFrame()
|
|||||||
|
|
||||||
if(!VideoF.getData())
|
if(!VideoF.getData())
|
||||||
return;
|
return;
|
||||||
if(TexHandle.fromTHP(Frame, VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
|
TexData *CurFrame = &Buffer[BufferPos];
|
||||||
rendered = false;
|
if(TexHandle.fromTHP(CurFrame, VideoF.getData(), VideoF.getWidth(), VideoF.getHeight()) == TE_OK)
|
||||||
|
{
|
||||||
|
CurFrame->thread = true;
|
||||||
|
Frame = CurFrame;
|
||||||
|
BufferPos ^= 1;
|
||||||
|
}
|
||||||
VideoF.dealloc();
|
VideoF.dealloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WiiMovie::Continue()
|
bool WiiMovie::Continue()
|
||||||
{
|
{
|
||||||
if(!vFile || !Playing || Frame->data == NULL)
|
if(!vFile || !Playing)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,16 @@ using namespace std;
|
|||||||
class WiiMovie
|
class WiiMovie
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
WiiMovie() { inited = false; };
|
||||||
void Init(const char * filepath);
|
void Init(const char * filepath);
|
||||||
void DeInit();
|
void DeInit();
|
||||||
bool Play(TexData *Background, bool loop = false);
|
bool Play(bool loop = false);
|
||||||
void Stop();
|
void Stop();
|
||||||
bool Continue();
|
bool Continue();
|
||||||
volatile bool loaded;
|
volatile bool loaded;
|
||||||
volatile bool rendered;
|
TexData *Frame; //our current texture
|
||||||
|
TexData Buffer[2];
|
||||||
|
u8 BufferPos;
|
||||||
protected:
|
protected:
|
||||||
static void * UpdateThread(void *arg);
|
static void * UpdateThread(void *arg);
|
||||||
void FrameLoadLoop();
|
void FrameLoadLoop();
|
||||||
@ -31,11 +34,21 @@ protected:
|
|||||||
float fps;
|
float fps;
|
||||||
Timer PlayTime;
|
Timer PlayTime;
|
||||||
u32 VideoFrameCount;
|
u32 VideoFrameCount;
|
||||||
TexData *Frame;
|
|
||||||
bool Playing;
|
bool Playing;
|
||||||
bool ExitRequested;
|
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;
|
extern WiiMovie movie;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2651,19 +2651,17 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
|||||||
if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
|
if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
|
||||||
gamePath = strrchr(menuPath, '/') + 1;
|
gamePath = strrchr(menuPath, '/') + 1;
|
||||||
}
|
}
|
||||||
else if(NoGameID(m_items[i].hdr->type))
|
else
|
||||||
|
{
|
||||||
|
gamePath = getPathId(m_items[i].hdr);
|
||||||
|
if(NoGameID(m_items[i].hdr->type))
|
||||||
{
|
{
|
||||||
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
||||||
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
||||||
if(m_items[i].hdr->type == TYPE_SOURCE)
|
if(m_items[i].hdr->type == TYPE_SOURCE)
|
||||||
coverDir = "sourceflow";
|
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;
|
|
||||||
|
|
||||||
FILE *file = NULL;
|
FILE *file = NULL;
|
||||||
if(gamePath != NULL)
|
if(gamePath != NULL)
|
||||||
@ -2763,6 +2761,21 @@ void CCoverFlow::_dropHQLOD(int i)
|
|||||||
m_items[i].texture = newTex;
|
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)
|
CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||||
{
|
{
|
||||||
if (!m_loadingCovers)
|
if (!m_loadingCovers)
|
||||||
@ -2781,19 +2794,17 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
|
|||||||
if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
|
if(menuPath != NULL && strrchr(menuPath, '/') != NULL)
|
||||||
gamePath = strrchr(menuPath, '/') + 1;
|
gamePath = strrchr(menuPath, '/') + 1;
|
||||||
}
|
}
|
||||||
else if(NoGameID(m_items[i].hdr->type))
|
else
|
||||||
|
{
|
||||||
|
gamePath = getPathId(m_items[i].hdr);
|
||||||
|
if(NoGameID(m_items[i].hdr->type))
|
||||||
{
|
{
|
||||||
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN)
|
||||||
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]);
|
||||||
if(m_items[i].hdr->type == TYPE_SOURCE)
|
if(m_items[i].hdr->type == TYPE_SOURCE)
|
||||||
coverDir = "sourceflow";
|
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;
|
|
||||||
|
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
if(gamePath != NULL)
|
if(gamePath != NULL)
|
||||||
|
@ -134,6 +134,7 @@ public:
|
|||||||
const dir_discHdr * getSpecificHdr(u32) const;
|
const dir_discHdr * getSpecificHdr(u32) const;
|
||||||
wstringEx getTitle(void) const;
|
wstringEx getTitle(void) const;
|
||||||
u64 getChanTitle(void) const;
|
u64 getChanTitle(void) const;
|
||||||
|
const char *getPathId(const dir_discHdr *curHdr);
|
||||||
//
|
//
|
||||||
bool getRenderTex(void);
|
bool getRenderTex(void);
|
||||||
void setRenderTex(bool);
|
void setRenderTex(bool);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "video.hpp"
|
#include "video.hpp"
|
||||||
#include "pngu.h"
|
#include "pngu.h"
|
||||||
#include "hw/Gekko.h"
|
#include "hw/Gekko.h"
|
||||||
|
#include "WiiMovie.hpp"
|
||||||
#include "gecko/gecko.hpp"
|
#include "gecko/gecko.hpp"
|
||||||
#include "loader/sys.h"
|
#include "loader/sys.h"
|
||||||
#include "loader/utils.h"
|
#include "loader/utils.h"
|
||||||
@ -78,6 +79,10 @@ const float CVideo::_jitter8[8][2] = {
|
|||||||
{ 0.164216f, -0.054399f }
|
{ 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::_stencilWidth = 128;
|
||||||
const int CVideo::_stencilHeight = 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);
|
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)
|
void CVideo::screensaver(u32 no_input, u32 max_no_input)
|
||||||
{
|
{
|
||||||
if(no_input == 0)
|
if(no_input == 0)
|
||||||
|
@ -126,6 +126,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void DrawTexture(TexData * &tex);
|
void DrawTexture(TexData * &tex);
|
||||||
|
void DrawTexturePos(const TexData *tex);
|
||||||
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
||||||
|
|
||||||
extern CVideo m_vid;
|
extern CVideo m_vid;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "gc/gc.hpp"
|
#include "gc/gc.hpp"
|
||||||
#include "hw/Gekko.h"
|
#include "hw/Gekko.h"
|
||||||
#include "gui/GameTDB.hpp"
|
#include "gui/GameTDB.hpp"
|
||||||
|
#include "gui/WiiMovie.hpp"
|
||||||
#include "loader/alt_ios.h"
|
#include "loader/alt_ios.h"
|
||||||
#include "loader/cios.h"
|
#include "loader/cios.h"
|
||||||
#include "loader/fs.h"
|
#include "loader/fs.h"
|
||||||
@ -1959,11 +1960,21 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
|||||||
CoverFlow.drawText(adjusting);
|
CoverFlow.drawText(adjusting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(m_gameSelected)
|
||||||
|
{
|
||||||
if(m_fa.isLoaded())
|
if(m_fa.isLoaded())
|
||||||
m_fa.draw();
|
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)))
|
else if(m_banner.GetSelectedGame() && (!m_banner.GetInGameSettings() || (m_banner.GetInGameSettings() && m_bnr_settings)))
|
||||||
m_banner.Draw();
|
m_banner.Draw();
|
||||||
|
}
|
||||||
m_btnMgr.draw();
|
m_btnMgr.draw();
|
||||||
ScanInput();
|
ScanInput();
|
||||||
if(!m_vid.showingWaitMessage())
|
if(!m_vid.showingWaitMessage())
|
||||||
|
@ -1088,6 +1088,9 @@ public:
|
|||||||
u64 m_thrdTotal;
|
u64 m_thrdTotal;
|
||||||
void update_pThread(u64 added);
|
void update_pThread(u64 added);
|
||||||
private:
|
private:
|
||||||
|
void _cleanupBanner(bool gamechange = false);
|
||||||
|
void _cleanupVideo();
|
||||||
|
bool _startVideo();
|
||||||
static int _pThread(void *obj);
|
static int _pThread(void *obj);
|
||||||
void _start_pThread(void);
|
void _start_pThread(void);
|
||||||
void _stop_pThread(void);
|
void _stop_pThread(void);
|
||||||
|
@ -283,6 +283,7 @@ static u8 GetRequestedGameIOS(dir_discHdr *hdr)
|
|||||||
void CMenu::_hideGame(bool instant)
|
void CMenu::_hideGame(bool instant)
|
||||||
{
|
{
|
||||||
m_gameSelected = false;
|
m_gameSelected = false;
|
||||||
|
_cleanupVideo();
|
||||||
m_fa.unload();
|
m_fa.unload();
|
||||||
CoverFlow.showCover();
|
CoverFlow.showCover();
|
||||||
m_btnMgr.hide(m_gameBtnPlay, instant);
|
m_btnMgr.hide(m_gameBtnPlay, instant);
|
||||||
@ -347,40 +348,88 @@ static void setLanguage(int l)
|
|||||||
configbytes[0] = 0xCD;
|
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)
|
void CMenu::_game(bool launch)
|
||||||
{
|
{
|
||||||
m_gcfg1.load(fmt("%s/" GAME_SETTINGS1_FILENAME, m_settingsDir.c_str()));
|
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)
|
if(!launch)
|
||||||
{
|
{
|
||||||
SetupInput();
|
SetupInput();
|
||||||
_playGameSound();
|
|
||||||
_showGame();
|
_showGame();
|
||||||
m_gameSelected = true;
|
m_gameSelected = true;
|
||||||
|
_playGameSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_banner.GetZoomSetting() != m_zoom_banner)
|
|
||||||
m_banner.ToogleZoom();
|
|
||||||
|
|
||||||
s8 startGameSound = 1;
|
s8 startGameSound = 1;
|
||||||
while(!m_exit)
|
while(!m_exit)
|
||||||
{
|
{
|
||||||
if(startGameSound < 1)
|
if(startGameSound < 1)
|
||||||
startGameSound++;
|
startGameSound++;
|
||||||
|
|
||||||
u64 chantitle = CoverFlow.getChanTitle();
|
|
||||||
|
|
||||||
if(startGameSound == -5)
|
if(startGameSound == -5)
|
||||||
{
|
|
||||||
_playGameSound();
|
|
||||||
_showGame();
|
_showGame();
|
||||||
}
|
|
||||||
_mainLoopCommon(true);
|
_mainLoopCommon(true);
|
||||||
|
|
||||||
if(startGameSound == 0)
|
if(startGameSound == 0)
|
||||||
{
|
{
|
||||||
m_gameSelected = true;
|
m_gameSelected = true;
|
||||||
startGameSound = 1;
|
startGameSound = 1;
|
||||||
|
_playGameSound();
|
||||||
}
|
}
|
||||||
if(BTN_B_PRESSED && !m_locked && (m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)))
|
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)
|
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
|
||||||
{
|
{
|
||||||
m_gameSound.FreeMemory();
|
_cleanupBanner();
|
||||||
CheckGameSoundThread();
|
|
||||||
m_banner.DeleteBanner();
|
|
||||||
break;
|
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))
|
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)
|
else if(BTN_MINUS_PRESSED)
|
||||||
{
|
{
|
||||||
const char *videoPath = fmt("%s/%.3s.thp", m_videoDir.c_str(), CoverFlow.getId());
|
if(m_video_playing)
|
||||||
if(fsop_FileExist(videoPath))
|
|
||||||
{
|
{
|
||||||
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;
|
m_video_playing = false;
|
||||||
|
movie.DeInit();
|
||||||
|
m_gameSound.FreeMemory();
|
||||||
m_banner.SetShowBanner(true);
|
m_banner.SetShowBanner(true);
|
||||||
if(!m_gameSound.IsPlaying())
|
if(!m_gameSound.IsPlaying())
|
||||||
startGameSound = -6;
|
startGameSound = -6;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
_startVideo();
|
||||||
}
|
}
|
||||||
else if((BTN_1_PRESSED) || (BTN_2_PRESSED))
|
else if((BTN_1_PRESSED) || (BTN_2_PRESSED))
|
||||||
{
|
{
|
||||||
@ -482,9 +493,7 @@ void CMenu::_game(bool launch)
|
|||||||
m_banner.SetShowBanner(false);
|
m_banner.SetShowBanner(false);
|
||||||
if(_wbfsOp(WO_REMOVE_GAME))
|
if(_wbfsOp(WO_REMOVE_GAME))
|
||||||
{
|
{
|
||||||
m_gameSound.FreeMemory();
|
_cleanupBanner();
|
||||||
CheckGameSoundThread();
|
|
||||||
m_banner.DeleteBanner();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_banner.SetShowBanner(true);
|
m_banner.SetShowBanner(true);
|
||||||
@ -499,15 +508,15 @@ void CMenu::_game(bool launch)
|
|||||||
m_gcfg1.setBool("ADULTONLY", _getId(), !m_gcfg1.getBool("ADULTONLY", _getId(), false));
|
m_gcfg1.setBool("ADULTONLY", _getId(), !m_gcfg1.getBool("ADULTONLY", _getId(), false));
|
||||||
else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull))
|
else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull))
|
||||||
{
|
{
|
||||||
m_gameSound.FreeMemory();
|
_cleanupBanner();
|
||||||
CheckGameSoundThread();
|
|
||||||
m_banner.DeleteBanner();
|
|
||||||
break;
|
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_zoom_banner = m_banner.ToogleZoom();
|
||||||
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
|
||||||
|
currentMoviePos = (m_zoom_banner ? zoomedMoviePos : normalMoviePos);
|
||||||
m_show_zone_game = false;
|
m_show_zone_game = false;
|
||||||
m_btnMgr.hide(m_gameBtnPlayFull);
|
m_btnMgr.hide(m_gameBtnPlayFull);
|
||||||
m_btnMgr.hide(m_gameBtnBackFull);
|
m_btnMgr.hide(m_gameBtnBackFull);
|
||||||
@ -530,9 +539,7 @@ void CMenu::_game(bool launch)
|
|||||||
{
|
{
|
||||||
_hideGame();
|
_hideGame();
|
||||||
MusicPlayer.Stop();
|
MusicPlayer.Stop();
|
||||||
m_gameSound.FreeMemory();
|
_cleanupBanner();
|
||||||
CheckGameSoundThread();
|
|
||||||
m_banner.DeleteBanner();
|
|
||||||
dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr));
|
dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr));
|
||||||
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));
|
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));
|
||||||
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
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 */
|
/* Get Banner Title for Playlog */
|
||||||
CurrentBanner.ClearBanner();
|
CurrentBanner.ClearBanner();
|
||||||
if(hdr->type == TYPE_CHANNEL)
|
if(hdr->type == TYPE_CHANNEL)
|
||||||
|
{
|
||||||
|
u64 chantitle = CoverFlow.getChanTitle();
|
||||||
_extractChannelBnr(chantitle);
|
_extractChannelBnr(chantitle);
|
||||||
|
}
|
||||||
else if(hdr->type == TYPE_WII_GAME)
|
else if(hdr->type == TYPE_WII_GAME)
|
||||||
_extractBnr(hdr);
|
_extractBnr(hdr);
|
||||||
if(CurrentBanner.IsValid())
|
if(CurrentBanner.IsValid())
|
||||||
@ -607,38 +617,31 @@ void CMenu::_game(bool launch)
|
|||||||
}
|
}
|
||||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_UP_REPEAT || RIGHT_STICK_UP))
|
if((startGameSound == 1 || startGameSound < -8) && (BTN_UP_REPEAT || RIGHT_STICK_UP))
|
||||||
{
|
{
|
||||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
_cleanupBanner(true);
|
||||||
CheckGameSoundThread();
|
|
||||||
CoverFlow.up();
|
CoverFlow.up();
|
||||||
startGameSound = -10;
|
startGameSound = -10;
|
||||||
}
|
}
|
||||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT))
|
if((startGameSound == 1 || startGameSound < -8) && (BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT))
|
||||||
{
|
{
|
||||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
_cleanupBanner(true);
|
||||||
CheckGameSoundThread();
|
|
||||||
CoverFlow.right();
|
CoverFlow.right();
|
||||||
startGameSound = -10;
|
startGameSound = -10;
|
||||||
}
|
}
|
||||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_DOWN_REPEAT || RIGHT_STICK_DOWN))
|
if((startGameSound == 1 || startGameSound < -8) && (BTN_DOWN_REPEAT || RIGHT_STICK_DOWN))
|
||||||
{
|
{
|
||||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
_cleanupBanner(true);
|
||||||
CheckGameSoundThread();
|
|
||||||
CoverFlow.down();
|
CoverFlow.down();
|
||||||
startGameSound = -10;
|
startGameSound = -10;
|
||||||
}
|
}
|
||||||
if((startGameSound == 1 || startGameSound < -8) && (BTN_LEFT_REPEAT || RIGHT_STICK_LEFT))
|
if((startGameSound == 1 || startGameSound < -8) && (BTN_LEFT_REPEAT || RIGHT_STICK_LEFT))
|
||||||
{
|
{
|
||||||
if(m_gameSoundThread != LWP_THREAD_NULL)
|
_cleanupBanner(true);
|
||||||
CheckGameSoundThread();
|
|
||||||
CoverFlow.left();
|
CoverFlow.left();
|
||||||
startGameSound = -10;
|
startGameSound = -10;
|
||||||
}
|
}
|
||||||
if(startGameSound == -10)
|
if(startGameSound == -10)
|
||||||
{
|
{
|
||||||
m_gameSound.Stop();
|
|
||||||
m_gameSelected = false;
|
m_gameSelected = false;
|
||||||
m_fa.unload();
|
|
||||||
m_banner.DeleteBanner(true);
|
|
||||||
_setBg(m_gameBg, m_gameBgLQ);
|
_setBg(m_gameBg, m_gameBgLQ);
|
||||||
}
|
}
|
||||||
if(m_show_zone_game && !m_zoom_banner)
|
if(m_show_zone_game && !m_zoom_banner)
|
||||||
@ -1746,6 +1749,17 @@ u8 *GameSoundStack = NULL;
|
|||||||
u32 GameSoundSize = 0x10000; //64kb
|
u32 GameSoundSize = 0x10000; //64kb
|
||||||
void CMenu::_playGameSound(void)
|
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;
|
m_gamesound_changed = false;
|
||||||
if(m_bnrSndVol == 0)
|
if(m_bnrSndVol == 0)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user