mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-27 03:42:19 -05:00
c80f9fbd57
* WIP Multiversion support * GC PAL Non-MQ support complete * Updated OtrGui to handle different game versions * Added version file * Added new extract mode to ZAPD and optimized OTR gen time * Fixed bug causing crash * Further optimized OTRExporter, saving around ~20 seconds. * ZAPD is now multi-threaded. * Fixed merge issue * Fixed memory leak and fog issue on pause screen. * Additional fog fixes. Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
78 lines
1.5 KiB
C++
78 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#if 0
|
|
|
|
#include "Utils/Directory.h"
|
|
#include "ZResource.h"
|
|
#include "elfio/elfio.hpp"
|
|
#include "tinyxml2.h"
|
|
|
|
enum class SectionType
|
|
{
|
|
Text = 1,
|
|
Data = 2,
|
|
RoData = 3,
|
|
Bss = 4,
|
|
ERROR = 255
|
|
};
|
|
|
|
enum class RelocationType
|
|
{
|
|
R_MIPS_32 = 2,
|
|
R_MIPS_26 = 4,
|
|
R_MIPS_HI16 = 5,
|
|
R_MIPS_LO16 = 6,
|
|
};
|
|
|
|
class RelocationEntry
|
|
{
|
|
public:
|
|
SectionType sectionType;
|
|
RelocationType relocationType;
|
|
int32_t offset;
|
|
|
|
RelocationEntry(SectionType nSecType, RelocationType nRelType, int32_t nOffset)
|
|
{
|
|
sectionType = nSecType;
|
|
relocationType = nRelType;
|
|
offset = nOffset;
|
|
}
|
|
|
|
uint32_t CalcRelocationWord()
|
|
{
|
|
uint32_t relocationWord = 0;
|
|
|
|
relocationWord |= static_cast<uint32_t>(sectionType) << 30;
|
|
relocationWord |= static_cast<uint32_t>(relocationType) << 24;
|
|
relocationWord |= offset;
|
|
|
|
return relocationWord;
|
|
}
|
|
|
|
const char* GetSectionName() const;
|
|
const char* GetRelocTypeName() const;
|
|
};
|
|
|
|
class ZOverlay
|
|
{
|
|
public:
|
|
std::string name;
|
|
|
|
ZOverlay(const std::string& nName);
|
|
~ZOverlay();
|
|
static ZOverlay* FromBuild(fs::path buildPath, fs::path cfgFolderPath);
|
|
std::string GetSourceOutputCode(const std::string& prefix);
|
|
|
|
private:
|
|
std::vector<RelocationEntry*> entries;
|
|
std::vector<std::string> cfgLines;
|
|
|
|
ZOverlay();
|
|
|
|
static SectionType GetSectionTypeFromStr(const std::string& sectionName);
|
|
// static std::string GetOverlayNameFromElf(ELFIO::elfio& reader);
|
|
|
|
ELFIO::Elf_Half FindSymbolInSection(const std::string& curSymName, ELFIO::section* sectionData,
|
|
ELFIO::elfio& reader, size_t readerId);
|
|
};
|
|
#endif
|