From 0aae00e75aee1c411b6ed5ffc6ae366a29c58d7b Mon Sep 17 00:00:00 2001 From: LolHacksRule Date: Sun, 19 Feb 2023 11:04:58 -0800 Subject: [PATCH] Fix WiiU GFXLibrary, messagetable and DKCTF texture read Actual commit this time --- CScaleformFlashLibrary.bt | 21 +- MaterialArchive.bt | 581 +++++++++--------- MessageStudioBinaryText.bt => MessageTable.bt | 20 +- NTextureFormat.bt | 7 +- Run.bt | 4 +- 5 files changed, 343 insertions(+), 290 deletions(-) rename MessageStudioBinaryText.bt => MessageTable.bt (92%) diff --git a/CScaleformFlashLibrary.bt b/CScaleformFlashLibrary.bt index 9d293ad..47e04b6 100644 --- a/CScaleformFlashLibrary.bt +++ b/CScaleformFlashLibrary.bt @@ -15,7 +15,8 @@ #define _CSCALEFORMFLASHLIBRARY typedef struct -{ ChunkDescriptor chunk; +{ + ChunkDescriptor chunk; struct CScaleformFlashLibraryChunk { uint32 referencedTextures; @@ -24,10 +25,24 @@ typedef struct struct ReferencedTxtr { GUID texRef; - CStringFixed texName; + if (ReadByte() == 0) + { + CStringFixed texName; + } + else + { + CString texName; + } } rtxtr[referencedTextures] ; } rtxrs; - CStringFixed theSWFName; + if (ReadByte() == 0) + { + CStringFixed theSWFName; + } + else + { + CString theSWFName; + } FSkip(4); //Skip ahead to see the SWF size LittleEndian(); //temp swap endian uint32 swfSize; //Pull SWF size diff --git a/MaterialArchive.bt b/MaterialArchive.bt index a7a1d62..e106813 100644 --- a/MaterialArchive.bt +++ b/MaterialArchive.bt @@ -1,274 +1,307 @@ -#ifndef _MATERIALARCHIVE -#define _MATERIALARCHIVE -struct SBufferTOCEntry { - uint unk1; - uint unk2; -}; - -struct CPermutation { - uint64 unk1; - uint64 unk2; -}; - -enum EMaterialTechnique { - kMT_None = 'x', /* offset 0x10 = 9, offset 0x20 = 0, offset 0x28 = 1, type = 0 */ - kMT_DepthOnly = 'z',/* offset 0x10 = 15, offset 0x20 = 0, offset 0x28 = 1, type 1 */ - kMT_DeferredGBuffer = 'g',/* offset 0x10 = 15, offset 0x20 = 0, offset 0x28 = 1, type 2 */ - kMT_DeferredInstance = 'i',/* offset 0x10 = 16, offset 0x20 = 0, offset 0x28 = 1, type 3 */ - kMT_ForwardRender = 'f', /* offset 0x10 = 13, offset 0x20 = 0, offset 0x28 = 1, type 4 */ - kMT_ParticleTechniqueSprite = 's', /* offset 0x10 = 23, offset 0x20 = 0, offset 0x28 = 1, type 5 */ - kMT_ParticleTechniqueSwoosh = 'w', /* offset 0x10 = 23, offset 0x20 = 0, offset 0x28 = 1, type 6 */ - kMT_ParticleTechniqueModel = 'm', /* offset 0x10 = 22, offset 0x20 = 0, offset 0x28 = 1, type 7 */ -}; - -struct CShaderIdentifier { - EMaterialTechnique matTechnique; - CPermutation perm; -}; - -struct SShaderTOCEntry { - CShaderIdentifier identifier; - uint unk1; - uint unk2; -}; - -struct SMaterialTOCEntry { - GUID guid; - uint unk1; - uint nameLen; - char name[nameLen]; - ushort unk2; - uint shaderEntryCount; - SShaderTOCEntry shaderEntries[shaderEntryCount]; - SBufferTOCEntry bufferToc; -}; - -struct SShaderSource { - uchar state; - uint strLen; - if (strLen) - char str[strLen]; - uint dataLen; - uchar data[dataLen]; -}; - -struct CShaderDefines { - struct Name { - uint str1Len; - char str1[str1Len]; - }; - - uint namesCount; - if (namesCount) - Name names[namesCount] ; - uint unk; -}; - -struct CShaderVariable { - -}; -struct SShaderImportDesc { - CShaderIdentifier ident; - uint64 shaderID; - int vertexProgramIndex; - int pixelProgramIndex; - int geomProgramIndex; - int computeProgramIndex; - uint unk; - CShaderDefines defines; - uint dataSize; - union { - struct { - uint variableCount; - CShaderVariable variables[1]; - } meta; - char data[dataSize]; - } data; -}; - - -struct SExpression { - uint unk1; - uint unk2; -}; - - -struct CBooleanExpressionEvaluator { - uint expressionCount; - SExpression expressions[expressionCount]; -}; - -struct SSimpleFeatureInstanceInternalOptionRequirement { - uint unk; - CBooleanExpressionEvaluator evaluator; -}; - -struct SSimpleFeatureInstanceShaderBinding { - CStringFixed name; - CStringFixed binding; -}; - -struct SSimpleFeatureInstanceInternalOption { - uint unk; - CShaderDefines shaderDefines; - uint bindingCount; - if (bindingCount) { - SSimpleFeatureInstanceShaderBinding binding[bindingCount] ; - } -}; - -struct IFeatureInstance; -struct CFeatureSet { - uint count; - IFeatureInstance features[count] ; - CBooleanExpressionEvaluator evaluator; -}; - -struct CSimpleFeatureInstance { - FourCC unk1; - uint fccCount; - uint fccs[fccCount]; - uint boolExpresionEvalCount; - CBooleanExpressionEvaluator evaluators[boolExpresionEvalCount] ; - uint internalOptionCount; - SSimpleFeatureInstanceInternalOption internalOption[internalOptionCount] ; - uint unk; - uint unkIntCount; - Assert(unkIntCount <= 32); - uint unkInts[unkIntCount]; - uint optionRequirementCount; - if (optionRequirementCount) - SSimpleFeatureInstanceInternalOptionRequirement optionRequirements[optionRequirementCount] ; -}; - -struct SCompositeFeatureInstanceInternalOptionRequirement { - uint unk; - CBooleanExpressionEvaluator eval; -}; - -struct SCompositeFeatureInstanceInternalOption { - CStringFixed name; - CPermutation perm; - CShaderDefines defines; -}; - -struct SCompositeFeatureInstanceArgument { - CStringFixed name; - CBooleanExpressionEvaluator evaluator; -}; - -struct CCompositeFeatureInstance { - CFeatureSet subSet; - uint argumentCount1; - if (argumentCount1) { - SCompositeFeatureInstanceArgument arguments1[argumentCount1] ; - } - uint argumentCount2; - if (argumentCount2) { - SCompositeFeatureInstanceArgument arguments2[argumentCount2] ; - } - - uint optionCount; - SCompositeFeatureInstanceInternalOption optionRequirements1[optionCount] ; - uint optionRequirementsCount; - SCompositeFeatureInstanceInternalOptionRequirement optionRequirements2[optionRequirementsCount] ; -}; - -struct IFeatureInstance; -struct CExplicitCompositeFeatureInstance; -struct CExplicitCompositeFeatureInstance { - CCompositeFeatureInstance base; - IFeatureInstance sub; -}; - -struct IFeatureInstance { - uint type; - CStringFixed name; - uint unk1; - uint unk2; - switch(type) { - case 0: - CSimpleFeatureInstance simple ; - break; - case 1: - CCompositeFeatureInstance composite ; - break; - case 2: - CExplicitCompositeFeatureInstance explicitComposite ; - break; - } -}; - -struct SDepthModeState { - -}; - -struct SStencilModeState { - -}; - -struct CGraphicsState { - uint flags; -}; - -struct SOverrideState { - CBooleanExpressionEvaluator evaluator; - CGraphicsState state; -}; -struct SMaterialImportDesc { - GUID guid; - uint shaderHash; - uint nameLen; - char name[nameLen]; - ushort unk2; - uint shaderImportCount; - SShaderImportDesc shaderImportDescs[shaderImportCount] ; - uint dataSize; - union { - struct { - uchar hasFeatureSet; - if (hasFeatureSet) { - CFeatureSet featureSet; - } - CGraphicsState state; - uint overrideStateCount; - if (overrideStateCount) { - SOverrideState overrideStates; - } - } meta; - char data[dataSize]; - } data; -}; - -struct MaterialBackend { - ChunkDescriptor chunk; - local uint64 start