Skip to content

Commit

Permalink
Update psp side to be buildable with latest psp sdk, add support for …
Browse files Browse the repository at this point in the history
…usb pairing (TheOfficialFloW#457)

* Fix for up-to-date psp sdk

* Fix game usb pairing (psp<->ps3)
  • Loading branch information
isage authored Jan 13, 2024
1 parent e0fef64 commit 7d382b7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions cef/systemctrl/io_patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ int (* _sceIoDelDrv)(const char *drv_name);
int (* _sceIoUnassign)(const char *dev);
int (* _sceIoAssign)(const char *dev1, const char *dev2, const char *dev3, int mode, void* unk1, long unk2);

char mytolower(const char in) {
if(in >=65 && in<=90)
return in + 32;
return in;
}

char *stristr(const char *str1, const char *str2) {
#define MAXLEN 256

Expand All @@ -45,11 +51,11 @@ char *stristr(const char *str1, const char *str2) {

int i;
for (i = 0; i < MAXLEN && (temp1[i] != 0); i++) {
temp1[i] = tolower((int)temp1[i]);
temp1[i] = mytolower((int)temp1[i]);
}

for (i = 0; i < MAXLEN && (temp2[i] != 0); i++) {
temp2[i] = tolower((int)temp2[i]);
temp2[i] = mytolower((int)temp2[i]);
}

const char *pos = strstr(temp1, temp2);
Expand Down
6 changes: 3 additions & 3 deletions cef/vshctrl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ int AddIsoDirent(char *path, SceUID fd, SceIoDirent *dir, int readcategories) {
strcat(fullpath, "/");
strcat(fullpath, dir->d_name);

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

Expand All @@ -341,7 +341,7 @@ int AddIsoDirent(char *path, SceUID fd, SceIoDirent *dir, int readcategories) {
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));
memcpy(&dir->d_stat.sce_st_mtime, &dir->d_stat.sce_st_ctime, sizeof(ScePspDateTime));

if (docache) {
Cache(&vpbp);
Expand Down
4 changes: 2 additions & 2 deletions cef/vshctrl/virtualpbpmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ int virtualpbp_getstat(int i, SceIoStat *stat)
res = sceIoGetstat(vpbps[i].isofile, stat);
stat->st_size = vpbps[i].filesize;

memcpy(&stat->st_mtime, &stat->st_ctime, sizeof(ScePspDateTime));
memcpy(&stat->sce_st_mtime, &stat->sce_st_ctime, sizeof(ScePspDateTime));

sceKernelSignalSema(vpsema, 1);
return res;
Expand Down Expand Up @@ -650,7 +650,7 @@ int virtualpbp_dread(SceUID fd, SceIoDirent *dir)
}

sceIoGetstat(vpbps[fd].isofile, &dir->d_stat);
memcpy(&dir->d_stat.st_mtime, &dir->d_stat.st_ctime, sizeof(ScePspDateTime));
memcpy(&dir->d_stat.sce_st_mtime, &dir->d_stat.sce_st_ctime, sizeof(ScePspDateTime));
private = (SceFatMsDirentPrivate *)dir->d_private;

if (states[fd].dread == 1)
Expand Down
6 changes: 6 additions & 0 deletions user/titleinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,27 @@
int ScePspemuInitTitleSpecificInfoPatched(const char *titleid, SceUID uid) {
int res = 0;
uint32_t *info = NULL;
uint32_t *unk = NULL;

if (module_nid == 0x2714F07D) { // 3.60 retail
// Make __sce_menuinfo path
snprintf((char *)(data_addr + 0x11C7D0C), 0x80, "ms0:PSP/GAME/%s/__sce_menuinfo", titleid);

info = (uint32_t *)(data_addr + 0x1156450);
unk = (uint32_t *)(data_addr + 0x115644c);
} else if (module_nid == 0x3F75D4D3) { // 3.65/3.67/3.68 retail
// Make __sce_menuinfo path
snprintf((char *)(data_addr + 0x11C7E0C), 0x80, "ms0:PSP/GAME/%s/__sce_menuinfo", titleid);

info = (uint32_t *)(data_addr + 0x1156550);
unk = (uint32_t *)(data_addr + 0x115654c);
} else {
return -1;
}

// enable usbpspcm pairing
unk[0] = 0x10;

// Video delay
// Buzz!: Brain Bender: 3000. Fixes buggy PMF sequence
info[0x00] = 3000;
Expand Down

0 comments on commit 7d382b7

Please sign in to comment.