diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4b0706..504455e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,48 @@ All notable changes to the `apollo-ps3` project will be documented in this file.
## [Unreleased]()
+
+### Added
+
+* Auto-detect `X`/`O` button settings
+* New cheat codes
+ - Assassin's Creed II
+ - Grand Theft Auto V
+ - Metal Gear Solid 5: The Phantom Pain
+* Custom decryption support
+ - Metal Gear Solid 5: The Phantom Pain
+* Custom checksum support
+ - Assassin's Creed
+ - Assassin's Creed II
+ - Assassin's Creed III
+ - Assassin's Creed IV: Black Flag
+ - Assassin's Creed: Brotherhood
+ - Assassin's Creed: Revelations
+ - Assassin's Creed Rogue
+ - Castlevania: Lords Of Shadow
+ - Castlevania: Lords Of Shadow 2
+ - Grand Theft Auto V
+ - Metal Gear Solid 5: The Phantom Pain
+
+### Fixed
+
+* Fix exported file attributes on FAT32 drives
+* Fix `BCAS20224` secure file-id key
+
+### Misc
+
+* Network HTTP proxy settings support
+* Updated [`apollo-lib`](https://github.com/bucanero/apollo-lib) Patch Engine to v0.6.0
+ - Add host callbacks (username, system name, wlan mac, psid, account id)
+ - Add `murmu3_32`, `jhash` hash functions
+ - Add Patapon 3 PSP decryption
+ - Add MGS5 decryption (PS3/PS4)
+ - Add Monster Hunter 2G/3rd PSP decryption
+ - Add Castlevania:LoS checksum
+ - Add Rockstar checksum
+ - Fix SaveWizard Code Type C
+ - Fix `right()` on little-endian platforms
+
## [v1.8.4](https://github.com/bucanero/apollo-ps3/releases/tag/v1.8.4) - 2023-04-08
### Added
diff --git a/docs/screenshots/screenshot_main.png b/docs/screenshots/screenshot_main.png
index b9bd673..62f4d02 100644
Binary files a/docs/screenshots/screenshot_main.png and b/docs/screenshots/screenshot_main.png differ
diff --git a/include/common.h b/include/common.h
index 92b70cd..eaf5631 100644
--- a/include/common.h
+++ b/include/common.h
@@ -21,6 +21,7 @@ int mkdirs(const char* dir);
int copy_file(const char* input, const char* output);
int copy_directory(const char* startdir, const char* inputdir, const char* outputdir);
int clean_directory(const char* inputdir);
+int file_chmod(const char* path);
//----------------------------------------
//CONSOLE ID UTILS
diff --git a/include/saves.h b/include/saves.h
index a74171b..f20e191 100644
--- a/include/saves.h
+++ b/include/saves.h
@@ -292,8 +292,8 @@ uint64_t get_account_id(uint32_t user_id);
int create_savegame_folder(const char* folder);
-void ps2_encrypt_image(uint8_t dex_mode, const char* image_name, const char* data_file, char* msg_update);
-void ps2_decrypt_image(uint8_t dex_mode, const char* image_name, const char* data_file, char* msg_update);
+void ps2_encrypt_image(uint8_t cfg_file, const char* image_name, const char* data_file);
+void ps2_decrypt_image(uint8_t dex_mode, const char* image_name, const char* data_file);
void ps2_crypt_vmc(uint8_t dex_mode, const char* vmc_path, const char* vmc_out, int crypt_mode);
int ps2_add_vmc_ecc(const char* src, const char* dst);
int ps2_remove_vmc_ecc(const char* src, const char* dst);
diff --git a/include/settings.h b/include/settings.h
index 35513ec..f487f86 100644
--- a/include/settings.h
+++ b/include/settings.h
@@ -1,5 +1,5 @@
-#define APOLLO_VERSION "1.8.8" //Apollo PS3 version (about menu)
+#define APOLLO_VERSION "1.8.6" //Apollo PS3 version (about menu)
#define MENU_TITLE_OFF 30 //Offset of menu title text from menu mini icon
#define MENU_ICON_OFF 70 //X Offset to start printing menu mini icon
diff --git a/sfo.xml b/sfo.xml
index d2166c8..a32867e 100644
--- a/sfo.xml
+++ b/sfo.xml
@@ -1,7 +1,7 @@
- 01.88
+ 01.86
133
@@ -34,6 +34,6 @@
NP0APOLLO
- 01.84
+ 01.86
diff --git a/source/common.c b/source/common.c
index 3a282ef..04d0151 100644
--- a/source/common.c
+++ b/source/common.c
@@ -137,6 +137,11 @@ int copy_file(const char* input, const char* output)
return (read - written);
}
+int file_chmod(const char* path)
+{
+ return sysLv2FsChmod(path, S_IFMT | 0777);
+}
+
uint32_t file_crc32(const char* input)
{
char buffer[TMP_BUFF_SIZE];
diff --git a/source/exec_cmd.c b/source/exec_cmd.c
index cdc5d90..e2f641a 100644
--- a/source/exec_cmd.c
+++ b/source/exec_cmd.c
@@ -69,9 +69,10 @@ static void _saveOwnerData(const char* path)
sysUtilGetSystemParamString(SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME, buff, SYSUTIL_SYSTEMPARAM_CURRENT_USERNAME_SIZE);
LOG("Saving User '%s'...", buff);
save_xml_owner(path, buff);
+ file_chmod(path);
}
-static uint32_t get_filename_id(const char* dir)
+static uint32_t get_filename_id(const char* dir, const char* title_id)
{
char path[128];
uint32_t tid = 0;
@@ -79,7 +80,7 @@ static uint32_t get_filename_id(const char* dir)
do
{
tid++;
- snprintf(path, sizeof(path), "%s%08d.zip", dir, tid);
+ snprintf(path, sizeof(path), "%s%s-%08d.zip", dir, title_id, tid);
}
while (file_exists(path) == SUCCESS);
@@ -89,9 +90,10 @@ static uint32_t get_filename_id(const char* dir)
static void zipSave(const save_entry_t* entry, int dest)
{
char exp_path[256];
- char* export_file;
+ char export_file[256];
char* tmp;
uint32_t fid;
+ int ret;
_set_dest_path(exp_path, dest, PS3_EXPORT_PATH);
if (mkdirs(exp_path) != SUCCESS)
@@ -102,31 +104,39 @@ static void zipSave(const save_entry_t* entry, int dest)
init_loading_screen("Exporting save game...");
- fid = get_filename_id(exp_path);
- asprintf(&export_file, "%s%08d.zip", exp_path, fid);
+ fid = get_filename_id(exp_path, entry->title_id);
+ snprintf(export_file, sizeof(export_file), "%s%s-%08d.zip", exp_path, entry->title_id, fid);
asprintf(&tmp, entry->path);
*strrchr(tmp, '/') = 0;
*strrchr(tmp, '/') = 0;
- zip_directory(tmp, entry->path, export_file);
+ ret = zip_directory(tmp, entry->path, export_file);
+ free(tmp);
- sprintf(export_file, "%s%08d.txt", exp_path, fid);
- FILE* f = fopen(export_file, "a");
- if (f)
+ if (ret)
{
- fprintf(f, "%08d.zip=[%s] %s\n", fid, entry->title_id, entry->name);
- fclose(f);
- }
-
- sprintf(export_file, "%s" OWNER_XML_FILE, exp_path);
- _saveOwnerData(export_file);
+ snprintf(export_file, sizeof(export_file), "%s%08d.txt", exp_path, apollo_config.user_id);
+ FILE* f = fopen(export_file, "a");
+ if (f)
+ {
+ fprintf(f, "%s-%08d.zip=%s\n", entry->title_id, fid, entry->name);
+ fclose(f);
+ file_chmod(export_file);
+ }
- free(export_file);
- free(tmp);
+ snprintf(export_file, sizeof(export_file), "%s" OWNER_XML_FILE, exp_path);
+ _saveOwnerData(export_file);
+ }
stop_loading_screen();
- show_message("Zip file successfully saved to:\n%s%08d.zip", exp_path, fid);
+ if (!ret)
+ {
+ show_message("Error! Can't export save game to:\n%s", exp_path);
+ return;
+ }
+
+ show_message("Zip file successfully saved to:\n%s%s-%08d.zip", exp_path, entry->title_id, fid);
}
static int _copy_save_usb(const save_entry_t* save, const char* exp_path)
@@ -157,7 +167,7 @@ static void copySave(const save_entry_t* save, int dst, const char* path)
_copy_save_usb(save, exp_path);
stop_loading_screen();
- show_message("Files successfully copied to:\n%s", exp_path);
+ show_message("Files successfully copied to:\n%s%s", exp_path, save->dir_name);
}
static void copyAllSavesUSB(const save_entry_t* save, int dst, int all)
@@ -536,6 +546,7 @@ static void exportLicensesZip(int dst)
sprintf(export_file, "%s" "idps.hex", exp_path);
write_buffer(export_file, (u8*) apollo_config.idps, 16);
+ file_chmod(export_file);
free(export_file);
free(lic_path);
@@ -567,6 +578,7 @@ static void exportFlashZip(int dst)
sprintf(export_file, "%s" "idps.hex", exp_path);
write_buffer(export_file, (u8*) apollo_config.idps, 16);
+ file_chmod(export_file);
free(export_file);
@@ -576,6 +588,7 @@ static void exportFlashZip(int dst)
static void exportTrophiesZip(int dst)
{
+ int ret;
char* export_file;
char* trp_path;
char* tmp;
@@ -596,7 +609,7 @@ static void exportTrophiesZip(int dst)
tmp = strdup(trp_path);
*strrchr(tmp, '/') = 0;
- zip_directory(tmp, trp_path, export_file);
+ ret = zip_directory(tmp, trp_path, export_file);
sprintf(export_file, "%s" OWNER_XML_FILE, exp_path);
_saveOwnerData(export_file);
@@ -606,6 +619,12 @@ static void exportTrophiesZip(int dst)
free(tmp);
stop_loading_screen();
+ if (!ret)
+ {
+ show_message("Error! Failed to export Trophies to Zip");
+ return;
+ }
+
show_message("Trophies successfully saved to:\n%strophies_%08d.zip", exp_path, apollo_config.user_id);
}
@@ -872,6 +891,7 @@ static void exportVM2raw(const char* vm2_path, const char* vm2_file, int dst)
init_loading_screen("Exporting PS2 .VM2 memory card...");
ps2_remove_vmc_ecc(vm2file, dstfile);
+ file_chmod(dstfile);
stop_loading_screen();
show_message("File successfully saved to:\n%s", dstfile);
@@ -887,9 +907,9 @@ static void importPS2classicsCfg(const char* cfg_path, const char* cfg_file)
*strrchr(outfile, '.') = 0;
strcat(outfile, ".ENC");
- init_loading_screen("Encrypting PS2 CONFIG...");
- ps2_encrypt_image(1, ps2file, outfile, NULL);
- stop_loading_screen();
+ init_progress_bar("Encrypting PS2 CONFIG...", cfg_file);
+ ps2_encrypt_image(1, ps2file, outfile);
+ end_progress_bar();
show_message("File successfully saved to:\n%s", outfile);
}
@@ -898,16 +918,15 @@ static void importPS2classics(const char* iso_path, const char* iso_file)
{
char ps2file[256];
char outfile[256];
- char msg[128] = "Encrypting PS2 ISO...";
snprintf(ps2file, sizeof(ps2file), "%s%s", iso_path, iso_file);
snprintf(outfile, sizeof(outfile), PS2ISO_PATH_HDD "%s", iso_file);
*strrchr(outfile, '.') = 0;
strcat(outfile, ".BIN.ENC");
- init_loading_screen(msg);
- ps2_encrypt_image(0, ps2file, outfile, msg);
- stop_loading_screen();
+ init_progress_bar("Encrypting PS2 ISO...", iso_file);
+ ps2_encrypt_image(0, ps2file, outfile);
+ end_progress_bar();
show_message("File successfully saved to:\n%s", outfile);
}
@@ -917,7 +936,6 @@ static void exportPS2classics(const char* enc_path, const char* enc_file, uint8_
char path[256];
char ps2file[256];
char outfile[256];
- char msg[128] = "Decrypting PS2 BIN.ENC...";
if (dst != STORAGE_HDD)
_set_dest_path(path, dst, PS2ISO_PATH);
@@ -935,9 +953,10 @@ static void exportPS2classics(const char* enc_path, const char* enc_file, uint8_
return;
}
- init_loading_screen(msg);
- ps2_decrypt_image(0, ps2file, outfile, msg);
- stop_loading_screen();
+ init_progress_bar("Decrypting PS2 BIN.ENC...", enc_file);
+ ps2_decrypt_image(0, ps2file, outfile);
+ file_chmod(outfile);
+ end_progress_bar();
show_message("File successfully saved to:\n%s", outfile);
}
diff --git a/source/pfd_util.c b/source/pfd_util.c
index f9a7690..5810fe1 100644
--- a/source/pfd_util.c
+++ b/source/pfd_util.c
@@ -427,7 +427,12 @@ int decrypt_save_file(const char* path, const char* fname, const char* outpath,
snprintf(file_path, sizeof(file_path), "%s%s", outpath, fname);
if (write_buffer(file_path, file_data, file_size) < 0)
+ {
+ free(file_data);
return 0;
+ }
+
+ free(file_data);
}
return 1;
}
diff --git a/source/ps2classic.c b/source/ps2classic.c
index 1699a2f..50e70e8 100644
--- a/source/ps2classic.c
+++ b/source/ps2classic.c
@@ -10,6 +10,7 @@
#include "ps2_data.h"
#include "settings.h"
#include "common.h"
+#include "saves.h"
#include
#include
@@ -516,7 +517,7 @@ static void build_ps2_header(u8 * buffer, int npd_type, const char* content_id,
}
-void ps2_decrypt_image(u8 dex_mode, const char* image_name, const char* data_file, char* msg_update)
+void ps2_decrypt_image(u8 dex_mode, const char* image_name, const char* data_file)
{
FILE * in;
FILE * data_out;
@@ -556,6 +557,9 @@ void ps2_decrypt_image(u8 dex_mode, const char* image_name, const char* data_fil
total_size = data_size;
flush_size = total_size / 100;
+ for (i = 0; i < 0x20; c++)
+ update_progress_bar(0, total_size, image_name);
+
LOG("segment size: %x\ndata_size: %lx\n", segment_size, data_size);
//alloc buffers
@@ -596,7 +600,7 @@ void ps2_decrypt_image(u8 dex_mode, const char* image_name, const char* data_fil
if(c >= flush_size) {
percent += 1;
decr_size = decr_size + c;
- sprintf(msg_update, "Decrypted: %ld%% (%d Blocks)", (100*decr_size)/total_size, percent);
+ update_progress_bar(decr_size, total_size, image_name);
LOG("Decrypted: %d Blocks 0x%08lx", percent, decr_size);
c = 0;
}
@@ -619,7 +623,7 @@ static int64_t get_fsize(const char* fname)
return st.st_size;
}
-void ps2_encrypt_image(u8 cfg_mode, const char* image_name, const char* data_file, char* msg_update)
+void ps2_encrypt_image(u8 cfg_mode, const char* image_name, const char* data_file)
{
FILE * in;
FILE * data_out;
@@ -658,6 +662,9 @@ void ps2_encrypt_image(u8 cfg_mode, const char* image_name, const char* data_fil
total_size = data_size;
flush_size = total_size / 100;
+ for (i = 0; i < 0x20; c++)
+ update_progress_bar(0, total_size, image_name);
+
/* limg section */
if (!cfg_mode)
ps2_build_limg(image_name, data_size);
@@ -713,10 +720,10 @@ void ps2_encrypt_image(u8 cfg_mode, const char* image_name, const char* data_fil
fwrite(data_buffer, segment_size, num_child_segments, data_out);
c += read;
- if(msg_update && c >= flush_size) {
+ if(c >= flush_size) {
percent += 1;
encr_size = encr_size + c;
- sprintf(msg_update, "Encrypted: %ld%% (%d Blocks)", (100*encr_size)/data_size, percent);
+ update_progress_bar(encr_size, total_size, image_name);
LOG("Encrypted: %d Blocks 0x%08lx", percent, encr_size);
c = 0;
}
diff --git a/source/rifrap.c b/source/rifrap.c
index d5b59f4..570162e 100644
--- a/source/rifrap.c
+++ b/source/rifrap.c
@@ -17,42 +17,43 @@
#include "util.h"
#include "ecdsa.h"
+#include "common.h"
-const u8 rap_initial_key[16] = {
+static const u8 rap_initial_key[16] = {
0x86, 0x9F, 0x77, 0x45, 0xC1, 0x3F, 0xD8, 0x90,
0xCC, 0xF2, 0x91, 0x88, 0xE3, 0xCC, 0x3E, 0xDF
};
-const u8 pbox[16] = {
+static const u8 pbox[16] = {
0x0C, 0x03, 0x06, 0x04, 0x01, 0x0B, 0x0F, 0x08,
0x02, 0x07, 0x00, 0x05, 0x0A, 0x0E, 0x0D, 0x09
};
-const u8 e1[16] = {
+static const u8 e1[16] = {
0xA9, 0x3E, 0x1F, 0xD6, 0x7C, 0x55, 0xA3, 0x29,
0xB7, 0x5F, 0xDD, 0xA6, 0x2A, 0x95, 0xC7, 0xA5
};
-const u8 e2[16] = {
+static const u8 e2[16] = {
0x67, 0xD4, 0x5D, 0xA3, 0x29, 0x6D, 0x00, 0x6A,
0x4E, 0x7C, 0x53, 0x7B, 0xF5, 0x53, 0x8C, 0x74
};
// npdrm_const /klicenseeConst
-const u8 npdrm_const_key[16] = {
+static const u8 npdrm_const_key[16] = {
0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
};
// NP_rif_key /actdatIndexDecKey
-const u8 npdrm_rif_key[16] = {
+static const u8 npdrm_rif_key[16] = {
0xDA, 0x7D, 0x4B, 0x5E, 0x49, 0x9A, 0x4F, 0x53,
0xB1, 0xC1, 0xA1, 0x4A, 0x74, 0x84, 0x44, 0x3B
};
-u8 ec_k_nm[21] = {
+static u8 ec_k_nm[21] = {
0x00, 0xbf, 0x21, 0x22, 0x4b, 0x04, 0x1f, 0x29, 0x54, 0x9d,
0xb2, 0x5e, 0x9a, 0xad, 0xe1, 0x9e, 0x72, 0x0a, 0x1f, 0xe0, 0xf1
};
-u8 ec_Q_nm[40] = {
+static u8 ec_Q_nm[40] = {
0x94, 0x8D, 0xA1, 0x3E, 0x8C, 0xAF, 0xD5, 0xBA, 0x0E, 0x90,
0xCE, 0x43, 0x44, 0x61, 0xBB, 0x32, 0x7F, 0xE7, 0xE0, 0x80,
0x47, 0x5E, 0xAA, 0x0A, 0xD3, 0xAD, 0x4F, 0x5B, 0x62, 0x47,
@@ -324,6 +325,7 @@ int rif2rap(const u8* idps_key, const char* exdata_path, const char* rif_file, c
LOG("Error: unable to create rap file");
return 0;
}
+ file_chmod(path);
return 1;
}
diff --git a/source/zip_util.c b/source/zip_util.c
index 5c04b9b..fa30cef 100644
--- a/source/zip_util.c
+++ b/source/zip_util.c
@@ -76,6 +76,7 @@ int zip_directory(const char* basedir, const char* inputdir, const char* output_
walk_zip_directory(basedir, inputdir, archive);
ret = zip_close(archive);
+ file_chmod(output_filename);
return (ret == ZIP_ER_OK);
}
@@ -205,6 +206,7 @@ int extract_zip(const char* zip_file, const char* dest_path)
zip_fclose(zfd);
fclose(tfd);
+ file_chmod(path);
}
if (archive) {