aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-09-12 19:39:02 +0200
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-09-12 19:39:02 +0200
commitc6548f077282f871bc22bd05595d3a1139f50a80 (patch)
treeb5771fabdfd86fa2e2076ee08029d358c92f017d
parentffa679d4d24b891cb59aba10946368f2ec00c391 (diff)
downloadpsn00bsdk-c6548f077282f871bc22bd05595d3a1139f50a80.tar.gz
Added preliminary files for CMake/CPack support
-rw-r--r--CMakeLists.txt177
-rw-r--r--cpack/convert_images.sh45
-rw-r--r--cpack/description.txt27
-rw-r--r--cpack/fakeroot_fix.cmake32
-rw-r--r--cpack/icon.icobin0 -> 194619 bytes
-rw-r--r--cpack/icon.svg164
-rw-r--r--cpack/nsis_banner.bmpbin0 -> 42622 bytes
-rw-r--r--cpack/nsis_banner.svg162
-rw-r--r--cpack/nsis_header.bmpbin0 -> 4220 bytes
-rw-r--r--cpack/nsis_header.svg66
-rw-r--r--cpack/uninstall.icobin0 -> 194619 bytes
-rw-r--r--cpack/uninstall.svg164
-rw-r--r--cpack/welcome.txt3
-rw-r--r--libpsn00b/cmake/internal_setup.cmake158
-rw-r--r--libpsn00b/cmake/sdk.cmake78
-rw-r--r--libpsn00b/cmake/virtual_targets.cmake109
16 files changed, 1185 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..4cca098
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,177 @@
+# PSn00bSDK main build script
+# (C) 2021 spicyjpeg - MPL licensed
+
+# NOTE: CMake doesn't support using multiple toolchains in a single project,
+# so we can't use add_subdirectory() to build both the libraries and tools. A
+# workaround is to use ExternalProject_Add() to launch multiple independent
+# CMake instances, creating what's known as a "superbuild".
+
+cmake_minimum_required(VERSION 3.21)
+include(ExternalProject)
+
+project(
+ PSn00bSDK
+ LANGUAGES NONE
+ # IMPORTANT TODO: set a version number
+ VERSION 0.1.0
+ DESCRIPTION "Open source PlayStation 1 SDK"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+# Including this without initializing at least one language throws a warning and
+# there's no way to mute it.
+include(GNUInstallDirs)
+
+# These are passed through to libpsn00b and the examples (they are defined in
+# the toolchain file).
+set(
+ PSN00BSDK_TC $ENV{PSN00BSDK_TC}
+ CACHE PATH "Path to the GCC toolchain's installation directory"
+)
+set(
+ PSN00BSDK_TARGET mipsel-unknown-elf
+ CACHE STRING "GCC toolchain target triplet"
+)
+
+set(
+ SKIP_DOWNLOAD OFF
+ CACHE BOOL "Skip downloading and building tinyxml2 and mkpsxiso"
+)
+set(
+ SKIP_EXAMPLES OFF
+ CACHE BOOL "Skip building SDK examples (which are never installed)"
+)
+
+# Forward some important variables to mkpsxiso and to the subprojects (they are
+# not inherited automatically as they are not environment variables). This also
+# sets all subprojects to "install" everything to a temporary directory in the
+# build tree, so they don't actually get installed until "cmake --install" is
+# invoked (ExternalProject_Add() runs the subprojects' install step at build
+# time).
+set(
+ SUBPROJECT_ARGS
+ -DPSN00BSDK_TC:PATH=${PSN00BSDK_TC}
+ -DPSN00BSDK_TARGET:STRING=${PSN00BSDK_TARGET}
+ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
+ -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/install_tree
+)
+set(
+ EXAMPLES_ARGS
+ -DPSN00BSDK_TC:PATH=${PSN00BSDK_TC}
+ -DPSN00BSDK_TARGET:STRING=${PSN00BSDK_TARGET}
+ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${PROJECT_BINARY_DIR}/install_tree/${CMAKE_INSTALL_LIBDIR}/libpsn00b/cmake/sdk.cmake
+ -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/examples
+)
+
+## External dependencies
+
+if(NOT SKIP_DOWNLOAD)
+ list(APPEND SUBPROJECT_ARGS -Dtinyxml2_ROOT:PATH=${PROJECT_BINARY_DIR}/install_temp)
+
+ ExternalProject_Add(
+ tinyxml2
+ GIT_REPOSITORY "https://github.com/leethomason/tinyxml2"
+ CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/install_temp
+ INSTALL_DIR install_temp
+ )
+ ExternalProject_Add(
+ mkpsxiso
+ # IMPORTANT TODO: migrate to Lameguy64/mkpsxiso once PR #18 is merged
+ GIT_REPOSITORY "https://github.com/spicyjpeg/mkpsxiso"
+ GIT_TAG cmake
+ #GIT_REPOSITORY "https://github.com/Lameguy64/mkpsxiso"
+ CMAKE_CACHE_ARGS ${SUBPROJECT_ARGS}
+ INSTALL_DIR install_tree
+ DEPENDS tinyxml2
+ )
+else()
+ list(APPEND SUBPROJECT_ARGS -Dtinyxml2_ROOT:PATH=${tinyxml2_ROOT})
+
+ # Create dummy targets so CMake doesn't throw missing dependency errors.
+ add_library(tinyxml2 INTERFACE)
+ add_library(mkpsxiso INTERFACE)
+endif()
+
+## Subprojects
+
+ExternalProject_Add(
+ libpsn00b
+ SOURCE_DIR ${PROJECT_SOURCE_DIR}/libpsn00b
+ CMAKE_CACHE_ARGS ${SUBPROJECT_ARGS}
+ INSTALL_DIR install_tree
+)
+ExternalProject_Add(
+ tools
+ SOURCE_DIR ${PROJECT_SOURCE_DIR}/tools
+ CMAKE_CACHE_ARGS ${SUBPROJECT_ARGS}
+ INSTALL_DIR install_tree
+ DEPENDS tinyxml2
+)
+ExternalProject_Add(
+ examples
+ SOURCE_DIR ${PROJECT_SOURCE_DIR}/examples
+ CMAKE_CACHE_ARGS ${EXAMPLES_ARGS}
+ INSTALL_DIR install_tree
+ DEPENDS libpsn00b tools mkpsxiso
+ EXCLUDE_FROM_ALL ${SKIP_EXAMPLES}
+)
+
+# Install all files in the temporary installation tree, as well as static files
+# from the source tree, when "cmake --install" is invoked.
+install(
+ DIRECTORY ${PROJECT_BINARY_DIR}/install_tree/ # THE TRAILING SLASH IS IMPORTANT
+ DESTINATION .
+ USE_SOURCE_PERMISSIONS
+)
+install(
+ DIRECTORY doc template
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/psn00bsdk
+)
+
+## CPack configuration
+
+# TODO: add a macOS installer and related options
+if(WIN32)
+ set(CPACK_GENERATOR ZIP NSIS)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(CPACK_GENERATOR ZIP DEB RPM)
+else()
+ set(CPACK_GENERATOR ZIP)
+endif()
+
+set(CPACK_PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/cpack)
+set(CPACK_PACKAGE_NAME PSn00bSDK)
+set(CPACK_PACKAGE_VENDOR Lameguy64)
+set(CPACK_PACKAGE_CONTACT Lameguy64)
+set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/cpack/icon.ico)
+set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/cpack/description.txt)
+set(CPACK_RESOURCE_FILE_WELCOME ${PROJECT_SOURCE_DIR}/cpack/welcome.txt)
+set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
+set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.md)
+set(CPACK_PRE_BUILD_SCRIPTS ${PROJECT_SOURCE_DIR}/cpack/fakeroot_fix.cmake)
+
+
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28), cmake (>= 3.21), gcc-mipsel-unknown-elf")
+set(CPACK_DEBIAN_PACKAGE_SUGGESTS "git")
+set(CPACK_DEBIAN_PACKAGE_SECTION devel)
+set(CPACK_RPM_PACKAGE_REQUIRES "cmake >= 3.21, gcc-mipsel-unknown-elf")
+set(CPACK_RPM_PACKAGE_SUGGESTS "git")
+#set(CPACK_RPM_PACKAGE_RELOCATABLE ON)
+
+set(CPACK_NSIS_MUI_ICON ${PROJECT_SOURCE_DIR}/cpack/icon.ico)
+set(CPACK_NSIS_MUI_UNIICON ${PROJECT_SOURCE_DIR}/cpack/uninstall.ico)
+set(CPACK_NSIS_MUI_HEADERIMAGE ${PROJECT_SOURCE_DIR}/cpack/nsis_header.bmp)
+set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP ${PROJECT_SOURCE_DIR}/cpack/nsis_banner.bmp)
+set(CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP ${PROJECT_SOURCE_DIR}/cpack/nsis_banner.bmp)
+set(CPACK_NSIS_BRANDING_TEXT "PSn00bSDK - Meido-Tek Productions")
+set(CPACK_NSIS_URL_INFO_ABOUT "${PROJECT_HOMEPAGE_URL}")
+set(CPACK_NSIS_MODIFY_PATH ON)
+set(
+ CPACK_NSIS_MENU_LINKS
+ "${PROJECT_HOMEPAGE_URL}" "About PSn00bSDK"
+ "https://github.com/Lameguy64/PSn00bSDK" "GitHub repo"
+)
+
+# This will generate a CPack configuration file and add a "package" target to
+# launch CPack.
+include(CPack)
diff --git a/cpack/convert_images.sh b/cpack/convert_images.sh
new file mode 100644
index 0000000..3816dec
--- /dev/null
+++ b/cpack/convert_images.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# This script generates Windows bitmaps from the SVGs in this directory. The
+# bitmaps are displayed by the NSIS installers generated using CPack. Inkscape
+# and ImageMagick must be installed for this script to work.
+
+INDEXED_SIZES=(16 24 32 48)
+RGB_ONLY_SIZES=(64 96 128 256)
+DITHER_OPTIONS="-dither riemersma"
+OUTPUT_OPTIONS="+compress -strip"
+
+svg_to_bitmap() {
+ inkscape -z -e rgb.png $1
+
+ # There seems to be no way to tell ImageMagick to generate an 8-bit indexed
+ # BMP directly, so the image has to be converted to indexed PNG first. NSIS
+ # seems to reject all BMP versions other than "bmp3".
+ convert $DITHER_OPTIONS -colors 256 +remap rgb.png png8:i8.png
+ convert i8.png $OUTPUT_OPTIONS bmp3:$2
+ rm -f rgb.png i8.png
+}
+
+# https://stackoverflow.com/a/52636645
+svg_to_icon() {
+ for size in ${INDEXED_SIZES[@]} ${RGB_ONLY_SIZES[@]}; do
+ inkscape -z -e $size.png -w $size -h $size $1
+ done
+
+ # Windows expects some of the smaller sizes to be available in 4- and 8-bit
+ # indexed color formats, as well as RGB.
+ for size in ${INDEXED_SIZES[@]}; do
+ convert $DITHER_OPTIONS -colors 256 +remap $size.png png8:$size-i8.png
+ convert $DITHER_OPTIONS -colors 16 +remap $size.png png8:$size-i4.png
+ done
+
+ icons="${INDEXED_SIZES[@]/%/.png} ${INDEXED_SIZES[@]/%/-i8.png} ${INDEXED_SIZES[@]/%/-i4.png} ${RGB_ONLY_SIZES[@]/%/.png}"
+ convert $icons $OUTPUT_OPTIONS $2
+ rm -f $icons
+}
+
+rm -f *.ico *.bmp
+
+svg_to_icon icon.svg icon.ico
+svg_to_icon uninstall.svg uninstall.ico
+svg_to_bitmap nsis_banner.svg nsis_banner.bmp
+svg_to_bitmap nsis_header.svg nsis_header.bmp
diff --git a/cpack/description.txt b/cpack/description.txt
new file mode 100644
index 0000000..240b7d1
--- /dev/null
+++ b/cpack/description.txt
@@ -0,0 +1,27 @@
+PSn00bSDK is a 100% free and open source SDK project for the original Sony
+PlayStation for developing homebrew applications and games for the console
+100% freely. This SDK can be used for freeware, commercial, and open source
+homebrew projects.
+
+The SDK is composed mainly of libraries (libpsn00b) and some utilities that
+provide a basic framework for developing software for the PlayStation
+hardware, the compiler is separate (GCC) and should be acquired from GNU.
+The library API is intentionally written to resemble the library API of the
+official libraries as closely as possible. This design decision is not only
+for familiarity reasons to experienced programmers, but also so that existing
+sample code and tutorials would still apply to this SDK, as well as making
+the process of porting over existing homebrew originally made with official
+SDKs easier with minimal modification, provided it doesn't use libgs.
+
+PSn00bSDK is currently a work in progress and cannot really be considered
+production ready, but what is currently implemented should be enough to
+produce some interesting homebrew with the SDK, especially with its extensive
+support for the GPU and GTE hardware. There's no reason not to fully support
+hardware features of a target platform when said hardware features have been
+fully documented for years (nocash's PSX specs document in this case).
+
+Most of libpsn00b is written mostly in MIPS assembly, moreso functions that
+interface with the hardware. Many of the standard C functions are implemented
+in custom MIPS assembly instead of equivalents found in the BIOS ROM, for both
+stability (the BIOS libc implementation of the PlayStation is actually buggy)
+and performance reasons.
diff --git a/cpack/fakeroot_fix.cmake b/cpack/fakeroot_fix.cmake
new file mode 100644
index 0000000..e34baa0
--- /dev/null
+++ b/cpack/fakeroot_fix.cmake
@@ -0,0 +1,32 @@
+# This script works around a bug in CPack's DEB/RPM generator, which causes
+# files installed by subprojects (not by the main CMake script) to end up in
+# packages alongside the "real" installation directory. It probably happens due
+# to CMake running under fakeroot (when invoked by CPack to prepare the files
+# to be packaged) and referencing absolute paths, which would explain why the
+# entire build directory tree is replicated inside the packages. What this
+# script does is simply finding and deleting all directories that do not match
+# the installation prefix before CPack generates the package.
+
+cmake_minimum_required(VERSION 3.21)
+
+set(_prefix ${CPACK_TEMPORARY_INSTALL_DIRECTORY}${CPACK_PACKAGING_INSTALL_PREFIX})
+
+file(
+ GLOB_RECURSE _entries
+ LIST_DIRECTORIES ON
+ ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/*
+)
+
+foreach(_entry IN LISTS _entries)
+ # Skip the entry if it (or its parent directory) has already been deleted.
+ if(NOT EXISTS ${_entry})
+ continue()
+ endif()
+
+ # Delete anything whose path doesn't start with the expected prefix.
+ string(FIND ${_entry} ${_prefix} _index)
+ if(NOT _index EQUAL 0)
+ message(NOTICE "Deleting unneeded entry from package: ${_entry}")
+ file(REMOVE_RECURSE ${_entry})
+ endif()
+endforeach()
diff --git a/cpack/icon.ico b/cpack/icon.ico
new file mode 100644
index 0000000..6759d23
--- /dev/null
+++ b/cpack/icon.ico
Binary files differ
diff --git a/cpack/icon.svg b/cpack/icon.svg
new file mode 100644
index 0000000..70d400d
--- /dev/null
+++ b/cpack/icon.svg
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ id="svg8"
+ version="1.1"
+ viewBox="0 0 512 512"
+ height="512"
+ width="512">
+ <title
+ id="title884">PSn00bSDK icon</title>
+ <defs
+ id="defs2">
+ <linearGradient
+ id="linearGradient880">
+ <stop
+ id="stop876"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1" />
+ <stop
+ style="stop-color:#100f0e;stop-opacity:1"
+ offset="0.34999999"
+ id="stop898" />
+ <stop
+ style="stop-color:#20181a;stop-opacity:1"
+ offset="0.58333331"
+ id="stop890" />
+ <stop
+ id="stop892"
+ offset="0.75"
+ style="stop-color:#301e25;stop-opacity:1" />
+ <stop
+ style="stop-color:#412030;stop-opacity:1"
+ offset="0.86666667"
+ id="stop886" />
+ <stop
+ id="stop894"
+ offset="0.91666669"
+ style="stop-color:#511e3d;stop-opacity:1" />
+ <stop
+ id="stop888"
+ offset="0.94999999"
+ style="stop-color:#60184e;stop-opacity:1" />
+ <stop
+ style="stop-color:#720d66;stop-opacity:1"
+ offset="0.98333335"
+ id="stop896" />
+ <stop
+ id="stop878"
+ offset="1"
+ style="stop-color:#800080;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="16"
+ x2="496"
+ y1="496"
+ x1="16"
+ id="linearGradient882"
+ xlink:href="#linearGradient880" />
+ <filter
+ id="filter1534"
+ style="color-interpolation-filters:sRGB;">
+ <feFlood
+ id="feFlood1524"
+ result="flood"
+ flood-color="rgb(0,0,0)"
+ flood-opacity="0.701961" />
+ <feComposite
+ id="feComposite1526"
+ result="composite1"
+ operator="in"
+ in2="SourceGraphic"
+ in="flood" />
+ <feGaussianBlur
+ id="feGaussianBlur1528"
+ result="blur"
+ stdDeviation="0.5"
+ in="composite1" />
+ <feOffset
+ id="feOffset1530"
+ result="offset"
+ dy="3.5"
+ dx="4" />
+ <feComposite
+ id="feComposite1532"
+ result="composite2"
+ operator="over"
+ in2="offset"
+ in="SourceGraphic" />
+ </filter>
+ </defs>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>PSn00bSDK icon</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1">
+ <rect
+ ry="64"
+ rx="64"
+ y="0"
+ x="0"
+ height="512"
+ width="512"
+ id="rect860"
+ style="opacity:0.998;fill:url(#linearGradient882);fill-opacity:1;stroke-width:2" />
+ <g
+ style="fill:#ffffff;fill-opacity:1;filter:url(#filter1534)"
+ id="layer1-5"
+ transform="matrix(3.779521,0,0,3.779521,16.000484,-786.51733)">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 57.179711,259.17821 v 17.18692 h 5.773631 c -0.396902,-2.52219 -1.516281,-11.47627 2.677532,-11.43765 4.154274,0.0381 2.825972,8.818 2.338686,11.43765 h 5.726019 c 0,-2.5475 0.612565,-10.89684 -1.883577,-14.15061 -2.122953,-2.76729 -7.048341,-2.41673 -9.502018,-1.00656 v -2.02975 z"
+ id="path5596" />
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 82.828855,255.71895 c -10.353164,0.25013 -10.721078,21.06797 0.714234,20.66283 10.000569,-0.35432 8.896917,-20.89502 -0.714234,-20.66283 z m -1.383056,5.71268 c -1.165387,3.71776 1.988956,7.56732 5.10259,5.73157 0,0 -0.09008,3.35969 -2.71075,4.0174 -5.560412,1.39549 -6.092866,-7.18149 -2.39184,-9.74897 z"
+ id="path5600" />
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 114.82523,255.43876 -6.43139,1.1339 0.7563,19.49459 4.79365,0.0898 0.0665,-1.56688 c 0,0 0.84813,1.16403 3.59108,1.45064 9.30033,0.97173 8.87091,-14.3259 1.34541,-14.73418 -2.83582,-0.15386 -4.43043,1.4041 -4.43043,1.4041 z m 2.46382,10.23949 c 3.64531,-0.38951 4.6306,5.87108 0.65,6.49892 -3.75349,0.59205 -4.99839,-6.03428 -0.65,-6.49892 z"
+ id="path5612" />
+ <g
+ aria-label="SDK"
+ transform="matrix(0.56695433,0,0,0.56695433,-141.8248,-64.336976)"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.6667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none"
+ id="flowRoot5618">
+ <path
+ d="m 351.00651,635.98438 v -8.70834 h 20.60417 v -3.45833 h -11 q -5.72917,0 -7.5625,-1.27083 -1.83334,-1.27084 -1.83334,-4.52084 v -7.64583 q 0,-3.33333 2.16667,-4.79167 2.1875,-1.47916 7.22917,-1.47916 h 18.72916 v 8.625 h -18.39583 v 3.54166 h 13.22917 q 3.66666,0 5.39583,1.5 1.72917,1.5 1.72917,4.6875 v 7.8125 q 0,2.66667 -1.85417,4.1875 -1.85417,1.52084 -5.14583,1.52084 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ id="path24" />
+ <path
+ d="m 394.81901,627.27604 h 11.35417 v -14.54166 h -11.35417 z m -9.9375,8.70834 v -31.875 h 23.6875 q 3.6875,0 5.77083,2.27083 2.08334,2.25 2.08334,6.3125 v 14.5 q 0,4.33333 -2.04167,6.5625 -2.04167,2.22917 -6.02083,2.22917 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ id="path26" />
+ <path
+ d="m 420.13152,635.98438 v -31.875 h 9.77083 v 12.20833 h 2.3125 l 9,-12.20833 h 11.72917 l -12.10417,15.66666 12.79167,16.20834 h -12.375 l -9.04167,-12.16667 h -2.3125 v 12.16667 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ id="path28" />
+ </g>
+ <path
+ id="path908"
+ d="m 99.804384,255.71668 c -10.133001,-0.0773 -10.593527,20.63351 0.262436,20.66506 10.26945,0.0298 9.09211,-20.59369 -0.262436,-20.66506 z m 0.556956,15.46392 c -0.008,9.6e-4 -0.0138,0.002 -0.021,0.004 2.35422,-2.63067 -1.289504,-8.16996 -4.519013,-6.33394 0,0 1.131029,-4.35205 4.012975,-4.09159 4.446218,0.40182 4.327948,9.1393 0.527048,10.42125 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path914"
+ d="m 26.876314,267.84943 c -0.07198,3.84917 -0.663735,8.22997 -3.673281,10.94853 -2.089478,1.66049 -4.851082,0.94991 -7.306542,1.10553 H 11.04198 v -3.42363 c 2.156559,-0.0653 4.33832,0.13885 6.477279,-0.11786 2.536377,-0.98515 3.091955,-4.09776 3.4593,-6.48869 0.300636,-3.36989 0.07856,-7.12599 -2.014955,-9.92767 -1.357242,-1.62658 -3.597582,-0.93352 -5.431053,-1.08326 H 8.6169014 v 37.37473 H 2.4115531 v -40.79837 c 5.9979405,0.0129 11.9968419,-0.0238 17.9941699,0.0171 3.625596,0.34104 5.274335,4.24515 5.941221,7.34963 0.369793,1.65348 0.52937,3.01218 0.52937,5.04391 z m 26.781736,16.11965 c -0.08017,3.9379 -0.873268,8.36119 -3.922921,11.12682 -2.089008,1.69992 -4.872113,0.98781 -7.342206,1.14121 H 31.547042 v -3.42363 c 4.070829,-0.0292 8.14743,0.0592 12.21455,-0.0456 2.781143,-0.57546 3.669767,-3.80823 4.021548,-6.25301 0.166648,-2.54728 0.292442,-5.57249 -1.565266,-7.57307 -2.159164,-1.74308 -5.042366,-1.02412 -7.593577,-1.17799 -2.19456,0.14293 -4.637761,-0.23372 -5.967246,-2.20664 -3.132732,-4.47482 -3.210319,-10.62153 -1.220061,-15.57718 0.94516,-2.55433 3.288885,-4.87136 6.197494,-4.54117 h 12.956554 v 3.42364 c -3.583967,0.0246 -7.172385,-0.0503 -10.753483,0.039 -2.74647,0.48591 -3.651617,3.67317 -3.835713,6.07941 -0.145669,2.69978 0.298311,6.06194 2.828236,7.58171 1.744887,0.64676 3.664647,0.23375 5.491578,0.35107 3.519412,0 4.7894,-0.0107 6.359655,1.56024 2.176061,2.17605 2.976739,6.12884 2.976739,9.49523 z"
+ style="font-style:normal;font-weight:normal;font-size:33.286px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.742977" />
+ </g>
+ </g>
+</svg>
diff --git a/cpack/nsis_banner.bmp b/cpack/nsis_banner.bmp
new file mode 100644
index 0000000..831c8f9
--- /dev/null
+++ b/cpack/nsis_banner.bmp
Binary files differ
diff --git a/cpack/nsis_banner.svg b/cpack/nsis_banner.svg
new file mode 100644
index 0000000..499bb94
--- /dev/null
+++ b/cpack/nsis_banner.svg
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="164"
+ height="314"
+ viewBox="0 0 164 314"
+ version="1.1"
+ id="svg8">
+ <title
+ id="title884">PSn00bSDK installer banner</title>
+ <defs
+ id="defs2">
+ <linearGradient
+ id="linearGradient880">
+ <stop
+ style="stop-color:#000000;stop-opacity:1"
+ offset="0"
+ id="stop876" />
+ <stop
+ id="stop898"
+ offset="0.34999999"
+ style="stop-color:#100f0e;stop-opacity:1" />
+ <stop
+ id="stop890"
+ offset="0.58333331"
+ style="stop-color:#20181a;stop-opacity:1" />
+ <stop
+ style="stop-color:#301e25;stop-opacity:1"
+ offset="0.75"
+ id="stop892" />
+ <stop
+ id="stop886"
+ offset="0.86666667"
+ style="stop-color:#412030;stop-opacity:1" />
+ <stop
+ style="stop-color:#511e3d;stop-opacity:1"
+ offset="0.91666669"
+ id="stop894" />
+ <stop
+ style="stop-color:#60184e;stop-opacity:1"
+ offset="0.94999999"
+ id="stop888" />
+ <stop
+ id="stop896"
+ offset="0.98333335"
+ style="stop-color:#720d66;stop-opacity:1" />
+ <stop
+ style="stop-color:#800080;stop-opacity:1"
+ offset="1"
+ id="stop878" />
+ </linearGradient>
+ <linearGradient
+ xlink:href="#linearGradient880"
+ id="linearGradient882"
+ x1="0"
+ y1="314"
+ x2="164"
+ y2="0"
+ gradientUnits="userSpaceOnUse" />
+ <filter
+ style="color-interpolation-filters:sRGB"
+ id="filter1534">
+ <feFlood
+ flood-opacity="0.701961"
+ flood-color="rgb(0,0,0)"
+ result="flood"
+ id="feFlood1524" />
+ <feComposite
+ in="flood"
+ in2="SourceGraphic"
+ operator="in"
+ result="composite1"
+ id="feComposite1526" />
+ <feGaussianBlur
+ in="composite1"
+ stdDeviation="0.5"
+ result="blur"
+ id="feGaussianBlur1528" />
+ <feOffset
+ dx="4"
+ dy="3.5"
+ result="offset"
+ id="feOffset1530" />
+ <feComposite
+ in="SourceGraphic"
+ in2="offset"
+ operator="over"
+ result="composite2"
+ id="feComposite1532" />
+ </filter>
+ </defs>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>PSn00bSDK installer banner</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1">
+ <rect
+ style="opacity:0.998;fill:url(#linearGradient882);fill-opacity:1;stroke-width:2"
+ id="rect860"
+ width="164"
+ height="314"
+ x="0"
+ y="0" />
+ <g
+ transform="matrix(0,-1.9077179,1.9077179,0,-416.37176,307.29252)"
+ id="layer1-5"
+ style="fill:#ffffff;fill-opacity:1;filter:url(#filter1534)">
+ <path
+ id="path5596"
+ d="m 57.179711,259.17821 v 17.18692 h 5.773631 c -0.396902,-2.52219 -1.516281,-11.47627 2.677532,-11.43765 4.154274,0.0381 2.825972,8.818 2.338686,11.43765 h 5.726019 c 0,-2.5475 0.612565,-10.89684 -1.883577,-14.15061 -2.122953,-2.76729 -7.048341,-2.41673 -9.502018,-1.00656 v -2.02975 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path5600"
+ d="m 82.828855,255.71895 c -10.353164,0.25013 -10.721078,21.06797 0.714234,20.66283 10.000569,-0.35432 8.896917,-20.89502 -0.714234,-20.66283 z m -1.383056,5.71268 c -1.165387,3.71776 1.988956,7.56732 5.10259,5.73157 0,0 -0.09008,3.35969 -2.71075,4.0174 -5.560412,1.39549 -6.092866,-7.18149 -2.39184,-9.74897 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path5612"
+ d="m 114.82523,255.43876 -6.43139,1.1339 0.7563,19.49459 4.79365,0.0898 0.0665,-1.56688 c 0,0 0.84813,1.16403 3.59108,1.45064 9.30033,0.97173 8.87091,-14.3259 1.34541,-14.73418 -2.83582,-0.15386 -4.43043,1.4041 -4.43043,1.4041 z m 2.46382,10.23949 c 3.64531,-0.38951 4.6306,5.87108 0.65,6.49892 -3.75349,0.59205 -4.99839,-6.03428 -0.65,-6.49892 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <g
+ id="flowRoot5618"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.6667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none"
+ transform="matrix(0.56695433,0,0,0.56695433,-141.8248,-64.336976)"
+ aria-label="SDK">
+ <path
+ id="path24"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ d="m 351.00651,635.98438 v -8.70834 h 20.60417 v -3.45833 h -11 q -5.72917,0 -7.5625,-1.27083 -1.83334,-1.27084 -1.83334,-4.52084 v -7.64583 q 0,-3.33333 2.16667,-4.79167 2.1875,-1.47916 7.22917,-1.47916 h 18.72916 v 8.625 h -18.39583 v 3.54166 h 13.22917 q 3.66666,0 5.39583,1.5 1.72917,1.5 1.72917,4.6875 v 7.8125 q 0,2.66667 -1.85417,4.1875 -1.85417,1.52084 -5.14583,1.52084 z" />
+ <path
+ id="path26"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ d="m 394.81901,627.27604 h 11.35417 v -14.54166 h -11.35417 z m -9.9375,8.70834 v -31.875 h 23.6875 q 3.6875,0 5.77083,2.27083 2.08334,2.25 2.08334,6.3125 v 14.5 q 0,4.33333 -2.04167,6.5625 -2.04167,2.22917 -6.02083,2.22917 z" />
+ <path
+ id="path28"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ d="m 420.13152,635.98438 v -31.875 h 9.77083 v 12.20833 h 2.3125 l 9,-12.20833 h 11.72917 l -12.10417,15.66666 12.79167,16.20834 h -12.375 l -9.04167,-12.16667 h -2.3125 v 12.16667 z" />
+ </g>
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 99.804384,255.71668 c -10.133001,-0.0773 -10.593527,20.63351 0.262436,20.66506 10.26945,0.0298 9.09211,-20.59369 -0.262436,-20.66506 z m 0.556956,15.46392 c -0.008,9.6e-4 -0.0138,0.002 -0.021,0.004 2.35422,-2.63067 -1.289504,-8.16996 -4.519013,-6.33394 0,0 1.131029,-4.35205 4.012975,-4.09159 4.446218,0.40182 4.327948,9.1393 0.527048,10.42125 z"
+ id="path908" />
+ <path
+ style="font-style:normal;font-weight:normal;font-size:33.286px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.742977"
+ d="m 26.876314,267.84943 c -0.07198,3.84917 -0.663735,8.22997 -3.673281,10.94853 -2.089478,1.66049 -4.851082,0.94991 -7.306542,1.10553 H 11.04198 v -3.42363 c 2.156559,-0.0653 4.33832,0.13885 6.477279,-0.11786 2.536377,-0.98515 3.091955,-4.09776 3.4593,-6.48869 0.300636,-3.36989 0.07856,-7.12599 -2.014955,-9.92767 -1.357242,-1.62658 -3.597582,-0.93352 -5.431053,-1.08326 H 8.6169014 v 37.37473 H 2.4115531 v -40.79837 c 5.9979405,0.0129 11.9968419,-0.0238 17.9941699,0.0171 3.625596,0.34104 5.274335,4.24515 5.941221,7.34963 0.369793,1.65348 0.52937,3.01218 0.52937,5.04391 z m 26.781736,16.11965 c -0.08017,3.9379 -0.873268,8.36119 -3.922921,11.12682 -2.089008,1.69992 -4.872113,0.98781 -7.342206,1.14121 H 31.547042 v -3.42363 c 4.070829,-0.0292 8.14743,0.0592 12.21455,-0.0456 2.781143,-0.57546 3.669767,-3.80823 4.021548,-6.25301 0.166648,-2.54728 0.292442,-5.57249 -1.565266,-7.57307 -2.159164,-1.74308 -5.042366,-1.02412 -7.593577,-1.17799 -2.19456,0.14293 -4.637761,-0.23372 -5.967246,-2.20664 -3.132732,-4.47482 -3.210319,-10.62153 -1.220061,-15.57718 0.94516,-2.55433 3.288885,-4.87136 6.197494,-4.54117 h 12.956554 v 3.42364 c -3.583967,0.0246 -7.172385,-0.0503 -10.753483,0.039 -2.74647,0.48591 -3.651617,3.67317 -3.835713,6.07941 -0.145669,2.69978 0.298311,6.06194 2.828236,7.58171 1.744887,0.64676 3.664647,0.23375 5.491578,0.35107 3.519412,0 4.7894,-0.0107 6.359655,1.56024 2.176061,2.17605 2.976739,6.12884 2.976739,9.49523 z"
+ id="path914" />
+ </g>
+ </g>
+</svg>
diff --git a/cpack/nsis_header.bmp b/cpack/nsis_header.bmp
new file mode 100644
index 0000000..d677e8c
--- /dev/null
+++ b/cpack/nsis_header.bmp
Binary files differ
diff --git a/cpack/nsis_header.svg b/cpack/nsis_header.svg
new file mode 100644
index 0000000..19ae01a
--- /dev/null
+++ b/cpack/nsis_header.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ id="svg4999"
+ version="1.1"
+ viewBox="0 0 150 57"
+ height="57"
+ width="150">
+ <title
+ id="title4511">PSn00bSDK installer header</title>
+ <defs
+ id="defs4993" />
+ <rect
+ y="0"
+ x="0"
+ height="57"
+ width="150"
+ id="rect844"
+ style="opacity:0.998;fill:#ffffff;stroke-width:2;fill-opacity:1" />
+ <g
+ transform="translate(0,-254.66652)"
+ id="layer1">
+ <path
+ id="path5596"
+ d="m 68.679157,266.51141 v 17.18692 h 5.773631 c -0.396902,-2.52219 -1.516281,-11.47627 2.677532,-11.43765 4.154274,0.0381 2.825972,8.818 2.338686,11.43765 h 5.726019 c 0,-2.5475 0.612565,-10.89684 -1.883577,-14.15061 -2.122953,-2.76729 -7.048341,-2.41673 -9.502018,-1.00656 v -2.02975 z"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path5600"
+ d="m 94.328301,263.05215 c -10.353164,0.25013 -10.721078,21.06797 0.714234,20.66283 10.000575,-0.35432 8.896925,-20.89502 -0.714234,-20.66283 z m -1.383056,5.71268 c -1.165387,3.71776 1.988956,7.56732 5.10259,5.73157 0,0 -0.09008,3.35969 -2.71075,4.0174 -5.560412,1.39549 -6.092866,-7.18149 -2.39184,-9.74897 z"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path5612"
+ d="m 126.32468,262.77196 -6.43139,1.1339 0.7563,19.49459 4.79365,0.0898 0.0665,-1.56688 c 0,0 0.84813,1.16403 3.59108,1.45064 9.30033,0.97173 8.87091,-14.3259 1.34541,-14.73418 -2.83582,-0.15386 -4.43043,1.4041 -4.43043,1.4041 z m 2.46382,10.23949 c 3.64531,-0.38951 4.6306,5.87108 0.65,6.49892 -3.75349,0.59205 -4.99839,-6.03428 -0.65,-6.49892 z"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <g
+ id="flowRoot5618"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.6667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
+ transform="matrix(0.56695433,0,0,0.56695433,-130.32535,-57.003778)"
+ aria-label="SDK">
+ <path
+ id="path24"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold'"
+ d="m 351.00651,635.98438 v -8.70834 h 20.60417 v -3.45833 h -11 q -5.72917,0 -7.5625,-1.27083 -1.83334,-1.27084 -1.83334,-4.52084 v -7.64583 q 0,-3.33333 2.16667,-4.79167 2.1875,-1.47916 7.22917,-1.47916 h 18.72916 v 8.625 h -18.39583 v 3.54166 h 13.22917 q 3.66666,0 5.39583,1.5 1.72917,1.5 1.72917,4.6875 v 7.8125 q 0,2.66667 -1.85417,4.1875 -1.85417,1.52084 -5.14583,1.52084 z" />
+ <path
+ id="path26"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold'"
+ d="m 394.81901,627.27604 h 11.35417 v -14.54166 h -11.35417 z m -9.9375,8.70834 v -31.875 h 23.6875 q 3.6875,0 5.77083,2.27083 2.08334,2.25 2.08334,6.3125 v 14.5 q 0,4.33333 -2.04167,6.5625 -2.04167,2.22917 -6.02083,2.22917 z" />
+ <path
+ id="path28"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold'"
+ d="m 420.13152,635.98438 v -31.875 h 9.77083 v 12.20833 h 2.3125 l 9,-12.20833 h 11.72917 l -12.10417,15.66666 12.79167,16.20834 h -12.375 l -9.04167,-12.16667 h -2.3125 v 12.16667 z" />
+ </g>
+ <path
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 111.30383,263.04988 c -10.133,-0.0773 -10.59352,20.63351 0.26244,20.66506 10.26945,0.0298 9.09211,-20.59369 -0.26244,-20.66506 z m 0.55696,15.46392 c -0.008,9.6e-4 -0.0138,0.002 -0.021,0.004 2.35422,-2.63067 -1.2895,-8.16996 -4.51901,-6.33394 0,0 1.13103,-4.35205 4.01297,-4.09159 4.44622,0.40182 4.32795,9.1393 0.52705,10.42125 z"
+ id="path908" />
+ <path
+ style="font-style:normal;font-weight:normal;font-size:33.286px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.742977"
+ d="m 38.37576,275.18263 c -0.07198,3.84917 -0.663735,8.22997 -3.673281,10.94853 -2.089478,1.66049 -4.851082,0.94991 -7.306542,1.10553 h -4.854511 v -3.42363 c 2.156559,-0.0653 4.33832,0.13885 6.477279,-0.11786 2.536377,-0.98515 3.091955,-4.09776 3.4593,-6.48869 0.300636,-3.36989 0.07856,-7.12599 -2.014955,-9.92767 -1.357242,-1.62658 -3.597582,-0.93352 -5.431053,-1.08326 h -4.915649 v 37.37473 H 13.911 v -40.79837 c 5.99794,0.0129 11.996841,-0.0238 17.994169,0.0171 3.625596,0.34104 5.274335,4.24515 5.941221,7.34963 0.369793,1.65348 0.52937,3.01218 0.52937,5.04391 z m 26.781736,16.11965 c -0.08017,3.9379 -0.873268,8.36119 -3.922921,11.12682 -2.089008,1.69992 -4.872113,0.98781 -7.342206,1.14121 H 43.046488 v -3.42363 c 4.070829,-0.0292 8.14743,0.0592 12.21455,-0.0456 2.781143,-0.57546 3.669767,-3.80823 4.021548,-6.25301 0.166648,-2.54728 0.292442,-5.57249 -1.565266,-7.57307 -2.159164,-1.74308 -5.042366,-1.02412 -7.593577,-1.17799 -2.19456,0.14293 -4.637761,-0.23372 -5.967246,-2.20664 -3.132732,-4.47482 -3.210319,-10.62153 -1.220061,-15.57718 0.94516,-2.55433 3.288885,-4.87136 6.197494,-4.54117 h 12.956554 v 3.42364 c -3.583967,0.0246 -7.172385,-0.0503 -10.753483,0.039 -2.74647,0.48591 -3.651617,3.67317 -3.835713,6.07941 -0.145669,2.69978 0.298311,6.06194 2.828236,7.58171 1.744887,0.64676 3.664647,0.23375 5.491578,0.35107 3.519412,0 4.7894,-0.0107 6.359655,1.56024 2.176061,2.17605 2.976739,6.12884 2.976739,9.49523 z"
+ id="path914" />
+ </g>
+</svg>
diff --git a/cpack/uninstall.ico b/cpack/uninstall.ico
new file mode 100644
index 0000000..6759d23
--- /dev/null
+++ b/cpack/uninstall.ico
Binary files differ
diff --git a/cpack/uninstall.svg b/cpack/uninstall.svg
new file mode 100644
index 0000000..70d400d
--- /dev/null
+++ b/cpack/uninstall.svg
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ id="svg8"
+ version="1.1"
+ viewBox="0 0 512 512"
+ height="512"
+ width="512">
+ <title
+ id="title884">PSn00bSDK icon</title>
+ <defs
+ id="defs2">
+ <linearGradient
+ id="linearGradient880">
+ <stop
+ id="stop876"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1" />
+ <stop
+ style="stop-color:#100f0e;stop-opacity:1"
+ offset="0.34999999"
+ id="stop898" />
+ <stop
+ style="stop-color:#20181a;stop-opacity:1"
+ offset="0.58333331"
+ id="stop890" />
+ <stop
+ id="stop892"
+ offset="0.75"
+ style="stop-color:#301e25;stop-opacity:1" />
+ <stop
+ style="stop-color:#412030;stop-opacity:1"
+ offset="0.86666667"
+ id="stop886" />
+ <stop
+ id="stop894"
+ offset="0.91666669"
+ style="stop-color:#511e3d;stop-opacity:1" />
+ <stop
+ id="stop888"
+ offset="0.94999999"
+ style="stop-color:#60184e;stop-opacity:1" />
+ <stop
+ style="stop-color:#720d66;stop-opacity:1"
+ offset="0.98333335"
+ id="stop896" />
+ <stop
+ id="stop878"
+ offset="1"
+ style="stop-color:#800080;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="16"
+ x2="496"
+ y1="496"
+ x1="16"
+ id="linearGradient882"
+ xlink:href="#linearGradient880" />
+ <filter
+ id="filter1534"
+ style="color-interpolation-filters:sRGB;">
+ <feFlood
+ id="feFlood1524"
+ result="flood"
+ flood-color="rgb(0,0,0)"
+ flood-opacity="0.701961" />
+ <feComposite
+ id="feComposite1526"
+ result="composite1"
+ operator="in"
+ in2="SourceGraphic"
+ in="flood" />
+ <feGaussianBlur
+ id="feGaussianBlur1528"
+ result="blur"
+ stdDeviation="0.5"
+ in="composite1" />
+ <feOffset
+ id="feOffset1530"
+ result="offset"
+ dy="3.5"
+ dx="4" />
+ <feComposite
+ id="feComposite1532"
+ result="composite2"
+ operator="over"
+ in2="offset"
+ in="SourceGraphic" />
+ </filter>
+ </defs>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>PSn00bSDK icon</dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1">
+ <rect
+ ry="64"
+ rx="64"
+ y="0"
+ x="0"
+ height="512"
+ width="512"
+ id="rect860"
+ style="opacity:0.998;fill:url(#linearGradient882);fill-opacity:1;stroke-width:2" />
+ <g
+ style="fill:#ffffff;fill-opacity:1;filter:url(#filter1534)"
+ id="layer1-5"
+ transform="matrix(3.779521,0,0,3.779521,16.000484,-786.51733)">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 57.179711,259.17821 v 17.18692 h 5.773631 c -0.396902,-2.52219 -1.516281,-11.47627 2.677532,-11.43765 4.154274,0.0381 2.825972,8.818 2.338686,11.43765 h 5.726019 c 0,-2.5475 0.612565,-10.89684 -1.883577,-14.15061 -2.122953,-2.76729 -7.048341,-2.41673 -9.502018,-1.00656 v -2.02975 z"
+ id="path5596" />
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 82.828855,255.71895 c -10.353164,0.25013 -10.721078,21.06797 0.714234,20.66283 10.000569,-0.35432 8.896917,-20.89502 -0.714234,-20.66283 z m -1.383056,5.71268 c -1.165387,3.71776 1.988956,7.56732 5.10259,5.73157 0,0 -0.09008,3.35969 -2.71075,4.0174 -5.560412,1.39549 -6.092866,-7.18149 -2.39184,-9.74897 z"
+ id="path5600" />
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 114.82523,255.43876 -6.43139,1.1339 0.7563,19.49459 4.79365,0.0898 0.0665,-1.56688 c 0,0 0.84813,1.16403 3.59108,1.45064 9.30033,0.97173 8.87091,-14.3259 1.34541,-14.73418 -2.83582,-0.15386 -4.43043,1.4041 -4.43043,1.4041 z m 2.46382,10.23949 c 3.64531,-0.38951 4.6306,5.87108 0.65,6.49892 -3.75349,0.59205 -4.99839,-6.03428 -0.65,-6.49892 z"
+ id="path5612" />
+ <g
+ aria-label="SDK"
+ transform="matrix(0.56695433,0,0,0.56695433,-141.8248,-64.336976)"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:42.6667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none"
+ id="flowRoot5618">
+ <path
+ d="m 351.00651,635.98438 v -8.70834 h 20.60417 v -3.45833 h -11 q -5.72917,0 -7.5625,-1.27083 -1.83334,-1.27084 -1.83334,-4.52084 v -7.64583 q 0,-3.33333 2.16667,-4.79167 2.1875,-1.47916 7.22917,-1.47916 h 18.72916 v 8.625 h -18.39583 v 3.54166 h 13.22917 q 3.66666,0 5.39583,1.5 1.72917,1.5 1.72917,4.6875 v 7.8125 q 0,2.66667 -1.85417,4.1875 -1.85417,1.52084 -5.14583,1.52084 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ id="path24" />
+ <path
+ d="m 394.81901,627.27604 h 11.35417 v -14.54166 h -11.35417 z m -9.9375,8.70834 v -31.875 h 23.6875 q 3.6875,0 5.77083,2.27083 2.08334,2.25 2.08334,6.3125 v 14.5 q 0,4.33333 -2.04167,6.5625 -2.04167,2.22917 -6.02083,2.22917 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ id="path26" />
+ <path
+ d="m 420.13152,635.98438 v -31.875 h 9.77083 v 12.20833 h 2.3125 l 9,-12.20833 h 11.72917 l -12.10417,15.66666 12.79167,16.20834 h -12.375 l -9.04167,-12.16667 h -2.3125 v 12.16667 z"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Bolt Bd BT';-inkscape-font-specification:'Bolt Bd BT Bold';fill:#ffffff;fill-opacity:1"
+ id="path28" />
+ </g>
+ <path
+ id="path908"
+ d="m 99.804384,255.71668 c -10.133001,-0.0773 -10.593527,20.63351 0.262436,20.66506 10.26945,0.0298 9.09211,-20.59369 -0.262436,-20.66506 z m 0.556956,15.46392 c -0.008,9.6e-4 -0.0138,0.002 -0.021,0.004 2.35422,-2.63067 -1.289504,-8.16996 -4.519013,-6.33394 0,0 1.131029,-4.35205 4.012975,-4.09159 4.446218,0.40182 4.327948,9.1393 0.527048,10.42125 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.973493;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path914"
+ d="m 26.876314,267.84943 c -0.07198,3.84917 -0.663735,8.22997 -3.673281,10.94853 -2.089478,1.66049 -4.851082,0.94991 -7.306542,1.10553 H 11.04198 v -3.42363 c 2.156559,-0.0653 4.33832,0.13885 6.477279,-0.11786 2.536377,-0.98515 3.091955,-4.09776 3.4593,-6.48869 0.300636,-3.36989 0.07856,-7.12599 -2.014955,-9.92767 -1.357242,-1.62658 -3.597582,-0.93352 -5.431053,-1.08326 H 8.6169014 v 37.37473 H 2.4115531 v -40.79837 c 5.9979405,0.0129 11.9968419,-0.0238 17.9941699,0.0171 3.625596,0.34104 5.274335,4.24515 5.941221,7.34963 0.369793,1.65348 0.52937,3.01218 0.52937,5.04391 z m 26.781736,16.11965 c -0.08017,3.9379 -0.873268,8.36119 -3.922921,11.12682 -2.089008,1.69992 -4.872113,0.98781 -7.342206,1.14121 H 31.547042 v -3.42363 c 4.070829,-0.0292 8.14743,0.0592 12.21455,-0.0456 2.781143,-0.57546 3.669767,-3.80823 4.021548,-6.25301 0.166648,-2.54728 0.292442,-5.57249 -1.565266,-7.57307 -2.159164,-1.74308 -5.042366,-1.02412 -7.593577,-1.17799 -2.19456,0.14293 -4.637761,-0.23372 -5.967246,-2.20664 -3.132732,-4.47482 -3.210319,-10.62153 -1.220061,-15.57718 0.94516,-2.55433 3.288885,-4.87136 6.197494,-4.54117 h 12.956554 v 3.42364 c -3.583967,0.0246 -7.172385,-0.0503 -10.753483,0.039 -2.74647,0.48591 -3.651617,3.67317 -3.835713,6.07941 -0.145669,2.69978 0.298311,6.06194 2.828236,7.58171 1.744887,0.64676 3.664647,0.23375 5.491578,0.35107 3.519412,0 4.7894,-0.0107 6.359655,1.56024 2.176061,2.17605 2.976739,6.12884 2.976739,9.49523 z"
+ style="font-style:normal;font-weight:normal;font-size:33.286px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.742977" />
+ </g>
+ </g>
+</svg>
diff --git a/cpack/welcome.txt b/cpack/welcome.txt
new file mode 100644
index 0000000..e024336
--- /dev/null
+++ b/cpack/welcome.txt
@@ -0,0 +1,3 @@
+This installer will set up PSn00bSDK, including prebuilt libraries, CMake scripts as well as several command-line utilities for PlayStation 1 homebrew development.
+
+NOTE: CMake and the GCC toolchain must be installed separately.
diff --git a/libpsn00b/cmake/internal_setup.cmake b/libpsn00b/cmake/internal_setup.cmake
new file mode 100644
index 0000000..e9423a4
--- /dev/null
+++ b/libpsn00b/cmake/internal_setup.cmake
@@ -0,0 +1,158 @@
+# PSn00bSDK internal setup script for CMake
+# (C) 2021 spicyjpeg - MPL licensed
+
+# This script is included automatically when using the toolchain file and
+# defines helper functions.
+
+cmake_minimum_required(VERSION 3.21)
+include(GNUInstallDirs)
+
+## Settings (can be overridden by projects)
+
+set(PSN00BSDK_EXECUTABLE_SUFFIX ".exe")
+set(PSN00BSDK_SHARED_LIBRARY_SUFFIX ".dll")
+set(PSN00BSDK_SYMBOL_MAP_SUFFIX ".map")
+
+## SDK libraries
+
+# DON'T CHANGE THE ORDER or you'll break the libraries' internal dependencies.
+set(PSN00BSDK_LIBRARIES psxgpu psxgte psxspu psxcd psxsio psxetc psxapi lzp c)
+
+include(${CMAKE_CURRENT_LIST_DIR}/libpsn00b.cmake OPTIONAL)
+if(NOT TARGET psn00bsdk_common)
+ include(${CMAKE_CURRENT_LIST_DIR}/virtual_targets.cmake)
+endif()
+
+# Use the toolchain path to find libgcc (used to build libpsn00b). Of course
+# different installers, packages and distros have different opinions when it
+# comes to deciding where to install toolchains, so we have to bruteforce
+# multiple combinations of paths.
+if(CMAKE_C_COMPILER_VERSION)
+ string(REGEX MATCH "^([0-9]+)\." _dummy ${CMAKE_C_COMPILER_VERSION})
+
+ find_library(
+ PSN00BSDK_LIBGCC gcc
+ HINTS
+ ${PSN00BSDK_TC}/lib/gcc-cross/${PSN00BSDK_TARGET}/${CMAKE_C_COMPILER_VERSION}
+ ${PSN00BSDK_TC}/lib/gcc-cross/${PSN00BSDK_TARGET}/${CMAKE_MATCH_1}
+ ${PSN00BSDK_TC}/lib/gcc/${PSN00BSDK_TARGET}/${CMAKE_C_COMPILER_VERSION}
+ ${PSN00BSDK_TC}/lib/gcc/${PSN00BSDK_TARGET}/${CMAKE_MATCH_1}
+ ${PSN00BSDK_TC}/../lib/gcc-cross/${PSN00BSDK_TARGET}/${CMAKE_C_COMPILER_VERSION}
+ ${PSN00BSDK_TC}/../lib/gcc-cross/${PSN00BSDK_TARGET}/${CMAKE_MATCH_1}
+ ${PSN00BSDK_TC}/../lib/gcc/${PSN00BSDK_TARGET}/${CMAKE_C_COMPILER_VERSION}
+ ${PSN00BSDK_TC}/../lib/gcc/${PSN00BSDK_TARGET}/${CMAKE_MATCH_1}
+ NO_DEFAULT_PATH
+ DOC "Path to libgcc (bundled with the GCC toolchain)"
+ )
+endif()
+
+## Tools
+
+set(
+ PSN00BSDK_TOOLS
+ ${CMAKE_CURRENT_LIST_DIR}/../../../${CMAKE_INSTALL_BINDIR}
+ ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
+)
+
+find_program(ELF2X elf2x HINTS ${PSN00BSDK_TOOLS})
+find_program(ELF2CPE elf2cpe HINTS ${PSN00BSDK_TOOLS})
+find_program(SMXLINK elf2x HINTS ${PSN00BSDK_TOOLS})
+find_program(LZPACK lzpack HINTS ${PSN00BSDK_TOOLS})
+find_program(MKPSXISO mkpsxiso HINTS ${PSN00BSDK_TOOLS})
+
+## Helper functions for executables
+
+set(PSN00BSDK_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/../include)
+set(PSN00BSDK_LDSCRIPTS ${CMAKE_CURRENT_LIST_DIR}/../ldscripts)
+
+# psn00bsdk_add_executable(
+# <target name> <STATIC|DYNAMIC>
+# [EXCLUDE_FROM_ALL]
+# <sources> ...
+# )
+function(psn00bsdk_add_executable name type)
+ string(TOLOWER ${type} _type)
+ if(NOT ${_type} MATCHES "^(static|dynamic)$")
+ message(FATAL_ERROR "Invalid executable type: ${type} (must be STATIC or DYNAMIC)")
+ endif()
+
+ add_executable (${name} ${ARGN})
+ target_link_libraries(${name} psn00bsdk_${_type}_exe)
+ set_target_properties(${name} PROPERTIES PREFIX "" SUFFIX ".elf")
+ target_link_options (${name} PRIVATE -T${PSN00BSDK_LDSCRIPTS}/exe.ld)
+
+ target_include_directories(${name} PRIVATE ${PSN00BSDK_INCLUDE})
+
+ # Add post-build steps to generate the .exe and symbol map once the
+ # executable is built. CMake 3.21 added support for target-dependent
+ # generator expressions (catchy name lol) in add_custom_command(), so I'm
+ # making heavy use of those here.
+ add_custom_command(
+ TARGET ${name} POST_BUILD
+ COMMAND ${ELF2X} -q ${name}.elf ${name}${PSN00BSDK_EXECUTABLE_SUFFIX}
+ COMMAND ${TOOLCHAIN_NM} -f posix -l -n ${name}.elf $<ANGLE-R>${name}${PSN00BSDK_SYMBOL_MAP_SUFFIX}
+ BYPRODUCTS ${name}${PSN00BSDK_EXECUTABLE_SUFFIX} ${name}${PSN00BSDK_SYMBOL_MAP_SUFFIX}
+ )
+endfunction()
+
+# psn00bsdk_add_library(
+# <target name> <STATIC|SHARED|MODULE>
+# [EXCLUDE_FROM_ALL]
+# <sources> ...
+# )
+# Note that SHARED and MODULE have the same meaning (both will create a DLL).
+# SDK libraries are NOT statically linked in by default; if you need to link
+# something, use target_link_libraries() manually.
+function(psn00bsdk_add_library name type)
+ string(TOUPPER ${type} _type_upper)
+ string(TOLOWER ${type} _type)
+ if(NOT ${_type} MATCHES "^(static|object|shared|module)$")
+ message(FATAL_ERROR "Invalid library type: ${type} (must be STATIC, OBJECT, SHARED or MODULE)")
+ endif()
+
+ add_library (${name} ${_type_upper} ${ARGN})
+ target_link_libraries(${name} psn00bsdk_${_type}_lib)
+
+ target_include_directories(${name} PRIVATE ${PSN00BSDK_INCLUDE})
+
+ if(${_type} MATCHES "^(shared|module)$")
+ set_target_properties(${name} PROPERTIES PREFIX "" SUFFIX ".so")
+ target_link_options (${name} PRIVATE -T${PSN00BSDK_LDSCRIPTS}/dll.ld)
+
+ # Add a post-build step to dump the DLL's raw contents into a new file
+ # separate from the built ELF.
+ add_custom_command(
+ TARGET ${name} POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} -O binary ${name}.so ${name}${PSN00BSDK_SHARED_LIBRARY_SUFFIX}
+ BYPRODUCTS ${name}${PSN00BSDK_SHARED_LIBRARY_SUFFIX}
+ )
+ else()
+ set_target_properties(${name} PROPERTIES PREFIX "lib" SUFFIX ".a")
+
+ # Remove virtual target dependencies to make sure linking against the
+ # library does not also propagate static library flags.
+ set_target_properties(${name} PROPERTIES INTERFACE_LINK_LIBRARIES "")
+ endif()
+endfunction()
+
+# psn00bsdk_add_cd_image(
+# <target name>
+# <image file name>
+# <mkpsxiso config template>
+# [DEPENDS <dependencies> ...]
+# [additional options passed to add_custom_target()]
+# )
+function(psn00bsdk_add_cd_image name image_name config_file)
+ set(CD_IMAGE_NAME ${image_name})
+ configure_file(${config_file} _gen_${config_file})
+
+ add_custom_target(
+ ${name} ALL
+ COMMAND ${MKPSXISO} -y -q _gen_${config_file}
+ BYPRODUCTS ${image_name}.bin ${image_name}.cue
+ COMMENT "Building CD image ${image_name}"
+ ${ARGN}
+ )
+endfunction()
+
+## Helper functions for assets (TODO)
diff --git a/libpsn00b/cmake/sdk.cmake b/libpsn00b/cmake/sdk.cmake
new file mode 100644
index 0000000..82e921c
--- /dev/null
+++ b/libpsn00b/cmake/sdk.cmake
@@ -0,0 +1,78 @@
+# PSn00bSDK toolchain setup file for CMake
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+set(
+ PSN00BSDK_TC $ENV{PSN00BSDK_TC}
+ CACHE PATH "Path to the GCC toolchain's installation directory"
+)
+set(
+ PSN00BSDK_TARGET mipsel-unknown-elf
+ CACHE STRING "GCC toolchain target triplet"
+)
+
+## CMake configuration
+
+set(CMAKE_SYSTEM_NAME PlayStation)
+set(CMAKE_SYSTEM_PROCESSOR mipsel)
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+# Tell CMake not to run the linker when compiling test programs. This dodges
+# missing C++ standard library errors.
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
+## Toolchain path setup
+
+# Attempt to find GCC. PSN00BSDK_TC can be left unset if the toolchain can be
+# found in the PATH environment variable.
+find_program(
+ _gcc ${PSN00BSDK_TARGET}-gcc
+ HINTS
+ ${PSN00BSDK_TC}/bin
+ ${PSN00BSDK_TC}/../bin
+ ${CMAKE_CURRENT_LIST_DIR}/../../../${PSN00BSDK_TARGET}/bin
+ PATHS
+ "C:/Program Files/${PSN00BSDK_TARGET}/bin"
+ "C:/${PSN00BSDK_TARGET}/bin"
+ /usr/local/${PSN00BSDK_TARGET}/bin
+ /usr/${PSN00BSDK_TARGET}/bin
+ NO_CACHE REQUIRED
+)
+cmake_path(GET _gcc PARENT_PATH _bin)
+cmake_path(GET _bin PARENT_PATH _toolchain)
+
+# Overwrite the empty cache entry, so it won't have to be found again.
+if(NOT IS_DIRECTORY PSN00BSDK_TC)
+ set(
+ PSN00BSDK_TC ${_toolchain}
+ CACHE PATH "Path to the GCC toolchain's installation directory"
+ FORCE
+ )
+endif()
+
+## Toolchain executables
+
+set(_prefix ${_bin}/${PSN00BSDK_TARGET})
+
+set(CMAKE_ASM_COMPILER ${_prefix}-gcc${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_C_COMPILER ${_prefix}-gcc${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_CXX_COMPILER ${_prefix}-g++${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_AR ${_prefix}-ar${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_LINKER ${_prefix}-ld${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_RANLIB ${_prefix}-ranlib${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_OBJCOPY ${_prefix}-objcopy${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_SIZE ${_prefix}-size${CMAKE_EXECUTABLE_SUFFIX})
+set(CMAKE_STRIP ${_prefix}-strip${CMAKE_EXECUTABLE_SUFFIX})
+set(TOOLCHAIN_NM ${_prefix}-nm${CMAKE_EXECUTABLE_SUFFIX})
+
+## SDK setup
+
+# We can't set up the SDK here as the find_*() functions may fail if they are
+# called before project(). We can however set a script to be executed right
+# after project() is invoked.
+set(CMAKE_PROJECT_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/internal_setup.cmake)
diff --git a/libpsn00b/cmake/virtual_targets.cmake b/libpsn00b/cmake/virtual_targets.cmake
new file mode 100644
index 0000000..df1df79
--- /dev/null
+++ b/libpsn00b/cmake/virtual_targets.cmake
@@ -0,0 +1,109 @@
+# libpsn00b interface targets
+# (C) 2021 spicyjpeg - MPL licensed
+
+# This script creates several "virtual" targets (psn00bsdk_*) that set include
+# directories and compiler flags when a target is linked against them. These
+# all end up in the autogenerated libpsn00b setup script after installation,
+# so this file is only included when building libpsn00b.
+
+# The following targets are currently defined:
+# - psn00bsdk_common
+# - psn00bsdk_object_lib (same as psn00bsdk_common)
+# - psn00bsdk_static_exe
+# - psn00bsdk_dynamic_exe
+# - psn00bsdk_static_lib
+# - psn00bsdk_shared_lib
+# - psn00bsdk_module_lib (same as psn00bsdk_shared_lib)
+
+include(GNUInstallDirs)
+
+set(PSN00BSDK_VIRTUAL_TARGETS "")
+
+macro(_add_interface_target name)
+ add_library(${name} INTERFACE)
+ list(APPEND PSN00BSDK_VIRTUAL_TARGETS ${name})
+
+ target_compile_options(
+ ${name} INTERFACE
+ ${_aflags}
+ $<$<COMPILE_LANGUAGE:C,CXX>:${_cflags}>
+ $<$<COMPILE_LANGUAGE:CXX>:${_cxxflags}>
+ )
+ target_link_options (${name} INTERFACE ${_ldflags})
+ target_link_libraries(${name} INTERFACE ${ARGN})
+endmacro()
+
+macro(_add_alias_target name)
+ #add_library(${name} ALIAS ${ARGN})
+ add_library(${name} INTERFACE)
+ list(APPEND PSN00BSDK_VIRTUAL_TARGETS ${name})
+
+ target_link_libraries(${name} INTERFACE ${ARGN})
+endmacro()
+
+# Options common to all target types:
+# - Define PLAYSTATION=1 and set include directories
+# - Optimize for MIPS R3000
+# - Inject zero checks into division operations (will throw breaks)
+# - All standard libraries (including libgcc) disabled
+# - Put all symbols into separate sections when building
+# - C++ features that require runtime support disabled
+# - Unused section stripping enabled
+set(_aflags -msoft-float -march=r3000 -mtune=r3000 -mabi=32)
+set(_cflags -mdivide-breaks -O2 -ffreestanding -fno-builtin -nostdlib -fdata-sections -ffunction-sections -fsigned-char -fno-strict-overflow -fdiagnostics-color=always)
+set(_cxxflags -fno-exceptions -fno-rtti -fno-unwind-tables -fno-threadsafe-statics -fno-use-cxa-atexit)
+set(_ldflags -nostdlib -Wl,-gc-sections)
+
+_add_interface_target(psn00bsdk_common)
+_add_alias_target (psn00bsdk_object_lib psn00bsdk_common)
+
+target_compile_definitions(
+ psn00bsdk_common INTERFACE
+ PLAYSTATION=1
+ $<$<CONFIG:DEBUG>:DEBUG=1>
+)
+
+# Options for executables without support for dynamic linking:
+# - Position-independent code disabled
+# - GP-relative addressing enabled only for local symbols
+# - ABI-compatible calls disabled (incompatible with GP-relative addr)
+set(_aflags -G8)
+set(_cflags -mno-abicalls -mgpopt -mno-extern-sdata)
+set(_cxxflags)
+set(_ldflags -G8 -static)
+
+_add_interface_target(psn00bsdk_static_exe psn00bsdk_common ${PSN00BSDK_LIBRARIES})
+
+# Options for executables with support for dynamic linking:
+# - Position-independent code disabled
+# - GP-relative addressing disabled
+# - ABI-compatible calls disabled (must be performed manually)
+set(_aflags -G0)
+set(_cflags -mno-abicalls -mno-gpopt)
+set(_cxxflags)
+set(_ldflags -G0 -static)
+
+_add_interface_target(psn00bsdk_dynamic_exe psn00bsdk_common ${PSN00BSDK_LIBRARIES})
+
+# Options for static libraries:
+# - GP-relative addressing disabled
+# - ABI-compatible calls disabled
+# - Local stripping enabled
+set(_aflags -G0 -Wa,--strip-local-absolute)
+set(_cflags -mno-abicalls -mno-gpopt)
+set(_cxxflags)
+set(_ldflags)
+
+_add_interface_target(psn00bsdk_static_lib psn00bsdk_common)
+
+# Options for dynamically-loaded libraries:
+# - Position-independent code enabled
+# - GP-relative addressing disabled (incompatible with ABI calls)
+# - ABI-compatible calls enabled
+set(_aflags -G0)
+set(_cflags -mabicalls -mshared -mno-gpopt -fPIC)
+set(_cxxflags)
+set(_ldflags -G0 -shared)
+
+_add_interface_target(psn00bsdk_shared_lib psn00bsdk_common)
+_add_alias_target (psn00bsdk_module_lib psn00bsdk_shared_lib)