Skip to content

Commit 0dcc54c

Browse files
authored
Merge pull request #94 from OpenDriver2/develop-SoapyMan
Pre-beta now
2 parents 5495e2a + 4db2219 commit 0dcc54c

208 files changed

Lines changed: 6152 additions & 4119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@
2525
*.code-workspace
2626
.vscode/*
2727
.vs/*
28-
PSXToolchain/*
28+
PSXToolchain/GameSRC*
29+
PSXToolchain/Overlay*
30+
PSXToolchain/0_CD_DATA/*
31+
PSXToolchain/PsyQ/*
32+
PSXToolchain/mipsel-unknown-elf/*
33+
PSXToolchain/REDRIVER2.bin
34+
PSXToolchain/REDRIVER2.cue
2935
src_rebuild/dependencies/*
3036
src_rebuild/.vs/*
3137
src_rebuild/bin/*

CONTRIBUTING.md

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,3 @@
1-
# Contributing
2-
Pull requests which drastically alter the structure or architecture of the code will not be accepted.
3-
This is to maintain "sanity" whilst going back through code, comparing to the original MIPS disassembled output.
4-
Best pull requests are which resolve bugs, finish existing decompiled methods, improve readability, introduce new decompiled methods and improve code documentation.
1+
# Moved
52

6-
It's also good to see which issues have more priority to work with here:
7-
https://github.com/OpenDriver2/REDRIVER2/contribute
8-
9-
#### Markers for decompiled function names, code, etc
10-
11-
- [D] = decompiled
12-
- [T] = debugged and tested
13-
- [A] = altered code - debugging purposes or not being able to compile or run.... Can be used anywhere in the code, structures etc
14-
15-
# Base Versions
16-
- **SLES-02996/SLES-12996** - 1.0 Italian version (look for `ITALIAN.SYM` existence)
17-
- **SLES-02997/SLES-12997** - 1.0 Spanish version (look for `SPANISH.SYM` existence)
18-
19-
# Game Content
20-
See [Wiki/Installation Instructions](https://github.com/OpenDriver2/REDRIVER2/wiki/Installation-instructions)
21-
22-
# Prerequisites
23-
You'll need to acquire a few dependencies in order to start developing for **REDRIVER2**.
24-
25-
The default location for dependencies are in the `src_rebuild\dependencies` folder:
26-
```
27-
SDL2_DIR = <dependencies>\SDL2
28-
OPENAL_DIR = <dependencies>\openal-soft
29-
JPEG_DIR = <dependencies>\jpeg
30-
```
31-
32-
Alternatively, you can set environment variables like so:
33-
```
34-
SDL2_DIR = <your_dependency_folder>\SDL2-2.0.12
35-
OPENAL_DIR = <your_dependency_folder>\openal-soft-1.20.1-bin
36-
JPEG_DIR = <your_dependency_folder>\jpeg-9d
37-
```
38-
39-
Once you've got your folder(s) setup, you'll need to download the following dependencies.
40-
41-
## SDL 2
42-
- [Download](https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip)
43-
44-
Place all files in your `SDL2_DIR` directory.
45-
46-
## OpenAL-Soft
47-
- [Download](https://openal-soft.org/openal-binaries/openal-soft-1.20.1-bin.zip)
48-
49-
Place all files in your `OPENAL_DIR` directory.
50-
51-
## JPEG
52-
- [Download](http://www.ijg.org/files/jpegsr9d.zip)
53-
54-
Place all files in your `JPEG_DIR` directory.
55-
56-
You'll also need to rename `jconfig.xx` (proper one for your platform) to `jconfig.h`.
57-
For *Windows / Visual Studio* this means renaming `jconfig.vc` to `jconfig.h`.
58-
59-
## Premake 5
60-
- [Download](https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-windows.zip)
61-
62-
Place `premake5.exe` in your `src_rebuild` folder in order to generate project files.
63-
64-
Make sure you have downloaded all other dependencies first before running premake.
65-
66-
Next you need to run `premake5 <target IDE>`, see premake documentation;
67-
Or just run `gen_vc2019.bat` (Windows only)
68-
69-
# Compiling
70-
Project **must** be targeted for **32-bit** platforms only. This is due to the size of pointers and other types (such as *long* in GCC) being different on 64-bit platforms.
71-
72-
You can also download pre-compiled [nightly builds](https://ci.appveyor.com/project/SoapyMan/redriver2-10jm8/branch/master) or the latest [release builds](https://github.com/OpenDriver2/REDRIVER2/releases) as well.
3+
See [Contributing to project](https://github.com/OpenDriver2/REDRIVER2/wiki/Contributing-to-project) page for details

PSXToolchain/.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "gdb",
6+
"request": "attach",
7+
"name": "Attach to gdbserver",
8+
"executable": "0_CD_DATA/DRIVER2.ps-exe",
9+
"gdbpath": "C:/mingw/bin/gdb.exe",
10+
"target": "localhost:3333",
11+
"remote": true,
12+
"cwd": "${workspaceRoot}"
13+
}
14+
]
15+
}

PSXToolchain/Makefile

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
PSYQ_DIR ?= X:/PsyQ
2+
3+
OBJDIR = obj
4+
BINDIR ?= 0_CD_DATA/
5+
TARGET = DRIVER2
6+
TYPE = ps-exe
7+
BUILD = Release
8+
9+
SOURCES = GameSRC/Game
10+
11+
OVERLAYSCRIPT ?= redriver2_overlays.ld
12+
OVERLAYSECTION ?= .frnt .path .lead
13+
14+
# Main sources
15+
SRCS = \
16+
$(SOURCES)/ASM/asmtest.c\
17+
$(SOURCES)/ASM/compres.c\
18+
$(SOURCES)/ASM/d2mapasm.c\
19+
$(SOURCES)/ASM/rnc_2.c\
20+
$(SOURCES)/ASM/rndrasm.c\
21+
$(SOURCES)/C/E3stuff.c\
22+
$(SOURCES)/C/ai.c\
23+
$(SOURCES)/C/bcoll3d.c\
24+
$(SOURCES)/C/bcollide.c\
25+
$(SOURCES)/C/bomberman.c\
26+
$(SOURCES)/C/camera.c\
27+
$(SOURCES)/C/cars.c\
28+
$(SOURCES)/C/cell.c\
29+
$(SOURCES)/C/civ_ai.c\
30+
$(SOURCES)/C/convert.c\
31+
$(SOURCES)/C/cop_ai.c\
32+
$(SOURCES)/C/cosmetic.c\
33+
$(SOURCES)/C/cutscene.c\
34+
$(SOURCES)/C/debris.c\
35+
$(SOURCES)/C/denting.c\
36+
$(SOURCES)/C/director.c\
37+
$(SOURCES)/C/dr2roads.c\
38+
$(SOURCES)/C/draw.c\
39+
$(SOURCES)/C/drivinggames.c\
40+
$(SOURCES)/C/envsound.c\
41+
$(SOURCES)/C/event.c\
42+
$(SOURCES)/C/felony.c\
43+
$(SOURCES)/C/fmvplay.c\
44+
$(SOURCES)/C/gamesnd.c\
45+
$(SOURCES)/C/glaunch.c\
46+
$(SOURCES)/C/handling.c\
47+
$(SOURCES)/C/job_fx.c\
48+
$(SOURCES)/C/loadsave.c\
49+
$(SOURCES)/C/loadview.c\
50+
$(SOURCES)/C/main.c\
51+
$(SOURCES)/C/map.c\
52+
$(SOURCES)/C/mc_snd.c\
53+
$(SOURCES)/C/mdraw.c\
54+
$(SOURCES)/C/mgeneric.c\
55+
$(SOURCES)/C/mission.c\
56+
$(SOURCES)/C/models.c\
57+
$(SOURCES)/C/motion_c.c\
58+
$(SOURCES)/C/objanim.c\
59+
$(SOURCES)/C/objcoll.c\
60+
$(SOURCES)/C/overlay.c\
61+
$(SOURCES)/C/overmap.c\
62+
$(SOURCES)/C/pad.c\
63+
$(SOURCES)/C/pause.c\
64+
$(SOURCES)/C/pedest.c\
65+
$(SOURCES)/C/players.c\
66+
$(SOURCES)/C/pres.c\
67+
$(SOURCES)/C/replays.c\
68+
$(SOURCES)/C/roadbits.c\
69+
$(SOURCES)/C/scores.c\
70+
$(SOURCES)/C/search.c\
71+
$(SOURCES)/C/shadow.c\
72+
$(SOURCES)/C/sky.c\
73+
$(SOURCES)/C/sound.c\
74+
$(SOURCES)/C/spool.c\
75+
$(SOURCES)/C/state.c\
76+
$(SOURCES)/C/system.c\
77+
$(SOURCES)/C/targets.c\
78+
$(SOURCES)/C/texture.c\
79+
$(SOURCES)/C/tile.c\
80+
$(SOURCES)/C/time.c\
81+
$(SOURCES)/C/sysclock.c\
82+
$(SOURCES)/C/wheelforces.c\
83+
$(SOURCES)/C/xaplay.c\
84+
$(SOURCES)/C/xmplay.c
85+
86+
# overlay sources
87+
SRCS += \
88+
$(SOURCES)/Frontend/FEmain.c\
89+
$(SOURCES)/C/pathfind.c\
90+
$(SOURCES)/C/leadai.c
91+
92+
SRCS += $(PSYQ_DIR)/common/crt0/crt0.s
93+
INCL = $(SOURCES) $(PSYQ_DIR)/include
94+
95+
DEFS = PSX NTSC_VERSION RELOC DEBUG_OPTIONS
96+
97+
NOWARNS = write-strings narrowing
98+
99+
CPPFLAGS += -x c++ -fno-threadsafe-statics $(addprefix -D,$(DEFS)) $(addprefix -I,$(INCL)) $(addprefix -Wno-,$(NOWARNS))
100+
101+
# Psy-Q libraries
102+
LIBS = api c card etc gpu gte math mcrd pad snd spu cd
103+
104+
LDFLAGS += -L$(PSYQ_DIR)/lib
105+
LDFLAGS += -Wl,--start-group
106+
LDFLAGS += $(addprefix -l,$(LIBS))
107+
LDFLAGS += -Wl,--end-group
108+
109+
include common.mk

PSXToolchain/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Playstation build toolchain
2+
3+
In order to start building a Playstation version of **REDRIVER2** you'll need to perform following steps:
4+
5+
- Put **mipsel-unknown-elf** toolchain to this folder (https://github.com/majenkotech/mipsel-unknown-elf/releases)
6+
- Obtain Psy-Q libraries converted for latest GCC
7+
- Execute **psx_build.bat**

PSXToolchain/SYSTEM.CNF

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BOOT = cdrom:\DRIVER2.EXE;1
2+
TCB = 4
3+
EVENT = 10
4+
STACK = 801ffff0

PSXToolchain/common.mk

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
BUILD ?= Release
2+
3+
HAS_LINUX_MIPS_GCC = $(shell which mipsel-linux-gnu-gcc > /dev/null 2> /dev/null && echo true || echo false)
4+
5+
ifeq ($(HAS_LINUX_MIPS_GCC),true)
6+
PREFIX ?= mipsel-linux-gnu
7+
FORMAT ?= elf32-tradlittlemips
8+
else
9+
PREFIX ?= mipsel-unknown-elf
10+
FORMAT ?= elf32-littlemips
11+
endif
12+
13+
# weird but it works
14+
define \n
15+
16+
17+
endef
18+
19+
ROOTDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
20+
21+
CC = $(PREFIX)-gcc
22+
CXX = $(PREFIX)-g++
23+
24+
TYPE ?= cpe
25+
LDSCRIPT ?= $(ROOTDIR)/$(TYPE).ld
26+
ifneq ($(strip $(OVERLAYSCRIPT)),)
27+
LDSCRIPT := $(addprefix $(OVERLAYSCRIPT) , -T$(LDSCRIPT))
28+
else
29+
LDSCRIPT := $(addprefix $(ROOTDIR)/default.ld , -T$(LDSCRIPT))
30+
endif
31+
32+
USE_FUNCTION_SECTIONS ?= true
33+
34+
ARCHFLAGS = -march=mips1 -mabi=32 -EL -fno-pic -mno-shared -mno-abicalls -mfp32 -msoft-float
35+
ARCHFLAGS += -fno-stack-protector -nostdlib -ffreestanding
36+
37+
ifeq ($(USE_FUNCTION_SECTIONS),true)
38+
CPPFLAGS += -ffunction-sections
39+
endif
40+
41+
CPPFLAGS += -mno-gpopt -fomit-frame-pointer
42+
CPPFLAGS += -fno-builtin -fno-strict-aliasing -Wno-attributes
43+
CPPFLAGS += $(ARCHFLAGS)
44+
CPPFLAGS += -I$(ROOTDIR)
45+
46+
LDFLAGS += -Wl,-Map=$(BINDIR)$(TARGET).map -nostdlib -T$(LDSCRIPT) -static -Wl,--gc-sections
47+
LDFLAGS += $(ARCHFLAGS) -Wl,--oformat=$(FORMAT)
48+
49+
# don't do O1/O2/O3 since it will grow code size
50+
CPPFLAGS_Release += -Os
51+
LDFLAGS_Release += -Os
52+
53+
CPPFLAGS_Debug += -O0
54+
55+
LDFLAGS += -g
56+
CPPFLAGS += -g
57+
58+
CPPFLAGS += $(CPPFLAGS_$(BUILD))
59+
LDFLAGS += $(LDFLAGS_$(BUILD))
60+
61+
OBJS += $(addsuffix .o, $(basename $(SRCS)))
62+
63+
all: dep $(BINDIR)$(TARGET).$(TYPE)
64+
65+
$(BINDIR)$(TARGET).$(TYPE): $(BINDIR)$(TARGET).elf
66+
$(PREFIX)-objcopy $(addprefix -R , $(OVERLAYSECTION)) -O binary $< $@
67+
$(foreach ovl, $(OVERLAYSECTION), $(PREFIX)-objcopy -j $(ovl) -O binary $< $(BINDIR)Overlay$(ovl) $(\n))
68+
69+
$(BINDIR)$(TARGET).elf: $(OBJS)
70+
$(CC) -g -o $(BINDIR)$(TARGET).elf $(OBJS) $(LDFLAGS)
71+
72+
%.o: %.s
73+
$(CC) $(ARCHFLAGS) -I$(ROOTDIR) -g -c -o $@ $<
74+
75+
%.dep: %.c
76+
$(CC) $(CPPFLAGS) $(CFLAGS) -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $<
77+
78+
%.dep: %.cpp
79+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $<
80+
81+
%.dep: %.cc
82+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -M -MT $(addsuffix .o, $(basename $@)) -MF $@ $<
83+
84+
# A bit broken, but that'll do in most cases.
85+
%.dep: %.s
86+
echo. 2> $@
87+
88+
DEPS := $(patsubst %.cpp, %.dep,$(filter %.cpp,$(SRCS)))
89+
DEPS := $(patsubst %.cc, %.dep,$(filter %.cc,$(SRCS)))
90+
DEPS += $(patsubst %.c, %.dep,$(filter %.c,$(SRCS)))
91+
DEPS += $(patsubst %.s, %.dep,$(filter %.s,$(SRCS)))
92+
93+
dep: $(DEPS)
94+
95+
clean:
96+
rm -f $(OBJS) $(BINDIR)Overlay.* $(BINDIR)*.elf $(BINDIR)*.ps-exe $(BINDIR)*.map $(DEPS)
97+
98+
ifneq ($(MAKECMDGOALS), clean)
99+
ifneq ($(MAKECMDGOALS), deepclean)
100+
-include $(DEPS)
101+
endif
102+
endif
103+
104+
.PHONY: clean dep all

PSXToolchain/licensea.dat

27.4 KB
Binary file not shown.

PSXToolchain/makecd.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mkpsxiso.exe -lba2 redriver2.txt -lba redriver2_.txt redriver2_cd.xml
2+
3+
pause

0 commit comments

Comments
 (0)