Skip to content

Commit

Permalink
conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
louist103 committed Jan 31, 2024
2 parents 1ac9c36 + bd3e38a commit 1db7c31
Show file tree
Hide file tree
Showing 10 changed files with 840 additions and 26 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build ZAPD

on:
push:
pull_request:
branches:
- master

jobs:
build:
runs-on: self-hosted-runner

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Build ZAPD
run: make -j WERROR=1

- name: Checkout Repos
run: echo "Checkout Repos"

- name: Checkout oot
run: |
git clone https://github.com/zeldaret/oot.git
cd oot
git submodule update --init --recursive
- name: Checkout mm
run: |
git clone https://github.com/zeldaret/mm.git
cd mm
- name: Set up repos
run: echo "Set up repos"

- name: Setup OOT
run: |
cd oot
mkdir -p baseroms/gc-eu-mq-dbg
cp ~/baserom_original.z64 ./baseroms/gc-eu-mq-dbg/baserom.z64
make venv
make -C tools -j
cp ../ZAPD.out tools/ZAPD/
.venv/bin/python3 tools/decompress_baserom.py gc-eu-mq-dbg
.venv/bin/python3 extract_baserom.py
.venv/bin/python3 extract_assets.py -j 4
- name: Install Python dependencies
run: |
cd mm
python3 -m venv .mm-env
source .mm-env/bin/activate
python3 -m pip install -r requirements.txt
- name: Setup MM
run: |
cd mm
cp ~/baserom.mm.us.rev1.z64 ./baserom.mm.us.rev1.z64
make -C tools -j
cp ../ZAPD.out tools/ZAPD/
python3 tools/fixbaserom.py
python3 tools/extract_baserom.py
python3 tools/decompress_yars.py
python3 extract_assets.py -j $(nproc)
- name: Build Repos
run: echo "Build Repos"

- name: Build oot
run: |
cd oot
make venv
make -j
- name: Build mm
run: |
cd mm
make -j disasm
make -j
- name: Clean workspace
run: git clean -fdX
51 changes: 31 additions & 20 deletions ZAPD/OtherStructs/CutsceneMM_Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const

/**** CAMERA ****/

CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex): CutsceneSubCommandEntry(rawData, rawDataIndex)
CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint(
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
: CutsceneSubCommandEntry(rawData, rawDataIndex)
{
interpType = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0);
weight = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1);
Expand All @@ -145,17 +146,19 @@ std::string CutsceneSubCommandEntry_SplineCamPoint::GetBodySourceCode() const
const auto interpTypeMap = &Globals::Instance->cfg.enumData.interpType;
const auto relToMap = &Globals::Instance->cfg.enumData.relTo;

return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, %s)", interpTypeMap->at(interpType).c_str(), weight, duration, posX, posY, posZ, relToMap->at(relTo).c_str());
return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, %s)",
interpTypeMap->at(interpType).c_str(), weight, duration, posX,
posY, posZ, relToMap->at(relTo).c_str());
}

size_t CutsceneSubCommandEntry_SplineCamPoint::GetRawSize() const
{
return 0x0C;
}


CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex): CutsceneSubCommandEntry(rawData, rawDataIndex)
CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint(
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
: CutsceneSubCommandEntry(rawData, rawDataIndex)
{
unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
roll = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
Expand All @@ -165,16 +168,18 @@ CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint

std::string CutsceneSubCommandEntry_SplineMiscPoint::GetBodySourceCode() const
{
return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov, unused1);
return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov,
unused1);
}

size_t CutsceneSubCommandEntry_SplineMiscPoint::GetRawSize() const
{
return 0x08;
}

CutsceneSubCommandEntry_SplineHeader::CutsceneSubCommandEntry_SplineHeader(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex): CutsceneSubCommandEntry(rawData, rawDataIndex)
CutsceneSubCommandEntry_SplineHeader::CutsceneSubCommandEntry_SplineHeader(
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
: CutsceneSubCommandEntry(rawData, rawDataIndex)
{
numEntries = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0);
unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);
Expand All @@ -184,25 +189,28 @@ CutsceneSubCommandEntry_SplineHeader::CutsceneSubCommandEntry_SplineHeader(const

std::string CutsceneSubCommandEntry_SplineHeader::GetBodySourceCode() const
{
return StringHelper::Sprintf("CS_CAM_SPLINE(0x%04X, 0x%04X, 0x%04X, 0x%04X)", numEntries, unused0, unused1, duration);

return StringHelper::Sprintf("CS_CAM_SPLINE(0x%04X, 0x%04X, 0x%04X, 0x%04X)", numEntries,
unused0, unused1, duration);
}

size_t CutsceneSubCommandEntry_SplineHeader::GetRawSize() const
{
return 0x08;
}

CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex): CutsceneSubCommandEntry(rawData, rawDataIndex)
CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter(
const std::vector<uint8_t>& rawData, offset_t rawDataIndex)
: CutsceneSubCommandEntry(rawData, rawDataIndex)
{
uint16_t firstHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex);
uint16_t secondHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2);

if (firstHalfWord != 0xFFFF || secondHalfWord != 4) {
if (firstHalfWord != 0xFFFF || secondHalfWord != 4)
{
HANDLE_ERROR(WarningType::InvalidExtractedData, "Invalid Spline Footer",
StringHelper::Sprintf("Invalid Spline footer. Was expecting 0xFFFF, 0x0004. Got 0x%04X, 0x%04X",
firstHalfWord, secondHalfWord));
StringHelper::Sprintf(
"Invalid Spline footer. Was expecting 0xFFFF, 0x0004. Got 0x%04X, 0x%04X",
firstHalfWord, secondHalfWord));
}
}

Expand All @@ -224,16 +232,18 @@ CutsceneMMCommand_Spline::CutsceneMMCommand_Spline(const std::vector<uint8_t>& r
totalCommands = 0;
rawDataIndex += 4;

while(1) {
if (BitConverter::ToUInt16BE(rawData, rawDataIndex) == 0xFFFF) {
while (1)
{
if (BitConverter::ToUInt16BE(rawData, rawDataIndex) == 0xFFFF)
{
break;
}
numHeaders++;

auto* header = new CutsceneSubCommandEntry_SplineHeader(rawData, rawDataIndex);
rawDataIndex += header->GetRawSize();
entries.push_back(header);

totalCommands += header->numEntries;

for (uint32_t i = 0; i < header->numEntries; i++)
Expand Down Expand Up @@ -270,7 +280,8 @@ std::string CutsceneMMCommand_Spline::GetCommandMacro() const

size_t CutsceneMMCommand_Spline::GetCommandSize() const
{
// 8 Bytes once for the spline command, 8 Bytes per spline the header, two groups of size 12, 1 group of size 8, 4 bytes for the footer.
// 8 Bytes once for the spline command, 8 Bytes per spline the header, two groups of size 12, 1
// group of size 8, 4 bytes for the footer.
return 8 + (8 * numHeaders) + ((totalCommands * 2) * 0xC) + (totalCommands * 8) + 4;
}

Expand Down
16 changes: 10 additions & 6 deletions ZAPD/OtherStructs/CutsceneMM_Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ class CutsceneSubCommandEntry_SplineCamPoint : public CutsceneSubCommandEntry
uint16_t posZ;
uint16_t relTo;

CutsceneSubCommandEntry_SplineCamPoint(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
CutsceneSubCommandEntry_SplineCamPoint(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex);

std::string GetBodySourceCode() const override;

Expand All @@ -296,8 +297,9 @@ class CutsceneSubCommandEntry_SplineMiscPoint : public CutsceneSubCommandEntry
uint16_t roll;
uint16_t fov;
uint16_t unused1;

CutsceneSubCommandEntry_SplineMiscPoint(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);

CutsceneSubCommandEntry_SplineMiscPoint(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex);

std::string GetBodySourceCode() const override;

Expand All @@ -306,8 +308,9 @@ class CutsceneSubCommandEntry_SplineMiscPoint : public CutsceneSubCommandEntry

class CutsceneSubCommandEntry_SplineFooter : public CutsceneSubCommandEntry
{
public:
CutsceneSubCommandEntry_SplineFooter(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
public:
CutsceneSubCommandEntry_SplineFooter(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex);

std::string GetBodySourceCode() const override;

Expand All @@ -321,7 +324,8 @@ class CutsceneSubCommandEntry_SplineHeader : public CutsceneSubCommandEntry
uint16_t unused0;
uint16_t unused1;
uint16_t duration;
CutsceneSubCommandEntry_SplineHeader(const std::vector<uint8_t>& rawData, offset_t rawDataIndex);
CutsceneSubCommandEntry_SplineHeader(const std::vector<uint8_t>& rawData,
offset_t rawDataIndex);

std::string GetBodySourceCode() const override;

Expand Down
6 changes: 6 additions & 0 deletions ZAPD/ZAPD.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<EnableASAN>false</EnableASAN>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<EnableASAN>false</EnableASAN>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down Expand Up @@ -194,6 +196,8 @@ mkdir build\ZAPD
<ClCompile Include="ZActorList.cpp" />
<ClCompile Include="ZArray.cpp" />
<ClCompile Include="ZBackground.cpp" />
<ClCompile Include="ZCKeyFrame.cpp" />
<ClCompile Include="ZCKeyFrameAnim.cpp" />
<ClCompile Include="ZCollisionPoly.cpp" />
<ClCompile Include="ZLimb.cpp" />
<ClCompile Include="ZMtx.cpp" />
Expand Down Expand Up @@ -289,6 +293,8 @@ mkdir build\ZAPD
<ClInclude Include="ZArray.h" />
<ClInclude Include="ZBackground.h" />
<ClInclude Include="ZBlob.h" />
<ClInclude Include="ZCKeyFrame.h" />
<ClInclude Include="ZCkeyFrameAnim.h" />
<ClInclude Include="ZCollision.h" />
<ClInclude Include="ZCollisionPoly.h" />
<ClInclude Include="ZCutscene.h" />
Expand Down
12 changes: 12 additions & 0 deletions ZAPD/ZAPD.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@
<ClCompile Include="ZRoom\Commands\SetCutsceneEntryList.cpp">
<Filter>Source Files\Z64\ZRoom\Commands</Filter>
</ClCompile>
<ClCompile Include="ZCKeyFrame.cpp">
<Filter>Source Files\Z64</Filter>
</ClCompile>
<ClCompile Include="ZCKeyFrameAnim.cpp">
<Filter>Source Files\Z64</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ZRoom\ZRoom.h">
Expand Down Expand Up @@ -575,6 +581,12 @@
<ClInclude Include="ZRoom\Commands\SetCutsceneEntryList.h">
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
</ClInclude>
<ClInclude Include="ZCKeyFrame.h">
<Filter>Header Files\Z64</Filter>
</ClInclude>
<ClInclude Include="ZCkeyFrameAnim.h">
<Filter>Header Files\Z64</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="..\SymbolMap_OoTMqDbg.txt">
Expand Down
Loading

0 comments on commit 1db7c31

Please sign in to comment.