This repository contains a port of Ren'Py to the Nintendo Switch.
The repository is located at the following URL: https://github.com/uyjulian/renpy-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.
Once the steps in the aforementioned file are completed, run make
to build the project.
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 Contents
in the directory romfs
(see section File system layout), 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 (using either this port or upstream Ren'Py) on a read-write file system, the loading time required until the title screen is seen will be increased.
To integrate the game into one single nro
file, follow these steps:
Contents
in the folder named romfs
(see section File system layout).switch-tools
from devkitPro pacman (follow the installation instructions here if you have not already)control.nacp
: nacptool --create TITLE AUTHOR VERSION control.nacp
nro
file: elf2nro renpy-switch.elf OUTPUT.NRO --romfsdir=romfs --nacp=control.nacp --icon=LOGO.JPG
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:
= libnx.ClkrstSession() clkrstSession
To access members of a structure, you can use the following syntax:
= clkrstSession.s service
To access a enumeration, you can use the following syntax:
libnx.PcvModuleId_CpuBus
To call a function, you can use the following syntax:
3) libnx.clkrstOpenSession(clkrstSession, libnx.PcvModuleId_CpuBus,
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.