Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
krazynez committed Apr 21, 2024
1 parent 75f9b51 commit b7b1a9d
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
- Can now install `cIPL` on all `PSP` models.
- Added `FinalSpeed` for easier access to `Live` installations.
- Several other small fixes and improvements.
- Updated `Despertar del Cementerio` to `Version 10`. Now compatible with all PSP models.
- Can now install `cIPL` on all PSP models.
- `Custom App` location has been changed to `/PSP/APP/CUSTOM/EBOOT.PBP`
#### Rev 1
- Updated `DC-ARK` (PSP version) to decrypt PSP GO Firmware. Must be put on the root of memory stick as `661GO.PBP`
- Fixed a bug in `Despertar del Cementerio` where it could not repartion lflash, was missing `lflash_fdisk.prx`

## Version 4.20.68 (2024-02-06)
- https://github.com/PSP-Archive/ARK-4/releases/tag/r42068
Expand Down
2 changes: 1 addition & 1 deletion common/include/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#define ARK_MAJOR_VERSION 4
#define ARK_MINOR_VERSION 20
#define ARK_MICRO_VERSION 69
#define ARK_REVISION 0
#define ARK_REVISION 1
#define MAX_FLASH0_SIZE 0x32000

/*
Expand Down
4 changes: 4 additions & 0 deletions loader/dc/installer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ OBJS = \
ipl_update.h \
dcman.h \
iop.h \
lflash_fdisk.h \
pspdecryptmod.h \
intrafont.h \
resurrection.h \
Expand Down Expand Up @@ -93,6 +94,9 @@ ipl_update.h:
iop.h:
$(Q)bin2c $(ARKROOT)/extras/modules/iop/iop.prx iop.h iop

lflash_fdisk.h:
$(Q)bin2c $(ARKROOT)/contrib/PSP/GAME/ARK_DC/lflash_fdisk.prx lflash_fdisk.h lflash_fdisk

pspdecryptmod.h:
$(Q)bin2c $(ARKROOT)/contrib/PSP/GAME/ARK_DC/pspdecrypt.prx pspdecryptmod.h pspdecrypt

Expand Down
94 changes: 78 additions & 16 deletions loader/dc/installer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>

#include <globals.h>
#include <libpsardumper.h>
Expand Down Expand Up @@ -53,6 +54,7 @@
#include "dcman.h"
#include "ipl_update.h"
#include "iop.h"
#include "lflash_fdisk.h"
#include "pspdecryptmod.h"
#include "intrafont.h"
#include "resurrection.h"
Expand All @@ -63,19 +65,24 @@ PSP_MAIN_THREAD_ATTR(0);

#define UPDATER_VER_STR "6.61"
#define UPDATER "661.PBP"
#define UPDATER_GO "661GO.PBP"

#define PRX_SIZE_661 5718512
#define PRX_SIZE_661_GO 6495584
#define LFLASH_FATFMT_UPDATER_SIZE 0x28A0
#define NAND_UPDATER_SIZE 0x39D0
#define LFATFS_UPDATER_SIZE 0xE970

#define PSAR_SIZE_661 26848656
#define PSAR_SIZE_661_GO 21569584

char boot_path[256];

char error_msg[256];
static int g_running = 0, g_cancel = 0;
static SceUID install_thid = -1;
static int go = 0;


////////////////////////////////////////////////////////////////////
// big buffers for data. Some system calls require 64 byte alignment
Expand Down Expand Up @@ -421,10 +428,11 @@ void ExtractPrxs(int cbFile, SceUID fd)
{
ErrorExit(1000, "Error reading PBP.\n");
}

pspPSARSetBufferPosition(psar_pos);

continue;

}
else if (res == 0) /* no more files */
{
Expand Down Expand Up @@ -616,27 +624,48 @@ static void Extract661Modules()

SetStatus("Extracting " UPDATER_VER_STR " updater modules...");

if (ReadFile("ms0:/" UPDATER, 0, pbp_header, sizeof(pbp_header)) != sizeof(pbp_header))
{
ErrorExit(1000, "Error reading " UPDATER " at root.\n");
if (ReadFile("ms0:/" UPDATER_GO, 0, pbp_header, sizeof(pbp_header)) != sizeof(pbp_header)) {
if (ReadFile("ms0:/" UPDATER, 0, pbp_header, sizeof(pbp_header)) != sizeof(pbp_header))
{
ErrorExit(1000, "Error reading " UPDATER " or " UPDATER_GO " at root.\n");
}
}

if (ReadFile("ms0:/" UPDATER_GO, 0, pbp_header, sizeof(pbp_header)) == sizeof(pbp_header)) {
go = 1;
}

if (g_cancel)
{
CancelInstall();
}

if (ReadFile("ms0:/" UPDATER, *(u32 *)&pbp_header[0x20], g_dataPSAR, PRX_SIZE_661) != PRX_SIZE_661)
{
ErrorExit(1000, "Invalid " UPDATER ".\n");
if(go) {

if (ReadFile("ms0:/" UPDATER_GO, *(u32 *)&pbp_header[0x20], g_dataPSAR, PRX_SIZE_661_GO) != PRX_SIZE_661_GO)
{
ErrorExit(1000, "Invalid " UPDATER_GO ".\n");
}

}
else {
if (ReadFile("ms0:/" UPDATER, *(u32 *)&pbp_header[0x20], g_dataPSAR, PRX_SIZE_661) != PRX_SIZE_661)
{
ErrorExit(1000, "Invalid " UPDATER ".\n");
}
}

if (g_cancel)
CancelInstall();

sceKernelDelayThread(10000);

size = pspDecryptPRX(g_dataPSAR, g_dataPSAR, PRX_SIZE_661);
if(go) {
size = pspDecryptPRX(g_dataPSAR, g_dataPSAR, PRX_SIZE_661_GO);
}
else {
size = pspDecryptPRX(g_dataPSAR, g_dataPSAR, PRX_SIZE_661);
}
if (size <= 0)
{
ErrorExit(1000, "Error decrypting " UPDATER_VER_STR " updater.\n");
Expand All @@ -647,18 +676,28 @@ static void Extract661Modules()

sceKernelDelayThread(10000);

size = pspDecryptPRX(g_dataPSAR+0x4E6380, g_dataOut, LFLASH_FATFMT_UPDATER_SIZE);
if(go) {
size = pspDecryptPRX(g_dataPSAR+0x5A43C0, g_dataOut, LFLASH_FATFMT_UPDATER_SIZE);
}
else {
size = pspDecryptPRX(g_dataPSAR+0x4E6380, g_dataOut, LFLASH_FATFMT_UPDATER_SIZE);
}
if (size <= 0)
{
ErrorExit(1000, "Error decoding lflash_fatfmt_updater.prx\n");
ErrorExit(1000, "Error decoding lflash_fatfmt_updater.prx: %p\n", g_dataPSAR);
}

if (WriteFile(ARK_DC_PATH "/kd/lflash_fatfmt_updater.prx", g_dataOut, size) != size)
{
ErrorExit(1000, "Error writing lflash_fatfmt_updater.prx.\n");
}

mod_buf = (u8 *)g_dataPSAR+0x21880;
if(go) {
mod_buf = (u8 *)g_dataPSAR+0x215c0;
}
else {
mod_buf = (u8 *)g_dataPSAR+0x21880;
}

DescrambleUpdaterModule(mod_buf, mod_buf, LFATFS_UPDATER_SIZE);

Expand All @@ -678,7 +717,12 @@ static void Extract661Modules()
ErrorExit(1000, "Error writing lfatfs_updater.prx.\n");
}

mod_buf = (u8 *)g_dataPSAR+0x30200;
if (go) {
mod_buf = (u8 *)g_dataPSAR+0x2ff40;
}
else {
mod_buf = (u8 *)g_dataPSAR+0x30200;
}

DescrambleUpdaterModule(mod_buf, mod_buf, NAND_UPDATER_SIZE);

Expand All @@ -705,13 +749,23 @@ static void Extract661PSAR()

SetStatus("Extracting " UPDATER_VER_STR " modules... ");

fd = sceIoOpen("ms0:/" UPDATER, PSP_O_RDONLY, 0);
if(go) {
fd = sceIoOpen("ms0:/" UPDATER_GO, PSP_O_RDONLY, 0);
}
else {
fd = sceIoOpen("ms0:/" UPDATER, PSP_O_RDONLY, 0);
}
if (fd < 0)
{
ErrorExit(1000, "Incorrect or inexistant " UPDATER " at root.\n");
ErrorExit(1000, "Incorrect or inexistant " UPDATER " or " UPDATER_GO " at root.\n");
}

sceIoLseek32(fd, 0x577635, PSP_SEEK_SET);
if(go) {
sceIoLseek32(fd, 0x6351a5, PSP_SEEK_SET);
}
else {
sceIoLseek32(fd, 0x577635, PSP_SEEK_SET);
}
sceIoRead(fd, g_dataPSAR, PSAR_BUFFER_SIZE);

if (g_cancel)
Expand All @@ -728,7 +782,12 @@ static void Extract661PSAR()
CancelInstall();
}

ExtractPrxs(PSAR_SIZE_661, fd);
if(go) {
ExtractPrxs(PSAR_SIZE_661_GO, fd);
}
else {
ExtractPrxs(PSAR_SIZE_661, fd);
}
sceIoClose(fd);
}

Expand Down Expand Up @@ -833,6 +892,9 @@ static void WriteDCFiles()
if (WriteFile(ARK_DC_PATH "/kd/iop.prx", iop, size_iop) != size_iop)
ErrorExit(1000, "Error writing iop.prx");

if (WriteFile(ARK_DC_PATH "/kd/lflash_fdisk.prx", lflash_fdisk, size_lflash_fdisk) != size_lflash_fdisk)
ErrorExit(1000, "Error writing lflash_fdisk.prx");

if (WriteFile(ARK_DC_PATH "/kd/pspdecrypt.prx", pspdecrypt, size_pspdecrypt) != size_pspdecrypt)
ErrorExit(1000, "Error writing pspdecrypt.prx");

Expand Down

0 comments on commit b7b1a9d

Please sign in to comment.