Easy to use SGL wrapper written in C++
Documentation
![]() |
ReyeMe |
![]() |
robertoduarte |
![]() |
7shades |
![]() |
willll |
![]() |
nemesis-saturn |
![]() |
jae686 |
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.
- Download toolchain. This can be done by running
setup_compiler.bat
. - 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 compilationunzip
- used during compiler installationwget
- to download the compilersox
- to convert audiolibsox-fmt-mp3
- for sox to support mp3 files
xorriso
- to build cue/bin
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)
- Open the folder of a project/sample (folder contains .vscode sub folder) with VSCode.
- Open tasks menu using
CTRL+SHIFT+B
. - Click on one of the
compile
tasks to build the project, orrun with
task to start emulator.
Projects can be compiled with DEBUG or RELEASE target.
Manually
- Open the folder of a project/sample.
- To build just run
compile.bat
or to run a built project in an emulator use one of therun with
.bat
files.
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
.
This block describes general code style for this project.
Following this style will ensure readability, maintainability and ease of creating documentation.
- Tab vs. Spaces
- Empty lines
- Curly braces
- Documentation
- Variables & constants
- Function naming
- Referencing local variables
Tab characters should not be used, 4 spaces should be used instead of a single TAB.
Do not use multiple empty lines.
Noncompliant:
void MyFunc()
{
int i;
i = Compute();
}
Compliant:
void MyFunc()
{
int i;
i = Compute();
}
- Curly braces should always be on a new line.
- 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.
- Ending curly bracket must never be preceded by a empty line,
Every member (eg: namespace
, class
, variable
, function
, ...) must have doxygen documentation comment above it. (example: see Variables & Constants - compliant case)
- Public variables and constants must be names with PascalCase and use of '_' or single letter names is forbidden in every case.
- 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;
// ...
};
/** @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 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);
-
Instance variables:
When referencing an instance variable within class be it public or privatethis->
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.
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;
}
}