mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
-horribly cleaned up and simplified the whole game list loading
code and process, should be faster now, also the list cache should take less space now -using "types" instead of magic word now for internal detection, faster and easier to handle -prepared wiiflows code for custom coverflow which can have all types together (nothing added yet)
This commit is contained in:
parent
452c8b4f46
commit
d12e9e84d6
@ -805,7 +805,7 @@ void Nand::CreatePath(const char *path, ...)
|
||||
|
||||
void Nand::CreateTitleTMD(const char *path, dir_discHdr *hdr)
|
||||
{
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->hdr.id, (char *)hdr->path);
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *)&hdr->id, (char *)hdr->path);
|
||||
if(!disc)
|
||||
return;
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#define APP_NAME "WiiFlow"
|
||||
#define APP_VERSION "Mod 3.1"
|
||||
|
||||
@ -50,8 +51,3 @@ Triiforce"
|
||||
|
||||
#define WIINNERTAG_URL "http://www.wiinnertag.com/wiinnertag_scripts/update_sign.php?key={KEY}&game_id={ID6}"
|
||||
#define DUTAG_URL "http://tag.darkumbra.net/{KEY}.update={ID6}"
|
||||
|
||||
#define WII_MAGIC 0x5D1C9EA3
|
||||
#define GC_MAGIC 0xC2339F3D
|
||||
#define PLUGIN_MAGIC 0x4C4F4C4F
|
||||
#define HB_MAGIC 0x484F4D45
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "libwbfs.h"
|
||||
#include "gecko/gecko.h"
|
||||
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
|
@ -6,10 +6,12 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <gccore.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "mem2.hpp"
|
||||
#include "gecko/gecko.h"
|
||||
#include "loader/disc.h"
|
||||
|
||||
#define wbfs_fatal(x) do { gprintf(x); wd_last_error = 1; } while(0)
|
||||
#define wbfs_error(x) do { gprintf(x); wd_last_error = 2; } while(0)
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "lockMutex.hpp"
|
||||
#include "fonts.h"
|
||||
#include "gecko.h"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
|
||||
extern const u8 dvdskin_png[];
|
||||
extern const u8 dvdskin_red_png[];
|
||||
@ -1348,7 +1348,7 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
|
||||
}
|
||||
if (dm == CCoverFlow::CFDR_NORMAL)
|
||||
{
|
||||
u32 casecolor = m_items[m_covers[i].index].hdr->hdr.casecolor;
|
||||
u32 casecolor = m_items[m_covers[i].index].hdr->casecolor;
|
||||
// set dvd box texture, depending on game
|
||||
if(casecolor == 0xFFFFFF)
|
||||
GX_InitTexObj(&texObj, m_dvdSkin.data.get(), m_dvdSkin.width, m_dvdSkin.height, m_dvdSkin.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
@ -1362,34 +1362,34 @@ void CCoverFlow::_drawCoverBox(int i, bool mirror, CCoverFlow::DrawMode dm)
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_GreenOne.data.get(), m_dvdSkin_GreenOne.width, m_dvdSkin_GreenOne.height, m_dvdSkin_GreenOne.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
else if (casecolor == 0x00E360)
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_GreenTwo.data.get(), m_dvdSkin_GreenTwo.width, m_dvdSkin_GreenTwo.height, m_dvdSkin_GreenTwo.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->hdr.id,red,red_len))
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,red,red_len))
|
||||
{
|
||||
m_items[m_covers[i].index].hdr->hdr.casecolor = 0xFF0000;
|
||||
m_items[m_covers[i].index].hdr->casecolor = 0xFF0000;
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_Red.data.get(), m_dvdSkin_Red.width, m_dvdSkin_Red.height, m_dvdSkin_Red.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->hdr.id,black,black_len))
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,black,black_len))
|
||||
{
|
||||
m_items[m_covers[i].index].hdr->hdr.casecolor = 0x000000;
|
||||
m_items[m_covers[i].index].hdr->casecolor = 0x000000;
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_Black.data.get(), m_dvdSkin_Black.width, m_dvdSkin_Black.height, m_dvdSkin_Black.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->hdr.id,yellow,yellow_len))
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,yellow,yellow_len))
|
||||
{
|
||||
m_items[m_covers[i].index].hdr->hdr.casecolor = 0xFCFF00;
|
||||
m_items[m_covers[i].index].hdr->casecolor = 0xFCFF00;
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_Yellow.data.get(), m_dvdSkin_Yellow.width, m_dvdSkin_Yellow.height, m_dvdSkin_Yellow.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->hdr.id,greenOne,greenOne_len))
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,greenOne,greenOne_len))
|
||||
{
|
||||
m_items[m_covers[i].index].hdr->hdr.casecolor = 0x01A300;
|
||||
m_items[m_covers[i].index].hdr->casecolor = 0x01A300;
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_GreenOne.data.get(), m_dvdSkin_GreenOne.width, m_dvdSkin_GreenOne.height, m_dvdSkin_GreenOne.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->hdr.id,greenTwo,greenTwo_len))
|
||||
else if(_checkCoverColor((char *)m_items[m_covers[i].index].hdr->id,greenTwo,greenTwo_len))
|
||||
{
|
||||
m_items[m_covers[i].index].hdr->hdr.casecolor = 0x00E360;
|
||||
m_items[m_covers[i].index].hdr->casecolor = 0x00E360;
|
||||
GX_InitTexObj(&texObj, m_dvdSkin_GreenTwo.data.get(), m_dvdSkin_GreenTwo.width, m_dvdSkin_GreenTwo.height, m_dvdSkin_GreenTwo.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_items[m_covers[i].index].hdr->hdr.casecolor = 0xFFFFFF;
|
||||
m_items[m_covers[i].index].hdr->casecolor = 0xFFFFFF;
|
||||
GX_InitTexObj(&texObj, m_dvdSkin.data.get(), m_dvdSkin.width, m_dvdSkin.height, m_dvdSkin.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
@ -1460,13 +1460,13 @@ void CCoverFlow::_loadCover(int i, int item)
|
||||
string CCoverFlow::getId(void) const
|
||||
{
|
||||
if (m_covers.empty() || m_items.empty()) return "";
|
||||
return string((char *) &m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->hdr.id);
|
||||
return string(m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->id);
|
||||
}
|
||||
|
||||
string CCoverFlow::getNextId(void) const
|
||||
{
|
||||
if (m_covers.empty() || m_items.empty()) return "";
|
||||
return string((char *) &m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr->hdr.id);
|
||||
return string((char *) &m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr->id);
|
||||
}
|
||||
|
||||
dir_discHdr * CCoverFlow::getHdr(void) const
|
||||
@ -1492,7 +1492,7 @@ u64 CCoverFlow::getChanTitle(void) const
|
||||
{
|
||||
if (m_covers.empty() || m_items.empty()) return 0;
|
||||
|
||||
return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->hdr.chantitle;
|
||||
return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->chantitle;
|
||||
}
|
||||
|
||||
|
||||
@ -1736,16 +1736,16 @@ bool CCoverFlow::_sortByLastPlayed(CItem item1, CItem item2)
|
||||
|
||||
bool CCoverFlow::_sortByGameID(CItem item1, CItem item2)
|
||||
{
|
||||
u32 s = min(strlen((char *) &item1.hdr->hdr.id), strlen((char *) &item2.hdr->hdr.id));
|
||||
u32 s = min(strlen((char *) &item1.hdr->id), strlen((char *) &item2.hdr->id));
|
||||
for (u32 k = 0; k < s; ++k)
|
||||
{
|
||||
if (toupper(item1.hdr->hdr.id[k]) > toupper(item2.hdr->hdr.id[k]))
|
||||
if (toupper(item1.hdr->id[k]) > toupper(item2.hdr->id[k]))
|
||||
return false;
|
||||
else if (toupper(item1.hdr->hdr.id[k]) < toupper(item2.hdr->hdr.id[k]))
|
||||
else if (toupper(item1.hdr->id[k]) < toupper(item2.hdr->id[k]))
|
||||
return true;
|
||||
}
|
||||
|
||||
return strlen((char *) &item1.hdr->hdr.id) < strlen((char *) &item2.hdr->hdr.id);
|
||||
return strlen((char *) &item1.hdr->id) < strlen((char *) &item2.hdr->id);
|
||||
}
|
||||
|
||||
bool CCoverFlow::_sortByAlpha(CItem item1, CItem item2)
|
||||
@ -1769,14 +1769,14 @@ bool CCoverFlow::_sortByAlpha(CItem item1, CItem item2)
|
||||
|
||||
bool CCoverFlow::_sortByPlayers(CItem item1, CItem item2)
|
||||
{
|
||||
if(item1.hdr->hdr.players == item2.hdr->hdr.players) return _sortByAlpha(item1, item2);
|
||||
return item1.hdr->hdr.players < item2.hdr->hdr.players;
|
||||
if(item1.hdr->players == item2.hdr->players) return _sortByAlpha(item1, item2);
|
||||
return item1.hdr->players < item2.hdr->players;
|
||||
}
|
||||
|
||||
bool CCoverFlow::_sortByWifiPlayers(CItem item1, CItem item2)
|
||||
{
|
||||
if(item1.hdr->hdr.wifi == item2.hdr->hdr.wifi) return _sortByAlpha(item1, item2);
|
||||
return item1.hdr->hdr.wifi < item2.hdr->hdr.wifi;
|
||||
if(item1.hdr->wifi == item2.hdr->wifi) return _sortByAlpha(item1, item2);
|
||||
return item1.hdr->wifi < item2.hdr->wifi;
|
||||
}
|
||||
|
||||
bool CCoverFlow::start(const char *id)
|
||||
@ -2014,7 +2014,7 @@ bool CCoverFlow::findId(const char *id, bool instant)
|
||||
return false;
|
||||
//
|
||||
for (i = 0; i < m_items.size(); ++i)
|
||||
if (memcmp(&m_items[i].hdr->hdr.id, id, strlen(id)) == 0)
|
||||
if (memcmp(&m_items[i].hdr->id, id, strlen(id)) == 0)
|
||||
break;
|
||||
else if (strlen(id) > 6 && memcmp(&m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], id, strlen(id)) == 0)
|
||||
break;
|
||||
@ -2256,16 +2256,16 @@ void CCoverFlow::nextPlayers(bool wifi, wchar_t *c)
|
||||
|
||||
_completeJump();
|
||||
u32 curPos = _currentPos();
|
||||
int players = wifi ? m_items[curPos].hdr->hdr.wifi : m_items[curPos].hdr->hdr.players;
|
||||
int players = wifi ? m_items[curPos].hdr->wifi : m_items[curPos].hdr->players;
|
||||
|
||||
for (i = 1; i < n; ++i)
|
||||
if ((wifi ? m_items[loopNum(curPos + i, n)].hdr->hdr.wifi : m_items[loopNum(curPos + i, n)].hdr->hdr.players) != players)
|
||||
if ((wifi ? m_items[loopNum(curPos + i, n)].hdr->wifi : m_items[loopNum(curPos + i, n)].hdr->players) != players)
|
||||
break;
|
||||
|
||||
if (i < n)
|
||||
{
|
||||
_setJump(i);
|
||||
players = wifi ? m_items[loopNum(curPos + i, n)].hdr->hdr.wifi : m_items[loopNum(curPos + i, n)].hdr->hdr.players;
|
||||
players = wifi ? m_items[loopNum(curPos + i, n)].hdr->wifi : m_items[loopNum(curPos + i, n)].hdr->players;
|
||||
}
|
||||
|
||||
char p[4] = {0 ,0 ,0 ,0};
|
||||
@ -2282,13 +2282,13 @@ void CCoverFlow::prevPlayers(bool wifi, wchar_t *c)
|
||||
|
||||
_completeJump();
|
||||
u32 curPos = _currentPos();
|
||||
int players = wifi ? m_items[curPos].hdr->hdr.wifi : m_items[curPos].hdr->hdr.players;
|
||||
int players = wifi ? m_items[curPos].hdr->wifi : m_items[curPos].hdr->players;
|
||||
|
||||
for (i = 1; i < n; ++i)
|
||||
if ((wifi ? m_items[loopNum(curPos - i, n)].hdr->hdr.wifi : m_items[loopNum(curPos - i, n)].hdr->hdr.players) != players)
|
||||
if ((wifi ? m_items[loopNum(curPos - i, n)].hdr->wifi : m_items[loopNum(curPos - i, n)].hdr->players) != players)
|
||||
{
|
||||
players = wifi ? m_items[loopNum(curPos - i, n)].hdr->hdr.wifi : m_items[loopNum(curPos - i, n)].hdr->hdr.players;
|
||||
while(i < n && (wifi ? m_items[loopNum(curPos - i, n)].hdr->hdr.wifi : m_items[loopNum(curPos - i, n)].hdr->hdr.players) == players) ++i;
|
||||
players = wifi ? m_items[loopNum(curPos - i, n)].hdr->wifi : m_items[loopNum(curPos - i, n)].hdr->players;
|
||||
while(i < n && (wifi ? m_items[loopNum(curPos - i, n)].hdr->wifi : m_items[loopNum(curPos - i, n)].hdr->players) == players) ++i;
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
@ -2296,7 +2296,7 @@ void CCoverFlow::prevPlayers(bool wifi, wchar_t *c)
|
||||
if (i < n)
|
||||
{
|
||||
_setJump(-i);
|
||||
players = wifi ? m_items[loopNum(curPos - i, n)].hdr->hdr.wifi : m_items[loopNum(curPos - i, n)].hdr->hdr.players;
|
||||
players = wifi ? m_items[loopNum(curPos - i, n)].hdr->wifi : m_items[loopNum(curPos - i, n)].hdr->players;
|
||||
}
|
||||
|
||||
char p[4] = {0 ,0 ,0 ,0};
|
||||
@ -2313,16 +2313,16 @@ void CCoverFlow::nextID(wchar_t *c)
|
||||
|
||||
_completeJump();
|
||||
u32 curPos = _currentPos();
|
||||
char *system = (char *)m_items[curPos].hdr->hdr.id;
|
||||
char *system = (char *)m_items[curPos].hdr->id;
|
||||
|
||||
for (i = 1; i < n; ++i)
|
||||
if ((char)m_items[loopNum(curPos + i, n)].hdr->hdr.id[0] != system[0])
|
||||
if ((char)m_items[loopNum(curPos + i, n)].hdr->id[0] != system[0])
|
||||
break;
|
||||
|
||||
if (i < n)
|
||||
{
|
||||
_setJump(i);
|
||||
system = (char *)m_items[loopNum(curPos + i, n)].hdr->hdr.id;
|
||||
system = (char *)m_items[loopNum(curPos + i, n)].hdr->id;
|
||||
}
|
||||
|
||||
system[1] = '\0';
|
||||
@ -2338,13 +2338,13 @@ void CCoverFlow::prevID(wchar_t *c)
|
||||
|
||||
_completeJump();
|
||||
u32 curPos = _currentPos();
|
||||
char *system = (char *)m_items[curPos].hdr->hdr.id;
|
||||
char *system = (char *)m_items[curPos].hdr->id;
|
||||
|
||||
for (i = 1; i < n; ++i)
|
||||
if ((char)m_items[loopNum(curPos - i, n)].hdr->hdr.id[0] != system[0])
|
||||
if ((char)m_items[loopNum(curPos - i, n)].hdr->id[0] != system[0])
|
||||
{
|
||||
system = (char *)m_items[loopNum(curPos - i, n)].hdr->hdr.id;
|
||||
while(i < n && (char)m_items[loopNum(curPos - i, n)].hdr->hdr.id[0] == system[0]) ++i;
|
||||
system = (char *)m_items[loopNum(curPos - i, n)].hdr->id;
|
||||
while(i < n && (char)m_items[loopNum(curPos - i, n)].hdr->id[0] == system[0]) ++i;
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
@ -2352,7 +2352,7 @@ void CCoverFlow::prevID(wchar_t *c)
|
||||
if (i < n)
|
||||
{
|
||||
_setJump(-i);
|
||||
system = (char *)m_items[loopNum(curPos - i, n)].hdr->hdr.id;
|
||||
system = (char *)m_items[loopNum(curPos - i, n)].hdr->id;
|
||||
}
|
||||
|
||||
system[1] = '\0';
|
||||
@ -2555,14 +2555,14 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq)
|
||||
if (!!zBuffer && (!m_compressCache || compress(zBuffer.get(), &zBufferSize, tex.data.get(), bufSize) == Z_OK))
|
||||
{
|
||||
char gamePath[256];
|
||||
if(NoGameID(m_items[i].hdr->hdr.gc_magic))
|
||||
if(NoGameID(m_items[i].hdr->type))
|
||||
{
|
||||
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos)
|
||||
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath));
|
||||
else
|
||||
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath));
|
||||
}
|
||||
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->hdr.gc_magic) ? gamePath : (char*)m_items[i].hdr->hdr.id)), "wb");
|
||||
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->type) ? gamePath : (char*)m_items[i].hdr->id)), "wb");
|
||||
if (file != 0)
|
||||
{
|
||||
SWFCHeader header(tex, box, m_compressCache);
|
||||
@ -2630,14 +2630,14 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq)
|
||||
if(!m_cachePath.empty())
|
||||
{
|
||||
char gamePath[256];
|
||||
if(NoGameID(m_items[i].hdr->hdr.gc_magic))
|
||||
if(NoGameID(m_items[i].hdr->type))
|
||||
{
|
||||
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos)
|
||||
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath));
|
||||
else
|
||||
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath));
|
||||
}
|
||||
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->hdr.gc_magic) ? gamePath : (char*)m_items[i].hdr->hdr.id)), "rb");
|
||||
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->type) ? gamePath : (char*)m_items[i].hdr->id)), "rb");
|
||||
if(file != 0)
|
||||
{
|
||||
bool success = false;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "gecko.h"
|
||||
#include "GameTDB.hpp"
|
||||
#include "config.hpp"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
#include "channels.h"
|
||||
#include "gc.h"
|
||||
#include "fileOps.h"
|
||||
@ -92,11 +92,13 @@ void CList<T>::GetPaths(vector<string> &pathlist, string containing, string dire
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strcasestr(containing.c_str(), ".dol") != 0) return;
|
||||
if(strcasestr(containing.c_str(), ".dol") != 0)
|
||||
return;
|
||||
|
||||
int partition = DeviceHandler::Instance()->PathToDriveType(directory.c_str());
|
||||
wbfs_t* handle = DeviceHandler::Instance()->GetWbfsHandle(partition);
|
||||
if (!handle) return;
|
||||
if(!handle)
|
||||
return;
|
||||
|
||||
u32 count = wbfs_count_discs(handle);
|
||||
for(u32 i = 0; i < count; i++)
|
||||
@ -109,7 +111,9 @@ void CList<string>::GetHeaders(vector<string> pathlist, vector<string> &headerli
|
||||
{
|
||||
//gprintf("Getting headers for CList<string>\n");
|
||||
|
||||
if(pathlist.size() < 1) return;
|
||||
if(pathlist.size() < 1)
|
||||
return;
|
||||
|
||||
headerlist.reserve(pathlist.size() + headerlist.size());
|
||||
|
||||
for(vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++)
|
||||
@ -119,9 +123,10 @@ void CList<string>::GetHeaders(vector<string> pathlist, vector<string> &headerli
|
||||
template <>
|
||||
void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr> &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin)
|
||||
{
|
||||
if(pathlist.size() < 1) return;
|
||||
headerlist.reserve(pathlist.size() + headerlist.size());
|
||||
if(pathlist.size() < 1)
|
||||
return;
|
||||
|
||||
headerlist.reserve(pathlist.size() + headerlist.size());
|
||||
gprintf("Getting headers for paths in pathlist (%d)\n", pathlist.size());
|
||||
|
||||
dir_discHdr tmp;
|
||||
@ -129,14 +134,14 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
string GTitle;
|
||||
|
||||
Config custom_titles;
|
||||
if (settingsDir.size() > 0)
|
||||
if(settingsDir.size() > 0)
|
||||
{
|
||||
string custom_titles_path = sfmt("%s/" CTITLES_FILENAME, settingsDir.c_str());
|
||||
custom_titles.load(custom_titles_path.c_str());
|
||||
}
|
||||
|
||||
GameTDB gameTDB;
|
||||
if (settingsDir.size() > 0)
|
||||
if(settingsDir.size() > 0)
|
||||
{
|
||||
gameTDB.OpenFile(fmt("%s/wiitdb.xml", settingsDir.c_str()));
|
||||
if(curLanguage.size() == 0) curLanguage = "EN";
|
||||
@ -145,10 +150,10 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
|
||||
for(vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++)
|
||||
{
|
||||
bzero(&tmp, sizeof(dir_discHdr));
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
|
||||
tmp.hdr.index = headerlist.size();
|
||||
tmp.hdr.casecolor = 1;
|
||||
tmp.index = headerlist.size();
|
||||
tmp.casecolor = 1;
|
||||
|
||||
bool wbfs = (*itr).rfind(".wbfs") != string::npos || (*itr).rfind(".WBFS") != string::npos;
|
||||
|
||||
@ -162,26 +167,23 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
if(lowerCase(*itr).rfind((*type_itr).c_str()) != string::npos)
|
||||
{
|
||||
strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
|
||||
strncpy((char*)tmp.hdr.id, "PLUGIN", sizeof(tmp.hdr.id));
|
||||
|
||||
int plugin_ccolor;
|
||||
sscanf(plugin.getString("PLUGIN","coverColor","").c_str(), "%08x", &plugin_ccolor);
|
||||
int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, plugin_ccolor).intVal();
|
||||
tmp.hdr.casecolor = ccolor != plugin_ccolor ? ccolor : plugin_ccolor;
|
||||
strncpy(tmp.id, "PLUGIN", sizeof(tmp.id));
|
||||
sscanf(plugin.getString("PLUGIN","coverColor","").c_str(), "%08x", &tmp.casecolor);
|
||||
|
||||
char tempname[64];
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
if((*itr).find_last_of('.') != string::npos)
|
||||
(*itr).erase((*itr).find_last_of('.'), (*itr).size() - (*itr).find_last_of('.'));
|
||||
strncpy(tempname, (*itr).c_str(), sizeof(tempname));
|
||||
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8(tempname);
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
|
||||
gprintf("Found: %s\n", tmp.path);
|
||||
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &tmp.hdr.magic); //Plugin magic
|
||||
tmp.hdr.gc_magic = PLUGIN_MAGIC; //Abusing gc_magic for general emu detection ;)
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &tmp.plugin_magic); //Plugin magic
|
||||
tmp.type = TYPE_PLUGIN;
|
||||
headerlist.push_back(tmp);
|
||||
break;
|
||||
}
|
||||
@ -189,7 +191,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (wbfs || (*itr).rfind(".iso") != string::npos || (*itr).rfind(".ISO") != string::npos
|
||||
else if(wbfs || (*itr).rfind(".iso") != string::npos || (*itr).rfind(".ISO") != string::npos
|
||||
|| (*itr).rfind(".bin") != string::npos || (*itr).rfind(".BIN") != string::npos)
|
||||
{
|
||||
char* filename = &(*itr)[(*itr).find_last_of('/')+1];
|
||||
@ -197,220 +199,191 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
||||
if((strcasecmp(filename, "game.iso") == 0 || strcasecmp(filename, "boot.bin") == 0) && strstr((*itr).c_str(), sfmt((strncmp(dml_partition, "sd", 2) != 0) ? DMLgameUSBDir.c_str() : DML_DIR, dml_partition).c_str()) != NULL)
|
||||
{
|
||||
FILE *fp = fopen((*itr).c_str(), "rb");
|
||||
if( fp )
|
||||
if(fp)
|
||||
{
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
fread( tmp.hdr.id, 1, 6, fp );
|
||||
|
||||
u8 gc_disc[1];
|
||||
|
||||
fseek(fp, 6, SEEK_SET);
|
||||
fread(gc_disc, 1, 1, fp);
|
||||
|
||||
GTitle = custom_titles.getString( "TITLES", (const char *) tmp.hdr.id );
|
||||
int ccolor = custom_titles.getColor( "COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor ).intVal();
|
||||
|
||||
if( GTitle.size() > 0 || ( gameTDB.IsLoaded() && gameTDB.GetTitle( (char *)tmp.hdr.id, GTitle ) ) )
|
||||
{
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
if(gc_disc[0])
|
||||
wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
|
||||
|
||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor( (char *)tmp.hdr.id );
|
||||
if( tmp.hdr.casecolor == 0xffffffff )
|
||||
tmp.hdr.casecolor = 0;
|
||||
|
||||
tmp.hdr.gc_magic = GC_MAGIC;
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
if(strcasecmp(filename, "boot.bin") == 0)
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
strcpy( tmp.path, (*itr).c_str() );
|
||||
|
||||
if(strncmp(dml_partition, "sd", 2) != 0)
|
||||
{
|
||||
if (GC_GameIsInstalled((char*)tmp.hdr.id, DeviceName[SD], DML_DIR) || GC_GameIsInstalled((char*)fmt("%s [%s]", tmp.hdr.title, (char *)tmp.hdr.id), DeviceName[SD], DML_DIR) || GC_GameIsInstalled(tmp.path, DeviceName[SD], DML_DIR))
|
||||
wcslcat(tmp.title, L" \n(on SD)", sizeof(tmp.title));
|
||||
}
|
||||
|
||||
gprintf("Found: %s\n", tmp.path);
|
||||
headerlist.push_back( tmp );
|
||||
continue;
|
||||
}
|
||||
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
fread( &tmp.hdr, sizeof( discHdr ), 1, fp);
|
||||
discHdr gc_hdr;
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
fread(&gc_hdr, sizeof(discHdr), 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
if (tmp.hdr.gc_magic == GC_MAGIC)
|
||||
{
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8((const char *)tmp.hdr.title);
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
if(gc_disc[0])
|
||||
wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
|
||||
|
||||
tmp.hdr.casecolor = 0;
|
||||
if(gc_hdr.gc_magic == GC_MAGIC)
|
||||
{
|
||||
strncpy(tmp.id, (char*)gc_hdr.id, 6);
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
if(strcasecmp(filename, "boot.bin") == 0)
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
strcpy( tmp.path, (*itr).c_str() );
|
||||
strcpy(tmp.path, (*itr).c_str());
|
||||
GTitle = custom_titles.getString("TITLES", tmp.id);
|
||||
tmp.casecolor = 0;
|
||||
int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
|
||||
|
||||
wstringEx tmpString;
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
|
||||
{
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
tmp.casecolor = ccolor != 0 ? ccolor : gameTDB.GetCaseColor(tmp.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpString.fromUTF8(gc_hdr.title);
|
||||
tmp.casecolor = ccolor;
|
||||
}
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
if(gc_disc[0])
|
||||
wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
|
||||
if(strncmp(dml_partition, "sd", 2) != 0)
|
||||
{
|
||||
if (GC_GameIsInstalled((char*)tmp.hdr.id, DeviceName[SD], DML_DIR) || GC_GameIsInstalled((char*)fmt("%s [%s]", tmp.hdr.title, (char *)tmp.hdr.id), DeviceName[SD], DML_DIR) || GC_GameIsInstalled(tmp.path, DeviceName[SD], DML_DIR))
|
||||
if(GC_GameIsInstalled(tmp.id, DeviceName[SD], DML_DIR) || GC_GameIsInstalled((char*)fmt("%s [%s]", tmp.title, tmp.id), DeviceName[SD], DML_DIR) || GC_GameIsInstalled(tmp.path, DeviceName[SD], DML_DIR))
|
||||
wcslcat(tmp.title, L" \n(on SD)", sizeof(tmp.title));
|
||||
}
|
||||
Asciify(tmp.title);
|
||||
|
||||
gprintf("Found: %s\n", tmp.path);
|
||||
headerlist.push_back( tmp );
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.type = TYPE_GC_GAME;
|
||||
headerlist.push_back(tmp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Check_For_ID(tmp.hdr.id, (*itr).c_str(), "[", "]"); /* [GAMEID] Title, [GAMEID]_Title, Title [GAMEID], Title_[GAMEID] */
|
||||
if(tmp.hdr.id[0] == 0)
|
||||
Check_For_ID(tmp.id, (*itr).c_str(), "[", "]"); /* [GAMEID] Title, [GAMEID]_Title, Title [GAMEID], Title_[GAMEID] */
|
||||
if(tmp.id[0] == 0)
|
||||
{
|
||||
Check_For_ID(tmp.hdr.id, (*itr).c_str(), "/", "."); /* GAMEID.wbfs, GAMEID.iso */
|
||||
if(tmp.hdr.id[0] == 0)
|
||||
Check_For_ID(tmp.id, (*itr).c_str(), "/", "."); /* GAMEID.wbfs, GAMEID.iso */
|
||||
if(tmp.id[0] == 0)
|
||||
{
|
||||
Check_For_ID(tmp.hdr.id, (*itr).c_str(), "/", "_"); /* GAMEID_Title */
|
||||
if(tmp.hdr.id[0] == 0)
|
||||
Check_For_ID(tmp.id, (*itr).c_str(), "/", "_"); /* GAMEID_Title */
|
||||
if(tmp.id[0] == 0)
|
||||
{
|
||||
Check_For_ID(tmp.hdr.id, (*itr).c_str(), "_", "."); /* Title_GAMEID */ // <-- Unsafe?
|
||||
if(tmp.hdr.id[0] == 0)
|
||||
Check_For_ID(tmp.hdr.id, (*itr).c_str(), " ", "."); /* Title GAMEID */ //<-- Unsafe?
|
||||
Check_For_ID(tmp.id, (*itr).c_str(), "_", "."); /* Title_GAMEID */ // <-- Unsafe?
|
||||
if(tmp.id[0] == 0)
|
||||
Check_For_ID(tmp.id, (*itr).c_str(), " ", "."); /* Title GAMEID */ //<-- Unsafe?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isalnum(tmp.hdr.id[0]) || tmp.hdr.id[0] == 0 || memcmp(tmp.hdr.id, "__CFG_", sizeof tmp.hdr.id) == 0)
|
||||
if(!isalnum(tmp.id[0]) || tmp.id[0] == 0 || memcmp(tmp.id, "__CFG_", sizeof tmp.id) == 0)
|
||||
{
|
||||
gprintf("Skipping file: '%s'\n", (*itr).c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get info from custom titles
|
||||
GTitle = custom_titles.getString("TITLES", (const char *) tmp.hdr.id);
|
||||
int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor).intVal();
|
||||
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle((char *)tmp.hdr.id, GTitle)))
|
||||
{
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor((char *)tmp.hdr.id);
|
||||
|
||||
tmp.hdr.wifi = gameTDB.GetWifiPlayers((char *)tmp.hdr.id);
|
||||
tmp.hdr.players = gameTDB.GetPlayers((char *)tmp.hdr.id);
|
||||
//tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id);
|
||||
|
||||
tmp.hdr.magic = WII_MAGIC;
|
||||
headerlist.push_back(tmp);
|
||||
continue;
|
||||
}
|
||||
|
||||
discHdr wii_hdr;
|
||||
FILE *fp = fopen((*itr).c_str(), "rb");
|
||||
if (fp)
|
||||
if(fp)
|
||||
{
|
||||
fseek(fp, wbfs ? 512 : 0, SEEK_SET);
|
||||
fread(&tmp.hdr, sizeof(discHdr), 1, fp);
|
||||
fread(&wii_hdr, sizeof(discHdr), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
if (tmp.hdr.magic == WII_MAGIC)
|
||||
if(wii_hdr.magic == WII_MAGIC)
|
||||
{
|
||||
strncpy(tmp.id, (char*)wii_hdr.id, 6);
|
||||
GTitle = custom_titles.getString("TITLES", tmp.id);
|
||||
int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
|
||||
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8((const char *)tmp.hdr.title);
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
|
||||
{
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
tmp.wifi = gameTDB.GetWifiPlayers(tmp.id);
|
||||
tmp.players = gameTDB.GetPlayers(tmp.id);
|
||||
tmp.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor(tmp.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpString.fromUTF8(wii_hdr.title);
|
||||
tmp.casecolor = ccolor;
|
||||
}
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
|
||||
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.type = TYPE_WII_GAME;
|
||||
headerlist.push_back(tmp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if((*itr).rfind(".dol") != string::npos || (*itr).rfind(".DOL") != string::npos
|
||||
|| (*itr).rfind(".elf") != string::npos || (*itr).rfind(".ELF") != string::npos)
|
||||
{
|
||||
char *filename = &(*itr)[(*itr).find_last_of('/')+1];
|
||||
strncpy((char*)tmp.hdr.id, "HB_APP", sizeof(tmp.hdr.id));
|
||||
|
||||
if(strcasecmp(filename, "boot.dol") != 0 && strcasecmp(filename, "boot.elf") != 0) continue;
|
||||
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
|
||||
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
char foldername[64];
|
||||
strncpy(foldername, (*itr).c_str(), sizeof(foldername));
|
||||
gprintf("Found: %s\n", foldername);
|
||||
|
||||
// Get info from custom titles
|
||||
wstringEx tmpString;
|
||||
GTitle = custom_titles.getString("TITLES", (const char *)foldername);
|
||||
int ccolor = custom_titles.getColor("COVERS", (const char *)foldername, tmp.hdr.casecolor).intVal();
|
||||
if(GTitle.size() > 0)
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
else
|
||||
tmpString.fromUTF8(foldername);
|
||||
|
||||
tmp.hdr.casecolor = ccolor;
|
||||
tmp.hdr.gc_magic = HB_MAGIC;
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
headerlist.push_back(tmp);
|
||||
continue;
|
||||
}
|
||||
else if(strncasecmp(DeviceHandler::Instance()->PathToFSName((*itr).c_str()), "WBFS", 4) == 0)
|
||||
{
|
||||
u8 partition = DeviceHandler::Instance()->PathToDriveType((*itr).c_str());
|
||||
wbfs_t* handle = DeviceHandler::Instance()->GetWbfsHandle(partition);
|
||||
if (!handle)
|
||||
if(!handle)
|
||||
return;
|
||||
|
||||
s32 ret = wbfs_get_disc_info(handle, count, (u8 *)&tmp.hdr, sizeof(struct discHdr), NULL);
|
||||
discHdr wbfs_hdr;
|
||||
s32 ret = wbfs_get_disc_info(handle, count, (u8 *)&wbfs_hdr, sizeof(struct discHdr), NULL);
|
||||
count++;
|
||||
if(ret != 0)
|
||||
continue;
|
||||
|
||||
GTitle = custom_titles.getString("TITLES", (const char *) tmp.hdr.id);
|
||||
int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, 1).intVal();
|
||||
|
||||
wstringEx tmpString;
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle((char *)tmp.hdr.id, GTitle)))
|
||||
if(wbfs_hdr.magic == WII_MAGIC)
|
||||
{
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor((char *)tmp.hdr.id);
|
||||
tmp.hdr.wifi = gameTDB.GetWifiPlayers((char *)tmp.hdr.id);
|
||||
tmp.hdr.players = gameTDB.GetPlayers((char *)tmp.hdr.id);
|
||||
strncpy(tmp.id, (char*)wbfs_hdr.id, 6);
|
||||
GTitle = custom_titles.getString("TITLES", tmp.id);
|
||||
int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
|
||||
|
||||
//tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id);
|
||||
if (tmp.hdr.magic == WII_MAGIC)
|
||||
wstringEx tmpString;
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
|
||||
{
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
headerlist.push_back(tmp);
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
tmp.wifi = gameTDB.GetWifiPlayers(tmp.id);
|
||||
tmp.players = gameTDB.GetPlayers(tmp.id);
|
||||
tmp.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor(tmp.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpString.fromUTF8((const char *)wbfs_hdr.title);
|
||||
tmp.casecolor = ccolor;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tmp.hdr.magic == WII_MAGIC)
|
||||
{
|
||||
tmpString.fromUTF8((const char *)tmp.hdr.title);
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : 1;
|
||||
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.type = TYPE_WII_GAME;
|
||||
headerlist.push_back(tmp);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if((*itr).rfind(".dol") != string::npos || (*itr).rfind(".DOL") != string::npos
|
||||
|| (*itr).rfind(".elf") != string::npos || (*itr).rfind(".ELF") != string::npos)
|
||||
{
|
||||
char *filename = &(*itr)[(*itr).find_last_of('/')+1];
|
||||
if(strcasecmp(filename, "boot.dol") != 0 && strcasecmp(filename, "boot.elf") != 0)
|
||||
continue;
|
||||
|
||||
strncpy(tmp.id, "HB_APP", sizeof(tmp.id));
|
||||
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
|
||||
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
char homebrewtitle[64];
|
||||
strncpy(homebrewtitle, (*itr).c_str(), sizeof(homebrewtitle));
|
||||
|
||||
tmp.casecolor = custom_titles.getColor("COVERS", homebrewtitle, tmp.casecolor).intVal();
|
||||
|
||||
wstringEx tmpString;
|
||||
GTitle = custom_titles.getString("TITLES", homebrewtitle);
|
||||
if(GTitle.size() > 0)
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
else
|
||||
tmpString.fromUTF8(homebrewtitle);
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.type = TYPE_HOMEBREW;
|
||||
headerlist.push_back(tmp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(gameTDB.IsLoaded())
|
||||
@ -446,34 +419,37 @@ void CList<dir_discHdr>::GetChannels(vector<dir_discHdr> &headerlist, string set
|
||||
{
|
||||
Channel *chan = m_channels.GetChannel(i);
|
||||
|
||||
if (chan->id == NULL)
|
||||
if(chan->id == NULL)
|
||||
continue; // Skip invalid channels
|
||||
|
||||
dir_discHdr tmp;
|
||||
bzero(&tmp, sizeof(dir_discHdr));
|
||||
tmp.hdr.index = headerlist.size();
|
||||
tmp.hdr.casecolor = 1;
|
||||
tmp.index = headerlist.size();
|
||||
tmp.casecolor = 1;
|
||||
|
||||
memcpy(tmp.hdr.id, chan->id, 4);
|
||||
memcpy(tmp.title, chan->name, sizeof(tmp.title));
|
||||
string GTitle = custom_titles.getString("TITLES", (const char *) tmp.hdr.id);
|
||||
int ccolor = custom_titles.getColor("COVERS", (const char *) tmp.hdr.id, tmp.hdr.casecolor).intVal();
|
||||
tmp.chantitle = chan->title;
|
||||
strncpy(tmp.id, chan->id, 4);
|
||||
int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
|
||||
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle((char *)tmp.hdr.id, GTitle)))
|
||||
wstringEx tmpString;
|
||||
string GTitle = custom_titles.getString("TITLES", tmp.id);
|
||||
if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
|
||||
{
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8(GTitle.c_str());
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
tmp.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor(tmp.id);
|
||||
tmp.wifi = gameTDB.GetWifiPlayers(tmp.id);
|
||||
tmp.players = gameTDB.GetPlayers(tmp.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpString = chan->name;
|
||||
tmp.casecolor = ccolor;
|
||||
}
|
||||
|
||||
tmp.hdr.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor((char *)tmp.hdr.id);
|
||||
|
||||
tmp.hdr.wifi = gameTDB.GetWifiPlayers((char *)tmp.hdr.id);
|
||||
tmp.hdr.players = gameTDB.GetPlayers((char *)tmp.hdr.id);
|
||||
//tmp.hdr.controllers = gameTDB.GetAccessories((char *)tmp.hdr.id);
|
||||
|
||||
tmp.hdr.chantitle = chan->title;
|
||||
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
Asciify(tmp.title);
|
||||
//gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.type = TYPE_CHANNEL;
|
||||
headerlist.push_back(tmp);
|
||||
}
|
||||
|
||||
@ -482,8 +458,9 @@ void CList<dir_discHdr>::GetChannels(vector<dir_discHdr> &headerlist, string set
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void CList<T>::Check_For_ID(u8 *id, string path, string one, string two)
|
||||
void CList<T>::Check_For_ID(char *id, string path, string one, string two)
|
||||
{
|
||||
memset(id, 0, sizeof(id));
|
||||
size_t idstart = path.find_last_of(one);
|
||||
size_t idend = path.find_last_of(two);
|
||||
if (idend != string::npos && idstart != string::npos && idend - idstart == 7)
|
||||
|
@ -26,6 +26,6 @@ class CList
|
||||
void GetHeaders(vector<string> pathlist, vector<T> &headerlist, string, string, string, Config &plugin);
|
||||
void GetChannels(vector<T> &headerlist, string, u32, string);
|
||||
private:
|
||||
void Check_For_ID(u8 *id, string path, string one, string two);
|
||||
void Check_For_ID(char *id, string path, string one, string two);
|
||||
};
|
||||
#endif
|
||||
|
@ -22,9 +22,7 @@
|
||||
#include "wip.h"
|
||||
#include "memory.h"
|
||||
#include "gecko.h"
|
||||
#include "defines.h"
|
||||
|
||||
#define ALIGNED(x) __attribute__((aligned(x)))
|
||||
#include "utils.h"
|
||||
|
||||
/* Constants */
|
||||
#define PTABLE_OFFSET 0x40000
|
||||
|
@ -1,6 +1,10 @@
|
||||
|
||||
#ifndef _DISC_H_
|
||||
#define _DISC_H_
|
||||
|
||||
#define WII_MAGIC 0x5D1C9EA3
|
||||
#define GC_MAGIC 0xC2339F3D
|
||||
|
||||
/* Disc header structure */
|
||||
struct discHdr
|
||||
{
|
||||
@ -42,13 +46,6 @@ struct discHdr
|
||||
u8 unused3[26];
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
struct dir_discHdr
|
||||
{
|
||||
struct discHdr hdr;
|
||||
char path[256];
|
||||
wchar_t title[64];
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
struct gc_discHdr
|
||||
{
|
||||
/* Game ID */
|
||||
@ -74,6 +71,25 @@ struct gc_discHdr
|
||||
u8 unused2[64];
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
struct dir_discHdr
|
||||
{
|
||||
char id[7]; //6+1 for null character
|
||||
|
||||
char path[256];
|
||||
wchar_t title[64];
|
||||
u64 chantitle;
|
||||
|
||||
u32 plugin_magic;
|
||||
u8 type;
|
||||
|
||||
u32 casecolor;
|
||||
u16 index;
|
||||
u8 esrb;
|
||||
u8 controllers;
|
||||
u8 players;
|
||||
u8 wifi;
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
@ -25,8 +25,6 @@
|
||||
#define Write16(addr, val) *(u16 *)addr = val; DCFlushRange((void *)addr, sizeof(u16));
|
||||
#define Write32(addr, val) *(u32 *)addr = val; DCFlushRange((void *)addr, sizeof(u32));
|
||||
|
||||
#define NoGameID(x) (x == PLUGIN_MAGIC || x == HB_MAGIC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "gecko.h"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
#include "fonts.h"
|
||||
#include "music/SoundHandler.hpp"
|
||||
#include "fs.h"
|
||||
@ -1504,21 +1504,19 @@ void CMenu::_initCF(void)
|
||||
}
|
||||
}
|
||||
const char *catviews = m_cat.getString(domain, "categories", "100000000000000000000").c_str();
|
||||
string id;
|
||||
for (u32 i = 0; i < m_gameList.size(); ++i)
|
||||
{
|
||||
u64 chantitle = m_gameList[i].hdr.chantitle;
|
||||
if(m_current_view == COVERFLOW_CHANNEL && chantitle == HBC_108)
|
||||
strncpy((char *) m_gameList[i].hdr.id, "JODI", 6);
|
||||
if(NoGameID(m_gameList[i].hdr.gc_magic))
|
||||
string id;
|
||||
string tempname(m_gameList[i].path);
|
||||
u64 chantitle = m_gameList[i].chantitle;
|
||||
if(m_gameList[i].type == TYPE_HOMEBREW)
|
||||
{
|
||||
string tempname(m_gameList[i].path);
|
||||
if(m_gameList[i].hdr.gc_magic == HB_MAGIC)
|
||||
{
|
||||
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||
id = tempname;
|
||||
}
|
||||
else if(!m_plugin.isScummVM(m_gameList[i].hdr.magic))
|
||||
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||
id = tempname;
|
||||
}
|
||||
else if(m_gameList[i].type == TYPE_PLUGIN)
|
||||
{
|
||||
if(!m_plugin.isScummVM(m_gameList[i].plugin_magic))
|
||||
{
|
||||
if(tempname.empty() || tempname.find_first_of('/') == string::npos)
|
||||
{
|
||||
@ -1541,24 +1539,29 @@ void CMenu::_initCF(void)
|
||||
else
|
||||
id = tempname;
|
||||
}
|
||||
else
|
||||
id = string((const char *)m_gameList[i].hdr.id, m_current_view == COVERFLOW_CHANNEL ? 4 : 6);
|
||||
else
|
||||
{
|
||||
if(m_gameList[i].type == TYPE_CHANNEL && chantitle == HBC_108)
|
||||
strncpy(m_gameList[i].id, "JODI", 6);
|
||||
id = string(m_gameList[i].id);
|
||||
}
|
||||
|
||||
string idcats = m_cat.getString("CATEGORIES", id, "").c_str();
|
||||
if (idcats.length() < 21 && idcats.length() > 0)
|
||||
{
|
||||
idcats.append((21-idcats.length()), '0');
|
||||
m_cat.setString("CATEGORIES", id, idcats);
|
||||
}
|
||||
|
||||
|
||||
bool ageLocked = false;
|
||||
if (ageLock < 19)
|
||||
{
|
||||
int ageRated = min(max(gameAgeList.getInt(domain, id), 0), 19);
|
||||
|
||||
if (ageRated == 0 && (m_current_view == COVERFLOW_USB || m_current_view == COVERFLOW_CHANNEL))
|
||||
if(ageRated == 0 && (m_current_view == COVERFLOW_USB || m_current_view == COVERFLOW_CHANNEL))
|
||||
{
|
||||
GameXMLInfo gameinfo;
|
||||
if (gametdb.IsLoaded() && gametdb.GetGameXMLInfo(id.c_str(), &gameinfo))
|
||||
if(gametdb.IsLoaded() && gametdb.GetGameXMLInfo(id.c_str(), &gameinfo))
|
||||
{
|
||||
switch(gameinfo.RatingType)
|
||||
{
|
||||
@ -1615,15 +1618,15 @@ void CMenu::_initCF(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ageRated == 0)
|
||||
if(ageRated == 0)
|
||||
ageRated = min(max(m_cfg.getInt("GENERAL", "age_lock_default", AGE_LOCK_DEFAULT), 2), 19);
|
||||
if (ageRated == 0)
|
||||
if(ageRated == 0)
|
||||
ageRated = AGE_LOCK_DEFAULT;
|
||||
if (ageRated > ageLock)
|
||||
if(ageRated > ageLock)
|
||||
ageLocked = true;
|
||||
}
|
||||
|
||||
if ((!m_favorites || m_gcfg1.getBool("FAVORITES", id, false))
|
||||
if((!m_favorites || m_gcfg1.getBool("FAVORITES", id, false))
|
||||
&& (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false))
|
||||
&& !ageLocked)
|
||||
{
|
||||
@ -1653,21 +1656,19 @@ void CMenu::_initCF(void)
|
||||
if(dumpGameLst)
|
||||
dump.setWString(domain, id, m_gameList[i].title);
|
||||
|
||||
if(m_gameList[i].hdr.gc_magic == PLUGIN_MAGIC)
|
||||
if(m_gameList[i].type == TYPE_PLUGIN)
|
||||
{
|
||||
string tempname(m_gameList[i].path);
|
||||
if(tempname.find_last_of("/") != string::npos)
|
||||
tempname.assign(&tempname[tempname.find_last_of("/") + 1]);
|
||||
string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].hdr.magic));
|
||||
//if(tempname.find_last_of('.') != string::npos)
|
||||
// tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
|
||||
string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].plugin_magic));
|
||||
if(EnabledPlugins.size() == 0) //all plugins
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
else
|
||||
{
|
||||
for(u8 j = 0; j < EnabledPlugins.size(); j++)
|
||||
{
|
||||
if(EnabledPlugins[j] == true && m_gameList[i].hdr.magic == m_plugin.getPluginMagic(j))
|
||||
if(EnabledPlugins[j] == true && m_gameList[i].plugin_magic == m_plugin.getPluginMagic(j))
|
||||
{
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
break;
|
||||
@ -1675,7 +1676,7 @@ void CMenu::_initCF(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_gameList[i].hdr.gc_magic == HB_MAGIC)
|
||||
else if(m_gameList[i].type == TYPE_HOMEBREW)
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/icon.png", m_gameList[i].path), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
||||
else
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "loader/wbfs.h"
|
||||
#include "libwbfs/wiidisc.h"
|
||||
#include "menu.hpp"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "loader/sys.h"
|
||||
#include "gecko.h"
|
||||
@ -120,27 +120,38 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsBtnPageP);
|
||||
m_btnMgr.show(m_gameSettingsBtnBack);
|
||||
m_btnMgr.show(m_gameSettingsLblTitle);
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
{
|
||||
if(m_current_view == COVERFLOW_USB && _checkSave(string((const char *)m_cf.getHdr()->hdr.id), false))
|
||||
g_numGCfPages = 5;
|
||||
else
|
||||
g_numGCfPages = 4;
|
||||
}
|
||||
else
|
||||
if(m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
if(m_new_dml)
|
||||
g_numGCfPages = 3;
|
||||
else
|
||||
g_numGCfPages = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_current_view == COVERFLOW_USB && _checkSave(string((const char *)m_cf.getHdr()->id), false))
|
||||
g_numGCfPages = 5;
|
||||
else
|
||||
g_numGCfPages = 4;
|
||||
}
|
||||
|
||||
if (m_gameSettingsPage == 1)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblCover);
|
||||
m_btnMgr.show(m_gameSettingsBtnCover);
|
||||
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
if(m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblDMLGameVideo);
|
||||
m_btnMgr.show(m_gameSettingsLblDMLVideo);
|
||||
m_btnMgr.show(m_gameSettingsBtnDMLVideoP);
|
||||
m_btnMgr.show(m_gameSettingsBtnDMLVideoM);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblGClanguageVal);
|
||||
m_btnMgr.show(m_gameSettingsLblGClanguage);
|
||||
m_btnMgr.show(m_gameSettingsBtnGClanguageP);
|
||||
m_btnMgr.show(m_gameSettingsBtnGClanguageM);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsBtnCategoryMain);
|
||||
m_btnMgr.show(m_gameSettingsLblCategoryMain);
|
||||
@ -150,30 +161,29 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsBtnLanguageP);
|
||||
m_btnMgr.show(m_gameSettingsBtnLanguageM);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblGameVideo);
|
||||
m_btnMgr.show(m_gameSettingsLblGameVideo);
|
||||
m_btnMgr.show(m_gameSettingsLblVideo);
|
||||
m_btnMgr.show(m_gameSettingsBtnVideoP);
|
||||
m_btnMgr.show(m_gameSettingsBtnVideoM);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblDMLGameVideo);
|
||||
m_btnMgr.show(m_gameSettingsLblDMLVideo);
|
||||
m_btnMgr.show(m_gameSettingsBtnDMLVideoP);
|
||||
m_btnMgr.show(m_gameSettingsBtnDMLVideoM);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblGClanguageVal);
|
||||
m_btnMgr.show(m_gameSettingsLblGClanguage);
|
||||
m_btnMgr.show(m_gameSettingsBtnGClanguageP);
|
||||
m_btnMgr.show(m_gameSettingsBtnGClanguageM);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblCover);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCover);
|
||||
if(m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblGClanguageVal);
|
||||
m_btnMgr.hide(m_gameSettingsLblGClanguage);
|
||||
m_btnMgr.hide(m_gameSettingsBtnGClanguageP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnGClanguageM);
|
||||
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
m_btnMgr.hide(m_gameSettingsLblDMLGameVideo);
|
||||
m_btnMgr.hide(m_gameSettingsLblDMLVideo);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDMLVideoP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDMLVideoM);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsBtnCategoryMain);
|
||||
m_btnMgr.hide(m_gameSettingsLblCategoryMain);
|
||||
@ -188,18 +198,6 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.hide(m_gameSettingsBtnVideoP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnVideoM);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblGClanguageVal);
|
||||
m_btnMgr.hide(m_gameSettingsLblGClanguage);
|
||||
m_btnMgr.hide(m_gameSettingsBtnGClanguageP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnGClanguageM);
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblDMLGameVideo);
|
||||
m_btnMgr.hide(m_gameSettingsLblDMLVideo);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDMLVideoP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDMLVideoM);
|
||||
}
|
||||
}
|
||||
if (m_gameSettingsPage == 2)
|
||||
{
|
||||
@ -208,7 +206,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsBtnDebuggerP);
|
||||
m_btnMgr.show(m_gameSettingsBtnDebuggerM);
|
||||
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
if(m_cf.getHdr()->type != TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblHooktype);
|
||||
m_btnMgr.show(m_gameSettingsLblHooktypeVal);
|
||||
@ -229,7 +227,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.hide(m_gameSettingsBtnDebuggerP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDebuggerM);
|
||||
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
if(m_cf.getHdr()->type != TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblHooktype);
|
||||
m_btnMgr.hide(m_gameSettingsLblHooktypeVal);
|
||||
@ -245,7 +243,7 @@ void CMenu::_showGameSettings(void)
|
||||
}
|
||||
if (m_gameSettingsPage == 3)
|
||||
{
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
if(m_cf.getHdr()->type != TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblPatchVidModes);
|
||||
m_btnMgr.show(m_gameSettingsLblPatchVidModesVal);
|
||||
@ -255,9 +253,9 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsBtnVipatch);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblCountryPatch);
|
||||
m_btnMgr.show(m_gameSettingsBtnCountryPatch);
|
||||
|
||||
if (m_current_view != COVERFLOW_HOMEBREW)
|
||||
m_btnMgr.show(m_gameSettingsBtnCountryPatch);
|
||||
|
||||
if(m_cf.getHdr()->type == TYPE_WII_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblAspectRatio);
|
||||
m_btnMgr.show(m_gameSettingsLblAspectRatioVal);
|
||||
@ -271,7 +269,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsLblNMM_Val);
|
||||
m_btnMgr.show(m_gameSettingsBtnNMM_P);
|
||||
m_btnMgr.show(m_gameSettingsBtnNMM_M);
|
||||
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblNoDVD);
|
||||
m_btnMgr.show(m_gameSettingsLblNoDVD_Val);
|
||||
m_btnMgr.show(m_gameSettingsBtnNoDVD_P);
|
||||
@ -280,7 +278,7 @@ void CMenu::_showGameSettings(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
if(m_cf.getHdr()->type != TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblPatchVidModes);
|
||||
m_btnMgr.hide(m_gameSettingsLblPatchVidModesVal);
|
||||
@ -313,29 +311,27 @@ void CMenu::_showGameSettings(void)
|
||||
}
|
||||
if (m_gameSettingsPage == 4)
|
||||
{
|
||||
if (m_current_view == COVERFLOW_CHANNEL)
|
||||
if(m_cf.getHdr()->type == TYPE_CHANNEL)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblCustom);
|
||||
m_btnMgr.show(m_gameSettingsBtnCustom);
|
||||
}
|
||||
|
||||
if(m_current_view == COVERFLOW_USB)
|
||||
else if(m_cf.getHdr()->type == TYPE_WII_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblEmulationVal);
|
||||
m_btnMgr.show(m_gameSettingsLblEmulation);
|
||||
m_btnMgr.show(m_gameSettingsBtnEmulationP);
|
||||
m_btnMgr.show(m_gameSettingsBtnEmulationM);
|
||||
m_btnMgr.show(m_gameSettingsBtnEmulationM);
|
||||
if(_checkSave(string((const char *)m_cf.getHdr()->id), true))
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblExtractSave);
|
||||
m_btnMgr.show(m_gameSettingsBtnExtractSave);
|
||||
}
|
||||
}
|
||||
m_btnMgr.show(m_gameSettingsLblGameIOS);
|
||||
m_btnMgr.show(m_gameSettingsLblIOS);
|
||||
m_btnMgr.show(m_gameSettingsBtnIOSP);
|
||||
m_btnMgr.show(m_gameSettingsBtnIOSM);
|
||||
|
||||
if(m_current_view == COVERFLOW_USB && _checkSave(string((const char *)m_cf.getHdr()->hdr.id), true))
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblExtractSave);
|
||||
m_btnMgr.show(m_gameSettingsBtnExtractSave);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -377,7 +373,18 @@ void CMenu::_showGameSettings(void)
|
||||
|
||||
m_btnMgr.setText(m_gameSettingsLblPage, wfmt(L"%i / %i", page, maxpage));
|
||||
m_btnMgr.setText(m_gameSettingsBtnOcarina, _optBoolToString(m_gcfg2.getOptBool(id, "cheat")));
|
||||
if(m_cf.getHdr()->hdr.gc_magic != GC_MAGIC)
|
||||
if(m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
i = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblDMLVideo, _t(CMenu::_DMLvideoModes[i].id, CMenu::_DMLvideoModes[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblGClanguageVal, _t(CMenu::_GClanguages[i].id, CMenu::_GClanguages[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "dml_nmm", 0), ARRAY_SIZE(CMenu::_NMM) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblNMM_Val, _t(CMenu::_NMM[i].id, CMenu::_NMM[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblNoDVD_Val, _t(CMenu::_NoDVD[i].id, CMenu::_NoDVD[i].text));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.setText(m_gameSettingsBtnVipatch, _optBoolToString(m_gcfg2.getOptBool(id, "vipatch", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCountryPatch, _optBoolToString(m_gcfg2.getOptBool(id, "country_patch", 0)));
|
||||
@ -390,17 +397,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.setText(m_gameSettingsLblAspectRatioVal, _t(CMenu::_AspectRatio[i].id, CMenu::_AspectRatio[i].text));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCustom, _optBoolToString(m_gcfg2.getOptBool(id, "custom", 0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
i = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblDMLVideo, _t(CMenu::_DMLvideoModes[i].id, CMenu::_DMLvideoModes[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblGClanguageVal, _t(CMenu::_GClanguages[i].id, CMenu::_GClanguages[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "dml_nmm", 0), ARRAY_SIZE(CMenu::_NMM) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblNMM_Val, _t(CMenu::_NMM[i].id, CMenu::_NMM[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblNoDVD_Val, _t(CMenu::_NoDVD[i].id, CMenu::_NoDVD[i].text));
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
if (m_gcfg2.getInt(id, "ios", &j) && _installed_cios.size() > 0)
|
||||
{
|
||||
|
@ -516,7 +516,7 @@ int CMenu::_coverDownloader(bool missingOnly)
|
||||
}
|
||||
else
|
||||
{
|
||||
id = (const char *)m_gameList[i].hdr.id;
|
||||
id = (const char *)m_gameList[i].id;
|
||||
path = sfmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str());
|
||||
}
|
||||
if (!missingOnly || (!m_cf.fullCoverCached(id.c_str()) && !checkPNGFile(path.c_str())))
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "alt_ios.h"
|
||||
#include "gecko.h"
|
||||
#include "homebrew.h"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
#include "gc/gc.h"
|
||||
#include "gc/fileOps.h"
|
||||
#include "Gekko.h"
|
||||
@ -242,7 +242,7 @@ static Banner *_extractChannelBnr(const u64 chantitle)
|
||||
static Banner *_extractBnr(dir_discHdr *hdr)
|
||||
{
|
||||
Banner *banner = NULL;
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->hdr.id, (char *) hdr->path);
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->id, (char *) hdr->path);
|
||||
if (disc != NULL)
|
||||
{
|
||||
void *bnr = NULL;
|
||||
@ -275,7 +275,7 @@ static u8 GetRequestedGameIOS(dir_discHdr *hdr)
|
||||
{
|
||||
u8 IOS = 0;
|
||||
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->hdr.id, (char *) hdr->path);
|
||||
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) &hdr->id, (char *) hdr->path);
|
||||
if (!disc) return IOS;
|
||||
|
||||
u8 *titleTMD = NULL;
|
||||
@ -385,7 +385,7 @@ void CMenu::_game(bool launch)
|
||||
ClearGameSoundThreadStack();
|
||||
break;
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (m_cf.getHdr()->hdr.magic == WII_MAGIC || m_cf.getHdr()->hdr.gc_magic == GC_MAGIC || m_current_view == COVERFLOW_CHANNEL))
|
||||
else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (m_cf.getHdr()->type == TYPE_WII_GAME || m_cf.getHdr()->type == TYPE_GC_GAME || m_cf.getHdr()->type == TYPE_CHANNEL))
|
||||
{
|
||||
_hideGame();
|
||||
m_gameSelected = true;
|
||||
@ -474,14 +474,14 @@ void CMenu::_game(bool launch)
|
||||
{
|
||||
_hideGame();
|
||||
dir_discHdr *hdr = m_cf.getHdr();
|
||||
if(currentPartition != SD && hdr->hdr.gc_magic == GC_MAGIC)
|
||||
if(currentPartition != SD && hdr->type == TYPE_GC_GAME)
|
||||
{
|
||||
char gcfolder[300];
|
||||
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->hdr.id);
|
||||
if(GC_GameIsInstalled((char *)hdr->hdr.id, DeviceName[SD], DML_DIR))
|
||||
snprintf(gcfolder, sizeof(gcfolder), "%s [%s]", m_cf.getTitle().toUTF8().c_str(), (char *)hdr->id);
|
||||
if(GC_GameIsInstalled((char *)hdr->id, DeviceName[SD], DML_DIR))
|
||||
{
|
||||
memset(hdr->path, 0, sizeof(hdr->path));
|
||||
strncpy(hdr->path, (char*)hdr->hdr.id, sizeof(hdr->path));
|
||||
strncpy(hdr->path, (char*)hdr->id, sizeof(hdr->path));
|
||||
}
|
||||
else if(GC_GameIsInstalled(gcfolder, DeviceName[SD], DML_DIR))
|
||||
{
|
||||
@ -496,10 +496,10 @@ void CMenu::_game(bool launch)
|
||||
m_cf.clear();
|
||||
_showWaitMessage();
|
||||
|
||||
if(m_current_view != COVERFLOW_HOMEBREW && m_current_view != COVERFLOW_EMU)
|
||||
if(hdr->type != TYPE_HOMEBREW && hdr->type != TYPE_PLUGIN)
|
||||
{
|
||||
// Get banner_title
|
||||
Banner * banner = m_current_view == COVERFLOW_CHANNEL ? _extractChannelBnr(chantitle) : (m_current_view == COVERFLOW_USB && hdr->hdr.gc_magic != GC_MAGIC) ? _extractBnr(hdr) : NULL;
|
||||
Banner *banner = hdr->type == TYPE_CHANNEL ? _extractChannelBnr(chantitle) : (hdr->type == TYPE_WII_GAME ? _extractBnr(hdr) : NULL);
|
||||
if(banner != NULL)
|
||||
{
|
||||
if(banner->IsValid())
|
||||
@ -581,7 +581,7 @@ void CMenu::_game(bool launch)
|
||||
m_btnMgr.show(m_gameBtnSettings);
|
||||
}
|
||||
|
||||
if ((m_current_view == COVERFLOW_USB || m_current_view == COVERFLOW_EMU || m_cf.getHdr()->hdr.gc_magic == GC_MAGIC) && !m_locked)
|
||||
if ((m_cf.getHdr()->type != TYPE_HOMEBREW && m_cf.getHdr()->type != TYPE_CHANNEL) && !m_locked)
|
||||
m_btnMgr.show(m_gameBtnDelete);
|
||||
}
|
||||
else
|
||||
@ -633,7 +633,12 @@ void CMenu::_directlaunch(const string &id)
|
||||
void CMenu::_launch(dir_discHdr *hdr)
|
||||
{
|
||||
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
|
||||
if(hdr->hdr.gc_magic == PLUGIN_MAGIC)
|
||||
if(hdr->type == TYPE_WII_GAME)
|
||||
{
|
||||
_launchGame(hdr, false);
|
||||
return;
|
||||
}
|
||||
else if(hdr->type == TYPE_PLUGIN)
|
||||
{
|
||||
string title(&hdr->path[string(hdr->path).find_last_of("/")+1]);
|
||||
string wiiflow_dol(m_dol);
|
||||
@ -642,7 +647,7 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size()));
|
||||
vector<string> arguments;
|
||||
gprintf("Game title: %s\n", title.c_str());
|
||||
if(m_plugin.isMplayerCE(hdr->hdr.magic))
|
||||
if(m_plugin.isMplayerCE(hdr->plugin_magic))
|
||||
arguments = m_plugin.CreateMplayerCEArguments(string(hdr->path).c_str());
|
||||
else if(strstr(path.c_str(), ":/") != NULL)
|
||||
{
|
||||
@ -650,7 +655,7 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
path.erase(3,1);
|
||||
arguments.push_back(path);
|
||||
arguments.push_back(title);
|
||||
if(m_plugin.UseReturnLoader(hdr->hdr.magic))
|
||||
if(m_plugin.UseReturnLoader(hdr->plugin_magic))
|
||||
arguments.push_back(sfmt("%s/WiiFlowLoader.dol",m_pluginsDir.c_str()));
|
||||
else
|
||||
arguments.push_back(wiiflow_dol);
|
||||
@ -663,10 +668,10 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
wcstombs(gametitle, hdr->title, sizeof(gametitle));
|
||||
m_cfg.setString("EMULATOR", "current_item", gametitle);
|
||||
}
|
||||
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->hdr.magic)), arguments);
|
||||
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->plugin_magic)), arguments);
|
||||
return;
|
||||
}
|
||||
else if(hdr->hdr.gc_magic == HB_MAGIC)
|
||||
else if(hdr->type == TYPE_HOMEBREW)
|
||||
{
|
||||
char gamepath[128];
|
||||
snprintf(gamepath, sizeof(gamepath), "%s/boot.dol", hdr->path);
|
||||
@ -675,24 +680,23 @@ void CMenu::_launch(dir_discHdr *hdr)
|
||||
_launchHomebrew(gamepath, m_homebrewArgs);
|
||||
return;
|
||||
}
|
||||
else if(hdr->hdr.gc_magic == GC_MAGIC)
|
||||
else if(hdr->type == TYPE_GC_GAME)
|
||||
{
|
||||
_launchGC(hdr, true);
|
||||
return;
|
||||
}
|
||||
else if(m_current_view == COVERFLOW_CHANNEL)
|
||||
else if(hdr->type == TYPE_CHANNEL)
|
||||
{
|
||||
_launchChannel(hdr);
|
||||
return;
|
||||
}
|
||||
_launchGame(hdr, false);
|
||||
}
|
||||
|
||||
extern "C" {extern void USBStorage_Deinit(void);}
|
||||
|
||||
void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
|
||||
{
|
||||
char* id = (char *)hdr->hdr.id;
|
||||
char* id = (char *)hdr->id;
|
||||
|
||||
Nand::Instance()->Disable_Emu();
|
||||
|
||||
@ -882,7 +886,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
u32 entry = 0;
|
||||
Nand::Instance()->Disable_Emu();
|
||||
|
||||
string id = string((const char *) hdr->hdr.id);
|
||||
string id = string((const char *)hdr->id);
|
||||
|
||||
bool forwarder = true;
|
||||
for (u8 num = 0; num < ARRAY_SIZE(systems); num++)
|
||||
@ -976,13 +980,13 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
|
||||
if(!forwarder)
|
||||
{
|
||||
entry = channel.Load(hdr->hdr.chantitle, &ios);
|
||||
entry = channel.Load(hdr->chantitle, &ios);
|
||||
setLanguage(language);
|
||||
|
||||
SmartBuf cheatFile;
|
||||
u32 cheatSize = 0;
|
||||
if (cheat)
|
||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", hdr->hdr.id));
|
||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", hdr->id));
|
||||
|
||||
ocarina_load_code(cheatFile.get(), cheatSize);
|
||||
|
||||
@ -1068,17 +1072,17 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
if(forwarder)
|
||||
{
|
||||
WII_Initialize();
|
||||
if(WII_LaunchTitle(hdr->hdr.chantitle) < 0)
|
||||
if(WII_LaunchTitle(hdr->chantitle) < 0)
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
if(!BootChannel(entry, hdr->hdr.chantitle, ios, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio))
|
||||
if(!BootChannel(entry, hdr->chantitle, ios, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio))
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
{
|
||||
string id = string((const char *) hdr->hdr.id);
|
||||
string id = string((const char *) hdr->id);
|
||||
Nand::Instance()->Disable_Emu();
|
||||
|
||||
if (dvd)
|
||||
@ -1119,7 +1123,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
/* Read GC disc header */
|
||||
struct gc_discHdr *gcHeader = (struct gc_discHdr *)MEM2_alloc(sizeof(struct gc_discHdr));
|
||||
Disc_ReadGCHeader(gcHeader);
|
||||
memcpy(hdr->hdr.id, gcHeader->id, 6);
|
||||
memcpy(hdr->id, gcHeader->id, 6);
|
||||
MEM2_free(gcHeader);
|
||||
/* Launching GC Game */
|
||||
_launchGC(hdr, false);
|
||||
@ -1206,7 +1210,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
}
|
||||
}
|
||||
|
||||
if (!dvd && get_frag_list((u8 *) hdr->hdr.id, (char *) hdr->path, currentPartition == 0 ? 0x200 : sector_size) < 0)
|
||||
if (!dvd && get_frag_list((u8 *)hdr->id, (char *) hdr->path, currentPartition == 0 ? 0x200 : sector_size) < 0)
|
||||
return;
|
||||
|
||||
u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
|
||||
@ -1243,12 +1247,12 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
setLanguage(language);
|
||||
|
||||
if(cheat)
|
||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", hdr->hdr.id));
|
||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", hdr->id));
|
||||
|
||||
_loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt");
|
||||
|
||||
load_wip_patches((u8 *) m_wipDir.c_str(), (u8 *) &hdr->hdr.id);
|
||||
app_gameconfig_load((u8 *) &hdr->hdr.id, gameconfig.get(), gameconfigSize);
|
||||
load_wip_patches((u8 *)m_wipDir.c_str(), (u8 *) &hdr->id);
|
||||
app_gameconfig_load((u8 *) &hdr->id, gameconfig.get(), gameconfigSize);
|
||||
ocarina_load_code(cheatFile.get(), cheatSize);
|
||||
|
||||
if (!m_use_wifi_gecko)
|
||||
@ -1310,7 +1314,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
|
||||
if (!dvd)
|
||||
{
|
||||
s32 ret = Disc_SetUSB((u8 *) hdr->hdr.id);
|
||||
s32 ret = Disc_SetUSB((u8 *)hdr->id);
|
||||
if (ret < 0)
|
||||
{
|
||||
gprintf("Set USB failed: %d\n", ret);
|
||||
@ -1430,26 +1434,26 @@ unsigned int gameSoundThreadStackSize = (unsigned int)32768;
|
||||
|
||||
void CMenu::_gameSoundThread(CMenu *m)
|
||||
{
|
||||
if(m->m_cf.getHdr()->hdr.gc_magic == GC_MAGIC)
|
||||
if(m->m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
|
||||
m->m_gamesound_changed = true;
|
||||
return;
|
||||
}
|
||||
else if(m->m_cf.getHdr()->hdr.gc_magic == PLUGIN_MAGIC)
|
||||
else if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->hdr.magic), m->m_plugin.GetBannerSoundSize(), false);
|
||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->plugin_magic), m->m_plugin.GetBannerSoundSize(), false);
|
||||
m->m_gamesound_changed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
m->m_gameSoundHdr = m->m_cf.getHdr();
|
||||
m->m_gamesound_changed = false;
|
||||
u32 sndSize = 0;
|
||||
m->m_gameSoundHdr = m->m_cf.getHdr();
|
||||
|
||||
Banner *banner = m->m_current_view == COVERFLOW_USB ?
|
||||
_extractBnr(m->m_gameSoundHdr) : m->m_current_view == COVERFLOW_CHANNEL ?
|
||||
_extractChannelBnr(m->m_gameSoundHdr->hdr.chantitle) : NULL;
|
||||
Banner *banner = m->m_gameSoundHdr->type == TYPE_WII_GAME ?
|
||||
_extractBnr(m->m_gameSoundHdr) : m->m_gameSoundHdr->type == TYPE_CHANNEL ?
|
||||
_extractChannelBnr(m->m_gameSoundHdr->chantitle) : NULL;
|
||||
m->m_gameSoundHdr = NULL;
|
||||
|
||||
if (banner == NULL || !banner->IsValid())
|
||||
|
@ -654,7 +654,7 @@ int CMenu::main(void)
|
||||
_hideMain(true);
|
||||
dir_discHdr hdr;
|
||||
memset(&hdr, 0, sizeof(dir_discHdr));
|
||||
memcpy(&hdr.hdr.id, "dvddvd", 6);
|
||||
memcpy(&hdr.id, "dvddvd", 6);
|
||||
_launchGame(&hdr, true);
|
||||
_showMain();
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ int CMenu::_NandDumper(void *obj)
|
||||
m._setDumpMsg(m._t("cfgne18", L"Listing game saves to extract..."), 0.f, 0.f);
|
||||
LWP_MutexUnlock(m.m_mutex);
|
||||
|
||||
string id((const char *)m.m_gameList[i].hdr.id, 4);
|
||||
string id((const char *)m.m_gameList[i].id, 4);
|
||||
|
||||
if(!missingOnly || !m._checkSave(id, false))
|
||||
{
|
||||
|
@ -1,46 +0,0 @@
|
||||
#include "menu.hpp"
|
||||
#include "gecko.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
// Returns a list of games which starts with the specified (partial) gameId
|
||||
// We can enhance the code in this file later on to support more search features
|
||||
// Using a search class as argument or something like that
|
||||
vector<dir_discHdr> CMenu::_searchGamesByID(const char *gameId)
|
||||
{
|
||||
vector<dir_discHdr> retval;
|
||||
for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
|
||||
if (strncmp((const char *) (*itr).hdr.id, gameId, strlen(gameId)) == 0)
|
||||
retval.push_back(*itr);
|
||||
|
||||
return retval;
|
||||
}
|
||||
/*
|
||||
vector<dir_discHdr> CMenu::_searchGamesByTitle(wchar_t letter)
|
||||
{
|
||||
vector<dir_discHdr> retval;
|
||||
for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
|
||||
if ((*itr).title[0] == letter)
|
||||
retval.push_back(*itr);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
vector<dir_discHdr> CMenu::_searchGamesByType(const char type)
|
||||
{
|
||||
vector<dir_discHdr> retval;
|
||||
for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
|
||||
if ((*itr).id[0] == type)
|
||||
retval.push_back(*itr);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
vector<dir_discHdr> CMenu::_searchGamesByRegion(const char region)
|
||||
{
|
||||
vector<dir_discHdr> retval;
|
||||
for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
|
||||
if ((*itr).id[3] == region)
|
||||
retval.push_back(*itr);
|
||||
|
||||
return retval;
|
||||
} */
|
@ -7,7 +7,7 @@
|
||||
#include "fileOps.h"
|
||||
#include "music/SoundHandler.hpp"
|
||||
#include "channel/nand.hpp"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
#include "wdvd.h"
|
||||
|
||||
void CMenu::_hideWBFS(bool instant)
|
||||
@ -71,6 +71,16 @@ void CMenu::_addDiscProgress(int status, int total, void *user_data)
|
||||
}
|
||||
}
|
||||
|
||||
vector<dir_discHdr> CMenu::_searchGamesByID(const char *gameId)
|
||||
{
|
||||
vector<dir_discHdr> retval;
|
||||
for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
|
||||
if (strncmp((const char *) (*itr).id, gameId, strlen(gameId)) == 0)
|
||||
retval.push_back(*itr);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void CMenu::_Messenger(int message, int info, char *cinfo, void *user_data)
|
||||
{
|
||||
CMenu &m = *(CMenu *)user_data;
|
||||
@ -365,19 +375,19 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
}
|
||||
break;
|
||||
case CMenu::WO_REMOVE_GAME:
|
||||
if(m_cf.getHdr()->hdr.gc_magic == GC_MAGIC)
|
||||
if(m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
char source[300];
|
||||
snprintf(source, sizeof(source), "%s/%s", fmt((currentPartition != SD) ? m_DMLgameDir.c_str() : DML_DIR, DeviceName[currentPartition]), (char *)m_cf.getHdr()->path);
|
||||
fsop_deleteFolder(source);
|
||||
upd_dml = true;
|
||||
}
|
||||
else if(m_cf.getHdr()->hdr.gc_magic == PLUGIN_MAGIC)
|
||||
else if(m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
fsop_deleteFile((char*)m_cf.getHdr()->path);
|
||||
upd_emu = true;
|
||||
}
|
||||
else if(m_current_view == COVERFLOW_USB)
|
||||
else if(m_cf.getHdr()->type == TYPE_WII_GAME)
|
||||
{
|
||||
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), (char *) m_cf.getHdr()->path);
|
||||
upd_usb = true;
|
||||
@ -413,8 +423,8 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
m_btnMgr.hide(m_wbfsBtnBack);
|
||||
m_btnMgr.show(m_wbfsLblMessage);
|
||||
m_btnMgr.setText(m_wbfsLblMessage, L"");
|
||||
cfPos = string((char*)m_cf.getHdr()->hdr.id);
|
||||
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop10", L"Copying [%s] %s..."), (u8*)m_cf.getHdr()->hdr.id, (u8*)m_cf.getTitle().toUTF8().c_str()));
|
||||
cfPos = string((char*)m_cf.getHdr()->id);
|
||||
m_btnMgr.setText(m_wbfsLblDialog, wfmt(_fmt("wbfsop10", L"Copying [%s] %s..."), (u8*)m_cf.getHdr()->id, (u8*)m_cf.getTitle().toUTF8().c_str()));
|
||||
done = true;
|
||||
upd_dml = true;
|
||||
m_thrdWorking = true;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "gecko/gecko.h"
|
||||
#include "devicemounter/PartitionHandle.h"
|
||||
#include "devicemounter/DeviceHandler.hpp"
|
||||
#include "defines.h"
|
||||
#include "types.h"
|
||||
#include "crc32.h"
|
||||
|
||||
static const string emptyString;
|
||||
@ -214,15 +214,15 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
|
||||
continue;
|
||||
}
|
||||
memset(&tmp, 0, sizeof(dir_discHdr));
|
||||
strncpy((char*)tmp.hdr.id, "PLUGIN", sizeof(tmp.hdr.id));
|
||||
tmp.hdr.casecolor = Plugins.back().caseColor;
|
||||
strncpy((char*)tmp.id, "PLUGIN", sizeof(tmp.id));
|
||||
tmp.casecolor = Plugins.back().caseColor;
|
||||
wstringEx tmpString;
|
||||
tmpString.fromUTF8(GameName.c_str());
|
||||
wcsncpy(tmp.title, tmpString.c_str(), 64);
|
||||
strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
|
||||
gprintf("Found: %ls\n", tmp.title);
|
||||
tmp.hdr.magic = Plugins.back().magicWord;
|
||||
tmp.hdr.gc_magic = PLUGIN_MAGIC;
|
||||
tmp.plugin_magic = Plugins.back().magicWord;
|
||||
tmp.type = TYPE_PLUGIN;
|
||||
gameHeader.push_back(tmp);
|
||||
game = ini.nextDomain();
|
||||
}
|
||||
@ -281,7 +281,7 @@ bool Plugin::isScummVM(u32 magic)
|
||||
|
||||
string Plugin::GenerateCoverLink(dir_discHdr gameHeader, string url)
|
||||
{
|
||||
Plugin_Pos = GetPluginPosition(gameHeader.hdr.magic);
|
||||
Plugin_Pos = GetPluginPosition(gameHeader.plugin_magic);
|
||||
|
||||
if(url.find(TAG_LOC) != url.npos)
|
||||
url.replace(url.find(TAG_LOC), strlen(TAG_LOC), "EN");
|
||||
|
25
source/types.h
Normal file
25
source/types.h
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
#ifndef _TYPES_H_
|
||||
#define _TYPES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
TYPE_WII_GAME = 0,
|
||||
TYPE_GC_GAME,
|
||||
TYPE_CHANNEL,
|
||||
TYPE_PLUGIN,
|
||||
TYPE_HOMEBREW,
|
||||
TYPE_END
|
||||
};
|
||||
|
||||
#define NoGameID(x) (x == TYPE_PLUGIN || x == TYPE_HOMEBREW)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user