MemoryIO.Pcsx2 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MemoryIO.Pcsx2 --version 1.0.0                
NuGet\Install-Package MemoryIO.Pcsx2 -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MemoryIO.Pcsx2" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MemoryIO.Pcsx2 --version 1.0.0                
#r "nuget: MemoryIO.Pcsx2, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MemoryIO.Pcsx2 as a Cake Addin
#addin nuget:?package=MemoryIO.Pcsx2&version=1.0.0

// Install MemoryIO.Pcsx2 as a Cake Tool
#tool nuget:?package=MemoryIO.Pcsx2&version=1.0.0                

MemoryIO.Pcsx2

An implemention of MemoryIO specifically for the PCSX2 emulator. Designed along-side MemoryIO to provide an easy-to-use, cross platform PCSX2 memory manipulation experience.

Usage

Pcsx2MemoryIO automatically attempts to detect and attach to a PCSX2 process. Because different PS2 games use different string encodings, it is recommended that you provide an Encoding for Pcsx2MemoryIO to use, otherwise it will default to UTF8.
For example, .hack//Fragment uses "Shift-JIS" encoding.

Pcsx2MemoryIO exposes two bool properties to check the state of the process such, IsPcsx2Running and IsAttached.
Calling Update() will attempt to find and attach to a PCSX2 process if not already attached.

EEmem BaseAddress

Pcsx2MemoryIO automatically finds the BaseAddress of EEmem based on whether the process is running in 64bit or 32bit mode. This allows users to simply use the address without worrying about where the EEmem was initialized.
If you have used Cheat Engine on PCSX2 1.6.0 you might have found a value at address 0x20C461DA. With Pcsx2MemoryIO, you would just ignore the first 2 and use 0x00C461DA.
It is recommended to use the methods that use an int for the address as they are validated to include the BaseAddress if they are non-zero and not greater than the BaseAddress already.
Pcsx2MemoryIO does expose the BaseAddress of EEmem as an IntPtr to allow users to use the default IMemoryIO methods, without address validation. Advanced users could also use those methods to read/write anywhere in the PCSX2 memory, not just EEmem.

Example

internal struct PlayerStruct
{
    public int NamePointer;
    public short Level;
    public short EXP;
    public int GP;
}

const int playerAddress = 0xC461DA;
const int partyPointersAddress = 0x8B9390;

Pcsx2MemoryIO memoryIO = new(Encoding.GetEncoding("Shift-JIS"));

if (memoryIO.IsAttached)
{
    PlayerStruct player = memoryIO.Read<PlayerStruct>(playerAddress);
    player.GP = 999999;
    player.Level = 99;
    memoryIO.Write(playerAddress, player);

    int[] partyPointers = memoryIO.ReadArray<int>(partyPointersAddress, 3);
    PlayerStruct party3 = memoryIO.Read<PlayerStruct>(partyPointers[2]);
    memoryIO.WriteString(party3.NamePointer, "Kite");
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 194 6/11/2023
1.0.2 169 6/11/2023
1.0.1 160 6/11/2023
1.0.0 168 6/11/2023