summaryrefslogtreecommitdiff
path: root/include/nw4r/ut/ut_DvdLockedFileStream.h
blob: e519e76436077bb42bae41431ee151770e3e12bf (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
#ifndef NW4R_UT_DVD_LOCKED_FILE_STREAM_H
#define NW4R_UT_DVD_LOCKED_FILE_STREAM_H
#include "nw4r/types_nw4r.h"
#include "nw4r/ut/ut_DvdFileStream.h"
#include "rvl/OS.h" // IWYU pragma: export

namespace nw4r {
namespace ut {

class DvdLockedFileStream : public DvdFileStream {
public:
    NW4R_UT_RTTI_DECL(DvdLockedFileStream);

    DvdLockedFileStream(s32 entrynum);
    DvdLockedFileStream(const DVDFileInfo *info, bool close);
    virtual ~DvdLockedFileStream(); // at 0xC

    virtual void Close(); // at 0x10

    virtual s32 Read(void *dst, u32 size); // at 0x14
    virtual bool ReadAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
        return false;
    } // at 0x18

    virtual s32 Peek(void *dst, u32 size); // at 0x5C
    virtual bool PeekAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
        return false;
    } // at 0x60

    virtual bool CanAsync() const {
        return false;
    } // at 0x28

    void Cancel();

private:
    static void InitMutex_();
    bool LockMutex();
    static void UnlockMutex();
    void CancelMutex();

private:
    volatile bool mCancelFlag; // 0x6f
    static bool sInitialized;
    static OSThreadQueue sThreadQueue;
    static OSMutex sMutex;
};

} // namespace ut
} // namespace nw4r
#endif