Skip to content

ReyeMe/SaturnRingLib

Repository files navigation

Saturn Ring Library

Easy to use SGL wrapper written in C++
Documentation



Issues Last commit

Brought to you by

ReyeMe
robertoduarte
7shades
willll
nemesis-saturn
jae686

Getting started

Installing SRL

Download

Using pre-packaged release

Go to the Releases section and download latest .zip release.

Using git repository Clone git repository by using:
git clone --recurse-submodules https://github.com/ReyeMe/SaturnRingLib.git

Note: It is important to not forget the --recurse-submodules otherwise some submodules (SaturnMath++ and TLSF memory allocator) will not get downloaded.

Setting up

  1. Download toolchain. This can be done by running setup_compiler.bat.
  2. Download mednafen and put it into emulators/mednafen/ folder (or install it with a package manager if on linux).
    You will also need to obtain bios file (mpr-17933.bin) and put it in the mednafen folder.

Note: .bat scripts used within SRL can be run natively on Windows, Linux or Mac.

Linux dependencies

Use your preferred package manager to install the following:

  • make - for compilation
  • unzip - used during compiler installation
  • wget - to download the compiler
  • sox - to convert audio
    • libsox-fmt-mp3 - for sox to support mp3 files
  • xorriso - to build cue/bin

Build and run samples

Samples and project in SRL can be build and run from VSCode or manually by starting .bat scripts in the sample/project directory

With VSCode (recommended)
  1. Open the folder of a project/sample (folder contains .vscode sub folder) with VSCode.
  2. Open tasks menu using CTRL+SHIFT+B.
  3. Click on one of the compile tasks to build the project, or run with task to start emulator.
    Projects can be compiled with DEBUG or RELEASE target.
Manually
  1. Open the folder of a project/sample.
  2. To build just run compile.bat or to run a built project in an emulator use one of the run with .bat files.

Creating a project

To create a new custom project just copy one of the samples to the projects folder.
The name of the project can than be changed within the makefile.

Contributing to the project

This block describes general code style for this project.
Following this style will ensure readability, maintainability and ease of creating documentation.

Sections

Tab vs. Spaces

Tab characters should not be used, 4 spaces should be used instead of a single TAB.

Empty lines

Do not use multiple empty lines.

Noncompliant:

void MyFunc()
{
    int i;



    i = Compute();
}

Compliant:

void MyFunc()
{
    int i;

    i = Compute();
}

Curly braces

  1. Curly braces should always be on a new line.
  2. If there is an function call or variable definition/assignment before a starting curly bracket it must be preceded by a empty line, otherwise there should be no empty line before starting curly bracket.
  3. Ending curly bracket must never be preceded by a empty line,

Documentation

Every member (eg: namespace, class, variable, function, ...) must have doxygen documentation comment above it. (example: see Variables & Constants - compliant case)

Variables & constants

  1. Public variables and constants must be names with PascalCase and use of '_' or single letter names is forbidden in every case.
  2. Private variables must be named with camelCase and use of '_' or single letter names is forbidden in every case.

Noncompliant:

class MyClass
{
private:
    static const _myConstant = 15;
    int _myValue;

public:
    int myTest;

    // ...
};

Compliant:

/** @brief My example class
 */
class MyClass
{
private:
    /** @brief My private constant that defines stuff
     */
    static const MyConstant = 15;
    
    /** @brief My private variable that stores stuff
     */
    int myValue;

public:
    /** @brief My public variable that stores stuff
     */
    int MyTest;

    // ...
};

Function naming

Function names are in PascalCase and use of '_' or single letter names is forbidden in every case.

Noncompliant:

void _myFunction(int _t);

Compliant:

/** @brief My function that does stuff
 * @param test Current test value
 */
void MyFunction(int test);

Referencing local variables

  • Instance variables:
    When referencing an instance variable within class be it public or private this-> keyword must always be before it. This improves readability by showing which variable comes from within this class, which comes from within function or which comes from outside.

  • Static/Constant variables:
    When referencing a constant or static variable we must put a name of class from where this variable came from before it always. This improves readability helping to distinguish between static/const and instance variables, it also helps to identify where variable is defined by just a glance.

Example:

Documentation omitted to conserve space

class MyClass
{
private:
    static const int MyAmazingHiddenConstant;
    int myAmazingVariable;

public:
    static const int WowSoPublic;
    int YouCanSeeThis;

    // Constructors...

    int TestFunc(int myParam)
    {
        return this->YouCanSeeThis +
            this->myAmazingVariable +
            myParam + 
            MyClass::MyAmazingHiddenConstant +
            MyClass::WowSoPublic;
    }
}