Skip to content

Commit

Permalink
- fixed cacheing scummvm covers
Browse files Browse the repository at this point in the history
- fixed setting scummvm cover's color via plugin
- now scummvm list is cached like all the other lists. but still does not use custom titles or titles from the plugins data xml.
- fixed the random bug where covers sometimes were not cached.
- fixed minor memory leaks via gametdb.cpp
- fixed an issue with using custom backgrounds via source menu.
- added the ability to move to next and previous game while on game info menu by using the controllers '+' and '-' buttons
- added the ability to launch a game directly from the game info menu by pressing 'A' on the controller.
- added the abilty to launch super smash bros melee via nintendont slippi. manually edit wiiflow_lite.ini by adding use_slippi=yes under [GAMECUBE]. google nintendont slippi and slippi project to learn about it.
- upped to version 5.4.1
  • Loading branch information
Fledge68 committed Feb 2, 2020
1 parent 5b21e15 commit 53a06c0
Show file tree
Hide file tree
Showing 19 changed files with 277 additions and 214 deletions.
Binary file modified out/bins/ext_booter.bin
Binary file not shown.
Binary file modified out/boot.dol
Binary file not shown.
2 changes: 1 addition & 1 deletion source/defines.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#define APP_NAME "WiiFlow WFL"
#define APP_VERSION "5.4.0"
#define APP_VERSION "5.4.1"

#define APP_DATA_DIR "wiiflow"
#define APPS_DIR "apps/wiiflow"
Expand Down
16 changes: 13 additions & 3 deletions source/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ u8 get_wii_language()

// Nintendont
NIN_CFG NinCfg;
bool slippi;

/* since Nintendont v1.98 argsboot is supported.
since v3.324 '$$Version:' string was added for loaders to detect.
Expand All @@ -90,9 +91,13 @@ void Nintendont_SetOptions(const char *gamePath, const char *gameID, const char
u32 NIN_cfg_version = NIN_CFG_VERSION;
char NINVersion[7]= "";
u32 NINRev = 0;
const char *dol_path = NULL;
for(u8 i = SD; i < MAXDEVICES; ++i)
{
const char *dol_path = fmt(NIN_LOADER_PATH, DeviceName[i]);
if(slippi)
dol_path = fmt(NIN_SLIPPI_PATH, DeviceName[i]);
else
dol_path = fmt(NIN_LOADER_PATH, DeviceName[i]);
if(!fsop_FileExist(dol_path))
continue;
u8 *buffer = NULL;
Expand Down Expand Up @@ -213,12 +218,17 @@ bool Nintendont_Installed()
return false;
}

bool Nintendont_GetLoader()
bool Nintendont_GetLoader(bool use_slippi)
{
slippi = use_slippi;
bool ret = false;
const char *dol_path = NULL;
for(u8 i = SD; i < MAXDEVICES; ++i)
{
const char *dol_path = fmt(NIN_LOADER_PATH, DeviceName[i]);
if(slippi)
dol_path = fmt(NIN_SLIPPI_PATH, DeviceName[i]);
else
dol_path = fmt(NIN_LOADER_PATH, DeviceName[i]);
ret = (LoadHomebrew(dol_path) == 1);
if(ret == true)
{
Expand Down
3 changes: 2 additions & 1 deletion source/gc/gc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
// Nintendont
#include "nin_cfg.h"
#define NIN_LOADER_PATH "%s:/apps/nintendont/boot.dol"
#define NIN_SLIPPI_PATH "%s:/apps/nintendont slippi/boot.dol"

bool Nintendont_Installed();
bool Nintendont_GetLoader();
bool Nintendont_GetLoader(bool use_slippi);
void Nintendont_SetOptions(const char *gamePath, const char *gameID, const char *CheatPath, u8 lang, u32 n_cfg,
u32 n_vm, s8 vidscale, s8 vidoffset, u8 netprofile);

Expand Down
9 changes: 6 additions & 3 deletions source/gui/GameTDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@ int GameTDB::GetWifiPlayers(const char *id)

players = atoi(PlayersNode);

MEM2_free(data);
return players;
}

Expand Down Expand Up @@ -912,6 +913,7 @@ int GameTDB::GetPlayers(const char *id)

players = atoi(PlayersNode);

MEM2_free(data);
return players;
}

Expand Down Expand Up @@ -1005,15 +1007,16 @@ int GameTDB::GetCaseVersions(const char *id)
return altcase;
}

char *PlayersNode = GetNodeText(data, "case versions=\"", "\"");
if(!PlayersNode)
char *CaseVersionsNode = GetNodeText(data, "case versions=\"", "\"");
if(!CaseVersionsNode)
{
MEM2_free(data);
return altcase;
}

altcase = atoi(PlayersNode);
altcase = atoi(CaseVersionsNode);

MEM2_free(data);
return altcase;
}

Expand Down
5 changes: 3 additions & 2 deletions source/gui/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void CVideo::setup2DProjection(bool setViewPort, bool noScale)

if (setViewPort)
_setViewPort(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
guOrtho(projMtx, y, height2D + y, x, width2D + x, 0.f, 1000.0f);
guOrtho(projMtx, y, height2D - 1 + y, x, width2D - 1 + x, 0.f, 1000.0f);
GX_LoadProjectionMtx(projMtx, GX_ORTHOGRAPHIC);
}

Expand All @@ -299,7 +299,8 @@ void CVideo::set2DViewport(u32 w, u32 h, int x, int y)
}

/* this takes what is drawn in the frame buffer and copies it to make a new texture/image set as whatever TexData &tex is */
/* this is used by coverflow and updatebg */
/* this is used by updatebg to fade old bg into new bg */
/* and coverflow after drawing bg and covers to make mirror bg with blur */
void CVideo::renderToTexture(TexData &tex, bool clear)
{
if(tex.data == NULL)
Expand Down
78 changes: 75 additions & 3 deletions source/list/ListGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,79 @@ static void Add_Plugin_Game(char *FullPath)
m_cacheList.push_back(ListElement);
}

/* note: scummvm games have list generator in plugin.cpp */
/* notes: "description" is used as the title because it basically is the title */
/* the [GameDomain] is used as the path even though it isn't the path */
/* the [GameDomain] is usually short without any '/' */
/* in scummvm.ini the path is the path without the exe or main app file added on */
void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char *datadir, const char *platform, const string& DBName, bool UpdateCache)
{
Clear();
if(!DBName.empty())
{
if(UpdateCache)
fsop_deleteFile(DBName.c_str());
else
{
CCache(*this, DBName, LOAD);
if(!this->empty())
return;
fsop_deleteFile(DBName.c_str());
}
}

gprintf("Parsing scummvm.ini\n");
if(!ini.loaded())
return;

Config m_crc;
if(platform != NULL)
m_crc.load(fmt("%s/%s/%s.ini", datadir, platform, platform));

const char *GameDomain = ini.firstDomain().c_str();
while(1)
{
if(strlen(GameDomain) < 2)
break;
char GameName[64];
memset(GameName, 0, sizeof(GameName));
strncpy(GameName, ini.getString(GameDomain, "description").c_str(), 63);
if(strlen(GameName) < 2 || strncasecmp(Device, ini.getString(GameDomain, "path").c_str(), 2) != 0)
{
GameDomain = ini.nextDomain().c_str();
continue;
}

/* get shortName */
char *cp;
if((cp = strstr(GameName, " (")) != NULL)
*cp = '\0';

/* get Game ID */
string GameID = "PLUGIN";
// Get game ID based on GameName
if(m_crc.loaded() && m_crc.has(platform, GameName))
{
vector<string> searchID = m_crc.getStrings(platform, GameName, '|');
if(!searchID[0].empty())
GameID = searchID[0];
}

memset((void*)&ListElement, 0, sizeof(dir_discHdr));
memcpy(ListElement.id, GameID.c_str(), 6);
mbstowcs(ListElement.title, GameName, 63);
strncpy(ListElement.path, GameDomain, sizeof(ListElement.path));
ListElement.settings[0] = m_cacheList.Magic; //scummvm magic
ListElement.casecolor = m_cacheList.Color;
ListElement.type = TYPE_PLUGIN;
m_cacheList.push_back(ListElement);
GameDomain = ini.nextDomain().c_str();
}
m_crc.unload();
if(!this->empty() && !DBName.empty()) /* Write a new Cache */
CCache(*this, DBName, SAVE);
}

/* note: scummvm games are parsed above */
void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache)
{
Clear();
Expand All @@ -313,6 +385,7 @@ void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, c
}
}

platformName = "";
if(platform_cfg.loaded())
{
/* Search platform.ini to find plugin magic to get platformName */
Expand Down Expand Up @@ -344,8 +417,7 @@ void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, c
CCache(*this, DBName, SAVE);
}

void ListGenerator::CreateList(u32 Flow, const string& Path, const vector<string>& FileTypes,
const string& DBName, bool UpdateCache)
void ListGenerator::CreateList(u32 Flow, const string& Path, const vector<string>& FileTypes, const string& DBName, bool UpdateCache)
{
Clear();
if(!DBName.empty())
Expand Down
1 change: 1 addition & 0 deletions source/list/ListGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ListGenerator : public vector<dir_discHdr>
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir);
void Init(const char *settingsDir, const char *Language, const char *plgnsDataDir);
void Clear();
void ParseScummvmINI(Config &ini, const char *Device, const char *datadir, const char *platform, const string& DBName, bool UpdateCache);
void CreateRomList(Config &platform_cfg, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache);
void CreateList(u32 Flow, const string& Path, const vector<string>& FileTypes, const string& DBName, bool UpdateCache);
u32 Color;
Expand Down
17 changes: 9 additions & 8 deletions source/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,9 +1641,9 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
MusicPlayer.Pause();//note - bg music is paused but sound thread is still running. so banner gamesound still plays
m_btnMgr.tick();
m_vid.prepare();
m_vid.setup2DProjection(false, true);
m_vid.setup2DProjection(false, true);// false = prepare() already set view port, true = no scaling - draw at 640x480
_updateBg();
m_vid.setup2DProjection();
m_vid.setup2DProjection();// this time set the view port and allow scaling
_drawBg();
m_btnMgr.draw();
m_vid.render();
Expand Down Expand Up @@ -1680,7 +1680,6 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
CoverFlow.draw();
m_vid.setup2DProjection(false, true);
CoverFlow.drawEffect();
//if(startGameSound == 1 && !m_soundThrdBusy && !m_banner.GetSelectedGame() && !m_snapshot_loaded)
if(!m_soundThrdBusy && !m_banner.GetSelectedGame() && !m_snapshot_loaded)
CoverFlow.drawText(adjusting);
m_vid.renderAAPass(i);
Expand Down Expand Up @@ -2524,7 +2523,9 @@ bool CMenu::_loadPluginList()
}
else
{
vector<dir_discHdr> scummvmList;
string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord));
if(updateCache || !fsop_FileExist(cachedListFile.c_str()))
cacheCovers = true;
Config scummvm;
if(!scummvm.load(fmt("%s/scummvm.ini", m_pluginsDir.c_str())))
{
Expand All @@ -2534,11 +2535,11 @@ bool CMenu::_loadPluginList()
string platformName = "";
if(m_platform.loaded())/* convert plugin magic to platform name */
platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);
scummvmList = m_plugin.ParseScummvmINI(scummvm, DeviceName[currentPartition], Magic, m_pluginDataDir.c_str(), platformName.c_str());
for(vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++)
m_cacheList.Color = m_plugin.GetCaseColor(i);
m_cacheList.Magic = Magic;
m_cacheList.ParseScummvmINI(scummvm, DeviceName[currentPartition], m_pluginDataDir.c_str(), platformName.c_str(), cachedListFile, updateCache);
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr);
scummvmList.clear();
vector<dir_discHdr>().swap(scummvmList);
scummvm.unload();
}
}
Expand Down
6 changes: 4 additions & 2 deletions source/menu/menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ class CMenu
s16 m_gameinfoLblOverlay;
s16 m_gameLblSnap;
s16 m_gameLblOverlay;
TexData m_game_snap;
TexData m_game_overlay;
TexData m_snap;
TexData m_cart;
TexData m_overlay;
Expand Down Expand Up @@ -1104,7 +1106,7 @@ class CMenu
void _about(bool help = false);
bool _wbfsOp(WBFS_OP op);
void _cfTheme(void);
void _gameinfo(void);
bool _gameinfo(void);
void _gameSettings(const dir_discHdr *GameHdr, bool disc = false);
void _CoverBanner(void);
int _cacheCovers(void);
Expand All @@ -1129,7 +1131,7 @@ class CMenu
bool _srcTierBack(bool home);
void _srcTierLoad(string fn);
void _restoreSrcTiers();
void _setSrcFlowBg();
void _getSFlowBgTex();
void _mainLoopCommon(bool withCF = false, bool adjusting = false);
void _netInit();
void _loadDefaultFont(void);
Expand Down
32 changes: 18 additions & 14 deletions source/menu/menu_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,12 @@ void CMenu::_game(bool launch)
{
_hideGame();
m_banner.SetShowBanner(false);
_gameinfo();
m_gameSelected = false;
launch = _gameinfo();
m_gameSelected = true;
_showGame();
if(m_newGame)
startGameSound = -10;
m_banner.SetShowBanner(true);
}
/* play or stop a trailer video */
Expand Down Expand Up @@ -930,8 +934,8 @@ void CMenu::_game(bool launch)
TexData emptyTex;
m_btnMgr.setTexture(m_gameLblSnap, emptyTex);
m_btnMgr.setTexture(m_gameLblOverlay, emptyTex);
TexHandle.Cleanup(m_snap);
TexHandle.Cleanup(m_overlay);
TexHandle.Cleanup(m_game_snap);
TexHandle.Cleanup(m_game_overlay);
m_gameSelected = false;
MEM2_free(hdr);
_hideGame();
Expand Down Expand Up @@ -988,8 +992,8 @@ void CMenu::_initGameMenu()
m_gameBtnToggle = _addPicButton("GAME/TOOGLE_BTN", texToggleBanner, texToggleBanner, 385, 31, 246, 135);
m_gameBtnToggleFull = _addPicButton("GAME/TOOGLE_FULL_BTN", texToggleBanner, texToggleBanner, 20, 12, 608, 344);
m_gameLblSnapBg = _addLabel("GAME/SNAP_BG", theme.txtFont, L"", 385, 31, 246, 170, theme.txtFontColor, 0, texSnapShotBg);
m_gameLblSnap = _addLabel("GAME/SNAP", theme.txtFont, L"", 385, 31, 100, 100, theme.txtFontColor, 0, m_snap);
m_gameLblOverlay = _addLabel("GAME/OVERLAY", theme.txtFont, L"", 385, 31, 100, 100, theme.txtFontColor, 0, m_overlay);
m_gameLblSnap = _addLabel("GAME/SNAP", theme.txtFont, L"", 385, 31, 100, 100, theme.txtFontColor, 0, m_game_snap);
m_gameLblOverlay = _addLabel("GAME/OVERLAY", theme.txtFont, L"", 385, 31, 100, 100, theme.txtFontColor, 0, m_game_overlay);
// 8 pixel width frames
m_gameLblSnapFrame = _addLabel("GAME/SNAP_FRAME", theme.txtFont, L"", 377, 23, 262, 186, theme.txtFontColor, 0, texSnapShotFrame);
m_gameLblBannerFrame = _addLabel("GAME/BANNER_FRAME", theme.txtFont, L"", 377, 23, 262, 151, theme.txtFontColor, 0, texBannerFrame);
Expand Down Expand Up @@ -1168,10 +1172,10 @@ void * CMenu::_gameSoundThread(void *obj)
if(fsop_FileExist(snap_path))
{
m->m_snapshot_loaded = true;
TexHandle.fromImageFile(m->m_snap, snap_path);
TexHandle.fromImageFile(m->m_game_snap, snap_path);
/* get snapshot position and dimensions to center it on the snap background */
int snap_w = m->m_snap.width;
int snap_h = m->m_snap.height;
int snap_w = m->m_game_snap.width;
int snap_h = m->m_game_snap.height;
int width_over = snap_w - m->snapbg_w;
int height_over = snap_h - m->snapbg_h;
float aspect_ratio = (float)snap_w / (float)snap_h;
Expand All @@ -1191,24 +1195,24 @@ void * CMenu::_gameSoundThread(void *obj)

int x_pos = (m->snapbg_w - snap_w) / 2 + m->snapbg_x;
int y_pos = (m->snapbg_h - snap_h) / 2 + m->snapbg_y;
m_btnMgr.setTexture(m->m_gameLblSnap, m->m_snap, x_pos, y_pos, snap_w, snap_h);
m_btnMgr.setTexture(m->m_gameLblSnap, m->m_game_snap, x_pos, y_pos, snap_w, snap_h);

/* get possible overlay */
const char *overlay_path = fmt("%s/%s_overlay.png", m->m_snapDir.c_str(), platformName);
if(fsop_FileExist(overlay_path))
{
TexHandle.fromImageFile(m->m_overlay, overlay_path);
m_btnMgr.setTexture(m->m_gameLblOverlay, m->m_overlay, x_pos, y_pos, snap_w, snap_h);
TexHandle.fromImageFile(m->m_game_overlay, overlay_path);
m_btnMgr.setTexture(m->m_gameLblOverlay, m->m_game_overlay, x_pos, y_pos, snap_w, snap_h);
}
else
TexHandle.Cleanup(m->m_overlay);
TexHandle.Cleanup(m->m_game_overlay);
}
}
}
if(!m->m_snapshot_loaded)
{
TexHandle.Cleanup(m->m_snap);
TexHandle.Cleanup(m->m_overlay);
TexHandle.Cleanup(m->m_game_snap);
TexHandle.Cleanup(m->m_game_overlay);
}
}
if(custom_bnr_size == 0 || custom_bnr_file == NULL)
Expand Down
5 changes: 4 additions & 1 deletion source/menu/menu_game_boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,17 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
u8 netprofile = 0;
if(!IsOnWiiU())
netprofile = m_gcfg2.getUInt(id, "net_profile", 0);
// project slippi is a mod of nintendont to play patched version of smash bros melee
bool use_slippi = (m_cfg.getBool(GC_DOMAIN, "use_slippi", false) && strncasecmp(hdr->id, "GAL", 3) == 0);
gprintf("use slippi %s\n", use_slippi ? "yes" : "no");

/* configs no longer needed */
m_gcfg1.save(true);
m_gcfg2.save(true);
m_cat.save(true);
m_cfg.save(true);

bool ret = (Nintendont_GetLoader() && LoadAppBooter(fmt("%s/app_booter.bin", m_binsDir.c_str())));
bool ret = (Nintendont_GetLoader(use_slippi) && LoadAppBooter(fmt("%s/app_booter.bin", m_binsDir.c_str())));
if(ret == false)
{
error(_t("errgame14", L"app_booter.bin not found!"));
Expand Down
Loading

0 comments on commit 53a06c0

Please sign in to comment.