mirror of https://github.com/zeldaret/botw.git
Havok: Add hkNativePackfileUtils
This commit is contained in:
parent
fb6d464665
commit
751bed1105
|
@ -37,6 +37,8 @@ add_library(hkStubs OBJECT
|
|||
Havok/Common/Base/Types/hkRefVariant.h
|
||||
Havok/Common/Base/Types/Geometry/Aabb/hkAabb.h
|
||||
|
||||
Havok/Common/Serialize/Resource/hkResource.h
|
||||
Havok/Common/Serialize/Util/hkNativePackfileUtils.h
|
||||
Havok/Common/Serialize/Util/hkRootLevelContainer.h
|
||||
|
||||
Havok/Geometry/Collide/Shapes/hkcdShape.h
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#include <Havok/Common/Base/hkBase.h>
|
||||
|
||||
class hkTypeInfoRegistry;
|
||||
|
||||
class hkResource : public hkReferencedObject {
|
||||
public:
|
||||
HK_DECLARE_CLASS_ALLOCATOR(hkResource)
|
||||
|
||||
struct Export {
|
||||
HK_DECLARE_CLASS_ALLOCATOR(Export)
|
||||
|
||||
const char* name;
|
||||
void* data;
|
||||
};
|
||||
|
||||
struct Import {
|
||||
HK_DECLARE_CLASS_ALLOCATOR(Import)
|
||||
|
||||
const char* name;
|
||||
void** location;
|
||||
};
|
||||
|
||||
virtual const char* getName() const = 0;
|
||||
|
||||
~hkResource() override = default;
|
||||
|
||||
virtual void callDestructors() {}
|
||||
|
||||
virtual void getImportsExports(hkArray<Import>& impOut, hkArray<Export>& expOut) const = 0;
|
||||
|
||||
virtual void* getContentsPointer(const char* typeName,
|
||||
const hkTypeInfoRegistry* typeRegistry) const = 0;
|
||||
|
||||
template <typename T>
|
||||
inline T* getContentsWithRegistry(const hkTypeInfoRegistry* typeRegistry) const;
|
||||
|
||||
template <typename T>
|
||||
inline T* getContents() const;
|
||||
|
||||
/// Return the top level object type name.
|
||||
virtual const char* getContentsTypeName() const = 0;
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <Havok/Common/Base/hkBase.h>
|
||||
#include <Havok/Common/Serialize/Resource/hkResource.h>
|
||||
|
||||
class hkTypeInfoRegistry;
|
||||
|
||||
namespace hkNativePackfileUtils {
|
||||
|
||||
hkResource* load(const void* packfileData, int dataSize,
|
||||
const hkTypeInfoRegistry* userRegistry = nullptr);
|
||||
|
||||
int getRequiredBufferSize(const void* packfileData, int dataSize);
|
||||
|
||||
void* load(const void* packfileData, int dataSize, void* outBuffer, int outBufferSize,
|
||||
const hkTypeInfoRegistry* userRegistry = nullptr);
|
||||
|
||||
/// @warning A buffer that has been loaded in place cannot be loaded more than once!
|
||||
void* loadInPlace(void* packfileData, int dataSize,
|
||||
const hkTypeInfoRegistry* userRegistry = nullptr, const char** errOut = nullptr);
|
||||
|
||||
const char* getContentsClassName(const void* packfileData, int dataSize);
|
||||
|
||||
void getImportsExports(const void* loadedBuffer, hkArray<hkResource::Export>& expOut,
|
||||
hkArray<hkResource::Import>& impOut);
|
||||
|
||||
void getImportsExportsInPlace(const void* loadedBuffer, hkArray<hkResource::Export>& expOut,
|
||||
hkArray<hkResource::Import>& impOut);
|
||||
|
||||
void unload(void* loadedBuffer, int bufferSize);
|
||||
void unloadInPlace(void* loadedBuffer, int bufferSize);
|
||||
|
||||
hkResult validatePackfileHeader(const void* packfileData, const char** errOut);
|
||||
|
||||
} // namespace hkNativePackfileUtils
|
Loading…
Reference in New Issue