Coder Social home page Coder Social logo

rayshader / cp2077-red-memorydump Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 500 KB

Cyberpunk 2077 plugin to help reverse engineer data types.

License: MIT License

CMake 2.05% JavaScript 12.45% Lua 58.92% Red 3.51% C++ 23.07%
cet cyberenginetweaks cyberpunk data dump engineer memory red4ext redscript reverse type

cp2077-red-memorydump's Introduction

Red Memory Dump

Cyberpunk 2077 GitHub License Donate

This tool allows to dump memory to help in analyzing unknown data types. It provides an interface with CET.

Getting started

Compatibility

Installation

  1. Install requirements:
  1. Extract the latest archive into the Cyberpunk 2077 directory.

Demo

screenshot of tool

Setup

You'll need to configure CET to use a monospace font. You can import one of your choice or pick from existing fonts. For example with NotoSansMono-Regular.ttf.

In bin/x64/plugins/cyber_engine_tweaks/, change config.json with:

{
  // ...
  "fonts": {
    // ...
    "path": "C:/Program Files (x86)/Steam/steamapps/common/Cyberpunk 2077/bin/x64/plugins/cyber_engine_tweaks/fonts/NotoSansMono-Regular.ttf"
    // ...
  }
  // ...
}

Note

fonts.path must be an absolute path to be loaded by CET.

Usage

This tool introduce MemoryDump with three core functions:

TrackScriptable(object: ref<IScriptable>) -> ref<MemoryTarget>;
TrackSerializable(object: ref<ISerializable>) -> ref<MemoryTarget>;
TrackAddress(name: String, type: CName, address: Uint64, opt size: Uint32) -> ref<MemoryTarget>;

It will return a MemoryTarget which allows to dump memory in a "frame".

Important

It only keeps the internal pointer of the object. If reference to the object is lost, it will result in unexpected behaviors.

This tool requires a MemoryTarget to print it in CET's overlay. You have two possibilities to provide a target:

CET's console

You can use CET's console to write commands and manually add a target. You will need to import the tool's API using:

RedMemoryModApi = GetMod("RedMemoryMod").api

You can then use MemoryDump to track and add a target:

player = Game.GetPlayer()
target = MemoryDump.TrackScriptable(player)
RedMemoryModApi.AddTarget(target)
-- It should be visible in section TARGETS

AddCustomTarget

You can define your custom behavior in RedMemoryDump/AddCustomTarget.lua where the plugin is installed. You can react to common CET events and return a target you want to track.

You must define AddCustomTarget which will be triggered when you click on the button Add custom target in CET overlay, for example:

-- See file itself for more.

-- ...
AddCustomTarget = function(context)
  local player = Game.GetPlayer()

  return MemoryDump.TrackScriptable(player)
end
-- ...

Tip

This is the recommended solution, DRY.

Development

Contributions are welcome, feel free to fill an issue or a PR.

Usage

  1. Install requirements:
  • CMake v3.27+
  • Visual Studio Community 2022+
  • Node JS v20.11+
    • run npm install --save-dev archiver
  1. Configure project with:
cmake -G "Visual Studio 17 2022" -A x64 -S . -B build
  1. Build in debug mode:
cmake --build build --target RedMemoryDump --config Debug

Tests

  1. Install in your game directory:
node install.mjs
  1. Run game.
  2. Open CET, show Game Log popup.
  3. Output should show tests result.

Release

  1. Build in release mode:
cmake --build build --target RedMemoryDump --config Release
  1. Bundle release:
node bundle.mjs

cp2077-red-memorydump's People

Contributors

poirierlouis avatar

Watchers

 avatar

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.