mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 11:19:17 +01:00
*Fixed DVD support in IOS58 modus. You have to have AHBPROT flag enabled for the DVD access support in IOS58 mode. It might be possible that the forwarder channel does not have it set yet. Start from HBC 1.0.8 with IOS58 and you will have it for sure.
*Fixed several leaks *Source optimization *Reworked new titles class (a few leaks fixed)
This commit is contained in:
parent
3503f114ed
commit
4a3d3fb31b
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>2.0 r1041</version>
|
||||
<release_date>201101111755</release_date>
|
||||
<version>2.0 r1042</version>
|
||||
<release_date>201101121930</release_date>
|
||||
<no_ios_reload/>
|
||||
<short_description>Loads games from USB-devices</short_description>
|
||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||
|
2
Makefile
2
Makefile
@ -63,7 +63,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lpngu -lpng -lgd -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec \
|
||||
-lmad -lmxml -ljpeg -lzip -lcustomfat -lcustomntfs -lcustomext2fs
|
||||
-lmad -lmxml -ljpeg -lzip -lcustomfat -lcustomntfs -lcustomext2fs -ldi
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
|
@ -91,7 +91,7 @@ void Mp3Decoder::OpenFile()
|
||||
}
|
||||
|
||||
u8 dummybuff[4096];
|
||||
int ret = Read((u8 *) &dummybuff, 4096, 0);
|
||||
int ret = Read(dummybuff, 4096, 0);
|
||||
if(ret <= 0)
|
||||
{
|
||||
if(file_fd)
|
||||
|
@ -322,7 +322,7 @@ int HomebrewBrowser::ReceiveFile()
|
||||
// It's a zip file, unzip to the apps directory
|
||||
// Zip archive, ask for permission to install the zip
|
||||
char zippath[255];
|
||||
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
|
||||
sprintf(zippath, "%s%s", Settings.homebrewapps_path, filename);
|
||||
|
||||
FILE *fp = fopen(zippath, "wb");
|
||||
if (!fp)
|
||||
|
@ -85,7 +85,7 @@ int DownloadFileToMem(const char *url, u8 **inbuffer, u32 *size)
|
||||
char filename[255];
|
||||
memset(filename, 0, sizeof(filename));
|
||||
|
||||
int filesize = network_request(connection, header, (char *) &filename);
|
||||
int filesize = network_request(connection, header, filename);
|
||||
|
||||
if(filesize <= 0)
|
||||
{
|
||||
@ -205,7 +205,7 @@ int DownloadFileToPath(const char *orig_url, const char *dest, bool UseFilename)
|
||||
char filename[255];
|
||||
memset(filename, 0, sizeof(filename));
|
||||
|
||||
int filesize = network_request(connection, header, (char *) &filename);
|
||||
int filesize = network_request(connection, header, filename);
|
||||
|
||||
if(filesize <= 0)
|
||||
{
|
||||
|
@ -11,8 +11,7 @@ bool Anti_002_fix(u8 * Address, int Size)
|
||||
{
|
||||
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
u8 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
return PatchDOL(Address, Size, (const u8 *) &SearchPattern, sizeof(SearchPattern), (const u8 *) &PatchData,
|
||||
sizeof(PatchData));
|
||||
return PatchDOL(Address, Size, (const u8 *) SearchPattern, sizeof(SearchPattern), (const u8 *) PatchData, sizeof(PatchData));
|
||||
}
|
||||
|
||||
bool NSMBPatch()
|
||||
|
@ -20,7 +20,7 @@ CGameStatistics::~CGameStatistics()
|
||||
{
|
||||
}
|
||||
|
||||
GameStatus * CGameStatistics::GetGameStatus(const char * id)
|
||||
GameStatus * CGameStatistics::GetGameStatus(const char * id) const
|
||||
{
|
||||
if(!id)
|
||||
return NULL;
|
||||
@ -29,7 +29,7 @@ GameStatus * CGameStatistics::GetGameStatus(const char * id)
|
||||
{
|
||||
if(strncmp(id, GameList[i].id, 6) == 0)
|
||||
{
|
||||
return &GameList[i];
|
||||
return (GameStatus *) &GameList[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ bool CGameStatistics::ReadGameID(const char * src, char * GameID, int size)
|
||||
|
||||
return true;
|
||||
}
|
||||
#include "gecko.h"
|
||||
|
||||
void CGameStatistics::ParseLine(char *line)
|
||||
{
|
||||
char name[1024], value[1024];
|
||||
@ -238,7 +238,6 @@ void CGameStatistics::ParseLine(char *line)
|
||||
this->TrimLine(name, LinePtr, sizeof(name));
|
||||
this->TrimLine(value, eq + 1, sizeof(value));
|
||||
|
||||
//gprintf("ID: %s, Name = %s, Value = %s\n", GameID, name, value);
|
||||
SetSetting(NewGame, name, value);
|
||||
|
||||
LinePtr = strchr(LinePtr, ';');
|
||||
@ -304,7 +303,7 @@ void CGameStatistics::SetFavoriteRank(const char * id, int rank)
|
||||
AddGame(NewStatus);
|
||||
}
|
||||
|
||||
int CGameStatistics::GetPlayCount(const char * id)
|
||||
int CGameStatistics::GetPlayCount(const char * id) const
|
||||
{
|
||||
if(!id)
|
||||
return 0;
|
||||
@ -316,7 +315,7 @@ int CGameStatistics::GetPlayCount(const char * id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CGameStatistics::GetFavoriteRank(const char * id)
|
||||
int CGameStatistics::GetFavoriteRank(const char * id) const
|
||||
{
|
||||
if(!id)
|
||||
return 0;
|
||||
|
@ -38,23 +38,23 @@ class CGameStatistics
|
||||
void SetPlayCount(const u8 * id, int count) { SetPlayCount((const char *) id, count); };
|
||||
void SetPlayCount(const struct discHdr * game, int count) { if(!game) return; SetPlayCount(game->id, count); };
|
||||
//!Overloads for get playcount
|
||||
int GetPlayCount(const char * id);
|
||||
int GetPlayCount(const u8 * id) { return GetPlayCount((const char *) id); };
|
||||
int GetPlayCount(const struct discHdr * game) { if(!game) return 0; else return GetPlayCount(game->id); };
|
||||
int GetPlayCount(const char * id) const;
|
||||
int GetPlayCount(const u8 * id) const { return GetPlayCount((const char *) id); };
|
||||
int GetPlayCount(const struct discHdr * game) const { if(!game) return 0; else return GetPlayCount(game->id); };
|
||||
//!Overloads for set FavoriteRank
|
||||
void SetFavoriteRank(const char * id, int rank);
|
||||
void SetFavoriteRank(const u8 * id, int rank) { SetFavoriteRank((const char *) id, rank); };
|
||||
void SetFavoriteRank(const struct discHdr * game, int rank) { if(!game) return; SetFavoriteRank(game->id, rank); };
|
||||
//!Overloads for get FavoriteRank
|
||||
int GetFavoriteRank(const char * id);
|
||||
int GetFavoriteRank(const u8 * id) { return GetFavoriteRank((const char *) id); };
|
||||
int GetFavoriteRank(const struct discHdr * game) { if(!game) return 0; else return GetFavoriteRank(game->id); };
|
||||
int GetFavoriteRank(const char * id) const;
|
||||
int GetFavoriteRank(const u8 * id) const { return GetFavoriteRank((const char *) id); };
|
||||
int GetFavoriteRank(const struct discHdr * game) const { if(!game) return 0; else return GetFavoriteRank(game->id); };
|
||||
//!Get GameStatus
|
||||
GameStatus * GetGameStatus(const char * id);
|
||||
GameStatus * GetGameStatus(const char * id) const;
|
||||
//!Overload
|
||||
GameStatus * GetGameStatus(const u8 * id) { return GetGameStatus((const char *) id); };
|
||||
GameStatus * GetGameStatus(const u8 * id) const { return GetGameStatus((const char *) id); };
|
||||
//!Overload
|
||||
GameStatus * GetGameStatus(const struct discHdr * game) { if(!game) return NULL; else return GetGameStatus(game->id); };
|
||||
GameStatus * GetGameStatus(const struct discHdr * game) const { if(!game) return NULL; else return GetGameStatus(game->id); };
|
||||
|
||||
protected:
|
||||
bool ReadGameID(const char * src, char * GameID, int size);
|
||||
|
@ -34,7 +34,7 @@ void CGameTitles::SetGameTitle(const char * id, const char * title)
|
||||
TitleList.push_back(newTitle);
|
||||
}
|
||||
|
||||
const char * CGameTitles::GetTitle(const char * id)
|
||||
const char * CGameTitles::GetTitle(const char * id) const
|
||||
{
|
||||
if(!id)
|
||||
return NULL;
|
||||
@ -48,7 +48,7 @@ const char * CGameTitles::GetTitle(const char * id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * CGameTitles::GetTitle(const struct discHdr *header)
|
||||
const char * CGameTitles::GetTitle(const struct discHdr *header) const
|
||||
{
|
||||
if(!header)
|
||||
return NULL;
|
||||
@ -62,7 +62,7 @@ const char * CGameTitles::GetTitle(const struct discHdr *header)
|
||||
return header->title;
|
||||
}
|
||||
|
||||
int CGameTitles::GetParentalRating(const char * id)
|
||||
int CGameTitles::GetParentalRating(const char * id) const
|
||||
{
|
||||
if(!id)
|
||||
return -1;
|
||||
|
@ -23,14 +23,14 @@ class CGameTitles
|
||||
void SetGameTitle(const u8 * id, const char * title) { SetGameTitle((const char *) id, title); };
|
||||
|
||||
//! Get a game title
|
||||
const char * GetTitle(const char * id);
|
||||
const char * GetTitle(const char * id) const;
|
||||
//! Overload
|
||||
const char * GetTitle(const u8 * id) { return GetTitle((const char *) id); };
|
||||
const char * GetTitle(const u8 * id) const { return GetTitle((const char *) id); };
|
||||
//! Overload
|
||||
const char * GetTitle(const struct discHdr *header);
|
||||
const char * GetTitle(const struct discHdr *header) const;
|
||||
|
||||
//! Get game parental rating
|
||||
int GetParentalRating(const char * id);
|
||||
int GetParentalRating(const char * id) const;
|
||||
|
||||
//! Load Game Titles from WiiTDB
|
||||
void LoadTitlesFromWiiTDB(const char * path);
|
||||
|
@ -5,29 +5,11 @@
|
||||
#include "settings/CGameStatistics.h"
|
||||
#include "newtitles.h"
|
||||
|
||||
#define NEW_SECONDS 24 * 60 * 60
|
||||
#define GAMETITLES "gametitles.txt"
|
||||
#define NEW_SECONDS (24 * 60 * 60)
|
||||
#define GAMETITLES "GameTimestamps.txt"
|
||||
|
||||
NewTitles *NewTitles::instance = NULL;
|
||||
|
||||
NewTitles* NewTitles::Instance()
|
||||
{
|
||||
if (instance == NULL)
|
||||
{
|
||||
instance = new NewTitles();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
void NewTitles::DestroyInstance()
|
||||
{
|
||||
if (instance != NULL)
|
||||
{
|
||||
delete instance;
|
||||
instance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
NewTitles::NewTitles()
|
||||
{
|
||||
firstTitle = lastTitle = NULL;
|
||||
@ -35,46 +17,51 @@ NewTitles::NewTitles()
|
||||
|
||||
// Read the text file
|
||||
char path[255];
|
||||
strcpy(path, Settings.titlestxt_path);
|
||||
path[strlen(Settings.titlestxt_path) - 1] = '/';
|
||||
strcat(path, GAMETITLES);
|
||||
snprintf(path, sizeof(path), Settings.titlestxt_path);
|
||||
if(path[strlen(path)-1] != '/')
|
||||
strcat(path, "/");
|
||||
|
||||
char line[20];
|
||||
FILE *fp = fopen(path, "r");
|
||||
if (fp != NULL)
|
||||
{
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
{
|
||||
// This is one line
|
||||
if (line[0] != '#' || line[0] != ';')
|
||||
{
|
||||
Title *title = new Title();
|
||||
if (sscanf(line, "%6c:%ld", (u8 *) &title->titleId, &title->timestamp) == 2)
|
||||
{
|
||||
if (firstTitle == NULL)
|
||||
{
|
||||
firstTitle = title;
|
||||
lastTitle = title;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastTitle->next = title;
|
||||
lastTitle = title;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete title; // Invalid title entry, ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf(path, sizeof(path), "%s%s", path, GAMETITLES);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
char line[50];
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
isNewFile = true;
|
||||
return;
|
||||
}
|
||||
|
||||
time_t currenttime = time(0);
|
||||
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
{
|
||||
// This is one line
|
||||
if (line[0] == '#' || line[0] == ';')
|
||||
continue;
|
||||
|
||||
Title *title = new Title();
|
||||
if (sscanf(line, "%6c:%lu", title->titleId, &title->timestamp) != 2)
|
||||
{
|
||||
delete title; // Invalid title entry, ignore
|
||||
continue;
|
||||
}
|
||||
|
||||
title->next = NULL;
|
||||
title->isNew = ((currenttime - title->timestamp) < NEW_SECONDS);
|
||||
|
||||
if (firstTitle == NULL)
|
||||
{
|
||||
firstTitle = title;
|
||||
lastTitle = title;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastTitle->next = title;
|
||||
lastTitle = title;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
NewTitles::~NewTitles()
|
||||
@ -84,39 +71,44 @@ NewTitles::~NewTitles()
|
||||
Title *t = firstTitle;
|
||||
while (t != NULL)
|
||||
{
|
||||
Title *temp = (Title *) t->next;
|
||||
Title *temp = t->next;
|
||||
delete t;
|
||||
t = temp;
|
||||
}
|
||||
firstTitle = lastTitle = NULL;
|
||||
}
|
||||
|
||||
void NewTitles::CheckGame(u8 *titleid)
|
||||
void NewTitles::CheckGame(const u8 *titleid)
|
||||
{
|
||||
if (titleid == NULL || strlen((char *) titleid) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Title *t = firstTitle;
|
||||
while (t != NULL)
|
||||
{
|
||||
// Loop all titles, search for the correct titleid
|
||||
if (strcmp((const char *) titleid, (const char *) t->titleId) == 0)
|
||||
{
|
||||
if (memcmp(titleid, t->titleId, 6) == 0)
|
||||
return; // Game found, which is excellent
|
||||
}
|
||||
t = (Title *) t->next;
|
||||
|
||||
t = t->next;
|
||||
}
|
||||
|
||||
// Not found, add it
|
||||
t = new Title();
|
||||
strncpy((char *) t->titleId, (char *) titleid, 6);
|
||||
t->timestamp = time(NULL);
|
||||
t = new Title;
|
||||
snprintf(t->titleId, sizeof(t->titleId), (char *) titleid);
|
||||
t->timestamp = time(0);
|
||||
t->next = NULL;
|
||||
|
||||
if (isNewFile)
|
||||
{
|
||||
t->isNew = false;
|
||||
t->timestamp -= (NEW_SECONDS + 1); // Mark all games as not new if this is a new file
|
||||
}
|
||||
else
|
||||
{
|
||||
GameStatus *Status = GameStatistics.GetGameStatus(titleid);
|
||||
t->isNew = (Status == NULL || Status->PlayCount == 0);
|
||||
}
|
||||
|
||||
if (firstTitle == NULL)
|
||||
{
|
||||
@ -125,64 +117,50 @@ void NewTitles::CheckGame(u8 *titleid)
|
||||
}
|
||||
else
|
||||
{
|
||||
lastTitle -> next = t;
|
||||
lastTitle->next = t;
|
||||
lastTitle = t;
|
||||
}
|
||||
isDirty = true;
|
||||
}
|
||||
|
||||
bool NewTitles::IsNew(u8 *titleid)
|
||||
bool NewTitles::IsNew(const u8 *titleid) const
|
||||
{
|
||||
if (titleid == NULL || strlen((char *) titleid) == 0) return false;
|
||||
if (!titleid) return false;
|
||||
|
||||
Title *t = firstTitle;
|
||||
|
||||
while (t != NULL)
|
||||
while(t != NULL)
|
||||
{
|
||||
// Loop all titles, search for the correct titleid
|
||||
if (strcmp((const char *) titleid, (const char *) t->titleId) == 0)
|
||||
{
|
||||
// This title is less than 24 hours old
|
||||
if ((time(NULL) - t->timestamp) < NEW_SECONDS)
|
||||
{
|
||||
// Only count the game as new when it's never been played through GX
|
||||
GameStatus *gnum = GameStatistics.GetGameStatus(titleid);
|
||||
return gnum == NULL || gnum->PlayCount == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
t = (Title *) t->next;
|
||||
}
|
||||
// We should never get here, since all files should be added by now!
|
||||
CheckGame(titleid);
|
||||
if (memcmp(titleid, t->titleId, 6) == 0)
|
||||
return t->isNew;
|
||||
|
||||
return !isNewFile; // If this is a new file, return false
|
||||
t = t->next;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void NewTitles::Remove(u8 *titleid)
|
||||
void NewTitles::Remove(const u8 *titleid)
|
||||
{
|
||||
if (titleid == NULL || strlen((char *) titleid) == 0) return;
|
||||
if (titleid == NULL) return;
|
||||
|
||||
Title *t = firstTitle, *prev = NULL;
|
||||
while (t != NULL)
|
||||
{
|
||||
if (strcmp((const char *) titleid, (const char *) t->titleId) == 0)
|
||||
if (memcmp(titleid, t->titleId, 6) == 0)
|
||||
{
|
||||
if (prev == NULL)
|
||||
{
|
||||
firstTitle = (Title *) t->next;
|
||||
}
|
||||
firstTitle = t->next;
|
||||
else
|
||||
{
|
||||
prev->next = t->next;
|
||||
}
|
||||
|
||||
delete t;
|
||||
isDirty = true;
|
||||
|
||||
return;
|
||||
}
|
||||
prev = t;
|
||||
t = (Title *) t->next;
|
||||
t = t->next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,19 +169,21 @@ void NewTitles::Save()
|
||||
if (!isDirty) return;
|
||||
|
||||
char path[255];
|
||||
strcpy(path, Settings.titlestxt_path);
|
||||
path[strlen(Settings.titlestxt_path) - 1] = '/';
|
||||
strcat(path, GAMETITLES);
|
||||
snprintf(path, sizeof(path), Settings.titlestxt_path);
|
||||
if(path[strlen(path)-1] != '/')
|
||||
strcat(path, "/");
|
||||
|
||||
FILE *fp = fopen(path, "w");
|
||||
if (fp != NULL)
|
||||
snprintf(path, sizeof(path), "%s%s", path, GAMETITLES);
|
||||
|
||||
FILE *fp = fopen(path, "wb");
|
||||
if (fp == NULL)
|
||||
return;
|
||||
|
||||
Title *t = firstTitle;
|
||||
while (t != NULL && strlen(t->titleId) > 0)
|
||||
{
|
||||
Title *t = firstTitle;
|
||||
while (t != NULL && strlen((char *) t->titleId) > 0)
|
||||
{
|
||||
fprintf(fp, "%s:%ld\n", t->titleId, t->timestamp);
|
||||
t = (Title *) t->next;
|
||||
}
|
||||
fclose(fp);
|
||||
fprintf(fp, "%s:%lu\n", t->titleId, t->timestamp);
|
||||
t = t->next;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
@ -6,13 +6,13 @@
|
||||
class NewTitles
|
||||
{
|
||||
public:
|
||||
static NewTitles *Instance();
|
||||
static void DestroyInstance();
|
||||
static NewTitles *Instance() { if(!instance) instance = new NewTitles(); return instance; }
|
||||
static void DestroyInstance() { delete instance; instance = NULL; }
|
||||
|
||||
void Save();
|
||||
void CheckGame(u8 *titleid);
|
||||
bool IsNew(u8 *titleid);
|
||||
void Remove(u8 *titleid);
|
||||
void CheckGame(const u8 *titleid);
|
||||
bool IsNew(const u8 *titleid) const;
|
||||
void Remove(const u8 *titleid);
|
||||
private:
|
||||
NewTitles();
|
||||
~NewTitles();
|
||||
@ -22,9 +22,10 @@ class NewTitles
|
||||
class Title
|
||||
{
|
||||
public:
|
||||
u8 titleId[6];
|
||||
char titleId[7];
|
||||
time_t timestamp;
|
||||
void *next;
|
||||
Title *next;
|
||||
bool isNew;
|
||||
};
|
||||
|
||||
Title *firstTitle;
|
||||
|
@ -37,11 +37,6 @@
|
||||
|
||||
GameList gameList;
|
||||
|
||||
GameList::GameList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GameList::clear()
|
||||
{
|
||||
GameFilter.clear();
|
||||
@ -53,14 +48,7 @@ void GameList::clear()
|
||||
std::vector<struct discHdr>().swap(FullGameList);
|
||||
}
|
||||
|
||||
struct discHdr * GameList::at(int i)
|
||||
{
|
||||
if (i < 0 || i >= (int) FilteredList.size()) return NULL;
|
||||
|
||||
return FilteredList[i];
|
||||
}
|
||||
|
||||
struct discHdr * GameList::GetDiscHeader(const char * gameID)
|
||||
struct discHdr * GameList::GetDiscHeader(const char * gameID) const
|
||||
{
|
||||
for (u32 i = 0; i < FilteredList.size(); ++i)
|
||||
{
|
||||
@ -148,15 +136,12 @@ int GameList::FilterList(const wchar_t * gameFilter)
|
||||
|
||||
GameCFG * GameConfig = GameSettings.GetGameCFG(header);
|
||||
|
||||
/* Rating based parental control method */
|
||||
if (Settings.parentalcontrol != 4 && !Settings.godmode)
|
||||
{
|
||||
if (GameConfig && GameConfig->parentalcontrol > Settings.parentalcontrol)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Rating based parental control method */
|
||||
if (Settings.parentalcontrol != 4 && Settings.godmode == 0)
|
||||
{
|
||||
// Check game rating in WiiTDB, since the default Wii parental control setting is enabled
|
||||
int rating = GameTitles.GetParentalRating((char *) header->id);
|
||||
if (rating > Settings.parentalcontrol)
|
||||
@ -168,7 +153,6 @@ int GameList::FilterList(const wchar_t * gameFilter)
|
||||
continue;
|
||||
|
||||
wchar_t *gameName = charToWideChar(GameTitles.GetTitle(header));
|
||||
|
||||
if (gameName && *GameFilter.c_str())
|
||||
{
|
||||
if (wcsnicmp(gameName, GameFilter.c_str(), GameFilter.size()) != 0)
|
||||
@ -193,7 +177,8 @@ int GameList::FilterList(const wchar_t * gameFilter)
|
||||
|
||||
AvailableSearchChars.push_back(L'\0');
|
||||
|
||||
if (FilteredList.size() < 2) AvailableSearchChars.clear();
|
||||
if (FilteredList.size() < 2)
|
||||
AvailableSearchChars.clear();
|
||||
|
||||
SortList();
|
||||
|
||||
@ -218,8 +203,8 @@ int GameList::LoadUnfiltered()
|
||||
wchar_t *gameName = charToWideChar(GameTitles.GetTitle(header));
|
||||
if (gameName)
|
||||
{
|
||||
if (wcslen(gameName) > GameFilter.size() && AvailableSearchChars.find(gameName[GameFilter.size()])
|
||||
== std::string::npos) AvailableSearchChars.push_back(gameName[GameFilter.size()]);
|
||||
if (wcslen(gameName) > GameFilter.size() && AvailableSearchChars.find(gameName[GameFilter.size()]) == std::string::npos)
|
||||
AvailableSearchChars.push_back(gameName[GameFilter.size()]);
|
||||
delete[] gameName;
|
||||
}
|
||||
|
||||
@ -230,7 +215,8 @@ int GameList::LoadUnfiltered()
|
||||
|
||||
AvailableSearchChars.push_back(L'\0');
|
||||
|
||||
if (FilteredList.size() < 2) AvailableSearchChars.clear();
|
||||
if (FilteredList.size() < 2)
|
||||
AvailableSearchChars.clear();
|
||||
|
||||
SortList();
|
||||
|
||||
@ -254,8 +240,8 @@ void GameList::SortList()
|
||||
std::sort(FilteredList.begin(), FilteredList.end(), NameSortCallback);
|
||||
}
|
||||
|
||||
if (AvailableSearchChars.size() > 1) std::sort(AvailableSearchChars.begin(), AvailableSearchChars.end(),
|
||||
WCharSortCallback);
|
||||
if (AvailableSearchChars.size() > 1)
|
||||
std::sort(AvailableSearchChars.begin(), AvailableSearchChars.end(), WCharSortCallback);
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,19 +8,29 @@
|
||||
class GameList
|
||||
{
|
||||
public:
|
||||
GameList();
|
||||
GameList() : selectedGame(0) { };
|
||||
int ReadGameList();
|
||||
int size() { return FilteredList.size(); };
|
||||
int GameCount() { return FullGameList.size(); };
|
||||
int size() const { return FilteredList.size(); }
|
||||
int GameCount() const { return FullGameList.size(); }
|
||||
int FilterList(const wchar_t * gameFilter = NULL);
|
||||
int LoadUnfiltered();
|
||||
struct discHdr * at(int i);
|
||||
struct discHdr * operator[](int i) { return at(i); };
|
||||
struct discHdr * GetDiscHeader(const char * gameID);
|
||||
const wchar_t * GetCurrentFilter() { return GameFilter.c_str(); };
|
||||
const wchar_t * GetAvailableSearchChars() { return AvailableSearchChars.c_str(); };
|
||||
struct discHdr * at(int i) const { return operator[](i); }
|
||||
struct discHdr * operator[](int i) const { if (i < 0 || i >= (int) FilteredList.size()) return NULL; return FilteredList[i]; }
|
||||
struct discHdr * GetDiscHeader(const char * gameID) const;
|
||||
const wchar_t * GetCurrentFilter() const { return GameFilter.c_str(); }
|
||||
const wchar_t * GetAvailableSearchChars() const { return AvailableSearchChars.c_str(); }
|
||||
void SortList();
|
||||
void clear();
|
||||
bool operator!() const { return (FullGameList.size() == 0); }
|
||||
//! Gamelist scrolling operators
|
||||
int operator+=(int i) { return (selectedGame = (selectedGame+i) % FilteredList.size()); }
|
||||
int operator-=(int i) { return (selectedGame = (selectedGame-i+FilteredList.size()) % FilteredList.size()); }
|
||||
int operator++() { return (selectedGame = (++selectedGame) % FilteredList.size()); }
|
||||
int operator--() { return (selectedGame = ((--selectedGame)+FilteredList.size()) % FilteredList.size()); }
|
||||
int operator++(int i) { return operator++(); }
|
||||
int operator--(int i) { return operator--(); }
|
||||
struct discHdr * GetCurrentSelected() const { return operator[](selectedGame); }
|
||||
|
||||
protected:
|
||||
static bool NameSortCallback(const struct discHdr *a, const struct discHdr *b);
|
||||
static bool PlaycountSortCallback(const struct discHdr *a, const struct discHdr *b);
|
||||
@ -28,6 +38,7 @@ class GameList
|
||||
|
||||
wString AvailableSearchChars;
|
||||
wString GameFilter;
|
||||
int selectedGame;
|
||||
std::vector<struct discHdr *> FilteredList;
|
||||
std::vector<struct discHdr> FullGameList;
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <di/di.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
#include "gecko.h"
|
||||
@ -34,16 +35,22 @@ static u32 inbuf[8] ATTRIBUTE_ALIGN(32);
|
||||
static u32 outbuf[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
static const char di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
|
||||
static s32 di_fd = -1;
|
||||
static s32 _di_fd = -1;
|
||||
|
||||
static s32 currentIOS = -1;
|
||||
|
||||
|
||||
s32 WDVD_Init(void)
|
||||
{
|
||||
currentIOS = IOS_GetVersion();
|
||||
if(currentIOS < 200)
|
||||
return DI_Init();
|
||||
|
||||
/* Open "/dev/di" */
|
||||
if (di_fd < 0) {
|
||||
di_fd = IOS_Open(di_fs, 0);
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if (_di_fd < 0) {
|
||||
_di_fd = IOS_Open(di_fs, 0);
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -51,10 +58,16 @@ s32 WDVD_Init(void)
|
||||
|
||||
s32 WDVD_Close(void)
|
||||
{
|
||||
if(currentIOS < 200)
|
||||
{
|
||||
DI_Close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Close "/dev/di" */
|
||||
if (di_fd >= 0) {
|
||||
IOS_Close(di_fd);
|
||||
di_fd = -1;
|
||||
if (_di_fd >= 0) {
|
||||
IOS_Close(_di_fd);
|
||||
_di_fd = -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -62,14 +75,20 @@ s32 WDVD_Close(void)
|
||||
|
||||
s32 WDVD_GetHandle(void)
|
||||
{
|
||||
if(currentIOS < 200)
|
||||
return -1;
|
||||
|
||||
/* Return di handle */
|
||||
return di_fd;
|
||||
return _di_fd;
|
||||
}
|
||||
|
||||
s32 WDVD_Reset(void)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_Reset();
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -80,7 +99,7 @@ s32 WDVD_Reset(void)
|
||||
inbuf[1] = 1;
|
||||
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_RESET, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_RESET, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -89,8 +108,11 @@ s32 WDVD_Reset(void)
|
||||
|
||||
s32 WDVD_ReadDiskId(void *id)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_ReadDiscID((u64 *) id);
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -99,7 +121,7 @@ s32 WDVD_ReadDiskId(void *id)
|
||||
/* Read disc ID */
|
||||
inbuf[0] = IOCTL_DI_READID << 24;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_READID, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_READID, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -113,8 +135,11 @@ s32 WDVD_ReadDiskId(void *id)
|
||||
|
||||
s32 WDVD_Seek(u64 offset)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return -1;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -124,7 +149,7 @@ s32 WDVD_Seek(u64 offset)
|
||||
inbuf[0] = IOCTL_DI_SEEK << 24;
|
||||
inbuf[1] = (u32)(offset >> 2);
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -134,8 +159,11 @@ s32 WDVD_Seek(u64 offset)
|
||||
|
||||
s32 WDVD_Offset(u64 offset)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return -1;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
//u32 *off = (u32 *)((void *)&offset);
|
||||
union { u64 off64; u32 off32[2]; } off;off.off64 = offset;
|
||||
@ -148,7 +176,7 @@ s32 WDVD_Offset(u64 offset)
|
||||
inbuf[1] = (off.off32[0]) ? 1: 0;
|
||||
inbuf[2] = (off.off32[1] >> 2);
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_OFFSET, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_OFFSET, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -157,8 +185,11 @@ s32 WDVD_Offset(u64 offset)
|
||||
|
||||
s32 WDVD_StopLaser(void)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return -1;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -167,7 +198,7 @@ s32 WDVD_StopLaser(void)
|
||||
/* Stop laser */
|
||||
inbuf[0] = IOCTL_DI_STOPLASER << 24;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_STOPLASER, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_STOPLASER, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -176,8 +207,11 @@ s32 WDVD_StopLaser(void)
|
||||
|
||||
s32 WDVD_StopMotor(void)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return -1;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -186,7 +220,7 @@ s32 WDVD_StopMotor(void)
|
||||
/* Stop motor */
|
||||
inbuf[0] = IOCTL_DI_STOPMOTOR << 24;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_STOPMOTOR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_STOPMOTOR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -195,8 +229,11 @@ s32 WDVD_StopMotor(void)
|
||||
|
||||
s32 WDVD_OpenPartition(u64 offset)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_OpenPartition(offset >> 2);
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
static u8 Tmd_Buffer[0x4A00] ATTRIBUTE_ALIGN(32);
|
||||
static ioctlv Vectors[5] ATTRIBUTE_ALIGN(32);
|
||||
@ -219,7 +256,7 @@ s32 WDVD_OpenPartition(u64 offset)
|
||||
Vectors[4].data = outbuf;
|
||||
Vectors[4].len = 0x20;
|
||||
|
||||
ret = IOS_Ioctlv(di_fd, IOCTL_DI_OPENPART, 3, 2, (ioctlv *)Vectors);
|
||||
ret = IOS_Ioctlv(_di_fd, IOCTL_DI_OPENPART, 3, 2, (ioctlv *)Vectors);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -229,8 +266,11 @@ s32 WDVD_OpenPartition(u64 offset)
|
||||
|
||||
s32 WDVD_ClosePartition(void)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_ClosePartition();
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -239,7 +279,7 @@ s32 WDVD_ClosePartition(void)
|
||||
/* Close partition */
|
||||
inbuf[0] = IOCTL_DI_CLOSEPART << 24;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_CLOSEPART, inbuf, sizeof(inbuf), NULL, 0);
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_CLOSEPART, inbuf, sizeof(inbuf), NULL, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -248,8 +288,11 @@ s32 WDVD_ClosePartition(void)
|
||||
|
||||
s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_UnencryptedRead(buf, len, offset >> 2);
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -260,7 +303,7 @@ s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
||||
inbuf[1] = len;
|
||||
inbuf[2] = (u32)(offset >> 2);
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_UNENCREAD, inbuf, sizeof(inbuf), buf, len);
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_UNENCREAD, inbuf, sizeof(inbuf), buf, len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -269,8 +312,11 @@ s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
||||
|
||||
s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_Read(buf, len, offset >> 2);
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -281,7 +327,7 @@ s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
||||
inbuf[1] = len;
|
||||
inbuf[2] = (u32)(offset >> 2);
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_READ, inbuf, sizeof(inbuf), buf, len);
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_READ, inbuf, sizeof(inbuf), buf, len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -290,8 +336,11 @@ s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
||||
|
||||
s32 WDVD_WaitForDisc(void)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return -1;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -300,7 +349,7 @@ s32 WDVD_WaitForDisc(void)
|
||||
/* Wait for disc */
|
||||
inbuf[0] = IOCTL_DI_WAITCVRCLOSE << 24;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_WAITCVRCLOSE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_WAITCVRCLOSE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -309,8 +358,11 @@ s32 WDVD_WaitForDisc(void)
|
||||
|
||||
s32 WDVD_GetCoverStatus(u32 *status)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_GetCoverRegister(status);
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -319,7 +371,7 @@ s32 WDVD_GetCoverStatus(u32 *status)
|
||||
/* Get cover status */
|
||||
inbuf[0] = IOCTL_DI_GETCOVER << 24;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_GETCOVER, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_GETCOVER, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -335,8 +387,11 @@ s32 WDVD_GetCoverStatus(u32 *status)
|
||||
|
||||
s32 WDVD_SetUSBMode(const u8 *id, s32 partition)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return 0;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -354,12 +409,12 @@ s32 WDVD_SetUSBMode(const u8 *id, s32 partition)
|
||||
}
|
||||
}
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_SETWBFSMODE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_SETWBFSMODE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret!=1) {
|
||||
// Try old cIOS 222
|
||||
/* Set USB mode */
|
||||
inbuf[0] = DI_SETWBFSMODE << 24;
|
||||
ret = IOS_Ioctl(di_fd, DI_SETWBFSMODE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, DI_SETWBFSMODE, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
@ -370,8 +425,11 @@ s32 WDVD_SetUSBMode(const u8 *id, s32 partition)
|
||||
|
||||
s32 WDVD_Read_Disc_BCA(void *buf)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_Read_BCA(buf);
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -381,7 +439,7 @@ s32 WDVD_Read_Disc_BCA(void *buf)
|
||||
inbuf[0] = IOCTL_DI_DISC_BCA << 24;
|
||||
//inbuf[1] = 64;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_DISC_BCA, inbuf, sizeof(inbuf), buf, 64);
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_DISC_BCA, inbuf, sizeof(inbuf), buf, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -392,8 +450,11 @@ s32 WDVD_Read_Disc_BCA(void *buf)
|
||||
|
||||
s32 WDVD_SetFragList(int device, void *fraglist, int size)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return 0;
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -407,7 +468,7 @@ s32 WDVD_SetFragList(int device, void *fraglist, int size)
|
||||
inbuf[3] = size;
|
||||
|
||||
DCFlushRange(fraglist, size);
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_SETFRAG, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_SETFRAG, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -417,8 +478,11 @@ s32 WDVD_SetFragList(int device, void *fraglist, int size)
|
||||
|
||||
s32 WDVD_Eject(void)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
if(currentIOS < 200)
|
||||
return DI_Eject();
|
||||
|
||||
if (_di_fd < 0)
|
||||
return _di_fd;
|
||||
|
||||
s32 ret;
|
||||
|
||||
@ -429,7 +493,7 @@ s32 WDVD_Eject(void)
|
||||
/* Eject DVD */
|
||||
inbuf[1] = 1;
|
||||
|
||||
ret = IOS_Ioctl(di_fd, IOCTL_DI_STOPMOTOR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
ret = IOS_Ioctl(_di_fd, IOCTL_DI_STOPMOTOR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user