jak-project/common/link_types.h
water111 6e0ff4c9d0
[Decompiler] Clean up the output (#245)
* fix parent issue

* fix compiler issue

* update

* add error messages

* fix error

* fix array access, temporary

* more clean

* fix

* rename arg variables better

* fix method name

* fix no return value in decompiler

* many small fixes

* cheat types so it works

* name map

* fix old test'
2021-02-09 20:59:14 -05:00

54 lines
1.4 KiB
C++

#pragma once
/*!
* @file link_types.h
* Types used in the linking data, shared between the object file generator and the kernel's linker.
*/
#include "common_types.h"
enum LinkKind {
LINK_TABLE_END = 0, //! no more linking data
LINK_SYMBOL_OFFSET = 1, //! link a symbol (pointer to symbol table entry)
LINK_TYPE_PTR = 2, //! link a pointer to a type.
LINK_DISTANCE_TO_OTHER_SEG_64 = 3, //! link to another segment
LINK_DISTANCE_TO_OTHER_SEG_32 = 4, //! link to another segment
LINK_PTR = 5, //! link a pointer within this segment
};
enum SegmentTypes { MAIN_SEGMENT = 0, DEBUG_SEGMENT = 1, TOP_LEVEL_SEGMENT = 2 };
constexpr int N_SEG = 3;
/*!
* Data at the front of the DGO.
*/
struct DgoHeader {
u32 object_count;
char name[60];
};
/*!
* Data at the front of each OBJ.
*/
struct ObjectHeader {
u32 size;
char name[60];
};
// Header for link data used for V2 linking data
// used in GOAL and OpenGOAL
struct LinkHeaderV2 {
uint32_t type_tag; // always -1
uint32_t length; // length of link data
uint32_t version; // always 2
};
// Header for link data used for V4
struct LinkHeaderV4 {
uint32_t type_tag; // always -1
uint32_t length; // length of V2 link data found after object.
uint32_t version; // always 4
uint32_t code_size; // length of object data before link data starts
};