mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-14 21:45:16 -05:00
c4ce2f10cd
* update * Update generate-builds.yml * Update generate-builds.yml * sohotr in CI? * paths * gitignore soh.otr * Fix * no COMMAND maybe? * try generating otr as it's own step * deps * f * g * h * a * cc * ccc * m * blarg * try uploading * try * s * copy things * wii u? * wiiu * don't fail * windows without cpack? * wut * whoops * see all the things plz * b * v * zip working maybe * ok but this tho * pdb and switch * mac lus * soh.otr in appimage * down first * mac * bundle soh otr into mac app and read it from the bundle * appimage fix * try just downloading for mac? * i like to mv it mv it * mv to the right place * no more otrgui * bring back otrgui and assets * echo blarg * echo * zapd.exe * clean and remove * a * space --------- Co-authored-by: louis <louist103@gmail.com> Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Adam Bird <archez39@me.com>
111 lines
3.6 KiB
C++
111 lines
3.6 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "GameConfig.h"
|
|
#include "ZFile.h"
|
|
#include <ZRom.h>
|
|
#include <FileWorker.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;
|
|
ExporterSetFuncVoid3 endProgramFunc = 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;
|
|
bool singleThreaded;
|
|
VerbosityLevel verbosity; // ZAPD outputs additional information
|
|
ZFileMode fileMode = ZFileMode::Invalid;
|
|
fs::path baseRomPath, inputPath, outputPath, sourceOutputPath, cfgPath, fileListPath;
|
|
TextureType texType;
|
|
ZGame game;
|
|
GameConfig cfg;
|
|
bool verboseUnaccounted = false;
|
|
bool gccCompat = false;
|
|
bool forceStatic = false;
|
|
bool forceUnaccountedStatic = false;
|
|
bool otrMode = true;
|
|
bool buildRawTexture = false;
|
|
bool onlyGenSohOtr = false;
|
|
|
|
ZRom* rom;
|
|
std::vector<ZFile*> files;
|
|
std::vector<ZFile*> externalFiles;
|
|
std::vector<int32_t> segments;
|
|
|
|
std::map<int, FileWorker*> workerData;
|
|
|
|
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, int workerID);
|
|
bool HasSegment(int32_t segment, int workerID);
|
|
ZFile* GetSegment(int32_t segment, int workerID);
|
|
std::map<int32_t, std::vector<ZFile*>> GetSegmentRefFiles(int workerID);
|
|
void AddFile(ZFile* file, int workerID);
|
|
void AddExternalFile(ZFile* file, int workerID);
|
|
void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath);
|
|
|
|
ZResourceExporter* GetExporter(ZResourceType resType);
|
|
ExporterSet* GetExporterSet();
|
|
|
|
std::vector<uint8_t> GetBaseromFile(std::string fileName);
|
|
|
|
/**
|
|
* 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, int workerID);
|
|
|
|
bool GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile,
|
|
const std::string& expectedType, std::string& declName, int workerID);
|
|
};
|