mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
-added better check if DML game is already
installed -added possibility to delete DML game
This commit is contained in:
parent
cb478c4dd3
commit
714047d220
@ -1,5 +1,11 @@
|
|||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include "gc.h"
|
#include "gc.h"
|
||||||
|
#include "gecko.h"
|
||||||
|
|
||||||
|
#define MAX_FAT_PATH 1024
|
||||||
|
|
||||||
#define SRAM_ENGLISH 0
|
#define SRAM_ENGLISH 0
|
||||||
#define SRAM_GERMAN 1
|
#define SRAM_GERMAN 1
|
||||||
@ -86,4 +92,50 @@ void set_language(u8 lang)
|
|||||||
|
|
||||||
__SYS_UnlockSram(1); // 1 -> write changes
|
__SYS_UnlockSram(1); // 1 -> write changes
|
||||||
while(!__SYS_SyncSram());
|
while(!__SYS_SyncSram());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DML_RemoveGame(const char *discid)
|
||||||
|
{
|
||||||
|
int num = 6;
|
||||||
|
const char *fl[6] = {"sd:/games/%s/game.iso","sd:/games/%s/sys/boot.bin","sd:/games/%s/sys/bi2.bin",
|
||||||
|
"sd:/games/%s/sys/apploader.img","sd:/games/%s/sys","sd:/games/%s"};
|
||||||
|
char fname[MAX_FAT_PATH];
|
||||||
|
FILE *f;
|
||||||
|
DIR *dir;
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
sprintf(fname, fl[i], discid);
|
||||||
|
f = fopen((char*)fname, "r");
|
||||||
|
if(f)
|
||||||
|
{
|
||||||
|
gprintf("Deleting %s...\n",fname);
|
||||||
|
fclose(f);
|
||||||
|
remove(fname);
|
||||||
|
}
|
||||||
|
dir = opendir((char*)fname);
|
||||||
|
if(dir)
|
||||||
|
{
|
||||||
|
gprintf("Deleting %s...\n",fname);
|
||||||
|
closedir(dir);
|
||||||
|
unlink((char*)fname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DML_GameIsInstalled(char *discid)
|
||||||
|
{
|
||||||
|
char filepath[64];
|
||||||
|
sprintf(filepath, "sd:/games/%s/game.iso", discid);
|
||||||
|
|
||||||
|
gprintf("Filepath on SD: %s\n", filepath);
|
||||||
|
|
||||||
|
FILE *f = fopen(filepath, "r");
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
gprintf("Not found\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -7,6 +7,8 @@ extern "C"
|
|||||||
#define GC_H_
|
#define GC_H_
|
||||||
void set_video_mode(int i);
|
void set_video_mode(int i);
|
||||||
void set_language(u8 lang);
|
void set_language(u8 lang);
|
||||||
|
void DML_RemoveGame(const char *discid);
|
||||||
|
bool DML_GameIsInstalled(char *discid);
|
||||||
#endif //GC_H_
|
#endif //GC_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -512,7 +512,7 @@ void CMenu::_game(bool launch)
|
|||||||
m_btnMgr.show(m_gameBtnSettings);
|
m_btnMgr.show(m_gameBtnSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_current_view == COVERFLOW_USB && !m_locked)
|
if ((m_current_view == COVERFLOW_USB || m_current_view == COVERFLOW_DML) && !m_locked)
|
||||||
m_btnMgr.show(m_gameBtnDelete);
|
m_btnMgr.show(m_gameBtnDelete);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "loader/wbfs.h"
|
#include "loader/wbfs.h"
|
||||||
#include "lockMutex.hpp"
|
#include "lockMutex.hpp"
|
||||||
#include "loader/gc_disc.hpp"
|
#include "loader/gc_disc.hpp"
|
||||||
|
#include "gc.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -178,7 +179,6 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
bool upd_usb = false;
|
bool upd_usb = false;
|
||||||
bool upd_dml = false;
|
bool upd_dml = false;
|
||||||
bool out = false;
|
bool out = false;
|
||||||
bool del_cover = true;
|
|
||||||
struct AutoLight { AutoLight(void) { } ~AutoLight(void) { slotLight(false); } } aw;
|
struct AutoLight { AutoLight(void) { } ~AutoLight(void) { slotLight(false); } } aw;
|
||||||
string cfPos = m_cf.getNextId();
|
string cfPos = m_cf.getNextId();
|
||||||
|
|
||||||
@ -258,7 +258,9 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
{
|
{
|
||||||
Disc_ReadGCHeader(&gcheader);
|
Disc_ReadGCHeader(&gcheader);
|
||||||
|
|
||||||
if (_searchGamesByID((const char *) gcheader.id).size() != 0)
|
char gcfolder[64];
|
||||||
|
sprintf(gcfolder, "%s [%s]", gcheader.title, (char *)gcheader.id);
|
||||||
|
if (_searchGamesByID((const char *) gcheader.id).size() != 0 || DML_GameIsInstalled((char *)gcheader.id) || DML_GameIsInstalled(gcfolder))
|
||||||
{
|
{
|
||||||
error(_t("wbfsoperr4", L"Game already installed"));
|
error(_t("wbfsoperr4", L"Game already installed"));
|
||||||
out = true;
|
out = true;
|
||||||
@ -278,12 +280,14 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
error(_t("wbfsoperr3", L"This is not a Wii or GC disc!"));
|
error(_t("wbfsoperr3", L"This is not a Wii or GC disc!"));
|
||||||
out = true;
|
out = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CMenu::WO_REMOVE_GAME:
|
case CMenu::WO_REMOVE_GAME:
|
||||||
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), (char *) m_cf.getHdr()->path);
|
if(m_current_view == COVERFLOW_USB)
|
||||||
del_cover = m_cfg.getBool("GENERAL", "delete_cover_and_game", true);
|
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), (char *) m_cf.getHdr()->path);
|
||||||
if(del_cover)
|
else
|
||||||
|
DML_RemoveGame(m_cf.getHdr()->path);
|
||||||
|
if(m_cfg.getBool("GENERAL", "delete_cover_and_game", true))
|
||||||
RemoveCover((char *)m_cf.getId().c_str());
|
RemoveCover((char *)m_cf.getId().c_str());
|
||||||
m_btnMgr.show(m_wbfsPBar);
|
m_btnMgr.show(m_wbfsPBar);
|
||||||
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
|
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user