1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-19 21:41:59 +00:00
oot/tools/ZAPD/ZAPD/ZFile.h
Zelllll 20c1f4e648
Decompile Gameplay_Keep and fix all existing decompiled objects (#595)
* First batch of files

* Add missing folders back

* Fix missing folders again

* Finish fixing existing texture files

* Gameplay_Keep XML finished

* Most actor gameplay_keep undefined syms removed

* Only ~200 gkeep symbols remain

* All gkeep symbols that ZAP supports are fixed

* Cleanup, and make gkeep names more accurate

* Starting to figure out what some unknown blobs are, merge zeldaret in

* fix a few more things

* refactor gkeep

* Change how gitkeep is handled

* gkeep xml cleanup

* Gkeep finished, now just waiting up ZAP updates

* 100 link animations finished

* 150 link animations finished

* 200 link animations finished

* 250 link animations finished

* 350 link animations finished

* 400 link animations finished

* 450 link animations finished

* 500 link animations finished

* 550 link animations finished

* All Link animations finished

cannot build yet because ZAP doesn't have LinkAnimationHeader yet

* xml changes for new zap stuff

* finish gameplay_keep

* fixing existing objects

* ready for pr besides zap padding issue

* mostly ready for pr

* format all c files

* all conflicts fixed

* make changes that roman requested

* fix thing i didn't mean to change

* some animation symbols renamed

* fixed roman's stuff

* lifemeter hardcoded pointers removed

* fix issue with incorrect data in gameplay_keep

* removed unused asm

* fixed most of fig's comments

* fix all of fig's comments

* reformat files

* Update assets/xml/textures/icon_item_static.xml

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* Update assets/xml/textures/icon_item_static.xml

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* fixed stuff

* fixed most of roman's comments

* remove leading zeroes

* should build now

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "f84d8337b"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "f84d8337b"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* all of gkeep symbols fixed

* compiler error fixed

* format files

* final changes

Co-authored-by: Zelllll <elijah@DESKTOP-NMP1I89.localdomain>
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
2021-01-24 19:36:40 -05:00

79 lines
No EOL
2.9 KiB
C++

#pragma once
#include <vector>
#include <string>
#include "tinyxml2.h"
#include "ZResource.h"
enum class ZFileMode
{
Build,
BuildTexture,
BuildOverlay,
BuildModelIntermediette,
BuildAnimationIntermediette,
BuildBlob,
BuildSourceFile,
Extract,
Invalid
};
enum class ZGame
{
OOT_RETAIL,
OOT_SW97,
MM_RETAIL
};
class ZFile
{
public:
std::map<int32_t, Declaration*> declarations;
std::string defines;
std::vector<ZResource*> resources;
uint32_t baseAddress, rangeStart, rangeEnd;
ZFile(std::string nOutPath, std::string nName);
ZFile(ZFileMode mode, tinyxml2::XMLElement* reader, std::string nBasePath, std::string nOutPath, std::string filename, bool placeholderMode);
~ZFile();
std::string GetVarName(int address);
std::string GetName();
void ExtractResources(std::string outputDir);
void BuildResources();
void BuildSourceFile(std::string outputDir);
void AddResource(ZResource* res);
Declaration* AddDeclaration(uint32_t address, DeclarationAlignment alignment, uint32_t size, std::string varType, std::string varName, std::string body);
Declaration* AddDeclaration(uint32_t address, DeclarationAlignment alignment, DeclarationPadding padding, uint32_t size, std::string varType, std::string varName, std::string body);
Declaration* AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, uint32_t size, std::string varType, std::string varName, int arrayItemCnt, std::string body);
Declaration* AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, DeclarationPadding padding, uint32_t size, std::string varType, std::string varName, int arrayItemCnt, std::string body);
Declaration* AddDeclarationPlaceholder(uint32_t address);
Declaration* AddDeclarationPlaceholder(uint32_t address, std::string varName);
Declaration* AddDeclarationInclude(uint32_t address, std::string includePath, uint32_t size, std::string varType, std::string varName);
Declaration* AddDeclarationIncludeArray(uint32_t address, std::string includePath, uint32_t size, std::string varType, std::string varName, int arrayItemCnt);
std::string GetDeclarationName(uint32_t address);
std::string GetDeclarationName(uint32_t address, std::string defaultResult);
Declaration* GetDeclaration(uint32_t address);
Declaration* GetDeclarationRanged(uint32_t address);
uint32_t GetDeclarationRangedAddress(uint32_t address);
bool HasDeclaration(uint32_t address);
std::string GetHeaderInclude();
void GeneratePlaceholderDeclarations();
protected:
std::vector<uint8_t> rawData;
std::string name;
std::string basePath;
std::string outputPath;
std::string sourceOutput;
ZFile();
void ParseXML(ZFileMode mode, tinyxml2::XMLElement* reader, std::string filename, bool placeholderMode);
void GenerateSourceFiles(std::string outputDir);
void GenerateHLIntermediette();
void AddDeclarationDebugChecks(uint32_t address);
std::string ProcessDeclarations();
void ProcessDeclarationText(Declaration* decl);
std::string ProcessExterns();
};