-fixed copy gamecube games from sd to usb, to use that feature you need to have DIOS-MIOS Lite installed and either dont have Devolution installed or set the game loader explicit to DIOS-MIOS

-fixed banner was not automatically hiding in gametdb, delete game question, copy game from usb to sd question, trailer and favourites settings
-cleaned up some stuff again
This commit is contained in:
fix94.1 2012-08-26 15:20:51 +00:00
parent 338f552d02
commit 9a1f56de1d
8 changed files with 97 additions and 67 deletions

View File

@ -35,6 +35,7 @@ void BannerWindow::Init(CVideo *vid, u8 *font1, u8 *font2)
ScreenProps.y = 400; //400 ScreenProps.y = 400; //400
sysFont1 = font1; sysFont1 = font1;
sysFont2 = font2; sysFont2 = font2;
ShowBanner = true;
video = vid; video = vid;
guMtxIdentity(modelview); guMtxIdentity(modelview);
@ -75,6 +76,7 @@ void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
gameBanner->LoadBanner(banner); gameBanner->LoadBanner(banner);
gameSelected = 1; gameSelected = 1;
changing = false; changing = false;
ShowBanner = true;
} }
void BannerWindow::DeleteBanner(bool gamechange) void BannerWindow::DeleteBanner(bool gamechange)
@ -86,6 +88,7 @@ void BannerWindow::DeleteBanner(bool gamechange)
BannerWindow::BannerWindow() BannerWindow::BannerWindow()
{ {
ShowBanner = true;
FontLoaded = false; FontLoaded = false;
changing = false; changing = false;
AnimZoom = false; AnimZoom = false;
@ -101,6 +104,7 @@ void BannerWindow::LoadBannerBin(u8 *bnr, u32 bnr_size, CVideo *vid, u8 *font1,
gameBanner->LoadBannerBin(bnr, bnr_size); gameBanner->LoadBannerBin(bnr, bnr_size);
gameSelected = 1; gameSelected = 1;
changing = false; changing = false;
ShowBanner = true;
} }
void BannerWindow::CreateGCBanner(u8 *bnr, CVideo *vid, u8 *font1, u8 *font2, const wchar_t *title) void BannerWindow::CreateGCBanner(u8 *bnr, CVideo *vid, u8 *font1, u8 *font2, const wchar_t *title)
@ -154,6 +158,9 @@ void BannerWindow::Animate(void)
void BannerWindow::Draw(void) void BannerWindow::Draw(void)
{ {
if(!ShowBanner)
return;
// draw a black background image first // draw a black background image first
if(AnimStep >= MaxAnimSteps) if(AnimStep >= MaxAnimSteps)
DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, 255.f}); DrawRectangle(0.0f, 0.0f, video->width(), video->height(), (GXColor) {0, 0, 0, 255.f});

View File

@ -56,6 +56,8 @@ class BannerWindow
void Draw(void); void Draw(void);
bool ToogleZoom(void); bool ToogleZoom(void);
void ToogleGameSettings(); void ToogleGameSettings();
bool GetShowBanner() { return ShowBanner; }
void SetShowBanner(bool show) { ShowBanner = show; }
protected: protected:
int MainLoop(); int MainLoop();
void Animate(void); void Animate(void);
@ -83,6 +85,7 @@ class BannerWindow
bool AnimZoom; bool AnimZoom;
bool AnimationRunning; bool AnimationRunning;
bool changing; bool changing;
bool ShowBanner;
float xDiff, yDiff; float xDiff, yDiff;
float iconWidth, iconHeight; float iconWidth, iconHeight;

View File

@ -61,7 +61,7 @@ bool fsop_GetFileSizeBytes(char *path, size_t *filesize) // for me stats st_size
/* /*
Recursive fsop_GetFolderBytes Recursive fsop_GetFolderBytes
*/ */
u64 fsop_GetFolderBytes(char *source) u64 fsop_GetFolderBytes(const char *source)
{ {
DIR *pdir; DIR *pdir;
struct dirent *pent; struct dirent *pent;
@ -93,7 +93,7 @@ u64 fsop_GetFolderBytes(char *source)
return bytes; return bytes;
} }
u32 fsop_GetFolderKb(char *source) u32 fsop_GetFolderKb(const char *source)
{ {
u32 ret = (u32)round((double)fsop_GetFolderBytes (source) / 1000.0); u32 ret = (u32)round((double)fsop_GetFolderBytes (source) / 1000.0);

View File

@ -9,8 +9,8 @@ extern "C"
typedef void (*progress_callback_t)(int status,int total,void *user_data); typedef void (*progress_callback_t)(int status,int total,void *user_data);
bool fsop_GetFileSizeBytes(char *path, size_t *filesize); bool fsop_GetFileSizeBytes(char *path, size_t *filesize);
u64 fsop_GetFolderBytes(char *source); u64 fsop_GetFolderBytes(const char *source);
u32 fsop_GetFolderKb(char *source); u32 fsop_GetFolderKb(const char *source);
u32 fsop_GetFreeSpaceKb(char *path); u32 fsop_GetFreeSpaceKb(char *path);
bool fsop_FileExist(const char *fn); bool fsop_FileExist(const char *fn);
bool fsop_DirExist(const char *path); bool fsop_DirExist(const char *path);

View File

@ -392,7 +392,6 @@ void CMenu::_game(bool launch)
if(m_banner->GetZoomSetting() != m_zoom_banner) if(m_banner->GetZoomSetting() != m_zoom_banner)
m_banner->ToogleZoom(); m_banner->ToogleZoom();
string id(m_cf.getId());
s8 startGameSound = 1; s8 startGameSound = 1;
while(true) while(true)
{ {
@ -403,7 +402,6 @@ void CMenu::_game(bool launch)
if(startGameSound == -5) if(startGameSound == -5)
{ {
id = m_cf.getId();
_playGameSound(); _playGameSound();
_showGame(); _showGame();
} }
@ -417,9 +415,10 @@ void CMenu::_game(bool launch)
if(BTN_B_PRESSED && (m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff))) if(BTN_B_PRESSED && (m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)))
{ {
_hideGame(); _hideGame();
m_banner->DeleteBanner(); m_banner->SetShowBanner(false);
_CategorySettings(true); _CategorySettings(true);
_showGame(); _showGame();
m_banner->SetShowBanner(true);
if(!m_gameSound.IsPlaying()) if(!m_gameSound.IsPlaying())
startGameSound = -6; startGameSound = -6;
continue; continue;
@ -435,20 +434,23 @@ void CMenu::_game(bool launch)
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)) 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(); _hideGame();
m_banner->DeleteBanner(); m_banner->SetShowBanner(false);
m_gameSelected = true; m_gameSelected = true;
_gameinfo(); _gameinfo();
_showGame(); _showGame();
m_banner->SetShowBanner(true);
if(!m_gameSound.IsPlaying()) if(!m_gameSound.IsPlaying())
startGameSound = -6; startGameSound = -6;
} }
else if(BTN_MINUS_PRESSED) else if(BTN_MINUS_PRESSED)
{ {
string videoPath = sfmt("%s/%.3s.thp", m_videoDir.c_str(), id.c_str()); string videoPath = sfmt("%s/%.3s.thp", m_videoDir.c_str(), m_cf.getId().c_str());
FILE *file = fopen(videoPath.c_str(), "rb"); FILE *file = fopen(videoPath.c_str(), "rb");
if(file) if(file)
{ {
m_gameSound.Stop();
m_banner->SetShowBanner(false);
fclose(file); fclose(file);
_hideGame(); _hideGame();
WiiMovie movie(videoPath.c_str()); WiiMovie movie(videoPath.c_str());
@ -470,7 +472,9 @@ void CMenu::_game(bool launch)
_showGame(); _showGame();
m_music.Play(); m_music.Play();
m_video_playing = false; m_video_playing = false;
//m_gameSound->play(m_bnrSndVol); m_banner->SetShowBanner(true);
if(!m_gameSound.IsPlaying())
startGameSound = -6;
} }
} }
else if((BTN_1_PRESSED) || (BTN_2_PRESSED)) else if((BTN_1_PRESSED) || (BTN_2_PRESSED))
@ -491,6 +495,7 @@ void CMenu::_game(bool launch)
if(!m_locked) if(!m_locked)
{ {
_hideGame(); _hideGame();
m_banner->SetShowBanner(false);
if(_wbfsOp(CMenu::WO_REMOVE_GAME)) if(_wbfsOp(CMenu::WO_REMOVE_GAME))
{ {
m_gameSound.FreeMemory(); m_gameSound.FreeMemory();
@ -499,13 +504,16 @@ void CMenu::_game(bool launch)
m_banner->DeleteBanner(); m_banner->DeleteBanner();
break; break;
} }
m_banner->SetShowBanner(true);
if(!m_gameSound.IsPlaying())
startGameSound = -6;
_showGame(); _showGame();
} }
} }
else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)) else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff))
m_gcfg1.setBool("FAVORITES", id, !m_gcfg1.getBool("FAVORITES", id, false)); m_gcfg1.setBool("FAVORITES", m_cf.getId(), !m_gcfg1.getBool("FAVORITES", m_cf.getId(), false));
else if(m_btnMgr.selected(m_gameBtnAdultOn) || m_btnMgr.selected(m_gameBtnAdultOff)) else if(m_btnMgr.selected(m_gameBtnAdultOn) || m_btnMgr.selected(m_gameBtnAdultOff))
m_gcfg1.setBool("ADULTONLY", id, !m_gcfg1.getBool("ADULTONLY", id, false)); m_gcfg1.setBool("ADULTONLY", m_cf.getId(), !m_gcfg1.getBool("ADULTONLY", m_cf.getId(), false));
else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull)) else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull))
{ {
m_gameSound.FreeMemory(); m_gameSound.FreeMemory();
@ -536,8 +544,14 @@ void CMenu::_game(bool launch)
else if(launch || m_btnMgr.selected(m_gameBtnPlay) || m_btnMgr.selected(m_gameBtnPlayFull) || (!WPadIR_Valid(0) && !WPadIR_Valid(1) && !WPadIR_Valid(2) && !WPadIR_Valid(3) && m_btnMgr.selected((u16)-1))) else if(launch || m_btnMgr.selected(m_gameBtnPlay) || m_btnMgr.selected(m_gameBtnPlayFull) || (!WPadIR_Valid(0) && !WPadIR_Valid(1) && !WPadIR_Valid(2) && !WPadIR_Valid(3) && m_btnMgr.selected((u16)-1)))
{ {
_hideGame(); _hideGame();
m_gameSound.FreeMemory();
CheckGameSoundThread();
ClearGameSoundThreadStack();
m_banner->DeleteBanner();
dir_discHdr *hdr = m_cf.getHdr(); dir_discHdr *hdr = m_cf.getHdr();
if(currentPartition != SD && hdr->type == TYPE_GC_GAME && m_show_dml == 2 && !m_devo_installed) m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
if(currentPartition != SD && hdr->type == TYPE_GC_GAME && m_show_dml == 2 && (strstr(hdr->path, ".iso") == NULL ||
!m_devo_installed || min((u32)m_gcfg2.getInt(hdr->id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u) == 1))
{ {
bool foundOnSD = false; bool foundOnSD = false;
CList<dir_discHdr> tmplist; CList<dir_discHdr> tmplist;
@ -556,8 +570,23 @@ void CMenu::_game(bool launch)
break; break;
} }
} }
if(!foundOnSD && !_wbfsOp(CMenu::WO_COPY_GAME)) if(!foundOnSD)
{
if(_wbfsOp(CMenu::WO_COPY_GAME))
{
char folder[50];
string GC_Path(hdr->path);
if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
else
GC_Path.erase(GC_Path.end() - 9, GC_Path.end());
memset(hdr->path, 0, sizeof(hdr->path));
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]);
snprintf(hdr->path, sizeof(hdr->path), "%s/%s", folder, &GC_Path[GC_Path.find_last_of("/")]+1);
}
else
break; break;
}
currentPartition = SD; currentPartition = SD;
} }
@ -577,11 +606,11 @@ void CMenu::_game(bool launch)
} }
banner = NULL; banner = NULL;
if(Playlog_Update(id.c_str(), banner_title) < 0) if(Playlog_Update(m_cf.getId().c_str(), banner_title) < 0)
Playlog_Delete(); Playlog_Delete();
} }
gprintf("Launching game %s\n", id.c_str()); gprintf("Launching game %s\n", m_cf.getId().c_str());
_launch(hdr); _launch(hdr);
if(m_exit) if(m_exit)
@ -592,7 +621,7 @@ void CMenu::_game(bool launch)
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--) for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height()); WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height());
m_gcfg2.unload();
_showGame(); _showGame();
_initCF(); _initCF();
m_cf.select(); m_cf.select();
@ -642,7 +671,7 @@ void CMenu::_game(bool launch)
} }
if(m_show_zone_game && !m_zoom_banner) if(m_show_zone_game && !m_zoom_banner)
{ {
bool b = m_gcfg1.getBool("FAVORITES", id, false); bool b = m_gcfg1.getBool("FAVORITES", m_cf.getId(), false);
m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff); m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff);
m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn); m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
m_btnMgr.show(m_gameBtnPlay); m_btnMgr.show(m_gameBtnPlay);
@ -658,7 +687,7 @@ void CMenu::_game(bool launch)
} }
if(!m_locked) if(!m_locked)
{ {
b = m_gcfg1.getBool("ADULTONLY", id, false); b = m_gcfg1.getBool("ADULTONLY", m_cf.getId(), false);
m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff); m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff);
m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn); m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
m_btnMgr.show(m_gameBtnSettings); m_btnMgr.show(m_gameBtnSettings);
@ -721,12 +750,15 @@ void CMenu::directlaunch(const string &id)
void CMenu::_launch(dir_discHdr *hdr) void CMenu::_launch(dir_discHdr *hdr)
{ {
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); /* No need to do that separate */
Nand::Instance()->Disable_Emu();
/* Lets boot that shit */
if(hdr->type == TYPE_WII_GAME) if(hdr->type == TYPE_WII_GAME)
{
_launchGame(hdr, false); _launchGame(hdr, false);
return; else if(hdr->type == TYPE_GC_GAME)
} _launchGC(hdr, false);
else if(hdr->type == TYPE_CHANNEL)
_launchChannel(hdr);
else if(hdr->type == TYPE_PLUGIN) else if(hdr->type == TYPE_PLUGIN)
{ {
string title(&hdr->path[string(hdr->path).find_last_of("/")+1]); string title(&hdr->path[string(hdr->path).find_last_of("/")+1]);
@ -758,7 +790,6 @@ void CMenu::_launch(dir_discHdr *hdr)
m_cfg.setString("EMULATOR", "current_item", gametitle); m_cfg.setString("EMULATOR", "current_item", gametitle);
} }
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->settings[0])), arguments); _launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->settings[0])), arguments);
return;
} }
else if(hdr->type == TYPE_HOMEBREW) else if(hdr->type == TYPE_HOMEBREW)
{ {
@ -767,17 +798,6 @@ void CMenu::_launch(dir_discHdr *hdr)
if(!fsop_FileExist((const char*)gamepath)) if(!fsop_FileExist((const char*)gamepath))
snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path); snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path);
_launchHomebrew(gamepath, m_homebrewArgs); _launchHomebrew(gamepath, m_homebrewArgs);
return;
}
else if(hdr->type == TYPE_GC_GAME)
{
_launchGC(hdr, false);
return;
}
else if(hdr->type == TYPE_CHANNEL)
{
_launchChannel(hdr);
return;
} }
} }
@ -785,9 +805,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
{ {
string id(hdr->id); string id(hdr->id);
string path(hdr->path); string path(hdr->path);
Nand::Instance()->Disable_Emu();
m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL));
@ -891,8 +908,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments) void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
{ {
Nand::Instance()->Disable_Emu();
m_gcfg1.save(true); m_gcfg1.save(true);
m_gcfg2.save(true); m_gcfg2.save(true);
m_cat.save(true); m_cat.save(true);
@ -994,7 +1009,6 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
Channels channel; Channels channel;
u32 gameIOS = 0; u32 gameIOS = 0;
u32 entry = 0; u32 entry = 0;
Nand::Instance()->Disable_Emu();
string id = string(hdr->id); string id = string(hdr->id);
bool forwarder = true; bool forwarder = true;
@ -1139,11 +1153,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
{ {
string id(hdr->id); string id(hdr->id);
string path(hdr->path); string path(hdr->path);
m_gameSound.Stop();
CheckGameSoundThread();
Nand::Instance()->Disable_Emu();
if(neek2o()) if(neek2o())
{ {
int discID = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3]; int discID = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3];

View File

@ -428,13 +428,18 @@ int CMenu::main(void)
} }
else if(m_btnMgr.selected(m_mainBtnDVD)) else if(m_btnMgr.selected(m_mainBtnDVD))
{ {
/* Cleanup for Disc Booter */
_hideMain(true); _hideMain(true);
m_cf.clear(); m_cf.clear();
_showWaitMessage(); _showWaitMessage();
m_gameSound.Stop();
CheckGameSoundThread();
Nand::Instance()->Disable_Emu();
/* Create Fake Header */
dir_discHdr hdr; dir_discHdr hdr;
memset(&hdr, 0, sizeof(dir_discHdr)); memset(&hdr, 0, sizeof(dir_discHdr));
memcpy(&hdr.id, "dvddvd", 6); memcpy(&hdr.id, "dvddvd", 6);
/* Boot the Disc */
_launchGame(&hdr, true); _launchGame(&hdr, true);
_showMain(); _showMain();
if(BTN_B_HELD) if(BTN_B_HELD)

View File

@ -125,7 +125,8 @@ int CMenu::_FindEmuPart(string *emuPath, int part, bool searchvalid)
} }
} }
if(_TestEmuNand(emuPartition, tmpPath.c_str(), true) && DeviceHandler::Instance()->IsInserted(emuPartition) && DeviceHandler::Instance()->GetFSType(emuPartition) == PART_FS_FAT) if(((_TestEmuNand(emuPartition, tmpPath.c_str(), true) && m_current_view == COVERFLOW_USB) || m_current_view == COVERFLOW_CHANNEL)
&& DeviceHandler::Instance()->IsInserted(emuPartition) && DeviceHandler::Instance()->GetFSType(emuPartition) == PART_FS_FAT)
{ {
*emuPath = tmpPath; *emuPath = tmpPath;
return emuPartition; return emuPartition;

View File

@ -229,15 +229,19 @@ int CMenu::_GCcopyGame(void *obj)
char folder[50]; char folder[50];
char source[300]; char source[300];
char target[300]; char target[300];
snprintf(folder, sizeof(folder), m.m_DMLgameDir.c_str(), DeviceName[currentPartition]);
snprintf(source, sizeof(source), "%s/%s", folder, m.m_cf.getHdr()->path); string GC_Path(m.m_cf.getHdr()->path);
memset(folder, 0, sizeof(folder)); if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
else
GC_Path.erase(GC_Path.end() - 9, GC_Path.end());
strncpy(source, GC_Path.c_str(), sizeof(source));
snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]); snprintf(folder, sizeof(folder), DML_DIR, DeviceName[SD]);
snprintf(target, sizeof(target), "%s/%s", folder, m.m_cf.getHdr()->path); snprintf(target, sizeof(target), "%s/%s", folder, &GC_Path[GC_Path.find_last_of("/")]+1);
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m._setThrdMsg(L"", 0); m._setThrdMsg(L"", 0);
gprintf("Copying from:\n%s\nto:\n%s\n",source,target); gprintf("Copying from:\n%s\nto:\n%s\n", source, target);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
if (!fsop_DirExist(folder)) if (!fsop_DirExist(folder))
fsop_MakeFolder(folder); fsop_MakeFolder(folder);
@ -409,14 +413,15 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
case CMenu::WO_FORMAT: case CMenu::WO_FORMAT:
break; break;
case CMenu::WO_COPY_GAME: case CMenu::WO_COPY_GAME:
char folder[50]; string GC_Path(m_cf.getHdr()->path);
char source[300]; if(strcasestr(GC_Path.c_str(), "boot.bin") != NULL)
snprintf(folder, sizeof(folder), m_DMLgameDir.c_str(), DeviceName[currentPartition]); GC_Path.erase(GC_Path.end() - 13, GC_Path.end());
snprintf(source, sizeof(source), "%s/%s", folder, m_cf.getHdr()->path); else
if(fsop_GetFreeSpaceKb((char*)"sd:/")<fsop_GetFolderKb(source)) GC_Path.erase(GC_Path.end() - 9, GC_Path.end());
if(fsop_GetFreeSpaceKb((char*)"sd:/")<fsop_GetFolderKb(GC_Path.c_str()))
{ {
m_btnMgr.hide(m_wbfsBtnGo); m_btnMgr.hide(m_wbfsBtnGo);
_setThrdMsg(wfmt(_fmt("wbfsop24", L"Not enough space: %d blocks needed, %d available"), fsop_GetFolderKb(source), fsop_GetFreeSpaceKb((char*)"sd:/")), 0.f); _setThrdMsg(wfmt(_fmt("wbfsop24", L"Not enough space: %d blocks needed, %d available"), fsop_GetFolderKb(GC_Path.c_str()), fsop_GetFreeSpaceKb((char*)"sd:/")), 0.f);
break; break;
} }