diff options
| -rw-r--r-- | ZAPD/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | ZAPD/CrashHandler.cpp | 2 | ||||
| -rw-r--r-- | ZAPD/Main.cpp | 5 | ||||
| -rw-r--r-- | ZAPD/OtherStructs/CutsceneMM_Commands.cpp | 7 | ||||
| -rw-r--r-- | ZAPD/ZFile.cpp | 1 | ||||
| -rw-r--r-- | ZAPD/ZFile.h | 4 | ||||
| -rw-r--r-- | ZAPD/ZPointer.cpp | 2 | ||||
| -rw-r--r-- | ZAPD/ZRom.cpp | 14 | ||||
| -rw-r--r-- | ZAPD/ZRoom/ZRoomCommand.h | 2 |
9 files changed, 39 insertions, 14 deletions
diff --git a/ZAPD/CMakeLists.txt b/ZAPD/CMakeLists.txt index 12be637..b631ebd 100644 --- a/ZAPD/CMakeLists.txt +++ b/ZAPD/CMakeLists.txt @@ -61,6 +61,7 @@ set(Header_Files__Z64 "ZMtx.h"
"ZPath.h"
"ZPlayerAnimationData.h"
+ "ZPointer.h"
"ZResource.h"
"ZRom.h"
"ZScalar.h"
@@ -175,6 +176,7 @@ set(Source_Files__Z64 "ZMtx.cpp"
"ZPath.cpp"
"ZPlayerAnimationData.cpp"
+ "ZPointer.cpp"
"ZResource.cpp"
"ZRom.cpp"
"ZScalar.cpp"
@@ -278,7 +280,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
- elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
+ elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
@@ -294,7 +296,7 @@ endif() if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
foreach(ZTarget ${PROJECT_NAME} ZAPD)
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${ZTarget} PROPERTY MSVC_RUNTIME_LIBRARY)
- if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
+ if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
$<$<CONFIG:Debug>:
MultiThreadedDebug
@@ -318,7 +320,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") "_MBCS"
STORMLIB_NO_AUTO_LINK
)
- elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
+ elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_definitions(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:"
"_CRT_SECURE_NO_WARNINGS"
@@ -365,7 +367,7 @@ if(MSVC) ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
- elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
+ elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/Od
@@ -393,7 +395,7 @@ if(MSVC) >
/DEBUG:FULL
)
- elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86")
+ elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/PROFILE
@@ -443,7 +445,7 @@ add_dependencies(${PROJECT_NAME} )
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
- if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
+# if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
@@ -452,7 +454,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") storm
PNG::PNG
)
- endif()
+# endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
diff --git a/ZAPD/CrashHandler.cpp b/ZAPD/CrashHandler.cpp index 7ddec5a..6c05733 100644 --- a/ZAPD/CrashHandler.cpp +++ b/ZAPD/CrashHandler.cpp @@ -194,6 +194,7 @@ LONG seh_filter(_EXCEPTION_POINTERS* ex) void CrashHandler_Init() { + #if 0 #if HAS_POSIX == 1 signal(SIGSEGV, ErrorHandler); signal(SIGABRT, ErrorHandler); @@ -203,4 +204,5 @@ void CrashHandler_Init() HANDLE_WARNING(WarningType::Always, "tried to set error handler, but this ZAPD build lacks support for one", ""); #endif + #endif } diff --git a/ZAPD/Main.cpp b/ZAPD/Main.cpp index a388087..f5fc1f7 100644 --- a/ZAPD/Main.cpp +++ b/ZAPD/Main.cpp @@ -68,6 +68,9 @@ ZVtx vtx(nullptr); #include "ZRoom/ZRoom.h" ZRoom room(nullptr); + +#include "ZPointer.h" +ZPointer pointer(nullptr); // Linker Hacks End #include "ZFile.h" @@ -600,7 +603,7 @@ int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet) auto start = std::chrono::steady_clock::now(); int fileListSize = fileList.size(); - Globals::Instance->singleThreaded = false; + Globals::Instance->singleThreaded = true; for (int i = 0; i < fileListSize; i++) Globals::Instance->workerData[i] = new FileWorker(); diff --git a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp index 85fce22..508a7b4 100644 --- a/ZAPD/OtherStructs/CutsceneMM_Commands.cpp +++ b/ZAPD/OtherStructs/CutsceneMM_Commands.cpp @@ -76,16 +76,17 @@ std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const type = base ? "true" : "false"; if (type != "") - return StringHelper::Sprintf(entryFmt.c_str(), type.c_str(), startFrame, endFrame, pad); + return StringHelper::Sprintf("%s", entryFmt.c_str(), type.c_str(), startFrame, endFrame, + pad); if (commandId == CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING || commandId == CutsceneMM_CommandType::CS_CMD_START_SEQ || commandId == CutsceneMM_CommandType::CS_CMD_STOP_SEQ) { - return StringHelper::Sprintf(entryFmt.c_str(), base - 1, startFrame, endFrame, pad); + return StringHelper::Sprintf("%s", entryFmt.c_str(), base - 1, startFrame, endFrame, pad); } - return StringHelper::Sprintf(entryFmt.c_str(), base, startFrame, endFrame, pad); + return StringHelper::Sprintf("%s", entryFmt.c_str(), base, startFrame, endFrame, pad); } CutsceneMMCommand_GenericCmd::CutsceneMMCommand_GenericCmd(const std::vector<uint8_t>& rawData, diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp index 2f455b1..44974b3 100644 --- a/ZAPD/ZFile.cpp +++ b/ZAPD/ZFile.cpp @@ -31,6 +31,7 @@ #include "ZTexture.h" #include "ZVector.h" #include "ZVtx.h" +#undef FindResource ZFile::ZFile() { diff --git a/ZAPD/ZFile.h b/ZAPD/ZFile.h index 53cb2e0..92ed99b 100644 --- a/ZAPD/ZFile.h +++ b/ZAPD/ZFile.h @@ -1,11 +1,13 @@ #pragma once - +#define NO_GDI +#define WIN32_LEAN_AND_MEAN #include <string> #include <vector> #include "ZSymbol.h" #include "ZTexture.h" #include "tinyxml2.h" +#undef FindResource enum class ZFileMode { diff --git a/ZAPD/ZPointer.cpp b/ZAPD/ZPointer.cpp index 6e6945c..61ad9ac 100644 --- a/ZAPD/ZPointer.cpp +++ b/ZAPD/ZPointer.cpp @@ -31,7 +31,7 @@ std::string ZPointer::GetBodySourceCode() const { std::string ptrName; - Globals::Instance->GetSegmentedPtrName(ptr, parent, "", ptrName); + Globals::Instance->GetSegmentedPtrName(ptr, parent, "", ptrName, parent->workerID, false); return ptrName; } diff --git a/ZAPD/ZRom.cpp b/ZAPD/ZRom.cpp index e9b583b..938ac3a 100644 --- a/ZAPD/ZRom.cpp +++ b/ZAPD/ZRom.cpp @@ -66,6 +66,8 @@ namespace fs = std::filesystem; #define OOT_IQUE_CN 0xB1E1E07B #define UNKNOWN 0xFFFFFFFF +#define MM_NTSC_10 0xDA6983E7 + bool ZRom::IsMQ() { int crc = BitConverter::ToInt32BE(romData, 0x10); switch (crc) { @@ -82,6 +84,7 @@ bool ZRom::IsMQ() { case OOT_PAL_GC_DBG2: case OOT_IQUE_CN: case OOT_IQUE_TW: + case MM_NTSC_10: default: return false; case OOT_NTSC_JP_MQ: @@ -188,6 +191,10 @@ ZRom::ZRom(std::string romPath) version.listPath = "ique.txt"; version.offset = OOT_OFF_TW_IQUE; break; + case MM_NTSC_10: + version.version = "MM US 1.0"; + version.listPath = "mm.txt"; + version.offset = MM_OFF_US_10; } auto path = StringHelper::Sprintf("%s/%s", Globals::Instance->fileListPath.string().c_str(), version.listPath.c_str()); @@ -205,6 +212,13 @@ ZRom::ZRom(std::string romPath) const int virtEnd = BitConverter::ToInt32BE(romData, romOffset + 4); const int physStart = BitConverter::ToInt32BE(romData, romOffset + 8); const int physEnd = BitConverter::ToInt32BE(romData, romOffset + 12); + // File Deleted + if (physEnd == 0xFFFFFFFF && physStart == 0xFFFFFFFF) + { + // MM has some other checks that we might need to do + //if (virtEnd - virtStart == 0) + continue; + } const bool compressed = physEnd != 0; int size = compressed ? physEnd - physStart : virtEnd - virtStart; diff --git a/ZAPD/ZRoom/ZRoomCommand.h b/ZAPD/ZRoom/ZRoomCommand.h index 5e4d0bc..279f08d 100644 --- a/ZAPD/ZRoom/ZRoomCommand.h +++ b/ZAPD/ZRoom/ZRoomCommand.h @@ -46,7 +46,7 @@ enum class RoomCommand : uint8_t SetMinimapList = 0x1C, Unused1D = 0x1D, SetMinimapChests = 0x1E, - + SetCutscenesMM = 0x1F, // This opcode is not in the original game. Its a special command for OTRs. Error = 0xFF }; |
