Skip to content

Releases: Boarlock/SRSE

SRSE - Pre Release

SRSE - Pre Release Pre-release
Pre-release

Choose a tag to compare

@Boarlock Boarlock released this 10 Oct 22:01
f9ad157

SRSE Release Documentation

Overview

SRSE (Sins of a Solar Empire: Rebellion Script Extender) is a C# library that enables programmatic control and monitoring of Sins of a Solar Empire: Rebellion. It provides direct access to game state, real time camera and input data, and powerful manipulation capabilities for pause, speed, and camera control.

The library uses DLL injection via EasyHook to hook into the running game process and expose its internal state through a clean, managed C# API.

Key Features

  • Game State Monitoring: Real-time access to frame counters, game timing, and game state (menu, playing, game over)
  • Pause & Speed Control: Full pause/resume functionality and 5-speed settings (1x, 2x, 4x, 6x, 8x)
  • Camera Manipulation: Direct control over camera position, rotation, pitch, and zoom
  • Input Monitoring: Real time mouse button and cursor position tracking
  • Window Information: Access to display resolution and display mode
  • Direct Memory Access: For advanced users, low level memory reading/writing capabilities through Marshal APIs

Public API Reference

Core Classes

SRSE

Main entry point for the public facing API.

Properties:

  • bool IsInitialized - Checks if the library has successfully initialized and hooked into the game

Game State:

  • GameState CurrentGameState() - Returns current game state (MainMenu, Playing, GameOver, Unknown)
  • Coordinate GetWindowSize() - Returns current window dimensions (X, Y)

Pause Controls:

  • void Pause() - Pauses the game
  • void Resume() - Resumes the game
  • void TogglePause() - Toggles pause state

Game Speed:

  • GameSpeed GetSpeed() - Returns current game speed
  • void SetSpeed(GameSpeed speed) - Sets game speed to specified value
  • void SpeedUp() - Increases speed to next level
  • void SlowDown() - Decreases speed to previous level
  • void ResetSpeed() - Resets speed to Normal (1x)

Camera Control:

  • void RotateCamera(float degrees, bool counterClockwise = false) - Rotates camera by specified degrees
  • void AngleCamera(float angle) - Sets camera pitch angle (-90° to +90°)

Input Monitoring:

  • bool IsMouseButtonDown(MouseButton button) - Checks if mouse button is currently pressed
  • Coordinate CursorPosition(bool invertYAxis) - Returns current cursor position

Enums:

public enum GameSpeed { Normal = 1, Fast = 2, Super = 4, Ultra = 6, Max = 8, Unknown }
public enum GameState { MainMenu, Playing, GameOver, Unknown }
public enum MouseButton { LeftMouseButton, RightMouseButton }

public struct Coordinate { public int X; public int Y; }

Advanced API (Direct Access)
For advanced users, the following classes provide direct access to game memory:

Sins

Low level memory access and base address management.

Properties:

static IntPtr BaseAddress - Process base address for ASLR offset calculations
static bool initialized - Initialization status

Methods:

static IntPtr Address(int rva) - Converts relative virtual address to absolute address

SinsAddresses

Constants for all known memory addresses and offsets within the game:

Frame counters: Total_Frame, Play_Frame, Simulation_Frame, Game_Sim_Frame
Game timing: Game_Time, Focused_Time

Pause/speed functions and offsets
Camera object pointers and field offsets
Input flags and window properties

SinsGetters

Direct memory read properties for game state:

Frame information: TotalFrame, PlayFrame, SimulationFrame, GameSimulationFrame
Timing: GameTime, FocusedTime
Input state: IsLeftClickDown, IsRightClickDown, CursorX, CursorY
Game state flags: IsAtMainMenu, IsCurPlaying, IsGameOver
Window properties: WindowWidth, WindowHeight, DisplayMode

SinsGame

Game pause and speed state management.

Properties:

static int Pause - Current pause state (0 = playing, 1 = paused, -5 = uninitialized)
static int GameSpeed - Current game speed multiplier

Methods:

static bool SetPause(int pause, int showNotification) - Sets pause state
static bool SetSpeed(int speed, int showNotification) - Sets game speed

SinsCamera

Camera state manipulation.

Properties:

static float HorizontalMotion - Horizontal camera movement velocity
static float VerticalMotion - Vertical camera movement velocity
static float ZoomVelocity - Zoom velocity
static float Pitch - Camera pitch angle (clamped -1.55334 to 1.55334)
static float Rotation - Camera rotation angle
static float Zoom - Camera zoom level (clamped 20 to 11222389)

EntryPoint

Injection entry point and frame tick event system.

Events:

static event Action SinsTick - Fires every frame when frame counter increments
Subscribe to this event to hook into the game loop

MathExtensions

Utility extension methods.

Methods:

T Clamp<T>(T value, T min, T max) - Generic value clamping for IComparable types

Installation & Usage

Prerequisites

Sins of a Solar Empire: Rebellion (tested on v1.9.8 - newest Steam version)
Windows OS (x86 or x64)

Basic Setup

Compile SRSE.dll from the source or use the supplied .dll
Use the supplied injector .exe made with EasyHook

Place both in SOASER directory, launch the game through SRSE_Injector.exe

Technical Details

Memory Injection Architecture
Uses EasyHook for managed DLL injection
Injects into running game process (Sins of a Solar Empire Rebellion.exe)
Hooks into game frame loop via EntryPoint.Run() which polls frame counter
Provides stable frame synchronous event via SinsTick event
Frame Tick System
The library monitors Total_Frame counter and fires SinsTick event when the frame increments. This occurs approximately once per frame (dependent on game FPS).

Memory Addresses

All in-game memory addresses are hardcoded as relative virtual addresses (RVA) in SinsAddresses. These are converted to absolute addresses using:

Code

Absolute Address = BaseAddress + RVA

Note: These addresses may require updating if the game binary is patched.

Pause & Speed Implementation

Pause and game speed have two control methods:

Direct memory writes (faster, no notifications)
Function pointer delegates calling native functions (slower, shows UI notifications)
Default behavior uses direct memory when available

Limitations & Known Issues

Address Hardcoding: All memory addresses are specific to a particular game version. Game patches will require address updates.
Stability: Early-stage implementation; crashes possible with invalid memory access.
No Documentation of Native Types: Game native structures are not fully documented; offset values are approximate.

Development Notes

Adding New Features:

Identify the memory address or function pointer in the game binary (via reverse engineering)
Add the address constant to SinsAddresses
Create getter/setter methods in SinsGetters, SinsGame, or custom class
Expose through public API in SRSE class if appropriate

Memory Safety

All Marshal operations are relatively safe but can crash if addresses are invalid
Camera properties clamp values to prevent infinite zoom/pitch values
Always check IsInitialized before accessing game state

License

See LICENSE file in repository.

Contributing

Early-stage project; contributions welcome. Please ensure:

Code follows existing style conventions
All public API methods have clear purposes
Memory addresses are documented with sources (IDA Pro, x64dbg, etc.)
Testing performed against clean game instance

Support

For issues, questions, or address updates for new game versions, open an issue on GitHub.