diff options
| author | 2026-10-29 23:01:05 -0400 | |
|---|---|---|
| committer | 2026-10-29 23:01:05 -0400 | |
| commit | b1dfe847f742aa7079a819090ba36d606e7af4db (patch) | |
| tree | fa5d1f7a02f7b29f28ef54d051c34ffa10b9cc7b | |
| parent | 504e6e7ab767894b5f9f9276dfe9361979d5bcf2 (diff) | |
| download | WorldTuningTool-b1dfe847f742aa7079a819090ba36d606e7af4db.tar.gz WorldTuningTool-b1dfe847f742aa7079a819090ba36d606e7af4db.tar.bz2 WorldTuningTool-b1dfe847f742aa7079a819090ba36d606e7af4db.zip | |
LUT tweaks
Signed-off-by: Andrew Opalach <andrew@akon.city>
| -rw-r--r-- | LUT.cs | 16 | ||||
| -rw-r--r-- | Plugin.cs | 15 |
2 files changed, 15 insertions, 16 deletions
@@ -157,11 +157,10 @@ namespace WorldTuningTool fixed (byte *dataPointer = (byte[])data) { // DXGI_FORMAT_R16G16B16A16_FLOAT = 10 - return new Texture(texture).Replace(dataPointer, 10, 32, 32, 32); + new Texture(texture).Replace(dataPointer, 10, 32, 32, 32); } -#else - return true; #endif + return true; } private static bool overwriteFromFile(nint texture, string path) @@ -176,13 +175,10 @@ namespace WorldTuningTool private static bool overwriteFromMtFile(nint texture, string path) { MtFileStream? file = MtFileStream.FromPath(path, OpenMode.Read, false); - bool success = false; - if (file != null) - { - success = overwriteFromStream(texture, new MemoryStream(file.Read(file.Length))); - file.Close(); - } - return success; + if (file == null) return false; + MemoryStream stream = new MemoryStream(file.Read(file.Length)); + file.Close(); + return overwriteFromStream(texture, stream); } private static void reloadBlendLut(nint lightingObject) @@ -613,7 +613,6 @@ namespace WorldTuningTool } // Start of Parameter Definitions. - private delegate void OnAreaChange(nint sMhArea); private Hook<OnAreaChange>? onAreaChange; @@ -931,10 +930,11 @@ namespace WorldTuningTool private Hook<DestroyBloomObject>? destroyBloomObject; private nint bloomObject = 0x0; private static Parameter[] bloomParameters = { - // Disabling 'Draw' is a bad way to disable bloom. It breaks the filter on initial load which - // can be seen when returning to title or opening a guild card for the first time. Setting 'Bloom Renormalize' - // to 0.0 or 'Bloom Reduction Resolution' to -1 can both effectively disable bloom without that issue. - //newFlag<byte>("Bloom Enabled", 0x14, ParameterType.FLAG, (1 << 1)), // Draw + // Disabling "Draw" is a bad way to disable bloom as it breaks the filter on initialization. + // It can be seen when returning to title or opening a guild card for the first time. + // Setting "Bloom Renormalize" to 0.0 or "Bloom Reduction Resolution" to -1 can both + // effectively disable bloom without that issue. + //M<byte>("Bloom Enabled", 0x14, ParameterType.FLAG, (1 << 1)), // Draw P<float>("Bloom Threshold", 0x204, ParameterType.FLOAT, pStep(0.001f)), P<float>("Bloom Renormalize", 0x208, ParameterType.FLOAT, pMin(0.0f)), P<int>("Bloom Color", 0x200, ParameterType.COLOR), @@ -2283,6 +2283,9 @@ namespace WorldTuningTool sslrEnvMapIntensity.Update(sMhScene!.Instance, true); } + // Any CreateObject() can be called many times consecutively before it's associated DestroyObject(). + // For this to be correct, the most recent CreateObject() needs to be the object that is used. + // This is why we cannot, for example, Assert(toneMapObject == 0x0) in CreateToneMapObjectHook(). private nint CreateToneMapObjectHook() { toneMapObject = createToneMapObject!.Original(); @@ -2290,6 +2293,7 @@ namespace WorldTuningTool { param.Update(toneMapObject); } + Lut.clearState(); return toneMapObject; } @@ -2303,7 +2307,6 @@ namespace WorldTuningTool { param.Update(toneMapObject); } - Lut.clearState(); } return destroyToneMapObject!.Original(toneMapObjectInternal, unknownInt); } |