mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
add scePauth support
This commit is contained in:
parent
19e010ef6e
commit
99913b1b08
@ -18,17 +18,60 @@
|
||||
#include "HLE.h"
|
||||
|
||||
#include "scePauth.h"
|
||||
#include "zlib.h"
|
||||
|
||||
int scePauth_F7AA47F6(u32 srcPtr, int srcLength, u32 destLengthPtr, u32 workArea)
|
||||
{
|
||||
ERROR_LOG(HLE, "UNIMPL scePauth_F7AA47F6(%d, %d, %d, %d)", srcPtr, srcLength, destLengthPtr, workArea);
|
||||
ERROR_LOG(HLE, "UNIMPL scePauth_F7AA47F6(%08x, %08x, %08x, %08x)", srcPtr, srcLength, destLengthPtr, workArea);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int scePauth_98B83B5D(u32 srcPtr, int srcLength, u32 destLengthPtr, u32 workArea)
|
||||
{
|
||||
ERROR_LOG(HLE, "UNIMPL scePauth_98B83B5D(%d, %d, %d, %d)", srcPtr, srcLength, destLengthPtr, workArea);
|
||||
return 0;
|
||||
u8 *src, *key;
|
||||
u32 crc;
|
||||
char path[256], name[256];
|
||||
std::string hostPath;
|
||||
FILE *fp;
|
||||
int size;
|
||||
|
||||
INFO_LOG(HLE, "scePauth_98B83B5D(%08x, %08x, %08x, %08x)", srcPtr, srcLength, destLengthPtr, workArea);
|
||||
|
||||
sprintf(name, "ms0:/PAUTH");
|
||||
pspFileSystem.GetHostPath(std::string(name), hostPath);
|
||||
|
||||
src = (u8*) Memory::GetPointer(srcPtr);
|
||||
key = (u8*) Memory::GetPointer(workArea);
|
||||
crc = crc32(0, src, srcLength);
|
||||
|
||||
sprintf(name, "%s/pauth_%08x.bin.decrypt", hostPath.c_str(), crc);
|
||||
fp = fopen(name, "rb");
|
||||
if(fp){
|
||||
fseek(fp, 0, SEEK_END);
|
||||
size = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
fread(src, 1, size, fp);
|
||||
fclose(fp);
|
||||
Memory::Write_U32(size, destLengthPtr);
|
||||
INFO_LOG(HLE, " read from decrypted file %s", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pspFileSystem.MkDir("ms0:/PAUTH");
|
||||
|
||||
sprintf(name, "%s/pauth_%08x.bin", hostPath.c_str(), crc);
|
||||
ERROR_LOG(HLE, " no decrypted file found! save as %s", name);
|
||||
|
||||
fp = fopen(name, "wb");
|
||||
fwrite(src, 1, srcLength, fp);
|
||||
fclose(fp);
|
||||
|
||||
sprintf(name, "%s/pauth_%08x.key", hostPath.c_str(), crc);
|
||||
fp = fopen(name, "wb");
|
||||
fwrite(key, 1, 16, fp);
|
||||
fclose(fp);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const HLEFunction scePauth[] = {
|
||||
@ -39,4 +82,4 @@ const HLEFunction scePauth[] = {
|
||||
void Register_scePauth()
|
||||
{
|
||||
RegisterModule("scePauth", ARRAY_SIZE(scePauth), scePauth);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user