mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-29 21:02:18 -05:00
f31a841789
* git subrepo clone --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/ subrepo: subdir: "ZAPDTR" merged: "6aa54a551" upstream: origin: "C:/ZeldaStuff/ZAPDTR" branch: "rebase2" commit: "6aa54a551" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * git subrepo clone --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/ subrepo: subdir: "ZAPDTR" merged: "88b012240" upstream: origin: "C:/ZeldaStuff/ZAPDTR" branch: "rebase2" commit: "88b012240" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Update (its broken) * fix the enum * git subrepo push --remote=C:/ZeldaStuff/ZAPDTR/ ZAPDTR subrepo: subdir: "ZAPDTR" merged: "b7b6e1c82" upstream: origin: "C:/ZeldaStuff/ZAPDTR/" branch: "rebase2" commit: "b7b6e1c82" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * New names for LUS actions * git subrepo push --remote=C:/ZeldaStuff/ZAPDTR/ ZAPDTR subrepo: subdir: "ZAPDTR" merged: "c5cfebeee" upstream: origin: "C:/ZeldaStuff/ZAPDTR/" branch: "rebase2" commit: "c5cfebeee" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * git subrepo clone (merge) --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/ subrepo: subdir: "ZAPDTR" merged: "d5f4769b8" upstream: origin: "C:/ZeldaStuff/ZAPDTR" branch: "rebase2" commit: "d5f4769b8" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Fix missing commands in the exporter. * Cleanups. * git subrepo pull --force --remote=https://github.com/harbourmasters/ZAPDTR --branch=master ZAPDTR subrepo: subdir: "ZAPDTR" merged: "d4c35b90a" upstream: origin: "https://github.com/harbourmasters/ZAPDTR" branch: "master" commit: "d4c35b90a" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Add unordered_map include to fix MacOS * fix string_view * Update Main.cpp * fix string view * So close I can almost taste it * So close * Fix missed git marker. * Fix surface types and * Update ZFile.cpp * Delete Jenkinsfile --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
214 lines
7.1 KiB
C++
214 lines
7.1 KiB
C++
#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();
|
|
}
|
|
}
|