1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
22 CDump::CDump(const char* _szFilename
) :
26 FILE* pStream
= fopen(_szFilename
, "rb");
29 fseek(pStream
, 0, SEEK_END
);
30 m_size
= (size_t) ftell(pStream
);
31 fseek(pStream
, 0, SEEK_SET
);
33 m_pData
= new u8
[m_size
];
35 fread(m_pData
, m_size
, 1, pStream
);
51 CDump::GetNumberOfSteps(void)
53 return (int)(m_size
/ STRUCTUR_SIZE
);
57 CDump::GetGPR(int _step
, int _gpr
)
59 u32 offset
= _step
* STRUCTUR_SIZE
;
64 return Read32(offset
+ OFFSET_GPR
+ (_gpr
* 4));
68 CDump::GetPC(int _step
)
70 u32 offset
= _step
* STRUCTUR_SIZE
;
75 return Read32(offset
+ OFFSET_PC
);
79 CDump::Read32(u32 _pos
)
81 u32 result
= (m_pData
[_pos
+0] << 24) |
82 (m_pData
[_pos
+1] << 16) |
83 (m_pData
[_pos
+2] << 8) |
84 (m_pData
[_pos
+3] << 0);