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.
Please view the external_library_build/Building.md
file for instructions on building this project, including the additional third party dependencies.
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
.
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 {} \;
The following files or folders are required to be in the same directory as the .nro
or in RomFS:
lib.zip
- contains the Python stdlib, Ren'Py modules, pygame_sdl2 modules, and libnx binding modules.renpy
- contains the common
directory used by Ren'Py.renpy.py
- startup script for Ren'Py.game
- contains the game files. This is where you place the game.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:
The following native Python modules are available in Ren'Py for Nintendo Switch:
_bisect
_codecs
_codecs_cn
_codecs_hk
_codecs_iso2022
_codecs_jp
_codecs_kr
_codecs_tw
_collections
_csv
_ctypes_test
_elementtree
_functools
_heapq
_hotshot
_io
_json
_locale
_lsprof
_md5
_multibytecodec
_random
_sha
_sha256
_sha512
_socket
_sre
_struct
_symtable
_testcapi
_weakref
array
audioop
binascii
bz2
cPickle
cStringIO
cmath
datetime
errno
fcntl
future_builtins
imageop
itertools
math
operator
parser
posix
pyexpat
strop
time
timing
unicodedata
xx
xxsubtype
zipimport
zlib
This project is licensed under the MIT license. Please read the LICENSE
file for more information.