1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-15 19:46:16 +00:00
oot/tools/ZAPD/ZAPD/Globals.h
Dragorn421 bdee3d33b4
No longer use asm-processor (#1824)
* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "b3bfa14cf"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "b3bfa14cf"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"

* use CS_FLOAT

* update csdis

* update committed csdata

* finish updating csdis.py

* add script to reextract committed csdata

* dont use asm-processor, use iconv for reencoding utf8 to eucjp

* remove asm-processor csdata usage remnants

* --cs-float hex

* delete tempfile at end of reencode.sh (may want to rm even if compilation fails though?)

* comment reencode.sh

* comment CMD_F

* do not break permuter guessing compile command, by not reencode.sh-wrapping compilation under PERMUTER (thanks anghelo)

* fix the permuter fix

* pad -> sBssDummyNeg1

* reencode.sh: rm tempfile on script exit (including on error)

* renumber sBssDummy vars in zcolchk from 0

* Revert "--cs-float hex"

This reverts commit 85267dc348.

* Revert BSS changes

* Add linemarker to reencoded files for better error message

* fix audio/general.c bss

* make reencode.sh work on macOS

* touch up csdis, csdis_re

---------

Co-authored-by: cadmic <cadmic24@gmail.com>
2024-03-01 16:12:22 -05:00

85 lines
2.5 KiB
C++

#pragma once
#include <map>
#include <string>
#include <vector>
#include "GameConfig.h"
#include "ZFile.h"
#include "ExporterSet.h"
class ZRoom;
enum class VerbosityLevel
{
VERBOSITY_SILENT,
VERBOSITY_INFO,
VERBOSITY_DEBUG
};
enum class CsFloatType
{
HexOnly,
FloatOnly,
HexAndFloat,
};
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;
CsFloatType floatType = CsFloatType::FloatOnly;
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 warnIfNotFound = true);
bool GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile,
const std::string& expectedType, std::string& declName,
bool warnIfNotFound = true);
// TODO: consider moving to another place
void WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res,
offset_t currentOffset);
};