summaryrefslogtreecommitdiff
path: root/include/egg/core/eggDvdRipper.h
blob: 8f4b4b481c0eb0f18160dd128f22f11852f1ccc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef EGG_DVD_RIPPER_H
#define EGG_DVD_RIPPER_H

#include "common.h"
#include "egg/core/eggDvdFile.h"
#include "egg/core/eggHeap.h"
#include "egg/core/eggStreamDecomp.h"

namespace EGG {

class DvdRipper {
public:
    enum EAllocDirection {
        ALLOC_CIR_PAD,
        ALLOC_DIR_TOP,
        ALLOC_DIR_BOTTOM
    };

    struct UnkCallback_Arg {
        u8 UNK_0x00[4];
        u32 UNK_0x04;
        u32 UNK_0x08;
        u32 UNK_0x0C;
        u32 UNK_0x10;
        void *buf;
    };
    typedef void (*UnkCallback)(void *);

public:
    // Not sure
    struct Arg {
        Arg(const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize)
            : path(path),
              pOut(pOut),
              pHeap(pHeap),
              allocDir(allocDir),
              offset(offset),
              pRead(pRead),
              fileSize(fileSize) {}
        const char *path;
        u8 *pOut;
        Heap *pHeap;
        EAllocDirection allocDir;
        u32 offset;
        u32 *pRead;
        u32 *fileSize;
    };

    static u8 *loadToMainRAM(Arg &arg) {
        return loadToMainRAM(arg.path, arg.pOut, arg.pHeap, arg.allocDir, arg.offset, arg.pRead, arg.fileSize);
    }

    static u8 *
    loadToMainRAM(s32 entryNum, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize);

    static u8 *loadToMainRAM(
        const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize
    );

    static u8 *loadToMainRAM(
        DvdFile *pFile, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize
    );

    static void *loadToMainRAMDecomp(
        DvdFile *pFile, StreamDecomp *decompressor, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, s32 offset,
        u32 size, u32 chunkSize, u32 *pRead, u32 *fileSize
    );

public:
    static bool sErrorRetry;
    static UnkCallback sCallback;
};

} // namespace EGG

#endif