diff options
| author | 2026-03-17 14:51:15 -0400 | |
|---|---|---|
| committer | 2026-03-17 14:51:15 -0400 | |
| commit | b07893ab935c25d07d81f15521a25cca769a28c1 (patch) | |
| tree | 1a50706f01c84fd70695ea8d74f89eeaf4da3bde /Scripts | |
| parent | a6fcd3f4c75651e08c4392dea8a77b7fed1c2fe5 (diff) | |
| download | WorldTuningTool-b07893ab935c25d07d81f15521a25cca769a28c1.tar.gz WorldTuningTool-b07893ab935c25d07d81f15521a25cca769a28c1.tar.bz2 WorldTuningTool-b07893ab935c25d07d81f15521a25cca769a28c1.zip | |
Cleanup notes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'Scripts')
| -rw-r--r-- | Scripts/3dmigoto_unsigned_int_and_hacks.diff | 76 | ||||
| -rwxr-xr-x | Scripts/generate_diffs.sh | 4 |
2 files changed, 80 insertions, 0 deletions
diff --git a/Scripts/3dmigoto_unsigned_int_and_hacks.diff b/Scripts/3dmigoto_unsigned_int_and_hacks.diff new file mode 100644 index 0000000..b45317d --- /dev/null +++ b/Scripts/3dmigoto_unsigned_int_and_hacks.diff @@ -0,0 +1,76 @@ +For more complete decompile of Monster Hunter World shaders. +diff --git a/BinaryDecompiler/decode.cpp b/BinaryDecompiler/decode.cpp +index 89ac94f0..9356d27b 100644 +--- a/BinaryDecompiler/decode.cpp ++++ b/BinaryDecompiler/decode.cpp +@@ -333,7 +333,7 @@ uint32_t DecodeOperand (const uint32_t *pui32Tokens, Operand* psOperand) + } + default: + { +- ASSERT(0); ++ //ASSERT(0); + break; + } + } +diff --git a/HLSLDecompiler/DecompileHLSL.cpp b/HLSLDecompiler/DecompileHLSL.cpp +index 6175e733..24913e88 100644 +--- a/HLSLDecompiler/DecompileHLSL.cpp ++++ b/HLSLDecompiler/DecompileHLSL.cpp +@@ -1493,7 +1493,7 @@ public: + { + int in[4] = { 0, 0, 0, 0 }; + +- numRead = sscanf_s(c + pos, "// = %i %i %i %i", in + 0, in + 1, in + 2, in + 3); ++ numRead = sscanf_s(c + pos, "// = %d %d %d %d", in + 0, in + 1, in + 2, in + 3); + NextLine(c, pos, size); + + if (structLevel < 0) +@@ -1510,10 +1510,37 @@ public: + + for (int i = 0; i < numRead - 1; ++i) + { +- sprintf(buffer, "%i,", in[i]); ++ sprintf(buffer, "%d,", in[i]); + mOutput.insert(mOutput.end(), buffer, buffer + strlen(buffer)); + } +- sprintf(buffer, "%i};\n", in[numRead - 1]); ++ sprintf(buffer, "%d};\n", in[numRead - 1]); ++ mOutput.insert(mOutput.end(), buffer, buffer + strlen(buffer)); ++ } ++ else if (e.bt == DT_uint || e.bt == DT_uint2 || e.bt == DT_uint3 || e.bt == DT_uint4) ++ { ++ unsigned in[4] = { 0, 0, 0, 0 }; ++ ++ numRead = sscanf_s(c + pos, "// = %u %u %u %u", in + 0, in + 1, in + 2, in + 3); ++ NextLine(c, pos, size); ++ ++ if (structLevel < 0) ++ { ++ if (suboffset == 0) ++ sprintf(buffer, " %s%s %s : packoffset(c%u) = {", modifier.c_str(), type, name, packoffset); ++ else ++ sprintf(buffer, " %s%s %s : packoffset(c%u.%c) = {", modifier.c_str(), type, name, packoffset, INDEX_MASK[suboffset]); ++ } ++ else ++ sprintf(buffer, " %s%s%s %s = {", structSpacing.c_str(), modifier.c_str(), type, name); ++ ++ mOutput.insert(mOutput.end(), buffer, buffer + strlen(buffer)); ++ ++ for (int i = 0; i < numRead - 1; ++i) ++ { ++ sprintf(buffer, "%u,", in[i]); ++ mOutput.insert(mOutput.end(), buffer, buffer + strlen(buffer)); ++ } ++ sprintf(buffer, "%u};\n", in[numRead - 1]); + mOutput.insert(mOutput.end(), buffer, buffer + strlen(buffer)); + } + else if (e.bt == DT_float || e.bt == DT_float2 || e.bt == DT_float3 || e.bt == DT_float4) +@@ -2510,7 +2537,7 @@ public: + else if (!strncmp(textype, "TextureCubeArray<", strlen("TextureCubeArray<"))) pos = 5; // float4 .xyzw + else logDecompileError(" unknown texture type for truncation: " + string(textype)); + cpos = strrchr(op, '.'); +- cpos[pos] = 0; ++ if (cpos) cpos[pos] = 0; + } + } + diff --git a/Scripts/generate_diffs.sh b/Scripts/generate_diffs.sh index b0c5687..d7e0d70 100755 --- a/Scripts/generate_diffs.sh +++ b/Scripts/generate_diffs.sh @@ -1,5 +1,9 @@ #! /usr/bin/env sh +# https://github.com/bo3b/3Dmigoto +# Disassemble: cmd_Decompiler.exe -d shader.dxbc (saved from RenderDoc). +# Assemble: cmd_Decompiler.exe -a shader.asm (edited) + #wine cmd_Decompiler.exe -d ../Shaders/Original/*.dxbc #wine cmd_Decompiler.exe -d ../Shaders/*.shdr #diff -u orig.asm edit.asm |