2012-01-01 18:58:10 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2011 Dimok
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
2009-07-11 09:21:38 +02:00
|
|
|
#ifndef _WAD_H_
|
|
|
|
#define _WAD_H_
|
|
|
|
|
2012-01-01 18:58:10 +01:00
|
|
|
#include <gccore.h>
|
2010-09-19 01:04:39 +02:00
|
|
|
|
2012-01-01 18:58:10 +01:00
|
|
|
/* 'WAD Header' structure */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* Header length */
|
|
|
|
u32 header_len;
|
|
|
|
/* WAD type */
|
|
|
|
u16 type;
|
|
|
|
u16 padding;
|
|
|
|
/* Data length */
|
|
|
|
u32 certs_len;
|
|
|
|
u32 crl_len;
|
|
|
|
u32 tik_len;
|
|
|
|
u32 tmd_len;
|
|
|
|
u32 data_len;
|
|
|
|
u32 footer_len;
|
|
|
|
} ATTRIBUTE_PACKED wadHeader;
|
2010-09-19 01:04:39 +02:00
|
|
|
|
2012-01-01 18:58:10 +01:00
|
|
|
class Wad
|
|
|
|
{
|
|
|
|
public:
|
2016-01-02 17:23:01 +01:00
|
|
|
Wad(const char *wadpath = 0, bool prompt = true);
|
2012-01-01 18:58:10 +01:00
|
|
|
virtual ~Wad();
|
|
|
|
bool Open(const char *wadpath);
|
|
|
|
void Close(void);
|
|
|
|
bool Install(const char *installpath);
|
|
|
|
bool UnInstall(const char *installpath);
|
2016-01-02 17:23:01 +01:00
|
|
|
void SetPrompt(bool choice) { showPrompt = choice; };
|
2012-01-01 18:58:10 +01:00
|
|
|
private:
|
|
|
|
bool InstallContents(const char *installpath);
|
|
|
|
int CheckContentMap(const char *installpath, tmd_content *content, char *filepath);
|
|
|
|
bool WriteFile(const char *filepath, u8 *buffer, u32 len);
|
|
|
|
bool SetTitleUID(const char *intallpath, const u64 &tid);
|
|
|
|
|
|
|
|
FILE *pFile;
|
|
|
|
wadHeader *header;
|
|
|
|
u8 *p_tik, *p_tmd;
|
|
|
|
u8 *content_map;
|
|
|
|
u32 content_map_size;
|
|
|
|
u32 content_start;
|
2016-01-02 17:23:01 +01:00
|
|
|
bool showPrompt;
|
2012-01-01 18:58:10 +01:00
|
|
|
};
|
2009-07-11 09:21:38 +02:00
|
|
|
|
|
|
|
#endif
|