jak-project/game/kernel/common/Symbol4.h
ManDude 4b8b2abbed
port pckernel to Jak 2 (#2248)
Adds the `pckernel` system to Jak 2, allowing you to do the PC-specific
things that Jak 1 lets you do like change game resolution, etc.

In other to reduce the amount of code duplication for something that
we're gonna be changing a lot over time, I split it into a few more code
files. In this new system, `pckernel-h.gc`, `pckernel-common.gc`
(previously `pckernel.gc`) and `pc-debug-common.gc` are the files that
should be shared across all games (I hacked the Jak 2 project to pull
these files from the Jak 1 folder), while `pckernel-impl.gc`,
`pckernel.gc` and `pc-debug-methods.gc` are their respective
game-specific counterparts that should be loaded after. I'm not fully
happy with this, I think it's slightly messy, but it cleanly separates
code that should be game-specific and not accidentally copied around and
code that should be the same for all games anyway.
2023-02-25 10:19:32 -05:00

19 lines
505 B
C++

#pragma once
#include "common/common_types.h"
#include "common/goal_constants.h"
#include "common/util/Assert.h"
#include "game/kernel/common/Ptr.h"
template <typename T>
struct Symbol4 {
u8 foo;
T& value() { return *reinterpret_cast<T*>(&foo - 1); }
const T& value() const { return *reinterpret_cast<T*>(&foo - 1); }
const char* name_cstr() const {
return (const char*)(g_ee_main_mem + 4 +
*reinterpret_cast<const u32*>(&foo + jak2::SYM_TO_STRING_OFFSET));
}
};