WopsS / RED4ext.SDK

A library to create mods for REDengine 4 (Cyberpunk 2077), independently of RED4ext.
MIT License
100 stars 33 forks source link

Update patterns.py #85

Closed maximegmd closed 1 year ago

FransBouma commented 1 year ago

CRTTISystem::Get() seems to be:

Cyberpunk2077.exe+2A3F08 - 48 83 EC 28           - sub rsp,28 { 40 }
Cyberpunk2077.exe+2A3F0C - 65 48 8B 04 25 58000000  - mov rax,gs:[00000058] { 88 }
Cyberpunk2077.exe+2A3F15 - BA 10000000           - mov edx,00000010 { 16 }
Cyberpunk2077.exe+2A3F1A - 48 8B 08              - mov rcx,[rax]
Cyberpunk2077.exe+2A3F1D - 8B 04 0A              - mov eax,[rdx+rcx]
Cyberpunk2077.exe+2A3F20 - 39 05 7A50B103        - cmp [Cyberpunk2077.exe+3DB8FA0],eax { (-2147483645) }
Cyberpunk2077.exe+2A3F26 - 0F8F E4E1AC01         - jg Cyberpunk2077.exe+1D72110
Cyberpunk2077.exe+2A3F2C - 80 3D 24B82503 00     - cmp byte ptr [Cyberpunk2077.exe+34FF757],00 { (1),0 }
Cyberpunk2077.exe+2A3F33 - 0F84 13E2AC01         - je Cyberpunk2077.exe+1D7214C
Cyberpunk2077.exe+2A3F39 - 48 8D 05 6850B103     - lea rax,[Cyberpunk2077.exe+3DB8FA8] { (7FF772ACB418) }
Cyberpunk2077.exe+2A3F40 - 48 83 C4 28           - add rsp,28 { 40 }
Cyberpunk2077.exe+2A3F44 - C3                    - ret 
Cyberpunk2077.exe+2A3F45 - CC                    - int 3 

(which is basically the hardcoded reference at the bottom)

Comparing calling code from 1.62 patch 2 (1.63?) and 2.0... Have to test it tho.

WopsS commented 1 year ago

Thanks!

@FransBouma thanks, CRTTISystem::Get was indeed at that address.

FransBouma commented 1 year ago

Thanks!

@FransBouma thanks, CRTTISystem::Get was indeed at that address.

Great! :) Glad I could help out!

Only thing I now still need is the World Runtime Entity Registry but the code is nowhere to be found.... :(

(edit) found here, for ref:

Cyberpunk2077.exe+948604 - 48 89 5C 24 08        - mov [rsp+08],rbx
Cyberpunk2077.exe+948609 - 57                    - push rdi
Cyberpunk2077.exe+94860A - 48 83 EC 20           - sub rsp,20 { 32 }
Cyberpunk2077.exe+94860E - 48 8B F9              - mov rdi,rcx
Cyberpunk2077.exe+948611 - 48 8D 0D 20C28A02     - lea rcx,[Cyberpunk2077.exe+31F4838] { (0) }
Cyberpunk2077.exe+948618 - E8 E7C67EFF           - call Cyberpunk2077.exe+134D04
Cyberpunk2077.exe+94861D - 8B 15 11C28A02        - mov edx,[Cyberpunk2077.exe+31F4834] { (3) }
Cyberpunk2077.exe+948623 - 33 DB                 - xor ebx,ebx
Cyberpunk2077.exe+948625 - 4C 8B 05 FCC18A02     - mov r8,[Cyberpunk2077.exe+31F4828]       <<< Location of WorldRuntimeEntityRegistry (the start of the pointer walk at least).
Cyberpunk2077.exe+94862C - 8B C3                 - mov eax,ebx
Cyberpunk2077.exe+94862E - 85 D2                 - test edx,edx
Cyberpunk2077.exe+948630 - 74 2D                 - je Cyberpunk2077.exe+94865F
Cyberpunk2077.exe+948632 - 8B C8                 - mov ecx,eax
Cyberpunk2077.exe+948634 - 49 39 3C C8           - cmp [r8+rcx*8],rdi
Cyberpunk2077.exe+948638 - 74 08                 - je Cyberpunk2077.exe+948642
Cyberpunk2077.exe+94863A - FF C0                 - inc eax
Cyberpunk2077.exe+94863C - 3B C2                 - cmp eax,edx
Cyberpunk2077.exe+94863E - 72 F2                 - jb Cyberpunk2077.exe+948632
Cyberpunk2077.exe+948640 - EB 1D                 - jmp Cyberpunk2077.exe+94865F
Cyberpunk2077.exe+948642 - 49 8D 0C C8           - lea rcx,[r8+rcx*8]
Cyberpunk2077.exe+948646 - 2B D0                 - sub edx,eax
Cyberpunk2077.exe+948648 - 44 8D 42 FF           - lea r8d,[rdx-01]
Cyberpunk2077.exe+94864C - 49 C1 E0 03           - shl r8,03 { 3 }
Cyberpunk2077.exe+948650 - 48 8D 51 08           - lea rdx,[rcx+08]
FransBouma commented 1 year ago

Anything else I can help with?

WopsS commented 1 year ago

We could use a hand on fixing the patterns. There are only ±25 left.

FransBouma commented 1 year ago

Will check them tomorrow morning (It's 10pm here and I'm on this for 12hours or so :D ).

FransBouma commented 1 year ago

JobInternals::SetLocalThreadParam seems to have vanished. Compare these two blocks:

1.63:

00007FF60D31DED0 | 40:53               | push    rbx                                    
00007FF60D31DED2 | 55                  | push    rbp                                    
00007FF60D31DED3 | 56                  | push    rsi                                    
00007FF60D31DED4 | 57                  | push    rdi                                    
00007FF60D31DED5 | 41:56               | push    r14                                    
00007FF60D31DED7 | 48:83EC 50          | sub     rsp,50                                 
00007FF60D31DEDB | 48:8BF9             | mov     rdi,rcx                                
00007FF60D31DEDE | 0FB64A 32           | movzx   ecx,byte ptr ds:[rdx+32]               
00007FF60D31DEE2 | E8 59C30F02         | call    cyberpunk2077_162_2_dump.7FF60F41A240    <<< FUNCTION to find
00007FF60D31DEE7 | 48:8B0F             | mov     rcx,qword ptr ds:[rdi]                 
00007FF60D31DEEA | E8 417170FF         | call    cyberpunk2077_162_2_dump.7FF60CA25030    <<< FUNCTION A
00007FF60D31DEEF | 84C0                | test    al,al                                  
00007FF60D31DEF1 | 75 51               | jne     cyberpunk2077_162_2_dump.7FF60D31DF44  
00007FF60D31DEF3 | 48:8B0F             | mov     rcx,qword ptr ds:[rdi]                 
00007FF60D31DEF6 | E8 556970FF         | call    cyberpunk2077_162_2_dump.7FF60CA24850  
00007FF60D31DEFB | 48:8B0F             | mov     rcx,qword ptr ds:[rdi]                 
00007FF60D31DEFE | 48:8D9424 88000000  | lea     rdx,qword ptr ss:[rsp+88]              
00007FF60D31DF06 | 0FBED8              | movsx   ebx,al                                 
00007FF60D31DF09 | E8 526970FF         | call    cyberpunk2077_162_2_dump.7FF60CA24860  
00007FF60D31DF0E | 48:8BC8             | mov     rcx,rax                                
00007FF60D31DF11 | E8 DA6166FF         | call    cyberpunk2077_162_2_dump.7FF60C9840F0  
00007FF60D31DF16 | 4C:8D0D 0B1E7102    | lea     r9,qword ptr ds:[7FF60FA2FD28]         | 00007FF60FA2FD28:"Failed to load sector %s, error=%d"
00007FF60D31DF1D | 895C24 28           | mov     dword ptr ss:[rsp+28],ebx              |
00007FF60D31DF21 | 4C:8D05 281E7102    | lea     r8,qword ptr ds:[7FF60FA2FD50]         | 00007FF60FA2FD50:"streamingSectorLoadingToken->IsLoaded()"
00007FF60D31DF28 | 48:894424 20        | mov     qword ptr ss:[rsp+20],rax              |
00007FF60D31DF2D | BA 20020000         | mov     edx,220                                |
00007FF60D31DF32 | 48:8D0D A71D7102    | lea     rcx,qword ptr ds:[7FF60FA2FCE0]        | 00007FF60FA2FCE0:"E:\\R6.Release\\dev\\src\\common\\world\\src\\runtimeSystemWorldStreaming.cpp"
00007FF60D31DF39 | E8 B2F40702         | call    cyberpunk2077_162_2_dump.7FF60F39D3F0  
00007FF60D31DF3E | CC                  | int3                                           
00007FF60D31DF3F | E8 7CF20702         | call    cyberpunk2077_162_2_dump.7FF60F39D1C0  
00007FF60D31DF44 | 48:8B0F             | mov     rcx,qword ptr ds:[rdi]     

2.0:

00007FF7FBC7AF00 | 40:53               | push    rbx                                           
00007FF7FBC7AF02 | 48:83EC 40          | sub     rsp,40                                        
00007FF7FBC7AF06 | 48:8BD9             | mov     rbx,rcx                                       
00007FF7FBC7AF09 | 48:8B09             | mov     rcx,qword ptr ds:[rcx]                        
00007FF7FBC7AF0C | E8 37005FFE         | call    cyberpunk2077_200_20230921_dump.7FF7FA26AF48  <<< FUNCTION A
00007FF7FBC7AF11 | 84C0                | test    al,al                                         
00007FF7FBC7AF13 | 75 3C               | jne     cyberpunk2077_200_20230921_dump.7FF7FBC7AF51  
00007FF7FBC7AF15 | 48:8B03             | mov     rax,qword ptr ds:[rbx]                        
00007FF7FBC7AF18 | 4C:8D0D 313C4401    | lea     r9,qword ptr ds:[7FF7FD0BEB50]                | 00007FF7FD0BEB50:"Failed to load sector %s, error=%d"
00007FF7FBC7AF1F | 4C:8D05 023C4401    | lea     r8,qword ptr ds:[7FF7FD0BEB28]                | 00007FF7FD0BEB28:"streamingSectorLoadingToken->IsLoaded()"
00007FF7FBC7AF26 | 48:8D0D F33A4401    | lea     rcx,qword ptr ds:[7FF7FD0BEA20]               | 00007FF7FD0BEA20:"E:\\R6.Release\\dev\\src\\common\\world\\src\\runtimeSystemWorldStreaming.cpp"
00007FF7FBC7AF2D | 0FBE50 5C           | movsx   edx,byte ptr ds:[rax+5C]                      
00007FF7FBC7AF31 | 48:8D05 50A2E800    | lea     rax,qword ptr ds:[7FF7FCB05188]               
00007FF7FBC7AF38 | 895424 28           | mov     dword ptr ss:[rsp+28],edx                     
00007FF7FBC7AF3C | BA D7010000         | mov     edx,1D7                                       
00007FF7FBC7AF41 | 48:894424 20        | mov     qword ptr ss:[rsp+20],rax                     
00007FF7FBC7AF46 | E8 B913DA00         | call    cyberpunk2077_200_20230921_dump.7FF7FCA1C304  
00007FF7FBC7AF4B | CC                  | int3                                                  
00007FF7FBC7AF4C | E8 BB15DA00         | call    cyberpunk2077_200_20230921_dump.7FF7FCA1C50C  
00007FF7FBC7AF51 | 48:8B13             | mov     rdx,qword ptr ds:[rbx]    

There are over 2000 calls/jmps to this function in 1.63, but I can't find it back in 2.0 in any form. Will look for other patterns not found for another hour or so

FransBouma commented 1 year ago

TweakDB::Get seems to have been enrolled into other functions. I base that on the following:

1.63:

00007FF60D4A5B84 | 48:8BF1                  | mov     rsi,rcx                                  
00007FF60D4A5B87 | E8 6427F9FF              | call    cyberpunk2077_162_2_dump.7FF60D4382F0    
00007FF60D4A5B8C | 48:8D05 CDA95C02         | lea     rax,qword ptr ds:[7FF60FA70560]          
00007FF60D4A5B93 | 4C:8D05 8EAE5A02         | lea     r8,qword ptr ds:[7FF60FA50A28]            | 00007FF60FA50A28:".enumComment"
00007FF60D4A5B9A | 48:8906                  | mov     qword ptr ds:[rsi],rax                  
00007FF60D4A5B9D | 48:8D5424 30             | lea     rdx,qword ptr ss:[rsp+30]               
00007FF60D4A5BA2 | 48:8D4C24 38             | lea     rcx,qword ptr ss:[rsp+38]               
00007FF60D4A5BA7 | E8 B4CEF401              | call    cyberpunk2077_162_2_dump.7FF60F3F2A60   
00007FF60D4A5BAC | 48:8B18                  | mov     rbx,qword ptr ds:[rax]                  
00007FF60D4A5BAF | 66:C786 49010000 0000    | mov     word ptr ds:[rsi+149],0                 
00007FF60D4A5BB8 | C686 48010000 00         | mov     byte ptr ds:[rsi+148],0                 
00007FF60D4A5BBF | E8 DCF3F0FF              | call    cyberpunk2077_162_2_dump.7FF60D3B4FA0     << TweakDB::Get
00007FF60D4A5BC4 | 48:8BC8                  | mov     rcx,rax                                 
00007FF60D4A5BC7 | 4C:8D86 48010000         | lea     r8,qword ptr ds:[rsi+148]               
00007FF60D4A5BCE | 48:8BD3                  | mov     rdx,rbx                                 
00007FF60D4A5BD1 | E8 EA99F3FF              | call    cyberpunk2077_162_2_dump.7FF60D3DF5C0   
00007FF60D4A5BD6 | 4C:8D05 8BBE5C02         | lea     r8,qword ptr ds:[7FF60FA71A68]            | 00007FF60FA71A68:".startingEquippedItems"
00007FF60D4A5BDD | 48:8D5424 30             | lea     rdx,qword ptr ss:[rsp+30]              
00007FF60D4A5BE2 | 48:8D4C24 38             | lea     rcx,qword ptr ss:[rsp+38]              
00007FF60D4A5BE7 | E8 74CEF401              | call    cyberpunk2077_162_2_dump.7FF60F3F2A60  
00007FF60D4A5BEC | 48:8B18                  | mov     rbx,qword ptr ds:[rax]                 
00007FF60D4A5BEF | 66:C786 4C010000 0000    | mov     word ptr ds:[rsi+14C],0                
00007FF60D4A5BF8 | C686 4B010000 00         | mov     byte ptr ds:[rsi+14B],0                
00007FF60D4A5BFF | E8 9CF3F0FF              | call    cyberpunk2077_162_2_dump.7FF60D3B4FA0     << TweakDB::Get
00007FF60D4A5C04 | 48:8BC8                  | mov     rcx,rax                                
00007FF60D4A5C07 | 4C:8D86 4B010000         | lea     r8,qword ptr ds:[rsi+14B]              
00007FF60D4A5C0E | 48:8BD3                  | mov     rdx,rbx                                
00007FF60D4A5C11 | E8 2A95F3FF              | call    cyberpunk2077_162_2_dump.7FF60D3DF140  
00007FF60D4A5C16 | 4C:8D05 63BE5C02         | lea     r8,qword ptr ds:[7FF60FA71A80]            | 00007FF60FA71A80:".referenceName"
00007FF60D4A5C1D | 48:8D5424 30             | lea     rdx,qword ptr ss:[rsp+30]              
00007FF60D4A5C22 | 48:8D4C24 38             | lea     rcx,qword ptr ss:[rsp+38]              
00007FF60D4A5C27 | E8 34CEF401              | call    cyberpunk2077_162_2_dump.7FF60F3F2A60  
00007FF60D4A5C2C | 48:8B18                  | mov     rbx,qword ptr ds:[rax]                 
00007FF60D4A5C2F | 66:C786 4F010000 0000    | mov     word ptr ds:[rsi+14F],0                
00007FF60D4A5C38 | C686 4E010000 00         | mov     byte ptr ds:[rsi+14E],0                
00007FF60D4A5C3F | E8 5CF3F0FF              | call    cyberpunk2077_162_2_dump.7FF60D3B4FA0     << TweakDB::Get
00007FF60D4A5C44 | 48:8BC8                  | mov     rcx,rax                                
00007FF60D4A5C47 | 4C:8D86 4E010000         | lea     r8,qword ptr ds:[rsi+14E]              
00007FF60D4A5C4E | 48:8BD3                  | mov     rdx,rbx                                
00007FF60D4A5C51 | E8 EA97F3FF              | call    cyberpunk2077_162_2_dump.7FF60D3DF440  
00007FF60D4A5C56 | 4C:8D05 DBAD5A02         | lea     r8,qword ptr ds:[7FF60FA50A38]            | 00007FF60FA50A38:".enumName"
00007FF60D4A5C5D | 48:8D5424 30             | lea     rdx,qword ptr ss:[rsp+30]               
00007FF60D4A5C62 | 48:8D4C24 38             | lea     rcx,qword ptr ss:[rsp+38]               
00007FF60D4A5C67 | E8 F4CDF401              | call    cyberpunk2077_162_2_dump.7FF60F3F2A60   
00007FF60D4A5C6C | 48:8B18                  | mov     rbx,qword ptr ds:[rax]                  
00007FF60D4A5C6F | 66:C786 52010000 0000    | mov     word ptr ds:[rsi+152],0                 
00007FF60D4A5C78 | C686 51010000 00         | mov     byte ptr ds:[rsi+151],0                 
00007FF60D4A5C7F | E8 1CF3F0FF              | call    cyberpunk2077_162_2_dump.7FF60D3B4FA0     << TweakDB::Get
00007FF60D4A5C84 | 48:8BC8                  | mov     rcx,rax                                 
00007FF60D4A5C87 | 4C:8D86 51010000         | lea     r8,qword ptr ds:[rsi+151]               
00007FF60D4A5C8E | 48:8BD3                  | mov     rdx,rbx                                 
00007FF60D4A5C91 | E8 AA97F3FF              | call    cyberpunk2077_162_2_dump.7FF60D3DF440   
00007FF60D4A5C96 | 0FB786 51010000          | movzx   eax,word ptr ds:[rsi+151]               
00007FF60D4A5C9D | 48:BF 02F67FDF0CFDBD16   | mov     rdi,16BDFD0CDF7FF602      

2.0:

00007FF7FABB1554  | 48:8BF1             | mov     rsi,rcx                                     
00007FF7FABB1557  | E8 0457B1FF         | call    cyberpunk2077_200_20230921_dump.7FF7FA6C6C60
00007FF7FABB155C  | 48:8D05 2524FF01    | lea     rax,qword ptr ds:[7FF7FCBA3988]             
00007FF7FABB1563  | 4C:8D05 3601F901    | lea     r8,qword ptr ds:[7FF7FCB416A0]                 | 00007FF7FCB416A0:".enumComment"
00007FF7FABB156A  | 48:8906             | mov     qword ptr ds:[rsi],rax                       
00007FF7FABB156D  | 48:8D55 20          | lea     rdx,qword ptr ss:[rbp+20]                    
00007FF7FABB1571  | 48:8D4D 28          | lea     rcx,qword ptr ss:[rbp+28]                    
00007FF7FABB1575  | E8 7E6CB1FF         | call    cyberpunk2077_200_20230921_dump.7FF7FA6C81F8  << Function called after every string ref
00007FF7FABB157A  | 48:8D8E 70040000    | lea     rcx,qword ptr ds:[rsi+470]                   
00007FF7FABB1581  | 48:8B10             | mov     rdx,qword ptr ds:[rax]                       
00007FF7FABB1584  | E8 4B4AB1FF         | call    cyberpunk2077_200_20230921_dump.7FF7FA6C5FD4 
00007FF7FABB1589  | 4C:8D05 E023FF01    | lea     r8,qword ptr ds:[7FF7FCBA3970]                 | 00007FF7FCBA3970:".startingEquippedItems"
00007FF7FABB1590  | 48:8D55 20          | lea     rdx,qword ptr ss:[rbp+20]                    
00007FF7FABB1594  | 48:8D4D 28          | lea     rcx,qword ptr ss:[rbp+28]                    
00007FF7FABB1598  | E8 5B6CB1FF         | call    cyberpunk2077_200_20230921_dump.7FF7FA6C81F8  << Function called after every string ref
00007FF7FABB159D  | 48:8D8E 7C040000    | lea     rcx,qword ptr ds:[rsi+47C]                   
00007FF7FABB15A4  | 48:8B10             | mov     rdx,qword ptr ds:[rax]                       
00007FF7FABB15A7  | E8 DC2C6AFF         | call    cyberpunk2077_200_20230921_dump.7FF7FA254288 
00007FF7FABB15AC  | 4C:8D05 7523FF01    | lea     r8,qword ptr ds:[7FF7FCBA3928]                 | 00007FF7FCBA3928:".referenceName"
00007FF7FABB15B3  | 48:8D55 20          | lea     rdx,qword ptr ss:[rbp+20]                    
00007FF7FABB15B7  | 48:8D4D 28          | lea     rcx,qword ptr ss:[rbp+28]                    
00007FF7FABB15BB  | E8 386CB1FF         | call    cyberpunk2077_200_20230921_dump.7FF7FA6C81F8  << Function called after every string ref
00007FF7FABB15C0  | 48:8D8E 88040000    | lea     rcx,qword ptr ds:[rsi+488]                   
00007FF7FABB15C7  | 48:8B10             | mov     rdx,qword ptr ds:[rax]                       
00007FF7FABB15CA  | E8 AD196AFF         | call    cyberpunk2077_200_20230921_dump.7FF7FA252F7C 
00007FF7FABB15CF  | 4C:8D05 DA00F901    | lea     r8,qword ptr ds:[7FF7FCB416B0]                 | 00007FF7FCB416B0:".enumName"
00007FF7FABB15D6  | 48:8D55 20          | lea     rdx,qword ptr ss:[rbp+20]                    
00007FF7FABB15DA  | 48:8D4D 28          | lea     rcx,qword ptr ss:[rbp+28]                    
00007FF7FABB15DE  | E8 156CB1FF         | call    cyberpunk2077_200_20230921_dump.7FF7FA6C81F8  << Function called after every string ref
00007FF7FABB15E3  | 48:8D9E 94040000    | lea     rbx,qword ptr ds:[rsi+494]                   

Where the function called after every string ref is is referenced over 4500 times in 2.0. Every . string in 1.63 used it, and it's nowhere to be found in 2.0 for the same strings. I don't know what TweakDB does, but maybe it helps tracking down its functionality in 2.0

FransBouma commented 1 year ago

ResourceLoader

2.0:

00007FF7FA26AEEE | 4D:8B00           | mov     r8,qword ptr ds:[r8]                            
00007FF7FA26AEF1 | 48:8D5424 20      | lea     rdx,qword ptr ss:[rsp+20]                       
00007FF7FA26AEF6 | 48:8B0D BB1D1B03  | mov     rcx,qword ptr ds:[7FF7FD41CCB8]                 << REF ResourceLoader
00007FF7FA26AEFD | E8 62455300       | call    cyberpunk2077_200_20230921_dump.7FF7FA79F464    
00007FF7FA26AF02 | 48:8BD0           | mov     rdx,rax                                         
00007FF7FA26AF05 | 48:8BCB           | mov     rcx,rbx                                         
00007FF7FA26AF08 | E8 EB0B0000       | call    cyberpunk2077_200_20230921_dump.7FF7FA26BAF8    
00007FF7FA26AF0D | 48:8D4C24 20      | lea     rcx,qword ptr ss:[rsp+20]                       
00007FF7FA26AF12 | E8 15240000       | call    cyberpunk2077_200_20230921_dump.7FF7FA26D32C    
00007FF7FA26AF17 | 48:8B0B           | mov     rcx,qword ptr ds:[rbx]                          
00007FF7FA26AF1A | 8079 5C 00        | cmp     byte ptr ds:[rcx+5C],0                          
00007FF7FA26AF1E | 75 C2             | jne     cyberpunk2077_200_20230921_dump.7FF7FA26AEE2    
00007FF7FA26AF20 | 48:83C4 30        | add     rsp,30                                          
00007FF7FA26AF24 | 5B                | pop     rbx                                             

alt:

00007FF7FA3667D5  | 48:8D4C24 50     | lea     rcx,qword ptr ss:[rsp+50]                     
00007FF7FA3667DA  | E8 5D8AF4FF      | call    cyberpunk2077_200_20230921_dump.7FF7FA2AF23C  
00007FF7FA3667DF  | 4D:8B06          | mov     r8,qword ptr ds:[r14]                         
00007FF7FA3667E2  | 48:8D55 98       | lea     rdx,qword ptr ss:[rbp-68]                     
00007FF7FA3667E6  | 48:8B0D CB640B03 | mov     rcx,qword ptr ds:[7FF7FD41CCB8]                  << REF ResourceLoader
00007FF7FA3667ED  | 48:8D9F 58010000 | lea     rbx,qword ptr ds:[rdi+158]                    
00007FF7FA3667F4  | E8 2BC20500      | call    cyberpunk2077_200_20230921_dump.7FF7FA3C2A24  
00007FF7FA3667F9  | 48:8BD0          | mov     rdx,rax                                       
00007FF7FA3667FC  | 48:8D4D 88       | lea     rcx,qword ptr ss:[rbp-78]                     
00007FF7FA366800  | E8 03A3FAFF      | call    cyberpunk2077_200_20230921_dump.7FF7FA310B08  
00007FF7FA366805  | 48:8BD0          | mov     rdx,rax                                       
00007FF7FA366808  | 48:8BCB          | mov     rcx,rbx                                       
00007FF7FA36680B  | E8 0CA2EFFF      | call    cyberpunk2077_200_20230921_dump.7FF7FA260A1C  
00007FF7FA366810  | 48:8D4D 88       | lea     rcx,qword ptr ss:[rbp-78]                     
00007FF7FA366814  | E8 D3CBEEFF      | call    cyberpunk2077_200_20230921_dump.7FF7FA2533EC  
00007FF7FA366819  | 48:8D4D 98       | lea     rcx,qword ptr ss:[rbp-68]                     
00007FF7FA36681D  | E8 CACBEEFF      | call    cyberpunk2077_200_20230921_dump.7FF7FA2533EC  
00007FF7FA366822  | 48:833B 00       | cmp     qword ptr ds:[rbx],0                          
00007FF7FA366826  | 0F84 E4CCB201    | je      cyberpunk2077_200_20230921_dump.7FF7FBE93510  
00007FF7FA36682C  | 41:B1 FB         | mov     r9b,FB                                        
00007FF7FA36682F  | 48:8D5424 50     | lea     rdx,qword ptr ss:[rsp+50]                     

based on: 1.63:

00007FF60CED8DBA  | E8 91095D02       | call    cyberpunk2077_162_2_dump.7FF60F4A9750 
00007FF60CED8DBF  | 48:8B05 0A5A7C03  | mov     rax,qword ptr ds:[7FF61069E7D0]             << REF ResourceLoader
00007FF60CED8DC6  | 48:8D15 8367AD02  | lea     rdx,qword ptr ds:[7FF60F9AF550]         | 00007FF60F9AF550:"English"
00007FF60CED8DCD  | 33F6              | xor     esi,esi                               
00007FF60CED8DCF  | 48:8987 48020000  | mov     qword ptr ds:[rdi+248],rax            
00007FF60CED8DD6  | 48:8D4C24 40      | lea     rcx,qword ptr ss:[rsp+40]             
00007FF60CED8DDB  | 48:89B7 50020000  | mov     qword ptr ds:[rdi+250],rsi            
00007FF60CED8DE2  | E8 695AAAFF       | call    cyberpunk2077_162_2_dump.7FF60C97E850 
00007FF60CED8DE7  | 48:8D15 8A65AD02  | lea     rdx,qword ptr ds:[7FF60F9AF378]         | 00007FF60F9AF378:"en-us"
00007FF60CED8DEE  | 48:8D4C24 20      | lea     rcx,qword ptr ss:[rsp+20]              
00007FF60CED8DF3  | E8 585AAAFF       | call    cyberpunk2077_162_2_dump.7FF60C97E850  
00007FF60CED8DF8  | 48:8D8F 58020000  | lea     rcx,qword ptr ds:[rdi+258]             
00007FF60CED8DFF  | 41:B1 01          | mov     r9b,1                                  
00007FF60CED8E02  | 4C:8D4424 20      | lea     r8,qword ptr ss:[rsp+20]               
00007FF60CED8E07  | 48:8D5424 40      | lea     rdx,qword ptr ss:[rsp+40]        

2.0 equivalent:

00007FF7FA974103  | 33F6               | xor     esi,esi                                 
00007FF7FA974105  | 48:8D05 C48A1F02   | lea     rax,qword ptr ds:[7FF7FCB6CBD0]         
00007FF7FA97410C  | 48:8983 E8000000   | mov     qword ptr ds:[rbx+E8],rax               
00007FF7FA974113  | 48:8D15 3E891F02   | lea     rdx,qword ptr ds:[7FF7FCB6CA58]                | 00007FF7FCB6CA58:"English"
00007FF7FA97411A  | 48:89B3 C0000000   | mov     qword ptr ds:[rbx+C0],rsi        
00007FF7FA974121  | 48:8D4C24 40       | lea     rcx,qword ptr ss:[rsp+40]        
00007FF7FA974126  | 48:89B3 C8000000   | mov     qword ptr ds:[rbx+C8],rsi        
00007FF7FA97412D  | 83CF FF            | or      edi,FFFFFFFF                     
00007FF7FA974130  | 48:89B3 D0000000   | mov     qword ptr ds:[rbx+D0],rsi        
00007FF7FA974137  | 48:89B3 D8000000   | mov     qword ptr ds:[rbx+D8],rsi        
00007FF7FA97413E  | 89BB E0000000      | mov     dword ptr ds:[rbx+E0],edi        
00007FF7FA974144  | 89B3 E4000000      | mov     dword ptr ds:[rbx+E4],esi        
00007FF7FA97414A  | 48:8983 18010000   | mov     qword ptr ds:[rbx+118],rax       
00007FF7FA974151  | 48:8B05 608BAA02   | mov     rax,qword ptr ds:[7FF7FD41CCB8]            << REF ResourceLoader
00007FF7FA974158  | 48:89B3 F0000000   | mov     qword ptr ds:[rbx+F0],rsi        
00007FF7FA97415F  | 48:89B3 F8000000   | mov     qword ptr ds:[rbx+F8],rsi        
00007FF7FA974166  | 48:89B3 00010000   | mov     qword ptr ds:[rbx+100],rsi       
00007FF7FA97416D  | 48:89B3 08010000   | mov     qword ptr ds:[rbx+108],rsi       
00007FF7FA974174  | 89BB 10010000      | mov     dword ptr ds:[rbx+110],edi       
00007FF7FA97417A  | 89B3 14010000      | mov     dword ptr ds:[rbx+114],esi       
00007FF7FA974180  | 48:8983 20010000   | mov     qword ptr ds:[rbx+120],rax       
00007FF7FA974187  | 48:89B3 28010000   | mov     qword ptr ds:[rbx+128],rsi       
00007FF7FA97418E  | E8 9933A5FF        | call    cyberpunk2077_200_20230921_dump.7FF7FA3C752C 
00007FF7FA974193  | 48:8D15 9E6A1A02   | lea     rdx,qword ptr ds:[7FF7FCB1AC38]                | 00007FF7FCB1AC38:"en-us"
00007FF7FA97419A  | 48:8D4C24 20       | lea     rcx,qword ptr ss:[rsp+20]    
WopsS commented 1 year ago

@FransBouma thanks :) We fixed most of them now, need to fix some inlining and then check the classes / vtbls layout

FransBouma commented 1 year ago

@WopsS Quick question: which tool is used to generate the natives: https://github.com/WopsS/RED4ext.SDK/tree/master/include/RED4ext/Scripting/Natives/Generated

I think it's done from the RTTI info, but I couldn't find the code in the red4ext.sdk (or I must have overlooked it). Thanks! (and if that doesn't work yet, no rush, was just curious if I could generate that pile of code myself somehow)

WopsS commented 1 year ago

I'm using https://github.com/WopsS/RED4.RTTIDumper to dump them. I just pushed the types to the 2.0 branch.

FransBouma commented 1 year ago

Thanks. I notices I can dump the types also myself with some custom code as the RTTI types contain the properties and functions (altho not native functions which is what I use), but will have a look at that dumper, thanks!

FransBouma commented 1 year ago

Worked like a charm. Do you have a paypal or kofi or patreon I can send a small thank you to?

WopsS commented 1 year ago

Thanks. I notices I can dump the types also myself with some custom code as the RTTI types contain the properties and functions (altho not native functions which is what I use), but will have a look at that dumper, thanks!

I forgot to mention, but there is also a dumper, only for C++ types here https://github.com/WopsS/RED4ext.SDK/blob/master/include/RED4ext/Dump/Reflection.hpp#L123-L124.

Worked like a charm. Do you have a paypal or kofi or patreon I can send a small thank you to?

I appreciate your kind offer, but I don't have any links like that.

FransBouma commented 1 year ago

Thanks! I built your full dumper and dumped everything. I only needed the entLightComponent type which had its properties changed all over the place :(.

I appreciate your kind offer, but I don't have any links like that.

Let me know when you do! :) Thanks for all your work