mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-03 14:34:32 +00:00
ZAPD update (#612)
* remove roompoly * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "fd4d53a26" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "fd4d53a26" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
This commit is contained in:
parent
5c6335f9fb
commit
1ff2f0f849
171 changed files with 1567 additions and 826 deletions
|
@ -25,7 +25,6 @@ struct DynaPolyActor;
|
||||||
#define FUNC_80041EA4_VOID_OUT 12
|
#define FUNC_80041EA4_VOID_OUT 12
|
||||||
|
|
||||||
#define WATERBOX_ROOM(p) ((p >> 13) & 0x3F)
|
#define WATERBOX_ROOM(p) ((p >> 13) & 0x3F)
|
||||||
#define RoomPoly CollisionPoly // FIXME: Update ZAP to remove RoomPoly
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Vec3f scale;
|
Vec3f scale;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
[subrepo]
|
[subrepo]
|
||||||
remote = https://github.com/zeldaret/ZAPD.git
|
remote = https://github.com/zeldaret/ZAPD.git
|
||||||
branch = master
|
branch = master
|
||||||
commit = 440ed2684bb9d02837bfef0c41e6c59e479897a4
|
commit = fd4d53a2684871a1ac28668515d025470a45ef7f
|
||||||
parent = 1f7bebfc05c42cc4f100a1992970e78ef7055dbd
|
parent = cbe216b1810f9274242d0088a7e3b15b0f95f55d
|
||||||
method = merge
|
method = merge
|
||||||
cmdver = 0.4.3
|
cmdver = 0.4.3
|
||||||
|
|
45
tools/ZAPD/Jenkinsfile
vendored
Normal file
45
tools/ZAPD/Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build ZAPD') {
|
||||||
|
steps {
|
||||||
|
sh 'make -j'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Checkout oot') {
|
||||||
|
steps {
|
||||||
|
dir('oot') {
|
||||||
|
git url: 'https://github.com/zeldaret/oot.git'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Set up oot') {
|
||||||
|
steps {
|
||||||
|
dir('oot') {
|
||||||
|
sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom_original.z64'
|
||||||
|
|
||||||
|
// Identical to `make setup` except for copying our newer ZAPD.out into oot
|
||||||
|
sh 'git submodule update --init --recursive'
|
||||||
|
sh 'make -C tools'
|
||||||
|
sh 'cp ../ZAPD.out tools/ZAPD/'
|
||||||
|
sh 'python3 fixbaserom.py'
|
||||||
|
sh 'python3 extract_baserom.py'
|
||||||
|
sh 'python3 extract_assets.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build oot') {
|
||||||
|
steps {
|
||||||
|
dir('oot') {
|
||||||
|
sh 'make -j'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,11 +4,19 @@ ifneq (, $(shell which ccache))
|
||||||
CC := ccache $(CC)
|
CC := ccache $(CC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS := -g -std=c++17 -I ZAPD -I ZAPD/sqlite -O2 -rdynamic
|
CFLAGS := -g -std=c++17 -I ZAPD -I lib/assimp/include -I lib/elfio -I lib/json/include -I lib/stb -I lib/tinygltf -I lib/tinyxml2 -O2 -rdynamic
|
||||||
|
|
||||||
|
UNAME := $(shell uname)
|
||||||
|
|
||||||
|
FS_INC =
|
||||||
|
ifneq ($(UNAME), Darwin)
|
||||||
|
FS_INC += -lstdc++fs
|
||||||
|
endif
|
||||||
|
|
||||||
SRC_DIRS := ZAPD ZAPD/ZRoom ZAPD/ZRoom/Commands ZAPD/Overlays ZAPD/HighLevel ZAPD/OpenFBX
|
SRC_DIRS := ZAPD ZAPD/ZRoom ZAPD/ZRoom/Commands ZAPD/Overlays ZAPD/HighLevel ZAPD/OpenFBX
|
||||||
|
|
||||||
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
|
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
|
||||||
|
CPP_FILES += lib/tinyxml2/tinyxml2.cpp
|
||||||
O_FILES := $(CPP_FILES:.cpp=.o)
|
O_FILES := $(CPP_FILES:.cpp=.o)
|
||||||
|
|
||||||
all: ZAPD.out
|
all: ZAPD.out
|
||||||
|
@ -22,4 +30,4 @@ rebuild: clean all
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
ZAPD.out: $(O_FILES)
|
ZAPD.out: $(O_FILES)
|
||||||
$(CC) $(CFLAGS) $(O_FILES) -o $@ -lstdc++fs
|
$(CC) $(CFLAGS) $(O_FILES) -o $@ $(FS_INC)
|
||||||
|
|
|
@ -1,43 +1,129 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class BitConverter
|
class BitConverter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline int16_t ToInt16BE(uint8_t* data, int offset)
|
static inline int8_t ToInt8BE(const uint8_t* data, int offset)
|
||||||
{
|
{
|
||||||
return (data[offset + 0] << 8) + data[offset + 1];
|
return (uint8_t)data[offset + 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int16_t ToInt16BE(std::vector<uint8_t> data, int offset)
|
static inline int8_t ToInt8BE(const std::vector<uint8_t>& data, int offset)
|
||||||
{
|
{
|
||||||
return (data[offset + 0] << 8) + data[offset + 1];
|
return (uint8_t)data[offset + 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int32_t ToInt32BE(std::uint8_t* data, int offset)
|
static inline uint8_t ToUInt8BE(const uint8_t* data, int offset)
|
||||||
{
|
{
|
||||||
return (data[offset + 0] << 24) + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
|
return (uint8_t)data[offset + 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int32_t ToInt32BE(std::vector<uint8_t> data, int offset)
|
static inline uint8_t ToUInt8BE(const std::vector<uint8_t>& data, int offset)
|
||||||
{
|
{
|
||||||
return (data[offset + 0] << 24) + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
|
return (uint8_t)data[offset + 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t ToInt64BE(uint8_t* data, int offset)
|
static inline int16_t ToInt16BE(const uint8_t* data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint16_t)data[offset + 0] << 8) + (uint16_t)data[offset + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int16_t ToInt16BE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint16_t)data[offset + 0] << 8) + (uint16_t)data[offset + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint16_t ToUInt16BE(const uint8_t* data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint16_t)data[offset + 0] << 8) + (uint16_t)data[offset + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint16_t ToUInt16BE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint16_t)data[offset + 0] << 8) + (uint16_t)data[offset + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int32_t ToInt32BE(const uint8_t* data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint32_t)data[offset + 0] << 24) + ((uint32_t)data[offset + 1] << 16) + ((uint32_t)data[offset + 2] << 8) + (uint32_t)data[offset + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int32_t ToInt32BE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint32_t)data[offset + 0] << 24) + ((uint32_t)data[offset + 1] << 16) + ((uint32_t)data[offset + 2] << 8) + (uint32_t)data[offset + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t ToUInt32BE(const uint8_t* data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint32_t)data[offset + 0] << 24) + ((uint32_t)data[offset + 1] << 16) + ((uint32_t)data[offset + 2] << 8) + (uint32_t)data[offset + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t ToUInt32BE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint32_t)data[offset + 0] << 24) + ((uint32_t)data[offset + 1] << 16) + ((uint32_t)data[offset + 2] << 8) + (uint32_t)data[offset + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int64_t ToInt64BE(const uint8_t* data, int offset)
|
||||||
{
|
{
|
||||||
return ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
return ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t ToInt64BE(std::vector<uint8_t> data, int offset)
|
static inline int64_t ToInt64BE(const std::vector<uint8_t>& data, int offset)
|
||||||
{
|
{
|
||||||
return ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
return ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float ToFloatBE(std::vector<uint8_t> data, int offset)
|
static inline uint64_t ToUInt64BE(const uint8_t* data, int offset)
|
||||||
{
|
{
|
||||||
return (float)(data[offset + 0] << 24) + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
|
return ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t ToUInt64BE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
return ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline float ToFloatBE(const uint8_t* data, int offset)
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
uint32_t floatData = ((uint32_t)data[offset + 0] << 24) + ((uint32_t)data[offset + 1] << 16) + ((uint32_t)data[offset + 2] << 8) + (uint32_t)data[offset + 3];
|
||||||
|
static_assert(sizeof(uint32_t) == sizeof(float));
|
||||||
|
std::memcpy(&value, &floatData, sizeof(value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline float ToFloatBE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
uint32_t floatData = ((uint32_t)data[offset + 0] << 24) + ((uint32_t)data[offset + 1] << 16) + ((uint32_t)data[offset + 2] << 8) + (uint32_t)data[offset + 3];
|
||||||
|
static_assert(sizeof(uint32_t) == sizeof(float));
|
||||||
|
std::memcpy(&value, &floatData, sizeof(value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline double ToDoubleBE(const uint8_t* data, int offset)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
uint64_t floatData = ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
||||||
|
static_assert(sizeof(uint64_t) == sizeof(double));
|
||||||
|
// Checks if the float format on the platform the ZAPD binary is running on supports the same float format as the object file.
|
||||||
|
static_assert(std::numeric_limits<float>::is_iec559);
|
||||||
|
std::memcpy(&value, &floatData, sizeof(value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline double ToDoubleBE(const std::vector<uint8_t>& data, int offset)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
uint64_t floatData = ((uint64_t)data[offset + 0] << 56) + ((uint64_t)data[offset + 1] << 48) + ((uint64_t)data[offset + 2] << 40) + ((uint64_t)data[offset + 3] << 32) + ((uint64_t)data[offset + 4] << 24) + ((uint64_t)data[offset + 5] << 16) + ((uint64_t)data[offset + 6] << 8) + ((uint64_t)data[offset + 7]);
|
||||||
|
static_assert(sizeof(uint64_t) == sizeof(double));
|
||||||
|
// Checks if the float format on the platform the ZAPD binary is running on supports the same float format as the object file.
|
||||||
|
static_assert(std::numeric_limits<double>::is_iec559);
|
||||||
|
std::memcpy(&value, &floatData, sizeof(value));
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -3,7 +3,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__clang__)
|
#if __has_include(<filesystem>)
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
#else
|
#else
|
||||||
|
@ -19,12 +19,12 @@ public:
|
||||||
return fs::current_path().u8string();
|
return fs::current_path().u8string();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Exists(std::string path)
|
static bool Exists(const std::string& path)
|
||||||
{
|
{
|
||||||
return fs::exists(fs::path(path));
|
return fs::exists(fs::path(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateDirectory(std::string path)
|
static void CreateDirectory(const std::string& path)
|
||||||
{
|
{
|
||||||
fs::create_directory(path);
|
fs::create_directory(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,23 +11,26 @@
|
||||||
class File
|
class File
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool Exists(std::string filePath)
|
static bool Exists(const std::string& filePath)
|
||||||
{
|
{
|
||||||
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||||
return file.good();
|
return file.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<uint8_t> ReadAllBytes(std::string filePath)
|
static std::vector<uint8_t> ReadAllBytes(const std::string& filePath)
|
||||||
{
|
{
|
||||||
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||||
int fileSize = (int)file.tellg();
|
int fileSize = (int)file.tellg();
|
||||||
file.seekg(0);
|
file.seekg(0);
|
||||||
char* data = new char[fileSize];
|
char* data = new char[fileSize];
|
||||||
file.read(data, fileSize);
|
file.read(data, fileSize);
|
||||||
return std::vector<uint8_t>(data, data + fileSize);
|
std::vector<uint8_t> result = std::vector<uint8_t>(data, data + fileSize);
|
||||||
|
delete data;
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string ReadAllText(std::string filePath)
|
static std::string ReadAllText(const std::string& filePath)
|
||||||
{
|
{
|
||||||
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||||
int fileSize = (int)file.tellg();
|
int fileSize = (int)file.tellg();
|
||||||
|
@ -35,10 +38,13 @@ public:
|
||||||
char* data = new char[fileSize+1];
|
char* data = new char[fileSize+1];
|
||||||
memset(data, 0, fileSize + 1);
|
memset(data, 0, fileSize + 1);
|
||||||
file.read(data, fileSize);
|
file.read(data, fileSize);
|
||||||
return std::string((const char*)data);
|
std::string str = std::string((const char*)data);
|
||||||
|
delete data;
|
||||||
|
|
||||||
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<std::string> ReadAllLines(std::string filePath)
|
static std::vector<std::string> ReadAllLines(const std::string& filePath)
|
||||||
{
|
{
|
||||||
std::string text = ReadAllText(filePath);
|
std::string text = ReadAllText(filePath);
|
||||||
std::vector<std::string> lines = StringHelper::Split(text, "\n");
|
std::vector<std::string> lines = StringHelper::Split(text, "\n");
|
||||||
|
@ -46,13 +52,13 @@ public:
|
||||||
return lines;
|
return lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void WriteAllBytes(std::string filePath, std::vector<uint8_t> data)
|
static void WriteAllBytes(const std::string& filePath, const std::vector<uint8_t>& data)
|
||||||
{
|
{
|
||||||
std::ofstream file(filePath, std::ios::binary);
|
std::ofstream file(filePath, std::ios::binary);
|
||||||
file.write((char*)data.data(), data.size());
|
file.write((char*)data.data(), data.size());
|
||||||
};
|
};
|
||||||
|
|
||||||
static void WriteAllText(std::string filePath, std::string text)
|
static void WriteAllText(const std::string& filePath, const std::string& text)
|
||||||
{
|
{
|
||||||
std::ofstream file(filePath, std::ios::out);
|
std::ofstream file(filePath, std::ios::out);
|
||||||
file.write(text.c_str(), text.size());
|
file.write(text.c_str(), text.size());
|
||||||
|
|
|
@ -19,11 +19,11 @@ Globals::Globals()
|
||||||
segmentRefFiles = map<int, ZFile*>();
|
segmentRefFiles = map<int, ZFile*>();
|
||||||
genSourceFile = true;
|
genSourceFile = true;
|
||||||
testMode = false;
|
testMode = false;
|
||||||
debugMessages = false;
|
|
||||||
profile = false;
|
profile = false;
|
||||||
includeFilePrefix = false;
|
includeFilePrefix = false;
|
||||||
useExternalResources = true;
|
useExternalResources = true;
|
||||||
lastScene = nullptr;
|
lastScene = nullptr;
|
||||||
|
verbosity = VERBOSITY_SILENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Globals::FindSymbolSegRef(int segNumber, uint32_t symbolAddress)
|
string Globals::FindSymbolSegRef(int segNumber, uint32_t symbolAddress)
|
||||||
|
@ -64,7 +64,7 @@ string Globals::FindSymbolSegRef(int segNumber, uint32_t symbolAddress)
|
||||||
return "ERROR";
|
return "ERROR";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Globals::ReadConfigFile(string configFilePath)
|
void Globals::ReadConfigFile(const std::string& configFilePath)
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
XMLError eResult = doc.LoadFile(configFilePath.c_str());
|
XMLError eResult = doc.LoadFile(configFilePath.c_str());
|
||||||
|
@ -93,7 +93,7 @@ void Globals::ReadConfigFile(string configFilePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Globals::GenSymbolMap(string symbolMapPath)
|
void Globals::GenSymbolMap(const std::string& symbolMapPath)
|
||||||
{
|
{
|
||||||
auto symbolLines = File::ReadAllLines(symbolMapPath);
|
auto symbolLines = File::ReadAllLines(symbolMapPath);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "ZFile.h"
|
#include "ZFile.h"
|
||||||
#include "ZTexture.h"
|
#include "ZTexture.h"
|
||||||
#include "ZRoom/ZRoom.h"
|
#include "ZRoom/ZRoom.h"
|
||||||
|
|
||||||
|
typedef enum VerbosityLevel {
|
||||||
|
VERBOSITY_SILENT,
|
||||||
|
VERBOSITY_INFO,
|
||||||
|
VERBOSITY_DEBUG
|
||||||
|
} VerbosityLevel;
|
||||||
|
|
||||||
class Globals
|
class Globals
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -14,9 +21,9 @@ public:
|
||||||
bool genSourceFile; // Used for extraction
|
bool genSourceFile; // Used for extraction
|
||||||
bool useExternalResources;
|
bool useExternalResources;
|
||||||
bool testMode; // Enables certain experimental features
|
bool testMode; // Enables certain experimental features
|
||||||
bool debugMessages; // Enables certain printfs
|
|
||||||
bool profile; // Measure performance of certain operations
|
bool profile; // Measure performance of certain operations
|
||||||
bool includeFilePrefix; // Include the file prefix in symbols
|
bool includeFilePrefix; // Include the file prefix in symbols
|
||||||
|
VerbosityLevel verbosity; // ZAPD outputs additional information
|
||||||
ZFileMode fileMode;
|
ZFileMode fileMode;
|
||||||
std::string baseRomPath, inputPath, outputPath, cfgPath;
|
std::string baseRomPath, inputPath, outputPath, cfgPath;
|
||||||
TextureType texType;
|
TextureType texType;
|
||||||
|
@ -30,8 +37,8 @@ public:
|
||||||
|
|
||||||
Globals();
|
Globals();
|
||||||
std::string FindSymbolSegRef(int segNumber, uint32_t symbolAddress);
|
std::string FindSymbolSegRef(int segNumber, uint32_t symbolAddress);
|
||||||
void ReadConfigFile(std::string configFilePath);
|
void ReadConfigFile(const std::string& configFilePath);
|
||||||
void GenSymbolMap(std::string symbolMapPath);
|
void GenSymbolMap(const std::string& symbolMapPath);
|
||||||
void AddSegment(int segment);
|
void AddSegment(int segment);
|
||||||
bool HasSegment(int segment);
|
bool HasSegment(int segment);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "../ZAnimation.h"
|
#include "../ZAnimation.h"
|
||||||
#include "../tinyxml2.h"
|
#include <tinyxml2.h>
|
||||||
#include "HLFileIntermediette.h"
|
#include "HLFileIntermediette.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include "../File.h"
|
#include "../File.h"
|
||||||
|
|
||||||
#ifdef USE_ASSIMP
|
#ifdef USE_ASSIMP
|
||||||
#include "../assimp/Importer.hpp"
|
#include <assimp/Importer.hpp>
|
||||||
#include "../assimp/Exporter.hpp"
|
#include <assimp/Exporter.hpp>
|
||||||
#include "../assimp/scene.h"
|
#include <assimp/scene.h>
|
||||||
#include "../assimp/postprocess.h"
|
#include <assimp/postprocess.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "HLFileIntermediette.h"
|
#include "HLFileIntermediette.h"
|
||||||
#include "../ZDisplayList.h"
|
#include "../ZDisplayList.h"
|
||||||
#include "../ZSkeleton.h"
|
#include "../ZSkeleton.h"
|
||||||
#include "../tinyxml2.h"
|
#include <tinyxml2.h>
|
||||||
#include "../assimp/scene.h"
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An intermediette format for models. Goes from FBX<-->Intermediette<-->Display List C Code.
|
* An intermediette format for models. Goes from FBX<-->Intermediette<-->Display List C Code.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "HLTexture.h"
|
#include "HLTexture.h"
|
||||||
#include "../StringHelper.h"
|
#include "../StringHelper.h"
|
||||||
#include "../stb_image.h"
|
#include <stb_image.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
bool Parse(string xmlFilePath, string basePath, string outPath, ZFileMode fileMode);
|
bool Parse(const std::string& xmlFilePath, const std::string& basePath, const std::string& outPath, ZFileMode fileMode);
|
||||||
|
|
||||||
void BuildAssetTexture(string pngFilePath, TextureType texType, string outPath);
|
void BuildAssetTexture(const std::string& pngFilePath, TextureType texType, const std::string& outPath);
|
||||||
void BuildAssetBlob(string blobFilePath, string outPath);
|
void BuildAssetBlob(const std::string& blobFilePath, const std::string& outPath);
|
||||||
void BuildAssetModelIntermediette(string mdlPath, string outPath);
|
void BuildAssetModelIntermediette(const std::string& mdlPath, const std::string& outPath);
|
||||||
void BuildAssetAnimationIntermediette(string animPath, string outPath);
|
void BuildAssetAnimationIntermediette(const std::string& animPath, const std::string& outPath);
|
||||||
|
|
||||||
int NewMain(int argc, char* argv[]);
|
int NewMain(int argc, char* argv[]);
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ int main(int argc, char* argv[])
|
||||||
int NewMain(int argc, char* argv[])
|
int NewMain(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Syntax: ZAPD.exe [mode (b/btex/bovl/e)] (Arbritrary Number of Arguments)
|
// Syntax: ZAPD.exe [mode (b/btex/bovl/e)] (Arbritrary Number of Arguments)
|
||||||
printf("ZAPD: Zelda Asset Processor For Decomp\n");
|
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
|
@ -130,11 +129,6 @@ int NewMain(int argc, char* argv[])
|
||||||
Globals::Instance->testMode = string(argv[i + 1]) == "1";
|
Globals::Instance->testMode = string(argv[i + 1]) == "1";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else if (arg == "-dm") // Debug Messages
|
|
||||||
{
|
|
||||||
Globals::Instance->debugMessages = string(argv[i + 1]) == "1";
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (arg == "-profile") // Profile
|
else if (arg == "-profile") // Profile
|
||||||
{
|
{
|
||||||
Globals::Instance->profile = string(argv[i + 1]) == "1";
|
Globals::Instance->profile = string(argv[i + 1]) == "1";
|
||||||
|
@ -179,6 +173,15 @@ int NewMain(int argc, char* argv[])
|
||||||
signal(SIGSEGV, ErrorHandler);
|
signal(SIGSEGV, ErrorHandler);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if (arg == "-v") // Verbose
|
||||||
|
{
|
||||||
|
Globals::Instance->verbosity = (VerbosityLevel)strtol(argv[++i], NULL, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_INFO)
|
||||||
|
{
|
||||||
|
printf("ZAPD: Zelda Asset Processor For Decomp\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileMode == ZFileMode::Build || fileMode == ZFileMode::Extract || fileMode == ZFileMode::BuildSourceFile)
|
if (fileMode == ZFileMode::Build || fileMode == ZFileMode::Extract || fileMode == ZFileMode::BuildSourceFile)
|
||||||
|
@ -219,7 +222,7 @@ int NewMain(int argc, char* argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parse(string xmlFilePath, string basePath, string outPath, ZFileMode fileMode)
|
bool Parse(const std::string& xmlFilePath, const std::string& basePath, const std::string& outPath, ZFileMode fileMode)
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
XMLError eResult = doc.LoadFile(xmlFilePath.c_str());
|
XMLError eResult = doc.LoadFile(xmlFilePath.c_str());
|
||||||
|
@ -232,8 +235,6 @@ bool Parse(string xmlFilePath, string basePath, string outPath, ZFileMode fileMo
|
||||||
if (root == nullptr)
|
if (root == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//vector<ZFile*> files = vector<ZFile*>();
|
|
||||||
|
|
||||||
for (XMLElement* child = root->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
|
for (XMLElement* child = root->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
|
||||||
{
|
{
|
||||||
if (string(child->Name()) == "File")
|
if (string(child->Name()) == "File")
|
||||||
|
@ -253,15 +254,16 @@ bool Parse(string xmlFilePath, string basePath, string outPath, ZFileMode fileMo
|
||||||
file->ExtractResources(outPath);
|
file->ExtractResources(outPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLElement* element = root->FirstChildElement("File");
|
// All done, free files
|
||||||
|
for (ZFile* file : Globals::Instance->files)
|
||||||
|
delete file;
|
||||||
|
|
||||||
if (element == nullptr)
|
Globals::Instance->files.clear();
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildAssetTexture(string pngFilePath, TextureType texType, string outPath)
|
void BuildAssetTexture(const std::string& pngFilePath, TextureType texType, const std::string& outPath)
|
||||||
{
|
{
|
||||||
vector<string> split = StringHelper::Split(outPath, "/");
|
vector<string> split = StringHelper::Split(outPath, "/");
|
||||||
string name = StringHelper::Split(split[split.size() - 1], ".")[0];
|
string name = StringHelper::Split(split[split.size() - 1], ".")[0];
|
||||||
|
@ -279,7 +281,7 @@ void BuildAssetTexture(string pngFilePath, TextureType texType, string outPath)
|
||||||
delete tex;
|
delete tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildAssetBlob(string blobFilePath, string outPath)
|
void BuildAssetBlob(const std::string& blobFilePath, const std::string& outPath)
|
||||||
{
|
{
|
||||||
vector<string> split = StringHelper::Split(outPath, "/");
|
vector<string> split = StringHelper::Split(outPath, "/");
|
||||||
ZBlob* blob = ZBlob::FromFile(blobFilePath);
|
ZBlob* blob = ZBlob::FromFile(blobFilePath);
|
||||||
|
@ -293,7 +295,7 @@ void BuildAssetBlob(string blobFilePath, string outPath)
|
||||||
delete blob;
|
delete blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildAssetModelIntermediette(string mdlPath, string outPath)
|
void BuildAssetModelIntermediette(const std::string& mdlPath, const std::string& outPath)
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
XMLError eResult = doc.LoadFile(mdlPath.c_str());
|
XMLError eResult = doc.LoadFile(mdlPath.c_str());
|
||||||
|
@ -307,7 +309,7 @@ void BuildAssetModelIntermediette(string mdlPath, string outPath)
|
||||||
delete mdl;
|
delete mdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildAssetAnimationIntermediette(string animPath, string outPath)
|
void BuildAssetAnimationIntermediette(const std::string& animPath, const std::string& outPath)
|
||||||
{
|
{
|
||||||
vector<string> split = StringHelper::Split(outPath, "/");
|
vector<string> split = StringHelper::Split(outPath, "/");
|
||||||
ZFile* file = new ZFile("", split[split.size() - 2]);
|
ZFile* file = new ZFile("", split[split.size() - 2]);
|
||||||
|
|
|
@ -185,7 +185,7 @@ ZOverlay* ZOverlay::FromBuild(string buildPath, string cfgFolderPath)
|
||||||
return ovl;
|
return ovl;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZOverlay::GetSourceOutputCode(std::string prefix)
|
string ZOverlay::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
string output = "";
|
string output = "";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../ZResource.h"
|
#include "../ZResource.h"
|
||||||
#include "../tinyxml2.h"
|
#include <tinyxml2.h>
|
||||||
#include <elfio/elfio.hpp>
|
#include <elfio/elfio.hpp>
|
||||||
|
|
||||||
enum SectionType
|
enum SectionType
|
||||||
|
@ -55,7 +55,7 @@ public:
|
||||||
ZOverlay(std::string nName);
|
ZOverlay(std::string nName);
|
||||||
~ZOverlay();
|
~ZOverlay();
|
||||||
static ZOverlay* FromBuild(std::string buildPath, std::string cfgFolderPath);
|
static ZOverlay* FromBuild(std::string buildPath, std::string cfgFolderPath);
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<RelocationEntry*> entries;
|
std::vector<RelocationEntry*> entries;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "StringHelper.h"
|
#include "StringHelper.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__clang__)
|
#if __has_include(<filesystem>)
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
#else
|
#else
|
||||||
|
@ -15,18 +15,18 @@ namespace fs = std::experimental::filesystem;
|
||||||
class Path
|
class Path
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::string GetFileNameWithoutExtension(std::string input)
|
static std::string GetFileNameWithoutExtension(const std::string& input)
|
||||||
{
|
{
|
||||||
std::vector<std::string> split = StringHelper::Split(input, "/");
|
std::vector<std::string> split = StringHelper::Split(input, "/");
|
||||||
return split[split.size() - 1].substr(0, input.find_last_of("."));
|
return split[split.size() - 1].substr(0, input.find_last_of("."));
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string GetFileNameExtension(std::string input)
|
static std::string GetFileNameExtension(const std::string& input)
|
||||||
{
|
{
|
||||||
return input.substr(input.find_last_of("."), input.length());
|
return input.substr(input.find_last_of("."), input.length());
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string GetPath(std::string input)
|
static std::string GetPath(const std::string& input)
|
||||||
{
|
{
|
||||||
std::vector<std::string> split = StringHelper::Split(input, "/");
|
std::vector<std::string> split = StringHelper::Split(input, "/");
|
||||||
std::string output = "";
|
std::string output = "";
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string GetDirectoryName(std::string path)
|
static std::string GetDirectoryName(const std::string& path)
|
||||||
{
|
{
|
||||||
return fs::path(path).parent_path().u8string();
|
return fs::path(path).parent_path().u8string();
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <numeric>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
class StringHelper
|
class StringHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::vector<std::string> Split(std::string s, std::string delimiter)
|
static std::vector<std::string> Split(std::string s, const std::string& delimiter)
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string Strip(std::string s, std::string delimiter)
|
static std::string Strip(std::string s, const std::string& delimiter)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
std::string token;
|
std::string token;
|
||||||
|
@ -42,17 +43,17 @@ public:
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool StartsWith(std::string s, std::string input)
|
static bool StartsWith(const std::string& s, const std::string& input)
|
||||||
{
|
{
|
||||||
return s.rfind(input, 0) == 0;
|
return s.rfind(input, 0) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Contains(std::string s, std::string input)
|
static bool Contains(const std::string& s, const std::string& input)
|
||||||
{
|
{
|
||||||
return s.find(input) != std::string::npos;
|
return s.find(input) != std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool EndsWith(std::string s, std::string input)
|
static bool EndsWith(const std::string& s, const std::string& input)
|
||||||
{
|
{
|
||||||
int inputLen = strlen(input.c_str());
|
int inputLen = strlen(input.c_str());
|
||||||
return s.rfind(input) == (s.size() - inputLen);
|
return s.rfind(input) == (s.size() - inputLen);
|
||||||
|
@ -72,4 +73,13 @@ public:
|
||||||
output = buffer;
|
output = buffer;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string Implode(std::vector<std::string>& elements, const char* const separator)
|
||||||
|
{
|
||||||
|
return std::accumulate(std::begin(elements), std::end(elements), std::string(),
|
||||||
|
[separator](std::string& ss, std::string& s)
|
||||||
|
{
|
||||||
|
return ss.empty() ? s : ss + separator + s;
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
|
@ -71,8 +71,8 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<IncludePath>$(ProjectDir)sqlite;$(ProjectDir);$(IncludePath)</IncludePath>
|
<IncludePath>$(SolutionDir)lib\tinyxml2;$(SolutionDir)lib\elfio;$(SolutionDir)lib\assimp\include;$(SolutionDir)lib\stb;$(ProjectDir);$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>$(ProjectDir)Libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)lib\assimp-built;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<IncludePath>$(IncludePath)</IncludePath>
|
<IncludePath>$(IncludePath)</IncludePath>
|
||||||
|
@ -135,13 +135,14 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\lib\tinyxml2\tinyxml2.cpp" />
|
||||||
<ClCompile Include="Globals.cpp" />
|
<ClCompile Include="Globals.cpp" />
|
||||||
<ClCompile Include="HighLevel\HLAnimationIntermediette.cpp" />
|
<ClCompile Include="HighLevel\HLAnimationIntermediette.cpp" />
|
||||||
<ClCompile Include="HighLevel\HLModelIntermediette.cpp" />
|
<ClCompile Include="HighLevel\HLModelIntermediette.cpp" />
|
||||||
<ClCompile Include="HighLevel\HLTexture.cpp" />
|
<ClCompile Include="HighLevel\HLTexture.cpp" />
|
||||||
<ClCompile Include="Main.cpp" />
|
<ClCompile Include="Main.cpp" />
|
||||||
<ClCompile Include="Overlays\ZOverlay.cpp" />
|
<ClCompile Include="Overlays\ZOverlay.cpp" />
|
||||||
<ClCompile Include="tinyxml2.cpp" />
|
<ClCompile Include="ZScalar.cpp" />
|
||||||
<ClCompile Include="ZAnimation.cpp" />
|
<ClCompile Include="ZAnimation.cpp" />
|
||||||
<ClCompile Include="ZBlob.cpp" />
|
<ClCompile Include="ZBlob.cpp" />
|
||||||
<ClCompile Include="ZCollision.cpp" />
|
<ClCompile Include="ZCollision.cpp" />
|
||||||
|
@ -179,22 +180,28 @@
|
||||||
<ClCompile Include="ZRoom\ZRoom.cpp" />
|
<ClCompile Include="ZRoom\ZRoom.cpp" />
|
||||||
<ClCompile Include="ZRoom\ZRoomCommand.cpp" />
|
<ClCompile Include="ZRoom\ZRoomCommand.cpp" />
|
||||||
<ClCompile Include="ZTexture.cpp" />
|
<ClCompile Include="ZTexture.cpp" />
|
||||||
|
<ClCompile Include="ZVector.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_dump.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_dynamic.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_header.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_note.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_relocation.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_section.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_segment.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_strings.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_symbols.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elfio_utils.hpp" />
|
||||||
|
<ClInclude Include="..\lib\elfio\elfio\elf_types.hpp" />
|
||||||
|
<ClInclude Include="..\lib\json\include\nlohmann\json.hpp" />
|
||||||
|
<ClInclude Include="..\lib\stb\stb_image.h" />
|
||||||
|
<ClInclude Include="..\lib\stb\stb_image_write.h" />
|
||||||
|
<ClInclude Include="..\lib\stb\tinyxml2.h" />
|
||||||
|
<ClInclude Include="..\lib\tinygtlf\tiny_gltf.h" />
|
||||||
<ClInclude Include="BitConverter.h" />
|
<ClInclude Include="BitConverter.h" />
|
||||||
<ClInclude Include="Directory.h" />
|
<ClInclude Include="Directory.h" />
|
||||||
<ClInclude Include="elfio\elfio.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_dump.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_dynamic.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_header.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_note.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_relocation.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_section.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_segment.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_strings.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_symbols.hpp" />
|
|
||||||
<ClInclude Include="elfio\elfio_utils.hpp" />
|
|
||||||
<ClInclude Include="elfio\elf_types.hpp" />
|
|
||||||
<ClInclude Include="File.h" />
|
<ClInclude Include="File.h" />
|
||||||
<ClInclude Include="Globals.h" />
|
<ClInclude Include="Globals.h" />
|
||||||
<ClInclude Include="HighLevel\HLAnimation.h" />
|
<ClInclude Include="HighLevel\HLAnimation.h" />
|
||||||
|
@ -202,17 +209,9 @@
|
||||||
<ClInclude Include="HighLevel\HLFileIntermediette.h" />
|
<ClInclude Include="HighLevel\HLFileIntermediette.h" />
|
||||||
<ClInclude Include="HighLevel\HLModelIntermediette.h" />
|
<ClInclude Include="HighLevel\HLModelIntermediette.h" />
|
||||||
<ClInclude Include="HighLevel\HLTexture.h" />
|
<ClInclude Include="HighLevel\HLTexture.h" />
|
||||||
<ClInclude Include="json.hpp" />
|
|
||||||
<ClInclude Include="OpenFBX\miniz.h" />
|
|
||||||
<ClInclude Include="OpenFBX\ofbx.h" />
|
|
||||||
<ClInclude Include="Overlays\ZOverlay.h" />
|
<ClInclude Include="Overlays\ZOverlay.h" />
|
||||||
<ClInclude Include="Path.h" />
|
<ClInclude Include="Path.h" />
|
||||||
<ClInclude Include="sqlite_orm.h" />
|
|
||||||
<ClInclude Include="stb_image.h" />
|
|
||||||
<ClInclude Include="stb_image_write.h" />
|
|
||||||
<ClInclude Include="StringHelper.h" />
|
<ClInclude Include="StringHelper.h" />
|
||||||
<ClInclude Include="tinyxml2.h" />
|
|
||||||
<ClInclude Include="tiny_gltf.h" />
|
|
||||||
<ClInclude Include="Vec3s.h" />
|
<ClInclude Include="Vec3s.h" />
|
||||||
<ClInclude Include="ZAnimation.h" />
|
<ClInclude Include="ZAnimation.h" />
|
||||||
<ClInclude Include="ZBlob.h" />
|
<ClInclude Include="ZBlob.h" />
|
||||||
|
@ -220,6 +219,7 @@
|
||||||
<ClInclude Include="ZCutscene.h" />
|
<ClInclude Include="ZCutscene.h" />
|
||||||
<ClInclude Include="ZDisplayList.h" />
|
<ClInclude Include="ZDisplayList.h" />
|
||||||
<ClInclude Include="ZFile.h" />
|
<ClInclude Include="ZFile.h" />
|
||||||
|
<ClInclude Include="ZScalar.h" />
|
||||||
<ClInclude Include="ZSkeleton.h" />
|
<ClInclude Include="ZSkeleton.h" />
|
||||||
<ClInclude Include="ZResource.h" />
|
<ClInclude Include="ZResource.h" />
|
||||||
<ClInclude Include="ZRoom\ActorList.h" />
|
<ClInclude Include="ZRoom\ActorList.h" />
|
||||||
|
@ -253,6 +253,7 @@
|
||||||
<ClInclude Include="ZRoom\ZRoom.h" />
|
<ClInclude Include="ZRoom\ZRoom.h" />
|
||||||
<ClInclude Include="ZRoom\ZRoomCommand.h" />
|
<ClInclude Include="ZRoom\ZRoomCommand.h" />
|
||||||
<ClInclude Include="ZTexture.h" />
|
<ClInclude Include="ZTexture.h" />
|
||||||
|
<ClInclude Include="ZVector.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="..\SymbolMap_OoTMqDbg.txt">
|
<Text Include="..\SymbolMap_OoTMqDbg.txt">
|
||||||
|
@ -260,7 +261,7 @@
|
||||||
</Text>
|
</Text>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CopyFileToFolders Include="Libs\assimp-vc142-mt.dll">
|
<CopyFileToFolders Include="..\lib\assimp-built\assimp-vc142-mt.dll">
|
||||||
<FileType>Document</FileType>
|
<FileType>Document</FileType>
|
||||||
</CopyFileToFolders>
|
</CopyFileToFolders>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -13,9 +13,6 @@
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\OpenFBX">
|
|
||||||
<UniqueIdentifier>{c5d86b0a-fff0-47cf-83af-807dd8267ad1}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files\Libraries">
|
<Filter Include="Source Files\Libraries">
|
||||||
<UniqueIdentifier>{02148456-5068-4613-8478-f10addc58e70}</UniqueIdentifier>
|
<UniqueIdentifier>{02148456-5068-4613-8478-f10addc58e70}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
@ -144,7 +141,7 @@
|
||||||
<ClCompile Include="ZRoom\Commands\SetCutscenes.cpp">
|
<ClCompile Include="ZRoom\Commands\SetCutscenes.cpp">
|
||||||
<Filter>Source Files\Z64\ZRoom\Commands</Filter>
|
<Filter>Source Files\Z64\ZRoom\Commands</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="tinyxml2.cpp">
|
<ClCompile Include="..\lib\tinyxml2\tinyxml2.cpp">
|
||||||
<Filter>Source Files\Libraries</Filter>
|
<Filter>Source Files\Libraries</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ZAnimation.cpp">
|
<ClCompile Include="ZAnimation.cpp">
|
||||||
|
@ -192,6 +189,12 @@
|
||||||
<ClCompile Include="ZCollision.cpp">
|
<ClCompile Include="ZCollision.cpp">
|
||||||
<Filter>Source Files\Z64</Filter>
|
<Filter>Source Files\Z64</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="ZScalar.cpp">
|
||||||
|
<Filter>Source Files\Z64</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ZVector.cpp">
|
||||||
|
<Filter>Source Files\Z64</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Path.h">
|
<ClInclude Include="Path.h">
|
||||||
|
@ -248,40 +251,40 @@
|
||||||
<ClInclude Include="ZRoom\Commands\SetStartPositionList.h">
|
<ClInclude Include="ZRoom\Commands\SetStartPositionList.h">
|
||||||
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
|
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elf_types.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elf_types.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_dump.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_dump.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_dynamic.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_dynamic.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_header.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_header.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_note.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_note.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_relocation.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_relocation.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_section.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_section.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_segment.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_segment.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_strings.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_strings.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_symbols.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_symbols.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="elfio\elfio_utils.hpp">
|
<ClInclude Include="..\lib\elfio\elfio\elfio_utils.hpp">
|
||||||
<Filter>Header Files\Libraries\elfio</Filter>
|
<Filter>Header Files\Libraries\elfio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="StringHelper.h">
|
<ClInclude Include="StringHelper.h">
|
||||||
|
@ -335,25 +338,16 @@
|
||||||
<ClInclude Include="Vec3s.h">
|
<ClInclude Include="Vec3s.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="OpenFBX\ofbx.h">
|
<ClInclude Include="..\lib\json\include\nlohmann\json.hpp">
|
||||||
<Filter>Header Files\OpenFBX</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="OpenFBX\miniz.h">
|
|
||||||
<Filter>Header Files\OpenFBX</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="json.hpp">
|
|
||||||
<Filter>Header Files\Libraries</Filter>
|
<Filter>Header Files\Libraries</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="stb_image.h">
|
<ClInclude Include="..\lib\stb\stb_image.h">
|
||||||
<Filter>Header Files\Libraries</Filter>
|
<Filter>Header Files\Libraries</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="stb_image_write.h">
|
<ClInclude Include="..\lib\stb\stb_image_write.h">
|
||||||
<Filter>Header Files\Libraries</Filter>
|
<Filter>Header Files\Libraries</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="tiny_gltf.h">
|
<ClInclude Include="..\lib\tinygtlf\tiny_gltf.h">
|
||||||
<Filter>Header Files\Libraries</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="tinyxml2.h">
|
|
||||||
<Filter>Header Files\Libraries</Filter>
|
<Filter>Header Files\Libraries</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Overlays\ZOverlay.h">
|
<ClInclude Include="Overlays\ZOverlay.h">
|
||||||
|
@ -404,12 +398,18 @@
|
||||||
<ClInclude Include="ZRoom\Commands\ZRoomCommandUnk.h">
|
<ClInclude Include="ZRoom\Commands\ZRoomCommandUnk.h">
|
||||||
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
|
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="sqlite_orm.h">
|
|
||||||
<Filter>Header Files\Libraries</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="ZCollision.h">
|
<ClInclude Include="ZCollision.h">
|
||||||
<Filter>Header Files\Z64</Filter>
|
<Filter>Header Files\Z64</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="ZScalar.h">
|
||||||
|
<Filter>Header Files\Z64</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ZVector.h">
|
||||||
|
<Filter>Header Files\Z64</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\lib\stb\tinyxml2.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="..\SymbolMap_OoTMqDbg.txt">
|
<Text Include="..\SymbolMap_OoTMqDbg.txt">
|
||||||
|
@ -417,7 +417,7 @@
|
||||||
</Text>
|
</Text>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CopyFileToFolders Include="Libs\assimp-vc142-mt.dll">
|
<CopyFileToFolders Include="..\lib\assimp-built\assimp-vc142-mt.dll">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</CopyFileToFolders>
|
</CopyFileToFolders>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "ZAnimation.h"
|
#include "ZAnimation.h"
|
||||||
|
#include <utility>
|
||||||
#include "ZFile.h"
|
#include "ZFile.h"
|
||||||
#include "BitConverter.h"
|
#include "BitConverter.h"
|
||||||
#include "StringHelper.h"
|
#include "StringHelper.h"
|
||||||
|
@ -15,13 +16,13 @@ ZAnimation::ZAnimation() : ZResource()
|
||||||
|
|
||||||
void ZAnimation::ParseRawData()
|
void ZAnimation::ParseRawData()
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
// Read the header
|
// Read the header
|
||||||
frameCount = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
frameCount = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZAnimation::Save(string outFolder)
|
void ZAnimation::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
if (Globals::Instance->testMode)
|
if (Globals::Instance->testMode)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +41,7 @@ void ZAnimation::ParseXML(tinyxml2::XMLElement* reader)
|
||||||
name = reader->Attribute("Name");
|
name = reader->Attribute("Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZAnimation::GetSourceOutputCode(string prefix)
|
string ZAnimation::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -52,7 +53,7 @@ ZNormalAnimation::ZNormalAnimation() : ZAnimation()
|
||||||
limit = 0;
|
limit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZNormalAnimation::GetSourceOutputCode(std::string prefix)
|
std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ std::string ZNormalAnimation::GetSourceOutputCode(std::string prefix)
|
||||||
|
|
||||||
string headerStr = StringHelper::Sprintf("{ %i }, %sFrameData, %sJointIndices, %i",
|
string headerStr = StringHelper::Sprintf("{ %i }, %sFrameData, %sJointIndices, %i",
|
||||||
frameCount, defaultPrefix.c_str(), defaultPrefix.c_str(), limit);
|
frameCount, defaultPrefix.c_str(), defaultPrefix.c_str(), limit);
|
||||||
parent->declarations[rawDataIndex] = new Declaration(DeclarationAlignment::None, 16, "AnimationHeader", StringHelper::Sprintf("%s", name.c_str()), false, headerStr);
|
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, 16, "AnimationHeader", StringHelper::Sprintf("%s", name.c_str()), headerStr);
|
||||||
|
|
||||||
string indicesStr = "";
|
string indicesStr = "";
|
||||||
string valuesStr = " ";
|
string valuesStr = " ";
|
||||||
|
@ -99,10 +100,10 @@ int ZNormalAnimation::GetRawDataSize()
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZNormalAnimation* ZNormalAnimation::ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath)
|
ZNormalAnimation* ZNormalAnimation::ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, const std::string& nRelPath)
|
||||||
{
|
{
|
||||||
ZNormalAnimation* anim = new ZNormalAnimation();
|
ZNormalAnimation* anim = new ZNormalAnimation();
|
||||||
anim->rawData = nRawData;
|
anim->rawData = std::move(nRawData);
|
||||||
anim->rawDataIndex = rawDataIndex;
|
anim->rawDataIndex = rawDataIndex;
|
||||||
anim->ParseXML(reader);
|
anim->ParseXML(reader);
|
||||||
anim->ParseRawData();
|
anim->ParseRawData();
|
||||||
|
@ -114,7 +115,7 @@ void ZNormalAnimation::ParseRawData()
|
||||||
{
|
{
|
||||||
ZAnimation::ParseRawData();
|
ZAnimation::ParseRawData();
|
||||||
|
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
rotationValuesSeg = BitConverter::ToInt32BE(data, rawDataIndex + 4) & 0x00FFFFFF;
|
rotationValuesSeg = BitConverter::ToInt32BE(data, rawDataIndex + 4) & 0x00FFFFFF;
|
||||||
rotationIndicesSeg = BitConverter::ToInt32BE(data, rawDataIndex + 8) & 0x00FFFFFF;
|
rotationIndicesSeg = BitConverter::ToInt32BE(data, rawDataIndex + 8) & 0x00FFFFFF;
|
||||||
|
@ -144,14 +145,14 @@ ZLinkAnimation::ZLinkAnimation() : ZAnimation()
|
||||||
segmentAddress = 0;
|
segmentAddress = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZLinkAnimation::GetSourceOutputCode(std::string prefix)
|
std::string ZLinkAnimation::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
{
|
{
|
||||||
string segSymbol = segmentAddress == 0 ? "NULL" : parent->GetDeclarationName(segmentAddress, StringHelper::Sprintf("%sSeg%06X", name.c_str(), segmentAddress));
|
string segSymbol = segmentAddress == 0 ? "NULL" : parent->GetDeclarationName(segmentAddress, StringHelper::Sprintf("%sSeg%06X", name.c_str(), segmentAddress));
|
||||||
string headerStr = StringHelper::Sprintf("{ %i }, 0x%08X",
|
string headerStr = StringHelper::Sprintf("{ %i }, 0x%08X",
|
||||||
frameCount, segmentAddress);
|
frameCount, segmentAddress);
|
||||||
parent->declarations[rawDataIndex] = new Declaration(DeclarationAlignment::None, 16, "LinkAnimationHeader", StringHelper::Sprintf("%s", name.c_str()), false, headerStr);
|
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, 16, "LinkAnimationHeader", StringHelper::Sprintf("%s", name.c_str()), headerStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -162,10 +163,10 @@ int ZLinkAnimation::GetRawDataSize()
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZLinkAnimation* ZLinkAnimation::ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath)
|
ZLinkAnimation* ZLinkAnimation::ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, const std::string& nRelPath)
|
||||||
{
|
{
|
||||||
ZLinkAnimation* anim = new ZLinkAnimation();
|
ZLinkAnimation* anim = new ZLinkAnimation();
|
||||||
anim->rawData = nRawData;
|
anim->rawData = std::move(nRawData);
|
||||||
anim->rawDataIndex = rawDataIndex;
|
anim->rawDataIndex = rawDataIndex;
|
||||||
anim->ParseXML(reader);
|
anim->ParseXML(reader);
|
||||||
anim->ParseRawData();
|
anim->ParseRawData();
|
||||||
|
@ -177,7 +178,7 @@ void ZLinkAnimation::ParseRawData()
|
||||||
{
|
{
|
||||||
ZAnimation::ParseRawData();
|
ZAnimation::ParseRawData();
|
||||||
|
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
//segmentAddress = SEG2FILESPACE(BitConverter::ToInt32BE(data, rawDataIndex + 4));
|
//segmentAddress = SEG2FILESPACE(BitConverter::ToInt32BE(data, rawDataIndex + 4));
|
||||||
segmentAddress = (BitConverter::ToInt32BE(data, rawDataIndex + 4));
|
segmentAddress = (BitConverter::ToInt32BE(data, rawDataIndex + 4));
|
||||||
|
|
|
@ -23,11 +23,11 @@ public:
|
||||||
|
|
||||||
ZAnimation();
|
ZAnimation();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void ParseRawData();
|
virtual void ParseRawData();
|
||||||
void Save(std::string outFolder);
|
void Save(const std::string& outFolder);
|
||||||
void ParseXML(tinyxml2::XMLElement* reader);
|
void ParseXML(tinyxml2::XMLElement* reader);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@ public:
|
||||||
|
|
||||||
ZNormalAnimation();
|
ZNormalAnimation();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
virtual int GetRawDataSize();
|
virtual int GetRawDataSize();
|
||||||
|
|
||||||
static ZNormalAnimation* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath);
|
static ZNormalAnimation* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, const std::string& nRelPath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ParseRawData();
|
virtual void ParseRawData();
|
||||||
|
@ -58,10 +58,10 @@ public:
|
||||||
|
|
||||||
ZLinkAnimation();
|
ZLinkAnimation();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
virtual int GetRawDataSize();
|
virtual int GetRawDataSize();
|
||||||
|
|
||||||
static ZLinkAnimation* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath);
|
static ZLinkAnimation* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, const std::string& nRelPath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ParseRawData();
|
virtual void ParseRawData();
|
||||||
|
|
|
@ -13,14 +13,14 @@ ZBlob::ZBlob() : ZResource()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZBlob::ZBlob(std::vector<uint8_t> nRawData, int nRawDataIndex, int size, std::string nName) : ZBlob()
|
ZBlob::ZBlob(const std::vector<uint8_t>& nRawData, int nRawDataIndex, int size, std::string nName) : ZBlob()
|
||||||
{
|
{
|
||||||
rawDataIndex = nRawDataIndex;
|
rawDataIndex = nRawDataIndex;
|
||||||
rawData = vector<uint8_t>(nRawData.data() + rawDataIndex, nRawData.data() + rawDataIndex + size);
|
rawData = vector<uint8_t>(nRawData.data() + rawDataIndex, nRawData.data() + rawDataIndex + size);
|
||||||
name = nName;
|
name = std::move(nName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZBlob* ZBlob::ExtractFromXML(XMLElement* reader, vector<uint8_t> nRawData, int nRawDataIndex, string nRelPath)
|
ZBlob* ZBlob::ExtractFromXML(XMLElement* reader, const vector<uint8_t>& nRawData, int nRawDataIndex, string nRelPath)
|
||||||
{
|
{
|
||||||
ZBlob* blob = new ZBlob();
|
ZBlob* blob = new ZBlob();
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ ZBlob* ZBlob::ExtractFromXML(XMLElement* reader, vector<uint8_t> nRawData, int n
|
||||||
blob->ParseXML(reader);
|
blob->ParseXML(reader);
|
||||||
int size = strtol(reader->Attribute("Size"), NULL, 16);
|
int size = strtol(reader->Attribute("Size"), NULL, 16);
|
||||||
blob->rawData = vector<uint8_t>(nRawData.data() + blob->rawDataIndex, nRawData.data() + blob->rawDataIndex + size);
|
blob->rawData = vector<uint8_t>(nRawData.data() + blob->rawDataIndex, nRawData.data() + blob->rawDataIndex + size);
|
||||||
blob->relativePath = nRelPath;
|
blob->relativePath = std::move(nRelPath);
|
||||||
|
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZBlob* ZBlob::BuildFromXML(XMLElement* reader, string inFolder, bool readFile)
|
ZBlob* ZBlob::BuildFromXML(XMLElement* reader, const std::string& inFolder, bool readFile)
|
||||||
{
|
{
|
||||||
ZBlob* blob = new ZBlob();
|
ZBlob* blob = new ZBlob();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ ZBlob* ZBlob::BuildFromXML(XMLElement* reader, string inFolder, bool readFile)
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZBlob* ZBlob::FromFile(string filePath)
|
ZBlob* ZBlob::FromFile(const std::string& filePath)
|
||||||
{
|
{
|
||||||
int comp;
|
int comp;
|
||||||
ZBlob* blob = new ZBlob();
|
ZBlob* blob = new ZBlob();
|
||||||
|
@ -56,7 +56,7 @@ ZBlob* ZBlob::FromFile(string filePath)
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZBlob::GetSourceOutputCode(std::string prefix)
|
string ZBlob::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
sourceOutput = "";
|
sourceOutput = "";
|
||||||
//sourceOutput += StringHelper::Sprintf("u8 %s_%s[] = \n{\n", prefix.c_str(), name.c_str());
|
//sourceOutput += StringHelper::Sprintf("u8 %s_%s[] = \n{\n", prefix.c_str(), name.c_str());
|
||||||
|
@ -77,12 +77,12 @@ string ZBlob::GetSourceOutputCode(std::string prefix)
|
||||||
return sourceOutput;
|
return sourceOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZBlob::GetSourceOutputHeader(std::string prefix)
|
string ZBlob::GetSourceOutputHeader(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return StringHelper::Sprintf("extern u8 %s[];\n", name.c_str());
|
return StringHelper::Sprintf("extern u8 %s[];\n", name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZBlob::Save(string outFolder)
|
void ZBlob::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
//printf("NAME = %s\n", name.c_str());
|
//printf("NAME = %s\n", name.c_str());
|
||||||
File::WriteAllBytes(outFolder + "/" + name + ".bin", rawData);
|
File::WriteAllBytes(outFolder + "/" + name + ".bin", rawData);
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
class ZBlob : public ZResource
|
class ZBlob : public ZResource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ZBlob(std::vector<uint8_t> nRawData, int rawDataIndex, int size, std::string nName);
|
ZBlob(const std::vector<uint8_t>& nRawData, int rawDataIndex, int size, std::string nName);
|
||||||
|
|
||||||
static ZBlob* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath);
|
static ZBlob* ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData, int rawDataIndex, std::string nRelPath);
|
||||||
static ZBlob* BuildFromXML(tinyxml2::XMLElement* reader, std::string inFolder, bool readFile);
|
static ZBlob* BuildFromXML(tinyxml2::XMLElement* reader, const std::string& inFolder, bool readFile);
|
||||||
static ZBlob* FromFile(std::string filePath);
|
static ZBlob* FromFile(const std::string& filePath);
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
std::string GetSourceOutputHeader(std::string prefix);
|
std::string GetSourceOutputHeader(const std::string& prefix);
|
||||||
void Save(std::string outFolder);
|
void Save(const std::string& outFolder);
|
||||||
bool IsExternalResource();
|
bool IsExternalResource();
|
||||||
std::string GetExternalExtension();
|
std::string GetExternalExtension();
|
||||||
ZResourceType GetResourceType();
|
ZResourceType GetResourceType();
|
||||||
|
|
|
@ -11,9 +11,9 @@ ZCollisionHeader::ZCollisionHeader()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vector<uint8_t> rawData, int rawDataIndex)
|
ZCollisionHeader::ZCollisionHeader(ZFile* parent, const std::string& prefix, const std::vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
absMinX = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
absMinX = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
absMinY = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
absMinY = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
@ -53,14 +53,14 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vecto
|
||||||
//if (highestPolyType > 0)
|
//if (highestPolyType > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < highestPolyType + 1; i++)
|
for (int i = 0; i < highestPolyType + 1; i++)
|
||||||
polygonTypes.push_back(BitConverter::ToInt64BE(data, polyTypeDefSegmentOffset + (i * 8)));
|
polygonTypes.push_back(BitConverter::ToUInt64BE(data, polyTypeDefSegmentOffset + (i * 8)));
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
//int polyTypesSize = abs(polyTypeDefSegmentOffset - camDataSegmentOffset) / 8;
|
//int polyTypesSize = abs(polyTypeDefSegmentOffset - camDataSegmentOffset) / 8;
|
||||||
|
|
||||||
//for (int i = 0; i < polyTypesSize; i++)
|
//for (int i = 0; i < polyTypesSize; i++)
|
||||||
//polygonTypes.push_back(BitConverter::ToInt64BE(data, polyTypeDefSegmentOffset + (i * 8)));
|
//polygonTypes.push_back(BitConverter::ToUInt64BE(data, polyTypeDefSegmentOffset + (i * 8)));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (camDataSegmentOffset != 0)
|
if (camDataSegmentOffset != 0)
|
||||||
|
@ -82,8 +82,8 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vecto
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waterBoxSegmentOffset != 0)
|
if (waterBoxSegmentOffset != 0)
|
||||||
parent->declarations[waterBoxSegmentOffset] = new Declaration(DeclarationAlignment::None, 16 * waterBoxes.size(), "WaterBox",
|
parent->AddDeclarationArray(waterBoxSegmentOffset, DeclarationAlignment::None, 16 * waterBoxes.size(), "WaterBox",
|
||||||
StringHelper::Sprintf("%s_waterBoxes_%08X", prefix.c_str(), waterBoxSegmentOffset), true, declaration);
|
StringHelper::Sprintf("%s_waterBoxes_%08X", prefix.c_str(), waterBoxSegmentOffset), 0, declaration);
|
||||||
|
|
||||||
if (polygons.size() > 0)
|
if (polygons.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -98,8 +98,7 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vecto
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polySegmentOffset != 0) {
|
if (polySegmentOffset != 0) {
|
||||||
parent->declarations[polySegmentOffset] = new Declaration(DeclarationAlignment::None, polygons.size() * 16, "RoomPoly", // TODO: Change this to CollisionPoly once the struct has been updated
|
parent->AddDeclarationArray(polySegmentOffset, DeclarationAlignment::None, polygons.size() * 16, "CollisionPoly", StringHelper::Sprintf("%s_polygons_%08X", prefix.c_str(), polySegmentOffset), 0, declaration);
|
||||||
StringHelper::Sprintf("%s_polygons_%08X", prefix.c_str(), polySegmentOffset), true, declaration);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +110,8 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vecto
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polyTypeDefSegmentOffset != 0)
|
if (polyTypeDefSegmentOffset != 0)
|
||||||
parent->declarations[polyTypeDefSegmentOffset] = new Declaration(DeclarationAlignment::None, polygonTypes.size() * 8,
|
parent->AddDeclarationArray(polyTypeDefSegmentOffset, DeclarationAlignment::None, polygonTypes.size() * 8,
|
||||||
"u32", StringHelper::Sprintf("%s_polygonTypes_%08X", prefix.c_str(), polyTypeDefSegmentOffset), true, declaration);
|
"u32", StringHelper::Sprintf("%s_polygonTypes_%08X", prefix.c_str(), polyTypeDefSegmentOffset), 0, declaration);
|
||||||
|
|
||||||
declaration = "";
|
declaration = "";
|
||||||
|
|
||||||
|
@ -128,8 +127,8 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vecto
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vtxSegmentOffset != 0)
|
if (vtxSegmentOffset != 0)
|
||||||
parent->declarations[vtxSegmentOffset] = new Declaration(DeclarationAlignment::None, vertices.size() * 6,
|
parent->AddDeclarationArray(vtxSegmentOffset, DeclarationAlignment::None, vertices.size() * 6,
|
||||||
"Vec3s", StringHelper::Sprintf("%s_vtx_%08X", prefix.c_str(), vtxSegmentOffset), true, declaration);
|
"Vec3s", StringHelper::Sprintf("%s_vtx_%08X", prefix.c_str(), vtxSegmentOffset), 0, declaration);
|
||||||
|
|
||||||
declaration = "";
|
declaration = "";
|
||||||
}
|
}
|
||||||
|
@ -149,14 +148,22 @@ ZCollisionHeader::ZCollisionHeader(ZFile* parent, std::string prefix, std::vecto
|
||||||
prefix.c_str(), polySegmentOffset, prefix.c_str(), polyTypeDefSegmentOffset,
|
prefix.c_str(), polySegmentOffset, prefix.c_str(), polyTypeDefSegmentOffset,
|
||||||
prefix.c_str(), camDataSegmentOffset, numWaterBoxes, waterBoxStr);
|
prefix.c_str(), camDataSegmentOffset, numWaterBoxes, waterBoxStr);
|
||||||
|
|
||||||
|
|
||||||
/*parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, DeclarationPadding::Pad16, 44, "CollisionHeader",
|
|
||||||
StringHelper::Sprintf("%s_collisionHeader_%08X", prefix.c_str(), rawDataIndex), declaration);*/
|
|
||||||
|
|
||||||
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, DeclarationPadding::Pad16, 44, "CollisionHeader",
|
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, DeclarationPadding::Pad16, 44, "CollisionHeader",
|
||||||
StringHelper::Sprintf("%s", prefix.c_str(), rawDataIndex), declaration);
|
StringHelper::Sprintf("%s", prefix.c_str(), rawDataIndex), declaration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZCollisionHeader::~ZCollisionHeader()
|
||||||
|
{
|
||||||
|
for (VertexEntry* vtx : vertices)
|
||||||
|
delete vtx;
|
||||||
|
|
||||||
|
for (PolygonEntry* poly : polygons)
|
||||||
|
delete poly;
|
||||||
|
|
||||||
|
for (WaterBoxHeader* waterBox : waterBoxes)
|
||||||
|
delete waterBox;
|
||||||
|
}
|
||||||
|
|
||||||
ZCollisionHeader* ZCollisionHeader::ExtractFromXML(tinyxml2::XMLElement* reader, vector<uint8_t> nRawData, int rawDataIndex)
|
ZCollisionHeader* ZCollisionHeader::ExtractFromXML(tinyxml2::XMLElement* reader, vector<uint8_t> nRawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
ZCollisionHeader* col = new ZCollisionHeader();
|
ZCollisionHeader* col = new ZCollisionHeader();
|
||||||
|
@ -166,9 +173,9 @@ ZCollisionHeader* ZCollisionHeader::ExtractFromXML(tinyxml2::XMLElement* reader,
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
PolygonEntry::PolygonEntry(std::vector<uint8_t> rawData, int rawDataIndex)
|
PolygonEntry::PolygonEntry(const std::vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
type = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
type = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
vtxA = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
vtxA = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
@ -180,18 +187,18 @@ PolygonEntry::PolygonEntry(std::vector<uint8_t> rawData, int rawDataIndex)
|
||||||
d = BitConverter::ToInt16BE(data, rawDataIndex + 14);
|
d = BitConverter::ToInt16BE(data, rawDataIndex + 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexEntry::VertexEntry(std::vector<uint8_t> rawData, int rawDataIndex)
|
VertexEntry::VertexEntry(const std::vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
x = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
x = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
y = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
y = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
z = BitConverter::ToInt16BE(data, rawDataIndex + 4);
|
z = BitConverter::ToInt16BE(data, rawDataIndex + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
WaterBoxHeader::WaterBoxHeader(std::vector<uint8_t> rawData, int rawDataIndex)
|
WaterBoxHeader::WaterBoxHeader(const std::vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
xMin = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
xMin = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
ySurface = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
ySurface = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
@ -201,7 +208,7 @@ WaterBoxHeader::WaterBoxHeader(std::vector<uint8_t> rawData, int rawDataIndex)
|
||||||
properties = BitConverter::ToInt32BE(data, rawDataIndex + 12);
|
properties = BitConverter::ToInt32BE(data, rawDataIndex + 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraDataList::CameraDataList(ZFile* parent, std::string prefix, std::vector<uint8_t> rawData, int rawDataIndex, int polyTypeDefSegmentOffset, int polygonTypesCnt)
|
CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, const std::vector<uint8_t>& rawData, int rawDataIndex, int polyTypeDefSegmentOffset, int polygonTypesCnt)
|
||||||
{
|
{
|
||||||
string declaration = "";
|
string declaration = "";
|
||||||
|
|
||||||
|
@ -267,7 +274,7 @@ CameraDataList::CameraDataList(ZFile* parent, std::string prefix, std::vector<ui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraPositionData::CameraPositionData(std::vector<uint8_t> rawData, int rawDataIndex)
|
CameraPositionData::CameraPositionData(const std::vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
y = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
y = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
|
|
@ -11,7 +11,7 @@ public:
|
||||||
int16_t vtxA, vtxB, vtxC;
|
int16_t vtxA, vtxB, vtxC;
|
||||||
int16_t a, b, c, d;
|
int16_t a, b, c, d;
|
||||||
|
|
||||||
PolygonEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
PolygonEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class VertexEntry
|
class VertexEntry
|
||||||
|
@ -19,7 +19,7 @@ class VertexEntry
|
||||||
public:
|
public:
|
||||||
int16_t x, y, z;
|
int16_t x, y, z;
|
||||||
|
|
||||||
VertexEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
VertexEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaterBoxHeader
|
class WaterBoxHeader
|
||||||
|
@ -33,7 +33,7 @@ public:
|
||||||
int16_t pad;
|
int16_t pad;
|
||||||
int32_t properties;
|
int32_t properties;
|
||||||
|
|
||||||
WaterBoxHeader(std::vector<uint8_t> rawData, int rawDataIndex);
|
WaterBoxHeader(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CameraPositionData
|
class CameraPositionData
|
||||||
|
@ -41,7 +41,7 @@ class CameraPositionData
|
||||||
public:
|
public:
|
||||||
int16_t x, y, z;
|
int16_t x, y, z;
|
||||||
|
|
||||||
CameraPositionData(std::vector<uint8_t> rawData, int rawDataIndex);
|
CameraPositionData(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CameraDataEntry
|
class CameraDataEntry
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
std::vector<CameraDataEntry*> entries;
|
std::vector<CameraDataEntry*> entries;
|
||||||
std::vector<CameraPositionData*> cameraPositionData;
|
std::vector<CameraPositionData*> cameraPositionData;
|
||||||
|
|
||||||
CameraDataList(ZFile* parent, std::string prefix, std::vector<uint8_t> rawData, int rawDataIndex, int polyTypeDefSegmentOffset, int polygonTypesCnt);
|
CameraDataList(ZFile* parent, const std::string& prefix, const std::vector<uint8_t>& rawData, int rawDataIndex, int polyTypeDefSegmentOffset, int polygonTypesCnt);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ZCollisionHeader : public ZResource
|
class ZCollisionHeader : public ZResource
|
||||||
|
@ -84,7 +84,8 @@ public:
|
||||||
|
|
||||||
ZCollisionHeader();
|
ZCollisionHeader();
|
||||||
//ZCollisionHeader(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
//ZCollisionHeader(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
ZCollisionHeader(ZFile* parent, std::string prefix, std::vector<uint8_t> rawData, int rawDataIndex);
|
ZCollisionHeader(ZFile* parent, const std::string& prefix, const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
|
~ZCollisionHeader();
|
||||||
|
|
||||||
static ZCollisionHeader* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex);
|
static ZCollisionHeader* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex);
|
||||||
};
|
};
|
|
@ -6,7 +6,7 @@ using namespace std;
|
||||||
|
|
||||||
ZCutscene::ZCutscene(std::vector<uint8_t> nRawData, int rawDataIndex, int rawDataSize)
|
ZCutscene::ZCutscene(std::vector<uint8_t> nRawData, int rawDataIndex, int rawDataSize)
|
||||||
{
|
{
|
||||||
rawData = nRawData;
|
rawData = std::move(nRawData);
|
||||||
segmentOffset = rawDataIndex;
|
segmentOffset = rawDataIndex;
|
||||||
|
|
||||||
numCommands = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
numCommands = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
|
@ -78,7 +78,13 @@ ZCutscene::ZCutscene(std::vector<uint8_t> nRawData, int rawDataIndex, int rawDat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZCutscene::GetSourceOutputCode(string prefix)
|
ZCutscene::~ZCutscene()
|
||||||
|
{
|
||||||
|
for (CutsceneCommand* cmd : commands)
|
||||||
|
delete cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ZCutscene::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
string output = "";
|
string output = "";
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -160,17 +166,17 @@ CutsceneCommands ZCutscene::GetCommandFromID(int id)
|
||||||
return CutsceneCommands::Error;
|
return CutsceneCommands::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommand::CutsceneCommand(vector<uint8_t> rawData, int rawDataIndex)
|
CutsceneCommand::CutsceneCommand(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommand::GetCName(string prefix)
|
string CutsceneCommand::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "SCmdCutsceneData";
|
return "SCmdCutsceneData";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommand::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommand::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
return StringHelper::Sprintf("%s %sCutsceneData%04XCmd%02X = { 0x%02X,", GetCName(roomName).c_str(), roomName.c_str(), baseAddress, commandIndex, commandID);
|
return StringHelper::Sprintf("%s %sCutsceneData%04XCmd%02X = { 0x%02X,", GetCName(roomName).c_str(), roomName.c_str(), baseAddress, commandIndex, commandID);
|
||||||
}
|
}
|
||||||
|
@ -180,9 +186,9 @@ size_t CutsceneCommand::GetCommandSize()
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCameraPoint::CutsceneCameraPoint(vector<uint8_t> rawData, int rawDataIndex)
|
CutsceneCameraPoint::CutsceneCameraPoint(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
continueFlag = data[rawDataIndex + 0];
|
continueFlag = data[rawDataIndex + 0];
|
||||||
cameraRoll = data[rawDataIndex + 1];
|
cameraRoll = data[rawDataIndex + 1];
|
||||||
|
@ -196,9 +202,9 @@ CutsceneCameraPoint::CutsceneCameraPoint(vector<uint8_t> rawData, int rawDataInd
|
||||||
unused = BitConverter::ToInt16BE(data, rawDataIndex + 14);
|
unused = BitConverter::ToInt16BE(data, rawDataIndex + 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandSetCameraPos::CutsceneCommandSetCameraPos(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandSetCameraPos::CutsceneCommandSetCameraPos(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
@ -224,12 +230,12 @@ CutsceneCommandSetCameraPos::CutsceneCommandSetCameraPos(vector<uint8_t> rawData
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
string CutsceneCommandSetCameraPos::GetCName(string prefix)
|
string CutsceneCommandSetCameraPos::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandSetCameraPos::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandSetCameraPos::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -273,7 +279,7 @@ size_t CutsceneCommandSetCameraPos::GetCommandSize()
|
||||||
return 8 + (entries.size() * 16);
|
return 8 + (entries.size() * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicFadeEntry::MusicFadeEntry(vector<uint8_t> rawData, int rawDataIndex)
|
MusicFadeEntry::MusicFadeEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
@ -291,7 +297,7 @@ MusicFadeEntry::MusicFadeEntry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
unknown10 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 44);
|
unknown10 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 44);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandFadeBGM::CutsceneCommandFadeBGM(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandFadeBGM::CutsceneCommandFadeBGM(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
|
|
||||||
|
@ -304,12 +310,12 @@ CutsceneCommandFadeBGM::CutsceneCommandFadeBGM(vector<uint8_t> rawData, int rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandFadeBGM::GetCName(string prefix)
|
string CutsceneCommandFadeBGM::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdMusicFade";
|
return "CsCmdMusicFade";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandFadeBGM::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandFadeBGM::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -330,7 +336,7 @@ size_t CutsceneCommandFadeBGM::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + 0x30;
|
return CutsceneCommand::GetCommandSize() + 0x30;
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicChangeEntry::MusicChangeEntry(vector<uint8_t> rawData, int rawDataIndex)
|
MusicChangeEntry::MusicChangeEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
sequence = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
sequence = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
@ -345,7 +351,7 @@ MusicChangeEntry::MusicChangeEntry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
unknown7 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 32);
|
unknown7 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandPlayBGM::CutsceneCommandPlayBGM(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandPlayBGM::CutsceneCommandPlayBGM(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
|
|
||||||
|
@ -358,7 +364,7 @@ CutsceneCommandPlayBGM::CutsceneCommandPlayBGM(vector<uint8_t> rawData, int rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandPlayBGM::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandPlayBGM::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -374,7 +380,7 @@ string CutsceneCommandPlayBGM::GenerateSourceCode(string roomName, int baseAddre
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandPlayBGM::GetCName(string prefix)
|
string CutsceneCommandPlayBGM::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdMusicChange";
|
return "CsCmdMusicChange";
|
||||||
}
|
}
|
||||||
|
@ -384,7 +390,7 @@ size_t CutsceneCommandPlayBGM::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + 0x30;
|
return CutsceneCommand::GetCommandSize() + 0x30;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandStopBGM::CutsceneCommandStopBGM(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandStopBGM::CutsceneCommandStopBGM(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
|
|
||||||
|
@ -397,7 +403,7 @@ CutsceneCommandStopBGM::CutsceneCommandStopBGM(vector<uint8_t> rawData, int rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandStopBGM::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandStopBGM::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -413,7 +419,7 @@ string CutsceneCommandStopBGM::GenerateSourceCode(string roomName, int baseAddre
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandStopBGM::GetCName(string prefix)
|
string CutsceneCommandStopBGM::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdMusicChange";
|
return "CsCmdMusicChange";
|
||||||
}
|
}
|
||||||
|
@ -423,7 +429,7 @@ size_t CutsceneCommandStopBGM::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + 0x30;
|
return CutsceneCommand::GetCommandSize() + 0x30;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnvLightingEntry::EnvLightingEntry(vector<uint8_t> rawData, int rawDataIndex)
|
EnvLightingEntry::EnvLightingEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
setting = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
setting = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
@ -438,7 +444,7 @@ EnvLightingEntry::EnvLightingEntry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
unused7 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 32);
|
unused7 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandEnvLighting::CutsceneCommandEnvLighting(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandEnvLighting::CutsceneCommandEnvLighting(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
|
|
||||||
|
@ -451,7 +457,7 @@ CutsceneCommandEnvLighting::CutsceneCommandEnvLighting(vector<uint8_t> rawData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandEnvLighting::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandEnvLighting::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -467,7 +473,7 @@ string CutsceneCommandEnvLighting::GenerateSourceCode(string roomName, int baseA
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandEnvLighting::GetCName(string prefix)
|
string CutsceneCommandEnvLighting::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdEnvLighting";
|
return "CsCmdEnvLighting";
|
||||||
}
|
}
|
||||||
|
@ -477,7 +483,7 @@ size_t CutsceneCommandEnvLighting::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (0x30 * entries.size());
|
return CutsceneCommand::GetCommandSize() + (0x30 * entries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
Unknown9Entry::Unknown9Entry(vector<uint8_t> rawData, int rawDataIndex)
|
Unknown9Entry::Unknown9Entry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
@ -489,7 +495,7 @@ Unknown9Entry::Unknown9Entry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
unused1 = rawData[rawDataIndex + 11];;
|
unused1 = rawData[rawDataIndex + 11];;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandUnknown9::CutsceneCommandUnknown9(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandUnknown9::CutsceneCommandUnknown9(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
||||||
|
|
||||||
|
@ -502,7 +508,7 @@ CutsceneCommandUnknown9::CutsceneCommandUnknown9(vector<uint8_t> rawData, int ra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandUnknown9::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandUnknown9::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -517,7 +523,7 @@ string CutsceneCommandUnknown9::GenerateSourceCode(string roomName, int baseAddr
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandUnknown9::GetCName(string prefix)
|
string CutsceneCommandUnknown9::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdUnknown9";
|
return "CsCmdUnknown9";
|
||||||
}
|
}
|
||||||
|
@ -527,7 +533,7 @@ size_t CutsceneCommandUnknown9::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (entries.size() * 12);
|
return CutsceneCommand::GetCommandSize() + (entries.size() * 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnkEntry::UnkEntry(vector<uint8_t> rawData, int rawDataIndex)
|
UnkEntry::UnkEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
unused0 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
unused0 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
unused1 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 4);
|
unused1 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 4);
|
||||||
|
@ -543,7 +549,7 @@ UnkEntry::UnkEntry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
unused11 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 44);
|
unused11 = (uint32_t)BitConverter::ToInt32BE(rawData, rawDataIndex + 44);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandUnknown::CutsceneCommandUnknown(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandUnknown::CutsceneCommandUnknown(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
||||||
|
|
||||||
|
@ -556,7 +562,7 @@ CutsceneCommandUnknown::CutsceneCommandUnknown(vector<uint8_t> rawData, int rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandUnknown::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandUnknown::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -572,7 +578,7 @@ string CutsceneCommandUnknown::GenerateSourceCode(string roomName, int baseAddre
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandUnknown::GetCName(string prefix)
|
string CutsceneCommandUnknown::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdUnknown1A";
|
return "CsCmdUnknown1A";
|
||||||
}
|
}
|
||||||
|
@ -582,7 +588,7 @@ size_t CutsceneCommandUnknown::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (entries.size() * 0x30);
|
return CutsceneCommand::GetCommandSize() + (entries.size() * 0x30);
|
||||||
}
|
}
|
||||||
|
|
||||||
DayTimeEntry::DayTimeEntry(vector<uint8_t> rawData, int rawDataIndex)
|
DayTimeEntry::DayTimeEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
@ -592,7 +598,7 @@ DayTimeEntry::DayTimeEntry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
unused = rawData[rawDataIndex + 8];
|
unused = rawData[rawDataIndex + 8];
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandDayTime::CutsceneCommandDayTime(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandDayTime::CutsceneCommandDayTime(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
||||||
|
|
||||||
|
@ -605,12 +611,12 @@ CutsceneCommandDayTime::CutsceneCommandDayTime(vector<uint8_t> rawData, int rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandDayTime::GetCName(string prefix)
|
string CutsceneCommandDayTime::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdDayTime";
|
return "CsCmdDayTime";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandDayTime::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandDayTime::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -630,7 +636,7 @@ size_t CutsceneCommandDayTime::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (entries.size() * 12);
|
return CutsceneCommand::GetCommandSize() + (entries.size() * 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextboxEntry::TextboxEntry(vector<uint8_t> rawData, int rawDataIndex)
|
TextboxEntry::TextboxEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
|
@ -640,7 +646,7 @@ TextboxEntry::TextboxEntry(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
textID2 = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
textID2 = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandTextbox::CutsceneCommandTextbox(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandTextbox::CutsceneCommandTextbox(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
||||||
|
|
||||||
|
@ -653,12 +659,12 @@ CutsceneCommandTextbox::CutsceneCommandTextbox(vector<uint8_t> rawData, int rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandTextbox::GetCName(string prefix)
|
string CutsceneCommandTextbox::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdTextbox";
|
return "CsCmdTextbox";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandTextbox::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandTextbox::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -685,9 +691,9 @@ size_t CutsceneCommandTextbox::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (entries.size() * 12);
|
return CutsceneCommand::GetCommandSize() + (entries.size() * 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActorAction::ActorAction(vector<uint8_t> rawData, int rawDataIndex)
|
ActorAction::ActorAction(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
action = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
action = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
@ -706,7 +712,7 @@ ActorAction::ActorAction(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
normalZ = BitConverter::ToInt32BE(data, rawDataIndex + 44);
|
normalZ = BitConverter::ToInt32BE(data, rawDataIndex + 44);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandActorAction::CutsceneCommandActorAction(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandActorAction::CutsceneCommandActorAction(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex);
|
||||||
|
|
||||||
|
@ -719,7 +725,7 @@ CutsceneCommandActorAction::CutsceneCommandActorAction(vector<uint8_t> rawData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandActorAction::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandActorAction::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -735,7 +741,7 @@ string CutsceneCommandActorAction::GenerateSourceCode(string roomName, int baseA
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandActorAction::GetCName(string prefix)
|
string CutsceneCommandActorAction::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdBase";
|
return "CsCmdBase";
|
||||||
}
|
}
|
||||||
|
@ -745,7 +751,7 @@ size_t CutsceneCommandActorAction::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (entries.size() * 0x30);
|
return CutsceneCommand::GetCommandSize() + (entries.size() * 0x30);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandTerminator::CutsceneCommandTerminator(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandTerminator::CutsceneCommandTerminator(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
rawDataIndex += 4;
|
rawDataIndex += 4;
|
||||||
|
|
||||||
|
@ -755,12 +761,12 @@ CutsceneCommandTerminator::CutsceneCommandTerminator(vector<uint8_t> rawData, in
|
||||||
unknown = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 6);
|
unknown = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandTerminator::GetCName(string prefix)
|
string CutsceneCommandTerminator::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdBase";
|
return "CsCmdBase";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandTerminator::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandTerminator::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -774,14 +780,14 @@ size_t CutsceneCommandTerminator::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + 8;
|
return CutsceneCommand::GetCommandSize() + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandEnd::CutsceneCommandEnd(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandEnd::CutsceneCommandEnd(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandEnd::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandEnd::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -790,7 +796,7 @@ string CutsceneCommandEnd::GenerateSourceCode(string roomName, int baseAddress)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandEnd::GetCName(string prefix)
|
string CutsceneCommandEnd::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdBase";
|
return "CsCmdBase";
|
||||||
}
|
}
|
||||||
|
@ -800,27 +806,27 @@ size_t CutsceneCommandEnd::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + 6;
|
return CutsceneCommand::GetCommandSize() + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpecialActionEntry::SpecialActionEntry(vector<uint8_t> rawData, int rawDataIndex)
|
SpecialActionEntry::SpecialActionEntry(const vector<uint8_t>& rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
base = BitConverter::ToUInt16BE(data, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
startFrame = BitConverter::ToUInt16BE(data, rawDataIndex + 2);
|
||||||
endFrame = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 4);
|
endFrame = BitConverter::ToUInt16BE(data, rawDataIndex + 4);
|
||||||
unused0 = (uint16_t)BitConverter::ToInt16BE(data, rawDataIndex + 6);
|
unused0 = BitConverter::ToUInt16BE(data, rawDataIndex + 6);
|
||||||
unused1 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 8);
|
unused1 = BitConverter::ToUInt32BE(data, rawDataIndex + 8);
|
||||||
unused2 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 12);
|
unused2 = BitConverter::ToUInt32BE(data, rawDataIndex + 12);
|
||||||
unused3 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 16);
|
unused3 = BitConverter::ToUInt32BE(data, rawDataIndex + 16);
|
||||||
unused4 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 20);
|
unused4 = BitConverter::ToUInt32BE(data, rawDataIndex + 20);
|
||||||
unused5 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 24);
|
unused5 = BitConverter::ToUInt32BE(data, rawDataIndex + 24);
|
||||||
unused6 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 28);
|
unused6 = BitConverter::ToUInt32BE(data, rawDataIndex + 28);
|
||||||
unused7 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 32);
|
unused7 = BitConverter::ToUInt32BE(data, rawDataIndex + 32);
|
||||||
unused8 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 36);
|
unused8 = BitConverter::ToUInt32BE(data, rawDataIndex + 36);
|
||||||
unused9 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 40);
|
unused9 = BitConverter::ToUInt32BE(data, rawDataIndex + 40);
|
||||||
unused10 = (uint32_t)BitConverter::ToInt32BE(data, rawDataIndex + 44);
|
unused10 = BitConverter::ToUInt32BE(data, rawDataIndex + 44);
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandSpecialAction::CutsceneCommandSpecialAction(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandSpecialAction::CutsceneCommandSpecialAction(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
int numEntries = BitConverter::ToInt32BE(rawData, rawDataIndex + 0);
|
||||||
|
|
||||||
|
@ -833,7 +839,7 @@ CutsceneCommandSpecialAction::CutsceneCommandSpecialAction(vector<uint8_t> rawDa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandSpecialAction::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandSpecialAction::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
@ -849,7 +855,7 @@ string CutsceneCommandSpecialAction::GenerateSourceCode(string roomName, int bas
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandSpecialAction::GetCName(string prefix)
|
string CutsceneCommandSpecialAction::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdBase";
|
return "CsCmdBase";
|
||||||
}
|
}
|
||||||
|
@ -859,14 +865,14 @@ size_t CutsceneCommandSpecialAction::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + (0x30 * entries.size());
|
return CutsceneCommand::GetCommandSize() + (0x30 * entries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandNop::CutsceneCommandNop(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandNop::CutsceneCommandNop(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
base = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||||
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
startFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||||
endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandNop::GetCName(string prefix)
|
string CutsceneCommandNop::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdBase";
|
return "CsCmdBase";
|
||||||
}
|
}
|
||||||
|
@ -876,7 +882,7 @@ size_t CutsceneCommandNop::GetCommandSize()
|
||||||
return CutsceneCommand::GetCommandSize() + 6;
|
return CutsceneCommand::GetCommandSize() + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
CutsceneCommandSceneTransFX::CutsceneCommandSceneTransFX(vector<uint8_t> rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
CutsceneCommandSceneTransFX::CutsceneCommandSceneTransFX(const vector<uint8_t>& rawData, int rawDataIndex) : CutsceneCommand(rawData, rawDataIndex)
|
||||||
{
|
{
|
||||||
rawDataIndex += 4;
|
rawDataIndex += 4;
|
||||||
|
|
||||||
|
@ -885,12 +891,12 @@ CutsceneCommandSceneTransFX::CutsceneCommandSceneTransFX(vector<uint8_t> rawData
|
||||||
endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandSceneTransFX::GenerateSourceCode(string roomName, int baseAddress)
|
string CutsceneCommandSceneTransFX::GenerateSourceCode(const std::string& roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
return StringHelper::Sprintf("CS_SCENE_TRANS_FX(%i, %i, %i, %i),\n", base, startFrame, endFrame);
|
return StringHelper::Sprintf("CS_SCENE_TRANS_FX(%i, %i, %i, %i),\n", base, startFrame, endFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
string CutsceneCommandSceneTransFX::GetCName(string prefix)
|
string CutsceneCommandSceneTransFX::GetCName(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "CsCmdBase";
|
return "CsCmdBase";
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
int16_t posX, posY, posZ;
|
int16_t posX, posY, posZ;
|
||||||
int16_t unused;
|
int16_t unused;
|
||||||
|
|
||||||
CutsceneCameraPoint(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCameraPoint(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommand
|
class CutsceneCommand
|
||||||
|
@ -61,9 +61,9 @@ public:
|
||||||
uint32_t commandID;
|
uint32_t commandID;
|
||||||
uint32_t commandIndex;
|
uint32_t commandIndex;
|
||||||
|
|
||||||
CutsceneCommand(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommand(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
virtual std::string GetCName(std::string prefix);
|
virtual std::string GetCName(const std::string& prefix);
|
||||||
virtual std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
virtual size_t GetCommandSize();
|
virtual size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ public:
|
||||||
|
|
||||||
std::vector<CutsceneCameraPoint*> entries;
|
std::vector<CutsceneCameraPoint*> entries;
|
||||||
|
|
||||||
CutsceneCommandSetCameraPos(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandSetCameraPos(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
uint32_t unused9;
|
uint32_t unused9;
|
||||||
uint32_t unused10;
|
uint32_t unused10;
|
||||||
|
|
||||||
SpecialActionEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
SpecialActionEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandSpecialAction : public CutsceneCommand
|
class CutsceneCommandSpecialAction : public CutsceneCommand
|
||||||
|
@ -109,9 +109,9 @@ class CutsceneCommandSpecialAction : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<SpecialActionEntry*> entries;
|
std::vector<SpecialActionEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandSpecialAction(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandSpecialAction(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public:
|
||||||
uint32_t unknown9;
|
uint32_t unknown9;
|
||||||
uint32_t unknown10;
|
uint32_t unknown10;
|
||||||
|
|
||||||
MusicFadeEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
MusicFadeEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandFadeBGM : public CutsceneCommand
|
class CutsceneCommandFadeBGM : public CutsceneCommand
|
||||||
|
@ -141,9 +141,9 @@ class CutsceneCommandFadeBGM : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<MusicFadeEntry*> entries;
|
std::vector<MusicFadeEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandFadeBGM( std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandFadeBGM( const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public:
|
||||||
uint32_t unknown6;
|
uint32_t unknown6;
|
||||||
uint32_t unknown7;
|
uint32_t unknown7;
|
||||||
|
|
||||||
MusicChangeEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
MusicChangeEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandPlayBGM : public CutsceneCommand
|
class CutsceneCommandPlayBGM : public CutsceneCommand
|
||||||
|
@ -170,9 +170,9 @@ class CutsceneCommandPlayBGM : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<MusicChangeEntry*> entries;
|
std::vector<MusicChangeEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandPlayBGM(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandPlayBGM(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ class CutsceneCommandStopBGM : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<MusicChangeEntry*> entries;
|
std::vector<MusicChangeEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandStopBGM(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandStopBGM(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ public:
|
||||||
uint32_t unused6;
|
uint32_t unused6;
|
||||||
uint32_t unused7;
|
uint32_t unused7;
|
||||||
|
|
||||||
EnvLightingEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
EnvLightingEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandEnvLighting : public CutsceneCommand
|
class CutsceneCommandEnvLighting : public CutsceneCommand
|
||||||
|
@ -210,9 +210,9 @@ class CutsceneCommandEnvLighting : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<EnvLightingEntry*> entries;
|
std::vector<EnvLightingEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandEnvLighting(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandEnvLighting(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,9 +223,9 @@ public:
|
||||||
uint16_t startFrame;
|
uint16_t startFrame;
|
||||||
uint16_t endFrame;
|
uint16_t endFrame;
|
||||||
|
|
||||||
CutsceneCommandSceneTransFX(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandSceneTransFX(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ public:
|
||||||
uint8_t unused0;
|
uint8_t unused0;
|
||||||
uint8_t unused1;
|
uint8_t unused1;
|
||||||
|
|
||||||
Unknown9Entry(std::vector<uint8_t> rawData, int rawDataIndex);
|
Unknown9Entry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandUnknown9 : public CutsceneCommand
|
class CutsceneCommandUnknown9 : public CutsceneCommand
|
||||||
|
@ -249,9 +249,9 @@ class CutsceneCommandUnknown9 : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<Unknown9Entry*> entries;
|
std::vector<Unknown9Entry*> entries;
|
||||||
|
|
||||||
CutsceneCommandUnknown9(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandUnknown9(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ public:
|
||||||
uint32_t unused10;
|
uint32_t unused10;
|
||||||
uint32_t unused11;
|
uint32_t unused11;
|
||||||
|
|
||||||
UnkEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
UnkEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandUnknown : public CutsceneCommand
|
class CutsceneCommandUnknown : public CutsceneCommand
|
||||||
|
@ -279,9 +279,9 @@ class CutsceneCommandUnknown : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<UnkEntry*> entries;
|
std::vector<UnkEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandUnknown(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandUnknown(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ public:
|
||||||
uint8_t minute;
|
uint8_t minute;
|
||||||
uint8_t unused;
|
uint8_t unused;
|
||||||
|
|
||||||
DayTimeEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
DayTimeEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandDayTime : public CutsceneCommand
|
class CutsceneCommandDayTime : public CutsceneCommand
|
||||||
|
@ -303,9 +303,9 @@ class CutsceneCommandDayTime : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<DayTimeEntry*> entries;
|
std::vector<DayTimeEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandDayTime(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandDayTime(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ public:
|
||||||
uint16_t textID1;
|
uint16_t textID1;
|
||||||
uint16_t textID2;
|
uint16_t textID2;
|
||||||
|
|
||||||
TextboxEntry(std::vector<uint8_t> rawData, int rawDataIndex);
|
TextboxEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandTextbox : public CutsceneCommand
|
class CutsceneCommandTextbox : public CutsceneCommand
|
||||||
|
@ -327,9 +327,9 @@ class CutsceneCommandTextbox : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<TextboxEntry*> entries;
|
std::vector<TextboxEntry*> entries;
|
||||||
|
|
||||||
CutsceneCommandTextbox(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandTextbox(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ public:
|
||||||
int32_t endPosX, endPosY, endPosZ;
|
int32_t endPosX, endPosY, endPosZ;
|
||||||
int32_t normalX, normalY, normalZ;
|
int32_t normalX, normalY, normalZ;
|
||||||
|
|
||||||
ActorAction(std::vector<uint8_t> rawData, int rawDataIndex);
|
ActorAction(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneCommandActorAction : public CutsceneCommand
|
class CutsceneCommandActorAction : public CutsceneCommand
|
||||||
|
@ -352,9 +352,9 @@ class CutsceneCommandActorAction : public CutsceneCommand
|
||||||
public:
|
public:
|
||||||
std::vector<ActorAction*> entries;
|
std::vector<ActorAction*> entries;
|
||||||
|
|
||||||
CutsceneCommandActorAction(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandActorAction(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -366,9 +366,9 @@ public:
|
||||||
uint16_t endFrame;
|
uint16_t endFrame;
|
||||||
uint16_t unknown;
|
uint16_t unknown;
|
||||||
|
|
||||||
CutsceneCommandTerminator(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandTerminator(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -379,9 +379,9 @@ public:
|
||||||
uint16_t startFrame;
|
uint16_t startFrame;
|
||||||
uint16_t endFrame;
|
uint16_t endFrame;
|
||||||
|
|
||||||
CutsceneCommandEnd(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandEnd(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
std::string GenerateSourceCode(std::string roomName, int baseAddress);
|
std::string GenerateSourceCode(const std::string& roomName, int baseAddress);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -392,8 +392,8 @@ public:
|
||||||
uint16_t startFrame;
|
uint16_t startFrame;
|
||||||
uint16_t endFrame;
|
uint16_t endFrame;
|
||||||
|
|
||||||
CutsceneCommandNop(std::vector<uint8_t> rawData, int rawDataIndex);
|
CutsceneCommandNop(const std::vector<uint8_t>& rawData, int rawDataIndex);
|
||||||
std::string GetCName(std::string prefix);
|
std::string GetCName(const std::string& prefix);
|
||||||
size_t GetCommandSize();
|
size_t GetCommandSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -404,8 +404,9 @@ public:
|
||||||
|
|
||||||
CutsceneCommands GetCommandFromID(int id);
|
CutsceneCommands GetCommandFromID(int id);
|
||||||
ZCutscene(std::vector<uint8_t> nRawData, int rawDataIndex, int rawDataSize);
|
ZCutscene(std::vector<uint8_t> nRawData, int rawDataIndex, int rawDataSize);
|
||||||
|
~ZCutscene();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
int GetRawDataSize();
|
int GetRawDataSize();
|
||||||
private:
|
private:
|
||||||
int numCommands;
|
int numCommands;
|
||||||
|
|
|
@ -23,6 +23,7 @@ ZDisplayList::ZDisplayList() : ZResource()
|
||||||
lastTexSiz = F3DZEXTexSizes::G_IM_SIZ_16b;
|
lastTexSiz = F3DZEXTexSizes::G_IM_SIZ_16b;
|
||||||
lastTexSizTest = F3DZEXTexSizes::G_IM_SIZ_16b;
|
lastTexSizTest = F3DZEXTexSizes::G_IM_SIZ_16b;
|
||||||
lastTexLoaded = false;
|
lastTexLoaded = false;
|
||||||
|
lastTexIsPalette = false;
|
||||||
name = "";
|
name = "";
|
||||||
scene = nullptr;
|
scene = nullptr;
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ void ZDisplayList::ParseRawData()
|
||||||
instructions.reserve(numInstructions);
|
instructions.reserve(numInstructions);
|
||||||
|
|
||||||
for (int i = 0; i < numInstructions; i++)
|
for (int i = 0; i < numInstructions; i++)
|
||||||
instructions.push_back(BitConverter::ToInt64BE(rawDataArr, (i * 8)));
|
instructions.push_back(BitConverter::ToUInt64BE(rawDataArr, (i * 8)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZDisplayList::GetDListLength(vector<uint8_t> rawData, int rawDataIndex)
|
int ZDisplayList::GetDListLength(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
|
@ -162,11 +163,6 @@ int ZDisplayList::OptimizationCheck_LoadTextureBlock(int startIndex, string& out
|
||||||
|
|
||||||
lastTexSeg = (data & 0xFF000000);
|
lastTexSeg = (data & 0xFF000000);
|
||||||
|
|
||||||
if (texAddr == 0xb880e0)
|
|
||||||
{
|
|
||||||
int bp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Declaration* texDecl = nullptr;
|
Declaration* texDecl = nullptr;
|
||||||
|
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
|
@ -245,11 +241,6 @@ int ZDisplayList::OptimizationCheck_LoadTextureBlock(int startIndex, string& out
|
||||||
if (sizB == (int)F3DZEXTexSizes::G_IM_SIZ_4b && fmt == (int)F3DZEXTexFormats::G_IM_FMT_IA)
|
if (sizB == (int)F3DZEXTexSizes::G_IM_SIZ_4b && fmt == (int)F3DZEXTexFormats::G_IM_FMT_IA)
|
||||||
shiftAmtH = 3;
|
shiftAmtH = 3;
|
||||||
|
|
||||||
if (texAddr == 0xb880e0)
|
|
||||||
{
|
|
||||||
int bp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
width = (uuu >> shiftAmtW) + 1;
|
width = (uuu >> shiftAmtW) + 1;
|
||||||
height = (vvv >> shiftAmtH) + 1;
|
height = (vvv >> shiftAmtH) + 1;
|
||||||
|
|
||||||
|
@ -304,11 +295,6 @@ int ZDisplayList::OptimizationCheck_LoadTextureBlock(int startIndex, string& out
|
||||||
lastTexSiz = (F3DZEXTexSizes)siz;
|
lastTexSiz = (F3DZEXTexSizes)siz;
|
||||||
lastTexLoaded = true;
|
lastTexLoaded = true;
|
||||||
|
|
||||||
if (lastTexAddr == 0x8798)
|
|
||||||
{
|
|
||||||
int bp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureGenCheck(prefix);
|
TextureGenCheck(prefix);
|
||||||
|
|
||||||
return (int)sequence.size();
|
return (int)sequence.size();
|
||||||
|
@ -317,12 +303,12 @@ int ZDisplayList::OptimizationCheck_LoadTextureBlock(int startIndex, string& out
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZDisplayList::GetSourceOutputHeader(string prefix)
|
string ZDisplayList::GetSourceOutputHeader(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
string ZDisplayList::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
char line[4096];
|
char line[4096];
|
||||||
string sourceOutput = "";
|
string sourceOutput = "";
|
||||||
|
@ -370,14 +356,14 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
if (dListDecl != nullptr)
|
if (dListDecl != nullptr)
|
||||||
sprintf(line, "gsSPBranchList(%s),", dListDecl->varName.c_str());
|
sprintf(line, "gsSPBranchList(%s),", dListDecl->varName.c_str());
|
||||||
else
|
else
|
||||||
sprintf(line, "gsSPBranchList(%sDlist0x%06X),", prefix.c_str(), SEG2FILESPACE(data));
|
sprintf(line, "gsSPBranchList(%sDlist0x%06lX),", prefix.c_str(), SEG2FILESPACE(data));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dListDecl != nullptr)
|
if (dListDecl != nullptr)
|
||||||
sprintf(line, "gsSPDisplayList(%s),", dListDecl->varName.c_str());
|
sprintf(line, "gsSPDisplayList(%s),", dListDecl->varName.c_str());
|
||||||
else
|
else
|
||||||
sprintf(line, "gsSPDisplayList(%sDlist0x%06X),", prefix.c_str(), SEG2FILESPACE(data));
|
sprintf(line, "gsSPDisplayList(%sDlist0x%06lX),", prefix.c_str(), SEG2FILESPACE(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
int segmentNumber = (data & 0xFF000000) >> 24;
|
int segmentNumber = (data & 0xFF000000) >> 24;
|
||||||
|
@ -495,7 +481,7 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
uint32_t fmt = (__ & 0xE0) >> 5;
|
uint32_t fmt = (__ & 0xE0) >> 5;
|
||||||
uint32_t siz = (__ & 0x18) >> 3;
|
uint32_t siz = (__ & 0x18) >> 3;
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("TextureGenCheck G_SETTIMG\n");
|
printf("TextureGenCheck G_SETTIMG\n");
|
||||||
|
|
||||||
TextureGenCheck(prefix); // HOTSPOT
|
TextureGenCheck(prefix); // HOTSPOT
|
||||||
|
@ -513,9 +499,7 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
if (segmentNumber != 2)
|
if (segmentNumber != 2)
|
||||||
{
|
{
|
||||||
char texStr[2048];
|
char texStr[2048];
|
||||||
|
|
||||||
int32_t texAddress = SEG2FILESPACE(data);
|
int32_t texAddress = SEG2FILESPACE(data);
|
||||||
|
|
||||||
Declaration* texDecl = nullptr;
|
Declaration* texDecl = nullptr;
|
||||||
|
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
|
@ -548,7 +532,7 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//sprintf(line, "gsDPSetTextureImage(%s, %s, %i, 0x%08X),", fmtTbl[fmt].c_str(), sizTbl[siz].c_str(), www + 1, data & 0xFFFFFFFF);
|
//sprintf(line, "gsDPSetTextureImage(%s, %s, %i, 0x%08X),", fmtTbl[fmt].c_str(), sizTbl[siz].c_str(), www + 1, data & 0xFFFFFFFF);
|
||||||
sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %sTex_%06X),", fmtTbl[fmt].c_str(), sizTbl[siz].c_str(), www + 1, scene->GetName().c_str(), data & 0x00FFFFFF);
|
sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %sTex_%06lX),", fmtTbl[fmt].c_str(), sizTbl[siz].c_str(), www + 1, scene->GetName().c_str(), SEG2FILESPACE(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -866,10 +850,10 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
lastTexWidth = (uuu >> shiftAmtW) + 1;
|
lastTexWidth = (uuu >> shiftAmtW) + 1;
|
||||||
lastTexHeight = (vvv >> shiftAmtH) + 1;
|
lastTexHeight = (vvv >> shiftAmtH) + 1;
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("lastTexWidth: %i lastTexHeight: %i, lastTexSizTest: 0x%x, lastTexFmt: 0x%x\n", lastTexWidth, lastTexHeight, (uint32_t)lastTexSizTest, (uint32_t)lastTexFmt);
|
printf("lastTexWidth: %i lastTexHeight: %i, lastTexSizTest: 0x%x, lastTexFmt: 0x%x\n", lastTexWidth, lastTexHeight, (uint32_t)lastTexSizTest, (uint32_t)lastTexFmt);
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("TextureGenCheck G_SETTILESIZE\n");
|
printf("TextureGenCheck G_SETTILESIZE\n");
|
||||||
|
|
||||||
TextureGenCheck(prefix);
|
TextureGenCheck(prefix);
|
||||||
|
@ -928,8 +912,9 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
lastTexHeight = sqrt(ccc + 1);
|
lastTexHeight = sqrt(ccc + 1);
|
||||||
|
|
||||||
lastTexLoaded = true;
|
lastTexLoaded = true;
|
||||||
|
lastTexIsPalette = true;
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("TextureGenCheck G_LOADTLUT (lastCISiz: %i)\n", (uint32_t)lastCISiz);
|
printf("TextureGenCheck G_LOADTLUT (lastCISiz: %i)\n", (uint32_t)lastCISiz);
|
||||||
|
|
||||||
TextureGenCheck(prefix);
|
TextureGenCheck(prefix);
|
||||||
|
@ -995,7 +980,7 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
case F3DZEXOpcode::G_ENDDL:
|
case F3DZEXOpcode::G_ENDDL:
|
||||||
sprintf(line, "gsSPEndDisplayList(),");
|
sprintf(line, "gsSPEndDisplayList(),");
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("TextureGenCheck G_ENDDL\n");
|
printf("TextureGenCheck G_ENDDL\n");
|
||||||
|
|
||||||
TextureGenCheck(prefix);
|
TextureGenCheck(prefix);
|
||||||
|
@ -1126,8 +1111,8 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
|
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
{
|
{
|
||||||
parent->AddDeclarationArray(item.first, DeclarationAlignment::None, item.second.size() * 16, "Vtx",
|
parent->AddDeclarationArray(item.first, DeclarationAlignment::None, item.second.size() * 16, "static Vtx",
|
||||||
StringHelper::Sprintf("%sVtx_%06X", prefix.c_str(), item.first, item.second.size()), 0, declaration);
|
StringHelper::Sprintf("%sVtx_%06X", prefix.c_str(), item.first, item.second.size()), item.second.size(), declaration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1183,6 +1168,14 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
{
|
{
|
||||||
int intersectAmt = (texturesSorted[i].first + texSize) - texturesSorted[i + 1].first;
|
int intersectAmt = (texturesSorted[i].first + texSize) - texturesSorted[i + 1].first;
|
||||||
|
|
||||||
|
// If we're working with a palette, resize it to its "real" dimensions
|
||||||
|
if (texturesSorted[i].second->isPalette)
|
||||||
|
{
|
||||||
|
texturesSorted[i].second->SetWidth(intersectAmt / 2);
|
||||||
|
texturesSorted[i].second->SetHeight(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
defines += StringHelper::Sprintf("#define %sTex_%06X ((u32)%sTex_%06X + 0x%06X)\n", prefix.c_str(), texturesSorted[i + 1].first, prefix.c_str(),
|
defines += StringHelper::Sprintf("#define %sTex_%06X ((u32)%sTex_%06X + 0x%06X)\n", prefix.c_str(), texturesSorted[i + 1].first, prefix.c_str(),
|
||||||
texturesSorted[i].first, texturesSorted[i + 1].first - texturesSorted[i].first);
|
texturesSorted[i].first, texturesSorted[i + 1].first - texturesSorted[i].first);
|
||||||
|
|
||||||
|
@ -1194,7 +1187,7 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate Texture Declarations
|
// Generate Texture Declarations
|
||||||
for (pair<int32_t, ZTexture*> item : textures)
|
for (pair<int32_t, ZTexture*> item : textures)
|
||||||
|
@ -1208,7 +1201,7 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
{
|
{
|
||||||
if (parent->GetDeclaration(item.first) == nullptr)
|
if (parent->GetDeclaration(item.first) == nullptr)
|
||||||
{
|
{
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("SAVING IMAGE TO %s\n", Globals::Instance->outputPath.c_str());
|
printf("SAVING IMAGE TO %s\n", Globals::Instance->outputPath.c_str());
|
||||||
|
|
||||||
item.second->Save(Globals::Instance->outputPath);
|
item.second->Save(Globals::Instance->outputPath);
|
||||||
|
@ -1235,28 +1228,28 @@ string ZDisplayList::GetSourceOutputCode(std::string prefix)
|
||||||
// HOTSPOT
|
// HOTSPOT
|
||||||
void ZDisplayList::TextureGenCheck(string prefix)
|
void ZDisplayList::TextureGenCheck(string prefix)
|
||||||
{
|
{
|
||||||
if (TextureGenCheck(fileData, textures, scene, parent, prefix, lastTexWidth, lastTexHeight, lastTexAddr, lastTexSeg, lastTexFmt, lastTexSiz, lastTexLoaded))
|
if (TextureGenCheck(fileData, textures, scene, parent, prefix, lastTexWidth, lastTexHeight, lastTexAddr, lastTexSeg, lastTexFmt, lastTexSiz, lastTexLoaded, lastTexIsPalette))
|
||||||
{
|
{
|
||||||
lastTexAddr = 0;
|
lastTexAddr = 0;
|
||||||
lastTexLoaded = false;
|
lastTexLoaded = false;
|
||||||
|
lastTexIsPalette = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HOTSPOT
|
// HOTSPOT
|
||||||
bool ZDisplayList::TextureGenCheck(vector<uint8_t> fileData, map<uint32_t, ZTexture*>& textures, ZRoom* scene, ZFile* parent, string prefix, uint32_t texWidth, uint32_t texHeight, uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded)
|
bool ZDisplayList::TextureGenCheck(vector<uint8_t> fileData, map<uint32_t, ZTexture*>& textures, ZRoom* scene, ZFile* parent, string prefix, uint32_t texWidth, uint32_t texHeight, uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded, bool texIsPalette)
|
||||||
{
|
{
|
||||||
int segmentNumber = (texSeg & 0xFF000000) >> 24;
|
int segmentNumber = (texSeg & 0xFF000000) >> 24;
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("TextureGenCheck seg=%i width=%i height=%i addr=0x%06X\n", segmentNumber, texWidth, texHeight, texAddr);
|
printf("TextureGenCheck seg=%i width=%i height=%i ispal=%i addr=0x%06X\n", segmentNumber, texWidth, texHeight, texIsPalette, texAddr);
|
||||||
|
|
||||||
if (texAddr != 0 && texWidth != 0 && texHeight != 0 && texLoaded && Globals::Instance->HasSegment(segmentNumber))
|
if (texAddr != 0 && texWidth != 0 && texHeight != 0 && texLoaded && Globals::Instance->HasSegment(segmentNumber))
|
||||||
{
|
{
|
||||||
if (segmentNumber != 2) // Not from a scene file
|
if (segmentNumber != 2) // Not from a scene file
|
||||||
{
|
{
|
||||||
ZTexture* tex = ZTexture::FromBinary(TexFormatToTexType(texFmt, texSiz), fileData, texAddr, StringHelper::Sprintf("%sTex_%06X", prefix.c_str(), texAddr), texWidth, texHeight);
|
ZTexture* tex = ZTexture::FromBinary(TexFormatToTexType(texFmt, texSiz), fileData, texAddr, StringHelper::Sprintf("%sTex_%06X", prefix.c_str(), texAddr), texWidth, texHeight);
|
||||||
|
tex->isPalette = texIsPalette;
|
||||||
//tex->Save(Globals::Instance->outputPath);
|
|
||||||
textures[texAddr] = tex;
|
textures[texAddr] = tex;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1266,8 +1259,6 @@ bool ZDisplayList::TextureGenCheck(vector<uint8_t> fileData, map<uint32_t, ZText
|
||||||
ZTexture* tex = ZTexture::FromBinary(TexFormatToTexType(texFmt, texSiz), scene->GetRawData(), texAddr,
|
ZTexture* tex = ZTexture::FromBinary(TexFormatToTexType(texFmt, texSiz), scene->GetRawData(), texAddr,
|
||||||
StringHelper::Sprintf("%sTex_%06X", Globals::Instance->lastScene->GetName().c_str(), texAddr), texWidth, texHeight);
|
StringHelper::Sprintf("%sTex_%06X", Globals::Instance->lastScene->GetName().c_str(), texAddr), texWidth, texHeight);
|
||||||
|
|
||||||
//tex->Save(Globals::Instance->outputPath);
|
|
||||||
|
|
||||||
if (scene != nullptr)
|
if (scene != nullptr)
|
||||||
{
|
{
|
||||||
scene->textures[texAddr] = tex;
|
scene->textures[texAddr] = tex;
|
||||||
|
@ -1318,7 +1309,7 @@ TextureType ZDisplayList::TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSize
|
||||||
return TextureType::RGBA16bpp;
|
return TextureType::RGBA16bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZDisplayList::Save(string outFolder)
|
void ZDisplayList::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
//HLModelIntermediette* mdl = HLModelIntermediette::FromZDisplayList(this);
|
//HLModelIntermediette* mdl = HLModelIntermediette::FromZDisplayList(this);
|
||||||
|
|
||||||
|
@ -1382,7 +1373,7 @@ Vertex::Vertex(int16_t nX, int16_t nY, int16_t nZ, uint16_t nFlag, int16_t nS, i
|
||||||
|
|
||||||
Vertex::Vertex(std::vector<uint8_t> rawData, int rawDataIndex)
|
Vertex::Vertex(std::vector<uint8_t> rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
x = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
x = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
y = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
y = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
|
|
@ -219,6 +219,7 @@ protected:
|
||||||
F3DZEXTexFormats lastTexFmt;
|
F3DZEXTexFormats lastTexFmt;
|
||||||
F3DZEXTexSizes lastTexSiz, lastTexSizTest, lastCISiz;
|
F3DZEXTexSizes lastTexSiz, lastTexSizTest, lastCISiz;
|
||||||
bool lastTexLoaded;
|
bool lastTexLoaded;
|
||||||
|
bool lastTexIsPalette;
|
||||||
|
|
||||||
//void ParseXML(tinyxml2::XMLElement* reader);
|
//void ParseXML(tinyxml2::XMLElement* reader);
|
||||||
static TextureType TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSizes siz);
|
static TextureType TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSizes siz);
|
||||||
|
@ -253,13 +254,13 @@ public:
|
||||||
static ZDisplayList* BuildFromXML(tinyxml2::XMLElement* reader, std::string inFolder, bool readFile);
|
static ZDisplayList* BuildFromXML(tinyxml2::XMLElement* reader, std::string inFolder, bool readFile);
|
||||||
|
|
||||||
void TextureGenCheck(std::string prefix);
|
void TextureGenCheck(std::string prefix);
|
||||||
static bool TextureGenCheck(std::vector<uint8_t> fileData, std::map<uint32_t, ZTexture*>& textures, ZRoom* scene, ZFile* parent, std::string prefix, uint32_t texWidth, uint32_t texHeight, uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded);
|
static bool TextureGenCheck(std::vector<uint8_t> fileData, std::map<uint32_t, ZTexture*>& textures, ZRoom* scene, ZFile* parent, std::string prefix, uint32_t texWidth, uint32_t texHeight, uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded, bool texIsPalette);
|
||||||
static int GetDListLength(std::vector<uint8_t> rawData, int rawDataIndex);
|
static int GetDListLength(std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
|
||||||
std::vector<uint8_t> GetRawData();
|
std::vector<uint8_t> GetRawData();
|
||||||
int GetRawDataSize();
|
int GetRawDataSize();
|
||||||
std::string GetSourceOutputHeader(std::string prefix);
|
std::string GetSourceOutputHeader(const std::string& prefix);
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
void Save(std::string outFolder);
|
void Save(const std::string& outFolder);
|
||||||
virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile);
|
virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile);
|
||||||
};
|
};
|
|
@ -6,6 +6,8 @@
|
||||||
#include "ZAnimation.h"
|
#include "ZAnimation.h"
|
||||||
#include "ZSkeleton.h"
|
#include "ZSkeleton.h"
|
||||||
#include "ZCollision.h"
|
#include "ZCollision.h"
|
||||||
|
#include "ZScalar.h"
|
||||||
|
#include "ZVector.h"
|
||||||
#include "Path.h"
|
#include "Path.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Directory.h"
|
#include "Directory.h"
|
||||||
|
@ -50,6 +52,12 @@ ZFile::ZFile(ZFileMode mode, XMLElement* reader, string nBasePath, string nOutPa
|
||||||
ParseXML(mode, reader, placeholderMode);
|
ParseXML(mode, reader, placeholderMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZFile::~ZFile()
|
||||||
|
{
|
||||||
|
for (ZResource* res : resources)
|
||||||
|
delete res;
|
||||||
|
}
|
||||||
|
|
||||||
void ZFile::ParseXML(ZFileMode mode, XMLElement* reader, bool placeholderMode)
|
void ZFile::ParseXML(ZFileMode mode, XMLElement* reader, bool placeholderMode)
|
||||||
{
|
{
|
||||||
name = reader->Attribute("Name");
|
name = reader->Attribute("Name");
|
||||||
|
@ -90,6 +98,7 @@ void ZFile::ParseXML(ZFileMode mode, XMLElement* reader, bool placeholderMode)
|
||||||
if (child->Attribute("Offset") != NULL)
|
if (child->Attribute("Offset") != NULL)
|
||||||
rawDataIndex = strtol(StringHelper::Split(child->Attribute("Offset"), "0x")[1].c_str(), NULL, 16);
|
rawDataIndex = strtol(StringHelper::Split(child->Attribute("Offset"), "0x")[1].c_str(), NULL, 16);
|
||||||
|
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_INFO)
|
||||||
printf("%s: 0x%06X\n", child->Attribute("Name"), rawDataIndex);
|
printf("%s: 0x%06X\n", child->Attribute("Name"), rawDataIndex);
|
||||||
|
|
||||||
if (string(child->Name()) == "Texture")
|
if (string(child->Name()) == "Texture")
|
||||||
|
@ -239,25 +248,50 @@ void ZFile::ParseXML(ZFileMode mode, XMLElement* reader, bool placeholderMode)
|
||||||
|
|
||||||
resources.push_back(res);
|
resources.push_back(res);
|
||||||
}
|
}
|
||||||
else if (string(child->Name()) == "Vec3s")
|
else if (string(child->Name()) == "Scalar")
|
||||||
{
|
{
|
||||||
|
ZScalar* scalar = nullptr;
|
||||||
|
|
||||||
}
|
if (mode == ZFileMode::Extract)
|
||||||
else if (string(child->Name()) == "Vec3f")
|
scalar = ZScalar::ExtractFromXML(child, rawData, rawDataIndex, folderName);
|
||||||
{
|
|
||||||
|
if (scalar != nullptr)
|
||||||
}
|
|
||||||
else if (string(child->Name()) == "Vec3i")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (string(child->Name()) == "String")
|
|
||||||
{
|
{
|
||||||
|
scalar->parent = this;
|
||||||
|
resources.push_back(scalar);
|
||||||
|
|
||||||
|
rawDataIndex += scalar->GetRawDataSize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
|
printf("No ZScalar created!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (string(child->Name()) == "Vector")
|
||||||
|
{
|
||||||
|
ZVector* vector = nullptr;
|
||||||
|
|
||||||
|
if (mode == ZFileMode::Extract)
|
||||||
|
vector = ZVector::ExtractFromXML(child, rawData, rawDataIndex, folderName);
|
||||||
|
|
||||||
|
if (vector != nullptr)
|
||||||
|
{
|
||||||
|
vector->parent = this;
|
||||||
|
resources.push_back(vector);
|
||||||
|
|
||||||
|
rawDataIndex += vector->GetRawDataSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
|
printf("No ZVector created!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
|
printf("Encountered unknown resource type: %s\n", string(child->Name()).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,7 +362,9 @@ void ZFile::ExtractResources(string outputDir)
|
||||||
|
|
||||||
for (ZResource* res : resources)
|
for (ZResource* res : resources)
|
||||||
{
|
{
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_INFO)
|
||||||
printf("Saving resource %s\n", res->GetName().c_str());
|
printf("Saving resource %s\n", res->GetName().c_str());
|
||||||
|
|
||||||
res->CalcHash(); // TEST
|
res->CalcHash(); // TEST
|
||||||
res->Save(outputPath);
|
res->Save(outputPath);
|
||||||
}
|
}
|
||||||
|
@ -621,6 +657,7 @@ string ZFile::ProcessDeclarations()
|
||||||
|
|
||||||
// Account for padding/alignment
|
// Account for padding/alignment
|
||||||
int lastAddr = 0;
|
int lastAddr = 0;
|
||||||
|
int lastSize = 0;
|
||||||
|
|
||||||
//printf("RANGE START: 0x%06X - RANGE END: 0x%06X\n", rangeStart, rangeEnd);
|
//printf("RANGE START: 0x%06X - RANGE END: 0x%06X\n", rangeStart, rangeEnd);
|
||||||
|
|
||||||
|
@ -707,45 +744,47 @@ string ZFile::ProcessDeclarations()
|
||||||
|
|
||||||
// Handle unaccounted data
|
// Handle unaccounted data
|
||||||
lastAddr = 0;
|
lastAddr = 0;
|
||||||
|
lastSize = 0;
|
||||||
for (pair<int32_t, Declaration*> item : declarationKeysSorted)
|
for (pair<int32_t, Declaration*> item : declarationKeysSorted)
|
||||||
{
|
{
|
||||||
if (lastAddr != 0 && item.first >= rangeStart && item.first < rangeEnd)
|
if (item.first >= rangeStart && item.first < rangeEnd)
|
||||||
{
|
{
|
||||||
if (lastAddr + declarations[lastAddr]->size > item.first)
|
if (lastAddr != 0 && declarations.find(lastAddr) != declarations.end() && lastAddr + declarations[lastAddr]->size > item.first)
|
||||||
{
|
{
|
||||||
// UH OH!
|
printf("WARNING: Intersection detected from 0x%06X:0x%06X, conflicts with 0x%06X\n", lastAddr, lastAddr + declarations[lastAddr]->size, item.first);
|
||||||
int bp = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* rawDataArr = rawData.data();
|
uint8_t* rawDataArr = rawData.data();
|
||||||
|
|
||||||
if (lastAddr + declarations[lastAddr]->size != item.first)
|
if (lastAddr + lastSize != item.first)
|
||||||
{
|
{
|
||||||
int diff = item.first - (lastAddr + declarations[lastAddr]->size);
|
//int diff = item.first - (lastAddr + declarations[lastAddr]->size);
|
||||||
|
int diff = item.first - (lastAddr + lastSize);
|
||||||
|
|
||||||
string src = " ";
|
string src = " ";
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < diff; i++)
|
for (int i = 0; i < diff; i++)
|
||||||
{
|
{
|
||||||
src += StringHelper::Sprintf("0x%02X, ", rawDataArr[lastAddr + declarations[lastAddr]->size + i]);
|
//src += StringHelper::Sprintf("0x%02X, ", rawDataArr[lastAddr + declarations[lastAddr]->size + i]);
|
||||||
|
src += StringHelper::Sprintf("0x%02X, ", rawDataArr[lastAddr + lastSize + i]);
|
||||||
|
|
||||||
if ((i % 16 == 15) && (i != (diff - 1)))
|
if ((i % 16 == 15) && (i != (diff - 1)))
|
||||||
src += "\n ";
|
src += "\n ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (declarations.find(lastAddr + declarations[lastAddr]->size) == declarations.end())
|
if (declarations.find(lastAddr + lastSize) == declarations.end())
|
||||||
{
|
{
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
{
|
{
|
||||||
AddDeclarationArray(lastAddr + declarations[lastAddr]->size, DeclarationAlignment::None, diff, "static u8", StringHelper::Sprintf("unaccounted_%06X", lastAddr + declarations[lastAddr]->size),
|
//AddDeclarationArray(lastAddr + declarations[lastAddr]->size, DeclarationAlignment::None, diff, "static u8", StringHelper::Sprintf("unaccounted_%06X", lastAddr + declarations[lastAddr]->size), diff, src);
|
||||||
diff, src);
|
AddDeclarationArray(lastAddr + lastSize, DeclarationAlignment::None, diff, "static u8", StringHelper::Sprintf("unaccounted_%06X", lastAddr + lastSize), diff, src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAddr = item.first;
|
lastAddr = item.first;
|
||||||
|
lastSize = item.second->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: THIS CONTAINS REDUNDANCIES. CLEAN THIS UP!
|
// TODO: THIS CONTAINS REDUNDANCIES. CLEAN THIS UP!
|
||||||
|
@ -780,6 +819,30 @@ string ZFile::ProcessDeclarations()
|
||||||
return lhs.first < rhs.first;
|
return lhs.first < rhs.first;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// First, handle the prototypes (static only for now)
|
||||||
|
int protoCnt = 0;
|
||||||
|
for (pair<int32_t, Declaration*> item : declarationKeysSorted)
|
||||||
|
{
|
||||||
|
if (item.second->includePath == "" && StringHelper::StartsWith(item.second->varType, "static ") && !StringHelper::StartsWith(item.second->varName, "unaccounted_"))
|
||||||
|
{
|
||||||
|
if (item.second->isArray)
|
||||||
|
{
|
||||||
|
if (item.second->arrayItemCnt == 0)
|
||||||
|
output += StringHelper::Sprintf("%s %s[];\n", item.second->varType.c_str(), item.second->varName.c_str());
|
||||||
|
else
|
||||||
|
output += StringHelper::Sprintf("%s %s[%i];\n", item.second->varType.c_str(), item.second->varName.c_str(), item.second->arrayItemCnt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
output += StringHelper::Sprintf("%s %s;\n", item.second->varType.c_str(), item.second->varName.c_str());
|
||||||
|
|
||||||
|
protoCnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protoCnt > 0)
|
||||||
|
output += "\n";
|
||||||
|
|
||||||
|
// Next, output the actual declarations
|
||||||
for (pair<int32_t, Declaration*> item : declarationKeysSorted)
|
for (pair<int32_t, Declaration*> item : declarationKeysSorted)
|
||||||
{
|
{
|
||||||
if (item.second->includePath != "")
|
if (item.second->includePath != "")
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
|
|
||||||
ZFile(std::string nOutPath, std::string nName);
|
ZFile(std::string nOutPath, std::string nName);
|
||||||
ZFile(ZFileMode mode, tinyxml2::XMLElement* reader, std::string nBasePath, std::string nOutPath, bool placeholderMode);
|
ZFile(ZFileMode mode, tinyxml2::XMLElement* reader, std::string nBasePath, std::string nOutPath, bool placeholderMode);
|
||||||
|
~ZFile();
|
||||||
|
|
||||||
std::string GetVarName(int address);
|
std::string GetVarName(int address);
|
||||||
void ExtractResources(std::string outputDir);
|
void ExtractResources(std::string outputDir);
|
||||||
|
|
|
@ -25,7 +25,7 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader)
|
||||||
outName = name;
|
outName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZResource::Save(string outFolder)
|
void ZResource::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ std::string ZResource::GetOutName()
|
||||||
|
|
||||||
void ZResource::SetName(string nName)
|
void ZResource::SetName(string nName)
|
||||||
{
|
{
|
||||||
name = nName;
|
name = std::move(nName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZResource::IsExternalResource()
|
bool ZResource::IsExternalResource()
|
||||||
|
@ -84,12 +84,12 @@ void ZResource::SetRawDataIndex(int value)
|
||||||
rawDataIndex = value;
|
rawDataIndex = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZResource::GetSourceOutputCode(std::string prefix)
|
string ZResource::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZResource::GetSourceOutputHeader(std::string prefix)
|
string ZResource::GetSourceOutputHeader(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,9 @@ enum class ZResourceType
|
||||||
Cutscene,
|
Cutscene,
|
||||||
Blob,
|
Blob,
|
||||||
Limb,
|
Limb,
|
||||||
Skeleton
|
Skeleton,
|
||||||
|
Scalar,
|
||||||
|
Vector
|
||||||
};
|
};
|
||||||
|
|
||||||
class ZResource
|
class ZResource
|
||||||
|
@ -45,7 +47,7 @@ public:
|
||||||
|
|
||||||
ZResource();
|
ZResource();
|
||||||
virtual void ParseXML(tinyxml2::XMLElement* reader);
|
virtual void ParseXML(tinyxml2::XMLElement* reader);
|
||||||
virtual void Save(std::string outFolder);
|
virtual void Save(const std::string& outFolder);
|
||||||
virtual void PreGenSourceFiles();
|
virtual void PreGenSourceFiles();
|
||||||
std::string GetName();
|
std::string GetName();
|
||||||
std::string GetOutName();
|
std::string GetOutName();
|
||||||
|
@ -57,8 +59,8 @@ public:
|
||||||
virtual int GetRawDataIndex();
|
virtual int GetRawDataIndex();
|
||||||
virtual int GetRawDataSize();
|
virtual int GetRawDataSize();
|
||||||
virtual void SetRawDataIndex(int value);
|
virtual void SetRawDataIndex(int value);
|
||||||
virtual std::string GetSourceOutputCode(std::string prefix);
|
virtual std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
virtual std::string GetSourceOutputHeader(std::string prefix);
|
virtual std::string GetSourceOutputHeader(const std::string& prefix);
|
||||||
virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile);
|
virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile);
|
||||||
virtual ZResourceType GetResourceType();
|
virtual ZResourceType GetResourceType();
|
||||||
virtual void CalcHash();
|
virtual void CalcHash();
|
||||||
|
|
|
@ -19,6 +19,14 @@ SetActorList::SetActorList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawD
|
||||||
zRoom->parent->AddDeclarationPlaceholder(segmentOffset);
|
zRoom->parent->AddDeclarationPlaceholder(segmentOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetActorList::~SetActorList()
|
||||||
|
{
|
||||||
|
for (ActorSpawnEntry* entry : actors)
|
||||||
|
delete entry;
|
||||||
|
|
||||||
|
actors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
string SetActorList::GetSourceOutputCode(std::string prefix)
|
string SetActorList::GetSourceOutputCode(std::string prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
|
@ -94,7 +102,7 @@ RoomCommand SetActorList::GetRoomCommand()
|
||||||
|
|
||||||
ActorSpawnEntry::ActorSpawnEntry(std::vector<uint8_t> rawData, int rawDataIndex)
|
ActorSpawnEntry::ActorSpawnEntry(std::vector<uint8_t> rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
actorNum = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
actorNum = BitConverter::ToInt16BE(data, rawDataIndex + 0);
|
||||||
posX = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
posX = BitConverter::ToInt16BE(data, rawDataIndex + 2);
|
||||||
|
|
|
@ -21,6 +21,7 @@ class SetActorList : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetActorList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetActorList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetActorList();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(std::string prefix);
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -44,8 +44,8 @@ string SetAlternateHeaders::GenerateSourceCodePass1(string roomName, int baseAdd
|
||||||
declaration += StringHelper::Sprintf("\t(u32)&%sSet%04XCmd00,\n", roomName.c_str(), headers[i] & 0x00FFFFFF);
|
declaration += StringHelper::Sprintf("\t(u32)&%sSet%04XCmd00,\n", roomName.c_str(), headers[i] & 0x00FFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
zRoom->parent->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, headers.size() * 4,
|
zRoom->parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::None, headers.size() * 4,
|
||||||
"u32", StringHelper::Sprintf("%sAlternateHeaders0x%06X", roomName.c_str(), segmentOffset), true, declaration);
|
"u32", StringHelper::Sprintf("%sAlternateHeaders0x%06X", roomName.c_str(), segmentOffset), 0, declaration);
|
||||||
|
|
||||||
return sourceOutput;
|
return sourceOutput;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,15 @@ SetCutscenes::SetCutscenes(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawD
|
||||||
StringHelper::Sprintf("%sCutsceneData0x%06X", zRoom->GetName().c_str(), segmentOffset), 0, output);
|
StringHelper::Sprintf("%sCutsceneData0x%06X", zRoom->GetName().c_str(), segmentOffset), 0, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetCutscenes::~SetCutscenes()
|
||||||
|
{
|
||||||
|
if (cutscene != nullptr)
|
||||||
|
{
|
||||||
|
delete cutscene;
|
||||||
|
cutscene = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string SetCutscenes::GenerateSourceCodePass1(string roomName, int baseAddress)
|
string SetCutscenes::GenerateSourceCodePass1(string roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
return StringHelper::Sprintf("%s 0, (u32)%sCutsceneData0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), zRoom->GetName().c_str(), segmentOffset);
|
return StringHelper::Sprintf("%s 0, (u32)%sCutsceneData0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), zRoom->GetName().c_str(), segmentOffset);
|
||||||
|
|
|
@ -7,6 +7,7 @@ class SetCutscenes : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetCutscenes(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetCutscenes(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetCutscenes();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(std::string prefix);
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -16,6 +16,12 @@ SetEntranceList::SetEntranceList(ZRoom* nZRoom, std::vector<uint8_t> rawData, in
|
||||||
_rawDataIndex = rawDataIndex;
|
_rawDataIndex = rawDataIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetEntranceList::~SetEntranceList()
|
||||||
|
{
|
||||||
|
for (EntranceEntry* entry : entrances)
|
||||||
|
delete entry;
|
||||||
|
}
|
||||||
|
|
||||||
string SetEntranceList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
string SetEntranceList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string sourceOutput = StringHelper::Sprintf("%s 0x00, (u32)&%sEntranceList0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), zRoom->GetName().c_str(), segmentOffset);
|
string sourceOutput = StringHelper::Sprintf("%s 0x00, (u32)&%sEntranceList0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), zRoom->GetName().c_str(), segmentOffset);
|
||||||
|
|
|
@ -15,6 +15,7 @@ class SetEntranceList : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetEntranceList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetEntranceList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetEntranceList();
|
||||||
|
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
virtual std::string GenerateExterns();
|
virtual std::string GenerateExterns();
|
||||||
|
|
|
@ -35,6 +35,12 @@ SetLightingSettings::SetLightingSettings(ZRoom* nZRoom, std::vector<uint8_t> raw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetLightingSettings::~SetLightingSettings()
|
||||||
|
{
|
||||||
|
for (LightingSettings* setting : settings)
|
||||||
|
delete setting;
|
||||||
|
}
|
||||||
|
|
||||||
string SetLightingSettings::GenerateSourceCodePass1(string roomName, int baseAddress)
|
string SetLightingSettings::GenerateSourceCodePass1(string roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
return StringHelper::Sprintf("%s %i, (u32)&%sLightSettings0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), settings.size(), zRoom->GetName().c_str(), segmentOffset);
|
return StringHelper::Sprintf("%s %i, (u32)&%sLightSettings0x%06X", ZRoomCommand::GenerateSourceCodePass1(roomName, baseAddress).c_str(), settings.size(), zRoom->GetName().c_str(), segmentOffset);
|
||||||
|
@ -62,7 +68,7 @@ RoomCommand SetLightingSettings::GetRoomCommand()
|
||||||
|
|
||||||
LightingSettings::LightingSettings(vector<uint8_t> rawData, int rawDataIndex)
|
LightingSettings::LightingSettings(vector<uint8_t> rawData, int rawDataIndex)
|
||||||
{
|
{
|
||||||
uint8_t* data = rawData.data();
|
const uint8_t* data = rawData.data();
|
||||||
|
|
||||||
ambientClrR = data[rawDataIndex + 0];
|
ambientClrR = data[rawDataIndex + 0];
|
||||||
ambientClrG = data[rawDataIndex + 1];
|
ambientClrG = data[rawDataIndex + 1];
|
||||||
|
|
|
@ -21,6 +21,7 @@ class SetLightingSettings : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetLightingSettings(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetLightingSettings(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetLightingSettings();
|
||||||
|
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -109,8 +109,6 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
||||||
zRoom->parent->AddDeclaration(meshHeader0->dListStart + (meshHeader0->entries.size() * 8) + 0, DeclarationAlignment::None, DeclarationPadding::Pad16, 4, "static s32",
|
zRoom->parent->AddDeclaration(meshHeader0->dListStart + (meshHeader0->entries.size() * 8) + 0, DeclarationAlignment::None, DeclarationPadding::Pad16, 4, "static s32",
|
||||||
"terminatorMaybe", " 0x01000000 ");
|
"terminatorMaybe", " 0x01000000 ");
|
||||||
|
|
||||||
//zRoom->parent->declarations[meshHeader0->dListStart] = new Declaration(DeclarationAlignment::None, DeclarationPadding::Pad16, (meshHeader0->entries.size() * 8) + 4, declaration);
|
|
||||||
|
|
||||||
meshHeader = meshHeader0;
|
meshHeader = meshHeader0;
|
||||||
}
|
}
|
||||||
else if (meshHeaderType == 1)
|
else if (meshHeaderType == 1)
|
||||||
|
@ -146,11 +144,6 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
||||||
zRoom->parent->AddDeclaration(segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, 0x1E, "MeshHeader1Single",
|
zRoom->parent->AddDeclaration(segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, 0x1E, "MeshHeader1Single",
|
||||||
StringHelper::Sprintf("%sMeshHeader0x%06X", zRoom->GetName().c_str(), segmentOffset), declaration);
|
StringHelper::Sprintf("%sMeshHeader0x%06X", zRoom->GetName().c_str(), segmentOffset), declaration);
|
||||||
|
|
||||||
//if (headerSingle->imagePtr != 0)
|
|
||||||
//{
|
|
||||||
//zRoom->declarations[headerSingle->imagePtr] = new Declaration(DeclarationAlignment::None, DeclarationPadding::Pad16, 0x1E, declaration);
|
|
||||||
//}
|
|
||||||
|
|
||||||
meshHeader1 = headerSingle;
|
meshHeader1 = headerSingle;
|
||||||
; }
|
; }
|
||||||
else if (fmt == 2) // Multi-Format
|
else if (fmt == 2) // Multi-Format
|
||||||
|
@ -164,21 +157,18 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
||||||
headerMulti->bgCnt = rawData[segmentOffset + 8];
|
headerMulti->bgCnt = rawData[segmentOffset + 8];
|
||||||
headerMulti->bgRecordPtr = BitConverter::ToInt32BE(rawData, segmentOffset + 12);
|
headerMulti->bgRecordPtr = BitConverter::ToInt32BE(rawData, segmentOffset + 12);
|
||||||
|
|
||||||
//zRoom->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, DeclarationPadding::Pad16, 12, "");
|
|
||||||
|
|
||||||
declaration += StringHelper::Sprintf("{ { 1 }, 2, 0x%06X }, 0x%06X, 0x%06X",
|
declaration += StringHelper::Sprintf("{ { 1 }, 2, 0x%06X }, 0x%06X, 0x%06X",
|
||||||
headerMulti->entryRecord, headerMulti->bgCnt, headerMulti->bgRecordPtr);
|
headerMulti->entryRecord, headerMulti->bgCnt, headerMulti->bgRecordPtr);
|
||||||
|
|
||||||
zRoom->parent->AddDeclaration(segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, 16, "MeshHeader1Multi",
|
zRoom->parent->AddDeclaration(segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, 16, "MeshHeader1Multi",
|
||||||
StringHelper::Sprintf("%sMeshHeader0x%06X", zRoom->GetName().c_str(), segmentOffset), declaration);
|
StringHelper::Sprintf("%sMeshHeader0x%06X", zRoom->GetName().c_str(), segmentOffset), declaration);
|
||||||
|
|
||||||
//zRoom->parent->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, DeclarationPadding::Pad16, 16, declaration);
|
|
||||||
|
|
||||||
meshHeader1 = headerMulti;
|
meshHeader1 = headerMulti;
|
||||||
}
|
}
|
||||||
else // UH OH
|
else // UH OH
|
||||||
{
|
{
|
||||||
int bp = 0;
|
if (Globals::Instance->verbosity >= VERBOSITY_INFO)
|
||||||
|
printf("WARNING: MeshHeader FMT %i not implemented!\n", fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
meshHeader1->headerType = 1;
|
meshHeader1->headerType = 1;
|
||||||
|
@ -290,6 +280,15 @@ SetMesh::SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetMesh::~SetMesh()
|
||||||
|
{
|
||||||
|
if (meshHeader != nullptr)
|
||||||
|
{
|
||||||
|
delete meshHeader;
|
||||||
|
meshHeader = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SetMesh::GenDListDeclarations(std::vector<uint8_t> rawData, ZDisplayList* dList)
|
void SetMesh::GenDListDeclarations(std::vector<uint8_t> rawData, ZDisplayList* dList)
|
||||||
{
|
{
|
||||||
string sourceOutput = dList->GetSourceOutputCode(zRoom->GetName()); // HOTSPOT
|
string sourceOutput = dList->GetSourceOutputCode(zRoom->GetName()); // HOTSPOT
|
||||||
|
@ -301,15 +300,15 @@ void SetMesh::GenDListDeclarations(std::vector<uint8_t> rawData, ZDisplayList* d
|
||||||
else
|
else
|
||||||
srcVarName = StringHelper::Sprintf("%s", dList->GetName().c_str());
|
srcVarName = StringHelper::Sprintf("%s", dList->GetName().c_str());
|
||||||
|
|
||||||
zRoom->parent->AddDeclarationArray(dList->GetRawDataIndex(), DeclarationAlignment::None, dList->GetRawDataSize(), "Gfx", srcVarName, 0, sourceOutput);
|
zRoom->parent->AddDeclarationArray(dList->GetRawDataIndex(), DeclarationAlignment::None, dList->GetRawDataSize(), "static Gfx", srcVarName, dList->GetRawDataSize() / 8, sourceOutput);
|
||||||
|
|
||||||
for (ZDisplayList* otherDList : dList->otherDLists)
|
for (ZDisplayList* otherDList : dList->otherDLists)
|
||||||
GenDListDeclarations(rawData, otherDList);
|
GenDListDeclarations(rawData, otherDList);
|
||||||
|
|
||||||
for (pair<uint32_t, string> vtxEntry : dList->vtxDeclarations)
|
for (pair<uint32_t, string> vtxEntry : dList->vtxDeclarations)
|
||||||
{
|
{
|
||||||
zRoom->parent->AddDeclarationArray(vtxEntry.first, DeclarationAlignment::Align8, dList->vertices[vtxEntry.first].size() * 16, "Vtx",
|
zRoom->parent->AddDeclarationArray(vtxEntry.first, DeclarationAlignment::Align8, dList->vertices[vtxEntry.first].size() * 16, "static Vtx",
|
||||||
StringHelper::Sprintf("%sVtx_%06X", zRoom->GetName().c_str(), vtxEntry.first), 0, vtxEntry.second);
|
StringHelper::Sprintf("%sVtx_%06X", zRoom->GetName().c_str(), vtxEntry.first), dList->vertices[vtxEntry.first].size(), vtxEntry.second);
|
||||||
|
|
||||||
//zRoom->parent->declarations[vtxEntry.first] = new Declaration(DeclarationAlignment::Align8, dList->vertices[vtxEntry.first].size() * 16, vtxEntry.second);
|
//zRoom->parent->declarations[vtxEntry.first] = new Declaration(DeclarationAlignment::Align8, dList->vertices[vtxEntry.first].size() * 16, vtxEntry.second);
|
||||||
}
|
}
|
||||||
|
@ -318,10 +317,7 @@ void SetMesh::GenDListDeclarations(std::vector<uint8_t> rawData, ZDisplayList* d
|
||||||
{
|
{
|
||||||
zRoom->textures[texEntry.first] = dList->textures[texEntry.first];
|
zRoom->textures[texEntry.first] = dList->textures[texEntry.first];
|
||||||
|
|
||||||
//zRoom->parent->AddDeclarationArray(texEntry.first, DeclarationAlignment::None, dList->textures[texEntry.first]->GetRawDataSize(), "u64",
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
//zRoom->textures[texEntry.first]->GetName(), 0, texEntry.second);
|
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
|
||||||
printf("SAVING IMAGE TO %s\n", Globals::Instance->outputPath.c_str());
|
printf("SAVING IMAGE TO %s\n", Globals::Instance->outputPath.c_str());
|
||||||
|
|
||||||
zRoom->textures[texEntry.first]->Save(Globals::Instance->outputPath);
|
zRoom->textures[texEntry.first]->Save(Globals::Instance->outputPath);
|
||||||
|
@ -344,8 +340,8 @@ std::string SetMesh::GenDListExterns(ZDisplayList* dList)
|
||||||
for (ZDisplayList* otherDList : dList->otherDLists)
|
for (ZDisplayList* otherDList : dList->otherDLists)
|
||||||
sourceOutput += GenDListExterns(otherDList);
|
sourceOutput += GenDListExterns(otherDList);
|
||||||
|
|
||||||
for (pair<uint32_t, string> vtxEntry : dList->vtxDeclarations)
|
//for (pair<uint32_t, string> vtxEntry : dList->vtxDeclarations)
|
||||||
sourceOutput += StringHelper::Sprintf("extern Vtx %sVtx_%06X[%i];\n", zRoom->GetName().c_str(), vtxEntry.first, dList->vertices[vtxEntry.first].size());
|
//sourceOutput += StringHelper::Sprintf("extern Vtx %sVtx_%06X[%i];\n", zRoom->GetName().c_str(), vtxEntry.first, dList->vertices[vtxEntry.first].size());
|
||||||
|
|
||||||
for (pair<uint32_t, string> texEntry : dList->texDeclarations)
|
for (pair<uint32_t, string> texEntry : dList->texDeclarations)
|
||||||
sourceOutput += StringHelper::Sprintf("extern u64 %sTex_%06X[];\n", zRoom->GetName().c_str(), texEntry.first);
|
sourceOutput += StringHelper::Sprintf("extern u64 %sTex_%06X[];\n", zRoom->GetName().c_str(), texEntry.first);
|
||||||
|
|
|
@ -102,6 +102,7 @@ class SetMesh : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, int segAddressOffset);
|
SetMesh(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex, int segAddressOffset);
|
||||||
|
~SetMesh();
|
||||||
|
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
//virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
//virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -19,10 +19,13 @@ SetPathways::SetPathways(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDat
|
||||||
uint32_t currentPtr = listSegmentOffset;
|
uint32_t currentPtr = listSegmentOffset;
|
||||||
|
|
||||||
if (segmentOffset != 0)
|
if (segmentOffset != 0)
|
||||||
zRoom->parent->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, 0, "", "", false, "");
|
zRoom->parent->AddDeclarationPlaceholder(segmentOffset);
|
||||||
|
}
|
||||||
|
|
||||||
//if (listSegmentOffset != 0)
|
SetPathways::~SetPathways()
|
||||||
//zRoom->declarations[listSegmentOffset] = new Declaration(DeclarationAlignment::None, 0, "");
|
{
|
||||||
|
for (PathwayEntry* entry : pathways)
|
||||||
|
delete entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPathways::InitList(uint32_t address)
|
void SetPathways::InitList(uint32_t address)
|
||||||
|
|
|
@ -13,6 +13,7 @@ class SetPathways : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetPathways(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetPathways(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetPathways();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(std::string prefix);
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -23,19 +23,12 @@ SetRoomList::SetRoomList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDat
|
||||||
|
|
||||||
currentPtr += 8;
|
currentPtr += 8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//string declaration = "";
|
SetRoomList::~SetRoomList()
|
||||||
|
{
|
||||||
/*for (int i = 0; i < rooms.size(); i++)
|
for (RoomEntry* entry : rooms)
|
||||||
{
|
delete entry;
|
||||||
RoomEntry* entry = rooms[i];
|
|
||||||
|
|
||||||
string roomName = StringHelper::Sprintf("%sRoom%i", StringHelper::Split(zRoom->GetName(), "_scene")[0].c_str(), i);
|
|
||||||
declaration += StringHelper::Sprintf("\t{ (u32)%sSegmentRomStart, (u32)%sSegmentRomEnd },\n", roomName.c_str(), roomName.c_str());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//zRoom->parent->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, rooms.size() * 8,
|
|
||||||
//"RomFile", StringHelper::Sprintf("%sRoomList0x%06X", zRoom->GetName().c_str(), segmentOffset), true, declaration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string SetRoomList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
string SetRoomList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
||||||
|
@ -79,8 +72,8 @@ std::string SetRoomList::PreGenSourceFiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zRoom->parent->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, rooms.size() * 8,
|
zRoom->parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::None, rooms.size() * 8,
|
||||||
"RomFile", StringHelper::Sprintf("%sRoomList0x%06X", zRoom->GetName().c_str(), segmentOffset), true, declaration);
|
"RomFile", StringHelper::Sprintf("%sRoomList0x%06X", zRoom->GetName().c_str(), segmentOffset), 0, declaration);
|
||||||
|
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ class SetRoomList : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetRoomList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetRoomList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetRoomList();
|
||||||
|
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -26,6 +26,12 @@ SetStartPositionList::SetStartPositionList(ZRoom* nZRoom, std::vector<uint8_t> r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetStartPositionList::~SetStartPositionList()
|
||||||
|
{
|
||||||
|
for (ActorSpawnEntry* entry : actors)
|
||||||
|
delete entry;
|
||||||
|
}
|
||||||
|
|
||||||
string SetStartPositionList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
string SetStartPositionList::GenerateSourceCodePass1(string roomName, int baseAddress)
|
||||||
{
|
{
|
||||||
string sourceOutput = "";
|
string sourceOutput = "";
|
||||||
|
|
|
@ -10,6 +10,7 @@ public:
|
||||||
std::vector<ActorSpawnEntry*> actors;
|
std::vector<ActorSpawnEntry*> actors;
|
||||||
|
|
||||||
SetStartPositionList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetStartPositionList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetStartPositionList();
|
||||||
|
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass2(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -25,6 +25,12 @@ SetTransitionActorList::SetTransitionActorList(ZRoom* nZRoom, std::vector<uint8_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetTransitionActorList::~SetTransitionActorList()
|
||||||
|
{
|
||||||
|
for (TransitionActorEntry* actor : transitionActors)
|
||||||
|
delete actor;
|
||||||
|
}
|
||||||
|
|
||||||
string SetTransitionActorList::GetSourceOutputCode(std::string prefix)
|
string SetTransitionActorList::GetSourceOutputCode(std::string prefix)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
|
@ -38,8 +44,8 @@ string SetTransitionActorList::GenerateSourceCodePass1(string roomName, int base
|
||||||
for (TransitionActorEntry* entry : transitionActors)
|
for (TransitionActorEntry* entry : transitionActors)
|
||||||
declaration += StringHelper::Sprintf("\t{ %i, %i, %i, %i, %s, %i, %i, %i, %i, 0x%04X }, \n", entry->frontObjectRoom, entry->frontTransitionReaction, entry->backObjectRoom, entry->backTransitionReaction, ActorList[entry->actorNum].c_str(), entry->posX, entry->posY, entry->posZ, entry->rotY, (uint16_t)entry->initVar);
|
declaration += StringHelper::Sprintf("\t{ %i, %i, %i, %i, %s, %i, %i, %i, %i, 0x%04X }, \n", entry->frontObjectRoom, entry->frontTransitionReaction, entry->backObjectRoom, entry->backTransitionReaction, ActorList[entry->actorNum].c_str(), entry->posX, entry->posY, entry->posZ, entry->rotY, (uint16_t)entry->initVar);
|
||||||
|
|
||||||
zRoom->parent->declarations[segmentOffset] = new Declaration(DeclarationAlignment::None, transitionActors.size() * 16, "TransitionActorEntry",
|
zRoom->parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::None, transitionActors.size() * 16, "TransitionActorEntry",
|
||||||
StringHelper::Sprintf("%sTransitionActorList0x%06X", roomName.c_str(), segmentOffset), true, declaration);
|
StringHelper::Sprintf("%sTransitionActorList0x%06X", roomName.c_str(), segmentOffset), 0, declaration);
|
||||||
|
|
||||||
return sourceOutput;
|
return sourceOutput;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ class SetTransitionActorList : public ZRoomCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SetTransitionActorList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
SetTransitionActorList(ZRoom* nZRoom, std::vector<uint8_t> rawData, int rawDataIndex);
|
||||||
|
~SetTransitionActorList();
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(std::string prefix);
|
||||||
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
virtual std::string GenerateSourceCodePass1(std::string roomName, int baseAddress);
|
||||||
|
|
|
@ -48,6 +48,12 @@ ZRoom::ZRoom() : ZResource()
|
||||||
scene = nullptr;
|
scene = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZRoom::~ZRoom()
|
||||||
|
{
|
||||||
|
for (ZRoomCommand* cmd : commands)
|
||||||
|
delete cmd;
|
||||||
|
}
|
||||||
|
|
||||||
ZRoom* ZRoom::ExtractFromXML(XMLElement* reader, vector<uint8_t> nRawData, int rawDataIndex, string nRelPath, ZFile* nParent, ZRoom* nScene)
|
ZRoom* ZRoom::ExtractFromXML(XMLElement* reader, vector<uint8_t> nRawData, int rawDataIndex, string nRelPath, ZFile* nParent, ZRoom* nScene)
|
||||||
{
|
{
|
||||||
ZRoom* room = new ZRoom();
|
ZRoom* room = new ZRoom();
|
||||||
|
@ -86,10 +92,8 @@ ZRoom* ZRoom::ExtractFromXML(XMLElement* reader, vector<uint8_t> nRawData, int r
|
||||||
int address = strtol(StringHelper::Split(addressStr, "0x")[1].c_str(), NULL, 16);
|
int address = strtol(StringHelper::Split(addressStr, "0x")[1].c_str(), NULL, 16);
|
||||||
|
|
||||||
ZDisplayList* dList = new ZDisplayList(room->rawData, address, ZDisplayList::GetDListLength(room->rawData, address));
|
ZDisplayList* dList = new ZDisplayList(room->rawData, address, ZDisplayList::GetDListLength(room->rawData, address));
|
||||||
//room->parent->declarations[address] = new Declaration(DeclarationAlignment::None, dList->GetRawDataSize(), comment + dList->GetSourceOutputCode(room->name));
|
|
||||||
//room->parent->AddDeclarationArray(address, DeclarationAlignment::None, dList->GetRawDataSize(), "Gfx", "", 0, comment + dList->GetSourceOutputCode(room->name));
|
|
||||||
|
|
||||||
dList->GetSourceOutputCode(room->name);
|
dList->GetSourceOutputCode(room->name);
|
||||||
|
delete dList;
|
||||||
}
|
}
|
||||||
else if (string(child->Name()) == "BlobHint")
|
else if (string(child->Name()) == "BlobHint")
|
||||||
{
|
{
|
||||||
|
@ -280,7 +284,7 @@ void ZRoom::ProcessCommandSets()
|
||||||
cmd->commandSet = commandSet & 0x00FFFFFF;
|
cmd->commandSet = commandSet & 0x00FFFFFF;
|
||||||
string pass1 = cmd->GenerateSourceCodePass1(name, cmd->commandSet);
|
string pass1 = cmd->GenerateSourceCodePass1(name, cmd->commandSet);
|
||||||
|
|
||||||
Declaration* decl = parent->AddDeclaration(cmd->cmdAddress, i == 0 ? DeclarationAlignment::Align16 : DeclarationAlignment::None, 8, cmd->GetCommandCName(),
|
Declaration* decl = parent->AddDeclaration(cmd->cmdAddress, i == 0 ? DeclarationAlignment::Align16 : DeclarationAlignment::None, 8, StringHelper::Sprintf("static %s", cmd->GetCommandCName().c_str()),
|
||||||
StringHelper::Sprintf("%sSet%04XCmd%02X", name.c_str(), commandSet & 0x00FFFFFF, cmd->cmdIndex, cmd->cmdID),
|
StringHelper::Sprintf("%sSet%04XCmd%02X", name.c_str(), commandSet & 0x00FFFFFF, cmd->cmdIndex, cmd->cmdID),
|
||||||
StringHelper::Sprintf("%s", pass1.c_str()));
|
StringHelper::Sprintf("%s", pass1.c_str()));
|
||||||
|
|
||||||
|
@ -298,7 +302,7 @@ void ZRoom::ProcessCommandSets()
|
||||||
string pass2 = cmd->GenerateSourceCodePass2(name, cmd->commandSet);
|
string pass2 = cmd->GenerateSourceCodePass2(name, cmd->commandSet);
|
||||||
|
|
||||||
if (pass2 != "")
|
if (pass2 != "")
|
||||||
parent->AddDeclaration(cmd->cmdAddress, DeclarationAlignment::None, 8, cmd->GetCommandCName(), StringHelper::Sprintf("%sSet%04XCmd%02X", name.c_str(), cmd->commandSet & 0x00FFFFFF, cmd->cmdIndex, cmd->cmdID), StringHelper::Sprintf("%s // 0x%04X", pass2.c_str(), cmd->cmdAddress));
|
parent->AddDeclaration(cmd->cmdAddress, DeclarationAlignment::None, 8, StringHelper::Sprintf("static %s", cmd->GetCommandCName().c_str()), StringHelper::Sprintf("%sSet%04XCmd%02X", name.c_str(), cmd->commandSet & 0x00FFFFFF, cmd->cmdIndex, cmd->cmdID), StringHelper::Sprintf("%s // 0x%04X", pass2.c_str(), cmd->cmdAddress));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +396,7 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZRoom::GetSourceOutputHeader(string prefix)
|
string ZRoom::GetSourceOutputHeader(const std::string& prefix)
|
||||||
{
|
{
|
||||||
sourceOutput = "";
|
sourceOutput = "";
|
||||||
|
|
||||||
|
@ -407,7 +411,7 @@ string ZRoom::GetSourceOutputHeader(string prefix)
|
||||||
return sourceOutput;
|
return sourceOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZRoom::GetSourceOutputCode(std::string prefix)
|
string ZRoom::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
sourceOutput = "";
|
sourceOutput = "";
|
||||||
|
|
||||||
|
@ -466,7 +470,7 @@ string ZRoom::GetSourceOutputCode(std::string prefix)
|
||||||
|
|
||||||
declaration += item.second->GetSourceOutputCode(prefix);
|
declaration += item.second->GetSourceOutputCode(prefix);
|
||||||
|
|
||||||
if (Globals::Instance->debugMessages)
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
printf("SAVING IMAGE TO %s\n", Globals::Instance->outputPath.c_str());
|
printf("SAVING IMAGE TO %s\n", Globals::Instance->outputPath.c_str());
|
||||||
|
|
||||||
item.second->Save(Globals::Instance->outputPath);
|
item.second->Save(Globals::Instance->outputPath);
|
||||||
|
@ -501,7 +505,7 @@ ZResourceType ZRoom::GetResourceType()
|
||||||
return ZResourceType::Room;
|
return ZResourceType::Room;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZRoom::Save(string outFolder)
|
void ZRoom::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
for (ZRoomCommand* cmd : commands)
|
for (ZRoomCommand* cmd : commands)
|
||||||
cmd->Save();
|
cmd->Save();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../ZResource.h"
|
#include "../ZResource.h"
|
||||||
#include "ZRoomCommand.h"
|
#include "ZRoomCommand.h"
|
||||||
#include "ZTexture.h"
|
#include "ZTexture.h"
|
||||||
#include "../tinyxml2.h"
|
#include <tinyxml2.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -14,12 +14,13 @@ class ZRoom : public ZResource
|
||||||
protected:
|
protected:
|
||||||
std::vector<ZRoomCommand*> commands;
|
std::vector<ZRoomCommand*> commands;
|
||||||
|
|
||||||
std::string GetSourceOutputHeader(std::string prefix);
|
std::string GetSourceOutputHeader(const std::string& prefix);
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
void ProcessCommandSets();
|
void ProcessCommandSets();
|
||||||
void SyotesRoomHack();
|
void SyotesRoomHack();
|
||||||
|
|
||||||
ZRoom();
|
ZRoom();
|
||||||
|
~ZRoom();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZRoom* scene;
|
ZRoom* scene;
|
||||||
|
@ -36,7 +37,7 @@ public:
|
||||||
std::vector<uint8_t> GetRawData();
|
std::vector<uint8_t> GetRawData();
|
||||||
int GetRawDataSize();
|
int GetRawDataSize();
|
||||||
virtual ZResourceType GetResourceType();
|
virtual ZResourceType GetResourceType();
|
||||||
virtual void Save(std::string outFolder);
|
virtual void Save(const std::string& outFolder);
|
||||||
virtual void PreGenSourceFiles();
|
virtual void PreGenSourceFiles();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../tinyxml2.h"
|
#include <tinyxml2.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
231
tools/ZAPD/ZAPD/ZScalar.cpp
Normal file
231
tools/ZAPD/ZAPD/ZScalar.cpp
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
#include "ZScalar.h"
|
||||||
|
#include "ZFile.h"
|
||||||
|
#include "BitConverter.h"
|
||||||
|
#include "StringHelper.h"
|
||||||
|
#include "File.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
|
ZScalar* ZScalar::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData, const int rawDataIndex, const std::string& nRelPath)
|
||||||
|
{
|
||||||
|
ZScalar* scalar = new ZScalar();
|
||||||
|
scalar->rawData = nRawData;
|
||||||
|
scalar->rawDataIndex = rawDataIndex;
|
||||||
|
scalar->ParseXML(reader);
|
||||||
|
scalar->ParseRawData();
|
||||||
|
|
||||||
|
return scalar;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZScalar::ZScalar() : ZResource()
|
||||||
|
{
|
||||||
|
memset(&scalarData, 0, sizeof(ZScalarData));
|
||||||
|
scalarType = ZSCALAR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZScalar::ZScalar(const ZScalarType scalarType) : ZScalar()
|
||||||
|
{
|
||||||
|
this->scalarType = scalarType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZScalar::ParseXML(tinyxml2::XMLElement* reader)
|
||||||
|
{
|
||||||
|
ZResource::ParseXML(reader);
|
||||||
|
|
||||||
|
name = reader->Attribute("Name");
|
||||||
|
|
||||||
|
std::string type = reader->Attribute("Type");
|
||||||
|
scalarType = ZScalar::MapOutputTypeToScalarType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZScalarType ZScalar::MapOutputTypeToScalarType(const std::string& type) {
|
||||||
|
if (type == "s8")
|
||||||
|
{
|
||||||
|
return ZSCALAR_S8;
|
||||||
|
}
|
||||||
|
else if (type == "u8")
|
||||||
|
{
|
||||||
|
return ZSCALAR_U8;
|
||||||
|
}
|
||||||
|
else if (type == "s16")
|
||||||
|
{
|
||||||
|
return ZSCALAR_S16;
|
||||||
|
}
|
||||||
|
else if (type == "u16")
|
||||||
|
{
|
||||||
|
return ZSCALAR_U16;
|
||||||
|
}
|
||||||
|
else if (type == "s32")
|
||||||
|
{
|
||||||
|
return ZSCALAR_S32;
|
||||||
|
}
|
||||||
|
else if (type == "u32")
|
||||||
|
{
|
||||||
|
return ZSCALAR_U32;
|
||||||
|
}
|
||||||
|
else if (type == "s64")
|
||||||
|
{
|
||||||
|
return ZSCALAR_S64;
|
||||||
|
}
|
||||||
|
else if (type == "u64")
|
||||||
|
{
|
||||||
|
return ZSCALAR_U64;
|
||||||
|
}
|
||||||
|
else if (type == "f32")
|
||||||
|
{
|
||||||
|
return ZSCALAR_F32;
|
||||||
|
}
|
||||||
|
else if (type == "f64")
|
||||||
|
{
|
||||||
|
return ZSCALAR_F64;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ZSCALAR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZScalar::MapScalarTypeToOutputType(const ZScalarType scalarType)
|
||||||
|
{
|
||||||
|
switch (scalarType) {
|
||||||
|
case ZSCALAR_S8:
|
||||||
|
return "s8";
|
||||||
|
case ZSCALAR_U8:
|
||||||
|
return "u8";
|
||||||
|
case ZSCALAR_S16:
|
||||||
|
return "s16";
|
||||||
|
case ZSCALAR_U16:
|
||||||
|
return "u16";
|
||||||
|
case ZSCALAR_S32:
|
||||||
|
return "s32";
|
||||||
|
case ZSCALAR_U32:
|
||||||
|
return "u32";
|
||||||
|
case ZSCALAR_S64:
|
||||||
|
return "s64";
|
||||||
|
case ZSCALAR_U64:
|
||||||
|
return "u64";
|
||||||
|
case ZSCALAR_F32:
|
||||||
|
return "f32";
|
||||||
|
case ZSCALAR_F64:
|
||||||
|
return "f64";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZScalar::MapTypeToSize(const ZScalarType scalarType)
|
||||||
|
{
|
||||||
|
switch (scalarType) {
|
||||||
|
case ZSCALAR_S8:
|
||||||
|
return sizeof(scalarData.s8);
|
||||||
|
case ZSCALAR_U8:
|
||||||
|
return sizeof(scalarData.u8);
|
||||||
|
case ZSCALAR_S16:
|
||||||
|
return sizeof(scalarData.s16);
|
||||||
|
case ZSCALAR_U16:
|
||||||
|
return sizeof(scalarData.u16);
|
||||||
|
case ZSCALAR_S32:
|
||||||
|
return sizeof(scalarData.s32);
|
||||||
|
case ZSCALAR_U32:
|
||||||
|
return sizeof(scalarData.u32);
|
||||||
|
case ZSCALAR_S64:
|
||||||
|
return sizeof(scalarData.s64);
|
||||||
|
case ZSCALAR_U64:
|
||||||
|
return sizeof(scalarData.u64);
|
||||||
|
case ZSCALAR_F32:
|
||||||
|
return sizeof(scalarData.f32);
|
||||||
|
case ZSCALAR_F64:
|
||||||
|
return sizeof(scalarData.f64);
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZScalar::GetRawDataSize()
|
||||||
|
{
|
||||||
|
return ZScalar::MapTypeToSize(scalarType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZScalar::ParseRawData()
|
||||||
|
{
|
||||||
|
ZScalar::ParseRawData(rawData, rawDataIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZScalar::ParseRawData(const std::vector<uint8_t>& data, const int offset)
|
||||||
|
{
|
||||||
|
switch (scalarType) {
|
||||||
|
case ZSCALAR_S8:
|
||||||
|
scalarData.s8 = BitConverter::ToInt8BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_U8:
|
||||||
|
scalarData.u8 = BitConverter::ToUInt8BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_S16:
|
||||||
|
scalarData.s16 = BitConverter::ToInt16BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_U16:
|
||||||
|
scalarData.u16 = BitConverter::ToUInt16BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_S32:
|
||||||
|
scalarData.s32 = BitConverter::ToInt32BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_U32:
|
||||||
|
scalarData.u32 = BitConverter::ToUInt32BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_S64:
|
||||||
|
scalarData.s64 = BitConverter::ToInt64BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_U64:
|
||||||
|
scalarData.u64 = BitConverter::ToUInt64BE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_F32:
|
||||||
|
scalarData.f32 = BitConverter::ToFloatBE(data, offset);
|
||||||
|
break;
|
||||||
|
case ZSCALAR_F64:
|
||||||
|
scalarData.f64 = BitConverter::ToDoubleBE(data, offset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZScalar::GetSourceTypeName()
|
||||||
|
{
|
||||||
|
return ZScalar::MapScalarTypeToOutputType(scalarType);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZScalar::GetSourceValue()
|
||||||
|
{
|
||||||
|
switch (scalarType) {
|
||||||
|
case ZSCALAR_S8:
|
||||||
|
return StringHelper::Sprintf("%hhd", scalarData.s8);
|
||||||
|
case ZSCALAR_U8:
|
||||||
|
return StringHelper::Sprintf("%hhu", scalarData.u8);
|
||||||
|
case ZSCALAR_S16:
|
||||||
|
return StringHelper::Sprintf("%hd", scalarData.s16);
|
||||||
|
case ZSCALAR_U16:
|
||||||
|
return StringHelper::Sprintf("%hu", scalarData.u16);
|
||||||
|
case ZSCALAR_S32:
|
||||||
|
return StringHelper::Sprintf("%d", scalarData.s32);
|
||||||
|
case ZSCALAR_U32:
|
||||||
|
return StringHelper::Sprintf("%u", scalarData.u32);
|
||||||
|
case ZSCALAR_S64:
|
||||||
|
return StringHelper::Sprintf("%lld", scalarData.s64);
|
||||||
|
case ZSCALAR_U64:
|
||||||
|
return StringHelper::Sprintf("%llu", scalarData.u64);
|
||||||
|
case ZSCALAR_F32:
|
||||||
|
return StringHelper::Sprintf("%f", scalarData.f32);
|
||||||
|
case ZSCALAR_F64:
|
||||||
|
return StringHelper::Sprintf("%lf", scalarData.f64);
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZScalar::GetSourceOutputCode(const std::string& prefix)
|
||||||
|
{
|
||||||
|
if (parent != nullptr)
|
||||||
|
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(), GetSourceTypeName(), GetName(), GetSourceValue());
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ZResourceType ZScalar::GetResourceType()
|
||||||
|
{
|
||||||
|
return ZResourceType::Scalar;
|
||||||
|
}
|
61
tools/ZAPD/ZAPD/ZScalar.h
Normal file
61
tools/ZAPD/ZAPD/ZScalar.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "ZResource.h"
|
||||||
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
|
typedef enum ZScalarType {
|
||||||
|
ZSCALAR_NONE,
|
||||||
|
ZSCALAR_S8,
|
||||||
|
ZSCALAR_U8,
|
||||||
|
ZSCALAR_S16,
|
||||||
|
ZSCALAR_U16,
|
||||||
|
ZSCALAR_S32,
|
||||||
|
ZSCALAR_U32,
|
||||||
|
ZSCALAR_S64,
|
||||||
|
ZSCALAR_U64,
|
||||||
|
ZSCALAR_F32,
|
||||||
|
ZSCALAR_F64
|
||||||
|
} ZScalarType;
|
||||||
|
|
||||||
|
typedef union ZScalarData {
|
||||||
|
uint8_t u8;
|
||||||
|
int8_t s8;
|
||||||
|
uint16_t u16;
|
||||||
|
int16_t s16;
|
||||||
|
uint32_t u32;
|
||||||
|
int32_t s32;
|
||||||
|
uint64_t u64;
|
||||||
|
int64_t s64;
|
||||||
|
float f32;
|
||||||
|
double f64;
|
||||||
|
} ZScalarData;
|
||||||
|
|
||||||
|
class ZScalar : public ZResource
|
||||||
|
{
|
||||||
|
friend class ZVector;
|
||||||
|
public:
|
||||||
|
ZScalarData scalarData;
|
||||||
|
ZScalarType scalarType;
|
||||||
|
|
||||||
|
ZScalar();
|
||||||
|
ZScalar(const ZScalarType scalarType);
|
||||||
|
|
||||||
|
void ParseXML(tinyxml2::XMLElement* reader);
|
||||||
|
std::string GetSourceTypeName();
|
||||||
|
std::string GetSourceValue();
|
||||||
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
|
int GetRawDataSize();
|
||||||
|
ZResourceType GetResourceType();
|
||||||
|
|
||||||
|
static ZScalar* ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData, const int rawDataIndex, const std::string& nRelPath);
|
||||||
|
static int MapTypeToSize(const ZScalarType scalarType);
|
||||||
|
static ZScalarType MapOutputTypeToScalarType(const std::string& type);
|
||||||
|
static std::string MapScalarTypeToOutputType(const ZScalarType scalarType);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void ParseRawData();
|
||||||
|
void ParseRawData(const std::vector<uint8_t>& data, const int offset);
|
||||||
|
};
|
|
@ -59,7 +59,7 @@ ZLimbStandard* ZLimbStandard::FromRawData(std::vector<uint8_t> nRawData, int raw
|
||||||
return limb;
|
return limb;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZLimbStandard::GetSourceOutputCode(string prefix)
|
string ZLimbStandard::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
string dListStr = dListPtr == 0 ? "NULL" : StringHelper::Sprintf("%s", parent->GetVarName(dListPtr).c_str());
|
string dListStr = dListPtr == 0 ? "NULL" : StringHelper::Sprintf("%s", parent->GetVarName(dListPtr).c_str());
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ ZSkeleton* ZSkeleton::FromXML(XMLElement* reader, vector<uint8_t> nRawData, int
|
||||||
return skeleton;
|
return skeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZSkeleton::GetSourceOutputCode(std::string prefix)
|
std::string ZSkeleton::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -224,10 +224,12 @@ std::string ZSkeleton::GetSourceOutputCode(std::string prefix)
|
||||||
//string decl = StringHelper::Sprintf(" &_%sLimb_%04X,\n", prefix.c_str(), limb->address);
|
//string decl = StringHelper::Sprintf(" &_%sLimb_%04X,\n", prefix.c_str(), limb->address);
|
||||||
string decl = "";
|
string decl = "";
|
||||||
|
|
||||||
if (parent->HasDeclaration(limb->address))
|
if (parent->HasDeclaration(limb->address)) {
|
||||||
decl = StringHelper::Sprintf(" &%s,", parent->GetDeclarationName(limb->address).c_str());
|
decl = StringHelper::Sprintf(" &%s,", parent->GetDeclarationName(limb->address).c_str());
|
||||||
if (i != (limbs.size() - 1))
|
if (i != (limbs.size() - 1)) {
|
||||||
decl += "\n";
|
decl += "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tblStr += decl;
|
tblStr += decl;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +259,7 @@ std::string ZSkeleton::GetSourceOutputCode(std::string prefix)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZSkeleton::Save(string outFolder)
|
void ZSkeleton::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -286,7 +288,7 @@ ZLimbLOD* ZLimbLOD::FromRawData(vector<uint8_t> nRawData, int rawDataIndex)
|
||||||
return limb;
|
return limb;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ZLimbLOD::GetSourceOutputCode(string prefix)
|
string ZLimbLOD::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct ZLimbStandard : public ZResource
|
||||||
ZLimbStandard();
|
ZLimbStandard();
|
||||||
static ZLimbStandard* FromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath, ZFile* parent);
|
static ZLimbStandard* FromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath, ZFile* parent);
|
||||||
static ZLimbStandard* FromRawData(std::vector<uint8_t> nRawData, int rawDataIndex);
|
static ZLimbStandard* FromRawData(std::vector<uint8_t> nRawData, int rawDataIndex);
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
virtual int GetRawDataSize();
|
virtual int GetRawDataSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ struct ZLimbLOD : ZLimbStandard
|
||||||
ZLimbLOD();
|
ZLimbLOD();
|
||||||
//static ZLimbLOD* FromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath, ZFile* parent);
|
//static ZLimbLOD* FromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath, ZFile* parent);
|
||||||
static ZLimbLOD* FromRawData(std::vector<uint8_t> nRawData, int rawDataIndex);
|
static ZLimbLOD* FromRawData(std::vector<uint8_t> nRawData, int rawDataIndex);
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
virtual int GetRawDataSize();
|
virtual int GetRawDataSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
ZSkeleton();
|
ZSkeleton();
|
||||||
virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile);
|
virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile);
|
||||||
static ZSkeleton* FromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath, ZFile* nParent);
|
static ZSkeleton* FromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath, ZFile* nParent);
|
||||||
void Save(std::string outFolder);
|
void Save(const std::string& outFolder);
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
};
|
};
|
|
@ -21,6 +21,7 @@ ZTexture::ZTexture() : ZResource()
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
type = TextureType::Error;
|
type = TextureType::Error;
|
||||||
|
isPalette = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZTexture::~ZTexture()
|
ZTexture::~ZTexture()
|
||||||
|
@ -657,7 +658,22 @@ int ZTexture::GetHeight()
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZTexture::Save(string outFolder)
|
void ZTexture::SetWidth(int nWidth)
|
||||||
|
{
|
||||||
|
width = nWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZTexture::SetHeight(int nHeight)
|
||||||
|
{
|
||||||
|
height = nHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureType ZTexture::GetTextureType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZTexture::Save(const std::string& outFolder)
|
||||||
{
|
{
|
||||||
if (type == TextureType::RGBA32bpp)
|
if (type == TextureType::RGBA32bpp)
|
||||||
stbi_write_png((outFolder + "/" + outName + ".rgba32.png").c_str(), width, height, 4, bmpRgba, width * 4);
|
stbi_write_png((outFolder + "/" + outName + ".rgba32.png").c_str(), width, height, 4, bmpRgba, width * 4);
|
||||||
|
@ -683,7 +699,7 @@ void ZTexture::Save(string outFolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HOTSPOT
|
// HOTSPOT
|
||||||
string ZTexture::GetSourceOutputCode(std::string prefix)
|
string ZTexture::GetSourceOutputCode(const std::string& prefix)
|
||||||
{
|
{
|
||||||
sourceOutput = "";
|
sourceOutput = "";
|
||||||
|
|
||||||
|
@ -703,7 +719,7 @@ string ZTexture::GetSourceOutputCode(std::string prefix)
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
sourceOutput += "\t";
|
sourceOutput += "\t";
|
||||||
|
|
||||||
sourceOutput += StringHelper::Sprintf("0x%016llX, ", BitConverter::ToInt64BE(rawDataArr, i));
|
sourceOutput += StringHelper::Sprintf("0x%016llX, ", BitConverter::ToUInt64BE(rawDataArr, i));
|
||||||
|
|
||||||
if (i % 32 == 24)
|
if (i % 32 == 24)
|
||||||
sourceOutput += StringHelper::Sprintf(" // 0x%06X \n", rawDataIndex + ((i / 32) * 32));
|
sourceOutput += StringHelper::Sprintf(" // 0x%06X \n", rawDataIndex + ((i / 32) * 32));
|
||||||
|
@ -748,7 +764,7 @@ std::string ZTexture::GetExternalExtension()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ZTexture::GetSourceOutputHeader(std::string prefix)
|
string ZTexture::GetSourceOutputHeader(const std::string& prefix)
|
||||||
{
|
{
|
||||||
//return StringHelper::Sprintf("extern u64 %s[];\n", name.c_str());
|
//return StringHelper::Sprintf("extern u64 %s[];\n", name.c_str());
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -60,6 +60,8 @@ public:
|
||||||
ZTexture();
|
ZTexture();
|
||||||
~ZTexture();
|
~ZTexture();
|
||||||
|
|
||||||
|
bool isPalette;
|
||||||
|
|
||||||
static ZTexture* BuildFromXML(tinyxml2::XMLElement* reader, std::string inFolder, bool readFile);
|
static ZTexture* BuildFromXML(tinyxml2::XMLElement* reader, std::string inFolder, bool readFile);
|
||||||
static ZTexture* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath);
|
static ZTexture* ExtractFromXML(tinyxml2::XMLElement* reader, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nRelPath);
|
||||||
static ZTexture* FromBinary(TextureType nType, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nName, int nWidth, int nHeight);
|
static ZTexture* FromBinary(TextureType nType, std::vector<uint8_t> nRawData, int rawDataIndex, std::string nName, int nWidth, int nHeight);
|
||||||
|
@ -67,8 +69,8 @@ public:
|
||||||
static ZTexture* FromHLTexture(HLTexture* hlTex);
|
static ZTexture* FromHLTexture(HLTexture* hlTex);
|
||||||
static TextureType GetTextureTypeFromString(std::string str);
|
static TextureType GetTextureTypeFromString(std::string str);
|
||||||
|
|
||||||
std::string GetSourceOutputCode(std::string prefix);
|
std::string GetSourceOutputCode(const std::string& prefix) override;
|
||||||
std::string GetSourceOutputHeader(std::string prefix);
|
std::string GetSourceOutputHeader(const std::string& prefix) override;
|
||||||
|
|
||||||
std::vector<uint8_t> GetRawData();
|
std::vector<uint8_t> GetRawData();
|
||||||
int GetRawDataSize();
|
int GetRawDataSize();
|
||||||
|
@ -76,6 +78,9 @@ public:
|
||||||
std::string GetIMSizFromType();
|
std::string GetIMSizFromType();
|
||||||
int GetWidth();
|
int GetWidth();
|
||||||
int GetHeight();
|
int GetHeight();
|
||||||
void Save(std::string outFolder);
|
void SetWidth(int nWidth);
|
||||||
|
void SetHeight(int nHeight);
|
||||||
|
TextureType GetTextureType();
|
||||||
|
void Save(const std::string& outFolder);
|
||||||
std::string GetExternalExtension();
|
std::string GetExternalExtension();
|
||||||
};
|
};
|
111
tools/ZAPD/ZAPD/ZVector.cpp
Normal file
111
tools/ZAPD/ZAPD/ZVector.cpp
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
#include "ZVector.h"
|
||||||
|
#include "ZFile.h"
|
||||||
|
#include "BitConverter.h"
|
||||||
|
#include "StringHelper.h"
|
||||||
|
#include "File.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
ZVector::ZVector() : ZResource()
|
||||||
|
{
|
||||||
|
scalars = std::vector<ZScalar*>();
|
||||||
|
this->scalarType = ZSCALAR_NONE;
|
||||||
|
this->dimensions = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZVector* ZVector::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData, const int rawDataIndex, const std::string& nRelPath)
|
||||||
|
{
|
||||||
|
ZVector* vector = new ZVector();
|
||||||
|
vector->rawData = nRawData;
|
||||||
|
vector->rawDataIndex = rawDataIndex;
|
||||||
|
vector->ParseXML(reader);
|
||||||
|
vector->ParseRawData();
|
||||||
|
|
||||||
|
return vector;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZVector::ParseXML(tinyxml2::XMLElement* reader)
|
||||||
|
{
|
||||||
|
ZResource::ParseXML(reader);
|
||||||
|
|
||||||
|
name = reader->Attribute("Name");
|
||||||
|
|
||||||
|
std::string type = reader->Attribute("Type");
|
||||||
|
this->scalarType = ZScalar::MapOutputTypeToScalarType(type);
|
||||||
|
|
||||||
|
std::string dimensions = reader->Attribute("Dimensions");
|
||||||
|
this->dimensions = strtol(dimensions.c_str(), NULL, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZVector::ParseRawData()
|
||||||
|
{
|
||||||
|
int currentRawDataIndex = this->rawDataIndex;
|
||||||
|
|
||||||
|
scalars.clear();
|
||||||
|
for (int i = 0; i < this->dimensions; i++) {
|
||||||
|
ZScalar* scalar = new ZScalar(this->scalarType);
|
||||||
|
scalar->rawDataIndex = currentRawDataIndex;
|
||||||
|
scalar->rawData = this->rawData;
|
||||||
|
scalar->ParseRawData();
|
||||||
|
currentRawDataIndex += scalar->GetRawDataSize();
|
||||||
|
|
||||||
|
this->scalars.push_back(scalar);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the scalars vector has the same number of elements as the vector dimension.
|
||||||
|
assert(this->scalars.size() == this->dimensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZVector::GetRawDataSize()
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
for (int i = 0; i < this->scalars.size(); i++)
|
||||||
|
size += this->scalars[i]->GetRawDataSize();
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZVector::GetSourceTypeName()
|
||||||
|
{
|
||||||
|
if (dimensions == 3 && scalarType == ZSCALAR_F32)
|
||||||
|
{
|
||||||
|
return "Vec3f";
|
||||||
|
}
|
||||||
|
else if (dimensions == 3 && scalarType == ZSCALAR_S16)
|
||||||
|
{
|
||||||
|
return "Vec3s";
|
||||||
|
}
|
||||||
|
else if (dimensions == 3 && scalarType == ZSCALAR_S32)
|
||||||
|
{
|
||||||
|
return "Vec3i";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string output = StringHelper::Sprintf("Encountered unsupported vector type: %d dimensions, %s type", dimensions, ZScalar::MapScalarTypeToOutputType(scalarType));
|
||||||
|
|
||||||
|
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||||
|
printf("%s\n", output.c_str());
|
||||||
|
|
||||||
|
throw output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZVector::GetSourceValue()
|
||||||
|
{
|
||||||
|
std::vector<std::string> strings = std::vector<std::string>();
|
||||||
|
for (int i = 0; i < this->scalars.size(); i++)
|
||||||
|
strings.push_back(scalars[i]->GetSourceValue());
|
||||||
|
return StringHelper::Implode(strings, ", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ZVector::GetSourceOutputCode(const std::string& prefix)
|
||||||
|
{
|
||||||
|
if (parent != nullptr)
|
||||||
|
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(), GetSourceTypeName(), GetName(), GetSourceValue());
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ZResourceType ZVector::GetResourceType()
|
||||||
|
{
|
||||||
|
return ZResourceType::Vector;
|
||||||
|
}
|
30
tools/ZAPD/ZAPD/ZVector.h
Normal file
30
tools/ZAPD/ZAPD/ZVector.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "ZResource.h"
|
||||||
|
#include "ZScalar.h"
|
||||||
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
|
class ZVector : public ZResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::vector<ZScalar*> scalars;
|
||||||
|
ZScalarType scalarType;
|
||||||
|
uint32_t dimensions;
|
||||||
|
|
||||||
|
ZVector();
|
||||||
|
|
||||||
|
void ParseXML(tinyxml2::XMLElement* reader);
|
||||||
|
std::string GetSourceTypeName();
|
||||||
|
std::string GetSourceValue();
|
||||||
|
std::string GetSourceOutputCode(const std::string& prefix);
|
||||||
|
int GetRawDataSize();
|
||||||
|
ZResourceType GetResourceType();
|
||||||
|
|
||||||
|
static ZVector* ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData, const int rawDataIndex, const std::string& nRelPath);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void ParseRawData();
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue