Ren'Py for Nintendo Switch

This repository contains a port of Ren'Py to the Nintendo Switch.
Ren'Py is a visual novel engine that is written using Python.
Discussion of this project is on the Lemma Soft Forums.

Building

Please view the external_library_build/Building.md file for instructions on building this project, including the additional third party dependencies.

File Formats

It is highly recommended that you use the following file formats:

If these formats are not used, there is a possibility of the program working incorrectly or performance being impacted.
Free tools such as FFmpeg, cwebp, and ImageMagick are available to convert file formats.
rpatool can be used to create and merge RPA files, and also convert to RPAv2 format.
The file format can be changed without changing the file extension, so no script (rpy file) changes are needed.
The file example.png can be in the WebP file format without changing the filename to example.webp.

RomFS Integration

To integrate the game into one single nro file, place game files in a folder named romfs, and build as described in the "Building" section.
NOTE: If you do not compile the py and rpy files to pyo and rpyc respectively by running the game at least once on a read-write file system, the loading time required until the title screen is seen will be increased.
The py_compile module can be used to compile py files to pyo.
Example usage of this module:

find . -name \*.py -exec python -O -m py_compile {} \;

File system layout

The following files or folders are required to be in the same directory as the .nro or in RomFS:

libnx bindings

Ren'Py for Nintendo Switch supports mostly complete libnx bindings.
The bindings are generated by SWIG.

To use the bindings, you need to import the library libnx.

import libnx

To initialize a structure, you can use the following syntax:

clkrstSession = libnx.ClkrstSession()

To access members of a structure, you can use the following syntax:

service = clkrstSession.s

To access a enumeration, you can use the following syntax:

libnx.PcvModuleId_CpuBus

To call a function, you can use the following syntax:

libnx.clkrstOpenSession(clkrstSession, libnx.PcvModuleId_CpuBus, 3)

Example use cases of this feature:

Available Python native modules

The following native Python modules are available in Ren'Py for Nintendo Switch:

License

This project is licensed under the MIT license. Please read the LICENSE file for more information.