Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Halo.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace halo
4 {
5 #define STR_CAT(a,b) a##b
6 #define STR_CAT_DELAYED(a,b) STR_CAT(a,b)
7 #define UNKNOWN(size) char STR_CAT_DELAYED(_unused_,__COUNTER__)[size]
8 #define UNKNOWN_BITFIELD(size) char STR_CAT_DELAYED(_unusedbf_, __COUNTER__) : size
9 
10 #pragma pack(push, 1)
11 
12  struct ident
13  {
14  unsigned short slot;
15  unsigned short id;
16 
17  explicit ident() {
18  slot = 0xFFFF;
19  id = 0xFFFF;
20  }
21 
22  bool operator<(const ident& other)
23  {
24  return (unsigned long)*this < (unsigned long)other;
25  }
26 
27  bool operator>(const ident& other)
28  {
29  return (unsigned long)*this > (unsigned long)other;
30  }
31 
32  operator unsigned long() const
33  {
34  unsigned long result = id << 16 | (slot & 0xffff);
35  return result;
36  }
37 
38  bool valid() const { return id != 0xFFFF || slot != 0xFFFF; }
39  };
40  static_assert(sizeof(ident) == 4, "bad");
41 
42  ident make_ident(unsigned long id);
43 
44  // Header for tables used throughout Halo (objects, players, loopobjects)
46  {
47  char name[0x20];
48  unsigned short max_size;
49  unsigned short elem_size;
50  UNKNOWN(4); // only seen as 1
51  UNKNOWN(4); // d@t@
52  UNKNOWN(2);
53  unsigned short cur_items; // i think
54  UNKNOWN(4);
55  void* data;
56  };
57  static_assert(sizeof(s_table_header) == 0x38, "s_table_header size incorrect");
58 
59 #pragma pack(pop)
60 }