Skip to content

Commit

Permalink
Updated tools to encrypt EBOOT. Also fixed PSP GO bug
Browse files Browse the repository at this point in the history
  • Loading branch information
krazynez committed Aug 31, 2024
1 parent 8f5d6d2 commit 292b8a3
Show file tree
Hide file tree
Showing 36 changed files with 1,900 additions and 21 deletions.
11 changes: 6 additions & 5 deletions src/Makefile.signed
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
UNAME := $(shell uname)
release: all
ifeq ($(UNAME), Linux)
WINEPREFIX=$(shell pwd)/prefix wine bin/prxEncrypter.exe $(TARGET).prx
bin/psptools/pack_ms_game.py --vanity "$(PSP_EBOOT_TITLE)" EBOOT.PBP EBOOT.PBP
else
bin\prxEncrypter.exe $(TARGET).prx
bin\\psptools\\pack_ms_game.py --vanity "$(PSP_EBOOT_TITLE)" EBOOT.PBP EBOOT.PBP
endif
pack-pbp $(EXTRA_TARGETS) PARAM.SFO icon0.png NULL NULL NULL NULL data.psp NULL
rm -f data.psp
unpack-pbp EBOOT.PBP
pack-pbp $(EXTRA_TARGETS) PARAM.SFO icon0.png NULL NULL NULL NULL DATA.PSP NULL
rm -f DATA.PSP
rm -f downgrade_ctrl.h
rm -f downgrade660_ctrl.h
@mkdir -p PSP/GAME/ChronoSwitch
Expand All @@ -26,7 +27,7 @@ LIBS = -lpsppower
PSP_FW_VERSION = 271

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Chronoswitch Downgrader v7.4
PSP_EBOOT_TITLE = Chronoswitch Downgrader v7.5

BUILD_PRX = 1

Expand Down
Binary file removed src/bin/prxEncrypter.exe
Binary file not shown.
22 changes: 22 additions & 0 deletions src/bin/psptools/pack_btcnf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

import argparse

from psptool.pack import pack_btcnf
from psptool.prx import encrypt

parser = argparse.ArgumentParser(description="Infinity Boot Config Packer")
parser.add_argument('input', type=argparse.FileType('rb'),
help='The raw text file to pack')
parser.add_argument('--vanity', type=str,
help='Some vanity text in the executable header')
parser.add_argument('output', type=str,
help='The output to write the packed text')
args = parser.parse_args()

executable = args.input.read()
executable = encrypt(pack_btcnf(executable,
psptag=0x00000000), vanity=args.vanity)

with open(args.output, 'wb') as f:
f.write(executable)
22 changes: 22 additions & 0 deletions src/bin/psptools/pack_kernel_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

import argparse

from psptool.pack import pack_prx
from psptool.prx import encrypt

parser = argparse.ArgumentParser(description="Infinity Kernel Module Packer")
parser.add_argument('input', type=argparse.FileType('rb'),
help='The raw kernel PRX to pack')
parser.add_argument('--vanity', type=str,
help='Some vanity text in the executable header')
parser.add_argument('output', type=str,
help='The output to write the packed PRX')
args = parser.parse_args()

executable = args.input.read()
executable = encrypt(pack_prx(executable, is_pbp=False,
psptag=lambda x: 0x00000000), vanity=args.vanity)

with open(args.output, 'wb') as f:
f.write(executable)
30 changes: 30 additions & 0 deletions src/bin/psptools/pack_ms_game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

import argparse

from psptool.pbp import is_pbp, PBP
from psptool.pack import pack_prx
from psptool.prx import encrypt

parser = argparse.ArgumentParser(description="Infinity Game Packer")
parser.add_argument('input', type=argparse.FileType('rb'),
help='The raw PBP to pack')
parser.add_argument('--vanity', type=str,
help='Some vanity text in the executable header')
parser.add_argument('output', type=str,
help='The output to write the packed PBP')
args = parser.parse_args()

executable = args.input.read()

if not is_pbp(executable):
raise ValueError("not a PBP")

# Although there are several tags for MS demos, 0x0C000000 is the most
# portable as it exists in every firmware
pbp = PBP(executable)
pbp.prx = encrypt(pack_prx(pbp.prx, is_pbp=True,
psptag=lambda x: 0x0C000000), vanity=args.vanity)

with open(args.output, 'wb') as f:
f.write(pbp.pack())
28 changes: 28 additions & 0 deletions src/bin/psptools/pack_updater.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3

import argparse

from psptool.pbp import is_pbp, PBP
from psptool.pack import pack_prx
from psptool.prx import encrypt

parser = argparse.ArgumentParser(description="Infinity Updater Packer")
parser.add_argument('input', type=argparse.FileType('rb'),
help='The raw PBP to pack')
parser.add_argument('--vanity', type=str,
help='Some vanity text in the executable header')
parser.add_argument('output', type=str,
help='The output to write the packed PBP')
args = parser.parse_args()

executable = args.input.read()

if not is_pbp(executable):
raise ValueError("not a PBP")

pbp = PBP(executable)
pbp.prx = encrypt(pack_prx(pbp.prx, is_pbp=True,
psptag=lambda x: 0x0B000000), vanity=args.vanity)

with open(args.output, 'wb') as f:
f.write(pbp.pack())
22 changes: 22 additions & 0 deletions src/bin/psptools/pack_user_fw_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

import argparse

from psptool.pack import pack_prx
from psptool.prx import encrypt

parser = argparse.ArgumentParser(
description="Infinity User Firmware Module Packer")
parser.add_argument('input', type=argparse.FileType('rb'),
help='The raw user PRX to pack')
parser.add_argument('--id', type=str, help='The btcnf id to set')
parser.add_argument('output', type=str,
help='The output to write the packed PRX')
args = parser.parse_args()

executable = args.input.read()
executable = encrypt(pack_prx(executable, is_pbp=False,
psptag=lambda x: 0x457B8AF0), id=bytes.fromhex(args.id))

with open(args.output, 'wb') as f:
f.write(executable)
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

2 comments on commit 292b8a3

@Yoti
Copy link

@Yoti Yoti commented on 292b8a3 Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to exclude __pycache__ dir from git repo.

@krazynez
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to exclude __pycache__ dir from git repo.

Oops yeah let me remove that.

Please sign in to comment.