From 58a8306d24fe29d965aa8b40ddc37c3163c0a2f9 Mon Sep 17 00:00:00 2001 From: spicyjpeg Date: Thu, 11 May 2023 23:26:42 +0200 Subject: Bump SDK to v0.23 and GCC to v13.1, update readme --- .github/workflows/build.yml | 2 +- CHANGELOG.md | 74 ++++++++++++++--------- CMakeLists.txt | 2 +- README.md | 144 +++++++++++++++++++------------------------- 4 files changed, 108 insertions(+), 114 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 879c72a..e84dbca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: [ push, pull_request ] env: BINUTILS_VERSION: '2.40' BINUTILS_OPTIONS: '--disable-docs --disable-nls --disable-werror --with-float=soft' - GCC_VERSION: '12.2.0' + GCC_VERSION: '13.1.0' GCC_OPTIONS: '--disable-docs --disable-nls --disable-werror --disable-libada --disable-libssp --disable-libquadmath --disable-threads --disable-libgomp --disable-libstdcxx-pch --disable-hosted-libstdcxx --enable-languages=c,c++ --without-isl --without-headers --with-float=soft --with-gnu-as --with-gnu-ld' GCC_TARGET: 'mipsel-none-elf' diff --git a/CHANGELOG.md b/CHANGELOG.md index e02f33d..971b71c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,23 @@ to ensure the changelog can be parsed correctly. ------------------------------------------------------------------------------- -## 2023-04-05: 0.23 +## 2023-05-11: 0.23 + +- libc: Added some missing C++ STL headers (`cassert`, `cctype`, `cstdint`, + `cstdio`, `cstdlib`, `cstring`). + +- psxgpu: Added `SetDrawOpType()` and the `GPU_DrawOpType` enum for more + flexibility when using custom drawing queue callbacks with `EnqueueDrawOp()`. + Added GPU IRQ variants of all display list sending APIs (`DrawOTagIRQ()`, + `DrawOTagEnvIRQ()`, `DrawBufferIRQ()` and so on). + +- examples: Cleaned up `beginner/cppdemo` and updated it to use the new STL + headers. + +- docs: Added `drawing_queue.md`, a reference on the internals of the GPU + library's drawing queue implementation. + +## 2023-04-05 spicyjpeg: @@ -498,16 +514,16 @@ Lameguy64: - Libpsn00b: Added `int8_t`, `int16_t`, `int32_t`, `int64_t`, `uint8_t`, `uint16_t`, `uint32_t` and `uint64_t` variable types in `sys/types.h`. - + - psxgte: Replaced unsigned int variable types with `u_long` to further improve compatibility with code written for the official Sony SDK and to make my tutorial examples easier to compile on PSn00bSDK. Example programs have been updated to account for this change. - + - psxcd: Changed type of 2nd argument of `CdRead()` from `u_int` to `u_long`, as well as changing the type of the size element in `CdlFILE` from `u_int` to `u_long`. - + ## 2021-02-17 Lameguy64: @@ -521,13 +537,13 @@ Lameguy64: - Fixed prefixes to allow SDK libraries and examples to be built with `mipsel-none-elf`. - + - examples: Fixed typo in `plasma_tbl.h` causing multiple definitions when compiling with newer versions of GCC in `n00bdemo`. - examples: `cartrom` example now marked as obsoleted, but still kept for reference purposes. - + - Includes alextrevisan's GTE macros in `inline_c.h`. - Added makefile template. @@ -561,7 +577,7 @@ Lameguy64: - examples: Removed redundant toolchain executable definitions in the makefiles. - + - examples: Included HDTV example for Github repo. ## 2020-09-19 @@ -573,7 +589,7 @@ Lameguy64: environment variable. Library installation and linking is also made easier with the `PSN00BSDK_LIBS` environment variable. See readme in the `libpsn00b` directory for details. - + - examples: Fixed libgcc not found error when compiling some of the examples. - libc: Added `strtok()`. @@ -581,7 +597,7 @@ Lameguy64: - libc: Added support for command line arguments. Pass arguments via `SYSTEM.CNF` `BOOT=` string or a string array with `Exec()`. Arguments can be read via `argc`/`argv[]` in `main()` or `__argc`/`__argv` anywhere else. - + - libc: Added `SetHeapSize()`. - psxgpu: Moved ISR and callback subsystem to `psxetc`. You'll have to link @@ -595,7 +611,7 @@ Lameguy64: - psxcd: Fixed crashing on PSIO and possibly some emulators by implementing a response buffer read limiter. - + - psxgpu: Interrupts are now disabled before setting up ISR and callbacks in `ResetGraph()`, as `LoadExec()` still has interrupts enabled when jumping to the loaded PS-EXE's entrypoint. Fixes programs made with PSn00bSDK crashing @@ -615,10 +631,10 @@ Lameguy64: - psxcd: Updated media change detection logic, media change is checked by lid open status bit in all CD-ROM file functions. `CdControl()` calls will also trigger the media change status on lid open. - + - psxcd: Fixed bug in `CdGetVolumeLabel()` where it constantly reparses the file system regardless of media change status. - + - examples: Updated `cdrom/cdbrowse` example slightly. - psxcd: Added `CdLoadSession()`. @@ -626,10 +642,10 @@ Lameguy64: - psxcd: Fixed bug where `CdReadDir()` locks up in an infinite loop when it encounters a NULL directory record, and the parser has not yet exceeded the length of the directory record. - + - doc: Replaced library version numbers with SVN revision numbers in the introduced fields. - + - doc: Started work on CD-ROM library overview. ## 2020-04-24 @@ -643,10 +659,10 @@ Lameguy64: - psxapi: Added BIOS `atoi()` and `atol()` calls. Temporary, may be replaced with a faster implementation. - + - psxsio: Added `ioctl()` support for `FIOCSCAN` to probe for pending input in serial tty driver. - + - examples: Reorganized examples, added new `tty` and `console` examples. ## 2020-03-11 @@ -678,7 +694,7 @@ Lameguy64: flag internal to the libraries when CD lid is opened, so file system functions can update the cached ISO descriptor when the disc has been changed. - + - psxcd: Made internal variables and functions for iso9660 parsing static. ## 2020-02-25 @@ -712,13 +728,13 @@ Lameguy64: - psxgpu: Added parenthesis to argument value in `setlen()`, `setaddr()` and `setcode()` macros, preventing `addPrims()` from being used in a more sensible manner (ie. `addPrims(ot, sub_ot+3, sub_ot)`). - + - examples: Added render2tex render to texture example. - psxspu: Fixed typo in `spuinit.s` on section specifier specifying a data section instead of text section, resulting to jump to non-instruction-aligned linker errors. - + - psxgpu: Increased ISR stack size to 2048 bytes. - psxsio: Added `kbhit()` to poll keyboard input asynchronously and stdin @@ -759,7 +775,7 @@ Lameguy64: - libc: Fixed negative integers not displaying properly in `vsprintf()`/`vsnprintf()`. - + - libc: Fixed zero padding not working in `vsprintf()`/`vsnprintf()`. - fpscam: Added debug text using `FntOpen()`, `FntPrint()` and `FntFlush()`. @@ -832,7 +848,7 @@ Lameguy64: - libc: Updated build method which takes `libgcc` from the compiler and adds its own object files into it, eliminating linker problems caused by having to order `libc` and `libgcc` libraries in a specific manner. - + - psxgpu: Added `RestartCallback()`. - psxgpu: Added `StoreImage()` function. @@ -851,11 +867,11 @@ Lameguy64: so its emulated like floats. `int64` still used for processing floats and doubles and old `vsprintf.c` file is still included for those who really want `int64` support for whatever reason. - + - libc: Removed `stdarg.h` which is part of GCC and not license compatible with MPL. The toolchain compiled with libgcc provides `stdarg.h` and other standard headers. - + - examples: Updated `sdk-common.mk` variable convention for better flexibility. - libpsn00b: Added `common.mk` file containing global values for all libraries. @@ -866,17 +882,17 @@ Lameguy64: to install due to `GetInterruptCallback()` retrieving the callback value immediately in the branch delay slot of a `jr` instruction, which resuls to an inconsistent return value. This also broke `DrawSyncCallback()`. - + - psxsio: Done fixes on `_sio_control()` from the aformentioned issues with load instructions in delay slots. - + - psxgte: Added `DVECTOR` struct. - psxgpu: Added `setLineF2()`, `setLineG2()`, `setLineF3()` and `setLineG3()` primitive macros. - + - Added more functions in documentation. - + ## 2019-07-01 williamblair: @@ -928,7 +944,7 @@ Lameguy64: - psxgpu: Implemented IRQ callback system with `InterruptCallback()` allowing to set interrupt callbacks very easily. - + - psxgpu: Implemented proper IRQ handler installed using HookEntryInt or `SetCustomExitFromException()` for handling VSync and other interrupts. `ChangeClearPAD(0)` must now be called after `_InitPad()` or vsync timeout @@ -938,7 +954,7 @@ Lameguy64: making them not appear in symbol lists resulting in a cleaner symbol dump. Still not possible to do function-scope local labels like in ASMPSX because GAS syntax is ASS (or ASS GAS which is farts, GAS is farts). - + - psxgpu: `DrawSync()` function now waits for DMA completion and GPU transfer ready instead of simply waiting for GPU transfer ready which is the likely cause of subtle GPU related timing issues, it also sets GPU DMA transfer diff --git a/CMakeLists.txt b/CMakeLists.txt index 19050f8..34afa52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ include(ExternalProject) project( PSn00bSDK LANGUAGES NONE - VERSION 0.22 + VERSION 0.23 DESCRIPTION "Open source PlayStation 1 SDK" HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" ) diff --git a/README.md b/README.md index 07ad738..50c50a0 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,58 @@ # PSn00bSDK -PSn00bSDK is a 100% free and open source SDK project for the original Sony -PlayStation for developing homebrew applications and games for the console. -This SDK may be used for freeware, commercial, and open source homebrew -projects as far as what the SDK currently supports. Out of all the open -source PS1 SDK projects that have come and gone from active development -over the years, PSn00bSDK is arguably the most capable of them all. - -Much of the SDK is merely just a set of libraries (`libpsn00b`) and some -utilities for converting executables and data files to formats more usable -on the target platform. The compiler used is just the standard GNU GCC -toolchain compiled to target mipsel and has to be acquired separately. -The library API was deliberately written to resemble the library API of the -official libraries as closely as possible not only for familiarity reasons -to experienced programmers but also so that existing sample code and tutorials -that have been written over the years would still apply to this SDK, as well -as making the process of porting over existing homebrew originally made with -official SDKs easier with minimal modificationn provided they do not depend -on libgs. - -PSn00bSDK is currently a work in progress and cannot really be considered -production ready, but what is currently implemented should be enough to -produce some interesting homebrew with the SDK especially with its extensive -support for the GPU and GTE hardware. There's no reason not to fully support -hardware features of a target platform when said hardware features have been -fully documented for years (nocash's PSX specs document in this case). - -Most of `libpsn00b` is written mostly in MIPS assembly more so functions that -interface with the hardware. Many of the standard C functions are implemented -in custom MIPS assembly instead of equivalents found in the BIOS ROM, for both -stability (the BIOS `libc` implementation of the PlayStation is actually buggy) -and performance reasons. - - -## Notable features - -As of October 11, 2022: - -* Extensive GPU support with lines, flat shaded or textured polygon and sprite - primitives, high-speed DMA for VRAM transfers and ordering tables. All video - modes for both NTSC and PAL standards also supported with fully adjustable - display area and automatic video standard detection based on last GPU mode. +PSn00bSDK is an open source homebrew software development kit for the original +Sony PlayStation, consisting of a C/C++ compiler toolchain and a set of +libraries that provide a layer of abstraction over the raw hardware in order to +make game and app development easier. A CMake-based build system, CD-ROM image +packing tool (`mkpsxiso`) and asset conversion utilities are also provided. + +At the heart of PSn00bSDK is `libpsn00b`, a set of libraries that implements +most of the core functionality of the official Sony SDK (excluding higher-level +libraries) plus several new extensions to it. Most of the basic APIs commonly +used by homebrew apps and games built with the official SDK are available, +making PSn00bSDK a good starting point for those who have an existing codebase +but want to move away from Sony tools. + +Currently supported features include: + +* Full support for the GPU's functionality including all primitive types (lines, + polygons, sprites) as well DMA transfers managed through a software-driven + command queue that can optionally be extended with custom commands. Both NTSC + and PAL video modes are fully supported. * Extensive GTE support with rotate, translate, perspective correction and lighting calculation fully supported through C and/or assembly GTE macros paired with high speed matrix and vector helper functions. All calculations performed in fixed point integer math, not a single float used. -* Flexible interrupt service subsystem with easy to use callback mechanism for - simplified handling and hooking of hardware and DMA interrupts. No crude - event handler hooks or kernel hacks providing great compatibility with - HLE BIOS implementations and loader/menu type homebrew programs. +* BIOS-based interrupt dispatch system providing the ability to register custom + callbacks for all IRQs and DMA channels while preserving compatibility with + all functions provided by the BIOS. -* BIOS controller functions for polling controller input work as intended - thanks to proper handling of hardware interrupts. Optional limited support - for manual polling. +* Basic support for controller input through the BIOS, with optional limited + support for manual polling. -* Complete Serial I/O support and console driver to redirect standard input and - output to the serial port. Hardware flow control supported. +* Complete Serial I/O support with buffering and console driver to redirect BIOS + standard input and output to the serial port. Hardware flow control supported. -* Full CD-ROM support using `libpsxcd` featuring data reading, CD-DA and XA - audio playback, a built-in ISO9660 file system parser with no file count - limit and support for multi-session discs. +* CD-ROM support featuring asynchronous reading, CD-DA and XA-ADPCM audio + playback and a built-in ISO9660 file system parser with no file count limit. + Additional support for multi-session discs and bypassing region checks on + supported console models. -* MDEC support, lossy image decompression and video playback using - `libpsxpress` (currently only bitstream versions 1 and 2 are supported). +* Full MDEC support for hardware accelerated lossy image decompression and video + playback. * Preliminary limited support for Konami System 573 arcade hardware. -* Experimental support for dynamic linking at runtime, with support for - function and variable introspection by loading a map file generated at build - time. - -* Uses Sony SDK library syntax for familiarity to experienced programmers - and makes porting existing homebrew projects to PSn00bSDK easier. - -* Works on real hardware and most popular emulators. - -* Fully expandable and customizable to your heart's content. +* Experimental support for dynamic linking at runtime, including function and + variable introspection by loading a map file generated at build time. +Note that, while PSn00bSDK's API is to some extent compatible with the official +SDK's, the project is *not* meant to be a drop-in replacement for it, both +since reimplementing the entire SDK would be a major undertaking and because +many parts of it are inefficient, clunky and/or provide relatively little value. ## Obtaining PSn00bSDK @@ -97,27 +70,31 @@ used as a starting point. For more information on how to get started, or if you wish to build the SDK yourself from source instead, refer to [installation.md](doc/installation.md). +## Tutorials and examples -## Examples - -There are a few examples and complete source code of `n00bdemo` included in the -`examples` directory. More example programs may be added in the future and -contributed example programs are welcome. - -There's also [Lameguy's PlayStation Programming Tutorial Series](http://lameguy64.net/tutorials/pstutorials) -for learning how to program for the PlayStation. Much of the tutorials should -apply to PSn00bSDK. +The `examples` directory contains several example programs showcasing different +parts of the SDK (mostly graphics); the source code of `n00bdemo` can also be +found in the same directory. More example programs may be added in the future +and contributed example programs are welcome. +[Lameguy's PlayStation Programming Tutorial Series](http://lameguy64.net/tutorials/pstutorials) +was written with older versions of PSn00bSDK in mind and is outdated at this +point, but may still be useful as an introduction to the console's hardware and +the basics of the graphics and controller APIs. ## To-do List +* `libpsxgte`: Rewrite all assembly functions from scratch as parts of them have + been lifted as-is from Sony libraries. **PSn00bSDK is currently** (and + will probably always be) **in a legal gray area due to this.** + * `libpsxspu`: Plenty of work to be done. Some kind of MIDI sequencer (similar to the one present in the official SDK) should be added at some point, along with a proper API for audio streaming. * `libpsxcd`: Implement a command queue mechanism for the CD-ROM. -* `libpsxpress`: Add support for version 3 and IKI frame bitstreams. +* `libpsxpress`: Add an API for SPU-ADPCM audio encoding at runtime. * `libc`: Improve the memory allocation framework with multiple allocators, replace the string functions with optimized implementations and maybe add @@ -127,32 +104,33 @@ apply to PSn00bSDK. controller driver, and possibly a library for interfacing to IDE/ATAPI drives to make development for arcade systems easier. - ## Credits -Main developer/author/whatever: +Main developers/authors: * **Lameguy64** (John "Lameguy" Wilbert Villamor) +* **spicyjpeg** Contributors: -* **spicyjpeg**: dynamic linker, `libpsxpress`, CMake scripts, some docs and - examples. * **Silent**, **G4Vi**, **Chromaryu**: `mkpsxiso` and `dumpsxiso` (maintained as a [separate repo](https://github.com/Lameguy64/mkpsxiso)). Honorable mentions: +* **Soapy**: wrote the original version of the `inline_c.h` header containing + GTE macros. * **ijacquez**: helpful suggestions for getting C++ working. -* **Nicolas Noble**: his OpenBIOS project gave insight to how the BIOS works - internally. +* **Nicolas Noble**: author of the + [pcsx-redux](https://github.com/grumpycoders/pcsx-redux) emulator, OpenBIOS + and other projects which proved invaluable during development. Helpful contributors can be found in the changelog. References used: -* [nocash's PlayStation specs document](http://problemkaputt.de/psx-spx.htm) - and Nicolas Noble's [updated version](https://psx-spx.consoledev.net). +* [Martin Korth's psx-spx document](http://problemkaputt.de/psx-spx.htm) and the + [community-maintained version](https://psx-spx.consoledev.net). * MIPS and System V ABI specs (for the dynamic linker). * Tails92's PSXSDK project (during PSn00bSDK's infancy). -- cgit v1.2.3