-
Notifications
You must be signed in to change notification settings - Fork 6
/
Util.h
71 lines (62 loc) · 2.47 KB
/
Util.h
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
/*-------------------------------------------------------------------
* Original Author: Grenadiac
*
* Contributing Authors:
*
* File Description:
* Utility class written to avoid rewriting analysis code over
* and over. Meant to be parent class of Bitmaps, sounds, models,
* etc.
*
*-----------------------------------------------------------------*/
#if !defined(AFX_UTIL_H__EBD8366A_75B5_4D64_8374_05979978EA03__INCLUDED_)
#define AFX_UTIL_H__EBD8366A_75B5_4D64_8374_05979978EA03__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "HaloStructDefs.h"
typedef struct STRUCT_OFFSET_XREF
{
UINT source;
UINT dest;
}OFFSET_XREF;
class CUtil
{
public:
void DumpReflexiveInfo(REFLEXIVE* pRefl, CString Name, int struct_size, UINT magic);
BOOL CompressFloatToShort(float input, SHORT &output);
void AppendXrefs(UINT *pIn, UINT in_count, UINT buffer_base, UINT min, UINT max, OFFSET_XREF**pOut, UINT *out_count, UINT magic);
void TruncateAsciiGarbage(char* pBuf, int buf_size);
BOOL IsAscii(float val, CString * pStr);
void AnalyzeFileSection3(CFile *pMapFile, UINT offset, UINT len, UINT magic, UINT xref_magic);
void AnalyzeFileSection2(CFile *pMapFile, UINT offset, UINT len, UINT magic);
float DotProduct(float *pV1, float *pV2);
float CalculateCameraDist(float *pCoord);
void CalculateCrossProduct(float *pU, float *pV, float *pUVcross);
BOOL CompressVector(UINT& comp_vector, float *pVector);
float DecompressShortToFloat(SHORT comp_vector);
void DecompressIntToVector(UINT cvect, float *pVector);
CString CheckForReference(CFile *pMapFile, UINT val, UINT magic);
void AnalyzeFileSection(CFile *pMapFile, UINT offset, UINT len, UINT magic, UINT xref_magic);
void DumpBufferContents(float *pFloat, UINT buffer_base, UINT float_count);
CUtil();
virtual ~CUtil();
void DumpBlockInfo(void);
virtual void ReadHeader(CFile *pMapFile, INDEX_ITEM *item, int magic, CString Name);
void DumpInfo(UINT offset, UINT size, CString Name);
protected:
CString ConvertToText(UINT val);
BOOL CheckForAscii(int val);
CString GetAddrRange(UINT addr);
void ExtractFilename(CString Input, CString *pPath, CString *pFilename);
CString CreateItemDirectory(CString Name);
void UpdateBlockInfo(UINT offset, UINT size);
CFile m_OutputFile;
CString m_ObjTag;
int m_ObjCount;
UINT m_ObjStart;
UINT m_ObjEnd;
CString m_OutputPathRoot;
CString m_WorkingDir;
};
#endif // !defined(AFX_UTIL_H__EBD8366A_75B5_4D64_8374_05979978EA03__INCLUDED_)