Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Is there any way to revert any memory changes?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Stacktrace
Expert Cheater
Reputation: 1

Joined: 04 Jul 2015
Posts: 105

PostPosted: Thu Oct 08, 2015 11:13 am    Post subject: Is there any way to revert any memory changes? Reply with quote

Hi, I'm wondering if there's any way to revert any changes that has been done in the memory by a script? Let's say I've NOP'd 5 addresses, once 4 minutes have hit, they will all automaticly revert to the original instruction, it has to be automaticly and know which ones I NOP'd because I'm talking about NOPing random addresses, if you could make me a quick script to perform such action that would be VERY appreciated! (If possible..)
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Oct 08, 2015 12:14 pm    Post subject: Reply with quote

You would have to store the addresses which you are wanting to nop, as well as the original data for each nop'd address.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Stacktrace
Expert Cheater
Reputation: 1

Joined: 04 Jul 2015
Posts: 105

PostPosted: Thu Oct 08, 2015 8:59 pm    Post subject: Reply with quote

atom0s wrote:
You would have to store the addresses which you are wanting to nop, as well as the original data for each nop'd address.



That sounds good to be honest with you!
I could make something out of that... If you have time, could you by any chance write up a quick code what does that for me? I'm not fluent in Lua, sorry. It would be kindly appreciated though! Thanks for your response.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Oct 08, 2015 11:36 pm    Post subject: Reply with quote

An example of this would be like:
Code:
----------------------------------------------------------------------------------------------------
-- desc: List of cheats that are to be nop'd.
-- note:
--      The syntax of the below table is:
--      { address to nop, nop count }
----------------------------------------------------------------------------------------------------
local nopCheats = {
    { 0x00400000, 4 },
    { 0x00400004, 4 },
    { 0x00400008, 4 },
    { 0x0040000C, 4 },
    { 0x00400010, 4 }
};

----------------------------------------------------------------------------------------------------
-- func: GenerateNopTable
-- desc: Generates a table of nops with the given count.
----------------------------------------------------------------------------------------------------
function GenerateNopTable(count)
    local ret = { };
    for x = 1, count do
        table.insert(ret, 0x90);
    end
    return ret;
end

----------------------------------------------------------------------------------------------------
-- func: EnableNopCheats
-- desc: Enables the above list of cheats that are specific for nop'ing.
----------------------------------------------------------------------------------------------------
function EnableNopCheats()
    -- Loop each cheat entry and process it..
    for k, v in pairs(nopCheats) do
        -- Ensure we have access to the cheat location..
        fullAccess(v[1], v[2]);

        -- Attempt to read the data of the current address..
        v[3] = readBytes(v[1], v[2], true);

        -- Next, write the bytes to the address..
        writeBytes(v[1], GenerateNopTable(v[2]));
    end

    print('Enabled cheats!');
end

----------------------------------------------------------------------------------------------------
-- func: DisableNopCheats
-- desc: Disables the above list of cheats that are specific for nop'ing.
----------------------------------------------------------------------------------------------------
function DisableNopCheats()
    -- Loop each cheat entry and disable it..
    for k, v in pairs(nopCheats) do
        -- Only process cheats that have been enabled..
        if (v[3] ~= nil) then
            writeBytes(v[1], v[3]);
            v[3] = nil;
        end
    end

    print('Disabled cheats!');
end

-- Test the code..
EnableNopCheats()
sleep(3000);
DisableNopCheats();

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites