mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +00:00
Update ZAPD (#1569)
* git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "094e79734" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "094e79734" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb" * Add EnumData.xml where some names are now externalized * Remove legacy typedefs for zapd, no longer needed!
This commit is contained in:
parent
503f6d86d5
commit
4e55168eaa
97 changed files with 4225 additions and 2328 deletions
|
@ -66,7 +66,7 @@ PenaltyExcessCharacter: 1000000
|
|||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortIncludes: false
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[subrepo]
|
||||
remote = https://github.com/zeldaret/ZAPD.git
|
||||
branch = master
|
||||
commit = dcf56d93ecbd4db3bfd8a4832d7f991467964b98
|
||||
parent = 9bad1d108e6311562c8424eefc92f0f1004551c9
|
||||
commit = 094e797349c86d0baef4a624962f4287aefdfef2
|
||||
parent = 503f6d86d5fca5bd234640ef9de597d413cb91f5
|
||||
method = merge
|
||||
cmdver = 0.4.5
|
||||
cmdver = 0.4.6
|
||||
|
|
|
@ -67,9 +67,9 @@ void ExporterExample_Collision::Save(ZResource* res, [[maybe_unused]] fs::path o
|
|||
|
||||
for (auto entry : col->camData->entries)
|
||||
{
|
||||
writer->Write(entry->cameraSType);
|
||||
writer->Write(entry->numData);
|
||||
writer->Write(entry->cameraPosDataSeg);
|
||||
writer->Write(entry.cameraSType);
|
||||
writer->Write(entry.numData);
|
||||
writer->Write(entry.cameraPosDataSeg);
|
||||
}
|
||||
|
||||
writer->Seek(oldOffset, SeekOffsetType::Start);
|
||||
|
|
|
@ -17,7 +17,7 @@ clean:
|
|||
rm -rf build $(LIB)
|
||||
|
||||
format:
|
||||
clang-format-11 -i $(CPP_FILES) $(H_FILES)
|
||||
clang-format-14 -i $(CPP_FILES) $(H_FILES)
|
||||
|
||||
.PHONY: all clean format
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
|
|||
uint32_t oldOffset = writer->GetBaseAddress();
|
||||
writer->Seek(baseStreamEnd, SeekOffsetType::Start);
|
||||
|
||||
for (EntranceEntry entry : cmdEntrance->entrances)
|
||||
for (Spawn entry : cmdEntrance->entrances)
|
||||
{
|
||||
writer->Write((uint8_t)entry.startPositionIndex);
|
||||
writer->Write((uint8_t)entry.roomToLoad);
|
||||
|
|
|
@ -8,6 +8,18 @@ COPYCHECK_ARGS ?=
|
|||
LLD ?= 0
|
||||
WERROR ?= 0
|
||||
|
||||
# On MacOS 10.14, use boost::filesystem, because
|
||||
# the system doesn't supply std::filesystem.
|
||||
ifneq ($(OS),Windows_NT)
|
||||
ifeq ($(shell uname -s),Darwin)
|
||||
MACOS_VERSION := $(shell sw_vers -productVersion | cut -d . -f 1,2)
|
||||
ifeq ($(MACOS_VERSION),10.14)
|
||||
USE_BOOST_FS ?= 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
USE_BOOST_FS ?= 0
|
||||
|
||||
# Use clang++ if available, else use g++
|
||||
ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0)
|
||||
CXX := clang++
|
||||
|
@ -46,6 +58,11 @@ endif
|
|||
|
||||
LDFLAGS := -lm -ldl -lpng
|
||||
|
||||
ifneq ($(USE_BOOST_FS),0)
|
||||
CXXFLAGS += -DUSE_BOOST_FS
|
||||
LDFLAGS += -lboost_filesystem
|
||||
endif
|
||||
|
||||
# Use LLD if available. Set LLD=0 to not use it
|
||||
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
|
||||
LLD := 1
|
||||
|
@ -106,7 +123,7 @@ clean:
|
|||
rebuild: clean all
|
||||
|
||||
format:
|
||||
clang-format-11 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES)
|
||||
clang-format-14 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES)
|
||||
$(MAKE) -C ZAPDUtils format
|
||||
$(MAKE) -C ExporterTest format
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ to install it via Homebrew.
|
|||
|
||||
#### Linux / *nix
|
||||
|
||||
ZAPD uses the clasic `Makefile` approach. To build just run `make` (or even better `make -j` for faster compilations).
|
||||
ZAPD uses the classic `Makefile` approach. To build just run `make` (or even better `make -j` for faster compilations).
|
||||
|
||||
You can configure a bit your ZAPD build with the following options:
|
||||
|
||||
|
@ -139,22 +139,23 @@ Each warning type uses one of these by default, but can be modified with flags,
|
|||
|
||||
All warning types currently implemented, with their default levels:
|
||||
|
||||
| Warning type | Default level | Description |
|
||||
| --------------------------- | ------------- | ------------------------------------------------------------------------ |
|
||||
| `-Wdeprecated` | Warn | Deprecated features |
|
||||
| `-Whardcoded-pointer` | Warn | ZAPD lacks the info to make a symbol, so must output a hardcoded pointer |
|
||||
| `-Wintersection` | Warn | Two assets intersect |
|
||||
| `-Winvalid-attribute-value` | Err | Attribute declared in XML is wrong |
|
||||
| `-Winvalid-extracted-data` | Err | Extracted data does not have correct form |
|
||||
| `-Winvalid-jpeg` | Err | JPEG file does not conform to the game's format requirements |
|
||||
| `-Winvalid-png` | Err | Issues arising when processing PNG data |
|
||||
| `-Winvalid-xml` | Err | XML has syntax errors |
|
||||
| `-Wmissing-attribute` | Warn | Required attribute missing in XML tag |
|
||||
| `-Wmissing-offsets` | Warn | Offset attribute missing in XML tag |
|
||||
| `-Wmissing-segment` | Warn | Segment not given in File tag in XML |
|
||||
| `-Wnot-implemented` | Warn | ZAPD does not currently support this feature |
|
||||
| `-Wunaccounted` | Off | Large blocks of unaccounted |
|
||||
| `-Wunknown-attribute` | Warn | Unknown attribute in XML entry tag |
|
||||
| Warning type | Default level | Description |
|
||||
| ----------------------------- | ------------- | ------------------------------------------------------------------------ |
|
||||
| `-Wdeprecated` | Warn | Deprecated features |
|
||||
| `-Whardcoded-generic-pointer` | Off | A generic segmented pointer must be produced |
|
||||
| `-Whardcoded-pointer` | Warn | ZAPD lacks the info to make a symbol, so must output a hardcoded pointer |
|
||||
| `-Wintersection` | Warn | Two assets intersect |
|
||||
| `-Winvalid-attribute-value` | Err | Attribute declared in XML is wrong |
|
||||
| `-Winvalid-extracted-data` | Err | Extracted data does not have correct form |
|
||||
| `-Winvalid-jpeg` | Err | JPEG file does not conform to the game's format requirements |
|
||||
| `-Winvalid-png` | Err | Issues arising when processing PNG data |
|
||||
| `-Winvalid-xml` | Err | XML has syntax errors |
|
||||
| `-Wmissing-attribute` | Warn | Required attribute missing in XML tag |
|
||||
| `-Wmissing-offsets` | Warn | Offset attribute missing in XML tag |
|
||||
| `-Wmissing-segment` | Warn | Segment not given in File tag in XML |
|
||||
| `-Wnot-implemented` | Warn | ZAPD does not currently support this feature |
|
||||
| `-Wunaccounted` | Off | Large blocks of unaccounted |
|
||||
| `-Wunknown-attribute` | Warn | Unknown attribute in XML entry tag |
|
||||
|
||||
There are also errors that do not have a type, and cannot be disabled.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
static uint32_t CRC32B(unsigned char* message, int32_t size)
|
||||
static uint32_t CRC32B(const unsigned char* message, int32_t size)
|
||||
{
|
||||
int32_t byte, crc;
|
||||
int32_t mask;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
|
|
@ -4,61 +4,79 @@
|
|||
#include "Utils/StringHelper.h"
|
||||
|
||||
Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nText)
|
||||
const std::string& nBody)
|
||||
{
|
||||
address = nAddress;
|
||||
alignment = nAlignment;
|
||||
size = nSize;
|
||||
text = nText;
|
||||
declBody = nBody;
|
||||
}
|
||||
|
||||
Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
const std::string& nText)
|
||||
: Declaration(nAddress, nAlignment, nSize, nText)
|
||||
Declaration* Declaration::Create(offset_t declAddr, DeclarationAlignment declAlign, size_t declSize,
|
||||
const std::string& declType, const std::string& declName,
|
||||
const std::string& declBody)
|
||||
{
|
||||
varType = nVarType;
|
||||
varName = nVarName;
|
||||
isArray = nIsArray;
|
||||
Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody);
|
||||
|
||||
decl->declType = declType;
|
||||
decl->declName = declName;
|
||||
decl->declBody = declBody;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
size_t nArrayItemCnt, const std::string& nText)
|
||||
: Declaration(nAddress, nAlignment, nSize, nText)
|
||||
Declaration* Declaration::CreateArray(offset_t declAddr, DeclarationAlignment declAlign,
|
||||
size_t declSize, const std::string& declType,
|
||||
const std::string& declName, const std::string& declBody,
|
||||
size_t declArrayItemCnt, bool isDeclExternal)
|
||||
{
|
||||
varType = nVarType;
|
||||
varName = nVarName;
|
||||
isArray = nIsArray;
|
||||
arrayItemCnt = nArrayItemCnt;
|
||||
Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody);
|
||||
|
||||
decl->declName = declName;
|
||||
decl->declType = declType;
|
||||
decl->arrayItemCnt = declArrayItemCnt;
|
||||
decl->isExternal = isDeclExternal;
|
||||
decl->isArray = true;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
const std::string& nArrayItemCntStr, const std::string& nText)
|
||||
: Declaration(nAddress, nAlignment, nSize, nText)
|
||||
Declaration* Declaration::CreateArray(offset_t declAddr, DeclarationAlignment declAlign,
|
||||
size_t declSize, const std::string& declType,
|
||||
const std::string& declName, const std::string& declBody,
|
||||
const std::string& declArrayItemCntStr, bool isDeclExternal)
|
||||
{
|
||||
varType = nVarType;
|
||||
varName = nVarName;
|
||||
isArray = nIsArray;
|
||||
arrayItemCntStr = nArrayItemCntStr;
|
||||
Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody);
|
||||
|
||||
decl->declName = declName;
|
||||
decl->declType = declType;
|
||||
decl->arrayItemCntStr = declArrayItemCntStr;
|
||||
decl->isExternal = isDeclExternal;
|
||||
decl->isArray = true;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
size_t nArrayItemCnt, const std::string& nText, bool nIsExternal)
|
||||
: Declaration(nAddress, nAlignment, nSize, nVarType, nVarName, nIsArray, nArrayItemCnt, nText)
|
||||
Declaration* Declaration::CreateInclude(offset_t declAddr, const std::string& includePath,
|
||||
size_t declSize, const std::string& declType,
|
||||
const std::string& declName, const std::string& defines)
|
||||
{
|
||||
isExternal = nIsExternal;
|
||||
Declaration* decl = new Declaration(declAddr, DeclarationAlignment::Align4, declSize, "");
|
||||
decl->includePath = includePath;
|
||||
decl->declType = declType;
|
||||
decl->declName = declName;
|
||||
decl->defines = defines;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
Declaration::Declaration(offset_t nAddress, const std::string& nIncludePath, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName)
|
||||
: Declaration(nAddress, DeclarationAlignment::Align4, nSize, "")
|
||||
Declaration* Declaration::CreatePlaceholder(offset_t declAddr, const std::string& declName)
|
||||
{
|
||||
includePath = nIncludePath;
|
||||
varType = nVarType;
|
||||
varName = nVarName;
|
||||
Declaration* decl = new Declaration(declAddr, DeclarationAlignment::Align4, 0, "");
|
||||
decl->declName = declName;
|
||||
decl->isPlaceholder = true;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
bool Declaration::IsStatic() const
|
||||
|
@ -82,9 +100,6 @@ std::string Declaration::GetNormalDeclarationStr() const
|
|||
{
|
||||
std::string output;
|
||||
|
||||
if (preText != "")
|
||||
output += preText + "\n";
|
||||
|
||||
if (IsStatic())
|
||||
{
|
||||
output += "static ";
|
||||
|
@ -92,27 +107,28 @@ std::string Declaration::GetNormalDeclarationStr() const
|
|||
|
||||
if (isArray)
|
||||
{
|
||||
if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt))
|
||||
bool includeArraySize = (IsStatic() || forceArrayCnt);
|
||||
|
||||
if (includeArraySize)
|
||||
{
|
||||
output += StringHelper::Sprintf("%s %s[%s];\n", varType.c_str(), varName.c_str(),
|
||||
arrayItemCntStr.c_str());
|
||||
}
|
||||
else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt))
|
||||
{
|
||||
output += StringHelper::Sprintf("%s %s[%i] = {\n", varType.c_str(), varName.c_str(),
|
||||
arrayItemCnt);
|
||||
if (arrayItemCntStr != "")
|
||||
output += StringHelper::Sprintf("%s %s[%s];\n", declType.c_str(), declName.c_str(),
|
||||
arrayItemCntStr.c_str());
|
||||
else
|
||||
output += StringHelper::Sprintf("%s %s[%i] = {\n", declType.c_str(),
|
||||
declName.c_str(), arrayItemCnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
output += StringHelper::Sprintf("%s %s[] = {\n", varType.c_str(), varName.c_str());
|
||||
output += StringHelper::Sprintf("%s %s[] = {\n", declType.c_str(), declName.c_str());
|
||||
}
|
||||
|
||||
output += text + "\n";
|
||||
output += declBody + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
output += StringHelper::Sprintf("%s %s = { ", varType.c_str(), varName.c_str());
|
||||
output += text;
|
||||
output += StringHelper::Sprintf("%s %s = { ", declType.c_str(), declName.c_str());
|
||||
output += declBody;
|
||||
}
|
||||
|
||||
if (output.back() == '\n')
|
||||
|
@ -120,14 +136,8 @@ std::string Declaration::GetNormalDeclarationStr() const
|
|||
else
|
||||
output += " };";
|
||||
|
||||
if (rightText != "")
|
||||
output += " " + rightText + "";
|
||||
|
||||
output += "\n";
|
||||
|
||||
if (postText != "")
|
||||
output += postText + "\n";
|
||||
|
||||
output += "\n";
|
||||
|
||||
return output;
|
||||
|
@ -137,41 +147,34 @@ std::string Declaration::GetExternalDeclarationStr() const
|
|||
{
|
||||
std::string output;
|
||||
|
||||
if (preText != "")
|
||||
output += preText + "\n";
|
||||
|
||||
if (IsStatic())
|
||||
{
|
||||
output += "static ";
|
||||
|
||||
bool includeArraySize = (IsStatic() || forceArrayCnt);
|
||||
|
||||
if (includeArraySize)
|
||||
{
|
||||
if (arrayItemCntStr != "")
|
||||
output += StringHelper::Sprintf("%s %s[%s] = ", declType.c_str(), declName.c_str(),
|
||||
arrayItemCntStr.c_str());
|
||||
else
|
||||
output += StringHelper::Sprintf("%s %s[%i] = ", declType.c_str(), declName.c_str(),
|
||||
arrayItemCnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
output += StringHelper::Sprintf("%s %s[] = ", declType.c_str(), declName.c_str());
|
||||
}
|
||||
|
||||
if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt))
|
||||
output += StringHelper::Sprintf("%s %s[%s] = ", varType.c_str(), varName.c_str(),
|
||||
arrayItemCntStr.c_str());
|
||||
else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt))
|
||||
output +=
|
||||
StringHelper::Sprintf("%s %s[%i] = ", varType.c_str(), varName.c_str(), arrayItemCnt);
|
||||
else
|
||||
output += StringHelper::Sprintf("%s %s[] = ", varType.c_str(), varName.c_str());
|
||||
|
||||
output += StringHelper::Sprintf("{\n#include \"%s\"\n};", includePath.c_str());
|
||||
|
||||
if (rightText != "")
|
||||
output += " " + rightText + "";
|
||||
|
||||
output += "\n";
|
||||
|
||||
if (postText != "")
|
||||
output += postText + "\n";
|
||||
|
||||
output += "\n";
|
||||
output += "\n\n";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string Declaration::GetExternStr() const
|
||||
{
|
||||
if (IsStatic() || varType == "" || isUnaccounted)
|
||||
if (IsStatic() || declType == "" || isUnaccounted)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
@ -180,19 +183,28 @@ std::string Declaration::GetExternStr() const
|
|||
{
|
||||
if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt))
|
||||
{
|
||||
return StringHelper::Sprintf("extern %s %s[%s];\n", varType.c_str(), varName.c_str(),
|
||||
return StringHelper::Sprintf("extern %s %s[%s];\n", declType.c_str(), declName.c_str(),
|
||||
arrayItemCntStr.c_str());
|
||||
}
|
||||
else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt))
|
||||
{
|
||||
return StringHelper::Sprintf("extern %s %s[%i];\n", varType.c_str(), varName.c_str(),
|
||||
return StringHelper::Sprintf("extern %s %s[%i];\n", declType.c_str(), declName.c_str(),
|
||||
arrayItemCnt);
|
||||
}
|
||||
else
|
||||
return StringHelper::Sprintf("extern %s %s[];\n", varType.c_str(), varName.c_str());
|
||||
return StringHelper::Sprintf("extern %s %s[];\n", declType.c_str(), declName.c_str());
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("extern %s %s;\n", varType.c_str(), varName.c_str());
|
||||
return StringHelper::Sprintf("extern %s %s;\n", declType.c_str(), declName.c_str());
|
||||
}
|
||||
|
||||
std::string Declaration::GetDefinesStr() const
|
||||
{
|
||||
if (IsStatic() || (declType == ""))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return StringHelper::Sprintf("%s", defines.c_str());
|
||||
}
|
||||
|
||||
std::string Declaration::GetStaticForwardDeclarationStr() const
|
||||
|
@ -210,15 +222,15 @@ std::string Declaration::GetStaticForwardDeclarationStr() const
|
|||
|
||||
if (arrayItemCntStr != "")
|
||||
{
|
||||
return StringHelper::Sprintf("static %s %s[%s];\n", varType.c_str(), varName.c_str(),
|
||||
return StringHelper::Sprintf("static %s %s[%s];\n", declType.c_str(), declName.c_str(),
|
||||
arrayItemCntStr.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
return StringHelper::Sprintf("static %s %s[%i];\n", varType.c_str(), varName.c_str(),
|
||||
return StringHelper::Sprintf("static %s %s[%i];\n", declType.c_str(), declName.c_str(),
|
||||
arrayItemCnt);
|
||||
}
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("static %s %s;\n", varType.c_str(), varName.c_str());
|
||||
return StringHelper::Sprintf("static %s %s;\n", declType.c_str(), declName.c_str());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -22,59 +23,160 @@ enum class StaticConfig
|
|||
On
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A declaration is contains the C contents of a symbol for a file.
|
||||
/// It contains at a minimum the address where the symbol would be in the binary file, alignment
|
||||
/// settings, the size of the binary data, and the C code that makes it up. Optionally it can also
|
||||
/// contain comments.
|
||||
/// </summary>
|
||||
class Declaration
|
||||
{
|
||||
public:
|
||||
offset_t address;
|
||||
DeclarationAlignment alignment;
|
||||
size_t size;
|
||||
std::string preText;
|
||||
std::string text;
|
||||
std::string rightText;
|
||||
std::string postText;
|
||||
std::string preComment;
|
||||
std::string postComment;
|
||||
std::string varType;
|
||||
std::string varName;
|
||||
std::string includePath;
|
||||
// Where in the binary file (segment) will this C code end up being?
|
||||
offset_t address = 0;
|
||||
|
||||
// How is this C code aligned?
|
||||
DeclarationAlignment alignment = DeclarationAlignment::Align4;
|
||||
|
||||
// How many bytes will this C code take up in the resulting binary when compiled?
|
||||
size_t size = 0;
|
||||
|
||||
// The C type of this declaration
|
||||
std::string declType = "";
|
||||
|
||||
// The C variable name of this declaration
|
||||
std::string declName = "";
|
||||
|
||||
// The body of the declaration containing the data.
|
||||
// In "int j = 7;", "7" would be text.
|
||||
std::string declBody = "";
|
||||
|
||||
// #define's to be included in the header
|
||||
std::string defines = "";
|
||||
|
||||
std::string includePath = "";
|
||||
|
||||
// Is this declaration in an external file? (ie. a gameplay_keep reference being found in
|
||||
// another file that wishes to use its data)
|
||||
bool isExternal = false;
|
||||
|
||||
bool isArray = false;
|
||||
|
||||
// If true, will ensure that the arrays size is included in the declaration
|
||||
bool forceArrayCnt = false;
|
||||
|
||||
// If this declaration is an array, how many items make it up?
|
||||
size_t arrayItemCnt = 0;
|
||||
|
||||
// Overrides the brackets for the arrays size with a custom string
|
||||
std::string arrayItemCntStr = "";
|
||||
|
||||
std::vector<segptr_t> references;
|
||||
|
||||
// If true, this declaration represents data inside the file which we do not understand it's
|
||||
// purpose for. It will be outputted as just a byte array.
|
||||
bool isUnaccounted = false;
|
||||
|
||||
// Is this declaration a placeholder that will be replaced later?
|
||||
bool isPlaceholder = false;
|
||||
|
||||
// Does this declaration come straight from the XML?
|
||||
// If false, this means that the declaration was created by ZAPD when it was parsing the
|
||||
// resources.
|
||||
bool declaredInXml = false;
|
||||
|
||||
StaticConfig staticConf = StaticConfig::Global;
|
||||
|
||||
Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
const std::string& nText);
|
||||
Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
size_t nArrayItemCnt, const std::string& nText);
|
||||
Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
const std::string& nArrayItemCntStr, const std::string& nText);
|
||||
Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName, bool nIsArray,
|
||||
size_t nArrayItemCnt, const std::string& nText, bool nIsExternal);
|
||||
/// <summary>
|
||||
/// Creates a regular declaration.
|
||||
/// </summary>
|
||||
/// <param name="declAddr">The address inside a binary file this declaration will be in when
|
||||
/// compiled.</param> <param name="declAlign">The alignment of this declaration in the compiled
|
||||
/// binary file.</param> <param name="declSize">The size of this declaration when it is compiled
|
||||
/// to binary data.</param> <param name="declType">The C variable type this declaration will be
|
||||
/// declared as.</param> <param name="declName">The C variable name this declaration will be
|
||||
/// declared as.</param> <param name="declBody">The contents of the C variable
|
||||
/// declaration.</param> <returns></returns>
|
||||
static Declaration* Create(offset_t declAddr, DeclarationAlignment declAlign, size_t declSize,
|
||||
const std::string& declType, const std::string& declName,
|
||||
const std::string& declBody);
|
||||
|
||||
Declaration(offset_t nAddress, const std::string& nIncludePath, size_t nSize,
|
||||
const std::string& nVarType, const std::string& nVarName);
|
||||
/// <summary>
|
||||
/// Creates an array declaration.
|
||||
/// </summary>
|
||||
/// <param name="declAddr">The address inside a binary file this declaration will be in when
|
||||
/// compiled.</param> <param name="declAlign">The alignment of this declaration in the compiled
|
||||
/// binary file.</param> <param name="declSize">The size of this declaration when it is compiled
|
||||
/// to binary data.</param> <param name="declType">The C variable type this declaration will be
|
||||
/// declared as.</param> <param name="declName">The C variable name this declaration will be
|
||||
/// declared as.</param> <param name="declBody">The contents of the C variable
|
||||
/// declaration.</param> <param name="declArrayItemCnt">The number of items in the
|
||||
/// array.</param> <param name="isDeclExternal">(Optional) Is this declaration from another
|
||||
/// segment?</param> <returns></returns>
|
||||
static Declaration* CreateArray(offset_t declAddr, DeclarationAlignment declAlign,
|
||||
size_t declSize, const std::string& declType,
|
||||
const std::string& declName, const std::string& declBody,
|
||||
size_t declArrayItemCnt = 0, bool isDeclExternal = false);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an array declaration who's size in the C code uses a custom string.
|
||||
/// </summary>
|
||||
/// <param name="declAddr">The address inside a binary file this declaration will be in when
|
||||
/// compiled.</param> <param name="declAlign">The alignment of this declaration in the compiled
|
||||
/// binary file.</param> <param name="declSize">The size of this declaration when it is compiled
|
||||
/// to binary data.</param> <param name="declType">The C variable type this declaration will be
|
||||
/// declared as.</param> <param name="declName">The C variable name this declaration will be
|
||||
/// declared as.</param> <param name="declBody">The contents of the C variable
|
||||
/// declaration.</param> <param name="declArrayItemCntStr">The string to be put in the C array's
|
||||
/// size inbetween the brackets.</param> <param name="isDeclExternal">(Optional) Is this
|
||||
/// declaration from another segment?</param> <returns></returns>
|
||||
static Declaration* CreateArray(offset_t declAddr, DeclarationAlignment declAlign,
|
||||
size_t declSize, const std::string& declType,
|
||||
const std::string& declName, const std::string& declBody,
|
||||
const std::string& declArrayItemCntStr,
|
||||
bool isDeclExternal = false);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a declaration who's body uses a #include to include another file
|
||||
/// </summary>
|
||||
/// <param name="declAddr">The address inside a binary file this declaration will be in when
|
||||
/// compiled.</param> <param name="includePath">The path to the file this declaration will be
|
||||
/// #including.</param> <param name="declSize">The size of this declaration when it is compiled
|
||||
/// to binary data.</param> <param name="declType">The C variable type this declaration will be
|
||||
/// declared as.</param> <param name="declName">The C variable name this declaration will be
|
||||
/// declared as.</param> <param name="defines">(Optional) Any #define's we want to have
|
||||
/// outputted by this declaration.</param> <returns></returns>
|
||||
static Declaration* CreateInclude(offset_t declAddr, const std::string& includePath,
|
||||
size_t declSize, const std::string& declType,
|
||||
const std::string& declName, const std::string& defines = "");
|
||||
|
||||
/// <summary>
|
||||
/// Creates a placeholder declaration to be replaced later.
|
||||
/// </summary>
|
||||
/// <param name="declAddr">The address inside a binary file this declaration will be in when
|
||||
/// compiled.</param> <param name="declName">The C variable name this declaration will be
|
||||
/// declared as.</param> <returns></returns>
|
||||
static Declaration* CreatePlaceholder(offset_t declAddr, const std::string& declName);
|
||||
|
||||
bool IsStatic() const;
|
||||
|
||||
// Returns the declaration as C code as it would be in the code file when the body contains the
|
||||
// needed data
|
||||
std::string GetNormalDeclarationStr() const;
|
||||
|
||||
// Returns the declaration as C code as it would be in the code file when the body #include's
|
||||
// another file
|
||||
std::string GetExternalDeclarationStr() const;
|
||||
|
||||
// Generates the extern for this item to be placed in header files.
|
||||
std::string GetExternStr() const;
|
||||
|
||||
// Generates any #define's needed
|
||||
std::string GetDefinesStr() const;
|
||||
|
||||
std::string GetStaticForwardDeclarationStr() const;
|
||||
|
||||
protected:
|
||||
Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
|
||||
const std::string& nText);
|
||||
const std::string& nBody);
|
||||
};
|
||||
|
|
24
tools/ZAPD/ZAPD/ExporterSet.h
Normal file
24
tools/ZAPD/ZAPD/ExporterSet.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
typedef void (*ExporterSetFunc)(ZFile*);
|
||||
typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode);
|
||||
typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i);
|
||||
typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode);
|
||||
typedef void (*ExporterSetFuncVoid3)();
|
||||
typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer);
|
||||
|
||||
class ExporterSet
|
||||
{
|
||||
public:
|
||||
~ExporterSet();
|
||||
|
||||
std::map<ZResourceType, ZResourceExporter*> exporters;
|
||||
ExporterSetFuncVoid parseArgsFunc = nullptr;
|
||||
ExporterSetFuncVoid2 parseFileModeFunc = nullptr;
|
||||
ExporterSetFuncBool processFileModeFunc = nullptr;
|
||||
ExporterSetFunc beginFileFunc = nullptr;
|
||||
ExporterSetFunc endFileFunc = nullptr;
|
||||
ExporterSetFuncVoid3 beginXMLFunc = nullptr;
|
||||
ExporterSetFuncVoid3 endXMLFunc = nullptr;
|
||||
ExporterSetResSave resSaveFunc = nullptr;
|
||||
};
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Utils/Directory.h"
|
||||
#include "Utils/File.h"
|
||||
|
@ -124,6 +125,7 @@ void GameConfig::ConfigFunc_BGConfig(const tinyxml2::XMLElement& element)
|
|||
{
|
||||
bgScreenWidth = element.IntAttribute("ScreenWidth", 320);
|
||||
bgScreenHeight = element.IntAttribute("ScreenHeight", 240);
|
||||
useScreenWidthHeightConstants = element.BoolAttribute("UseScreenWidthHeightConstants", true);
|
||||
}
|
||||
|
||||
void GameConfig::ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element)
|
||||
|
@ -163,6 +165,83 @@ void GameConfig::ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element)
|
|||
externalFiles.push_back(ExternalFile(fs::path(xmlPathValue), fs::path(outPathValue)));
|
||||
}
|
||||
|
||||
void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element)
|
||||
{
|
||||
std::string path = Path::GetDirectoryName(configFilePath);
|
||||
path = path.append("/").append(element.Attribute("File"));
|
||||
tinyxml2::XMLDocument doc;
|
||||
tinyxml2::XMLError eResult = doc.LoadFile(path.c_str());
|
||||
|
||||
if (eResult != tinyxml2::XML_SUCCESS)
|
||||
{
|
||||
throw std::runtime_error("Error: Unable to read enum data.");
|
||||
}
|
||||
|
||||
tinyxml2::XMLNode* root = doc.FirstChild();
|
||||
|
||||
if (root == nullptr)
|
||||
return;
|
||||
|
||||
for (tinyxml2::XMLElement* csEnum = root->FirstChildElement(); csEnum != nullptr;
|
||||
csEnum = csEnum->NextSiblingElement())
|
||||
{
|
||||
for (tinyxml2::XMLElement* item = csEnum->FirstChildElement(); item != nullptr;
|
||||
item = item->NextSiblingElement())
|
||||
{
|
||||
std::string enumKey = csEnum->Attribute("Key");
|
||||
uint16_t itemIndex = atoi(item->Attribute("Index"));
|
||||
const char* itemID = item->Attribute("ID");
|
||||
|
||||
// Common
|
||||
if (enumKey == "cmd")
|
||||
enumData.cutsceneCmd[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "miscType")
|
||||
enumData.miscType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "textType")
|
||||
enumData.textType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "fadeOutSeqPlayer")
|
||||
enumData.fadeOutSeqPlayer[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "transitionType")
|
||||
enumData.transitionType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "destination")
|
||||
enumData.destination[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "naviQuestHintType")
|
||||
enumData.naviQuestHintType[itemIndex] = itemID;
|
||||
|
||||
// MM
|
||||
else if (enumKey == "modifySeqType")
|
||||
enumData.modifySeqType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "chooseCreditsSceneType")
|
||||
enumData.chooseCreditsSceneType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "destinationType")
|
||||
enumData.destinationType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "motionBlurType")
|
||||
enumData.motionBlurType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "transitionGeneralType")
|
||||
enumData.transitionGeneralType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "rumbleType")
|
||||
enumData.rumbleType[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "spawnFlag")
|
||||
enumData.spawnFlag[itemIndex] = itemID;
|
||||
|
||||
else if (enumKey == "endSfx")
|
||||
enumData.endSfx[itemIndex] = itemID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath)
|
||||
{
|
||||
static const std::unordered_map<std::string, ConfigFunc> ConfigFuncDictionary = {
|
||||
|
@ -173,6 +252,7 @@ void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath)
|
|||
{"SpecialEntranceList", &GameConfig::ConfigFunc_specialEntranceList},
|
||||
{"TexturePool", &GameConfig::ConfigFunc_TexturePool},
|
||||
{"BGConfig", &GameConfig::ConfigFunc_BGConfig},
|
||||
{"EnumData", &GameConfig::ConfigFunc_EnumData},
|
||||
{"ExternalXMLFolder", &GameConfig::ConfigFunc_ExternalXMLFolder},
|
||||
{"ExternalFile", &GameConfig::ConfigFunc_ExternalFile},
|
||||
};
|
||||
|
|
|
@ -21,6 +21,32 @@ public:
|
|||
ExternalFile(fs::path nXmlPath, fs::path nOutPath);
|
||||
};
|
||||
|
||||
// Stores data from the XML file, the integer is the index (via ATOI) and the string is the value
|
||||
class EnumData
|
||||
{
|
||||
public:
|
||||
// Common
|
||||
std::map<uint16_t, std::string> cutsceneCmd;
|
||||
std::map<uint16_t, std::string> miscType;
|
||||
std::map<uint16_t, std::string> fadeOutSeqPlayer;
|
||||
std::map<uint16_t, std::string> transitionType;
|
||||
std::map<uint16_t, std::string> naviQuestHintType;
|
||||
|
||||
// OoT
|
||||
std::map<uint16_t, std::string> textType;
|
||||
std::map<uint16_t, std::string> destination;
|
||||
|
||||
// MM
|
||||
std::map<uint16_t, std::string> modifySeqType;
|
||||
std::map<uint16_t, std::string> chooseCreditsSceneType;
|
||||
std::map<uint16_t, std::string> destinationType;
|
||||
std::map<uint16_t, std::string> motionBlurType;
|
||||
std::map<uint16_t, std::string> transitionGeneralType;
|
||||
std::map<uint16_t, std::string> rumbleType;
|
||||
std::map<uint8_t, std::string> spawnFlag;
|
||||
std::map<uint8_t, std::string> endSfx;
|
||||
};
|
||||
|
||||
class ZFile;
|
||||
|
||||
class GameConfig
|
||||
|
@ -34,9 +60,12 @@ public:
|
|||
std::vector<std::string> entranceList;
|
||||
std::vector<std::string> specialEntranceList;
|
||||
std::map<uint32_t, TexturePoolEntry> texturePool; // Key = CRC
|
||||
EnumData enumData;
|
||||
|
||||
// ZBackground
|
||||
uint32_t bgScreenWidth = 320, bgScreenHeight = 240;
|
||||
bool useScreenWidthHeightConstants = true; // If true, ZBackground's will be declared with
|
||||
// SCREEN_WIDTH * SCREEN_HEIGHT in the C file
|
||||
|
||||
// ExternalFile
|
||||
fs::path externalXmlFolder;
|
||||
|
@ -57,6 +86,7 @@ public:
|
|||
void ConfigFunc_BGConfig(const tinyxml2::XMLElement& element);
|
||||
void ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element);
|
||||
void ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element);
|
||||
void ConfigFunc_EnumData(const tinyxml2::XMLElement& element);
|
||||
|
||||
void ReadConfigFile(const fs::path& configFilePath);
|
||||
};
|
||||
|
|
|
@ -83,9 +83,10 @@ ExporterSet* Globals::GetExporterSet()
|
|||
}
|
||||
|
||||
bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile,
|
||||
const std::string& expectedType, std::string& declName)
|
||||
const std::string& expectedType, std::string& declName,
|
||||
bool warnIfNotFound)
|
||||
{
|
||||
if (segAddress == 0)
|
||||
if (segAddress == SEGMENTED_NULL)
|
||||
{
|
||||
declName = "NULL";
|
||||
return true;
|
||||
|
@ -160,14 +161,18 @@ bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile,
|
|||
}
|
||||
|
||||
declName = StringHelper::Sprintf("0x%08X", segAddress);
|
||||
if (warnIfNotFound)
|
||||
{
|
||||
WarnHardcodedPointer(segAddress, currentFile, nullptr, -1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Globals::GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize,
|
||||
ZFile* currentFile, const std::string& expectedType,
|
||||
std::string& declName)
|
||||
std::string& declName, bool warnIfNotFound)
|
||||
{
|
||||
if (segAddress == 0)
|
||||
if (segAddress == SEGMENTED_NULL)
|
||||
{
|
||||
declName = "NULL";
|
||||
return true;
|
||||
|
@ -197,9 +202,36 @@ bool Globals::GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSi
|
|||
}
|
||||
|
||||
declName = StringHelper::Sprintf("0x%08X", segAddress);
|
||||
if (warnIfNotFound)
|
||||
{
|
||||
WarnHardcodedPointer(segAddress, currentFile, nullptr, -1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Globals::WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res,
|
||||
offset_t currentOffset)
|
||||
{
|
||||
uint8_t segment = GETSEGNUM(segAddress);
|
||||
|
||||
if ((segment >= 2 && segment <= 6) || segment == 0x80)
|
||||
{
|
||||
std::string errorHeader = "A hardcoded pointer was found";
|
||||
std::string errorBody = StringHelper::Sprintf("Pointer: 0x%08X", segAddress);
|
||||
|
||||
HANDLE_WARNING_RESOURCE(WarningType::HardcodedPointer, currentFile, res, currentOffset,
|
||||
errorHeader, errorBody);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string errorHeader = "A general purpose hardcoded pointer was found";
|
||||
std::string errorBody = StringHelper::Sprintf("Pointer: 0x%08X", segAddress);
|
||||
|
||||
HANDLE_WARNING_RESOURCE(WarningType::HardcodedGenericPointer, currentFile, res,
|
||||
currentOffset, errorHeader, errorBody);
|
||||
}
|
||||
}
|
||||
|
||||
ExternalFile::ExternalFile(fs::path nXmlPath, fs::path nOutPath)
|
||||
: xmlPath{nXmlPath}, outPath{nOutPath}
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <vector>
|
||||
#include "GameConfig.h"
|
||||
#include "ZFile.h"
|
||||
#include "ExporterSet.h"
|
||||
|
||||
class ZRoom;
|
||||
|
||||
|
@ -15,29 +16,6 @@ enum class VerbosityLevel
|
|||
VERBOSITY_DEBUG
|
||||
};
|
||||
|
||||
typedef void (*ExporterSetFunc)(ZFile*);
|
||||
typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode);
|
||||
typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i);
|
||||
typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode);
|
||||
typedef void (*ExporterSetFuncVoid3)();
|
||||
typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer);
|
||||
|
||||
class ExporterSet
|
||||
{
|
||||
public:
|
||||
~ExporterSet();
|
||||
|
||||
std::map<ZResourceType, ZResourceExporter*> exporters;
|
||||
ExporterSetFuncVoid parseArgsFunc = nullptr;
|
||||
ExporterSetFuncVoid2 parseFileModeFunc = nullptr;
|
||||
ExporterSetFuncBool processFileModeFunc = nullptr;
|
||||
ExporterSetFunc beginFileFunc = nullptr;
|
||||
ExporterSetFunc endFileFunc = nullptr;
|
||||
ExporterSetFuncVoid3 beginXMLFunc = nullptr;
|
||||
ExporterSetFuncVoid3 endXMLFunc = nullptr;
|
||||
ExporterSetResSave resSaveFunc = nullptr;
|
||||
};
|
||||
|
||||
class Globals
|
||||
{
|
||||
public:
|
||||
|
@ -86,8 +64,14 @@ public:
|
|||
* in which case `declName` will be set to the address formatted as a pointer.
|
||||
*/
|
||||
bool GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile,
|
||||
const std::string& expectedType, std::string& declName);
|
||||
const std::string& expectedType, std::string& declName,
|
||||
bool warnIfNotFound = true);
|
||||
|
||||
bool GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile,
|
||||
const std::string& expectedType, std::string& declName);
|
||||
const std::string& expectedType, std::string& declName,
|
||||
bool warnIfNotFound = true);
|
||||
|
||||
// TODO: consider moving to another place
|
||||
void WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res,
|
||||
offset_t currentOffset);
|
||||
};
|
||||
|
|
|
@ -9,24 +9,52 @@
|
|||
#include "ZFile.h"
|
||||
#include "ZTexture.h"
|
||||
|
||||
#include <functional>
|
||||
#include "CrashHandler.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include "tinyxml2.h"
|
||||
|
||||
using ArgFunc = void (*)(int&, char**);
|
||||
|
||||
void Arg_SetOutputPath(int& i, char* argv[]);
|
||||
void Arg_SetInputPath(int& i, char* argv[]);
|
||||
void Arg_SetBaseromPath(int& i, char* argv[]);
|
||||
void Arg_SetSourceOutputPath(int& i, char* argv[]);
|
||||
void Arg_GenerateSourceFile(int& i, char* argv[]);
|
||||
void Arg_TestMode(int& i, char* argv[]);
|
||||
void Arg_LegacyDList(int& i, char* argv[]);
|
||||
void Arg_EnableProfiling(int& i, char* argv[]);
|
||||
void Arg_UseExternalResources(int& i, char* argv[]);
|
||||
void Arg_SetTextureType(int& i, char* argv[]);
|
||||
void Arg_ReadConfigFile(int& i, char* argv[]);
|
||||
void Arg_EnableErrorHandler(int& i, char* argv[]);
|
||||
void Arg_SetVerbosity(int& i, char* argv[]);
|
||||
void Arg_VerboseUnaccounted(int& i, char* argv[]);
|
||||
void Arg_SetExporter(int& i, char* argv[]);
|
||||
void Arg_EnableGCCCompat(int& i, char* argv[]);
|
||||
void Arg_ForceStatic(int& i, char* argv[]);
|
||||
void Arg_ForceUnaccountedStatic(int& i, char* argv[]);
|
||||
|
||||
int main(int argc, char* argv[]);
|
||||
|
||||
bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath,
|
||||
ZFileMode fileMode);
|
||||
|
||||
void ParseArgs(int& argc, char* argv[]);
|
||||
|
||||
void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath);
|
||||
void BuildAssetBackground(const fs::path& imageFilePath, const fs::path& outPath);
|
||||
void BuildAssetBlob(const fs::path& blobFilePath, const fs::path& outPath);
|
||||
ZFileMode ParseFileMode(const std::string& buildMode, ExporterSet* exporterSet);
|
||||
int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet);
|
||||
|
||||
extern const char gBuildHash[];
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Syntax: ZAPD.out [mode (btex/bovl/e)] (Arbritrary Number of Arguments)
|
||||
int returnCode = 0;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
|
@ -55,112 +83,12 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
// Parse other "commands"
|
||||
for (int32_t i = 2; i < argc; i++)
|
||||
{
|
||||
std::string arg = argv[i];
|
||||
|
||||
if (arg == "-o" || arg == "--outputpath") // Set output path
|
||||
{
|
||||
Globals::Instance->outputPath = argv[++i];
|
||||
|
||||
if (Globals::Instance->sourceOutputPath == "")
|
||||
Globals::Instance->sourceOutputPath = Globals::Instance->outputPath;
|
||||
}
|
||||
else if (arg == "-i" || arg == "--inputpath") // Set input path
|
||||
{
|
||||
Globals::Instance->inputPath = argv[++i];
|
||||
}
|
||||
else if (arg == "-b" || arg == "--baserompath") // Set baserom path
|
||||
{
|
||||
Globals::Instance->baseRomPath = argv[++i];
|
||||
}
|
||||
else if (arg == "-osf") // Set source output path
|
||||
{
|
||||
Globals::Instance->sourceOutputPath = argv[++i];
|
||||
}
|
||||
else if (arg == "-gsf") // Generate source file during extraction
|
||||
{
|
||||
Globals::Instance->genSourceFile = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
else if (arg == "-tm") // Test Mode (enables certain experimental features)
|
||||
{
|
||||
Globals::Instance->testMode = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
else if (arg == "-crc" ||
|
||||
arg == "--output-crc") // Outputs a CRC file for each extracted texture.
|
||||
{
|
||||
Globals::Instance->testMode = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
else if (arg == "-ulzdl") // Use Legacy ZDisplay List
|
||||
{
|
||||
Globals::Instance->useLegacyZDList = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
else if (arg == "-profile") // Enable profiling
|
||||
{
|
||||
Globals::Instance->profile = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
else if (arg ==
|
||||
"-uer") // Split resources into their individual components (enabled by default)
|
||||
// TODO: We may wish to make this a part of the config file...
|
||||
{
|
||||
Globals::Instance->useExternalResources = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
else if (arg == "-tt") // Set texture type
|
||||
{
|
||||
Globals::Instance->texType = ZTexture::GetTextureTypeFromString(argv[++i]);
|
||||
}
|
||||
else if (arg == "-rconf") // Read Config File
|
||||
{
|
||||
Globals::Instance->cfg.ReadConfigFile(argv[++i]);
|
||||
}
|
||||
else if (arg == "-eh") // Enable Error Handler
|
||||
{
|
||||
CrashHandler_Init();
|
||||
}
|
||||
else if (arg == "-v") // Verbose
|
||||
{
|
||||
Globals::Instance->verbosity = static_cast<VerbosityLevel>(strtol(argv[++i], NULL, 16));
|
||||
}
|
||||
else if (arg == "-vu" || arg == "--verbose-unaccounted") // Verbose unaccounted
|
||||
{
|
||||
Globals::Instance->verboseUnaccounted = true;
|
||||
}
|
||||
else if (arg == "-se" || arg == "--set-exporter") // Set Current Exporter
|
||||
{
|
||||
Globals::Instance->currentExporter = argv[++i];
|
||||
}
|
||||
else if (arg == "--gcc-compat") // GCC compatibility
|
||||
{
|
||||
Globals::Instance->gccCompat = true;
|
||||
}
|
||||
else if (arg == "-s" || arg == "--static")
|
||||
{
|
||||
Globals::Instance->forceStatic = true;
|
||||
}
|
||||
else if (arg == "-us" || arg == "--unaccounted-static")
|
||||
{
|
||||
Globals::Instance->forceUnaccountedStatic = true;
|
||||
}
|
||||
}
|
||||
ParseArgs(argc, argv);
|
||||
|
||||
// Parse File Mode
|
||||
ExporterSet* exporterSet = Globals::Instance->GetExporterSet();
|
||||
std::string buildMode = argv[1];
|
||||
ZFileMode fileMode = ZFileMode::Invalid;
|
||||
|
||||
if (buildMode == "btex")
|
||||
fileMode = ZFileMode::BuildTexture;
|
||||
else if (buildMode == "bren")
|
||||
fileMode = ZFileMode::BuildBackground;
|
||||
else if (buildMode == "bsf")
|
||||
fileMode = ZFileMode::BuildSourceFile;
|
||||
else if (buildMode == "bblb")
|
||||
fileMode = ZFileMode::BuildBlob;
|
||||
else if (buildMode == "e")
|
||||
fileMode = ZFileMode::Extract;
|
||||
else if (exporterSet != nullptr && exporterSet->parseFileModeFunc != nullptr)
|
||||
exporterSet->parseFileModeFunc(buildMode, fileMode);
|
||||
ZFileMode fileMode = ParseFileMode(buildMode, exporterSet);
|
||||
|
||||
if (fileMode == ZFileMode::Invalid)
|
||||
{
|
||||
|
@ -170,7 +98,6 @@ int main(int argc, char* argv[])
|
|||
|
||||
// We've parsed through our commands once. If an exporter exists, it's been set by now.
|
||||
// Now we'll parse through them again but pass them on to our exporter if one is available.
|
||||
|
||||
if (exporterSet != nullptr && exporterSet->parseArgsFunc != nullptr)
|
||||
{
|
||||
for (int32_t i = 2; i < argc; i++)
|
||||
|
@ -181,62 +108,20 @@ int main(int argc, char* argv[])
|
|||
printf("ZAPD: Zelda Asset Processor For Decomp: %s\n", gBuildHash);
|
||||
|
||||
if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG)
|
||||
{
|
||||
WarningHandler::PrintWarningsDebugInfo();
|
||||
}
|
||||
|
||||
// TODO: switch
|
||||
if (fileMode == ZFileMode::Extract || fileMode == ZFileMode::BuildSourceFile)
|
||||
{
|
||||
bool procFileModeSuccess = false;
|
||||
|
||||
if (exporterSet != nullptr && exporterSet->processFileModeFunc != nullptr)
|
||||
procFileModeSuccess = exporterSet->processFileModeFunc(fileMode);
|
||||
|
||||
if (!procFileModeSuccess)
|
||||
{
|
||||
bool parseSuccessful;
|
||||
|
||||
for (auto& extFile : Globals::Instance->cfg.externalFiles)
|
||||
{
|
||||
fs::path externalXmlFilePath =
|
||||
Globals::Instance->cfg.externalXmlFolder / extFile.xmlPath;
|
||||
|
||||
if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO)
|
||||
{
|
||||
printf("Parsing external file from config: '%s'\n",
|
||||
externalXmlFilePath.c_str());
|
||||
}
|
||||
|
||||
parseSuccessful = Parse(externalXmlFilePath, Globals::Instance->baseRomPath,
|
||||
extFile.outPath, ZFileMode::ExternalFile);
|
||||
|
||||
if (!parseSuccessful)
|
||||
return 1;
|
||||
}
|
||||
|
||||
parseSuccessful = Parse(Globals::Instance->inputPath, Globals::Instance->baseRomPath,
|
||||
Globals::Instance->outputPath, fileMode);
|
||||
if (!parseSuccessful)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
returnCode = HandleExtract(fileMode, exporterSet);
|
||||
else if (fileMode == ZFileMode::BuildTexture)
|
||||
{
|
||||
TextureType texType = Globals::Instance->texType;
|
||||
BuildAssetTexture(Globals::Instance->inputPath, texType, Globals::Instance->outputPath);
|
||||
}
|
||||
BuildAssetTexture(Globals::Instance->inputPath, Globals::Instance->texType,
|
||||
Globals::Instance->outputPath);
|
||||
else if (fileMode == ZFileMode::BuildBackground)
|
||||
{
|
||||
BuildAssetBackground(Globals::Instance->inputPath, Globals::Instance->outputPath);
|
||||
}
|
||||
else if (fileMode == ZFileMode::BuildBlob)
|
||||
{
|
||||
BuildAssetBlob(Globals::Instance->inputPath, Globals::Instance->outputPath);
|
||||
}
|
||||
|
||||
delete g;
|
||||
return 0;
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath,
|
||||
|
@ -339,6 +224,209 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path
|
|||
return true;
|
||||
}
|
||||
|
||||
void ParseArgs(int& argc, char* argv[])
|
||||
{
|
||||
static const std::unordered_map<std::string, ArgFunc> ArgFuncDictionary = {
|
||||
{"-o", &Arg_SetOutputPath},
|
||||
{"--outputpath", &Arg_SetOutputPath},
|
||||
{"-i", &Arg_SetInputPath},
|
||||
{"--inputpath", &Arg_SetInputPath},
|
||||
{"-b", &Arg_SetBaseromPath},
|
||||
{"--baserompath", &Arg_SetBaseromPath},
|
||||
{"-osf", &Arg_SetSourceOutputPath},
|
||||
{"-gsf", &Arg_GenerateSourceFile},
|
||||
{"-tm", &Arg_TestMode},
|
||||
{"-ulzdl", &Arg_LegacyDList},
|
||||
{"-profile", &Arg_EnableProfiling},
|
||||
{"-uer", &Arg_UseExternalResources},
|
||||
{"-tt", &Arg_SetTextureType},
|
||||
{"-rconf", &Arg_ReadConfigFile},
|
||||
{"-eh", &Arg_EnableErrorHandler},
|
||||
{"-v", &Arg_SetVerbosity},
|
||||
{"-vu", &Arg_VerboseUnaccounted},
|
||||
{"--verbose-unaccounted", &Arg_VerboseUnaccounted},
|
||||
{"-se", &Arg_SetExporter},
|
||||
{"--set-exporter", &Arg_SetExporter},
|
||||
{"--gcc-compat", &Arg_EnableGCCCompat},
|
||||
{"-s", &Arg_ForceStatic},
|
||||
{"--static", &Arg_ForceStatic},
|
||||
{"-us", &Arg_ForceUnaccountedStatic},
|
||||
{"--unaccounted-static", &Arg_ForceUnaccountedStatic},
|
||||
};
|
||||
|
||||
for (int32_t i = 2; i < argc; i++)
|
||||
{
|
||||
std::string arg = argv[i];
|
||||
|
||||
// Ignore warning args as they have already been parsed
|
||||
if (arg.length() > 2 && arg[0] == '-' && arg[1] == 'W' && arg[2] != '\0')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
auto it = ArgFuncDictionary.find(arg);
|
||||
if (it == ArgFuncDictionary.end())
|
||||
{
|
||||
fprintf(stderr, "Unsupported argument: %s\n", arg.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
std::invoke(it->second, i, argv);
|
||||
}
|
||||
}
|
||||
|
||||
ZFileMode ParseFileMode(const std::string& buildMode, ExporterSet* exporterSet)
|
||||
{
|
||||
ZFileMode fileMode = ZFileMode::Invalid;
|
||||
|
||||
if (buildMode == "btex")
|
||||
fileMode = ZFileMode::BuildTexture;
|
||||
else if (buildMode == "bren")
|
||||
fileMode = ZFileMode::BuildBackground;
|
||||
else if (buildMode == "bsf")
|
||||
fileMode = ZFileMode::BuildSourceFile;
|
||||
else if (buildMode == "bblb")
|
||||
fileMode = ZFileMode::BuildBlob;
|
||||
else if (buildMode == "e")
|
||||
fileMode = ZFileMode::Extract;
|
||||
else if (exporterSet != nullptr && exporterSet->parseFileModeFunc != nullptr)
|
||||
exporterSet->parseFileModeFunc(buildMode, fileMode);
|
||||
|
||||
return fileMode;
|
||||
}
|
||||
|
||||
void Arg_SetOutputPath(int& i, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
Globals::Instance->outputPath = argv[++i];
|
||||
|
||||
if (Globals::Instance->sourceOutputPath == "")
|
||||
Globals::Instance->sourceOutputPath = Globals::Instance->outputPath;
|
||||
}
|
||||
|
||||
void Arg_SetInputPath(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->inputPath = argv[++i];
|
||||
}
|
||||
|
||||
void Arg_SetBaseromPath(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->baseRomPath = argv[++i];
|
||||
}
|
||||
|
||||
void Arg_SetSourceOutputPath(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->sourceOutputPath = argv[++i];
|
||||
}
|
||||
|
||||
void Arg_GenerateSourceFile(int& i, char* argv[])
|
||||
{
|
||||
// Generate source file during extraction
|
||||
Globals::Instance->genSourceFile = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
|
||||
void Arg_TestMode(int& i, char* argv[])
|
||||
{
|
||||
// Test Mode (enables certain experimental features)
|
||||
Globals::Instance->testMode = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
|
||||
void Arg_LegacyDList(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->useLegacyZDList = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
|
||||
void Arg_EnableProfiling(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->profile = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
|
||||
void Arg_UseExternalResources(int& i, char* argv[])
|
||||
{
|
||||
// Split resources into their individual components(enabled by default)
|
||||
// TODO: We may wish to make this a part of the config file...
|
||||
Globals::Instance->useExternalResources = std::string_view(argv[++i]) == "1";
|
||||
}
|
||||
|
||||
void Arg_SetTextureType(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->texType = ZTexture::GetTextureTypeFromString(argv[++i]);
|
||||
}
|
||||
|
||||
void Arg_ReadConfigFile(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->cfg.ReadConfigFile(argv[++i]);
|
||||
}
|
||||
|
||||
void Arg_EnableErrorHandler([[maybe_unused]] int& i, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
CrashHandler_Init();
|
||||
}
|
||||
|
||||
void Arg_SetVerbosity(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->verbosity = static_cast<VerbosityLevel>(strtol(argv[++i], NULL, 16));
|
||||
}
|
||||
|
||||
void Arg_VerboseUnaccounted([[maybe_unused]] int& i, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
Globals::Instance->verboseUnaccounted = true;
|
||||
}
|
||||
|
||||
void Arg_SetExporter(int& i, char* argv[])
|
||||
{
|
||||
Globals::Instance->currentExporter = argv[++i];
|
||||
}
|
||||
|
||||
void Arg_EnableGCCCompat([[maybe_unused]] int& i, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
Globals::Instance->gccCompat = true;
|
||||
}
|
||||
|
||||
void Arg_ForceStatic([[maybe_unused]] int& i, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
Globals::Instance->forceStatic = true;
|
||||
}
|
||||
|
||||
void Arg_ForceUnaccountedStatic([[maybe_unused]] int& i, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
Globals::Instance->forceUnaccountedStatic = true;
|
||||
}
|
||||
|
||||
int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet)
|
||||
{
|
||||
bool procFileModeSuccess = false;
|
||||
|
||||
if (exporterSet != nullptr && exporterSet->processFileModeFunc != nullptr)
|
||||
procFileModeSuccess = exporterSet->processFileModeFunc(fileMode);
|
||||
|
||||
if (!procFileModeSuccess)
|
||||
{
|
||||
bool parseSuccessful;
|
||||
|
||||
for (auto& extFile : Globals::Instance->cfg.externalFiles)
|
||||
{
|
||||
fs::path externalXmlFilePath =
|
||||
Globals::Instance->cfg.externalXmlFolder / extFile.xmlPath;
|
||||
|
||||
if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO)
|
||||
printf("Parsing external file from config: '%s'\n", externalXmlFilePath.c_str());
|
||||
|
||||
parseSuccessful = Parse(externalXmlFilePath, Globals::Instance->baseRomPath,
|
||||
extFile.outPath, ZFileMode::ExternalFile);
|
||||
|
||||
if (!parseSuccessful)
|
||||
return 1;
|
||||
}
|
||||
|
||||
parseSuccessful = Parse(Globals::Instance->inputPath, Globals::Instance->baseRomPath,
|
||||
Globals::Instance->outputPath, fileMode);
|
||||
if (!parseSuccessful)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath)
|
||||
{
|
||||
std::string name = outPath.stem().string();
|
||||
|
|
|
@ -1,40 +1,46 @@
|
|||
#include "CutsceneMM_Commands.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
// Specific for command lists where each entry has size 8 bytes
|
||||
const std::unordered_map<CutsceneMMCommands, CsCommandListDescriptor> csCommandsDescMM = {
|
||||
{CutsceneMMCommands::CS_CMD_MISC, {"CS_MISC", "(0x%02X, %i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_SET_LIGHTING, {"CS_LIGHTING", "(0x%02X, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_SCENE_TRANS_FX, {"CS_SCENE_TRANS_FX", "(%i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_MOTIONBLUR, {"CS_MOTIONBLUR", "(%i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_GIVETATL, {"CS_GIVETATL", "(%i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_PLAYSEQ, {"CS_PLAYSEQ", "(0x%04X, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_130, {"CS_SCENE_UNK_130", "(0x%04X, %i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_131, {"CS_SCENE_UNK_131", "(0x%04X, %i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_132, {"CS_SCENE_UNK_132", "(%i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_STOPSEQ, {"CS_STOPSEQ", "(0x%04X, %i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_PLAYAMBIENCE, {"CS_PLAYAMBIENCE", "(0x%04X, %i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_FADEAMBIENCE, {"CS_FADEAMBIENCE", "(0x%04X, %i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_TERMINATOR, {"CS_TERMINATOR", "(%i, %i, %i)"}},
|
||||
{CutsceneMMCommands::CS_CMD_CHOOSE_CREDITS_SCENES,
|
||||
{"CS_CHOOSE_CREDITS_SCENES", "(%i, %i, %i)"}},
|
||||
const std::unordered_map<CutsceneMM_CommandType, CsCommandListDescriptor> csCommandsDescMM = {
|
||||
{CutsceneMM_CommandType::CS_CMD_MISC, {"CS_MISC", "(%s, %i, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING, {"CS_LIGHT_SETTING", "(0x%02X, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_TRANSITION, {"CS_TRANSITION", "(%s, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_MOTION_BLUR, {"CS_MOTION_BLUR", "(%s, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_GIVE_TATL, {"CS_GIVE_TATL", "(%s, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_START_SEQ, {"CS_START_SEQ", "(0x%04X, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_2,
|
||||
{"CS_SFX_REVERB_INDEX_2", "(0x%04X, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_1,
|
||||
{"CS_SFX_REVERB_INDEX_1", "(0x%04X, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ, {"CS_MODIFY_SEQ", "(%s, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_STOP_SEQ, {"CS_STOP_SEQ", "(0x%04X, %i, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_START_AMBIENCE, {"CS_START_AMBIENCE", "(0x%04X, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_FADE_OUT_AMBIENCE,
|
||||
{"CS_FADE_OUT_AMBIENCE", "(0x%04X, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_DESTINATION, {"CS_DESTINATION", "(%s, %i, %i)"}},
|
||||
{CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES,
|
||||
{"CS_CHOOSE_CREDITS_SCENES", "(%s, %i, %i)"}},
|
||||
};
|
||||
|
||||
CutsceneSubCommandEntry_GenericMMCmd::CutsceneSubCommandEntry_GenericMMCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneMMCommands cmdId)
|
||||
CutsceneMMSubCommandEntry_GenericCmd::CutsceneMMSubCommandEntry_GenericCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneMM_CommandType cmdId)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId)
|
||||
{
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_GenericMMCmd::GetBodySourceCode() const
|
||||
std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
const auto& element = csCommandsDescMM.find(commandId);
|
||||
std::string entryFmt = "CS_UNK_DATA(0x%02X, %i, %i, %i)";
|
||||
std::string type = "";
|
||||
|
||||
if (element != csCommandsDescMM.end())
|
||||
{
|
||||
|
@ -42,12 +48,49 @@ std::string CutsceneSubCommandEntry_GenericMMCmd::GetBodySourceCode() const
|
|||
entryFmt += element->second.args;
|
||||
}
|
||||
|
||||
if (commandId == CutsceneMM_CommandType::CS_CMD_MISC &&
|
||||
enumData->miscType.find(base) != enumData->miscType.end())
|
||||
type = enumData->miscType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_TRANSITION &&
|
||||
enumData->transitionType.find(base) != enumData->transitionType.end())
|
||||
type = enumData->transitionType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_MOTION_BLUR &&
|
||||
enumData->motionBlurType.find(base) != enumData->motionBlurType.end())
|
||||
type = enumData->motionBlurType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ &&
|
||||
enumData->modifySeqType.find(base) != enumData->modifySeqType.end())
|
||||
type = enumData->modifySeqType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_DESTINATION &&
|
||||
enumData->destinationType.find(base) != enumData->destinationType.end())
|
||||
type = enumData->destinationType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES &&
|
||||
enumData->chooseCreditsSceneType.find(base) != enumData->chooseCreditsSceneType.end())
|
||||
type = enumData->chooseCreditsSceneType[base];
|
||||
|
||||
else if (commandId == CutsceneMM_CommandType::CS_CMD_GIVE_TATL)
|
||||
type = base ? "true" : "false";
|
||||
|
||||
if (type != "")
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), type.c_str(), startFrame, endFrame, pad);
|
||||
|
||||
if (commandId == CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING ||
|
||||
commandId == CutsceneMM_CommandType::CS_CMD_START_SEQ ||
|
||||
commandId == CutsceneMM_CommandType::CS_CMD_STOP_SEQ)
|
||||
{
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), base - 1, startFrame, endFrame, pad);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), base, startFrame, endFrame, pad);
|
||||
}
|
||||
|
||||
CutsceneMMCommand_GenericCmd::CutsceneMMCommand_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex,
|
||||
CutsceneMMCommands cmdId)
|
||||
CutsceneMM_CommandType cmdId)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
@ -57,7 +100,7 @@ CutsceneMMCommand_GenericCmd::CutsceneMMCommand_GenericCmd(const std::vector<uin
|
|||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_GenericMMCmd(rawData, rawDataIndex, cmdId);
|
||||
auto* entry = new CutsceneMMSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
|
@ -65,7 +108,7 @@ CutsceneMMCommand_GenericCmd::CutsceneMMCommand_GenericCmd(const std::vector<uin
|
|||
|
||||
std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const
|
||||
{
|
||||
const auto& element = csCommandsDescMM.find(static_cast<CutsceneMMCommands>(commandID));
|
||||
const auto& element = csCommandsDescMM.find(static_cast<CutsceneMM_CommandType>(commandID));
|
||||
|
||||
if (element != csCommandsDescMM.end())
|
||||
{
|
||||
|
@ -75,6 +118,8 @@ std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const
|
|||
return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
CutsceneSubCommandEntry_Camera::CutsceneSubCommandEntry_Camera(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
|
@ -108,10 +153,12 @@ CutsceneMMCommand_Camera::CutsceneMMCommand_Camera(const std::vector<uint8_t>& r
|
|||
|
||||
std::string CutsceneMMCommand_Camera::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_CAMERA_LIST(%i)", numEntries);
|
||||
return StringHelper::Sprintf("CS_CAM_SPLINE_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_FadeScreen::CutsceneSubCommandEntry_FadeScreen(
|
||||
/**** TRANSITION GENERAL ****/
|
||||
|
||||
CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGeneral(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
|
@ -123,18 +170,71 @@ CutsceneSubCommandEntry_FadeScreen::CutsceneSubCommandEntry_FadeScreen(
|
|||
unk_0B = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0B);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_FadeScreen::GetBodySourceCode() const
|
||||
std::string CutsceneSubCommandEntry_TransitionGeneral::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADESCREEN(0x%02X, %i, %i, %i, %i, %i)", base, startFrame,
|
||||
endFrame, unk_06, unk_07, unk_08);
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->transitionGeneralType.find(base) != enumData->transitionGeneralType.end())
|
||||
return StringHelper::Sprintf("CS_TRANSITION_GENERAL(%s, %i, %i, %i, %i, %i)",
|
||||
enumData->transitionGeneralType[base].c_str(), startFrame,
|
||||
endFrame, unk_06, unk_07, unk_08);
|
||||
|
||||
return StringHelper::Sprintf("CS_TRANSITION_GENERAL(0x%02X, %i, %i, %i, %i, %i)", base,
|
||||
startFrame, endFrame, unk_06, unk_07, unk_08);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_FadeScreen::GetRawSize() const
|
||||
size_t CutsceneSubCommandEntry_TransitionGeneral::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_FadeScreen::CutsceneMMCommand_FadeScreen(const std::vector<uint8_t>& rawData,
|
||||
CutsceneMMCommand_TransitionGeneral::CutsceneMMCommand_TransitionGeneral(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_TransitionGeneral(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_TransitionGeneral::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TRANSITION_GENERAL_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_FadeOutSeq::CutsceneSubCommandEntry_FadeOutSeq(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
unk_08 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8);
|
||||
}
|
||||
|
||||
/**** FADE OUT SEQUENCE ****/
|
||||
|
||||
std::string CutsceneSubCommandEntry_FadeOutSeq::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end())
|
||||
return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%s, %i, %i)",
|
||||
enumData->fadeOutSeqPlayer[base].c_str(), startFrame,
|
||||
endFrame);
|
||||
|
||||
return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%i, %i, %i)", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_FadeOutSeq::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_FadeOutSeq::CutsceneMMCommand_FadeOutSeq(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
|
@ -143,53 +243,18 @@ CutsceneMMCommand_FadeScreen::CutsceneMMCommand_FadeScreen(const std::vector<uin
|
|||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_FadeScreen(rawData, rawDataIndex);
|
||||
auto* entry = new CutsceneSubCommandEntry_FadeOutSeq(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_FadeScreen::GetCommandMacro() const
|
||||
std::string CutsceneMMCommand_FadeOutSeq::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADESCREEN_LIST(%i)", numEntries);
|
||||
return StringHelper::Sprintf("CS_FADE_OUT_SEQ_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_FadeSeq::CutsceneSubCommandEntry_FadeSeq(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
unk_08 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_FadeSeq::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADESEQ(%i, %i, %i)", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_FadeSeq::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_FadeSeq::CutsceneMMCommand_FadeSeq(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_FadeSeq(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_FadeSeq::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADESEQ_LIST(%i)", numEntries);
|
||||
}
|
||||
/**** NON IMPLEMENTED ****/
|
||||
|
||||
CutsceneSubCommandEntry_NonImplemented::CutsceneSubCommandEntry_NonImplemented(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
|
@ -211,3 +276,207 @@ CutsceneMMCommand_NonImplemented::CutsceneMMCommand_NonImplemented(
|
|||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
CutsceneMMSubCommandEntry_Rumble::CutsceneMMSubCommandEntry_Rumble(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
intensity = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06);
|
||||
decayTimer = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07);
|
||||
decayStep = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
}
|
||||
|
||||
std::string CutsceneMMSubCommandEntry_Rumble::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->rumbleType.find(base) != enumData->rumbleType.end())
|
||||
return StringHelper::Sprintf("CS_RUMBLE(%s, %i, %i, 0x%02X, 0x%02X, 0x%02X)",
|
||||
enumData->rumbleType[base].c_str(), startFrame, endFrame,
|
||||
intensity, decayTimer, decayStep);
|
||||
|
||||
return StringHelper::Sprintf("CS_RUMBLE(0x%04X, %i, %i, 0x%02X, 0x%02X, 0x%02X)", base,
|
||||
startFrame, endFrame, intensity, decayTimer, decayStep);
|
||||
}
|
||||
|
||||
size_t CutsceneMMSubCommandEntry_Rumble::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_Rumble::CutsceneMMCommand_Rumble(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_Rumble(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_Rumble::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_RUMBLE_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
CutsceneMMSubCommandEntry_Text::CutsceneMMSubCommandEntry_Text(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
}
|
||||
|
||||
std::string CutsceneMMSubCommandEntry_Text::GetBodySourceCode() const
|
||||
{
|
||||
if (type == 0xFFFF)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame);
|
||||
}
|
||||
|
||||
if (type == 2)
|
||||
{
|
||||
// TODO: set the enum name when it will be documented
|
||||
// (https://github.com/Decompollaborate/mm/blob/3e1c568c084671c17836ced904714ea49d989621/include/z64ocarina.h#L35-L118)
|
||||
return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%i, %i, %i, 0x%X)", base, startFrame,
|
||||
endFrame, textId1);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
return StringHelper::Sprintf("CS_TEXT_DEFAULT(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, textId1, textId2);
|
||||
|
||||
case 1:
|
||||
return StringHelper::Sprintf("CS_TEXT_TYPE_1(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, textId1, textId2);
|
||||
|
||||
case 3:
|
||||
return StringHelper::Sprintf("CS_TEXT_TYPE_3(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, textId1, textId2);
|
||||
|
||||
case 4:
|
||||
return StringHelper::Sprintf("CS_TEXT_BOSSES_REMAINS(0x%X, %i, %i, 0x%X)", base, startFrame,
|
||||
endFrame, textId1);
|
||||
|
||||
case 5:
|
||||
return StringHelper::Sprintf("CS_TEXT_ALL_NORMAL_MASKS(0x%X, %i, %i, 0x%X)", base,
|
||||
startFrame, endFrame, textId1);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t CutsceneMMSubCommandEntry_Text::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_Text::CutsceneMMCommand_Text(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_Text(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_Text::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
CutsceneMMSubCommandEntry_ActorCue::CutsceneMMSubCommandEntry_ActorCue(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC);
|
||||
startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10);
|
||||
startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14);
|
||||
endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18);
|
||||
endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20);
|
||||
normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24);
|
||||
normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28);
|
||||
normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneMMSubCommandEntry_ActorCue::GetBodySourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
if (static_cast<CutsceneMM_CommandType>(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
result = "CS_PLAYER_CUE";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "CS_ACTOR_CUE";
|
||||
}
|
||||
|
||||
result +=
|
||||
StringHelper::Sprintf("(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, "
|
||||
"%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)",
|
||||
base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY,
|
||||
startPosZ, endPosX, endPosY, endPosZ, normalX, normalY, normalZ);
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneMMSubCommandEntry_ActorCue::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_ActorCue::CutsceneMMCommand_ActorCue(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneMMSubCommandEntry_ActorCue(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_ActorCue::GetCommandMacro() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneMM_CommandType>(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)",
|
||||
enumData->cutsceneCmd[commandID].c_str(), numEntries);
|
||||
}
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%03X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
|
|
@ -1,51 +1,256 @@
|
|||
#pragma once
|
||||
|
||||
#include "Cutscene_Commands.h"
|
||||
#include "Cutscene_Common.h"
|
||||
|
||||
enum class CutsceneMMCommands
|
||||
// https://github.com/zeldaret/mm/blob/0c7b90cf97f26483c8b6a98ae099a295f61e72ab/include/z64cutscene.h#L294-530
|
||||
enum class CutsceneMM_CommandType
|
||||
{
|
||||
/* 0x00A */ CS_CMD_TEXTBOX = 0xA,
|
||||
/* 0x05A */ CS_CMD_CAMERA = 0x5A,
|
||||
/* 0x096 */ CS_CMD_MISC = 0x96,
|
||||
/* 0x097 */ CS_CMD_SET_LIGHTING,
|
||||
/* 0x098 */ CS_CMD_SCENE_TRANS_FX,
|
||||
/* 0x099 */ CS_CMD_MOTIONBLUR,
|
||||
/* 0x09A */ CS_CMD_GIVETATL,
|
||||
/* 0x09B */ CS_CMD_FADESCREEN,
|
||||
/* 0x09C */ CS_CMD_FADESEQ,
|
||||
/* 0x09D */ CS_CMD_SETTIME,
|
||||
/* 0x0C8 */ CS_CMD_SET_PLAYER_ACTION = 0xC8,
|
||||
/* 0x0FA */ CS_CMD_UNK_FA = 0xFA,
|
||||
/* 0x0FE */ CS_CMD_UNK_FE = 0xFE,
|
||||
/* 0x0FF */ CS_CMD_UNK_FF,
|
||||
/* 0x100 */ CS_CMD_UNK_100,
|
||||
/* 0x101 */ CS_CMD_UNK_101,
|
||||
/* 0x102 */ CS_CMD_UNK_102,
|
||||
/* 0x103 */ CS_CMD_UNK_103,
|
||||
/* 0x104 */ CS_CMD_UNK_104,
|
||||
/* 0x105 */ CS_CMD_UNK_105,
|
||||
/* 0x108 */ CS_CMD_UNK_108 = 0x108,
|
||||
/* 0x109 */ CS_CMD_UNK_109,
|
||||
/* 0x12C */ CS_CMD_PLAYSEQ = 0x12C,
|
||||
/* 0x12D */ CS_CMD_UNK_12D,
|
||||
/* 0x130 */ CS_CMD_130 = 0x130,
|
||||
/* 0x131 */ CS_CMD_131 = 0x131,
|
||||
/* 0x132 */ CS_CMD_132 = 0x132,
|
||||
/* 0x133 */ CS_CMD_STOPSEQ,
|
||||
/* 0x134 */ CS_CMD_PLAYAMBIENCE,
|
||||
/* 0x135 */ CS_CMD_FADEAMBIENCE,
|
||||
/* 0x15E */ CS_CMD_TERMINATOR = 0x15E,
|
||||
/* -2 */ CS_CMD_ACTOR_CUE_POST_PROCESS = -2,
|
||||
/* -1 */ CS_CAM_STOP,
|
||||
/* 0x00A */ CS_CMD_TEXT = 10,
|
||||
/* 0x05A */ CS_CMD_CAMERA_SPLINE = 90,
|
||||
/* 0x064 */ CS_CMD_ACTOR_CUE_100 = 100,
|
||||
/* 0x065 */ CS_CMD_ACTOR_CUE_101,
|
||||
/* 0x066 */ CS_CMD_ACTOR_CUE_102,
|
||||
/* 0x067 */ CS_CMD_ACTOR_CUE_103,
|
||||
/* 0x068 */ CS_CMD_ACTOR_CUE_104,
|
||||
/* 0x069 */ CS_CMD_ACTOR_CUE_105,
|
||||
/* 0x06A */ CS_CMD_ACTOR_CUE_106,
|
||||
/* 0x06B */ CS_CMD_ACTOR_CUE_107,
|
||||
/* 0x06C */ CS_CMD_ACTOR_CUE_108,
|
||||
/* 0x06D */ CS_CMD_ACTOR_CUE_109,
|
||||
/* 0x06E */ CS_CMD_ACTOR_CUE_110,
|
||||
/* 0x06F */ CS_CMD_ACTOR_CUE_111,
|
||||
/* 0x070 */ CS_CMD_ACTOR_CUE_112,
|
||||
/* 0x071 */ CS_CMD_ACTOR_CUE_113,
|
||||
/* 0x072 */ CS_CMD_ACTOR_CUE_114,
|
||||
/* 0x073 */ CS_CMD_ACTOR_CUE_115,
|
||||
/* 0x074 */ CS_CMD_ACTOR_CUE_116,
|
||||
/* 0x075 */ CS_CMD_ACTOR_CUE_117,
|
||||
/* 0x076 */ CS_CMD_ACTOR_CUE_118,
|
||||
/* 0x077 */ CS_CMD_ACTOR_CUE_119,
|
||||
/* 0x078 */ CS_CMD_ACTOR_CUE_120,
|
||||
/* 0x079 */ CS_CMD_ACTOR_CUE_121,
|
||||
/* 0x07A */ CS_CMD_ACTOR_CUE_122,
|
||||
/* 0x07B */ CS_CMD_ACTOR_CUE_123,
|
||||
/* 0x07C */ CS_CMD_ACTOR_CUE_124,
|
||||
/* 0x07D */ CS_CMD_ACTOR_CUE_125,
|
||||
/* 0x07E */ CS_CMD_ACTOR_CUE_126,
|
||||
/* 0x07F */ CS_CMD_ACTOR_CUE_127,
|
||||
/* 0x080 */ CS_CMD_ACTOR_CUE_128,
|
||||
/* 0x081 */ CS_CMD_ACTOR_CUE_129,
|
||||
/* 0x082 */ CS_CMD_ACTOR_CUE_130,
|
||||
/* 0x083 */ CS_CMD_ACTOR_CUE_131,
|
||||
/* 0x084 */ CS_CMD_ACTOR_CUE_132,
|
||||
/* 0x085 */ CS_CMD_ACTOR_CUE_133,
|
||||
/* 0x086 */ CS_CMD_ACTOR_CUE_134,
|
||||
/* 0x087 */ CS_CMD_ACTOR_CUE_135,
|
||||
/* 0x088 */ CS_CMD_ACTOR_CUE_136,
|
||||
/* 0x089 */ CS_CMD_ACTOR_CUE_137,
|
||||
/* 0x08A */ CS_CMD_ACTOR_CUE_138,
|
||||
/* 0x08B */ CS_CMD_ACTOR_CUE_139,
|
||||
/* 0x08C */ CS_CMD_ACTOR_CUE_140,
|
||||
/* 0x08D */ CS_CMD_ACTOR_CUE_141,
|
||||
/* 0x08E */ CS_CMD_ACTOR_CUE_142,
|
||||
/* 0x08F */ CS_CMD_ACTOR_CUE_143,
|
||||
/* 0x090 */ CS_CMD_ACTOR_CUE_144,
|
||||
/* 0x091 */ CS_CMD_ACTOR_CUE_145,
|
||||
/* 0x092 */ CS_CMD_ACTOR_CUE_146,
|
||||
/* 0x093 */ CS_CMD_ACTOR_CUE_147,
|
||||
/* 0x094 */ CS_CMD_ACTOR_CUE_148,
|
||||
/* 0x095 */ CS_CMD_ACTOR_CUE_149,
|
||||
/* 0x096 */ CS_CMD_MISC,
|
||||
/* 0x097 */ CS_CMD_LIGHT_SETTING,
|
||||
/* 0x098 */ CS_CMD_TRANSITION,
|
||||
/* 0x099 */ CS_CMD_MOTION_BLUR,
|
||||
/* 0x09A */ CS_CMD_GIVE_TATL,
|
||||
/* 0x09B */ CS_CMD_TRANSITION_GENERAL,
|
||||
/* 0x09C */ CS_CMD_FADE_OUT_SEQ,
|
||||
/* 0x09D */ CS_CMD_TIME,
|
||||
/* 0x0C8 */ CS_CMD_PLAYER_CUE = 200,
|
||||
/* 0x0C9 */ CS_CMD_ACTOR_CUE_201,
|
||||
/* 0x0FA */ CS_CMD_UNK_DATA_FA = 0xFA,
|
||||
/* 0x0FE */ CS_CMD_UNK_DATA_FE = 0xFE,
|
||||
/* 0x0FF */ CS_CMD_UNK_DATA_FF,
|
||||
/* 0x100 */ CS_CMD_UNK_DATA_100,
|
||||
/* 0x101 */ CS_CMD_UNK_DATA_101,
|
||||
/* 0x102 */ CS_CMD_UNK_DATA_102,
|
||||
/* 0x103 */ CS_CMD_UNK_DATA_103,
|
||||
/* 0x104 */ CS_CMD_UNK_DATA_104,
|
||||
/* 0x105 */ CS_CMD_UNK_DATA_105,
|
||||
/* 0x108 */ CS_CMD_UNK_DATA_108 = 0x108,
|
||||
/* 0x109 */ CS_CMD_UNK_DATA_109,
|
||||
/* 0x12C */ CS_CMD_START_SEQ = 300,
|
||||
/* 0x12D */ CS_CMD_STOP_SEQ,
|
||||
/* 0x12E */ CS_CMD_START_AMBIENCE,
|
||||
/* 0x12F */ CS_CMD_FADE_OUT_AMBIENCE,
|
||||
/* 0x130 */ CS_CMD_SFX_REVERB_INDEX_2,
|
||||
/* 0x131 */ CS_CMD_SFX_REVERB_INDEX_1,
|
||||
/* 0x132 */ CS_CMD_MODIFY_SEQ,
|
||||
/* 0x15E */ CS_CMD_DESTINATION = 350,
|
||||
/* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES,
|
||||
/* 0x190 */ CS_CMD_RUMBLE = 0x190,
|
||||
/* 0x190 */ CS_CMD_RUMBLE = 400,
|
||||
/* 0x1C2 */ CS_CMD_ACTOR_CUE_450 = 450,
|
||||
/* 0x1C3 */ CS_CMD_ACTOR_CUE_451,
|
||||
/* 0x1C4 */ CS_CMD_ACTOR_CUE_452,
|
||||
/* 0x1C5 */ CS_CMD_ACTOR_CUE_453,
|
||||
/* 0x1C6 */ CS_CMD_ACTOR_CUE_454,
|
||||
/* 0x1C7 */ CS_CMD_ACTOR_CUE_455,
|
||||
/* 0x1C8 */ CS_CMD_ACTOR_CUE_456,
|
||||
/* 0x1C9 */ CS_CMD_ACTOR_CUE_457,
|
||||
/* 0x1CA */ CS_CMD_ACTOR_CUE_458,
|
||||
/* 0x1CB */ CS_CMD_ACTOR_CUE_459,
|
||||
/* 0x1CC */ CS_CMD_ACTOR_CUE_460,
|
||||
/* 0x1CD */ CS_CMD_ACTOR_CUE_461,
|
||||
/* 0x1CE */ CS_CMD_ACTOR_CUE_462,
|
||||
/* 0x1CF */ CS_CMD_ACTOR_CUE_463,
|
||||
/* 0x1D0 */ CS_CMD_ACTOR_CUE_464,
|
||||
/* 0x1D1 */ CS_CMD_ACTOR_CUE_465,
|
||||
/* 0x1D2 */ CS_CMD_ACTOR_CUE_466,
|
||||
/* 0x1D3 */ CS_CMD_ACTOR_CUE_467,
|
||||
/* 0x1D4 */ CS_CMD_ACTOR_CUE_468,
|
||||
/* 0x1D5 */ CS_CMD_ACTOR_CUE_469,
|
||||
/* 0x1D6 */ CS_CMD_ACTOR_CUE_470,
|
||||
/* 0x1D7 */ CS_CMD_ACTOR_CUE_471,
|
||||
/* 0x1D8 */ CS_CMD_ACTOR_CUE_472,
|
||||
/* 0x1D9 */ CS_CMD_ACTOR_CUE_473,
|
||||
/* 0x1DA */ CS_CMD_ACTOR_CUE_474,
|
||||
/* 0x1DB */ CS_CMD_ACTOR_CUE_475,
|
||||
/* 0x1DC */ CS_CMD_ACTOR_CUE_476,
|
||||
/* 0x1DD */ CS_CMD_ACTOR_CUE_477,
|
||||
/* 0x1DE */ CS_CMD_ACTOR_CUE_478,
|
||||
/* 0x1DF */ CS_CMD_ACTOR_CUE_479,
|
||||
/* 0x1E0 */ CS_CMD_ACTOR_CUE_480,
|
||||
/* 0x1E1 */ CS_CMD_ACTOR_CUE_481,
|
||||
/* 0x1E2 */ CS_CMD_ACTOR_CUE_482,
|
||||
/* 0x1E3 */ CS_CMD_ACTOR_CUE_483,
|
||||
/* 0x1E4 */ CS_CMD_ACTOR_CUE_484,
|
||||
/* 0x1E5 */ CS_CMD_ACTOR_CUE_485,
|
||||
/* 0x1E6 */ CS_CMD_ACTOR_CUE_486,
|
||||
/* 0x1E7 */ CS_CMD_ACTOR_CUE_487,
|
||||
/* 0x1E8 */ CS_CMD_ACTOR_CUE_488,
|
||||
/* 0x1E9 */ CS_CMD_ACTOR_CUE_489,
|
||||
/* 0x1EA */ CS_CMD_ACTOR_CUE_490,
|
||||
/* 0x1EB */ CS_CMD_ACTOR_CUE_491,
|
||||
/* 0x1EC */ CS_CMD_ACTOR_CUE_492,
|
||||
/* 0x1ED */ CS_CMD_ACTOR_CUE_493,
|
||||
/* 0x1EE */ CS_CMD_ACTOR_CUE_494,
|
||||
/* 0x1EF */ CS_CMD_ACTOR_CUE_495,
|
||||
/* 0x1F0 */ CS_CMD_ACTOR_CUE_496,
|
||||
/* 0x1F1 */ CS_CMD_ACTOR_CUE_497,
|
||||
/* 0x1F2 */ CS_CMD_ACTOR_CUE_498,
|
||||
/* 0x1F3 */ CS_CMD_ACTOR_CUE_499,
|
||||
/* 0x1F4 */ CS_CMD_ACTOR_CUE_500,
|
||||
/* 0x1F5 */ CS_CMD_ACTOR_CUE_501,
|
||||
/* 0x1F6 */ CS_CMD_ACTOR_CUE_502,
|
||||
/* 0x1F7 */ CS_CMD_ACTOR_CUE_503,
|
||||
/* 0x1F8 */ CS_CMD_ACTOR_CUE_504,
|
||||
/* 0x1F9 */ CS_CMD_ACTOR_CUE_SOTCS,
|
||||
/* 0x1FA */ CS_CMD_ACTOR_CUE_506,
|
||||
/* 0x1FB */ CS_CMD_ACTOR_CUE_507,
|
||||
/* 0x1FC */ CS_CMD_ACTOR_CUE_508,
|
||||
/* 0x1FD */ CS_CMD_ACTOR_CUE_509,
|
||||
/* 0x1FE */ CS_CMD_ACTOR_CUE_510,
|
||||
/* 0x1FF */ CS_CMD_ACTOR_CUE_511,
|
||||
/* 0x200 */ CS_CMD_ACTOR_CUE_512,
|
||||
/* 0x201 */ CS_CMD_ACTOR_CUE_513,
|
||||
/* 0x202 */ CS_CMD_ACTOR_CUE_514,
|
||||
/* 0x203 */ CS_CMD_ACTOR_CUE_515,
|
||||
/* 0x204 */ CS_CMD_ACTOR_CUE_516,
|
||||
/* 0x205 */ CS_CMD_ACTOR_CUE_517,
|
||||
/* 0x206 */ CS_CMD_ACTOR_CUE_518,
|
||||
/* 0x207 */ CS_CMD_ACTOR_CUE_519,
|
||||
/* 0x208 */ CS_CMD_ACTOR_CUE_520,
|
||||
/* 0x209 */ CS_CMD_ACTOR_CUE_521,
|
||||
/* 0x20A */ CS_CMD_ACTOR_CUE_522,
|
||||
/* 0x20B */ CS_CMD_ACTOR_CUE_523,
|
||||
/* 0x20C */ CS_CMD_ACTOR_CUE_524,
|
||||
/* 0x20D */ CS_CMD_ACTOR_CUE_525,
|
||||
/* 0x20E */ CS_CMD_ACTOR_CUE_526,
|
||||
/* 0x20F */ CS_CMD_ACTOR_CUE_527,
|
||||
/* 0x210 */ CS_CMD_ACTOR_CUE_528,
|
||||
/* 0x211 */ CS_CMD_ACTOR_CUE_529,
|
||||
/* 0x212 */ CS_CMD_ACTOR_CUE_530,
|
||||
/* 0x213 */ CS_CMD_ACTOR_CUE_531,
|
||||
/* 0x214 */ CS_CMD_ACTOR_CUE_532,
|
||||
/* 0x215 */ CS_CMD_ACTOR_CUE_533,
|
||||
/* 0x216 */ CS_CMD_ACTOR_CUE_534,
|
||||
/* 0x217 */ CS_CMD_ACTOR_CUE_535,
|
||||
/* 0x218 */ CS_CMD_ACTOR_CUE_536,
|
||||
/* 0x219 */ CS_CMD_ACTOR_CUE_537,
|
||||
/* 0x21A */ CS_CMD_ACTOR_CUE_538,
|
||||
/* 0x21B */ CS_CMD_ACTOR_CUE_539,
|
||||
/* 0x21C */ CS_CMD_ACTOR_CUE_540,
|
||||
/* 0x21D */ CS_CMD_ACTOR_CUE_541,
|
||||
/* 0x21E */ CS_CMD_ACTOR_CUE_542,
|
||||
/* 0x21F */ CS_CMD_ACTOR_CUE_543,
|
||||
/* 0x220 */ CS_CMD_ACTOR_CUE_544,
|
||||
/* 0x221 */ CS_CMD_ACTOR_CUE_545,
|
||||
/* 0x222 */ CS_CMD_ACTOR_CUE_546,
|
||||
/* 0x223 */ CS_CMD_ACTOR_CUE_547,
|
||||
/* 0x224 */ CS_CMD_ACTOR_CUE_548,
|
||||
/* 0x225 */ CS_CMD_ACTOR_CUE_549,
|
||||
/* 0x226 */ CS_CMD_ACTOR_CUE_550,
|
||||
/* 0x227 */ CS_CMD_ACTOR_CUE_551,
|
||||
/* 0x228 */ CS_CMD_ACTOR_CUE_552,
|
||||
/* 0x229 */ CS_CMD_ACTOR_CUE_553,
|
||||
/* 0x22A */ CS_CMD_ACTOR_CUE_554,
|
||||
/* 0x22B */ CS_CMD_ACTOR_CUE_555,
|
||||
/* 0x22C */ CS_CMD_ACTOR_CUE_556,
|
||||
/* 0x22D */ CS_CMD_ACTOR_CUE_557,
|
||||
/* 0x22E */ CS_CMD_ACTOR_CUE_558,
|
||||
/* 0x22F */ CS_CMD_ACTOR_CUE_559,
|
||||
/* 0x230 */ CS_CMD_ACTOR_CUE_560,
|
||||
/* 0x231 */ CS_CMD_ACTOR_CUE_561,
|
||||
/* 0x232 */ CS_CMD_ACTOR_CUE_562,
|
||||
/* 0x233 */ CS_CMD_ACTOR_CUE_563,
|
||||
/* 0x234 */ CS_CMD_ACTOR_CUE_564,
|
||||
/* 0x235 */ CS_CMD_ACTOR_CUE_565,
|
||||
/* 0x236 */ CS_CMD_ACTOR_CUE_566,
|
||||
/* 0x237 */ CS_CMD_ACTOR_CUE_567,
|
||||
/* 0x238 */ CS_CMD_ACTOR_CUE_568,
|
||||
/* 0x239 */ CS_CMD_ACTOR_CUE_569,
|
||||
/* 0x23A */ CS_CMD_ACTOR_CUE_570,
|
||||
/* 0x23B */ CS_CMD_ACTOR_CUE_571,
|
||||
/* 0x23C */ CS_CMD_ACTOR_CUE_572,
|
||||
/* 0x23D */ CS_CMD_ACTOR_CUE_573,
|
||||
/* 0x23E */ CS_CMD_ACTOR_CUE_574,
|
||||
/* 0x23F */ CS_CMD_ACTOR_CUE_575,
|
||||
/* 0x240 */ CS_CMD_ACTOR_CUE_576,
|
||||
/* 0x241 */ CS_CMD_ACTOR_CUE_577,
|
||||
/* 0x242 */ CS_CMD_ACTOR_CUE_578,
|
||||
/* 0x243 */ CS_CMD_ACTOR_CUE_579,
|
||||
/* 0x244 */ CS_CMD_ACTOR_CUE_580,
|
||||
/* 0x245 */ CS_CMD_ACTOR_CUE_581,
|
||||
/* 0x246 */ CS_CMD_ACTOR_CUE_582,
|
||||
/* 0x247 */ CS_CMD_ACTOR_CUE_583,
|
||||
/* 0x248 */ CS_CMD_ACTOR_CUE_584,
|
||||
/* 0x249 */ CS_CMD_ACTOR_CUE_585,
|
||||
/* 0x24A */ CS_CMD_ACTOR_CUE_586,
|
||||
/* 0x24B */ CS_CMD_ACTOR_CUE_587,
|
||||
/* 0x24C */ CS_CMD_ACTOR_CUE_588,
|
||||
/* 0x24D */ CS_CMD_ACTOR_CUE_589,
|
||||
/* 0x24E */ CS_CMD_ACTOR_CUE_590,
|
||||
/* 0x24F */ CS_CMD_ACTOR_CUE_591,
|
||||
/* 0x250 */ CS_CMD_ACTOR_CUE_592,
|
||||
/* 0x251 */ CS_CMD_ACTOR_CUE_593,
|
||||
/* 0x252 */ CS_CMD_ACTOR_CUE_594,
|
||||
/* 0x253 */ CS_CMD_ACTOR_CUE_595,
|
||||
/* 0x254 */ CS_CMD_ACTOR_CUE_596,
|
||||
/* 0x255 */ CS_CMD_ACTOR_CUE_597,
|
||||
/* 0x256 */ CS_CMD_ACTOR_CUE_598,
|
||||
/* 0x257 */ CS_CMD_ACTOR_CUE_599
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_GenericMMCmd : public CutsceneSubCommandEntry
|
||||
/**** GENERIC ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommands commandId;
|
||||
CutsceneMM_CommandType commandId;
|
||||
|
||||
CutsceneSubCommandEntry_GenericMMCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMMCommands cmdId);
|
||||
CutsceneMMSubCommandEntry_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMM_CommandType cmdId);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
};
|
||||
|
@ -54,11 +259,13 @@ class CutsceneMMCommand_GenericCmd : public CutsceneCommand
|
|||
{
|
||||
public:
|
||||
CutsceneMMCommand_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMMCommands cmdId);
|
||||
CutsceneMM_CommandType cmdId);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
// TODO: MM cutscene camera command is implemented as a placeholder until we better understand how
|
||||
// it works
|
||||
class CutsceneSubCommandEntry_Camera : public CutsceneSubCommandEntry
|
||||
|
@ -81,7 +288,9 @@ public:
|
|||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_FadeScreen : public CutsceneSubCommandEntry
|
||||
/**** TRANSITION GENERAL ****/
|
||||
|
||||
class CutsceneSubCommandEntry_TransitionGeneral : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t unk_06;
|
||||
|
@ -91,41 +300,46 @@ public:
|
|||
uint8_t unk_0A;
|
||||
uint8_t unk_0B;
|
||||
|
||||
CutsceneSubCommandEntry_FadeScreen(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
CutsceneSubCommandEntry_TransitionGeneral(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_FadeScreen : public CutsceneCommand
|
||||
class CutsceneMMCommand_TransitionGeneral : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_FadeScreen(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
CutsceneMMCommand_TransitionGeneral(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_FadeSeq : public CutsceneSubCommandEntry
|
||||
/**** FADE OUT SEQUENCE ****/
|
||||
|
||||
class CutsceneSubCommandEntry_FadeOutSeq : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint32_t unk_08;
|
||||
|
||||
CutsceneSubCommandEntry_FadeSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
CutsceneSubCommandEntry_FadeOutSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_FadeSeq : public CutsceneCommand
|
||||
class CutsceneMMCommand_FadeOutSeq : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_FadeSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
CutsceneMMCommand_FadeOutSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** NON IMPLEMENTED ****/
|
||||
|
||||
class CutsceneSubCommandEntry_NonImplemented : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
|
@ -138,3 +352,75 @@ class CutsceneMMCommand_NonImplemented : public CutsceneCommand
|
|||
public:
|
||||
CutsceneMMCommand_NonImplemented(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
};
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_Rumble : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t intensity;
|
||||
uint8_t decayTimer;
|
||||
uint8_t decayStep;
|
||||
|
||||
CutsceneMMSubCommandEntry_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_Rumble : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_Text : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t type;
|
||||
uint16_t textId1;
|
||||
uint16_t textId2;
|
||||
|
||||
CutsceneMMSubCommandEntry_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_Text : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
class CutsceneMMSubCommandEntry_ActorCue : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t rotX, rotY, rotZ;
|
||||
int32_t startPosX, startPosY, startPosZ;
|
||||
int32_t endPosX, endPosY, endPosZ;
|
||||
float normalX, normalY, normalZ;
|
||||
|
||||
CutsceneMMSubCommandEntry_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_ActorCue : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
|
456
tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
Normal file
456
tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
Normal file
|
@ -0,0 +1,456 @@
|
|||
#include "CutsceneOoT_Commands.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <unordered_map>
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
// Specific for command lists where each entry has size 0x30 bytes
|
||||
const std::unordered_map<CutsceneOoT_CommandType, CsCommandListDescriptor> csCommandsDesc = {
|
||||
{CutsceneOoT_CommandType::CS_CMD_MISC,
|
||||
{"CS_MISC", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING,
|
||||
{"CS_LIGHT_SETTING", "(0x%02X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneOoT_CommandType::CS_CMD_START_SEQ,
|
||||
{"CS_START_SEQ", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneOoT_CommandType::CS_CMD_STOP_SEQ,
|
||||
{"CS_STOP_SEQ", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ,
|
||||
{"CS_FADE_OUT_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
};
|
||||
|
||||
CutsceneOoTSubCommandEntry_GenericCmd::CutsceneOoTSubCommandEntry_GenericCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneOoT_CommandType cmdId)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId)
|
||||
{
|
||||
word0 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0);
|
||||
word1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x4);
|
||||
|
||||
unused1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x8);
|
||||
unused2 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC);
|
||||
unused3 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x10);
|
||||
unused4 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x14);
|
||||
unused5 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x18);
|
||||
unused6 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
unused7 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x20);
|
||||
unused8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x24);
|
||||
unused9 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x28);
|
||||
unused10 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_GenericCmd::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
const auto& element = csCommandsDesc.find(commandId);
|
||||
|
||||
if (element != csCommandsDesc.end())
|
||||
{
|
||||
bool isIndexInMisc = enumData->miscType.find(base) != enumData->miscType.end();
|
||||
bool isIndexInFade =
|
||||
enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end();
|
||||
std::string entryFmt = element->second.cmdMacro;
|
||||
std::string firstArg;
|
||||
entryFmt += element->second.args;
|
||||
|
||||
if (commandId == CutsceneOoT_CommandType::CS_CMD_MISC && isIndexInMisc)
|
||||
firstArg = enumData->miscType[base];
|
||||
else if (commandId == CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ && isIndexInFade)
|
||||
firstArg = enumData->fadeOutSeqPlayer[base];
|
||||
else
|
||||
{
|
||||
bool baseOne = (commandId == CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING ||
|
||||
commandId == CutsceneOoT_CommandType::CS_CMD_START_SEQ ||
|
||||
commandId == CutsceneOoT_CommandType::CS_CMD_STOP_SEQ);
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), baseOne ? base - 1 : base, startFrame,
|
||||
endFrame, pad, unused1, unused2, unused3, unused4, unused5,
|
||||
unused6, unused7, unused8, unused9, unused10);
|
||||
}
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), firstArg.c_str(), startFrame, endFrame, pad,
|
||||
unused1, unused2, unused3, unused4, unused5, unused6, unused7,
|
||||
unused8, unused9, unused10);
|
||||
}
|
||||
return StringHelper::Sprintf("CS_UNK_DATA(0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, "
|
||||
"0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X)",
|
||||
word0, word1, unused1, unused2, unused3, unused4, unused5, unused6,
|
||||
unused7, unused8, unused9, unused10);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_GenericCmd::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_GenericCmd::CutsceneOoTCommand_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex,
|
||||
CutsceneOoT_CommandType cmdId)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
commandID = static_cast<uint32_t>(cmdId);
|
||||
entries.reserve(numEntries);
|
||||
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_GenericCmd::GetCommandMacro() const
|
||||
{
|
||||
const auto& element = csCommandsDesc.find(static_cast<CutsceneOoT_CommandType>(commandID));
|
||||
|
||||
if (element != csCommandsDesc.end())
|
||||
{
|
||||
return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
CutsceneOoTCommand_CameraPoint::CutsceneOoTCommand_CameraPoint(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
continueFlag = BitConverter::ToInt8BE(rawData, rawDataIndex + 0);
|
||||
cameraRoll = BitConverter::ToInt8BE(rawData, rawDataIndex + 1);
|
||||
nextPointFrame = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||
viewAngle = BitConverter::ToFloatBE(rawData, rawDataIndex + 4);
|
||||
|
||||
posX = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
|
||||
posY = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
||||
posZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 12);
|
||||
|
||||
unused = BitConverter::ToInt16BE(rawData, rawDataIndex + 14);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_CameraPoint::GetBodySourceCode() const
|
||||
{
|
||||
std::string continueMacro = "CS_CAM_CONTINUE";
|
||||
if (continueFlag != 0)
|
||||
continueMacro = "CS_CAM_STOP";
|
||||
|
||||
return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, %i, %ff, %i, %i, %i, 0x%04X)",
|
||||
continueMacro.c_str(), cameraRoll, nextPointFrame, viewAngle, posX,
|
||||
posY, posZ, unused);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_CameraPoint::GetRawSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_GenericCameraCmd::CutsceneOoTCommand_GenericCameraCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unused = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
|
||||
bool shouldContinue = true;
|
||||
|
||||
uint32_t currentPtr = rawDataIndex + 8;
|
||||
|
||||
while (shouldContinue)
|
||||
{
|
||||
CutsceneOoTCommand_CameraPoint* camPoint =
|
||||
new CutsceneOoTCommand_CameraPoint(rawData, currentPtr);
|
||||
entries.push_back(camPoint);
|
||||
|
||||
if (camPoint->continueFlag == -1)
|
||||
shouldContinue = false;
|
||||
|
||||
currentPtr += camPoint->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_GenericCameraCmd::GetCommandMacro() const
|
||||
{
|
||||
std::string result;
|
||||
const char* listStr;
|
||||
|
||||
if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE)
|
||||
{
|
||||
listStr = "CS_CAM_AT_SPLINE";
|
||||
}
|
||||
else if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER)
|
||||
{
|
||||
listStr = "CS_CAM_AT_SPLINE_REL_TO_PLAYER";
|
||||
}
|
||||
else if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER)
|
||||
{
|
||||
listStr = "CS_CAM_EYE_SPLINE_REL_TO_PLAYER";
|
||||
}
|
||||
else
|
||||
{
|
||||
listStr = "CS_CAM_EYE_SPLINE";
|
||||
}
|
||||
|
||||
result += StringHelper::Sprintf("%s(%i, %i)", listStr, startFrame, endFrame);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_GenericCameraCmd::GetCommandSize() const
|
||||
{
|
||||
return 0x0C + entries.at(0)->GetRawSize() * entries.size();
|
||||
}
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
CutsceneOoTSubCommandEntry_Rumble::CutsceneOoTSubCommandEntry_Rumble(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
sourceStrength = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06);
|
||||
duration = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07);
|
||||
decreaseRate = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
unk_09 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
unk_0A = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0A);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_Rumble::GetBodySourceCode() const
|
||||
{
|
||||
// Note: the first argument is unused
|
||||
return StringHelper::Sprintf("CS_RUMBLE_CONTROLLER(%i, %i, %i, %i, %i, %i, 0x%02X, 0x%02X)",
|
||||
base, startFrame, endFrame, sourceStrength, duration, decreaseRate,
|
||||
unk_09, unk_0A);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_Rumble::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_Rumble::CutsceneOoTCommand_Rumble(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_Rumble(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Rumble::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_RUMBLE_CONTROLLER_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
CutsceneOoTSubCommandEntry_Text::CutsceneOoTSubCommandEntry_Text(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_Text::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (type == 0xFFFF)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame);
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%i, %i, %i, 0x%X)", base, startFrame,
|
||||
endFrame, textId1);
|
||||
}
|
||||
|
||||
if (enumData->textType.find(type) != enumData->textType.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %s, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, enumData->textType[type].c_str(), textId1, textId2);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %i, 0x%X, 0x%X)", base, startFrame,
|
||||
endFrame, type, textId1, textId2);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_Text::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_Text::CutsceneOoTCommand_Text(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_Text(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Text::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
CutsceneOoTSubCommandEntry_ActorCue::CutsceneOoTSubCommandEntry_ActorCue(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC);
|
||||
startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10);
|
||||
startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14);
|
||||
endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18);
|
||||
endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20);
|
||||
normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24);
|
||||
normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28);
|
||||
normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTSubCommandEntry_ActorCue::GetBodySourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
if (static_cast<CutsceneOoT_CommandType>(commandID) ==
|
||||
CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
result = "CS_PLAYER_CUE";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "CS_ACTOR_CUE";
|
||||
}
|
||||
|
||||
result +=
|
||||
StringHelper::Sprintf("(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, "
|
||||
"%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)",
|
||||
base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY,
|
||||
startPosZ, endPosX, endPosY, endPosZ, normalX, normalY, normalZ);
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneOoTSubCommandEntry_ActorCue::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneOoTCommand_ActorCue::CutsceneOoTCommand_ActorCue(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneOoTSubCommandEntry_ActorCue(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_ActorCue::GetCommandMacro() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneOoT_CommandType>(commandID) ==
|
||||
CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", entries.size());
|
||||
}
|
||||
|
||||
if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)",
|
||||
enumData->cutsceneCmd[commandID].c_str(), entries.size());
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%04X, %i)", commandID, entries.size());
|
||||
}
|
||||
|
||||
/**** DESTINATION ****/
|
||||
|
||||
CutsceneOoTCommand_Destination::CutsceneOoTCommand_Destination(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unknown = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); // endFrame duplicate
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Destination::GenerateSourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->destination.find(base) != enumData->destination.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_DESTINATION(%s, %i, %i),\n",
|
||||
enumData->destination[base].c_str(), startFrame, endFrame);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_DESTINATION(%i, %i, %i),\n", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_Destination::GetCommandSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
/**** TRANSITION ****/
|
||||
|
||||
CutsceneOoTCommand_Transition::CutsceneOoTCommand_Transition(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
}
|
||||
|
||||
std::string CutsceneOoTCommand_Transition::GenerateSourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->transitionType.find(base) != enumData->transitionType.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TRANSITION(%s, %i, %i),\n",
|
||||
enumData->transitionType[base].c_str(), startFrame, endFrame);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_TRANSITION(%i, %i, %i),\n", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneOoTCommand_Transition::GetCommandSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
314
tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.h
Normal file
314
tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.h
Normal file
|
@ -0,0 +1,314 @@
|
|||
#pragma once
|
||||
|
||||
#include "Cutscene_Common.h"
|
||||
|
||||
// https://github.com/zeldaret/oot/blob/7235af2249843fb68740111b70089bad827a4730/include/z64cutscene.h#L35-L165
|
||||
enum class CutsceneOoT_CommandType
|
||||
{
|
||||
CS_CMD_CAM_EYE_SPLINE = 0x01,
|
||||
CS_CMD_CAM_AT_SPLINE,
|
||||
CS_CMD_MISC,
|
||||
CS_CMD_LIGHT_SETTING,
|
||||
CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER,
|
||||
CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER,
|
||||
CS_CMD_CAM_EYE,
|
||||
CS_CMD_CAM_AT,
|
||||
CS_CMD_RUMBLE_CONTROLLER,
|
||||
CS_CMD_PLAYER_CUE,
|
||||
CS_CMD_UNIMPLEMENTED_B,
|
||||
CS_CMD_UNIMPLEMENTED_D = 0x0D,
|
||||
CS_CMD_ACTOR_CUE_1_0,
|
||||
CS_CMD_ACTOR_CUE_0_0,
|
||||
CS_CMD_ACTOR_CUE_1_1,
|
||||
CS_CMD_ACTOR_CUE_0_1,
|
||||
CS_CMD_ACTOR_CUE_0_2,
|
||||
CS_CMD_TEXT,
|
||||
CS_CMD_UNIMPLEMENTED_15 = 0x15,
|
||||
CS_CMD_UNIMPLEMENTED_16,
|
||||
CS_CMD_ACTOR_CUE_0_3,
|
||||
CS_CMD_ACTOR_CUE_1_2,
|
||||
CS_CMD_ACTOR_CUE_2_0,
|
||||
CS_CMD_UNIMPLEMENTED_1B = 0x1B,
|
||||
CS_CMD_UNIMPLEMENTED_1C,
|
||||
CS_CMD_ACTOR_CUE_3_0,
|
||||
CS_CMD_ACTOR_CUE_4_0,
|
||||
CS_CMD_ACTOR_CUE_6_0,
|
||||
CS_CMD_UNIMPLEMENTED_20,
|
||||
CS_CMD_UNIMPLEMENTED_21,
|
||||
CS_CMD_ACTOR_CUE_0_4,
|
||||
CS_CMD_ACTOR_CUE_1_3,
|
||||
CS_CMD_ACTOR_CUE_2_1,
|
||||
CS_CMD_ACTOR_CUE_3_1,
|
||||
CS_CMD_ACTOR_CUE_4_1,
|
||||
CS_CMD_ACTOR_CUE_0_5,
|
||||
CS_CMD_ACTOR_CUE_1_4,
|
||||
CS_CMD_ACTOR_CUE_2_2,
|
||||
CS_CMD_ACTOR_CUE_3_2,
|
||||
CS_CMD_ACTOR_CUE_4_2,
|
||||
CS_CMD_ACTOR_CUE_5_0,
|
||||
CS_CMD_TRANSITION,
|
||||
CS_CMD_ACTOR_CUE_0_6,
|
||||
CS_CMD_ACTOR_CUE_4_3,
|
||||
CS_CMD_ACTOR_CUE_1_5,
|
||||
CS_CMD_ACTOR_CUE_7_0,
|
||||
CS_CMD_ACTOR_CUE_2_3,
|
||||
CS_CMD_ACTOR_CUE_3_3,
|
||||
CS_CMD_ACTOR_CUE_6_1,
|
||||
CS_CMD_ACTOR_CUE_3_4,
|
||||
CS_CMD_ACTOR_CUE_4_4,
|
||||
CS_CMD_ACTOR_CUE_5_1,
|
||||
CS_CMD_ACTOR_CUE_6_2 = 0x39,
|
||||
CS_CMD_ACTOR_CUE_6_3,
|
||||
CS_CMD_UNIMPLEMENTED_3B,
|
||||
CS_CMD_ACTOR_CUE_7_1,
|
||||
CS_CMD_UNIMPLEMENTED_3D,
|
||||
CS_CMD_ACTOR_CUE_8_0,
|
||||
CS_CMD_ACTOR_CUE_3_5,
|
||||
CS_CMD_ACTOR_CUE_1_6,
|
||||
CS_CMD_ACTOR_CUE_3_6,
|
||||
CS_CMD_ACTOR_CUE_3_7,
|
||||
CS_CMD_ACTOR_CUE_2_4,
|
||||
CS_CMD_ACTOR_CUE_1_7,
|
||||
CS_CMD_ACTOR_CUE_2_5,
|
||||
CS_CMD_ACTOR_CUE_1_8,
|
||||
CS_CMD_UNIMPLEMENTED_47,
|
||||
CS_CMD_ACTOR_CUE_2_6,
|
||||
CS_CMD_UNIMPLEMENTED_49,
|
||||
CS_CMD_ACTOR_CUE_2_7,
|
||||
CS_CMD_ACTOR_CUE_3_8,
|
||||
CS_CMD_ACTOR_CUE_0_7,
|
||||
CS_CMD_ACTOR_CUE_5_2,
|
||||
CS_CMD_ACTOR_CUE_1_9,
|
||||
CS_CMD_ACTOR_CUE_4_5,
|
||||
CS_CMD_ACTOR_CUE_1_10,
|
||||
CS_CMD_ACTOR_CUE_2_8,
|
||||
CS_CMD_ACTOR_CUE_3_9,
|
||||
CS_CMD_ACTOR_CUE_4_6,
|
||||
CS_CMD_ACTOR_CUE_5_3,
|
||||
CS_CMD_ACTOR_CUE_0_8,
|
||||
CS_CMD_START_SEQ,
|
||||
CS_CMD_STOP_SEQ,
|
||||
CS_CMD_ACTOR_CUE_6_4,
|
||||
CS_CMD_ACTOR_CUE_7_2,
|
||||
CS_CMD_ACTOR_CUE_5_4,
|
||||
CS_CMD_ACTOR_CUE_0_9 = 0x5D,
|
||||
CS_CMD_ACTOR_CUE_1_11,
|
||||
CS_CMD_ACTOR_CUE_0_10 = 0x69,
|
||||
CS_CMD_ACTOR_CUE_2_9,
|
||||
CS_CMD_ACTOR_CUE_0_11,
|
||||
CS_CMD_ACTOR_CUE_3_10,
|
||||
CS_CMD_UNIMPLEMENTED_6D,
|
||||
CS_CMD_ACTOR_CUE_0_12,
|
||||
CS_CMD_ACTOR_CUE_7_3,
|
||||
CS_CMD_UNIMPLEMENTED_70,
|
||||
CS_CMD_UNIMPLEMENTED_71,
|
||||
CS_CMD_ACTOR_CUE_7_4,
|
||||
CS_CMD_ACTOR_CUE_6_5,
|
||||
CS_CMD_ACTOR_CUE_1_12,
|
||||
CS_CMD_ACTOR_CUE_2_10,
|
||||
CS_CMD_ACTOR_CUE_1_13,
|
||||
CS_CMD_ACTOR_CUE_0_13,
|
||||
CS_CMD_ACTOR_CUE_1_14,
|
||||
CS_CMD_ACTOR_CUE_2_11,
|
||||
CS_CMD_ACTOR_CUE_0_14 = 0x7B,
|
||||
CS_CMD_FADE_OUT_SEQ,
|
||||
CS_CMD_ACTOR_CUE_1_15,
|
||||
CS_CMD_ACTOR_CUE_2_12,
|
||||
CS_CMD_ACTOR_CUE_3_11,
|
||||
CS_CMD_ACTOR_CUE_4_7,
|
||||
CS_CMD_ACTOR_CUE_5_5,
|
||||
CS_CMD_ACTOR_CUE_6_6,
|
||||
CS_CMD_ACTOR_CUE_1_16,
|
||||
CS_CMD_ACTOR_CUE_2_13,
|
||||
CS_CMD_ACTOR_CUE_3_12,
|
||||
CS_CMD_ACTOR_CUE_7_5,
|
||||
CS_CMD_ACTOR_CUE_4_8,
|
||||
CS_CMD_ACTOR_CUE_5_6,
|
||||
CS_CMD_ACTOR_CUE_6_7,
|
||||
CS_CMD_ACTOR_CUE_0_15,
|
||||
CS_CMD_ACTOR_CUE_0_16,
|
||||
CS_CMD_TIME,
|
||||
CS_CMD_ACTOR_CUE_1_17,
|
||||
CS_CMD_ACTOR_CUE_7_6,
|
||||
CS_CMD_ACTOR_CUE_9_0,
|
||||
CS_CMD_ACTOR_CUE_0_17,
|
||||
CS_CMD_DESTINATION = 0x03E8,
|
||||
CS_CMD_END = 0xFFFF
|
||||
};
|
||||
|
||||
/**** GENERIC ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneOoT_CommandType commandId;
|
||||
|
||||
uint32_t word0 = 0;
|
||||
uint32_t word1 = 0;
|
||||
|
||||
uint32_t unused1 = 0;
|
||||
uint32_t unused2 = 0;
|
||||
uint32_t unused3 = 0;
|
||||
uint32_t unused4 = 0;
|
||||
uint32_t unused5 = 0;
|
||||
uint32_t unused6 = 0;
|
||||
uint32_t unused7 = 0;
|
||||
uint32_t unused8 = 0;
|
||||
uint32_t unused9 = 0;
|
||||
uint32_t unused10 = 0;
|
||||
|
||||
CutsceneOoTSubCommandEntry_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex, CutsceneOoT_CommandType cmdId);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_GenericCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneOoT_CommandType cmdId);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** CAMERA ****/
|
||||
|
||||
class CutsceneOoTCommand_CameraPoint : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
int8_t continueFlag;
|
||||
int8_t cameraRoll;
|
||||
int16_t nextPointFrame;
|
||||
float viewAngle;
|
||||
int16_t posX, posY, posZ;
|
||||
int16_t unused;
|
||||
|
||||
CutsceneOoTCommand_CameraPoint(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_GenericCameraCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t unused;
|
||||
|
||||
CutsceneOoTCommand_GenericCameraCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
/**** TRANSITION ****/
|
||||
|
||||
class CutsceneOoTCommand_Transition : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
|
||||
CutsceneOoTCommand_Transition(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GenerateSourceCode() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
/**** RUMBLE ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_Rumble : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t sourceStrength;
|
||||
uint8_t duration;
|
||||
uint8_t decreaseRate;
|
||||
uint8_t unk_09;
|
||||
uint8_t unk_0A;
|
||||
|
||||
CutsceneOoTSubCommandEntry_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_Rumble : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** TEXT ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_Text : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t type;
|
||||
uint16_t textId1;
|
||||
uint16_t textId2;
|
||||
|
||||
CutsceneOoTSubCommandEntry_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_Text : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_Text(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** ACTOR CUE ****/
|
||||
|
||||
class CutsceneOoTSubCommandEntry_ActorCue : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t rotX, rotY, rotZ;
|
||||
int32_t startPosX, startPosY, startPosZ;
|
||||
int32_t endPosX, endPosY, endPosZ;
|
||||
float normalX, normalY, normalZ;
|
||||
|
||||
CutsceneOoTSubCommandEntry_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneOoTCommand_ActorCue : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneOoTCommand_ActorCue(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
/**** DESTINATION ****/
|
||||
|
||||
class CutsceneOoTCommand_Destination : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t unknown;
|
||||
|
||||
CutsceneOoTCommand_Destination(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GenerateSourceCode() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
|
@ -1,596 +0,0 @@
|
|||
#include "Cutscene_Commands.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "CutsceneMM_Commands.h"
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
/* CutsceneSubCommandEntry */
|
||||
|
||||
CutsceneSubCommandEntry::CutsceneSubCommandEntry(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
{
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
pad = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_HH(0x%04X, 0x%04X), CMD_HH(0x%04X, 0x%04X)", base, startFrame,
|
||||
endFrame, pad);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry::GetRawSize() const
|
||||
{
|
||||
return 0x08;
|
||||
}
|
||||
|
||||
/* CutsceneCommand */
|
||||
|
||||
CutsceneCommand::CutsceneCommand(const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
{
|
||||
numEntries = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0);
|
||||
}
|
||||
|
||||
CutsceneCommand::~CutsceneCommand()
|
||||
{
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
delete entry;
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_W(0x%08X), CMD_W(0x%08X)", commandID, numEntries);
|
||||
}
|
||||
|
||||
std::string CutsceneCommand::GenerateSourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
result += GetCommandMacro();
|
||||
result += ",\n";
|
||||
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
result += " ";
|
||||
result += entry->GetBodySourceCode();
|
||||
result += ",\n";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneCommand::GetCommandSize() const
|
||||
{
|
||||
size_t size = 0;
|
||||
if (entries.size() > 0)
|
||||
{
|
||||
size = entries.at(0)->GetRawSize() * entries.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 0x08 * numEntries;
|
||||
}
|
||||
return 0x08 + size;
|
||||
}
|
||||
|
||||
void CutsceneCommand::SetCommandID(uint32_t nCommandID)
|
||||
{
|
||||
commandID = nCommandID;
|
||||
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
entry->commandID = commandID;
|
||||
}
|
||||
}
|
||||
|
||||
// Specific for command lists where each entry has size 0x30 bytes
|
||||
const std::unordered_map<CutsceneCommands, CsCommandListDescriptor> csCommandsDesc = {
|
||||
{CutsceneCommands::Misc,
|
||||
{"CS_MISC", "(0x%04X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneCommands::SetLighting,
|
||||
{"CS_LIGHTING", "(0x%02X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneCommands::PlayBGM, {"CS_PLAY_BGM", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneCommands::StopBGM, {"CS_STOP_BGM", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneCommands::FadeBGM, {"CS_FADE_BGM", "(%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
};
|
||||
|
||||
CutsceneSubCommandEntry_GenericCmd::CutsceneSubCommandEntry_GenericCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneCommands cmdId)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId)
|
||||
{
|
||||
word0 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0);
|
||||
word1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x4);
|
||||
|
||||
unused1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x8);
|
||||
unused2 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC);
|
||||
unused3 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x10);
|
||||
unused4 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x14);
|
||||
unused5 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x18);
|
||||
unused6 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
unused7 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x20);
|
||||
unused8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x24);
|
||||
unused9 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x28);
|
||||
unused10 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_GenericCmd::GetBodySourceCode() const
|
||||
{
|
||||
const auto& element = csCommandsDesc.find(commandId);
|
||||
|
||||
if (element != csCommandsDesc.end())
|
||||
{
|
||||
std::string entryFmt = element->second.cmdMacro;
|
||||
entryFmt += element->second.args;
|
||||
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), base, startFrame, endFrame, pad, unused1,
|
||||
unused2, unused3, unused4, unused5, unused6, unused7, unused8,
|
||||
unused9, unused10);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_UNK_DATA(0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, "
|
||||
"0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X)",
|
||||
word0, word1, unused1, unused2, unused3, unused4, unused5, unused6,
|
||||
unused7, unused8, unused9, unused10);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_GenericCmd::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneCommand_GenericCmd::CutsceneCommand_GenericCmd(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex,
|
||||
CutsceneCommands cmdId)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
commandID = static_cast<uint32_t>(cmdId);
|
||||
entries.reserve(numEntries);
|
||||
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_GenericCmd::GetCommandMacro() const
|
||||
{
|
||||
const auto& element = csCommandsDesc.find(static_cast<CutsceneCommands>(commandID));
|
||||
|
||||
if (element != csCommandsDesc.end())
|
||||
{
|
||||
return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
CutsceneCameraPoint::CutsceneCameraPoint(const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
continueFlag = BitConverter::ToInt8BE(rawData, rawDataIndex + 0);
|
||||
cameraRoll = BitConverter::ToInt8BE(rawData, rawDataIndex + 1);
|
||||
nextPointFrame = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||
viewAngle = BitConverter::ToFloatBE(rawData, rawDataIndex + 4);
|
||||
|
||||
posX = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
|
||||
posY = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
||||
posZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 12);
|
||||
|
||||
unused = BitConverter::ToInt16BE(rawData, rawDataIndex + 14);
|
||||
}
|
||||
|
||||
std::string CutsceneCameraPoint::GetBodySourceCode() const
|
||||
{
|
||||
std::string result = "";
|
||||
|
||||
if (commandID == (int32_t)CutsceneCommands::SetCameraFocus)
|
||||
{
|
||||
result += "CS_CAM_FOCUS_POINT";
|
||||
}
|
||||
else if (commandID == (int32_t)CutsceneCommands::SetCameraFocusLink)
|
||||
{
|
||||
result += "CS_CAM_FOCUS_POINT_PLAYER";
|
||||
}
|
||||
else if (commandID == (int32_t)CutsceneCommands::SetCameraPosLink)
|
||||
{
|
||||
result += "CS_CAM_POS_PLAYER";
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "CS_CAM_POS";
|
||||
}
|
||||
|
||||
std::string continueMacro = "CS_CMD_CONTINUE";
|
||||
if (continueFlag != 0)
|
||||
continueMacro = "CS_CMD_STOP";
|
||||
|
||||
result +=
|
||||
StringHelper::Sprintf("(%s, 0x%02X, %i, %ff, %i, %i, %i, 0x%04X)", continueMacro.c_str(),
|
||||
cameraRoll, nextPointFrame, viewAngle, posX, posY, posZ, unused);
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneCameraPoint::GetRawSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
CutsceneCommandSetCameraPos::CutsceneCommandSetCameraPos(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unused = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
|
||||
bool shouldContinue = true;
|
||||
|
||||
uint32_t currentPtr = rawDataIndex + 8;
|
||||
|
||||
while (shouldContinue)
|
||||
{
|
||||
CutsceneCameraPoint* camPoint = new CutsceneCameraPoint(rawData, currentPtr);
|
||||
entries.push_back(camPoint);
|
||||
|
||||
if (camPoint->continueFlag == -1)
|
||||
shouldContinue = false;
|
||||
|
||||
currentPtr += camPoint->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommandSetCameraPos::GetCommandMacro() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
std::string listStr;
|
||||
|
||||
if (commandID == (int32_t)CutsceneCommands::SetCameraFocus)
|
||||
{
|
||||
listStr = "CS_CAM_FOCUS_POINT_LIST";
|
||||
}
|
||||
else if (commandID == (int32_t)CutsceneCommands::SetCameraFocusLink)
|
||||
{
|
||||
listStr = "CS_CAM_FOCUS_POINT_PLAYER_LIST";
|
||||
}
|
||||
else if (commandID == (int32_t)CutsceneCommands::SetCameraPosLink)
|
||||
{
|
||||
listStr = "CS_CAM_POS_PLAYER_LIST";
|
||||
}
|
||||
else
|
||||
{
|
||||
listStr = "CS_CAM_POS_LIST";
|
||||
}
|
||||
|
||||
result += StringHelper::Sprintf("%s(%i, %i)", listStr.c_str(), startFrame, endFrame);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneCommandSetCameraPos::GetCommandSize() const
|
||||
{
|
||||
return 0x0C + entries.at(0)->GetRawSize() * entries.size();
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_Rumble::CutsceneSubCommandEntry_Rumble(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
unk_06 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06);
|
||||
unk_07 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07);
|
||||
unk_08 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
unk_09 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
unk_0A = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0A);
|
||||
unk_0B = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0B);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_Rumble::GetBodySourceCode() const
|
||||
{
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_RUMBLE(%i, %i, %i, 0x%02X, 0x%02X, 0x%02X)", base,
|
||||
startFrame, endFrame, unk_06, unk_07, unk_08);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_CMD_09(%i, %i, %i, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X)",
|
||||
base, startFrame, endFrame, unk_06, unk_07, unk_08, unk_09, unk_0A,
|
||||
unk_0B);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_Rumble::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneCommand_Rumble::CutsceneCommand_Rumble(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_Rumble(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_Rumble::GetCommandMacro() const
|
||||
{
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_RUMBLE_LIST(%i)", numEntries);
|
||||
}
|
||||
return StringHelper::Sprintf("CS_CMD_09_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_SetTime::CutsceneSubCommandEntry_SetTime(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
hour = BitConverter::ToUInt8BE(rawData, rawDataIndex + 6);
|
||||
minute = BitConverter::ToUInt8BE(rawData, rawDataIndex + 7);
|
||||
unk_08 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SetTime::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TIME(%i, %i, %i, %i, %i, %i)", base, startFrame, endFrame,
|
||||
hour, minute, unk_08);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_SetTime::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneCommand_SetTime::CutsceneCommand_SetTime(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_SetTime(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_SetTime::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TIME_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_TextBox::CutsceneSubCommandEntry_TextBox(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_TextBox::GetBodySourceCode() const
|
||||
{
|
||||
if (type == 0xFFFF)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame);
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_LEARN_SONG(%i, %i, %i, 0x%X)", base, startFrame,
|
||||
endFrame, textId1);
|
||||
}
|
||||
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
return StringHelper::Sprintf("CS_TEXT_DEFAULT(0x%X, %i, %i, 0x%X, 0x%X)", base,
|
||||
startFrame, endFrame, textId1, textId2);
|
||||
|
||||
case 1:
|
||||
return StringHelper::Sprintf("CS_TEXT_TYPE_1(0x%X, %i, %i, 0x%X, 0x%X)", base,
|
||||
startFrame, endFrame, textId1, textId2);
|
||||
|
||||
case 3:
|
||||
return StringHelper::Sprintf("CS_TEXT_TYPE_3(0x%X, %i, %i, 0x%X, 0x%X)", base,
|
||||
startFrame, endFrame, textId1, textId2);
|
||||
|
||||
case 4:
|
||||
return StringHelper::Sprintf("CS_TEXT_BOSSES_REMAINS(0x%X, %i, %i, 0x%X)", base,
|
||||
startFrame, endFrame, textId1);
|
||||
|
||||
case 5:
|
||||
return StringHelper::Sprintf("CS_TEXT_ALL_NORMAL_MASKS(0x%X, %i, %i, 0x%X)", base,
|
||||
startFrame, endFrame, textId1);
|
||||
}
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_TEXT_DISPLAY_TEXTBOX(0x%X, %i, %i, %i, 0x%X, 0x%X)", base,
|
||||
startFrame, endFrame, type, textId1, textId2);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_TextBox::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneCommand_TextBox::CutsceneCommand_TextBox(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_TextBox(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_TextBox::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_ActorAction::CutsceneSubCommandEntry_ActorAction(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6);
|
||||
rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8);
|
||||
rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA);
|
||||
startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC);
|
||||
startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10);
|
||||
startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14);
|
||||
endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18);
|
||||
endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C);
|
||||
endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20);
|
||||
normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24);
|
||||
normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28);
|
||||
normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_ActorAction::GetBodySourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
if (static_cast<CutsceneMMCommands>(commandID) ==
|
||||
CutsceneMMCommands::CS_CMD_SET_PLAYER_ACTION)
|
||||
{
|
||||
result = "CS_PLAYER_ACTION";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "CS_ACTOR_ACTION";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (static_cast<CutsceneCommands>(commandID) == CutsceneCommands::SetPlayerAction)
|
||||
{
|
||||
result = "CS_PLAYER_ACTION";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "CS_NPC_ACTION";
|
||||
}
|
||||
}
|
||||
|
||||
result +=
|
||||
StringHelper::Sprintf("(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, "
|
||||
"%i, %i, %i, %i, %.11ef, %.11ef, %.11ef)",
|
||||
base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY,
|
||||
startPosZ, endPosX, endPosY, endPosZ, normalX, normalY, normalZ);
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_ActorAction::GetRawSize() const
|
||||
{
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
CutsceneCommand_ActorAction::CutsceneCommand_ActorAction(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_ActorAction(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_ActorAction::GetCommandMacro() const
|
||||
{
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
if (static_cast<CutsceneMMCommands>(commandID) ==
|
||||
CutsceneMMCommands::CS_CMD_SET_PLAYER_ACTION)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_ACTION_LIST(%i)", numEntries);
|
||||
}
|
||||
return StringHelper::Sprintf("CS_ACTOR_ACTION_LIST(0x%03X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
if (static_cast<CutsceneCommands>(commandID) == CutsceneCommands::SetPlayerAction)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_ACTION_LIST(%i)", entries.size());
|
||||
}
|
||||
return StringHelper::Sprintf("CS_NPC_ACTION_LIST(0x%03X, %i)", commandID, entries.size());
|
||||
}
|
||||
|
||||
CutsceneCommand_Terminator::CutsceneCommand_Terminator(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
unknown = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); // endFrame duplicate
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_Terminator::GenerateSourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
result += StringHelper::Sprintf("CS_TERMINATOR(%i, %i, %i),\n", base, startFrame, endFrame);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneCommand_Terminator::GetCommandSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
CutsceneCommandSceneTransFX::CutsceneCommandSceneTransFX(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
}
|
||||
|
||||
std::string CutsceneCommandSceneTransFX::GenerateSourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_SCENE_TRANS_FX(%i, %i, %i),\n", base, startFrame, endFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneCommandSceneTransFX::GetCommandSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
|
@ -1,267 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Declaration.h"
|
||||
|
||||
enum class CutsceneCommands
|
||||
{
|
||||
SetCameraPos = 0x0001,
|
||||
SetCameraFocus = 0x0002,
|
||||
Misc = 0x0003,
|
||||
SetLighting = 0x0004,
|
||||
SetCameraPosLink = 0x0005,
|
||||
SetCameraFocusLink = 0x0006,
|
||||
Cmd07 = 0x0007,
|
||||
Cmd08 = 0x0008,
|
||||
Cmd09 = 0x0009, // Rumble
|
||||
Textbox = 0x0013,
|
||||
SetPlayerAction = 0x000A,
|
||||
SetActorAction1 = 0x000F,
|
||||
SetActorAction2 = 0x000E,
|
||||
SetActorAction3 = 0x0019,
|
||||
SetActorAction4 = 0x001D,
|
||||
SetActorAction5 = 0x001E,
|
||||
SetActorAction6 = 0x002C,
|
||||
SetActorAction7 = 0x001F,
|
||||
SetActorAction8 = 0x0031,
|
||||
SetActorAction9 = 0x003E,
|
||||
SetActorAction10 = 0x008F,
|
||||
SetSceneTransFX = 0x002D,
|
||||
PlayBGM = 0x0056,
|
||||
StopBGM = 0x0057,
|
||||
FadeBGM = 0x007C,
|
||||
SetTime = 0x008C,
|
||||
Terminator = 0x03E8,
|
||||
};
|
||||
|
||||
typedef struct CsCommandListDescriptor
|
||||
{
|
||||
const char* cmdMacro;
|
||||
const char* args;
|
||||
} CsCommandListDescriptor;
|
||||
|
||||
class CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t pad;
|
||||
|
||||
uint32_t commandID;
|
||||
|
||||
CutsceneSubCommandEntry(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
virtual ~CutsceneSubCommandEntry() = default;
|
||||
|
||||
virtual std::string GetBodySourceCode() const;
|
||||
|
||||
virtual size_t GetRawSize() const;
|
||||
};
|
||||
|
||||
class CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint32_t commandID;
|
||||
uint32_t commandIndex;
|
||||
|
||||
uint32_t numEntries;
|
||||
std::vector<CutsceneSubCommandEntry*> entries;
|
||||
|
||||
CutsceneCommand(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
virtual ~CutsceneCommand();
|
||||
|
||||
virtual std::string GetCommandMacro() const;
|
||||
virtual std::string GenerateSourceCode() const;
|
||||
virtual size_t GetCommandSize() const;
|
||||
|
||||
virtual void SetCommandID(uint32_t nCommandID);
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneCommands commandId;
|
||||
|
||||
uint32_t word0 = 0;
|
||||
uint32_t word1 = 0;
|
||||
|
||||
uint32_t unused1 = 0;
|
||||
uint32_t unused2 = 0;
|
||||
uint32_t unused3 = 0;
|
||||
uint32_t unused4 = 0;
|
||||
uint32_t unused5 = 0;
|
||||
uint32_t unused6 = 0;
|
||||
uint32_t unused7 = 0;
|
||||
uint32_t unused8 = 0;
|
||||
uint32_t unused9 = 0;
|
||||
uint32_t unused10 = 0;
|
||||
|
||||
CutsceneSubCommandEntry_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneCommands cmdId);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_GenericCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneCommands cmdId);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneCameraPoint : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
int8_t continueFlag;
|
||||
int8_t cameraRoll;
|
||||
int16_t nextPointFrame;
|
||||
float viewAngle;
|
||||
int16_t posX, posY, posZ;
|
||||
int16_t unused;
|
||||
|
||||
CutsceneCameraPoint(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommandSetCameraPos : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t unused;
|
||||
|
||||
CutsceneCommandSetCameraPos(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommandSceneTransFX : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
|
||||
CutsceneCommandSceneTransFX(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GenerateSourceCode() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_Rumble : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t unk_06;
|
||||
uint8_t unk_07;
|
||||
uint8_t unk_08;
|
||||
uint8_t unk_09;
|
||||
uint8_t unk_0A;
|
||||
uint8_t unk_0B;
|
||||
|
||||
CutsceneSubCommandEntry_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_Rumble : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_Rumble(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_SetTime : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t hour;
|
||||
uint8_t minute;
|
||||
uint32_t unk_08;
|
||||
|
||||
CutsceneSubCommandEntry_SetTime(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_SetTime : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_SetTime(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_TextBox : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t type;
|
||||
uint16_t textId1;
|
||||
uint16_t textId2;
|
||||
|
||||
CutsceneSubCommandEntry_TextBox(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_TextBox : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_TextBox(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_ActorAction : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t rotX, rotY, rotZ;
|
||||
int32_t startPosX, startPosY, startPosZ;
|
||||
int32_t endPosX, endPosY, endPosZ;
|
||||
float normalX, normalY, normalZ;
|
||||
|
||||
CutsceneSubCommandEntry_ActorAction(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_ActorAction : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_ActorAction(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_Terminator : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t unknown;
|
||||
|
||||
CutsceneCommand_Terminator(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GenerateSourceCode() const override;
|
||||
size_t GetCommandSize() const override;
|
||||
};
|
128
tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.cpp
Normal file
128
tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.cpp
Normal file
|
@ -0,0 +1,128 @@
|
|||
#include "Cutscene_Common.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
/* CutsceneSubCommandEntry */
|
||||
|
||||
CutsceneSubCommandEntry::CutsceneSubCommandEntry(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
{
|
||||
base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
|
||||
startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
|
||||
endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4);
|
||||
pad = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_HH(0x%04X, 0x%04X), CMD_HH(0x%04X, 0x%04X)", base, startFrame,
|
||||
endFrame, pad);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry::GetRawSize() const
|
||||
{
|
||||
return 0x08;
|
||||
}
|
||||
|
||||
/* CutsceneCommand */
|
||||
|
||||
CutsceneCommand::CutsceneCommand(const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
{
|
||||
numEntries = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0);
|
||||
}
|
||||
|
||||
CutsceneCommand::~CutsceneCommand()
|
||||
{
|
||||
for (auto entry : entries)
|
||||
{
|
||||
delete entry;
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_W(0x%08X), CMD_W(0x%08X)", commandID, numEntries);
|
||||
}
|
||||
|
||||
std::string CutsceneCommand::GenerateSourceCode() const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
result += GetCommandMacro();
|
||||
result += ",\n";
|
||||
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
result += " ";
|
||||
result += entry->GetBodySourceCode();
|
||||
result += ",\n";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t CutsceneCommand::GetCommandSize() const
|
||||
{
|
||||
size_t size = 0;
|
||||
if (entries.size() > 0)
|
||||
{
|
||||
size = entries.at(0)->GetRawSize() * entries.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 0x08 * numEntries;
|
||||
}
|
||||
return 0x08 + size;
|
||||
}
|
||||
|
||||
void CutsceneCommand::SetCommandID(uint32_t nCommandID)
|
||||
{
|
||||
commandID = nCommandID;
|
||||
|
||||
for (auto& entry : entries)
|
||||
{
|
||||
entry->commandID = commandID;
|
||||
}
|
||||
}
|
||||
|
||||
/*** TIME ****/
|
||||
|
||||
CutsceneSubCommandEntry_SetTime::CutsceneSubCommandEntry_SetTime(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
hour = BitConverter::ToUInt8BE(rawData, rawDataIndex + 6);
|
||||
minute = BitConverter::ToUInt8BE(rawData, rawDataIndex + 7);
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_SetTime::GetBodySourceCode() const
|
||||
{
|
||||
// Note: Both OoT and MM have the first argument unused
|
||||
return StringHelper::Sprintf("CS_TIME(%i, %i, %i, %i, %i)", base, startFrame, endFrame, hour,
|
||||
minute);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_SetTime::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneCommand_Time::CutsceneCommand_Time(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_SetTime(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneCommand_Time::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TIME_LIST(%i)", numEntries);
|
||||
}
|
72
tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.h
Normal file
72
tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Declaration.h"
|
||||
|
||||
typedef struct CsCommandListDescriptor
|
||||
{
|
||||
const char* cmdMacro;
|
||||
const char* args;
|
||||
} CsCommandListDescriptor;
|
||||
|
||||
class CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint16_t base;
|
||||
uint16_t startFrame;
|
||||
uint16_t endFrame;
|
||||
uint16_t pad;
|
||||
|
||||
uint32_t commandID;
|
||||
|
||||
CutsceneSubCommandEntry(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
virtual ~CutsceneSubCommandEntry() = default;
|
||||
|
||||
virtual std::string GetBodySourceCode() const;
|
||||
|
||||
virtual size_t GetRawSize() const;
|
||||
};
|
||||
|
||||
class CutsceneCommand
|
||||
{
|
||||
public:
|
||||
uint32_t commandID;
|
||||
uint32_t commandIndex;
|
||||
|
||||
uint32_t numEntries;
|
||||
std::vector<CutsceneSubCommandEntry*> entries;
|
||||
|
||||
CutsceneCommand(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
virtual ~CutsceneCommand();
|
||||
|
||||
virtual std::string GetCommandMacro() const;
|
||||
virtual std::string GenerateSourceCode() const;
|
||||
virtual size_t GetCommandSize() const;
|
||||
|
||||
virtual void SetCommandID(uint32_t nCommandID);
|
||||
};
|
||||
|
||||
/**** TIME ****/
|
||||
|
||||
class CutsceneSubCommandEntry_SetTime : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint8_t hour;
|
||||
uint8_t minute;
|
||||
|
||||
CutsceneSubCommandEntry_SetTime(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneCommand_Time : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneCommand_Time(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
|
@ -6,149 +6,149 @@
|
|||
#include "ZDisplayList.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
/* Struct_800A57C0 */
|
||||
/* SkinVertex */
|
||||
|
||||
Struct_800A57C0::Struct_800A57C0(ZFile* nParent) : ZResource(nParent)
|
||||
SkinVertex::SkinVertex(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A57C0::ParseRawData()
|
||||
void SkinVertex::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
unk_2 = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
|
||||
unk_4 = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
|
||||
unk_6 = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x06);
|
||||
unk_7 = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x07);
|
||||
unk_8 = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x08);
|
||||
unk_9 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
index = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
s = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
|
||||
t = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
|
||||
normX = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x06);
|
||||
normY = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x07);
|
||||
normZ = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x08);
|
||||
alpha = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09);
|
||||
}
|
||||
|
||||
std::string Struct_800A57C0::GetBodySourceCode() const
|
||||
std::string SkinVertex::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, %i, %i, 0x%02X", unk_0, unk_2, unk_4, unk_6,
|
||||
unk_7, unk_8, unk_9);
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, %i, %i, 0x%02X", index, s, t, normX, normY,
|
||||
normZ, alpha);
|
||||
}
|
||||
|
||||
std::string Struct_800A57C0::GetSourceTypeName() const
|
||||
std::string SkinVertex::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A57C0";
|
||||
return "SkinVertex";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A57C0::GetResourceType() const
|
||||
ZResourceType SkinVertex::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A57C0::GetRawDataSize() const
|
||||
size_t SkinVertex::GetRawDataSize() const
|
||||
{
|
||||
return 0x0A;
|
||||
}
|
||||
|
||||
/* Struct_800A598C_2 */
|
||||
/* SkinTransformation */
|
||||
|
||||
Struct_800A598C_2::Struct_800A598C_2(ZFile* nParent) : ZResource(nParent)
|
||||
SkinTransformation::SkinTransformation(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A598C_2::ParseRawData()
|
||||
void SkinTransformation::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
unk_0 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x00);
|
||||
limbIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x00);
|
||||
x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02);
|
||||
y = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04);
|
||||
z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x06);
|
||||
unk_8 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
scale = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08);
|
||||
}
|
||||
|
||||
std::string Struct_800A598C_2::GetBodySourceCode() const
|
||||
std::string SkinTransformation::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", unk_0, x, y, z, unk_8);
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", limbIndex, x, y, z, scale);
|
||||
}
|
||||
|
||||
std::string Struct_800A598C_2::GetSourceTypeName() const
|
||||
std::string SkinTransformation::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A598C_2";
|
||||
return "SkinTransformation";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A598C_2::GetResourceType() const
|
||||
ZResourceType SkinTransformation::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A598C_2::GetRawDataSize() const
|
||||
size_t SkinTransformation::GetRawDataSize() const
|
||||
{
|
||||
return 0x0A;
|
||||
}
|
||||
|
||||
/* Struct_800A598C */
|
||||
/* SkinLimbModif */
|
||||
|
||||
Struct_800A598C::Struct_800A598C(ZFile* nParent) : ZResource(nParent)
|
||||
SkinLimbModif::SkinLimbModif(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A598C::ParseRawData()
|
||||
void SkinLimbModif::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
unk_2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
|
||||
vtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
transformCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
|
||||
unk_4 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x04);
|
||||
unk_8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
|
||||
unk_C = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C);
|
||||
skinVertices = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
|
||||
limbTransformations = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C);
|
||||
|
||||
if (unk_8 != 0 && GETSEGNUM(unk_8) == parent->segment)
|
||||
if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment)
|
||||
{
|
||||
uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
|
||||
uint32_t unk_8_Offset = Seg2Filespace(skinVertices, parent->baseAddress);
|
||||
|
||||
unk_8_arr.reserve(unk_0);
|
||||
for (size_t i = 0; i < unk_0; i++)
|
||||
skinVertices_arr.reserve(vtxCount);
|
||||
for (size_t i = 0; i < vtxCount; i++)
|
||||
{
|
||||
Struct_800A57C0 unk8_data(parent);
|
||||
unk8_data.ExtractFromFile(unk_8_Offset);
|
||||
unk_8_arr.push_back(unk8_data);
|
||||
SkinVertex skinVertices_data(parent);
|
||||
skinVertices_data.ExtractFromFile(unk_8_Offset);
|
||||
skinVertices_arr.push_back(skinVertices_data);
|
||||
|
||||
unk_8_Offset += unk8_data.GetRawDataSize();
|
||||
unk_8_Offset += skinVertices_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (unk_C != 0 && GETSEGNUM(unk_8) == parent->segment)
|
||||
if (limbTransformations != 0 && GETSEGNUM(skinVertices) == parent->segment)
|
||||
{
|
||||
uint32_t unk_C_Offset = Seg2Filespace(unk_C, parent->baseAddress);
|
||||
uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress);
|
||||
|
||||
unk_C_arr.reserve(unk_2);
|
||||
for (size_t i = 0; i < unk_2; i++)
|
||||
limbTransformations_arr.reserve(transformCount);
|
||||
for (size_t i = 0; i < transformCount; i++)
|
||||
{
|
||||
Struct_800A598C_2 unkC_data(parent);
|
||||
unkC_data.ExtractFromFile(unk_C_Offset);
|
||||
unk_C_arr.push_back(unkC_data);
|
||||
SkinTransformation limbTransformations_data(parent);
|
||||
limbTransformations_data.ExtractFromFile(unk_C_Offset);
|
||||
limbTransformations_arr.push_back(limbTransformations_data);
|
||||
|
||||
unk_C_Offset += unkC_data.GetRawDataSize();
|
||||
unk_C_Offset += limbTransformations_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Struct_800A598C::DeclareReferences(const std::string& prefix)
|
||||
void SkinLimbModif::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string varPrefix = prefix;
|
||||
if (name != "")
|
||||
varPrefix = name;
|
||||
|
||||
if (unk_8 != 0 && GETSEGNUM(unk_8) == parent->segment)
|
||||
if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment)
|
||||
{
|
||||
const auto& res = unk_8_arr.at(0);
|
||||
const auto& res = skinVertices_arr.at(0);
|
||||
std::string unk_8_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = unk_8_arr.size();
|
||||
size_t arrayItemCnt = skinVertices_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = unk_8_arr[i];
|
||||
auto& child = skinVertices_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
|
@ -156,29 +156,29 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
|
|||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_8_Offset);
|
||||
uint32_t skinVertices_Offset = Seg2Filespace(skinVertices, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(skinVertices_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(unk_8_Offset, res.GetDeclarationAlignment(),
|
||||
parent->AddDeclarationArray(skinVertices_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_8_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->text = entryStr;
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
|
||||
if (unk_C != 0 && GETSEGNUM(unk_C) == parent->segment)
|
||||
if (limbTransformations != 0 && GETSEGNUM(limbTransformations) == parent->segment)
|
||||
{
|
||||
const auto& res = unk_C_arr.at(0);
|
||||
const auto& res = limbTransformations_arr.at(0);
|
||||
std::string unk_C_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = unk_C_arr.size();
|
||||
size_t arrayItemCnt = limbTransformations_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = unk_C_arr[i];
|
||||
auto& child = limbTransformations_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
|
@ -186,7 +186,7 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
|
|||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_C_Offset = Seg2Filespace(unk_C, parent->baseAddress);
|
||||
uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_C_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
|
@ -195,73 +195,74 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix)
|
|||
res.GetSourceTypeName(), unk_C_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->text = entryStr;
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Struct_800A598C::GetBodySourceCode() const
|
||||
std::string SkinLimbModif::GetBodySourceCode() const
|
||||
{
|
||||
std::string unk_8_Str;
|
||||
std::string skinVertices_Str;
|
||||
std::string unk_C_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(unk_8, parent, "Struct_800A57C0", unk_8_Str);
|
||||
Globals::Instance->GetSegmentedPtrName(unk_C, parent, "Struct_800A598C_2", unk_C_Str);
|
||||
Globals::Instance->GetSegmentedPtrName(skinVertices, parent, "SkinVertex", skinVertices_Str);
|
||||
Globals::Instance->GetSegmentedPtrName(limbTransformations, parent, "SkinTransformation",
|
||||
unk_C_Str);
|
||||
|
||||
std::string entryStr = StringHelper::Sprintf("\n\t\tARRAY_COUNTU(%s), ARRAY_COUNTU(%s),\n",
|
||||
unk_8_Str.c_str(), unk_C_Str.c_str());
|
||||
entryStr +=
|
||||
StringHelper::Sprintf("\t\t%i, %s, %s\n\t", unk_4, unk_8_Str.c_str(), unk_C_Str.c_str());
|
||||
skinVertices_Str.c_str(), unk_C_Str.c_str());
|
||||
entryStr += StringHelper::Sprintf("\t\t%i, %s, %s\n\t", unk_4, skinVertices_Str.c_str(),
|
||||
unk_C_Str.c_str());
|
||||
|
||||
return entryStr;
|
||||
}
|
||||
|
||||
std::string Struct_800A598C::GetSourceTypeName() const
|
||||
std::string SkinLimbModif::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A598C";
|
||||
return "SkinLimbModif";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A598C::GetResourceType() const
|
||||
ZResourceType SkinLimbModif::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A598C::GetRawDataSize() const
|
||||
size_t SkinLimbModif::GetRawDataSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
/* Struct_800A5E28 */
|
||||
/* SkinAnimatedLimbData */
|
||||
|
||||
Struct_800A5E28::Struct_800A5E28(ZFile* nParent) : ZResource(nParent)
|
||||
SkinAnimatedLimbData::SkinAnimatedLimbData(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A5E28::ParseRawData()
|
||||
void SkinAnimatedLimbData::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
unk_2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
|
||||
unk_4 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
|
||||
unk_8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
|
||||
totalVtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
limbModifCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02);
|
||||
limbModifications = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04);
|
||||
dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08);
|
||||
|
||||
if (unk_4 != 0 && GETSEGNUM(unk_4) == parent->segment)
|
||||
if (limbModifications != 0 && GETSEGNUM(limbModifications) == parent->segment)
|
||||
{
|
||||
uint32_t unk_4_Offset = Seg2Filespace(unk_4, parent->baseAddress);
|
||||
uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress);
|
||||
|
||||
unk_4_arr.reserve(unk_2);
|
||||
for (size_t i = 0; i < unk_2; i++)
|
||||
limbModifications_arr.reserve(limbModifCount);
|
||||
for (size_t i = 0; i < limbModifCount; i++)
|
||||
{
|
||||
Struct_800A598C unk_4_data(parent);
|
||||
unk_4_data.ExtractFromFile(unk_4_Offset);
|
||||
unk_4_arr.push_back(unk_4_data);
|
||||
SkinLimbModif limbModifications_data(parent);
|
||||
limbModifications_data.ExtractFromFile(limbModifications_Offset);
|
||||
limbModifications_arr.push_back(limbModifications_data);
|
||||
|
||||
unk_4_Offset += unk_4_data.GetRawDataSize();
|
||||
limbModifications_Offset += limbModifications_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Struct_800A5E28::DeclareReferences(const std::string& prefix)
|
||||
void SkinAnimatedLimbData::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string varPrefix = prefix;
|
||||
if (name != "")
|
||||
|
@ -269,17 +270,17 @@ void Struct_800A5E28::DeclareReferences(const std::string& prefix)
|
|||
|
||||
ZResource::DeclareReferences(varPrefix);
|
||||
|
||||
if (unk_4 != SEGMENTED_NULL && GETSEGNUM(unk_4) == parent->segment)
|
||||
if (limbModifications != SEGMENTED_NULL && GETSEGNUM(limbModifications) == parent->segment)
|
||||
{
|
||||
const auto& res = unk_4_arr.at(0);
|
||||
std::string unk_4_Str = res.GetDefaultName(varPrefix);
|
||||
const auto& res = limbModifications_arr.at(0);
|
||||
std::string limbModifications_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = unk_4_arr.size();
|
||||
size_t arrayItemCnt = limbModifications_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = unk_4_arr[i];
|
||||
auto& child = limbModifications_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
|
@ -287,63 +288,67 @@ void Struct_800A5E28::DeclareReferences(const std::string& prefix)
|
|||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_4_Offset = Seg2Filespace(unk_4, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_4_Offset);
|
||||
uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(limbModifications_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(unk_4_Offset, res.GetDeclarationAlignment(),
|
||||
parent->AddDeclarationArray(limbModifications_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_4_Str, arrayItemCnt, entryStr);
|
||||
res.GetSourceTypeName(), limbModifications_Str,
|
||||
arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->text = entryStr;
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
|
||||
if (unk_8 != SEGMENTED_NULL && GETSEGNUM(unk_8) == parent->segment)
|
||||
if (dlist != SEGMENTED_NULL && GETSEGNUM(dlist) == parent->segment)
|
||||
{
|
||||
uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
|
||||
uint32_t dlist_Offset = Seg2Filespace(dlist, parent->baseAddress);
|
||||
|
||||
int32_t dlistLength = ZDisplayList::GetDListLength(
|
||||
parent->GetRawData(), unk_8_Offset,
|
||||
parent->GetRawData(), dlist_Offset,
|
||||
Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX);
|
||||
ZDisplayList* unk_8_dlist = new ZDisplayList(parent);
|
||||
unk_8_dlist->ExtractFromBinary(unk_8_Offset, dlistLength);
|
||||
ZDisplayList* dlist_data = new ZDisplayList(parent);
|
||||
dlist_data->ExtractFromBinary(dlist_Offset, dlistLength);
|
||||
|
||||
std::string dListStr =
|
||||
StringHelper::Sprintf("%sSkinLimbDL_%06X", varPrefix.c_str(), unk_8_Offset);
|
||||
unk_8_dlist->SetName(dListStr);
|
||||
unk_8_dlist->DeclareVar(varPrefix, "");
|
||||
unk_8_dlist->DeclareReferences(varPrefix);
|
||||
parent->AddResource(unk_8_dlist);
|
||||
StringHelper::Sprintf("%sSkinLimbDL_%06X", varPrefix.c_str(), dlist_Offset);
|
||||
dlist_data->SetName(dListStr);
|
||||
dlist_data->DeclareVar(varPrefix, "");
|
||||
dlist_data->DeclareReferences(varPrefix);
|
||||
parent->AddResource(dlist_data);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Struct_800A5E28::GetBodySourceCode() const
|
||||
std::string SkinAnimatedLimbData::GetBodySourceCode() const
|
||||
{
|
||||
std::string unk_4_Str;
|
||||
std::string unk_8_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(unk_4, parent, "Struct_800A598C", unk_4_Str);
|
||||
Globals::Instance->GetSegmentedPtrName(unk_8, parent, "Gfx", unk_8_Str);
|
||||
std::string limbModifications_Str;
|
||||
std::string dlist_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(limbModifications, parent, "SkinLimbModif",
|
||||
limbModifications_Str);
|
||||
Globals::Instance->GetSegmentedPtrName(dlist, parent, "Gfx", dlist_Str);
|
||||
|
||||
std::string entryStr = "\n";
|
||||
entryStr += StringHelper::Sprintf("\t%i, ARRAY_COUNTU(%s),\n", unk_0, unk_4_Str.c_str());
|
||||
entryStr += StringHelper::Sprintf("\t%s, %s\n", unk_4_Str.c_str(), unk_8_Str.c_str());
|
||||
entryStr += StringHelper::Sprintf("\t%i, ARRAY_COUNTU(%s),\n", totalVtxCount,
|
||||
limbModifications_Str.c_str());
|
||||
entryStr +=
|
||||
StringHelper::Sprintf("\t%s, %s\n", limbModifications_Str.c_str(), dlist_Str.c_str());
|
||||
|
||||
return entryStr;
|
||||
}
|
||||
|
||||
std::string Struct_800A5E28::GetSourceTypeName() const
|
||||
std::string SkinAnimatedLimbData::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A5E28";
|
||||
return "SkinAnimatedLimbData";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A5E28::GetResourceType() const
|
||||
ZResourceType SkinAnimatedLimbData::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A5E28::GetRawDataSize() const
|
||||
size_t SkinAnimatedLimbData::GetRawDataSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
|
|
@ -6,19 +6,17 @@
|
|||
|
||||
#include "ZResource.h"
|
||||
|
||||
// TODO: check if more types exists
|
||||
enum class ZLimbSkinType
|
||||
{
|
||||
SkinType_0, // Segment = 0
|
||||
SkinType_4 = 4, // Segment = segmented address // Struct_800A5E28
|
||||
SkinType_5 = 5, // Segment = 0
|
||||
SkinType_DList = 11, // Segment = DList address
|
||||
SkinType_Null, // SkinLimb segment = NULL
|
||||
SkinType_Animated = 4, // SkinLimb segment = SkinAnimatedLimbData*
|
||||
SkinType_Normal = 11, // SkinLimb segment = Gfx*
|
||||
};
|
||||
|
||||
class Struct_800A57C0 : public ZResource
|
||||
class SkinVertex : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A57C0(ZFile* nParent);
|
||||
SkinVertex(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
|
@ -30,19 +28,19 @@ public:
|
|||
size_t GetRawDataSize() const override;
|
||||
|
||||
protected:
|
||||
uint16_t unk_0;
|
||||
int16_t unk_2;
|
||||
int16_t unk_4;
|
||||
int8_t unk_6;
|
||||
int8_t unk_7;
|
||||
int8_t unk_8;
|
||||
uint8_t unk_9;
|
||||
uint16_t index;
|
||||
int16_t s;
|
||||
int16_t t;
|
||||
int8_t normX;
|
||||
int8_t normY;
|
||||
int8_t normZ;
|
||||
uint8_t alpha;
|
||||
};
|
||||
|
||||
class Struct_800A598C_2 : public ZResource
|
||||
class SkinTransformation : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A598C_2(ZFile* nParent);
|
||||
SkinTransformation(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
|
@ -54,17 +52,17 @@ public:
|
|||
size_t GetRawDataSize() const override;
|
||||
|
||||
protected:
|
||||
uint8_t unk_0;
|
||||
uint8_t limbIndex;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t z;
|
||||
uint8_t unk_8;
|
||||
uint8_t scale;
|
||||
};
|
||||
|
||||
class Struct_800A598C : public ZResource
|
||||
class SkinLimbModif : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A598C(ZFile* nParent);
|
||||
SkinLimbModif(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
@ -77,20 +75,20 @@ public:
|
|||
size_t GetRawDataSize() const override;
|
||||
|
||||
protected:
|
||||
uint16_t unk_0; // Length of unk_8
|
||||
uint16_t unk_2; // Length of unk_C
|
||||
uint16_t unk_4; // 0 or 1 // Used as an index for unk_C
|
||||
segptr_t unk_8; // Struct_800A57C0*
|
||||
segptr_t unk_C; // Struct_800A598C_2*
|
||||
uint16_t vtxCount; // Number of vertices in this modif entry
|
||||
uint16_t transformCount; // Length of limbTransformations
|
||||
uint16_t unk_4; // 0 or 1, used as an index for limbTransformations
|
||||
segptr_t skinVertices; // SkinVertex*
|
||||
segptr_t limbTransformations; // SkinTransformation*
|
||||
|
||||
std::vector<Struct_800A57C0> unk_8_arr;
|
||||
std::vector<Struct_800A598C_2> unk_C_arr;
|
||||
std::vector<SkinVertex> skinVertices_arr;
|
||||
std::vector<SkinTransformation> limbTransformations_arr;
|
||||
};
|
||||
|
||||
class Struct_800A5E28 : public ZResource
|
||||
class SkinAnimatedLimbData : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A5E28(ZFile* nParent);
|
||||
SkinAnimatedLimbData(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
@ -103,11 +101,11 @@ public:
|
|||
size_t GetRawDataSize() const override;
|
||||
|
||||
protected:
|
||||
uint16_t unk_0; // Vtx count
|
||||
uint16_t unk_2; // Length of unk_4
|
||||
segptr_t unk_4; // Struct_800A598C*
|
||||
segptr_t unk_8; // Gfx*
|
||||
uint16_t totalVtxCount;
|
||||
uint16_t limbModifCount; // Length of limbModifications
|
||||
segptr_t limbModifications; // SkinLimbModif*
|
||||
segptr_t dlist; // Gfx*
|
||||
|
||||
std::vector<Struct_800A598C> unk_4_arr;
|
||||
std::vector<SkinLimbModif> limbModifications_arr;
|
||||
// ZDisplayList* unk_8_dlist = nullptr;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -84,26 +84,27 @@ typedef struct
|
|||
*/
|
||||
// clang-format off
|
||||
static const std::unordered_map<std::string, WarningInfoInit> warningStringToInitMap = {
|
||||
{"deprecated", {WarningType::Deprecated,
|
||||
{"deprecated", {WarningType::Deprecated,
|
||||
#ifdef DEPRECATION_ON
|
||||
WarningLevel::Warn,
|
||||
#else
|
||||
WarningLevel::Off,
|
||||
#endif
|
||||
"Deprecated features"}},
|
||||
{"unaccounted", {WarningType::Unaccounted, WarningLevel::Off, "Large blocks of unaccounted"}},
|
||||
{"missing-offsets", {WarningType::MissingOffsets, WarningLevel::Warn, "Offset attribute missing in XML tag"}},
|
||||
{"intersection", {WarningType::Intersection, WarningLevel::Warn, "Two assets intersect"}},
|
||||
{"missing-attribute", {WarningType::MissingAttribute, WarningLevel::Warn, "Required attribute missing in XML tag"}},
|
||||
{"invalid-attribute-value", {WarningType::InvalidAttributeValue, WarningLevel::Err, "Attribute declared in XML is wrong"}},
|
||||
{"unknown-attribute", {WarningType::UnknownAttribute, WarningLevel::Warn, "Unknown attribute in XML entry tag"}},
|
||||
{"invalid-xml", {WarningType::InvalidXML, WarningLevel::Err, "XML has syntax errors"}},
|
||||
{"invalid-jpeg", {WarningType::InvalidJPEG, WarningLevel::Err, "JPEG file does not conform to the game's format requirements"}},
|
||||
{"invalid-png", {WarningType::InvalidPNG, WarningLevel::Err, "Issues arising when processing PNG data"}},
|
||||
{"invalid-extracted-data", {WarningType::InvalidExtractedData, WarningLevel::Err, "Extracted data does not have correct form"}},
|
||||
{"missing-segment", {WarningType::MissingSegment, WarningLevel::Warn, "Segment not given in File tag in XML"}},
|
||||
{"hardcoded-pointer", {WarningType::HardcodedPointer, WarningLevel::Warn, "ZAPD lacks the info to make a symbol, so must output a hardcoded pointer"}},
|
||||
{"not-implemented", {WarningType::NotImplemented, WarningLevel::Warn, "ZAPD does not currently support this feature"}},
|
||||
{"unaccounted", {WarningType::Unaccounted, WarningLevel::Off, "Large blocks of unaccounted"}},
|
||||
{"missing-offsets", {WarningType::MissingOffsets, WarningLevel::Warn, "Offset attribute missing in XML tag"}},
|
||||
{"intersection", {WarningType::Intersection, WarningLevel::Warn, "Two assets intersect"}},
|
||||
{"missing-attribute", {WarningType::MissingAttribute, WarningLevel::Warn, "Required attribute missing in XML tag"}},
|
||||
{"invalid-attribute-value", {WarningType::InvalidAttributeValue, WarningLevel::Err, "Attribute declared in XML is wrong"}},
|
||||
{"unknown-attribute", {WarningType::UnknownAttribute, WarningLevel::Warn, "Unknown attribute in XML entry tag"}},
|
||||
{"invalid-xml", {WarningType::InvalidXML, WarningLevel::Err, "XML has syntax errors"}},
|
||||
{"invalid-jpeg", {WarningType::InvalidJPEG, WarningLevel::Err, "JPEG file does not conform to the game's format requirements"}},
|
||||
{"invalid-png", {WarningType::InvalidPNG, WarningLevel::Err, "Issues arising when processing PNG data"}},
|
||||
{"invalid-extracted-data", {WarningType::InvalidExtractedData, WarningLevel::Err, "Extracted data does not have correct form"}},
|
||||
{"missing-segment", {WarningType::MissingSegment, WarningLevel::Warn, "Segment not given in File tag in XML"}},
|
||||
{"hardcoded-generic-pointer", {WarningType::HardcodedGenericPointer, WarningLevel::Off, "A generic segmented pointer must be produced"}},
|
||||
{"hardcoded-pointer", {WarningType::HardcodedPointer, WarningLevel::Warn, "ZAPD lacks the info to make a symbol, so must output a hardcoded pointer"}},
|
||||
{"not-implemented", {WarningType::NotImplemented, WarningLevel::Warn, "ZAPD does not currently support this feature"}},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -229,7 +230,10 @@ void WarningHandler::ExtractedFilePreamble(const ZFile *parent, const ZResource*
|
|||
if (res != nullptr) {
|
||||
fprintf(stderr, "resource '%s' at ", res->GetName().c_str());
|
||||
}
|
||||
fprintf(stderr, "offset 0x%06X: \n\t", offset);
|
||||
if (offset != static_cast<uint32_t>(-1)) {
|
||||
fprintf(stderr, "offset 0x%06X:", offset);
|
||||
}
|
||||
fprintf(stderr, "\n\t");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,6 +81,7 @@ enum class WarningType
|
|||
InvalidExtractedData,
|
||||
MissingSegment,
|
||||
HardcodedPointer,
|
||||
HardcodedGenericPointer,
|
||||
NotImplemented,
|
||||
Max,
|
||||
};
|
||||
|
|
|
@ -249,6 +249,7 @@ mkdir build\ZAPD
|
|||
<ClCompile Include="ZTextureAnimation.cpp" />
|
||||
<ClCompile Include="ZVector.cpp" />
|
||||
<ClCompile Include="ZVtx.cpp" />
|
||||
<ClCompile Include="ZWaterbox.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\lib\elfio\elfio\elfio.hpp" />
|
||||
|
@ -272,6 +273,7 @@ mkdir build\ZAPD
|
|||
<ClInclude Include="CrashHandler.h" />
|
||||
<ClInclude Include="CRC32.h" />
|
||||
<ClInclude Include="Declaration.h" />
|
||||
<ClInclude Include="ExporterSet.h" />
|
||||
<ClInclude Include="GameConfig.h" />
|
||||
<ClInclude Include="Globals.h" />
|
||||
<ClInclude Include="ImageBackend.h" />
|
||||
|
@ -339,6 +341,7 @@ mkdir build\ZAPD
|
|||
<ClInclude Include="ZTextureAnimation.h" />
|
||||
<ClInclude Include="ZVector.h" />
|
||||
<ClInclude Include="ZVtx.h" />
|
||||
<ClInclude Include="ZWaterbox.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\SymbolMap_OoTMqDbg.txt">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
@ -291,6 +291,12 @@
|
|||
<ClCompile Include="ZSurfaceType.cpp">
|
||||
<Filter>Source Files\Z64</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ZActorList.cpp">
|
||||
<Filter>Source Files\Z64</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ZWaterbox.cpp">
|
||||
<Filter>Source Files\Z64</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ZRoom\ZRoom.h">
|
||||
|
@ -554,6 +560,15 @@
|
|||
<ClInclude Include="ZSurfaceType.h">
|
||||
<Filter>Header Files\Z64</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZActorList.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ExporterSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZWaterbox.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\SymbolMap_OoTMqDbg.txt">
|
||||
|
|
|
@ -153,7 +153,10 @@ size_t ZLinkAnimation::GetRawDataSize() const
|
|||
|
||||
std::string ZLinkAnimation::GetSourceTypeName() const
|
||||
{
|
||||
return "LinkAnimationHeader";
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
return "PlayerAnimationHeader";
|
||||
else
|
||||
return "LinkAnimationHeader";
|
||||
}
|
||||
|
||||
void ZLinkAnimation::ParseRawData()
|
||||
|
@ -174,8 +177,8 @@ std::string ZLinkAnimation::GetBodySourceCode() const
|
|||
|
||||
/* ZCurveAnimation */
|
||||
|
||||
TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData,
|
||||
uint32_t fileOffset)
|
||||
CurveInterpKnot::CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData,
|
||||
uint32_t fileOffset)
|
||||
: parent(parent)
|
||||
{
|
||||
unk_00 = BitConverter::ToUInt16BE(rawData, fileOffset + 0);
|
||||
|
@ -185,26 +188,26 @@ TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData,
|
|||
unk_08 = BitConverter::ToFloatBE(rawData, fileOffset + 8);
|
||||
}
|
||||
|
||||
TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData,
|
||||
uint32_t fileOffset, size_t index)
|
||||
: TransformData(parent, rawData, fileOffset + index * GetRawDataSize())
|
||||
CurveInterpKnot::CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData,
|
||||
uint32_t fileOffset, size_t index)
|
||||
: CurveInterpKnot(parent, rawData, fileOffset + index * GetRawDataSize())
|
||||
{
|
||||
}
|
||||
|
||||
std::string TransformData::GetBody([[maybe_unused]] const std::string& prefix) const
|
||||
std::string CurveInterpKnot::GetBody([[maybe_unused]] const std::string& prefix) const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%04X, 0x%04X, %i, %i, %ff", unk_00, unk_02, unk_04, unk_06,
|
||||
unk_08);
|
||||
}
|
||||
|
||||
size_t TransformData::GetRawDataSize() const
|
||||
size_t CurveInterpKnot::GetRawDataSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
std::string TransformData::GetSourceTypeName()
|
||||
std::string CurveInterpKnot::GetSourceTypeName()
|
||||
{
|
||||
return "TransformData";
|
||||
return "CurveInterpKnot";
|
||||
}
|
||||
|
||||
ZCurveAnimation::ZCurveAnimation(ZFile* nParent) : ZAnimation(nParent)
|
||||
|
@ -300,7 +303,7 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix)
|
|||
}
|
||||
else
|
||||
{
|
||||
decl->text = entryStr;
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,7 +334,7 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix)
|
|||
}
|
||||
else
|
||||
{
|
||||
decl->text = entryStr;
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +362,7 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix)
|
|||
}
|
||||
else
|
||||
{
|
||||
decl->text = entryStr;
|
||||
decl->declBody = entryStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +372,7 @@ std::string ZCurveAnimation::GetBodySourceCode() const
|
|||
std::string refIndexStr;
|
||||
Globals::Instance->GetSegmentedPtrName(refIndex, parent, "u8", refIndexStr);
|
||||
std::string transformDataStr;
|
||||
Globals::Instance->GetSegmentedPtrName(transformData, parent, "TransformData",
|
||||
Globals::Instance->GetSegmentedPtrName(transformData, parent, "CurveInterpKnot",
|
||||
transformDataStr);
|
||||
std::string copyValuesStr;
|
||||
Globals::Instance->GetSegmentedPtrName(copyValues, parent, "s16", copyValuesStr);
|
||||
|
@ -390,7 +393,7 @@ DeclarationAlignment ZCurveAnimation::GetDeclarationAlignment() const
|
|||
|
||||
std::string ZCurveAnimation::GetSourceTypeName() const
|
||||
{
|
||||
return "TransformUpdateIndex";
|
||||
return "CurveAnimationHeader";
|
||||
}
|
||||
|
||||
/* ZLegacyAnimation */
|
||||
|
@ -423,7 +426,7 @@ void ZLegacyAnimation::ParseRawData()
|
|||
ptr = jointKeyOffset;
|
||||
for (int32_t i = 0; i < limbCount + 1; i++)
|
||||
{
|
||||
JointKey key(parent);
|
||||
LegacyJointKey key(parent);
|
||||
key.ExtractFromFile(ptr);
|
||||
|
||||
jointKeyArray.push_back(key);
|
||||
|
@ -495,7 +498,7 @@ std::string ZLegacyAnimation::GetBodySourceCode() const
|
|||
std::string frameDataName;
|
||||
std::string jointKeyName;
|
||||
Globals::Instance->GetSegmentedPtrName(frameData, parent, "s16", frameDataName);
|
||||
Globals::Instance->GetSegmentedPtrName(jointKey, parent, "JointKey", jointKeyName);
|
||||
Globals::Instance->GetSegmentedPtrName(jointKey, parent, "LegacyJointKey", jointKeyName);
|
||||
|
||||
body += StringHelper::Sprintf("\t%i, %i,\n", frameCount, limbCount);
|
||||
body += StringHelper::Sprintf("\t%s,\n", frameDataName.c_str());
|
||||
|
@ -514,11 +517,11 @@ size_t ZLegacyAnimation::GetRawDataSize() const
|
|||
return 0x0C;
|
||||
}
|
||||
|
||||
JointKey::JointKey(ZFile* nParent) : ZResource(nParent)
|
||||
LegacyJointKey::LegacyJointKey(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void JointKey::ParseRawData()
|
||||
void LegacyJointKey::ParseRawData()
|
||||
{
|
||||
ZResource::ParseRawData();
|
||||
|
||||
|
@ -531,23 +534,23 @@ void JointKey::ParseRawData()
|
|||
z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x0A);
|
||||
}
|
||||
|
||||
std::string JointKey::GetBodySourceCode() const
|
||||
std::string LegacyJointKey::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("%6i, %6i, %6i, %6i, %6i, %6i", xMax, x, yMax, y, zMax, z);
|
||||
}
|
||||
|
||||
std::string JointKey::GetSourceTypeName() const
|
||||
std::string LegacyJointKey::GetSourceTypeName() const
|
||||
{
|
||||
return "JointKey";
|
||||
return "LegacyJointKey";
|
||||
}
|
||||
|
||||
ZResourceType JointKey::GetResourceType() const
|
||||
ZResourceType LegacyJointKey::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t JointKey::GetRawDataSize() const
|
||||
size_t LegacyJointKey::GetRawDataSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
void ParseRawData() override;
|
||||
};
|
||||
|
||||
class TransformData
|
||||
class CurveInterpKnot
|
||||
{
|
||||
protected:
|
||||
ZFile* parent;
|
||||
|
@ -84,10 +84,10 @@ protected:
|
|||
float unk_08;
|
||||
|
||||
public:
|
||||
TransformData() = default;
|
||||
TransformData(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset);
|
||||
TransformData(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset,
|
||||
size_t index);
|
||||
CurveInterpKnot() = default;
|
||||
CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset);
|
||||
CurveInterpKnot(ZFile* parent, const std::vector<uint8_t>& rawData, uint32_t fileOffset,
|
||||
size_t index);
|
||||
|
||||
[[nodiscard]] std::string GetBody(const std::string& prefix) const;
|
||||
|
||||
|
@ -102,7 +102,7 @@ protected:
|
|||
|
||||
///* 0x0000 */ u8* refIndex;
|
||||
segptr_t refIndex = 0;
|
||||
///* 0x0004 */ TransformData* transformData;
|
||||
///* 0x0004 */ CurveInterpKnot* transformData;
|
||||
segptr_t transformData = 0;
|
||||
///* 0x0008 */ s16* copyValues;
|
||||
segptr_t copyValues = 0;
|
||||
|
@ -114,7 +114,7 @@ protected:
|
|||
uint8_t limbCount = 0;
|
||||
|
||||
std::vector<uint8_t> refIndexArr;
|
||||
std::vector<TransformData> transformDataArr;
|
||||
std::vector<CurveInterpKnot> transformDataArr;
|
||||
std::vector<int16_t> copyValuesArr;
|
||||
|
||||
public:
|
||||
|
@ -132,14 +132,14 @@ public:
|
|||
|
||||
std::string GetSourceTypeName() const override;
|
||||
};
|
||||
// TransformUpdateIndex
|
||||
// CurveAnimationHeader
|
||||
|
||||
/* ZLegacyAnimation */
|
||||
|
||||
class JointKey : public ZResource
|
||||
class LegacyJointKey : public ZResource
|
||||
{
|
||||
public:
|
||||
JointKey(ZFile* nParent);
|
||||
LegacyJointKey(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
@ -172,8 +172,8 @@ public:
|
|||
protected:
|
||||
int16_t limbCount;
|
||||
segptr_t frameData; // s16*
|
||||
segptr_t jointKey; // JointKey*
|
||||
segptr_t jointKey; // LegacyJointKey*
|
||||
|
||||
std::vector<uint16_t> frameDataArray;
|
||||
std::vector<JointKey> jointKeyArray;
|
||||
std::vector<LegacyJointKey> jointKeyArray;
|
||||
};
|
||||
|
|
|
@ -56,7 +56,7 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader)
|
|||
}
|
||||
res->parent = parent;
|
||||
res->SetInnerNode(true);
|
||||
res->ExtractFromXML(child, childIndex);
|
||||
res->ExtractWithXML(child, childIndex);
|
||||
|
||||
childIndex += res->GetRawDataSize();
|
||||
resList.push_back(res);
|
||||
|
@ -75,11 +75,11 @@ Declaration* ZArray::DeclareVar(const std::string& prefix, const std::string& bo
|
|||
if (res->IsExternalResource())
|
||||
{
|
||||
auto filepath = Globals::Instance->outputPath / name;
|
||||
std::string includePath = StringHelper::Sprintf("%s.%s.inc", filepath.c_str(),
|
||||
std::string includePath = StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(),
|
||||
res->GetExternalExtension().c_str());
|
||||
decl = parent->AddDeclarationIncludeArray(rawDataIndex, includePath, GetRawDataSize(),
|
||||
GetSourceTypeName(), name, arrayCnt);
|
||||
decl->text = bodyStr;
|
||||
decl->declBody = bodyStr;
|
||||
decl->isExternal = true;
|
||||
}
|
||||
else
|
||||
|
@ -109,6 +109,7 @@ std::string ZArray::GetBodySourceCode() const
|
|||
case ZResourceType::Vertex:
|
||||
case ZResourceType::CollisionPoly:
|
||||
case ZResourceType::SurfaceType:
|
||||
case ZResourceType::Waterbox:
|
||||
output += resList.at(i)->GetBodySourceCode();
|
||||
break;
|
||||
|
||||
|
|
|
@ -132,8 +132,13 @@ Declaration* ZBackground::DeclareVar(const std::string& prefix,
|
|||
|
||||
Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(),
|
||||
GetSourceTypeName(), auxName, 0);
|
||||
decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4";
|
||||
decl->forceArrayCnt = true;
|
||||
|
||||
if (Globals::Instance->cfg.useScreenWidthHeightConstants)
|
||||
{
|
||||
decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4";
|
||||
decl->forceArrayCnt = true;
|
||||
}
|
||||
|
||||
decl->staticConf = staticConf;
|
||||
return decl;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "ZCollision.h"
|
||||
#include "ZWaterbox.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
@ -50,6 +51,7 @@ void ZCollisionHeader::ParseRawData()
|
|||
|
||||
vertices.reserve(numVerts);
|
||||
polygons.reserve(numPolygons);
|
||||
waterBoxes.reserve(numWaterBoxes);
|
||||
|
||||
offset_t currentPtr = vtxSegmentOffset;
|
||||
|
||||
|
@ -97,38 +99,55 @@ void ZCollisionHeader::ParseRawData()
|
|||
// usually ordered. If for some reason the data was in some other funny
|
||||
// order, this would probably break.
|
||||
// The most common ordering is:
|
||||
// - *CamData*
|
||||
// - *BgCamInfo*
|
||||
// - SurfaceType
|
||||
// - CollisionPoly
|
||||
// - Vertices
|
||||
// - WaterBoxes
|
||||
// - CollisionHeader
|
||||
offset_t upperCameraBoundary = polyTypeDefSegmentOffset;
|
||||
if (upperCameraBoundary == 0)
|
||||
if (upperCameraBoundary == SEGMENTED_NULL)
|
||||
{
|
||||
upperCameraBoundary = polySegmentOffset;
|
||||
}
|
||||
if (upperCameraBoundary == 0)
|
||||
if (upperCameraBoundary == SEGMENTED_NULL)
|
||||
{
|
||||
upperCameraBoundary = vtxSegmentOffset;
|
||||
}
|
||||
if (upperCameraBoundary == 0)
|
||||
if (upperCameraBoundary == SEGMENTED_NULL)
|
||||
{
|
||||
upperCameraBoundary = waterBoxSegmentOffset;
|
||||
}
|
||||
if (upperCameraBoundary == 0)
|
||||
if (upperCameraBoundary == SEGMENTED_NULL)
|
||||
{
|
||||
upperCameraBoundary = rawDataIndex;
|
||||
}
|
||||
|
||||
// Sharp Ocarina places the CamDataEntries above the list so we need to calculate the number
|
||||
// of cameras differently.
|
||||
if (upperCameraBoundary < camDataSegmentOffset)
|
||||
{
|
||||
offset_t offset = camDataSegmentOffset;
|
||||
while (rawData[offset] == 0x00 && rawData[offset + 0x4] == 0x02)
|
||||
{
|
||||
offset += 0x08;
|
||||
}
|
||||
upperCameraBoundary = offset;
|
||||
}
|
||||
|
||||
camData =
|
||||
new CameraDataList(parent, name, rawData, camDataSegmentOffset, upperCameraBoundary);
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < numWaterBoxes; i++)
|
||||
waterBoxes.push_back(WaterBoxHeader(
|
||||
rawData,
|
||||
waterBoxSegmentOffset + (i * (Globals::Instance->game == ZGame::OOT_SW97 ? 12 : 16))));
|
||||
for (int32_t i = 0; i < numWaterBoxes; i++)
|
||||
{
|
||||
ZWaterbox waterbox(parent);
|
||||
|
||||
waterbox.SetRawDataIndex(waterBoxSegmentOffset +
|
||||
(i * (Globals::Instance->game == ZGame::OOT_SW97 ? 12 : 16)));
|
||||
waterbox.ParseRawData();
|
||||
waterBoxes.emplace_back(waterbox);
|
||||
}
|
||||
}
|
||||
|
||||
void ZCollisionHeader::DeclareReferences(const std::string& prefix)
|
||||
|
@ -149,9 +168,11 @@ void ZCollisionHeader::DeclareReferences(const std::string& prefix)
|
|||
declaration += "\n";
|
||||
}
|
||||
|
||||
parent->AddDeclarationArray(
|
||||
waterBoxSegmentOffset, DeclarationAlignment::Align4, 16 * waterBoxes.size(), "WaterBox",
|
||||
StringHelper::Sprintf("%sWaterBoxes", auxName.c_str()), waterBoxes.size(), declaration);
|
||||
parent->AddDeclarationArray(waterBoxSegmentOffset, DeclarationAlignment::Align4,
|
||||
waterBoxes[0].GetRawDataSize() * waterBoxes.size(),
|
||||
waterBoxes[0].GetSourceTypeName().c_str(),
|
||||
StringHelper::Sprintf("%sWaterBoxes", auxName.c_str()),
|
||||
waterBoxes.size(), declaration);
|
||||
}
|
||||
|
||||
if (polygons.size() > 0)
|
||||
|
@ -219,23 +240,38 @@ std::string ZCollisionHeader::GetBodySourceCode() const
|
|||
|
||||
std::string vtxName;
|
||||
Globals::Instance->GetSegmentedPtrName(vtxAddress, parent, "Vec3s", vtxName);
|
||||
declaration += StringHelper::Sprintf("\t%i, %s,\n", numVerts, vtxName.c_str());
|
||||
|
||||
if (numVerts > 0)
|
||||
declaration +=
|
||||
StringHelper::Sprintf("\tARRAY_COUNT(%s), %s,\n", vtxName.c_str(), vtxName.c_str());
|
||||
else
|
||||
declaration += StringHelper::Sprintf("\t%i, %s,\n", numVerts, vtxName.c_str());
|
||||
|
||||
std::string polyName;
|
||||
Globals::Instance->GetSegmentedPtrName(polyAddress, parent, "CollisionPoly", polyName);
|
||||
declaration += StringHelper::Sprintf("\t%i, %s,\n", numPolygons, polyName.c_str());
|
||||
|
||||
if (numPolygons > 0)
|
||||
declaration +=
|
||||
StringHelper::Sprintf("\tARRAY_COUNT(%s), %s,\n", polyName.c_str(), polyName.c_str());
|
||||
else
|
||||
declaration += StringHelper::Sprintf("\t%i, %s,\n", numPolygons, polyName.c_str());
|
||||
|
||||
std::string surfaceName;
|
||||
Globals::Instance->GetSegmentedPtrName(polyTypeDefAddress, parent, "SurfaceType", surfaceName);
|
||||
declaration += StringHelper::Sprintf("\t%s,\n", surfaceName.c_str());
|
||||
|
||||
std::string camName;
|
||||
Globals::Instance->GetSegmentedPtrName(camDataAddress, parent, "CamData", camName);
|
||||
Globals::Instance->GetSegmentedPtrName(camDataAddress, parent, "BgCamInfo", camName);
|
||||
declaration += StringHelper::Sprintf("\t%s,\n", camName.c_str());
|
||||
|
||||
std::string waterBoxName;
|
||||
Globals::Instance->GetSegmentedPtrName(waterBoxAddress, parent, "WaterBox", waterBoxName);
|
||||
declaration += StringHelper::Sprintf("\t%i, %s\n", numWaterBoxes, waterBoxName.c_str());
|
||||
|
||||
if (numWaterBoxes > 0)
|
||||
declaration += StringHelper::Sprintf("\tARRAY_COUNT(%s), %s\n", waterBoxName.c_str(),
|
||||
waterBoxName.c_str());
|
||||
else
|
||||
declaration += StringHelper::Sprintf("\t%i, %s\n", numWaterBoxes, waterBoxName.c_str());
|
||||
|
||||
return declaration;
|
||||
}
|
||||
|
@ -260,26 +296,6 @@ size_t ZCollisionHeader::GetRawDataSize() const
|
|||
return 44;
|
||||
}
|
||||
|
||||
WaterBoxHeader::WaterBoxHeader(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
{
|
||||
xMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||
ySurface = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||
zMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
||||
xLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 6);
|
||||
zLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
|
||||
|
||||
if (Globals::Instance->game == ZGame::OOT_SW97)
|
||||
properties = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
||||
else
|
||||
properties = BitConverter::ToInt32BE(rawData, rawDataIndex + 12);
|
||||
}
|
||||
|
||||
std::string WaterBoxHeader::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("%i, %i, %i, %i, %i, 0x%08X", xMin, ySurface, zMin, xLength,
|
||||
zLength, properties);
|
||||
}
|
||||
|
||||
CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix,
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
offset_t upperCameraBoundary)
|
||||
|
@ -291,73 +307,93 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix,
|
|||
assert(numElements < 10000);
|
||||
|
||||
offset_t cameraPosDataSeg = rawDataIndex;
|
||||
uint32_t numDataTotal;
|
||||
uint32_t cameraPosDataSegEnd = rawDataIndex;
|
||||
bool isSharpOcarina = false;
|
||||
|
||||
for (size_t i = 0; i < numElements; i++)
|
||||
{
|
||||
CameraDataEntry* entry = new CameraDataEntry();
|
||||
CameraDataEntry entry;
|
||||
|
||||
entry->cameraSType =
|
||||
entry.cameraSType =
|
||||
BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 0);
|
||||
entry->numData = BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 2);
|
||||
entry->cameraPosDataSeg =
|
||||
entry.numData = BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 2);
|
||||
entry.cameraPosDataSeg =
|
||||
BitConverter::ToInt32BE(rawData, rawDataIndex + (entries.size() * 8) + 4);
|
||||
|
||||
if (entry->cameraPosDataSeg != 0 && GETSEGNUM(entry->cameraPosDataSeg) != SEGMENT_SCENE)
|
||||
if (entry.cameraPosDataSeg != 0 && GETSEGNUM(entry.cameraPosDataSeg) != SEGMENT_SCENE)
|
||||
{
|
||||
cameraPosDataSeg = rawDataIndex + (entries.size() * 8);
|
||||
break;
|
||||
}
|
||||
|
||||
if (entry->cameraPosDataSeg != 0 && cameraPosDataSeg > (entry->cameraPosDataSeg & 0xFFFFFF))
|
||||
cameraPosDataSeg = (entry->cameraPosDataSeg & 0xFFFFFF);
|
||||
if (rawDataIndex > GETSEGOFFSET(entry.cameraPosDataSeg))
|
||||
{
|
||||
if (entry.cameraPosDataSeg != 0 &&
|
||||
cameraPosDataSeg > GETSEGOFFSET(entry.cameraPosDataSeg))
|
||||
cameraPosDataSeg = GETSEGOFFSET(entry.cameraPosDataSeg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sharp Ocarina will place the cam data after the list as opposed to the original maps
|
||||
// which have it before.
|
||||
isSharpOcarina = true;
|
||||
cameraPosDataSeg = rawDataIndex + (numElements * 0x8);
|
||||
if (cameraPosDataSegEnd < GETSEGOFFSET(entry.cameraPosDataSeg))
|
||||
cameraPosDataSegEnd = GETSEGOFFSET(entry.cameraPosDataSeg);
|
||||
}
|
||||
|
||||
entries.push_back(entry);
|
||||
entries.emplace_back(entry);
|
||||
}
|
||||
|
||||
// Setting cameraPosDataAddr to rawDataIndex give a pos list length of 0
|
||||
uint32_t cameraPosDataOffset = cameraPosDataSeg & 0xFFFFFF;
|
||||
uint32_t cameraPosDataOffset = GETSEGOFFSET(cameraPosDataSeg);
|
||||
for (size_t i = 0; i < entries.size(); i++)
|
||||
{
|
||||
char camSegLine[2048];
|
||||
|
||||
if (entries[i]->cameraPosDataSeg != 0)
|
||||
if (entries[i].cameraPosDataSeg != 0)
|
||||
{
|
||||
int32_t index =
|
||||
((entries[i]->cameraPosDataSeg & 0x00FFFFFF) - cameraPosDataOffset) / 0x6;
|
||||
sprintf(camSegLine, "&%sCamPosData[%i]", prefix.c_str(), index);
|
||||
uint32_t index =
|
||||
(GETSEGOFFSET(entries[i].cameraPosDataSeg) - cameraPosDataOffset) / 0x6;
|
||||
snprintf(camSegLine, 2048, "&%sCamPosData[%i]", prefix.c_str(), index);
|
||||
}
|
||||
else
|
||||
sprintf(camSegLine, "NULL");
|
||||
snprintf(camSegLine, 2048, "NULL");
|
||||
|
||||
declaration +=
|
||||
StringHelper::Sprintf(" { 0x%04X, %i, %s },", entries[i]->cameraSType,
|
||||
entries[i]->numData, camSegLine, rawDataIndex + (i * 8));
|
||||
StringHelper::Sprintf(" { 0x%04X, %i, %s },", entries[i].cameraSType,
|
||||
entries[i].numData, camSegLine, rawDataIndex + (i * 8));
|
||||
|
||||
if (i < entries.size() - 1)
|
||||
declaration += "\n";
|
||||
}
|
||||
|
||||
parent->AddDeclarationArray(
|
||||
rawDataIndex, DeclarationAlignment::Align4, entries.size() * 8, "CamData",
|
||||
rawDataIndex, DeclarationAlignment::Align4, entries.size() * 8, "BgCamInfo",
|
||||
StringHelper::Sprintf("%sCamDataList", prefix.c_str(), rawDataIndex), entries.size(),
|
||||
declaration);
|
||||
|
||||
uint32_t numDataTotal = (rawDataIndex - cameraPosDataOffset) / 0x6;
|
||||
if (!isSharpOcarina)
|
||||
numDataTotal = (rawDataIndex - cameraPosDataOffset) / 0x6;
|
||||
else
|
||||
numDataTotal = ((cameraPosDataSegEnd - cameraPosDataSeg) + 18) / 0x6;
|
||||
|
||||
if (numDataTotal > 0)
|
||||
{
|
||||
declaration.clear();
|
||||
cameraPositionData.reserve(numDataTotal);
|
||||
for (uint32_t i = 0; i < numDataTotal; i++)
|
||||
{
|
||||
CameraPositionData* data =
|
||||
new CameraPositionData(rawData, cameraPosDataOffset + (i * 6));
|
||||
cameraPositionData.push_back(data);
|
||||
CameraPositionData data = CameraPositionData(rawData, cameraPosDataOffset + (i * 6));
|
||||
|
||||
declaration += StringHelper::Sprintf("\t{ %6i, %6i, %6i },", data->x, data->y, data->z);
|
||||
declaration += StringHelper::Sprintf("\t{ %6i, %6i, %6i },", data.x, data.y, data.z);
|
||||
cameraPositionData.emplace_back(data);
|
||||
if (i + 1 < numDataTotal)
|
||||
declaration += "\n";
|
||||
}
|
||||
|
||||
int32_t cameraPosDataIndex = GETSEGOFFSET(cameraPosDataSeg);
|
||||
uint32_t cameraPosDataIndex = GETSEGOFFSET(cameraPosDataSeg);
|
||||
uint32_t entrySize = numDataTotal * 0x6;
|
||||
parent->AddDeclarationArray(cameraPosDataIndex, DeclarationAlignment::Align4, entrySize,
|
||||
"Vec3s", StringHelper::Sprintf("%sCamPosData", prefix.c_str()),
|
||||
|
@ -367,11 +403,6 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix,
|
|||
|
||||
CameraDataList::~CameraDataList()
|
||||
{
|
||||
for (auto entry : entries)
|
||||
delete entry;
|
||||
|
||||
for (auto camPosData : cameraPositionData)
|
||||
delete camPosData;
|
||||
}
|
||||
|
||||
CameraPositionData::CameraPositionData(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
|
|
|
@ -6,23 +6,7 @@
|
|||
#include "ZRoom/ZRoom.h"
|
||||
#include "ZSurfaceType.h"
|
||||
#include "ZVector.h"
|
||||
|
||||
class WaterBoxHeader
|
||||
{
|
||||
public:
|
||||
WaterBoxHeader(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const;
|
||||
|
||||
protected:
|
||||
int16_t xMin;
|
||||
int16_t ySurface;
|
||||
int16_t zMin;
|
||||
int16_t xLength;
|
||||
int16_t zLength;
|
||||
int16_t pad;
|
||||
int32_t properties;
|
||||
};
|
||||
#include "ZWaterbox.h"
|
||||
|
||||
class CameraPositionData
|
||||
{
|
||||
|
@ -37,14 +21,14 @@ class CameraDataEntry
|
|||
public:
|
||||
int16_t cameraSType;
|
||||
int16_t numData;
|
||||
int32_t cameraPosDataSeg;
|
||||
offset_t cameraPosDataSeg;
|
||||
};
|
||||
|
||||
class CameraDataList
|
||||
{
|
||||
public:
|
||||
std::vector<CameraDataEntry*> entries;
|
||||
std::vector<CameraPositionData*> cameraPositionData;
|
||||
std::vector<CameraDataEntry> entries;
|
||||
std::vector<CameraPositionData> cameraPositionData;
|
||||
|
||||
CameraDataList(ZFile* parent, const std::string& prefix, const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex, offset_t upperCameraBoundary);
|
||||
|
@ -72,7 +56,7 @@ public:
|
|||
std::vector<ZVector> vertices;
|
||||
std::vector<ZCollisionPoly> polygons;
|
||||
std::vector<ZSurfaceType> polygonTypes;
|
||||
std::vector<WaterBoxHeader> waterBoxes;
|
||||
std::vector<ZWaterbox> waterBoxes;
|
||||
CameraDataList* camData = nullptr;
|
||||
|
||||
ZCollisionHeader(ZFile* nParent);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <cassert>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "OtherStructs/CutsceneMM_Commands.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "WarningHandler.h"
|
||||
|
@ -129,174 +128,147 @@ void ZCutscene::ParseRawData()
|
|||
|
||||
CutsceneCommand* ZCutscene::GetCommandOoT(uint32_t id, offset_t currentPtr) const
|
||||
{
|
||||
CutsceneCommands cmdID = static_cast<CutsceneCommands>(id);
|
||||
CutsceneOoT_CommandType cmdID = static_cast<CutsceneOoT_CommandType>(id);
|
||||
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 10: // CutsceneCommands::SetPlayerAction
|
||||
case 15: // CutsceneCommands::SetActorAction1
|
||||
case 17:
|
||||
case 18:
|
||||
case 23:
|
||||
case 34:
|
||||
case 39:
|
||||
case 46:
|
||||
case 76:
|
||||
case 85:
|
||||
case 93:
|
||||
case 105:
|
||||
case 107:
|
||||
case 110:
|
||||
case 119:
|
||||
case 123:
|
||||
case 138:
|
||||
case 139:
|
||||
case 144:
|
||||
case 14: // CutsceneCommands::SetActorAction2
|
||||
case 16:
|
||||
case 24:
|
||||
case 35:
|
||||
case 40:
|
||||
case 48:
|
||||
case 64:
|
||||
case 68:
|
||||
case 70:
|
||||
case 78:
|
||||
case 80:
|
||||
case 94:
|
||||
case 116:
|
||||
case 118:
|
||||
case 120:
|
||||
case 125:
|
||||
case 131:
|
||||
case 141:
|
||||
case 25: // CutsceneCommands::SetActorAction3
|
||||
case 36:
|
||||
case 41:
|
||||
case 50:
|
||||
case 67:
|
||||
case 69:
|
||||
case 72:
|
||||
case 81:
|
||||
case 106:
|
||||
case 117:
|
||||
case 121:
|
||||
case 126:
|
||||
case 132:
|
||||
case 29: // CutsceneCommands::SetActorAction4
|
||||
case 37:
|
||||
case 42:
|
||||
case 51:
|
||||
case 53:
|
||||
case 63:
|
||||
case 65:
|
||||
case 66:
|
||||
case 75:
|
||||
case 82:
|
||||
case 108:
|
||||
case 127:
|
||||
case 133:
|
||||
case 30: // CutsceneCommands::SetActorAction5
|
||||
case 38:
|
||||
case 43:
|
||||
case 47:
|
||||
case 54:
|
||||
case 79:
|
||||
case 83:
|
||||
case 128:
|
||||
case 135:
|
||||
case 44: // CutsceneCommands::SetActorAction6
|
||||
case 55:
|
||||
case 77:
|
||||
case 84:
|
||||
case 90:
|
||||
case 129:
|
||||
case 136:
|
||||
case 31: // CutsceneCommands::SetActorAction7
|
||||
case 52:
|
||||
case 57:
|
||||
case 58:
|
||||
case 88:
|
||||
case 115:
|
||||
case 130:
|
||||
case 137:
|
||||
case 49: // CutsceneCommands::SetActorAction8
|
||||
case 60:
|
||||
case 89:
|
||||
case 111:
|
||||
case 114:
|
||||
case 134:
|
||||
case 142:
|
||||
case 62: // CutsceneCommands::SetActorAction9
|
||||
case 143: // CutsceneCommands::SetActorAction10
|
||||
return new CutsceneCommand_ActorAction(rawData, currentPtr);
|
||||
|
||||
case 0x0B:
|
||||
case 0x0D:
|
||||
case 0x1A:
|
||||
case 0x1B:
|
||||
case 0x1C:
|
||||
case 0x20:
|
||||
case 0x21:
|
||||
case 0x3B:
|
||||
case 0x3D:
|
||||
case 0x47:
|
||||
case 0x49:
|
||||
case 0x6D:
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x70:
|
||||
case 0x71:
|
||||
case 0x4A:
|
||||
return new CutsceneCommand_GenericCmd(rawData, currentPtr, cmdID);
|
||||
}
|
||||
|
||||
switch (cmdID)
|
||||
{
|
||||
case CutsceneCommands::Misc:
|
||||
case CutsceneCommands::SetLighting:
|
||||
case CutsceneCommands::PlayBGM:
|
||||
case CutsceneCommands::StopBGM:
|
||||
case CutsceneCommands::FadeBGM:
|
||||
return new CutsceneCommand_GenericCmd(rawData, currentPtr, cmdID);
|
||||
case CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_1:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_8_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_7:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_7:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_8:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_7:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_8:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_7:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_9:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_10:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_8:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_9:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_8:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_2:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_9:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_11:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_10:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_9:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_11:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_10:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_12:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_3:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_4:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_12:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_10:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_13:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_13:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_14:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_11:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_14:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_15:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_12:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_11:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_7:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_16:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_13:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_12:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_5:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_8:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_7:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_15:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_16:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_17:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_6:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_9_0:
|
||||
case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_17:
|
||||
return new CutsceneOoTCommand_ActorCue(rawData, currentPtr);
|
||||
|
||||
case CutsceneCommands::SetCameraPos:
|
||||
case CutsceneCommands::SetCameraFocus:
|
||||
case CutsceneCommands::SetCameraPosLink:
|
||||
case CutsceneCommands::SetCameraFocusLink:
|
||||
return new CutsceneCommandSetCameraPos(rawData, currentPtr);
|
||||
case CutsceneOoT_CommandType::CS_CMD_MISC:
|
||||
case CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING:
|
||||
case CutsceneOoT_CommandType::CS_CMD_START_SEQ:
|
||||
case CutsceneOoT_CommandType::CS_CMD_STOP_SEQ:
|
||||
case CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ:
|
||||
return new CutsceneOoTCommand_GenericCmd(rawData, currentPtr, cmdID);
|
||||
|
||||
case CutsceneCommands::Cmd07:
|
||||
break;
|
||||
case CutsceneCommands::Cmd08:
|
||||
break;
|
||||
case CutsceneCommands::Cmd09:
|
||||
return new CutsceneCommand_Rumble(rawData, currentPtr);
|
||||
case CutsceneCommands::Textbox:
|
||||
return new CutsceneCommand_TextBox(rawData, currentPtr);
|
||||
case CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE:
|
||||
case CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE:
|
||||
case CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER:
|
||||
case CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER:
|
||||
return new CutsceneOoTCommand_GenericCameraCmd(rawData, currentPtr);
|
||||
|
||||
case CutsceneCommands::SetPlayerAction:
|
||||
case CutsceneCommands::SetActorAction1:
|
||||
case CutsceneCommands::SetActorAction2:
|
||||
case CutsceneCommands::SetActorAction3:
|
||||
case CutsceneCommands::SetActorAction4:
|
||||
case CutsceneCommands::SetActorAction5:
|
||||
case CutsceneCommands::SetActorAction6:
|
||||
case CutsceneCommands::SetActorAction7:
|
||||
case CutsceneCommands::SetActorAction8:
|
||||
case CutsceneCommands::SetActorAction9:
|
||||
case CutsceneCommands::SetActorAction10:
|
||||
case CutsceneOoT_CommandType::CS_CMD_RUMBLE_CONTROLLER:
|
||||
return new CutsceneOoTCommand_Rumble(rawData, currentPtr);
|
||||
|
||||
case CutsceneOoT_CommandType::CS_CMD_TEXT:
|
||||
return new CutsceneOoTCommand_Text(rawData, currentPtr);
|
||||
|
||||
case CutsceneOoT_CommandType::CS_CMD_TRANSITION:
|
||||
return new CutsceneOoTCommand_Transition(rawData, currentPtr);
|
||||
|
||||
case CutsceneOoT_CommandType::CS_CMD_TIME:
|
||||
return new CutsceneCommand_Time(rawData, currentPtr);
|
||||
|
||||
case CutsceneOoT_CommandType::CS_CMD_DESTINATION:
|
||||
return new CutsceneOoTCommand_Destination(rawData, currentPtr);
|
||||
|
||||
case CutsceneOoT_CommandType::CS_CMD_CAM_EYE:
|
||||
case CutsceneOoT_CommandType::CS_CMD_CAM_AT:
|
||||
break;
|
||||
|
||||
case CutsceneCommands::SetSceneTransFX:
|
||||
return new CutsceneCommandSceneTransFX(rawData, currentPtr);
|
||||
|
||||
case CutsceneCommands::SetTime:
|
||||
return new CutsceneCommand_SetTime(rawData, currentPtr);
|
||||
case CutsceneCommands::Terminator:
|
||||
return new CutsceneCommand_Terminator(rawData, currentPtr);
|
||||
default:
|
||||
std::string errorHeader =
|
||||
StringHelper::Sprintf("Warning: Invalid cutscene command ID: '0x%04X'", cmdID);
|
||||
return new CutsceneOoTCommand_GenericCmd(rawData, currentPtr, cmdID);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -304,60 +276,74 @@ CutsceneCommand* ZCutscene::GetCommandOoT(uint32_t id, offset_t currentPtr) cons
|
|||
|
||||
CutsceneCommand* ZCutscene::GetCommandMM(uint32_t id, offset_t currentPtr) const
|
||||
{
|
||||
CutsceneMMCommands cmdID = static_cast<CutsceneMMCommands>(id);
|
||||
CutsceneMM_CommandType cmdID = static_cast<CutsceneMM_CommandType>(id);
|
||||
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
if (((id >= 100) && (id < 150)) || (id == 201) || ((id >= 450) && (id < 600)))
|
||||
if (((id >= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_100) &&
|
||||
(id <= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_149)) ||
|
||||
(id == (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_201) ||
|
||||
((id >= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_450) &&
|
||||
(id <= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_599)))
|
||||
{
|
||||
return new CutsceneCommand_ActorAction(rawData, currentPtr);
|
||||
return new CutsceneMMCommand_ActorCue(rawData, currentPtr);
|
||||
}
|
||||
|
||||
switch (cmdID)
|
||||
{
|
||||
case CutsceneMMCommands::CS_CMD_MISC:
|
||||
case CutsceneMMCommands::CS_CMD_SET_LIGHTING:
|
||||
case CutsceneMMCommands::CS_CMD_SCENE_TRANS_FX:
|
||||
case CutsceneMMCommands::CS_CMD_MOTIONBLUR:
|
||||
case CutsceneMMCommands::CS_CMD_GIVETATL:
|
||||
case CutsceneMMCommands::CS_CMD_PLAYSEQ:
|
||||
case CutsceneMMCommands::CS_CMD_130:
|
||||
case CutsceneMMCommands::CS_CMD_131:
|
||||
case CutsceneMMCommands::CS_CMD_132:
|
||||
case CutsceneMMCommands::CS_CMD_STOPSEQ:
|
||||
case CutsceneMMCommands::CS_CMD_PLAYAMBIENCE:
|
||||
case CutsceneMMCommands::CS_CMD_FADEAMBIENCE:
|
||||
case CutsceneMMCommands::CS_CMD_TERMINATOR:
|
||||
case CutsceneMMCommands::CS_CMD_CHOOSE_CREDITS_SCENES:
|
||||
case CutsceneMM_CommandType::CS_CMD_MISC:
|
||||
case CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING:
|
||||
case CutsceneMM_CommandType::CS_CMD_TRANSITION:
|
||||
case CutsceneMM_CommandType::CS_CMD_MOTION_BLUR:
|
||||
case CutsceneMM_CommandType::CS_CMD_GIVE_TATL:
|
||||
case CutsceneMM_CommandType::CS_CMD_START_SEQ:
|
||||
case CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_2:
|
||||
case CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_1:
|
||||
case CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ:
|
||||
case CutsceneMM_CommandType::CS_CMD_STOP_SEQ:
|
||||
case CutsceneMM_CommandType::CS_CMD_START_AMBIENCE:
|
||||
case CutsceneMM_CommandType::CS_CMD_FADE_OUT_AMBIENCE:
|
||||
case CutsceneMM_CommandType::CS_CMD_DESTINATION:
|
||||
case CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES:
|
||||
|
||||
case CutsceneMMCommands::CS_CMD_UNK_FA:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_FE:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_FF:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_100:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_101:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_102:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_103:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_104:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_105:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_108:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_109:
|
||||
case CutsceneMMCommands::CS_CMD_UNK_12D:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_FA:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_FE:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_FF:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_100:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_101:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_102:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_103:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_104:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_105:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_108:
|
||||
case CutsceneMM_CommandType::CS_CMD_UNK_DATA_109:
|
||||
return new CutsceneMMCommand_GenericCmd(rawData, currentPtr, cmdID);
|
||||
|
||||
case CutsceneMMCommands::CS_CMD_TEXTBOX:
|
||||
return new CutsceneCommand_TextBox(rawData, currentPtr);
|
||||
case CutsceneMMCommands::CS_CMD_CAMERA:
|
||||
case CutsceneMM_CommandType::CS_CMD_TEXT:
|
||||
return new CutsceneMMCommand_Text(rawData, currentPtr);
|
||||
|
||||
case CutsceneMM_CommandType::CS_CMD_CAMERA_SPLINE:
|
||||
return new CutsceneMMCommand_Camera(rawData, currentPtr);
|
||||
case CutsceneMMCommands::CS_CMD_FADESCREEN:
|
||||
return new CutsceneMMCommand_FadeScreen(rawData, currentPtr);
|
||||
case CutsceneMMCommands::CS_CMD_FADESEQ:
|
||||
return new CutsceneMMCommand_FadeSeq(rawData, currentPtr);
|
||||
case CutsceneMMCommands::CS_CMD_SETTIME:
|
||||
return new CutsceneCommand_SetTime(rawData, currentPtr);
|
||||
case CutsceneMMCommands::CS_CMD_SET_PLAYER_ACTION:
|
||||
return new CutsceneCommand_ActorAction(rawData, currentPtr);
|
||||
case CutsceneMMCommands::CS_CMD_RUMBLE:
|
||||
return new CutsceneCommand_Rumble(rawData, currentPtr);
|
||||
|
||||
case CutsceneMM_CommandType::CS_CMD_TRANSITION_GENERAL:
|
||||
return new CutsceneMMCommand_TransitionGeneral(rawData, currentPtr);
|
||||
|
||||
case CutsceneMM_CommandType::CS_CMD_FADE_OUT_SEQ:
|
||||
return new CutsceneMMCommand_FadeOutSeq(rawData, currentPtr);
|
||||
|
||||
case CutsceneMM_CommandType::CS_CMD_TIME:
|
||||
return new CutsceneCommand_Time(rawData, currentPtr);
|
||||
|
||||
case CutsceneMM_CommandType::CS_CMD_PLAYER_CUE:
|
||||
return new CutsceneMMCommand_ActorCue(rawData, currentPtr);
|
||||
|
||||
case CutsceneMM_CommandType::CS_CMD_RUMBLE:
|
||||
return new CutsceneMMCommand_Rumble(rawData, currentPtr);
|
||||
|
||||
default:
|
||||
std::string errorHeader =
|
||||
StringHelper::Sprintf("Warning: Invalid cutscene command ID: '0x%04X'", cmdID);
|
||||
return new CutsceneMMCommand_GenericCmd(rawData, currentPtr, cmdID);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include <vector>
|
||||
#include "tinyxml2.h"
|
||||
|
||||
#include "OtherStructs/Cutscene_Commands.h"
|
||||
#include "OtherStructs/CutsceneOoT_Commands.h"
|
||||
#include "OtherStructs/CutsceneMM_Commands.h"
|
||||
#include "ZFile.h"
|
||||
#include "ZResource.h"
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ ZDisplayList::~ZDisplayList()
|
|||
}
|
||||
|
||||
// EXTRACT MODE
|
||||
void ZDisplayList::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
void ZDisplayList::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
{
|
||||
rawDataIndex = nRawDataIndex;
|
||||
ParseXML(reader);
|
||||
|
@ -708,7 +708,7 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l
|
|||
if (!Globals::Instance->HasSegment(segNum))
|
||||
sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF);
|
||||
else if (dListDecl != nullptr)
|
||||
sprintf(line, "gsSPBranchList(%s),", dListDecl->varName.c_str());
|
||||
sprintf(line, "gsSPBranchList(%s),", dListDecl->declName.c_str());
|
||||
else
|
||||
sprintf(line, "gsSPBranchList(%sDlist0x%06" PRIX64 "),", prefix.c_str(),
|
||||
GETSEGOFFSET(data));
|
||||
|
@ -718,7 +718,7 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l
|
|||
if (!Globals::Instance->HasSegment(segNum))
|
||||
sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF);
|
||||
else if (dListDecl != nullptr)
|
||||
sprintf(line, "gsSPDisplayList(%s),", dListDecl->varName.c_str());
|
||||
sprintf(line, "gsSPDisplayList(%s),", dListDecl->declName.c_str());
|
||||
else
|
||||
sprintf(line, "gsSPDisplayList(%sDlist0x%06" PRIX64 "),", prefix.c_str(),
|
||||
GETSEGOFFSET(data));
|
||||
|
@ -958,7 +958,7 @@ void ZDisplayList::Opcode_G_SETTIMG(uint64_t data, const std::string& prefix, ch
|
|||
}
|
||||
|
||||
if (texDecl != nullptr)
|
||||
sprintf(texStr, "%s", texDecl->varName.c_str());
|
||||
sprintf(texStr, "%s", texDecl->declName.c_str());
|
||||
else if (data != 0 && Globals::Instance->HasSegment(segmentNumber))
|
||||
sprintf(texStr, "%sTex_%06X", prefix.c_str(), texAddress);
|
||||
else
|
||||
|
@ -1642,7 +1642,14 @@ static int32_t GfxdCallback_Vtx(uint32_t seg, int32_t count)
|
|||
vtxList.push_back(vtx);
|
||||
currentPtr += 16;
|
||||
}
|
||||
self->vertices[vtxOffset] = vtxList;
|
||||
|
||||
bool keyAlreadyOccupied = self->vertices.find(vtxOffset) != self->vertices.end();
|
||||
|
||||
// In some cases a vtxList already exists at vtxOffset. Only override the existing list
|
||||
// if the new one is bigger.
|
||||
if (!keyAlreadyOccupied ||
|
||||
(keyAlreadyOccupied && vtxList.size() > self->vertices[vtxOffset].size()))
|
||||
self->vertices[vtxOffset] = vtxList;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1708,17 +1715,26 @@ static int32_t GfxdCallback_DisplayList(uint32_t seg)
|
|||
uint32_t dListSegNum = GETSEGNUM(seg);
|
||||
|
||||
std::string dListName = "";
|
||||
bool addressFound = Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Gfx", dListName);
|
||||
bool addressFound =
|
||||
Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Gfx", dListName, false);
|
||||
|
||||
if (!addressFound && self->parent->segment == dListSegNum)
|
||||
if (!addressFound)
|
||||
{
|
||||
ZDisplayList* newDList = new ZDisplayList(self->parent);
|
||||
newDList->ExtractFromBinary(
|
||||
dListOffset,
|
||||
self->GetDListLength(self->parent->GetRawData(), dListOffset, self->dListType));
|
||||
newDList->SetName(newDList->GetDefaultName(self->parent->GetName()));
|
||||
self->otherDLists.push_back(newDList);
|
||||
dListName = newDList->GetName();
|
||||
if (self->parent->segment == dListSegNum)
|
||||
{
|
||||
ZDisplayList* newDList = new ZDisplayList(self->parent);
|
||||
newDList->ExtractFromBinary(
|
||||
dListOffset,
|
||||
self->GetDListLength(self->parent->GetRawData(), dListOffset, self->dListType));
|
||||
newDList->SetName(newDList->GetDefaultName(self->parent->GetName()));
|
||||
self->otherDLists.push_back(newDList);
|
||||
dListName = newDList->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals::Instance->WarnHardcodedPointer(seg, self->parent, self,
|
||||
self->GetRawDataIndex());
|
||||
}
|
||||
}
|
||||
|
||||
gfxd_puts(dListName.c_str());
|
||||
|
@ -1731,21 +1747,31 @@ static int32_t GfxdCallback_Matrix(uint32_t seg)
|
|||
std::string mtxName;
|
||||
ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get());
|
||||
|
||||
bool addressFound = Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Mtx", mtxName);
|
||||
if (!addressFound && GETSEGNUM(seg) == self->parent->segment)
|
||||
{
|
||||
Declaration* decl =
|
||||
self->parent->GetDeclaration(Seg2Filespace(seg, self->parent->baseAddress));
|
||||
if (decl == nullptr)
|
||||
{
|
||||
ZMtx mtx(self->parent);
|
||||
mtx.SetName(mtx.GetDefaultName(self->GetName()));
|
||||
mtx.ExtractFromFile(Seg2Filespace(seg, self->parent->baseAddress));
|
||||
mtx.DeclareVar(self->GetName(), "");
|
||||
bool addressFound =
|
||||
Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Mtx", mtxName, false);
|
||||
|
||||
mtx.GetSourceOutputCode(self->GetName());
|
||||
self->mtxList.push_back(mtx);
|
||||
mtxName = "&" + mtx.GetName();
|
||||
if (!addressFound)
|
||||
{
|
||||
if (GETSEGNUM(seg) == self->parent->segment)
|
||||
{
|
||||
Declaration* decl =
|
||||
self->parent->GetDeclaration(Seg2Filespace(seg, self->parent->baseAddress));
|
||||
if (decl == nullptr)
|
||||
{
|
||||
ZMtx mtx(self->parent);
|
||||
mtx.SetName(mtx.GetDefaultName(self->GetName()));
|
||||
mtx.ExtractFromFile(Seg2Filespace(seg, self->parent->baseAddress));
|
||||
mtx.DeclareVar(self->GetName(), "");
|
||||
|
||||
mtx.GetSourceOutputCode(self->GetName());
|
||||
self->mtxList.push_back(mtx);
|
||||
mtxName = "&" + mtx.GetName();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals::Instance->WarnHardcodedPointer(seg, self->parent, self,
|
||||
self->GetRawDataIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1870,7 +1896,8 @@ void ZDisplayList::DeclareReferences(const std::string& prefix)
|
|||
vtxName = StringHelper::Sprintf("%sVtx_%06X", prefix.c_str(), vtxKeys[i]);
|
||||
|
||||
auto filepath = Globals::Instance->outputPath / vtxName;
|
||||
std::string incStr = StringHelper::Sprintf("%s.%s.inc", filepath.c_str(), "vtx");
|
||||
std::string incStr =
|
||||
StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), "vtx");
|
||||
|
||||
Declaration* vtxDecl = parent->AddDeclarationIncludeArray(
|
||||
vtxKeys[i], incStr, item.size() * 16, "Vtx", vtxName, item.size());
|
||||
|
@ -1954,9 +1981,46 @@ std::string ZDisplayList::ProcessGfxDis([[maybe_unused]] const std::string& pref
|
|||
gfxd_execute(); // generate display list
|
||||
sourceOutput += outputformatter.GetOutput(); // write formatted display list
|
||||
|
||||
MergeConnectingVertexLists();
|
||||
|
||||
return sourceOutput;
|
||||
}
|
||||
|
||||
void ZDisplayList::MergeConnectingVertexLists()
|
||||
{
|
||||
if (vertices.size() > 0)
|
||||
{
|
||||
std::vector<std::pair<uint32_t, std::vector<ZVtx>>> vertexKeys(vertices.begin(),
|
||||
vertices.end());
|
||||
std::pair<uint32_t, std::vector<ZVtx>> lastItem = vertexKeys.at(0);
|
||||
|
||||
for (size_t i = 1; i < vertexKeys.size(); i++)
|
||||
{
|
||||
std::pair<uint32_t, std::vector<ZVtx>> curItem = vertexKeys[i];
|
||||
|
||||
size_t lastItemEnd = lastItem.first + (lastItem.second.size() * 16);
|
||||
bool lastItemIntersects = lastItemEnd >= curItem.first;
|
||||
|
||||
if (lastItemIntersects)
|
||||
{
|
||||
int intersectedVtxStart = (lastItemEnd - curItem.first) / 16;
|
||||
|
||||
for (size_t j = intersectedVtxStart; j < curItem.second.size(); j++)
|
||||
vertices[lastItem.first].push_back(curItem.second[j]);
|
||||
|
||||
vertices.erase(curItem.first);
|
||||
vertexKeys.erase(vertexKeys.begin() + i);
|
||||
|
||||
lastItem.second = vertices[lastItem.first];
|
||||
|
||||
i--;
|
||||
}
|
||||
else
|
||||
lastItem = curItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZDisplayList::TextureGenCheck()
|
||||
{
|
||||
if (TextureGenCheck(lastTexWidth, lastTexHeight, lastTexAddr, lastTexSeg, lastTexFmt,
|
||||
|
|
|
@ -346,7 +346,7 @@ public:
|
|||
ZDisplayList(ZFile* nParent);
|
||||
~ZDisplayList();
|
||||
|
||||
void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
void ExtractFromBinary(uint32_t nRawDataIndex, int32_t rawDataSize);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
@ -367,6 +367,9 @@ public:
|
|||
std::string ProcessLegacy(const std::string& prefix);
|
||||
std::string ProcessGfxDis(const std::string& prefix);
|
||||
|
||||
// Combines vertex lists from the vertices map which touch or intersect
|
||||
void MergeConnectingVertexLists();
|
||||
|
||||
bool IsExternalResource() const override;
|
||||
std::string GetExternalExtension() const override;
|
||||
std::string GetSourceTypeName() const override;
|
||||
|
|
|
@ -181,6 +181,12 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename)
|
|||
}
|
||||
}
|
||||
|
||||
const char* segmentDefines = reader->Attribute("Defines");
|
||||
if (segmentDefines != NULL)
|
||||
{
|
||||
makeDefines = true;
|
||||
}
|
||||
|
||||
if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile)
|
||||
{
|
||||
if (!File::Exists((basePath / name).string()))
|
||||
|
@ -213,14 +219,12 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename)
|
|||
// Check for repeated attributes.
|
||||
if (offsetXml != nullptr)
|
||||
{
|
||||
std::string offsetStr = StringHelper::Split(offsetXml, "0x")[1];
|
||||
if (!StringHelper::HasOnlyHexDigits(offsetStr))
|
||||
if (!StringHelper::IsValidOffset(std::string_view(offsetXml)))
|
||||
{
|
||||
HANDLE_ERROR(WarningType::InvalidXML,
|
||||
StringHelper::Sprintf("Invalid offset %s entered", offsetStr.c_str()),
|
||||
"");
|
||||
StringHelper::Sprintf("Invalid offset %s entered", offsetXml), "");
|
||||
}
|
||||
rawDataIndex = strtol(offsetStr.c_str(), NULL, 16);
|
||||
rawDataIndex = strtol(offsetXml, NULL, 16);
|
||||
|
||||
if (offsetSet.find(offsetXml) != offsetSet.end())
|
||||
{
|
||||
|
@ -268,7 +272,7 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename)
|
|||
ZResource* nRes = nodeMap[nodeName](this);
|
||||
|
||||
if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile)
|
||||
nRes->ExtractFromXML(child, rawDataIndex);
|
||||
nRes->ExtractWithXML(child, rawDataIndex);
|
||||
|
||||
switch (nRes->GetResourceType())
|
||||
{
|
||||
|
@ -442,24 +446,25 @@ Declaration* ZFile::AddDeclaration(offset_t address, DeclarationAlignment alignm
|
|||
const std::string& varType, const std::string& varName,
|
||||
const std::string& body)
|
||||
{
|
||||
bool validOffset = AddDeclarationChecks(address, varName);
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
Declaration* decl = GetDeclaration(address);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
decl = new Declaration(address, alignment, size, varType, varName, false, body);
|
||||
decl = Declaration::Create(address, alignment, size, varType, varName, body);
|
||||
declarations[address] = decl;
|
||||
}
|
||||
else
|
||||
{
|
||||
decl->alignment = alignment;
|
||||
decl->size = size;
|
||||
decl->varType = varType;
|
||||
decl->varName = varName;
|
||||
decl->text = body;
|
||||
decl->declType = varType;
|
||||
decl->declName = varName;
|
||||
decl->declBody = body;
|
||||
}
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
|
@ -468,27 +473,29 @@ Declaration* ZFile::AddDeclarationArray(offset_t address, DeclarationAlignment a
|
|||
const std::string& varName, size_t arrayItemCnt,
|
||||
const std::string& body)
|
||||
{
|
||||
bool validOffset = AddDeclarationChecks(address, varName);
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
Declaration* decl = GetDeclaration(address);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
decl =
|
||||
new Declaration(address, alignment, size, varType, varName, true, arrayItemCnt, body);
|
||||
decl = Declaration::CreateArray(address, alignment, size, varType, varName, body,
|
||||
arrayItemCnt);
|
||||
|
||||
declarations[address] = decl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (decl->isPlaceholder)
|
||||
decl->varName = varName;
|
||||
decl->declName = varName;
|
||||
|
||||
decl->alignment = alignment;
|
||||
decl->size = size;
|
||||
decl->varType = varType;
|
||||
decl->declType = varType;
|
||||
decl->isArray = true;
|
||||
decl->arrayItemCnt = arrayItemCnt;
|
||||
decl->text = body;
|
||||
decl->declBody = body;
|
||||
}
|
||||
|
||||
return decl;
|
||||
|
@ -499,41 +506,41 @@ Declaration* ZFile::AddDeclarationArray(offset_t address, DeclarationAlignment a
|
|||
const std::string& varName,
|
||||
const std::string& arrayItemCntStr, const std::string& body)
|
||||
{
|
||||
bool validOffset = AddDeclarationChecks(address, varName);
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
Declaration* decl = GetDeclaration(address);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
decl = new Declaration(address, alignment, size, varType, varName, true, arrayItemCntStr,
|
||||
body);
|
||||
decl = Declaration::CreateArray(address, alignment, size, varType, varName, body,
|
||||
arrayItemCntStr);
|
||||
|
||||
declarations[address] = decl;
|
||||
}
|
||||
else
|
||||
{
|
||||
decl->alignment = alignment;
|
||||
decl->size = size;
|
||||
decl->varType = varType;
|
||||
decl->varName = varName;
|
||||
decl->declType = varType;
|
||||
decl->declName = varName;
|
||||
decl->isArray = true;
|
||||
decl->arrayItemCntStr = arrayItemCntStr;
|
||||
decl->text = body;
|
||||
decl->declBody = body;
|
||||
}
|
||||
return decl;
|
||||
}
|
||||
|
||||
Declaration* ZFile::AddDeclarationPlaceholder(offset_t address, const std::string& varName)
|
||||
{
|
||||
bool validOffset = AddDeclarationChecks(address, varName);
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
Declaration* decl;
|
||||
if (declarations.find(address) == declarations.end())
|
||||
{
|
||||
decl = new Declaration(address, DeclarationAlignment::Align4, 0, "", varName, false, "");
|
||||
decl->isPlaceholder = true;
|
||||
decl = Declaration::CreatePlaceholder(address, varName);
|
||||
declarations[address] = decl;
|
||||
}
|
||||
else
|
||||
|
@ -546,22 +553,22 @@ Declaration* ZFile::AddDeclarationInclude(offset_t address, const std::string& i
|
|||
size_t size, const std::string& varType,
|
||||
const std::string& varName)
|
||||
{
|
||||
bool validOffset = AddDeclarationChecks(address, varName);
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
Declaration* decl = GetDeclaration(address);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
decl = new Declaration(address, includePath, size, varType, varName);
|
||||
decl = Declaration::CreateInclude(address, includePath, size, varType, varName);
|
||||
declarations[address] = decl;
|
||||
}
|
||||
else
|
||||
{
|
||||
decl->includePath = includePath;
|
||||
decl->size = size;
|
||||
decl->varType = varType;
|
||||
decl->varName = varName;
|
||||
decl->declType = varType;
|
||||
decl->declName = varName;
|
||||
}
|
||||
return decl;
|
||||
}
|
||||
|
@ -570,7 +577,7 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in
|
|||
size_t size, const std::string& varType,
|
||||
const std::string& varName, size_t arrayItemCnt)
|
||||
{
|
||||
bool validOffset = AddDeclarationChecks(address, varName);
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
|
@ -582,7 +589,7 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in
|
|||
Declaration* decl = GetDeclaration(address);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
decl = new Declaration(address, includePath, size, varType, varName);
|
||||
decl = Declaration::CreateInclude(address, includePath, size, varType, varName);
|
||||
|
||||
decl->isArray = true;
|
||||
decl->arrayItemCnt = arrayItemCnt;
|
||||
|
@ -592,8 +599,8 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in
|
|||
else
|
||||
{
|
||||
decl->includePath = includePath;
|
||||
decl->varType = varType;
|
||||
decl->varName = varName;
|
||||
decl->declType = varType;
|
||||
decl->declName = varName;
|
||||
decl->size = size;
|
||||
decl->isArray = true;
|
||||
decl->arrayItemCnt = arrayItemCnt;
|
||||
|
@ -601,7 +608,44 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in
|
|||
return decl;
|
||||
}
|
||||
|
||||
bool ZFile::AddDeclarationChecks(uint32_t address, const std::string& varName)
|
||||
Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& includePath,
|
||||
size_t size, const std::string& varType,
|
||||
const std::string& varName,
|
||||
const std::string& defines, size_t arrayItemCnt)
|
||||
{
|
||||
bool validOffset = DeclarationSanityChecks(address, varName);
|
||||
if (!validOffset)
|
||||
return nullptr;
|
||||
|
||||
if (StringHelper::StartsWith(includePath, "assets/extracted/"))
|
||||
includePath = "assets/" + StringHelper::Split(includePath, "assets/extracted/")[1];
|
||||
if (StringHelper::StartsWith(includePath, "assets/custom/"))
|
||||
includePath = "assets/" + StringHelper::Split(includePath, "assets/custom/")[1];
|
||||
|
||||
Declaration* decl = GetDeclaration(address);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
decl = Declaration::CreateInclude(address, includePath, size, varType, varName, defines);
|
||||
|
||||
decl->isArray = true;
|
||||
decl->arrayItemCnt = arrayItemCnt;
|
||||
|
||||
declarations[address] = decl;
|
||||
}
|
||||
else
|
||||
{
|
||||
decl->includePath = includePath;
|
||||
decl->declType = varType;
|
||||
decl->declName = varName;
|
||||
decl->defines = defines;
|
||||
decl->size = size;
|
||||
decl->isArray = true;
|
||||
decl->arrayItemCnt = arrayItemCnt;
|
||||
}
|
||||
return decl;
|
||||
}
|
||||
|
||||
bool ZFile::DeclarationSanityChecks(uint32_t address, const std::string& varName)
|
||||
{
|
||||
assert(GETSEGNUM(address) == 0);
|
||||
assert(varName != "");
|
||||
|
@ -645,7 +689,7 @@ bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expect
|
|||
|
||||
if (expectedType != "" && expectedType != "void*")
|
||||
{
|
||||
if (expectedType != decl->varType && "static " + expectedType != decl->varType)
|
||||
if (expectedType != decl->declType && "static " + expectedType != decl->declType)
|
||||
{
|
||||
declName = StringHelper::Sprintf("0x%08X", segAddress);
|
||||
return false;
|
||||
|
@ -653,9 +697,9 @@ bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expect
|
|||
}
|
||||
|
||||
if (!decl->isArray)
|
||||
declName = "&" + decl->varName;
|
||||
declName = "&" + decl->declName;
|
||||
else
|
||||
declName = decl->varName;
|
||||
declName = decl->declName;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -679,7 +723,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi
|
|||
|
||||
if (expectedType != "" && expectedType != "void*")
|
||||
{
|
||||
if (expectedType != decl->varType && "static " + expectedType != decl->varType)
|
||||
if (expectedType != decl->declType && "static " + expectedType != decl->declType)
|
||||
{
|
||||
declName = StringHelper::Sprintf("0x%08X", segAddress);
|
||||
return false;
|
||||
|
@ -688,7 +732,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi
|
|||
|
||||
if (decl->address == address)
|
||||
{
|
||||
declName = decl->varName;
|
||||
declName = decl->declName;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -699,7 +743,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi
|
|||
}
|
||||
|
||||
uint32_t index = (address - decl->address) / elementSize;
|
||||
declName = StringHelper::Sprintf("&%s[%u]", decl->varName.c_str(), index);
|
||||
declName = StringHelper::Sprintf("&%s[%u]", decl->declName.c_str(), index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -728,6 +772,20 @@ bool ZFile::HasDeclaration(offset_t address)
|
|||
return declarations.find(address) != declarations.end();
|
||||
}
|
||||
|
||||
size_t ZFile::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress)
|
||||
{
|
||||
auto currentDecl = declarations.find(declarationAddress);
|
||||
if (currentDecl == declarations.end())
|
||||
return 0;
|
||||
|
||||
auto nextDecl = currentDecl;
|
||||
std::advance(nextDecl, 1);
|
||||
if (nextDecl == declarations.end())
|
||||
return GetRawData().size() - currentDecl->first;
|
||||
|
||||
return nextDecl->first - currentDecl->first;
|
||||
}
|
||||
|
||||
void ZFile::GenerateSourceFiles()
|
||||
{
|
||||
std::string sourceOutput;
|
||||
|
@ -817,8 +875,8 @@ void ZFile::GenerateSourceHeaderFiles()
|
|||
|
||||
std::string ZFile::GetHeaderInclude() const
|
||||
{
|
||||
std::string headers = StringHelper::Sprintf("#include \"%s.h\"\n",
|
||||
(outName.parent_path() / outName.stem()).c_str());
|
||||
std::string headers = StringHelper::Sprintf(
|
||||
"#include \"%s.h\"\n", (outName.parent_path() / outName.stem()).string().c_str());
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
@ -843,16 +901,12 @@ std::string ZFile::GetExternalFileHeaderInclude() const
|
|||
{
|
||||
fs::path outputFolderPath = externalFile->GetSourceOutputFolderPath();
|
||||
if (outputFolderPath == this->GetSourceOutputFolderPath())
|
||||
{
|
||||
outputFolderPath = externalFile->outName.stem();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFolderPath /= externalFile->outName.stem();
|
||||
}
|
||||
|
||||
externalFilesIncludes +=
|
||||
StringHelper::Sprintf("#include \"%s.h\"\n", outputFolderPath.c_str());
|
||||
StringHelper::Sprintf("#include \"%s.h\"\n", outputFolderPath.string().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -967,46 +1021,7 @@ std::string ZFile::ProcessDeclarations()
|
|||
|
||||
// printf("RANGE START: 0x%06X - RANGE END: 0x%06X\n", rangeStart, rangeEnd);
|
||||
|
||||
// Optimization: See if there are any arrays side by side that can be merged...
|
||||
std::vector<std::pair<int32_t, Declaration*>> declarationKeys(declarations.begin(),
|
||||
declarations.end());
|
||||
|
||||
std::pair<int32_t, Declaration*> lastItem = declarationKeys.at(0);
|
||||
|
||||
for (size_t i = 1; i < declarationKeys.size(); i++)
|
||||
{
|
||||
std::pair<int32_t, Declaration*> curItem = declarationKeys[i];
|
||||
|
||||
if (curItem.second->isArray && lastItem.second->isArray)
|
||||
{
|
||||
if (curItem.second->varType == lastItem.second->varType)
|
||||
{
|
||||
if (!curItem.second->declaredInXml && !lastItem.second->declaredInXml)
|
||||
{
|
||||
// TEST: For now just do Vtx declarations...
|
||||
if (lastItem.second->varType == "Vtx")
|
||||
{
|
||||
int32_t sizeDiff = curItem.first - (lastItem.first + lastItem.second->size);
|
||||
|
||||
// Make sure there isn't an unaccounted inbetween these two
|
||||
if (sizeDiff == 0)
|
||||
{
|
||||
lastItem.second->size += curItem.second->size;
|
||||
lastItem.second->arrayItemCnt += curItem.second->arrayItemCnt;
|
||||
lastItem.second->text += "\n" + curItem.second->text;
|
||||
declarations.erase(curItem.first);
|
||||
declarationKeys.erase(declarationKeys.begin() + i);
|
||||
delete curItem.second;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastItem = curItem;
|
||||
}
|
||||
MergeNeighboringDeclarations();
|
||||
|
||||
for (std::pair<uint32_t, Declaration*> item : declarations)
|
||||
ProcessDeclarationText(item.second);
|
||||
|
@ -1041,20 +1056,20 @@ std::string ZFile::ProcessDeclarations()
|
|||
// HACK
|
||||
std::string extType;
|
||||
|
||||
if (item.second->varType == "Gfx")
|
||||
if (item.second->declType == "Gfx")
|
||||
extType = "dlist";
|
||||
else if (item.second->varType == "Vtx")
|
||||
else if (item.second->declType == "Vtx")
|
||||
extType = "vtx";
|
||||
|
||||
auto filepath = outputPath / item.second->varName;
|
||||
auto filepath = outputPath / item.second->declName;
|
||||
File::WriteAllText(
|
||||
StringHelper::Sprintf("%s.%s.inc", filepath.c_str(), extType.c_str()),
|
||||
item.second->text);
|
||||
StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), extType.c_str()),
|
||||
item.second->declBody);
|
||||
}
|
||||
|
||||
output += item.second->GetExternalDeclarationStr();
|
||||
}
|
||||
else if (item.second->varType != "")
|
||||
else if (item.second->declType != "")
|
||||
{
|
||||
output += item.second->GetNormalDeclarationStr();
|
||||
}
|
||||
|
@ -1063,6 +1078,50 @@ std::string ZFile::ProcessDeclarations()
|
|||
return output;
|
||||
}
|
||||
|
||||
void ZFile::MergeNeighboringDeclarations()
|
||||
{
|
||||
// Optimization: See if there are any arrays side by side that can be merged...
|
||||
std::vector<std::pair<int32_t, Declaration*>> declarationKeys(declarations.begin(),
|
||||
declarations.end());
|
||||
|
||||
std::pair<int32_t, Declaration*> lastItem = declarationKeys.at(0);
|
||||
|
||||
for (size_t i = 1; i < declarationKeys.size(); i++)
|
||||
{
|
||||
std::pair<int32_t, Declaration*> curItem = declarationKeys[i];
|
||||
|
||||
if (curItem.second->isArray && lastItem.second->isArray)
|
||||
{
|
||||
if (curItem.second->declType == lastItem.second->declType)
|
||||
{
|
||||
if (!curItem.second->declaredInXml && !lastItem.second->declaredInXml)
|
||||
{
|
||||
// TEST: For now just do Vtx declarations...
|
||||
if (lastItem.second->declType == "Vtx")
|
||||
{
|
||||
int32_t sizeDiff = curItem.first - (lastItem.first + lastItem.second->size);
|
||||
|
||||
// Make sure there isn't an unaccounted inbetween these two
|
||||
if (sizeDiff == 0)
|
||||
{
|
||||
lastItem.second->size += curItem.second->size;
|
||||
lastItem.second->arrayItemCnt += curItem.second->arrayItemCnt;
|
||||
lastItem.second->declBody += "\n" + curItem.second->declBody;
|
||||
declarations.erase(curItem.first);
|
||||
declarationKeys.erase(declarationKeys.begin() + i);
|
||||
delete curItem.second;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastItem = curItem;
|
||||
}
|
||||
}
|
||||
|
||||
void ZFile::ProcessDeclarationText(Declaration* decl)
|
||||
{
|
||||
size_t refIndex = 0;
|
||||
|
@ -1070,17 +1129,17 @@ void ZFile::ProcessDeclarationText(Declaration* decl)
|
|||
if (!(decl->references.size() > 0))
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < decl->text.size() - 1; i++)
|
||||
for (size_t i = 0; i < decl->declBody.size() - 1; i++)
|
||||
{
|
||||
char c = decl->text[i];
|
||||
char c2 = decl->text[i + 1];
|
||||
char c = decl->declBody[i];
|
||||
char c2 = decl->declBody[i + 1];
|
||||
|
||||
if (c == '@' && c2 == 'r')
|
||||
{
|
||||
std::string vtxName;
|
||||
Globals::Instance->GetSegmentedArrayIndexedName(decl->references[refIndex], 0x10, this,
|
||||
"Vtx", vtxName);
|
||||
decl->text.replace(i, 2, vtxName);
|
||||
decl->declBody.replace(i, 2, vtxName);
|
||||
|
||||
refIndex++;
|
||||
|
||||
|
@ -1092,7 +1151,8 @@ void ZFile::ProcessDeclarationText(Declaration* decl)
|
|||
|
||||
std::string ZFile::ProcessExterns()
|
||||
{
|
||||
std::string output;
|
||||
std::string output = "";
|
||||
bool hadDefines = true; // Previous declaration included defines.
|
||||
|
||||
for (const auto& item : declarations)
|
||||
{
|
||||
|
@ -1101,10 +1161,21 @@ std::string ZFile::ProcessExterns()
|
|||
continue;
|
||||
}
|
||||
|
||||
std::string itemDefines = item.second->GetDefinesStr();
|
||||
// Add a newline above if previous has no defines and this one does.
|
||||
if (!hadDefines && (itemDefines.length() > 0))
|
||||
{
|
||||
output.push_back('\n');
|
||||
}
|
||||
output += item.second->GetExternStr();
|
||||
}
|
||||
output += itemDefines;
|
||||
|
||||
output += "\n";
|
||||
// Newline below if this one has defines.
|
||||
if ((hadDefines = (itemDefines.length() > 0)))
|
||||
{
|
||||
output.push_back('\n');
|
||||
}
|
||||
}
|
||||
|
||||
output += defines;
|
||||
|
||||
|
@ -1153,7 +1224,7 @@ std::string ZFile::ProcessTextureIntersections([[maybe_unused]] const std::strin
|
|||
if (nextDecl == nullptr)
|
||||
texNextName = texturesResources.at(nextOffset)->GetName();
|
||||
else
|
||||
texNextName = nextDecl->varName;
|
||||
texNextName = nextDecl->declName;
|
||||
|
||||
defines += StringHelper::Sprintf("#define %s ((u32)%s + 0x%06X)\n",
|
||||
texNextName.c_str(), texName.c_str(), offsetDiff);
|
||||
|
@ -1226,8 +1297,8 @@ bool ZFile::HandleUnaccountedAddress(offset_t currentAddress, offset_t lastAddr,
|
|||
|
||||
std::string intersectionInfo = StringHelper::Sprintf(
|
||||
"Resource from 0x%06X:0x%06X (%s) conflicts with 0x%06X (%s).", lastAddr,
|
||||
lastAddr + lastSize, lastDecl->varName.c_str(), currentAddress,
|
||||
currentDecl->varName.c_str());
|
||||
lastAddr + lastSize, lastDecl->declName.c_str(), currentAddress,
|
||||
currentDecl->declName.c_str());
|
||||
HANDLE_WARNING_RESOURCE(WarningType::Intersection, this, nullptr, currentAddress,
|
||||
"intersection detected", intersectionInfo);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
uint32_t segment = 0x80;
|
||||
uint32_t baseAddress, rangeStart, rangeEnd;
|
||||
bool isExternalFile = false;
|
||||
// Whether to make defines for texture dimensions, and possibly more in future
|
||||
bool makeDefines = false;
|
||||
|
||||
ZFile(const fs::path& nOutPath, const std::string& nName);
|
||||
ZFile(ZFileMode nMode, tinyxml2::XMLElement* reader, const fs::path& nBasePath,
|
||||
|
@ -74,6 +76,9 @@ public:
|
|||
Declaration* AddDeclarationIncludeArray(offset_t address, std::string& includePath, size_t size,
|
||||
const std::string& varType, const std::string& varName,
|
||||
size_t arrayItemCnt);
|
||||
Declaration* AddDeclarationIncludeArray(offset_t address, std::string& includePath, size_t size,
|
||||
const std::string& varType, const std::string& varName,
|
||||
const std::string& defines, size_t arrayItemCnt);
|
||||
|
||||
bool GetDeclarationPtrName(segptr_t segAddress, const std::string& expectedType,
|
||||
std::string& declName) const;
|
||||
|
@ -84,6 +89,7 @@ public:
|
|||
Declaration* GetDeclaration(offset_t address) const;
|
||||
Declaration* GetDeclarationRanged(offset_t address) const;
|
||||
bool HasDeclaration(offset_t address);
|
||||
size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress);
|
||||
|
||||
std::string GetHeaderInclude() const;
|
||||
std::string GetZRoomHeaderInclude() const;
|
||||
|
@ -126,8 +132,9 @@ protected:
|
|||
void DeclareResourceSubReferences();
|
||||
void GenerateSourceFiles();
|
||||
void GenerateSourceHeaderFiles();
|
||||
bool AddDeclarationChecks(uint32_t address, const std::string& varName);
|
||||
bool DeclarationSanityChecks(uint32_t address, const std::string& varName);
|
||||
std::string ProcessDeclarations();
|
||||
void MergeNeighboringDeclarations();
|
||||
void ProcessDeclarationText(Declaration* decl);
|
||||
std::string ProcessExterns();
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ void ZLimb::ParseRawData()
|
|||
skinSegmentType =
|
||||
static_cast<ZLimbSkinType>(BitConverter::ToInt32BE(rawData, rawDataIndex + 8));
|
||||
skinSegment = BitConverter::ToUInt32BE(rawData, rawDataIndex + 12);
|
||||
if (skinSegmentType == ZLimbSkinType::SkinType_4)
|
||||
if (skinSegmentType == ZLimbSkinType::SkinType_Animated)
|
||||
{
|
||||
if (skinSegment != 0 && GETSEGNUM(skinSegment) == parent->segment)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ void ZLimb::DeclareReferences(const std::string& prefix)
|
|||
case ZLimbType::Skin:
|
||||
switch (skinSegmentType)
|
||||
{
|
||||
case ZLimbSkinType::SkinType_4:
|
||||
case ZLimbSkinType::SkinType_Animated:
|
||||
if (skinSegment != 0 && GETSEGNUM(skinSegment) == parent->segment)
|
||||
{
|
||||
segmentStruct.DeclareReferences(varPrefix);
|
||||
|
@ -189,7 +189,7 @@ void ZLimb::DeclareReferences(const std::string& prefix)
|
|||
}
|
||||
break;
|
||||
|
||||
case ZLimbSkinType::SkinType_DList:
|
||||
case ZLimbSkinType::SkinType_Normal:
|
||||
DeclareDList(skinSegment, varPrefix, "");
|
||||
break;
|
||||
|
||||
|
@ -394,7 +394,7 @@ void ZLimb::DeclareDList(segptr_t dListSegmentedPtr, const std::string& prefix,
|
|||
|
||||
std::string dlistName;
|
||||
bool declFound = Globals::Instance->GetSegmentedArrayIndexedName(dListSegmentedPtr, 8, parent,
|
||||
"Gfx", dlistName);
|
||||
"Gfx", dlistName, false);
|
||||
if (declFound)
|
||||
return;
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ public:
|
|||
|
||||
ZLimbType type = ZLimbType::Standard;
|
||||
|
||||
ZLimbSkinType skinSegmentType = ZLimbSkinType::SkinType_0; // Skin only
|
||||
segptr_t skinSegment = 0; // Skin only
|
||||
Struct_800A5E28 segmentStruct; // Skin only
|
||||
ZLimbSkinType skinSegmentType = ZLimbSkinType::SkinType_Null; // Skin only
|
||||
segptr_t skinSegment = 0; // Skin only
|
||||
SkinAnimatedLimbData segmentStruct; // Skin only
|
||||
|
||||
// Legacy only
|
||||
float legTransX, legTransY, legTransZ; // Vec3f
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
#include "WarningHandler.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
REGISTER_ZFILENODE(Path, ZPath);
|
||||
REGISTER_ZFILENODE(Path, ZPath); // Old name that is being kept for backwards compatability
|
||||
REGISTER_ZFILENODE(PathList, ZPath); // New name that may be used in future XMLs
|
||||
|
||||
ZPath::ZPath(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
|
@ -144,8 +145,8 @@ void PathwayEntry::DeclareReferences(const std::string& prefix)
|
|||
return;
|
||||
|
||||
std::string pointsName;
|
||||
bool addressFound =
|
||||
Globals::Instance->GetSegmentedPtrName(listSegmentAddress, parent, "Vec3s", pointsName);
|
||||
bool addressFound = Globals::Instance->GetSegmentedPtrName(listSegmentAddress, parent, "Vec3s",
|
||||
pointsName, false);
|
||||
if (addressFound)
|
||||
return;
|
||||
|
||||
|
@ -172,7 +173,7 @@ void PathwayEntry::DeclareReferences(const std::string& prefix)
|
|||
points.size(), declaration);
|
||||
}
|
||||
else
|
||||
decl->text = declaration;
|
||||
decl->declBody = declaration;
|
||||
}
|
||||
|
||||
std::string PathwayEntry::GetBodySourceCode() const
|
||||
|
@ -185,7 +186,13 @@ std::string PathwayEntry::GetBodySourceCode() const
|
|||
declaration +=
|
||||
StringHelper::Sprintf("%i, %i, %i, %s", numPoints, unk1, unk2, listName.c_str());
|
||||
else
|
||||
declaration += StringHelper::Sprintf("%i, %s", numPoints, listName.c_str());
|
||||
{
|
||||
if (numPoints > 0)
|
||||
declaration +=
|
||||
StringHelper::Sprintf("ARRAY_COUNT(%s), %s", listName.c_str(), listName.c_str());
|
||||
else
|
||||
declaration += StringHelper::Sprintf("%i, %s", numPoints, listName.c_str());
|
||||
}
|
||||
|
||||
return declaration;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ void ZPlayerAnimationData::ParseRawData()
|
|||
|
||||
for (size_t i = 0; i < totalSize; i += 2)
|
||||
{
|
||||
limbRotData.push_back(BitConverter::ToUInt16BE(rawData, rawDataIndex + i));
|
||||
limbRotData.push_back(BitConverter::ToInt16BE(rawData, rawDataIndex + i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,14 +55,21 @@ std::string ZPlayerAnimationData::GetBodySourceCode() const
|
|||
std::string declaration = "";
|
||||
|
||||
size_t index = 0;
|
||||
for (const auto& entry : limbRotData)
|
||||
for (const auto entry : limbRotData)
|
||||
{
|
||||
if (index % 8 == 0)
|
||||
{
|
||||
declaration += "\t";
|
||||
}
|
||||
|
||||
declaration += StringHelper::Sprintf("0x%04X, ", entry);
|
||||
if (entry < 0)
|
||||
{
|
||||
declaration += StringHelper::Sprintf("-0x%04X, ", -entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
declaration += StringHelper::Sprintf("0x%04X, ", entry);
|
||||
}
|
||||
|
||||
if ((index + 1) % 8 == 0)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ class ZPlayerAnimationData : public ZResource
|
|||
{
|
||||
public:
|
||||
int16_t frameCount = 0;
|
||||
std::vector<uint16_t> limbRotData;
|
||||
std::vector<int16_t> limbRotData;
|
||||
|
||||
ZPlayerAnimationData(ZFile* nParent);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ ZResource::ZResource(ZFile* nParent)
|
|||
RegisterOptionalAttribute("Static", "Global");
|
||||
}
|
||||
|
||||
void ZResource::ExtractFromXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex)
|
||||
void ZResource::ExtractWithXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex)
|
||||
{
|
||||
rawDataIndex = nRawDataIndex;
|
||||
declaredInXml = true;
|
||||
|
@ -274,7 +274,7 @@ void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
|
|||
if (decl == nullptr || decl->isPlaceholder)
|
||||
decl = DeclareVar(prefix, bodyStr);
|
||||
else
|
||||
decl->text = bodyStr;
|
||||
decl->declBody = bodyStr;
|
||||
|
||||
decl->staticConf = staticConf;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ enum class ZResourceType
|
|||
TextureAnimationParams,
|
||||
Vector,
|
||||
Vertex,
|
||||
Waterbox,
|
||||
};
|
||||
|
||||
class ResourceAttribute
|
||||
|
@ -79,8 +80,18 @@ public:
|
|||
ZResource(ZFile* nParent);
|
||||
virtual ~ZResource() = default;
|
||||
|
||||
// Parsing from File
|
||||
virtual void ExtractFromXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex);
|
||||
/// <summary>
|
||||
/// Extracts/Parsees data from binary file using an XML to provide the needed metadata.
|
||||
/// </summary>
|
||||
/// <param name="reader">XML Node we wish to parse from.</param>
|
||||
/// <param name="nRawDataIndex">The offset within the binary file we are going to parse from as
|
||||
/// indicated by the "Offset" parameter in the XML.</param>
|
||||
virtual void ExtractWithXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex);
|
||||
|
||||
/// <summary>
|
||||
/// Extracts/Parses the needed data straight from a binary without the use of an XML.
|
||||
/// </summary>
|
||||
/// <param name="nRawDataIndex">The offset within the binary file we wish to parse from.</param>
|
||||
virtual void ExtractFromFile(offset_t nRawDataIndex);
|
||||
|
||||
// Misc
|
||||
|
|
|
@ -21,7 +21,7 @@ void SetAlternateHeaders::DeclareReferences([[maybe_unused]] const std::string&
|
|||
|
||||
void SetAlternateHeaders::ParseRawDataLate()
|
||||
{
|
||||
size_t numHeaders = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 4;
|
||||
size_t numHeaders = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 4;
|
||||
|
||||
headers.reserve(numHeaders);
|
||||
for (uint32_t i = 0; i < numHeaders; i++)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "Globals.h"
|
||||
|
||||
SetCameraSettings::SetCameraSettings(ZFile* nParent) : ZRoomCommand(nParent)
|
||||
{
|
||||
|
@ -16,8 +17,12 @@ void SetCameraSettings::ParseRawData()
|
|||
|
||||
std::string SetCameraSettings::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("SCENE_CMD_MISC_SETTINGS(0x%02X, 0x%08X)", cameraMovement,
|
||||
mapHighlight);
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
return StringHelper::Sprintf("SCENE_CMD_SET_REGION_VISITED(0x%02X, 0x%08X)", cameraMovement,
|
||||
mapHighlight);
|
||||
else
|
||||
return StringHelper::Sprintf("SCENE_CMD_MISC_SETTINGS(0x%02X, 0x%08X)", cameraMovement,
|
||||
mapHighlight);
|
||||
}
|
||||
|
||||
std::string SetCameraSettings::GetCommandCName() const
|
||||
|
|
|
@ -21,7 +21,7 @@ void SetCsCamera::ParseRawData()
|
|||
cameras.reserve(numCameras);
|
||||
for (int32_t i = 0; i < numCameras; i++)
|
||||
{
|
||||
CsCameraEntry entry(parent->GetRawData(), currentPtr);
|
||||
ActorCsCamInfo entry(parent->GetRawData(), currentPtr);
|
||||
numPoints += entry.GetNumPoints();
|
||||
|
||||
currentPtr += entry.GetRawDataSize();
|
||||
|
@ -105,7 +105,7 @@ void SetCsCamera::DeclareReferences(const std::string& prefix)
|
|||
std::string SetCsCamera::GetBodySourceCode() const
|
||||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CsCameraEntry", listName);
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorCsCamInfo", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_CAM_LIST(%i, %s)", cameras.size(),
|
||||
listName.c_str());
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ RoomCommand SetCsCamera::GetRoomCommand() const
|
|||
return RoomCommand::SetCsCamera;
|
||||
}
|
||||
|
||||
CsCameraEntry::CsCameraEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
ActorCsCamInfo::ActorCsCamInfo(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
: baseOffset(rawDataIndex), type(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)),
|
||||
numPoints(BitConverter::ToInt16BE(rawData, rawDataIndex + 2))
|
||||
{
|
||||
|
@ -128,27 +128,27 @@ CsCameraEntry::CsCameraEntry(const std::vector<uint8_t>& rawData, uint32_t rawDa
|
|||
segmentOffset = GETSEGOFFSET(camAddress);
|
||||
}
|
||||
|
||||
std::string CsCameraEntry::GetSourceTypeName() const
|
||||
std::string ActorCsCamInfo::GetSourceTypeName() const
|
||||
{
|
||||
return "CsCameraEntry";
|
||||
return "ActorCsCamInfo";
|
||||
}
|
||||
|
||||
int32_t CsCameraEntry::GetRawDataSize() const
|
||||
int32_t ActorCsCamInfo::GetRawDataSize() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
int16_t CsCameraEntry::GetNumPoints() const
|
||||
int16_t ActorCsCamInfo::GetNumPoints() const
|
||||
{
|
||||
return numPoints;
|
||||
}
|
||||
|
||||
segptr_t CsCameraEntry::GetCamAddress() const
|
||||
segptr_t ActorCsCamInfo::GetCamAddress() const
|
||||
{
|
||||
return camAddress;
|
||||
}
|
||||
|
||||
uint32_t CsCameraEntry::GetSegmentOffset() const
|
||||
uint32_t ActorCsCamInfo::GetSegmentOffset() const
|
||||
{
|
||||
return segmentOffset;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "ZRoom/ZRoomCommand.h"
|
||||
#include "ZVector.h"
|
||||
|
||||
class CsCameraEntry
|
||||
class ActorCsCamInfo
|
||||
{
|
||||
public:
|
||||
CsCameraEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
ActorCsCamInfo(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
std::string GetSourceTypeName() const;
|
||||
int32_t GetRawDataSize() const;
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
class SetCsCamera : public ZRoomCommand
|
||||
{
|
||||
public:
|
||||
std::vector<CsCameraEntry> cameras;
|
||||
std::vector<ActorCsCamInfo> cameras;
|
||||
std::vector<ZVector> points;
|
||||
|
||||
SetCsCamera(ZFile* nParent);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "SetActorCutsceneList.h"
|
||||
#include "SetCutsceneEntryList.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
|
@ -19,7 +19,7 @@ void SetActorCutsceneList::ParseRawData()
|
|||
cutscenes.reserve(numCutscenes);
|
||||
for (int32_t i = 0; i < numCutscenes; i++)
|
||||
{
|
||||
ActorCutsceneEntry entry(parent->GetRawData(), currentPtr);
|
||||
CutsceneEntry entry(parent->GetRawData(), currentPtr);
|
||||
cutscenes.push_back(entry);
|
||||
|
||||
currentPtr += 16;
|
||||
|
@ -55,7 +55,7 @@ void SetActorCutsceneList::DeclareReferences(const std::string& prefix)
|
|||
std::string SetActorCutsceneList::GetBodySourceCode() const
|
||||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorCutscene", listName);
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_LIST(%i, %s)", cutscenes.size(),
|
||||
listName.c_str());
|
||||
}
|
||||
|
@ -70,25 +70,34 @@ RoomCommand SetActorCutsceneList::GetRoomCommand() const
|
|||
return RoomCommand::SetActorCutsceneList;
|
||||
}
|
||||
|
||||
ActorCutsceneEntry::ActorCutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
: priority(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)),
|
||||
length(BitConverter::ToInt16BE(rawData, rawDataIndex + 2)),
|
||||
unk4(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)),
|
||||
unk6(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)),
|
||||
additionalCutscene(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)),
|
||||
sound(rawData[rawDataIndex + 0xA]), unkB(rawData[rawDataIndex + 0xB]),
|
||||
unkC(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)), unkE(rawData[rawDataIndex + 0xE]),
|
||||
letterboxSize(rawData[rawDataIndex + 0xF])
|
||||
csCamId(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)),
|
||||
scriptIndex(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)),
|
||||
additionalCsId(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)),
|
||||
endSfx(rawData[rawDataIndex + 0xA]), customValue(rawData[rawDataIndex + 0xB]),
|
||||
hudVisibility(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)),
|
||||
endCam(rawData[rawDataIndex + 0xE]), letterboxSize(rawData[rawDataIndex + 0xF])
|
||||
{
|
||||
}
|
||||
|
||||
std::string ActorCutsceneEntry::GetBodySourceCode() const
|
||||
std::string CutsceneEntry::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length, unk4,
|
||||
unk6, additionalCutscene, sound, unkB, unkC, unkE, letterboxSize);
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (enumData->endSfx.find(endSfx) != enumData->endSfx.end())
|
||||
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %s, %i, %i, %i, %i", priority, length,
|
||||
csCamId, scriptIndex, additionalCsId,
|
||||
enumData->endSfx[endSfx].c_str(), customValue, hudVisibility,
|
||||
endCam, letterboxSize);
|
||||
else
|
||||
return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length,
|
||||
csCamId, scriptIndex, additionalCsId, endSfx, customValue,
|
||||
hudVisibility, endCam, letterboxSize);
|
||||
}
|
||||
|
||||
std::string ActorCutsceneEntry::GetSourceTypeName() const
|
||||
std::string CutsceneEntry::GetSourceTypeName() const
|
||||
{
|
||||
return "ActorCutscene";
|
||||
return "CutsceneEntry";
|
||||
}
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
#include "ZRoom/ZRoomCommand.h"
|
||||
|
||||
class ActorCutsceneEntry
|
||||
class CutsceneEntry
|
||||
{
|
||||
protected:
|
||||
int16_t priority;
|
||||
int16_t length;
|
||||
int16_t unk4;
|
||||
int16_t unk6;
|
||||
int16_t additionalCutscene;
|
||||
uint8_t sound;
|
||||
uint8_t unkB;
|
||||
int16_t unkC;
|
||||
uint8_t unkE;
|
||||
int16_t csCamId;
|
||||
int16_t scriptIndex;
|
||||
int16_t additionalCsId;
|
||||
uint8_t endSfx;
|
||||
uint8_t customValue;
|
||||
int16_t hudVisibility;
|
||||
uint8_t endCam;
|
||||
uint8_t letterboxSize;
|
||||
|
||||
public:
|
||||
ActorCutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const;
|
||||
std::string GetSourceTypeName() const;
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
class SetActorCutsceneList : public ZRoomCommand
|
||||
{
|
||||
public:
|
||||
std::vector<ActorCutsceneEntry> cutscenes;
|
||||
std::vector<CutsceneEntry> cutscenes;
|
||||
|
||||
SetActorCutsceneList(ZFile* nParent);
|
||||
|
|
@ -23,7 +23,7 @@ void SetCutscenes::ParseRawData()
|
|||
cutsceneEntries.reserve(numCutscenes);
|
||||
for (uint8_t i = 0; i < numCutscenes; i++)
|
||||
{
|
||||
CutsceneEntry entry(parent->GetRawData(), currentPtr);
|
||||
CutsceneScriptEntry entry(parent->GetRawData(), currentPtr);
|
||||
cutsceneEntries.push_back(entry);
|
||||
currentPtr += 8;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ void SetCutscenes::ParseRawData()
|
|||
|
||||
void SetCutscenes::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
std::string varPrefix = name;
|
||||
if (varPrefix == "")
|
||||
varPrefix = prefix;
|
||||
|
@ -62,10 +63,14 @@ void SetCutscenes::DeclareReferences(const std::string& prefix)
|
|||
Globals::Instance->GetSegmentedPtrName(entry.segmentPtr, parent, "CutsceneData",
|
||||
csName);
|
||||
|
||||
declaration +=
|
||||
StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, 0x%02X },", csName.c_str(),
|
||||
entry.exit, entry.entrance, entry.flag);
|
||||
|
||||
if (enumData->spawnFlag.find(entry.flag) != enumData->spawnFlag.end())
|
||||
declaration += StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, %s },",
|
||||
csName.c_str(), entry.exit, entry.entrance,
|
||||
enumData->spawnFlag[entry.flag].c_str());
|
||||
else
|
||||
declaration +=
|
||||
StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, 0x%02X },", csName.c_str(),
|
||||
entry.exit, entry.entrance, entry.flag);
|
||||
if (i + 1 < numCutscenes)
|
||||
declaration += "\n";
|
||||
|
||||
|
@ -73,8 +78,8 @@ void SetCutscenes::DeclareReferences(const std::string& prefix)
|
|||
}
|
||||
|
||||
parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
|
||||
cutsceneEntries.size() * 8, "CutsceneEntry",
|
||||
StringHelper::Sprintf("%sCutsceneEntryList_%06X",
|
||||
cutsceneEntries.size() * 8, "CutsceneScriptEntry",
|
||||
StringHelper::Sprintf("%sCutsceneScriptEntryList_%06X",
|
||||
zRoom->GetName().c_str(), segmentOffset),
|
||||
cutsceneEntries.size(), declaration);
|
||||
}
|
||||
|
@ -102,8 +107,8 @@ std::string SetCutscenes::GetBodySourceCode() const
|
|||
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_LIST(%i, %s)", numCutscenes,
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneScriptEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_SCRIPT_LIST(%i, %s)", numCutscenes,
|
||||
listName.c_str());
|
||||
}
|
||||
|
||||
|
@ -121,7 +126,7 @@ RoomCommand SetCutscenes::GetRoomCommand() const
|
|||
return RoomCommand::SetCutscenes;
|
||||
}
|
||||
|
||||
CutsceneEntry::CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
CutsceneScriptEntry::CutsceneScriptEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
: segmentPtr(BitConverter::ToInt32BE(rawData, rawDataIndex + 0)),
|
||||
exit(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)), entrance(rawData[rawDataIndex + 6]),
|
||||
flag(rawData[rawDataIndex + 7])
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "ZCutscene.h"
|
||||
#include "ZRoom/ZRoomCommand.h"
|
||||
|
||||
class CutsceneEntry
|
||||
class CutsceneScriptEntry
|
||||
{
|
||||
public:
|
||||
CutsceneEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
CutsceneScriptEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
segptr_t segmentPtr;
|
||||
uint16_t exit;
|
||||
|
@ -17,8 +17,8 @@ public:
|
|||
class SetCutscenes : public ZRoomCommand
|
||||
{
|
||||
public:
|
||||
std::vector<CutsceneEntry> cutsceneEntries; // (MM Only)
|
||||
uint8_t numCutscenes; // (MM Only)
|
||||
std::vector<CutsceneScriptEntry> cutsceneEntries; // (MM Only)
|
||||
uint8_t numCutscenes; // (MM Only)
|
||||
|
||||
SetCutscenes(ZFile* nParent);
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ void SetEntranceList::DeclareReferences([[maybe_unused]] const std::string& pref
|
|||
void SetEntranceList::ParseRawDataLate()
|
||||
{
|
||||
// Parse Entrances and Generate Declaration
|
||||
uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t currentPtr = segmentOffset;
|
||||
|
||||
entrances.reserve(numEntrances);
|
||||
for (uint32_t i = 0; i < numEntrances; i++)
|
||||
{
|
||||
EntranceEntry entry(parent->GetRawData(), currentPtr);
|
||||
Spawn entry(parent->GetRawData(), currentPtr);
|
||||
entrances.push_back(entry);
|
||||
|
||||
currentPtr += 2;
|
||||
|
@ -55,16 +55,25 @@ void SetEntranceList::DeclareReferencesLate([[maybe_unused]] const std::string&
|
|||
|
||||
std::string varName =
|
||||
StringHelper::Sprintf("%sEntranceList0x%06X", prefix.c_str(), segmentOffset);
|
||||
parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
|
||||
entrances.size() * 2, "EntranceEntry", varName,
|
||||
entrances.size(), declaration);
|
||||
|
||||
if (Globals::Instance->game != ZGame::MM_RETAIL)
|
||||
parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
|
||||
entrances.size() * 2, "Spawn", varName, entrances.size(),
|
||||
declaration);
|
||||
else
|
||||
parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4,
|
||||
entrances.size() * 2, "EntranceEntry", varName,
|
||||
entrances.size(), declaration);
|
||||
}
|
||||
}
|
||||
|
||||
std::string SetEntranceList::GetBodySourceCode() const
|
||||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EntranceEntry", listName);
|
||||
if (Globals::Instance->game != ZGame::MM_RETAIL)
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "Spawn", listName);
|
||||
else
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EntranceEntry", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_ENTRANCE_LIST(%s)", listName.c_str());
|
||||
}
|
||||
|
||||
|
@ -78,13 +87,13 @@ RoomCommand SetEntranceList::GetRoomCommand() const
|
|||
return RoomCommand::SetEntranceList;
|
||||
}
|
||||
|
||||
EntranceEntry::EntranceEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
Spawn::Spawn(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex)
|
||||
{
|
||||
startPositionIndex = rawData.at(rawDataIndex + 0);
|
||||
roomToLoad = rawData.at(rawDataIndex + 1);
|
||||
}
|
||||
|
||||
std::string EntranceEntry::GetBodySourceCode() const
|
||||
std::string Spawn::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%02X, 0x%02X", startPositionIndex, roomToLoad);
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#include "ZRoom/ZRoomCommand.h"
|
||||
|
||||
class EntranceEntry
|
||||
class Spawn
|
||||
{
|
||||
public:
|
||||
uint8_t startPositionIndex;
|
||||
uint8_t roomToLoad;
|
||||
|
||||
EntranceEntry(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
Spawn(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const;
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ public:
|
|||
class SetEntranceList : public ZRoomCommand
|
||||
{
|
||||
public:
|
||||
std::vector<EntranceEntry> entrances;
|
||||
std::vector<Spawn> entrances;
|
||||
|
||||
SetEntranceList(ZFile* nParent);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void SetExitList::DeclareReferences([[maybe_unused]] const std::string& prefix)
|
|||
void SetExitList::ParseRawDataLate()
|
||||
{
|
||||
// Parse Entrances and Generate Declaration
|
||||
uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2;
|
||||
uint32_t currentPtr = segmentOffset;
|
||||
|
||||
exits.reserve(numEntrances);
|
||||
|
|
|
@ -34,18 +34,28 @@ void SetLightingSettings::DeclareReferences(const std::string& prefix)
|
|||
declaration += "\n";
|
||||
}
|
||||
|
||||
parent->AddDeclarationArray(
|
||||
segmentOffset, DeclarationAlignment::Align4,
|
||||
settings.size() * settings.front().GetRawDataSize(), "LightSettings",
|
||||
StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
|
||||
settings.size(), declaration);
|
||||
if (Globals::Instance->game != ZGame::MM_RETAIL)
|
||||
parent->AddDeclarationArray(
|
||||
segmentOffset, DeclarationAlignment::Align4,
|
||||
settings.size() * settings.front().GetRawDataSize(), "EnvLightSettings",
|
||||
StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
|
||||
settings.size(), declaration);
|
||||
else
|
||||
parent->AddDeclarationArray(
|
||||
segmentOffset, DeclarationAlignment::Align4,
|
||||
settings.size() * settings.front().GetRawDataSize(), "LightSettings",
|
||||
StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset),
|
||||
settings.size(), declaration);
|
||||
}
|
||||
}
|
||||
|
||||
std::string SetLightingSettings::GetBodySourceCode() const
|
||||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightSettings", listName);
|
||||
if (Globals::Instance->game != ZGame::MM_RETAIL)
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EnvLightSettings", listName);
|
||||
else
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightSettings", listName);
|
||||
return StringHelper::Sprintf("SCENE_CMD_ENV_LIGHT_SETTINGS(%i, %s)", settings.size(),
|
||||
listName.c_str());
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ void SetMesh::ParseRawData()
|
|||
switch (meshHeaderType)
|
||||
{
|
||||
case 0:
|
||||
polyType = std::make_shared<PolygonType2>(parent, segmentOffset, zRoom);
|
||||
polyType = std::make_shared<RoomShapeCullable>(parent, segmentOffset, zRoom);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -32,7 +32,7 @@ void SetMesh::ParseRawData()
|
|||
break;
|
||||
|
||||
case 2:
|
||||
polyType = std::make_shared<PolygonType2>(parent, segmentOffset, zRoom);
|
||||
polyType = std::make_shared<RoomShapeCullable>(parent, segmentOffset, zRoom);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -79,7 +79,7 @@ std::string SetMesh::GetBodySourceCode() const
|
|||
{
|
||||
std::string list;
|
||||
Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "", list);
|
||||
return StringHelper::Sprintf("SCENE_CMD_MESH(%s)", list.c_str());
|
||||
return StringHelper::Sprintf("SCENE_CMD_ROOM_SHAPE(%s)", list.c_str());
|
||||
}
|
||||
|
||||
std::string SetMesh::GetCommandCName() const
|
||||
|
@ -92,11 +92,11 @@ RoomCommand SetMesh::GetRoomCommand() const
|
|||
return RoomCommand::SetMesh;
|
||||
}
|
||||
|
||||
PolygonDlist::PolygonDlist(ZFile* nParent) : ZResource(nParent)
|
||||
RoomShapeDListsEntry::RoomShapeDListsEntry(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void PolygonDlist::ParseRawData()
|
||||
void RoomShapeDListsEntry::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
switch (polyType)
|
||||
|
@ -118,13 +118,13 @@ void PolygonDlist::ParseRawData()
|
|||
}
|
||||
}
|
||||
|
||||
void PolygonDlist::DeclareReferences(const std::string& prefix)
|
||||
void RoomShapeDListsEntry::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
opaDList = MakeDlist(opa, prefix);
|
||||
xluDList = MakeDlist(xlu, prefix);
|
||||
}
|
||||
|
||||
std::string PolygonDlist::GetBodySourceCode() const
|
||||
std::string RoomShapeDListsEntry::GetBodySourceCode() const
|
||||
{
|
||||
std::string bodyStr;
|
||||
std::string opaStr;
|
||||
|
@ -142,7 +142,7 @@ std::string PolygonDlist::GetBodySourceCode() const
|
|||
return bodyStr;
|
||||
}
|
||||
|
||||
void PolygonDlist::GetSourceOutputCode(const std::string& prefix)
|
||||
void RoomShapeDListsEntry::GetSourceOutputCode(const std::string& prefix)
|
||||
{
|
||||
std::string bodyStr = StringHelper::Sprintf("\n\t%s\n", GetBodySourceCode().c_str());
|
||||
|
||||
|
@ -151,28 +151,28 @@ void PolygonDlist::GetSourceOutputCode(const std::string& prefix)
|
|||
if (decl == nullptr)
|
||||
DeclareVar(prefix, bodyStr);
|
||||
else
|
||||
decl->text = bodyStr;
|
||||
decl->declBody = bodyStr;
|
||||
}
|
||||
|
||||
std::string PolygonDlist::GetSourceTypeName() const
|
||||
std::string RoomShapeDListsEntry::GetSourceTypeName() const
|
||||
{
|
||||
switch (polyType)
|
||||
{
|
||||
case 2:
|
||||
return "PolygonDlist2";
|
||||
return "RoomShapeCullableEntry";
|
||||
|
||||
default:
|
||||
return "PolygonDlist";
|
||||
return "RoomShapeDListsEntry";
|
||||
}
|
||||
}
|
||||
|
||||
ZResourceType PolygonDlist::GetResourceType() const
|
||||
ZResourceType RoomShapeDListsEntry::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t PolygonDlist::GetRawDataSize() const
|
||||
size_t RoomShapeDListsEntry::GetRawDataSize() const
|
||||
{
|
||||
switch (polyType)
|
||||
{
|
||||
|
@ -184,12 +184,13 @@ size_t PolygonDlist::GetRawDataSize() const
|
|||
}
|
||||
}
|
||||
|
||||
void PolygonDlist::SetPolyType(uint8_t nPolyType)
|
||||
void RoomShapeDListsEntry::SetPolyType(uint8_t nPolyType)
|
||||
{
|
||||
polyType = nPolyType;
|
||||
}
|
||||
|
||||
ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, [[maybe_unused]] const std::string& prefix)
|
||||
ZDisplayList* RoomShapeDListsEntry::MakeDlist(segptr_t ptr,
|
||||
[[maybe_unused]] const std::string& prefix)
|
||||
{
|
||||
if (ptr == 0)
|
||||
{
|
||||
|
@ -210,15 +211,15 @@ ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, [[maybe_unused]] const std::
|
|||
return dlist;
|
||||
}
|
||||
|
||||
/* BgImage */
|
||||
/* RoomShapeImageMultiBgEntry */
|
||||
|
||||
BgImage::BgImage(ZFile* nParent) : ZResource(nParent)
|
||||
RoomShapeImageMultiBgEntry::RoomShapeImageMultiBgEntry(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex,
|
||||
ZFile* nParent)
|
||||
: BgImage(nParent)
|
||||
RoomShapeImageMultiBgEntry::RoomShapeImageMultiBgEntry(bool nIsSubStruct, const std::string& prefix,
|
||||
uint32_t nRawDataIndex, ZFile* nParent)
|
||||
: RoomShapeImageMultiBgEntry(nParent)
|
||||
{
|
||||
rawDataIndex = nRawDataIndex;
|
||||
parent = nParent;
|
||||
|
@ -230,7 +231,7 @@ BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, uint32_t nRawData
|
|||
sourceBackground = MakeBackground(source, prefix);
|
||||
}
|
||||
|
||||
void BgImage::ParseRawData()
|
||||
void RoomShapeImageMultiBgEntry::ParseRawData()
|
||||
{
|
||||
size_t pad = 0x00;
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
@ -252,7 +253,7 @@ void BgImage::ParseRawData()
|
|||
tlutCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + pad + 0x14);
|
||||
}
|
||||
|
||||
ZBackground* BgImage::MakeBackground(segptr_t ptr, const std::string& prefix)
|
||||
ZBackground* RoomShapeImageMultiBgEntry::MakeBackground(segptr_t ptr, const std::string& prefix)
|
||||
{
|
||||
if (ptr == 0)
|
||||
return nullptr;
|
||||
|
@ -272,12 +273,12 @@ ZBackground* BgImage::MakeBackground(segptr_t ptr, const std::string& prefix)
|
|||
return background;
|
||||
}
|
||||
|
||||
size_t BgImage::GetRawDataSize() const
|
||||
size_t RoomShapeImageMultiBgEntry::GetRawDataSize() const
|
||||
{
|
||||
return 0x1C;
|
||||
}
|
||||
|
||||
std::string BgImage::GetBodySourceCode() const
|
||||
std::string RoomShapeImageMultiBgEntry::GetBodySourceCode() const
|
||||
{
|
||||
std::string bodyStr = " ";
|
||||
if (!isSubStruct)
|
||||
|
@ -340,12 +341,12 @@ std::string BgImage::GetBodySourceCode() const
|
|||
return bodyStr;
|
||||
}
|
||||
|
||||
std::string BgImage::GetSourceTypeName() const
|
||||
std::string RoomShapeImageMultiBgEntry::GetSourceTypeName() const
|
||||
{
|
||||
return "BgImage";
|
||||
return "RoomShapeImageMultiBgEntry";
|
||||
}
|
||||
|
||||
ZResourceType BgImage::GetResourceType() const
|
||||
ZResourceType RoomShapeImageMultiBgEntry::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
|
@ -371,7 +372,7 @@ void PolygonTypeBase::DeclareAndGenerateOutputCode(const std::string& prefix)
|
|||
}
|
||||
else
|
||||
{
|
||||
decl->text = bodyStr;
|
||||
decl->declBody = bodyStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,13 +381,13 @@ std::string PolygonTypeBase::GetSourceTypeName() const
|
|||
switch (type)
|
||||
{
|
||||
case 2:
|
||||
return "PolygonType2";
|
||||
return "RoomShapeCullable";
|
||||
|
||||
case 1:
|
||||
return "PolygonType1";
|
||||
|
||||
default:
|
||||
return "PolygonType0";
|
||||
return "RoomShapeNormal";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,7 +417,7 @@ void PolygonType1::ParseRawData()
|
|||
|
||||
if (dlist != 0)
|
||||
{
|
||||
PolygonDlist polyGfxList(parent);
|
||||
RoomShapeDListsEntry polyGfxList(parent);
|
||||
polyGfxList.zRoom = zRoom;
|
||||
polyGfxList.SetPolyType(type);
|
||||
polyGfxList.ExtractFromFile(Seg2Filespace(dlist, parent->baseAddress));
|
||||
|
@ -434,7 +435,7 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
|
|||
switch (format)
|
||||
{
|
||||
case 1:
|
||||
single = BgImage(true, prefix, rawDataIndex + 0x08, parent);
|
||||
single = RoomShapeImageMultiBgEntry(true, prefix, rawDataIndex + 0x08, parent);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -446,7 +447,7 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
|
|||
multiList.reserve(count);
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
BgImage bg(false, prefix, auxPtr, parent);
|
||||
RoomShapeImageMultiBgEntry bg(false, prefix, auxPtr, parent);
|
||||
multiList.push_back(bg);
|
||||
auxPtr += bg.GetRawDataSize();
|
||||
bgImageArrayBody += bg.GetBodySourceCode();
|
||||
|
@ -507,7 +508,7 @@ std::string PolygonType1::GetBodySourceCode() const
|
|||
bodyStr += single.GetBodySourceCode();
|
||||
break;
|
||||
case 2:
|
||||
Globals::Instance->GetSegmentedPtrName(list, parent, "BgImage", listStr);
|
||||
Globals::Instance->GetSegmentedPtrName(list, parent, "RoomShapeImageMultiBgEntry", listStr);
|
||||
bodyStr += StringHelper::Sprintf(" %i, %s, \n", count, listStr.c_str());
|
||||
break;
|
||||
|
||||
|
@ -523,21 +524,21 @@ std::string PolygonType1::GetSourceTypeName() const
|
|||
switch (format)
|
||||
{
|
||||
case 1:
|
||||
return "MeshHeader1Single";
|
||||
return "RoomShapeImageSingle";
|
||||
|
||||
case 2:
|
||||
return "MeshHeader1Multi";
|
||||
return "RoomShapeImageMulti";
|
||||
}
|
||||
return "ERROR";
|
||||
// return "PolygonType1";
|
||||
}
|
||||
|
||||
PolygonType2::PolygonType2(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom)
|
||||
RoomShapeCullable::RoomShapeCullable(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom)
|
||||
: PolygonTypeBase(nParent, nRawDataIndex, nRoom)
|
||||
{
|
||||
}
|
||||
|
||||
void PolygonType2::ParseRawData()
|
||||
void RoomShapeCullable::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
|
@ -551,7 +552,7 @@ void PolygonType2::ParseRawData()
|
|||
polyDLists.reserve(num);
|
||||
for (size_t i = 0; i < num; i++)
|
||||
{
|
||||
PolygonDlist entry(parent);
|
||||
RoomShapeDListsEntry entry(parent);
|
||||
entry.zRoom = zRoom;
|
||||
entry.SetPolyType(type);
|
||||
entry.ExtractFromFile(currentPtr);
|
||||
|
@ -561,7 +562,7 @@ void PolygonType2::ParseRawData()
|
|||
}
|
||||
}
|
||||
|
||||
void PolygonType2::DeclareReferences(const std::string& prefix)
|
||||
void RoomShapeCullable::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
if (num > 0)
|
||||
{
|
||||
|
@ -593,7 +594,7 @@ void PolygonType2::DeclareReferences(const std::string& prefix)
|
|||
"0x01000000");
|
||||
}
|
||||
|
||||
std::string PolygonType2::GetBodySourceCode() const
|
||||
std::string RoomShapeCullable::GetBodySourceCode() const
|
||||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(start, parent, "", listName);
|
||||
|
@ -605,12 +606,12 @@ std::string PolygonType2::GetBodySourceCode() const
|
|||
return body;
|
||||
}
|
||||
|
||||
size_t PolygonType2::GetRawDataSize() const
|
||||
size_t RoomShapeCullable::GetRawDataSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
DeclarationAlignment PolygonType2::GetDeclarationAlignment() const
|
||||
DeclarationAlignment RoomShapeCullable::GetDeclarationAlignment() const
|
||||
{
|
||||
return DeclarationAlignment::Align4;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "ZDisplayList.h"
|
||||
#include "ZRoom/ZRoomCommand.h"
|
||||
|
||||
class PolygonDlist : public ZResource
|
||||
class RoomShapeDListsEntry : public ZResource
|
||||
{
|
||||
public:
|
||||
ZRoom* zRoom;
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
ZDisplayList* opaDList = nullptr; // Gfx*
|
||||
ZDisplayList* xluDList = nullptr; // Gfx*
|
||||
|
||||
PolygonDlist(ZFile* nParent);
|
||||
RoomShapeDListsEntry(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
@ -41,7 +41,7 @@ protected:
|
|||
ZDisplayList* MakeDlist(segptr_t ptr, const std::string& prefix);
|
||||
};
|
||||
|
||||
class BgImage : public ZResource
|
||||
class RoomShapeImageMultiBgEntry : public ZResource
|
||||
{
|
||||
public:
|
||||
uint16_t unk_00;
|
||||
|
@ -60,8 +60,9 @@ public:
|
|||
|
||||
bool isSubStruct;
|
||||
|
||||
BgImage(ZFile* nParent);
|
||||
BgImage(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex, ZFile* nParent);
|
||||
RoomShapeImageMultiBgEntry(ZFile* nParent);
|
||||
RoomShapeImageMultiBgEntry(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex,
|
||||
ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
|
@ -80,7 +81,7 @@ class PolygonTypeBase : public ZResource
|
|||
{
|
||||
public:
|
||||
uint8_t type;
|
||||
std::vector<PolygonDlist> polyDLists;
|
||||
std::vector<RoomShapeDListsEntry> polyDLists;
|
||||
|
||||
PolygonTypeBase(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
|
||||
|
||||
|
@ -100,12 +101,12 @@ public:
|
|||
segptr_t dlist;
|
||||
|
||||
// single
|
||||
BgImage single;
|
||||
RoomShapeImageMultiBgEntry single;
|
||||
|
||||
// multi
|
||||
uint8_t count;
|
||||
segptr_t list; // BgImage*
|
||||
std::vector<BgImage> multiList;
|
||||
segptr_t list; // RoomShapeImageMultiBgEntry*
|
||||
std::vector<RoomShapeImageMultiBgEntry> multiList;
|
||||
|
||||
PolygonType1(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
|
||||
|
||||
|
@ -119,14 +120,14 @@ public:
|
|||
size_t GetRawDataSize() const override;
|
||||
};
|
||||
|
||||
class PolygonType2 : public PolygonTypeBase
|
||||
class RoomShapeCullable : public PolygonTypeBase
|
||||
{
|
||||
public:
|
||||
uint8_t num;
|
||||
segptr_t start;
|
||||
segptr_t end;
|
||||
|
||||
PolygonType2(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
|
||||
RoomShapeCullable(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
|
|
@ -15,7 +15,7 @@ void SetMinimapList::ParseRawData()
|
|||
ZRoomCommand::ParseRawData();
|
||||
listSegmentAddr = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset);
|
||||
listSegmentOffset = GETSEGOFFSET(listSegmentAddr);
|
||||
unk4 = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset + 4);
|
||||
scale = BitConverter::ToInt16BE(parent->GetRawData(), segmentOffset + 4);
|
||||
|
||||
uint32_t currentPtr = listSegmentOffset;
|
||||
|
||||
|
@ -54,7 +54,7 @@ void SetMinimapList::DeclareReferences(const std::string& prefix)
|
|||
{
|
||||
std::string listName;
|
||||
Globals::Instance->GetSegmentedPtrName(listSegmentAddr, parent, "MinimapEntry", listName);
|
||||
std::string declaration = StringHelper::Sprintf("\n\t%s, 0x%08X\n", listName.c_str(), unk4);
|
||||
std::string declaration = StringHelper::Sprintf("\n\t%s, %d\n", listName.c_str(), scale);
|
||||
|
||||
parent->AddDeclaration(
|
||||
segmentOffset, DeclarationAlignment::Align4, 8, "MinimapList",
|
||||
|
|
|
@ -35,5 +35,5 @@ public:
|
|||
private:
|
||||
segptr_t listSegmentAddr;
|
||||
uint32_t listSegmentOffset;
|
||||
uint32_t unk4;
|
||||
int16_t scale;
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ void SetPathways::ParseRawDataLate()
|
|||
{
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
{
|
||||
auto numPaths = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 8;
|
||||
auto numPaths = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 8;
|
||||
pathwayList.SetNumPaths(numPaths);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,14 @@ void SetSpecialObjects::ParseRawData()
|
|||
|
||||
std::string SetSpecialObjects::GetBodySourceCode() const
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
std::string objectName = ZNames::GetObjectName(globalObject);
|
||||
|
||||
if (enumData->naviQuestHintType.find(elfMessage) != enumData->naviQuestHintType.end())
|
||||
return StringHelper::Sprintf("SCENE_CMD_SPECIAL_FILES(%s, %s)",
|
||||
enumData->naviQuestHintType[elfMessage].c_str(),
|
||||
objectName.c_str());
|
||||
|
||||
return StringHelper::Sprintf("SCENE_CMD_SPECIAL_FILES(0x%02X, %s)", elfMessage,
|
||||
objectName.c_str());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "SetWorldMapVisited.h"
|
||||
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "Globals.h"
|
||||
|
||||
SetWorldMapVisited::SetWorldMapVisited(ZFile* nParent) : ZRoomCommand(nParent)
|
||||
{
|
||||
|
@ -8,7 +9,10 @@ SetWorldMapVisited::SetWorldMapVisited(ZFile* nParent) : ZRoomCommand(nParent)
|
|||
|
||||
std::string SetWorldMapVisited::GetBodySourceCode() const
|
||||
{
|
||||
return "SCENE_CMD_MISC_SETTINGS()";
|
||||
if (Globals::Instance->game == ZGame::MM_RETAIL)
|
||||
return "SCENE_CMD_SET_REGION_VISITED()";
|
||||
else
|
||||
return "SCENE_CMD_MISC_SETTINGS()";
|
||||
}
|
||||
|
||||
std::string SetWorldMapVisited::GetCommandCName() const
|
||||
|
|
|
@ -48,11 +48,12 @@ public:
|
|||
static std::string GetEntranceName(uint16_t id)
|
||||
{
|
||||
if (ZNames::GetNumEntrances() == 0 || ZNames::GetNumSpecialEntrances() == 0)
|
||||
return StringHelper::Sprintf("0x%04X", id);
|
||||
|
||||
return StringHelper::Sprintf("0x%04X", id);
|
||||
|
||||
if (id < ZNames::GetNumEntrances())
|
||||
return Globals::Instance->cfg.entranceList[id];
|
||||
else if ((id >= 0x7FF9 && id <= 0x7FFF) && !((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances
|
||||
else if ((id >= 0x7FF9 && id <= 0x7FFF) &&
|
||||
!((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances
|
||||
return Globals::Instance->cfg.specialEntranceList[id - 0x7FF9];
|
||||
else
|
||||
return StringHelper::Sprintf("0x%04X", id);
|
||||
|
@ -60,5 +61,8 @@ public:
|
|||
|
||||
static size_t GetNumActors() { return Globals::Instance->cfg.actorList.size(); }
|
||||
static size_t GetNumEntrances() { return Globals::Instance->cfg.entranceList.size(); }
|
||||
static size_t GetNumSpecialEntrances() { return Globals::Instance->cfg.specialEntranceList.size(); }
|
||||
static size_t GetNumSpecialEntrances()
|
||||
{
|
||||
return Globals::Instance->cfg.specialEntranceList.size();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <string_view>
|
||||
|
||||
#include "Commands/EndMarker.h"
|
||||
#include "Commands/SetActorCutsceneList.h"
|
||||
#include "Commands/SetCutsceneEntryList.h"
|
||||
#include "Commands/SetActorList.h"
|
||||
#include "Commands/SetAlternateHeaders.h"
|
||||
#include "Commands/SetAnimatedMaterialList.h"
|
||||
|
@ -64,18 +64,14 @@ ZRoom::~ZRoom()
|
|||
delete cmd;
|
||||
}
|
||||
|
||||
void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
void ZRoom::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex)
|
||||
{
|
||||
ZResource::ExtractFromXML(reader, nRawDataIndex);
|
||||
ZResource::ExtractWithXML(reader, nRawDataIndex);
|
||||
|
||||
if (hackMode == "syotes_room")
|
||||
{
|
||||
SyotesRoomHack();
|
||||
}
|
||||
SyotesRoomFix();
|
||||
else
|
||||
{
|
||||
DeclareVar(name, "");
|
||||
}
|
||||
}
|
||||
|
||||
void ZRoom::ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType)
|
||||
|
@ -338,9 +334,9 @@ std::string ZRoom::GetDefaultName(const std::string& prefix) const
|
|||
* back to very early in the game's development. Since this room is a special case,
|
||||
* declare automatically the data its contains whitout the need of a header.
|
||||
*/
|
||||
void ZRoom::SyotesRoomHack()
|
||||
void ZRoom::SyotesRoomFix()
|
||||
{
|
||||
PolygonType2 poly(parent, 0, this);
|
||||
RoomShapeCullable poly(parent, 0, this);
|
||||
|
||||
poly.ParseRawData();
|
||||
poly.DeclareReferences(GetName());
|
||||
|
@ -360,20 +356,6 @@ ZRoomCommand* ZRoom::FindCommandOfType(RoomCommand cmdType)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
size_t ZRoom::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress)
|
||||
{
|
||||
auto currentDecl = parent->declarations.find(declarationAddress);
|
||||
if (currentDecl == parent->declarations.end())
|
||||
return 0;
|
||||
|
||||
auto nextDecl = currentDecl;
|
||||
std::advance(nextDecl, 1);
|
||||
if (nextDecl == parent->declarations.end())
|
||||
return parent->GetRawData().size() - currentDecl->first;
|
||||
|
||||
return nextDecl->first - currentDecl->first;
|
||||
}
|
||||
|
||||
size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
|
||||
{
|
||||
int32_t cmdIndex = -1;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
ZRoom(ZFile* nParent);
|
||||
virtual ~ZRoom();
|
||||
|
||||
void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override;
|
||||
void ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType);
|
||||
|
||||
void ParseXML(tinyxml2::XMLElement* reader) override;
|
||||
|
@ -37,7 +37,6 @@ public:
|
|||
void GetSourceOutputCode(const std::string& prefix) override;
|
||||
|
||||
std::string GetDefaultName(const std::string& prefix) const override;
|
||||
size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress);
|
||||
size_t GetCommandSizeFromNeighbor(ZRoomCommand* cmd);
|
||||
ZRoomCommand* FindCommandOfType(RoomCommand cmdType);
|
||||
|
||||
|
@ -46,5 +45,5 @@ public:
|
|||
ZResourceType GetResourceType() const override;
|
||||
|
||||
protected:
|
||||
void SyotesRoomHack();
|
||||
void SyotesRoomFix();
|
||||
};
|
||||
|
|
|
@ -189,7 +189,7 @@ std::string ZSkeleton::GetSourceTypeName() const
|
|||
case ZSkeletonType::Flex:
|
||||
return "FlexSkeletonHeader";
|
||||
case ZSkeletonType::Curve:
|
||||
return "SkelCurveLimbList";
|
||||
return "CurveSkeletonHeader";
|
||||
}
|
||||
|
||||
return "SkeletonHeader";
|
||||
|
|
|
@ -137,31 +137,31 @@ void ZTexture::ParseRawData()
|
|||
switch (format)
|
||||
{
|
||||
case TextureType::RGBA16bpp:
|
||||
PrepareBitmapRGBA16();
|
||||
ConvertN64ToBitmap_RGBA16();
|
||||
break;
|
||||
case TextureType::RGBA32bpp:
|
||||
PrepareBitmapRGBA32();
|
||||
ConvertN64ToBitmap_RGBA32();
|
||||
break;
|
||||
case TextureType::Grayscale4bpp:
|
||||
PrepareBitmapGrayscale4();
|
||||
ConvertN64ToBitmap_Grayscale4();
|
||||
break;
|
||||
case TextureType::Grayscale8bpp:
|
||||
PrepareBitmapGrayscale8();
|
||||
ConvertN64ToBitmap_Grayscale8();
|
||||
break;
|
||||
case TextureType::GrayscaleAlpha4bpp:
|
||||
PrepareBitmapGrayscaleAlpha4();
|
||||
ConvertN64ToBitmap_GrayscaleAlpha4();
|
||||
break;
|
||||
case TextureType::GrayscaleAlpha8bpp:
|
||||
PrepareBitmapGrayscaleAlpha8();
|
||||
ConvertN64ToBitmap_GrayscaleAlpha8();
|
||||
break;
|
||||
case TextureType::GrayscaleAlpha16bpp:
|
||||
PrepareBitmapGrayscaleAlpha16();
|
||||
ConvertN64ToBitmap_GrayscaleAlpha16();
|
||||
break;
|
||||
case TextureType::Palette4bpp:
|
||||
PrepareBitmapPalette4();
|
||||
ConvertN64ToBitmap_Palette4();
|
||||
break;
|
||||
case TextureType::Palette8bpp:
|
||||
PrepareBitmapPalette8();
|
||||
ConvertN64ToBitmap_Palette8();
|
||||
break;
|
||||
case TextureType::Error:
|
||||
HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex,
|
||||
|
@ -212,10 +212,10 @@ void ZTexture::ParseRawDataLate()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapRGBA16()
|
||||
void ZTexture::ConvertN64ToBitmap_RGBA16()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, true);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x++)
|
||||
|
@ -227,15 +227,16 @@ void ZTexture::PrepareBitmapRGBA16()
|
|||
uint8_t b = (data & 0x003E) >> 1;
|
||||
uint8_t alpha = data & 0x01;
|
||||
|
||||
textureData.SetRGBPixel(y, x, r * 8, g * 8, b * 8, alpha * 255);
|
||||
textureData.SetRGBPixel(y, x, (r << 3) | (r >> 2), (g << 3) | (g >> 2),
|
||||
(b << 3) | (b >> 2), alpha * 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapRGBA32()
|
||||
void ZTexture::ConvertN64ToBitmap_RGBA32()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, true);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x++)
|
||||
|
@ -251,10 +252,10 @@ void ZTexture::PrepareBitmapRGBA32()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapGrayscale4()
|
||||
void ZTexture::ConvertN64ToBitmap_Grayscale4()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, false);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x += 2)
|
||||
|
@ -269,16 +270,16 @@ void ZTexture::PrepareBitmapGrayscale4()
|
|||
else
|
||||
grayscale = (parentRawData.at(pos) & 0x0F) << 4;
|
||||
|
||||
textureData.SetGrayscalePixel(y, x + i, grayscale);
|
||||
textureData.SetGrayscalePixel(y, x + i, (grayscale << 4) | grayscale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapGrayscale8()
|
||||
void ZTexture::ConvertN64ToBitmap_Grayscale8()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, false);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x++)
|
||||
|
@ -290,10 +291,10 @@ void ZTexture::PrepareBitmapGrayscale8()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapGrayscaleAlpha4()
|
||||
void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha4()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, true);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x += 2)
|
||||
|
@ -308,8 +309,9 @@ void ZTexture::PrepareBitmapGrayscaleAlpha4()
|
|||
else
|
||||
data = parentRawData.at(pos) & 0x0F;
|
||||
|
||||
uint8_t grayscale = ((data & 0x0E) >> 1) * 32;
|
||||
uint8_t alpha = (data & 0x01) * 255;
|
||||
uint8_t grayscale = data & 0b1110;
|
||||
grayscale = (grayscale << 4) | (grayscale << 1) | (grayscale >> 2);
|
||||
uint8_t alpha = (data & 0x01) ? 255 : 0;
|
||||
|
||||
textureData.SetGrayscalePixel(y, x + i, grayscale, alpha);
|
||||
}
|
||||
|
@ -317,27 +319,32 @@ void ZTexture::PrepareBitmapGrayscaleAlpha4()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapGrayscaleAlpha8()
|
||||
void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha8()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, true);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x++)
|
||||
{
|
||||
size_t pos = rawDataIndex + ((y * width) + x) * 1;
|
||||
uint8_t grayscale = parentRawData.at(pos) & 0xF0;
|
||||
uint8_t alpha = (parentRawData.at(pos) & 0x0F) << 4;
|
||||
uint8_t pixel = parentRawData.at(pos);
|
||||
uint8_t data = (pixel >> 4) & 0xF;
|
||||
|
||||
data = (data << 4) | data;
|
||||
uint8_t grayscale = data;
|
||||
uint8_t alpha = (pixel & 0xF);
|
||||
alpha = (alpha << 4) | alpha;
|
||||
|
||||
textureData.SetGrayscalePixel(y, x, grayscale, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapGrayscaleAlpha16()
|
||||
void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha16()
|
||||
{
|
||||
textureData.InitEmptyRGBImage(width, height, true);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x++)
|
||||
|
@ -351,10 +358,10 @@ void ZTexture::PrepareBitmapGrayscaleAlpha16()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapPalette4()
|
||||
void ZTexture::ConvertN64ToBitmap_Palette4()
|
||||
{
|
||||
textureData.InitEmptyPaletteImage(width, height);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x += 2)
|
||||
|
@ -375,10 +382,10 @@ void ZTexture::PrepareBitmapPalette4()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareBitmapPalette8()
|
||||
void ZTexture::ConvertN64ToBitmap_Palette8()
|
||||
{
|
||||
textureData.InitEmptyPaletteImage(width, height);
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
for (size_t y = 0; y < height; y++)
|
||||
{
|
||||
for (size_t x = 0; x < width; x++)
|
||||
|
@ -428,31 +435,31 @@ void ZTexture::PrepareRawDataFromFile(const fs::path& pngFilePath)
|
|||
switch (format)
|
||||
{
|
||||
case TextureType::RGBA16bpp:
|
||||
PrepareRawDataRGBA16();
|
||||
ConvertBitmapToN64_RGBA16();
|
||||
break;
|
||||
case TextureType::RGBA32bpp:
|
||||
PrepareRawDataRGBA32();
|
||||
ConvertBitmapToN64_RGBA32();
|
||||
break;
|
||||
case TextureType::Grayscale4bpp:
|
||||
PrepareRawDataGrayscale4();
|
||||
ConvertBitmapToN64_Grayscale4();
|
||||
break;
|
||||
case TextureType::Grayscale8bpp:
|
||||
PrepareRawDataGrayscale8();
|
||||
ConvertBitmapToN64_Grayscale8();
|
||||
break;
|
||||
case TextureType::GrayscaleAlpha4bpp:
|
||||
PrepareRawDataGrayscaleAlpha4();
|
||||
ConvertBitmapToN64_GrayscaleAlpha4();
|
||||
break;
|
||||
case TextureType::GrayscaleAlpha8bpp:
|
||||
PrepareRawDataGrayscaleAlpha8();
|
||||
ConvertBitmapToN64_GrayscaleAlpha8();
|
||||
break;
|
||||
case TextureType::GrayscaleAlpha16bpp:
|
||||
PrepareRawDataGrayscaleAlpha16();
|
||||
ConvertBitmapToN64_GrayscaleAlpha16();
|
||||
break;
|
||||
case TextureType::Palette4bpp:
|
||||
PrepareRawDataPalette4();
|
||||
ConvertBitmapToN64_Palette4();
|
||||
break;
|
||||
case TextureType::Palette8bpp:
|
||||
PrepareRawDataPalette8();
|
||||
ConvertBitmapToN64_Palette8();
|
||||
break;
|
||||
case TextureType::Error:
|
||||
HANDLE_ERROR_PROCESS(WarningType::InvalidPNG, "Input PNG file has invalid format type", "");
|
||||
|
@ -460,7 +467,7 @@ void ZTexture::PrepareRawDataFromFile(const fs::path& pngFilePath)
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataRGBA16()
|
||||
void ZTexture::ConvertBitmapToN64_RGBA16()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -469,13 +476,13 @@ void ZTexture::PrepareRawDataRGBA16()
|
|||
size_t pos = ((y * width) + x) * 2;
|
||||
RGBAPixel pixel = textureData.GetPixel(y, x);
|
||||
|
||||
uint8_t r = pixel.r / 8;
|
||||
uint8_t g = pixel.g / 8;
|
||||
uint8_t b = pixel.b / 8;
|
||||
uint8_t r = pixel.r >> 3;
|
||||
uint8_t g = pixel.g >> 3;
|
||||
uint8_t b = pixel.b >> 3;
|
||||
|
||||
uint8_t alphaBit = pixel.a != 0;
|
||||
|
||||
uint16_t data = (r << 11) + (g << 6) + (b << 1) + alphaBit;
|
||||
uint16_t data = (r << 11) | (g << 6) | (b << 1) | alphaBit;
|
||||
|
||||
textureDataRaw[pos + 0] = (data & 0xFF00) >> 8;
|
||||
textureDataRaw[pos + 1] = (data & 0x00FF);
|
||||
|
@ -483,7 +490,7 @@ void ZTexture::PrepareRawDataRGBA16()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataRGBA32()
|
||||
void ZTexture::ConvertBitmapToN64_RGBA32()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -500,7 +507,7 @@ void ZTexture::PrepareRawDataRGBA32()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataGrayscale4()
|
||||
void ZTexture::ConvertBitmapToN64_Grayscale4()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -515,7 +522,7 @@ void ZTexture::PrepareRawDataGrayscale4()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataGrayscale8()
|
||||
void ZTexture::ConvertBitmapToN64_Grayscale8()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -528,7 +535,7 @@ void ZTexture::PrepareRawDataGrayscale8()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataGrayscaleAlpha4()
|
||||
void ZTexture::ConvertBitmapToN64_GrayscaleAlpha4()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -544,9 +551,9 @@ void ZTexture::PrepareRawDataGrayscaleAlpha4()
|
|||
uint8_t alphaBit = pixel.a != 0;
|
||||
|
||||
if (i == 0)
|
||||
data |= (((cR / 32) << 1) + alphaBit) << 4;
|
||||
data = (((cR >> 5) << 1) | alphaBit) << 4;
|
||||
else
|
||||
data |= ((cR / 32) << 1) + alphaBit;
|
||||
data |= ((cR >> 5) << 1) | alphaBit;
|
||||
}
|
||||
|
||||
textureDataRaw[pos] = data;
|
||||
|
@ -554,7 +561,7 @@ void ZTexture::PrepareRawDataGrayscaleAlpha4()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataGrayscaleAlpha8()
|
||||
void ZTexture::ConvertBitmapToN64_GrayscaleAlpha8()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -563,15 +570,15 @@ void ZTexture::PrepareRawDataGrayscaleAlpha8()
|
|||
size_t pos = ((y * width) + x) * 1;
|
||||
RGBAPixel pixel = textureData.GetPixel(y, x);
|
||||
|
||||
uint8_t r = pixel.r;
|
||||
uint8_t a = pixel.a;
|
||||
uint8_t r = (pixel.r >> 4) & 0xF;
|
||||
uint8_t a = (pixel.a >> 4) & 0xF;
|
||||
|
||||
textureDataRaw[pos] = ((r / 16) << 4) + (a / 16);
|
||||
textureDataRaw[pos] = (r << 4) | a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataGrayscaleAlpha16()
|
||||
void ZTexture::ConvertBitmapToN64_GrayscaleAlpha16()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -589,7 +596,7 @@ void ZTexture::PrepareRawDataGrayscaleAlpha16()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataPalette4()
|
||||
void ZTexture::ConvertBitmapToN64_Palette4()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -605,7 +612,7 @@ void ZTexture::PrepareRawDataPalette4()
|
|||
}
|
||||
}
|
||||
|
||||
void ZTexture::PrepareRawDataPalette8()
|
||||
void ZTexture::ConvertBitmapToN64_Palette8()
|
||||
{
|
||||
for (uint16_t y = 0; y < height; y++)
|
||||
{
|
||||
|
@ -770,10 +777,10 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix,
|
|||
auto filepath = Globals::Instance->outputPath / fs::path(auxOutName).stem();
|
||||
|
||||
if (dWordAligned)
|
||||
incStr =
|
||||
StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), GetExternalExtension().c_str());
|
||||
incStr = StringHelper::Sprintf("%s.%s.inc.c", filepath.string().c_str(),
|
||||
GetExternalExtension().c_str());
|
||||
else
|
||||
incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", filepath.c_str(),
|
||||
incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", filepath.string().c_str(),
|
||||
GetExternalExtension().c_str());
|
||||
|
||||
if (!Globals::Instance->cfg.texturePool.empty())
|
||||
|
@ -785,18 +792,31 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix,
|
|||
if (poolEntry != Globals::Instance->cfg.texturePool.end())
|
||||
{
|
||||
if (dWordAligned)
|
||||
incStr = StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.c_str(),
|
||||
GetExternalExtension().c_str());
|
||||
incStr =
|
||||
StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.string().c_str(),
|
||||
GetExternalExtension().c_str());
|
||||
else
|
||||
incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", poolEntry->second.path.c_str(),
|
||||
incStr = StringHelper::Sprintf("%s.u32.%s.inc.c",
|
||||
poolEntry->second.path.string().c_str(),
|
||||
GetExternalExtension().c_str());
|
||||
}
|
||||
}
|
||||
size_t texSizeDivisor = (dWordAligned) ? 8 : 4;
|
||||
|
||||
Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(),
|
||||
GetSourceTypeName(), auxName,
|
||||
GetRawDataSize() / texSizeDivisor);
|
||||
Declaration* decl;
|
||||
|
||||
if (parent->makeDefines)
|
||||
{
|
||||
decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(),
|
||||
GetSourceTypeName(), auxName, GetHeaderDefines(),
|
||||
GetRawDataSize() / texSizeDivisor);
|
||||
}
|
||||
else
|
||||
{
|
||||
decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(),
|
||||
GetSourceTypeName(), auxName,
|
||||
GetRawDataSize() / texSizeDivisor);
|
||||
}
|
||||
decl->staticConf = staticConf;
|
||||
return decl;
|
||||
}
|
||||
|
@ -827,6 +847,17 @@ std::string ZTexture::GetBodySourceCode() const
|
|||
return sourceOutput;
|
||||
}
|
||||
|
||||
std::string ZTexture::GetHeaderDefines() const
|
||||
{
|
||||
std::string definePrefix = StringHelper::camelCaseTo_SCREAMING_SNAKE_CASE(name.c_str(), true);
|
||||
std::string ret = StringHelper::Sprintf("#define %s_WIDTH %d\n", definePrefix.c_str(), width);
|
||||
|
||||
ret += StringHelper::Sprintf("#define %s_HEIGHT %d\n", definePrefix.c_str(), height);
|
||||
ret += StringHelper::Sprintf("#define %s_SIZE 0x%zX\n", definePrefix.c_str(), GetRawDataSize());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ZTexture::IsExternalResource() const
|
||||
{
|
||||
return true;
|
||||
|
@ -844,7 +875,7 @@ std::string ZTexture::GetSourceTypeName() const
|
|||
|
||||
void ZTexture::CalcHash()
|
||||
{
|
||||
auto parentRawData = parent->GetRawData();
|
||||
const auto& parentRawData = parent->GetRawData();
|
||||
hash = CRC32B(parentRawData.data() + rawDataIndex, GetRawDataSize());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,26 +30,28 @@ protected:
|
|||
ZTexture* tlut = nullptr;
|
||||
bool splitTlut;
|
||||
|
||||
void PrepareBitmapRGBA16();
|
||||
void PrepareBitmapRGBA32();
|
||||
void PrepareBitmapGrayscale8();
|
||||
void PrepareBitmapGrayscaleAlpha8();
|
||||
void PrepareBitmapGrayscale4();
|
||||
void PrepareBitmapGrayscaleAlpha4();
|
||||
void PrepareBitmapGrayscaleAlpha16();
|
||||
void PrepareBitmapPalette4();
|
||||
void PrepareBitmapPalette8();
|
||||
// The following functions convert from N64 binary data to a bitmap to be saved to a PNG.
|
||||
void ConvertN64ToBitmap_RGBA16();
|
||||
void ConvertN64ToBitmap_RGBA32();
|
||||
void ConvertN64ToBitmap_Grayscale8();
|
||||
void ConvertN64ToBitmap_GrayscaleAlpha8();
|
||||
void ConvertN64ToBitmap_Grayscale4();
|
||||
void ConvertN64ToBitmap_GrayscaleAlpha4();
|
||||
void ConvertN64ToBitmap_GrayscaleAlpha16();
|
||||
void ConvertN64ToBitmap_Palette4();
|
||||
void ConvertN64ToBitmap_Palette8();
|
||||
|
||||
// The following functions convert from a bitmap to N64 binary data.
|
||||
void PrepareRawDataFromFile(const fs::path& inFolder);
|
||||
void PrepareRawDataRGBA16();
|
||||
void PrepareRawDataRGBA32();
|
||||
void PrepareRawDataGrayscale4();
|
||||
void PrepareRawDataGrayscale8();
|
||||
void PrepareRawDataGrayscaleAlpha4();
|
||||
void PrepareRawDataGrayscaleAlpha8();
|
||||
void PrepareRawDataGrayscaleAlpha16();
|
||||
void PrepareRawDataPalette4();
|
||||
void PrepareRawDataPalette8();
|
||||
void ConvertBitmapToN64_RGBA16();
|
||||
void ConvertBitmapToN64_RGBA32();
|
||||
void ConvertBitmapToN64_Grayscale4();
|
||||
void ConvertBitmapToN64_Grayscale8();
|
||||
void ConvertBitmapToN64_GrayscaleAlpha4();
|
||||
void ConvertBitmapToN64_GrayscaleAlpha8();
|
||||
void ConvertBitmapToN64_GrayscaleAlpha16();
|
||||
void ConvertBitmapToN64_Palette4();
|
||||
void ConvertBitmapToN64_Palette8();
|
||||
|
||||
public:
|
||||
ZTexture(ZFile* nParent);
|
||||
|
@ -68,9 +70,15 @@ public:
|
|||
|
||||
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the hash of this texture, for use with the texture pool.
|
||||
/// </summary>
|
||||
void CalcHash() override;
|
||||
|
||||
void Save(const fs::path& outFolder) override;
|
||||
|
||||
std::string GetHeaderDefines() const;
|
||||
bool IsExternalResource() const override;
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
@ -83,10 +91,28 @@ public:
|
|||
uint32_t GetWidth() const;
|
||||
uint32_t GetHeight() const;
|
||||
void SetDimensions(uint32_t nWidth, uint32_t nHeight);
|
||||
|
||||
/// <summary>
|
||||
/// Returns how many bytes each pixel takes up.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
float GetPixelMultiplyer() const;
|
||||
|
||||
TextureType GetTextureType() const;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the path to the texture pool, taken from the config file.
|
||||
/// </summary>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
fs::path GetPoolOutPath(const fs::path& defaultValue);
|
||||
|
||||
/// <summary>
|
||||
/// Returns if this texture uses a palette.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsColorIndexed() const;
|
||||
|
||||
void SetTlut(ZTexture* nTlut);
|
||||
bool HasTlut() const;
|
||||
void ParseRawDataLate() override;
|
||||
|
|
|
@ -569,6 +569,7 @@ void ZTextureAnimation::DeclareReferences(const std::string& prefix)
|
|||
count = 2;
|
||||
}
|
||||
params = new TextureScrollingParams(parent);
|
||||
params->type = entry.type;
|
||||
params->ExtractFromBinary(paramsOffset, count);
|
||||
break;
|
||||
|
||||
|
@ -582,6 +583,7 @@ void ZTextureAnimation::DeclareReferences(const std::string& prefix)
|
|||
|
||||
case TextureAnimationParamsType::TextureCycle:
|
||||
params = new TextureCyclingParams(parent);
|
||||
params->type = entry.type;
|
||||
params->ExtractFromBinary(paramsOffset);
|
||||
break;
|
||||
|
||||
|
|
74
tools/ZAPD/ZAPD/ZWaterbox.cpp
Normal file
74
tools/ZAPD/ZAPD/ZWaterbox.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#include "ZWaterbox.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
REGISTER_ZFILENODE(Waterbox, ZWaterbox);
|
||||
|
||||
ZWaterbox::ZWaterbox(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
ZWaterbox::~ZWaterbox()
|
||||
{
|
||||
}
|
||||
|
||||
void ZWaterbox::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
xMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
|
||||
ySurface = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
|
||||
zMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
|
||||
xLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 6);
|
||||
zLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
|
||||
|
||||
if (Globals::Instance->game == ZGame::OOT_SW97)
|
||||
properties = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
|
||||
else
|
||||
properties = BitConverter::ToInt32BE(rawData, rawDataIndex + 12);
|
||||
}
|
||||
|
||||
void ZWaterbox::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string declaration;
|
||||
std::string auxName = name;
|
||||
|
||||
if (name == "")
|
||||
auxName = GetDefaultName(prefix);
|
||||
|
||||
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
|
||||
GetSourceTypeName(), name.c_str(), GetBodySourceCode());
|
||||
}
|
||||
|
||||
std::string ZWaterbox::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("%i, %i, %i, %i, %i, 0x%08X", xMin, ySurface, zMin, xLength,
|
||||
zLength, properties);
|
||||
}
|
||||
|
||||
std::string ZWaterbox::GetDefaultName(const std::string& prefix) const
|
||||
{
|
||||
return StringHelper::Sprintf("%sWaterBoxes_%06X", prefix.c_str(), rawDataIndex);
|
||||
}
|
||||
|
||||
ZResourceType ZWaterbox::GetResourceType() const
|
||||
{
|
||||
return ZResourceType::Waterbox;
|
||||
}
|
||||
|
||||
size_t ZWaterbox::GetRawDataSize() const
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
std::string ZWaterbox::GetSourceTypeName() const
|
||||
{
|
||||
return "WaterBox";
|
||||
}
|
||||
|
||||
bool ZWaterbox::DoesSupportArray() const
|
||||
{
|
||||
return true;
|
||||
}
|
30
tools/ZAPD/ZAPD/ZWaterbox.h
Normal file
30
tools/ZAPD/ZAPD/ZWaterbox.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include "ZFile.h"
|
||||
#include "ZResource.h"
|
||||
|
||||
class ZWaterbox : public ZResource
|
||||
{
|
||||
public:
|
||||
int16_t xMin;
|
||||
int16_t ySurface;
|
||||
int16_t zMin;
|
||||
int16_t xLength;
|
||||
int16_t zLength;
|
||||
int32_t properties;
|
||||
|
||||
ZWaterbox(ZFile* nParent);
|
||||
~ZWaterbox();
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
std::string GetBodySourceCode() const override;
|
||||
std::string GetDefaultName(const std::string& prefix) const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
bool DoesSupportArray() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
};
|
|
@ -10,7 +10,13 @@ parser.add_argument("--devel", action="store_true")
|
|||
args = parser.parse_args()
|
||||
|
||||
with open("build/ZAPD/BuildInfo.cpp", "w+") as buildFile:
|
||||
label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8")
|
||||
# Get commit hash from git
|
||||
# If git fails due to a missing .git directory, a default label will be used instead.
|
||||
try:
|
||||
label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8")
|
||||
except:
|
||||
label = "GIT_NOT_FOUND"
|
||||
|
||||
now = datetime.now()
|
||||
if args.devel:
|
||||
label += " ~ Development version"
|
||||
|
|
|
@ -17,7 +17,7 @@ clean:
|
|||
rm -rf build $(LIB)
|
||||
|
||||
format:
|
||||
clang-format-11 -i $(CPP_FILES) $(H_FILES)
|
||||
clang-format-14 -i $(CPP_FILES) $(H_FILES)
|
||||
|
||||
.PHONY: all clean format
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset);
|
||||
}
|
||||
return ((uint32_t)data.at(offset + 0) << 24) + ((uint32_t)data.at(offset + 1) << 16) +
|
||||
((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3);
|
||||
((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3);
|
||||
}
|
||||
|
||||
static inline uint32_t ToUInt32BE(const std::vector<uint8_t>& data, size_t offset)
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset);
|
||||
}
|
||||
return ((uint32_t)data.at(offset + 0) << 24) + ((uint32_t)data.at(offset + 1) << 16) +
|
||||
((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3);
|
||||
((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3);
|
||||
}
|
||||
|
||||
static inline int64_t ToInt64BE(const std::vector<uint8_t>& data, size_t offset)
|
||||
|
@ -102,9 +102,9 @@ public:
|
|||
fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset);
|
||||
}
|
||||
return ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) +
|
||||
((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) +
|
||||
((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) +
|
||||
((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7));
|
||||
((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) +
|
||||
((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) +
|
||||
((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7));
|
||||
}
|
||||
|
||||
static inline uint64_t ToUInt64BE(const std::vector<uint8_t>& data, size_t offset)
|
||||
|
@ -117,9 +117,9 @@ public:
|
|||
fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset);
|
||||
}
|
||||
return ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) +
|
||||
((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) +
|
||||
((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) +
|
||||
((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7));
|
||||
((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) +
|
||||
((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) +
|
||||
((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7));
|
||||
}
|
||||
|
||||
static inline float ToFloatBE(const std::vector<uint8_t>& data, size_t offset)
|
||||
|
@ -133,8 +133,8 @@ public:
|
|||
}
|
||||
float value;
|
||||
uint32_t floatData = ((uint32_t)data.at(offset + 0) << 24) +
|
||||
((uint32_t)data.at(offset + 1) << 16) +
|
||||
((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3);
|
||||
((uint32_t)data.at(offset + 1) << 16) +
|
||||
((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3);
|
||||
static_assert(sizeof(uint32_t) == sizeof(float), "expected 32-bit float");
|
||||
std::memcpy(&value, &floatData, sizeof(value));
|
||||
return value;
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#if __has_include(<filesystem>)
|
||||
#ifdef USE_BOOST_FS
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#elif __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
|
@ -17,9 +20,22 @@ namespace fs = std::experimental::filesystem;
|
|||
class Directory
|
||||
{
|
||||
public:
|
||||
static std::string GetCurrentDirectory() { return fs::current_path().u8string(); }
|
||||
#ifdef USE_BOOST_FS
|
||||
static std::string GetCurrentDirectory()
|
||||
{
|
||||
return fs::current_path().string();
|
||||
}
|
||||
#else
|
||||
static std::string GetCurrentDirectory()
|
||||
{
|
||||
return fs::current_path().u8string();
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool Exists(const fs::path& path) { return fs::exists(path); }
|
||||
static bool Exists(const fs::path& path)
|
||||
{
|
||||
return fs::exists(path);
|
||||
}
|
||||
|
||||
static void CreateDirectory(const std::string& path)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#ifdef USE_BOOST_FS
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#else
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Directory.h"
|
||||
|
@ -10,29 +13,38 @@
|
|||
|
||||
class File
|
||||
{
|
||||
#ifdef USE_BOOST_FS
|
||||
typedef fs::ifstream ifstream;
|
||||
typedef fs::ofstream ofstream;
|
||||
#else
|
||||
typedef std::ifstream ifstream;
|
||||
typedef std::ofstream ofstream;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static bool Exists(const fs::path& filePath)
|
||||
{
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
return file.good();
|
||||
}
|
||||
|
||||
static std::vector<uint8_t> ReadAllBytes(const fs::path& filePath)
|
||||
{
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
int32_t fileSize = (int32_t)file.tellg();
|
||||
file.seekg(0);
|
||||
char* data = new char[fileSize];
|
||||
file.read(data, fileSize);
|
||||
std::vector<uint8_t> result = std::vector<uint8_t>(data, data + fileSize);
|
||||
delete[] data;
|
||||
file.close();
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
static std::string ReadAllText(const fs::path& filePath)
|
||||
{
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
if (!file.is_open())
|
||||
return "";
|
||||
int32_t fileSize = (int32_t)file.tellg();
|
||||
|
@ -42,6 +54,7 @@ public:
|
|||
file.read(data, fileSize);
|
||||
std::string str = std::string((const char*)data);
|
||||
delete[] data;
|
||||
file.close();
|
||||
|
||||
return str;
|
||||
};
|
||||
|
@ -56,25 +69,29 @@ public:
|
|||
|
||||
static void WriteAllBytes(const fs::path& filePath, const std::vector<uint8_t>& data)
|
||||
{
|
||||
std::ofstream file(filePath, std::ios::binary);
|
||||
ofstream file(filePath, std::ios::binary);
|
||||
file.write((char*)data.data(), data.size());
|
||||
file.close();
|
||||
};
|
||||
|
||||
static void WriteAllBytes(const std::string& filePath, const std::vector<char>& data)
|
||||
{
|
||||
std::ofstream file(filePath, std::ios::binary);
|
||||
ofstream file(filePath, std::ios::binary);
|
||||
file.write((char*)data.data(), data.size());
|
||||
file.close();
|
||||
};
|
||||
|
||||
static void WriteAllBytes(const std::string& filePath, const char* data, int dataSize)
|
||||
{
|
||||
std::ofstream file(filePath, std::ios::binary);
|
||||
ofstream file(filePath, std::ios::binary);
|
||||
file.write((char*)data, dataSize);
|
||||
file.close();
|
||||
};
|
||||
|
||||
static void WriteAllText(const fs::path& filePath, const std::string& text)
|
||||
{
|
||||
std::ofstream file(filePath, std::ios::out);
|
||||
ofstream file(filePath, std::ios::out);
|
||||
file.write(text.c_str(), text.size());
|
||||
file.close();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
#include <string>
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
#if __has_include(<filesystem>)
|
||||
#ifdef USE_BOOST_FS
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#elif __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
|
|
|
@ -106,9 +106,35 @@ public:
|
|||
return std::all_of(str.begin(), str.end(), ::isdigit);
|
||||
}
|
||||
|
||||
static bool HasOnlyHexDigits(const std::string& str)
|
||||
static bool IsValidHex(std::string_view str)
|
||||
{
|
||||
return std::all_of(str.begin(), str.end(), ::isxdigit);
|
||||
if (str.length() < 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
|
||||
{
|
||||
return std::all_of(str.begin() + 2, str.end(), ::isxdigit);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsValidOffset(std::string_view str)
|
||||
{
|
||||
if (str.length() == 1)
|
||||
{
|
||||
// 0 is a valid offset
|
||||
return isdigit(str[0]);
|
||||
}
|
||||
|
||||
return IsValidHex(str);
|
||||
}
|
||||
|
||||
static bool IsValidHex(const std::string& str)
|
||||
{
|
||||
return IsValidHex(std::string_view(str.c_str()));
|
||||
}
|
||||
|
||||
static std::string ToUpper(const std::string& str)
|
||||
|
@ -123,4 +149,66 @@ public:
|
|||
return std::equal(a.begin(), a.end(), b.begin(), b.end(),
|
||||
[](char a, char b) { return tolower(a) == tolower(b); });
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a std::string formatted in camelCase into one in SCREAMING_SNAKE_CASE. Since this
|
||||
* will mostly be used on symbols that start with either 'g' or 's', an option is included to
|
||||
* skip these.
|
||||
*/
|
||||
static std::string camelCaseTo_SCREAMING_SNAKE_CASE(const std::string& in, bool skipSP)
|
||||
{
|
||||
std::string out = "";
|
||||
const char* ptr = in.c_str();
|
||||
char ch = *ptr;
|
||||
|
||||
// Switch checks for 'g'/'s'/'\0', looks at next character if skipSP enabled and string is
|
||||
// nonempty.
|
||||
switch (ch)
|
||||
{
|
||||
case 'g':
|
||||
case 's':
|
||||
if (skipSP)
|
||||
{
|
||||
// Print it anyway if the next character is lowercase, e.g. "gameplay_keep_...".
|
||||
if (!isupper(ptr[1]))
|
||||
{
|
||||
out.push_back(toupper(ch));
|
||||
}
|
||||
if ((ch = *++ptr) == '\0')
|
||||
{
|
||||
case '\0':
|
||||
// This is reached either by the if or the case label, avoiding duplication.
|
||||
return out;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
default:
|
||||
if (islower(ch))
|
||||
{
|
||||
out.push_back(toupper(ch));
|
||||
}
|
||||
else
|
||||
{
|
||||
out.push_back(ch);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
while ((ch = *++ptr) != '\0')
|
||||
{
|
||||
if (islower(ch))
|
||||
{
|
||||
out.push_back(toupper(ch));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isupper(ch) && !(isupper(ptr[1]) && isupper(ptr[-1])))
|
||||
{
|
||||
out.push_back('_');
|
||||
}
|
||||
out.push_back(ch);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
<ObjectList File="ObjectList_OoTMqDbg.txt"/>
|
||||
<EntranceList File="EntranceList_OoTMqDbg.txt"/>
|
||||
<SpecialEntranceList File="SpecialEntranceList_OoTMqDbg.txt"/>
|
||||
<EnumData File="EnumData.xml"/>
|
||||
<ExternalXMLFolder Path="assets/xml/"/>
|
||||
</Root>
|
||||
|
|
416
tools/ZAPDConfigs/MqDbg/EnumData.xml
Normal file
416
tools/ZAPDConfigs/MqDbg/EnumData.xml
Normal file
|
@ -0,0 +1,416 @@
|
|||
<Root>
|
||||
<Enum Games="OoTMqDbg" Key="cmd" ID="CutsceneCmd">
|
||||
<Item Key="cam_eye_spline" ID="CS_CMD_CAM_EYE_SPLINE" Index="1"/>
|
||||
<Item Key="cam_at_spline" ID="CS_CMD_CAM_AT_SPLINE" Index="2"/>
|
||||
<Item Key="misc" ID="CS_CMD_MISC" Index="3"/>
|
||||
<Item Key="light_setting" ID="CS_CMD_LIGHT_SETTING" Index="4"/>
|
||||
<Item Key="cam_eye_spline_rel_to_player" ID="CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER" Index="5"/>
|
||||
<Item Key="cam_at_spline_rel_to_player" ID="CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER" Index="6"/>
|
||||
<Item Key="cam_eye" ID="CS_CMD_CAM_EYE" Index="7"/>
|
||||
<Item Key="cam_at" ID="CS_CMD_CAM_AT" Index="8"/>
|
||||
<Item Key="rumble_controller" ID="CS_CMD_RUMBLE_CONTROLLER" Index="9"/>
|
||||
<Item Key="player_cue" ID="CS_CMD_PLAYER_CUE" Index="10"/>
|
||||
<Item Key="unimplemented_b" ID="CS_CMD_UNIMPLEMENTED_B" Index="11"/>
|
||||
<Item Key="unimplemented_d" ID="CS_CMD_UNIMPLEMENTED_D" Index="13"/>
|
||||
<Item Key="actor_cue_1_0" ID="CS_CMD_ACTOR_CUE_1_0" Index="14"/>
|
||||
<Item Key="actor_cue_0_0" ID="CS_CMD_ACTOR_CUE_0_0" Index="15"/>
|
||||
<Item Key="actor_cue_1_1" ID="CS_CMD_ACTOR_CUE_1_1" Index="16"/>
|
||||
<Item Key="actor_cue_0_1" ID="CS_CMD_ACTOR_CUE_0_1" Index="17"/>
|
||||
<Item Key="actor_cue_0_2" ID="CS_CMD_ACTOR_CUE_0_2" Index="18"/>
|
||||
<Item Key="text" ID="CS_CMD_TEXT" Index="19"/>
|
||||
<Item Key="unimplemented_15" ID="CS_CMD_UNIMPLEMENTED_15" Index="21"/>
|
||||
<Item Key="unimplemented_16" ID="CS_CMD_UNIMPLEMENTED_16" Index="22"/>
|
||||
<Item Key="actor_cue_0_3" ID="CS_CMD_ACTOR_CUE_0_3" Index="23"/>
|
||||
<Item Key="actor_cue_1_2" ID="CS_CMD_ACTOR_CUE_1_2" Index="24"/>
|
||||
<Item Key="actor_cue_2_0" ID="CS_CMD_ACTOR_CUE_2_0" Index="25"/>
|
||||
<Item Key="unimplemented_1b" ID="CS_CMD_UNIMPLEMENTED_1B" Index="27"/>
|
||||
<Item Key="unimplemented_1c" ID="CS_CMD_UNIMPLEMENTED_1C" Index="28"/>
|
||||
<Item Key="actor_cue_3_0" ID="CS_CMD_ACTOR_CUE_3_0" Index="29"/>
|
||||
<Item Key="actor_cue_4_0" ID="CS_CMD_ACTOR_CUE_4_0" Index="30"/>
|
||||
<Item Key="actor_cue_6_0" ID="CS_CMD_ACTOR_CUE_6_0" Index="31"/>
|
||||
<Item Key="unimplemented_20" ID="CS_CMD_UNIMPLEMENTED_20" Index="32"/>
|
||||
<Item Key="unimplemented_21" ID="CS_CMD_UNIMPLEMENTED_21" Index="33"/>
|
||||
<Item Key="actor_cue_0_4" ID="CS_CMD_ACTOR_CUE_0_4" Index="34"/>
|
||||
<Item Key="actor_cue_1_3" ID="CS_CMD_ACTOR_CUE_1_3" Index="35"/>
|
||||
<Item Key="actor_cue_2_1" ID="CS_CMD_ACTOR_CUE_2_1" Index="36"/>
|
||||
<Item Key="actor_cue_3_1" ID="CS_CMD_ACTOR_CUE_3_1" Index="37"/>
|
||||
<Item Key="actor_cue_4_1" ID="CS_CMD_ACTOR_CUE_4_1" Index="38"/>
|
||||
<Item Key="actor_cue_0_5" ID="CS_CMD_ACTOR_CUE_0_5" Index="39"/>
|
||||
<Item Key="actor_cue_1_4" ID="CS_CMD_ACTOR_CUE_1_4" Index="40"/>
|
||||
<Item Key="actor_cue_2_2" ID="CS_CMD_ACTOR_CUE_2_2" Index="41"/>
|
||||
<Item Key="actor_cue_3_2" ID="CS_CMD_ACTOR_CUE_3_2" Index="42"/>
|
||||
<Item Key="actor_cue_4_2" ID="CS_CMD_ACTOR_CUE_4_2" Index="43"/>
|
||||
<Item Key="actor_cue_5_0" ID="CS_CMD_ACTOR_CUE_5_0" Index="44"/>
|
||||
<Item Key="transition" ID="CS_CMD_TRANSITION" Index="45"/>
|
||||
<Item Key="actor_cue_0_6" ID="CS_CMD_ACTOR_CUE_0_6" Index="46"/>
|
||||
<Item Key="actor_cue_4_3" ID="CS_CMD_ACTOR_CUE_4_3" Index="47"/>
|
||||
<Item Key="actor_cue_1_5" ID="CS_CMD_ACTOR_CUE_1_5" Index="48"/>
|
||||
<Item Key="actor_cue_7_0" ID="CS_CMD_ACTOR_CUE_7_0" Index="49"/>
|
||||
<Item Key="actor_cue_2_3" ID="CS_CMD_ACTOR_CUE_2_3" Index="50"/>
|
||||
<Item Key="actor_cue_3_3" ID="CS_CMD_ACTOR_CUE_3_3" Index="51"/>
|
||||
<Item Key="actor_cue_6_1" ID="CS_CMD_ACTOR_CUE_6_1" Index="52"/>
|
||||
<Item Key="actor_cue_3_4" ID="CS_CMD_ACTOR_CUE_3_4" Index="53"/>
|
||||
<Item Key="actor_cue_4_4" ID="CS_CMD_ACTOR_CUE_4_4" Index="54"/>
|
||||
<Item Key="actor_cue_5_1" ID="CS_CMD_ACTOR_CUE_5_1" Index="55"/>
|
||||
<Item Key="actor_cue_6_2" ID="CS_CMD_ACTOR_CUE_6_2" Index="57"/>
|
||||
<Item Key="actor_cue_6_3" ID="CS_CMD_ACTOR_CUE_6_3" Index="58"/>
|
||||
<Item Key="unimplemented_3b" ID="CS_CMD_UNIMPLEMENTED_3B" Index="59"/>
|
||||
<Item Key="actor_cue_7_1" ID="CS_CMD_ACTOR_CUE_7_1" Index="60"/>
|
||||
<Item Key="unimplemented_3d" ID="CS_CMD_UNIMPLEMENTED_3D" Index="61"/>
|
||||
<Item Key="actor_cue_8_0" ID="CS_CMD_ACTOR_CUE_8_0" Index="62"/>
|
||||
<Item Key="actor_cue_3_5" ID="CS_CMD_ACTOR_CUE_3_5" Index="63"/>
|
||||
<Item Key="actor_cue_1_6" ID="CS_CMD_ACTOR_CUE_1_6" Index="64"/>
|
||||
<Item Key="actor_cue_3_6" ID="CS_CMD_ACTOR_CUE_3_6" Index="65"/>
|
||||
<Item Key="actor_cue_3_7" ID="CS_CMD_ACTOR_CUE_3_7" Index="66"/>
|
||||
<Item Key="actor_cue_2_4" ID="CS_CMD_ACTOR_CUE_2_4" Index="67"/>
|
||||
<Item Key="actor_cue_1_7" ID="CS_CMD_ACTOR_CUE_1_7" Index="68"/>
|
||||
<Item Key="actor_cue_2_5" ID="CS_CMD_ACTOR_CUE_2_5" Index="69"/>
|
||||
<Item Key="actor_cue_1_8" ID="CS_CMD_ACTOR_CUE_1_8" Index="70"/>
|
||||
<Item Key="unimplemented_47" ID="CS_CMD_UNIMPLEMENTED_47" Index="71"/>
|
||||
<Item Key="actor_cue_2_6" ID="CS_CMD_ACTOR_CUE_2_6" Index="72"/>
|
||||
<Item Key="unimplemented_49" ID="CS_CMD_UNIMPLEMENTED_49" Index="73"/>
|
||||
<Item Key="actor_cue_2_7" ID="CS_CMD_ACTOR_CUE_2_7" Index="74"/>
|
||||
<Item Key="actor_cue_3_8" ID="CS_CMD_ACTOR_CUE_3_8" Index="75"/>
|
||||
<Item Key="actor_cue_0_7" ID="CS_CMD_ACTOR_CUE_0_7" Index="76"/>
|
||||
<Item Key="actor_cue_5_2" ID="CS_CMD_ACTOR_CUE_5_2" Index="77"/>
|
||||
<Item Key="actor_cue_1_9" ID="CS_CMD_ACTOR_CUE_1_9" Index="78"/>
|
||||
<Item Key="actor_cue_4_5" ID="CS_CMD_ACTOR_CUE_4_5" Index="79"/>
|
||||
<Item Key="actor_cue_1_10" ID="CS_CMD_ACTOR_CUE_1_10" Index="80"/>
|
||||
<Item Key="actor_cue_2_8" ID="CS_CMD_ACTOR_CUE_2_8" Index="81"/>
|
||||
<Item Key="actor_cue_3_9" ID="CS_CMD_ACTOR_CUE_3_9" Index="82"/>
|
||||
<Item Key="actor_cue_4_6" ID="CS_CMD_ACTOR_CUE_4_6" Index="83"/>
|
||||
<Item Key="actor_cue_5_3" ID="CS_CMD_ACTOR_CUE_5_3" Index="84"/>
|
||||
<Item Key="actor_cue_0_8" ID="CS_CMD_ACTOR_CUE_0_8" Index="85"/>
|
||||
<Item Key="start_seq" ID="CS_CMD_START_SEQ" Index="86"/>
|
||||
<Item Key="stop_seq" ID="CS_CMD_STOP_SEQ" Index="87"/>
|
||||
<Item Key="actor_cue_6_4" ID="CS_CMD_ACTOR_CUE_6_4" Index="88"/>
|
||||
<Item Key="actor_cue_7_2" ID="CS_CMD_ACTOR_CUE_7_2" Index="89"/>
|
||||
<Item Key="actor_cue_5_4" ID="CS_CMD_ACTOR_CUE_5_4" Index="90"/>
|
||||
<Item Key="actor_cue_0_9" ID="CS_CMD_ACTOR_CUE_0_9" Index="93"/>
|
||||
<Item Key="actor_cue_1_11" ID="CS_CMD_ACTOR_CUE_1_11" Index="94"/>
|
||||
<Item Key="actor_cue_0_10" ID="CS_CMD_ACTOR_CUE_0_10" Index="105"/>
|
||||
<Item Key="actor_cue_2_9" ID="CS_CMD_ACTOR_CUE_2_9" Index="106"/>
|
||||
<Item Key="actor_cue_0_11" ID="CS_CMD_ACTOR_CUE_0_11" Index="107"/>
|
||||
<Item Key="actor_cue_3_10" ID="CS_CMD_ACTOR_CUE_3_10" Index="108"/>
|
||||
<Item Key="unimplemented_6d" ID="CS_CMD_UNIMPLEMENTED_6D" Index="109"/>
|
||||
<Item Key="actor_cue_0_12" ID="CS_CMD_ACTOR_CUE_0_12" Index="110"/>
|
||||
<Item Key="actor_cue_7_3" ID="CS_CMD_ACTOR_CUE_7_3" Index="111"/>
|
||||
<Item Key="unimplemented_70" ID="CS_CMD_UNIMPLEMENTED_70" Index="112"/>
|
||||
<Item Key="unimplemented_71" ID="CS_CMD_UNIMPLEMENTED_71" Index="113"/>
|
||||
<Item Key="actor_cue_7_4" ID="CS_CMD_ACTOR_CUE_7_4" Index="114"/>
|
||||
<Item Key="actor_cue_6_5" ID="CS_CMD_ACTOR_CUE_6_5" Index="115"/>
|
||||
<Item Key="actor_cue_1_12" ID="CS_CMD_ACTOR_CUE_1_12" Index="116"/>
|
||||
<Item Key="actor_cue_2_10" ID="CS_CMD_ACTOR_CUE_2_10" Index="117"/>
|
||||
<Item Key="actor_cue_1_13" ID="CS_CMD_ACTOR_CUE_1_13" Index="118"/>
|
||||
<Item Key="actor_cue_0_13" ID="CS_CMD_ACTOR_CUE_0_13" Index="119"/>
|
||||
<Item Key="actor_cue_1_14" ID="CS_CMD_ACTOR_CUE_1_14" Index="120"/>
|
||||
<Item Key="actor_cue_2_11" ID="CS_CMD_ACTOR_CUE_2_11" Index="121"/>
|
||||
<Item Key="actor_cue_0_14" ID="CS_CMD_ACTOR_CUE_0_14" Index="123"/>
|
||||
<Item Key="fade_out_seq" ID="CS_CMD_FADE_OUT_SEQ" Index="124"/>
|
||||
<Item Key="actor_cue_1_15" ID="CS_CMD_ACTOR_CUE_1_15" Index="125"/>
|
||||
<Item Key="actor_cue_2_12" ID="CS_CMD_ACTOR_CUE_2_12" Index="126"/>
|
||||
<Item Key="actor_cue_3_11" ID="CS_CMD_ACTOR_CUE_3_11" Index="127"/>
|
||||
<Item Key="actor_cue_4_7" ID="CS_CMD_ACTOR_CUE_4_7" Index="128"/>
|
||||
<Item Key="actor_cue_5_5" ID="CS_CMD_ACTOR_CUE_5_5" Index="129"/>
|
||||
<Item Key="actor_cue_6_6" ID="CS_CMD_ACTOR_CUE_6_6" Index="130"/>
|
||||
<Item Key="actor_cue_1_16" ID="CS_CMD_ACTOR_CUE_1_16" Index="131"/>
|
||||
<Item Key="actor_cue_2_13" ID="CS_CMD_ACTOR_CUE_2_13" Index="132"/>
|
||||
<Item Key="actor_cue_3_12" ID="CS_CMD_ACTOR_CUE_3_12" Index="133"/>
|
||||
<Item Key="actor_cue_7_5" ID="CS_CMD_ACTOR_CUE_7_5" Index="134"/>
|
||||
<Item Key="actor_cue_4_8" ID="CS_CMD_ACTOR_CUE_4_8" Index="135"/>
|
||||
<Item Key="actor_cue_5_6" ID="CS_CMD_ACTOR_CUE_5_6" Index="136"/>
|
||||
<Item Key="actor_cue_6_7" ID="CS_CMD_ACTOR_CUE_6_7" Index="137"/>
|
||||
<Item Key="actor_cue_0_15" ID="CS_CMD_ACTOR_CUE_0_15" Index="138"/>
|
||||
<Item Key="actor_cue_0_16" ID="CS_CMD_ACTOR_CUE_0_16" Index="139"/>
|
||||
<Item Key="time" ID="CS_CMD_TIME" Index="140"/>
|
||||
<Item Key="actor_cue_1_17" ID="CS_CMD_ACTOR_CUE_1_17" Index="141"/>
|
||||
<Item Key="actor_cue_7_6" ID="CS_CMD_ACTOR_CUE_7_6" Index="142"/>
|
||||
<Item Key="actor_cue_9_0" ID="CS_CMD_ACTOR_CUE_9_0" Index="143"/>
|
||||
<Item Key="actor_cue_0_17" ID="CS_CMD_ACTOR_CUE_0_17" Index="144"/>
|
||||
<Item Key="destination" ID="CS_CMD_DESTINATION" Index="1000"/>
|
||||
<Item Key="end" ID="CS_CMD_END" Index="65535"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="miscType" ID="CutsceneMiscType">
|
||||
<Item Key="unimplemented_0" ID="CS_MISC_UNIMPLEMENTED_0" Index="0"/>
|
||||
<Item Key="rain" ID="CS_MISC_RAIN" Index="1"/>
|
||||
<Item Key="lightning" ID="CS_MISC_LIGHTNING" Index="2"/>
|
||||
<Item Key="set_csflag_0" ID="CS_MISC_SET_CSFLAG_0" Index="3"/>
|
||||
<Item Key="unimplemented_4" ID="CS_MISC_UNIMPLEMENTED_4" Index="4"/>
|
||||
<Item Key="unimplemented_5" ID="CS_MISC_UNIMPLEMENTED_5" Index="5"/>
|
||||
<Item Key="lift_fog" ID="CS_MISC_LIFT_FOG" Index="6"/>
|
||||
<Item Key="cloudy_sky" ID="CS_MISC_CLOUDY_SKY" Index="7"/>
|
||||
<Item Key="fade_kokiri_grass_env_alpha" ID="CS_MISC_FADE_KOKIRI_GRASS_ENV_ALPHA" Index="8"/>
|
||||
<Item Key="snow" ID="CS_MISC_SNOW" Index="9"/>
|
||||
<Item Key="set_csflag_1" ID="CS_MISC_SET_CSFLAG_1" Index="10"/>
|
||||
<Item Key="deku_tree_death" ID="CS_MISC_DEKU_TREE_DEATH" Index="11"/>
|
||||
<Item Key="stop_cutscene" ID="CS_MISC_STOP_CUTSCENE" Index="12"/>
|
||||
<Item Key="triforce_flash" ID="CS_MISC_TRIFORCE_FLASH" Index="13"/>
|
||||
<Item Key="set_locked_viewpoint" ID="CS_MISC_SET_LOCKED_VIEWPOINT" Index="14"/>
|
||||
<Item Key="show_title_card" ID="CS_MISC_SHOW_TITLE_CARD" Index="15"/>
|
||||
<Item Key="quake_start" ID="CS_MISC_QUAKE_START" Index="16"/>
|
||||
<Item Key="quake_stop" ID="CS_MISC_QUAKE_STOP" Index="17"/>
|
||||
<Item Key="stop_storm_and_advance_to_day" ID="CS_MISC_STOP_STORM_AND_ADVANCE_TO_DAY" Index="18"/>
|
||||
<Item Key="set_flag_fast_windmill" ID="CS_MISC_SET_FLAG_FAST_WINDMILL" Index="19"/>
|
||||
<Item Key="set_flag_well_drained" ID="CS_MISC_SET_FLAG_WELL_DRAINED" Index="20"/>
|
||||
<Item Key="set_flag_lake_hylia_restored" ID="CS_MISC_SET_FLAG_LAKE_HYLIA_RESTORED" Index="21"/>
|
||||
<Item Key="vismono_black_and_white" ID="CS_MISC_VISMONO_BLACK_AND_WHITE" Index="22"/>
|
||||
<Item Key="vismono_sepia" ID="CS_MISC_VISMONO_SEPIA" Index="23"/>
|
||||
<Item Key="hide_room" ID="CS_MISC_HIDE_ROOM" Index="24"/>
|
||||
<Item Key="time_advance_to_night" ID="CS_MISC_TIME_ADVANCE_TO_NIGHT" Index="25"/>
|
||||
<Item Key="set_time_based_light_setting" ID="CS_MISC_SET_TIME_BASED_LIGHT_SETTING" Index="26"/>
|
||||
<Item Key="red_pulsating_lights" ID="CS_MISC_RED_PULSATING_LIGHTS" Index="27"/>
|
||||
<Item Key="halt_all_actors" ID="CS_MISC_HALT_ALL_ACTORS" Index="28"/>
|
||||
<Item Key="resume_all_actors" ID="CS_MISC_RESUME_ALL_ACTORS" Index="29"/>
|
||||
<Item Key="set_csflag_3" ID="CS_MISC_SET_CSFLAG_3" Index="30"/>
|
||||
<Item Key="set_csflag_4" ID="CS_MISC_SET_CSFLAG_4" Index="31"/>
|
||||
<Item Key="sandstorm_fill" ID="CS_MISC_SANDSTORM_FILL" Index="32"/>
|
||||
<Item Key="sunssong_start" ID="CS_MISC_SUNSSONG_START" Index="33"/>
|
||||
<Item Key="freeze_time" ID="CS_MISC_FREEZE_TIME" Index="34"/>
|
||||
<Item Key="long_scarecrow_song" ID="CS_MISC_LONG_SCARECROW_SONG" Index="35"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="textType" ID="CutsceneTextType">
|
||||
<Item Key="normal" ID="CS_TEXT_NORMAL" Index="0"/>
|
||||
<Item Key="choice" ID="CS_TEXT_CHOICE" Index="1"/>
|
||||
<Item Key="ocarina_action" ID="CS_TEXT_OCARINA_ACTION" Index="2"/>
|
||||
<Item Key="goron_ruby" ID="CS_TEXT_GORON_RUBY" Index="3"/>
|
||||
<Item Key="zora_sapphire" ID="CS_TEXT_ZORA_SAPPHIRE" Index="4"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="fadeOutSeqPlayer" ID="CutsceneFadeOutSeqPlayer">
|
||||
<Item Key="fade_out_fanfare" ID="CS_FADE_OUT_FANFARE" Index="3"/>
|
||||
<Item Key="fade_out_bgm_main" ID="CS_FADE_OUT_BGM_MAIN" Index="4"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="transitionType" ID="CutsceneTransitionType">
|
||||
<Item Key="gray_fill_in" ID="CS_TRANS_GRAY_FILL_IN" Index="1"/>
|
||||
<Item Key="blue_fill_in" ID="CS_TRANS_BLUE_FILL_IN" Index="2"/>
|
||||
<Item Key="red_fill_out" ID="CS_TRANS_RED_FILL_OUT" Index="3"/>
|
||||
<Item Key="green_fill_out" ID="CS_TRANS_GREEN_FILL_OUT" Index="4"/>
|
||||
<Item Key="gray_fill_out" ID="CS_TRANS_GRAY_FILL_OUT" Index="5"/>
|
||||
<Item Key="blue_fill_out" ID="CS_TRANS_BLUE_FILL_OUT" Index="6"/>
|
||||
<Item Key="red_fill_in" ID="CS_TRANS_RED_FILL_IN" Index="7"/>
|
||||
<Item Key="green_fill_in" ID="CS_TRANS_GREEN_FILL_IN" Index="8"/>
|
||||
<Item Key="trigger_instance" ID="CS_TRANS_TRIGGER_INSTANCE" Index="9"/>
|
||||
<Item Key="black_fill_out" ID="CS_TRANS_BLACK_FILL_OUT" Index="10"/>
|
||||
<Item Key="black_fill_in" ID="CS_TRANS_BLACK_FILL_IN" Index="11"/>
|
||||
<Item Key="black_fill_out_to_half" ID="CS_TRANS_BLACK_FILL_OUT_TO_HALF" Index="12"/>
|
||||
<Item Key="black_fill_in_from_half" ID="CS_TRANS_BLACK_FILL_IN_FROM_HALF" Index="13"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="destination" ID="CutsceneDestination">
|
||||
<Item Key="unimplemented_0" ID="CS_DEST_UNIMPLEMENTED_0" Index="0"/>
|
||||
<Item Key="cutscene_map_ganon_horse" ID="CS_DEST_CUTSCENE_MAP_GANON_HORSE" Index="1"/>
|
||||
<Item Key="cutscene_map_three_goddesses" ID="CS_DEST_CUTSCENE_MAP_THREE_GODDESSES" Index="2"/>
|
||||
<Item Key="gerudo_valley_din_part_1" ID="CS_DEST_GERUDO_VALLEY_DIN_PART_1" Index="3"/>
|
||||
<Item Key="death_mountain_trail_nayru" ID="CS_DEST_DEATH_MOUNTAIN_TRAIL_NAYRU" Index="4"/>
|
||||
<Item Key="kokiri_forest_farore" ID="CS_DEST_KOKIRI_FOREST_FARORE" Index="5"/>
|
||||
<Item Key="cutscene_map_triforce_creation" ID="CS_DEST_CUTSCENE_MAP_TRIFORCE_CREATION" Index="6"/>
|
||||
<Item Key="kokiri_forest_receive_kokiri_emerald" ID="CS_DEST_KOKIRI_FOREST_RECEIVE_KOKIRI_EMERALD" Index="7"/>
|
||||
<Item Key="temple_of_time_from_master_sword" ID="CS_DEST_TEMPLE_OF_TIME_FROM_MASTER_SWORD" Index="8"/>
|
||||
<Item Key="gerudo_valley_din_part_2" ID="CS_DEST_GERUDO_VALLEY_DIN_PART_2" Index="9"/>
|
||||
<Item Key="links_house_intro" ID="CS_DEST_LINKS_HOUSE_INTRO" Index="10"/>
|
||||
<Item Key="kokiri_forest_intro" ID="CS_DEST_KOKIRI_FOREST_INTRO" Index="11"/>
|
||||
<Item Key="death_mountain_trail_from_goron_ruby" ID="CS_DEST_DEATH_MOUNTAIN_TRAIL_FROM_GORON_RUBY" Index="12"/>
|
||||
<Item Key="zoras_fountain_from_zoras_sapphire" ID="CS_DEST_ZORAS_FOUNTAIN_FROM_ZORAS_SAPPHIRE" Index="13"/>
|
||||
<Item Key="kokiri_forest_from_kokiri_emerald" ID="CS_DEST_KOKIRI_FOREST_FROM_KOKIRI_EMERALD" Index="14"/>
|
||||
<Item Key="temple_of_time_kokiri_emerald_restored" ID="CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED" Index="15"/>
|
||||
<Item Key="temple_of_time_goron_ruby_restored" ID="CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED" Index="16"/>
|
||||
<Item Key="temple_of_time_zoras_sapphire_restored" ID="CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED" Index="17"/>
|
||||
<Item Key="temple_of_time_after_light_medallion" ID="CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION" Index="18"/>
|
||||
<Item Key="death_mountain_trail" ID="CS_DEST_DEATH_MOUNTAIN_TRAIL" Index="19"/>
|
||||
<Item Key="unimplemented_14" ID="CS_DEST_UNIMPLEMENTED_14" Index="20"/>
|
||||
<Item Key="lake_hylia_water_restored" ID="CS_DEST_LAKE_HYLIA_WATER_RESTORED" Index="21"/>
|
||||
<Item Key="desert_colossus_requiem" ID="CS_DEST_DESERT_COLOSSUS_REQUIEM" Index="22"/>
|
||||
<Item Key="cutscene_map_ganondorf_defeated_credits" ID="CS_DEST_CUTSCENE_MAP_GANONDORF_DEFEATED_CREDITS" Index="23"/>
|
||||
<Item Key="jabu_jabu" ID="CS_DEST_JABU_JABU" Index="24"/>
|
||||
<Item Key="chamber_of_sages_light_medallion" ID="CS_DEST_CHAMBER_OF_SAGES_LIGHT_MEDALLION" Index="25"/>
|
||||
<Item Key="temple_of_time_kokiri_emerald_restored_2" ID="CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED_2" Index="26"/>
|
||||
<Item Key="temple_of_time_goron_ruby_restored_2" ID="CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED_2" Index="27"/>
|
||||
<Item Key="temple_of_time_zoras_sapphire_restored_2" ID="CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED_2" Index="28"/>
|
||||
<Item Key="chamber_of_sages_forest_medallion" ID="CS_DEST_CHAMBER_OF_SAGES_FOREST_MEDALLION" Index="29"/>
|
||||
<Item Key="chamber_of_sages_fire_medallion" ID="CS_DEST_CHAMBER_OF_SAGES_FIRE_MEDALLION" Index="30"/>
|
||||
<Item Key="chamber_of_sages_water_medallion" ID="CS_DEST_CHAMBER_OF_SAGES_WATER_MEDALLION" Index="31"/>
|
||||
<Item Key="hyrule_field_flashback" ID="CS_DEST_HYRULE_FIELD_FLASHBACK" Index="32"/>
|
||||
<Item Key="hyrule_field_from_zelda_escape" ID="CS_DEST_HYRULE_FIELD_FROM_ZELDA_ESCAPE" Index="33"/>
|
||||
<Item Key="cutscene_map_ganondorf_from_master_sword" ID="CS_DEST_CUTSCENE_MAP_GANONDORF_FROM_MASTER_SWORD" Index="34"/>
|
||||
<Item Key="hyrule_field_intro_dream" ID="CS_DEST_HYRULE_FIELD_INTRO_DREAM" Index="35"/>
|
||||
<Item Key="unimplemented_24" ID="CS_DEST_UNIMPLEMENTED_24" Index="36"/>
|
||||
<Item Key="unimplemented_25" ID="CS_DEST_UNIMPLEMENTED_25" Index="37"/>
|
||||
<Item Key="cutscene_map_sheikah_legend" ID="CS_DEST_CUTSCENE_MAP_SHEIKAH_LEGEND" Index="38"/>
|
||||
<Item Key="temple_of_time_zelda_reveal" ID="CS_DEST_TEMPLE_OF_TIME_ZELDA_REVEAL" Index="39"/>
|
||||
<Item Key="temple_of_time_get_light_arrows" ID="CS_DEST_TEMPLE_OF_TIME_GET_LIGHT_ARROWS" Index="40"/>
|
||||
<Item Key="lake_hylia_from_lake_restored" ID="CS_DEST_LAKE_HYLIA_FROM_LAKE_RESTORED" Index="41"/>
|
||||
<Item Key="kakariko_village_drain_well" ID="CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL" Index="42"/>
|
||||
<Item Key="windmill_from_well_drained" ID="CS_DEST_WINDMILL_FROM_WELL_DRAINED" Index="43"/>
|
||||
<Item Key="temple_of_time_from_all_stones_restored" ID="CS_DEST_TEMPLE_OF_TIME_FROM_ALL_STONES_RESTORED" Index="44"/>
|
||||
<Item Key="unimplemented_2d" ID="CS_DEST_UNIMPLEMENTED_2D" Index="45"/>
|
||||
<Item Key="temple_of_time_after_light_medallion_alt" ID="CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT" Index="46"/>
|
||||
<Item Key="kakariko_village_nocturne_part_2" ID="CS_DEST_KAKARIKO_VILLAGE_NOCTURNE_PART_2" Index="47"/>
|
||||
<Item Key="desert_colossus_from_requiem" ID="CS_DEST_DESERT_COLOSSUS_FROM_REQUIEM" Index="48"/>
|
||||
<Item Key="temple_of_time_from_light_arrows" ID="CS_DEST_TEMPLE_OF_TIME_FROM_LIGHT_ARROWS" Index="49"/>
|
||||
<Item Key="kakariko_village_from_nocturne" ID="CS_DEST_KAKARIKO_VILLAGE_FROM_NOCTURNE" Index="50"/>
|
||||
<Item Key="hyrule_field_from_zeldas_courtyard" ID="CS_DEST_HYRULE_FIELD_FROM_ZELDAS_COURTYARD" Index="51"/>
|
||||
<Item Key="temple_of_time_song_of_time" ID="CS_DEST_TEMPLE_OF_TIME_SONG_OF_TIME" Index="52"/>
|
||||
<Item Key="hyrule_field_from_song_of_time" ID="CS_DEST_HYRULE_FIELD_FROM_SONG_OF_TIME" Index="53"/>
|
||||
<Item Key="gerudo_valley_credits" ID="CS_DEST_GERUDO_VALLEY_CREDITS" Index="54"/>
|
||||
<Item Key="gerudo_fortress_credits" ID="CS_DEST_GERUDO_FORTRESS_CREDITS" Index="55"/>
|
||||
<Item Key="kakariko_village_credits" ID="CS_DEST_KAKARIKO_VILLAGE_CREDITS" Index="56"/>
|
||||
<Item Key="death_mountain_trail_credits_part_1" ID="CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_1" Index="57"/>
|
||||
<Item Key="goron_city_credits" ID="CS_DEST_GORON_CITY_CREDITS" Index="58"/>
|
||||
<Item Key="lake_hylia_credits" ID="CS_DEST_LAKE_HYLIA_CREDITS" Index="59"/>
|
||||
<Item Key="zoras_fountain_credits crashes" ID="CS_DEST_ZORAS_FOUNTAIN_CREDITS crashes" Index="60"/>
|
||||
<Item Key="zoras_domain_credits" ID="CS_DEST_ZORAS_DOMAIN_CREDITS" Index="61"/>
|
||||
<Item Key="kokiri_forest_credits_part_1" ID="CS_DEST_KOKIRI_FOREST_CREDITS_PART_1" Index="62"/>
|
||||
<Item Key="kokiri_forest_credits_part_2" ID="CS_DEST_KOKIRI_FOREST_CREDITS_PART_2" Index="63"/>
|
||||
<Item Key="hyrule_field_credits" ID="CS_DEST_HYRULE_FIELD_CREDITS" Index="64"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_1_alt" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_1_ALT" Index="65"/>
|
||||
<Item Key="kakariko_village_from_trail_owl" ID="CS_DEST_KAKARIKO_VILLAGE_FROM_TRAIL_OWL" Index="66"/>
|
||||
<Item Key="hyrule_field_from_lake_hylia_owl" ID="CS_DEST_HYRULE_FIELD_FROM_LAKE_HYLIA_OWL" Index="67"/>
|
||||
<Item Key="cutscene_map_deku_sprout_part_2" ID="CS_DEST_CUTSCENE_MAP_DEKU_SPROUT_PART_2" Index="68"/>
|
||||
<Item Key="kokiri_forest_deku_sprout_part_3" ID="CS_DEST_KOKIRI_FOREST_DEKU_SPROUT_PART_3" Index="69"/>
|
||||
<Item Key="death_mountain_trail_credits_part_2" ID="CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_2" Index="70"/>
|
||||
<Item Key="temple_of_time_credits" ID="CS_DEST_TEMPLE_OF_TIME_CREDITS" Index="71"/>
|
||||
<Item Key="zeldas_courtyard_credits" ID="CS_DEST_ZELDAS_COURTYARD_CREDITS" Index="72"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_1" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_1" Index="73"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_2" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_2" Index="74"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_3" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_3" Index="75"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_4" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_4" Index="76"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_5" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_5" Index="77"/>
|
||||
<Item Key="lon_lon_ranch_credits_part_6" ID="CS_DEST_LON_LON_RANCH_CREDITS_PART_6" Index="78"/>
|
||||
<Item Key="lon_lon_ranch_1" ID="CS_DEST_LON_LON_RANCH_1" Index="79"/>
|
||||
<Item Key="lon_lon_ranch_2" ID="CS_DEST_LON_LON_RANCH_2" Index="80"/>
|
||||
<Item Key="lon_lon_ranch_3" ID="CS_DEST_LON_LON_RANCH_3" Index="81"/>
|
||||
<Item Key="lon_lon_ranch_4" ID="CS_DEST_LON_LON_RANCH_4" Index="82"/>
|
||||
<Item Key="lon_lon_ranch_5" ID="CS_DEST_LON_LON_RANCH_5" Index="83"/>
|
||||
<Item Key="lon_lon_ranch_6" ID="CS_DEST_LON_LON_RANCH_6" Index="84"/>
|
||||
<Item Key="lon_lon_ranch_7" ID="CS_DEST_LON_LON_RANCH_7" Index="85"/>
|
||||
<Item Key="lon_lon_ranch_8" ID="CS_DEST_LON_LON_RANCH_8" Index="86"/>
|
||||
<Item Key="lon_lon_ranch_9" ID="CS_DEST_LON_LON_RANCH_9" Index="87"/>
|
||||
<Item Key="lon_lon_ranch_10" ID="CS_DEST_LON_LON_RANCH_10" Index="88"/>
|
||||
<Item Key="lon_lon_ranch_11" ID="CS_DEST_LON_LON_RANCH_11" Index="89"/>
|
||||
<Item Key="lon_lon_ranch_12" ID="CS_DEST_LON_LON_RANCH_12" Index="90"/>
|
||||
<Item Key="lon_lon_ranch_13" ID="CS_DEST_LON_LON_RANCH_13" Index="91"/>
|
||||
<Item Key="lon_lon_ranch_14" ID="CS_DEST_LON_LON_RANCH_14" Index="92"/>
|
||||
<Item Key="lon_lon_ranch_15" ID="CS_DEST_LON_LON_RANCH_15" Index="93"/>
|
||||
<Item Key="lon_lon_ranch_from_eponas_song" ID="CS_DEST_LON_LON_RANCH_FROM_EPONAS_SONG" Index="94"/>
|
||||
<Item Key="stones_restored_conditional" ID="CS_DEST_STONES_RESTORED_CONDITIONAL" Index="95"/>
|
||||
<Item Key="desert_colossus_from_chamber_of_sages" ID="CS_DEST_DESERT_COLOSSUS_FROM_CHAMBER_OF_SAGES" Index="96"/>
|
||||
<Item Key="graveyard_from_chamber_of_sages" ID="CS_DEST_GRAVEYARD_FROM_CHAMBER_OF_SAGES" Index="97"/>
|
||||
<Item Key="death_mountain_crater_from_chamber_of_sages" ID="CS_DEST_DEATH_MOUNTAIN_CRATER_FROM_CHAMBER_OF_SAGES" Index="98"/>
|
||||
<Item Key="sacred_forest_meadow_warp_pad" ID="CS_DEST_SACRED_FOREST_MEADOW_WARP_PAD" Index="99"/>
|
||||
<Item Key="kokiri_forest_from_chamber_of_sages" ID="CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES" Index="100"/>
|
||||
<Item Key="desert_colossus_from_nabooru_capture" ID="CS_DEST_DESERT_COLOSSUS_FROM_NABOORU_CAPTURE" Index="101"/>
|
||||
<Item Key="temple_of_time_front_of_pedestal" ID="CS_DEST_TEMPLE_OF_TIME_FRONT_OF_PEDESTAL" Index="102"/>
|
||||
<Item Key="hyrule_field_title_screen" ID="CS_DEST_HYRULE_FIELD_TITLE_SCREEN" Index="103"/>
|
||||
<Item Key="title_screen_demo" ID="CS_DEST_TITLE_SCREEN_DEMO" Index="104"/>
|
||||
<Item Key="graveyard_suns_song_part_2" ID="CS_DEST_GRAVEYARD_SUNS_SONG_PART_2" Index="105"/>
|
||||
<Item Key="royal_familys_tomb_suns_song_part_3" ID="CS_DEST_ROYAL_FAMILYS_TOMB_SUNS_SONG_PART_3" Index="106"/>
|
||||
<Item Key="ganons_castle_dispel_forest_beam" ID="CS_DEST_GANONS_CASTLE_DISPEL_FOREST_BEAM" Index="107"/>
|
||||
<Item Key="ganons_castle_dispel_water_beam" ID="CS_DEST_GANONS_CASTLE_DISPEL_WATER_BEAM" Index="108"/>
|
||||
<Item Key="ganons_castle_dispel_shadow_beam" ID="CS_DEST_GANONS_CASTLE_DISPEL_SHADOW_BEAM" Index="109"/>
|
||||
<Item Key="ganons_castle_dispel_fire_beam" ID="CS_DEST_GANONS_CASTLE_DISPEL_FIRE_BEAM" Index="110"/>
|
||||
<Item Key="ganons_castle_dispel_light_beam" ID="CS_DEST_GANONS_CASTLE_DISPEL_LIGHT_BEAM" Index="111"/>
|
||||
<Item Key="ganons_castle_dispel_spirit_beam" ID="CS_DEST_GANONS_CASTLE_DISPEL_SPIRIT_BEAM" Index="112"/>
|
||||
<Item Key="ganons_castle_dispel_barrier_conditonal" ID="CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL" Index="113"/>
|
||||
<Item Key="hyrule_field_from_fairy_ocarina" ID="CS_DEST_HYRULE_FIELD_FROM_FAIRY_OCARINA" Index="114"/>
|
||||
<Item Key="hyrule_field_from_impa_escort" ID="CS_DEST_HYRULE_FIELD_FROM_IMPA_ESCORT" Index="115"/>
|
||||
<Item Key="from_rauru_final_message_conditional" ID="CS_DEST_FROM_RAURU_FINAL_MESSAGE_CONDITIONAL" Index="116"/>
|
||||
<Item Key="hyrule_field_credits_sky" ID="CS_DEST_HYRULE_FIELD_CREDITS_SKY" Index="117"/>
|
||||
<Item Key="ganon_battle_tower_collapse" ID="CS_DEST_GANON_BATTLE_TOWER_COLLAPSE" Index="118"/>
|
||||
<Item Key="zeldas_courtyard_receive_letter" ID="CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER" Index="119"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="naviQuestHintType" ID="NaviQuestHintFileId">
|
||||
<Item Key="hints_none" ID="NAVI_QUEST_HINTS_NONE" Index="0"/>
|
||||
<Item Key="hints_overworld" ID="NAVI_QUEST_HINTS_OVERWORLD" Index="1"/>
|
||||
<Item Key="hints_dungeon" ID="NAVI_QUEST_HINTS_DUNGEON" Index="2"/>
|
||||
</Enum>
|
||||
<Enum Games="OoTMqDbg" Key="playerCueId" ID="PlayerCueId">
|
||||
<Item Key="cueid_none" ID="PLAYER_CUEID_NONE" Index="0"/>
|
||||
<Item Key="cueid_1" ID="PLAYER_CUEID_1" Index="1"/>
|
||||
<Item Key="cueid_2" ID="PLAYER_CUEID_2" Index="2"/>
|
||||
<Item Key="cueid_3" ID="PLAYER_CUEID_3" Index="3"/>
|
||||
<Item Key="cueid_4" ID="PLAYER_CUEID_4" Index="4"/>
|
||||
<Item Key="cueid_5" ID="PLAYER_CUEID_5" Index="5"/>
|
||||
<Item Key="cueid_6" ID="PLAYER_CUEID_6" Index="6"/>
|
||||
<Item Key="cueid_7" ID="PLAYER_CUEID_7" Index="7"/>
|
||||
<Item Key="cueid_8" ID="PLAYER_CUEID_8" Index="8"/>
|
||||
<Item Key="cueid_9" ID="PLAYER_CUEID_9" Index="9"/>
|
||||
<Item Key="cueid_10" ID="PLAYER_CUEID_10" Index="10"/>
|
||||
<Item Key="cueid_11" ID="PLAYER_CUEID_11" Index="11"/>
|
||||
<Item Key="cueid_12" ID="PLAYER_CUEID_12" Index="12"/>
|
||||
<Item Key="cueid_13" ID="PLAYER_CUEID_13" Index="13"/>
|
||||
<Item Key="cueid_14" ID="PLAYER_CUEID_14" Index="14"/>
|
||||
<Item Key="cueid_15" ID="PLAYER_CUEID_15" Index="15"/>
|
||||
<Item Key="cueid_16" ID="PLAYER_CUEID_16" Index="16"/>
|
||||
<Item Key="cueid_17" ID="PLAYER_CUEID_17" Index="17"/>
|
||||
<Item Key="cueid_18" ID="PLAYER_CUEID_18" Index="18"/>
|
||||
<Item Key="cueid_19" ID="PLAYER_CUEID_19" Index="19"/>
|
||||
<Item Key="cueid_20" ID="PLAYER_CUEID_20" Index="20"/>
|
||||
<Item Key="cueid_21" ID="PLAYER_CUEID_21" Index="21"/>
|
||||
<Item Key="cueid_22" ID="PLAYER_CUEID_22" Index="22"/>
|
||||
<Item Key="cueid_23" ID="PLAYER_CUEID_23" Index="23"/>
|
||||
<Item Key="cueid_24" ID="PLAYER_CUEID_24" Index="24"/>
|
||||
<Item Key="cueid_25" ID="PLAYER_CUEID_25" Index="25"/>
|
||||
<Item Key="cueid_26" ID="PLAYER_CUEID_26" Index="26"/>
|
||||
<Item Key="cueid_27" ID="PLAYER_CUEID_27" Index="27"/>
|
||||
<Item Key="cueid_28" ID="PLAYER_CUEID_28" Index="28"/>
|
||||
<Item Key="cueid_29" ID="PLAYER_CUEID_29" Index="29"/>
|
||||
<Item Key="cueid_30" ID="PLAYER_CUEID_30" Index="30"/>
|
||||
<Item Key="cueid_31" ID="PLAYER_CUEID_31" Index="31"/>
|
||||
<Item Key="cueid_32" ID="PLAYER_CUEID_32" Index="32"/>
|
||||
<Item Key="cueid_33" ID="PLAYER_CUEID_33" Index="33"/>
|
||||
<Item Key="cueid_34" ID="PLAYER_CUEID_34" Index="34"/>
|
||||
<Item Key="cueid_35" ID="PLAYER_CUEID_35" Index="35"/>
|
||||
<Item Key="cueid_36" ID="PLAYER_CUEID_36" Index="36"/>
|
||||
<Item Key="cueid_37" ID="PLAYER_CUEID_37" Index="37"/>
|
||||
<Item Key="cueid_38" ID="PLAYER_CUEID_38" Index="38"/>
|
||||
<Item Key="cueid_39" ID="PLAYER_CUEID_39" Index="39"/>
|
||||
<Item Key="cueid_40" ID="PLAYER_CUEID_40" Index="40"/>
|
||||
<Item Key="cueid_41" ID="PLAYER_CUEID_41" Index="41"/>
|
||||
<Item Key="cueid_42" ID="PLAYER_CUEID_42" Index="42"/>
|
||||
<Item Key="cueid_43" ID="PLAYER_CUEID_43" Index="43"/>
|
||||
<Item Key="cueid_44" ID="PLAYER_CUEID_44" Index="44"/>
|
||||
<Item Key="cueid_45" ID="PLAYER_CUEID_45" Index="45"/>
|
||||
<Item Key="cueid_46" ID="PLAYER_CUEID_46" Index="46"/>
|
||||
<Item Key="cueid_47" ID="PLAYER_CUEID_47" Index="47"/>
|
||||
<Item Key="cueid_48" ID="PLAYER_CUEID_48" Index="48"/>
|
||||
<Item Key="cueid_49" ID="PLAYER_CUEID_49" Index="49"/>
|
||||
<Item Key="cueid_50" ID="PLAYER_CUEID_50" Index="50"/>
|
||||
<Item Key="cueid_51" ID="PLAYER_CUEID_51" Index="51"/>
|
||||
<Item Key="cueid_52" ID="PLAYER_CUEID_52" Index="52"/>
|
||||
<Item Key="cueid_53" ID="PLAYER_CUEID_53" Index="53"/>
|
||||
<Item Key="cueid_54" ID="PLAYER_CUEID_54" Index="54"/>
|
||||
<Item Key="cueid_55" ID="PLAYER_CUEID_55" Index="55"/>
|
||||
<Item Key="cueid_56" ID="PLAYER_CUEID_56" Index="56"/>
|
||||
<Item Key="cueid_57" ID="PLAYER_CUEID_57" Index="57"/>
|
||||
<Item Key="cueid_58" ID="PLAYER_CUEID_58" Index="58"/>
|
||||
<Item Key="cueid_59" ID="PLAYER_CUEID_59" Index="59"/>
|
||||
<Item Key="cueid_60" ID="PLAYER_CUEID_60" Index="60"/>
|
||||
<Item Key="cueid_61" ID="PLAYER_CUEID_61" Index="61"/>
|
||||
<Item Key="cueid_62" ID="PLAYER_CUEID_62" Index="62"/>
|
||||
<Item Key="cueid_63" ID="PLAYER_CUEID_63" Index="63"/>
|
||||
<Item Key="cueid_64" ID="PLAYER_CUEID_64" Index="64"/>
|
||||
<Item Key="cueid_65" ID="PLAYER_CUEID_65" Index="65"/>
|
||||
<Item Key="cueid_66" ID="PLAYER_CUEID_66" Index="66"/>
|
||||
<Item Key="cueid_67" ID="PLAYER_CUEID_67" Index="67"/>
|
||||
<Item Key="cueid_68" ID="PLAYER_CUEID_68" Index="68"/>
|
||||
<Item Key="cueid_69" ID="PLAYER_CUEID_69" Index="69"/>
|
||||
<Item Key="cueid_70" ID="PLAYER_CUEID_70" Index="70"/>
|
||||
<Item Key="cueid_71" ID="PLAYER_CUEID_71" Index="71"/>
|
||||
<Item Key="cueid_72" ID="PLAYER_CUEID_72" Index="72"/>
|
||||
<Item Key="cueid_73" ID="PLAYER_CUEID_73" Index="73"/>
|
||||
<Item Key="cueid_74" ID="PLAYER_CUEID_74" Index="74"/>
|
||||
<Item Key="cueid_75" ID="PLAYER_CUEID_75" Index="75"/>
|
||||
<Item Key="cueid_76" ID="PLAYER_CUEID_76" Index="76"/>
|
||||
<Item Key="cueid_77" ID="PLAYER_CUEID_77" Index="77"/>
|
||||
</Enum>
|
||||
</Root>
|
||||
|
||||
<!-- Format Documentation
|
||||
- <Enum>: a list of <Item> with a unique identifier (key), the decomp ID and the index
|
||||
Parameters:
|
||||
* Games: list of OoT versions that share this data
|
||||
* Key: identifier, the name is the same as the enum from decomp
|
||||
- <Item>: description of an element of an <Enum>
|
||||
Parameters:
|
||||
* Key: identifier that should never be changed
|
||||
* ID: the actual enum name from decomp, this may change hence the need of the Key parameter
|
||||
* Index: the location of the item in the enum (should match decomp)
|
||||
-->
|
Loading…
Add table
Add a link
Reference in a new issue