RLLib  0.1
Public Member Functions | List of all members
rl::Game Class Reference

This class represents the game itself. More...

#include <Game.hpp>

Public Member Functions

 Game (FilePath path)
 Creates and loads the game from the specified path. More...
 
void load (FilePath path)
 Loads the game from the specified path. More...
 
BundlegetBundle () noexcept
 Returns the bundle file associated with the game. More...
 
ByteStream getAsset (const FilePath &path)
 Extracts an asset from the game files. More...
 
Scene getScene (const FilePath &path)
 Returns a scene loaded from an asset. More...
 
void updateAsset (const FilePath &path, const ByteStream &data)
 Overwrites an asset in the game files. More...
 
void patchAsset (const FilePath &path, const ByteStream &data)
 Creates a patch for a specific asset, leaving the original content unmodified. More...
 
void removePatch ()
 Deletes the current existing patch.
 
int run (const FilePath &path="")
 Launches a specific scene in the game engine and displays the logs. More...
 
int run (const Scene &scene)
 Launches the given scene in the game engine and displays the logs. More...
 

Detailed Description

This class represents the game itself.

It provides features to extract, patch or run scenes in the game engine.

Constructor & Destructor Documentation

◆ Game()

rl::Game::Game ( FilePath  path)
explicit

Creates and loads the game from the specified path.

Parameters
pathThe path to the game executable file

Member Function Documentation

◆ getAsset()

ByteStream rl::Game::getAsset ( const FilePath path)

Extracts an asset from the game files.

Parameters
pathThe path to the asset
Returns
The extracted asset

◆ getBundle()

Bundle& rl::Game::getBundle ( )
noexcept

Returns the bundle file associated with the game.

Returns
A reference to the game bundle

◆ getScene()

Scene rl::Game::getScene ( const FilePath path)

Returns a scene loaded from an asset.

Use rl::Game::updateAsset or rl::Game::patchAsset to overwrite or patch the scene.

Parameters
pathThe path to the asset
Returns
The scene loaded from the file

◆ load()

void rl::Game::load ( FilePath  path)

Loads the game from the specified path.

Parameters
pathThe path to the game executable file

◆ patchAsset()

void rl::Game::patchAsset ( const FilePath path,
const ByteStream data 
)

Creates a patch for a specific asset, leaving the original content unmodified.

Use rl::Game::removePatch to revert the changes.

Note
Only a single file can be patched at once. Calling this function a second time will remove the previous patch.
Parameters
pathThe path to the scene file
dataThe scene object

◆ run() [1/2]

int rl::Game::run ( const FilePath path = "")

Launches a specific scene in the game engine and displays the logs.

If the specified scene does not exists, the game is launched normally.

Warning
This function might not work with all versions of the game, since some of them require the game to be launched by Steam or Uplay. For now, the only workaround is to patch the home scene and launch the game normally:
auto scene = game.getScene(path);
patchScene("world/home/level/home.isc", scene);
game.run();
Parameters
pathThe path to the scene file
Returns
The exit code status

◆ run() [2/2]

int rl::Game::run ( const Scene scene)

Launches the given scene in the game engine and displays the logs.

Warning
This function might not work with all versions of the game, since some of them require the game to be launched by Steam or Uplay. For now, the only workaround is to patch the home scene and launch the game normally:
patchScene("world/home/level/home.isc", scene);
game.run();
Parameters
sceneThe scene object
Returns
The exit code status

◆ updateAsset()

void rl::Game::updateAsset ( const FilePath path,
const ByteStream data 
)

Overwrites an asset in the game files.

The file path to the asset must already exist.

Warning
The original asset will be lost. Consider patching the asset if you wish to keep the original content unchanged (see rl::Game::patchAsset).
Parameters
pathThe path to the asset
dataThe asset data

The documentation for this class was generated from the following file: