first commit
This commit is contained in:
213
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
Normal file
213
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.cpp
Normal file
@@ -0,0 +1,213 @@
|
||||
#include "CutsceneMM_Commands.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
|
||||
// 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)"}},
|
||||
};
|
||||
|
||||
CutsceneSubCommandEntry_GenericMMCmd::CutsceneSubCommandEntry_GenericMMCmd(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex, CutsceneMMCommands cmdId)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId)
|
||||
{
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_GenericMMCmd::GetBodySourceCode() const
|
||||
{
|
||||
const auto& element = csCommandsDescMM.find(commandId);
|
||||
std::string entryFmt = "CS_UNK_DATA(0x%02X, %i, %i, %i)";
|
||||
|
||||
if (element != csCommandsDescMM.end())
|
||||
{
|
||||
entryFmt = element->second.cmdMacro;
|
||||
entryFmt += element->second.args;
|
||||
}
|
||||
|
||||
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)
|
||||
: 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_GenericMMCmd(rawData, rawDataIndex, cmdId);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const
|
||||
{
|
||||
const auto& element = csCommandsDescMM.find(static_cast<CutsceneMMCommands>(commandID));
|
||||
|
||||
if (element != csCommandsDescMM.end())
|
||||
{
|
||||
return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries);
|
||||
}
|
||||
|
||||
return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_Camera::CutsceneSubCommandEntry_Camera(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
}
|
||||
|
||||
std::string CutsceneSubCommandEntry_Camera::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CMD_HH(0x%04X, 0x%04X)", base, startFrame);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_Camera::GetRawSize() const
|
||||
{
|
||||
return 0x04;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_Camera::CutsceneMMCommand_Camera(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex)
|
||||
: CutsceneCommand(rawData, rawDataIndex)
|
||||
{
|
||||
rawDataIndex += 4;
|
||||
|
||||
entries.reserve(numEntries);
|
||||
for (size_t i = 0; i < numEntries / 4; i++)
|
||||
{
|
||||
auto* entry = new CutsceneSubCommandEntry_Camera(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_Camera::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_CAMERA_LIST(%i)", numEntries);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_FadeScreen::CutsceneSubCommandEntry_FadeScreen(
|
||||
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_FadeScreen::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADESCREEN(0x%02X, %i, %i, %i, %i, %i)", base, startFrame,
|
||||
endFrame, unk_06, unk_07, unk_08);
|
||||
}
|
||||
|
||||
size_t CutsceneSubCommandEntry_FadeScreen::GetRawSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
|
||||
CutsceneMMCommand_FadeScreen::CutsceneMMCommand_FadeScreen(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_FadeScreen(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CutsceneMMCommand_FadeScreen::GetCommandMacro() const
|
||||
{
|
||||
return StringHelper::Sprintf("CS_FADESCREEN_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);
|
||||
}
|
||||
|
||||
CutsceneSubCommandEntry_NonImplemented::CutsceneSubCommandEntry_NonImplemented(
|
||||
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
|
||||
: CutsceneSubCommandEntry(rawData, rawDataIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CutsceneMMCommand_NonImplemented::CutsceneMMCommand_NonImplemented(
|
||||
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_NonImplemented(rawData, rawDataIndex);
|
||||
entries.push_back(entry);
|
||||
rawDataIndex += entry->GetRawSize();
|
||||
}
|
||||
}
|
||||
140
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.h
Normal file
140
ZAPDTR/ZAPD/OtherStructs/CutsceneMM_Commands.h
Normal file
@@ -0,0 +1,140 @@
|
||||
#pragma once
|
||||
|
||||
#include "Cutscene_Commands.h"
|
||||
|
||||
enum class CutsceneMMCommands
|
||||
{
|
||||
/* 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,
|
||||
/* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES,
|
||||
/* 0x190 */ CS_CMD_RUMBLE = 0x190,
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_GenericMMCmd : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommands commandId;
|
||||
|
||||
CutsceneSubCommandEntry_GenericMMCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMMCommands cmdId);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_GenericCmd : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_GenericCmd(const std::vector<uint8_t>& rawData, offset_t rawDataIndex,
|
||||
CutsceneMMCommands cmdId);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
// TODO: MM cutscene camera command is implemented as a placeholder until we better understand how
|
||||
// it works
|
||||
class CutsceneSubCommandEntry_Camera : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint32_t unk_08;
|
||||
|
||||
CutsceneSubCommandEntry_Camera(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_Camera : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_Camera(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_FadeScreen : 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_FadeScreen(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_FadeScreen : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_FadeScreen(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_FadeSeq : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
uint32_t unk_08;
|
||||
|
||||
CutsceneSubCommandEntry_FadeSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
size_t GetRawSize() const override;
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_FadeSeq : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_FadeSeq(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
|
||||
std::string GetCommandMacro() const override;
|
||||
};
|
||||
|
||||
class CutsceneSubCommandEntry_NonImplemented : public CutsceneSubCommandEntry
|
||||
{
|
||||
public:
|
||||
CutsceneSubCommandEntry_NonImplemented(const std::vector<uint8_t>& rawData,
|
||||
offset_t rawDataIndex);
|
||||
};
|
||||
|
||||
class CutsceneMMCommand_NonImplemented : public CutsceneCommand
|
||||
{
|
||||
public:
|
||||
CutsceneMMCommand_NonImplemented(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
|
||||
};
|
||||
458
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
Normal file
458
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp
Normal file
@@ -0,0 +1,458 @@
|
||||
#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", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}},
|
||||
{CutsceneOoT_CommandType::CS_CMD_STOP_SEQ,
|
||||
{"CS_STOP_SEQ", "(%s, %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();
|
||||
bool isIndexInSeqId = enumData->seqId.find(base - 1) != enumData->seqId.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 if (commandId == CutsceneOoT_CommandType::CS_CMD_START_SEQ && isIndexInSeqId)
|
||||
firstArg = enumData->seqId[base - 1];
|
||||
else if (commandId == CutsceneOoT_CommandType::CS_CMD_STOP_SEQ && isIndexInSeqId)
|
||||
firstArg = enumData->seqId[base - 1];
|
||||
else
|
||||
{
|
||||
return StringHelper::Sprintf(entryFmt.c_str(), base - 1, 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 &&
|
||||
enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end())
|
||||
{
|
||||
return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)",
|
||||
enumData->ocarinaSongActionId[base].c_str(), 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
|
||||
{
|
||||
EnumData* enumData = &Globals::Instance->cfg.enumData;
|
||||
|
||||
if (static_cast<CutsceneOoT_CommandType>(commandID) ==
|
||||
CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE)
|
||||
{
|
||||
return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, "
|
||||
"%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)",
|
||||
enumData->playerCueId[base].c_str(), startFrame, endFrame,
|
||||
rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX,
|
||||
endPosY, endPosZ, normalX, normalY, normalZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
return StringHelper::Sprintf("CS_ACTOR_CUE(%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);
|
||||
}
|
||||
}
|
||||
|
||||
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
ZAPDTR/ZAPD/OtherStructs/CutsceneOoT_Commands.h
Normal file
314
ZAPDTR/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;
|
||||
};
|
||||
596
ZAPDTR/ZAPD/OtherStructs/Cutscene_Commands.cpp
Normal file
596
ZAPDTR/ZAPD/OtherStructs/Cutscene_Commands.cpp
Normal file
@@ -0,0 +1,596 @@
|
||||
#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;
|
||||
}
|
||||
267
ZAPDTR/ZAPD/OtherStructs/Cutscene_Commands.h
Normal file
267
ZAPDTR/ZAPD/OtherStructs/Cutscene_Commands.h
Normal file
@@ -0,0 +1,267 @@
|
||||
#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
ZAPDTR/ZAPD/OtherStructs/Cutscene_Common.cpp
Normal file
128
ZAPDTR/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
ZAPDTR/ZAPD/OtherStructs/Cutscene_Common.h
Normal file
72
ZAPDTR/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;
|
||||
};
|
||||
352
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.cpp
Normal file
352
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.cpp
Normal file
@@ -0,0 +1,352 @@
|
||||
#include "SkinLimbStructs.h"
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "ZDisplayList.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
/* Struct_800A57C0 */
|
||||
|
||||
Struct_800A57C0::Struct_800A57C0(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A57C0::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);
|
||||
}
|
||||
|
||||
std::string Struct_800A57C0::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);
|
||||
}
|
||||
|
||||
std::string Struct_800A57C0::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A57C0";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A57C0::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A57C0::GetRawDataSize() const
|
||||
{
|
||||
return 0x0A;
|
||||
}
|
||||
|
||||
/* Struct_800A598C_2 */
|
||||
|
||||
Struct_800A598C_2::Struct_800A598C_2(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A598C_2::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
unk_0 = 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);
|
||||
}
|
||||
|
||||
std::string Struct_800A598C_2::GetBodySourceCode() const
|
||||
{
|
||||
return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", unk_0, x, y, z, unk_8);
|
||||
}
|
||||
|
||||
std::string Struct_800A598C_2::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A598C_2";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A598C_2::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A598C_2::GetRawDataSize() const
|
||||
{
|
||||
return 0x0A;
|
||||
}
|
||||
|
||||
/* Struct_800A598C */
|
||||
|
||||
Struct_800A598C::Struct_800A598C(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A598C::ParseRawData()
|
||||
{
|
||||
const auto& rawData = parent->GetRawData();
|
||||
|
||||
unk_0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00);
|
||||
unk_2 = 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);
|
||||
|
||||
if (unk_8 != 0 && GETSEGNUM(unk_8) == parent->segment)
|
||||
{
|
||||
uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
|
||||
|
||||
unk_8_arr.reserve(unk_0);
|
||||
for (size_t i = 0; i < unk_0; i++)
|
||||
{
|
||||
Struct_800A57C0 unk8_data(parent);
|
||||
unk8_data.ExtractFromFile(unk_8_Offset);
|
||||
unk_8_arr.push_back(unk8_data);
|
||||
|
||||
unk_8_Offset += unk8_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (unk_C != 0 && GETSEGNUM(unk_8) == parent->segment)
|
||||
{
|
||||
uint32_t unk_C_Offset = Seg2Filespace(unk_C, parent->baseAddress);
|
||||
|
||||
unk_C_arr.reserve(unk_2);
|
||||
for (size_t i = 0; i < unk_2; i++)
|
||||
{
|
||||
Struct_800A598C_2 unkC_data(parent);
|
||||
unkC_data.ExtractFromFile(unk_C_Offset);
|
||||
unk_C_arr.push_back(unkC_data);
|
||||
|
||||
unk_C_Offset += unkC_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Struct_800A598C::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string varPrefix = prefix;
|
||||
if (name != "")
|
||||
varPrefix = name;
|
||||
|
||||
if (unk_8 != 0 && GETSEGNUM(unk_8) == parent->segment)
|
||||
{
|
||||
const auto& res = unk_8_arr.at(0);
|
||||
std::string unk_8_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = unk_8_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = unk_8_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
if (i < arrayItemCnt - 1)
|
||||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_8_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(unk_8_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_8_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->text = entryStr;
|
||||
}
|
||||
|
||||
if (unk_C != 0 && GETSEGNUM(unk_C) == parent->segment)
|
||||
{
|
||||
const auto& res = unk_C_arr.at(0);
|
||||
std::string unk_C_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = unk_C_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = unk_C_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
if (i < arrayItemCnt - 1)
|
||||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_C_Offset = Seg2Filespace(unk_C, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_C_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(unk_C_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_C_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->text = entryStr;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Struct_800A598C::GetBodySourceCode() const
|
||||
{
|
||||
std::string unk_8_Str;
|
||||
std::string unk_C_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(unk_8, parent, "Struct_800A57C0", unk_8_Str,
|
||||
parent->workerID);
|
||||
Globals::Instance->GetSegmentedPtrName(unk_C, parent, "Struct_800A598C_2", unk_C_Str,
|
||||
parent->workerID);
|
||||
|
||||
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());
|
||||
|
||||
return entryStr;
|
||||
}
|
||||
|
||||
std::string Struct_800A598C::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A598C";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A598C::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A598C::GetRawDataSize() const
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
/* Struct_800A5E28 */
|
||||
|
||||
Struct_800A5E28::Struct_800A5E28(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
}
|
||||
|
||||
void Struct_800A5E28::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);
|
||||
|
||||
if (unk_4 != 0 && GETSEGNUM(unk_4) == parent->segment)
|
||||
{
|
||||
uint32_t unk_4_Offset = Seg2Filespace(unk_4, parent->baseAddress);
|
||||
|
||||
unk_4_arr.reserve(unk_2);
|
||||
for (size_t i = 0; i < unk_2; i++)
|
||||
{
|
||||
Struct_800A598C unk_4_data(parent);
|
||||
unk_4_data.ExtractFromFile(unk_4_Offset);
|
||||
unk_4_arr.push_back(unk_4_data);
|
||||
|
||||
unk_4_Offset += unk_4_data.GetRawDataSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Struct_800A5E28::DeclareReferences(const std::string& prefix)
|
||||
{
|
||||
std::string varPrefix = prefix;
|
||||
if (name != "")
|
||||
varPrefix = name;
|
||||
|
||||
ZResource::DeclareReferences(varPrefix);
|
||||
|
||||
if (unk_4 != SEGMENTED_NULL && GETSEGNUM(unk_4) == parent->segment)
|
||||
{
|
||||
const auto& res = unk_4_arr.at(0);
|
||||
std::string unk_4_Str = res.GetDefaultName(varPrefix);
|
||||
|
||||
size_t arrayItemCnt = unk_4_arr.size();
|
||||
std::string entryStr = "";
|
||||
|
||||
for (size_t i = 0; i < arrayItemCnt; i++)
|
||||
{
|
||||
auto& child = unk_4_arr[i];
|
||||
child.DeclareReferences(varPrefix);
|
||||
entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str());
|
||||
|
||||
if (i < arrayItemCnt - 1)
|
||||
entryStr += "\n";
|
||||
}
|
||||
|
||||
uint32_t unk_4_Offset = Seg2Filespace(unk_4, parent->baseAddress);
|
||||
Declaration* decl = parent->GetDeclaration(unk_4_Offset);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
parent->AddDeclarationArray(unk_4_Offset, res.GetDeclarationAlignment(),
|
||||
arrayItemCnt * res.GetRawDataSize(),
|
||||
res.GetSourceTypeName(), unk_4_Str, arrayItemCnt, entryStr);
|
||||
}
|
||||
else
|
||||
decl->text = entryStr;
|
||||
}
|
||||
|
||||
if (unk_8 != SEGMENTED_NULL && GETSEGNUM(unk_8) == parent->segment)
|
||||
{
|
||||
uint32_t unk_8_Offset = Seg2Filespace(unk_8, parent->baseAddress);
|
||||
|
||||
int32_t dlistLength = ZDisplayList::GetDListLength(
|
||||
parent->GetRawData(), unk_8_Offset,
|
||||
Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX);
|
||||
unk_8_dlist = new ZDisplayList(parent);
|
||||
unk_8_dlist->ExtractFromBinary(unk_8_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);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Struct_800A5E28::GetBodySourceCode() const
|
||||
{
|
||||
std::string unk_4_Str;
|
||||
std::string unk_8_Str;
|
||||
Globals::Instance->GetSegmentedPtrName(unk_4, parent, "Struct_800A598C", unk_4_Str,
|
||||
parent->workerID);
|
||||
Globals::Instance->GetSegmentedPtrName(unk_8, parent, "Gfx", unk_8_Str, parent->workerID);
|
||||
|
||||
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());
|
||||
|
||||
return entryStr;
|
||||
}
|
||||
|
||||
std::string Struct_800A5E28::GetSourceTypeName() const
|
||||
{
|
||||
return "Struct_800A5E28";
|
||||
}
|
||||
|
||||
ZResourceType Struct_800A5E28::GetResourceType() const
|
||||
{
|
||||
// TODO
|
||||
return ZResourceType::Error;
|
||||
}
|
||||
|
||||
size_t Struct_800A5E28::GetRawDataSize() const
|
||||
{
|
||||
return 0x0C;
|
||||
}
|
||||
114
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.h
Normal file
114
ZAPDTR/ZAPD/OtherStructs/SkinLimbStructs.h
Normal file
@@ -0,0 +1,114 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ZResource.h"
|
||||
#include "ZDisplayList.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
|
||||
};
|
||||
|
||||
class Struct_800A57C0 : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A57C0(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
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;
|
||||
};
|
||||
|
||||
class Struct_800A598C_2 : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A598C_2(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
uint8_t unk_0;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t z;
|
||||
uint8_t unk_8;
|
||||
};
|
||||
|
||||
class Struct_800A598C : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A598C(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
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*
|
||||
|
||||
std::vector<Struct_800A57C0> unk_8_arr;
|
||||
std::vector<Struct_800A598C_2> unk_C_arr;
|
||||
};
|
||||
|
||||
class Struct_800A5E28 : public ZResource
|
||||
{
|
||||
public:
|
||||
Struct_800A5E28(ZFile* nParent);
|
||||
|
||||
void ParseRawData() override;
|
||||
void DeclareReferences(const std::string& prefix) override;
|
||||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
||||
size_t GetRawDataSize() const override;
|
||||
|
||||
public:
|
||||
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*
|
||||
|
||||
std::vector<Struct_800A598C> unk_4_arr;
|
||||
ZDisplayList* unk_8_dlist = nullptr;
|
||||
};
|
||||
Reference in New Issue
Block a user