Giter Club home page Giter Club logo

Comments (3)

ragnaroks avatar ragnaroks commented on May 27, 2024
private Boolean Inited=false;
private const Int64 StartAddress=0x5FB0000; //i found this by "x96dbg"
private const String AobHex="?? 06 0C 00 ?? 05 0D 00 00"; //may entity struct
private Nullable<IntPtr> PlayerStructAddress; // Nullable for dispose
private Int32 PlayerDefaultHp;
private Timer LockTimer=new Timer(){AutoReset=true,Intvel=100,Enable=false};
private Boolean LockTimerInAction=false;
private Memory.mem GameProcessMemory;

public EventHandler GameProcessExited;

public ctor(Memory.mem mem){
    GameProcessMemory=mem;//from MainWindow,all cheat Class share this instance
    GameProcessExited+=(sender,eventAreg)=>{
        LockTimer.Enable=false;
        LockTimerInAction=false;
        PlayerStructAddress=null;
        Inited=false;
    };
    LockTimer.Elapsed+=(sender,eventArgs)=>{
        if(LockTimerInAction){return;}
        LockTimerInAction=true;
        CheatEngine.WriteProcessMemoryAsInt32(GameProcessMemory.pHandle,PlayerStructAddress+0x0C,PlayerDefaultHp);
        LockTimerInAction=false;
    };
}

private Boolean Init(){
    if(Inited){return true;}
    //i guess EndAddress is 0x7FFFFFFF because this region is not in Visible module
    Int64[] addressArray=GameProcessMemory.AobScan(StartAddress,0x7FFFFFFF,AobHex,true,true);
    if(addressArray.GetLength(0)<1){return false;}
    foreach(Int64 address in addressArray){
        //I have some method myself to read or write memory,and use IntPtr,not hex String
        //the address+0x0c is entity's hp value
        IntPtr p1=new IntPtr(address+0x0c);
        //the address+0x14 is entity's type,player(0) or enemy(257) or frindly(1)
        IntPtr p2=new IntPtr(address+0x14);
        Nullable<Int32> i1=CheatEngine.ReadProcessMemoryAsInt32(GameProcessMemory.pHandle,p1);
        if(i1==null || !i1.HasValue || i1.Value<1){continue;}//hp always > 0,and died eneity i don't care
        Nullable<Int32> i2=CheatEngine.ReadProcessMemoryAsInt32(GameProcessMemory.pHandle,p2);
        if(i2==null || !i2.HasValue || i2.Value==257){continue;}//i only care myself hp,and you can extend this for friendly entity
        PlayerStructAddress=new IntPtr(address);
    break;}
    return PlayerStructAddress!=null;
}

public Boolean Enable(){
    if(!Init()){return false;}
    LockTimer.Enable=true;
}

public Boolean Disable(){
    if(Inited){return false;}
    LockTimer.Enable=false;
}

public void Dispose(){
    // dispose mode see MSDN for more
    LockTimer.Dispose();
}

trainer-izombie
and here is the trainer,you can download and decompile this exe.
unzip password is "skydust".

from memory.dll.

erfg12 avatar erfg12 commented on May 27, 2024

@chinasmu You gotta show all your code for us to know what's going on.
@ragnaroks idk why you posted this here.

Closing this issue ticket. If you have questions, you can visit our Discord channel.

from memory.dll.

ragnaroks avatar ragnaroks commented on May 27, 2024

@chinasmu You gotta show all your code for us to know what's going on.
@ragnaroks idk why you posted this here.

Closing this issue ticket. If you have questions, you can visit our Discord channel.

it's a csharp example for read/write/lock/find

from memory.dll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.