From 447fdd7ceca8a914147d217dac81150981a58b5e Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sun, 4 Nov 2012 19:22:02 +0000 Subject: [PATCH] -fixed those sometimes fucked up backgrounds -fixed last played gamecube game was not selected -fixed sounds didnt load anymore -added some more stuff to the cleanup --- source/defines.h | 6 ++ source/gui/coverflow.cpp | 57 ++++++----- source/gui/coverflow.hpp | 9 +- source/gui/gcvid.cpp | 8 -- source/gui/gcvid.h | 4 +- source/gui/texture.cpp | 168 ++++++++++++++++++------------- source/gui/texture.hpp | 5 +- source/gui/video.cpp | 11 +- source/menu/menu.cpp | 128 ++++++++++++----------- source/menu/menu_config.cpp | 8 +- source/menu/menu_config3.cpp | 8 +- source/menu/menu_config4.cpp | 2 +- source/menu/menu_config_game.cpp | 2 +- source/menu/menu_game.cpp | 52 +++++----- source/menu/menu_main.cpp | 26 ++--- source/menu/menu_nandemu.cpp | 58 +++++------ source/menu/menu_source.cpp | 13 ++- source/menu/menu_wbfs.cpp | 10 +- source/music/gui_sound.h | 2 +- source/plugin/plugin.cpp | 26 ++--- source/plugin/plugin.hpp | 2 +- 21 files changed, 322 insertions(+), 283 deletions(-) diff --git a/source/defines.h b/source/defines.h index 3bcef340..eecb8127 100644 --- a/source/defines.h +++ b/source/defines.h @@ -20,6 +20,12 @@ #define GAME_SETTINGS2_FILENAME "gameconfig2.ini" #define PLUGIN_CRCS_FILENAME "plugin_crc32.ini" +#define WII_DOMAIN "GAMES" +#define GC_DOMAIN "DML" +#define CHANNEL_DOMAIN "NAND" +#define PLUGIN_DOMAIN "EMULATOR" +#define HOMEBREW_DOMAIN "HOMEBREW" + #define AGE_LOCK_DEFAULT 13 #define DEVELOPERS "OverjoY, FIX94" diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 7d4a6857..55f153c0 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -188,6 +188,7 @@ CCoverFlow::CCoverFlow(void) m_mutex = 0; m_dvdskin_loaded = false; m_loadingCovers = false; + m_coverThrdBusy = false; m_moved = false; m_selected = false; m_hideCover = false; @@ -262,14 +263,12 @@ void CCoverFlow::simulateOtherScreenFormat(bool s) CCoverFlow::~CCoverFlow(void) { clear(); - if(m_sound[0]) - delete m_sound[0]; - if(m_hoverSound) - delete m_hoverSound; - if(m_selectSound) - delete m_selectSound; - if(m_cancelSound) + if(m_flipSound != NULL) + delete m_flipSound; + m_flipSound = NULL; + if(m_cancelSound != NULL) delete m_cancelSound; + m_cancelSound = NULL; LWP_MutexDestroy(m_mutex); } @@ -582,10 +581,10 @@ void CCoverFlow::setSorting(Sorting sorting) m_sorting = sorting; } -void CCoverFlow::setSounds(GuiSound *sound, GuiSound *hoverSound, GuiSound *selectSound, GuiSound *cancelSound) +void CCoverFlow::setSounds(GuiSound *flipSound, GuiSound *hoverSound, GuiSound *selectSound, GuiSound *cancelSound) { //for(u8 i = 0; i < 4; i++) - m_sound[0] = sound; + m_flipSound = flipSound; m_hoverSound = hoverSound; m_selectSound = selectSound; m_cancelSound = cancelSound; @@ -596,13 +595,13 @@ void CCoverFlow::setSoundVolume(u8 vol) m_soundVolume = vol; } -void CCoverFlow::_stopSound(GuiSound *snd) +void CCoverFlow::_stopSound(GuiSound * &snd) { if(snd == NULL) return; snd->Stop(); } -void CCoverFlow::_playSound(GuiSound *snd) +void CCoverFlow::_playSound(GuiSound * &snd) { if(snd == NULL) return; snd->Play(m_soundVolume); @@ -610,9 +609,11 @@ void CCoverFlow::_playSound(GuiSound *snd) void CCoverFlow::stopSound(void) { - for(u8 i = 0; i < 4; i++) - _stopSound(m_sound[i]); + //for(u8 i = 0; i < 4; i++) + _stopSound(m_flipSound); _stopSound(m_hoverSound); + _stopSound(m_selectSound); + _stopSound(m_cancelSound); } void CCoverFlow::applySettings(void) @@ -626,15 +627,15 @@ void CCoverFlow::applySettings(void) void CCoverFlow::stopCoverLoader(bool empty) { m_loadingCovers = false; - - if(coverLoaderThread != LWP_THREAD_NULL && !m_loadingCovers) + if(coverLoaderThread != LWP_THREAD_NULL) { if(LWP_ThreadIsSuspended(coverLoaderThread)) LWP_ResumeThread(coverLoaderThread); + while(m_coverThrdBusy) + usleep(50); LWP_JoinThread(coverLoaderThread, NULL); coverLoaderThread = LWP_THREAD_NULL; - if(empty) { for(u32 i = 0; i < m_items.size(); ++i) @@ -679,17 +680,12 @@ void CCoverFlow::shutdown(void) m_dvdSkin_GreenTwo.Cleanup(); m_loadingTexture.Cleanup(); m_noCoverTexture.Cleanup(); - for(u8 i = 0; i < 4; i++) - { - if(m_sound[i] != NULL) - delete m_sound[i]; - m_sound[i] = NULL; - } - if(m_hoverSound != NULL) delete m_hoverSound; - m_hoverSound = NULL; - if(m_selectSound) delete m_selectSound; - m_selectSound = NULL; - if(m_cancelSound) delete m_cancelSound; + + if(m_flipSound != NULL) + delete m_flipSound; + m_flipSound = NULL; + if(m_cancelSound != NULL) + delete m_cancelSound; m_cancelSound = NULL; LWP_MutexDestroy(m_mutex); } @@ -1926,13 +1922,14 @@ void CCoverFlow::right(void) void CCoverFlow::_playSound(void) { - if (m_soundVolume > 0) + /*if (m_soundVolume > 0) { sndCopyNum++; if(sndCopyNum == 4) sndCopyNum = 0; _playSound(m_sound[sndCopyNum]); //gprintf("\n\nPlaying flipsound copy # %u\n\n", sndCopyNum); - } + }*/ + _playSound(m_flipSound); } void CCoverFlow::_left(int repeatDelay, u32 step) @@ -2790,6 +2787,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank int CCoverFlow::_coverLoader(CCoverFlow *cf) { + cf->m_coverThrdBusy = true; CLRet ret; u32 firstItem; bool update; @@ -2831,5 +2829,6 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf) if(ret == CL_NOMEM && bufferSize > 3) bufferSize -= 2; } + cf->m_coverThrdBusy = false; return 0; } diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index ddd18d55..b3761b80 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -116,7 +116,7 @@ public: void setBlur(u32 blurResolution, u32 blurRadius, float blurFactor); void setSorting(Sorting sorting); // - void setSounds(GuiSound *sound, GuiSound *hoverSound, GuiSound *selectSound, GuiSound *cancelSound); + void setSounds(GuiSound *flipSound, GuiSound *hoverSound, GuiSound *selectSound, GuiSound *cancelSound); void setSoundVolume(u8 vol); void stopSound(void); // @@ -236,6 +236,7 @@ private: int m_jump; mutex_t m_mutex; volatile bool m_loadingCovers; + volatile bool m_coverThrdBusy; volatile bool m_moved; volatile int m_hqCover; bool m_selected; @@ -285,7 +286,7 @@ private: Vector3D m_flipCoverAngle; Vector3D m_flipCoverScale; u8 sndCopyNum; - GuiSound *m_sound[4]; + GuiSound *m_flipSound; GuiSound *m_hoverSound; GuiSound *m_selectSound; GuiSound *m_cancelSound; @@ -331,8 +332,8 @@ private: void _transposeCover(vector &dst, u32 rows, u32 columns, int pos); void _playSound(void); - void _stopSound(GuiSound *snd); - void _playSound(GuiSound *snd); + void _stopSound(GuiSound * &snd); + void _playSound(GuiSound * &snd); static bool _sortByPlayCount(CItem item1, CItem item2); static bool _sortByLastPlayed(CItem item1, CItem item2); diff --git a/source/gui/gcvid.cpp b/source/gui/gcvid.cpp index 1ae4b07c..52305f1a 100644 --- a/source/gui/gcvid.cpp +++ b/source/gui/gcvid.cpp @@ -259,14 +259,6 @@ int thpAudioDecode(s16 * destBuffer, const u8* srcBuffer, bool separateChannelsI return numSamples; } - -VideoFrame::VideoFrame() -: _data(NULL), _w(0), _h(0), _p(0) -{} - -VideoFrame::~VideoFrame() -{ dealloc(); } - void VideoFrame::resize(int width, int height) { if(width == _w && height == _h) diff --git a/source/gui/gcvid.h b/source/gui/gcvid.h index 21b2c3f0..42e5ae5e 100644 --- a/source/gui/gcvid.h +++ b/source/gui/gcvid.h @@ -186,8 +186,8 @@ struct MthHeader class VideoFrame { public: - VideoFrame(); - ~VideoFrame(); + VideoFrame() : _data(NULL), _w(0), _h(0), _p(0) { }; + ~VideoFrame() { }; void resize(int width, int height); diff --git a/source/gui/texture.cpp b/source/gui/texture.cpp index 43eccc2c..e69d80ee 100644 --- a/source/gui/texture.cpp +++ b/source/gui/texture.cpp @@ -188,12 +188,31 @@ void STexture::Cleanup(void) if(data != NULL) free(data); data = NULL; + dataSize = 0; width = 0; height = 0; format = -1; maxLOD = 0; } +bool STexture::CopyTexture(const STexture &tex) +{ + Cleanup(); + if(tex.data == NULL || tex.dataSize == 0) + return false; + data = (u8*)MEM2_alloc(tex.dataSize); + if(data == NULL) + return false; + dataSize = tex.dataSize; + memcpy(data, tex.data, dataSize); + DCFlushRange(data, dataSize); + width = tex.width; + height = tex.height; + format = tex.format; + maxLOD = tex.maxLOD; + return true; +} + STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipSize, u32 maxMipSize) { FILE *file = fopen(filename, "rb"); @@ -230,23 +249,72 @@ STexture::TexErr STexture::fromImageFile(const char *filename, u8 f, u32 minMipS return result; } -STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, u32 minMipSize, u32 maxMipSize) +STexture::TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h) { - // Convert our raw stuff to a usable format - u8 *rawData = (u8*)MEM2_alloc(w * h * 4); - if(rawData == NULL) + width = w; + height = h; + format = GX_TF_RGBA8; + dataSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0); + data = (u8*)MEM2_alloc(dataSize); + if(data == NULL) return TE_NOMEM; - _convertToFlippedRGBA(rawData, buffer, w, h); + for(u32 block = 0; block < height; block += 4) + { + for(u32 i = 0; i < width; i += 4) + { + for(u32 c = 0; c < 4; ++c) + { + for(u32 argb = 0; argb < 4; ++argb) + { + u32 y = h - 1 - (c + block); + u32 x = argb + i; + u32 src_offset = ((i + argb) + ((block + c) * width)) * 3; + u32 dst_offset = coordsRGBA8(x, y, width); + /* Alpha */ + data[dst_offset] = 0xFF; + /* RGB */ + data[dst_offset + 1] = src[src_offset]; + data[dst_offset + 32] = src[src_offset + 1]; + data[dst_offset + 33] = src[src_offset + 2]; + } + } + } + } + DCFlushRange(data, dataSize); + return TE_OK; +} + +STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize) +{ + Cleanup(); + + // Decode our JPG to raw + VideoFrame VideoF; + decodeRealJpeg(buffer, buffer_size, VideoF, true); + if(!VideoF.getData()) + return TE_ERROR; + data = VideoF.getData(); + width = VideoF.getWidth(); + height = VideoF.getHeight(); + + // Convert our raw stuff to a usable format + u8 *rawData = (u8*)MEM2_alloc(width * height * 4); + if(rawData == NULL) + { + Cleanup(); + return TE_NOMEM; + } + _convertToFlippedRGBA(rawData, data, width, height); + + //Free our raw stuff + VideoF.dealloc(); + data = NULL; //Let the real work begin - Cleanup(); - u32 BufSize = 0; u8 maxLODTmp = 0; u8 minLODTmp = 0; u32 baseWidth; u32 baseHeight; - width = w; - height = h; switch(f) { @@ -260,13 +328,15 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, u32 min format = f; if (minMipSize > 0 || maxMipSize > 0) - _calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, w, h, minMipSize, maxMipSize); + _calcMipMaps(maxLODTmp, minLODTmp, baseWidth, baseHeight, width, height, minMipSize, maxMipSize); if (maxLODTmp > 0) { rawData = _genMipMaps(rawData, width, height, maxLODTmp, baseWidth, baseHeight); if(rawData == NULL) + { + Cleanup(); return TE_NOMEM; - + } u32 newWidth = baseWidth; u32 newHeight = baseHeight; for(int i = 0; i < minLODTmp; ++i) @@ -274,10 +344,11 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, u32 min newWidth >>= 1; newHeight >>= 1; } - BufSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp); - data = (u8*)MEM2_alloc(BufSize); + dataSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp); + data = (u8*)MEM2_alloc(dataSize); if(data == NULL) { + Cleanup(); free(rawData); return TE_NOMEM; } @@ -312,10 +383,11 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, u32 min } else { - BufSize = GX_GetTexBufferSize(w, h, format, GX_FALSE, 0); - data = (u8*)MEM2_alloc(BufSize); + dataSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0); + data = (u8*)MEM2_alloc(dataSize); if(data == NULL) { + Cleanup(); free(rawData); return TE_NOMEM; } @@ -332,58 +404,11 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, u32 min break; } } - DCFlushRange(data, BufSize); + DCFlushRange(data, dataSize); free(rawData); return TE_OK; } -STexture::TexErr STexture::fromTHP(const u8 *src, u32 w, u32 h) -{ - width = w; - height = h; - format = GX_TF_RGBA8; - u32 BufSize = GX_GetTexBufferSize(width, height, format, GX_FALSE, 0); - data = (u8*)MEM2_alloc(BufSize); - if(data == NULL) - return TE_NOMEM; - for(u32 block = 0; block < height; block += 4) - { - for(u32 i = 0; i < width; i += 4) - { - for(u32 c = 0; c < 4; ++c) - { - for(u32 argb = 0; argb < 4; ++argb) - { - u32 y = h - 1 - (c + block); - u32 x = argb + i; - u32 src_offset = ((i + argb) + ((block + c) * width)) * 3; - u32 dst_offset = coordsRGBA8(x, y, width); - /* Alpha */ - data[dst_offset] = 0xFF; - /* RGB */ - data[dst_offset + 1] = src[src_offset]; - data[dst_offset + 32] = src[src_offset + 1]; - data[dst_offset + 33] = src[src_offset + 2]; - } - } - } - } - DCFlushRange(data, BufSize); - return TE_OK; -} - -STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, u32 minMipSize, u32 maxMipSize) -{ - TexErr result = TE_ERROR; - VideoFrame VideoF; - decodeRealJpeg(buffer, buffer_size, VideoF, true); - if(!VideoF.getData()) - return result; - result = fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight(), f, minMipSize, maxMipSize); - VideoF.dealloc(); - return result; -} - STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize) { Cleanup(); @@ -448,14 +473,15 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 m u8 *pSrc = tmpData2; if(minLODTmp > 0) pSrc += fixGX_GetTexBufferSize(baseWidth, baseHeight, f, minLODTmp > 1 ? GX_TRUE : GX_FALSE, minLODTmp - 1); - u32 Size = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp); - data = (u8*)MEM2_alloc(Size); + dataSize = fixGX_GetTexBufferSize(newWidth, newHeight, f, GX_TRUE, maxLODTmp - minLODTmp); + data = (u8*)MEM2_alloc(dataSize); if(data == NULL) { + Cleanup(); free(tmpData2); return TE_NOMEM; } - memset(data, 0, Size); + memset(data, 0, dataSize); u8 *pDst = data; for(u8 i = minLODTmp; i <= maxLODTmp; ++i) { @@ -481,18 +507,18 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 m format = f; width = newWidth; height = newHeight; - DCFlushRange(data, Size); } else { - u32 Size = GX_GetTexBufferSize(pngWidth, pngHeight, f, GX_FALSE, 0); - data = (u8*)MEM2_alloc(Size); + dataSize = GX_GetTexBufferSize(pngWidth, pngHeight, f, GX_FALSE, 0); + data = (u8*)MEM2_alloc(dataSize); if(data == NULL) { + Cleanup(); PNGU_ReleaseImageContext(ctx); return TE_NOMEM; } - memset(data, 0, Size); + memset(data, 0, dataSize); format = f; width = pngWidth; height = pngHeight; @@ -510,8 +536,8 @@ STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, u32 minMipSize, u32 m break; } PNGU_ReleaseImageContext(ctx); - DCFlushRange(data, Size); } + DCFlushRange(data, dataSize); return TE_OK; } diff --git a/source/gui/texture.hpp b/source/gui/texture.hpp index 69d2c314..fde4bafd 100644 --- a/source/gui/texture.hpp +++ b/source/gui/texture.hpp @@ -7,9 +7,11 @@ class STexture { public: - STexture(void) : data(NULL), width(0), height(0), format(-1), maxLOD(0) { } + STexture(void) : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0) { } void Cleanup(); + bool CopyTexture(const STexture &tex); u8 *data; + u32 dataSize; u32 width; u32 height; u8 format; @@ -20,7 +22,6 @@ public: TexErr fromImageFile(const char *filename, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); // This function doesn't use MEM2 if the PNG is loaded from memory and there's no mip mapping TexErr fromPNG(const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); - TexErr fromRAW(const u8 *buffer, u32 w, u32 h, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); TexErr fromJPG(const u8 *buffer, const u32 buffer_size, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); /* Just for THP */ TexErr fromTHP(const u8 *buffer, u32 w, u32 h); diff --git a/source/gui/video.cpp b/source/gui/video.cpp index d47f151b..d578c3f1 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -233,8 +233,13 @@ void CVideo::setup2DProjection(bool setViewPort, bool noScale) void CVideo::renderToTexture(STexture &tex, bool clear) { - if (!tex.data) tex.data = (u8*)MEM2_alloc(GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0)); - if (!tex.data) return; + if(tex.data == NULL) + { + tex.dataSize = GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0); + tex.data = (u8*)MEM2_alloc(tex.dataSize); + } + if(tex.data == NULL) + return; GX_DrawDone(); GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL); GX_SetTexCopySrc(0, 0, tex.width, tex.height); @@ -242,7 +247,7 @@ void CVideo::renderToTexture(STexture &tex, bool clear) GX_CopyTex(tex.data, clear ? GX_TRUE : GX_FALSE); GX_PixModeSync(); GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter); - DCFlushRange(tex.data, GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0)); + DCFlushRange(tex.data, tex.dataSize); GX_SetScissor(0, 0, m_rmode->fbWidth, m_rmode->efbHeight); } diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 62e1622e..30d6194b 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -261,7 +261,7 @@ void CMenu::init() } } - if(m_cfg.getBool("DML", "always_show_button", false)) + if(m_cfg.getBool(GC_DOMAIN, "always_show_button", false)) { gprintf("Force enabling DML view\n"); m_show_dml = true; @@ -269,13 +269,13 @@ void CMenu::init() else m_show_dml = MIOSisDML(); - m_new_dml = m_cfg.getBool("DML", "dml_r52+", true); - m_new_dm_cfg = m_cfg.getBool("DML", "dm_r2.1+", true); - m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString("DML", "dir_usb_games", "games").c_str()); + m_new_dml = m_cfg.getBool(GC_DOMAIN, "dml_r52+", true); + m_new_dm_cfg = m_cfg.getBool(GC_DOMAIN, "dm_r2.1+", true); + m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString(GC_DOMAIN, "dir_usb_games", "games").c_str()); - m_cfg.getString("NAND", "path", ""); - m_cfg.getInt("NAND", "partition", 1); - m_cfg.getBool("NAND", "disable", true); + m_cfg.getString(CHANNEL_DOMAIN, "path", ""); + m_cfg.getInt(CHANNEL_DOMAIN, "partition", 1); + m_cfg.getBool(CHANNEL_DOMAIN, "disable", true); _installed_cios.clear(); if(!neek2o()) @@ -518,7 +518,13 @@ void CMenu::cleanup() void CMenu::_Theme_Cleanup(void) { + /* Backgrounds */ theme.bg.Cleanup(); + m_prevBg.Cleanup(); + m_nextBg.Cleanup(); + m_curBg.Cleanup(); + m_lqBg.Cleanup(); + /* Buttons */ theme.btnTexL.Cleanup(); theme.btnTexR.Cleanup(); theme.btnTexC.Cleanup(); @@ -579,6 +585,11 @@ void CMenu::_Theme_Cleanup(void) theme.btnZHCNOns.Cleanup(); theme.btnZHCNOff.Cleanup(); theme.btnZHCNOffs.Cleanup(); + theme.btnTexPlus.Cleanup(); + theme.btnTexPlusS.Cleanup(); + theme.btnTexMinus.Cleanup(); + theme.btnTexMinusS.Cleanup(); + /* Checkboxes */ theme.checkboxoff.Cleanup(); theme.checkboxoffs.Cleanup(); theme.checkboxon.Cleanup(); @@ -587,16 +598,14 @@ void CMenu::_Theme_Cleanup(void) theme.checkboxHids.Cleanup(); theme.checkboxReq.Cleanup(); theme.checkboxReqs.Cleanup(); + /* Progress Bars */ theme.pbarTexL.Cleanup(); theme.pbarTexR.Cleanup(); theme.pbarTexC.Cleanup(); theme.pbarTexLS.Cleanup(); theme.pbarTexRS.Cleanup(); theme.pbarTexCS.Cleanup(); - theme.btnTexPlus.Cleanup(); - theme.btnTexPlusS.Cleanup(); - theme.btnTexMinus.Cleanup(); - theme.btnTexMinusS.Cleanup(); + /* Other Theme Stuff */ for(TexSet::iterator texture = theme.texSet.begin(); texture != theme.texSet.end(); ++texture) texture->second.Cleanup(); for(FontSet::iterator font = theme.fontSet.begin(); font != theme.fontSet.end(); ++font) @@ -1286,13 +1295,13 @@ STexture CMenu::_texture(const char *domain, const char *key, STexture &def, boo GuiSound *CMenu::_sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, const u8 * snd, u32 len, const char *name, bool isAllocated) { const char *filename = m_theme.getString(domain, key, "").c_str(); - if(filename == NULL) + if(filename == NULL || filename[0] == '\0') filename = name; - CMenu::SoundSet::iterator i = soundSet.find(upperCase(filename)); + CMenu::SoundSet::iterator i = soundSet.find(upperCase(name)); if(i == soundSet.end()) { - if(strncmp(filename, name, strlen(name) != 0)) + if(filename != name) soundSet[upperCase(filename)] = new GuiSound(fmt("%s/%s", m_themeDataDir.c_str(), filename)); else soundSet[upperCase(filename)] = new GuiSound(snd, len, filename, isAllocated); @@ -1305,7 +1314,7 @@ GuiSound *CMenu::_sound(CMenu::SoundSet &soundSet, const char *domain, const cha GuiSound *CMenu::_sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, const char *name) { const char *filename = m_theme.getString(domain, key).c_str(); - if(filename == NULL) + if(filename == NULL || filename[0] == '\0') { if(strrchr(name, '/') != NULL) name = strrchr(name, '/') + 1; @@ -1743,19 +1752,19 @@ void CMenu::_initCF(void) switch(element->type) { case TYPE_CHANNEL: - catDomain = "NAND"; + catDomain = CHANNEL_DOMAIN; break; case TYPE_HOMEBREW: - catDomain = "HOMEBREW"; + catDomain = HOMEBREW_DOMAIN; break; case TYPE_GC_GAME: - catDomain = "DML"; + catDomain = GC_DOMAIN; break; case TYPE_PLUGIN: - catDomain = "EMULATOR"; + catDomain = PLUGIN_DOMAIN; break; default: - catDomain = "GAMES"; + catDomain = WII_DOMAIN; } if(enabledPluginsCount == 1) { @@ -2041,8 +2050,9 @@ void CMenu::_setBg(const STexture &tex, const STexture &lqTex) m_lqBg = lqTex; if(tex.data == m_nextBg.data) return; - m_prevBg = m_curBg; - m_nextBg = tex; + m_prevBg.CopyTexture(m_curBg); + m_curBg.Cleanup(); + m_nextBg.CopyTexture(tex); m_bgCrossFade = 0xFF; } @@ -2057,26 +2067,22 @@ void CMenu::_updateBg(void) m_bgCrossFade = max(0, (int)m_bgCrossFade - 14); if (m_bgCrossFade == 0) { + m_curBg.Cleanup(); m_curBg = m_nextBg; return; } - if(m_curBg.data == m_prevBg.data && m_curBg.data != NULL) - { - free(m_curBg.data); - m_curBg.data = NULL; - } m_vid.prepare(); GX_SetViewport(0.f, 0.f, 640.f, 480.f, 0.f, 1.f); guOrtho(projMtx, 0.f, 480.f, 0.f, 640.f, 0.f, 1000.0f); GX_LoadProjectionMtx(projMtx, GX_ORTHOGRAPHIC); GX_ClearVtxDesc(); - GX_SetNumTevStages(!m_prevBg.data ? 1 : 2); + GX_SetNumTevStages(m_prevBg.data == NULL ? 1 : 2); GX_SetNumChans(0); GX_SetVtxDesc(GX_VA_POS, GX_DIRECT); GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, 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(!m_prevBg.data ? 1 : 2); + GX_SetNumTexGens(m_prevBg.data == NULL ? 1 : 2); GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GX_SetTevKColor(GX_KCOLOR0, CColor(m_bgCrossFade, 0xFF - m_bgCrossFade, 0, 0)); @@ -2121,8 +2127,9 @@ void CMenu::_updateBg(void) m_curBg.format = GX_TF_RGBA8; m_curBg.maxLOD = 0; m_vid.renderToTexture(m_curBg, true); - if (!m_curBg.data) + if(m_curBg.data == NULL) { + m_curBg.Cleanup(); m_curBg = m_nextBg; m_bgCrossFade = 0; } @@ -2198,11 +2205,11 @@ bool CMenu::_loadChannelList(void) string emuPath; int emuPartition = -1; - bool disable_emu = (m_cfg.getBool("NAND", "disable", true) || neek2o()); + bool disable_emu = (m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) || neek2o()); if(!disable_emu) { - m_partRequest = m_cfg.getInt("NAND", "partition", 1); + m_partRequest = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 1); emuPartition = _FindEmuPart(&emuPath, m_partRequest, false); if(emuPartition < 0) @@ -2218,7 +2225,7 @@ bool CMenu::_loadChannelList(void) { char basepath[64]; snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[currentPartition], emuPath.c_str()); - NandHandle.PreNandCfg(basepath, m_cfg.getBool("NAND", "real_nand_miis", false), m_cfg.getBool("NAND", "real_nand_config", false)); + NandHandle.PreNandCfg(basepath, m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false), m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false)); } NandHandle.Disable_Emu(); if(!disable_emu) @@ -2246,14 +2253,14 @@ bool CMenu::_loadChannelList(void) bool CMenu::_loadList(void) { m_cf.clear(); - if((m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true)) + if((m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)) || (m_current_view != COVERFLOW_CHANNEL && NandHandle.EmulationEnabled())) { MusicPlayer.Stop(); NandHandle.Disable_Emu(); _TempLoadIOS(IOS_TYPE_NORMAL_IOS); } - gprintf("Switching Views\n"); + gprintf("Switching View to %s\n", _domainFromView()); bool retval; switch(m_current_view) @@ -2282,14 +2289,15 @@ bool CMenu::_loadList(void) bool CMenu::_loadGameList(void) { - currentPartition = m_cfg.getInt("GAMES", "partition", USB1); + currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", USB1); if(!DeviceHandle.IsInserted(currentPartition)) return false; + m_gameList.clear(); DeviceHandle.OpenWBFS(currentPartition); string gameDir(fmt(GAMES_DIR, DeviceName[currentPartition])); string cacheDir(fmt("%s/%s_wii.db", m_listCacheDir.c_str(), DeviceName[currentPartition])); - bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache"); + bool updateCache = m_cfg.getBool(WII_DOMAIN, "update_cache"); m_gameList.CreateList(m_current_view, currentPartition, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, updateCache); WBFS_Close(); @@ -2298,13 +2306,14 @@ bool CMenu::_loadGameList(void) bool CMenu::_loadHomebrewList() { - currentPartition = m_cfg.getInt("HOMEBREW", "partition", SD); + currentPartition = m_cfg.getInt(HOMEBREW_DOMAIN, "partition", SD); if(!DeviceHandle.IsInserted(currentPartition)) return false; + m_gameList.clear(); string gameDir(fmt(HOMEBREW_DIR, DeviceName[currentPartition])); string cacheDir(fmt("%s/%s_homebrew.db", m_listCacheDir.c_str(), DeviceName[currentPartition])); - bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache"); + bool updateCache = m_cfg.getBool(HOMEBREW_DOMAIN, "update_cache"); m_gameList.CreateList(m_current_view, currentPartition, gameDir, stringToVector(".dol|.elf", '|'), cacheDir, updateCache); return m_gameList.size() > 0 ? true : false; @@ -2312,13 +2321,14 @@ bool CMenu::_loadHomebrewList() bool CMenu::_loadDmlList() { - currentPartition = m_cfg.getInt("DML", "partition", USB1); + currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", USB1); if(!DeviceHandle.IsInserted(currentPartition)) return false; + m_gameList.clear(); string gameDir(fmt(currentPartition == SD ? DML_DIR : m_DMLgameDir.c_str(), DeviceName[currentPartition])); string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition])); - bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache"); + bool updateCache = m_cfg.getBool(GC_DOMAIN, "update_cache"); m_gameList.CreateList(m_current_view, currentPartition, gameDir, stringToVector(".iso|root", '|'),cacheDir, updateCache); @@ -2334,10 +2344,10 @@ static void GrabINIFiles(char *FullPath) bool CMenu::_loadEmuList() { - currentPartition = m_cfg.getInt("EMULATOR", "partition", SD); + currentPartition = m_cfg.getInt(PLUGIN_DOMAIN, "partition", SD); if(!DeviceHandle.IsInserted(currentPartition)) return false; - bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache"); + bool updateCache = m_cfg.getBool(PLUGIN_DOMAIN, "update_cache"); vector emuList; Config m_plugin_cfg; @@ -2353,13 +2363,13 @@ bool CMenu::_loadEmuList() if(m_plugin_cfg.loaded()) { m_plugin.AddPlugin(m_plugin_cfg); - u32 MagicWord = strtoul(m_plugin_cfg.getString(PLUGIN_DOMAIN,"magic").c_str(), NULL, 16); - if(m_plugin_cfg.getString(PLUGIN_DOMAIN,"romDir").find("scummvm.ini") == string::npos) + u32 MagicWord = strtoul(m_plugin_cfg.getString(PLUGIN_INI_DEF,"magic").c_str(), NULL, 16); + if(m_plugin_cfg.getString(PLUGIN_INI_DEF,"romDir").find("scummvm.ini") == string::npos) { - string gameDir(fmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString(PLUGIN_DOMAIN,"romDir").c_str())); - string cacheDir(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin_cfg.getString(PLUGIN_DOMAIN,"magic").c_str())); - vector FileTypes = stringToVector(m_plugin_cfg.getString(PLUGIN_DOMAIN,"fileTypes"), '|'); - m_gameList.Color = strtoul(m_plugin_cfg.getString(PLUGIN_DOMAIN,"coverColor").c_str(), NULL, 16); + string gameDir(fmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString(PLUGIN_INI_DEF,"romDir").c_str())); + string cacheDir(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin_cfg.getString(PLUGIN_INI_DEF,"magic").c_str())); + vector FileTypes = stringToVector(m_plugin_cfg.getString(PLUGIN_INI_DEF,"fileTypes"), '|'); + m_gameList.Color = strtoul(m_plugin_cfg.getString(PLUGIN_INI_DEF,"coverColor").c_str(), NULL, 16); m_gameList.Magic = MagicWord; m_gameList.CreateList(m_current_view, currentPartition, gameDir, FileTypes, cacheDir, updateCache); for(vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) @@ -2603,15 +2613,15 @@ const char *CMenu::_domainFromView() switch(m_current_view) { case COVERFLOW_CHANNEL: - return "NAND"; + return CHANNEL_DOMAIN; case COVERFLOW_HOMEBREW: - return "HOMEBREW"; + return HOMEBREW_DOMAIN; case COVERFLOW_DML: - return "DML"; + return GC_DOMAIN; case COVERFLOW_PLUGIN: - return "EMULATOR"; + return PLUGIN_DOMAIN; default: - return "GAMES"; + return WII_DOMAIN; } return "NULL"; } @@ -2632,19 +2642,19 @@ void CMenu::UpdateCache(u32 view) switch(view) { case COVERFLOW_CHANNEL: - domain = "NAND"; + domain = CHANNEL_DOMAIN; break; case COVERFLOW_HOMEBREW: - domain = "HOMEBREW"; + domain = HOMEBREW_DOMAIN; break; case COVERFLOW_DML: - domain = "DML"; + domain = GC_DOMAIN; break; case COVERFLOW_PLUGIN: - domain = "EMULATOR"; + domain = PLUGIN_DOMAIN; break; default: - domain = "GAMES"; + domain = WII_DOMAIN; } m_cfg.setBool(domain, "update_cache", true); diff --git a/source/menu/menu_config.cpp b/source/menu/menu_config.cpp index 877e67d5..125d88e6 100644 --- a/source/menu/menu_config.cpp +++ b/source/menu/menu_config.cpp @@ -60,8 +60,8 @@ void CMenu::_showConfig(void) m_btnMgr.show(m_configLblDownload); m_btnMgr.show(m_configBtnDownload); - bool disable = (m_cfg.getBool("NAND", "disable", true) || neek2o()) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; - char *partitionname = disable ? (char *)"NAND" : (char *)DeviceName[m_tempView ? m_cfg.getInt("GAMES", "savepartition", 0) : m_cfg.getInt(_domainFromView(), "partition", 0)]; + bool disable = (m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) || neek2o()) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; + char *partitionname = disable ? (char *)CHANNEL_DOMAIN : (char *)DeviceName[m_tempView ? m_cfg.getInt(WII_DOMAIN, "savepartition", 0) : m_cfg.getInt(_domainFromView(), "partition", 0)]; for(u8 i = 0; strncmp((const char *)&partitionname[i], "\0", 1) != 0; i++) partitionname[i] = toupper(partitionname[i]); @@ -213,11 +213,11 @@ int CMenu::_config1(void) if (currentPartition != bCurrentPartition) { - bool disable = (m_cfg.getBool("NAND", "disable", true) || neek2o()) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; + bool disable = (m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) || neek2o()) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; if(!disable) { - char *newpartition = (char *)DeviceName[m_cfg.getInt(m_tempView ? "GAMES" : _domainFromView(), m_tempView ? "savepartition" : "partition", currentPartition)]; + char *newpartition = (char *)DeviceName[m_cfg.getInt(m_tempView ? WII_DOMAIN : _domainFromView(), m_tempView ? "savepartition" : "partition", currentPartition)]; for(u8 i = 0; strncmp((const char *)&newpartition[i], "\0", 1) != 0; i++) newpartition[i] = toupper(newpartition[i]); diff --git a/source/menu/menu_config3.cpp b/source/menu/menu_config3.cpp index d4ec92e2..d018f9fe 100644 --- a/source/menu/menu_config3.cpp +++ b/source/menu/menu_config3.cpp @@ -90,10 +90,10 @@ void CMenu::_showConfig3(void) } else { - i = min(max(0, m_cfg.getInt("DML", "video_mode", 0)), (int)ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1); + i = min(max(0, m_cfg.getInt(GC_DOMAIN, "video_mode", 0)), (int)ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1); m_btnMgr.setText(m_config3LblDMLVideo, _t(CMenu::_GlobalDMLvideoModes[i].id, CMenu::_GlobalDMLvideoModes[i].text)); - i = min(max(0, m_cfg.getInt("DML", "game_language", 0)), (int)ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1); + i = min(max(0, m_cfg.getInt(GC_DOMAIN, "game_language", 0)), (int)ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1); m_btnMgr.setText(m_config3LblDMLLanguage, _t(CMenu::_GlobalGClanguages[i].id, CMenu::_GlobalGClanguages[i].text)); } @@ -129,13 +129,13 @@ int CMenu::_config3(void) else if (m_btnMgr.selected(m_config3BtnDMLLanguageP) || m_btnMgr.selected(m_config3BtnDMLLanguageM)) { s8 direction = m_btnMgr.selected(m_config3BtnDMLLanguageP) ? 1 : -1; - m_cfg.setInt("DML", "game_language", (int)loopNum((u32)m_cfg.getInt("DML", "game_language", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGClanguages))); + m_cfg.setInt(GC_DOMAIN, "game_language", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "game_language", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGClanguages))); _showConfig3(); } else if (m_btnMgr.selected(m_config3BtnDMLVideoP) || m_btnMgr.selected(m_config3BtnDMLVideoM)) { s8 direction = m_btnMgr.selected(m_config3BtnDMLVideoP) ? 1 : -1; - m_cfg.setInt("DML", "video_mode", (int)loopNum((u32)m_cfg.getInt("DML", "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GlobalDMLvideoModes))); + m_cfg.setInt(GC_DOMAIN, "video_mode", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_GlobalDMLvideoModes))); _showConfig3(); } else if (m_btnMgr.selected(m_config3BtnAsyncNet)) diff --git a/source/menu/menu_config4.cpp b/source/menu/menu_config4.cpp index fa02b51d..5a583807 100644 --- a/source/menu/menu_config4.cpp +++ b/source/menu/menu_config4.cpp @@ -145,7 +145,7 @@ int CMenu::_config4(void) } } } - if(!neek2o() && m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true) == false) + if(!neek2o() && m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) == false) NandHandle.Enable_Emu(); _hideConfig4(); return change; diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index c4f4be27..607f9a17 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -348,7 +348,7 @@ void CMenu::_showGameSettings(void) { m_btnMgr.show(m_gameSettingsLblCustom); m_btnMgr.show(m_gameSettingsBtnCustom); - if(m_cfg.getInt("NAND", "partition", 0) == 1) + if(m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0) == 1) { m_btnMgr.show(m_gameSettingsLblLaunchNK); m_btnMgr.show(m_gameSettingsBtnLaunchNK); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 8511b55c..ea5b089b 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -472,8 +472,7 @@ void CMenu::_game(bool launch) ButtonsPressed(); } movie.Stop(); - free(m_curBg.data); - m_curBg.data = NULL; + m_curBg.Cleanup(); /* Finished, so lets re-setup the background */ _setBg(Current_HQ_BG, Current_LQ_BG); _updateBg(); @@ -794,7 +793,7 @@ void CMenu::_launch(dir_discHdr *hdr) if(loader.find("usb") != string::npos) loader.erase(3,1); loader.append("/WiiFlowLoader.dol"); - m_cfg.setString("EMULATOR", "current_item", title); + m_cfg.setString(PLUGIN_DOMAIN, "current_item", title); string device(currentPartition == 0 ? "sd" : (DeviceHandle.GetFSType(currentPartition) == PART_FS_NTFS ? "ntfs" : "usb")); vector arguments = m_plugin.CreateArgs(device, path, title, loader, hdr->settings[0]); @@ -807,7 +806,7 @@ void CMenu::_launch(dir_discHdr *hdr) snprintf(gamepath, sizeof(gamepath), "%s/boot.dol", hdr->path); if(!fsop_FileExist((const char*)gamepath)) snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path); - m_cfg.setString("HOMEBREW", "current_item", title); + m_cfg.setString(HOMEBREW_DOMAIN, "current_item", title); _launchHomebrew(gamepath, m_homebrewArgs); } } @@ -816,19 +815,20 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) { string id(hdr->id); string path(hdr->path); + m_cfg.setString(GC_DOMAIN, "current_item", id); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); if(has_enabled_providers() && _initNetwork() == 0) add_game_to_card(id.c_str()); - u8 videoSetting = min(m_cfg.getInt("DML", "video_setting", 1), 2); + u8 videoSetting = min(m_cfg.getInt(GC_DOMAIN, "video_setting", 1), 2); u8 GClanguage = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); - GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt("DML", "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1; + GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1; u8 videoMode = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u); - videoMode = (videoMode == 0) ? min((u32)m_cfg.getInt("DML", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1u) : videoMode-1; + videoMode = (videoMode == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1u) : videoMode-1; if(videoMode == 0) { if(id.c_str()[3] == 'E' || id.c_str()[3] == 'J') @@ -848,13 +848,13 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) else if(loader == 1 || strcasestr(path.c_str(), "boot.bin") != NULL || !m_devo_installed) { loader = 1; - m_cfg.setString("DML", "current_item", id); + m_cfg.setString(GC_DOMAIN, "current_item", id); char CheatPath[256]; u8 NMM = min((u32)m_gcfg2.getInt(id, "dml_nmm", 0), ARRAY_SIZE(CMenu::_NMM) - 1u); - NMM = (NMM == 0) ? m_cfg.getInt("DML", "dml_nmm", 0) : NMM-1; + NMM = (NMM == 0) ? m_cfg.getInt(GC_DOMAIN, "dml_nmm", 0) : NMM-1; u8 nodisc = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u); - nodisc = (nodisc == 0) ? m_cfg.getInt("DML", "no_disc_patch", 0) : nodisc-1; - bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("DML", "cheat", false)); + nodisc = (nodisc == 0) ? m_cfg.getInt(GC_DOMAIN, "no_disc_patch", 0) : nodisc-1; + bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(GC_DOMAIN, "cheat", false)); string NewCheatPath; bool DML_debug = m_gcfg2.getBool(id, "debugger", false); bool DM_Widescreen = m_gcfg2.getBool(id, "dm_widescreen", false); @@ -1018,11 +1018,11 @@ void CMenu::_launchChannel(dir_discHdr *hdr) u32 gameIOS = 0; string id = string(hdr->id); - bool NAND_Emu = !m_cfg.getBool("NAND", "disable", true); + bool NAND_Emu = !m_cfg.getBool(CHANNEL_DOMAIN, "disable", true); bool WII_Launch = (m_gcfg2.getBool(id, "custom", false) && (!NAND_Emu || neek2o())); bool vipatch = m_gcfg2.testOptBool(id, "vipatch", m_cfg.getBool("GENERAL", "vipatch", false)); - bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("NAND", "cheat", false)); + bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(CHANNEL_DOMAIN, "cheat", false)); bool countryPatch = m_gcfg2.testOptBool(id, "country_patch", m_cfg.getBool("GENERAL", "country_patch", false)); u8 videoMode = (u8)min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u); @@ -1052,14 +1052,14 @@ void CMenu::_launchChannel(dir_discHdr *hdr) if(has_enabled_providers() && _initNetwork() == 0) add_game_to_card(id.c_str()); } - m_cfg.setString("NAND", "current_item", id); + m_cfg.setString(CHANNEL_DOMAIN, "current_item", id); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); string emuPath; - m_partRequest = m_cfg.getInt("NAND", "partition", 0); + m_partRequest = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); int emuPartition = _FindEmuPart(&emuPath, m_partRequest, false); - int emulate_mode = min(max(0, m_cfg.getInt("NAND", "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); + int emulate_mode = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); int userIOS = m_gcfg2.getInt(id, "ios", 0); u64 gameTitle = TITLE_ID(hdr->settings[0],hdr->settings[1]); @@ -1217,16 +1217,16 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) int aspectRatio = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u)-1; string emuPath; - m_partRequest = m_cfg.getInt("GAMES", "savepartition", -1); + m_partRequest = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); if(m_partRequest == -1) - m_partRequest = m_cfg.getInt("NAND", "partition", 0); + m_partRequest = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); int emuPartition = _FindEmuPart(&emuPath, m_partRequest, false); u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); if(emulate_mode == 0) { - emulate_mode = min(max(0, m_cfg.getInt("GAMES", "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); + emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); if(emulate_mode != 0) emulate_mode++; } @@ -1242,10 +1242,10 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) while(true) { _AutoCreateNand(); - if(_TestEmuNand(m_cfg.getInt("GAMES", "savepartition", 0), emuPath.c_str(), true)) + if(_TestEmuNand(m_cfg.getInt(WII_DOMAIN, "savepartition", 0), emuPath.c_str(), true)) { - emuPartition = m_cfg.getInt("GAMES", "savepartition", -1); - string emuPath = m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")); + emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); + string emuPath = m_cfg.getString(WII_DOMAIN, "savepath", m_cfg.getString(CHANNEL_DOMAIN, "path", "")); break; } } @@ -1259,8 +1259,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) } } - m_cfg.setInt("GAMES", "savepartition", emuPartition); - m_cfg.setString("GAMES", "savepath", emuPath); + m_cfg.setInt(WII_DOMAIN, "savepartition", emuPartition); + m_cfg.setString(WII_DOMAIN, "savepath", emuPath); m_cfg.save(); char basepath[64]; @@ -1283,7 +1283,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) NandHandle.Do_Region_Change(id); } } - bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("GAMES", "cheat", false)); + bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false)); debuggerselect = m_gcfg2.getBool(id, "debugger", false) ? 1 : 0; // debuggerselect is defined in fst.h if(id == "RPWE41" || id == "RPWZ41" || id == "SPXP41") // Prince of Persia, Rival Swords debuggerselect = false; @@ -1293,7 +1293,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) u8 *gameconfig = NULL; u32 cheatSize = 0, gameconfigSize = 0, returnTo = 0; - m_cfg.setString("GAMES", "current_item", id); + m_cfg.setString(WII_DOMAIN, "current_item", id); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 802ba028..973af851 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -151,13 +151,13 @@ void CMenu::_showMain(void) m_btnMgr.show(m_mainLblInit); break; case COVERFLOW_CHANNEL: - if(!m_cfg.getBool("NAND", "disable", true)) + if(!m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)) { NandHandle.Disable_Emu(); DeviceHandle.MountAll(); _hideMain(); if(!_AutoCreateNand()) - m_cfg.setBool("NAND", "disable", true); + m_cfg.setBool(CHANNEL_DOMAIN, "disable", true); _loadList(); _showMain(); _initCF(); @@ -175,7 +175,7 @@ void CMenu::_showMain(void) break; } } - else if(!neek2o() && m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true)) + else if(!neek2o() && m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)) NandHandle.Enable_Emu(); } @@ -195,8 +195,8 @@ void CMenu::LoadView(void) _loadCFLayout(m_cfg.getInt(_domainFromView(), "last_cf_mode", 1)); m_cf.applySettings(); - char *mode = (m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true)) - ? (char *)"NAND" : (char *)DeviceName[currentPartition]; + char *mode = (m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)) + ? (char *)CHANNEL_DOMAIN : (char *)DeviceName[currentPartition]; for(u8 i = 0; strncmp((const char *)&mode[i], "\0", 1) != 0; i++) mode[i] = toupper(mode[i]); @@ -229,10 +229,10 @@ int CMenu::main(void) { wstringEx curLetter; string prevTheme = m_cfg.getString("GENERAL", "theme", "default"); - parental_homebrew = m_cfg.getBool("HOMEBREW", "parental", false); - show_homebrew = !m_cfg.getBool("HOMEBREW", "disable", false); + parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false); + show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false); show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false); - show_emu = !m_cfg.getBool("EMULATOR", "disable", false); + show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false); bool dpad_mode = m_cfg.getBool("GENERAL", "dpad_mode", false); bool b_lr_mode = m_cfg.getBool("GENERAL", "b_lr_mode", false); bool use_grab = m_cfg.getBool("GENERAL", "use_grab", false); @@ -472,8 +472,8 @@ int CMenu::main(void) else if(!neek2o()) { bUsed = true; - m_cfg.setBool("NAND", "disable", !m_cfg.getBool("NAND", "disable", true)); - gprintf("EmuNand is %s\n", m_cfg.getBool("NAND", "disable", true) ? "Disabled" : "Enabled"); + m_cfg.setBool(CHANNEL_DOMAIN, "disable", !m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)); + gprintf("EmuNand is %s\n", m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) ? "Disabled" : "Enabled"); m_current_view = COVERFLOW_CHANNEL; LoadView(); } @@ -634,7 +634,7 @@ int CMenu::main(void) else if(BTN_MINUS_PRESSED && !m_locked) { bUsed = true; - bool block = m_current_view == COVERFLOW_CHANNEL && (m_cfg.getBool("NAND", "disable", true) || neek2o()); + bool block = m_current_view == COVERFLOW_CHANNEL && (m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) || neek2o()); char *partition; if(!block) { @@ -643,7 +643,7 @@ int CMenu::main(void) bool isD2XnewerThanV6 = (CurrentIOS.Type == IOS_TYPE_NEEK2O); if(CurrentIOS.Revision > 6 && CurrentIOS.Type == IOS_TYPE_D2X) isD2XnewerThanV6 = true; - if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0)) + if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 0)) NandHandle.Enable_Emu(); u8 limiter = 0; currentPartition = loopNum(currentPartition + 1, (int)USB8); @@ -822,7 +822,7 @@ int CMenu::main(void) else if(Sys_GetExitTo() == EXIT_TO_SMNK2O || Sys_GetExitTo() == EXIT_TO_WFNK2O) { string emuPath; - _FindEmuPart(&emuPath, m_cfg.getInt("NAND", "partition", 0), false); + _FindEmuPart(&emuPath, m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0), false); Sys_SetNeekPath(emuPath.size() > 1 ? emuPath.c_str() : NULL); } //gprintf("Saving configuration files\n"); diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp index 264e394e..54be38f2 100644 --- a/source/menu/menu_nandemu.cpp +++ b/source/menu/menu_nandemu.cpp @@ -99,24 +99,24 @@ int CMenu::_FindEmuPart(string *emuPath, int part, bool searchvalid) string tmpPath; if(m_current_view == COVERFLOW_CHANNEL) { - emuPartition = m_cfg.getInt("NAND", "partition", 0); - tmpPath = m_cfg.getString("NAND", "path", ""); + emuPartition = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); + tmpPath = m_cfg.getString(CHANNEL_DOMAIN, "path", ""); if(tmpPath.size() == 0) { - m_cfg.setString("NAND", "path", STDEMU_DIR); - tmpPath = m_cfg.getString("NAND", "path", STDEMU_DIR); + m_cfg.setString(CHANNEL_DOMAIN, "path", STDEMU_DIR); + tmpPath = m_cfg.getString(CHANNEL_DOMAIN, "path", STDEMU_DIR); } } else if(m_current_view == COVERFLOW_USB) { - emuPartition = m_cfg.getInt("GAMES", "savepartition", -1); + emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); if(emuPartition == -1) - emuPartition = m_cfg.getInt("NAND", "partition", 0); - tmpPath = m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")); + emuPartition = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); + tmpPath = m_cfg.getString(WII_DOMAIN, "savepath", m_cfg.getString(CHANNEL_DOMAIN, "path", "")); if(tmpPath.size() == 0) { - m_cfg.setString("GAMES", "savepath", STDEMU_DIR); - tmpPath = m_cfg.getString("GAMES", "savepath", STDEMU_DIR); + m_cfg.setString(WII_DOMAIN, "savepath", STDEMU_DIR); + tmpPath = m_cfg.getString(WII_DOMAIN, "savepath", STDEMU_DIR); } } @@ -142,9 +142,9 @@ int CMenu::_FindEmuPart(string *emuPath, int part, bool searchvalid) if(_TestEmuNand(i, tmpPath.c_str(), true) || searchvalid) { if(m_current_view == COVERFLOW_CHANNEL) - m_cfg.setInt("NAND", "partition", i); + m_cfg.setInt(CHANNEL_DOMAIN, "partition", i); else if(m_current_view == COVERFLOW_USB) - m_cfg.setInt("GAMES", "savepartition", i); + m_cfg.setInt(WII_DOMAIN, "savepartition", i); *emuPath = tmpPath; m_cfg.save(); @@ -175,8 +175,8 @@ bool CMenu::_checkSave(string id, bool nand) } else { - int emuPartition = m_cfg.getInt("GAMES", "savepartition", -1); - string emuPath = m_cfg.getString("GAMES", "savepath", ""); + int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); + string emuPath = m_cfg.getString(WII_DOMAIN, "savepath", ""); if(emuPartition < 0 || emuPath.size() == 0) return false; @@ -191,14 +191,14 @@ bool CMenu::_checkSave(string id, bool nand) void CMenu::_enableNandEmu(bool fromconfig) { _cfNeedsUpdate(); - bool disable = (m_cfg.getBool("NAND", "disable", true) || neek2o()) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; + bool disable = (m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) || neek2o()) && m_current_view == COVERFLOW_CHANNEL && !m_tempView; if(!disable) { bool isD2XnewerThanV6 = (CurrentIOS.Type == IOS_TYPE_NEEK2O); if(CurrentIOS.Revision > 6 && CurrentIOS.Type == IOS_TYPE_D2X) isD2XnewerThanV6 = true; - if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true) && !neek2o() && !m_tempView) + if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool(CHANNEL_DOMAIN, "disable", true) && !neek2o() && !m_tempView) NandHandle.Enable_Emu(); u8 limiter = 0; s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1; @@ -217,7 +217,7 @@ void CMenu::_enableNandEmu(bool fromconfig) } gprintf("Next item: %s\n", DeviceName[currentPartition]); if(m_tempView) - m_cfg.setInt("GAMES", "savepartition", currentPartition); + m_cfg.setInt(WII_DOMAIN, "savepartition", currentPartition); else m_cfg.setInt(_domainFromView(), "partition", currentPartition); } @@ -282,7 +282,7 @@ void CMenu::_showNandEmu(void) m_btnMgr.show(m_nandemuLblTitle); m_btnMgr.show(m_nandemuBtnBack); int i; - if(((m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true)) || m_current_view == COVERFLOW_USB) && !m_locked) + if(((m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)) || m_current_view == COVERFLOW_USB) && !m_locked) { m_btnMgr.show(m_nandemuLblEmulation); m_btnMgr.show(m_nandemuLblEmulationVal); @@ -299,12 +299,12 @@ void CMenu::_showNandEmu(void) m_btnMgr.show(m_nandemuBtnNandDump); if (m_current_view == COVERFLOW_CHANNEL) { - i = min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); + i = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); m_btnMgr.setText(m_nandemuLblEmulationVal, _t(CMenu::_NandEmu[i].id, CMenu::_NandEmu[i].text)); } else if (m_current_view == COVERFLOW_USB) { - i = min(max(0, m_cfg.getInt("GAMES", "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); + i = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); m_btnMgr.setText(m_nandemuLblEmulationVal, _t(CMenu::_GlobalSaveEmu[i].id, CMenu::_GlobalSaveEmu[i].text)); } } @@ -333,9 +333,9 @@ int CMenu::_NandEmuCfg(void) { s8 direction = m_btnMgr.selected(m_nandemuBtnEmulationP) ? 1 : -1; if(m_current_view == COVERFLOW_CHANNEL) - m_cfg.setInt("NAND", "emulation", (int)loopNum((u32)m_cfg.getInt("NAND", "emulation", 0) + direction, ARRAY_SIZE(CMenu::_NandEmu))); + m_cfg.setInt(CHANNEL_DOMAIN, "emulation", (int)loopNum((u32)m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 0) + direction, ARRAY_SIZE(CMenu::_NandEmu))); else if(m_current_view == COVERFLOW_USB) - m_cfg.setInt("GAMES", "save_emulation", (int)loopNum((u32)m_cfg.getInt("GAMES", "save_emulation", 0) + direction, ARRAY_SIZE(CMenu::_GlobalSaveEmu))); + m_cfg.setInt(WII_DOMAIN, "save_emulation", (int)loopNum((u32)m_cfg.getInt(WII_DOMAIN, "save_emulation", 0) + direction, ARRAY_SIZE(CMenu::_GlobalSaveEmu))); _showNandEmu(); } else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandDump) || m_btnMgr.selected(m_nandemuBtnAll) || m_btnMgr.selected(m_nandemuBtnMissing))) @@ -408,9 +408,9 @@ int CMenu::_NandEmuCfg(void) int CMenu::_FlashSave(string gameId) { - int emuPartition = m_cfg.getInt("GAMES", "savepartition", m_cfg.getInt("NAND", "partition", 0)); + int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition", m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0)); char basepath[MAX_FAT_PATH]; - snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], m_cfg.getString("GAMES", "savepath", m_cfg.getString("NAND", "path", "")).c_str()); + snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], m_cfg.getString(WII_DOMAIN, "savepath", m_cfg.getString(CHANNEL_DOMAIN, "path", "")).c_str()); if(!_checkSave(gameId, false)) return 0; @@ -486,9 +486,9 @@ int CMenu::_AutoExtractSave(string gameId) string emuPath; if(m_current_view == COVERFLOW_CHANNEL) - m_partRequest = m_cfg.getInt("NAND", "partition", -1); + m_partRequest = m_cfg.getInt(CHANNEL_DOMAIN, "partition", -1); else if(m_current_view == COVERFLOW_USB) - m_partRequest = m_cfg.getInt("GAMES", "savepartition", -1); + m_partRequest = m_cfg.getInt(WII_DOMAIN, "savepartition", -1); int emuPartition = _FindEmuPart(&emuPath, m_partRequest, false); if(emuPartition < 0) @@ -705,9 +705,9 @@ int CMenu::_NandFlasher(void *obj) char dest[ISFS_MAXPATH]; if(m.m_current_view == COVERFLOW_CHANNEL) - m.m_partRequest = m.m_cfg.getInt("NAND", "partition", -1); + m.m_partRequest = m.m_cfg.getInt(CHANNEL_DOMAIN, "partition", -1); else if(m.m_current_view == COVERFLOW_USB) - m.m_partRequest = m.m_cfg.getInt("GAMES", "savepartition", -1); + m.m_partRequest = m.m_cfg.getInt(WII_DOMAIN, "savepartition", -1); int emuPartition = m._FindEmuPart(&emuPath, m.m_partRequest, false); int flashID = m.m_saveExtGameId.c_str()[0] << 24 | m.m_saveExtGameId.c_str()[1] << 16 | m.m_saveExtGameId.c_str()[2] << 8 | m.m_saveExtGameId.c_str()[3]; @@ -751,9 +751,9 @@ int CMenu::_NandDumper(void *obj) NandHandle.ResetCounters(); if(m.m_current_view == COVERFLOW_CHANNEL) - m.m_partRequest = m.m_cfg.getInt("NAND", "partition", -1); + m.m_partRequest = m.m_cfg.getInt(CHANNEL_DOMAIN, "partition", -1); else if(m.m_current_view == COVERFLOW_USB) - m.m_partRequest = m.m_cfg.getInt("GAMES", "savepartition", -1); + m.m_partRequest = m.m_cfg.getInt(WII_DOMAIN, "savepartition", -1); emuPartition = m._FindEmuPart(&emuPath, m.m_partRequest, true); diff --git a/source/menu/menu_source.cpp b/source/menu/menu_source.cpp index aa21bfc1..48cfe2ca 100644 --- a/source/menu/menu_source.cpp +++ b/source/menu/menu_source.cpp @@ -171,10 +171,10 @@ bool CMenu::_Source() m_plugin.EndAdd(); SetupInput(); - bool show_homebrew = !m_cfg.getBool("HOMEBREW", "disable", false); + bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false); bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false); - bool show_emu = !m_cfg.getBool("EMULATOR", "disable", false); - bool parental_homebrew = m_cfg.getBool("HOMEBREW", "parental", false); + bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false); + bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false); bool imgSelected = false; m_showtimer = 0; Source_curPage = 1; @@ -293,7 +293,7 @@ bool CMenu::_Source() else { m_current_view = COVERFLOW_CHANNEL; - m_cfg.setBool("NAND", "disable", false); + m_cfg.setBool(CHANNEL_DOMAIN, "disable", false); imgSelected = true; break; } @@ -304,7 +304,7 @@ bool CMenu::_Source() else { m_current_view = COVERFLOW_CHANNEL; - m_cfg.setBool("NAND", "disable", true); + m_cfg.setBool(CHANNEL_DOMAIN, "disable", true); imgSelected = true; break; } @@ -358,10 +358,9 @@ bool CMenu::_Source() } } } - int layout = m_source.getInt(fmt("BUTTON_%i", i + j), "emuflow", 0); if(layout != 0) - m_cfg.setInt("EMULATOR", "last_cf_mode", layout); + m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout); break; } } diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index 7cf069c9..65151da1 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -157,11 +157,11 @@ int CMenu::_GCgameInstaller(void *obj) CMenu &m = *(CMenu *)obj; GCDump m_gcdump; - bool skip = m.m_cfg.getBool("DML", "skip_on_error", false); - bool comp = m.m_cfg.getBool("DML", "compressed_dump", false); - bool wexf = m.m_cfg.getBool("DML", "write_ex_files", true); - bool alig = m.m_cfg.getBool("DML", "force_32k_align_files", false); - u32 nretry = m.m_cfg.getUInt("DML", "num_retries", 5); + bool skip = m.m_cfg.getBool(GC_DOMAIN, "skip_on_error", false); + bool comp = m.m_cfg.getBool(GC_DOMAIN, "compressed_dump", false); + bool wexf = m.m_cfg.getBool(GC_DOMAIN, "write_ex_files", true); + bool alig = m.m_cfg.getBool(GC_DOMAIN, "force_32k_align_files", false); + u32 nretry = m.m_cfg.getUInt(GC_DOMAIN, "num_retries", 5); u32 rsize = 1048576; //1MB if(skip) diff --git a/source/music/gui_sound.h b/source/music/gui_sound.h index 3bd7517a..5ea10f12 100644 --- a/source/music/gui_sound.h +++ b/source/music/gui_sound.h @@ -89,7 +89,7 @@ private: //!Initializes the GuiSound object by setting the default values void Init(); protected: - char filepath[256]; + char filepath[1024]; /* Wasting Memory but who knows what people wanna load */ u8 *sound; //!< Pointer to the sound data u32 length; //!< Length of sound data s8 voice; //!< Currently assigned ASND voice channel diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 689945f6..7982ffc5 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -54,21 +54,21 @@ bool Plugin::AddPlugin(Config &plugin) return false; PluginOptions NewPlugin; - NewPlugin.DolName = plugin.getString(PLUGIN_DOMAIN, "dolFile"); - NewPlugin.coverFolder = plugin.getString(PLUGIN_DOMAIN, "coverFolder"); - NewPlugin.magicWord = strtoul(plugin.getString(PLUGIN_DOMAIN, "magic").c_str(), NULL, 16); - NewPlugin.caseColor = strtoul(plugin.getString(PLUGIN_DOMAIN, "coverColor").c_str(), NULL, 16); - NewPlugin.Args = plugin.getStrings(PLUGIN_DOMAIN, "arguments", '|'); - string PluginName = plugin.getString(PLUGIN_DOMAIN, "displayname"); + NewPlugin.DolName = plugin.getString(PLUGIN_INI_DEF, "dolFile"); + NewPlugin.coverFolder = plugin.getString(PLUGIN_INI_DEF, "coverFolder"); + NewPlugin.magicWord = strtoul(plugin.getString(PLUGIN_INI_DEF, "magic").c_str(), NULL, 16); + NewPlugin.caseColor = strtoul(plugin.getString(PLUGIN_INI_DEF, "coverColor").c_str(), NULL, 16); + NewPlugin.Args = plugin.getStrings(PLUGIN_INI_DEF, "arguments", '|'); + string PluginName = plugin.getString(PLUGIN_INI_DEF, "displayname"); if(PluginName.size() < 2) { PluginName = NewPlugin.DolName; PluginName.erase(PluginName.end() - 4, PluginName.end()); } NewPlugin.DisplayName.fromUTF8(PluginName.c_str()); - NewPlugin.consoleCoverID = plugin.getString(PLUGIN_DOMAIN,"consoleCoverID"); + NewPlugin.consoleCoverID = plugin.getString(PLUGIN_INI_DEF,"consoleCoverID"); - const char *bannerfilepath = fmt("%s/%s", pluginsDir.c_str(), plugin.getString(PLUGIN_DOMAIN,"bannerSound").c_str()); + const char *bannerfilepath = fmt("%s/%s", pluginsDir.c_str(), plugin.getString(PLUGIN_INI_DEF,"bannerSound").c_str()); FILE *fp = fopen(bannerfilepath, "rb"); if(fp != NULL) { @@ -154,11 +154,11 @@ void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode) { strncpy(PluginMagicWord, fmt("%08x", Plugins[pos].magicWord), 8); if(ForceMode == 1) - cfg.setBool(PLUGIN_DOMAIN, PluginMagicWord, false); + cfg.setBool(PLUGIN_INI_DEF, PluginMagicWord, false); else if(ForceMode == 2) - cfg.setBool(PLUGIN_DOMAIN, PluginMagicWord, true); + cfg.setBool(PLUGIN_INI_DEF, PluginMagicWord, true); else - cfg.setBool(PLUGIN_DOMAIN, PluginMagicWord, cfg.getBool(PLUGIN_DOMAIN, PluginMagicWord) ? false : true); + cfg.setBool(PLUGIN_INI_DEF, PluginMagicWord, cfg.getBool(PLUGIN_INI_DEF, PluginMagicWord) ? false : true); } } @@ -169,7 +169,7 @@ const vector &Plugin::GetEnabledPlugins(Config &cfg) for(u8 i = 0; i < Plugins.size(); i++) { strncpy(PluginMagicWord, fmt("%08x", Plugins[i].magicWord), 8); - if(cfg.getBool(PLUGIN_DOMAIN, PluginMagicWord, true)) + if(cfg.getBool(PLUGIN_INI_DEF, PluginMagicWord, true)) { enabledPluginsNumber++; enabledPlugins.push_back(true); @@ -207,7 +207,7 @@ vector Plugin::ParseScummvmINI(Config &ini, const char *Device, u32 continue; } memset((void*)&ListElement, 0, sizeof(dir_discHdr)); - strncpy((char*)ListElement.id, PLUGIN_DOMAIN, 6); + strncpy((char*)ListElement.id, PLUGIN_INI_DEF, 6); ListElement.casecolor = Plugins.back().caseColor; mbstowcs(ListElement.title, GameName.c_str(), 63); strncpy(ListElement.path, GameDomain->c_str(), sizeof(ListElement.path)); diff --git a/source/plugin/plugin.hpp b/source/plugin/plugin.hpp index f978a784..f6bf43da 100644 --- a/source/plugin/plugin.hpp +++ b/source/plugin/plugin.hpp @@ -31,7 +31,7 @@ using namespace std; #define TAG_LOC "{loc}" #define TAG_CONSOLE "{console}" -#define PLUGIN_DOMAIN "PLUGIN" +#define PLUGIN_INI_DEF "PLUGIN" #define PLUGIN_DEV "{device}" #define PLUGIN_PATH "{path}" #define PLUGIN_NAME "{name}"