diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index abf33e2f..3200b010 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -93,3 +93,19 @@ job_gp2x:
paths:
- "*.zip"
- "GP2X_JOB_ID"
+
+job_switch:
+ stage: build
+ before_script:
+ - apt-get update -qq && apt-get install -y -qq zip
+ - "sh ./.install-switch-toolchain.sh"
+ - "source /etc/profile.d/devkit-env.sh"
+ script:
+ - "SWITCH=1 make -j2 grafx2"
+ - "SWITCH=1 make ziprelease"
+ after_script:
+ - "echo $CI_JOB_ID > SWITCH_JOB_ID"
+ artifacts:
+ paths:
+ - "*.zip"
+ - "SWITCH_JOB_ID"
diff --git a/.gitlab-page.sh b/.gitlab-page.sh
index b7292ac1..e45fb83e 100755
--- a/.gitlab-page.sh
+++ b/.gitlab-page.sh
@@ -9,6 +9,7 @@ LINUX_JOB_ID=$(cat LINUX_JOB_ID)
WIN32_JOB_ID=$(cat WIN32_JOB_ID)
ATARI_JOB_ID=$(cat ATARI_JOB_ID)
GP2X_JOB_ID=$(cat GP2X_JOB_ID)
+SWITCH_JOB_ID=$(cat SWITCH_JOB_ID)
# for debug:
echo "CI_JOB_URL=${CI_JOB_URL}"
@@ -46,6 +47,8 @@ echo "
Atari (SDL API) :" >> ${OUTFILE}
echo "grafx2-sdl-${VERSION}-m68k-atari-mint.zip" >> ${OUTFILE}
echo "GP2X (SDL API) :" >> ${OUTFILE}
echo "grafx2-sdl-${VERSION}-nottf-gp2x.zip" >> ${OUTFILE}
+echo "Switch (SDL2 API) :" >> ${OUTFILE}
+echo "grafx2-sdl2-${VERSION}-switch.zip" >> ${OUTFILE}
echo "" >> ${OUTFILE}
echo "" >> ${OUTFILE}
diff --git a/.install-switch-toolchain.sh b/.install-switch-toolchain.sh
new file mode 100755
index 00000000..07956fb1
--- /dev/null
+++ b/.install-switch-toolchain.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+
+FILE="devkitpro-pacman.deb"
+SHA256=aa674feee79b00948154ba132ed36266e1ace9fe1974c430764449ea26ac1d7a
+URL="https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/$FILE"
+URLALT="https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/$FILE"
+
+SUDO=$(which sudo || echo "")
+if [ -z "$SUDO" ] ; then
+ echo "no sudo"
+else
+ echo "sudo: $SUDO"
+fi
+
+WGET=$(WGET=`which wget` ; \
+ if [ "$?" = "0" ] && [ -x "$WGET" ] ; \
+ then echo "$WGET -nv" ; \
+ else echo 'curl -R -O -L' ; fi)
+
+TMP=$(mktemp -d)
+cd ${TMP}
+
+$WGET "$URL" || $WGET "$URLALT"
+if ! echo "$SHA256 $FILE" | shasum -c - ; then
+ echo "FAILED to check authenticity of devikpro dkp-pacman deb package"
+ exit 1
+fi
+
+cd /
+$SUDO apt-get install "${TMP}/${FILE}" || exit 1
+echo "devkitpro pacman installed"
+yes Y | $SUDO dkp-pacman -S devkitA64 devkit-env libnx switch-tools switch-sdl2 switch-sdl2_ttf switch-sdl2_image switch-zlib switch-bzip2 switch-libpng switch-libjpeg-turbo switch-freetype || exit 1
+echo "Switch toolchain and library extracted to /opt/devkitpro.."
+rm -r ${TMP}
diff --git a/.travis.yml b/.travis.yml
index af28252b..431bba9a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,9 @@ matrix:
env: ''
- os: linux
env: 'WIN32CROSS=1'
+ - os: linux
+ env: 'SWITCH=1'
+ sudo: required
- os: linux
env: 'ATARICROSS=1'
sudo: required
@@ -40,6 +43,7 @@ before_install:
install:
- 'git fetch --unshallow'
- 'if [ "$ATARICROSS" = "1" ] ; then sh ./.install-cross-mint.sh ; fi'
+ - 'if [ "$SWITCH" = "1" ] ; then sh ./.install-switch-toolchain.sh ; fi'
script:
- 'cd $TRAVIS_BUILD_DIR'
diff --git a/doc/COMPILING.txt b/doc/COMPILING.txt
index 481803fb..3961730b 100644
--- a/doc/COMPILING.txt
+++ b/doc/COMPILING.txt
@@ -121,6 +121,18 @@ To compile a gp2x executable, type
make GP2XCROSS=1
This will only work on an UNIXsystem (Linux or FreeBSD).
+== switch ==
+
+To build for Nintendo Switch, you have to install devkitA64 and the following dependencies using dkp-pacman:
+
+devkit-env libnx switch-tools switch-sdl2 switch-sdl2_ttf switch-sdl2_image switch-zlib
+ switch-bzip2 switch-libpng switch-libjpeg-turbo switch-freetype
+
+see https://devkitpro.org/wiki/devkitPro_pacman
+
+To compile a switch executable, type
+ make SWITCH=1
+
== Windows ==
It is also possible to compile from linux, with this command :
diff --git a/misc/switch/gfx2def.ini b/misc/switch/gfx2def.ini
new file mode 100644
index 00000000..d7ab97a8
--- /dev/null
+++ b/misc/switch/gfx2def.ini
@@ -0,0 +1,425 @@
+###### GrafX2 initialization file ###### Fichier d'initialisation de GrafX2 ##
+# # #
+# You may modify this file with any # Vous pouvez modifier ce fichier avec #
+# standard ASCII text editor. # n'importe quel éditeur de texte #
+# # ASCII standard. #
+# # #
+# Comments are preceded by ';' or # Les commentaires sont précédés par #
+# '#'. # ';' ou '#'. #
+# # #
+# Options are not case sensitive and # Les options ne sont pas sensibles à #
+# spaces are ignored. # la casse et les espaces sont ignorés.#
+# # #
+# You must not change the order of # Vous ne devez pas changer l'ordre #
+# the sections and their options. # des sections et de leurs options. #
+# You must not delete or put into # Vous ne devez pas effacer ou mettre #
+# comment any section nor option. # en commentaire une section ou option.#
+# # #
+# Each option is preceded by a # Chaque option est précédée par un #
+# comment which explains its meaning. # commentaire qui explique sa fonction.#
+# # #
+##############################################################################
+
+
+
+[MOUSE] # [SOURIS]
+
+ ; The sensitivity of the mouse can | La sensibilité de la souris peut
+ ; take values from 1 to 4. The | prendre des valeurs de 1 à 4. Plus
+ ; smaller values, the faster. | les valeurs sont petites, plus c'est
+ ; This only takes effect in | rapide. Ce paramétrage n'est utilisé
+ ; fullscreen modes. | que dans les modes "plein écran".
+ ; |
+ X_sensitivity = 1 ; (default 1)
+ Y_sensitivity = 1 ; (default 1)
+
+ ; Unused setting, only kept for compatibility.
+ X_correction_factor = 0 ; (default 0)
+ Y_correction_factor = 0 ; (default 0)
+
+ ; Aspect of the main cursor (cross) | Aspect du curseur principal (croix)
+ ; 1: Solid | 1: Solide
+ ; 2: Transparent | 2: Transparent
+ ; 3: Thin (solid) | 3: Fin (solide)
+ Cursor_aspect = 1 ; (default 1)
+
+[MENU] # [MENU]
+
+ ; Colors of the menus (the black | Couleurs des menus (la couleur noire
+ ; and the white colors cannot be | et la couleur blanche ne peuvent pas
+ ; modified). | être modifiées).
+ ; Values are in {Red,Green,Blue} | Les valeurs sont dans l'ordre {Rouge,
+ ; order and are between 0 and 63. | Vert,Bleu} et vont de 0 à 63.
+ Light_color = 42,42,42 ; (default 42,42,42)
+ Dark_color = 27,27,27 ; (default 27,27,27)
+ ;
+ ; Light_color = 24,25,30 ; \_ Nightmare
+ ; Dark_color = 13,14,19 ; /
+ ;
+ ; Light_color = 10,45,28 ; \_ Forest
+ ; Dark_color = 5,27,12 ; /
+ ;
+ ; Light_color = 48,41,26 ; \_ Gold
+ ; Dark_color = 26,22,15 ; /
+ ;
+ ; Light_color = 10,40,55 ; \_ Oceanic
+ ; Dark_color = 10,20,32 ; /
+
+ ; Aspect ratio and size of the | Proportion des menus et de la barre
+ ; menus and the tool-bar. | d'outils.
+ ; Possible values: | Valeurs possibles:
+ ; 0: Do not adapt (pixels are not | 0: Ne pas adapter (les pixels ne sont
+ ; stretched) | pas étirés)
+ ; 1: Adapt the menus and the tool- | 1: Adapter les menus et la barre
+ ; bar according to the resolution| d'outils suivant la résolution
+ ; 2: Slightly adapt the ratio of | 2: Adapter légèrement les proportions
+ ; the menus and tool-bar | des menus et de la barre d'outils
+ ; -1:Do not adapt (like 0) | -1:Ne pas adapter (comme 0)
+ ; -2:Stretch by x2 maximum | -2:Etire au double de taille si possible
+ ; -3:Stretch by x3 maximum | -3:Etire au triple de taille si possible
+ ; -4:Stretch by x4 maximum | -4:Etire au quadruple de taille si
+ ; | possible.
+ Menu_ratio = -2 ; (default -2)
+
+[FILE_SELECTOR] # [SELECTEUR_DE_FICHIERS]
+
+ ; Show hidden files and | Afficher les fichiers et répertoires
+ ; directories (values are 'yes' or | cachés (les valeurs sont 'yes' ou
+ ; 'no'). | 'no').
+ Show_hidden_files = no ; (default 'no')
+ Show_hidden_directories = no ; (default 'no')
+
+ ; Delay before displaying a preview | Délai avant d'afficher une preview
+ ; in file-selectors (in 18.2th of | dans les sélecteurs de fichiers (en
+ ; second). Possible values range | 18.2èmes de seconde) Les valeurs
+ ; from 1 to 256. | possibles vont de 1 à 256.
+ Preview_delay = 8 ; (default 8)
+
+ ; Maximize the preview of the | Maximiser la preview des images pour
+ ; pictures so that it is as big as | qu'elle soit aussi grande que
+ ; possible. If you're not in the | possible.
+ ; same resolution as the picture's | Si vous n'êtes pas dans la même réso-
+ ; one, it can try to correct the | lution que celle de l'image, cela peut
+ ; aspect ratio, but if the picture | essayer de corriger les proportions,
+ ; does not fill the whole screen, | mais si l'image ne prend pas tout
+ ; it can be worse. | l'écran, cela peut être pire.
+ Maximize_preview = no ; (default 'no')
+
+ ; This option is used to place the | Cette option est utilisée pour placer
+ ; selection bar on a filename by | la barre de sélection sur un nom de
+ ; typing its first letters. | fichier en tapant ses 1ères lettres.
+ ; For example, if you want to find | Par exemple, si vous voulez trouver le
+ ; the "PICTURE.PKM" in a directory | fichier "PICTURE.PKM" dans un réper-
+ ; that also contains "PALETTE.PAL", | toire contenant également le fichier
+ ; you'll just have to type P and I. | "PALETTE.PAL", vous n'aurez qu'à taper
+ ; The different values of "FFF" | P puis I.
+ ; indicate if you want to find the | Les different valeurs de "FFF"
+ ; name in both files and directories| indiquent si vous voulez trouvez le nom
+ ; or just in only one of these: | dans les fichiers ET les répertoires ou
+ ; 0: files and directories | simplement dans l'un OU l'autre.
+ ; 1: files only | 0: fichiers et répertoires
+ ; 2: directories only | 1: fichiers seulement
+ ; | 2: répertoires seulement
+ Find_file_fast = 0 ; (default 0)
+
+
+[LOADING] # [CHARGEMENT]
+
+ ; Automatically set the resolution | Passer automatiquement dans la bonne
+ ; when loading a picture. | résolution lors du chargement d'une
+ ; You should set this value to | image.
+ ; 'yes' after disabling the video | Vous devriez définir cette option à
+ ; modes that are not supported by | 'yes' après avoir inhibé les modes
+ ; your video card or monitor. | vidéo qui ne sont pas supportés par
+ ; | votre matériel.
+ Auto_set_resolution = no ; (default 'no')
+
+ ; If the variable above is set to | Si la variable ci-dessus est à 'yes',
+ ; 'yes', this one tells if you want | celle-ci indique si vous voulez
+ ; to set the resolution according | définir la résolution suivant:
+ ; to: | 1: les dimensions de "l'écran
+ ; 1: the internal "original screen" | d'origine" internes à l'image
+ ; dimensions of the picture | 2: les véritables dimensions de
+ ; 2: the actual dimensions of the | l'image
+ ; picture |
+ Set_resolution_according_to = 1 ; (default 1)
+
+ ; If you load a picture with a | Si vous chargez une image ayant une
+ ; palette of less than 256 colors, | palette de moins de 256 couleurs,
+ ; this option defines if you want | cette option indique si vous souhaitez
+ ; to clear the palette or to keep | effacer la palette ou bien conserver
+ ; the colors of the previous | les couleurs de l'image précédente qui
+ ; picture that are over the number | se situent au-delà du nombre de la
+ ; of colors of the new picture. | nouvelle image.
+ ; For example, if you load a | Par exemple, si vous chargez une image
+ ; 32-color picture, the colors 32 | de 32 couleurs, les couleurs 32 à 255
+ ; to 255 will be set to black if | seront passées en noir si cette option
+ ; this option is set to 'yes', or | est à 'yes', ou bien elles resteront
+ ; they will be kept unchanged if | inchangées si elle est à 'no'.
+ ; this option is set to 'no'. |
+ Clear_palette = yes ; (default 'yes')
+
+
+[MISCELLANEOUS] # [DIVERS]
+
+ ; Draw the limits of the picture. | Afficher les limites de l'image
+ Draw_limits = yes ; (default 'yes')
+
+ ; Adjust the brush grabbing in | Ajuster la capture de brosse en mode
+ ; "grid" mode. | "grille".
+ Adjust_brush_pick = yes ; (default 'yes')
+
+ ; Coordinates: | Coordonnées:
+ ; 1: Relative | 1: Relatives
+ ; 2: Absolute | 2: Absolues
+ Coordinates = 1 ; (default 1)
+
+ ; Create a backup file when saving. | Créer un fichier backup lors des
+ ; | sauvegardes.
+ Backup = no ; (default 'no')
+
+ ; Number of pages stored in memory | Nombre de pages stockées en mémoire
+ ; for "undoing". | destinées à annuler les dernières
+ ; Values are between 1 and 99. | modifications. Valeurs entre 1 et 99.
+ Undo_pages = 20 ; (default 20)
+
+ ; Speed of the scroll-bars (in VBLs | Vitesse des barre de défilement (en
+ ; waited) while clicking with the | VBLs attendus) lorsque l'un des
+ ; left or right button of the mouse.| boutons de la souris est enfoncé.
+ ; Values can be between 1 and 255. | Les valeurs sont comprises entre 1 et
+ ; The bigger values, the slower. | 255. Plus elles sont grandes, plus
+ ; | c'est lent.
+ Gauges_scrolling_speed_Left = 10 ; (default 10)
+ Gauges_scrolling_speed_Right = 3 ; (default 3)
+
+ ; Automatically save the configu- | Enregistre automatiquement la configu-
+ ; ration when exiting the program. | ration lorsqu'on quitte le programme.
+ Auto_save = yes ; (default 'yes')
+
+ ; Maximum number of vertices used | Nombre maximum de vertex utilisés dans
+ ; in filled polygons and polyforms, | les polygônes et polyformes pleins, et
+ ; and lasso. Possible values range | le lasso. Les valeurs possibles vont
+ ; from 2 to 16384. | de 2 à 16384.
+ ; Each vertex takes 4 bytes. | Chaque vertex prend 4 octets.
+ Vertices_per_polygon = 1024 ; (default 1024)
+
+ ; Automatically zoom into the | Zoomer automatiquement la zone pointée
+ ; pointed area when you press the | par la souris lorsque vous appuyez sur
+ ; short-key of the Magnifier button | la touche de raccourci de la loupe.
+ ; while being above the picture. |
+ Fast_zoom = yes ; (default 'yes')
+
+ ; Separate the colors in the tool- | Séparer les couleurs dans la barre
+ ; bar by a black squaring. | d'outils par un quadrillage noir.
+ Separate_colors = no ; (default 'no')
+
+ ; Initial value of the feedback for | Valeur initiale du "feedback" pour les
+ ; the drawing modes (cf. docs). | modes de dessin (cf. docs).
+ FX_feedback = yes ; (default 'yes')
+
+ ; When you reduce the palette or | Si vous réduisez la palette ou "zappez"
+ ; "zap" some colors out of it, it is| quelques couleurs, il est possible
+ ; possible that there are not enough| qu'il ne reste pas assez de couleurs
+ ; colors left to draw the menus. | pour afficher les menus. Mettre cette
+ ; Switching the following variable | variable à 'yes' ramènera automatiquent
+ ; on will bring back the colors of | les couleurs du menu s'il reste moins
+ ; the menu if there are less than 4 | de 4 couleurs après une "réduction" ou
+ ; colors left after "reducing" or | un "zapping".
+ ; "zapping". |
+ Safety_colors = yes ; (default 'yes')
+
+ ; Display a message at startup | Afficher un message au démarrage
+ ; telling the version number of the | indiquant le numéro de version du
+ ; program. | programme.
+ Opening_message = yes ; (default 'yes')
+
+ ; Take the Stencil into account when| Prendre le Stencil en compte lorsqu'on
+ ; clearing the image. | efface l'image.
+ Clear_with_stencil = yes ; (default 'yes')
+
+ ; Directly set the discontinuous | Passer automatiquement en mode de
+ ; freehand drawing mode after brush | dessin discontinu après la prise d'une
+ ; grabbing. | brosse.
+ Auto_discontinuous = no ; (default 'no')
+
+ ; Save the screen dimensions in GIF | Sauver les dimensions de l'écran dans
+ ; files. If you want to read these | les fichiers GIF. Si vous voulez lire
+ ; files with Photoshop or Alchemy, | ces fichiers avec Photoshop ou Alchemy,
+ ; and maybe some other programs, you| et peut-être d'autres programmes, vous
+ ; must set this option to 'no'. | devez mettre cette option à 'no'.
+ Save_screen_size_in_GIF = no ; (default 'no')
+
+ ; Automatically count the number of | Compter automatiquement le nombre de
+ ; different colors used when opening| couleurs différentes utilisées lors de
+ ; the palette editor window. (Set it| d'ouverture de la fenêtre d'édition de
+ ; to 'no' if you have a slow PC or | la palette. (Mettez-le à 'no' si vous
+ ; if you edit huge pictures) | avez un PC lent ou bien si vous éditez
+ ; | d'énormes images).
+ Auto_nb_colors_used = yes ; (default 'yes')
+
+ ; Default video mode at startup | Mode vidéo par défaut au
+ ; (see the list by running the | démarrage (voir la liste en lançant
+ ; program with argument "/?". | le programme avec l'option "/?".
+ Default_video_mode = window ; (default 'window')
+
+ ; Window dimensions. The program | Dimensions de la fenêtre en mode
+ ; remembers the last window size. | fenêtré.
+ Default_window_size = 1920,1080 ; (default '640,480')
+
+ ; This setting allows you merge successive mouse movements into a single
+ ; mouse movement. You should only use it if you are using a mouse which
+ ; reports at 200Hz or more, and you experience lag when using discontinuous
+ ; hand-drawing with large brushes (this tool tries to paste the brush and
+ ; update the screen on each new mouse position) In this case, set this to 2
+ ; or more, to ignore some intermediate mouse reports when a more recent one
+ ; is present.
+ ; Note that with a value superior to 1, you lose precision with continuous
+ ; hand-drawing, as intermediate mouse positions are skipped.
+ Merge_movement = 0 ; (default 0)
+
+ ; Number of columns in the palette of the menu bar. Can be any number from
+ ; 1 to 256. If there is not enough room, the program will display less
+ ; columns. But your preference will be kept, and as soon as there is more
+ ; space in the screen, more columns will be shown.
+ ;
+ Palette_Cells_X = 16; (Default 16)
+
+ ; Number of lines in the palette of the menu. Can be any number from
+ ; 1 to 16. The menu can always display the number of lines you request.
+ ;
+ Palette_Cells_Y = 4; (Default 4)
+
+ ; Bookmarked directories. Leave the directory blank for unused ones.
+ ;
+ Bookmark_label =
+ Bookmark_directory =
+
+ Bookmark_label =
+ Bookmark_directory =
+
+ Bookmark_label =
+ Bookmark_directory =
+
+ Bookmark_label =
+ Bookmark_directory =
+
+ ; In the classic layout, the palette in the menu has colors from left to
+ ; right. If you prefer the colors ordered top to bottom, set this option
+ ; to YES.
+ ;
+ Palette_vertical = YES; (Default YES)
+
+ ; The program remembers the last window position, if the
+ ; OS isn't able to do it by itself. (ie: Windows)
+ Window_position = 9999,9999; (Default 9999,9999 which means: NA)
+
+ ; This is the time (in milliseconds) between two clicks for Grafx2 to
+ ; recognize a double-click. Double-click is used mostly in the palette
+ ; area of the menu: double-click a color to open the palette.
+ Double_click_speed = 500; (Default 500)
+
+ ; When you press two digit keys in rapid succession (ex: 3 8), Grafx2
+ ; sets transparency to 38% (instead of 30% then 80%). This setting
+ ; allows you to set the maximum delay between two keypresses for
+ ; GrafX2 to recognize them as a combo.
+ Double_key_speed = 500; (Default 500)
+
+ ; Name of the skinfile you want to | Nom du fichier skin que vous voulez
+ ; use. | utiliser.
+ ; Default : (empty to let the program choose)
+ Skin_file =
+
+ ; Name of the font file (8x8) you | Nom du fichier police de caractère
+ ; want to use. | 8x8 utilisée dans les menus.
+ ; Default : (empty to let the program choose)
+ Font_file =
+
+ ; This determines the color value for the grid. Each pixel of
+ ; the grid will be displayed by XOR-ing the original color with
+ ; the value of this setting.
+ ; For example, if you always paint 16-color images, you can set it
+ ; to 16 so the color of the grid are 16 for 0, 17 for 1, etc.
+ ; Then you can set colors 16-31 as lighter/darker variants
+ ; of your original palette, resulting in a pretty grid !
+ ;
+ ; Valid values are 1 to 255.
+ Grid_XOR_color = 255; (Default 255)
+
+ ; This records the last pixel ratio used, to restore it on start.
+ ; Valid values are from 0 to 7 for: Simple, Wide, Tall, Double,
+ ; Triple, Wide2, Tall2, Quadruple.
+ ;
+ Pixel_ratio = 8; (Default 0)
+
+ ; This records the visibility of toolbars, to restore them on start.
+ ; It's a bitfield, where 1=Status, 2=Layers/Animation, 4=Tools
+ ;
+ Menubars_visible = 255; (Default 255)
+
+ ; This enables a mode where right mouse buttons acts as
+ ; a color picker, with most tools.
+ ;
+ Right_click_colorpick = NO; (Default NO)
+
+ ; When this mode is active, scrolling the view (and the magnifier view)
+ ; affects both the main image and the spare page - as long as they have
+ ; the same dimensions.
+ ;
+ Sync_views = YES; (Default YES)
+
+ ; This setting determines which key inverts the mouse buttons
+ ; when it's held : A left click is then interpreted as a right-click.
+ ; It's especially useful for one-button controllers,
+ ; such as touchscreens and tablets.
+ ; Possible values are 0 (none), 1 (control), 2 (alt)
+ ;
+ Swap_buttons = 1; (Default 1)
+
+ ; Last directory browsed with the script selector.
+ ; Leave blank to initially start in (data directory)/scripts
+ ;
+ Scripts_directory =
+
+ ; When this setting is disabled, and you create a shortcut with a key that
+ ; is already associated to another shortcut, Grafx2 will unset the latter.
+ ; If you enable this mode, Grafx2 will not make such check, so you can design
+ ; shortcuts that trigger several actions at once.
+ ;
+ Allow_multi_shortcuts = no; (Default no)
+
+ ; Determines if the Tilemap tool should identify tiles that are mirrored
+ ; version of other tiles, on the X axis.
+ ;
+ Tilemap_detect_mirrored_x = no; (Default no)
+
+ ; Determines if the Tilemap tool should identify tiles that are mirrored
+ ; version of other tiles, on the Y axis.
+ ;
+ Tilemap_detect_mirrored_y = no; (Default no)
+
+ ; Determines if the Tilemap tool should identify tiles that are reversed
+ ; versions of other tiles (180°).
+ ;
+ Tilemap_detect_mirrored_xy = no; (Default no)
+
+ ; Determines if the Tilemap tool should show the number of distinct tiles
+ ; at the end of analysis.
+ ;
+ Tilemap_count = no; (Default no)
+
+ ; Enables the virtual keyboard when the user enters a textbox.
+ ;
+ ; 0=Auto (guess), 1=ON, 2=OFF
+ Use_virtual_keyboard = 0; (Default 0)
+
+ ; Indicates if new images should by default use layers. The alternative
+ ; is animation frames.
+ ;
+ Default_mode_layers = yes; (Default no)
+
+ ; Set the gamma value used to translate palettes from Thomson MO/TO
+ ; pictures. 10 is 1.0, 22 is 2.2 etc.
+ ;
+ MOTO_gamma = 28; (Default 28)
+
+ ; end of configuration
diff --git a/misc/switch/icon.jpg b/misc/switch/icon.jpg
new file mode 100644
index 00000000..fe518593
Binary files /dev/null and b/misc/switch/icon.jpg differ
diff --git a/src/Makefile b/src/Makefile
index a67bd9ba..ee40e63e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -568,6 +568,27 @@ endif
STRIP = mipsel-linux-strip
JOYCOPT = -DUSE_JOYSTICK
else
+ ifdef SWITCH
+ #cross compile an exec for the switch
+ ifeq ($(strip $(DEVKITPRO)),)
+ $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro")
+ endif
+ include $(DEVKITPRO)/libnx/switch_rules
+ PLATFORM = switch
+ API = sdl2
+ NOLUA = 1
+ OBJDIR = ../obj/switch
+ BIN = ../bin/grafx2
+ CC = $(DEVKITPRO)/devkitA64/bin/aarch64-none-elf-gcc
+ ARCH = -g -march=armv8-a -mtune=cortex-a57 -fPIE -std=c99 -ffast-math -mcpu=cortex-a57+crc+fp+simd
+ COPT = `$(DEVKITPRO)/portlibs/switch/bin/sdl2-config --cflags` `$(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags`
+ COPT += $(ARCH) -Wall -ffunction-sections -O$(OPTIM)
+ COPT += -D__SWITCH__ -D_XOPEN_SOURCE=500 -DUSE_JOYSTICK -D__no_tifflib__
+ LOPT = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(OBJDIR)/$*.map
+ LOPT += -lSDL2_image `$(DEVKITPRO)/portlibs/switch/bin/sdl2-config --libs`
+ LOPT += -lSDL2_ttf `$(DEVKITPRO)/portlibs/switch/bin/freetype-config --libs`
+ LOPT += -ljpeg -lstdc++ -lnx
+ else
ifdef AROS32CROSS
#cross compile an AROS 32 bit executable
BIN = ../GrafX2
@@ -673,6 +694,7 @@ endif
endif
endif
endif
+ endif
endif
endif
@@ -924,6 +946,13 @@ else
ifeq ($(PLATFORM),FreeMiNT)
$(STACK) -S 128k $(BIN)
$(FIX_FLAGS) -S $(BIN)
+else
+ifeq ($(SWITCH), 1)
+ @nacptool --create "grafX2" "grafX2 team / romain337 (nxbuild)" "$(VERSIONTAG)" $(BIN).nacp
+ @echo built ... $(BIN).nacp
+ @elf2nro $(BIN) $(BIN).nro $(BIN).nacp --icon=../misc/switch/icon.jpg --nacp=$(BIN).nacp
+ @echo built ... $(BIN).nro
+endif
endif
endif
endif
@@ -937,6 +966,13 @@ else
ifeq ($(PLATFORM),FreeMiNT)
$(STACK) -S 128k $(BIN)
$(FIX_FLAGS) -S $(BIN)
+else
+ifeq ($(SWITCH), 1)
+ @nacptool --create "grafX2" "grafX2 team / romain337 (nxbuild)" "$(VERSIONTAG)" $(BIN).nacp
+ @echo built ... $(BIN).nacp
+ @elf2nro $(BIN) $(BIN).nro $(BIN).nacp --icon=../misc/switch/icon.jpg --nacp=$(BIN).nacp
+ @echo built ... $(BIN).nro
+endif
endif
endif
@@ -944,6 +980,12 @@ endif
# Make release will strip the executable to make it smaller but non-debugable
release : $(BIN)
$(STRIP) $(BIN)
+ifeq ($(SWITCH), 1)
+ @nacptool --create "grafX2" "grafX2 team / romain337 (nxbuild)" "$(VERSIONTAG)" $(BIN).nacp
+ @echo built ... $(BIN).nacp
+ @elf2nro $(BIN) $(BIN).nro $(BIN).nacp --icon=../misc/switch/icon.jpg --nacp=$(BIN).nacp
+ @echo built ... $(BIN).nro
+endif
# .tgz archive with source only files
SRCARCH = ../src-$(VERSIONTAG).tgz
@@ -995,6 +1037,19 @@ ifdef ATARICROSS
GRAFX2/gfx2def.ini GRAFX2/DOC/ GRAFX2/SCRIPTS/
$(AT)$(RM) -r $(TMP)
else
+ifdef SWITCH
+ $(eval TMP := $(shell mktemp -d))
+ $(AT)$(MKDIR) $(TMP)/switch/grafx2
+ $(AT)$(CP) $(BIN).nro $(TMP)/switch/grafx2
+ $(AT)$(CP) -R ../share/grafx2/fonts $(TMP)/switch/grafx2
+ $(AT)$(CP) -R ../share/grafx2/skins $(TMP)/switch/grafx2
+ $(AT)$(CP) ../misc/switch/gfx2def.ini $(TMP)/switch/grafx2
+ cd .. && $(ZIP) $(ZIPOPT) "grafx2-$(API)-$(VERSIONTAG)$(TTFLABEL)-$(PLATFORM).$(ZIP)" \
+ $(DOC_FILES:../%=%) $(DOC_FILESRTF:../%=%) $(SRCARCH:../%=%)
+ cd $(TMP) && \
+ $(ZIP) $(ZIPOPT) "$(CURDIR)/../grafx2-$(API)-$(VERSIONTAG)$(TTFLABEL)-$(PLATFORM).$(ZIP)" -r ./*
+ $(AT)$(RM) -r $(TMP)
+else
ifdef GP2XCROSS
$(eval TMP := $(shell mktemp -d))
$(AT)$(MKDIR) $(TMP)/data
@@ -1026,6 +1081,7 @@ ifeq ($(PLATFORM),Darwin)
$(DOC_FILES:../%=%) $(DOC_FILESRTF:../%=%) $(SRCARCH:../%=%)
endif
endif
+endif
endif
$(AT)$(TAR) czf "../grafx2-$(VERSIONTAG)-src.tgz" $(TARTRANSFORM) \
../src/*.c ../src/*.cpp ../src/*.h ../src/Makefile \
diff --git a/src/engine.c b/src/engine.c
index c7fe2fb2..38a665ba 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -53,7 +53,7 @@
#include "pxsimple.h"
#include "oldies.h"
-#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
+#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(__SWITCH__)
// We don't want to underline the keyboard shortcuts as there is no keyboard
#define NO_KEYBOARD
#endif
diff --git a/src/filesel.c b/src/filesel.c
index 2eab7827..2e807bfd 100644
--- a/src/filesel.c
+++ b/src/filesel.c
@@ -571,7 +571,7 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format)
// Now here's OS-specific code to determine if "parent directory" entry
// should appear.
-#if defined(__MORPHOS__) || defined(__AROS__) || defined (__amigaos4__) || defined(__amigaos__)
+#if defined(__MORPHOS__) || defined(__AROS__) || defined (__amigaos4__) || defined(__amigaos__) || defined(__SWITCH__)
// Amiga systems: always
Add_element_to_list(list, PARENT_DIR, Format_filename(PARENT_DIR,19,1), FSOBJECT_DIR, ICON_NONE);
list->Nb_directories ++;
diff --git a/src/help.c b/src/help.c
index 7f150e06..030a0d1a 100644
--- a/src/help.c
+++ b/src/help.c
@@ -977,7 +977,9 @@ void Button_Stats(int btn)
#else
#define NODISKSPACESUPPORT
// Free disk space is only for shows. Other platforms can display 0.
+ #if !defined(__SWITCH__)
#warning "Missing code for your platform !!! Check and correct please :)"
+ #endif
mem_size=0;
#endif
diff --git a/src/input.c b/src/input.c
index 3a0e3ddd..132c30e8 100644
--- a/src/input.c
+++ b/src/input.c
@@ -156,6 +156,15 @@ byte Pan_shortcut_pressed;
short Joybutton_left_click= JOY_BUTTON_A;
short Joybutton_right_click=JOY_BUTTON_B;
+#elif defined(__SWITCH__)
+
+ #define JOYSTICK_THRESHOLD (1024)
+ short Joybutton_shift= JOY_BUTTON_L;
+ short Joybutton_control= JOY_BUTTON_R;
+ short Joybutton_alt= JOY_BUTTON_Y;
+ short Joybutton_left_click= JOY_BUTTON_A;
+ short Joybutton_right_click=JOY_BUTTON_B;
+
#else // Default : Any joystick on a computer platform
///
/// This is the sensitivity threshold for the directional
diff --git a/src/io.c b/src/io.c
index 1bbaac3e..83e2cf41 100644
--- a/src/io.c
+++ b/src/io.c
@@ -462,7 +462,7 @@ int Directory_exists(const char * directory)
/// Check if a file or directory is hidden.
int File_is_hidden(const char *fname, const char *full_name)
{
-#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) || defined(__MINT__)
+#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) || defined(__MINT__)|| defined(__SWITCH__)
// False (unable to determine, or irrelevent for platform)
(void)fname;//unused
(void)full_name;//unused
@@ -772,6 +772,8 @@ byte Create_lock_file(const char *file_directory)
{
#if defined (__amigaos__)||(__AROS__)||(__ANDROID__)
#warning "Missing code for your platform, please check and correct!"
+ #elif defined(__SWITCH__)
+ // The switch can only run one application at a time, so we don't do anything special here
#else
char lock_filename[MAX_PATH_CHARACTERS];
diff --git a/src/keycodes.h b/src/keycodes.h
index 106a20ca..8e8d05a4 100644
--- a/src/keycodes.h
+++ b/src/keycodes.h
@@ -570,6 +570,20 @@
#define JOY_BUTTON_JOY (10)
#define KEY_ESC (KEY_JOYBUTTON+JOY_BUTTON_HOME)
+#elif defined (__SWITCH__)
+/// Button definitions for the Switch
+ #define JOY_BUTTON_UP (13)
+ #define JOY_BUTTON_DOWN (15)
+ #define JOY_BUTTON_LEFT (12)
+ #define JOY_BUTTON_RIGHT (14)
+ #define JOY_BUTTON_A (0)
+ #define JOY_BUTTON_X (2)
+ #define JOY_BUTTON_B (1)
+ #define JOY_BUTTON_Y (3)
+ #define JOY_BUTTON_L (6)
+ #define JOY_BUTTON_R (7)
+
+ #define KEY_ESC (KEY_JOYBUTTON+JOY_BUTTON_X)
#else
///
/// This is the key identifier for ESC. When hard-coding keyboard shortcuts
diff --git a/src/main.c b/src/main.c
index 4d803937..d45773b6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -92,6 +92,8 @@
#if defined(__macosx__)
#include
+#elif defined(__SWITCH__)
+#include
#elif defined(__FreeBSD__)
#include
#elif !defined(WIN32)
diff --git a/src/misc.c b/src/misc.c
index 768e4b54..3e708ffb 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -717,7 +717,7 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
#if defined(WIN32)
#include
-#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__SWITCH__)
#if defined(__OpenBSD__)
#include
#endif
@@ -785,7 +785,13 @@ unsigned long Memory_free(void)
return info.freeram*info.mem_unit;
#else
// AvailMem is misleading on os4 (os4 caches stuff in memory that you can still allocate)
+#if defined(__SWITCH__)
+ // There is some way to get memory information on switch (see include switch/kernel/svc.h svcGetInfo svcGetSystemInfo)
+ // but the usage is a bit confusing for the first and the later need privilege to be used.
+ // If you come here with a solution, you'r welcome. For now we just return the default value.
+#elif
#warning "There is missing code there for your platform ! please check and correct :)"
+#endif
return 10*1024*1024;
#endif
}
diff --git a/src/mountlist.c b/src/mountlist.c
index 3c064507..0db7bb57 100644
--- a/src/mountlist.c
+++ b/src/mountlist.c
@@ -43,6 +43,8 @@
#include
#elif defined(__SKYOS__)||defined(__ANDROID__)
#warning "Your platform is missing some specific code here ! please check and fix :)"
+#elif defined(__SWITCH__)
+ // Nothing much to do
#else
#define MOUNTED_GETMNTENT1
#endif
@@ -279,6 +281,10 @@ read_file_system_list (bool need_fs_type)
struct mount_entry **mtail = &mount_list;
(void)need_fs_type; // may be unused
+#if defined(__SWITCH__)
+ (void)me; // unused on switch
+#endif
+
#ifdef MOUNTED_LISTMNTENT
{
struct tabmntent *mntlist, *p;
diff --git a/src/readline.c b/src/readline.c
index bc9da8fb..48fdd3b0 100644
--- a/src/readline.c
+++ b/src/readline.c
@@ -74,7 +74,7 @@ const char * get_paste_board(void);
#endif
// Virtual keyboard is ON by default on these platforms:
-#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO)
+#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO) || defined(__SWITCH__)
#define VIRT_KEY_DEFAULT_ON 1
#else
#define VIRT_KEY_DEFAULT_ON 0
diff --git a/src/realpath.c b/src/realpath.c
index bcba03a7..256ad6ca 100644
--- a/src/realpath.c
+++ b/src/realpath.c
@@ -11,7 +11,7 @@
#include
#endif
-#if defined(__AROS__) || defined(__BEOS__) || defined(__MORPHOS__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(__amigaos__)
+#if defined(__AROS__) || defined(__BEOS__) || defined(__MORPHOS__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(__amigaos__) || defined(__SWITCH__)
// These platforms don't have realpath().
// We use the following implementation, found in:
// http://amiga.sourceforge.net/amigadevhelp/FUNCTIONS/GeekGadgets/realpath/ex02_realpath.c
@@ -65,7 +65,7 @@
if (chdir(path)) {
if (errno == ENOTDIR) {
- #if defined(WIN32) || defined(__MORPHOS__) || defined(__amigaos__)
+ #if defined(WIN32) || defined(__MORPHOS__) || defined(__amigaos__) || defined(__SWITCH__)
// No symbolic links and no readlink()
l = -1;
#else
diff --git a/src/sdlscreen.c b/src/sdlscreen.c
index 593157d1..891fccbd 100644
--- a/src/sdlscreen.c
+++ b/src/sdlscreen.c
@@ -60,6 +60,8 @@
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#elif defined(__ANDROID__)
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
+ #elif defined(__SWITCH__)
+ #define UPDATE_METHOD UPDATE_METHOD_CUMULATED
#else
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
#endif
diff --git a/src/setup.c b/src/setup.c
index 5a430e8e..961f5d0f 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -140,6 +140,9 @@ void Set_data_directory(const char * program_dir, char * data_dir)
//on tos, the same directory is used for everything
#elif defined (__MINT__)
strcpy(data_dir, program_dir);
+ //on switch, we store everything in the SD card in /switch/grafx2
+ #elif defined(__SWITCH__)
+ strcpy(data_dir,"/switch/grafx2/");
// Haiku provides us with an API to find it.
#elif defined(__HAIKU__)
if (find_path(Set_data_directory, B_FIND_PATH_DATA_DIRECTORY, "grafx2/", data_dir, PATH_MAX) != B_OK)
@@ -180,6 +183,9 @@ void Set_config_directory(const char * program_dir, char * config_dir)
// For TOS we store everything in the program dir
#elif defined(__MINT__)
strcpy(config_dir,program_dir);
+ //on switch, we store everything in the SD card in /switch/grafx2
+ #elif defined(__SWITCH__)
+ strcpy(config_dir,"/switch/grafx2/");
// For all other platforms, there is some kind of settigns dir to store this.
#else
char filename[MAX_PATH_CHARACTERS];