Skip to content

Commit

Permalink
Update v4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Jun 3, 2017
1 parent 72cb1b2 commit bd83a4d
Show file tree
Hide file tree
Showing 10 changed files with 2,728 additions and 2,641 deletions.
2 changes: 1 addition & 1 deletion adrenaline_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define __ADRENALINE_COMPAT_H__

#define ADRENALINE_VERSION_MAJOR 4
#define ADRENALINE_VERSION_MINOR 1
#define ADRENALINE_VERSION_MINOR 2
#define ADRENALINE_VERSION ((ADRENALINE_VERSION_MAJOR << 16) | ADRENALINE_VERSION_MINOR)

#define SCE_PSPEMU_FLASH0_PACKAGE_SIZE 0x920000
Expand Down
Binary file modified cef/flash0/kd/systemctrl.prx
Binary file not shown.
Binary file modified cef/flash0/kd/vshctrl.prx
Binary file not shown.
12 changes: 11 additions & 1 deletion cef/systemctrl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ void PatchLoadCore() {
LoadCoreForKernel_nids[1].function = (void *)text_addr + 0x73F0;
}

void PatchSysmem() {
u32 offsets[] = { 0x88009F76, 0x8800A096, 0x8800A12E, 0x8800A1DE, 0x8800A2B2, 0x8800A356, 0x8800A3FA, 0x8800A492, 0x8800A542, 0x8800A5F2 };

int i;
for (i = 0; i < (sizeof(offsets) / sizeof(u32)); i++) {
_sh(0x1000, offsets[i]);
}
}

int (* sceKernelVolatileMemTryLock)(int unk, void **ptr, int *size);

int sceKernelVolatileMemTryLockPatched(int unk, void **ptr, int *size) {
Expand Down Expand Up @@ -331,7 +340,7 @@ int OnModuleStart(SceModule2 *mod) {
log("Key Config: 0x%X\n", sceKernelInitKeyConfig());
log("Apitype: 0x%X\n", sceKernelInitApitype());
log("Filename: %s\n", sceKernelInitFileName());

sctrlSEGetConfig(&config);

if (sceKernelInitKeyConfig() != PSP_INIT_KEYCONFIG_POPS && config.forcehighmemory) {
Expand Down Expand Up @@ -412,6 +421,7 @@ int OnModuleStart(SceModule2 *mod) {
}

int module_start(SceSize args, void *argp) {
PatchSysmem();
PatchLoadCore();
PatchInterruptMgr();
PatchIoFileMgr();
Expand Down
11 changes: 9 additions & 2 deletions cef/updater/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ int WriteFile(char *file, void *buf, int size) {
int main(void) {
pspDebugScreenInit();

if (sctrlSEGetVersion() >= 0x00040001) {
if (sctrlSEGetVersion() >= 0x00040002) {
ErrorExit(5000, "This update or a higher one was already applied.\n");
}

printf("6.61 Adrenaline-4.1 Installer\n");
printf("6.61 Adrenaline-4.2 Installer\n");
printf("Changes:\n\n");

if (sctrlSEGetVersion() <= 0x00040001) {
printf("- Added support for ISO sorting using 'Game Categories Lite' plugin.\n");
printf("- Fixed compatiblity with 'Kingdom Hearts: Birth by Sleep' english patch.\n");
}

if (sctrlSEGetVersion() <= 0x00040000) {
printf("- Fixed bug where holding R trigger while launching Adrenaline didn't open the recovery menu.\n");
printf("- Fixed msfs truncation bug that caused savedata corruption for Little Big Planet and maybe other games.\n");
Expand All @@ -99,13 +104,15 @@ int main(void) {
for (i = 0; i < (sizeof(files) / sizeof(File)); i++) {
char *p = strrchr(files[i].path, '/');
printf("Writing %s (%d)... ", p+1, files[i].size);
sceKernelDelayThread(100 * 1000);

int written = WriteFile(files[i].path, files[i].buf, files[i].size);
if (written != files[i].size) {
ErrorExit(5000, "Error 0x%08X\n", written);
}

printf("OK\n");
sceKernelDelayThread(100 * 1000);
}

printf("\nUpdate complete. Press X to reboot your device.\n\n");
Expand Down
132 changes: 87 additions & 45 deletions cef/vshctrl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ PSP_MODULE_INFO("VshControl", 0x1007, 1, 0);
#define EBOOT_BIN "disc0:/PSP_GAME/SYSDIR/EBOOT.BIN"
#define EBOOT_OLD "disc0:/PSP_GAME/SYSDIR/EBOOT.OLD"

#define DUMMY_CAT_ISO_EXTENSION " "

char categorypath[256];
SceUID categorydfd = -1;

SceUID gamedfd = -1, isodfd = -1, overiso = 0;
int vpbpinited = 0, isoindex = 0, cachechanged = 0;
VirtualPbp *cache = NULL;
Expand Down Expand Up @@ -157,14 +162,27 @@ SceUID sceIoDopenPatched(const char *dirname) {
game = 1;
}

if (strstr(dirname, DUMMY_CAT_ISO_EXTENSION)) {
char *p = strrchr(dirname, '/');
if (p) {
strcpy(categorypath, "ms0:/ISO");
strcat(categorypath, p);
categorypath[8 + strlen(p) - 5] = '\0';

categorydfd = sceIoDopen(categorypath);
pspSdkSetK1(k1);
return categorydfd;
}
}

pspSdkSetK1(k1);
res = sceIoDopen(dirname);
pspSdkSetK1(0);

if (game) {
gamedfd = res;
overiso = 0;
}
}

pspSdkSetK1(k1);
return res;
Expand Down Expand Up @@ -269,6 +287,57 @@ int Cache(VirtualPbp *pbp) {

VirtualPbp vpbp;

int AddIsoDirent(char *path, SceUID fd, SceIoDirent *dir) {
int res;

NEXT:
if ((res = sceIoDread(fd, dir)) > 0) {
char fullpath[128];
int res2 = -1;
int docache;

if (!FIO_S_ISDIR(dir->d_stat.st_mode)) {
strcpy(fullpath, path);
strcat(fullpath, "/");
strcat(fullpath, dir->d_name);

if (IsCached(fullpath, &dir->d_stat.st_mtime, &vpbp)) {
res2 = virtualpbp_fastadd(&vpbp);
docache = 0;
} else {
res2 = virtualpbp_add(fullpath, &dir->d_stat.st_mtime, &vpbp);
docache = 1;
}

if (res2 >= 0) {
ApplyIsoNamePatch(dir);

// Fake the entry from file to directory
dir->d_stat.st_mode = 0x11FF;
dir->d_stat.st_attr = 0x0010;
dir->d_stat.st_size = 0;

// Change the modifcation time to creation time
memcpy(&dir->d_stat.st_mtime, &dir->d_stat.st_ctime, sizeof(ScePspDateTime));

if (docache) {
Cache(&vpbp);
}
}
} else {
if (dir->d_name[0] != '.') {
strcat(dir->d_name, DUMMY_CAT_ISO_EXTENSION);
} else {
goto NEXT;
}
}

return res;
}

return -1;
}

int sceIoDreadPatched(SceUID fd, SceIoDirent *dir) {
int res;
int k1 = pspSdkSetK1(0);
Expand Down Expand Up @@ -301,51 +370,20 @@ int sceIoDreadPatched(SceUID fd, SceIoDirent *dir) {
}

if (isodfd >= 0) {
NEXT:
if ((res = sceIoDread(isodfd, dir)) > 0) {
char fullpath[128];
int res2 = -1;
int docache;

if (!FIO_S_ISDIR(dir->d_stat.st_mode)) {
strcpy(fullpath, "ms0:/ISO/");
strcat(fullpath, dir->d_name);

if (IsCached(fullpath, &dir->d_stat.st_mtime, &vpbp)) {
res2 = virtualpbp_fastadd(&vpbp);
docache = 0;
} else {
res2 = virtualpbp_add(fullpath, &dir->d_stat.st_mtime, &vpbp);
docache = 1;
}

if (res2 >= 0) {
ApplyIsoNamePatch(dir);

// Fake the entry from file to directory
dir->d_stat.st_mode = 0x11FF;
dir->d_stat.st_attr = 0x0010;
dir->d_stat.st_size = 0;

// Change the modifcation time to creation time
memcpy(&dir->d_stat.st_mtime, &dir->d_stat.st_ctime, sizeof(ScePspDateTime));

if (docache) {
Cache(&vpbp);
}
}
} else {
goto NEXT;
}

res = AddIsoDirent("ms0:/ISO", isodfd, dir);
if (res >= 0) {
pspSdkSetK1(k1);
return res;
} else {
sceIoDclose(isodfd);
isodfd = -1;
overiso = 1;
}
}
}
} else if (fd == categorydfd) {
if (categorydfd >= 0) {
res = AddIsoDirent(categorypath, categorydfd, dir);
if (res >= 0) {
pspSdkSetK1(k1);
return res;
}
}
}
}

Expand All @@ -371,8 +409,12 @@ int sceIoDclosePatched(SceUID fd) {
return res;
}
}

if (fd == gamedfd) {

if (fd == categorydfd) {
categorydfd = -1;
} else if (fd == gamedfd) {
sceIoDclose(isodfd);
isodfd = -1;
gamedfd = -1;
overiso = 0;
SaveCache();
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
5) Press X/O on any connection name.
6) Follow the instructions to update Adrenaline.

- Changelog v4.2 -
- Added support for ISO sorting using 'Game Categories Lite' plugin.
- Fixed compatiblity with 'Kingdom Hearts: Birth by Sleep' english patch.

- Changelog v4.1 -
- Fixed bug where holding R trigger while launching Adrenaline didn't open the recovery menu.
- Fixed msfs truncation bug that caused savedata corruption for Little Big Planet and maybe other games.
Expand Down
Loading

0 comments on commit bd83a4d

Please sign in to comment.