Lua to Asi

kelthuzzar

Известный
Автор темы
9
2
Please, help me. Lua to Asi.
Код:
local memory = require 'memory'

function main()
    wait(-1)
end

function patch()
    if memory.getuint8(0x748C2B) == 0xE8 then
        memory.fill(0x748C2B, 0x90, 5, true)
    elseif memory.getuint8(0x748C7B) == 0xE8 then
        memory.fill(0x748C7B, 0x90, 5, true)
    end
    if memory.getuint8(0x5909AA) == 0xBE then
        memory.write(0x5909AB, 1, 1, true)
    end
    if memory.getuint8(0x590A1D) == 0xBE then
        memory.write(0x590A1D, 0xE9, 1, true)
        memory.write(0x590A1E, 0x8D, 4, true)
    end
    if memory.getuint8(0x748C6B) == 0xC6 then
        memory.fill(0x748C6B, 0x90, 7, true)
    elseif memory.getuint8(0x748CBB) == 0xC6 then
        memory.fill(0x748CBB, 0x90, 7, true)
    end
    if memory.getuint8(0x590AF0) == 0xA1 then
        memory.write(0x590AF0, 0xE9, 1, true)
        memory.write(0x590AF1, 0x140, 4, true)
    end
end

patch()
 
  • Нравится
Реакции: Letovv

legendabrn

Известный
Проверенный
122
172
Please, help me. Lua to Asi.
Код:
local memory = require 'memory'

function main()
    wait(-1)
end

function patch()
    if memory.getuint8(0x748C2B) == 0xE8 then
        memory.fill(0x748C2B, 0x90, 5, true)
    elseif memory.getuint8(0x748C7B) == 0xE8 then
        memory.fill(0x748C7B, 0x90, 5, true)
    end
    if memory.getuint8(0x5909AA) == 0xBE then
        memory.write(0x5909AB, 1, 1, true)
    end
    if memory.getuint8(0x590A1D) == 0xBE then
        memory.write(0x590A1D, 0xE9, 1, true)
        memory.write(0x590A1E, 0x8D, 4, true)
    end
    if memory.getuint8(0x748C6B) == 0xC6 then
        memory.fill(0x748C6B, 0x90, 7, true)
    elseif memory.getuint8(0x748CBB) == 0xC6 then
        memory.fill(0x748CBB, 0x90, 7, true)
    end
    if memory.getuint8(0x590AF0) == 0xA1 then
        memory.write(0x590AF0, 0xE9, 1, true)
        memory.write(0x590AF1, 0x140, 4, true)
    end
end

patch()
C++:
#include <windows.h>

void aNop(int pAddress, int iSize)
{
    unsigned long dwProtect[2];
    VirtualProtect(reinterpret_cast<void*>(pAddress), iSize, PAGE_EXECUTE_READWRITE, &dwProtect[0]);
    memset(reinterpret_cast<void*>(pAddress), 0x90, iSize);
    VirtualProtect(reinterpret_cast<void*>(pAddress), iSize, dwProtect[0], &dwProtect[1]);
}

bool aCheck(int pAddress, unsigned char cByte)
{
    unsigned long dwProtect[2];
    unsigned char cValue = cByte;
    VirtualProtect(reinterpret_cast<void*>(pAddress), 1, PAGE_EXECUTE_READ, &dwProtect[0]);
    memcpy(&cValue, reinterpret_cast<void*>(pAddress), 1);
    VirtualProtect(reinterpret_cast<void*>(pAddress), 1, dwProtect[0], &dwProtect[1]);
    return (cValue == cByte);
}

void aPatch(int address, void* val, int bytes)
{
    unsigned long dwProtect[2];
    VirtualProtect(reinterpret_cast<void*>(address), bytes, PAGE_EXECUTE_READWRITE, &dwProtect[0]);
    memcpy(reinterpret_cast<void*>(address), val, bytes);
    VirtualProtect(reinterpret_cast<void*>(address), bytes, dwProtect[0], &dwProtect[1]);
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        unsigned long dwValue;
        if (aCheck(0x748C2B, 0xE8))  
            aNop(0x748C2B, 5);
        else if (aCheck(0x748C7B, 0xE8)) 
            aNop(0x748C7B, 5);

        if (aCheck(0x5909AA, 0xBE)) 
            *reinterpret_cast<int*>(0x5909AB) = 1;

        if (aCheck(0x590A1D, 0xBE))
        {
            dwValue = 0xE9;
            aPatch(0x590A1D, &dwValue, 1);
            dwValue = 0x0000008D;
            aPatch(0x590A1E, &dwValue, 4);
        }

        if (aCheck(0x748C6B, 0xC6)) 
            aNop(0x748C6B, 7);
        else if (aCheck(0x748CBB, 0xC6)) 
            aNop(0x748CBB, 7);

        if (aCheck(0x590AF0, 0xA1))
        {
            dwValue = 0xE9;
            aPatch(0x590AF0, &dwValue, 1);
            dwValue = 0x00000140;
            aPatch(0x590AF1, &dwValue, 4);
        }
    }
    return TRUE;
}
 
Последнее редактирование:

kelthuzzar

Известный
Автор темы
9
2
C++:
bool aCheck(int pAddress, unsigned char cByte)
{
    unsigned long dwProtect[2];
    unsigned char cValue = cByte;
    VirtualProtect(reinterpret_cast<void*>(pAddress), 1, PAGE_EXECUTE_READ, &dwProtect[0]);
    memcpy(&cValue, reinterpret_cast<void*>(pAddress), 1);
    VirtualProtect(reinterpret_cast<void*>(pAddress), 1, dwProtect[0], &dwProtect[1]);
    return (cValue == cByte);
}

void aPatch(int address, char* val, int bytes)
{
    unsigned long dwProtect[2];
    VirtualProtect(reinterpret_cast<void*>(address), bytes, PAGE_EXECUTE_READWRITE, &dwProtect[0]);
    memcpy(reinterpret_cast<void*>(address), val, bytes);
    VirtualProtect(reinterpret_cast<void*>(address), bytes, dwProtect[0], &dwProtect[1]);
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        if (aCheck(0x748C2B, 0xE8))
            aPatch(0x748C2B, reinterpret_cast<char*>(0x90), 5);
        else if (aCheck(0x748C7B, 0xE8))
            aPatch(0x748C7B, reinterpret_cast<char*>(0x90), 5);

        if (aCheck(0x5909AA, 0xBE))
            *reinterpret_cast<int*>(0x5909AB) = 1;

        if (aCheck(0x590A1D, 0xBE))
        {
            aPatch(0x590A1D, reinterpret_cast<char*>(0xE9), 1);
            aPatch(0x590A1E, reinterpret_cast<char*>(0x8D), 4);
        }

        if (aCheck(0x748C6B, 0xC6))
            aPatch(0x748C6B, reinterpret_cast<char*>(0x90), 7);
        else if (aCheck(0x748CBB, 0xC6))
            aPatch(0x748CBB, reinterpret_cast<char*>(0x90), 7);

        if (aCheck(0x590AF0, 0xA1))
        {
            aPatch(0x590AF0, reinterpret_cast<char*>(0xE9), 1);
            aPatch(0x590AF1, reinterpret_cast<char*>(0x140), 4);

        }
    }
    return TRUE;
}
can you compile it for me?
 

cyborggg

Новичок
1
0
можно вот этот код сделать в виде аси файла? заранее спасибо
Код:
script_name("Driving Patch")
script_author("seven memz")

local memory = require("memory")

function main()
    -- patch wet roads
    memory.fill(0x72BB9F, 0x90, 12, true)
    memory.fill(0x72BBAB, 0x90, 20, true)
    memory.fill(0x72BBCB, 0x90, 12, true)
    -- patch wheel interpolation
    memory.fill(0x72B940, 0x90, 5, true)
    memory.fill(0x72B92B, 0x90, 5, true)
    memory.fill(0x72B959, 0x90, 5, true)

     -- disable sand particle
    memory.fill(0x6AA8CF, 0x90, 53, true)

    --patch blade collision
    memory.fill(0x6C5107, 0x90, 59, true)

    --disable speed limit
    memory.fill(0x544CF0, 0x90, 14, true)
    -- disable rails resistance
    memory.setfloat(0x8D34AC, 0.0, true)
end