~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Source/Core/DiscIO/Src/CISOBlob.h

  • Committer: Sérgio Benjamim
  • Date: 2015-02-13 05:54:40 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150213055440-ey2rt3sjpy27km78
Dolphin Triforce branch from code.google, commit b957980 (4.0-315).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2013 Dolphin Emulator Project
 
2
// Licensed under GPLv2
 
3
// Refer to the license.txt file included.
 
4
 
 
5
#ifndef _CISO_BLOB_H
 
6
#define _CISO_BLOB_H
 
7
 
 
8
#include "Blob.h"
 
9
#include "FileUtil.h"
 
10
 
 
11
namespace DiscIO
 
12
{
 
13
 
 
14
bool IsCISOBlob(const char* filename);
 
15
 
 
16
static const u32 CISO_HEADER_SIZE = 0x8000;
 
17
static const u32 CISO_MAP_SIZE = CISO_HEADER_SIZE - sizeof(u32) - sizeof(char) * 4;
 
18
 
 
19
struct CISOHeader
 
20
{
 
21
        // "CISO"
 
22
        char magic[4];
 
23
        
 
24
        // little endian
 
25
        u32 block_size;
 
26
        
 
27
        // 0=unused, 1=used, others=invalid
 
28
        u8 map[CISO_MAP_SIZE];
 
29
};
 
30
 
 
31
class CISOFileReader : public IBlobReader
 
32
{
 
33
public:
 
34
        static CISOFileReader* Create(const char* filename);
 
35
 
 
36
        u64 GetDataSize() const;
 
37
        u64 GetRawSize() const;
 
38
        bool Read(u64 offset, u64 nbytes, u8* out_ptr);
 
39
 
 
40
private:
 
41
        CISOFileReader(std::FILE* file);
 
42
        
 
43
        typedef u16 MapType;
 
44
        static const MapType UNUSED_BLOCK_ID = -1;
 
45
        
 
46
        File::IOFile m_file;
 
47
        u64 m_size;
 
48
        u32 m_block_size;
 
49
        MapType m_ciso_map[CISO_MAP_SIZE];
 
50
};
 
51
 
 
52
}  // namespace
 
53
 
 
54
#endif  // _FILE_BLOB_H