~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Source/Core/Core/Src/FifoPlayer/FifoDataFile.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 _FIFODATAFILE_H_
 
6
#define _FIFODATAFILE_H_
 
7
 
 
8
#include "Common.h"
 
9
#include <vector>
 
10
 
 
11
namespace File
 
12
{
 
13
        class IOFile;
 
14
}
 
15
 
 
16
struct MemoryUpdate
 
17
{
 
18
        enum Type
 
19
        {
 
20
                TEXTURE_MAP = 0x01,
 
21
                XF_DATA = 0x02,
 
22
                VERTEX_STREAM = 0x04,
 
23
                TMEM = 0x08,
 
24
        };
 
25
 
 
26
        u32 fifoPosition;
 
27
        u32 address;
 
28
        u32 size;
 
29
        u8 *data;
 
30
        Type type;
 
31
};
 
32
 
 
33
struct FifoFrameInfo
 
34
{
 
35
        u8 *fifoData;
 
36
        u32 fifoDataSize;
 
37
 
 
38
        u32 fifoStart;
 
39
        u32 fifoEnd;
 
40
 
 
41
        // Must be sorted by fifoPosition
 
42
        std::vector<MemoryUpdate> memoryUpdates;
 
43
};
 
44
 
 
45
class FifoDataFile
 
46
{
 
47
public:
 
48
        enum
 
49
        {
 
50
                BP_MEM_SIZE = 256,
 
51
                CP_MEM_SIZE = 256,
 
52
                XF_MEM_SIZE = 4096,
 
53
                XF_REGS_SIZE = 96,
 
54
        };
 
55
 
 
56
        FifoDataFile();
 
57
        ~FifoDataFile();        
 
58
 
 
59
        void SetIsWii(bool isWii);
 
60
        bool GetIsWii() const;
 
61
 
 
62
        u32 *GetBPMem() { return m_BPMem; }
 
63
        u32 *GetCPMem() { return m_CPMem; }
 
64
        u32 *GetXFMem() { return m_XFMem; }
 
65
        u32 *GetXFRegs() { return m_XFRegs; }
 
66
 
 
67
        void AddFrame(const FifoFrameInfo &frameInfo);
 
68
        const FifoFrameInfo &GetFrame(int frame) const { return m_Frames[frame]; }
 
69
        int GetFrameCount() { return (int)m_Frames.size(); }
 
70
 
 
71
        bool Save(const char *filename);
 
72
 
 
73
        static FifoDataFile *Load(const std::string &filename, bool flagsOnly);
 
74
 
 
75
private:
 
76
        enum
 
77
        {
 
78
                FLAG_IS_WII = 1
 
79
        };
 
80
        
 
81
        void PadFile(u32 numBytes, File::IOFile &file);
 
82
 
 
83
        void SetFlag(u32 flag, bool set);
 
84
        bool GetFlag(u32 flag) const;
 
85
 
 
86
        u64 WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates, File::IOFile &file);
 
87
        static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, std::vector<MemoryUpdate> &memUpdates, File::IOFile &file);
 
88
 
 
89
        u32 m_BPMem[BP_MEM_SIZE];
 
90
        u32 m_CPMem[CP_MEM_SIZE];
 
91
        u32 m_XFMem[XF_MEM_SIZE];
 
92
        u32 m_XFRegs[XF_REGS_SIZE];
 
93
 
 
94
        u32 m_Flags;
 
95
 
 
96
        std::vector<FifoFrameInfo> m_Frames;
 
97
};
 
98
 
 
99
#endif