Add nugget as a submodule

This commit is contained in:
ABelliqueux 2021-07-10 14:15:12 +02:00
parent dfa903087e
commit d0cd8d102a
6 changed files with 51 additions and 37 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "thirdparty/nugget"]
path = thirdparty/nugget
url = https://github.com/pcsx-redux/nugget.git

View File

@ -11,7 +11,6 @@ src/psx.c \
src/space.c \ src/space.c \
levels/level0.c \ levels/level0.c \
levels/level1.c \ levels/level1.c \
../common/crt0/crt0.s \
TIM/home.tim \ TIM/home.tim \
TIM/cat.tim \ TIM/cat.tim \
TIM/lara.tim \ TIM/lara.tim \
@ -26,32 +25,5 @@ OVERLAYSCRIPT ?= overlay.ld
OVERLAYSECTION ?= .lvl0 .lvl1 OVERLAYSECTION ?= .lvl0 .lvl1
# img2tim -t -bpp 8 -org 320 0 -plt 0 481 -o bg.tim bg.png # img2tim -t -bpp 8 -org 320 0 -plt 0 481 -o bg.tim bg.png
include ./common.mk
CPPFLAGS += -I../psyq/include include ./thirdparty/nugget/common.mk \
LDFLAGS += -L../psyq/lib
LDFLAGS += -Wl,--start-group
LDFLAGS += -lapi
LDFLAGS += -lc
LDFLAGS += -lc2
LDFLAGS += -lcard
LDFLAGS += -lcomb
LDFLAGS += -lds
LDFLAGS += -letc
LDFLAGS += -lgpu
LDFLAGS += -lgs
LDFLAGS += -lgte
LDFLAGS += -lgun
LDFLAGS += -lhmd
LDFLAGS += -lmath
LDFLAGS += -lmcrd
LDFLAGS += -lmcx
LDFLAGS += -lpad
LDFLAGS += -lpress
LDFLAGS += -lsio
LDFLAGS += -lsnd
LDFLAGS += -lspu
LDFLAGS += -ltap
LDFLAGS += -lcd
LDFLAGS += -Wl,--end-group
include ../common.mk \

View File

@ -35,7 +35,6 @@ Real-time 3D / 8bpp background / 4bpp background
* Up, Down, Left Right, L3 (Dualshock) : Move actor. * Up, Down, Left Right, L3 (Dualshock) : Move actor.
* X : "Jump" . * X : "Jump" .
* Select : Switch level. * Select : Switch level.
## Planned ## Planned
@ -44,16 +43,16 @@ Real-time 3D / 8bpp background / 4bpp background
# Compiling # Compiling
You need to install [mkpsxiso](https://github.com/Lameguy64/mkpsxiso) and the [pcsx-redux emulator and Nugget+PsyQ SDK](https://github.com/ABelliqueux/nolibgs_hello_worlds#setting-up-the-sdk--modern-gcc--psyq-aka-nuggetpsyq) before You need to install [mkpsxiso](https://github.com/Lameguy64/mkpsxiso) and the [Nugget+PsyQ SDK](https://github.com/ABelliqueux/nolibgs_hello_worlds/tree/newtree#installation) before
you can build the engine. Put `mkpsxiso` and `pcsx-redux` in your $PATH and you should be good to go. you can build the engine. Put `mkpsxiso` and `pcsx-redux` in your $PATH and you should be good to go.
1. Clone this repo in `(...)/pcsx-redux/src/mips/` as a new project : 1. Clone this repo in your nugget+PsyQ folder as a new project :
```bash ```bash
git clone https://github.com/ABelliqueux/3dcam-headers my-project git clone https://github.com/ABelliqueux/3dcam-headers --recursive my-project
``` ```
2. Navigate to that folder in a terminal : 2. Navigate to that folder in a terminal :
```bash ```bash
cd /pcsx-redux/src/mips/my-project cd my-project
``` ```
3. Type `./isotest.sh`. This should compile the example, build an iso with `mkpsxiso` and launch it with `pcsx-redux`. 3. Type `./isotest.sh`. This should compile the example, build an iso with `mkpsxiso` and launch it with `pcsx-redux`.
On first launch, `pcsx-redux` will ask for a PSX bios. You can use your own or [the open source OpenBios](https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips/openbios). On first launch, `pcsx-redux` will ask for a PSX bios. You can use your own or [the open source OpenBios](https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips/openbios).
@ -73,7 +72,7 @@ First, comment out line 28 in `main.c`, so that the PSX won't look for the data
// #define USECD // #define USECD
``` ```
The address we have to load the data to is defined by the 'load_all_overlays_here' symbol in `main.map`. The address we have to load the data to is defined by the 'load_all_overlays_here' symbol in `main.map`.
The provided `ovly_upload_helper.sh` script takes care of finding that address depending on the ps-exe name. The provided `ovly_upload_helper.sh` bash script takes care of finding that address depending on the ps-exe name.
Thus, to load `Overlay.lvl1` and `main.ps-exe` in the psx ram, use : Thus, to load `Overlay.lvl1` and `main.ps-exe` in the psx ram, use :
```bash ```bash
./ovly_upload_helper.sh Overlay.lvl1 main.ps-exe /dev/ttyUSB0 ./ovly_upload_helper.sh Overlay.lvl1 main.ps-exe /dev/ttyUSB0

39
common.mk Normal file
View File

@ -0,0 +1,39 @@
# If you change this to exe, you'll have to rename the file ./thirdparty/nugget/ps-exe.ld too.
TYPE = ps-exe
SRCS += ./thirdparty/nugget/common/crt0/crt0.s
# Check subfolder and current folder for psyq libs
CPPFLAGS += -I../thirdparty/nugget/psyq/include -I./thirdparty/nugget/psyq/include -I./psyq-4_7-converted/include -I../psyq-4_7-converted/include -I./psyq-4.7-converted-full/include -I../psyq-4.7-converted-full/include -I./psyq/include -I../psyq/include
LDFLAGS += -L../thirdparty/nugget/psyq/lib -L./thirdparty/nugget/psyq/lib -L./psyq-4_7-converted/lib -L../psyq-4_7-converted/lib -L./psyq-4.7-converted-full/lib -L../psyq-4.7-converted-full/lib -L./psyq/lib -L../psyq/lib
LDFLAGS += -Wl,--start-group
LDFLAGS += -lapi
LDFLAGS += -lc
LDFLAGS += -lc2
LDFLAGS += -lcard
LDFLAGS += -lcomb
LDFLAGS += -lds
LDFLAGS += -letc
LDFLAGS += -lgpu
LDFLAGS += -lgs
LDFLAGS += -lgte
LDFLAGS += -lgun
LDFLAGS += -lhmd
LDFLAGS += -lmath
LDFLAGS += -lmcrd
LDFLAGS += -lmcx
LDFLAGS += -lpad
LDFLAGS += -lpress
LDFLAGS += -lsio
LDFLAGS += -lsnd
LDFLAGS += -lspu
LDFLAGS += -ltap
LDFLAGS += -lcd
LDFLAGS += -Wl,--end-group
# convert TIM file to bin
%.o: %.tim
$(PREFIX)-objcopy -I binary --set-section-alignment .data=4 --rename-section .data=.rodata,alloc,load,readonly,data,contents -O elf32-tradlittlemips -B mips $< $@
# convert VAG files to bin
%.o: %.vag
$(PREFIX)-objcopy -I binary --set-section-alignment .data=4 --rename-section .data=.rodata,alloc,load,readonly,data,contents -O elf32-tradlittlemips -B mips $< $@

View File

@ -25,7 +25,7 @@
#include "../include/graphics.h" #include "../include/graphics.h"
#include "../include/space.h" #include "../include/space.h"
//~ #define USECD #define USECD
// START OVERLAY // START OVERLAY
extern u_long load_all_overlays_here; extern u_long load_all_overlays_here;

1
thirdparty/nugget vendored Submodule

@ -0,0 +1 @@
Subproject commit 6483f1e13b5c89932500129548e8aa8f2a026f25