2012-02-20 09:26:50 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2012
|
2012-02-24 22:08:24 +01:00
|
|
|
* by OverjoY and FIX94 for Wiiflow
|
2012-02-20 09:26:50 +01:00
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any
|
|
|
|
* damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any
|
|
|
|
* purpose, including commercial applications, and to alter it and
|
|
|
|
* redistribute it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
|
|
* must not claim that you wrote the original software. If you use
|
|
|
|
* this software in a product, an acknowledgment in the product
|
|
|
|
* documentation would be appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
|
|
* must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* gc_disc.hpp
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2012-02-17 03:35:42 +01:00
|
|
|
#ifndef GC_DISC_H_
|
|
|
|
#define GC_DISC_H_
|
|
|
|
|
|
|
|
typedef void (*progress_callback_t)(int status,int total,void *user_data);
|
2012-02-29 01:19:50 +01:00
|
|
|
typedef void (*message_callback_t)(int message, int info, char *cinfo, void *user_data);
|
2012-02-17 03:35:42 +01:00
|
|
|
|
2012-02-20 09:26:50 +01:00
|
|
|
class GCDump
|
|
|
|
{
|
|
|
|
public:
|
2012-03-06 22:04:23 +01:00
|
|
|
void Init(bool skip, bool comp, bool wexf, bool align, u32 nretry, u32 rsize, const char* partition, const char* m_DMLgameDir)
|
2012-02-20 09:26:50 +01:00
|
|
|
{
|
|
|
|
skiponerror = skip;
|
|
|
|
compressed = comp;
|
|
|
|
writeexfiles = wexf;
|
2012-02-26 16:03:54 +01:00
|
|
|
force_32k_align = align;
|
2012-02-20 09:26:50 +01:00
|
|
|
gc_nbrretry = nretry;
|
|
|
|
gc_readsize = rsize;
|
2012-02-27 17:05:10 +01:00
|
|
|
gamepartition = partition;
|
2012-03-07 22:03:27 +01:00
|
|
|
usb_dml_game_dir = m_DMLgameDir;
|
2012-02-20 09:26:50 +01:00
|
|
|
gc_skipped = 0;
|
|
|
|
}
|
2012-02-29 01:19:50 +01:00
|
|
|
s32 DumpGame(progress_callback_t spinner, message_callback_t message, void *spinner_data);
|
|
|
|
s32 CheckSpace(u32 *needed, bool comp, message_callback_t message, void *message_data);
|
2012-02-20 09:26:50 +01:00
|
|
|
private:
|
2012-02-26 16:03:54 +01:00
|
|
|
bool force_32k_align;
|
2012-02-20 09:26:50 +01:00
|
|
|
bool skiponerror;
|
|
|
|
bool compressed;
|
|
|
|
bool writeexfiles;
|
2012-02-27 17:05:10 +01:00
|
|
|
const char* gamepartition;
|
2012-03-07 22:03:27 +01:00
|
|
|
const char* usb_dml_game_dir;
|
2012-02-29 01:19:50 +01:00
|
|
|
u8 Disc;
|
|
|
|
u8 Disc2;
|
2012-02-20 09:26:50 +01:00
|
|
|
u32 gc_nbrretry;
|
|
|
|
u32 gc_error;
|
|
|
|
u32 gc_retry;
|
|
|
|
u32 gc_skipped;
|
2012-03-07 03:05:57 +01:00
|
|
|
u32 gc_readsize;
|
|
|
|
u32 gc_done;
|
2012-02-29 01:19:50 +01:00
|
|
|
u32 ID;
|
|
|
|
u32 ID2;
|
|
|
|
u32 ApploaderSize;
|
|
|
|
u32 DOLOffset;
|
|
|
|
u32 DOLSize;
|
|
|
|
u32 FSTOffset;
|
|
|
|
u32 FSTSize;
|
|
|
|
u32 FSTTotal;
|
|
|
|
u32 FSTEnt;
|
|
|
|
u32 GamePartOffset;
|
|
|
|
u32 DataSize;
|
2012-02-20 09:26:50 +01:00
|
|
|
u32 DiscSize;
|
2012-03-04 14:22:36 +01:00
|
|
|
u32 DiscSizeCalculated;
|
2012-02-20 09:26:50 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 Type :8;
|
|
|
|
u32 NameOffset :24;
|
|
|
|
};
|
|
|
|
u32 TypeName;
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 FileOffset;
|
|
|
|
u32 FileLength;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 ParentOffset;
|
|
|
|
u32 NextOffset;
|
|
|
|
};
|
|
|
|
u32 entry[2];
|
|
|
|
};
|
|
|
|
} FST;
|
|
|
|
s32 __DiscReadRaw(void *outbuf, u32 offset, u32 length);
|
2012-03-07 03:05:57 +01:00
|
|
|
s32 __DiscWrite(char * path, u32 offset, u32 length, u8 *ReadBuffer, progress_callback_t spinner, void *spinner_data);
|
|
|
|
s32 __DiscWriteFile(FILE *f, u32 offset, u32 length, u8 *ReadBuffer, progress_callback_t spinner, void *spinner_data);
|
|
|
|
bool __WaitForDisc(u8 dsc, char *minfo, u32 msg, message_callback_t message, void *message_data);
|
2012-02-20 09:26:50 +01:00
|
|
|
};
|
2012-02-17 03:35:42 +01:00
|
|
|
#endif
|