mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
Import code from previous AssetBuilder version
This commit is contained in:
11
src/ZoneCommon/Zone/Stream/IZoneStream.h
Normal file
11
src/ZoneCommon/Zone/Stream/IZoneStream.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "Zone/ZoneTypes.h"
|
||||
|
||||
class IZoneStream
|
||||
{
|
||||
public:
|
||||
virtual ~IZoneStream() = default;
|
||||
|
||||
virtual void PushBlock(block_t block) = 0;
|
||||
virtual block_t PopBlock() = 0;
|
||||
};
|
9
src/ZoneCommon/Zone/XAssetDependency.h
Normal file
9
src/ZoneCommon/Zone/XAssetDependency.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class XAssetDependency
|
||||
{
|
||||
public:
|
||||
int m_type;
|
||||
std::string m_name;
|
||||
};
|
33
src/ZoneCommon/Zone/XBlock.cpp
Normal file
33
src/ZoneCommon/Zone/XBlock.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "XBlock.h"
|
||||
#include <cassert>
|
||||
|
||||
XBlock::XBlock(const std::string& name, const int index, const Type type)
|
||||
{
|
||||
m_name = name;
|
||||
m_index = index;
|
||||
m_type = type;
|
||||
m_buffer = nullptr;
|
||||
m_buffer_size = 0;
|
||||
}
|
||||
|
||||
XBlock::~XBlock()
|
||||
{
|
||||
delete[] m_buffer;
|
||||
m_buffer = nullptr;
|
||||
}
|
||||
|
||||
void XBlock::Alloc(const size_t blockSize)
|
||||
{
|
||||
delete[] m_buffer;
|
||||
|
||||
if(blockSize > 0)
|
||||
{
|
||||
m_buffer = new uint8_t[blockSize];
|
||||
m_buffer_size = blockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buffer = nullptr;
|
||||
m_buffer_size = 0;
|
||||
}
|
||||
}
|
26
src/ZoneCommon/Zone/XBlock.h
Normal file
26
src/ZoneCommon/Zone/XBlock.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class XBlock
|
||||
{
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
BLOCK_TYPE_TEMP,
|
||||
BLOCK_TYPE_RUNTIME,
|
||||
BLOCK_TYPE_DELAY,
|
||||
BLOCK_TYPE_NORMAL
|
||||
};
|
||||
|
||||
std::string m_name;
|
||||
int m_index;
|
||||
Type m_type;
|
||||
|
||||
uint8_t* m_buffer;
|
||||
size_t m_buffer_size;
|
||||
|
||||
XBlock(const std::string& name, int index, Type type);
|
||||
~XBlock();
|
||||
|
||||
void Alloc(size_t blockSize);
|
||||
};
|
14
src/ZoneCommon/Zone/Zone.cpp
Normal file
14
src/ZoneCommon/Zone/Zone.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Zone.h"
|
||||
|
||||
Zone::Zone(std::string name, const zone_priority_t priority, IZoneAssetPools* pools, IGame* game)
|
||||
{
|
||||
m_name = std::move(name);
|
||||
m_priority = priority;
|
||||
m_pools = pools;
|
||||
m_game = game;
|
||||
}
|
||||
|
||||
IZoneAssetPools* Zone::GetPools() const
|
||||
{
|
||||
return m_pools;
|
||||
}
|
21
src/ZoneCommon/Zone/Zone.h
Normal file
21
src/ZoneCommon/Zone/Zone.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "ZoneTypes.h"
|
||||
#include "Pool/IZoneAssetPools.h"
|
||||
#include "Game/IGame.h"
|
||||
#include <string>
|
||||
|
||||
class IGame;
|
||||
|
||||
class Zone
|
||||
{
|
||||
std::string m_name;
|
||||
zone_priority_t m_priority;
|
||||
IZoneAssetPools* m_pools;
|
||||
|
||||
public:
|
||||
IGame* m_game;
|
||||
|
||||
Zone(std::string name, zone_priority_t priority, IZoneAssetPools* pools, IGame* game);
|
||||
|
||||
IZoneAssetPools* GetPools() const;
|
||||
};
|
24
src/ZoneCommon/Zone/ZoneTypes.h
Normal file
24
src/ZoneCommon/Zone/ZoneTypes.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
struct ZoneHeader
|
||||
{
|
||||
uint8_t m_magic[8];
|
||||
uint32_t m_version;
|
||||
};
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef uint32_t scr_string_t;
|
||||
typedef uint64_t xchunk_size_t;
|
||||
typedef uint64_t xblock_size_t;
|
||||
typedef uint64_t zone_pointer_t;
|
||||
#elif _WIN32
|
||||
typedef uint16_t scr_string_t;
|
||||
typedef uint32_t xchunk_size_t;
|
||||
typedef uint32_t xblock_size_t;
|
||||
typedef uint32_t zone_pointer_t;
|
||||
#endif
|
||||
|
||||
typedef int block_t;
|
||||
typedef int asset_type_t;
|
||||
typedef unsigned int zone_priority_t;
|
Reference in New Issue
Block a user