summaryrefslogtreecommitdiff
path: root/ZAPD/ZFile.cpp
AgeCommit message (Collapse)Author
2026-05-30Removed StringHelper in favor of the LUS one (#38)Lywx
2023-10-28MMlouist103
2023-10-22Fixes for MMLouis
2023-10-18Merge branch 'JackMaster' into mergeJackOntoSquashbriaguya
Conflicts: ZAPD/Declaration.h ZAPD/Globals.cpp ZAPD/Globals.h ZAPD/Main.cpp ZAPD/OtherStructs/SkinLimbStructs.cpp ZAPD/OtherStructs/SkinLimbStructs.h ZAPD/ZAnimation.cpp ZAPD/ZCollision.cpp ZAPD/ZCollision.h ZAPD/ZDisplayList.cpp ZAPD/ZFile.cpp ZAPD/ZLimb.cpp ZAPD/ZLimb.h ZAPD/ZPath.cpp ZAPD/ZResource.h ZAPD/ZRoom/Commands/SetCsCamera.cpp ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp ZAPD/ZRoom/Commands/SetCutscenes.cpp ZAPD/ZRoom/Commands/SetCutscenes.h ZAPD/ZRoom/Commands/SetEntranceList.cpp ZAPD/ZRoom/Commands/SetLightingSettings.cpp ZAPD/ZRoom/Commands/SetMesh.cpp ZAPD/ZRoom/Commands/SetMinimapList.cpp ZAPD/ZTexture.cpp ZAPDUtils/Makefile ZAPDUtils/Utils/BitConverter.h ZAPDUtils/Utils/Directory.h ZAPDUtils/Utils/File.h ZAPDUtils/Utils/Path.h ZAPDUtils/Utils/StringHelper.h ZAPDUtils/ZAPDUtils.vcxproj
2023-10-17update to latest version used by SoHbriaguya
2023-07-20Updated to use clang-format-14 (#297)Nicholas Estelami
2023-05-30Some cleanup and refactoring (#295)Nicholas Estelami
* Cleaned up Main and improved documentation * Moved ZRoom::GetDeclarationSizeFromNeighbor into ZFile * Fixed compile issue
2023-05-05Refactor - Clean up ZTexture, ZFile, and Main (#292)Nicholas Estelami
* ZTexture and ZFile cleanup * Moved Exporter Set into its own file * Some minor renaming * Arguments handled through dictionary instead of if else chain * Build error fix
2023-05-04Cleaned up and Documented Declaration Class (#290)Nicholas Estelami
2023-05-03Defines for texture dimensions (#233)EllipticEllipsis
* Create functions to produce and add defines to the header * Format * Fix Jenkinsfile * Make gcc shut up about fallthrough * Fix symbols that start with g but are not global
2023-05-01Modify ZFile.cpp for inc file creation (#286)Captainkittyca2
2023-04-30Fixed issue with include paths on Windows (#284)Nicholas Estelami
2023-04-29Better checks for hex digits in XMLs (#279)louist103
* Better checking * cleanup logic and explain with a better comment * cleanups * last cleanup * the last one for real
2022-12-05Read from an external file for entrance lists (#271)louist103
* Read from entrance list file * Remove switch. * Add check for special entrances. * Ignore warning for GCC in specific spot. * u
2022-10-31Check for non hex in offset.louist103
2022-08-24Merge pull request #257 from louist103/guardsNicholas Estelami
Custom header guard support
2022-07-30Done?Louis
2022-07-18Use file name for guard.louist103
2022-07-18Custom header guards.louist103
2022-03-26Add cutscene extraction for MM (#242)Anghelo Carvajal
* Initial draft * crashes a lot less * Some scenes matches * GiveTatl * A class for every command * CS_MISC * A few macros * More commands * Macros for unknown commands * small cleanup * Remove useless destructors and fix warnings * More cleanup * format * Move stuff around * move commands to commands file * oot builds again * Mix OoT and MM SetTime commands * Name Terminator and Camera * MOTIONBLUR * Use CS_TEXT_LEARN_SONG in OoT * Macros for each type of textbox * Mix PlaySec and PlayBgm classes * Mix StopSeq and StopBgm * Mix the actor actions from oot and mm * Merge unknown command * Mix ZCutscene and ZCutsceneMM into one * Fix SCENE_CMD_CUTSCENE_LIST not using symbol and hardcoded MM cutscenes names * Mix OoT and MM LIGHTING class * Mix OoT and MM misc * Rumble * format * remove redundant else * CS_FADESCREEN * argument change * Remove some redundant parameters * Renames * format * Rename ChooseCredits class * Final cleanup * line * GenericCmd class for MM * Move some extra commands to csCommandsDescMM * Remove redundant GetCommandOoTFromID * CutsceneCommand_GenericCmd for OoT * Move CS_UNK_DATA to GenericCmd * Final cleanup * format * warning
2022-01-20Automatic limbs enum generation (#221)Anghelo Carvajal
* proof of concept * SetLimbIndex * LIMB_DONE * use proper enum name in limbs * fix naming * add ifdefs * fix me being dumb * format * Add EnumPrefix * EnumName * Remove autogenerator stuff * Add warnings * format * Use HANDLE_WARNING_RESOURCE for warning * object_box special case * whoops * Remove overloaded bitconverter methods and use boundary-checker .at method when possible * Fix warning * Fix warning * format * Hopefully fix every warning now * docs * Review * typo * Update jenkinsfile for MM * format * Force functionpreamble printing in development mode * Use ARRAY_COUNT on SkeletonHeaders * Simplify endif in header guards * fix limbs using the wrong enum value * use hex in enum comments
2021-12-26Add flag to force unaccounted to be static (#216)louist103
* add forced static * add flag for forcing unaccounted to be static * Update README.md Co-authored-by: Louis <louist103@pop-os.localdomain>
2021-12-26Fix padding generation for double word aligned variables (#223)Anghelo Carvajal
* Don't produce a symbol for 8byte aligned symbols * Change Vtx alignment to 8 * Remove Align16 * handle unaccounteds properly when stuff has Align8 alignment * format * Fix warning * typo
2021-12-25Add option for f3dex (#214)louist103
* add option for f3dex * fix * Make it actually good * Update ZAPD/Main.cpp Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
2021-11-30ZResource::GetSourceOutputCode no longer returns a string (#209)Nicholas Estelami
* Updated nuget to use newer version of libpng. Also updated uses of std::filesystem::path to be compliant with MSVC implementation. * Updated nuget to use newer version of libpng. Also updated uses of std::filesystem::path to be compliant with MSVC implementation. * GetSourceOutputCode no longer uses strings, and some overrides were removed. * Removed redundant GetSourceOutputHeader * Fixed MSVC issue * Changed libpng nuget package due to compilation issues. Other minor tweaks. Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
2021-11-27Updated MSVC libpng package to newer version (#208)Nicholas Estelami
* Updated nuget to use newer version of libpng. Also updated uses of std::filesystem::path to be compliant with MSVC implementation. * Updated nuget to use newer version of libpng. Also updated uses of std::filesystem::path to be compliant with MSVC implementation. * Added missing cpp file and adjusted MSVC includes * Added new function to StringHelper Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
2021-11-27Warning system (#189)EllipticEllipsis
* first draft * take vt.h from mm repo * Colors * Fix argument types * Add argument parser to errorhandler * Rename ErrorHandler to WarningHandler * Add -Wno- and more warning types * header and body in warnings * Small cleanup * Replace a bunch of warnings with the new system Co-authored-by: EllipticEllipsis <EllipticEllipsis@users.noreply.github.com> * Move stuff around * Move stuff to header * Make some more VT macros, new Warning_Build function + macro, ZBackground * Add remaining warnings * Add ZResource* param to Warning_Resource * Add warning help message * Simplify help message a bit * Refactor warnings into lots of helper functions * Fix HANG_INDT in the wild * Builds now * Update macros to use bold * Fix body printing and error colour * Add -Werror= * Add warningType to HANDLE_ERROR * Change some throws into HANDLE_ERROR * Create init and main maps and write new help printer * Changed ZTextureAnimation to new w/e * Typo * Delete build warnings list file * Use ERROR in ZResource and ZPath * Remove extra structs * Move ifdef into the InitMap, add descriptions * Actually move into initMap and add descriptions... * Remove Everything from the WarningType enum * Make more of the handler arguments const for compatibility * Fix warning * Document macros a bit * Add ImageBackend ERRRORs * Note on Weverything, rename InvalidData to InvalidExtractedData * add texture and mesh warnings/errors * InvalidExtractedData * Add description for InvalidPNG * print which warnings are enabled by using debug verbosity * Fix everything * Fix some newlines * Move help to the end, start some documentation * Remove unnecessary `WarningHandler::`s * Remove commented code * Some more documentation * Make first letters consistenty lowercase, more docs * Consistently use lowercase, more docs * Format consistently, more detail in documentation * Simplify enabled warnings checks * Rename HANDLE_WARNING_BUILD and add HANDLE_ERROR_PROCESS * Delete BuildInfo.cpp * Use PROCESS where possible, bit more documentation * Add documenation to README, sort when printing help * Add an example, escalate the rest of the invalids by default * Format warning names in table * format readme * Remove old flags info * Remove obsolete variables * Format * assert.h -> cassert * Replace some asserts in ZTexture * Remove test file * Minor cleanup * Bit more in the help * Fix header includes * Format * One character in readme * Update README.md Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> * Some Morita inspiration * Convert new errors * Static warnings/errors * Merge remote-tracking branch 'upstream/master' into errorlib * Add explanation for switch control flow * format * whooops * Fix segment warning that doesn't apply now we assume no segment means use VRAM * Comment out MM in Jenkinsfile Co-authored-by: Angie <angheloalf95@gmail.com> Co-authored-by: EllipticEllipsis <EllipticEllipsis@users.noreply.github.com>
2021-11-24Only use array lengths on static variables (#205)Anghelo Carvajal
* Only use the array length if static * Add a way to force the array count * format
2021-10-20Plug some large leaks, deprecate `Segment="128"` (#204)EllipticEllipsis
* Fix freeing an uninitialised camData * exporter leaks * vtx leak fix * Fix ZSkeleton OOB reading * Improve segment assignment checking and add a default Also prevents non-segmented files not being freed * Plug leak in MakeDlist * More segment improvements: deprecate 128 * add externalfile to extraction reference * whoops * format * Document new Segment behaviour * Use deprecation ifdef Co-authored-by: angie <angheloalf95@gmail.com>
2021-10-16Fix static forward declarations for remaining resources (#202)Anghelo Carvajal
* Add sizes to almost every extracted array * Remove redundant stuff in zfile (cherry picked from commit c1cbf20f6786994dabdaf9e0cb95549fe7adcf34) * this is dumb * format * Fix merge issue * whoops
2021-10-16`ExternalFile`: Expose other XML's declarations during extraction (#151)Anghelo Carvajal
* proof of concept * fix header include paths * GetDeclarationAlignment and others * this should fix this * minor * DeclareVar in ExtractFromXML * fix vtx intersections * Fix segmented vtxs * --version * zcollision changes * Use GetSegmentedPtrName a lot more * memory related stuff * minor style fixes and use the actual symbol for zlinkanimation instead of the hex address * Simplify lots of GetSourceOutputCode * ZSkeleton cleanup and other changes * Elevate unknown types in skeleton to errors * ZAnimation cleanup * Add ExternalFile to config * delete some code * Remove unused code * fix conflicts * format * remove redundant constructors * minor fixes * fix vtx warnings * extract every vtx as standalone files * format * uups * Bugfix: don't create extra blank files * Fix some Vtx warnings and remove "defaulting to normal" in skeleton error * Refactor ZLimb * Make each limb to look up in every file for dlists * Use GetSegmentedArrayIndexedName in VTX references in dlists * simplify simple condition * search by type * run format * Revert "search by type" This reverts commit a049bdfc94c4ab04613b354f466dee836a20508a. * Add range checks * uups * Always set rangeEnd * special case zsymbol * Revert "Revert "search by type"" This reverts commit 3f6e77c780bd30dc7000614304021a0940168316. * symbol fix and IsOffsetInFileRange * Bugfix and minor checks * run format * Don't extract data from external files * Fix extraction of overly big tluts * Minor changes * More minor fixes * Fix clang warnings * Remove unused parameter * Fix merge issues * Fix ZLimbTable::DeclareVar * Fix limbs not naming properly their DLists * Remove segment number check * Fix merge problems * Run formatter * Maybe fix? * path * empty commit * Fix a typo * Fix merge issues * Fix null ptr dereferencing * Fix merge issues and some clang warnings * Format * Fix not-matching * Format * Fix merge issues * Fix exporter * Last fixes I hope * Fix merge issues * format * fix * fix * I'm dumb * format * static fix * Whoops * fix asan * Fix? * fix * reduce artificial changes * reduce artificial changes 2 * reorder more stuff * format * fix borken thing * Remove redundant stuff in zfile * fix * Format * Fix conflict issues * format * cleanup header includes * format * Add error checks in for ExternalXMLFolder * format
2021-10-11Divide ReadConfigFile into separate functions and move them and the rest of ↵EllipticEllipsis
GameConfig to their own file (#168) * Working as a separate file * Actually use classes * Remove init, use invoke * Change configFilePath to a member of GameConfig * Remove commented stuff, format * Fix invoke, maybe? And lighten up the includes * string_view * Remove unnecessary std::string initialisations * Rest of Leo's review * Format * Merge remote-tracking branch 'upstream/master' into config * Fix merge breakages
2021-10-11string -> const string& and more (#199)louist103
* all possible strings use const & and make some strings const char* * remove ='' from new strings * formatter * revert globals * Fix warning (error)
2021-10-05ZResource cleanup (#178)Anghelo Carvajal
* Add some general use methods to ZResource * change zarray * adapt ztexture * Clean up ZCollision, ZPath, ZScalar and ZVector * cleanup background * cleanup zmtx * Clean up skeleton and limb * mark GetSourceTypeName as abstract * Remove redundant ExtractFromXML * Reorder stuff to minimize changes in github * remove extra ZDisplayList constructor * Remove using namespace tinyxml2; * run formatter * Add some brief descriptions, and remove some methods * Remove trivials GetSourceOutputCode and a bit of cleanup * Add more descriptions to methods * Fix blob build * improve descriptions a bit * Run formatter * Now builds * Add attributes and fix some warnings * format * fix merge issues * fix merge issues and some clang warnings * format * Run formatter * Fix merge issues * Format * add SEGMENTED_NULL * Fix merge issues * Run format * dumb fix * whoops * format * whoops
2021-10-01Add `--static` flag (#193)Anghelo Carvajal
* remove static from every extracted asset * fix makefile * Move a bunch of code to Declaration * make static enablalble * fix texture static * clean up * minor fixes * Format * add small docs * fix * add table * add note in the readme * typo * maybe_unused * Add warning to ZSymbol * format * fix
2021-09-29Remove `DeclarationPadding` and `DeclarationAlignment::None` (#186)Anghelo Carvajal
* Nuke DeclarationPadding * Remove DeclarationAlignment::None * Fix AddDeclaration memory leaks * Run formatter * Remove extra AddDeclarationPlaceholder * Revert "Remove extra AddDeclarationPlaceholder" This reverts commit 7a5d6a19d80bb246e0a6c8fde009b2a00a84ef96.
2021-09-25Change VTXs `#include`s to be consistent (#185)Anghelo Carvajal
* Change VTXs incloudes to be consistent * Remove redundant check * Run formatter * Emtpy commit to trigger Jenkins * update gitignore
2021-09-23Error if RangeStart is after RangeEnd (#190)louist103
* Error if RangeStart is after RangeEnd * Delete BuildInfo.h
2021-09-13ZRoom cleaning 3 (#140)Anghelo Carvajal
* Remove redundant scene member * altheaders clean * it is broken and I don't know why * fix VTXs * Fix the stuff I broke in SetRoomList * Add RoomAltHeader and SceneAltHeader * fix syotes again and set the size of each ZRoomCommand * Add SCENE_CMD_UNK_09 todo * Nuke HintSystem * run format * Remove `canHaveInner` from ZRoom since the HintSystem doesn't exists anymore * Remove sourceOutput member from ZResource * Update docs * run format * Add non 64-bits aligned textures warning * remove unused json library * Update SCENE_CMD_UNK_09 * Fix merge issues * run format * Clean up actorlist output * Fix merge conflicts * format * Fix actorlist extraction * Unify AltHeader * fix merge conflicts * Run formatter * minor style changes * fix using wrong symbols for extracted vtxs from overlays * format * fix makefile stuff * fix merge issue
2021-09-12Fix compilation with -Wextra (#164)Random
* 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
2021-09-12Run formatter (#170)EllipticEllipsis
2021-08-08Moved utility code into its own library (#162)Nicholas Estelami
* Initial exporter implementation * Updated to use static library. * minor cleanup * Cleaned things up a bit * Fixed merge issues * Minor commenting * Added Begin and End functions, and removed HL stuff (to be turned into an exporter at a later date) * Cleaned some stuff up * Additional cleanup * Removed some commented out code * Fixed compilation issues * Cleanup * Fixed merge issues * Got rid of unused windows.h includes * Cleanup * Fixed warning * Removed additional redundancies * Cleanup * Fixed merge issues * Fixed some compiler issues, added makefile for exportertest. * Removed redundancies and clang formatted * Made sure exportertest compiles with C++17 * Moved certain files into new "Utils" folder. * GetExporterMap uses a reference now * Minor fixes and updates. * Moved utility code into its own library * Fixed merge issues * Fixed compilation issue * Added missing classes * Updated makefile * Minor update * Forgot to make an enum an 'enum class' * Minor fix * Few more adjustments * Bug fix * Another bug fix * Bug fix again * added comment * New functions added for exporters * Made certain fields public Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
2021-08-05Exporter Support Added (#127)Nicholas Estelami
* Initial exporter implementation * Updated to use static library. * minor cleanup * Cleaned things up a bit * Fixed merge issues * Minor commenting * Added Begin and End functions, and removed HL stuff (to be turned into an exporter at a later date) * Cleaned some stuff up * Additional cleanup * Removed some commented out code * Fixed compilation issues * Cleanup * Fixed merge issues * Got rid of unused windows.h includes * Cleanup * Fixed warning * Removed additional redundancies * Cleanup * Fixed merge issues * Fixed some compiler issues, added makefile for exportertest. * Removed redundancies and clang formatted * Made sure exportertest compiles with C++17 * Moved certain files into new "Utils" folder. * GetExporterMap uses a reference now * Minor fixes and updates. Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
2021-07-25Add options for warning or erroring on missing "Offset" node (#156)louist103
* done * Fixes * Change * revert
2021-06-23Add support to `LegacyLimb`s and `LegacyAnimation`, making `object_human` ↵Anghelo Carvajal
extractable (#152) * proof of concept * Add hex type to ZScalar * minor fixes * BetaAnimation proof of concept * FrameData and JointKey * Fix warnings * Rename betalimb to legacylimb and move with the rest of limbs * Rename BetaAnimation to LegacyAnimation * Add verboseunaccounted * Add limb table * Use ZLimbTable in ZSkeleton * run format * Update docs * AnimationHeader2 -> LegacyAnimationHeader
2021-06-11strip extra padding at the end of each file (#150)Anghelo Carvajal
2021-06-10Add `OutName` attribute to `<File>` node (#146)Anghelo Carvajal
* create attribute * Minor fixes * Remove redundant `outputPath` * Add `OutName` to docs * Whoops, wrong branch
2021-06-04Optimize RAM usage and performance by removing redundant `rawData` (#148)Anghelo Carvajal
* Remove rawData from ZResource * Remove dlistRawData and some leftovers extra params * Run format * Unused variable warning
2021-05-26Check XML resource attributes (#126)Anghelo Carvajal
* register attibutes * fix array problems * cutscene problems * Set inner * fix merge * ups * Run format * small cleaning * A small blob cleanup * Simplify the logic a bit * ups * Fix merge problem * Fix merge issues * Fix merge issues * fix merge-produced type * Fix merge issues * run format and update easteregg * register ZPath attributes * dumb problems * How dumb can I be? * future proof change * empty commit * Check if Width and Height attributes of ZTexture has only decimal digits
2021-05-10ZRoom refactor (#124)Anghelo Carvajal
* Remove redundant methods * first pass os cleaning * More cleaning * Fix compilation errors * Fix dumb crashes * Fix dumb issues * Removing most uses of GenerateSourceCodePass1 * more cleanup * Move segmentOffset to ZRoomCommand * Half of ParseRawData * somehow broken... * fix broken stuff * This may or may not be broken * More cleaning * Remove GenerateSourceCodePass2 * More cleanup and pointer removal * Use PolygonType2 in SetMesh * another small cleanup * Merge PolygonDlist and PolygonDlist2 * More code merging * GetDeclarationPtrName * Remove most repeated externs and a bit of redundant code * Dumb MM fixes * small fix (cherry picked from commit 0813fd69538491c5aceb00d79d19bf59fd082ca7) * Another dumb fix * Remove GenerateExterns * Change DeclareReferences signature * Refactor SetAnimatedTextureList * const std::vector<uint8_t>& * another small bunch of changes * last parserawdata and declarereferences separation probably * Move parserawdata * Remove GenerateSourceCodePass1 * Use macros for commands * Make ZRoomCommand inherit ZResource * shrink scenes tluts * ProcessTextureIntersections * small output improvements * Small changes * run format * SCENE_CMD -> SCENECMD * fix merge errors * run format * fix some warnings * update macros names * Add again different commands for each game ni SCENE_CMD_ROOM_BEHAVIOR * macro update * More booleans * Move declaration to its own file * minor changes * Update according to latest reviews in oot * run format * Yet another cutscene change * Remove special scene/room segment code * This is crashing and I don't know why * remove includeFilePrefix * fix merge issues * always pass a parent to zresource * move path to its own zclass and properly implement parserawdata in commands * Fix GetDeclarationPtrName uses * Some ZPath fixes (still broken tho) * Fix ZPath declarations * Fix weird problem * Add `Path` to the docs * run format * clean syotes code * A bunch of changes for MM * run format