All Projects → zyantific → Remodel

zyantific / Remodel

Licence: mit
Data and class remodeling library

Projects that are alternatives of or similar to Remodel

Genepi
Automatic generation of N-API wrapper from a C++ library
Stars: ✭ 45 (-28.57%)
Mutual labels:  wrapper, cmake
Gr Adsb
GNU Radio OOT module for demodulating and decoding ADS-B packets
Stars: ✭ 61 (-3.17%)
Mutual labels:  cmake
Nodeactyl
A NodeJS API for Pterodactyl panel, this was originally designed for discord.js (Discord bots)
Stars: ✭ 55 (-12.7%)
Mutual labels:  wrapper
Symphonyelectron
A desktop client for the Symphony Collaboration Platform built using Electron
Stars: ✭ 58 (-7.94%)
Mutual labels:  wrapper
Cxp
Lightweight & minimal project template using "modern" CMake
Stars: ✭ 56 (-11.11%)
Mutual labels:  cmake
Cmake Get
Get dependencies with cmake
Stars: ✭ 59 (-6.35%)
Mutual labels:  cmake
Sdl kitchensink
A Simple SDL2 / FFmpeg library for audio/video playback written in C99
Stars: ✭ 53 (-15.87%)
Mutual labels:  cmake
Clang Blueprint
🏰 Example C++11 CMake project that incorporates awesome Clang tooling 🐉
Stars: ✭ 63 (+0%)
Mutual labels:  cmake
Vscode Surround
🔥A simple yet powerful extension to add wrapper templates around your code blocks
Stars: ✭ 60 (-4.76%)
Mutual labels:  wrapper
Ws Wrapper
Lightweight WebSocket lib with socket.io-like event handling, requests, and channels
Stars: ✭ 58 (-7.94%)
Mutual labels:  wrapper
Cxxctp
DEPRECATED. USE INSTEAD github.com/blockspacer/flextool
Stars: ✭ 58 (-7.94%)
Mutual labels:  cmake
Run Cmake
GitHub Action to build C++ applications with CMake (either with CMakeLists.txt or CMakeSettings.json), Ninja and vcpkg on GitHub. Available as Azure DevOps task also: https://marketplace.visualstudio.com/items?itemName=lucappa.cmake-ninja-vcpkg-tasks
Stars: ✭ 57 (-9.52%)
Mutual labels:  cmake
Rt Thread Wrapper Of Ucos Iii
RT-Thread操作系统的uCOS-III兼容层:让基于uC/OS-III操作系统开发的应用层无感地迁移到RT-Thread操作系统 | A wrapper which can make codes developed by uCOS-III APIs directly run on RT-Thread
Stars: ✭ 60 (-4.76%)
Mutual labels:  wrapper
Vector ros
ROS package for Anki Vector home robot
Stars: ✭ 55 (-12.7%)
Mutual labels:  cmake
Abb experimental
Experimental packages for ABB manipulators within ROS-Industrial (http://wiki.ros.org/abb_experimental)
Stars: ✭ 61 (-3.17%)
Mutual labels:  cmake
Objcxx
Stars: ✭ 54 (-14.29%)
Mutual labels:  wrapper
Gwt Ol
GWT wrapper for OpenLayers 3+ using JSInterop
Stars: ✭ 57 (-9.52%)
Mutual labels:  wrapper
Urdf tutorial
Stars: ✭ 58 (-7.94%)
Mutual labels:  cmake
Android Cmake
CMake toolchain file and other scripts for the Android NDK
Stars: ✭ 1,123 (+1682.54%)
Mutual labels:  cmake
Osql Experimental
A community-oriented fork of osquery with support for cmake, public CI testing, and regular releases
Stars: ✭ 62 (-1.59%)
Mutual labels:  cmake

remodel library Build Status

remodel is a lightweight C++ library that allows interaction with applications that don't provide an official API. It can be used to create wrappers around the application's data structures and classes (with possibly many unknown fields), thereby avoiding messy casts and padding fields.

Core aspects

  • Easy to use
  • Modern (C++14, limited by what is already supported by MSVC 12)
  • Lightweight
    • Header-only library
    • No RTTI required
    • Exceptionless
  • Unit tests
  • Completely documented public API
  • CMake, cross-platform support, tested on:
    • MSVC 12 aka. 2013, 14 aka. 2015 (Windows)
    • clang 3.6, 3.7 (MSVC emulation mode on Windows, OS X)

Example

Imagine a scenario where you have instances of Dog in memory (let's say in your dog-simulator game that you intend to write mods for) that need be accessed.

class CustomString
{
  char* data;
  std::size_t length;
public:
  const char* str() const { return data; }
  std::size_t size() const { return length; }
};

class Dog
{
  CustomString name;
  CustomString* race;
  // ..
  // possibly many other unknown fields here
  // ..
  uint8_t age;
  bool hatesKittehz;
public:
  virtual int calculateFluffiness() const { /* ... */ }
  virtual void giveGoodie(int amount) { /* ... */ }
  // .. more methods ..
};

However, you obviously don't have that source code and only know a small subset of the whole thing that you found out through, let's say, reverse engineering with IDA. So here's the remodeled version:

class CustomString : public AdvancedClassWrapper<8 /* struct size */>
{
  REMODEL_ADV_WRAPPER(CustomString)
  // Note we omit the privates here because we decided we only need the methods.
public:
  MemberFunction<const char* (*)()> str{this, 0x12345678 /* function addr */};
  MemberFunction<std::size_t (*)()> size{this, 0x87654321};
};

// We don't create fields referring to `Dog`, so we don't have to know its
// size and can simply use `ClassWrapper` rather than `AdvancedClassWrapper`.
class Dog : public ClassWrapper
{
  REMODEL_WRAPPER(Dog)
  // We cheat and make the private fields public for our mod.
public:
  Field<CustomString> name{this, 4 /* struct offset */};
  Field<CustomString*> race{this, 12};
  // Note that we can just omit the unknown fields here without breaking
  // the integrity of the struct. No padding required.
  Field<uint8_t> age{this, 124};
  Field<bool> hatesKittehz{this, 125};
public:
  VirtualFunction<int (*)()> calculateFluffiness{this, 0 /* vftable index */};
  VirtualFunction<void (*)(int)> giveGoodie{this, 1};
};

And that's it! You can now use these wrappers pretty similar to how you would use the original class.

auto dog = wrapper_cast<Dog>(dogInstanceLocation);
// Don't give the bad dog too much of the good stuff!
dog.giveGoodie(dog.hatesKittehz ? 2 : 7);
// Year is over, +1 to age.
++dog.age;
// What was it's race again?
const char* race = dog.race->toStrong().str();

Note that this library is in an early stage, so some things might change in the future.

Cloning and dependencies

Please clone using the --recursive switch in order to automatically resolve the dependency on our core library.

git clone --recursive https://github.com/zyantific/remodel

Documentation

The HTML Doxygen documentation is automatically built from master every 12 hours.

License

remodel is released unter MIT license, dependencies are under their respective licenses.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].