commit aa605d1aef8a6c89826a26efcc7a1382fcb2c191 Author: superp00t Date: Sun Jul 7 03:00:06 2024 -0400 chore(binana): add files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58a97f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +jest +.vscode \ No newline at end of file diff --git a/3.3.5a/include/main.h b/3.3.5a/include/main.h new file mode 100644 index 0000000..1306079 --- /dev/null +++ b/3.3.5a/include/main.h @@ -0,0 +1,15 @@ +// Types +#include "storm/array.h" +#include "storm/list.h" + +#include "tempest/box.h" +#include "tempest/matrix.h" +#include "tempest/plane.h" +#include "tempest/quaternion.h" +#include "tempest/range.h" +#include "tempest/rect.h" +#include "tempest/sphere.h" +#include "tempest/vector.h" + +// include files that define the use of template classes +#include "storm/array/uint32_t.h" \ No newline at end of file diff --git a/3.3.5a/include/storm/array.h b/3.3.5a/include/storm/array.h new file mode 100644 index 0000000..e9fc53f --- /dev/null +++ b/3.3.5a/include/storm/array.h @@ -0,0 +1,29 @@ +#ifndef STORM_ARRAY_H +#define STORM_ARRAY_H + +#define STORM_TS_BASE_ARRAY(type) typedef struct TSBaseArray_##type TSBaseArray_##type; \ +struct TSBaseArray_##type { \ + void** vtable; \ + uint32_t m_alloc; \ + uint32_t m_count; \ + type* m_data; \ +}; + +#define STORM_TS_FIXED_ARRAY(type) typedef struct TSFixedArray_##type TSFixedArray_##type; \ +struct TSFixedArray_##type { \ + void** vtable; \ + uint32_t m_alloc; \ + uint32_t m_count; \ + type* m_data; \ +}; + +#define STORM_TS_GROWABLE_ARRAY(type) typedef struct TSGrowableArray_##type TSGrowableArray_##type; \ +struct TSGrowableArray_##type { \ + void** vtable; \ + uint32_t m_alloc; \ + uint32_t m_count; \ + type* m_data; \ + uint32_t m_chunk; \ +}; + +#endif diff --git a/3.3.5a/include/storm/array/uint32_t.h b/3.3.5a/include/storm/array/uint32_t.h new file mode 100644 index 0000000..f54dd73 --- /dev/null +++ b/3.3.5a/include/storm/array/uint32_t.h @@ -0,0 +1,10 @@ +#ifndef STORM_ARRAY_UINT32_T_H +#define STORM_ARRAY_UINT32_T_H + +#include + +#include "storm/array.h" + +STORM_TS_GROWABLE_ARRAY(uint32_t) + +#endif \ No newline at end of file diff --git a/3.3.5a/include/storm/list.h b/3.3.5a/include/storm/list.h new file mode 100644 index 0000000..6afa644 --- /dev/null +++ b/3.3.5a/include/storm/list.h @@ -0,0 +1,30 @@ +#ifndef STORM_LIST_H +#define STORM_LIST_H + +#include + +// to make an object self referential +// forward-declare 'struct Object_type' as 'Object_type' +// then define 'struct Object_type' + +// TSLink +#define STORM_TS_LINK(T) typedef struct TSLink_##T TSLink_##T; \ +struct TSLink_##T { \ + TSLink_##T* m_prevlink; \ + T* m_next; \ +}; + +// TSLinkedNode +#define STORM_TS_LINKED_NODE(T) typedef struct TSLinkedNode_##T TSLinkedNode_##T; \ +struct TSLinkedNode_##T { \ + TSLink_##T m_link; \ +}; + +// TSList +#define STORM_TS_LIST(T) typedef struct TSList_##T TSList_##T##; \ +struct TSList_##T { \ + ptrdiff_t m_linkoffset; \ + TSLink_##T m_terminator; \ +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/box.h b/3.3.5a/include/tempest/box.h new file mode 100644 index 0000000..47f8cb0 --- /dev/null +++ b/3.3.5a/include/tempest/box.h @@ -0,0 +1,21 @@ +#ifndef TEMPEST_BOX_H +#define TEMPEST_BOX_H + +#include "tempest/vector.h" +#include "tempest/range.h" + +typedef struct CAaBox CAaBox; +typedef struct CBoundingBox CBoundingBox; + +struct CAaBox { + C3Vector b; + C3Vector t; +}; + +struct CBoundingBox { + CRange x; + CRange y; + CRange z; +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/matrix.h b/3.3.5a/include/tempest/matrix.h new file mode 100644 index 0000000..b7163bf --- /dev/null +++ b/3.3.5a/include/tempest/matrix.h @@ -0,0 +1,55 @@ +#ifndef TEMPEST_MATRIX_H +#define TEMPEST_MATRIX_H + +typedef struct C33Matrix C33Matrix; +typedef struct C34Matrix C34Matrix; +typedef struct C44Matrix C44Matrix; + +struct C33Matrix { + float a0; + float a1; + float a2; + float b0; + float b1; + float b2; + float c0; + float c1; + float c2; +}; + +struct C34Matrix { + float a0; + float a1; + float a2; + float b0; + float b1; + float b2; + float c0; + float c1; + float c2; + float d0; + float d1; + float d2; +}; + +struct C44Matrix { + float a0; + float a1; + float a2; + float a3; + float b0; + float b1; + float b2; + float b3; + float c0; + float c1; + float c2; + float c3; + float d0; + float d1; + float d2; + float d3; +}; + + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/plane.h b/3.3.5a/include/tempest/plane.h new file mode 100644 index 0000000..1d479c9 --- /dev/null +++ b/3.3.5a/include/tempest/plane.h @@ -0,0 +1,13 @@ +#ifndef TEMPEST_PLANE_H +#define TEMPEST_PLANE_H + +#include "tempest/vector.h" + +typedef struct C4Plane C4Plane; + +struct C4Plane { + C3Vector n; + float d; +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/quaternion.h b/3.3.5a/include/tempest/quaternion.h new file mode 100644 index 0000000..a31e370 --- /dev/null +++ b/3.3.5a/include/tempest/quaternion.h @@ -0,0 +1,13 @@ +#ifndef TEMPEST_QUATERNION_H +#define TEMPEST_QUATERNION_H + +typedef struct C4Quaternion C4Quaternion; + +struct C4Quaternion { + float x; + float y; + float z; + float w; +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/range.h b/3.3.5a/include/tempest/range.h new file mode 100644 index 0000000..6ba9c44 --- /dev/null +++ b/3.3.5a/include/tempest/range.h @@ -0,0 +1,19 @@ +#ifndef TEMPEST_RANGE_H +#define TEMPEST_RANGE_H + +#include + +typedef struct CRange CRange; +typedef struct CiRange CiRange; + +struct CRange { + float l; + float h; +}; + +struct CiRange { + int32_t l; + int32_t h; +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/rect.h b/3.3.5a/include/tempest/rect.h new file mode 100644 index 0000000..01e1ccd --- /dev/null +++ b/3.3.5a/include/tempest/rect.h @@ -0,0 +1,20 @@ +#ifndef TEMPEST_RECT_H +#define TEMPEST_RECT_H + +#include + +struct CRect { + float minY; // t + float minX; // l + float maxY; // b + float maxX; // r +}; + +struct CiRect { + int32_t minY; + int32_t minX; + int32_t maxY; + int32_t maxX; +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/sphere.h b/3.3.5a/include/tempest/sphere.h new file mode 100644 index 0000000..729c63b --- /dev/null +++ b/3.3.5a/include/tempest/sphere.h @@ -0,0 +1,11 @@ +#ifndef TEMPEST_SPHERE_H +#define TEMPEST_SPHERE_H + +#include "tempest/vector.h" + +struct CAaSphere { + C3Vector n; + float d; +}; + +#endif \ No newline at end of file diff --git a/3.3.5a/include/tempest/vector.h b/3.3.5a/include/tempest/vector.h new file mode 100644 index 0000000..434521e --- /dev/null +++ b/3.3.5a/include/tempest/vector.h @@ -0,0 +1,42 @@ +#ifndef TEMPEST_VECTOR_H +#define TEMPEST_VECTOR_H + +#include + +typedef struct C2Vector C2Vector; +typedef struct C3Vector C3Vector; +typedef struct C4Vector C4Vector; +typedef struct CImVector CImVector; + +struct C2Vector { + float x; + float y; +}; + +struct C2iVector { + int32_t x; + int32_t y; +}; + +struct C3Vector { + float x; + float y; + float z; +}; + +struct C4Vector { + float x; + float y; + float z; + float w; +}; + +struct CImVector { + uint8_t b; + uint8_t g; + uint8_t r; + uint8_t a; +}; + + +#endif \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf4c356 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# binana + +This repository hosts some work related to studying the original game binaries. + +You can use the information here to get a headstart when working on the [Whoa project](https://github.com/whoahq/whoa). + +# Header files + +To make reverse engineering easier, C header files matching the original memory layout are provided. + +The header `/include/main.h` to import type definitions into your analysis repository. + +Headers should be restricted at all times to the C programming language only. C++ syntax will break type analysis. + +To convert C++ namespaces, use double-underscores. For instance: + +```cpp +void Name::Space::Thing(); +``` + +should become: + +```c +void Name__Space__Thing(); +```