From ef21810fa4afa4f6ced4a9a9e38a2970b24fdb26 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 18:57:32 +0800 Subject: [PATCH 01/27] change to just-the-docs theme --- .github/workflows/pages.yml | 64 ++ .gitignore | 70 ++ Gemfile | 5 + Gemfile.lock | 281 ++++++++ README.md | 1227 +---------------------------------- _config.yml | 14 +- _layouts/default.html | 37 -- basic_programs.md | 1086 +++++++++++++++++++++++++++++++ documentation.md | 5 + downloads.md | 13 + index.md | 18 + quickstart.md | 172 +++++ tools/index.md | 7 + 13 files changed, 1734 insertions(+), 1265 deletions(-) create mode 100644 .github/workflows/pages.yml create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock delete mode 100644 _layouts/default.html create mode 100644 basic_programs.md create mode 100644 downloads.md create mode 100644 index.md create mode 100644 quickstart.md create mode 100644 tools/index.md diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..fdee052 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,64 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Jekyll site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["use-jtd"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + cache-version: 0 # Increment this number if you need to re-download cached gems + - name: Setup Pages + id: pages + uses: actions/configure-pages@v4 + - name: Build with Jekyll + # Outputs to the './_site' directory by default + run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" + env: + JEKYLL_ENV: production + - name: Upload artifact + # Automatically uploads an artifact from the './_site' directory by default + uses: actions/upload-pages-artifact@v3 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d98308 --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +# Created by https://www.toptal.com/developers/gitignore/api/jekyll,ruby +# Edit at https://www.toptal.com/developers/gitignore?templates=jekyll,ruby + +### Jekyll ### +_site/ +.sass-cache/ +.jekyll-cache/ +.jekyll-metadata +# Ignore folders generated by Bundler +.bundle/ +vendor/ + +### Ruby ### +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Used by dotenv library to load environment variables. +# .env + +# Ignore Byebug command history file. +.byebug_history + +## Specific to RubyMotion: +.dat* +.repl_history +build/ +*.bridgesupport +build-iPhoneOS/ +build-iPhoneSimulator/ + +## Specific to RubyMotion (use of CocoaPods): +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# vendor/Pods/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# Used by RuboCop. Remote config files pulled in from inherit_from directive. +# .rubocop-https?--* + +# End of https://www.toptal.com/developers/gitignore/api/jekyll,ruby \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..2d98ba2 --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +#gem "github-pages", group: :jekyll_plugins +#gem "webrick" +gem "just-the-docs" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..e61f36a --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,281 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (7.1.3) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + base64 (0.2.0) + bigdecimal (3.1.6) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + colorator (1.1.0) + commonmarker (0.23.10) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) + dnsruby (1.70.0) + simpleidn (~> 0.2.1) + drb (2.2.0) + ruby2_keywords + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + ethon (0.16.0) + ffi (>= 1.15.0) + eventmachine (1.2.7) + execjs (2.9.1) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-net_http (3.1.0) + net-http + ffi (1.16.3-x64-mingw-ucrt) + forwardable-extended (2.6.0) + gemoji (4.1.0) + github-pages (230) + github-pages-health-check (= 1.18.2) + jekyll (= 3.9.5) + jekyll-avatar (= 0.8.0) + jekyll-coffeescript (= 1.2.2) + jekyll-commonmark-ghpages (= 0.4.0) + jekyll-default-layout (= 0.1.5) + jekyll-feed (= 0.17.0) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.16.1) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.7.0) + jekyll-remote-theme (= 0.4.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.13.0) + kramdown (= 2.4.0) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.4) + mercenary (~> 0.3) + minima (= 2.5.1) + nokogiri (>= 1.13.6, < 2.0) + rouge (= 3.30.0) + terminal-table (~> 1.4) + github-pages-health-check (1.18.2) + addressable (~> 2.3) + dnsruby (~> 1.60) + octokit (>= 4, < 8) + public_suffix (>= 3.0, < 6.0) + typhoeus (~> 1.3) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) + http_parser.rb (0.8.0) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + jekyll (3.9.5) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (>= 0.7, < 2) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (>= 1.17, < 3) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + jekyll-avatar (0.8.0) + jekyll (>= 3.0, < 5.0) + jekyll-coffeescript (1.2.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.12) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.4.0) + commonmarker (~> 0.23.7) + jekyll (~> 3.9.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 5.0) + jekyll-default-layout (0.1.5) + jekyll (>= 3.0, < 5.0) + jekyll-feed (0.17.0) + jekyll (>= 3.7, < 5.0) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.16.1) + jekyll (>= 3.4, < 5.0) + octokit (>= 4, < 7, != 4.4.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-mentions (1.6.0) + html-pipeline (~> 2.3) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.7.0) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) + html-pipeline (~> 2.2) + jekyll (>= 3.0, < 5.0) + just-the-docs (0.7.0) + jekyll (>= 3.8.5) + jekyll-include-cache + jekyll-seo-tag (>= 2.0) + rake (>= 12.3.1) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + mercenary (0.3.6) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (5.22.2) + mutex_m (0.2.0) + net-http (0.4.1) + uri + nokogiri (1.16.2-x64-mingw-ucrt) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (5.0.4) + racc (1.7.3) + rake (13.1.0) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + rexml (3.2.6) + rouge (3.30.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + simpleidn (0.2.1) + unf (~> 0.1.4) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.9.1-x64-mingw-ucrt) + unicode-display_width (1.8.0) + uri (0.13.0) + webrick (1.8.1) + +PLATFORMS + x64-mingw-ucrt + +DEPENDENCIES + github-pages + just-the-docs + webrick + +BUNDLED WITH + 2.5.6 diff --git a/README.md b/README.md index 1549c32..1986c6c 100644 --- a/README.md +++ b/README.md @@ -1,1227 +1,2 @@ -PSPDEV is an open source toolchain for Playstation Portable development. It allows you to make apps and games for both custom and official firmwares. This is a community project made by enthusiasts, it is in no way affiliated with Sony. - -# Getting started - -## Installing - -### dependencies - -The PSPDEV toolchain requires a couple of dependencies to be installed before use. - -#### Windows - -On Windows it is advised to use Ubuntu on Microsoft's WSL system. To set it up run the following commands in a Powershell window started as administrator: - -``` -wsl --install -``` - -Now run bash and run the following commands to install the dependencies: - -``` -sudo apt-get update -sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot -``` - -Going forwards, all commands will be run within bash. The filesystem of your Ubuntu installation can be accessed by opening the network location `\\wsl$`. - -#### Ubuntu - -On Ubuntu run the following commands to install the dependencies: - -``` -sudo apt-get update -sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot -``` - -#### MacOS - - -On MacOS make sure to install [Brew](https://brew.sh/) first, then run the following commands to install the dependencies: - -``` -brew install cmake pkgconf gnu-sed bash openssl libtool libarchive gettext texinfo bison flex isl gsl gmp mpfr -``` - - -### Toolchain - -To install the PSPDEV toolchain, first [download the latest version](https://github.com/pspdev/pspdev/releases/tag/latest) for your system. Extract it into your user's home directory, which would be `\\wsl$\home\username` on Windows, otherwise `~`. If you're on Windows, pick the Ubuntu build. - -Now set the required environment variables. On Mac edit the ``~/.zprofile`` on Linux/WSL the ``~/.bashrc`` file. Add the following at the bottom: - -``` -export PSPDEV=~/pspdev -export PATH=$PATH:$PSPDEV/bin -``` - -This can simply be done with `nano ~/.bashrc` (``~/.zprofile`` on Mac). To save press Ctrl+X, then press Y, then enter/return twice. After that run `source ~/.bashrc` to apply the changes. - -On MacOS, run ``sudo xattr -rd com.apple.quarantine $PSPDEV`` to prevent Gatekeeper from blocking the toolchain. - -That's it, now the PSPDEV toolchain can be used to build PSP software. Below are some examples of programs and how to run them. For testing on real hardware, check out [psplink](https://pspdev.github.io/psplinkusb/). - -## Basic programs - -Below are some basic examples of programs for the PSP. More can be found [here](https://github.com/pspdev/pspsdk/tree/master/src/samples). - -### Hello world - -![](images/hello.png?raw=true) - - -This is a simple Hello World program for the PSP. Click on the details below to see the code and how to build it. - -

- -main.c: - -
-#include <pspkernel.h>
-#include <pspdebug.h>
-#include <pspdisplay.h>
-
-// PSP_MODULE_INFO is required
-PSP_MODULE_INFO("Hello World", 0, 1, 0);
-PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
-
-int exit_callback(int arg1, int arg2, void *common)
-{
-    sceKernelExitGame();
-    return 0;
-}
-
-int callback_thread(SceSize args, void *argp)
-{
-    int cbid = sceKernelCreateCallback("Exit Callback",
-        exit_callback, NULL);
-    sceKernelRegisterExitCallback(cbid);
-    sceKernelSleepThreadCB();
-    return 0;
-}
-
-int setup_callbacks(void)
-{
-    int thid = sceKernelCreateThread("update_thread",
-        callback_thread, 0x11, 0xFA0, 0, 0);
-
-    if(thid >= 0)
-        sceKernelStartThread(thid, 0, 0);
-    return thid;
-}
-
-int main(void) 
-{
-    // Use above functions to make exiting possible
-    setup_callbacks();
-    
-    // Print Hello World! on a debug screen on a loop
-    pspDebugScreenInit();
-    while(1)
-    {
-        pspDebugScreenSetXY(0, 0);
-        pspDebugScreenPrintf("Hello World!");
-        sceDisplayWaitVblankStart();
-    }
-
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(hello)
-
-add_executable(${PROJECT_NAME} main.c)
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    pspdebug
-    pspdisplay
-    pspge
-)
-
-# Create an EBOOT.PBP file
-create_pbp_file(
-    TARGET ${PROJECT_NAME}
-    ICON_PATH NULL
-    BACKGROUND_PATH NULL
-    PREVIEW_PATH NULL
-    TITLE ${PROJECT_NAME}
-)
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it. -

- -### Drawing shapes - -![](images/shape.png?raw=true) - -This is a simple square drawn on the PSP. It uses the native libgu library. Click on the details below to see the code and how to build it. - -

- -main.c: - -
-#include <pspkernel.h>
-#include <pspgu.h>
-
-PSP_MODULE_INFO("gutest", 0, 1, 0);
-PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU | THREAD_ATTR_USER);
-
-#define BUFFER_WIDTH 512
-#define BUFFER_HEIGHT 272
-#define SCREEN_WIDTH 480
-#define SCREEN_HEIGHT BUFFER_HEIGHT
-
-char list[0x20000] __attribute__((aligned(64)));
-
-void initGu(){
-    sceGuInit();
-
-    //Set up buffers
-    sceGuStart(GU_DIRECT, list);
-    sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUFFER_WIDTH);
-    sceGuDispBuffer(SCREEN_WIDTH,SCREEN_HEIGHT,(void*)0x88000,BUFFER_WIDTH);
-    sceGuDepthBuffer((void*)0x110000,BUFFER_WIDTH);
-
-    //Set up viewport
-    sceGuOffset(2048 - (SCREEN_WIDTH / 2), 2048 - (SCREEN_HEIGHT / 2));
-    sceGuViewport(2048, 2048, SCREEN_WIDTH, SCREEN_HEIGHT);
-    sceGuEnable(GU_SCISSOR_TEST);
-    sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
-
-    //Set some stuff
-    sceGuDepthRange(65535, 0); //Use the full buffer for depth testing - buffer is reversed order
-
-    sceGuDepthFunc(GU_GEQUAL); //Depth buffer is reversed, so GEQUAL instead of LEQUAL
-    sceGuEnable(GU_DEPTH_TEST); //Enable depth testing
-
-    sceGuFinish();
-    sceGuDisplay(GU_TRUE);
-}
-
-void endGu(){
-    sceGuDisplay(GU_FALSE);
-    sceGuTerm();
-}
-
-void startFrame(){
-    sceGuStart(GU_DIRECT, list);
-    sceGuClearColor(0xFFFFFFFF); // White background
-    sceGuClear(GU_COLOR_BUFFER_BIT);
-}
-
-void endFrame(){
-    sceGuFinish();
-    sceGuSync(0, 0);
-    sceDisplayWaitVblankStart();
-    sceGuSwapBuffers();
-}
-
-typedef struct {
-    unsigned short u, v;
-    short x, y, z;
-} Vertex;
-
-void drawRect(float x, float y, float w, float h) {
-
-    Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(Vertex));
-
-    vertices[0].x = x;
-    vertices[0].y = y;
-
-    vertices[1].x = y + w;
-    vertices[1].y = x + h;
-
-    sceGuColor(0xFF0000FF); // Red, colors are ABGR
-    sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, 0, vertices);
-}
-
-
-int main() {
-    initGu();
-    int running = 1;
-    while(running){
-        startFrame();
-
-        drawRect(32, 32, 64, 64);
-
-        endFrame();
-    }
-
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(shape)
-
-add_executable(${PROJECT_NAME} main.c)
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    pspgu
-    pspge
-    pspdisplay
-)
-
-# Create an EBOOT.PBP file
-create_pbp_file(
-    TARGET ${PROJECT_NAME}
-    ICON_PATH NULL
-    BACKGROUND_PATH NULL
-    PREVIEW_PATH NULL
-    TITLE ${PROJECT_NAME}
-)
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

- -More libgu examples can be found here. - -

- -### Controller - -![](images/controls.png?raw=true) - -This is a simple program to use the PSP controller. Click on details below to see the code and how to build it. - -

- -main.c: - -
-#include <pspkernel.h>
-#include <pspdebug.h>
-#include <pspctrl.h>
-#include <stdlib.h>
-#include <string.h>
-
-PSP_MODULE_INFO("Controller", 0, 1, 1);
-
-PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
-
-#define printf pspDebugScreenPrintf
-
-int done = 0;
-
-int exit_callback(int arg1, int arg2, void *common)
-{
-    done = 1;
-    return 0;
-}
-
-int callback_thread(SceSize args, void *argp)
-{
-    int cbid = sceKernelCreateCallback("Exit Callback",
-        exit_callback, NULL);
-    sceKernelRegisterExitCallback(cbid);
-    sceKernelSleepThreadCB();
-    return 0;
-}
-
-int setup_callbacks(void)
-{
-    int thid = sceKernelCreateThread("update_thread",
-        callback_thread, 0x11, 0xFA0, 0, 0);
-
-    if(thid >= 0)
-        sceKernelStartThread(thid, 0, 0);
-    return thid;
-}
-
-int main(void)
-{
-    SceCtrlData pad;
-
-    pspDebugScreenInit();
-    setup_callbacks();
-
-    sceCtrlSetSamplingCycle(0);
-    sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
-
-    while (!done)
-    {
-        pspDebugScreenSetXY(0, 2);
-        sceCtrlReadBufferPositive(&pad, 1);
-
-        printf("Analog X = %d, ", pad.Lx);
-        printf("Analog Y = %d \n", pad.Ly);
-
-        if (pad.Buttons != 0)
-        {
-            if (pad.Buttons & PSP_CTRL_SQUARE)
-            {
-                printf("Square pressed! \n");
-            }
-            if (pad.Buttons & PSP_CTRL_TRIANGLE)
-            {
-                printf("Triangle pressed! \n");
-            }
-            if (pad.Buttons & PSP_CTRL_CIRCLE)
-            {
-                printf("Circle pressed! \n");
-            }
-            if (pad.Buttons & PSP_CTRL_CROSS)
-            {
-                printf("Cross pressed! \n");
-            }
-
-            if (pad.Buttons & PSP_CTRL_UP)
-            {
-                printf("Up direction pad pressed! \n");
-            }
-            if (pad.Buttons & PSP_CTRL_DOWN)
-            {
-                printf("Down direction pad pressed! \n");
-            }
-            if (pad.Buttons & PSP_CTRL_LEFT)
-            {
-                printf("Left direction pad pressed! \n");
-            }
-            if (pad.Buttons & PSP_CTRL_RIGHT)
-            {
-                printf("Right direction pad pressed! \n");
-            }
-        }
-    }
-
-    sceKernelExitGame();
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(controls)
-
-add_executable(${PROJECT_NAME} main.c)
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    pspdebug
-    pspdisplay
-    pspge
-    pspctrl
-)
-
-# Create an EBOOT.PBP file
-create_pbp_file(
-    TARGET ${PROJECT_NAME}
-    ICON_PATH NULL
-    BACKGROUND_PATH NULL
-    PREVIEW_PATH NULL
-    TITLE ${PROJECT_NAME}
-)
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

- -

- -### Audio - -![](images/audio.png?raw=true) - -This is a simple program to use the audio of the PSP with minimal effort. It uses native audio library. Click on the details below to see the code and how to build it. - -

- -main.c: - -
-#include <pspkernel.h>
-#include <pspdebug.h>
-#include <pspaudiolib.h>
-#include <pspaudio.h>
-#include <pspdisplay.h>
-#include <pspctrl.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <limits.h>
-
-PSP_MODULE_INFO("audio", 0, 1, 1);
-PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
-
-#define printf	pspDebugScreenPrintf
-
-/* Exit callback */
-int exitCallback(int arg1, int arg2, void *common) {
-    sceKernelExitGame();
-    return 0;
-}
-
-/* Callback thread */
-int callbackThread(SceSize args, void *argp) {
-    int cbid;
-
-    cbid = sceKernelCreateCallback("Exit Callback", (void*) exitCallback, NULL);
-    sceKernelRegisterExitCallback(cbid);
-    sceKernelSleepThreadCB();
-
-    return 0;
-}
-
-/* Sets up the callback thread and returns its thread id */
-int setupCallbacks(void) {
-    int thid = 0;
-
-    thid = sceKernelCreateThread("update_thread", callbackThread, 0x11, 0xFA0, 0, 0);
-    if (thid >= 0) {
-        sceKernelStartThread(thid, 0, 0);
-    }
-    return thid;
-}
-
-/* Main code */
-
-const float PI = 3.1415926535897932f;
-const int sampleRate = 44100;
-float frequency = 440.0f;
-float currentTime = 0;
-int function = 0;
-
-typedef struct {
-        short l, r;
-} sample_t;
-
-float currentFunction(const float time) {
-    double x;
-    float t = modf((time / (2 * PI)), &x);
-
-    switch(function) {
-        case 0: // SINE
-            return sinf(time);
-        case 1: // SQUARE
-            if (t < 0.5f) {
-                return -0.2f;
-            } else {
-                return 0.2f;
-            }
-        case 2: // TRIANGLE
-            if (t < 0.5f) {
-                return (t * 2.0f) - 0.5f;
-            } else {
-                return 0.5f - (t - 0.5f) * 2.0f;
-            }
-        default:
-             return 0.0f;
-    }
-}
-
-/* This function gets called by pspaudiolib every time the
-   audio buffer needs to be filled. The sample format is
-   16-bit, stereo. */
-void audioCallback(void* buf, unsigned int length, void *userdata) {
-    const float sampleLength = 1.0f / sampleRate;
-    const float scaleFactor = SHRT_MAX - 1.0f;
-    static float freq0 = 440.0f;
-    sample_t* ubuf = (sample_t*) buf;
-    int i;
-    
-    if (frequency != freq0) {
-            currentTime *= (freq0 / frequency);
-    }
-    for (i = 0; i < length; i++) {
-        short s = (short) (scaleFactor * currentFunction(2.0f * PI * frequency * currentTime));
-        ubuf[i].l = s;
-        ubuf[i].r = s;
-        currentTime += sampleLength;
-    }
-    if (currentTime * frequency > 1.0f) {
-        double d;
-        currentTime = modf(currentTime * frequency, &d) / frequency;
-    }
-
-    freq0 = frequency;
-}
-
-/* Read the analog stick and adjust the frequency */
-void controlFrequency(void) {
-    static int oldButtons = 0;
-    const int zones[6] = {30, 70, 100, 112, 125, 130};
-    const float response[6] = {0.0f, 0.1f, 0.5f, 1.0f, 4.0f, 8.0f};
-    const float minFreq = 32.0f;
-    const float maxFreq = 7040.0f;
-    SceCtrlData pad;
-    float direction;
-    int changedButtons;
-    int i, v;
-
-    sceCtrlReadBufferPositive(&pad, 1);
-
-    v = pad.Ly - 128;
-    if (v < 0) {
-           direction = 1.0f;
-        v = -v;
-    } else {
-        direction = -1.0f;
-    }
-
-    for (i = 0; i < 6; i++) {
-        if (v < zones[i]) {
-            frequency += (response[i] * direction);
-            break;
-        }
-    }
-
-    if (frequency < minFreq) {
-        frequency = minFreq;
-    } else if (frequency > maxFreq) {
-        frequency = maxFreq;
-    }
-
-    changedButtons = pad.Buttons & (~oldButtons);
-    if (changedButtons & PSP_CTRL_CROSS) {
-        function++;
-        if (function > 2) {
-            function = 0;
-        }
-    }
-
-    oldButtons = pad.Buttons;
-}
-
-int main(void) {
-    pspDebugScreenInit();
-    setupCallbacks();
-
-    pspAudioInit();
-    pspAudioSetChannelCallback(0, audioCallback, NULL);
-
-    sceCtrlSetSamplingCycle(0);
-    sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
-
-    printf("Press up and down to select frequency\nPress X to change function\n");
-    
-    while(1) {
-        sceDisplayWaitVblankStart();
-        pspDebugScreenSetXY(0,2);
-        printf("freq = %.2f \n", frequency);
-
-        switch(function) {
-            case 0:
-                printf("SINE WAVE. \n");
-                break;
-            case 1:
-                  printf("SQUARE WAVE. \n");
-                break;
-            case 2:
-                  printf("TRIANGLE WAVE. \n");
-                break;
-        }
-
-        controlFrequency();
-    }
-
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(audio)
-
-add_executable(${PROJECT_NAME} main.c)
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    pspdebug
-    pspdisplay
-    pspge
-    pspctrl
-    pspaudio
-    pspaudiolib
-    psputility
-)
-
-# Create an EBOOT.PBP file
-create_pbp_file(
-    TARGET ${PROJECT_NAME}
-    ICON_PATH NULL
-    BACKGROUND_PATH NULL
-    PREVIEW_PATH NULL
-    TITLE ${PROJECT_NAME}
-)
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

- -More audiolib examples can be found here. - -

- -### Using SDL2 - -![](images/sdl2.png?raw=true) - -SDL2 is a library which handles system specific things like input, audio and window management for you. It can also be used to render shapes and images, just like the native libgu. This will be slower, but will result in code that can be run more easily on multiple platforms. Click on details below for the to see the code and how to build it. - -

- -main.c: - -
-#include <SDL.h>
-
-int main(int argc, char *argv[])
-{
-    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER);
-
-    SDL_Window * window = SDL_CreateWindow(
-        "window",
-        SDL_WINDOWPOS_UNDEFINED,
-        SDL_WINDOWPOS_UNDEFINED,
-        480,
-        272,
-        0
-    );
-
-    SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
-
-    SDL_Rect square = {216, 96, 34, 64}; 
-
-    int running = 1;
-    SDL_Event event;
-    while (running) { 
-        if (SDL_PollEvent(&event)) {
-            switch (event.type) {
-                case SDL_QUIT:
-                    running = 0;
-                    break;
-                case SDL_CONTROLLERDEVICEADDED:
-                    SDL_GameControllerOpen(event.cdevice.which);
-                    break;
-                case SDL_CONTROLLERBUTTONDOWN:
-                    if(event.cbutton.button == SDL_CONTROLLER_BUTTON_START)
-                        running = 0;
-                    break;
-            }
-        }
-
-        // Clear the screen
-        SDL_RenderClear(renderer);
-
-        // Draw a red square
-        SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
-        SDL_RenderFillRect(renderer, &square);
-
-        // Draw everything on a white background
-        SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
-        SDL_RenderPresent(renderer);
-    }
-
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(square)
-
-add_executable(${PROJECT_NAME} main.c)
-
-find_package(SDL2 REQUIRED)
-
-target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS})
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    ${SDL2_LIBRARIES}
-)
-
-if(PSP)
-    create_pbp_file(
-        TARGET ${PROJECT_NAME}
-        ICON_PATH NULL
-        BACKGROUND_PATH NULL
-        PREVIEW_PATH NULL
-        TITLE ${PROJECT_NAME}
-    )
-endif()
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -

This will result in an EBOOT.PBP` file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

- -If you have sdl2 dev package and a compiler installed this code will also build on Linux for Linux by running: - -
-mkdir build && cd build
-cmake ..
-make
-
- -More documentation on SDL can be found here. - -

- -### Using SDL2 mixer - -![](images/sdl2_mixer.png?raw=true) - -This is a simple program to use the SDL2_mixer library. Click on details below to see the code and how to build it. - -

- -main.c: - -
-#include <SDL2/SDL.h>
-#include <SDL2/SDL_mixer.h>
-
-// Define MIN macro
-#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
-
-// Define screen dimensions
-#define SCREEN_WIDTH    480
-#define SCREEN_HEIGHT   272
-
-// audio file path
-#define MUSIC_PATH "ms0:/MUSIC/test.ogg" // ogg/mp3 file format
-
-int main(int argc, char **argv) {
-    (void)argc;
-    (void)argv;
-
-    // Initialize sdl
-    SDL_Init(SDL_INIT_VIDEO |
-        SDL_INIT_AUDIO |
-        SDL_INIT_GAMECONTROLLER
-    );
-
-    // Initialize sdl2_mixer
-    Mix_OpenAudio(44100, 
-        MIX_DEFAULT_FORMAT, 
-        MIX_DEFAULT_CHANNELS, 
-        2048
-    );
-
-    // create window
-    SDL_Window *win = SDL_CreateWindow(
-        "psp_win",
-        SDL_WINDOWPOS_UNDEFINED,
-        SDL_WINDOWPOS_UNDEFINED,
-        SCREEN_WIDTH,
-        SCREEN_HEIGHT,
-        0
-    );
-
-    // Create Renderer
-    SDL_Renderer *renderer = SDL_CreateRenderer(
-        win, -1, 0
-    );
-
-    // Load ogg file
-    Mix_Music *ogg_file = NULL;
-    ogg_file = Mix_LoadMUS(MUSIC_PATH);
-    if (!ogg_file) {
-        return 0;
-    }
-
-    SDL_Rect rect;
-
-    // Square dimensions: Half of the min(SCREEN_WIDTH, SCREEN_HEIGHT)
-    rect.w = MIN(SCREEN_WIDTH, SCREEN_HEIGHT) / 2;
-    rect.h = MIN(SCREEN_WIDTH, SCREEN_HEIGHT) / 2;
-
-    // Square position: In the middle of the screen
-    rect.x = SCREEN_WIDTH / 2 - rect.w / 2;
-    rect.y = SCREEN_HEIGHT / 2 - rect.h / 2;
-
-
-    // Declare rects of pause symbol
-    SDL_Rect pause_rect1, pause_rect2;
-
-    pause_rect1.h = rect.h / 2;
-    pause_rect1.w = 40;
-    pause_rect1.x = rect.x + (rect.w - pause_rect1.w * 3) / 2;
-    pause_rect1.y = rect.y + rect.h / 4;
-    pause_rect2 = pause_rect1;
-    pause_rect2.x += pause_rect1.w * 2;
-    
-    // play the music 8 times
-    if (Mix_PlayMusic(ogg_file, 8) == -1) {
-        return 0;
-    }
-
-    int running = 1;
-    SDL_Event e;
-    while (running) {
-        if(SDL_PollEvent(&e)) {
-            switch(e.type) {
-                case SDL_QUIT:
-                    running = 0;
-                break;
-                case SDL_CONTROLLERDEVICEADDED:
-                    SDL_GameControllerOpen(e.cdevice.which);
-                break;
-                case SDL_CONTROLLERBUTTONDOWN:
-                    // pause using cross button
-                    if (e.cbutton.button == SDL_CONTROLLER_BUTTON_A) {
-                        Mix_PauseMusic();
-                    // resume using circle button
-                    } else if (e.cbutton.button == SDL_CONTROLLER_BUTTON_B) {
-                        Mix_ResumeMusic();
-                    }	
-                    // press start button to exit
-                    if (e.cbutton.button == SDL_CONTROLLER_BUTTON_START) {
-                        running = 0;
-                    }
-            break;		
-            }
-        }
-
-        // Initialize renderer color black for the background
-        SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
-
-        // Clear screen
-        SDL_RenderClear(renderer);
-
-        // Set renderer color green to draw the square
-        SDL_SetRenderDrawColor(renderer, 0, 0xFF, 0, 0xFF);
-
-        // Draw filled square
-        SDL_RenderFillRect(renderer, &rect);
-
-        // Check pause status
-        if(Mix_PausedMusic()) {
-            // Set renderer color black to draw the pause symbol
-            SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
-
-            // Draw pause symbol
-            SDL_RenderFillRect(renderer, &pause_rect1);
-             SDL_RenderFillRect(renderer, &pause_rect2);
-        }
-
-        // Update screen
-        SDL_RenderPresent(renderer);
-    }
-
-    Mix_FreeMusic(ogg_file);
-    SDL_DestroyRenderer(renderer);
-    SDL_DestroyWindow(win);
-    Mix_CloseAudio();
-    SDL_Quit();
-
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(sdl2_mixer)
-
-add_executable(${PROJECT_NAME} main.c)
-
-find_package(SDL2 REQUIRED)
-
-target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS})
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    ${SDL2_LIBRARIES}
-)
-
-if(PSP)
-    target_link_libraries(${PROJECT_NAME} PRIVATE
-        SDL2_mixer
-        SDL2
-        vorbisfile
-        vorbis
-        ogg
-        xmp
-    )
-    create_pbp_file(
-        TARGET ${PROJECT_NAME}
-        ICON_PATH NULL
-        BACKGROUND_PATH NULL
-        PREVIEW_PATH NULL
-        TITLE ${PROJECT_NAME}
-    )
-endif()
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and you need an audio file to test the program, download it from here. Put it in a directory in ms0:/MUSIC/ and then rename the audio file same as name on your MUSIC_PATH macro in your C code and the PSP can run it.

- -

- -### Using SDL2 ttf - -![](images/sdl2_ttf.jpg?raw=true) - -This is a simple program to use the SDL2_ttf library. Click on details below to see the code and how to build it. - -

- -main.c: - -
-#include <stdio.h>
-
-#include <SDL2/SDL.h>
-#include <SDL2/SDL_ttf.h>
-
-// Define screen dimensions
-#define SCREEN_WIDTH 480
-#define SCREEN_HEIGHT 272
-
-int main(int argc, char **argv)
-{
-    (void)argc;
-    (void)argv;
-
-    // Initialize SDL2
-    if (SDL_Init(SDL_INIT_VIDEO) < 0)
-    {
-        printf("SDL2 could not be initialized!\n"
-               "SDL2 Error: %s\n",
-               SDL_GetError());
-        return 0;
-    }
-
-    // Initialize SDL2_ttf
-    if (TTF_Init() < 0)
-    {
-        printf("SDL2_ttf could not be initialized!\n"
-               "SDL2_ttf Error: %s\n",
-               SDL_GetError());
-        return 0;
-    }
-
-    SDL_Window *win = SDL_CreateWindow(
-        "window",
-        SDL_WINDOWPOS_UNDEFINED,
-        SDL_WINDOWPOS_UNDEFINED,
-        SCREEN_WIDTH,
-        SCREEN_HEIGHT,
-        0);
-
-    if (!win)
-    {
-        printf("Window could not be created!\n"
-               "SDL_Error: %s\n",
-               SDL_GetError());
-    }
-
-    SDL_Renderer *renderer = SDL_CreateRenderer(win, -1, 0);
-    TTF_Font *font = TTF_OpenFont("Pacifico.ttf", 40);
-
-    // Set the text and background color
-    SDL_Color text_color = {0xff, 0xff, 0xff, 0xff};
-    SDL_Color bg_color = {0x00, 0x00, 0x00, 0xff};
-
-    SDL_Rect text_rect;
-    SDL_Surface *surface = TTF_RenderText(font, "Hello World!", text_color, bg_color);
-    SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface);
-
-    // Get text dimensions
-    text_rect.w = surface->w;
-    text_rect.h = surface->h;
-
-    SDL_FreeSurface(surface);
-
-    text_rect.x = (SCREEN_WIDTH - text_rect.w) / 2;
-    text_rect.y = text_rect.h + 30;
-
-    int running = 1;
-    SDL_Event e;
-    while (running)
-    {
-        if (SDL_PollEvent(&e))
-        {
-            switch (e.type)
-            {
-            case SDL_QUIT:
-                running = 0;
-                break;
-            case SDL_CONTROLLERDEVICEADDED:
-                SDL_GameControllerOpen(e.cdevice.which);
-                break;
-            case SDL_CONTROLLERBUTTONDOWN:
-                if (e.cbutton.button == SDL_CONTROLLER_BUTTON_START)
-                {
-                    running = 0;
-                }
-                break;
-            }
-        }
-
-        SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 0xff);
-        SDL_RenderClear(renderer);
-        SDL_SetRenderDrawColor(renderer, 0xff, 0x00, 0x00, 0xff);
-        SDL_RenderCopy(renderer, texture, NULL, &text_rect);
-        SDL_RenderPresent(renderer);
-    }
-
-    SDL_DestroyRenderer(renderer);
-    SDL_DestroyWindow(win);
-    TTF_Quit();
-    SDL_Quit();
-
-    return 0;
-}
-
- -CMakeLists.txt: - -
-cmake_minimum_required(VERSION 3.0)
-
-project(text-ttf)
-
-add_executable(${PROJECT_NAME} main.c)
-
-find_package(SDL2 REQUIRED)
-
-target_include_directories(${PROJECT_NAME} 
-    PRIVATE ${SDL2_INCLUDE_DIRS}
-)
-
-target_link_libraries(${PROJECT_NAME} PRIVATE
-    ${SDL2_LIBRARIES}
-)
-
-if(PSP)
-    target_link_libraries(${PROJECT_NAME} PRIVATE
-        SDL2_ttf
-        freetype
-        m
-        bz2
-        png16
-        z
-    )
-    create_pbp_file(
-        TARGET ${PROJECT_NAME}
-        ICON_PATH NULL
-        BACKGROUND_PATH NULL
-        PREVIEW_PATH NULL
-        TITLE ${PROJECT_NAME}
-    )
-endif()
-
- -Building can be done with: - -
-mkdir build && cd build
-psp-cmake ..
-make
-
- -

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and you need a font file to test the program, download it from here. Put it in a directory same as EBOOT.PBP and the PSP can run it.

- -

- -## Tips and Tricks - -Here some useful tips for developing for the PSP. - -### Making Programs Work on Unmodded PSPs - -The PSPDEV toolchain contains tools for making your program work on unmodded PSPs. This can be done by running psp-cmake with some additional commands when building like so: - -``` -mkdir build && cd build -psp-cmake -DBUILD_PRX=1 -DENC_PRX=1 .. -make -``` - -This does require `create_pbp_file` to be used in your CMakeLists.txt file. After the first build, running `make` is enough to get an `EBOOT.PBP` file which works on official firmware with any new changes made to the code. - -### Add PSP Specific Code to a Multi-Platform Programs - -When porting a game to the PSP, some PSP specific code might be needed. To make this code only apply to PSP, it is possible to use a simple ifdef statements which checks for `__PSP__` like so: - -``` -#ifdef __PSP__ - // Do PSP specific thing -#else - // Do the thing all other systems should do -#endif -``` - -This makes sure that the other systems supported by the program keeps working the same, while still making it possible to add support for the PSP. - -## More Libraries - -There are many C and C++ libraries available within the PSPDEV toolchain which can add functionality to your program. Some examples: - -- Audio formats: mp3, ogg -- Image formats: png, jpeg -- Data formats: json, yaml, sqlite -- Support for compression, physics, fonts and much more - - -For the full list take a look at the [psp-packages repository](https://github.com/pspdev/psp-packages) or run `psp-pacman -Syl`. Updating libraries can be done with `psp-pacman -Syu`. - -## Contact - -If you need help or would like to contribute, don't hesitate to join us on [Discord](https://discord.gg/bePrj9W) or open an issue on [GitHub](https://github.com/pspdev/pspdev/issues). See you there! +# PSPDEV website diff --git a/_config.yml b/_config.yml index c1cff16..0482c48 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,13 @@ -theme: jekyll-theme-hacker title: PSPDEV -description: Development tools for the Playstation Portable +description: "Development tools for the Playstation Portable" +github_username: pspdev +theme: just-the-docs + +# just-the-docs configuration +favicon_ico: /images/pspdev.ico + +color_scheme: dark + +exclude: + - Gemfile.lock + - README.md diff --git a/_layouts/default.html b/_layouts/default.html deleted file mode 100644 index 1fe9377..0000000 --- a/_layouts/default.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - {{ page.title | default: site.title | default: site.github.repository_name }} - - - - -
-
- -

{{ page.title | default: site.title | default: site.github.repository_name }}

-
-

{{ page.description | default: site.description | default: site.github.project_tagline }}

- -
- Download - Documentation - Samples - PSPLINK - Discord - GitHub -
-
-
- -
-
- {{ content }} -
-
- - diff --git a/basic_programs.md b/basic_programs.md new file mode 100644 index 0000000..68dc205 --- /dev/null +++ b/basic_programs.md @@ -0,0 +1,1086 @@ +--- +title: Basic programs +nav_order: 4 +--- + +# Basic programs +{: .fs-8 .fw-700 .text-center } + +## Drawing shapes +{: .fs-6 .fw-700 } + +![](images/shape.png) + +This is a simple square drawn on the PSP. It uses the native libgu library. Click on the details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c +#include +#include + +PSP_MODULE_INFO("gutest", 0, 1, 0); +PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU | THREAD_ATTR_USER); + +#define BUFFER_WIDTH 512 +#define BUFFER_HEIGHT 272 +#define SCREEN_WIDTH 480 +#define SCREEN_HEIGHT BUFFER_HEIGHT + +char list[0x20000] __attribute__((aligned(64))); + +void initGu(){ + sceGuInit(); + + //Set up buffers + sceGuStart(GU_DIRECT, list); + sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUFFER_WIDTH); + sceGuDispBuffer(SCREEN_WIDTH,SCREEN_HEIGHT,(void*)0x88000,BUFFER_WIDTH); + sceGuDepthBuffer((void*)0x110000,BUFFER_WIDTH); + + //Set up viewport + sceGuOffset(2048 - (SCREEN_WIDTH / 2), 2048 - (SCREEN_HEIGHT / 2)); + sceGuViewport(2048, 2048, SCREEN_WIDTH, SCREEN_HEIGHT); + sceGuEnable(GU_SCISSOR_TEST); + sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + //Set some stuff + sceGuDepthRange(65535, 0); //Use the full buffer for depth testing - buffer is reversed order + + sceGuDepthFunc(GU_GEQUAL); //Depth buffer is reversed, so GEQUAL instead of LEQUAL + sceGuEnable(GU_DEPTH_TEST); //Enable depth testing + + sceGuFinish(); + sceGuDisplay(GU_TRUE); +} + +void endGu(){ + sceGuDisplay(GU_FALSE); + sceGuTerm(); +} + +void startFrame(){ + sceGuStart(GU_DIRECT, list); + sceGuClearColor(0xFFFFFFFF); // White background + sceGuClear(GU_COLOR_BUFFER_BIT); +} + +void endFrame(){ + sceGuFinish(); + sceGuSync(0, 0); + sceDisplayWaitVblankStart(); + sceGuSwapBuffers(); +} + +typedef struct { + unsigned short u, v; + short x, y, z; +} Vertex; + +void drawRect(float x, float y, float w, float h) { + + Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(Vertex)); + + vertices[0].x = x; + vertices[0].y = y; + + vertices[1].x = y + w; + vertices[1].y = x + h; + + sceGuColor(0xFF0000FF); // Red, colors are ABGR + sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, 0, vertices); +} + + +int main() { + initGu(); + int running = 1; + while(running){ + startFrame(); + + drawRect(32, 32, 64, 64); + + endFrame(); + } + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(shape) + +add_executable(${PROJECT_NAME} main.c) + +target_link_libraries(${PROJECT_NAME} PRIVATE + pspgu + pspge + pspdisplay +) + +# Create an EBOOT.PBP file +create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} +) +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

+ +More libgu examples can be found here. + +
+ +## Controller +{: .fs-6 .fw-700 } + +![](images/controls.png) + +This is a simple program to use the PSP controller. Click on details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c +#include +#include +#include +#include +#include + +PSP_MODULE_INFO("Controller", 0, 1, 1); + +PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); + +#define printf pspDebugScreenPrintf + +int done = 0; + +int exit_callback(int arg1, int arg2, void *common) +{ + done = 1; + return 0; +} + +int callback_thread(SceSize args, void *argp) +{ + int cbid = sceKernelCreateCallback("Exit Callback", + exit_callback, NULL); + sceKernelRegisterExitCallback(cbid); + sceKernelSleepThreadCB(); + return 0; +} + +int setup_callbacks(void) +{ + int thid = sceKernelCreateThread("update_thread", + callback_thread, 0x11, 0xFA0, 0, 0); + + if(thid >= 0) + sceKernelStartThread(thid, 0, 0); + return thid; +} + +int main(void) +{ + SceCtrlData pad; + + pspDebugScreenInit(); + setup_callbacks(); + + sceCtrlSetSamplingCycle(0); + sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); + + while (!done) + { + pspDebugScreenSetXY(0, 2); + sceCtrlReadBufferPositive(&pad, 1); + + printf("Analog X = %d, ", pad.Lx); + printf("Analog Y = %d \n", pad.Ly); + + if (pad.Buttons != 0) + { + if (pad.Buttons & PSP_CTRL_SQUARE) + { + printf("Square pressed! \n"); + } + if (pad.Buttons & PSP_CTRL_TRIANGLE) + { + printf("Triangle pressed! \n"); + } + if (pad.Buttons & PSP_CTRL_CIRCLE) + { + printf("Circle pressed! \n"); + } + if (pad.Buttons & PSP_CTRL_CROSS) + { + printf("Cross pressed! \n"); + } + + if (pad.Buttons & PSP_CTRL_UP) + { + printf("Up direction pad pressed! \n"); + } + if (pad.Buttons & PSP_CTRL_DOWN) + { + printf("Down direction pad pressed! \n"); + } + if (pad.Buttons & PSP_CTRL_LEFT) + { + printf("Left direction pad pressed! \n"); + } + if (pad.Buttons & PSP_CTRL_RIGHT) + { + printf("Right direction pad pressed! \n"); + } + } + } + + sceKernelExitGame(); + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(controls) + +add_executable(${PROJECT_NAME} main.c) + +target_link_libraries(${PROJECT_NAME} PRIVATE + pspdebug + pspdisplay + pspge + pspctrl +) + +# Create an EBOOT.PBP file +create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} +) +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

+ +
+ +## Audio +{: .fs-6 .fw-700 } + +![](images/audio.png?raw=true) + +This is a simple program to use the audio of the PSP with minimal effort. It uses native audio library. Click on the details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +PSP_MODULE_INFO("audio", 0, 1, 1); +PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); + +#define printf pspDebugScreenPrintf + +/* Exit callback */ +int exitCallback(int arg1, int arg2, void *common) { + sceKernelExitGame(); + return 0; +} + +/* Callback thread */ +int callbackThread(SceSize args, void *argp) { + int cbid; + + cbid = sceKernelCreateCallback("Exit Callback", (void*) exitCallback, NULL); + sceKernelRegisterExitCallback(cbid); + sceKernelSleepThreadCB(); + + return 0; +} + +/* Sets up the callback thread and returns its thread id */ +int setupCallbacks(void) { + int thid = 0; + + thid = sceKernelCreateThread("update_thread", callbackThread, 0x11, 0xFA0, 0, 0); + if (thid >= 0) { + sceKernelStartThread(thid, 0, 0); + } + return thid; +} + +/* Main code */ + +const float PI = 3.1415926535897932f; +const int sampleRate = 44100; +float frequency = 440.0f; +float currentTime = 0; +int function = 0; + +typedef struct { + short l, r; +} sample_t; + +float currentFunction(const float time) { + double x; + float t = modf((time / (2 * PI)), &x); + + switch(function) { + case 0: // SINE + return sinf(time); + case 1: // SQUARE + if (t < 0.5f) { + return -0.2f; + } else { + return 0.2f; + } + case 2: // TRIANGLE + if (t < 0.5f) { + return (t * 2.0f) - 0.5f; + } else { + return 0.5f - (t - 0.5f) * 2.0f; + } + default: + return 0.0f; + } +} + +/* This function gets called by pspaudiolib every time the + audio buffer needs to be filled. The sample format is + 16-bit, stereo. */ +void audioCallback(void* buf, unsigned int length, void *userdata) { + const float sampleLength = 1.0f / sampleRate; + const float scaleFactor = SHRT_MAX - 1.0f; + static float freq0 = 440.0f; + sample_t* ubuf = (sample_t*) buf; + int i; + + if (frequency != freq0) { + currentTime *= (freq0 / frequency); + } + for (i = 0; i < length; i++) { + short s = (short) (scaleFactor * currentFunction(2.0f * PI * frequency * currentTime)); + ubuf[i].l = s; + ubuf[i].r = s; + currentTime += sampleLength; + } + if (currentTime * frequency > 1.0f) { + double d; + currentTime = modf(currentTime * frequency, &d) / frequency; + } + + freq0 = frequency; +} + +/* Read the analog stick and adjust the frequency */ +void controlFrequency(void) { + static int oldButtons = 0; + const int zones[6] = {30, 70, 100, 112, 125, 130}; + const float response[6] = {0.0f, 0.1f, 0.5f, 1.0f, 4.0f, 8.0f}; + const float minFreq = 32.0f; + const float maxFreq = 7040.0f; + SceCtrlData pad; + float direction; + int changedButtons; + int i, v; + + sceCtrlReadBufferPositive(&pad, 1); + + v = pad.Ly - 128; + if (v < 0) { + direction = 1.0f; + v = -v; + } else { + direction = -1.0f; + } + + for (i = 0; i < 6; i++) { + if (v < zones[i]) { + frequency += (response[i] * direction); + break; + } + } + + if (frequency < minFreq) { + frequency = minFreq; + } else if (frequency > maxFreq) { + frequency = maxFreq; + } + + changedButtons = pad.Buttons & (~oldButtons); + if (changedButtons & PSP_CTRL_CROSS) { + function++; + if (function > 2) { + function = 0; + } + } + + oldButtons = pad.Buttons; +} + +int main(void) { + pspDebugScreenInit(); + setupCallbacks(); + + pspAudioInit(); + pspAudioSetChannelCallback(0, audioCallback, NULL); + + sceCtrlSetSamplingCycle(0); + sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); + + printf("Press up and down to select frequency\nPress X to change function\n"); + + while(1) { + sceDisplayWaitVblankStart(); + pspDebugScreenSetXY(0,2); + printf("freq = %.2f \n", frequency); + + switch(function) { + case 0: + printf("SINE WAVE. \n"); + break; + case 1: + printf("SQUARE WAVE. \n"); + break; + case 2: + printf("TRIANGLE WAVE. \n"); + break; + } + + controlFrequency(); + } + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(audio) + +add_executable(${PROJECT_NAME} main.c) + +target_link_libraries(${PROJECT_NAME} PRIVATE + pspdebug + pspdisplay + pspge + pspctrl + pspaudio + pspaudiolib + psputility +) + +# Create an EBOOT.PBP file +create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} +) +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +

This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

+ +More audiolib examples can be found here. + +
+ +## Using SDL2 +{: .fs-6 .fw-700 } + +![](images/sdl2.png) + +SDL2 is a library which handles system specific things like input, audio and window management for you. It can also be used to render shapes and images, just like the native libgu. This will be slower, but will result in code that can be run more easily on multiple platforms. Click on details below for the to see the code and how to build it. + +
+ +View source + +**main.c** + +```c +#include ; + +int main(int argc, char *argv[]) +{ + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER); + + SDL_Window * window = SDL_CreateWindow( + "window", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + 480, + 272, + 0 + ); + + SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); + + SDL_Rect square = {216, 96, 34, 64}; + + int running = 1; + SDL_Event event; + while (running) { + if (SDL_PollEvent(&event)) { + switch (event.type) { + case SDL_QUIT: + running = 0; + break; + case SDL_CONTROLLERDEVICEADDED: + SDL_GameControllerOpen(event.cdevice.which); + break; + case SDL_CONTROLLERBUTTONDOWN: + if(event.cbutton.button == SDL_CONTROLLER_BUTTON_START) + running = 0; + break; + } + } + + // Clear the screen + SDL_RenderClear(renderer); + + // Draw a red square + SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); + SDL_RenderFillRect(renderer, &square); + + // Draw everything on a white background + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDL_RenderPresent(renderer); + } + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(square) + +add_executable(${PROJECT_NAME} main.c) + +find_package(SDL2 REQUIRED) + +target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS}) + +target_link_libraries(${PROJECT_NAME} PRIVATE + ${SDL2_LIBRARIES} +) + +if(PSP) + create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} + ) +endif() +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +

This will result in an EBOOT.PBP` file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it.

+ +If you have sdl2 dev package and a compiler installed this code will also build on Linux for Linux by running: + +```shell +mkdir build && cd build +cmake .. +make +``` + +More documentation on SDL can be found here. + +
+ +## Using SDL2 mixer +{: .fs-6 .fw-700 } + +![](images/sdl2_mixer.png) + +This is a simple program to use the SDL2_mixer library. Click on details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c +#include +#include + +// Define MIN macro +#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) + +// Define screen dimensions +#define SCREEN_WIDTH 480 +#define SCREEN_HEIGHT 272 + +// audio file path +#define MUSIC_PATH "ms0:/MUSIC/test.ogg" // ogg/mp3 file format + +int main(int argc, char **argv) { + (void)argc; + (void)argv; + + // Initialize sdl + SDL_Init(SDL_INIT_VIDEO | + SDL_INIT_AUDIO | + SDL_INIT_GAMECONTROLLER + ); + + // Initialize sdl2_mixer + Mix_OpenAudio(44100, + MIX_DEFAULT_FORMAT, + MIX_DEFAULT_CHANNELS, + 2048 + ); + + // create window + SDL_Window *win = SDL_CreateWindow( + "psp_win", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + SCREEN_WIDTH, + SCREEN_HEIGHT, + 0 + ); + + // Create Renderer + SDL_Renderer *renderer = SDL_CreateRenderer( + win, -1, 0 + ); + + // Load ogg file + Mix_Music *ogg_file = NULL; + ogg_file = Mix_LoadMUS(MUSIC_PATH); + if (!ogg_file) { + return 0; + } + + SDL_Rect rect; + + // Square dimensions: Half of the min(SCREEN_WIDTH, SCREEN_HEIGHT) + rect.w = MIN(SCREEN_WIDTH, SCREEN_HEIGHT) / 2; + rect.h = MIN(SCREEN_WIDTH, SCREEN_HEIGHT) / 2; + + // Square position: In the middle of the screen + rect.x = SCREEN_WIDTH / 2 - rect.w / 2; + rect.y = SCREEN_HEIGHT / 2 - rect.h / 2; + + + // Declare rects of pause symbol + SDL_Rect pause_rect1, pause_rect2; + + pause_rect1.h = rect.h / 2; + pause_rect1.w = 40; + pause_rect1.x = rect.x + (rect.w - pause_rect1.w * 3) / 2; + pause_rect1.y = rect.y + rect.h / 4; + pause_rect2 = pause_rect1; + pause_rect2.x += pause_rect1.w * 2; + + // play the music 8 times + if (Mix_PlayMusic(ogg_file, 8) == -1) { + return 0; + } + + int running = 1; + SDL_Event e; + while (running) { + if(SDL_PollEvent(&e)) { + switch(e.type) { + case SDL_QUIT: + running = 0; + break; + case SDL_CONTROLLERDEVICEADDED: + SDL_GameControllerOpen(e.cdevice.which); + break; + case SDL_CONTROLLERBUTTONDOWN: + // pause using cross button + if (e.cbutton.button == SDL_CONTROLLER_BUTTON_A) { + Mix_PauseMusic(); + // resume using circle button + } else if (e.cbutton.button == SDL_CONTROLLER_BUTTON_B) { + Mix_ResumeMusic(); + } + // press start button to exit + if (e.cbutton.button == SDL_CONTROLLER_BUTTON_START) { + running = 0; + } + break; + } + } + + // Initialize renderer color black for the background + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); + + // Clear screen + SDL_RenderClear(renderer); + + // Set renderer color green to draw the square + SDL_SetRenderDrawColor(renderer, 0, 0xFF, 0, 0xFF); + + // Draw filled square + SDL_RenderFillRect(renderer, &rect); + + // Check pause status + if(Mix_PausedMusic()) { + // Set renderer color black to draw the pause symbol + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); + + // Draw pause symbol + SDL_RenderFillRect(renderer, &pause_rect1); + SDL_RenderFillRect(renderer, &pause_rect2); + } + + // Update screen + SDL_RenderPresent(renderer); + } + + Mix_FreeMusic(ogg_file); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(win); + Mix_CloseAudio(); + SDL_Quit(); + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(sdl2_mixer) + +add_executable(${PROJECT_NAME} main.c) + +find_package(SDL2 REQUIRED) + +target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS}) + +target_link_libraries(${PROJECT_NAME} PRIVATE + ${SDL2_LIBRARIES} +) + +if(PSP) + target_link_libraries(${PROJECT_NAME} PRIVATE + SDL2_mixer + SDL2 + vorbisfile + vorbis + ogg + xmp + ) + create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} + ) +endif() +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and you need an audio file to test the program, download it from here. Put it in a directory in ms0:/MUSIC/ and then rename the audio file same as name on your *MUSIC_PATH* macro in your C code and the PSP can run it. + +
+ +## Using SDL2 ttf +{: .fs-6 .fw-700 } + +![](/images/sdl2_ttf.jpg) + +This is a simple program to use the SDL2_ttf library. Click on details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c +#include + +#include +#include + +// Define screen dimensions +#define SCREEN_WIDTH 480 +#define SCREEN_HEIGHT 272 + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + + // Initialize SDL2 + if (SDL_Init(SDL_INIT_VIDEO) < 0) + { + printf("SDL2 could not be initialized!\n" + "SDL2 Error: %s\n", + SDL_GetError()); + return 0; + } + + // Initialize SDL2_ttf + if (TTF_Init() < 0) + { + printf("SDL2_ttf could not be initialized!\n" + "SDL2_ttf Error: %s\n", + SDL_GetError()); + return 0; + } + + SDL_Window *win = SDL_CreateWindow( + "window", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + SCREEN_WIDTH, + SCREEN_HEIGHT, + 0); + + if (!win) + { + printf("Window could not be created!\n" + "SDL_Error: %s\n", + SDL_GetError()); + } + + SDL_Renderer *renderer = SDL_CreateRenderer(win, -1, 0); + TTF_Font *font = TTF_OpenFont("Pacifico.ttf", 40); + + // Set the text and background color + SDL_Color text_color = {0xff, 0xff, 0xff, 0xff}; + SDL_Color bg_color = {0x00, 0x00, 0x00, 0xff}; + + SDL_Rect text_rect; + SDL_Surface *surface = TTF_RenderText(font, "Hello World!", text_color, bg_color); + SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface); + + // Get text dimensions + text_rect.w = surface->w; + text_rect.h = surface->h; + + SDL_FreeSurface(surface); + + text_rect.x = (SCREEN_WIDTH - text_rect.w) / 2; + text_rect.y = text_rect.h + 30; + + int running = 1; + SDL_Event e; + while (running) + { + if (SDL_PollEvent(&e)) + { + switch (e.type) + { + case SDL_QUIT: + running = 0; + break; + case SDL_CONTROLLERDEVICEADDED: + SDL_GameControllerOpen(e.cdevice.which); + break; + case SDL_CONTROLLERBUTTONDOWN: + if (e.cbutton.button == SDL_CONTROLLER_BUTTON_START) + { + running = 0; + } + break; + } + } + + SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 0xff); + SDL_RenderClear(renderer); + SDL_SetRenderDrawColor(renderer, 0xff, 0x00, 0x00, 0xff); + SDL_RenderCopy(renderer, texture, NULL, &text_rect); + SDL_RenderPresent(renderer); + } + + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(win); + TTF_Quit(); + SDL_Quit(); + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(text-ttf) + +add_executable(${PROJECT_NAME} main.c) + +find_package(SDL2 REQUIRED) + +target_include_directories(${PROJECT_NAME} + PRIVATE ${SDL2_INCLUDE_DIRS} +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + ${SDL2_LIBRARIES} +) + +if(PSP) + target_link_libraries(${PROJECT_NAME} PRIVATE + SDL2_ttf + freetype + m + bz2 + png16 + z + ) + create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} + ) +endif() +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and you need a font file to test the program, download it from here. Put it in a directory same as EBOOT.PBP and the PSP can run it. + +
+ +# Tips and Tricks +{: .fs-8 .fw-700 } + +Here some useful tips for developing for the PSP. + +## Making Programs Work on Unmodded PSPs +{: .fs-6 .fw-700 } + +The PSPDEV toolchain contains tools for making your program work on unmodded PSPs. This can be done by running psp-cmake with some additional commands when building like so: + +```shell +mkdir build && cd build +psp-cmake -DBUILD_PRX=1 -DENC_PRX=1 .. +make +``` + +This does require `create_pbp_file` to be used in your CMakeLists.txt file. After the first build, running `make` is enough to get an `EBOOT.PBP` file which works on official firmware with any new changes made to the code. + +## Add PSP Specific Code to a Multi-Platform Programs +{: .fs-6 .fw-700 } + +When porting a game to the PSP, some PSP specific code might be needed. To make this code only apply to PSP, it is possible to use a simple ifdef statements which checks for `__PSP__` like so: + +```c +#ifdef __PSP__ + // Do PSP specific thing +#else + // Do the thing all other systems should do +#endif +``` + +This makes sure that the other systems supported by the program keeps working the same, while still making it possible to add support for the PSP. + +## More Libraries +{: .fs-6 .fw-700 } + +There are many C and C++ libraries available within the PSPDEV toolchain which can add functionality to your program. Some examples: + +- Audio formats: mp3, ogg +- Image formats: png, jpeg +- Data formats: json, yaml, sqlite +- Support for compression, physics, fonts and much more + + +For the full list take a look at the [psp-packages repository](https://github.com/pspdev/psp-packages) or run `psp-pacman -Syl`. Updating libraries can be done with `psp-pacman -Syu`. diff --git a/documentation.md b/documentation.md index 7982a34..828013c 100644 --- a/documentation.md +++ b/documentation.md @@ -1,3 +1,8 @@ +--- +title: Documentation +nav_order: 5 +--- + PSPDEV is made out of several components. Here is a (non-exhaustive) list of links to the documentation available for them: diff --git a/downloads.md b/downloads.md new file mode 100644 index 0000000..03712f3 --- /dev/null +++ b/downloads.md @@ -0,0 +1,13 @@ +--- +title: Downloads +nav_order: 2 +--- + +# Downloads +{: .fs-8 .fw-700 .text-center } + +- Source code: + - PSPDEV: [Download](https://github.com/pspdev/pspdev/releases/tag/latest) + +- Docker image: + - PSPSDK: [Download](https://github.com/pspdev/pspsdk/pkgs/container/pspsdk) \ No newline at end of file diff --git a/index.md b/index.md new file mode 100644 index 0000000..2ef5fb8 --- /dev/null +++ b/index.md @@ -0,0 +1,18 @@ +--- +title: Home +nav_order: 1 +--- + +# Welcome to PSPDEV +{: .fs-8 .fw-700 .text-center } + + +PSPDEV is an open source toolchain for Playstation Portable development. It allows you to make apps and games for both custom and official firmwares. This is a community project made by enthusiasts, it is in no way affiliated with Sony. +{: .fs-5 .text-center } + +# Contact Us +{: .fs-6 .fw-700 } + + +If you need help or would like to contribute, don't hesitate to join us on [Discord](https://discord.gg/bePrj9W) or open an issue on [GitHub](https://github.com/pspdev/pspdev/issues). See you there! +{: .fs-5 } \ No newline at end of file diff --git a/quickstart.md b/quickstart.md new file mode 100644 index 0000000..be9227f --- /dev/null +++ b/quickstart.md @@ -0,0 +1,172 @@ +--- +title: Quickstart +nav_order: 3 +--- + +# Quickstart +{: .fs-10 .fw-700 .text-center } + +## Installing the toolchain +{: .fs-8 .fw-700 } + +### dependencies +{: .fs-6 .fw-700 } + +The PSPDEV toolchain requires a couple of dependencies to be installed before use. + +#### Windows(WSL) +{: .fs-4 .fw-700 } + +On Windows it is advised to use Ubuntu on Microsoft's WSL system. To set it up run the following commands in a Powershell window started as administrator: + +```powershell +wsl --install +``` + +Now run bash and run the following commands to install the dependencies: + +```shell +sudo apt-get update +sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot +``` + +Going forwards, all commands will be run within bash. The filesystem of your Ubuntu installation can be accessed by opening the network location `\\wsl$`. + +#### Ubuntu +{: .fs-4 .fw-700 } + +On Ubuntu run the following commands to install the dependencies: + +```shell +sudo apt-get update +sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot +``` + +#### MacOS +{: .fs-4 .fw-700 } + +On MacOS make sure to install [Brew](https://brew.sh/) first, then run the following commands to install the dependencies: + +```shell +brew install cmake pkgconf gnu-sed bash openssl libtool libarchive gettext texinfo bison flex isl gsl gmp mpfr +``` + + +### Toolchain +{: .fs-6 .fw-700 } + +To install the PSPDEV toolchain, first [download the latest version](https://github.com/pspdev/pspdev/releases/tag/latest) for your system. Extract it into your user's home directory, which would be `\\wsl$\home\username` on Windows, otherwise `~`. If you're on Windows, pick the Ubuntu build. + +Now set the required environment variables. On Mac edit the ``~/.zprofile`` on Linux/WSL the ``~/.bashrc`` file. Add the following at the bottom: + +```shell +export PSPDEV=~/pspdev +export PATH=$PATH:$PSPDEV/bin +``` + +This can simply be done with `nano ~/.bashrc` (`~/.zprofile` on Mac). To save press `Ctrl`+`X`, then press `Y`, then enter/return twice. After that run `source ~/.bashrc` to apply the changes. + +On MacOS, run `sudo xattr -rd com.apple.quarantine $PSPDEV` to prevent Gatekeeper from blocking the toolchain. + +That's it, now the PSPDEV toolchain can be used to build PSP software. Below is the sample code and how to run it. For testing on real hardware, check out [psplink](https://pspdev.github.io/psplinkusb/). + +## Coding +{: .fs-8 .fw-700 } + +### Hello world +{: .fs-6 .fw-700 } + +![](images/hello.png?raw=true) + + +This is a simple Hello World program for the PSP. Click on the details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c + +#include +#include +#include + +// PSP_MODULE_INFO is required +PSP_MODULE_INFO("Hello World", 0, 1, 0); +PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); + +int exit_callback(int arg1, int arg2, void *common) { + sceKernelExitGame(); + return 0; +} + +int callback_thread(SceSize args, void *argp) { + int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); + sceKernelRegisterExitCallback(cbid); + sceKernelSleepThreadCB(); + return 0; +} + +int setup_callbacks(void) { + int thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0); + if(thid >= 0) + sceKernelStartThread(thid, 0, 0); + return thid; +} + +int main(void) { + // Use above functions to make exiting possible + setup_callbacks(); + + // Print Hello World! on a debug screen on a loop + pspDebugScreenInit(); + while(1) { + pspDebugScreenSetXY(0, 0); + pspDebugScreenPrintf("Hello World!"); + sceDisplayWaitVblankStart(); + } + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(hello) + +add_executable(${PROJECT_NAME} main.c) + +target_link_libraries(${PROJECT_NAME} PRIVATE + pspdebug + pspdisplay + pspge +) + +# Create an EBOOT.PBP file +create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} +) +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it. + +
+ +More code samples can be found [here](/basic_programs.md). diff --git a/tools/index.md b/tools/index.md new file mode 100644 index 0000000..5874b02 --- /dev/null +++ b/tools/index.md @@ -0,0 +1,7 @@ +--- +title: Tools +has_children: true +has_toc: false +--- + +# Under construction, sorry for inconvenience. \ No newline at end of file From 41aa2a4efbc11f8902f233bd113436b5c06b0d60 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 18:58:46 +0800 Subject: [PATCH 02/27] remove Gemfile lock --- .gitignore | 2 +- Gemfile.lock | 281 --------------------------------------------------- 2 files changed, 1 insertion(+), 282 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 1d98308..3a65dd9 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,7 @@ build-iPhoneSimulator/ # for a library or gem, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock +Gemfile.lock # .ruby-version # .ruby-gemset diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index e61f36a..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,281 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (7.1.3) - base64 - bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) - connection_pool (>= 2.2.5) - drb - i18n (>= 1.6, < 2) - minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - base64 (0.2.0) - bigdecimal (3.1.6) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - colorator (1.1.0) - commonmarker (0.23.10) - concurrent-ruby (1.2.3) - connection_pool (2.4.1) - dnsruby (1.70.0) - simpleidn (~> 0.2.1) - drb (2.2.0) - ruby2_keywords - em-websocket (0.5.3) - eventmachine (>= 0.12.9) - http_parser.rb (~> 0) - ethon (0.16.0) - ffi (>= 1.15.0) - eventmachine (1.2.7) - execjs (2.9.1) - faraday (2.9.0) - faraday-net_http (>= 2.0, < 3.2) - faraday-net_http (3.1.0) - net-http - ffi (1.16.3-x64-mingw-ucrt) - forwardable-extended (2.6.0) - gemoji (4.1.0) - github-pages (230) - github-pages-health-check (= 1.18.2) - jekyll (= 3.9.5) - jekyll-avatar (= 0.8.0) - jekyll-coffeescript (= 1.2.2) - jekyll-commonmark-ghpages (= 0.4.0) - jekyll-default-layout (= 0.1.5) - jekyll-feed (= 0.17.0) - jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.16.1) - jekyll-include-cache (= 0.2.1) - jekyll-mentions (= 1.6.0) - jekyll-optional-front-matter (= 0.3.2) - jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.3.0) - jekyll-redirect-from (= 0.16.0) - jekyll-relative-links (= 0.7.0) - jekyll-remote-theme (= 0.4.3) - jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.8.0) - jekyll-sitemap (= 1.4.0) - jekyll-swiss (= 1.0.0) - jekyll-theme-architect (= 0.2.0) - jekyll-theme-cayman (= 0.2.0) - jekyll-theme-dinky (= 0.2.0) - jekyll-theme-hacker (= 0.2.0) - jekyll-theme-leap-day (= 0.2.0) - jekyll-theme-merlot (= 0.2.0) - jekyll-theme-midnight (= 0.2.0) - jekyll-theme-minimal (= 0.2.0) - jekyll-theme-modernist (= 0.2.0) - jekyll-theme-primer (= 0.6.0) - jekyll-theme-slate (= 0.2.0) - jekyll-theme-tactile (= 0.2.0) - jekyll-theme-time-machine (= 0.2.0) - jekyll-titles-from-headings (= 0.5.3) - jemoji (= 0.13.0) - kramdown (= 2.4.0) - kramdown-parser-gfm (= 1.1.0) - liquid (= 4.0.4) - mercenary (~> 0.3) - minima (= 2.5.1) - nokogiri (>= 1.13.6, < 2.0) - rouge (= 3.30.0) - terminal-table (~> 1.4) - github-pages-health-check (1.18.2) - addressable (~> 2.3) - dnsruby (~> 1.60) - octokit (>= 4, < 8) - public_suffix (>= 3.0, < 6.0) - typhoeus (~> 1.3) - html-pipeline (2.14.3) - activesupport (>= 2) - nokogiri (>= 1.4) - http_parser.rb (0.8.0) - i18n (1.14.1) - concurrent-ruby (~> 1.0) - jekyll (3.9.5) - addressable (~> 2.4) - colorator (~> 1.0) - em-websocket (~> 0.5) - i18n (>= 0.7, < 2) - jekyll-sass-converter (~> 1.0) - jekyll-watch (~> 2.0) - kramdown (>= 1.17, < 3) - liquid (~> 4.0) - mercenary (~> 0.3.3) - pathutil (~> 0.9) - rouge (>= 1.7, < 4) - safe_yaml (~> 1.0) - jekyll-avatar (0.8.0) - jekyll (>= 3.0, < 5.0) - jekyll-coffeescript (1.2.2) - coffee-script (~> 2.2) - coffee-script-source (~> 1.12) - jekyll-commonmark (1.4.0) - commonmarker (~> 0.22) - jekyll-commonmark-ghpages (0.4.0) - commonmarker (~> 0.23.7) - jekyll (~> 3.9.0) - jekyll-commonmark (~> 1.4.0) - rouge (>= 2.0, < 5.0) - jekyll-default-layout (0.1.5) - jekyll (>= 3.0, < 5.0) - jekyll-feed (0.17.0) - jekyll (>= 3.7, < 5.0) - jekyll-gist (1.5.0) - octokit (~> 4.2) - jekyll-github-metadata (2.16.1) - jekyll (>= 3.4, < 5.0) - octokit (>= 4, < 7, != 4.4.0) - jekyll-include-cache (0.2.1) - jekyll (>= 3.7, < 5.0) - jekyll-mentions (1.6.0) - html-pipeline (~> 2.3) - jekyll (>= 3.7, < 5.0) - jekyll-optional-front-matter (0.3.2) - jekyll (>= 3.0, < 5.0) - jekyll-paginate (1.1.0) - jekyll-readme-index (0.3.0) - jekyll (>= 3.0, < 5.0) - jekyll-redirect-from (0.16.0) - jekyll (>= 3.3, < 5.0) - jekyll-relative-links (0.7.0) - jekyll (>= 3.3, < 5.0) - jekyll-remote-theme (0.4.3) - addressable (~> 2.0) - jekyll (>= 3.5, < 5.0) - jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) - rubyzip (>= 1.3.0, < 3.0) - jekyll-sass-converter (1.5.2) - sass (~> 3.4) - jekyll-seo-tag (2.8.0) - jekyll (>= 3.8, < 5.0) - jekyll-sitemap (1.4.0) - jekyll (>= 3.7, < 5.0) - jekyll-swiss (1.0.0) - jekyll-theme-architect (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.6.0) - jekyll (> 3.5, < 5.0) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.0) - jekyll-theme-slate (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.3) - jekyll (>= 3.3, < 5.0) - jekyll-watch (2.2.1) - listen (~> 3.0) - jemoji (0.13.0) - gemoji (>= 3, < 5) - html-pipeline (~> 2.2) - jekyll (>= 3.0, < 5.0) - just-the-docs (0.7.0) - jekyll (>= 3.8.5) - jekyll-include-cache - jekyll-seo-tag (>= 2.0) - rake (>= 12.3.1) - kramdown (2.4.0) - rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) - liquid (4.0.4) - listen (3.8.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) - mercenary (0.3.6) - minima (2.5.1) - jekyll (>= 3.5, < 5.0) - jekyll-feed (~> 0.9) - jekyll-seo-tag (~> 2.1) - minitest (5.22.2) - mutex_m (0.2.0) - net-http (0.4.1) - uri - nokogiri (1.16.2-x64-mingw-ucrt) - racc (~> 1.4) - octokit (4.25.1) - faraday (>= 1, < 3) - sawyer (~> 0.9) - pathutil (0.16.2) - forwardable-extended (~> 2.6) - public_suffix (5.0.4) - racc (1.7.3) - rake (13.1.0) - rb-fsevent (0.11.2) - rb-inotify (0.10.1) - ffi (~> 1.0) - rexml (3.2.6) - rouge (3.30.0) - ruby2_keywords (0.0.5) - rubyzip (2.3.2) - safe_yaml (1.0.5) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) - simpleidn (0.2.1) - unf (~> 0.1.4) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - typhoeus (1.4.1) - ethon (>= 0.9.0) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1-x64-mingw-ucrt) - unicode-display_width (1.8.0) - uri (0.13.0) - webrick (1.8.1) - -PLATFORMS - x64-mingw-ucrt - -DEPENDENCIES - github-pages - just-the-docs - webrick - -BUNDLED WITH - 2.5.6 From f221aea18835b22b0b330bd6f93d1c1f4a7c0a83 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:03:36 +0800 Subject: [PATCH 03/27] add remote theme --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index 0482c48..ad040e0 100644 --- a/_config.yml +++ b/_config.yml @@ -4,6 +4,7 @@ github_username: pspdev theme: just-the-docs # just-the-docs configuration +remote_theme: just-the-docs/just-the-docs favicon_ico: /images/pspdev.ico color_scheme: dark From e8c65a041ae025122e7e0199e078dc066a061bb1 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:09:44 +0800 Subject: [PATCH 04/27] add jtd urls --- _config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index ad040e0..52421d5 100644 --- a/_config.yml +++ b/_config.yml @@ -4,7 +4,10 @@ github_username: pspdev theme: just-the-docs # just-the-docs configuration -remote_theme: just-the-docs/just-the-docs +url: https://just-the-docs.github.io +aux_links: + Template Repository: https://github.com/just-the-docs/just-the-docs-template + favicon_ico: /images/pspdev.ico color_scheme: dark From dac01be98598c574f78a32f39a58648b25d2beca Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:12:04 +0800 Subject: [PATCH 05/27] no exclude --- _config.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/_config.yml b/_config.yml index 52421d5..14e53bc 100644 --- a/_config.yml +++ b/_config.yml @@ -11,7 +11,3 @@ aux_links: favicon_ico: /images/pspdev.ico color_scheme: dark - -exclude: - - Gemfile.lock - - README.md From 3ad41501b8e2c9bb23839e3c71d2d668836f97e7 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:13:51 +0800 Subject: [PATCH 06/27] empty baseurl --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index 14e53bc..7e6fcdf 100644 --- a/_config.yml +++ b/_config.yml @@ -4,6 +4,7 @@ github_username: pspdev theme: just-the-docs # just-the-docs configuration +baseurl: "" url: https://just-the-docs.github.io aux_links: Template Repository: https://github.com/just-the-docs/just-the-docs-template From 767fcc59d06d2b2421c9e5bcebefb0c500c87c6d Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:20:34 +0800 Subject: [PATCH 07/27] Update _config.yml --- _config.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/_config.yml b/_config.yml index 7e6fcdf..728322f 100644 --- a/_config.yml +++ b/_config.yml @@ -1,14 +1,9 @@ title: PSPDEV description: "Development tools for the Playstation Portable" -github_username: pspdev +#github_username: pspdev theme: just-the-docs # just-the-docs configuration -baseurl: "" -url: https://just-the-docs.github.io -aux_links: - Template Repository: https://github.com/just-the-docs/just-the-docs-template - favicon_ico: /images/pspdev.ico color_scheme: dark From ec897aaf43dfffa7266902ee26ea0f6b2012fd48 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:22:46 +0800 Subject: [PATCH 08/27] add jekyll gem --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 2d98ba2..7b34cb7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source "https://rubygems.org" #gem "github-pages", group: :jekyll_plugins #gem "webrick" +gem "jekyll" gem "just-the-docs" \ No newline at end of file From 25038e6c37c1cca45ef8ec53a8ba0488eb71d21c Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:28:22 +0800 Subject: [PATCH 09/27] Update Gemfile --- Gemfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 7b34cb7..d526ffb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -#gem "github-pages", group: :jekyll_plugins -#gem "webrick" -gem "jekyll" -gem "just-the-docs" \ No newline at end of file +gem "jekyll", "~> 4.3.3" # installed by `gem jekyll` +# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2 + +gem "just-the-docs", "0.7.0" # pinned to the current release +# gem "just-the-docs" # always download the latest release \ No newline at end of file From ce58075e67010af065ea4fbf839222150974d2e6 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:33:25 +0800 Subject: [PATCH 10/27] Update index.md --- index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/index.md b/index.md index 2ef5fb8..09c5f05 100644 --- a/index.md +++ b/index.md @@ -1,5 +1,6 @@ --- title: Home +layout: home nav_order: 1 --- From c6e75e37f0b7f26f4d47b9fc34996ffe99b982ce Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:36:41 +0800 Subject: [PATCH 11/27] add layout every page --- basic_programs.md | 1 + documentation.md | 1 + downloads.md | 1 + quickstart.md | 1 + tools/index.md | 1 + 5 files changed, 5 insertions(+) diff --git a/basic_programs.md b/basic_programs.md index 68dc205..bb94e47 100644 --- a/basic_programs.md +++ b/basic_programs.md @@ -1,5 +1,6 @@ --- title: Basic programs +layout: home nav_order: 4 --- diff --git a/documentation.md b/documentation.md index 828013c..2ffb5cf 100644 --- a/documentation.md +++ b/documentation.md @@ -1,5 +1,6 @@ --- title: Documentation +layout: home nav_order: 5 --- diff --git a/downloads.md b/downloads.md index 03712f3..b6099f4 100644 --- a/downloads.md +++ b/downloads.md @@ -1,5 +1,6 @@ --- title: Downloads +layout: home nav_order: 2 --- diff --git a/quickstart.md b/quickstart.md index be9227f..0cafe2f 100644 --- a/quickstart.md +++ b/quickstart.md @@ -1,5 +1,6 @@ --- title: Quickstart +layout: home nav_order: 3 --- diff --git a/tools/index.md b/tools/index.md index 5874b02..6a89173 100644 --- a/tools/index.md +++ b/tools/index.md @@ -1,5 +1,6 @@ --- title: Tools +layout: home has_children: true has_toc: false --- From 762b61907929e53964e6125a0ee566946da57082 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 19:57:39 +0800 Subject: [PATCH 12/27] add readme instruction --- Gemfile | 9 +++++---- README.md | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index d526ffb..75e82d1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,8 @@ source 'https://rubygems.org' -gem "jekyll", "~> 4.3.3" # installed by `gem jekyll` -# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2 +gem "jekyll" +gem "just-the-docs" -gem "just-the-docs", "0.7.0" # pinned to the current release -# gem "just-the-docs" # always download the latest release \ No newline at end of file +# build locally +# gem "webrick" +# gem "github-pages" \ No newline at end of file diff --git a/README.md b/README.md index 1986c6c..8ec9374 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # PSPDEV website +Main repo of the PSPDEV website + +## Build locally + +Go here https://jekyllrb.com/docs/installation/ to install all +requirements to build the website locally + +> [!Note] +> Disable comment first the `webrick` and `github-pages` gems in Gemfile so you can build the +webpage on your computer. + +Run the command to install all gems: + +```shell +bundle +``` + +To access on your browser, run this: +```shell +bundle exec jekyll serve +``` + +> [!Tip] +> You can access the website to `http://localhost:4000` \ No newline at end of file From 2e9b7d582c3586261f2ce7298f3a508b4d51cf76 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 20:00:44 +0800 Subject: [PATCH 13/27] Update quickstart.md --- quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart.md b/quickstart.md index 0cafe2f..e3ea111 100644 --- a/quickstart.md +++ b/quickstart.md @@ -170,4 +170,4 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct -More code samples can be found [here](/basic_programs.md). +More code samples can be found [here](pspdev.github.io/basic_programs.md). From 46e0ceb6588ef89e067c6e400ea46cc85677eef4 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 20:03:29 +0800 Subject: [PATCH 14/27] Update quickstart.md --- quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart.md b/quickstart.md index e3ea111..73eb45d 100644 --- a/quickstart.md +++ b/quickstart.md @@ -170,4 +170,4 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct -More code samples can be found [here](pspdev.github.io/basic_programs.md). +More code samples can be found [here](basic_programs.md). From 06119c69105ef3c67465c7c0e7437e6143e14dd2 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 20:05:05 +0800 Subject: [PATCH 15/27] use html in link --- quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart.md b/quickstart.md index 73eb45d..a4d5b16 100644 --- a/quickstart.md +++ b/quickstart.md @@ -170,4 +170,4 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct -More code samples can be found [here](basic_programs.md). +More code samples can be found [here](basic_programs.html). From 80ea47f43b3fdd224cdf3bf9179fbf1f8174f529 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Wed, 14 Feb 2024 21:05:00 +0800 Subject: [PATCH 16/27] fix sdl2_ttf image link --- basic_programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basic_programs.md b/basic_programs.md index bb94e47..e8201a3 100644 --- a/basic_programs.md +++ b/basic_programs.md @@ -873,7 +873,7 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct ## Using SDL2 ttf {: .fs-6 .fw-700 } -![](/images/sdl2_ttf.jpg) +![](images/sdl2_ttf.jpg) This is a simple program to use the SDL2_ttf library. Click on details below to see the code and how to build it. From 70b5cbb3eafd219ea80686e8489c1287c93ef039 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:20:04 +0800 Subject: [PATCH 17/27] exclude README and gemfile lock --- _config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index 728322f..88e1b9e 100644 --- a/_config.yml +++ b/_config.yml @@ -1,9 +1,11 @@ title: PSPDEV description: "Development tools for the Playstation Portable" -#github_username: pspdev theme: just-the-docs # just-the-docs configuration favicon_ico: /images/pspdev.ico - color_scheme: dark + +exclude: + - README.md + - Gemfile.lock From bcf68f2da266e8758160c5b3c2dbca1ccc9b561c Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:23:44 +0800 Subject: [PATCH 18/27] move tips tricks to nav & improve sample description --- basic_programs.md | 173 +++++++++++++++++++++++++++++++--------------- 1 file changed, 118 insertions(+), 55 deletions(-) diff --git a/basic_programs.md b/basic_programs.md index e8201a3..f5e82a3 100644 --- a/basic_programs.md +++ b/basic_programs.md @@ -1,18 +1,117 @@ --- -title: Basic programs +title: Basic Programs layout: home -nav_order: 4 +nav_order: 3 --- -# Basic programs +# Basic Programs {: .fs-8 .fw-700 .text-center } +## Hello world +{: .fs-6 .fw-700 } + +![](images/hello.png?raw=true) + +> This is a simple Hello World program for the PSP. + +Click on the details below to see the code and how to build it. + +
+ +View source + +**main.c** + +```c + +#include +#include +#include + +// PSP_MODULE_INFO is required +PSP_MODULE_INFO("Hello World", 0, 1, 0); +PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); + +int exit_callback(int arg1, int arg2, void *common) { + sceKernelExitGame(); + return 0; +} + +int callback_thread(SceSize args, void *argp) { + int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); + sceKernelRegisterExitCallback(cbid); + sceKernelSleepThreadCB(); + return 0; +} + +int setup_callbacks(void) { + int thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0); + if(thid >= 0) + sceKernelStartThread(thid, 0, 0); + return thid; +} + +int main(void) { + // Use above functions to make exiting possible + setup_callbacks(); + + // Print Hello World! on a debug screen on a loop + pspDebugScreenInit(); + while(1) { + pspDebugScreenSetXY(0, 0); + pspDebugScreenPrintf("Hello World!"); + sceDisplayWaitVblankStart(); + } + + return 0; +} +``` + +**CMakeLists.txt** + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(hello) + +add_executable(${PROJECT_NAME} main.c) + +target_link_libraries(${PROJECT_NAME} PRIVATE + pspdebug + pspdisplay + pspge +) + +# Create an EBOOT.PBP file +create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} +) +``` + +Building can be done with: + +```shell +mkdir build && cd build +psp-cmake .. +make +``` + +This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and the PSP can run it. + +
+ ## Drawing shapes {: .fs-6 .fw-700 } ![](images/shape.png) -This is a simple square drawn on the PSP. It uses the native libgu library. Click on the details below to see the code and how to build it. +> This is a simple square drawn on the PSP. It uses the native libgu library. + +Click on the details below to see the code and how to build it.
@@ -156,7 +255,9 @@ More libgu examples can be found @@ -308,7 +409,9 @@ make ![](images/audio.png?raw=true) -This is a simple program to use the audio of the PSP with minimal effort. It uses native audio library. Click on the details below to see the code and how to build it. +> This is a simple program to use the audio of the PSP with minimal effort. It uses native audio library. + +Click on the details below to see the code and how to build it.
@@ -555,7 +658,9 @@ More audiolib examples can be found @@ -672,7 +777,9 @@ More documentation on SDL can be found @@ -875,7 +982,9 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct ![](images/sdl2_ttf.jpg) -This is a simple program to use the SDL2_ttf library. Click on details below to see the code and how to build it. +> This is a simple program to use the SDL2_ttf library. It provides functionality for rendering TrueType fonts for your PSP. + +Click on details below to see the code and how to build it.
@@ -1039,49 +1148,3 @@ make This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and you need a font file to test the program, download it from here. Put it in a directory same as EBOOT.PBP and the PSP can run it.
- -# Tips and Tricks -{: .fs-8 .fw-700 } - -Here some useful tips for developing for the PSP. - -## Making Programs Work on Unmodded PSPs -{: .fs-6 .fw-700 } - -The PSPDEV toolchain contains tools for making your program work on unmodded PSPs. This can be done by running psp-cmake with some additional commands when building like so: - -```shell -mkdir build && cd build -psp-cmake -DBUILD_PRX=1 -DENC_PRX=1 .. -make -``` - -This does require `create_pbp_file` to be used in your CMakeLists.txt file. After the first build, running `make` is enough to get an `EBOOT.PBP` file which works on official firmware with any new changes made to the code. - -## Add PSP Specific Code to a Multi-Platform Programs -{: .fs-6 .fw-700 } - -When porting a game to the PSP, some PSP specific code might be needed. To make this code only apply to PSP, it is possible to use a simple ifdef statements which checks for `__PSP__` like so: - -```c -#ifdef __PSP__ - // Do PSP specific thing -#else - // Do the thing all other systems should do -#endif -``` - -This makes sure that the other systems supported by the program keeps working the same, while still making it possible to add support for the PSP. - -## More Libraries -{: .fs-6 .fw-700 } - -There are many C and C++ libraries available within the PSPDEV toolchain which can add functionality to your program. Some examples: - -- Audio formats: mp3, ogg -- Image formats: png, jpeg -- Data formats: json, yaml, sqlite -- Support for compression, physics, fonts and much more - - -For the full list take a look at the [psp-packages repository](https://github.com/pspdev/psp-packages) or run `psp-pacman -Syl`. Updating libraries can be done with `psp-pacman -Syu`. From 833cd323ea2a9af24eb49d9cb3484b7b5b557e5f Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:27:35 +0800 Subject: [PATCH 19/27] add tips and tricks to nav --- tips_tricks.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tips_tricks.md diff --git a/tips_tricks.md b/tips_tricks.md new file mode 100644 index 0000000..47d4a20 --- /dev/null +++ b/tips_tricks.md @@ -0,0 +1,54 @@ +--- +title: Tips and Tricks +layout: home +nav_order: 4 +--- + +# Tips and Tricks +{: .fs-8 .fw-700 .text-center } + +Here some useful tips for developing for the PSP. + +## Making Programs Work on Unmodded PSPs +{: .fs-6 .fw-700 } + +The PSPDEV toolchain contains tools for making your program work on unmodded PSPs. This can be done by running psp-cmake with some additional commands when building like so: + +```shell +mkdir build && cd build +``` + +```shell +psp-cmake -DBUILD_PRX=1 -DENC_PRX=1 .. && make +``` + + +This does require `create_pbp_file` to be used in your CMakeLists.txt file. After the first build, running `make` is enough to get an `EBOOT.PBP` file which works on official firmware with any new changes made to the code. + +## Add PSP Specific Code to a Multi-Platform Programs +{: .fs-6 .fw-700 } + +When porting a game to the PSP, some PSP specific code might be needed. To make this code only apply to PSP, it is possible to use a simple ifdef statements which checks for `__PSP__` like so: + +```c +#ifdef __PSP__ + // Do PSP specific thing +#else + // Do the thing all other systems should do +#endif +``` + +This makes sure that the other systems supported by the program keeps working the same, while still making it possible to add support for the PSP. + +## More Libraries +{: .fs-6 .fw-700 } + +There are many C and C++ libraries available within the PSPDEV toolchain which can add functionality to your program. Some examples: + +- Audio formats: mp3, ogg +- Image formats: png, jpeg +- Data formats: json, yaml, sqlite +- Support for compression, physics, fonts and much more + + +For the full list take a look at the [psp-packages repository](https://github.com/pspdev/psp-packages) or run `psp-pacman -Syl`. Updating libraries can be done with `psp-pacman -Syu`. From f848d3a82d2a3db976fad15ea5be5198a60a1c2d Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:28:20 +0800 Subject: [PATCH 20/27] remove tools in nav --- tools/index.md | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 tools/index.md diff --git a/tools/index.md b/tools/index.md deleted file mode 100644 index 6a89173..0000000 --- a/tools/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Tools -layout: home -has_children: true -has_toc: false ---- - -# Under construction, sorry for inconvenience. \ No newline at end of file From a9ce628940f7fa2c92790bf07a65de48393bc85b Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:30:47 +0800 Subject: [PATCH 21/27] minor updates --- documentation.md | 6 ++++-- downloads.md | 8 +++----- quickstart.md | 18 ++++++++++++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/documentation.md b/documentation.md index 2ffb5cf..2a15460 100644 --- a/documentation.md +++ b/documentation.md @@ -1,9 +1,11 @@ --- -title: Documentation +title: Additional Documentation layout: home -nav_order: 5 +nav_order: 6 --- +# Additional Documentation +{: .fs-8 .fw-700 .text-center } PSPDEV is made out of several components. Here is a (non-exhaustive) list of links to the documentation available for them: diff --git a/downloads.md b/downloads.md index b6099f4..7cc7f24 100644 --- a/downloads.md +++ b/downloads.md @@ -1,14 +1,12 @@ --- title: Downloads layout: home -nav_order: 2 +nav_order: 5 --- # Downloads {: .fs-8 .fw-700 .text-center } -- Source code: - - PSPDEV: [Download](https://github.com/pspdev/pspdev/releases/tag/latest) +Downloading the latest version of the PSPDEV toolchain for your system [here](https://github.com/pspdev/pspdev/releases/tag/latest). -- Docker image: - - PSPSDK: [Download](https://github.com/pspdev/pspsdk/pkgs/container/pspsdk) \ No newline at end of file +Alternatively, a Docker container is available [here](https://github.com/pspdev/pspdev/pkgs/container/pspdev). \ No newline at end of file diff --git a/quickstart.md b/quickstart.md index a4d5b16..17ee9fd 100644 --- a/quickstart.md +++ b/quickstart.md @@ -1,7 +1,7 @@ --- title: Quickstart layout: home -nav_order: 3 +nav_order: 2 --- # Quickstart @@ -10,7 +10,7 @@ nav_order: 3 ## Installing the toolchain {: .fs-8 .fw-700 } -### dependencies +### Dependencies {: .fs-6 .fw-700 } The PSPDEV toolchain requires a couple of dependencies to be installed before use. @@ -28,6 +28,9 @@ Now run bash and run the following commands to install the dependencies: ```shell sudo apt-get update +``` + +```shell sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot ``` @@ -40,6 +43,9 @@ On Ubuntu run the following commands to install the dependencies: ```shell sudo apt-get update +``` + +```shell sudo apt-get install build-essential cmake pkgconf libreadline8 libusb-0.1 libgpgme11 libarchive-tools fakeroot ``` @@ -62,6 +68,9 @@ Now set the required environment variables. On Mac edit the ``~/.zprofile`` on L ```shell export PSPDEV=~/pspdev +``` + +```shell export PATH=$PATH:$PSPDEV/bin ``` @@ -79,8 +88,9 @@ That's it, now the PSPDEV toolchain can be used to build PSP software. Below is ![](images/hello.png?raw=true) +> This is a simple Hello World program for the PSP. -This is a simple Hello World program for the PSP. Click on the details below to see the code and how to build it. +Click on the details below to see the code and how to build it.
@@ -170,4 +180,4 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct
-More code samples can be found [here](basic_programs.html). +For more example take a look at the [Basic Programs](basic_programs.html) page. From 080d14122e88c92c7bb7a798b1c78351ca4ee33a Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:32:59 +0800 Subject: [PATCH 22/27] updates home page --- index.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/index.md b/index.md index 09c5f05..a808f7a 100644 --- a/index.md +++ b/index.md @@ -4,16 +4,27 @@ layout: home nav_order: 1 --- +
+ # Welcome to PSPDEV {: .fs-8 .fw-700 .text-center } -PSPDEV is an open source toolchain for Playstation Portable development. It allows you to make apps and games for both custom and official firmwares. This is a community project made by enthusiasts, it is in no way affiliated with Sony. +An open source toolchain for PlayStation Portable(PSP) development. It allows you to make apps and games for both custom and official firmwares. **This is a community project made by enthusiasts, it is in no way affiliated with Sony**. {: .fs-5 .text-center } +# Getting started +{: .fs-6 .fw-700 } + +Begin your journey [here](quickstart.html). +{: .fs-5 } + +Need some in-depth knowledge? [Go here](documentation.html). +{: .fs-5 } + # Contact Us {: .fs-6 .fw-700 } If you need help or would like to contribute, don't hesitate to join us on [Discord](https://discord.gg/bePrj9W) or open an issue on [GitHub](https://github.com/pspdev/pspdev/issues). See you there! -{: .fs-5 } \ No newline at end of file +{: .fs-5 } From 4dbbefe29b25b181bf35892678bf622d1f55d0fb Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 14:48:28 +0800 Subject: [PATCH 23/27] improve build instruction --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8ec9374..b64d1aa 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# PSPDEV website +# website -Main repo of the PSPDEV website +Main repo of the PSPDEV GitHub Organization portal ## Build locally -Go here https://jekyllrb.com/docs/installation/ to install all -requirements to build the website locally +First, Go here https://jekyllrb.com/docs/installation/ to install all +requirements to build the website locally. > [!Note] -> Disable comment first the `webrick` and `github-pages` gems in Gemfile so you can build the -webpage on your computer. +> Remove the comments of `webrick` and `github-pages` gems in Gemfile so you can build the +website locally. Run the command to install all gems: @@ -23,4 +23,7 @@ bundle exec jekyll serve ``` > [!Tip] -> You can access the website to `http://localhost:4000` \ No newline at end of file +> You can access the website to `http://localhost:4000`. + +> [!Note] +> You can learn how this website deployed from [here](https://jekyllrb.com/docs/continuous-integration/github-actions/). \ No newline at end of file From baff6860373f1f1c3f3fb5c2f57096b783719dbc Mon Sep 17 00:00:00 2001 From: diamant3 Date: Fri, 16 Feb 2024 15:24:52 +0800 Subject: [PATCH 24/27] add contributing note --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b64d1aa..4192a22 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,8 @@ bundle exec jekyll serve > You can access the website to `http://localhost:4000`. > [!Note] -> You can learn how this website deployed from [here](https://jekyllrb.com/docs/continuous-integration/github-actions/). \ No newline at end of file +> You can learn how this website deployed from [here](https://jekyllrb.com/docs/continuous-integration/github-actions/). + +## Contributing + +If you want to contribute your changes from the website you build locally, just add the comment again on `webrick` and `github-pages` gems in Gemfile so the github action will not get an error. Thanks! From a0c77f1a1f13b7557537ac95c49164e151ed62e5 Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Sat, 17 Feb 2024 07:12:43 +0800 Subject: [PATCH 25/27] minor updates Co-authored-by: Wouter Wijsman --- quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart.md b/quickstart.md index 17ee9fd..d2abaac 100644 --- a/quickstart.md +++ b/quickstart.md @@ -180,4 +180,4 @@ This will result in an EBOOT.PBP file in the build directory. Put it in a direct
-For more example take a look at the [Basic Programs](basic_programs.html) page. +For more examples of programs take a look at the [Basic Programs](basic_programs.html) page. From db300822908197229f60f563c7e934adfcc13eae Mon Sep 17 00:00:00 2001 From: diamant3 Date: Sat, 17 Feb 2024 07:20:56 +0800 Subject: [PATCH 26/27] add tips and tricks below --- basic_programs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basic_programs.md b/basic_programs.md index f5e82a3..0c6eabb 100644 --- a/basic_programs.md +++ b/basic_programs.md @@ -1148,3 +1148,5 @@ make This will result in an EBOOT.PBP file in the build directory. Put it in a directory in ms0:/PSP/GAME/ and you need a font file to test the program, download it from here. Put it in a directory same as EBOOT.PBP and the PSP can run it.
+ +Check out the [Tips and Tricks](tips_tricks.html) to get most out of your whole PSP development. \ No newline at end of file From fde9982588d8ffe57f312ad5873914664010b4bb Mon Sep 17 00:00:00 2001 From: diamant3 Date: Sun, 18 Feb 2024 19:19:45 +0800 Subject: [PATCH 27/27] set on push branch to master --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index fdee052..fa9454c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -9,7 +9,7 @@ name: Deploy Jekyll site to Pages on: # Runs on pushes targeting the default branch push: - branches: ["use-jtd"] + branches: ["master"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: