mirror of
https://github.com/AxioDL/PrimeAPI.git
synced 2026-03-30 11:38:46 -07:00
Some new header stuff
This commit is contained in:
+10
-2
@@ -21,9 +21,17 @@ typedef unsigned long uint32;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
// Other common types
|
||||
struct TAreaId {
|
||||
class TAreaId {
|
||||
public:
|
||||
int32 Id;
|
||||
inline operator int32() const { return Id; }
|
||||
|
||||
TAreaId() {}
|
||||
TAreaId(const TAreaId& rhs) { Id = rhs.Id; }
|
||||
~TAreaId() {}
|
||||
TAreaId& operator=(const TAreaId& rhs) { Id = rhs.Id; return *this; }
|
||||
TAreaId& operator=(int32 i) { Id = i; return *this; }
|
||||
|
||||
operator int32() const { return Id; }
|
||||
};
|
||||
|
||||
// Common defines
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef CGAMEAREA_HPP
|
||||
#define CGAMEAREA_HPP
|
||||
|
||||
class CStateManager;
|
||||
|
||||
class CGameArea
|
||||
{
|
||||
public:
|
||||
void StartStreamIn(CStateManager&);
|
||||
void Validate(CStateManager&);
|
||||
void LoadScriptObjects(CStateManager&);
|
||||
};
|
||||
|
||||
#endif // CGAMEAREA_HPP
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
class CPlayer;
|
||||
class CPlayerState;
|
||||
class CWorld;
|
||||
|
||||
class CStateManager
|
||||
{
|
||||
@@ -23,6 +24,7 @@ public:
|
||||
void InitializeState(uint WorldAssetId, TAreaId AreaId, uint AreaAssetId);
|
||||
|
||||
inline CPlayer* GetPlayer() const { return *GetField<CPlayer*>(this, 0x84C); }
|
||||
inline CWorld* GetWorld() const { return *GetField<CWorld*>(this, 0x850); }
|
||||
inline CPlayerState* GetPlayerState() const { return **GetField<CPlayerState**>(this, 0x8b8); }
|
||||
inline EInitPhase GetInitPhase() const { return *GetField<EInitPhase>(this, 0xB3C); }
|
||||
};
|
||||
|
||||
@@ -2,10 +2,32 @@
|
||||
#define CWORLDSTATE_HPP
|
||||
|
||||
#include <PrimeAPI.h>
|
||||
#include <rstl/vector.h>
|
||||
|
||||
class CWorldLayers
|
||||
{
|
||||
public:
|
||||
struct Area
|
||||
{
|
||||
uint32 mStartNameIdx;
|
||||
uint32 mLayerCount;
|
||||
uint64 mLayerBits;
|
||||
};
|
||||
};
|
||||
|
||||
class CWorldLayerState
|
||||
{
|
||||
public:
|
||||
rstl::vector<CWorldLayers::Area> areaLayers;
|
||||
};
|
||||
|
||||
class CWorldState
|
||||
{
|
||||
public:
|
||||
uint32 x0_worldAssetId;
|
||||
TAreaId x4_areaId;
|
||||
|
||||
inline CWorldLayerState* GetWorldLayerState() const { return **GetField<CWorldLayerState**>(this, 0x14); }
|
||||
void SetDesiredAreaAssetId(uint assetId);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef CWORLD_HPP
|
||||
#define CWORLD_HPP
|
||||
|
||||
#include <PrimeAPI.h>
|
||||
|
||||
class CWorld
|
||||
{
|
||||
public:
|
||||
TAreaId IGetAreaId(uint areaAssetId) const;
|
||||
TAreaId GetAreaId(uint areaAssetId) const;
|
||||
};
|
||||
|
||||
#endif // CWORLD_HPP
|
||||
@@ -0,0 +1,110 @@
|
||||
#ifndef RSTL_STRING_H
|
||||
#define RSTL_STRING_H
|
||||
|
||||
#include <rstl/rstl.h>
|
||||
|
||||
RSTL_BEGIN
|
||||
|
||||
class rmemory_allocator;
|
||||
template<typename t>
|
||||
class char_traits;
|
||||
|
||||
template<typename _CharTp, typename traits, typename allocator>
|
||||
class basic_string {
|
||||
struct COWData {
|
||||
u32 x0_capacity;
|
||||
u32 x4_refCount;
|
||||
_CharTp *x8_data;
|
||||
};
|
||||
|
||||
const _CharTp *x0_ptr;
|
||||
COWData *x4_cow;
|
||||
u32 x8_size;
|
||||
|
||||
void internal_allocate(int size) {
|
||||
x4_cow = reinterpret_cast<COWData *>(new u8[size * sizeof(_CharTp) + 8]);
|
||||
x0_ptr = x4_cow->x8_data;
|
||||
x4_cow->x0_capacity = u32(size);
|
||||
x4_cow->x4_refCount = 1;
|
||||
}
|
||||
|
||||
static const _CharTp _EmptyString;
|
||||
|
||||
public:
|
||||
struct literal_t {
|
||||
};
|
||||
|
||||
basic_string(literal_t, const _CharTp *data) {
|
||||
x0_ptr = data;
|
||||
x4_cow = nullptr;
|
||||
|
||||
const _CharTp *it = data;
|
||||
while (*it) {
|
||||
++it;
|
||||
}
|
||||
|
||||
x8_size = u32((it - data) / sizeof(_CharTp));
|
||||
}
|
||||
|
||||
basic_string(const basic_string &str) {
|
||||
x0_ptr = str.x0_ptr;
|
||||
x4_cow = str.x4_cow;
|
||||
x8_size = str.x8_size;
|
||||
if (x4_cow) {
|
||||
++x4_cow->x4_refCount;
|
||||
}
|
||||
}
|
||||
|
||||
basic_string(const _CharTp *data, int size) {
|
||||
if (size <= 0 && !data) {
|
||||
x0_ptr = &_EmptyString;
|
||||
x4_cow = nullptr;
|
||||
x8_size = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const _CharTp *it = data;
|
||||
u32 len = 0;
|
||||
while (*it) {
|
||||
if (size != -1 && len >= size) {
|
||||
break;
|
||||
}
|
||||
++it;
|
||||
++len;
|
||||
}
|
||||
|
||||
internal_allocate(len + 1);
|
||||
x8_size = len;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
x4_cow->x8_data[i] = data[i];
|
||||
}
|
||||
x4_cow->x8_data[len] = 0;
|
||||
}
|
||||
|
||||
~basic_string() {
|
||||
if (x4_cow && --x4_cow->x4_refCount == 0) {
|
||||
delete[] x4_cow;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
const char basic_string<char, char_traits<char>, rmemory_allocator>::_EmptyString = 0;
|
||||
template<>
|
||||
const wchar_t basic_string<wchar_t, char_traits<wchar_t>, rmemory_allocator>::_EmptyString = 0;
|
||||
|
||||
typedef basic_string<wchar_t, char_traits<wchar_t>, rmemory_allocator> wstring;
|
||||
typedef basic_string<char, char_traits<char>, rmemory_allocator> string;
|
||||
|
||||
|
||||
inline wstring wstring_l(const wchar_t *data) {
|
||||
return wstring(wstring::literal_t(), data);
|
||||
}
|
||||
|
||||
inline string string_l(const char *data) {
|
||||
return string(string::literal_t(), data);
|
||||
}
|
||||
|
||||
RSTL_END
|
||||
|
||||
#endif // RSTL_STRING_H
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef RSTL_VECTOR_H
|
||||
#define RSTL_VECTOR_H
|
||||
|
||||
#include "rstl/rstl.h"
|
||||
|
||||
RSTL_BEGIN
|
||||
|
||||
template<typename T>
|
||||
class vector
|
||||
{
|
||||
uint32 mFirst;
|
||||
uint32 mSize;
|
||||
uint32 mMax;
|
||||
T* mPtr;
|
||||
|
||||
public:
|
||||
inline uint32 size() const { return mSize; }
|
||||
inline uint32 capacity() const { return mMax; }
|
||||
inline T& operator[](int i) const { return mPtr[i]; }
|
||||
inline T* data() const { return mPtr; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class reserved_vector
|
||||
{
|
||||
public:
|
||||
int32 len;
|
||||
T* first;
|
||||
T* end;
|
||||
T* last;
|
||||
};
|
||||
|
||||
RSTL_END
|
||||
|
||||
|
||||
#endif // RSTL_VECTOR_H
|
||||
@@ -825,6 +825,8 @@
|
||||
0x800556F0 __dt__6CActorFv
|
||||
0x80055820 __ct__6CActorF9TUniqueIdbRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fRC10CModelDataRC13CMaterialListRC16CActorParameters9TUniqueId
|
||||
0x80055D28 MakeActorMaterialList__FRC13CMaterialListRC16CActorParameters
|
||||
0x800560CC IGetAreaId__6CWorldCFUi
|
||||
0x800560F8 GetAreaId__6CWorldCFUi
|
||||
0x80056164 AreSkyNeedsMet__6CWorldCFv
|
||||
0x800561D0 DrawSky__6CWorldCFRC12CTransform4f
|
||||
0x800562F0 PreRender__6CWorldFv
|
||||
@@ -969,6 +971,7 @@
|
||||
0x800609B8 Invalidate__9CGameAreaFP13CStateManager
|
||||
0x80060D80 CullDeadAreaRequests__9CGameAreaFv
|
||||
0x80060DE4 StartStreamIn__9CGameAreaFR13CStateManager
|
||||
0x80060F60 LoadScriptObjects__9CGameAreaFR13CStateManager
|
||||
0x800610A4 Validate__9CGameAreaFR13CStateManager
|
||||
0x800612F0 PostConstructArea__9CGameAreaFv
|
||||
0x80062548 FillInStaticGeometry__9CGameAreaFv
|
||||
|
||||
Reference in New Issue
Block a user