Skip to content

Commit

Permalink
Original Files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Lopez committed Jan 11, 2022
1 parent b883a34 commit e13ad89
Show file tree
Hide file tree
Showing 467 changed files with 48,591 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
syntax: glob
*.o
*.prx
dist/
*.elf
.*.sw?
*~
*.rej
*.orig
*.PBP
*.bat
*.SFO
*.bin
rebootbuffer/payload.h
exploit/main.s
rebootbuffer/main.s
libs/libpspsystemctrl_user.a
libs/libpspsystemctrl_kernel.a
libs/libpspkubridge.a
libs/SystemCtrlForUser/libpspsystemctrl_user.a
libs/SystemCtrlForKernel/libpspsystemctrl_kernel.a
libs/KUBridge/libpspkubridge.a
rebootbuffer/psidhash.c
*.pyc
libs/libpspsemaphore.a
exploit/psidhash.c
rebootbuffer/reboot.bin.gz
.config
libs/libansic.a
libs/ansi-c/libansic.a
libs/libdebug.a
libs/colordebugger/libcolordebugger.a
libs/libcolordebugger.a
libs/psid/libpsid.a
libs/libpsid.a
libs/debug/libdebug.a
systemctrl/_.sw?
*.Po
loader/encLoader/encLoader.h
loader/encLoader/enclink.l
exploit/link.l
loader/link.l
exploit/exploit.h
libs/libsmartstub.a
libs/smartstub/libsmartstub.a
loader/H2.BIN
93 changes: 93 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Number of Compilation Threads
OPT=-j8

PROVITA ?= $(CURDIR)
POPSMAN_VERSION ?= VERSION_180
POPS_VERSION ?= VERSION_PSP
USE_FLASH0_ARK ?= 1
SAVE ?= -1

export DEBUG DISABLE_PSID_CHECK FIRMWARE PSID GAME KXPLOIT PROVITA RELEASE SAVE
export POPSMAN_VERSION POPS_VERSION
export PSID_DUMP KERNEL_DUMP FLASH_DUMP FLASH_RESTORE

SUBDIRS = libs systemctrl galaxy stargate exitgame provsh popcorn inferno rebootbuffer exploit loader/encLoader loader contrib/PC/btcnf
.PHONY: subdirs $(SUBDIRS) cleanobj clean cleanobj distclean copy-bin mkdir-dist encrypt-prx

all: subdirs mkdir-dist copy-bin encrypt-prx

copy-bin: loader/h.bin contrib/PC/btcnf/pspbtinf.bin contrib/PC/btcnf/pspbtmnf.bin contrib/PC/btcnf/pspbtnnf.bin contrib/PSP/fake.cso provsh/EBOOT.PBP
$(Q)cp loader/h.bin dist/H.BIN
$(Q)cp exploit/k.enc.bin dist/K.BIN
$(Q)cp contrib/PC/btcnf/pspbtinf.bin dist/PSPBTINF.BIN
$(Q)cp contrib/PC/btcnf/pspbtmnf.bin dist/PSPBTMNF.BIN
$(Q)cp contrib/PC/btcnf/pspbtnnf.bin dist/PSPBTNNF.BIN
$(Q)cp contrib/PSP/fake.cso dist/FAKECSO0.BIN
$(Q)cp provsh/EBOOT.PBP dist/VBOOTPBP.BIN

encrypt-prx: \
dist/MODULE.BIN dist/SYSCTRL0.BIN dist/GALAXY00.BIN dist/INFERNO0.BIN dist/STARGATE.BIN dist/EXITGAME.BIN dist/POPCORN0.BIN \
dist/MARCH330.BIN dist/POPSMAN0.BIN dist/POPS.BIN dist/PSPVMC00.BIN dist/MEDIASYN.BIN dist/H.BIN
ifeq ($(USE_FLASH0_ARK), 1)
$(Q)python contrib/PC/pack/pack.py -p dist/FLASH0.ARK contrib/PC/pack/packlist.txt
else
$(Q)-rm -f dist/FLASH0.ARK
endif
# in the end always destroy tmp release key cache
$(Q)-rm -f $(tmpReleaseKey)


# Only clean non-library code
cleanobj:
$(Q)$(MAKE) clean CLEANOBJ=1

distclean clean:
ifndef CLEANOBJ
$(Q)$(MAKE) $@ -C libs
endif
$(Q)$(MAKE) $@ -C rebootbuffer
$(Q)$(MAKE) $@ -C exploit
$(Q)$(MAKE) $@ -C loader/encLoader
$(Q)$(MAKE) $@ -C loader
$(Q)$(MAKE) $@ -C systemctrl
$(Q)$(MAKE) $@ -C galaxy
$(Q)$(MAKE) $@ -C stargate
$(Q)$(MAKE) $@ -C exitgame
$(Q)$(MAKE) $@ -C provsh
$(Q)$(MAKE) $@ -C popcorn
$(Q)$(MAKE) $@ -C inferno
$(Q)-rm -rf dist *~ | true
$(Q)-rm -f contrib/PC/btcnf/pspbtinf.bin
$(Q)-rm -f contrib/PC/btcnf/pspbtmnf.bin
$(Q)-rm -f contrib/PC/btcnf/pspbtnnf.bin

subdirs: $(SUBDIRS)

$(filter-out libs, $(SUBDIRS)): libs
$(Q)$(MAKE) $(OPT) -C $@

libs:
$(Q)$(MAKE) $(OPT) -C $@

exploit: rebootbuffer

loader: exploit

mkdir-dist:
$(Q)mkdir dist | true

-include $(PROVITA)/.config
include $(PROVITA)/common/check.mak
include $(PROVITA)/common/quiet.mak
include $(PROVITA)/common/mod_enc.mak

ifeq ($(RELEASE), 1)
tmpReleaseKey=/tmp/psid_key
PSID = `if [ -f $(tmpReleaseKey) ]; \
then :; \
else od -A n -t x -N 16 /dev/urandom | tr -d ' ' | tr '[:lower:]' '[:upper:]' > $(tmpReleaseKey); \
fi; \
cat $(tmpReleaseKey);`;
#PSID=$(od -A n -t x -N 16 /dev/urandom | tr -d ' ' | tr '[:lower:]' '[:upper:]')
DISABLE_PSID_CHECK = 1
endif
59 changes: 59 additions & 0 deletions common/ansi-c/functions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* This file is part of PRO CFW.
* PRO CFW is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* PRO CFW is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ .
*/

#ifndef _ANSI_C_FUNCTIONS_H_
#define _ANSI_C_FUNCTIONS_H_

/*
* This is the main function prototype header of the ANSI-C Functions.
* Use it if your lowlevel binary consists of multiple source files.
*/

// Minimal Memcpy Implementation
void *memcpy(void *to_, const void *from_, unsigned int size);

// Minimal Memset Implementation
void *memset(void * buffer_, int value, unsigned int size);

// Check String Prefix
int strbeginswith(char * base, char * prefix);

// Copy String Buffer
char *strcpy(char *to, const char *from);

// Return Length of String in Bytes (without terminator)
unsigned int strlen(const char * text);

// Replace Character in String
unsigned int strreplaceall(char * base, char from, char to);

// Framebuffer Painter (for debugging)
void colorDebug(unsigned int color);

// Framebuffer Color Freeze Loop (for debugging)
void colorLoop(void);

// Lightweight String Conversion for Debug Screen Output (not threadsafe)
char * hex32(unsigned int v);

// memmove
void *memmove(void * to, const void * from, unsigned int length);

int strcmp(const char *a, const char *b);

#endif

59 changes: 59 additions & 0 deletions common/ansi-c/strhex32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* This file is part of PRO CFW.
* PRO CFW is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* PRO CFW is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ .
*/

#ifndef _ANSI_C_STRHEX32_H_
#define _ANSI_C_STRHEX32_H_

/*
* The ANSI-C Headers are ment for a ONE-TIME-INCLUSION into a lowlevel
* executable like the Exploit Payload or the Reboot Buffer!
*
* For other, more highlevel, applications like PRX Modules,
* please use the Kernel Libc or PSPSDK / Newlib Libc.
*/

// Lightweight String Conversion for Debug Screen Output (not threadsafe)
char * hex32(unsigned int v)
{
// Result String
static char result[9];

// Iterate Nibbles
unsigned int i = 0; for(; i < 8; i++)
{
// Fetch Nibble
char nibble = (char)((v >> (i << 2)) & 0xF);

// Number
if(nibble >= 0 && nibble <= 9) nibble += '0';

// Character
else nibble += 'A' - 0xA;

// Copy Character
result[7 - i] = nibble;
}

// Terminate String
result[8] = 0;

// Return String
return result;
}

#endif

46 changes: 46 additions & 0 deletions common/beauty.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ifeq ($(V), 1)
quiet =
Q =
else
quiet = quiet_
Q = @
endif

quiet_cmd_cc_o_c = CC $<
cmd_cc_o_c = $(CC) $(CFLAGS) -c $< -o $@

%.o: %.c
@echo $($(quiet)cmd_cc_o_c)
@$(cmd_cc_o_c)

quiet_cmd_cc_o_S = CC $<
cmd_cc_o_S = $(CC) $(CFLAGS) -c $< -o $@

%.o: %.S
@echo $($(quiet)cmd_cc_o_c)
@$(cmd_cc_o_c)

quiet_cmd_build_exports = BUILD-EXPORTS $@
cmd_build_exports = psp-build-exports -b $< > $@

%.c: %.exp
@echo $($(quiet)cmd_build_exports)
@$(cmd_build_exports)

quiet_cmd_link = LINKING $@
cmd_link = $(LINK.c) $^ $(LIBS) -o $@

quiet_cmd_fixup = FIXUP $@
cmd_fixup = $(FIXUP) $@

ifeq ($(NO_FIXUP_IMPORTS), 1)
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ)
@echo $($(quiet)cmd_link)
@$(cmd_link)
else
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ)
@echo $($(quiet)cmd_link)
@$(cmd_link)
@echo $($(quiet)cmd_fixup)
@$(cmd_fixup)
endif
19 changes: 19 additions & 0 deletions common/beauty_bin.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
quiet_cmd_compile = CC $<
cmd_compile = $(CC) $(CFLAGS) -c $< -o $@
quiet_cmd_link = LINK $@
cmd_link = $(LD) -T $(LINKFILE) $^ -o $@ $(LIBS)
#quiet_cmd_genpsid = GENPSID $@ $(PSID)
quiet_cmd_genlink = GENLINK $@ $(LOADADDR)
#cmd_genpsid = python $(PROVITA)/contrib/PC/psid/genpsidhash.py $(PSID) $@

%.o: %.c
@echo $($(quiet)cmd_compile)
@$(cmd_compile)

%.elf: %.o
@echo $($(quiet)cmd_link)
@$(cmd_link)

#psidhash.c:
# @echo $($(quiet)cmd_genpsid)
# @$(cmd_genpsid)
28 changes: 28 additions & 0 deletions common/beauty_gendep.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DEP_DIR = .deps
DEP_SUFFIX = .Po
ifeq ($(MAKECMDGOALS), distclean)
EXTRA_CLEAN += $(DEP_DIR)/*$(DEP_SUFFIX)
endif

ifneq ($(MAKECMDGOALS), distclean)
ifneq ($(MAKECMDGOALS), clean)
DEP_FILES = $(addprefix $(DEP_DIR)/,$(notdir $(patsubst %.o,%$(DEP_SUFFIX),$(C_OBJS))))

ifneq ($(strip $(DEP_FILES)),)
-include $(DEP_FILES)
endif
endif
endif

.phony: distclean
distclean: clean

$(DEP_DIR):
mkdir $@ | true

quiet_cmd_dep = DEP $(DEP_DIR)/$(notdir $@)
cmd_dep = python $(PROVITA)/contrib/PC/gendep/gendep.py $(DEP_DIR)/$(notdir $@) $(CC) -MM $(CFLAGS) $<

$(DEP_DIR)/%$(DEP_SUFFIX): %.c $(DEP_DIR)
@echo $($(quiet)cmd_dep)
@$(cmd_dep)
25 changes: 25 additions & 0 deletions common/beauty_lib.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
quiet_cmd_cc_o_c = CC $<
cmd_cc_o_c = $(CC) $(CFLAGS) -c $< -o $@

CFLAGS := $(addprefix -I,$(INCDIR)) $(CFLAGS)

%.o: %.c
@echo $($(quiet)cmd_cc_o_c)
@$(cmd_cc_o_c)

quiet_cmd_ar = AR $@
cmd_ar = psp-ar q $(TARGET_LIB) $(OBJS)

quiet_cmd_ranlib = RANLIB $@
cmd_ranlib = psp-ranlib $(TARGET_LIB)

$(TARGET_LIB): $(OBJS)
@echo $($(quiet)cmd_ar)
@$(cmd_ar)
@echo $($(quiet)cmd_ranlib)
@$(cmd_ranlib)

.phony: clean

clean:
$(Q)rm -f $(OBJS) $(TARGET_LIB) $(EXTRA_CLEAN)
Loading

0 comments on commit e13ad89

Please sign in to comment.