Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TMD::TMD( u64 TitleID )
- {
- if(TitleID)
- {
- static fstats stats ATTRIBUTE_ALIGN(32);
- u32 high = (u32)(TitleID >> 32);
- u32 low = (u32)(TitleID & 0xFFFFFFFF);
- s32 fd = ISFS_Open(fmt("/title/%08x/%08x/content/title.tmd", high, low), ISFS_OPEN_READ);
- if (fd >= 0)
- {
- if (ISFS_GetFileStats(fd, &stats) >= 0)
- {
- u32* data = NULL;
- if (stats.file_length > 0)
- data = (u32*)memalign(32, RU(stats.file_length, 32));
- if (data)
- {
- if (ISFS_Read(fd, (char*)data, stats.file_length) > 4)
- {
- p_tmd = (tmd *) SIGNATURE_PAYLOAD(data);
- gprintf("\n\tGID: %u", p_tmd->group_id);
- }
- free(data);
- }
- }
- ISFS_Close(fd);
- }
- }
- }
- TMD::~TMD()
- {
- }
- u16 TMD::GetGroupID()
- {
- if( !p_tmd )
- return 0;
- return p_tmd->group_id;
- }
- ///HFILE:
- class TMD
- {
- public:
- TMD( u64 TitleID = 0 );
- ~TMD();
- //!expose the tmd data to the rest of the code so it can read directly from the p_tmd instead of having to add a function to access all the data
- //!the pointer should be good until "data" is changed
- const tmd *payload(){ return p_tmd; }
- u16 GetGroupID();
- private:
- tmd *p_tmd;
- }
Add Comment
Please, Sign In to add comment