nolibgs_hello_worlds/README.md

111 lines
5.6 KiB
Markdown
Raw Normal View History

2021-05-04 16:52:17 +02:00
# Nolibgs Hello Worlds !
2021-05-24 16:49:09 +02:00
2021-05-04 16:52:17 +02:00
<p align="center">
2021-05-24 16:49:09 +02:00
2021-07-10 13:40:48 +02:00
<img height="240px" src="http://wiki.arthus.net/assets/cube.gif" alt="3D power !">
2021-05-24 16:49:09 +02:00
2021-07-10 13:40:48 +02:00
<img height="240px" src="http://wiki.arthus.net/assets/polyfun.jpg" alt="3D power !">
2021-05-24 16:49:09 +02:00
2021-07-10 13:40:48 +02:00
<img height="240px" src="http://wiki.arthus.net/assets/hello_gt.jpg" alt="3D power !">
2021-05-24 16:49:09 +02:00
2021-05-04 16:52:17 +02:00
</p>
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
So you want to begin developping on the original PSX but don't know where to start ?
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
This repo is destined to host a bunch of simple examples, each describing how to do one thing.
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
The code here will be using **Nugget + PsyQ**, the "Official" Sony SDK but with a modern MIPS toolchain.
We will not be using libGS, the Extended Graphics Library for the graphic stuff...
2021-05-24 16:49:09 +02:00
2020-12-23 12:12:38 +01:00
Instead we'll try to devise methods to reproduce libgs functions. This will not necessarly be more efficient, but we'll learn
2021-07-10 13:36:57 +02:00
a lot more stuff !
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
## Installation
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
We'll keep things simple for now. If you want to read about more methods to get things up and running, see the wiki's [Installation methods](https://github.com/ABelliqueux/nolibgs_hello_worlds/wiki/Installation-methods) section.
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
### Windows
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
#### MIPS toolchain setup
2021-07-30 10:24:17 +02:00
1. Download the MIPS toolchain here : [https://static.grumpycoder.net/pixel/mips/g++-mipsel-none-elf-10.3.0.zip](http://static.grumpycoder.net/pixel/mips/g++-mipsel-none-elf-10.3.0.zip)
2021-07-10 13:36:57 +02:00
2. Unzip anywhere on your hard-drive and add the `bin` folder to [your $PATH](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho#44272417).
3. Test everything is fine by [launching a command prompt](https://www.lifewire.com/how-to-open-command-prompt-2618089) and typing `mipsel-none-elf-gcc.exe --version`. If you get a message like `mipsel-none-gnu-gcc (GCC) 10.3.0`, then it's working !
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
#### Nugget + PsyQ setup
2021-09-03 17:09:15 +02:00
1. Download the PsyQ converted libraries here : [http://psx.arthus.net/sdk/Psy-Q/psyq-4.7-converted-full.7z](http://psx.arthus.net/sdk/Psy-Q/psyq-4.7-converted-full.7z)
2021-07-10 13:51:42 +02:00
2. Download this repository's release : [https://github.com/ABelliqueux/nolibgs_hello_worlds/releases/download/v0.1/nolibgs_hello_worlds.zip](https://github.com/ABelliqueux/nolibgs_hello_worlds/releases/download/v0.1/nolibgs_hello_worlds.zip)
2021-07-10 13:53:05 +02:00
3. Unzip the **`nolibgs_hello_worlds.zip`** file anywhere on your hard-drive. We'll use `C:\psxdev\` as an example
2021-09-03 17:09:15 +02:00
4. Unzip the `psyq-4.7-converted-full.7z` file in `C:\psxdev\psyq`. You should now have `C:\psxdev\psyq\include` and `C:\psxdev\psyq\lib`.
2021-07-10 15:55:44 +02:00
5. Test everything is working by [launching a command prompt](https://www.lifewire.com/how-to-open-command-prompt-2618089), change to the `C:\psxdev\` directory with the following command: `cd C:\psxdev\`, then type `make` and hit enter.
By default, this should build the `hello_world` example, and you should now have a `hello_world.ps-exe` file in `C:\psxdev\hello_world`. This a PSX executable that can be run in an emulator like [pcsx-redux](https://github.com/grumpycoders/pcsx-redux/).
2021-05-24 18:13:58 +02:00
2021-07-10 13:36:57 +02:00
### Linux
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
#### Install your distribution's MIPS toolchain
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
In a terminal :
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
On Debian derivatives (Ubuntu, Mint...) :
2021-05-17 19:37:31 +02:00
```bash
2021-07-10 13:36:57 +02:00
sudo apt-get install gcc-mipsel-linux-gnu g++-mipsel-linux-gnu binutils-mipsel-linux-gnu
2020-12-22 11:14:54 +01:00
```
2021-07-10 13:36:57 +02:00
On Arch derivatives (Manjaro), the mipsel environment can be installed from [AUR](https://wiki.archlinux.org/index.php/Aur) : [cross-mipsel-linux-gnu-binutils](https://aur.archlinux.org/packages/cross-mipsel-linux-gnu-binutils/) and [cross-mipsel-linux-gnu-gcc](https://aur.archlinux.org/packages/cross-mipsel-linux-gnu-gcc/) using your [AURhelper](https://wiki.archlinux.org/index.php/AUR_helpers) of choice:
2020-12-22 11:14:54 +01:00
```bash
2021-07-10 13:36:57 +02:00
trizen -S cross-mipsel-linux-gnu-binutils cross-mipsel-linux-gnu-gcc
2020-12-22 11:14:54 +01:00
```
2021-07-10 13:36:57 +02:00
#### Nugget + PsyQ setup
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
Let's do it all on the [CLI](https://en.wikipedia.org/wiki/Command-line_interface) !
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
1. Install the git client :
```bash
sudo apt-get install git
2020-12-22 11:14:54 +01:00
```
2021-07-10 13:36:57 +02:00
2. Clone this repository :
```bash
git clone https://github.com/ABelliqueux/nolibgs_hello_worlds.git --recursive
2020-12-22 11:14:54 +01:00
```
2021-07-10 13:36:57 +02:00
3. Change to the repo's directory and get the PsyQ converted libraries:
2020-12-22 11:14:54 +01:00
```bash
2021-07-10 13:36:57 +02:00
cd nolibgs_hello_worlds
2021-09-03 17:05:07 +02:00
wget http://psx.arthus.net/sdk/Psy-Q/psyq-4.7-converted-full.7z
2021-09-03 17:09:15 +02:00
7z x psyq-4.7-converted-full.7z
2020-12-22 11:14:54 +01:00
```
2021-07-10 13:36:57 +02:00
4. Try your setup :
2020-12-22 11:14:54 +01:00
```bash
2021-07-10 13:36:57 +02:00
make
2020-12-22 11:14:54 +01:00
```
2021-07-10 13:42:59 +02:00
By default, this should build the `hello_world` example, and you should now have a `hello_world.ps-exe` file in `./hello_world/`. This a PSX executable that can be run in an emulator like [pcsx-redux](https://github.com/grumpycoders/pcsx-redux/).
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
### MacOS
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
A [brew](https://brew.sh/) installation script can be found [here.](https://github.com/grumpycoders/pcsx-redux#macos).
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
## Compilation
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
In a terminal, `cd` to your psxdev setup directory and type `make all` to build all examples in their respective directories.
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
Alternatively, you can use `make example_name` to only build that example, i.e : `make hello_poly`.
2021-05-24 16:49:09 +02:00
2021-07-10 13:36:57 +02:00
If you want to remove all the files generated by the compilation process, type `make clean`.
2021-05-24 16:49:09 +02:00
2021-07-17 13:16:05 +02:00
## Upcoming examples
* hello_poly_subdiv (polygon subdivision)
* hello_rsd (rsd format)
2021-07-20 20:15:45 +02:00
* Hello multi XA
2021-07-17 13:16:05 +02:00
2020-12-22 11:14:54 +01:00
# Links and Doc
2021-07-10 13:36:57 +02:00
2020-12-22 12:41:57 +01:00
* [Getting started with PSX dev](https://psx.arthus.net/starting.html)
2021-07-10 13:36:57 +02:00
* [Ps1 dev ressource center](https://ps1.consoledev.net/)
2021-07-30 10:24:17 +02:00
* [PsyQ docs](https://psx.arthus.net/sdk/Psy-Q/DOCS/)
2020-12-22 12:41:57 +01:00
* [psxdev.net](http://psxdev.net/)
2021-07-10 13:36:57 +02:00
* [psxdev Discord](https://discord.com/invite/N2mmwp)
2021-05-24 16:49:09 +02:00
2020-12-24 17:58:40 +01:00
# Credits, thanks, hugs
2021-05-24 16:49:09 +02:00
2020-12-24 17:58:40 +01:00
Everything here was learnt from some more talented persons, mainly but not excluding others that hang around on the [psxdev discord](https://discord.com/channels/642647820683444236/642848627823345684)
Nicolas Noble, Lameguy64, NDR008, Jaby smoll seamonstah, danhans42, rama, sickle, paul, squaresoft74, and lot mores !