{$CLEO} {$I asmdef.txt} const LIGHT_STATES_OFFSET = 0x988 end 0AC6: 0@ = label @getTexture offset 0AC6: 1@ = label @jmp offset 0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x4C8311 then_jump 0x4C8319 offset_jump_in_asm 1@ 0AC6: 0@ = label @storeModel offset 0AC6: 1@ = label @jmp2 offset 0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x6D6622 then_jump 0x6D6627 offset_jump_in_asm 1@ 0AC6: 0@ = label @getTexture2 offset 0AC6: 1@ = label @jmp3 offset 0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x4C826B then_jump 0x4C8337 offset_jump_in_asm 1@ //getTexture 0AC6: 0@ = label @getTexture offset 0AC6: 1@ = label @renderedModel offset 0@ += 39 0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 0AC6: 0@ = label @new offset 0AC6: 2@ = label @lights_on offset 0A8C: 0@ 4 2@ 0 //getTexture2 0AC6: 0@ = label @getTexture2 offset 0AC6: 1@ = label @renderedModel offset 0@ += 7 0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 0AC6: 0@ = label @new2 offset 0AC6: 2@ = label @lights offset 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 //storeModel 0AC6: 0@ = label @storeModel offset 0@ += 10 0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 // patching _storeRenderLightParamsForVehicle 0AC6: 0@ = label @storelight offset 0AC6: 1@ = label @jmp4 offset 0AC6: 2@ = label @lightstates offset 0A8C: write_memory 0x4C82D8 size 4 value 2@ virtual_protect 1 0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x4C8C94 then_jump 0x4C8CD8 offset_jump_in_asm 1@ 0AC6: 0@ = label @sl_1 offset inc(2@) 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 dec(2@) 0AC6: 0@ = label @sl_2 offset 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 inc(2@, 3) 0AC6: 0@ = label @sl_3 offset 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 dec(2@) 0AC6: 0@ = label @sl_4 offset 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 0@ += 6 2@ += 2 4@ = LIGHT_STATES_OFFSET 4@ += 4 for 3@ = 0 to 11 0A8C: write_memory 0@ size 4 value 4@ virtual_protect 0 inc(4@) 0@ += 6 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 inc(2@) 0@ += 6 end // testing new materials 0AC6: 0@ = label @testmaterial offset 0AC6: 1@ = label @jmp5 offset 0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x4C82A4 then_jump 0x4C82B1 offset_jump_in_asm 1@ // test for damage texture 0AC6: 0@ = label @dam offset 0AC6: 1@ = label @jmp6 offset 0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x4C82DC then_jump 0x4C83AA offset_jump_in_asm 1@ 0AC6: 1@ = label @renderedModel offset 0@ += 34 0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 0AC6: 0@ = label @new6 offset 0AC6: 2@ = label @lights_dam offset 0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 0A93: :dam hex 80 FA 01 // cmp dl, 1 75 07 // jne short +7 BA E4 82 4C 00 // mov edx, 4C82E4h FF E2 // jmp edx 80 FA 02 // cmp dl, 2 75 66 // jne short +66h 8B 19 // mov ebx, [ecx] 89 03 // mov [ebx], eax 83 C3 04 // add ebx, 4 8B 30 // mov esi, [eax] 89 33 // mov [ebx], esi 83 01 08 // add dword ptr [ecx], 8 51 // push ecx 50 // push eax A1 00 00 00 00 // mov eax, RenderedModel 8B 04 85 C8 B0 A9 00 // mov eax, _modelPtrs[eax*4] 0F BF 48 0A // movsx ecx, word ptr [eax+Ah] 8B 15 0C 80 C8 00 // mov edx, _TexDictionaryPool 8B 72 04 // mov esi, [edx+4] 80 3C 31 00 // cmp byte ptr [ecx+esi], 0 79 04 // jns short +4 33 C9 // xor ecx, ecx EB 08 // jmp short +8 8B 12 // mov edx, [edx] 8D 0C 49 // lea ecx, [ecx+ecx*2] 8D 0C 8A // lea ecx, [edx+ecx*4] 8B 31 // mov esi, [ecx] 85 F6 // test esi, esi 74 23 // jz short +23h 68 end :new6 hex 00 00 00 00 // push offset "VEHICLELIGHTS_DAM" B8 00 CF 53 00 // mov eax, 53CF00h FF D0 // call eax 50 // push eax 56 // push esi B8 50 4E 73 00 // mov eax, 734E50h FF D0 // call eax 83 C4 0C // add esp, Ch 85 C0 // test eax, eax 74 07 // jz short +7 8B C8 // mov ecx, eax 58 // pop eax 89 08 // mov [eax], ecx EB 01 // jmp short +1 58 // pop eax 59 // pop ecx end :jmp6 hex E9 00 00 00 00 // jmp 4C83AAh end :storelight hex 8B F8 // mov edi, eax 8A 97 84 05 00 00 // mov dl, byte ptr [edi+CVehicle.dwRenderLights] 80 E2 01 // and dl, 1 6A 01 // push 1 8D 8F A0 05 00 00 // lea ecx, [edi+5A0h] B8 30 21 6C 00 // mov eax, 6C2130h FF D0 // call eax 85 C0 // test eax, eax 74 02 // jz short +2 B2 02 // mov dl, 2 88 15 end :sl_1 hex 00 00 00 00 // mov @lightstates[1], dl 8A 97 84 05 00 00 // mov dl, byte ptr [edi+CVehicle.dwRenderLights] D0 EA // shr dl, 1 80 E2 01 // and dl, 1 6A 00 // push 0 8D 8F A0 05 00 00 // lea ecx, [edi+5A0h] B8 30 21 6C 00 // mov eax, 6C2130h FF D0 // call eax 85 C0 // test eax, eax 74 02 // jz short +2 B2 02 // mov dl, 2 88 15 end :sl_2 hex 00 00 00 00 // mov @lightstates[0], dl 8A 97 84 05 00 00 // mov dl, byte ptr [edi+CVehicle.dwRenderLights] C0 EA 02 // shr dl, 2 80 E2 01 // and dl, 1 6A 02 // push 2 8D 8F A0 05 00 00 // lea ecx, [edi+5A0h] B8 30 21 6C 00 // mov eax, 6C2130h FF D0 // call eax 85 C0 // test eax, eax 74 02 // jz short +2 B2 02 // mov dl, 2 88 15 end :sl_3 hex 00 00 00 00 // mov @lightstates[3], dl 8A 97 84 05 00 00 // mov dl, byte ptr [edi+CVehicle.dwRenderLights] C0 EA 03 // shr dl, 3 80 E2 01 // and dl, 1 6A 03 // push 3 8D 8F A0 05 00 00 // lea ecx, [edi+5A0h] B8 30 21 6C 00 // mov eax, 6C2130h FF D0 // call eax 85 C0 // test eax, eax 74 02 // jz short +2 B2 02 // mov dl, 2 88 15 end :sl_4 hex 00 00 00 00 // mov @lightstates[2], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[4]] 88 15 00 00 00 00 // mov @lightstates[4], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[5]] 88 15 00 00 00 00 // mov @lightstates[5], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[6]] 88 15 00 00 00 00 // mov @lightstates[6], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[7]] 88 15 00 00 00 00 // mov @lightstates[7], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[8]] 88 15 00 00 00 00 // mov @lightstates[8], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[9]] 88 15 00 00 00 00 // mov @lightstates[9], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[10]] 88 15 00 00 00 00 // mov @lightstates[10], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[11]] 88 15 00 00 00 00 // mov @lightstates[11], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[12]] 88 15 00 00 00 00 // mov @lightstates[12], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[13]] 88 15 00 00 00 00 // mov @lightstates[13], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[14]] 88 15 00 00 00 00 // mov @lightstates[14], dl 8A 97 00 00 00 00 // mov dl, byte ptr [eax+CVehicle.bRenderLight[15]] 88 15 00 00 00 00 // mov @lightstates[15], dl end :jmp4 hex E9 00 00 00 00 // jmp 4C8CD8h end { RGB F_L FOG LEFT FF AE 00 R_L REV LEFT FF AD 00 F_R FOG RIGHT 00 FF C7 R_R REV LIGHT 00 FF C6 B_L BREAK LEFT B8 FF 00 T_LF TURN LEFT FRONT B7 FF 00 T_LM TURN LEFT MIDDLE B6 FF 00 T_LR TURN LEFT REAR B5 FF 00 B_R BREAK RIGHT FF 3B 00 T_RF TURN RIGHT FRONT FF 3A 00 T_RM TURN RIGHT MIDDLE FF 39 00 T_RR TURN RIGHT REAR FF 38 00 } :testmaterial hex 81 FE FF 3C 00 00 // cmp esi, 3CFFh 75 0A // jnz short +7 BF 03 00 00 00 // mov edi, 3 E9 BE 00 00 00 // jmp +BEh 81 FE B7 FF 00 00 // cmp esi, T_LF 75 0A // jnz short +7 BF 0A 00 00 00 // mov edi, Ah E9 AC 00 00 00 // jmp +AC 81 FE B6 FF 00 00 // cmp esi, T_LM 75 0A // jnz short +7 BF 0B 00 00 00 // mov edi, Bh E9 9A 00 00 00 // jmp +9Ah 81 FE B5 FF 00 00 // cmp esi, T_LR 75 0A // jnz short +7 BF 0C 00 00 00 // mov edi, Ch E9 88 00 00 00 // jmp +88h 81 FE FF 3A 00 00 // cmp esi, T_RF 75 0A // jnz short +7 BF 0D 00 00 00 // mov edi, Dh E9 76 00 00 00 // jmp +76h 81 FE FF 39 00 00 // cmp esi, T_RM 75 07 // jnz short +7 BF 0E 00 00 00 // mov edi, Eh EB 67 // jmp short +67h 81 FE FF 38 00 00 // cmp esi, T_RR 75 07 // jnz short +7 BF 0F 00 00 00 // mov edi, Fh EB 58 // jmp short +58h 81 FE B8 FF 00 00 // cmp esi, B_L 75 07 // jnz short +7 BF 04 00 00 00 // mov edi, 4 EB 49 // jmp short +49h 81 FE FF 3B 00 00 // cmp esi, B_R 75 07 // jnz short +7 BF 05 00 00 00 // mov edi, 5 EB 3A // jmp short +3Ah 81 FE FF AE 00 00 // cmp esi, F_L 75 07 // jnz short +7 BF 08 00 00 00 // mov edi, 8 EB 2B // jmp short +2Bh 81 FE 00 FF C7 00 // cmp esi, F_R 75 07 // jnz short +7 BF 09 00 00 00 // mov edi, 9 EB 1C // jmp short +1Ch 81 FE FF AD 00 00 // cmp esi, R_L 75 07 // jnz short +7 BF 06 00 00 00 // mov edi, 6 EB 0D // jmp short +Dh 81 FE 00 FF C6 00 // cmp esi, R_R 75 05 // jnz short +5 BF 07 00 00 00 // mov edi, 7 end :jmp5 hex E9 00 00 00 00 // jmp 4C82B1h end :getTexture hex 8B 19 // mov ebx, [ecx] // fixing Rockstar's bug, that after switching lights materials loss specular and diffuse color 83 C2 04 // add edx, 4 89 13 // mov [ebx], edx 83 C3 04 // add ebx, 4 8B 32 // mov esi, [edx] 89 33 // mov [ebx], esi 83 C3 04 // add ebx, 4 83 C2 04 // add edx, 4 89 13 // mov [ebx], edx 83 C3 04 // add ebx, 4 8B 32 // mov esi, [edx] 89 33 // mov [ebx], esi 83 EA 08 // sub edx, 8 83 01 10 // add dword ptr [ecx], 10h 50 // push eax 52 // push edx 56 // push esi A1 00 00 00 00 // mov eax, RenderedModel 8B 04 85 C8 B0 A9 00 // mov eax, _modelPtrs[eax*4] 0F BF 48 0A // movsx ecx, word ptr [eax+Ah] 8B 15 0C 80 C8 00 // mov edx, _TexDictionaryPool 8B 72 04 // mov esi, [edx+4] 80 3C 31 00 // cmp byte ptr [ecx+esi], 0 79 04 // jns short +4 33 C9 // xor ecx, ecx EB 08 // jmp short +8 8B 12 // mov edx, [edx] 8D 0C 49 // lea ecx, [ecx+ecx*2] 8D 0C 8A // lea ecx, [edx+ecx*4] 8B 31 // mov esi, [ecx] 85 F6 // test esi, esi 74 20 // jz short +20h 68 end :new hex 00 00 00 00 // push offset "VEHICLELIGHTS" B8 00 CF 53 00 // mov eax, 53CF00h FF D0 // call eax 50 // push eax 56 // push esi B8 50 4E 73 00 // mov eax, 734E50h FF D0 // call eax 83 C4 0C // add esp, Ch 85 C0 // test eax, eax 74 04 // jz short +4 8B C8 // mov ecx, eax EB 06 // jmp short +6 8B 0D 90 E6 B4 00 // ecx, texVehiclelightson128 5E // pop esi 5A // pop edx 58 // pop eex 89 08 // mov [eax], ecx end :jmp hex E9 00 00 00 00 // jmp 4C8319h end :storeModel hex A3 7C E4 B4 00 // mov dword ptr [B4E47C], eax 0F BF 46 22 // movsx eax, [esi+22h] A3 00 00 00 00 // mov RenderedModel, eax end :jmp2 hex E9 00 00 00 00 // jmp 6D6627h end :getTexture2 hex 53 // push ebx 51 // push ecx 57 // push edi 50 // push eax 52 // push edx 56 // push esi A1 00 00 00 00 // mov eax, RenderedModel 8B 04 85 C8 B0 A9 00 // mov eax, _modelPtrs[eax*4] 0F BF 48 0A // movsx ecx, word ptr [eax+Ah] 8B 15 0C 80 C8 00 // mov edx, _TexDictionaryPool 8B 72 04 // mov esi, [edx+4] 80 3C 31 00 // cmp byte ptr [ecx+esi], 0 79 04 // jns short +4 33 C9 // xor ecx, ecx EB 08 // jmp short +8 8B 12 // mov edx, [edx] 8D 0C 49 // lea ecx, [ecx+ecx*2] 8D 0C 8A // lea ecx, [edx+ecx*4] 8B 31 // mov esi, [ecx] 85 F6 // test esi, esi 74 20 // jz short +20h 68 end :new2 hex 00 00 00 00 // push offset "VEHICLELIGHTS" B8 00 CF 53 00 // mov eax, 53CF00h FF D0 // call eax 50 // push eax 56 // push esi B8 50 4E 73 00 // mov eax, 734E50h FF D0 // call eax 83 C4 0C // add esp, Ch 85 C0 // test eax, eax 74 04 // jz short +4 8B C8 // mov ecx, eax EB 06 // jmp short +6 8B 0D 8C E6 B4 00 // ecx, texVehiclelights128 5E // pop esi 5A // pop edx 58 // pop eex 5F // pop edi 3B F9 // cmp edi, ecx 75 09 // jnz short +9 59 // pop ecx 5B // pop ebx BF 77 82 4C 00 // mov edi, 4C8277h FF E7 // jmp edi 8B 0D 8C E6 B4 00 // mov ecx, texVehiclelights128 3B F9 // cmp edi, ecx 75 09 // jnz short +9 59 // pop ecx 5B // pop ebx BF 77 82 4C 00 // mov edi, 4C8277h FF E7 // jmp edi 59 // pop ecx 5B // pop ebx end :jmp3 hex E9 00 00 00 00 // jmp 4C8337h end :renderedModel hex 00000000 // ModelID end :lightstates hex 00 // LF 00 // RF 00 // LR 00 // RR 00 // breaklight L 00 // breaklight R 00 // reverselight L 00 // reverselight R 00 // foglight L 00 // foglight R 00 // turnlight LF 00 // turnlight LM 00 // turnlight LR 00 // turnlight RF 00 // turnlight RM 00 // turnlight RR end :lights hex "VEHICLELIGHTS" 00 end :lights_on hex "VEHICLELIGHTS_ON" 00 end :lights_dam hex "VEHICLELIGHTS_DAM" 00 end