usbloadergx/source/wad/nandtitle.h

118 lines
2.6 KiB
C
Raw Permalink Normal View History

#ifndef NANDTITLE_H
#define NANDTITLE_H
#include <gccore.h>
#include <ogcsys.h>
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <sys/stat.h>
2010-09-19 15:03:16 +02:00
#include <vector>
#include <map>
#include "wstring.hpp"
2010-09-19 15:03:16 +02:00
using namespace std;
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
#define TITLE_UPPER(x) ((u32)((x) >> 32))
#define TITLE_LOWER(x) ((u32)(x))
#define TITLE_1(x) ((u8)((x) >> 8))
#define TITLE_2(x) ((u8)((x) >> 16))
#define TITLE_3(x) ((u8)((x) >> 24))
#define TITLE_4(x) ((u8)((x) >> 32))
#define TITLE_5(x) ((u8)((x) >> 40))
#define TITLE_6(x) ((u8)((x) >> 48))
#define TITLE_7(x) ((u8)((x) >> 56))
#define IMET_MAX_NAME_LEN 0x2a
#define IMET_OFFSET 0x40
#define IMET_SIGNATURE 0x494d4554
#define DOWNLOADED_CHANNELS 0x00010001
#define SYSTEM_CHANNELS 0x00010002
#define RF_NEWS_CHANNEL 0x48414741
#define RF_FORECAST_CHANNEL 0x48414641
typedef struct
{
u8 zeroes1[0x40];
u32 sig; // "IMET"
u32 unk1;
u32 unk2;
u32 filesizes[3];
u32 unk3;
u16 name_japanese[IMET_MAX_NAME_LEN];
u16 name_english[IMET_MAX_NAME_LEN];
u16 name_german[IMET_MAX_NAME_LEN];
u16 name_french[IMET_MAX_NAME_LEN];
u16 name_spanish[IMET_MAX_NAME_LEN];
u16 name_italian[IMET_MAX_NAME_LEN];
u16 name_dutch[IMET_MAX_NAME_LEN];
u16 name_simp_chinese[IMET_MAX_NAME_LEN];
u16 name_trad_chinese[IMET_MAX_NAME_LEN];
u16 name_korean[IMET_MAX_NAME_LEN];
u8 zeroes2[0x24c];
u8 md5[0x10];
} IMET;
class NandTitle
{
public:
NandTitle();
~NandTitle();
s32 Get();
u64 At(u32 i);
int IndexOf(u64 tid);
u32 Count()
{
return titleIds.size();
}
const char* NameOf(u64 tid);
const char* NameFromIndex(u32 i);
u16 VersionOf(u64 tid);
u16 VersionFromIndex(u32 i);
u32 CountType(u32 type);
u32 SetType(u32 upper);
u64 Next();
void ResetCounter();
void AsciiTID(u64 tid, char* out);
void AsciiFromIndex(u32 i, char* out);
bool Exists(u64 tid);
bool ExistsFromIndex(u32 i);
u64 FindU64(const char *s);
u64 FindU32(const char *s);
s32 GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen);
u64 operator[](u32 i) { return At(i); }
bool GetName(u64 tid, int language, wchar_t* name);
OK since the Wii System Menu Player is released now as I already mentioned the source for the loader will also be put on SVN again. Now that i am done with merging here is the MOD17 source. Changelog since last revision: - add banner/icon animation support for wii games / channels / gamecube - add custom banner for gamecube which loads the gamecube internal opening.bnr information (it is much better than the generic one of the system menu) (big thanks to diddy from the wiithemeteam for creating the brlyt/brlan for the banner) - add gamecube banner of system menu (not used right now since it sucks) - add banner grid of the system menu (resources loaded from nand) (with button highliter) - add big banner frame window of the system menu (resources loaded from nand). the banner window has buttons "Settings" and "Start" by default. if parental control is enabled the "Settings" button is replaced by "Back" - add play count text to the banner frame window (can be disabled as up until now in the gui settings) - add zoom in/out/scroll animations to banner grid and change into big frame window - add loading gc banners from ISO and DVD - add loading wii banners from DVD discs even if the game is not installed - add favorite level setting to the game settings since it is no longer on the banner frame window - add new settings section for banner settings - add option to choose between disc window and banner window - added back ehci module to support 2 usb drives and re-enabled the option - add option for 2 usb drives for d2x cIOS as well (will be supported in the future, not yet) - exchanged "GC Games" and "EmuNand Channels" on the game selection screen (more space for translators) - add and fixed gui numpad for entering numbers of any kind - add setting for tooltip delay time - fix reload of cover image on game list when only 1 item is left after a change (e.g. sort) - add use of old build in font for credits window because it doesnt look good with the system menu one - fixed effect bug when scrolling buttons in the settings and the wiimote is over button 1 - fixed bug where entering -1 (Use global) for cIOS was not possible in game settings - many source cleanups - add bnr chace setting - add DML configuration from the loader - removed creation of temporary "boot.bin" file - DML custom game paths. Additionally i added support for following forms of paths: 1. configpath/gamepath/game.iso 2. configpath/gamepath/game.gcm 3. configpath/gamepath/GAMEID6.iso 4. configpath/gamepath/GAMEID6.gcm Where gamepath can be anything you want inside the configure path in the custom path settings. I don't know if GCM files are allowed by DML but i just added support for it just in case. Changing path to USB is not blocked currently but games won't run from USB just keep that in mind. The "copy to SD before start" feature is not added yet. Listing the games should work though - DML cheats now work the same way as for wii, gct goes to "Cheatcode Path" as GAMEID.gct (same as on wii) - several DML internal configs are added as per game/global settings - added load of last cheat configuration from GCT files - added init of network into background thread so it is cancelable and has a timeout - added gc games copy from USB to SD on demand with choice menu to delete SD games to make space, SD games path can be chosen seperately from main gc path. all dupicate sd games are prefered then the main path to allow direct boot of games that are already on sd. main path can be on USB or anywhere else. - added gc disc dump functionality with multidisc, compress and align support (thanks to FIX94 and Overjoy for their disc dump source on which this is based) - added selection menu for gc multidisc which game to install - fixed loading game ID when it can't be read from path for GC games and with that loading the titles from GameTDB for them - lots of string handling improvements (thanks to gerbilsoft for his patch) - added gamecube banner cache loading (only loading) if available with GAMEID6.bnr or ID3.bnr in the banner cache path. wii games/channels also accept now ID3.bnr. - added several progress bar cancel buttons on some missing progress windows - improved calculation of progress speed. now it is always the last 15 secs average instead of overall progress speed. - added pulsing new icon on banner grid layout for new games - added resize of widescreen screenshots to 768 width - added mii extract on save game extract if the file does not yet exists - added mii extractor and SYSCONF extractor that always extracts and overwrites old files - changed wifi gecko to UDP socket - support for DML v1.2+ NOTE: Banner animation support requires AHBPROT flag to be enabled. If you use old HBC you should use our forwarder or update the HBC otherwise you wont have that support. I am hoping that now the themers and the translators can catch up with their stuff for the next upcomming official release.
2012-05-06 12:59:58 +02:00
tmd* GetTMD(u64 tid);
static int LoadFileFromNand(const char *filepath, u8 **outbuffer, u32 *outfilesize);
static int ExtractFile(const char *nandPath, const char *filepath);
static int ExtractDir(const char *wiipath, const char *filepath);
private:
static int InternalExtractDir(char *nandPath, std::string &filepath);
std::vector<u64> titleIds;
std::map<u64, string> NameList;
u32 currentIndex;
u32 currentType;
};
2010-09-24 15:46:32 +02:00
extern NandTitle NandTitles;
#endif // NANDTITLE_H