1
0
mirror of https://github.com/blawar/ooot.git synced 2024-07-02 09:03:36 +00:00

moved segment marking into ZAPD

This commit is contained in:
Blake Warner 2022-02-11 00:00:50 -05:00
parent f2e2b8c38a
commit 3ad159855d
8 changed files with 17 additions and 21 deletions

@ -1 +1 @@
Subproject commit c5b63481ab58a58b84825c094db7c5c84c3972b0
Subproject commit 403658b456e0f4792c62d7fc8ba5fa273a7811a3

View File

@ -3,7 +3,7 @@
#include "porting_defs.h"
#define SEGMENT_ADDRESS(addr) (addr)
#define SEGMENT_ADDRESS(addr) ((uintptr_t)addr | 1)
//#pragma pack(1)

View File

@ -54,7 +54,7 @@ def build():
subprocess.check_call([sys.executable, str('tools/msgenc.py'), str('assets/text/charmap.txt'), str('assets/text/message_data_staff.h'), str('build/assets/text/message_data_staff.enc.h')])
subprocess.check_call([sys.executable, str('tools/extract_missing_assets.py')])
subprocess.check_call([sys.executable, str('tools/create_luts.py')])
subprocess.check_call([sys.executable, str('tools/mark_segments.py')])
#subprocess.check_call([sys.executable, str('tools/mark_segments.py')])
#subprocess.check_call([sys.executable, str('tools/extract_z64_variables.py')])
print("Finished asset extraction and parsing")

Binary file not shown.

View File

@ -159,7 +159,7 @@ bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile,
return true;
}
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}
@ -196,7 +196,7 @@ bool Globals::GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSi
}
}
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}

View File

@ -190,10 +190,6 @@ int main(int argc, char* argv[])
#if !defined(_MSC_VER) && !defined(__CYGWIN__)
signal(SIGSEGV, ErrorHandler);
signal(SIGABRT, ErrorHandler);
#else
HANDLE_WARNING(WarningType::Always,
"tried to set error handler, but this ZAPD build lacks support for one",
"");
#endif
}
else if (arg == "-v") // Verbose

View File

@ -705,7 +705,7 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l
if (pp != 0)
{
if (!Globals::Instance->HasSegment(segNum))
sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF);
sprintf(line, "gsSPBranchList(SEGMENT_ADDRESS(0x%08)" PRIX64 "),", data & 0xFFFFFFFF);
else if (dListDecl != nullptr)
sprintf(line, "gsSPBranchList(%s),", dListDecl->varName.c_str());
else
@ -715,7 +715,7 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l
else
{
if (!Globals::Instance->HasSegment(segNum))
sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF);
sprintf(line, "gsSPDisplayList(SEGMENT_ADDRESS(0x%08)" PRIX64 "),", data & 0xFFFFFFFF);
else if (dListDecl != nullptr)
sprintf(line, "gsSPDisplayList(%s),", dListDecl->varName.c_str());
else
@ -728,9 +728,9 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l
if (!Globals::Instance->HasSegment(segNum))
{
if (pp != 0)
sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF);
sprintf(line, "gsSPBranchList(SEGMENT_ADDRESS(0x%08)" PRIX64 "),", data & 0xFFFFFFFF);
else
sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF);
sprintf(line, "gsSPDisplayList(SEGMENT_ADDRESS(0x%08)" PRIX64 "),", data & 0xFFFFFFFF);
}
else
{
@ -807,7 +807,7 @@ void ZDisplayList::Opcode_G_MTX(uint64_t data, char* line)
if (Globals::Instance->cfg.symbolMap.find(mm) != Globals::Instance->cfg.symbolMap.end())
matrixRef = StringHelper::Sprintf("&%s", Globals::Instance->cfg.symbolMap[mm].c_str());
else
matrixRef = StringHelper::Sprintf("0x%08X", mm);
matrixRef = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", mm);
pp ^= 0x01;
@ -851,7 +851,7 @@ void ZDisplayList::Opcode_G_VTX(uint64_t data, char* line)
segptr_t segmented = data & 0xFFFFFFFF;
references.push_back(segmented);
parent->AddDeclaration(segmented, DeclarationAlignment::Align8, 16, "Vtx",
StringHelper::Sprintf("0x%08X", segmented), "");
StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segmented), "");
return;
}
references.push_back(data);
@ -962,7 +962,7 @@ void ZDisplayList::Opcode_G_SETTIMG(uint64_t data, const std::string& prefix, ch
sprintf(texStr, "%sTex_%06X", STR(prefix), texAddress);
else
{
sprintf(texStr, "0x%08" PRIX64, data & 0xFFFFFFFF);
sprintf(texStr, "SEGMENT_ADDRESS(0x%08)" PRIX64, data & 0xFFFFFFFF);
}
sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %s),", fmtTbl[fmt], sizTbl[siz], www + 1,

View File

@ -631,7 +631,7 @@ bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expect
Declaration* decl = GetDeclaration(offset);
if (GETSEGNUM(segAddress) != segment || decl == nullptr)
{
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}
@ -639,7 +639,7 @@ bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expect
{
if (expectedType != decl->varType && "static " + expectedType != decl->varType)
{
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}
}
@ -665,7 +665,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi
Declaration* decl = GetDeclarationRanged(address);
if (GETSEGNUM(segAddress) != segment || decl == nullptr || !decl->isArray)
{
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}
@ -673,7 +673,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi
{
if (expectedType != decl->varType && "static " + expectedType != decl->varType)
{
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}
}
@ -686,7 +686,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi
if ((address - decl->address) % elementSize != 0 || !(address < decl->address + decl->size))
{
declName = StringHelper::Sprintf("0x%08X", segAddress);
declName = StringHelper::Sprintf("SEGMENT_ADDRESS(0x%08X)", segAddress);
return false;
}