mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-01-11 11:29:09 +01:00
-fixed a small bug if a plugin music file is over that the game
banner sounds stopped working -added plugin subfolder cache file creation to prevent overwriting on same filenames based on the coverFolder option in plugin inis, "subfolder_cache" in "EMULATOR" domain, enabled by default (thx matt0620 for base patches)
This commit is contained in:
parent
dad4a16cc1
commit
761ca4bddb
@ -16,7 +16,9 @@
|
||||
#include "types.h"
|
||||
#include "gecko/gecko.hpp"
|
||||
#include "menu/menu.hpp"
|
||||
#include "plugin/plugin.hpp"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "wstringEx/wstringEx.hpp"
|
||||
|
||||
extern const u8 dvdskin_jpg[];
|
||||
@ -219,6 +221,7 @@ CCoverFlow::CCoverFlow(void)
|
||||
m_compressTextures = true;
|
||||
m_compressCache = false;
|
||||
m_deletePicsAfterCaching = false;
|
||||
m_pluginCacheFolders = false;
|
||||
m_box = true;
|
||||
m_useHQcover = false;
|
||||
m_rows = 1;
|
||||
@ -280,11 +283,12 @@ CCoverFlow::~CCoverFlow(void)
|
||||
LWP_MutexDestroy(m_mutex);
|
||||
}
|
||||
|
||||
void CCoverFlow::setCachePath(const char *path, bool deleteSource, bool compress)
|
||||
void CCoverFlow::setCachePath(const char *path, bool deleteSource, bool compress, bool pluginCacheFolders)
|
||||
{
|
||||
m_cachePath = path;
|
||||
m_deletePicsAfterCaching = deleteSource;
|
||||
m_compressCache = compress;
|
||||
m_pluginCacheFolders = pluginCacheFolders;
|
||||
}
|
||||
|
||||
void CCoverFlow::setTextureQuality(float lodBias, int aniso, bool edgeLOD)
|
||||
@ -2642,6 +2646,7 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
if(!!zBuffer && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
|
||||
{
|
||||
const char *gamePath = NULL;
|
||||
const char *coverDir = NULL;
|
||||
if(blankBoxCover)
|
||||
{
|
||||
const char *menuPath = mainMenu.getBlankCoverPath(m_items[i].hdr);
|
||||
@ -2650,6 +2655,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
}
|
||||
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(strrchr(m_items[i].hdr->path, '/') != NULL)
|
||||
gamePath = strrchr(m_items[i].hdr->path, '/') + 1;
|
||||
else
|
||||
@ -2660,7 +2667,15 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
|
||||
|
||||
FILE *file = NULL;
|
||||
if(gamePath != NULL)
|
||||
file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb");
|
||||
{
|
||||
if(coverDir == NULL || strlen(coverDir) == 0)
|
||||
file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb");
|
||||
else
|
||||
{
|
||||
fsop_MakeFolder(fmt("%s/%s", m_cachePath.c_str(), coverDir));
|
||||
file = fopen(fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), "wb");
|
||||
}
|
||||
}
|
||||
if(file != NULL)
|
||||
{
|
||||
SWFCHeader header(tex, box, m_compressCache);
|
||||
@ -2731,6 +2746,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
|
||||
if(!m_cachePath.empty())
|
||||
{
|
||||
const char *gamePath = NULL;
|
||||
const char *coverDir = NULL;
|
||||
if(blankBoxCover)
|
||||
{
|
||||
const char *menuPath = mainMenu.getBlankCoverPath(m_items[i].hdr);
|
||||
@ -2739,6 +2755,8 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
|
||||
}
|
||||
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(strrchr(m_items[i].hdr->path, '/') != NULL)
|
||||
gamePath = strrchr(m_items[i].hdr->path, '/') + 1;
|
||||
else
|
||||
@ -2750,8 +2768,10 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
|
||||
FILE *fp = NULL;
|
||||
if(gamePath != NULL)
|
||||
{
|
||||
const char *path = fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath);
|
||||
fp = fopen(path, "rb");
|
||||
if(coverDir == NULL || strlen(coverDir) == 0)
|
||||
fp = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb");
|
||||
else
|
||||
fp = fopen(fmt("%s/%s/%s.wfc", m_cachePath.c_str(), coverDir, gamePath), "rb");
|
||||
}
|
||||
if(fp != NULL)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
void stopSound(void);
|
||||
//
|
||||
void applySettings(void);
|
||||
void setCachePath(const char *path, bool deleteSource, bool compress);
|
||||
void setCachePath(const char *path, bool deleteSource, bool compress, bool pluginCacheFolders);
|
||||
bool fullCoverCached(const char *id);
|
||||
bool preCacheCover(const char *id, const u8 *png, bool full);
|
||||
//
|
||||
@ -288,6 +288,7 @@ private:
|
||||
bool m_compressCache;
|
||||
string m_cachePath;
|
||||
bool m_deletePicsAfterCaching;
|
||||
bool m_pluginCacheFolders;
|
||||
bool m_mirrorBlur;
|
||||
float m_mirrorAlpha;
|
||||
float m_txtMirrorAlpha;
|
||||
|
@ -646,7 +646,8 @@ void CMenu::_loadCFCfg()
|
||||
const char *domain = "_COVERFLOW";
|
||||
|
||||
//gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str());
|
||||
CoverFlow.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true), m_cfg.getBool("GENERAL", "compress_cache", false));
|
||||
CoverFlow.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true),
|
||||
m_cfg.getBool("GENERAL", "compress_cache", false), m_cfg.getBool(PLUGIN_DOMAIN, "subfolder_cache", true));
|
||||
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
|
||||
// Coverflow Sounds
|
||||
CoverFlow.setSounds(
|
||||
|
@ -150,7 +150,8 @@ void Musicplayer::LoadFile(const char *name, bool display_change)
|
||||
}
|
||||
else if(FileNames.size() == 1 && strcmp(name, PLUGIN_DOMAIN) == 0)
|
||||
{
|
||||
Cleanup();
|
||||
MusicFile.FreeMemory();
|
||||
MusicStopped = true;
|
||||
return;
|
||||
}
|
||||
MusicFile.Load(name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user