name: Animated water and lights
description: The world's animated textures move: the sewers' water and light caustics, the waterfall, the Volga and the rivers, the embers, the fans. Their materials carry RenderWare's MatFX UV transform, but no world sector of the game's data enables the MatFX pipeline (its 0x120 chunk), so they were drawn still on every emulator and port.
author: crazyriddler (the analysis and the fix, Finest Hour Remastered e56c378); hakuX port

# Call of Duty: Finest Hour, the first release (version 1).
#
# RenderWare draws a material's UV animation only through the MatFX pipeline,
# and a world sector gets it only from the 0x120 chunk of its extension when
# the world loads (RpMatFXWorldSectorEnableEffects). None of the 9,971
# sectors in COD.PAK has one, while 82 materials in 56 worlds have the UV
# transform effect: the game computes their matrices each frame, and nothing
# applies them.
#
# RpWorldSectorRender (0x1f4b50) jumps to the code below first: a sector
# still on the default pipeline whose meshes' materials have MatFX effect 5
# or 6 (UV transform, dual UV transform) and no other effect gets the MatFX
# sector pipeline and its plugin flag, as the 0x120 chunk's reader would
# have done. Then the function's own first instruction, and on.
#
# The code sits in the header page over the XBE's RSA signature (0x10004,
# 256 bytes), which nothing reads once the title runs.

[default.xbe]
0x00010004: 56 57 53 8B 74 24 10 85 F6 74 79 8B 3D 9C 6E 3F
0x00010014: 00 85 FF 74 6F 83 3D C0 6F 3F 00 00 74 66 83 7E
0x00010024: 7C 00 75 60 8B 4E 78 85 C9 74 59 0F B7 51 04 85
0x00010034: D2 74 51 8B 41 0C 8D 4C 01 10 31 DB 8B 41 08 85
0x00010044: C0 74 19 03 05 88 6E 3F 00 8B 00 85 C0 74 0D 8B
0x00010054: 40 60 83 F8 1F 77 05 0F AB C3 EB 03 83 CB 01 83
0x00010064: C1 0C 4A 75 D7 F7 C3 60 00 00 00 74 17 F7 C3 9E
0x00010074: FF FF FF 75 0F C7 04 3E 01 00 00 00 A1 C0 6F 3F
0x00010084: 00 89 46 7C 5B 5F 5E 8B 0D 84 7C 40 00 E9 C0 4A
0x00010094: 1E 00
0x001F4B50: 8B 0D 84 7C 40 00 -> E9 AF B4 E1 FF 90
