Add real HW upload instructions, improve helper script

This commit is contained in:
ABelliqueux 2021-06-30 13:33:23 +02:00
parent 92d05f24a7
commit dd4290fe4e
2 changed files with 32 additions and 13 deletions

View File

@ -61,7 +61,24 @@ cd /pcsx-redux/src/mips/my-project
Set it in pcsx-redux ; `Configuration > Emulation`, then reboot the emulator ; `File > Reboot`.
4. Install the [blender extension](https://github.com/ABelliqueux/blender_io_export_psx_mesh) to create your own levels.
# Trying on real HW
If you have a real PSX, a cart flashed with [Unirom](https://github.com/JonathanDotCel/unirom8_bootdisc_and_firmware_for_ps1) and a [Serial/USB cable](https://unirom.github.io/serial_psx_cable/), you can upload the demo to the PSX memory with [NOTpsxserial](https://github.com/JonathanDotCel/NOTPSXSerial).
The engine can use [overlays](https://github.com/JaberwockySeamonstah/PSXOverlayExample/) to load data in the psx memory, so as opposed to a 'classic' project where you can just load the psx-exe in ram, we first have to load the data to a specific address, then load the exe.
First, comment out line 28 in `main.c`, so that the PSX won't look for the data on a CD :
```c
// #define USECD
```
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.
Thus, to load `Overlay.lvl1` and `main.ps-exe` in the psx ram, use :
```bash
./ovly_upload_helper.sh Overlay.lvl1 main.ps-exe /dev/ttyUSB0
```
# Credits
PSX code based on [example](http://psx.arthus.net/code/primdraw.7z) by [Lameguy64](https://github.com/Lameguy64)

View File

@ -1,4 +1,8 @@
#!/bin/bash
# Path to nops executable
NOPS="nops"
if [ $# -eq 0 ]
then
echo "PSX Overlay Upload helper script
@ -8,22 +12,20 @@ Upload a binary and the corresponding executable to a real PSX memory, via uniro
This script is dependant on NOTpsxserial being available on your system : https://github.com/JonathanDotCel/NOTPSXSerial
Edit the $NOPS value to reflect the executable path on your system, e.g :
\$NOPS = '/blah/nops'
Usage : ./ovly_upload_helper.sh bin_load_adress bin_filename psx_exe_name com_port
Usage : ./ovly_upload_helper.sh bin_filename psx_exe_name com_port
- bin_load_adress, eg : 0x80010000 (This should correspond to the 'load_all_overlays_here' adress in your .map file. )
- bin_filename , eg : Overlay.lvl0
- psx_exe_name, e.g : main.ps-exe
- com_port, e.g : /dev/ttyUSB0, COM1
"
else
# Path to nops executable
NOPS="nops"
# $1 = bin loading address ( see .map's "load_all_overlays_here" address )
# $2 = bin file
# $3 = ps-exe file
# $4 = comport
$NOPS /debug $4
$NOPS /fast /bin $1 $2 $4
$NOPS /fast /exe $3 $4
$NOPS /slow $4
# Find map file corresponding to ps-exe
MAP_FILE="`echo $2 | awk -F. '{print $1}'`.map"
# Find loading address
LOAD_ADDR="0x`cat $MAP_FILE | grep load_all_overlays_here | awk '{print $1}' | cut -c 11-`"
$NOPS /debug $3
$NOPS /fast /bin $LOAD_ADDR $1 $3
$NOPS /fast /exe $2 $3
$NOPS /slow $3
fi