-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Build objects | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Addresses | ||
TEXT ?= 0x400000 | ||
DATA ?= 0x3d8000 | ||
ABI ?= 0x3d0000 | ||
|
||
# Variables | ||
SYSTEM ?= PCSX2 | ||
|
||
# Binaries | ||
PREFIX = mips64r5900el-ps2-elf- | ||
CPP = $(PREFIX)g++ | ||
OKRAGER = okrager | ||
|
||
# Directories | ||
BDIR = bin | ||
ODIR = build | ||
SDIR = src | ||
|
||
# Files | ||
CPPFILES = $(wildcard $(SDIR)/*.cpp $(SDIR)/*/*.cpp) | ||
OBJS = $(patsubst $(SDIR)/%.cpp, $(ODIR)/%.o, $(CPPFILES)) | ||
|
||
# Save files | ||
ifeq ($(SYSTEM), PCSX2) | ||
SAVE_IN ?= $(BDIR)/clean/Mcd001.ps2 | ||
SAVE_OUT ?= $(BDIR)/$(SYSTEM)/Mcd001.ps2 | ||
else ifeq ($(SYSTEM), $(filter $(SYSTEM),PS4 PS5)) | ||
SAVE_IN ?= $(BDIR)/clean/VMC0.card | ||
SAVE_OUT ?= $(BDIR)/$(SYSTEM)/VMC0.card | ||
endif | ||
|
||
# Flags | ||
LINKFLAGS = -Wl,-z,max-page-size=0x1,--section-start=.MIPS.abiflags=$(ABI) | ||
CPPFLAGS = -Tdata=$(DATA) -Ttext=$(TEXT) -mno-gpopt -nostartfiles -nostdlib -nodefaultlibs -ffreestanding $(LINKFLAGS) -I. -D$(SYSTEM)=1 | ||
|
||
# Target | ||
TARGET = $(shell basename $(CURDIR))-$(SYSTEM).elf | ||
|
||
all: compile save | ||
|
||
save: $(SAVE_IN) $(SAVE_OUT) | ||
$(OKRAGER) $(SAVE_IN) $(SAVE_OUT) $(BDIR)/$(TARGET) | ||
|
||
compile: $(ODIR) $(BDIR) $(OBJS) crt0 | ||
$(CPP) $(CPPFLAGS) $(ODIR)/crt0.o $(OBJS) -o $(BDIR)/$(TARGET) | ||
|
||
crt0: | ||
$(CPP) $(CPPFLAGS) -c $(SDIR)/crt0.S -o $(ODIR)/crt0.o | ||
|
||
$(ODIR)/%.o: $(SDIR)/%.cpp | ||
@mkdir -p $(shell dirname $@) | ||
$(CPP) -c -o $@ $< $(CPPFLAGS) | ||
|
||
$(BDIR) $(ODIR) $(SAVE_IN) $(SAVE_OUT): | ||
@mkdir -p $(shell dirname $@) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(BDIR)/$(TARGET) $(ODIR) $(BDIR)/$(SYSTEM) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# PCSX2 | ||
make clean SYSTEM=PCSX2 | ||
make SYSTEM=PCSX2 | ||
|
||
# PS4 | ||
make clean SYSTEM=PS4 | ||
make SYSTEM=PS4 | ||
|
||
# PS5 | ||
make clean SYSTEM=PS5 | ||
make SYSTEM=PS5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.text | ||
|
||
.global __start | ||
__start: | ||
j main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <cstdint> | ||
|
||
typedef char* fStrncpy(char* destination, const char* source, unsigned int num); | ||
typedef int fStrlen(const char* str); | ||
|
||
fStrncpy* strncpy = (fStrncpy*)0x001f1e60; | ||
fStrlen* strlen = (fStrlen*)0x001f1b70; | ||
|
||
// Okage (System Dynamic) | ||
#if (defined(PCSX2) && PCSX2) | ||
#define OKAGE_SCREEN_LOAD_NAME 0x008B8C40 | ||
#define OKAGE_SCREEN_LOAD_LOCATION 0x008B99C0 | ||
#elif ((defined(PS4) && PS4) || (defined(PS5) && PS5)) | ||
#define OKAGE_SCREEN_LOAD_NAME 0x008B8B10 | ||
#define OKAGE_SCREEN_LOAD_LOCATION 0x008B98A0 | ||
#endif | ||
|
||
extern "C" | ||
{ | ||
void* memset(void* str, int c, int n) | ||
{ | ||
for (int i = 0; i < n; i++) | ||
*((uint8_t*)str + i) = (uint8_t)c; | ||
return str; | ||
} | ||
} | ||
|
||
void main() | ||
{ | ||
#if (defined(PS4) && PS4) | ||
const char* system = "Hello PS4!\\n"; | ||
#elif (defined(PS5) && PS5) | ||
const char* system = "Hello PS5!\\n"; | ||
#elif (defined(PCSX2) && PCSX2) | ||
const char* system = "Hello PCSX2!\\n"; | ||
#endif | ||
|
||
// Change load name | ||
strncpy((char*)(OKAGE_SCREEN_LOAD_NAME), "\\f[2]Twitter\x81""F@_mccaulay", 25); | ||
|
||
// Move location text to read-able area | ||
strncpy((char*)(OKAGE_SCREEN_LOAD_LOCATION), "\\n\\n", 4); | ||
|
||
// Clear previous location overflow text | ||
memset((char*)(OKAGE_SCREEN_LOAD_LOCATION + 4), 0x00, 0x160); | ||
|
||
// Set system string | ||
strncpy((char*)(OKAGE_SCREEN_LOAD_LOCATION + 4), system, strlen(system)); | ||
} |