mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 03:12:18 -05:00
09432ee7f4
* Initial Linux/GCC support commit * Add instructins for linux in the README * apply suggestions by @Erotemic and @Emill * Fix python 3.10 symlink line * Fix func_80041E80 type mismatch (#3) Type mismatch functions.h:664 * Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES * Makefile: find C/CXX_FILES automatically * Makefile: remove ugly conditions in find commands * cleanup _MSC_VER usage * fix Windows build * cleanup extraction scripts * fix Windows build * Fix Windows path separator issue * fix rumble support for linux * use glew-cmake in dockerfile * add pulseaudio backend * fix ZAPDTR linkage * Check for "soh.elf" in directory (#6) hide second button if `soh.exe` or `soh.elf` is present * Fix hardcoded segment addresses (#5) * fix condition * hack lus -> soh dep for ZAPDTR Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
110 lines
3.0 KiB
C++
110 lines
3.0 KiB
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include "Utils/BinaryReader.h"
|
|
#include "Utils/BinaryWriter.h"
|
|
#include "GlobalCtx2.h"
|
|
#include "StrHash.h"
|
|
#include "File.h"
|
|
#include "Lib/tinyxml2/tinyxml2.h"
|
|
|
|
namespace Ship
|
|
{
|
|
enum class ResourceType
|
|
{
|
|
Archive = 0x4F415243, // OARC
|
|
Model = 0x4F4D444C, // OMDL
|
|
Texture = 0x4F544558, // OTEX
|
|
Material = 0x4F4D4154, // OMAT
|
|
Animation = 0x4F414E4D, // OANM
|
|
PlayerAnimation = 0x4F50414D, // OPAM
|
|
DisplayList = 0x4F444C54, // ODLT
|
|
Room = 0x4F524F4D, // OROM
|
|
CollisionHeader = 0x4F434F4C, // OCOL
|
|
Skeleton = 0x4F534B4C, // OSKL
|
|
SkeletonLimb = 0x4F534C42, // OSLB
|
|
Matrix = 0x4F4D5458, // OMTX
|
|
Path = 0x4F505448, // OPTH
|
|
Vertex = 0x4F565458, // OVTX
|
|
Cutscene = 0x4F435654, // OCUT
|
|
Array = 0x4F415252, // OARR
|
|
Text = 0x4F545854, // OTXT
|
|
Blob = 0x4F424C42, // OBLB
|
|
};
|
|
|
|
enum class DataType
|
|
{
|
|
U8 = 0,
|
|
S8 = 1,
|
|
U16 = 2,
|
|
S16 = 3,
|
|
U32 = 4,
|
|
S32 = 5,
|
|
U64 = 6,
|
|
S64 = 7,
|
|
F16 = 8,
|
|
F32 = 9,
|
|
F64 = 10
|
|
};
|
|
|
|
enum class Endianess
|
|
{
|
|
Little = 0,
|
|
Big = 1,
|
|
};
|
|
|
|
enum class Version
|
|
{
|
|
// BR
|
|
Deckard = 0,
|
|
Roy = 1,
|
|
Rachael = 2,
|
|
Leon = 3,
|
|
Zhora = 4,
|
|
// ...
|
|
};
|
|
|
|
struct Patch
|
|
{
|
|
uint64_t crc;
|
|
uint32_t index;
|
|
uintptr_t origData;
|
|
};
|
|
|
|
class Resource
|
|
{
|
|
public:
|
|
ResourceMgr* resMgr;
|
|
uint64_t id; // Unique Resource ID
|
|
ResourceType resType;
|
|
bool isDirty = false;
|
|
void* cachedGameAsset = 0; // Conversion to OoT friendly struct cached...
|
|
std::shared_ptr<File> file;
|
|
std::vector<Patch> patches;
|
|
virtual ~Resource();
|
|
};
|
|
|
|
class ResourceFile
|
|
{
|
|
public:
|
|
Endianess endianess; // 0x00 - Endianess of the file
|
|
uint32_t resourceType; // 0x01 - 4 byte MAGIC
|
|
Version version; // 0x05 - Based on Ship release numbers
|
|
uint64_t id; // 0x09 - Unique Resource ID
|
|
uint32_t resourceVersion; // 0x11 - Resource Minor Version Number
|
|
|
|
virtual void ParseFileBinary(BinaryReader* reader, Resource* res);
|
|
virtual void ParseFileXML(tinyxml2::XMLElement* reader, Resource* res);
|
|
virtual void WriteFileBinary(BinaryWriter* writer, Resource* res);
|
|
virtual void WriteFileXML(tinyxml2::XMLElement* writer, Resource* res);
|
|
};
|
|
|
|
class ResourcePromise {
|
|
public:
|
|
std::shared_ptr<Resource> resource;
|
|
std::shared_ptr<File> file;
|
|
std::condition_variable resourceLoadNotifier;
|
|
std::mutex resourceLoadMutex;
|
|
bool bHasResourceLoaded = false;
|
|
};
|
|
} |