Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statistics and introduce new hook format #4

Merged
merged 3 commits into from
Nov 14, 2024
Merged

Conversation

4z0t
Copy link
Member

@4z0t 4z0t commented Nov 12, 2024

Organize files a bit and indroduce new Hook syntax.

Hooks

Allows to create more readable hooks with .hook file format, which is parsed by patcher into .cpp for further process by compiler.
Before using new hooks format:

#include "../asm.h"
#include "../define.h"
asm(
    
    SECTION(1, 0x86EF2B)
    "jmp "QU(CustomDrawEnter)";"
    
    SECTION(2, 0x456264)
    "subss xmm0, ds:"QU(THICKNESS)";"
    
    SECTION(3, 0x4562CD)
    "addss xmm0, ds:"QU(THICKNESS)";"
    
    SECTION(4, 0x4561A8)
    "call "QU(GetCircleColor)";"
    
    SECTION(5, 0x455E53)
    "mov ecx, 0x30;"
    
    SECTION(6, 0x4561E4)
    "cmp eax, 0x30;"
    
    SECTION(7, 0x455E30)
    "fld dword ptr ["QU(SEGMENT_RAD)"];"  
);

After:

0x86EF2B:
    jmp @CustomDrawEnter

//allow changing thickness of line
0x456264:
    subss xmm0, ds:@THICKNESS

//allow changing thickness of line
0x4562CD:
    addss xmm0, ds:@THICKNESS

//allow changing color
0x4561A8:
    call @GetCircleColor

//increase number of segements
0x455E53:
    mov ecx, 0x30
    
0x4561E4:
    cmp eax, 0x30

//adjust angle to number of segments 2*pi/segments
0x455E30:
    fld dword ptr [@SEGMENT_RAD]

@Garanas Garanas changed the title Statistics + Hooks (#4) Add statistics and introduce new hook format Nov 12, 2024
@4z0t 4z0t merged commit 0520ff6 into FAForever:main Nov 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants