From d30207307445c914e1dec4bb0edb57c8a71ee12f Mon Sep 17 00:00:00 2001 From: LJW-Dev Date: Wed, 8 Oct 2025 21:33:13 +0800 Subject: [PATCH] Another refactor to remove leacy code that isn't used anymore --- .gitmodules | 3 -- src/Common/Game/T6/T6.h | 1 - src/Common/Game/T6/T6_Assets.h | 2 - src/ObjLoading/Asset/AssetCreationContext.cpp | 3 -- .../Game/T6/Script/ScriptCompileT6.cpp | 31 --------------- .../Game/T6/Script/ScriptCompileT6.h | 3 -- .../Game/T6/AssetNameResolverT6.cpp | 2 - .../Loading/Steps/StepVerifySignature.cpp | 2 +- .../Game/T6/ZoneWriterFactoryT6.cpp | 11 ++---- .../Writing/Steps/StepWriteZoneRSA.cpp | 38 ------------------- .../Writing/Steps/StepWriteZoneRSA.h | 13 ------- 11 files changed, 4 insertions(+), 105 deletions(-) delete mode 100644 src/ObjLoading/Game/T6/Script/ScriptCompileT6.cpp delete mode 100644 src/ObjLoading/Game/T6/Script/ScriptCompileT6.h delete mode 100644 src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.cpp delete mode 100644 src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.h diff --git a/.gitmodules b/.gitmodules index 84c41e45..b283a8c3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,6 +19,3 @@ [submodule "thirdparty/lz4"] path = thirdparty/lz4 url = https://github.com/lz4/lz4.git -[submodule "thirdparty/gsc-tool"] - path = thirdparty/gsc-tool - url = https://github.com/xensik/gsc-tool.git diff --git a/src/Common/Game/T6/T6.h b/src/Common/Game/T6/T6.h index 4b13191a..fbaa88db 100644 --- a/src/Common/Game/T6/T6.h +++ b/src/Common/Game/T6/T6.h @@ -302,7 +302,6 @@ namespace T6 using AssetFootstepTable = Asset; using AssetFootstepFxTable = Asset; using AssetZBarrier = Asset; - using AssetCustomMap = Asset; } // namespace T6 DEFINE_ASSET_NAME_ACCESSOR(T6::AssetPhysPreset, name); diff --git a/src/Common/Game/T6/T6_Assets.h b/src/Common/Game/T6/T6_Assets.h index c8488eef..c830fc6a 100644 --- a/src/Common/Game/T6/T6_Assets.h +++ b/src/Common/Game/T6/T6_Assets.h @@ -304,8 +304,6 @@ namespace T6 ASSET_TYPE_REPORT = 0x3E, ASSET_TYPE_DEPEND = 0x3F, ASSET_TYPE_FULL_COUNT = 0x40, - - ASSET_TYPE_CUSTOM_MAP = 0x41 }; enum XFileBlock diff --git a/src/ObjLoading/Asset/AssetCreationContext.cpp b/src/ObjLoading/Asset/AssetCreationContext.cpp index a33cebdd..deb08b5a 100644 --- a/src/ObjLoading/Asset/AssetCreationContext.cpp +++ b/src/ObjLoading/Asset/AssetCreationContext.cpp @@ -131,9 +131,6 @@ XAssetInfoGeneric* AssetCreationContext::LoadDependencyGeneric(const asset_type_ } else { - if (assetName[0] == ',') - return LoadDefaultAssetDependency(assetType, assetName); - std::cerr << std::format("Missing asset \"{}\" of type \"{}\"\n", assetName, *m_zone.m_pools->GetAssetTypeName(assetType)); } diff --git a/src/ObjLoading/Game/T6/Script/ScriptCompileT6.cpp b/src/ObjLoading/Game/T6/Script/ScriptCompileT6.cpp deleted file mode 100644 index db74229b..00000000 --- a/src/ObjLoading/Game/T6/Script/ScriptCompileT6.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "ScriptCompileT6.h" - -#include - - -char* compileScriptT6(const std::string& gscName, char* gscCode, size_t gscCodeSize, size_t* out_CompiledSize) -{ - try - { - xsk::arc::t6::pc::context context = xsk::arc::t6::pc::context(xsk::arc::instance::server); - - std::vector scriptBuffer; - scriptBuffer.resize(gscCodeSize); - memcpy(&scriptBuffer[0], gscCode, gscCodeSize); - - auto outasm = context.compiler().compile(gscName, scriptBuffer); - auto outbin = context.assembler().assemble(*outasm); - - char* compiledBuffer = new char[outbin.first.size]; - memcpy(compiledBuffer, outbin.first.data, outbin.first.size); - - *out_CompiledSize = outbin.first.size; - return compiledBuffer; - - } - catch (std::exception const& e) - { - printf(std::format("GSC Compile failed: {}\n", e.what()).c_str()); - return NULL; - } -} \ No newline at end of file diff --git a/src/ObjLoading/Game/T6/Script/ScriptCompileT6.h b/src/ObjLoading/Game/T6/Script/ScriptCompileT6.h deleted file mode 100644 index 522858a5..00000000 --- a/src/ObjLoading/Game/T6/Script/ScriptCompileT6.h +++ /dev/null @@ -1,3 +0,0 @@ -#include - -char* compileScriptT6(const std::string& gscName, char* gscCode, size_t gscCodeSize, size_t* out_CompiledSize); diff --git a/src/ZoneCommon/Game/T6/AssetNameResolverT6.cpp b/src/ZoneCommon/Game/T6/AssetNameResolverT6.cpp index 46c0a3fa..765172d6 100644 --- a/src/ZoneCommon/Game/T6/AssetNameResolverT6.cpp +++ b/src/ZoneCommon/Game/T6/AssetNameResolverT6.cpp @@ -9,8 +9,6 @@ AssetNameResolver::AssetNameResolver() { for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++) AddAssetTypeName(assetType, *GameAssetPoolT6::AssetTypeNameByType(assetType)); - - AddAssetTypeName(ASSET_TYPE_CUSTOM_MAP, "custom_map"); } GameId AssetNameResolver::GetGameId() const diff --git a/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp b/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp index e4093d85..6fb7780f 100644 --- a/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp +++ b/src/ZoneLoading/Loading/Steps/StepVerifySignature.cpp @@ -34,7 +34,7 @@ namespace if (!m_algorithm->Verify(signatureData, signatureDataSize, signature, signatureSize)) { - //throw InvalidSignatureException(); + throw InvalidSignatureException(); } } diff --git a/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp b/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp index 3f73d584..3d0d1d70 100644 --- a/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp +++ b/src/ZoneWriting/Game/T6/ZoneWriterFactoryT6.cpp @@ -14,7 +14,6 @@ #include "Writing/Steps/StepWriteZoneContentToFile.h" #include "Writing/Steps/StepWriteZoneContentToMemory.h" #include "Writing/Steps/StepWriteZoneHeader.h" -#include "Writing/Steps/StepWriteZoneRSA.h" #include "Writing/Steps/StepWriteZoneSizes.h" #include "Zone/XChunk/XChunkProcessorDeflate.h" #include "Zone/XChunk/XChunkProcessorSalsa20Encryption.h" @@ -100,9 +99,9 @@ std::unique_ptr ZoneWriterFactory::CreateWriter(const Zone& zone) co { auto writer = std::make_unique(); - bool isSecure = true; + // TODO Support signed fastfiles + bool isSecure = false; bool isEncrypted = true; - bool isOfficial = true; SetupBlocks(*writer); @@ -112,11 +111,7 @@ std::unique_ptr ZoneWriterFactory::CreateWriter(const Zone& zone) co writer->AddWritingStep(std::move(contentInMemory)); // Write zone header - writer->AddWritingStep(std::make_unique(CreateHeaderForParams(isSecure, isOfficial, isEncrypted))); - - // write RSA - if (isSecure) - writer->AddWritingStep(std::make_unique(zone.m_name)); + writer->AddWritingStep(std::make_unique(CreateHeaderForParams(isSecure, false, isEncrypted))); // Setup loading XChunks from the zone from this point on. ICapturedDataProvider* dataToSignProvider; diff --git a/src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.cpp b/src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.cpp deleted file mode 100644 index 96dde648..00000000 --- a/src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "StepWriteZoneRSA.h" - -#include "Game/T6/ZoneConstantsT6.h" - -StepWriteZoneRSA::StepWriteZoneRSA(std::string zoneName) - : m_zoneName(zoneName) -{ -} - -void StepWriteZoneRSA::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) -{ - stream->Write(T6::ZoneConstants::MAGIC_AUTH_HEADER, strlen(T6::ZoneConstants::MAGIC_AUTH_HEADER)); - - uint32_t loadFlags = 0; - stream->Write(&loadFlags, sizeof(uint32_t)); - - char fileName[32]; - memset(fileName, 0, 32); - strncpy(fileName, m_zoneName.c_str(), 31); - stream->Write(fileName, 32); - - //char data[256] = {0x75, 0xc2, 0xca, 0x61, 0x15, 0xef, 0xcb, 0xde, 0x42, 0xfc, 0xa8, 0xed, 0xb1, 0x77, 0x79, 0x93, 0x73, 0x28, 0x3e, 0x7f, 0xca, - // 0x76, 0x48, 0xc3, 0x21, 0x23, 0x86, 0xc3, 0x0f, 0xb6, 0xa6, 0xb5, 0xe9, 0xab, 0x40, 0x29, 0xb8, 0x3c, 0x03, 0xc4, 0xe0, 0x99, 0xed, - // 0xf2, 0x96, 0xd7, 0xb3, 0x95, 0x0d, 0x2e, 0xdd, 0xf0, 0x08, 0x6d, 0x5a, 0x95, 0x0b, 0x61, 0xd9, 0xde, 0xb4, 0x9d, 0x8a, 0x1b, 0x19, - // 0xa8, 0x88, 0xb4, 0x35, 0xe8, 0x25, 0x78, 0x21, 0x04, 0xbf, 0x36, 0x13, 0x9b, 0xf6, 0x10, 0x12, 0x8a, 0x08, 0x98, 0xf0, 0xb5, 0xdc, - // 0x8c, 0xd6, 0x37, 0x6d, 0x9a, 0xd8, 0xe4, 0x62, 0x5d, 0x02, 0xc1, 0xf6, 0xf1, 0xa1, 0x95, 0x93, 0x42, 0xee, 0xc2, 0x1a, 0xd9, 0xf0, - // 0x36, 0x36, 0x23, 0x50, 0x8b, 0x11, 0x90, 0x6a, 0xa1, 0x8d, 0xf6, 0xd0, 0xe4, 0xb5, 0x0f, 0xfd, 0x87, 0x2f, 0x46, 0xb9, 0x08, 0x3e, - // 0x38, 0xf9, 0x81, 0xaa, 0x39, 0x2b, 0xf7, 0x44, 0x44, 0x75, 0x0e, 0x8a, 0x09, 0x6c, 0x6f, 0x6e, 0xea, 0xd0, 0x32, 0x62, 0xfd, 0x98, - // 0x65, 0xb5, 0xbd, 0xc0, 0xae, 0x63, 0xf1, 0xe9, 0x24, 0x03, 0xfc, 0x34, 0xed, 0xb6, 0xbf, 0x0e, 0xd2, 0x56, 0x43, 0xea, 0xde, 0xff, - // 0x51, 0xa8, 0xb1, 0x93, 0x47, 0xe3, 0xc3, 0xee, 0xc2, 0xa3, 0x0a, 0x93, 0x14, 0x8f, 0x98, 0x7c, 0xaf, 0x2d, 0xa2, 0x2c, 0x71, 0x23, - // 0x60, 0x6a, 0x66, 0xd1, 0x6b, 0x55, 0xc0, 0x5d, 0x9b, 0xad, 0x18, 0xc5, 0xac, 0x2f, 0xa4, 0x00, 0xe8, 0xd0, 0xa6, 0xb4, 0x67, 0xa7, - // 0xbb, 0x7d, 0x4a, 0xbe, 0x02, 0xd0, 0xb6, 0xe0, 0xc6, 0xac, 0x1e, 0x59, 0x88, 0xcd, 0x26, 0x41, 0x73, 0x10, 0x65, 0x13, 0x79, 0x72, - // 0x5a, 0x26, 0x41, 0xe9, 0x89, 0x51, 0xc3, 0x79, 0x7d, 0x70, 0x3a, 0x5b, 0x94, 0x5d, 0xdd}; - - char data[256]; - memset(data, 0, 256); - stream->Write(data, 256); -} diff --git a/src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.h b/src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.h deleted file mode 100644 index 3dbd4822..00000000 --- a/src/ZoneWriting/Writing/Steps/StepWriteZoneRSA.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include "Writing/IWritingStep.h" - - -class StepWriteZoneRSA final : public IWritingStep -{ - std::string m_zoneName; - -public: - explicit StepWriteZoneRSA(std::string zoneName); - - void PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) override; -};