0xvpr/SCCT-Trainer

[Request] Modify Visibility hack

vrubayka opened this issue · 9 comments

Hello!

Great trainer.
Is there a way to modify your code to force the highest visibility instead of the lowest? I wanted to play around with the AI.

I imagine it should be done in src/hacks.c under hack_GodMode but it's all greek to me.

0xvpr commented
void hack_GhostMode(bool bEnabled)
{
    char* const visibility_op = (char *)(module_base_addr + offsets_invisibility_base);
    char* const visibility_original = "\x8B\x86\x18\x15\x00\x00";  // mov eax, dword ptr [esi + 0x1518]
    char* const visibility_patch    = "\x90\x90\x90\x90\x90\x90";  // nop
    size_t visibility_size = 6;

    char* const noise_op = (char *)(module_base_addr + offsets_noise_base);
    char* const noise_original = "\x3B\xF8";  // cmp edi, eax
    char* const noise_patch    = "\x39\xC0";  // cmp eax, eax
    size_t noise_size = 2;

    // Add third op for slider

    if (bEnabled)
    {
        memory_patch(visibility_op, visibility_patch, visibility_size);
        memory_patch(noise_op, noise_patch, noise_size);
    }
    else
    {
        memory_patch(visibility_op, visibility_original, visibility_size);
        memory_patch(noise_op, noise_original, noise_size);
    }

}

is the function that would be responsible for this!

0xvpr commented

You would probably end up changing:

    char* const visibility_original = "\x8B\x86\x18\x15\x00\x00";  // mov eax, dword ptr [esi + 0x1518]
    char* const visibility_patch    = "\x90\x90\x90\x90\x90\x90";  // nop

to something like:

    char* const visibility_original = "\x8B\x86\x18\x15\x00\x00";  // mov eax, dword ptr [esi + 0x1518]
    char* const visibility_patch    = "\xB8\xFF\xFF\xFF\x7F\x90";  // mov eax, 0x7FFFFFFF
                                                                   // nop

and then recompiling the code

I have troubles building the project, I get the following error message:

i686-w64-mingw32-gcc -shared build/asm/health_detour.obj build/debug/d3d9hook.o build/debug/drawing.o build/debug/events.o build/debug/hacks.o build/debug/main.o build/debug/mem.o build/debug/render.o -ld3d9 -ld3dx9 -o bin/sp3_d.dll /usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.bss+0x1c): multiple definition of m_font_small'; build/debug/drawing.o:drawing.c:(.bss+0x0): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.bss+0x20): multiple definition of m_font'; build/debug/drawing.o:drawing.c:(.bss+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0x0): multiple definition of colorRed'; build/debug/drawing.o:drawing.c:(.rdata+0x0): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0x4): multiple definition of colorBlue'; build/debug/drawing.o:drawing.c:(.rdata+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0x8): multiple definition of colorGreen'; build/debug/drawing.o:drawing.c:(.rdata+0x8): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0xc): multiple definition of colorBlack'; build/debug/drawing.o:drawing.c:(.rdata+0xc): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0x10): multiple definition of colorWhite'; build/debug/drawing.o:drawing.c:(.rdata+0x10): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0x14): multiple definition of colorDarkGrey'; build/debug/drawing.o:drawing.c:(.rdata+0x14): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/events.o:events.c:(.rdata+0x18): multiple definition of colorLightGrey'; build/debug/drawing.o:drawing.c:(.rdata+0x18): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x210): multiple definition of color_Red'; build/debug/events.o:events.c:(.bss+0x0): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x214): multiple definition of color_Blue'; build/debug/events.o:events.c:(.bss+0x4): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x218): multiple definition of color_Green'; build/debug/events.o:events.c:(.bss+0x8): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x21c): multiple definition of color_Black'; build/debug/events.o:events.c:(.bss+0xc): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x220): multiple definition of color_White'; build/debug/events.o:events.c:(.bss+0x10): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x224): multiple definition of color_DarkGrey'; build/debug/events.o:events.c:(.bss+0x14): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x228): multiple definition of color_LightGrey'; build/debug/events.o:events.c:(.bss+0x18): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x22c): multiple definition of m_font_small'; build/debug/drawing.o:drawing.c:(.bss+0x0): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.bss+0x230): multiple definition of m_font'; build/debug/drawing.o:drawing.c:(.bss+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0x0): multiple definition of colorRed'; build/debug/drawing.o:drawing.c:(.rdata+0x0): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0x4): multiple definition of colorBlue'; build/debug/drawing.o:drawing.c:(.rdata+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0x8): multiple definition of colorGreen'; build/debug/drawing.o:drawing.c:(.rdata+0x8): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0xc): multiple definition of colorBlack'; build/debug/drawing.o:drawing.c:(.rdata+0xc): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0x10): multiple definition of colorWhite'; build/debug/drawing.o:drawing.c:(.rdata+0x10): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0x14): multiple definition of colorDarkGrey'; build/debug/drawing.o:drawing.c:(.rdata+0x14): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/main.o:main.c:(.rdata+0x18): multiple definition of colorLightGrey'; build/debug/drawing.o:drawing.c:(.rdata+0x18): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0x1c): multiple definition of color_DarkGrey'; build/debug/events.o:events.c:(.bss+0x14): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0x14): multiple definition of color_Black'; build/debug/events.o:events.c:(.bss+0xc): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0x20): multiple definition of color_LightGrey'; build/debug/events.o:events.c:(.bss+0x18): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0x10): multiple definition of color_Green'; build/debug/events.o:events.c:(.bss+0x8): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.bss+0x194): multiple definition of m_font'; build/debug/drawing.o:drawing.c:(.bss+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0x8): multiple definition of color_Red'; build/debug/events.o:events.c:(.bss+0x0): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0xc): multiple definition of color_Blue'; build/debug/events.o:events.c:(.bss+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.data+0x18): multiple definition of color_White'; build/debug/events.o:events.c:(.bss+0x10): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.bss+0x190): multiple definition of m_font_small'; build/debug/drawing.o:drawing.c:(.bss+0x0): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0x8): multiple definition of colorRed'; build/debug/drawing.o:drawing.c:(.rdata+0x0): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0xc): multiple definition of colorBlue'; build/debug/drawing.o:drawing.c:(.rdata+0x4): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0x10): multiple definition of colorGreen'; build/debug/drawing.o:drawing.c:(.rdata+0x8): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0x14): multiple definition of colorBlack'; build/debug/drawing.o:drawing.c:(.rdata+0xc): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0x18): multiple definition of colorWhite'; build/debug/drawing.o:drawing.c:(.rdata+0x10): first defined here
/usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0x1c): multiple definition of colorDarkGrey'; build/debug/drawing.o:drawing.c:(.rdata+0x14): first defined here /usr/bin/i686-w64-mingw32-ld: build/debug/render.o:render.c:(.rdata+0x20): multiple definition of colorLightGrey'; build/debug/drawing.o:drawing.c:(.rdata+0x18): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:44: build/debug] Error 1
`

I'm using a Debian 11 VM and I have installed i686-w64-mingw32-gcc and I had to install nasm because I was getting an error about its absence.

0xvpr commented

Yeah, that code is spaghetti. Some of my first C code. I'll make a fix for it today

0xvpr commented

Code fixed, it should compile now. I'll be making modifications for this thing to use Docker like my more recent projects to handle dependencies/tools.

Hi again, I decided to try you trainer again, I see you've done everything in assambly now.

Would you mind sharing ASM code that would make player character 100% visible at all times?

yeah let me see if I can write that

I see that you can change

mov eax, [esi+0x1518]

to something like

mov eax, 0x1
``` 0x1 and it makes you visible with the slightest light source