mirror of
https://github.com/zeldaret/oot.git
synced 2025-01-15 04:36:59 +00:00
9b67778a00
* git subrepo pull (merge) tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "945e6ca1a" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "50242eca9" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Fix extract_assets.py multithreading * Update binutils doc a bit * Remove * import, add multiprocessing option and way to pass arguments to ZAPD * Update format.sh to be more platform-independent * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "fd5a7f434" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "fd5a7f434" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Remove ; * Update formatting script to not just use 11 * Add Python requirements, move the Mac stuff in the README into its own doc * Fix readme link * Minor format thing * . * Move ZAPDArgs into its own function * Update readme and remove requirements.txt * Dragorn-inspired rewrite of processZAPDArgs * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "a0d3f7b68" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "a0d3f7b68" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Fix function definition * Building docs overhaul * Add Python packages to Mac and Cygwin * Heading number * format format.sh (!) * Replace "currently" * Remove Debian * git subrepo pull (merge) --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0ba781304" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0ba781304" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
93 lines
2.9 KiB
C++
93 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "GameConfig.h"
|
|
#include "ZFile.h"
|
|
|
|
class ZRoom;
|
|
|
|
enum class VerbosityLevel
|
|
{
|
|
VERBOSITY_SILENT,
|
|
VERBOSITY_INFO,
|
|
VERBOSITY_DEBUG
|
|
};
|
|
|
|
typedef void (*ExporterSetFunc)(ZFile*);
|
|
typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode);
|
|
typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i);
|
|
typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode);
|
|
typedef void (*ExporterSetFuncVoid3)();
|
|
typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer);
|
|
|
|
class ExporterSet
|
|
{
|
|
public:
|
|
~ExporterSet();
|
|
|
|
std::map<ZResourceType, ZResourceExporter*> exporters;
|
|
ExporterSetFuncVoid parseArgsFunc = nullptr;
|
|
ExporterSetFuncVoid2 parseFileModeFunc = nullptr;
|
|
ExporterSetFuncBool processFileModeFunc = nullptr;
|
|
ExporterSetFunc beginFileFunc = nullptr;
|
|
ExporterSetFunc endFileFunc = nullptr;
|
|
ExporterSetFuncVoid3 beginXMLFunc = nullptr;
|
|
ExporterSetFuncVoid3 endXMLFunc = nullptr;
|
|
ExporterSetResSave resSaveFunc = nullptr;
|
|
};
|
|
|
|
class Globals
|
|
{
|
|
public:
|
|
static Globals* Instance;
|
|
|
|
bool genSourceFile; // Used for extraction
|
|
bool useExternalResources;
|
|
bool testMode; // Enables certain experimental features
|
|
bool outputCrc = false;
|
|
bool profile; // Measure performance of certain operations
|
|
bool useLegacyZDList;
|
|
VerbosityLevel verbosity; // ZAPD outputs additional information
|
|
ZFileMode fileMode;
|
|
fs::path baseRomPath, inputPath, outputPath, sourceOutputPath, cfgPath;
|
|
TextureType texType;
|
|
ZGame game;
|
|
GameConfig cfg;
|
|
bool verboseUnaccounted = false;
|
|
bool gccCompat = false;
|
|
bool forceStatic = false;
|
|
bool forceUnaccountedStatic = false;
|
|
|
|
std::vector<ZFile*> files;
|
|
std::vector<ZFile*> externalFiles;
|
|
std::vector<int32_t> segments;
|
|
|
|
std::string currentExporter;
|
|
static std::map<std::string, ExporterSet*>& GetExporterMap();
|
|
static void AddExporter(std::string exporterName, ExporterSet* exporterSet);
|
|
|
|
Globals();
|
|
~Globals();
|
|
|
|
void AddSegment(int32_t segment, ZFile* file);
|
|
bool HasSegment(int32_t segment);
|
|
|
|
ZResourceExporter* GetExporter(ZResourceType resType);
|
|
ExporterSet* GetExporterSet();
|
|
|
|
/**
|
|
* Search in every file (and the symbol map) for the `segAddress` passed as parameter.
|
|
* If the segment of `currentFile` is the same segment of `segAddress`, then that file will be
|
|
* used only, otherwise, the search will be performed in every other file.
|
|
* The name of that variable will be stored in the `declName` parameter.
|
|
* Returns `true` if the address is found. `false` otherwise,
|
|
* in which case `declName` will be set to the address formatted as a pointer.
|
|
*/
|
|
bool GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile,
|
|
const std::string& expectedType, std::string& declName);
|
|
|
|
bool GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile,
|
|
const std::string& expectedType, std::string& declName);
|
|
};
|