diff options
| author | Random <28494085+Random06457@users.noreply.github.com> | 2021-09-12 22:25:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-12 16:25:37 -0400 |
| commit | 90662f3cbade844c8edc3943ab8252e334b6166a (patch) | |
| tree | cc794d60659a4640d36af52b580228891515e0dc | |
| parent | 5da00201f261f8ac4927064f1390e886672cda58 (diff) | |
Fix compilation with -Wextra (#164)
* add -Wextra -Werror
* remove void arg in GfxdCallback_FormatSingleEntry
* mark CRC32 functions as maybe_unused
* remove useless comment
* fix clang warnings
* replace (void) with [[maybe_unused]]
* run make format
49 files changed, 109 insertions, 98 deletions
diff --git a/ExporterTest/CollisionExporter.h b/ExporterTest/CollisionExporter.h index bea40f4..2828995 100644 --- a/ExporterTest/CollisionExporter.h +++ b/ExporterTest/CollisionExporter.h @@ -6,5 +6,5 @@ class ExporterExample_Collision : public ZResourceExporter { public: - virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; + void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; };
\ No newline at end of file diff --git a/ExporterTest/RoomExporter.h b/ExporterTest/RoomExporter.h index a312a1c..ee531dc 100644 --- a/ExporterTest/RoomExporter.h +++ b/ExporterTest/RoomExporter.h @@ -6,5 +6,5 @@ class ExporterExample_Room : public ZResourceExporter { public: - virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; + void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; };
\ No newline at end of file diff --git a/ExporterTest/TextureExporter.h b/ExporterTest/TextureExporter.h index 021410b..fcee8be 100644 --- a/ExporterTest/TextureExporter.h +++ b/ExporterTest/TextureExporter.h @@ -7,5 +7,5 @@ class ExporterExample_Texture : public ZResourceExporter { public: - virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; + void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; };
\ No newline at end of file @@ -7,7 +7,7 @@ COPYCHECK_ARGS ?= CXX := g++ INC := -I ZAPD -I lib/assimp/include -I lib/elfio -I lib/json/include -I lib/stb -I lib/tinygltf -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils -CXXFLAGS += -fpic -std=c++17 -Wall -fno-omit-frame-pointer +CXXFLAGS += -fpic -std=c++17 -Wall -Wextra -Werror -fno-omit-frame-pointer ifneq ($(DEBUG),0) OPTIMIZATION_ON = 0 diff --git a/ZAPD/OutputFormatter.cpp b/ZAPD/OutputFormatter.cpp index 65b45f3..4c92b62 100644 --- a/ZAPD/OutputFormatter.cpp +++ b/ZAPD/OutputFormatter.cpp @@ -102,9 +102,8 @@ int (*OutputFormatter::StaticWriter())(const char* buf, int count) } OutputFormatter::OutputFormatter(uint32_t tabSize, uint32_t defaultIndent, uint32_t lineLimit) - : tabSize{tabSize}, defaultIndent{defaultIndent}, lineLimit{lineLimit}, col{0}, nest{0}, - nestIndent{defaultIndent}, currentIndent{defaultIndent}, - wordNests(0), wordP{word}, spaceP{space} + : tabSize{tabSize}, lineLimit{lineLimit}, col{0}, nest{0}, nestIndent{defaultIndent}, + currentIndent{defaultIndent}, wordNests(0), wordP{word}, spaceP{space} { } diff --git a/ZAPD/OutputFormatter.h b/ZAPD/OutputFormatter.h index b887b42..b024d95 100644 --- a/ZAPD/OutputFormatter.h +++ b/ZAPD/OutputFormatter.h @@ -8,7 +8,6 @@ class OutputFormatter { private: const uint32_t tabSize; - const uint32_t defaultIndent; const uint32_t lineLimit; uint32_t col; diff --git a/ZAPD/Overlays/ZOverlay.cpp b/ZAPD/Overlays/ZOverlay.cpp index c3e0d74..0f68c84 100644 --- a/ZAPD/Overlays/ZOverlay.cpp +++ b/ZAPD/Overlays/ZOverlay.cpp @@ -249,7 +249,7 @@ ZOverlay* ZOverlay::FromBuild(fs::path buildPath, fs::path cfgFolderPath) return ovl; } -std::string ZOverlay::GetSourceOutputCode(const std::string& prefix) +std::string ZOverlay::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string output = ""; diff --git a/ZAPD/ZAnimation.cpp b/ZAPD/ZAnimation.cpp index ae8ce40..812b461 100644 --- a/ZAPD/ZAnimation.cpp +++ b/ZAPD/ZAnimation.cpp @@ -23,7 +23,7 @@ void ZAnimation::ParseRawData() frameCount = BitConverter::ToInt16BE(parent->GetRawData(), rawDataIndex + 0); } -std::string ZAnimation::GetSourceOutputCode(const std::string& prefix) +std::string ZAnimation::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { return ""; } @@ -40,7 +40,7 @@ ZNormalAnimation::ZNormalAnimation(ZFile* nParent) : ZAnimation(nParent) limit = 0; } -std::string ZNormalAnimation::GetSourceOutputCode(const std::string& prefix) +std::string ZNormalAnimation::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { if (parent != nullptr) { @@ -138,7 +138,7 @@ ZLinkAnimation::ZLinkAnimation(ZFile* nParent) : ZAnimation(nParent) segmentAddress = 0; } -std::string ZLinkAnimation::GetSourceOutputCode(const std::string& prefix) +std::string ZLinkAnimation::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { if (parent != nullptr) { @@ -195,7 +195,7 @@ TransformData::TransformData(ZFile* parent, const std::vector<uint8_t>& rawData, { } -std::string TransformData::GetBody(const std::string& prefix) const +std::string TransformData::GetBody([[maybe_unused]] const std::string& prefix) const { return StringHelper::Sprintf("0x%04X, 0x%04X, %i, %i, %ff", unk_00, unk_02, unk_04, unk_06, unk_08); @@ -577,7 +577,7 @@ std::string ZLegacyAnimation::GetBodySourceCode() const return body; } -std::string ZLegacyAnimation::GetSourceOutputCode(const std::string& prefix) +std::string ZLegacyAnimation::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string body = GetBodySourceCode(); diff --git a/ZAPD/ZAnimation.h b/ZAPD/ZAnimation.h index 6dee02c..5f75ed1 100644 --- a/ZAPD/ZAnimation.h +++ b/ZAPD/ZAnimation.h @@ -51,7 +51,7 @@ public: std::string GetSourceTypeName() const override; protected: - virtual void ParseRawData() override; + void ParseRawData() override; }; class ZLinkAnimation : public ZAnimation @@ -66,7 +66,7 @@ public: std::string GetSourceTypeName() const override; protected: - virtual void ParseRawData() override; + void ParseRawData() override; }; class TransformData diff --git a/ZAPD/ZArray.cpp b/ZAPD/ZArray.cpp index ee10a13..f73c025 100644 --- a/ZAPD/ZArray.cpp +++ b/ZAPD/ZArray.cpp @@ -53,7 +53,7 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader) } } -std::string ZArray::GetSourceOutputCode(const std::string& prefix) +std::string ZArray::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string output = ""; diff --git a/ZAPD/ZBackground.cpp b/ZAPD/ZBackground.cpp index e56c1a4..ed2968c 100644 --- a/ZAPD/ZBackground.cpp +++ b/ZAPD/ZBackground.cpp @@ -160,7 +160,7 @@ void ZBackground::Save(const fs::path& outFolder) File::WriteAllBytes(filepath.string(), data); } -std::string ZBackground::GetBodySourceCode() +std::string ZBackground::GetBodySourceCode() const { std::string bodyStr = " "; diff --git a/ZAPD/ZBackground.h b/ZAPD/ZBackground.h index 292d8a4..8071f84 100644 --- a/ZAPD/ZBackground.h +++ b/ZAPD/ZBackground.h @@ -26,7 +26,7 @@ public: bool IsExternalResource() const override; std::string GetExternalExtension() const override; void Save(const fs::path& outFolder) override; - std::string GetBodySourceCode(); + std::string GetBodySourceCode() const override; std::string GetSourceOutputCode(const std::string& prefix) override; static std::string GetDefaultName(const std::string& prefix, uint32_t address); diff --git a/ZAPD/ZBlob.cpp b/ZAPD/ZBlob.cpp index 9449717..664e00a 100644 --- a/ZAPD/ZBlob.cpp +++ b/ZAPD/ZBlob.cpp @@ -49,7 +49,7 @@ void ZBlob::ParseRawData() parent->GetRawData().begin() + rawDataIndex + blobSize); } -std::string ZBlob::GetSourceOutputCode(const std::string& prefix) +std::string ZBlob::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { sourceOutput = ""; @@ -72,7 +72,7 @@ std::string ZBlob::GetSourceOutputCode(const std::string& prefix) return sourceOutput; } -std::string ZBlob::GetSourceOutputHeader(const std::string& prefix) +std::string ZBlob::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) { return StringHelper::Sprintf("extern u8 %s[];\n", name.c_str()); } diff --git a/ZAPD/ZCollision.cpp b/ZAPD/ZCollision.cpp index a5a3e2b..afbcd64 100644 --- a/ZAPD/ZCollision.cpp +++ b/ZAPD/ZCollision.cpp @@ -240,7 +240,8 @@ WaterBoxHeader::WaterBoxHeader(const std::vector<uint8_t>& rawData, uint32_t raw CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, const std::vector<uint8_t>& rawData, uint32_t rawDataIndex, - uint32_t polyTypeDefSegmentOffset, uint32_t polygonTypesCnt) + uint32_t polyTypeDefSegmentOffset, + [[maybe_unused]] uint32_t polygonTypesCnt) { std::string declaration = ""; diff --git a/ZAPD/ZCutscene.cpp b/ZAPD/ZCutscene.cpp index 9d182fb..01eab16 100644 --- a/ZAPD/ZCutscene.cpp +++ b/ZAPD/ZCutscene.cpp @@ -85,7 +85,7 @@ CutsceneCommandSceneTransFX::~CutsceneCommandSceneTransFX() { } -std::string ZCutscene::GetBodySourceCode() +std::string ZCutscene::GetBodySourceCode() const { std::string output = ""; size_t size = 0; @@ -448,7 +448,8 @@ ZResourceType ZCutscene::GetResourceType() const return ZResourceType::Cutscene; } -CutsceneCommand::CutsceneCommand(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex) +CutsceneCommand::CutsceneCommand([[maybe_unused]] const std::vector<uint8_t>& rawData, + [[maybe_unused]] uint32_t rawDataIndex) { } @@ -523,7 +524,7 @@ std::string CutsceneCommandSetCameraPos::GetCName() return ""; } -std::string CutsceneCommandSetCameraPos::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandSetCameraPos::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -614,7 +615,7 @@ std::string CutsceneCommandFadeBGM::GetCName() return "CsCmdMusicFade"; } -std::string CutsceneCommandFadeBGM::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandFadeBGM::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -667,7 +668,7 @@ CutsceneCommandPlayBGM::CutsceneCommandPlayBGM(const std::vector<uint8_t>& rawDa } } -std::string CutsceneCommandPlayBGM::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandPlayBGM::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -710,7 +711,7 @@ CutsceneCommandStopBGM::CutsceneCommandStopBGM(const std::vector<uint8_t>& rawDa } } -std::string CutsceneCommandStopBGM::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandStopBGM::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -768,7 +769,7 @@ CutsceneCommandEnvLighting::CutsceneCommandEnvLighting(const std::vector<uint8_t } } -std::string CutsceneCommandEnvLighting::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandEnvLighting::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -824,7 +825,7 @@ CutsceneCommandUnknown9::CutsceneCommandUnknown9(const std::vector<uint8_t>& raw } } -std::string CutsceneCommandUnknown9::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandUnknown9::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -882,7 +883,7 @@ CutsceneCommandUnknown::CutsceneCommandUnknown(const std::vector<uint8_t>& rawDa } } -std::string CutsceneCommandUnknown::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandUnknown::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -940,7 +941,7 @@ std::string CutsceneCommandDayTime::GetCName() return "CsCmdDayTime"; } -std::string CutsceneCommandDayTime::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandDayTime::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -991,7 +992,7 @@ std::string CutsceneCommandTextbox::GetCName() return "CsCmdTextbox"; } -std::string CutsceneCommandTextbox::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandTextbox::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -1057,7 +1058,7 @@ CutsceneCommandActorAction::CutsceneCommandActorAction(const std::vector<uint8_t } } -std::string CutsceneCommandActorAction::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandActorAction::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; std::string subCommand = ""; @@ -1114,7 +1115,7 @@ std::string CutsceneCommandTerminator::GetCName() return "CsCmdBase"; } -std::string CutsceneCommandTerminator::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandTerminator::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -1136,7 +1137,7 @@ CutsceneCommandEnd::CutsceneCommandEnd(const std::vector<uint8_t>& rawData, uint endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4); } -std::string CutsceneCommandEnd::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandEnd::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -1190,7 +1191,7 @@ CutsceneCommandSpecialAction::CutsceneCommandSpecialAction(const std::vector<uin } } -std::string CutsceneCommandSpecialAction::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandSpecialAction::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { std::string result = ""; @@ -1249,7 +1250,7 @@ CutsceneCommandSceneTransFX::CutsceneCommandSceneTransFX(const std::vector<uint8 endFrame = (uint16_t)BitConverter::ToInt16BE(rawData, rawDataIndex + 4); } -std::string CutsceneCommandSceneTransFX::GenerateSourceCode(uint32_t baseAddress) +std::string CutsceneCommandSceneTransFX::GenerateSourceCode([[maybe_unused]] uint32_t baseAddress) { return StringHelper::Sprintf("CS_SCENE_TRANS_FX(%i, %i, %i),\n", base, startFrame, endFrame); } diff --git a/ZAPD/ZCutscene.h b/ZAPD/ZCutscene.h index 33ca740..7a4261b 100644 --- a/ZAPD/ZCutscene.h +++ b/ZAPD/ZCutscene.h @@ -412,7 +412,7 @@ class ZCutsceneBase : public ZResource { public: ZCutsceneBase(ZFile* nParent); - virtual std::string GetBodySourceCode() = 0; + std::string GetBodySourceCode() const override = 0; virtual void DeclareVar(const std::string& prefix, const std::string& bodyStr) const = 0; virtual uint32_t getSegmentOffset() const = 0; }; @@ -425,7 +425,7 @@ public: void ParseRawData() override; - std::string GetBodySourceCode() override; + std::string GetBodySourceCode() const override; void DeclareVar(const std::string& prefix, const std::string& bodyStr) const override; std::string GetSourceOutputCode(const std::string& prefix) override; size_t GetRawDataSize() const override; diff --git a/ZAPD/ZCutsceneMM.cpp b/ZAPD/ZCutsceneMM.cpp index 11c9117..4d3c2af 100644 --- a/ZAPD/ZCutsceneMM.cpp +++ b/ZAPD/ZCutsceneMM.cpp @@ -12,7 +12,7 @@ ZCutsceneMM::~ZCutsceneMM() delete cmd; } -std::string ZCutsceneMM::GetBodySourceCode() +std::string ZCutsceneMM::GetBodySourceCode() const { std::string output = ""; diff --git a/ZAPD/ZCutsceneMM.h b/ZAPD/ZCutsceneMM.h index 5cda5a1..91a40e8 100644 --- a/ZAPD/ZCutsceneMM.h +++ b/ZAPD/ZCutsceneMM.h @@ -15,7 +15,7 @@ public: ZCutsceneMM(ZFile* nParent); virtual ~ZCutsceneMM(); - std::string GetBodySourceCode() override; + std::string GetBodySourceCode() const override; void DeclareVar(const std::string& prefix, const std::string& bodyStr) const override; std::string GetSourceOutputCode(const std::string& prefix) override; size_t GetRawDataSize() const override; diff --git a/ZAPD/ZDisplayList.cpp b/ZAPD/ZDisplayList.cpp index 3dac4e7..cac1be0 100644 --- a/ZAPD/ZDisplayList.cpp +++ b/ZAPD/ZDisplayList.cpp @@ -78,7 +78,8 @@ void ZDisplayList::ParseRawData() } } -Declaration* ZDisplayList::DeclareVar(const std::string& prefix, const std::string& bodyStr) +Declaration* ZDisplayList::DeclareVar([[maybe_unused]] const std::string& prefix, + const std::string& bodyStr) { return parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::Align8, GetRawDataSize(), GetSourceTypeName(), name, 0, bodyStr, true); @@ -1538,12 +1539,12 @@ void ZDisplayList::Opcode_G_ENDDL(std::string prefix, char* line) TextureGenCheck(prefix); } -std::string ZDisplayList::GetSourceOutputHeader(const std::string& prefix) +std::string ZDisplayList::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) { return ""; } -static int32_t GfxdCallback_FormatSingleEntry(void) +static int32_t GfxdCallback_FormatSingleEntry() { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); gfxd_puts("\t"); @@ -1656,7 +1657,7 @@ static int32_t GfxdCallback_Vtx(uint32_t seg, int32_t count) } static int32_t GfxdCallback_Texture(segptr_t seg, int32_t fmt, int32_t siz, int32_t width, - int32_t height, int32_t pal) + int32_t height, [[maybe_unused]] int32_t pal) { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); uint32_t texOffset = Seg2Filespace(seg, self->parent->baseAddress); @@ -1692,7 +1693,7 @@ static int32_t GfxdCallback_Texture(segptr_t seg, int32_t fmt, int32_t siz, int3 return 1; } -static int32_t GfxdCallback_Palette(uint32_t seg, int32_t idx, int32_t count) +static int32_t GfxdCallback_Palette(uint32_t seg, [[maybe_unused]] int32_t idx, int32_t count) { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); uint32_t palOffset = Seg2Filespace(seg, self->parent->baseAddress); @@ -2045,7 +2046,7 @@ void ZDisplayList::TextureGenCheck(std::string prefix) } } -bool ZDisplayList::TextureGenCheck(ZRoom* scene, ZFile* parent, std::string prefix, +bool ZDisplayList::TextureGenCheck(ZRoom* scene, ZFile* parent, [[maybe_unused]] std::string prefix, int32_t texWidth, int32_t texHeight, uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded, bool texIsPalette, ZDisplayList* self) diff --git a/ZAPD/ZDisplayList.h b/ZAPD/ZDisplayList.h index 50b5652..4ed1098 100644 --- a/ZAPD/ZDisplayList.h +++ b/ZAPD/ZDisplayList.h @@ -373,7 +373,7 @@ public: std::string ProcessGfxDis(const std::string& prefix); bool IsExternalResource() const override; - virtual std::string GetExternalExtension() const override; + std::string GetExternalExtension() const override; std::string GetSourceTypeName() const override; ZResourceType GetResourceType() const override; diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp index 56555e8..7d461b8 100644 --- a/ZAPD/ZFile.cpp +++ b/ZAPD/ZFile.cpp @@ -71,7 +71,8 @@ ZFile::~ZFile() } } -void ZFile::ParseXML(ZFileMode mode, XMLElement* reader, std::string filename, bool placeholderMode) +void ZFile::ParseXML(ZFileMode mode, XMLElement* reader, std::string filename, + [[maybe_unused]] bool placeholderMode) { if (filename == "") name = reader->Attribute("Name"); @@ -1227,7 +1228,7 @@ std::string ZFile::ProcessExterns() return output; } -std::string ZFile::ProcessTextureIntersections(std::string prefix) +std::string ZFile::ProcessTextureIntersections([[maybe_unused]] std::string prefix) { if (texturesResources.empty()) return ""; diff --git a/ZAPD/ZLimb.cpp b/ZAPD/ZLimb.cpp index c746c40..174ab04 100644 --- a/ZAPD/ZLimb.cpp +++ b/ZAPD/ZLimb.cpp @@ -446,7 +446,7 @@ void ZLimb::ParseRawData() { case ZLimbType::LOD: dList2Ptr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 12); - // Intended fallthrough + [[fallthrough]]; case ZLimbType::Standard: dListPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); break; diff --git a/ZAPD/ZMtx.cpp b/ZAPD/ZMtx.cpp index 9156b4a..87918b8 100644 --- a/ZAPD/ZMtx.cpp +++ b/ZAPD/ZMtx.cpp @@ -48,7 +48,7 @@ void ZMtx::DeclareVar(const std::string& prefix, const std::string& bodyStr) con GetSourceTypeName(), auxName, bodyStr); } -std::string ZMtx::GetBodySourceCode() +std::string ZMtx::GetBodySourceCode() const { std::string bodyStr = "\n"; diff --git a/ZAPD/ZMtx.h b/ZAPD/ZMtx.h index 7a98650..5a4d1ef 100644 --- a/ZAPD/ZMtx.h +++ b/ZAPD/ZMtx.h @@ -17,7 +17,7 @@ public: void DeclareVar(const std::string& prefix, const std::string& bodyStr) const; - std::string GetBodySourceCode(); + std::string GetBodySourceCode() const override; std::string GetSourceOutputCode(const std::string& prefix) override; static std::string GetDefaultName(const std::string& prefix, uint32_t address); diff --git a/ZAPD/ZPath.cpp b/ZAPD/ZPath.cpp index 9b9c0e2..c7be852 100644 --- a/ZAPD/ZPath.cpp +++ b/ZAPD/ZPath.cpp @@ -80,7 +80,7 @@ std::string ZPath::GetBodySourceCode() const return declaration; } -std::string ZPath::GetSourceOutputCode(const std::string& prefix) +std::string ZPath::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string declaration = GetBodySourceCode(); diff --git a/ZAPD/ZPath.h b/ZAPD/ZPath.h index 23e2933..21394fa 100644 --- a/ZAPD/ZPath.h +++ b/ZAPD/ZPath.h @@ -11,12 +11,12 @@ public: void ParseRawData() override; void DeclareReferences(const std::string& prefix) override; - std::string GetBodySourceCode() const; + std::string GetBodySourceCode() const override; std::string GetSourceTypeName() const override; ZResourceType GetResourceType() const override; - size_t GetRawDataSize() const; + size_t GetRawDataSize() const override; segptr_t GetListAddress() const; protected: @@ -32,13 +32,13 @@ class ZPath : public ZResource public: ZPath(ZFile* nParent); - void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex); + void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; void ParseXML(tinyxml2::XMLElement* reader) override; void ParseRawData() override; void DeclareReferences(const std::string& prefix) override; - std::string GetBodySourceCode() const; + std::string GetBodySourceCode() const override; std::string GetSourceOutputCode(const std::string& prefix) override; std::string GetSourceTypeName() const override; diff --git a/ZAPD/ZResource.cpp b/ZAPD/ZResource.cpp index 15b67a1..bec6cfe 100644 --- a/ZAPD/ZResource.cpp +++ b/ZAPD/ZResource.cpp @@ -114,7 +114,7 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader) } } -void ZResource::Save(const fs::path& outFolder) +void ZResource::Save([[maybe_unused]] const fs::path& outFolder) { } @@ -177,12 +177,12 @@ std::string ZResource::GetBodySourceCode() const return "ERROR"; } -std::string ZResource::GetSourceOutputCode(const std::string& prefix) +std::string ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { return ""; } -std::string ZResource::GetSourceOutputHeader(const std::string& prefix) +std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) { return ""; } @@ -191,7 +191,7 @@ void ZResource::ParseRawData() { } -void ZResource::DeclareReferences(const std::string& prefix) +void ZResource::DeclareReferences([[maybe_unused]] const std::string& prefix) { } diff --git a/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp b/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp index 3aefe42..35bd20c 100644 --- a/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp +++ b/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp @@ -8,7 +8,7 @@ SetAlternateHeaders::SetAlternateHeaders(ZFile* nParent) : ZRoomCommand(nParent) { } -void SetAlternateHeaders::DeclareReferences(const std::string& prefix) +void SetAlternateHeaders::DeclareReferences([[maybe_unused]] const std::string& prefix) { if (segmentOffset != 0) parent->AddDeclarationPlaceholder(segmentOffset); diff --git a/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp b/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp index a0a313d..59e11f3 100644 --- a/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp +++ b/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp @@ -176,7 +176,8 @@ ScrollingTexture::ScrollingTexture(const std::vector<uint8_t>& rawData, uint32_t { } -std::string ScrollingTexture::GenerateSourceCode(ZRoom* zRoom, uint32_t baseAddress) +std::string ScrollingTexture::GenerateSourceCode([[maybe_unused]] ZRoom* zRoom, + [[maybe_unused]] uint32_t baseAddress) { return StringHelper::Sprintf(" { %i, %i, 0x%02X, 0x%02X },", xStep, yStep, width, height); } @@ -237,7 +238,7 @@ FlashingTexture::FlashingTexture(const std::vector<uint8_t>& rawData, uint32_t r } } -std::string FlashingTexture::GenerateSourceCode(ZRoom* zRoom, uint32_t baseAddress) +std::string FlashingTexture::GenerateSourceCode(ZRoom* zRoom, [[maybe_unused]] uint32_t baseAddress) { if (primColorSegmentOffset != 0) { @@ -352,7 +353,8 @@ AnimatedMatTexCycleParams::AnimatedMatTexCycleParams(const std::vector<uint8_t>& } } -std::string AnimatedMatTexCycleParams::GenerateSourceCode(ZRoom* zRoom, uint32_t baseAddress) +std::string AnimatedMatTexCycleParams::GenerateSourceCode(ZRoom* zRoom, + [[maybe_unused]] uint32_t baseAddress) { if (textureSegmentOffsetsSegmentOffset != 0) { diff --git a/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h b/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h index 3284d81..96a979f 100644 --- a/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h +++ b/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h @@ -4,14 +4,15 @@ #include "ZRoom/ZRoomCommand.h" // TODO move into header and add all types -class AnitmatedTextureParams +class AnimatedTextureParams { public: + virtual ~AnimatedTextureParams() = default; virtual std::string GenerateSourceCode(ZRoom* zRoom, uint32_t baseAddress) = 0; virtual size_t GetParamsSize() = 0; }; -class ScrollingTexture : public AnitmatedTextureParams +class ScrollingTexture : public AnimatedTextureParams { public: ScrollingTexture(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex); @@ -47,7 +48,7 @@ public: uint8_t a; }; -class FlashingTexture : public AnitmatedTextureParams +class FlashingTexture : public AnimatedTextureParams { public: FlashingTexture(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex, int32_t type); @@ -70,7 +71,7 @@ public: std::vector<uint16_t> keyFrames; }; -class AnimatedMatTexCycleParams : public AnitmatedTextureParams +class AnimatedMatTexCycleParams : public AnimatedTextureParams { public: AnimatedMatTexCycleParams(const std::vector<uint8_t>& rawData, uint32_t rawDataIndex); @@ -97,7 +98,7 @@ public: int16_t type; segptr_t segmentAddress; uint32_t segmentOffset; - std::vector<std::shared_ptr<AnitmatedTextureParams>> params; + std::vector<std::shared_ptr<AnimatedTextureParams>> params; }; class SetAnimatedMaterialList : public ZRoomCommand diff --git a/ZAPD/ZRoom/Commands/SetEntranceList.cpp b/ZAPD/ZRoom/Commands/SetEntranceList.cpp index b344e52..df0ba69 100644 --- a/ZAPD/ZRoom/Commands/SetEntranceList.cpp +++ b/ZAPD/ZRoom/Commands/SetEntranceList.cpp @@ -9,7 +9,7 @@ SetEntranceList::SetEntranceList(ZFile* nParent) : ZRoomCommand(nParent) { } -void SetEntranceList::DeclareReferences(const std::string& prefix) +void SetEntranceList::DeclareReferences([[maybe_unused]] const std::string& prefix) { if (segmentOffset != 0) parent->AddDeclarationPlaceholder(segmentOffset); @@ -30,7 +30,7 @@ void SetEntranceList::ParseRawDataLate() } } -void SetEntranceList::DeclareReferencesLate(const std::string& prefix) +void SetEntranceList::DeclareReferencesLate([[maybe_unused]] const std::string& prefix) { if (!entrances.empty()) { diff --git a/ZAPD/ZRoom/Commands/SetExitList.cpp b/ZAPD/ZRoom/Commands/SetExitList.cpp index 2203c85..ec1ac10 100644 --- a/ZAPD/ZRoom/Commands/SetExitList.cpp +++ b/ZAPD/ZRoom/Commands/SetExitList.cpp @@ -9,7 +9,7 @@ SetExitList::SetExitList(ZFile* nParent) : ZRoomCommand(nParent) { } -void SetExitList::DeclareReferences(const std::string& prefix) +void SetExitList::DeclareReferences([[maybe_unused]] const std::string& prefix) { if (segmentOffset != 0) parent->AddDeclarationPlaceholder(segmentOffset); @@ -30,7 +30,7 @@ void SetExitList::ParseRawDataLate() } } -void SetExitList::DeclareReferencesLate(const std::string& prefix) +void SetExitList::DeclareReferencesLate([[maybe_unused]] const std::string& prefix) { if (!exits.empty()) { diff --git a/ZAPD/ZRoom/Commands/SetMesh.cpp b/ZAPD/ZRoom/Commands/SetMesh.cpp index 08ae6b8..d2c9337 100644 --- a/ZAPD/ZRoom/Commands/SetMesh.cpp +++ b/ZAPD/ZRoom/Commands/SetMesh.cpp @@ -113,7 +113,8 @@ RoomCommand SetMesh::GetRoomCommand() const return RoomCommand::SetMesh; } -PolygonDlist::PolygonDlist(const std::string& prefix, const std::vector<uint8_t>& nRawData, +PolygonDlist::PolygonDlist(const std::string& prefix, + [[maybe_unused]] const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex, ZFile* nParent, ZRoom* nRoom) { rawDataIndex = nRawDataIndex; @@ -151,7 +152,7 @@ void PolygonDlist::DeclareReferences(const std::string& prefix) xluDList = MakeDlist(xlu, prefix); } -ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, const std::string& prefix) +ZDisplayList* PolygonDlist::MakeDlist(segptr_t ptr, [[maybe_unused]] const std::string& prefix) { if (ptr == 0) { @@ -268,8 +269,9 @@ std::string PolygonDlist::GetName() return name; } -BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, const std::vector<uint8_t>& nRawData, - uint32_t nRawDataIndex, ZFile* nParent) +BgImage::BgImage(bool nIsSubStruct, const std::string& prefix, + [[maybe_unused]] const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex, + ZFile* nParent) { rawDataIndex = nRawDataIndex; parent = nParent; @@ -404,7 +406,8 @@ std::string BgImage::GetName() /* PolygonType section */ -PolygonTypeBase::PolygonTypeBase(ZFile* nParent, const std::vector<uint8_t>& nRawData, +PolygonTypeBase::PolygonTypeBase(ZFile* nParent, + [[maybe_unused]] const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex, ZRoom* nRoom) : rawDataIndex{nRawDataIndex}, parent{nParent}, zRoom{nRoom} { diff --git a/ZAPD/ZRoom/Commands/SetMesh.h b/ZAPD/ZRoom/Commands/SetMesh.h index 035952e..a22cbf6 100644 --- a/ZAPD/ZRoom/Commands/SetMesh.h +++ b/ZAPD/ZRoom/Commands/SetMesh.h @@ -95,6 +95,7 @@ public: PolygonTypeBase(ZFile* nParent, const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex, ZRoom* nRoom); + virtual ~PolygonTypeBase() = default; virtual void ParseRawData() = 0; virtual void DeclareReferences(const std::string& prefix) = 0; diff --git a/ZAPD/ZRoom/Commands/SetObjectList.h b/ZAPD/ZRoom/Commands/SetObjectList.h index 4f02017..7277146 100644 --- a/ZAPD/ZRoom/Commands/SetObjectList.h +++ b/ZAPD/ZRoom/Commands/SetObjectList.h @@ -10,7 +10,7 @@ public: SetObjectList(ZFile* nParent); void ParseRawData() override; - void DeclareReferences(const std::string& prefix); + void DeclareReferences(const std::string& prefix) override; std::string GetBodySourceCode() const override; diff --git a/ZAPD/ZRoom/Commands/SetPathways.cpp b/ZAPD/ZRoom/Commands/SetPathways.cpp index 91cd146..bd7e7a7 100644 --- a/ZAPD/ZRoom/Commands/SetPathways.cpp +++ b/ZAPD/ZRoom/Commands/SetPathways.cpp @@ -9,7 +9,7 @@ SetPathways::SetPathways(ZFile* nParent) : ZRoomCommand(nParent), pathwayList(nP { } -void SetPathways::DeclareReferences(const std::string& prefix) +void SetPathways::DeclareReferences([[maybe_unused]] const std::string& prefix) { if (segmentOffset != 0) parent->AddDeclarationPlaceholder(segmentOffset); diff --git a/ZAPD/ZRoom/Commands/SetRoomList.h b/ZAPD/ZRoom/Commands/SetRoomList.h index a7b45fe..9c390bf 100644 --- a/ZAPD/ZRoom/Commands/SetRoomList.h +++ b/ZAPD/ZRoom/Commands/SetRoomList.h @@ -20,7 +20,7 @@ public: SetRoomList(ZFile* nParent); void ParseRawData() override; - virtual void DeclareReferences(const std::string& prefix); + void DeclareReferences(const std::string& prefix) override; std::string GetBodySourceCode() const override; void PreGenSourceFiles() override; diff --git a/ZAPD/ZRoom/ZRoom.cpp b/ZAPD/ZRoom/ZRoom.cpp index f02b60e..8b7d39b 100644 --- a/ZAPD/ZRoom/ZRoom.cpp +++ b/ZAPD/ZRoom/ZRoom.cpp @@ -421,12 +421,12 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd) return 0; } -std::string ZRoom::GetSourceOutputHeader(const std::string& prefix) +std::string ZRoom::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) { return "\n" + extDefines + "\n\n"; } -std::string ZRoom::GetSourceOutputCode(const std::string& prefix) +std::string ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { sourceOutput = ""; diff --git a/ZAPD/ZRoom/ZRoomCommand.cpp b/ZAPD/ZRoom/ZRoomCommand.cpp index cbadaf2..caf7e43 100644 --- a/ZAPD/ZRoom/ZRoomCommand.cpp +++ b/ZAPD/ZRoom/ZRoomCommand.cpp @@ -31,7 +31,7 @@ void ZRoomCommand::ParseRawDataLate() { } -void ZRoomCommand::DeclareReferencesLate(const std::string& prefix) +void ZRoomCommand::DeclareReferencesLate([[maybe_unused]] const std::string& prefix) { } diff --git a/ZAPD/ZRoom/ZRoomCommand.h b/ZAPD/ZRoom/ZRoomCommand.h index 23b141f..e8ee4fb 100644 --- a/ZAPD/ZRoom/ZRoomCommand.h +++ b/ZAPD/ZRoom/ZRoomCommand.h @@ -69,7 +69,7 @@ public: virtual void ParseRawDataLate(); virtual void DeclareReferencesLate(const std::string& prefix); - virtual std::string GetBodySourceCode() const = 0; + std::string GetBodySourceCode() const override = 0; ZResourceType GetResourceType() const override; diff --git a/ZAPD/ZScalar.cpp b/ZAPD/ZScalar.cpp index a5e9580..007c1cd 100644 --- a/ZAPD/ZScalar.cpp +++ b/ZAPD/ZScalar.cpp @@ -247,7 +247,7 @@ std::string ZScalar::GetBodySourceCode() const } } -std::string ZScalar::GetSourceOutputCode(const std::string& prefix) +std::string ZScalar::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { if (parent != nullptr) parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(), diff --git a/ZAPD/ZSkeleton.cpp b/ZAPD/ZSkeleton.cpp index e8360eb..53659e5 100644 --- a/ZAPD/ZSkeleton.cpp +++ b/ZAPD/ZSkeleton.cpp @@ -121,7 +121,7 @@ size_t ZSkeleton::GetRawDataSize() const } } -std::string ZSkeleton::GetSourceOutputCode(const std::string& prefix) +std::string ZSkeleton::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string headerStr = GetBodySourceCode(); @@ -269,7 +269,7 @@ std::string ZLimbTable::GetBodySourceCode() const return body; } -std::string ZLimbTable::GetSourceOutputCode(const std::string& prefix) +std::string ZLimbTable::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string body = GetBodySourceCode(); diff --git a/ZAPD/ZString.cpp b/ZAPD/ZString.cpp index 67de99b..b545604 100644 --- a/ZAPD/ZString.cpp +++ b/ZAPD/ZString.cpp @@ -34,7 +34,7 @@ std::string ZString::GetBodySourceCode() const return StringHelper::Sprintf("\t\"%s\"", strData.data()); } -std::string ZString::GetSourceOutputCode(const std::string& prefix) +std::string ZString::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(), GetSourceTypeName(), name, 0, GetBodySourceCode()); @@ -42,7 +42,7 @@ std::string ZString::GetSourceOutputCode(const std::string& prefix) return ""; } -std::string ZString::GetSourceOutputHeader(const std::string& prefix) +std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) { return StringHelper::Sprintf("#define %s_macro \"%s\"", name.c_str(), strData.data()); } diff --git a/ZAPD/ZString.h b/ZAPD/ZString.h index 3c0c290..19b4abb 100644 --- a/ZAPD/ZString.h +++ b/ZAPD/ZString.h @@ -9,7 +9,7 @@ public: ZString(ZFile* nParent); void ParseRawData() override; - std::string GetBodySourceCode() const; + std::string GetBodySourceCode() const override; std::string GetSourceOutputCode(const std::string& prefix) override; std::string GetSourceOutputHeader(const std::string& prefix) override; diff --git a/ZAPD/ZTexture.cpp b/ZAPD/ZTexture.cpp index 27fc8d6..8698cc1 100644 --- a/ZAPD/ZTexture.cpp +++ b/ZAPD/ZTexture.cpp @@ -322,7 +322,7 @@ void ZTexture::PrepareBitmapPalette8() } } -void ZTexture::DeclareReferences(const std::string& prefix) +void ZTexture::DeclareReferences([[maybe_unused]] const std::string& prefix) { if (tlutOffset != static_cast<uint32_t>(-1)) { diff --git a/ZAPD/ZTexture.h b/ZAPD/ZTexture.h index acc4129..2ec4a4c 100644 --- a/ZAPD/ZTexture.h +++ b/ZAPD/ZTexture.h @@ -64,7 +64,7 @@ public: void ParseXML(tinyxml2::XMLElement* reader) override; void ParseRawData() override; void DeclareReferences(const std::string& prefix) override; - std::string GetBodySourceCode() const; + std::string GetBodySourceCode() const override; void CalcHash() override; void Save(const fs::path& outFolder) override; diff --git a/ZAPD/ZVector.cpp b/ZAPD/ZVector.cpp index 476cf5f..c8d634a 100644 --- a/ZAPD/ZVector.cpp +++ b/ZAPD/ZVector.cpp @@ -91,7 +91,7 @@ std::string ZVector::GetBodySourceCode() const return "{ " + body + "}"; } -std::string ZVector::GetSourceOutputCode(const std::string& prefix) +std::string ZVector::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { if (parent != nullptr) parent->AddDeclaration(rawDataIndex, DeclarationAlignment::None, GetRawDataSize(), diff --git a/ZAPD/ZVtx.cpp b/ZAPD/ZVtx.cpp index 902f21b..8b825b1 100644 --- a/ZAPD/ZVtx.cpp +++ b/ZAPD/ZVtx.cpp @@ -42,7 +42,7 @@ std::string ZVtx::GetBodySourceCode() const a); } -std::string ZVtx::GetSourceOutputCode(const std::string& prefix) +std::string ZVtx::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string output = GetBodySourceCode(); diff --git a/ZAPDUtils/StrHash.h b/ZAPDUtils/StrHash.h index a3eb0c9..858c517 100644 --- a/ZAPDUtils/StrHash.h +++ b/ZAPDUtils/StrHash.h @@ -6,6 +6,7 @@ typedef uint32_t strhash; +[[maybe_unused]] static strhash CRC32B(unsigned char* message, int32_t size) { int32_t byte = 0, crc = 0; @@ -28,6 +29,7 @@ static strhash CRC32B(unsigned char* message, int32_t size) return ~(uint32_t)(crc); } +[[maybe_unused]] constexpr static strhash CRC32BCT(const char* message, int32_t size) { int32_t byte = 0, crc = 0; |
