Skip to main content

A Python API for reading & writing PCSX2's emulator memory, using the Pine IPC protocol.

Project description

PCSX2 Memory Accessor

A Python API for reading & writing PCSX2's emulator memory, using the Pine IPC protocol.

Installation

pip install pcsx2-memory-accessor

Enable Pine IPC in PCSX2:

  • Open PCSX2
  • Go to Settings
  • Under Advanced, scroll down to PINE Setting, check enable. Set the port to 28011
  • Restart PCSX2

Quick Start

import pcsx2_memory_accessor as p

# Initialize connection
if p.init():
    # Read a 32-bit integer
    health = p.read_u32(0x00100000)
    print(f"Health: {health}")
    
    # Write a 32-bit integer
    p.write_u32(0x00100000, 69)
    
    # Read multiple bytes (12 bytes in this case)
    data = p.read_pcsx2_memory(0x00200000, 12)

    # Write multiple bytes (9 bytes in this case)
    my_bytes = bytes([0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99])
    data = p.write_pcsx2_memory(0x00200000, my_bytes)

    # Write a binary file to PCSX2 Memory ---
    BIN_FILENAME = "memory_patch.bin"

    # Read data from the binary file in binary mode ('rb')
    with open(BIN_FILENAME, 'rb') as f:
        file_data = f.read()
    
    # Write the file data (byte array) directly to PCSX2 memory
    if file_data:
        TARGET_ADDRESS = 0x00300000
        p.write_pcsx2_memory(0x00300000, file_data)
    
    # Cleanup
    p.shutdown()

API Reference

# Read single values
health = pcsx2_memory_accessor.read_u8(address)   # Read 8-bit integer
score = pcsx2_memory_accessor.read_u16(address)   # Read 16-bit integer
value = pcsx2_memory_accessor.read_u32(address)   # Read 32-bit integer
big_num = pcsx2_memory_accessor.read_u64(address) # Read 64-bit integer

# Write single values
pcsx2_memory_accessor.write_u8(address, value)    # Write 8-bit integer
pcsx2_memory_accessor.write_u16(address, value)   # Write 16-bit integer
pcsx2_memory_accessor.write_u32(address, value)   # Write 32-bit integer
pcsx2_memory_accessor.write_u64(address, value)   # Write 64-bit integer

# Read multiple bytes (returns bytes object)
data = pcsx2_memory_accessor.read_pcsx2_memory(address, num_bytes)

# Write multiple bytes
pcsx2_memory_accessor.write_pcsx2_memory(address, data_bytes)

Requirements

  • Python 3.6+
  • PCSX2 with Pine IPC support

Credits

  • Pine by GovanifY

Links

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pcsx2_memory_accessor-1.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pcsx2_memory_accessor-1.0-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file pcsx2_memory_accessor-1.0.tar.gz.

File metadata

  • Download URL: pcsx2_memory_accessor-1.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for pcsx2_memory_accessor-1.0.tar.gz
Algorithm Hash digest
SHA256 236af91308b22538cc34c8a8aeba5ae4074bb96e08524584726b974e5ec2e4cd
MD5 4d24edafd21365151efb26ce96ae27c6
BLAKE2b-256 5f5f123fec3973707aa54288ea8ea52e70fde544635b8e72d8ab9511dfbd32c2

See more details on using hashes here.

File details

Details for the file pcsx2_memory_accessor-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pcsx2_memory_accessor-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc379a3c986c549efc48f0887a41b39ef15d3dab619b6550041930a2a2e21001
MD5 8e46c5ad5f0e337e6d4ba38e3e14082b
BLAKE2b-256 eebbf3d578c23704a2799deab9ccd3dfe7b010ce70cab28a59302a86a4e2d56d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page