Implement built in Extractor for Windows (#2730)
* wip * const * split zapd into two targets * Workingish. * fix working dir and copy xmls on build (#2) * dont change current working dir with dialog prompts * copy asset xmls to target dir * make zpadlib public * Messagebox. * Check for WIN32 * threading * Cleanups to the exporter and main. * Multi extraction. * Fix byteswap header includes. * Fix another byteswap include. * fix again. * stddef size_t * Add other targets for ZAPDLib * Non windows. * IDYES IDNO * Linux fixes * hopefully remove switch and wiiu from building extractor * Please? * validate roms and add another valid rom * ifdef out extract.h for switch and wiiu * Maybe update lux * Remove ZAPDlib from switch and WiiU * more rules * Update soh/soh/Extractor/Extract.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update ZAPDTR/ZAPD/ExecutableMain.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update ZAPDTR/ZAPD/CMakeLists.txt Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update ZAPDTR/ZAPD/GameConfig.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update ZAPDTR/ZAPD/Globals.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update ZAPDTR/ZAPD/Main.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update soh/CMakeLists.txt Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update soh/soh/Extractor/Extract.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update soh/soh/Extractor/Extract.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Update soh/soh/Extractor/Extract.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * the last fix * Add context to a comment --------- Co-authored-by: Adam Bird <archez39@me.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
set(PROJECT_NAME ZAPD)
|
||||
set(PROJECT_NAME ZAPDLib)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
|
||||
#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
|
||||
@@ -260,10 +260,17 @@ set(ALL_FILES
|
||||
################################################################################
|
||||
# Target
|
||||
################################################################################
|
||||
add_executable(${PROJECT_NAME} ${ALL_FILES})
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${ALL_FILES})
|
||||
|
||||
add_executable(ZAPD ExecutableMain.cpp)
|
||||
target_link_libraries(ZAPD ${PROJECT_NAME})
|
||||
|
||||
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
|
||||
use_props(ZAPD "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
|
||||
endif()
|
||||
################################################################################
|
||||
# Includes for CMake from *.props
|
||||
@@ -282,7 +289,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
)
|
||||
endif()
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
set_target_properties(ZAPD PROPERTIES
|
||||
OUTPUT_NAME "ZAPD.out"
|
||||
)
|
||||
endif()
|
||||
@@ -290,7 +297,8 @@ endif()
|
||||
# MSVC runtime library
|
||||
################################################################################
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
|
||||
foreach(ZTarget ${PROJECT_NAME} ZAPD)
|
||||
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${ZTarget} PROPERTY MSVC_RUNTIME_LIBRARY)
|
||||
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
|
||||
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
|
||||
$<$<CONFIG:Debug>:
|
||||
@@ -302,7 +310,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
$<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
|
||||
)
|
||||
endif()
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
|
||||
set_target_properties(${ZTarget} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})
|
||||
endforeach()
|
||||
endif()
|
||||
################################################################################
|
||||
# Compile definitions
|
||||
@@ -404,7 +413,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC
|
||||
-Wall -Wextra -Wno-error
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
@@ -417,11 +426,11 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
|
||||
)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
target_link_options(${PROJECT_NAME} PUBLIC
|
||||
-pthread
|
||||
)
|
||||
else()
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
target_link_options(${PROJECT_NAME} PUBLIC
|
||||
-pthread
|
||||
-Wl,-export-dynamic
|
||||
)
|
||||
@@ -491,7 +500,7 @@ endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
|
||||
add_library(pathconf OBJECT pathconf.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}" $<TARGET_OBJECTS:pathconf> )
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC "${ADDITIONAL_LIBRARY_DEPENDENCIES}" $<TARGET_OBJECTS:pathconf> )
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
|
||||
endif()
|
||||
|
||||
5
ZAPDTR/ZAPD/ExecutableMain.cpp
Normal file
5
ZAPDTR/ZAPD/ExecutableMain.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
extern "C" int zapd_main(int argc, char* argv[]);
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
return zapd_main(argc, argv);
|
||||
}
|
||||
@@ -27,11 +27,14 @@ Globals::Globals()
|
||||
|
||||
Globals::~Globals()
|
||||
{
|
||||
auto& exporters = GetExporterMap();
|
||||
|
||||
for (auto& it : exporters)
|
||||
for (const auto& w : workerData)
|
||||
{
|
||||
delete it.second;
|
||||
delete w.second;
|
||||
}
|
||||
|
||||
if (rom != nullptr)
|
||||
{
|
||||
delete rom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
bool buildRawTexture = false;
|
||||
bool onlyGenSohOtr = false;
|
||||
|
||||
ZRom* rom;
|
||||
ZRom* rom = nullptr;
|
||||
std::vector<ZFile*> files;
|
||||
std::vector<ZFile*> externalFiles;
|
||||
std::vector<int32_t> segments;
|
||||
|
||||
@@ -4,9 +4,71 @@
|
||||
#include "Utils/File.h"
|
||||
#include "Utils/Path.h"
|
||||
#include "WarningHandler.h"
|
||||
|
||||
#include "ZAnimation.h"
|
||||
ZNormalAnimation nAnim(nullptr);
|
||||
ZCurveAnimation cAnim(nullptr);
|
||||
ZLinkAnimation lAnim(nullptr);
|
||||
ZLegacyAnimation lAnim2(nullptr);
|
||||
|
||||
#include "ZArray.h"
|
||||
ZArray arr(nullptr);
|
||||
|
||||
#include "ZAudio.h"
|
||||
ZAudio audio(nullptr);
|
||||
|
||||
#include "ZBackground.h"
|
||||
ZBackground back(nullptr);
|
||||
|
||||
#include "ZBlob.h"
|
||||
ZBlob blob(nullptr);
|
||||
|
||||
#include "ZCollision.h"
|
||||
ZCollisionHeader colHeader(nullptr);
|
||||
|
||||
#include "ZCutscene.h"
|
||||
ZCutscene cs(nullptr);
|
||||
|
||||
#include "ZLimb.h"
|
||||
ZLimb limb(nullptr);
|
||||
|
||||
#include "ZMtx.h"
|
||||
ZMtx mtx(nullptr);
|
||||
|
||||
#include "ZPath.h"
|
||||
ZPath path(nullptr);
|
||||
|
||||
#include "ZPlayerAnimationData.h"
|
||||
ZPlayerAnimationData pAnimData(nullptr);
|
||||
|
||||
#include "ZScalar.h"
|
||||
ZScalar scalar(nullptr);
|
||||
|
||||
#include "ZSkeleton.h"
|
||||
ZLimbTable limbTbl(nullptr);
|
||||
ZSkeleton skel(nullptr);
|
||||
|
||||
#include "ZString.h"
|
||||
ZString str(nullptr);
|
||||
|
||||
#include "ZSymbol.h"
|
||||
ZSymbol sym(nullptr);
|
||||
|
||||
#include "ZText.h"
|
||||
ZText txt(nullptr);
|
||||
|
||||
#include "ZTexture.h"
|
||||
ZTexture tex(nullptr);
|
||||
|
||||
#include "ZVector.h"
|
||||
ZVector vec(nullptr);
|
||||
|
||||
#include "ZVtx.h"
|
||||
ZVtx vtx(nullptr);
|
||||
|
||||
#include "ZRoom/ZRoom.h"
|
||||
ZRoom room(nullptr);
|
||||
|
||||
#include "ZFile.h"
|
||||
#include "ZTexture.h"
|
||||
|
||||
@@ -29,29 +91,6 @@
|
||||
const char gBuildHash[] = "";
|
||||
|
||||
// LINUX_TODO: remove, those are because of soh <-> lus dependency problems
|
||||
float divisor_num = 0.0f;
|
||||
|
||||
extern "C" void Audio_SetGameVolume(int player_id, float volume)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DebugConsole_SaveCVars()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DebugConsole_LoadCVars()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath,
|
||||
ZFileMode fileMode, int workerID);
|
||||
@@ -119,7 +158,9 @@ void ErrorHandler(int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
extern void ImportExporters();
|
||||
|
||||
extern "C" int zapd_main(int argc, char* argv[])
|
||||
{
|
||||
// Syntax: ZAPD.out [mode (btex/bovl/e)] (Arbritrary Number of Arguments)
|
||||
|
||||
@@ -242,6 +283,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
else if (arg == "-se" || arg == "--set-exporter") // Set Current Exporter
|
||||
{
|
||||
ImportExporters();
|
||||
Globals::Instance->currentExporter = argv[++i];
|
||||
}
|
||||
else if (arg == "--gcc-compat") // GCC compatibility
|
||||
@@ -434,6 +476,9 @@ int main(int argc, char* argv[])
|
||||
exporterSet->endProgramFunc();
|
||||
|
||||
end:
|
||||
delete exporterSet;
|
||||
|
||||
//Globals::Instance->GetExporterSet() = nullptr; //TODO NULL this out. Compiler complains about lvalue assignment.
|
||||
|
||||
delete g;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user