Skip to content

NightFyre/PCSX2-CheatFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCSX2 Cheat Development Kit

PCSX2 Menu Trainer Development Kit is a C++ library designed to simplify the process of creating cheats for the PCSX2 emulator. It aims to bridge the gap between modern cheat development practices and the classic era of cheat codes. This framework provides tools to port older codes to a more modern approach, using additional libraries such as dear imgui and minhook.

image image image

FEATURES

  • Easily Read & Write to virtual PS2 Memory
  • PCSX2 Emulator Process Virtual Method Hooking
  • Rendering API Helpers
  • Access EE & IOP Registers during execution

USAGE

  1. include the SDK header as well as any required packages.
    NOTE: Engine_Package.h is a required package and needs to be manually included.
  • CDK.h // Including the SDK header will provide access to all the most necessary features.
  • Core_Package.cpp // Main Package and must be included for basic usage
  • PCSX2_Package.cpp // PCSX2 specific members and functions. Like the rendering API's for instance
  1. Initialize the SDK
  • PlayStation2::InitCDK(); // Basic CDK Initialization
  1. Do Stuff

    PlayStation2::g_Engine->CreateConsole(" PCSX2 Cheat Framework Console "); // Manually spawn a console instance ( this will be an sdk initialization option at some point in the future )
    auto device = *PlayStation2::CGlobals::g_gs_device; // Obtains the current render api device instance [@TODO: create method of obtaining current api class instance (GSDevice11)]
    auto renderer = *PlayStation2::CGlobals::g_gs_renderer; // obtains Hardware renderer instance
    auto emu_thread = *PlayStation2::CGlobals::g_emu_thread; // obtains main emu thread instance
    printf("[+] PCSX2 Framework Client Initialized!\n- device\t-> 0x%llX\n- renderer\t-> 0x%llX\n- thread\t-> 0x%llX\n- PS2Base\t-> 0x%llX\n"
    ". . . PRESS [END] TO EXIT . . .\n\n",
    device,
    renderer,
    emu_thread,
    PlayStation2::Memory::BasePS2MemorySpace
    );

  2. (optional) include game package for additional controls

USAGE EXAMPLES

  • Access EE Memory

    // - Get EE Memory Module Base ( ps2 game ram )
    const auto eeModuleBase = PS2Memory::GetModuleBase();

  • Get Virtual Address

    // - retrieve an offsets virtual address in memory
    long long offsetAddress = PS2Memory::GetAddr(0x1000);

  • Read Virtual Memory

    // - read 8 bytes from the offset virtual address obtained in the previous step
    auto read_result_long = PS2Memory::ReadLong<long long>(offsetAddress);
    Console::LogMsg("[+][%.3f][PS2Memory::ReadLong] 0x%llX\n", t.GetElapsedTime(clock()), read_result_long);
    // - read 8 bytes from a virtual address in memory using a games offset
    auto read_result_short = PS2Memory::ReadShort<long long>(0x2000);
    Console::LogMsg("[+][%.3f][PS2Memory::ReadShort] 0x%llX\n", t.GetElapsedTime(clock()), read_result_short);

  • Access Class Members via GamePackages

/// SOCOM 1 -> Access SealObject & Modify Weapon Ammo
{
    // Create an instance of the Offsets Class
    SOCOM1::CZSeal* pLocalSeal = SOCOM1::CZSeal::GetDefaultInstance();
    if (pLocalSeal)
        Console::cLogMsg("[+][PCSX2-CDK][SOCOM] LocalSeal Name: %s\n", EConsoleColors::green, pLocalSeal->GetName().c_str());
}
  • Hook Rendering API
    auto d3d11 = static_cast<PlayStation2::GSDevice11*>(PlayStation2::CGlobals::g_gs_device);
    if (d3d11)
    {
    // Get SwapChain & Hook
    pSwapChain = d3d11->GetSwapChain();
    if (pSwapChain)
    PlayStation2::hkVFunction(pSwapChain, 8, oIDXGISwapChainPresent, hkPresent);
    }

References & Credits

License

This framework is distributed under the MIT License.

Disclaimer

  1. This framework is intended for educational and single-player use.
  2. Use cheats responsibly and respect the terms of use of the games you are modifying.

About

PCSX2 Menu Trainer Development Kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published