diff --git a/asmjit b/asmjit index 9ead0cfb4c..0cff228354 160000 --- a/asmjit +++ b/asmjit @@ -1 +1 @@ -Subproject commit 9ead0cfb4cb5eb1bcf8c12b4a1ea115e438c44fa +Subproject commit 0cff228354124bd81050b949097282f78ad0e91a diff --git a/bin/dev_hdd0/home/00000001/exdata/.gitignore b/bin/dev_hdd0/home/00000001/exdata/.gitignore new file mode 100644 index 0000000000..8f6c3111a2 --- /dev/null +++ b/bin/dev_hdd0/home/00000001/exdata/.gitignore @@ -0,0 +1,6 @@ +# Note: This folder has to exist. Once the User Account manager is implemented, make sure it creates this folder in case it's missing and delete this .gitignore file. + +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/rpcs3/Crypto/ec.cpp b/rpcs3/Crypto/ec.cpp new file mode 100644 index 0000000000..1e8dd23b6e --- /dev/null +++ b/rpcs3/Crypto/ec.cpp @@ -0,0 +1,548 @@ +// Copyright 2007,2008,2010 Segher Boessenkool +// Licensed under the terms of the GNU GPL, version 2 +// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt + +#include "stdafx.h" +#include "utils.h" + +void bn_print(char *name, u8 *a, u32 n) +{ + u32 i; + + printf("%s = ", name); + + for (i = 0; i < n; i++) + printf("%02x", a[i]); + + printf("\n"); +} + +static void bn_zero(u8 *d, u32 n) +{ + memset(d, 0, n); +} +void bn_copy(u8 *d, u8 *a, u32 n) +{ + memcpy(d, a, n); +} + +int bn_compare(u8 *a, u8 *b, u32 n) +{ + u32 i; + + for (i = 0; i < n; i++) { + if (a[i] < b[i]) + return -1; + if (a[i] > b[i]) + return 1; + } + + return 0; +} + +static u8 bn_add_1(u8 *d, u8 *a, u8 *b, u32 n) +{ + u32 i; + u32 dig; + u8 c; + + c = 0; + for (i = n - 1; i < n; i--) { + dig = a[i] + b[i] + c; + c = dig >> 8; + d[i] = dig; + } + + return c; +} + +static u8 bn_sub_1(u8 *d, u8 *a, u8 *b, u32 n) +{ + u32 i; + u32 dig; + u8 c; + + c = 1; + for (i = n - 1; i < n; i--) { + dig = a[i] + 255 - b[i] + c; + c = dig >> 8; + d[i] = dig; + } + + return 1 - c; +} + +void bn_reduce(u8 *d, u8 *N, u32 n) +{ + if (bn_compare(d, N, n) >= 0) + bn_sub_1(d, d, N, n); +} + +void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n) +{ + if (bn_add_1(d, a, b, n)) + bn_sub_1(d, d, N, n); + + bn_reduce(d, N, n); +} + +void bn_sub(u8 *d, u8 *a, u8 *b, u8 *N, u32 n) +{ + if (bn_sub_1(d, a, b, n)) + bn_add_1(d, d, N, n); +} + +static const u8 inv256[0x80] = { + 0x01, 0xab, 0xcd, 0xb7, 0x39, 0xa3, 0xc5, 0xef, + 0xf1, 0x1b, 0x3d, 0xa7, 0x29, 0x13, 0x35, 0xdf, + 0xe1, 0x8b, 0xad, 0x97, 0x19, 0x83, 0xa5, 0xcf, + 0xd1, 0xfb, 0x1d, 0x87, 0x09, 0xf3, 0x15, 0xbf, + 0xc1, 0x6b, 0x8d, 0x77, 0xf9, 0x63, 0x85, 0xaf, + 0xb1, 0xdb, 0xfd, 0x67, 0xe9, 0xd3, 0xf5, 0x9f, + 0xa1, 0x4b, 0x6d, 0x57, 0xd9, 0x43, 0x65, 0x8f, + 0x91, 0xbb, 0xdd, 0x47, 0xc9, 0xb3, 0xd5, 0x7f, + 0x81, 0x2b, 0x4d, 0x37, 0xb9, 0x23, 0x45, 0x6f, + 0x71, 0x9b, 0xbd, 0x27, 0xa9, 0x93, 0xb5, 0x5f, + 0x61, 0x0b, 0x2d, 0x17, 0x99, 0x03, 0x25, 0x4f, + 0x51, 0x7b, 0x9d, 0x07, 0x89, 0x73, 0x95, 0x3f, + 0x41, 0xeb, 0x0d, 0xf7, 0x79, 0xe3, 0x05, 0x2f, + 0x31, 0x5b, 0x7d, 0xe7, 0x69, 0x53, 0x75, 0x1f, + 0x21, 0xcb, 0xed, 0xd7, 0x59, 0xc3, 0xe5, 0x0f, + 0x11, 0x3b, 0x5d, 0xc7, 0x49, 0x33, 0x55, 0xff, +}; + +static void bn_mon_muladd_dig(u8 *d, u8 *a, u8 b, u8 *N, u32 n) +{ + u32 dig; + u32 i; + + u8 z = -(d[n-1] + a[n-1]*b) * inv256[N[n-1]/2]; + + dig = d[n-1] + a[n-1]*b + N[n-1]*z; + dig >>= 8; + + for (i = n - 2; i < n; i--) { + dig += d[i] + a[i]*b + N[i]*z; + d[i+1] = dig; + dig >>= 8; + } + + d[0] = dig; + dig >>= 8; + + if (dig) + bn_sub_1(d, d, N, n); + + bn_reduce(d, N, n); +} + +void bn_mon_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n) +{ + u8 t[512]; + u32 i; + + bn_zero(t, n); + + for (i = n - 1; i < n; i--) + bn_mon_muladd_dig(t, a, b[i], N, n); + + bn_copy(d, t, n); +} + +void bn_to_mon(u8 *d, u8 *N, u32 n) +{ + u32 i; + + for (i = 0; i < 8*n; i++) + bn_add(d, d, d, N, n); +} + +void bn_from_mon(u8 *d, u8 *N, u32 n) +{ + u8 t[512]; + + bn_zero(t, n); + t[n-1] = 1; + bn_mon_mul(d, d, t, N, n); +} + +static void bn_mon_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en) +{ + u8 t[512]; + u32 i; + u8 mask; + + bn_zero(d, n); + d[n-1] = 1; + bn_to_mon(d, N, n); + + for (i = 0; i < en; i++) + for (mask = 0x80; mask != 0; mask >>= 1) { + bn_mon_mul(t, d, d, N, n); + if ((e[i] & mask) != 0) + bn_mon_mul(d, t, a, N, n); + else + bn_copy(d, t, n); + } +} + +void bn_mon_inv(u8 *d, u8 *a, u8 *N, u32 n) +{ + u8 t[512], s[512]; + + bn_zero(s, n); + s[n-1] = 2; + bn_sub_1(t, N, s, n); + bn_mon_exp(d, a, N, n, t, n); +} + +void bn_copy(u8 *d, u8 *a, u32 n); +int bn_compare(u8 *a, u8 *b, u32 n); +void bn_reduce(u8 *d, u8 *N, u32 n); +void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n); +void bn_sub(u8 *d, u8 *a, u8 *b, u8 *N, u32 n); +void bn_to_mon(u8 *d, u8 *N, u32 n); +void bn_from_mon(u8 *d, u8 *N, u32 n); +void bn_mon_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n); +void bn_mon_inv(u8 *d, u8 *a, u8 *N, u32 n); + +struct point { + u8 x[20]; + u8 y[20]; +}; + +static u8 ec_p[20]; +static u8 ec_a[20]; // mon +static u8 ec_b[20]; // mon +static u8 ec_N[21]; +static struct point ec_G; // mon +static struct point ec_Q; // mon +static u8 ec_k[21]; + +static void elt_copy(u8 *d, u8 *a) +{ + memcpy(d, a, 20); +} + +static void elt_zero(u8 *d) +{ + memset(d, 0, 20); +} + +static int elt_is_zero(u8 *d) +{ + u32 i; + + for (i = 0; i < 20; i++) + if (d[i] != 0) + return 0; + + return 1; +} + +static void elt_add(u8 *d, u8 *a, u8 *b) +{ + bn_add(d, a, b, ec_p, 20); +} + +static void elt_sub(u8 *d, u8 *a, u8 *b) +{ + bn_sub(d, a, b, ec_p, 20); +} + +static void elt_mul(u8 *d, u8 *a, u8 *b) +{ + bn_mon_mul(d, a, b, ec_p, 20); +} + +static void elt_square(u8 *d, u8 *a) +{ + elt_mul(d, a, a); +} + +static void elt_inv(u8 *d, u8 *a) +{ + u8 s[20]; + elt_copy(s, a); + bn_mon_inv(d, s, ec_p, 20); +} + +static void point_to_mon(struct point *p) +{ + bn_to_mon(p->x, ec_p, 20); + bn_to_mon(p->y, ec_p, 20); +} + +static void point_from_mon(struct point *p) +{ + bn_from_mon(p->x, ec_p, 20); + bn_from_mon(p->y, ec_p, 20); +} + +#if 0 +static int point_is_on_curve(u8 *p) +{ + u8 s[20], t[20]; + u8 *x, *y; + + x = p; + y = p + 20; + + elt_square(t, x); + elt_mul(s, t, x); + + elt_mul(t, x, ec_a); + elt_add(s, s, t); + + elt_add(s, s, ec_b); + + elt_square(t, y); + elt_sub(s, s, t); + + return elt_is_zero(s); +} +#endif + +static void point_zero(struct point *p) +{ + elt_zero(p->x); + elt_zero(p->y); +} + +static int point_is_zero(struct point *p) +{ + return elt_is_zero(p->x) && elt_is_zero(p->y); +} + +static void point_double(struct point *r, struct point *p) +{ + u8 s[20], t[20]; + struct point pp; + u8 *px, *py, *rx, *ry; + + pp = *p; + + px = pp.x; + py = pp.y; + rx = r->x; + ry = r->y; + + if (elt_is_zero(py)) { + point_zero(r); + return; + } + + elt_square(t, px); // t = px*px + elt_add(s, t, t); // s = 2*px*px + elt_add(s, s, t); // s = 3*px*px + elt_add(s, s, ec_a); // s = 3*px*px + a + elt_add(t, py, py); // t = 2*py + elt_inv(t, t); // t = 1/(2*py) + elt_mul(s, s, t); // s = (3*px*px+a)/(2*py) + + elt_square(rx, s); // rx = s*s + elt_add(t, px, px); // t = 2*px + elt_sub(rx, rx, t); // rx = s*s - 2*px + + elt_sub(t, px, rx); // t = -(rx-px) + elt_mul(ry, s, t); // ry = -s*(rx-px) + elt_sub(ry, ry, py); // ry = -s*(rx-px) - py +} + +static void point_add(struct point *r, struct point *p, struct point *q) +{ + u8 s[20], t[20], u[20]; + u8 *px, *py, *qx, *qy, *rx, *ry; + struct point pp, qq; + + pp = *p; + qq = *q; + + px = pp.x; + py = pp.y; + qx = qq.x; + qy = qq.y; + rx = r->x; + ry = r->y; + + if (point_is_zero(&pp)) { + elt_copy(rx, qx); + elt_copy(ry, qy); + return; + } + + if (point_is_zero(&qq)) { + elt_copy(rx, px); + elt_copy(ry, py); + return; + } + + elt_sub(u, qx, px); + + if (elt_is_zero(u)) { + elt_sub(u, qy, py); + if (elt_is_zero(u)) + point_double(r, &pp); + else + point_zero(r); + + return; + } + + elt_inv(t, u); // t = 1/(qx-px) + elt_sub(u, qy, py); // u = qy-py + elt_mul(s, t, u); // s = (qy-py)/(qx-px) + + elt_square(rx, s); // rx = s*s + elt_add(t, px, qx); // t = px+qx + elt_sub(rx, rx, t); // rx = s*s - (px+qx) + + elt_sub(t, px, rx); // t = -(rx-px) + elt_mul(ry, s, t); // ry = -s*(rx-px) + elt_sub(ry, ry, py); // ry = -s*(rx-px) - py +} + +static void point_mul(struct point *d, u8 *a, struct point *b) // a is bignum +{ + u32 i; + u8 mask; + + point_zero(d); + + for (i = 0; i < 21; i++) + for (mask = 0x80; mask != 0; mask >>= 1) { + point_double(d, d); + if ((a[i] & mask) != 0) + point_add(d, d, b); + } +} + +static void generate_ecdsa(u8 *R, u8 *S, u8 *k, u8 *hash) +{ + u8 e[21]; + u8 kk[21]; + u8 m[21]; + u8 minv[21]; + struct point mG; + + e[0] = 0; + memcpy(e + 1, hash, 20); + bn_reduce(e, ec_N, 21); + +try_again: + prng(m, 21); + m[0] = 0; + if (bn_compare(m, ec_N, 21) >= 0) + goto try_again; + + // R = (mG).x + + point_mul(&mG, m, &ec_G); + point_from_mon(&mG); + R[0] = 0; + elt_copy(R+1, mG.x); + + // S = m**-1*(e + Rk) (mod N) + + bn_copy(kk, k, 21); + bn_reduce(kk, ec_N, 21); + bn_to_mon(m, ec_N, 21); + bn_to_mon(e, ec_N, 21); + bn_to_mon(R, ec_N, 21); + bn_to_mon(kk, ec_N, 21); + + bn_mon_mul(S, R, kk, ec_N, 21); + bn_add(kk, S, e, ec_N, 21); + bn_mon_inv(minv, m, ec_N, 21); + bn_mon_mul(S, minv, kk, ec_N, 21); + + bn_from_mon(R, ec_N, 21); + bn_from_mon(S, ec_N, 21); +} + +static int check_ecdsa(struct point *Q, u8 *R, u8 *S, u8 *hash) +{ + u8 Sinv[21]; + u8 e[21]; + u8 w1[21], w2[21]; + struct point r1, r2; + u8 rr[21]; + + e[0] = 0; + memcpy(e + 1, hash, 20); + bn_reduce(e, ec_N, 21); + + bn_to_mon(R, ec_N, 21); + bn_to_mon(S, ec_N, 21); + bn_to_mon(e, ec_N, 21); + + bn_mon_inv(Sinv, S, ec_N, 21); + + bn_mon_mul(w1, e, Sinv, ec_N, 21); + bn_mon_mul(w2, R, Sinv, ec_N, 21); + + bn_from_mon(w1, ec_N, 21); + bn_from_mon(w2, ec_N, 21); + + point_mul(&r1, w1, &ec_G); + point_mul(&r2, w2, Q); + + point_add(&r1, &r1, &r2); + + point_from_mon(&r1); + + rr[0] = 0; + memcpy(rr + 1, r1.x, 20); + bn_reduce(rr, ec_N, 21); + + bn_from_mon(R, ec_N, 21); + bn_from_mon(S, ec_N, 21); + + return (bn_compare(rr, R, 21) == 0); +} + +#if 0 +static void ec_priv_to_pub(u8 *k, u8 *Q) +{ + point_mul(Q, k, ec_G); +} +#endif + +int ecdsa_set_curve(u8* p, u8* a, u8* b, u8* N, u8* Gx, u8* Gy) +{ + memcpy(ec_p, p, 20); + memcpy(ec_a, a, 20); + memcpy(ec_b, b, 20); + memcpy(ec_N, N, 21); + memcpy(ec_G.x, Gx, 20); + memcpy(ec_G.y, Gy, 20); + + bn_to_mon(ec_a, ec_p, 20); + bn_to_mon(ec_b, ec_p, 20); + + point_to_mon(&ec_G); + + return 0; +} + +void ecdsa_set_pub(u8 *Q) +{ + memcpy(ec_Q.x, Q, 20); + memcpy(ec_Q.y, Q+20, 20); + point_to_mon(&ec_Q); +} + +void ecdsa_set_priv(u8 *k) +{ + memcpy(ec_k, k, sizeof ec_k); +} + +int ecdsa_verify(u8 *hash, u8 *R, u8 *S) +{ + return check_ecdsa(&ec_Q, R, S, hash); +} + +void ecdsa_sign(u8 *hash, u8 *R, u8 *S) +{ + generate_ecdsa(R, S, ec_k, hash); +} \ No newline at end of file diff --git a/rpcs3/Crypto/ec.h b/rpcs3/Crypto/ec.h new file mode 100644 index 0000000000..6b00f51971 --- /dev/null +++ b/rpcs3/Crypto/ec.h @@ -0,0 +1,14 @@ +#pragma once + +// Copyright (C) 2014 Hykem +// Licensed under the terms of the GNU GPL, version 3 +// http://www.gnu.org/licenses/gpl-3.0.txt + +#include +#include + +int ecdsa_set_curve(unsigned char *p, unsigned char *a, unsigned char *b, unsigned char *N, unsigned char *Gx, unsigned char *Gy); +void ecdsa_set_pub(unsigned char *Q); +void ecdsa_set_priv(unsigned char *k); +int ecdsa_verify(unsigned char *hash, unsigned char *R, unsigned char *S); +void ecdsa_sign(unsigned char *hash, unsigned char *R, unsigned char *S); diff --git a/rpcs3/Crypto/key_vault.cpp b/rpcs3/Crypto/key_vault.cpp index 5cbc04ac02..04a949c1be 100644 --- a/rpcs3/Crypto/key_vault.cpp +++ b/rpcs3/Crypto/key_vault.cpp @@ -8,10 +8,10 @@ SELF_KEY::SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std:: version = ver; revision = rev; self_type = type; - hex_to_bytes(erk, e.c_str()); - hex_to_bytes(riv, r.c_str()); - hex_to_bytes(pub, pb.c_str()); - hex_to_bytes(priv, pr.c_str()); + hex_to_bytes(erk, e.c_str(), 0); + hex_to_bytes(riv, r.c_str(), 0); + hex_to_bytes(pub, pb.c_str(), 0); + hex_to_bytes(priv, pr.c_str(), 0); curve_type = ct; } diff --git a/rpcs3/Crypto/key_vault.h b/rpcs3/Crypto/key_vault.h index e57cfe5b90..293efeda9c 100644 --- a/rpcs3/Crypto/key_vault.h +++ b/rpcs3/Crypto/key_vault.h @@ -104,6 +104,35 @@ static u8 EDAT_IV[0x10] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static u8 VSH_CURVE_P[0x14] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; + +static u8 VSH_CURVE_A[0x14] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC +}; + +static u8 VSH_CURVE_B[0x14] = { + 0xA6, 0x8B, 0xED, 0xC3, 0x34, 0x18, 0x02, 0x9C, 0x1D, 0x3C, 0xE3, 0x3B, 0x9A, 0x32, 0x1F, 0xCC, 0xBB, 0x9E, 0x0F, 0x0B +}; + +static u8 VSH_CURVE_N[0x15] = { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xB5, 0xAE, 0x3C, 0x52, 0x3E, 0x63, 0x94, 0x4F, 0x21, 0x27 +}; + +static u8 VSH_CURVE_GX[0x14] = { + 0x12, 0x8E, 0xC4, 0x25, 0x64, 0x87, 0xFD, 0x8F, 0xDF, 0x64, 0xE2, 0x43, 0x7B, 0xC0, 0xA1, 0xF6, 0xD5, 0xAF, 0xDE, 0x2C +}; + +static u8 VSH_CURVE_GY[0x14] = { + 0x59, 0x58, 0x55, 0x7E, 0xB1, 0xDB, 0x00, 0x12, 0x60, 0x42, 0x55, 0x24, 0xDB, 0xC3, 0x79, 0xD5, 0xAC, 0x5F, 0x4A, 0xDF +}; + +static u8 VSH_PUB[0x28] = { + 0x62, 0x27, 0xB0, 0x0A, 0x02, 0x85, 0x6F, 0xB0, 0x41, 0x08, 0x87, 0x67, 0x19, 0xE0, 0xA0, 0x18, 0x32, 0x91, 0xEE, 0xB9, + 0x6E, 0x73, 0x6A, 0xBF, 0x81, 0xF7, 0x0E, 0xE9, 0x16, 0x1B, 0x0D, 0xDE, 0xB0, 0x26, 0x76, 0x1A, 0xFF, 0x7B, 0xC8, 0x5B +}; + class KeyVault { std::vector sk_LV0_arr; diff --git a/rpcs3/Crypto/lz.cpp b/rpcs3/Crypto/lz.cpp index ec04981725..86d82d7161 100644 --- a/rpcs3/Crypto/lz.cpp +++ b/rpcs3/Crypto/lz.cpp @@ -4,26 +4,20 @@ #include "lz.h" -int decode_range(unsigned int *range, unsigned int *code, unsigned char **src) +void decode_range(unsigned int *range, unsigned int *code, unsigned char **src) { - if (!((*range) >> 24)) + if (!((*range) >> 24)) { (*range) <<= 8; *code = ((*code) << 8) + (*src)++[5]; - return 1; } - else - return 0; } int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c) { - unsigned int val = *range; - - if (decode_range(range, code, src)) - val *= (*c); - else - val = (val >> 8) * (*c); + decode_range(range, code, src); + + unsigned int val = ((*range) >> 8) * (*c); *c -= ((*c) >> 3); if (index) (*index) <<= 1; @@ -47,12 +41,12 @@ int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *ra { int i = 1; - if (index >= 3) + if (index >= 3) { - decode_bit(range, code, &i, src, ptr + 0x18); // Offset 0x978 - if (index >= 4) + decode_bit(range, code, &i, src, ptr + 0x18); + if (index >= 4) { - decode_bit(range, code, &i, src, ptr + 0x18); // Offset 0x978 + decode_bit(range, code, &i, src, ptr + 0x18); if (index >= 5) { decode_range(range, code, src); @@ -60,8 +54,8 @@ int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *ra { i <<= 1; (*range) >>= 1; - if (*code < *range) - i++; + if (*code < *range) + i++; else (*code) -= *range; } @@ -69,16 +63,16 @@ int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *ra } } - *bit_flag = decode_bit(range, code, &i, src, ptr); // Offset 0x960 + *bit_flag = decode_bit(range, code, &i, src, ptr); - if (index >= 1) + if (index >= 1) { - decode_bit(range, code, &i, src, ptr + 0x8); // Offset 0x968 - if (index >= 2) + decode_bit(range, code, &i, src, ptr + 0x8); + if (index >= 2) { - decode_bit(range, code, &i, src, ptr + 0x10); // Offset 0x970 + decode_bit(range, code, &i, src, ptr + 0x10); } - } + } return i; } @@ -88,12 +82,12 @@ int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *rang int i = 1; index /= 8; - if (index >= 3) + if (index >= 3) { - decode_bit(range, code, &i, src, ptr); // Offset 0x8A8 - if (index >= 4) + decode_bit(range, code, &i, src, ptr + 4); + if (index >= 4) { - decode_bit(range, code, &i, src, ptr); // Offset 0x8A8 + decode_bit(range, code, &i, src, ptr + 4); if (index >= 5) { decode_range(range, code, src); @@ -101,8 +95,8 @@ int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *rang { i <<= 1; (*range) >>= 1; - if (*code < *range) - i++; + if (*code < *range) + i++; else (*code) -= *range; } @@ -110,16 +104,16 @@ int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *rang } } - *bit_flag = decode_bit(range, code, &i, src, ptr + 3); // Offset 0x8A8 + 3 + *bit_flag = decode_bit(range, code, &i, src, ptr); - if (index >= 1) + if (index >= 1) { - decode_bit(range, code, &i, src, ptr + 2); // Offset 0x8A8 + 2 - if (index >= 2) + decode_bit(range, code, &i, src, ptr + 1); + if (index >= 2) { - decode_bit(range, code, &i, src, ptr + 1); // Offset 0x8A8 + 1 + decode_bit(range, code, &i, src, ptr + 2); } - } + } return i; } @@ -128,7 +122,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) { int result; - unsigned char *tmp = new unsigned char[0xA70]; + unsigned char *tmp = new unsigned char[0xCC8]; int offset = 0; int bit_flag = 0; @@ -159,11 +153,11 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) else { // Set up a temporary buffer (sliding window). - memset(tmp, 0x80, 0xA60); + memset(tmp, 0x80, 0xCA8); while (1) { - // Start reading at 0x920. - tmp_sect1 = tmp + offset + 0x920; + // Start reading at 0xB68. + tmp_sect1 = tmp + offset + 0xB68; if (!decode_bit(&range, &code, 0, &in, tmp_sect1)) // Raw char. { // Adjust offset and check for stream end. @@ -189,57 +183,65 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) int index = -1; // Identify the data length bit field. - do { - tmp_sect1 += 8; + do + { + tmp_sect1 += 8; bit_flag = decode_bit(&range, &code, 0, &in, tmp_sect1); index += bit_flag; } while ((bit_flag != 0) && (index < 6)); - // Default block size is 0x40. - int b_size = 0x40; + // Default block size is 0x160. + int b_size = 0x160; tmp_sect2 = tmp + index + 0x7F1; // If the data length was found, parse it as a number. - if ((index >= 0) || (bit_flag != 0)) + if ((index >= 0) || (bit_flag != 0)) { // Locate next section. - int sect = (index << 5) | (((((start - out)) << index) & 3) << 3) | (offset & 7); - tmp_sect1 = tmp + 0x960 + sect; + int sect = (index << 5) | (((((int)(start - out)) << index) & 3) << 3) | (offset & 7); + tmp_sect1 = tmp + 0xBA8 + sect; // Decode the data length (8 bit fields). data_length = decode_number(tmp_sect1, index, &bit_flag, &range, &code, &in); - - // If we got valid parameters, seek to find data offset. - if ((data_length != 3) && ((index > 0) || (bit_flag != 0))) { - tmp_sect2 += 0x38; - b_size = 0x80; // Block size is now 0x80. - } - } else { + if (data_length == 0xFF) return (start - out); // End of stream. + } + else + { // Assume one byte of advance. data_length = 1; } + // If we got valid parameters, seek to find data offset. + if ((data_length <= 2)) + { + tmp_sect2 += 0xF8; + b_size = 0x40; // Block size is now 0x40. + } + int diff = 0; int shift = 1; // Identify the data offset bit field. - do { + do + { diff = (shift << 4) - b_size; bit_flag = decode_bit(&range, &code, &shift, &in, tmp_sect2 + (shift << 3)); } while (diff < 0); // If the data offset was found, parse it as a number. - if ((diff > 0) || (bit_flag != 0)) + if ((diff > 0) || (bit_flag != 0)) { // Adjust diff if needed. if (bit_flag == 0) diff -= 8; // Locate section. - tmp_sect3 = tmp + 0x8A8 + diff; + tmp_sect3 = tmp + 0x928 + diff; // Decode the data offset (1 bit fields). data_offset = decode_word(tmp_sect3, diff, &bit_flag, &range, &code, &in); - } else { + } + else + { // Assume one byte of advance. data_offset = 1; } @@ -260,7 +262,8 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) offset = ((((int)(buf_end - out)) + 1) & 1) + 6; // Copy data. - do { + do + { *start++ = *buf_start++; } while (start < buf_end); @@ -271,4 +274,4 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size) } delete[] tmp; return result; -} +} \ No newline at end of file diff --git a/rpcs3/Crypto/lz.h b/rpcs3/Crypto/lz.h index c27192624c..f84415623d 100644 --- a/rpcs3/Crypto/lz.h +++ b/rpcs3/Crypto/lz.h @@ -1,8 +1,15 @@ #pragma once + +// Copyright (C) 2014 Hykem +// Licensed under the terms of the GNU GPL, version 3 +// http://www.gnu.org/licenses/gpl-3.0.txt + +// Reverse-engineered custom Lempel–Ziv–Markov based compression. + #include -int decode_range(unsigned int *range, unsigned int *code, unsigned char **src); +void decode_range(unsigned int *range, unsigned int *code, unsigned char **src); int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c); int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src); int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src); -int decompress(unsigned char *out, unsigned char *in, unsigned int size); +int decompress(unsigned char *out, unsigned char *in, unsigned int size); \ No newline at end of file diff --git a/rpcs3/Crypto/sha1.h b/rpcs3/Crypto/sha1.h index 84d4bd80d2..f616f468b8 100644 --- a/rpcs3/Crypto/sha1.h +++ b/rpcs3/Crypto/sha1.h @@ -1,4 +1,5 @@ #pragma once + /** * \file sha1.h * diff --git a/rpcs3/Crypto/unedat.cpp b/rpcs3/Crypto/unedat.cpp index 7cd9604ac6..27ddbffb6a 100644 --- a/rpcs3/Crypto/unedat.cpp +++ b/rpcs3/Crypto/unedat.cpp @@ -1,5 +1,4 @@ #include "stdafx.h" -#include "utils.h" #include "key_vault.h" #include "unedat.h" #include "Utilities/Log.h" @@ -7,7 +6,7 @@ void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv) { - int mode = (int) (crypto_mode & 0xF0000000); + int mode = (int)(crypto_mode & 0xF0000000); switch (mode) { case 0x10000000: // Encrypted ERK. @@ -32,7 +31,7 @@ void generate_key(int crypto_mode, int version, unsigned char *key_final, unsign void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsigned char *hash) { - int mode = (int) (hash_mode & 0xF0000000); + int mode = (int)(hash_mode & 0xF0000000); switch (mode) { case 0x10000000: // Encrypted HASH. @@ -52,7 +51,7 @@ void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsign }; } -bool crypto(int hash_mode, int crypto_mode, int version, unsigned char *in, unsigned char *out, int length, unsigned char *key, unsigned char *iv, unsigned char *hash, unsigned char *test_hash) +bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, unsigned char *out, int length, unsigned char *key, unsigned char *iv, unsigned char *hash, unsigned char *test_hash) { // Setup buffers for key, iv and hash. unsigned char key_final[0x10] = {}; @@ -77,29 +76,30 @@ bool crypto(int hash_mode, int crypto_mode, int version, unsigned char *in, unsi } else { - LOG_ERROR(LOADER, "EDAT: Unknown crypto algorithm!\n"); + LOG_ERROR(LOADER, "EDAT: Unknown crypto algorithm!"); return false; } - + if ((hash_mode & 0xFF) == 0x01) // 0x14 SHA1-HMAC { - return hmac_hash_compare(hash_final_14, 0x14, in, length, test_hash); + return hmac_hash_compare(hash_final_14, 0x14, in, length, test_hash, 0x14); } else if ((hash_mode & 0xFF) == 0x02) // 0x10 AES-CMAC { - return cmac_hash_compare(hash_final_10, 0x10, in, length, test_hash); + return cmac_hash_compare(hash_final_10, 0x10, in, length, test_hash, 0x10); } else if ((hash_mode & 0xFF) == 0x04) //0x10 SHA1-HMAC { - return hmac_hash_compare(hash_final_10, 0x10, in, length, test_hash); + return hmac_hash_compare(hash_final_10, 0x10, in, length, test_hash, 0x10); } else { - LOG_ERROR(LOADER, "EDAT: Unknown hashing algorithm!\n"); + LOG_ERROR(LOADER, "EDAT: Unknown hashing algorithm!"); return false; } } +// EDAT/SDAT functions. unsigned char* dec_section(unsigned char* metadata) { unsigned char *dec = new unsigned char[0x10]; @@ -135,11 +135,11 @@ unsigned char* get_block_key(int block, NPD_HEADER *npd) return dest_key; } -// EDAT/SDAT functions. -int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, unsigned char* crypt_key, bool verbose) +// EDAT/SDAT decryption. +int decrypt_data(rFile *in, rFile *out, EDAT_HEADER *edat, NPD_HEADER *npd, unsigned char* crypt_key, bool verbose) { // Get metadata info and setup buffers. - int block_num = (int) ((edat->file_size + edat->block_size - 1) / edat->block_size); + int block_num = (int)((edat->file_size + edat->block_size - 1) / edat->block_size); int metadata_section_size = ((edat->flags & EDAT_COMPRESSED_FLAG) != 0 || (edat->flags & EDAT_FLAG_0x20) != 0) ? 0x20 : 0x10; int metadata_offset = 0x100; @@ -148,78 +148,103 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, unsigned char *b_key; unsigned char *iv; + unsigned char hash[0x10]; + unsigned char key_result[0x10]; + unsigned char hash_result[0x14]; + memset(hash, 0, 0x10); + memset(key_result, 0, 0x10); + memset(hash_result, 0, 0x14); + + unsigned long long offset = 0; + unsigned long long metadata_sec_offset = 0; + int length = 0; + int compression_end = 0; unsigned char empty_iv[0x10] = {}; // Decrypt the metadata. - for (int i = 0; i < block_num; i++) + int i; + for (i = 0; i < block_num; i++) { - in->Seek(metadata_offset + i * metadata_section_size); - unsigned char hash_result[0x10]; - long offset; - int length = 0; - int compression_end = 0; + memset(hash_result, 0, 0x14); - if ((edat->flags & EDAT_FLAG_0x04) != 0) - { - LOG_ERROR(LOADER, "EDAT: Flag 0x04 is not yet supported"); - return -1; - } - if ((edat->flags & EDAT_COMPRESSED_FLAG) != 0) { - unsigned char metadata[0x20]; - in->Read(metadata, 0x20); - - // If the data is compressed, decrypt the metadata. - unsigned char *result = dec_section(metadata); - offset = ((swap32(*(int*)&result[0]) << 4) | (swap32(*(int*)&result[4]))); - length = swap32(*(int*)&result[8]); - compression_end = swap32(*(int*)&result[12]); - delete[] result; + metadata_sec_offset = metadata_offset + (unsigned long long) i * metadata_section_size; + in->Seek(metadata_sec_offset); + unsigned char metadata[0x20]; + memset(metadata, 0, 0x20); + in->Read(metadata, 0x20); + + // If the data is compressed, decrypt the metadata. + // NOTE: For NPD version 1 the metadata is not encrypted. + if (npd->version <= 1) + { + offset = swap64(*(unsigned long long*)&metadata[0x10]); + length = swap32(*(int*)&metadata[0x18]); + compression_end = swap32(*(int*)&metadata[0x1C]); + } + else + { + unsigned char *result = dec_section(metadata); + offset = swap64(*(unsigned long long*)&result[0]); + length = swap32(*(int*)&result[8]); + compression_end = swap32(*(int*)&result[12]); + delete[] result; + } + memcpy(hash_result, metadata, 0x10); } else if ((edat->flags & EDAT_FLAG_0x20) != 0) { // If FLAG 0x20, the metadata precedes each data block. - in->Seek(metadata_offset + i * metadata_section_size + length); + metadata_sec_offset = metadata_offset + (unsigned long long) i * (metadata_section_size + length); + in->Seek(metadata_sec_offset); unsigned char metadata[0x20]; + memset(metadata, 0, 0x20); in->Read(metadata, 0x20); + memcpy(hash_result, metadata, 0x14); // If FLAG 0x20 is set, apply custom xor. - for (int j = 0; j < 0x10; j++) { - hash_result[j] = (unsigned char)(metadata[j] ^ metadata[j+0x10]); - } + int j; + for (j = 0; j < 0x10; j++) + hash_result[j] = (unsigned char)(metadata[j] ^ metadata[j + 0x10]); - offset = metadata_offset + i * edat->block_size + (i + 1) * metadata_section_size; + offset = metadata_sec_offset + 0x20; length = edat->block_size; if ((i == (block_num - 1)) && (edat->file_size % edat->block_size)) - length = (int) (edat->file_size % edat->block_size); + length = (int)(edat->file_size % edat->block_size); } else { + metadata_sec_offset = metadata_offset + (unsigned long long) i * metadata_section_size; + in->Seek(metadata_sec_offset); + in->Read(hash_result, 0x10); - offset = metadata_offset + i * edat->block_size + block_num * metadata_section_size; + offset = metadata_offset + (unsigned long long) i * edat->block_size + (unsigned long long) block_num * metadata_section_size; length = edat->block_size; - + if ((i == (block_num - 1)) && (edat->file_size % edat->block_size)) - length = (int) (edat->file_size % edat->block_size); + length = (int)(edat->file_size % edat->block_size); } // Locate the real data. int pad_length = length; - length = (int) ((pad_length + 0xF) & 0xFFFFFFF0); - in->Seek(offset); + length = (int)((pad_length + 0xF) & 0xFFFFFFF0); // Setup buffers for decryption and read the data. enc_data = new unsigned char[length]; dec_data = new unsigned char[length]; - unsigned char key_result[0x10]; - unsigned char hash[0x10]; + memset(enc_data, 0, length); + memset(dec_data, 0, length); + memset(hash, 0, 0x10); + memset(key_result, 0, 0x10); + + in->Seek(offset); in->Read(enc_data, length); - + // Generate a key for the current block. b_key = get_block_key(i, npd); @@ -247,7 +272,7 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, hash_mode |= 0x10000000; } - if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != 0) + if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != 0) { // Reset the flags. crypto_mode |= 0x01000000; @@ -260,7 +285,13 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, // IV is null if NPD version is 1 or 0. iv = (npd->version <= 1) ? empty_iv : npd->digest; // Call main crypto routine on this data block. - crypto(hash_mode, crypto_mode, (npd->version == 4), enc_data, dec_data, length, key_result, iv, hash, hash_result); + if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), enc_data, dec_data, length, key_result, iv, hash, hash_result)) + { + if (verbose) + LOG_WARNING(LOADER, "EDAT: Block at offset 0x%llx has invalid hash!", offset); + + return 1; + } } // Apply additional compression if needed and write the decrypted data. @@ -271,28 +302,28 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, memset(decomp_data, 0, decomp_size); if (verbose) - LOG_NOTICE(LOADER, "EDAT: Decompressing...\n"); - - int res = lz_decompress(decomp_data, dec_data, decomp_size); + LOG_NOTICE(LOADER, "EDAT: Decompressing data..."); + + int res = decompress(decomp_data, dec_data, decomp_size); out->Write(decomp_data, res); - + if (verbose) { - LOG_NOTICE(LOADER, "EDAT: Compressed block size: %d\n", pad_length); - LOG_NOTICE(LOADER, "EDAT: Decompressed block size: %d\n", res); + LOG_NOTICE(LOADER, "EDAT: Compressed block size: %d", pad_length); + LOG_NOTICE(LOADER, "EDAT: Decompressed block size: %d", res); } edat->file_size -= res; - if (edat->file_size == 0) + if (edat->file_size == 0) { if (res < 0) { - LOG_ERROR(LOADER, "EDAT: Decompression failed!\n"); + LOG_ERROR(LOADER, "EDAT: Decompression failed!"); return 1; } else - LOG_SUCCESS(LOADER, "EDAT: Data successfully decompressed!\n"); + LOG_NOTICE(LOADER, "EDAT: Successfully decompressed!"); } delete[] decomp_data; @@ -309,158 +340,262 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, return 0; } -static bool check_flags(EDAT_SDAT_HEADER *edat, NPD_HEADER *npd) +int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, rFile *f, bool verbose) { - if (edat == nullptr || npd == nullptr) - return false; + f->Seek(0); + unsigned char header[0xA0]; + unsigned char empty_header[0xA0]; + unsigned char header_hash[0x10]; + unsigned char metadata_hash[0x10]; + memset(header, 0, 0xA0); + memset(empty_header, 0, 0xA0); + memset(header_hash, 0, 0x10); + memset(metadata_hash, 0, 0x10); - if (npd->version == 0 || npd->version == 1) + // Check NPD version and flags. + if ((npd->version == 0) || (npd->version == 1)) { - if (edat->flags & 0x7EFFFFFE) + if (edat->flags & 0x7EFFFFFE) { - LOG_ERROR(LOADER, "EDAT: Bad header flags!\n"); - return false; + LOG_ERROR(LOADER, "EDAT: Bad header flags!"); + return 1; } } - else if (npd->version == 2) + else if (npd->version == 2) { - if (edat->flags & 0x7EFFFFE0) + if (edat->flags & 0x7EFFFFE0) { - LOG_ERROR(LOADER, "EDAT: Bad header flags!\n"); - return false; + LOG_ERROR(LOADER, "EDAT: Bad header flags!"); + return 1; } } - else if (npd->version == 3 || npd->version == 4) + else if ((npd->version == 3) || (npd->version == 4)) { if (edat->flags & 0x7EFFFFC0) { - LOG_ERROR(LOADER, "EDAT: Bad header flags!\n"); - return false; + LOG_ERROR(LOADER, "EDAT: Bad header flags!"); + return 1; } } - else if (npd->version > 4) + else { - LOG_ERROR(LOADER, "EDAT: Unknown version - %d\n", npd->version); - return false; - } - - return true; -} - -int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, rFile *f, bool verbose) -{ - f->Seek(0); - unsigned char *header = new unsigned char[0xA0]; - unsigned char *tmp = new unsigned char[0xA0]; - unsigned char *hash_result = new unsigned char[0x10]; - - // Check NPD version and EDAT flags. - if (!check_flags(edat, npd)) - { - delete[] header; - delete[] tmp; - delete[] hash_result; - + LOG_ERROR(LOADER, "EDAT: Unknown version!"); return 1; } // Read in the file header. f->Read(header, 0xA0); - f->Read(hash_result, 0x10); + + // Read in the header and metadata section hashes. + f->Seek(0x90); + f->Read(metadata_hash, 0x10); + f->Read(header_hash, 0x10); // Setup the hashing mode and the crypto mode used in the file. int crypto_mode = 0x1; int hash_mode = ((edat->flags & EDAT_ENCRYPTED_KEY_FLAG) == 0) ? 0x00000002 : 0x10000002; if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != 0) { - LOG_ERROR(LOADER, "EDAT: DEBUG data detected!\n"); hash_mode |= 0x01000000; + + if (verbose) + LOG_WARNING(LOADER, "EDAT: DEBUG data detected!"); } // Setup header key and iv buffers. - unsigned char header_key[0x10] = {}; - unsigned char header_iv[0x10] = {}; + unsigned char header_key[0x10]; + unsigned char header_iv[0x10]; + memset(header_key, 0, 0x10); + memset(header_iv, 0, 0x10); // Test the header hash (located at offset 0xA0). - if (!crypto(hash_mode, crypto_mode, (npd->version == 4), header, tmp, 0xA0, header_key, header_iv, key, hash_result)) + if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), header, empty_header, 0xA0, header_key, header_iv, key, header_hash)) { if (verbose) - LOG_WARNING(LOADER, "EDAT: Header hash is invalid!\n"); + LOG_WARNING(LOADER, "EDAT: Header hash is invalid!"); + + // If the header hash test fails and the data is not DEBUG, then RAP/RIF/KLIC key is invalid. + if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != EDAT_DEBUG_DATA_FLAG) + { + LOG_ERROR(LOADER, "EDAT: RAP/RIF/KLIC key is invalid!"); + return 1; + } } // Parse the metadata info. - int metadata_section_size = 0x10; + int metadata_section_size = ((edat->flags & EDAT_COMPRESSED_FLAG) != 0 || (edat->flags & EDAT_FLAG_0x20) != 0) ? 0x20 : 0x10; if (((edat->flags & EDAT_COMPRESSED_FLAG) != 0)) { - LOG_WARNING(LOADER, "EDAT: COMPRESSED data detected!\n"); - metadata_section_size = 0x20; + if (verbose) + LOG_WARNING(LOADER, "EDAT: COMPRESSED data detected!"); } - int block_num = (int) ((edat->file_size + edat->block_size - 1) / edat->block_size); - int bytes_read = 0; + int block_num = (int)((edat->file_size + edat->block_size - 1) / edat->block_size); int metadata_offset = 0x100; + int metadata_size = metadata_section_size * block_num; + long long metadata_section_offset = metadata_offset; + + long bytes_read = 0; + long bytes_to_read = metadata_size; + unsigned char *metadata = new unsigned char[metadata_size]; + unsigned char *empty_metadata = new unsigned char[metadata_size]; - long bytes_to_read = metadata_section_size * block_num; while (bytes_to_read > 0) { // Locate the metadata blocks. - int block_size = (0x3C00 > bytes_to_read) ? (int) bytes_to_read : 0x3C00; // 0x3C00 is the maximum block size. - f->Seek(metadata_offset + bytes_read); - unsigned char *data = new unsigned char[block_size]; + f->Seek(metadata_section_offset); // Read in the metadata. - tmp = new unsigned char[block_size]; - f->Read(data, block_size); - - // Check the generated hash against the metadata hash located at offset 0x90 in the header. - memset(hash_result, 0, 0x10); - f->Seek(0x90); - f->Read(hash_result, 0x10); - - // Generate the hash for this block. - if (!crypto(hash_mode, crypto_mode, (npd->version == 4), data, tmp, block_size, header_key, header_iv, key, hash_result)) - { - if (verbose) - LOG_WARNING(LOADER, "EDAT: Metadata hash from block 0x%08x is invalid!\n", metadata_offset + bytes_read); - } + f->Read(metadata + bytes_read, metadata_section_size); // Adjust sizes. - bytes_read += block_size; - bytes_to_read -= block_size; + bytes_read += metadata_section_size; + bytes_to_read -= metadata_section_size; - delete[] data; + if (((edat->flags & EDAT_FLAG_0x20) != 0)) // Metadata block before each data block. + metadata_section_offset += (metadata_section_size + edat->block_size); + else + metadata_section_offset += metadata_section_size; + } + + // Test the metadata section hash (located at offset 0x90). + if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), metadata, empty_metadata, metadata_size, header_key, header_iv, key, metadata_hash)) + { + if (verbose) + LOG_WARNING(LOADER, "EDAT: Metadata section hash is invalid!"); + } + + // Checking ECDSA signatures. + if ((edat->flags & EDAT_DEBUG_DATA_FLAG) == 0) + { + LOG_NOTICE(LOADER, "EDAT: Checking signatures..."); + + // Setup buffers. + unsigned char metadata_signature[0x28]; + unsigned char header_signature[0x28]; + unsigned char signature_hash[20]; + unsigned char signature_r[0x15]; + unsigned char signature_s[0x15]; + unsigned char zero_buf[0x15]; + memset(metadata_signature, 0, 0x28); + memset(header_signature, 0, 0x28); + memset(signature_hash, 0, 20); + memset(signature_r, 0, 0x15); + memset(signature_s, 0, 0x15); + memset(zero_buf, 0, 0x15); + + // Setup ECDSA curve and public key. + ecdsa_set_curve(VSH_CURVE_P, VSH_CURVE_A, VSH_CURVE_B, VSH_CURVE_N, VSH_CURVE_GX, VSH_CURVE_GY); + ecdsa_set_pub(VSH_PUB); + + + // Read in the metadata and header signatures. + f->Seek(0xB0); + f->Read(metadata_signature, 0x28); + f->Seek(0xD8); + f->Read(header_signature, 0x28); + + // Checking metadata signature. + // Setup signature r and s. + memcpy(signature_r + 01, metadata_signature, 0x14); + memcpy(signature_s + 01, metadata_signature + 0x14, 0x14); + if ((!memcmp(signature_r, zero_buf, 0x15)) || (!memcmp(signature_s, zero_buf, 0x15))) + LOG_WARNING(LOADER, "EDAT: Metadata signature is invalid!"); + else + { + // Setup signature hash. + if ((edat->flags & EDAT_FLAG_0x20) != 0) //Sony failed again, they used buffer from 0x100 with half size of real metadata. + { + int metadata_buf_size = block_num * 0x10; + unsigned char *metadata_buf = new unsigned char[metadata_buf_size]; + f->Seek(metadata_offset); + f->Read(metadata_buf, metadata_buf_size); + sha1(metadata_buf, metadata_buf_size, signature_hash); + delete[] metadata_buf; + } + else + sha1(metadata, metadata_size, signature_hash); + + if (!ecdsa_verify(signature_hash, signature_r, signature_s)) + { + LOG_WARNING(LOADER, "EDAT: Metadata signature is invalid!"); + if (((unsigned long long)edat->block_size * block_num) > 0x100000000) + LOG_WARNING(LOADER, "EDAT: *Due to large file size, metadata signature status may be incorrect!"); + } + else + LOG_NOTICE(LOADER, "EDAT: Metadata signature is valid!"); + } + + + // Checking header signature. + // Setup header signature r and s. + memset(signature_r, 0, 0x15); + memset(signature_s, 0, 0x15); + memcpy(signature_r + 01, header_signature, 0x14); + memcpy(signature_s + 01, header_signature + 0x14, 0x14); + + if ((!memcmp(signature_r, zero_buf, 0x15)) || (!memcmp(signature_s, zero_buf, 0x15))) + LOG_WARNING(LOADER, "EDAT: Header signature is invalid!"); + else + { + // Setup header signature hash. + memset(signature_hash, 0, 20); + unsigned char *header_buf = new unsigned char[0xD8]; + f->Seek(0x00); + f->Read(header_buf, 0xD8); + sha1(header_buf, 0xD8, signature_hash ); + delete[] header_buf; + + if (ecdsa_verify(signature_hash, signature_r, signature_s)) + LOG_NOTICE(LOADER, "EDAT: Header signature is valid!"); + else + LOG_WARNING(LOADER, "EDAT: Header signature is invalid!"); + } } // Cleanup. - delete[] header; - delete[] tmp; - delete[] hash_result; + delete[] metadata; + delete[] empty_metadata; return 0; } -void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER *npd, bool verbose) +int validate_npd_hashes(const char* file_name, unsigned char *klicensee, NPD_HEADER *npd, bool verbose) { int title_hash_result = 0; int dev_hash_result = 0; - int file_name_length = (int)strlen(file_name); + int file_name_length = (int) strlen(file_name); unsigned char *buf = new unsigned char[0x30 + file_name_length]; + unsigned char dev[0x60]; unsigned char key[0x10]; + memset(dev, 0, 0x60); + memset(key, 0, 0x10); - // Build the buffer (content_id + file_name). + // Build the title buffer (content_id + file_name). memcpy(buf, npd->content_id, 0x30); memcpy(buf + 0x30, file_name, file_name_length); - // Hash with NP_OMAC_KEY_3 and compare with title_hash. - title_hash_result = cmac_hash_compare(NP_OMAC_KEY_3, 0x10, buf, 0x30 + file_name_length, npd->title_hash); + // Build the dev buffer (first 0x60 bytes of NPD header in big-endian). + memcpy(dev, npd, 0x60); + + // Fix endianness. + int version = swap32(npd->version); + int license = swap32(npd->license); + int type = swap32(npd->type); + memcpy(dev + 0x4, &version, 4); + memcpy(dev + 0x8, &license, 4); + memcpy(dev + 0xC, &type, 4); + + // Hash with NPDRM_OMAC_KEY_3 and compare with title_hash. + title_hash_result = cmac_hash_compare(NP_OMAC_KEY_3, 0x10, buf, 0x30 + file_name_length, npd->title_hash, 0x10); if (verbose) { if (title_hash_result) - LOG_SUCCESS(LOADER, "EDAT: NPD title hash is valid!\n"); - else - LOG_WARNING(LOADER, "EDAT: NPD title hash is invalid!\n"); + LOG_NOTICE(LOADER, "EDAT: NPD title hash is valid!"); + else + LOG_WARNING(LOADER, "EDAT: NPD title hash is invalid!"); } // Check for an empty dev_hash (can't validate if devklic is NULL); @@ -477,40 +612,45 @@ void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER * if (isDevklicEmpty) { if (verbose) - LOG_WARNING(LOADER, "EDAT: NPD dev hash is empty!\n"); + LOG_WARNING(LOADER, "EDAT: NPD dev hash is empty!"); + + // Allow empty dev hash. + dev_hash_result = 1; } else { // Generate klicensee xor key. - xor_(key, klicensee, NP_OMAC_KEY_2, 0x10); + xor_key(key, klicensee, NP_OMAC_KEY_2, 0x10); // Hash with generated key and compare with dev_hash. - dev_hash_result = cmac_hash_compare(key, 0x10, (unsigned char *)npd, 0x60, npd->dev_hash); - + dev_hash_result = cmac_hash_compare(key, 0x10, dev, 0x60, npd->dev_hash, 0x10); + if (verbose) { if (dev_hash_result) - LOG_SUCCESS(LOADER, "EDAT: NPD dev hash is valid!\n"); - else - LOG_WARNING(LOADER, "EDAT: NPD dev hash is invalid!\n"); + LOG_NOTICE(LOADER, "EDAT: NPD dev hash is valid!"); + else + LOG_WARNING(LOADER, "EDAT: NPD dev hash is invalid!"); } } delete[] buf; + + return (title_hash_result && dev_hash_result); } bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsigned char* devklic, unsigned char* rifkey, bool verbose) { // Setup NPD and EDAT/SDAT structs. NPD_HEADER *NPD = new NPD_HEADER(); - EDAT_SDAT_HEADER *EDAT = new EDAT_SDAT_HEADER(); + EDAT_HEADER *EDAT = new EDAT_HEADER(); // Read in the NPD and EDAT/SDAT headers. char npd_header[0x80]; char edat_header[0x10]; - input->Read(npd_header, 0x80); - input->Read(edat_header, 0x10); - + input->Read(npd_header, sizeof(npd_header)); + input->Read(edat_header, sizeof(edat_header)); + memcpy(NPD->magic, npd_header, 4); NPD->version = swap32(*(int*)&npd_header[4]); NPD->license = swap32(*(int*)&npd_header[8]); @@ -523,7 +663,7 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi NPD->unk2 = swap64(*(u64*)&npd_header[120]); unsigned char npd_magic[4] = {0x4E, 0x50, 0x44, 0x00}; //NPD0 - if(memcmp(NPD->magic, npd_magic, 4)) + if (memcmp(NPD->magic, npd_magic, 4)) { LOG_ERROR(LOADER, "EDAT: %s has invalid NPD header or already decrypted.", input_file_name); delete NPD; @@ -537,41 +677,65 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi if (verbose) { - LOG_NOTICE(LOADER, "NPD HEADER\n"); - LOG_NOTICE(LOADER, "NPD version: %d\n", NPD->version); - LOG_NOTICE(LOADER, "NPD license: %d\n", NPD->license); - LOG_NOTICE(LOADER, "NPD type: %d\n", NPD->type); - LOG_NOTICE(LOADER, "\n"); - LOG_NOTICE(LOADER, "EDAT HEADER\n"); - LOG_NOTICE(LOADER, "EDAT flags: 0x%08X\n", EDAT->flags); - LOG_NOTICE(LOADER, "EDAT block size: 0x%08X\n", EDAT->block_size); - LOG_NOTICE(LOADER, "EDAT file size: 0x%08X\n", EDAT->file_size); - LOG_NOTICE(LOADER, "\n"); + LOG_NOTICE(LOADER, "NPD HEADER"); + LOG_NOTICE(LOADER, "NPD version: %d", NPD->version); + LOG_NOTICE(LOADER, "NPD license: %d", NPD->license); + LOG_NOTICE(LOADER, "NPD type: %d", NPD->type); } // Set decryption key. unsigned char key[0x10]; memset(key, 0, 0x10); - if((EDAT->flags & SDAT_FLAG) == SDAT_FLAG) + // Check EDAT/SDAT flag. + if ((EDAT->flags & SDAT_FLAG) == SDAT_FLAG) { - LOG_WARNING(LOADER, "EDAT: SDAT detected!\n"); - xor_(key, NPD->dev_hash, SDAT_KEY, 0x10); + if (verbose) + { + LOG_NOTICE(LOADER, "SDAT HEADER"); + LOG_NOTICE(LOADER, "SDAT flags: 0x%08X", EDAT->flags); + LOG_NOTICE(LOADER, "SDAT block size: 0x%08X", EDAT->block_size); + LOG_NOTICE(LOADER, "SDAT file size: 0x%08X", EDAT->file_size); + } + + // Generate SDAT key. + xor_key(key, NPD->dev_hash, SDAT_KEY, 0x10); } else { - // Perform header validation (optional step). - validate_data(input_file_name, devklic, NPD, verbose); + if (verbose) + { + LOG_NOTICE(LOADER, "EDAT HEADER"); + LOG_NOTICE(LOADER, "EDAT flags: 0x%08X", EDAT->flags); + LOG_NOTICE(LOADER, "EDAT block size: 0x%08X", EDAT->block_size); + LOG_NOTICE(LOADER, "EDAT file size: 0x%08X", EDAT->file_size); + } - if ((NPD->license & 0x3) == 0x3) // Type 3: Use supplied devklic. + // Perform header validation (EDAT only). + char real_file_name[MAX_PATH]; + extract_file_name(input_file_name, real_file_name); + if (!validate_npd_hashes(real_file_name, devklic, NPD, verbose)) + { + // Ignore header validation in DEBUG data. + if ((EDAT->flags & EDAT_DEBUG_DATA_FLAG) != EDAT_DEBUG_DATA_FLAG) + { + LOG_ERROR(LOADER, "EDAT: NPD hash validation failed!"); + delete NPD; + delete EDAT; + return 1; + } + } + + // Select EDAT key. + if ((NPD->license & 0x3) == 0x3) // Type 3: Use supplied devklic. memcpy(key, devklic, 0x10); - else if ((NPD->license & 0x2) == 0x2) // Type 2: Use key from RAP file (RIF key). - { + else if ((NPD->license & 0x2) == 0x2) // Type 2: Use key from RAP file (RIF key). + { memcpy(key, rifkey, 0x10); // Make sure we don't have an empty RIF key. int i, test = 0; - for(i = 0; i < 0x10; i++) + for (i = 0; i < 0x10; i++) { if (key[i] != 0) { @@ -579,30 +743,65 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi break; } } - + if (!test) { - LOG_ERROR(LOADER, "EDAT: A valid RAP file is needed!"); + LOG_ERROR(LOADER, "EDAT: A valid RAP file is needed for this EDAT file!"); delete NPD; delete EDAT; return 1; } } + else if ((NPD->license & 0x1) == 0x1) // Type 1: Use network activation. + { + LOG_ERROR(LOADER, "EDAT: Network license not supported!"); + delete NPD; + delete EDAT; + return 1; + } + + if (verbose) + { + int i; + LOG_NOTICE(LOADER, "DEVKLIC: "); + for (i = 0; i < 0x10; i++) + LOG_NOTICE(LOADER, "%02X", devklic[i]); + + LOG_NOTICE(LOADER, "RIF KEY: "); + for (i = 0; i < 0x10; i++) + LOG_NOTICE(LOADER, "%02X", rifkey[i]); + } } - LOG_NOTICE(LOADER, "EDAT: Parsing data...\n"); + if (verbose) + { + int i; + LOG_NOTICE(LOADER, "DECRYPTION KEY: "); + for (i = 0; i < 0x10; i++) + LOG_NOTICE(LOADER, "%02X", key[i]); + } + + LOG_NOTICE(LOADER, "EDAT: Parsing data..."); if (check_data(key, EDAT, NPD, input, verbose)) - LOG_ERROR(LOADER, "EDAT: Data parsing failed!\n"); + { + LOG_ERROR(LOADER, "EDAT: Data parsing failed!"); + delete NPD; + delete EDAT; + return 1; + } else - LOG_SUCCESS(LOADER, "EDAT: Data successfully parsed!\n"); + LOG_NOTICE(LOADER, "EDAT: Data successfully parsed!"); - printf("\n"); - - LOG_NOTICE(LOADER, "EDAT: Decrypting data...\n"); + LOG_NOTICE(LOADER, "EDAT: Decrypting data..."); if (decrypt_data(input, output, EDAT, NPD, key, verbose)) + { LOG_ERROR(LOADER, "EDAT: Data decryption failed!"); + delete NPD; + delete EDAT; + return 1; + } else - LOG_SUCCESS(LOADER, "EDAT: Data successfully decrypted!"); + LOG_NOTICE(LOADER, "EDAT: Data successfully decrypted!"); delete NPD; delete EDAT; @@ -655,21 +854,21 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi memcpy(devklic, custom_klic, 0x10); else { - LOG_ERROR(LOADER, "EDAT: Invalid custom klic!\n"); + LOG_ERROR(LOADER, "EDAT: Invalid custom klic!"); return -1; } break; } default: - LOG_ERROR(LOADER, "EDAT: Invalid mode!\n"); + LOG_ERROR(LOADER, "EDAT: Invalid mode!"); return -1; } // Check the input/output files. if (!input.IsOpened() || !output.IsOpened()) { - LOG_ERROR(LOADER, "EDAT: Failed to open files!\n"); + LOG_ERROR(LOADER, "EDAT: Failed to open files!"); return -1; } @@ -692,11 +891,11 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi input.Close(); output.Close(); rRemoveFile(output_file_name); - return 0; + return -1; } // Cleanup. input.Close(); output.Close(); return 0; -} +} \ No newline at end of file diff --git a/rpcs3/Crypto/unedat.h b/rpcs3/Crypto/unedat.h index 7efc8b3808..f1a9f81ab5 100644 --- a/rpcs3/Crypto/unedat.h +++ b/rpcs3/Crypto/unedat.h @@ -1,9 +1,12 @@ #pragma once +#include +#include +#include "utils.h" + #define SDAT_FLAG 0x01000000 #define EDAT_COMPRESSED_FLAG 0x00000001 #define EDAT_FLAG_0x02 0x00000002 -#define EDAT_FLAG_0x04 0x00000004 #define EDAT_ENCRYPTED_KEY_FLAG 0x00000008 #define EDAT_FLAG_0x10 0x00000010 #define EDAT_FLAG_0x20 0x00000020 @@ -28,6 +31,6 @@ typedef struct int flags; int block_size; unsigned long long file_size; -} EDAT_SDAT_HEADER; +} EDAT_HEADER; -int DecryptEDAT(const std::string& input_file_name, const std::string& output_file_name, int mode, const std::string& rap_file_name, unsigned char *custom_klic, bool verbose); +int DecryptEDAT(const std::string& input_file_name, const std::string& output_file_name, int mode, const std::string& rap_file_name, unsigned char *custom_klic, bool verbose); \ No newline at end of file diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp index 61422f5328..67ef26a4b1 100644 --- a/rpcs3/Crypto/unself.cpp +++ b/rpcs3/Crypto/unself.cpp @@ -813,10 +813,10 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key) u8 rap_key[0x10]; memset(rap_key, 0, 0x10); - // Try to find a matching RAP file under dev_usb000. + // Try to find a matching RAP file under exdata folder. std::string ci_str((const char *)content_id); - // TODO: This shouldn't use current dir - std::string rap_path("./dev_usb000/" + ci_str + ".rap"); + std::string pf_str("00000001"); // TODO: Allow multiple profiles. Use default for now. + std::string rap_path("dev_hdd0/home/" + pf_str + "/exdata/" + ci_str + ".rap"); // Check if we have a valid RAP file. if (!rExists(rap_path)) diff --git a/rpcs3/Crypto/utils.cpp b/rpcs3/Crypto/utils.cpp index 45a71222e3..2cba01afb8 100644 --- a/rpcs3/Crypto/utils.cpp +++ b/rpcs3/Crypto/utils.cpp @@ -1,9 +1,13 @@ -#include "stdafx.h" -#include "aes.h" -#include "sha1.h" -#include "utils.h" +// Copyright (C) 2014 Hykem +// Licensed under the terms of the GNU GPL, version 3 +// http://www.gnu.org/licenses/gpl-3.0.txt -// Endian swap auxiliary functions. +#include "stdafx.h" +#include "utils.h" +#include +#include + +// Auxiliary functions (endian swap, xor and prng). u16 swap16(u16 i) { return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8); @@ -22,7 +26,7 @@ u64 swap64(u64 i) ((i & 0x00ff000000000000) >> 40) | ((i & 0xff00000000000000) >> 56); } -void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size) +void xor_key(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size) { int i; for(i = 0; i < size; i++) @@ -31,10 +35,24 @@ void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int siz } } +void prng(unsigned char *dest, int size) +{ + unsigned char *buffer = new unsigned char[size]; + srand((u32)time(0)); + + int i; + for(i = 0; i < size; i++) + buffer[i] = (unsigned char)(rand() & 0xFF); + + memcpy(dest, buffer, size); + + delete[] buffer; +} + // Hex string conversion auxiliary functions. u64 hex_to_u64(const char* hex_str) { - u32 length = (u32)strlen(hex_str); + u32 length = (u32) strlen(hex_str); u64 tmp = 0; u64 result = 0; char c; @@ -56,19 +74,19 @@ u64 hex_to_u64(const char* hex_str) return result; } -void hex_to_bytes(unsigned char *data, const char *hex_str) +void hex_to_bytes(unsigned char *data, const char *hex_str, unsigned int str_length) { - u32 str_length = (u32)strlen(hex_str); - u32 data_length = str_length / 2; + u32 strn_length = (str_length > 0) ? str_length : (u32) strlen(hex_str); + u32 data_length = strn_length / 2; char tmp_buf[3] = {0, 0, 0}; // Don't convert if the string length is odd. - if (!(str_length % 2)) + if (!(strn_length % 2)) { - u8 *out = (u8 *) malloc (str_length * sizeof(u8)); + u8 *out = (u8 *)malloc(strn_length * sizeof(u8)); u8 *pos = out; - while (str_length--) + while (strn_length--) { tmp_buf[0] = *hex_str++; tmp_buf[1] = *hex_str++; @@ -81,6 +99,23 @@ void hex_to_bytes(unsigned char *data, const char *hex_str) } } +bool is_hex(const char* hex_str, unsigned int str_length) +{ + static const char hex_chars[] = "0123456789abcdefABCDEF"; + + if (hex_str == NULL) + return false; + + unsigned int i; + for (i = 0; i < str_length; i++) + { + if (strchr(hex_chars, hex_str[i]) == 0) + return false; + } + + return true; +} + // Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC). void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len) { @@ -92,6 +127,16 @@ void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, memset(iv, 0, 0x10); } +void aescbc128_encrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len) +{ + aes_context ctx; + aes_setkey_enc(&ctx, key, 128); + aes_crypt_cbc(&ctx, AES_ENCRYPT, len, iv, in, out); + + // Reset the IV. + memset(iv, 0, 0x10); +} + void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out) { aes_context ctx; @@ -99,13 +144,13 @@ void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out aes_crypt_ecb(&ctx, AES_ENCRYPT, in, out); } -bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash) +bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash, int hash_len) { unsigned char *out = new unsigned char[key_len]; sha1_hmac(key, key_len, in, in_len, out); - for (int i = 0; i < 0x10; i++) + for (int i = 0; i < hash_len; i++) { if (out[i] != hash[i]) { @@ -119,7 +164,12 @@ bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i return true; } -bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash) +void hmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash) +{ + sha1_hmac(key, key_len, in, in_len, hash); +} + +bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash, int hash_len) { unsigned char *out = new unsigned char[key_len]; @@ -127,7 +177,7 @@ bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i aes_setkey_enc(&ctx, key, 128); aes_cmac(&ctx, in_len, in, out); - for (int i = 0; i < key_len; i++) + for (int i = 0; i < hash_len; i++) { if (out[i] != hash[i]) { @@ -141,9 +191,20 @@ bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i return true; } -#include "lz.h" -// Reverse-engineered custom Lempel–Ziv–Markov based compression (unknown variant of LZRC). -int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size) +void cmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash) { - return decompress(out,in,size); + aes_context ctx; + aes_setkey_enc(&ctx, key, 128); + aes_cmac(&ctx, in_len, in, hash); } + +char* extract_file_name(const char* file_path, char real_file_name[MAX_PATH]) +{ + size_t file_path_len = strlen(file_path); + const char* p = strrchr(file_path, '/'); + if (!p) p = strrchr(file_path, '\\'); + if (p) file_path_len = file_path + file_path_len - p - 1; + strncpy(real_file_name, p ? (p + 1) : file_path, file_path_len + 1); + + return real_file_name; +} \ No newline at end of file diff --git a/rpcs3/Crypto/utils.h b/rpcs3/Crypto/utils.h index 4ae1466607..1c27ddb182 100644 --- a/rpcs3/Crypto/utils.h +++ b/rpcs3/Crypto/utils.h @@ -1,20 +1,35 @@ #pragma once -// Auxiliary functions (endian swap and xor). +// Copyright (C) 2014 Hykem +// Licensed under the terms of the GNU GPL, version 3 +// http://www.gnu.org/licenses/gpl-3.0.txt + +#define MAX_PATH 4096 + +#include +#include "aes.h" +#include "sha1.h" +#include "lz.h" +#include "ec.h" + +// Auxiliary functions (endian swap, xor, prng and file name). u16 swap16(u16 i); u32 swap32(u32 i); u64 swap64(u64 i); -void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size); +void xor_key(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size); +void prng(unsigned char *dest, int size); +char* extract_file_name(const char* file_path, char real_file_name[MAX_PATH]); // Hex string conversion auxiliary functions. u64 hex_to_u64(const char* hex_str); -void hex_to_bytes(unsigned char *data, const char *hex_str); +void hex_to_bytes(unsigned char *data, const char *hex_str, unsigned int str_length); +bool is_hex(const char* hex_str, unsigned int str_length); // Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC). void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len); +void aescbc128_encrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len); void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out); -bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash); -bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash); - -// Reverse-engineered custom Lempel–Ziv–Markov based compression (unknown variant of LZRC). -int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size); +bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash, int hash_len); +void hmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash); +bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash, int hash_len); +void cmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash); \ No newline at end of file diff --git a/rpcs3/Emu/Cell/PPUInstrTable.h b/rpcs3/Emu/Cell/PPUInstrTable.h index 8962eb7376..4c5b42c4db 100644 --- a/rpcs3/Emu/Cell/PPUInstrTable.h +++ b/rpcs3/Emu/Cell/PPUInstrTable.h @@ -624,5 +624,9 @@ namespace PPU_instr bind_instr(g3f_0_list, MFFS, FRD, RC); bind_instr(g3f_0_list, MTFSF, FM, FRB, RC); + static auto LIS = std::bind(ADDIS, std::placeholders::_1, 0, std::placeholders::_2); + static auto NOP = std::bind(ORI, 0, 0, 0); + static auto BLR = std::bind(BCLR, 0x10 | 0x04, 0, 0, 0); + #undef bind_instr }; \ No newline at end of file diff --git a/rpcs3/Emu/IdManager.h b/rpcs3/Emu/IdManager.h index b81c8678cd..a5ba1b1447 100644 --- a/rpcs3/Emu/IdManager.h +++ b/rpcs3/Emu/IdManager.h @@ -59,12 +59,13 @@ public: } }; -struct ID +class ID { std::string m_name; IDData* m_data; IDType m_type; +public: template ID(const std::string& name, T* data, const IDType type) : m_name(name) @@ -96,6 +97,21 @@ struct ID { delete m_data; } + + const std::string& GetName() const + { + return m_name; + } + + IDData* GetData() const + { + return m_data; + } + + IDType GetType() const + { + return m_type; + } }; class IdManager @@ -172,7 +188,7 @@ public: return false; } - result = f->second.m_data->get(); + result = f->second.GetData()->get(); return true; } @@ -198,8 +214,8 @@ public: if (item == m_id_map.end()) { return false; } - if (item->second.m_type < TYPE_OTHER) { - m_types[item->second.m_type].erase(id); + if (item->second.GetType() < TYPE_OTHER) { + m_types[item->second.GetType()].erase(id); } item->second.Kill(); diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 005ccb8e6b..c11f8e2de0 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -108,9 +108,9 @@ void MemoryBase::Init(MemoryType type) memset(RawSPUMem, 0, sizeof(RawSPUMem)); #ifdef _WIN32 - if (!m_base_addr) + if (!g_base_addr) #else - if ((s64)m_base_addr == (s64)-1) + if ((s64)g_base_addr == (s64)-1) #endif { LOG_ERROR(MEMORY, "Initializing memory failed"); @@ -119,7 +119,7 @@ void MemoryBase::Init(MemoryType type) } else { - LOG_NOTICE(MEMORY, "Initializing memory: m_base_addr = 0x%llx", (u64)m_base_addr); + LOG_NOTICE(MEMORY, "Initializing memory: m_base_addr = 0x%llx", (u64)g_base_addr); } switch (type) @@ -204,7 +204,7 @@ bool MemoryBase::Map(const u64 addr, const u32 size) { LV2_LOCK(0); - if ((u32)addr != addr || (u64)addr + (u64)size > 0x100000000ull) + if ((addr | (addr + size)) & ~0xFFFFFFFFull) { return false; } diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index bb6c83cc23..1ec1201b3c 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -7,7 +7,7 @@ using std::nullptr_t; #define safe_delete(x) do {delete (x);(x)=nullptr;} while(0) #define safe_free(x) do {free(x);(x)=nullptr;} while(0) -extern void* const m_base_addr; +extern void* const g_base_addr; enum MemoryType { @@ -69,7 +69,7 @@ public: static void* const GetBaseAddr() { - return m_base_addr; + return g_base_addr; } __noinline void InvalidAddress(const char* func, const u64 addr); diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index a55b9a9259..91708cf50c 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -4,7 +4,7 @@ #ifdef _WIN32 #include -void* const m_base_addr = VirtualAlloc(nullptr, 0x100000000, MEM_RESERVE, PAGE_NOACCESS); +void* const g_base_addr = VirtualAlloc(nullptr, 0x100000000, MEM_RESERVE, PAGE_NOACCESS); #else #include @@ -13,7 +13,7 @@ void* const m_base_addr = VirtualAlloc(nullptr, 0x100000000, MEM_RESERVE, PAGE_N #define MAP_ANONYMOUS MAP_ANON #endif -void* const m_base_addr = ::mmap(nullptr, 0x100000000, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); +void* const g_base_addr = ::mmap(nullptr, 0x100000000, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); #endif namespace vm diff --git a/rpcs3/Emu/Memory/vm.h b/rpcs3/Emu/Memory/vm.h index bf300eb175..c3ddba0d84 100644 --- a/rpcs3/Emu/Memory/vm.h +++ b/rpcs3/Emu/Memory/vm.h @@ -10,7 +10,7 @@ namespace vm template T* const get_ptr(u32 addr) { - return (T*)((u8*)m_base_addr + addr); + return (T*)((u8*)g_base_addr + addr); } template @@ -35,49 +35,29 @@ namespace vm { static u8 read8(u32 addr) { - return *((u8*)m_base_addr + addr); - } - - static u8 read8(u64 addr) - { - return read8((u32)addr); + return *((u8*)g_base_addr + addr); } static void write8(u32 addr, u8 value) { - *((u8*)m_base_addr + addr) = value; - } - - static void write8(u64 addr, u8 value) - { - write8((u32)addr, value); + *((u8*)g_base_addr + addr) = value; } static u16 read16(u32 addr) { - return re16(*(u16*)((u8*)m_base_addr + addr)); - } - - static u16 read16(u64 addr) - { - return read16((u32)addr); + return re16(*(u16*)((u8*)g_base_addr + addr)); } static void write16(u32 addr, u16 value) { - *(u16*)((u8*)m_base_addr + addr) = re16(value); - } - - static void write16(u64 addr, u16 value) - { - write16((u32)addr, value); + *(u16*)((u8*)g_base_addr + addr) = re16(value); } static u32 read32(u32 addr) { if (addr < RAW_SPU_BASE_ADDR || (addr % RAW_SPU_OFFSET) < RAW_SPU_PROB_OFFSET) { - return re32(*(u32*)((u8*)m_base_addr + addr)); + return re32(*(u32*)((u8*)g_base_addr + addr)); } else { @@ -85,16 +65,11 @@ namespace vm } } - static u32 read32(u64 addr) - { - return read32((u32)addr); - } - static void write32(u32 addr, u32 value) { if (addr < RAW_SPU_BASE_ADDR || (addr % RAW_SPU_OFFSET) < RAW_SPU_PROB_OFFSET) { - *(u32*)((u8*)m_base_addr + addr) = re32(value); + *(u32*)((u8*)g_base_addr + addr) = re32(value); } else { @@ -102,49 +77,24 @@ namespace vm } } - static void write32(u64 addr, u32 value) - { - write32((u32)addr, value); - } - static u64 read64(u32 addr) { - return re64(*(u64*)((u8*)m_base_addr + addr)); - } - - static u64 read64(u64 addr) - { - return read64((u32)addr); + return re64(*(u64*)((u8*)g_base_addr + addr)); } static void write64(u32 addr, u64 value) { - *(u64*)((u8*)m_base_addr + addr) = re64(value); - } - - static void write64(u64 addr, u64 value) - { - write64((u32)addr, value); + *(u64*)((u8*)g_base_addr + addr) = re64(value); } static u128 read128(u32 addr) { - return re128(*(u128*)((u8*)m_base_addr + addr)); - } - - static u128 read128(u64 addr) - { - return read128((u32)addr); + return re128(*(u128*)((u8*)g_base_addr + addr)); } static void write128(u32 addr, u128 value) { - *(u128*)((u8*)m_base_addr + addr) = re128(value); - } - - static void write128(u64 addr, u128 value) - { - write128((u32)addr, value); + *(u128*)((u8*)g_base_addr + addr) = re128(value); } } @@ -152,52 +102,52 @@ namespace vm { static u8 read8(u32 addr) { - return *((u8*)m_base_addr + addr); + return *((u8*)g_base_addr + addr); } static void write8(u32 addr, u8 value) { - *((u8*)m_base_addr + addr) = value; + *((u8*)g_base_addr + addr) = value; } static u16 read16(u32 addr) { - return *(u16*)((u8*)m_base_addr + addr); + return *(u16*)((u8*)g_base_addr + addr); } static void write16(u32 addr, u16 value) { - *(u16*)((u8*)m_base_addr + addr) = value; + *(u16*)((u8*)g_base_addr + addr) = value; } static u32 read32(u32 addr) { - return *(u32*)((u8*)m_base_addr + addr); + return *(u32*)((u8*)g_base_addr + addr); } static void write32(u32 addr, u32 value) { - *(u32*)((u8*)m_base_addr + addr) = value; + *(u32*)((u8*)g_base_addr + addr) = value; } static u64 read64(u32 addr) { - return *(u64*)((u8*)m_base_addr + addr); + return *(u64*)((u8*)g_base_addr + addr); } static void write64(u32 addr, u64 value) { - *(u64*)((u8*)m_base_addr + addr) = value; + *(u64*)((u8*)g_base_addr + addr) = value; } static u128 read128(u32 addr) { - return *(u128*)((u8*)m_base_addr + addr); + return *(u128*)((u8*)g_base_addr + addr); } static void write128(u32 addr, u128 value) { - *(u128*)((u8*)m_base_addr + addr) = value; + *(u128*)((u8*)g_base_addr + addr) = value; } } } diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 940f377ce8..7a956f9e4d 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -60,14 +60,14 @@ namespace vm return make(m_addr - count * sizeof(AT)); } - __forceinline _ptr_base& operator *() const + __forceinline _ptr_base::value, typename to_be_t::type, AT>>& operator *() const { - return vm::get_ref<_ptr_base>(m_addr); + return vm::get_ref<_ptr_base::value, typename to_be_t::type, AT>>>(m_addr); } - __forceinline _ptr_base& operator [](int index) const + __forceinline _ptr_base::value, typename to_be_t::type, AT>>& operator [](int index) const { - return vm::get_ref<_ptr_base>(m_addr + sizeof(AT) * index); + return vm::get_ref<_ptr_base::value, typename to_be_t::type, AT>>>(m_addr + sizeof(AT)* index); } operator bool() const diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 2a460fb235..612ce6ba96 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1804,11 +1804,9 @@ void GLGSRender::ExecCMD() } } - if (m_set_two_side_light_enable) - { - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - checkForGlError("glLightModeli"); - } + // TODO: Use other glLightModel functions? + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, m_set_two_side_light_enable ? GL_TRUE : GL_FALSE); + checkForGlError("glLightModeli"); if(m_set_shade_mode) { diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp index c312310e43..8fa1774ef5 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.cpp +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -4,7 +4,9 @@ extern void cellAdec_init(Module* pxThis); extern void cellAtrac_init(Module* pxThis); extern void cellAudio_init(Module* pxThis); +extern void cellAvconfExt_init(Module* pxThis); extern void cellCamera_init(Module* pxThis); +extern void cellCamera_unload(); extern void cellDmux_init(Module *pxThis); extern void cellFiber_init(Module *pxThis); extern void cellFont_init(Module *pxThis); @@ -18,10 +20,12 @@ extern void cellGcmSys_init(Module *pxThis); extern void cellGcmSys_load(); extern void cellGcmSys_unload(); extern void cellGem_init(Module *pxThis); +extern void cellGem_unload(); extern void cellJpgDec_init(Module *pxThis); extern void cellGifDec_init(Module *pxThis); extern void cellL10n_init(Module *pxThis); extern void cellNetCtl_init(Module *pxThis); +extern void cellNetCtl_unload(); extern void cellOvis_init(Module *pxThis); extern void cellPamf_init(Module *pxThis); extern void cellPngDec_init(Module *pxThis); @@ -43,6 +47,7 @@ extern void cellVdec_init(Module *pxThis); extern void cellVpost_init(Module *pxThis); extern void libmixer_init(Module *pxThis); extern void sceNp_init(Module *pxThis); +extern void sceNp_unload(); extern void sceNpClans_init(Module *pxThis); extern void sceNpClans_unload(); extern void sceNpCommerce2_init(Module *pxThis); @@ -90,9 +95,9 @@ static const g_modules_list[] = { 0x0011, "cellAudio", cellAudio_init, nullptr, nullptr }, { 0x0012, "cellPamf", cellPamf_init, nullptr, nullptr }, { 0x0013, "cellAtrac", cellAtrac_init, nullptr, nullptr }, - { 0x0014, "cellNetCtl", cellNetCtl_init, nullptr, nullptr }, + { 0x0014, "cellNetCtl", cellNetCtl_init, nullptr, cellNetCtl_unload }, { 0x0015, "cellSysutil", cellSysutil_init, cellSysutil_load, nullptr }, - { 0x0016, "sceNp", sceNp_init, nullptr, nullptr }, + { 0x0016, "sceNp", sceNp_init, nullptr, sceNp_unload }, { 0x0017, "sys_io", sys_io_init, nullptr, nullptr }, { 0x0018, "cellPngDec", cellPngDec_init, nullptr, nullptr }, { 0x0019, "cellFont", cellFont_init, cellFont_load, cellFont_unload }, @@ -105,7 +110,7 @@ static const g_modules_list[] = { 0x0020, "cellDaisy", nullptr, nullptr, nullptr }, { 0x0021, "cellKey2char", nullptr, nullptr, nullptr }, { 0x0022, "cellMic", nullptr, nullptr, nullptr }, - { 0x0023, "cellCamera", cellCamera_init, nullptr, nullptr }, + { 0x0023, "cellCamera", cellCamera_init, nullptr, cellCamera_unload }, { 0x0024, "cellVdecMpeg2", nullptr, nullptr, nullptr }, { 0x0025, "cellVdecAvc", nullptr, nullptr, nullptr }, { 0x0026, "cellAdecLpcm", nullptr, nullptr, nullptr }, @@ -115,7 +120,7 @@ static const g_modules_list[] = { 0x002a, "cellDmuxPamf", nullptr, nullptr, nullptr }, { 0x002e, "cellLv2dbg", nullptr, nullptr, nullptr }, { 0x0030, "cellUsbpspcm", nullptr, nullptr, nullptr }, - { 0x0031, "cellAvconfExt", nullptr, nullptr, nullptr }, + { 0x0031, "cellAvconfExt", cellAvconfExt_init, nullptr, nullptr }, { 0x0032, "cellUserInfo", cellUserInfo_init, nullptr, nullptr }, { 0x0033, "cellSysutilSavedata", nullptr, nullptr, nullptr }, { 0x0034, "cellSubdisplay", nullptr, nullptr, nullptr }, @@ -150,7 +155,7 @@ static const g_modules_list[] = { 0x0056, "cellNpUtil", nullptr, nullptr, nullptr }, { 0x0057, "cellRudp", nullptr, nullptr, nullptr }, { 0x0059, "cellNpSns", sceNpSns_init, nullptr, sceNpSns_unload }, - { 0x005a, "cellGem", cellGem_init, nullptr, nullptr }, + { 0x005a, "cellGem", cellGem_init, nullptr, cellGem_unload }, { 0xf00a, "cellCelpEnc", nullptr, nullptr, nullptr }, { 0xf010, "cellGifDec", cellGifDec_init, nullptr, nullptr }, { 0xf019, "cellAdecCelp", nullptr, nullptr, nullptr }, diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index a994cf5488..c3e8002554 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -5,6 +5,7 @@ #include "Emu/SysCalls/Static.h" #include "Crypto/sha1.h" #include "ModuleManager.h" +#include "Emu/Cell/PPUInstrTable.h" u32 getFunctionId(const char* name) { @@ -89,10 +90,13 @@ void Module::UnLoad() if(m_unload_func) m_unload_func(); - for(u32 i=0; iid); - } + // TODO: Re-enable this when needed + // This was disabled because some functions would get unloaded and + // some games tried to use them, thus only printing a TODO message + //for(u32 i=0; iid); + //} SetLoaded(false); } @@ -146,12 +150,12 @@ void Module::SetName(const std::string& name) bool Module::CheckID(u32 id) const { - return Emu.GetIdManager().CheckID(id) && Emu.GetIdManager().GetID(id).m_name == GetName(); + return Emu.GetIdManager().CheckID(id) && Emu.GetIdManager().GetID(id).GetName() == GetName(); } bool Module::CheckID(u32 id, ID*& _id) const { - return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == GetName(); + return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->GetName() == GetName(); } bool Module::RemoveId(u32 id) @@ -171,12 +175,18 @@ void Module::PushNewFuncSub(SFunc* func) void fix_import(Module* module, u32 func, u32 addr) { - vm::write32(addr + 0x0, 0x3d600000 | (func >> 16)); /* lis r11, (func_id >> 16) */ - vm::write32(addr + 0x4, 0x616b0000 | (func & 0xffff)); /* ori r11, (func_id & 0xffff) */ - vm::write32(addr + 0x8, 0x60000000); /* nop */ - // leave rtoc saving at 0xC - vm::write64(addr + 0x10, 0x440000024e800020ull); /* sc + blr */ - vm::write64(addr + 0x18, 0x6000000060000000ull); /* nop + nop */ + using namespace PPU_instr; + + vm::ptr& ptr = (vm::ptr&)addr; + + *ptr++ = LIS(11, func >> 16); + *ptr++ = ORI(11, 11, func & 0xffff); + *ptr++ = NOP(); + ++ptr; + *ptr++ = SC(2); + *ptr++ = BLR(); + *ptr++ = NOP(); + *ptr++ = NOP(); module->Load(func); } diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index 3f7e7ebe15..1e7afebc22 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -89,7 +89,7 @@ public: if(!CheckID(id, id_data)) return false; - data = id_data->m_data->get(); + data = id_data->GetData()->get(); return true; } @@ -100,8 +100,8 @@ public: if(!CheckID(id, id_data)) return false; - data = id_data->m_data->get(); - type = id_data->m_type; + data = id_data->GetData()->get(); + type = id_data->GetType(); return true; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp new file mode 100644 index 0000000000..a29056057a --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp @@ -0,0 +1,60 @@ +#include "stdafx.h" +#include "Ini.h" +#include "Emu/Memory/Memory.h" +#include "Emu/SysCalls/Modules.h" +#include "Emu/RSX/sysutil_video.h" + +Module *cellAvconfExt = nullptr; + +int cellVideoOutConvertCursorColor() +{ + UNIMPLEMENTED_FUNC(cellAvconfExt); + return CELL_OK; +} + +int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr screenSize) +{ + cellAvconfExt->Warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize_addr=0x%x)", videoOut, screenSize.addr()); + + if (!videoOut == CELL_VIDEO_OUT_PRIMARY) + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; + +#ifdef _WIN32 + HDC screen = GetDC(NULL); + u32 diagonal = round(sqrt((pow(GetDeviceCaps(screen, HORZSIZE), 2) + pow(GetDeviceCaps(screen, VERTSIZE), 2))) * 0.0393); +#else + // TODO: Linux implementation, without using wx + // u32 diagonal = round(sqrt((pow(wxGetDisplaySizeMM().GetWidth(), 2) + pow(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393); +#endif + + if (Ini.GS3DTV.GetValue()) + { +#ifdef _WIN32 + *screenSize = diagonal; +#endif + return CELL_OK; + } + + return CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET; +} + +int cellVideoOutGetGamma() +{ + UNIMPLEMENTED_FUNC(cellAvconfExt); + return CELL_OK; +} + +int cellVideoOutSetGamma() +{ + UNIMPLEMENTED_FUNC(cellAvconfExt); + return CELL_OK; +} + +void cellAvconfExt_init(Module *pxThis) +{ + cellAvconfExt = pxThis; + + cellAvconfExt->AddFunc(0x4ec8c141, cellVideoOutConvertCursorColor); + cellAvconfExt->AddFunc(0xfaa275a4, cellVideoOutGetScreenSize); + cellAvconfExt->AddFunc(0xc7020f62, cellVideoOutSetGamma); +} \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp b/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp index 7a364deb36..7fcec39666 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp @@ -221,6 +221,11 @@ int cellCameraRemoveNotifyEventQueue2() return CELL_OK; } +void cellCamera_unload() +{ + cellCameraInstance.m_bInitialized = false; +} + void cellCamera_init(Module* pxThis) { cellCamera = pxThis; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index 2fc7b1eb83..56c3c2ced9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -251,6 +251,11 @@ int cellGemWriteExternalPort() return CELL_OK; } +void cellGem_unload() +{ + cellGemInstance.m_bInitialized = false; +} + void cellGem_init(Module *pxThis) { cellGem = pxThis; diff --git a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp index 389ae23c34..87b31b94dd 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp @@ -44,7 +44,7 @@ int cellNetCtlTerm() return CELL_OK; } -int cellNetCtlGetState(vm::ptr> state) +int cellNetCtlGetState(vm::ptr state) { cellNetCtl->Warning("cellNetCtlGetState(state_addr=0x%x)", state.addr()); @@ -53,9 +53,9 @@ int cellNetCtlGetState(vm::ptr> state) return CELL_OK; } -int cellNetCtlAddHandler(vm::ptr handler, vm::ptr> arg, s32 hid) +int cellNetCtlAddHandler(vm::ptr handler, vm::ptr arg, vm::ptr hid) { - cellNetCtl->Todo("cellNetCtlAddHandler(handler_addr=0x%x, arg_addr=0x%x, hid=0x%x)", handler.addr(), arg.addr(), hid); + cellNetCtl->Todo("cellNetCtlAddHandler(handler_addr=0x%x, arg_addr=0x%x, hid_addr=0x%x)", handler.addr(), arg.addr(), hid.addr()); return CELL_OK; } @@ -111,6 +111,11 @@ int cellNetCtlGetNatInfo(vm::ptr natInfo) return CELL_OK; } +void cellNetCtl_unload() +{ + cellNetCtlInstance.m_bInitialized = false; +} + void cellNetCtl_init(Module *pxThis) { cellNetCtl = pxThis; diff --git a/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp b/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp index 3b2e2e0403..6284596f73 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" Module *cellOvis = nullptr; @@ -11,9 +12,9 @@ enum CELL_OVIS_ERROR_ALIGN = 0x80410410, }; -int cellOvisGetOverlayTableSize() +int cellOvisGetOverlayTableSize(vm::ptr elf) { - UNIMPLEMENTED_FUNC(cellOvis); + cellOvis->Todo("cellOvisGetOverlayTableSize(elf_addr=0x%x)", elf.addr()); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index 9930bcb665..add879bb34 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -16,11 +16,15 @@ struct sceNpInternal bool m_bSceNpInitialized; bool m_bSceNp2Initialized; bool m_bScoreInitialized; + bool m_bLookupInitialized; + bool m_bSceNpUtilBandwidthTestInitialized; sceNpInternal() : m_bSceNpInitialized(false), m_bSceNp2Initialized(false), - m_bScoreInitialized(false) + m_bScoreInitialized(false), + m_bLookupInitialized(false), + m_bSceNpUtilBandwidthTestInitialized(false) { } }; @@ -106,8 +110,9 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr drm_path) // TODO: These shouldn't use current dir std::string enc_drm_path = drm_path.get_ptr(); - std::string dec_drm_path = "/dev_hdd1/" + titleID + "/" + drm_file_name; - std::string rap_path = "/dev_usb000/"; + std::string dec_drm_path = "/dev_hdd1/cache/" + drm_file_name; + std::string pf_str("00000001"); // TODO: Allow multiple profiles. Use default for now. + std::string rap_path("../dev_hdd0/home/" + pf_str + "/exdata/"); // Search dev_usb000 for a compatible RAP file. vfsDir *raps_dir = new vfsDir(rap_path); @@ -126,19 +131,19 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr drm_path) } } - // Create a new directory under dev_hdd1/titleID to hold the decrypted data. - // TODO: These shouldn't use current dir - std::string tmp_dir = "./dev_hdd1/" + titleID; - if (!rExists(tmp_dir)) - rMkdir("./dev_hdd1/" + titleID); - // Decrypt this EDAT using the supplied k_licensee and matching RAP file. std::string enc_drm_path_local, dec_drm_path_local, rap_path_local; Emu.GetVFS().GetDevice(enc_drm_path, enc_drm_path_local); Emu.GetVFS().GetDevice(dec_drm_path, dec_drm_path_local); Emu.GetVFS().GetDevice(rap_path, rap_path_local); - DecryptEDAT(enc_drm_path_local, dec_drm_path_local, 8, rap_path_local, k_licensee, false); + if (DecryptEDAT(enc_drm_path_local, dec_drm_path_local, 8, rap_path_local, k_licensee, false) >= 0) + { + // If decryption succeeds, replace the encrypted file with it. + rRemoveFile(enc_drm_path_local); + rRename(dec_drm_path_local, enc_drm_path_local); + } + return CELL_OK; } @@ -156,9 +161,17 @@ int sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::ptr drm_path) return npDrmIsAvailable(k_licensee_addr, drm_path); } -int sceNpDrmVerifyUpgradeLicense(u32 content_id_addr) +int sceNpDrmVerifyUpgradeLicense(vm::ptr content_id) { - UNIMPLEMENTED_FUNC(sceNp); + sceNp->Todo("sceNpDrmVerifyUpgradeLicense(content_id_addr=0x%x)", content_id.addr()); + + return CELL_OK; +} + +int sceNpDrmVerifyUpgradeLicense2(vm::ptr content_id) +{ + sceNp->Todo("sceNpDrmVerifyUpgradeLicense2(content_id_addr=0x%x)", content_id.addr()); + return CELL_OK; } @@ -174,6 +187,720 @@ int sceNpDrmGetTimelimit(u32 drm_path_addr, vm::ptr> time_remain_usec) return CELL_OK; } +int sceNpDrmProcessExitSpawn() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpDrmProcessExitSpawn2() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicRegisterHandler() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicRegisterContextSensitiveHandler() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicUnregisterHandler() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicSetPresence() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicSetPresenceDetails() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicSetPresenceDetails2() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicSendMessage() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicSendMessageGui() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicSendMessageAttachment() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicRecvMessageAttachment() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicRecvMessageAttachmentLoad() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicRecvMessageCustom() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicMarkMessageAsUsed() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicAbortGui() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicAddFriend() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetFriendListEntryCount(vm::ptr count) +{ + sceNp->Warning("sceNpBasicGetFriendListEntryCount(count=%d)", count); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + // TODO: Check if there are any friends + *count = 0; + + return CELL_OK; +} + +int sceNpBasicGetFriendListEntry() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetFriendPresenceByIndex() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetFriendPresenceByIndex2() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetFriendPresenceByNpId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetFriendPresenceByNpId2() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicAddPlayersHistory() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicAddPlayersHistoryAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr count) +{ + sceNp->Todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count_addr=0x%x)", options, count.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetPlayersHistoryEntry() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicAddBlockListEntry() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetBlockListEntryCount(u32 count) +{ + sceNp->Todo("sceNpBasicGetBlockListEntryCount(count=%d)", count); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetBlockListEntry() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetMessageAttachmentEntryCount(vm::ptr count) +{ + sceNp->Todo("sceNpBasicGetMessageAttachmentEntryCount(count_addr=0x%x)", count.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr from) +{ + sceNp->Todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from_addr=0x%x)", index, from.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetCustomInvitationEntryCount() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetCustomInvitationEntry() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpBasicGetMatchingInvitationEntryCount(vm::ptr count) +{ + sceNp->Todo("sceNpBasicGetMatchingInvitationEntryCount(count_addr=0x%x)", count.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptr from) +{ + sceNp->Todo("sceNpBasicGetMatchingInvitationEntry(index=%d, from_addr=0x%x)", index, from.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetClanMessageEntryCount(vm::ptr count) +{ + sceNp->Todo("sceNpBasicGetClanMessageEntryCount(count_addr=0x%x)", count.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetClanMessageEntry(u32 index, vm::ptr from) +{ + sceNp->Todo("sceNpBasicGetClanMessageEntry(index=%d, from_addr=0x%x)", index, from.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) +{ + sceNp->Warning("sceNpBasicGetMessageEntryCount(type=%d, count=%d)", type, count); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + // TODO: Check if there are messages + *count = 0; + + return CELL_OK; +} + +int sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr from) +{ + sceNp->Todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from_addr=0x%x)", type, index, from.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpBasicGetEvent(vm::ptr event, vm::ptr from, vm::ptr data, vm::ptr size) +{ + sceNp->Warning("sceNpBasicGetEvent(event_addr=0x%x, from_addr=0x%x, data_addr=0x%x, size_addr=0x%x)", event.addr(), from.addr(), data.addr(), size.addr()); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; + + // TODO: Check for other error and pass other events + *event = SCE_NP_BASIC_EVENT_OFFLINE; + + return CELL_OK; +} + +int sceNpCommerceCreateCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceDestroyCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceInitProductCategory() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceDestroyProductCategory() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetProductCategoryStart() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetProductCategoryFinish() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetProductCategoryResult() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetProductCategoryAbort() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetProductId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetProductName() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCategoryDescription() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCategoryId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCategoryImageURL() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCategoryInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCategoryName() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCurrencyCode() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCurrencyDecimals() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetCurrencyInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetNumOfChildCategory() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetNumOfChildProductSku() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetSkuDescription() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetSkuId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetSkuImageURL() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetSkuName() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetSkuPrice() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetSkuUserData() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceSetDataFlagStart() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetDataFlagStart() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceSetDataFlagFinish() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetDataFlagFinish() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetDataFlagState() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetDataFlagAbort() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetChildCategoryInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceGetChildProductSkuInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceDoCheckoutStartAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCommerceDoCheckoutFinishAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCustomMenuRegisterActions() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCustomMenuActionSetActivation() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpCustomMenuRegisterExceptionList() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpFriendlist() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpFriendlistCustom() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpFriendlistAbortGui() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupInit() +{ + sceNp->Warning("sceNpLookupInit()"); + + // TODO: Make sure the error code returned is right, + // since there are no error codes for Lookup utility. + if (sceNpInstance.m_bLookupInitialized) + return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; + + sceNpInstance.m_bLookupInitialized = true; + + return CELL_OK; +} + +int sceNpLookupTerm() +{ + sceNp->Warning("sceNpLookupTerm()"); + + if (!sceNpInstance.m_bLookupInitialized) + return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; + + sceNpInstance.m_bLookupInitialized = false; + + return CELL_OK; +} + +int sceNpLookupCreateTitleCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupDestroyTitleCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupCreateTransactionCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupDestroyTransactionCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupSetTimeout() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupAbortTransaction() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupWaitAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupPollAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupNpId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupNpIdAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupUserProfile() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupUserProfileAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupUserProfileWithAvatarSize() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupUserProfileWithAvatarSizeAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupAvatarImage() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupAvatarImageAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupTitleStorage() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupTitleStorageAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + + return CELL_OK; +} + +int sceNpLookupTitleSmallStorage() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpLookupTitleSmallStorageAsync() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerRegisterCallback() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerUnregisterCallback() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + int sceNpManagerGetStatus(vm::ptr> status) { sceNp->Log("sceNpManagerGetStatus(status_addr=0x%x)", status.addr()); @@ -187,241 +914,31 @@ int sceNpManagerGetStatus(vm::ptr> status) return CELL_OK; } -int sceNpManagerSubSignout() +int sceNpManagerGetNetworkTime() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetChildProductSkuInfo() +int sceNpManagerGetOnlineId() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicSendMessageGui() +int sceNpManagerGetNpId() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpMatchingGetResult() +int sceNpManagerGetOnlineName() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicGetFriendListEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreRecordGameData() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetDataFlagAbort() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetMatchingInvitationEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetRankingByNpId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetTicket() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingQuickMatchGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetConnectionInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupNpId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreRecordScore() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicAddPlayersHistory() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetAccountAge() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetPsHandle() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreWaitAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetSkuUserData() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicAddBlockListEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupUserProfileWithAvatarSizeAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetRankingByRangeAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansRankingByClanIdAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreDestroyTitleCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetFriendPresenceByNpId2() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetCtxOpt() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingGetResultGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetProductCategoryStart() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreSetPlayerCharacterId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingSetCtxOpt() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicAddFriend() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreSetTimeout() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansRankingByClanId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingAcceptInvitationGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetNumOfChildCategory() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreSanitizeCommentAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingDestroyCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpProfileAbortGui() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupUserProfileWithAvatarSize() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetMessageEntry() +int sceNpManagerGetAvatarUrl() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; @@ -433,7 +950,235 @@ int sceNpManagerGetMyLanguages() return CELL_OK; } -int sceNpBasicGetFriendPresenceByIndex() +int sceNpManagerGetAccountRegion() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetAccountAge() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetContentRatingFlag() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetChatRestrictionFlag() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetCachedInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetPsHandle() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerRequestTicket() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerRequestTicket2() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetTicket() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetTicketParam() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetEntitlementIdList() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerGetEntitlementById() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerSubSignin() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerSubSigninAbortGui() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpManagerSubSignout() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingCreateCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingDestroyCtx() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetResult() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetResultGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingSetRoomInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingSetRoomInfoNoLimit() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetRoomInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetRoomInfoNoLimit() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingSetRoomSearchFlag() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetRoomSearchFlag() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetRoomMemberListLocal() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGetRoomListLimitGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingKickRoomMember() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingKickRoomMemberWithOpt() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingQuickMatchGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingSendInvitationGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingAcceptInvitationGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingCreateRoomGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingJoinRoomGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingLeaveRoom() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingSearchJoinRoomGUI() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpMatchingGrantOwnership() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpProfileCallGui() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpProfileAbortGui() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; @@ -451,445 +1196,6 @@ int sceNpScoreInit() return CELL_OK; } -int sceNpMatchingSearchJoinRoomGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingKickRoomMember() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetConnectionFromPeerAddress() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetCategoryDescription() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetAvatarUrl() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetSkuId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetGameData() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingCreateRoomGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupAbortTransaction() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetRankingByNpIdAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicSetPresence() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetProductCategoryResult() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicRegisterContextSensitiveHandler() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansMembersRankingByNpIdPcId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansMembersRankingByNpIdPcIdAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicSendMessageAttachment() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerSubSignin() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCustomMenuRegisterActions() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingJoinRoomGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicAbortGui() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingSetRoomInfoNoLimit() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetCachedInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansMembersRankingByRangeAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetClanMessageEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingAddExtendedHandler() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerUnregisterCallback() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetTicketParam() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetMessageAttachmentEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupDestroyTitleCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupTitleStorageAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - - return CELL_OK; -} - -int sceNpBasicSetPresenceDetails2() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupInit() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerSubSigninAbortGui() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingActivateConnection() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingCreateCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetFriendPresenceByIndex2() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicRecvMessageAttachmentLoad() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingCancelPeerNetInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetProductCategoryAbort() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingGetRoomInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceDestroyProductCategory() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansMembersRankingByRange() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetCategoryName() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetContentRatingFlag() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreCreateTransactionCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingSetRoomInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupSetTimeout() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetNumOfChildProductSku() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetBlockListEntryCount() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingGetRoomMemberListLocal() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClanMemberGameData() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupPollAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetPeerNetInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetSkuPrice() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetCurrencyCode() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClansRankingByRangeAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreCensorCommentAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreCensorComment() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerRequestTicket() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicRecvMessageCustom() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int _sceNpSysutilClientFree() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerRequestTicket2() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupTerm() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupTitleSmallStorageAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingSendInvitationGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceInitProductCategory() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceSetDataFlagFinish() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetMessageAttachmentEntryCount() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetDataFlagFinish() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetProductId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetCategoryImageURL() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCustomMenuRegisterExceptionList() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingTerminateConnection() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - int sceNpScoreTerm() { sceNp->Warning("sceNpScoreTerm()"); @@ -902,37 +1208,43 @@ int sceNpScoreTerm() return CELL_OK; } -int sceNpCommerceSetDataFlagStart() +int sceNpScoreCreateTitleCtx() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpSignalingGetLocalNetInfo() +int sceNpScoreDestroyTitleCtx() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpLookupTitleStorage() +int sceNpScoreCreateTransactionCtx() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicGetPlayersHistoryEntryCount() +int sceNpScoreDestroyTransactionCtx() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpManagerGetEntitlementById() +int sceNpScoreSetTimeout() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpMatchingSetRoomSearchFlag() +int sceNpScoreSetPlayerCharacterId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpScoreWaitAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; @@ -944,175 +1256,97 @@ int sceNpScorePollAsync() return CELL_OK; } -int sceNpCommerceGetSkuDescription() +int sceNpScoreGetBoardInfo() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicGetCustomInvitationEntryCount() +int sceNpScoreGetBoardInfoAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpDrmProcessExitSpawn() +int sceNpScoreRecordScore() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpMatchingCreateCtx() +int sceNpScoreRecordScoreAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicUnregisterHandler() +int sceNpScoreRecordGameData() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetCategoryId() +int sceNpScoreRecordGameDataAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceDoCheckoutFinishAsync() +int sceNpScoreGetGameData() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicGetMatchingInvitationEntryCount() +int sceNpScoreGetGameDataAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetCurrencyDecimals() +int sceNpScoreGetRankingByNpId() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicGetFriendListEntryCount() +int sceNpScoreGetRankingByNpIdAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpMatchingGetRoomInfoNoLimit() +int sceNpScoreGetRankingByRange() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpScoreGetClansRankingByRange() +int sceNpScoreGetRankingByRangeAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetCurrencyInfo() +int sceNpScoreCensorComment() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpManagerGetAccountRegion() +int sceNpScoreCensorCommentAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicRecvMessageAttachment() +int sceNpScoreSanitizeComment() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpLookupAvatarImage() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetEntitlementIdList() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreCreateTitleCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetChildCategoryInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetPlayersHistoryEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicRegisterHandler() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicAddPlayersHistoryAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetNetworkTime() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetOnlineId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpDrmVerifyUpgradeLicense2() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicSetPresenceDetails() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetClanMemberGameDataAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetClanMessageEntryCount() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupAvatarImageAsync() +int sceNpScoreSanitizeCommentAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; @@ -1130,114 +1364,7 @@ int sceNpScoreGetRankingByNpIdPcIdAsync() return CELL_OK; } -int sceNpScoreDestroyTransactionCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetConnectionStatus() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupTitleSmallStorage() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetSkuImageURL() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupCreateTitleCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpProfileCallGui() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetProductCategoryFinish() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceGetDataFlagState() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetCustomInvitationEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetPeerNetInfoResult() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupNpIdAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpUtilCmpNpId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingKickRoomMemberWithOpt() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupWaitAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpFriendlistCustom() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingGrantOwnership() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetGameDataAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} -int sceNpCommerceGetDataFlagStart() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetBoardInfoAsync() +int sceNpScoreAbortTransaction() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; @@ -1249,252 +1376,73 @@ int sceNpScoreGetClansMembersRankingByNpId() return CELL_OK; } -int sceNpLookupUserProfile() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetEvent() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicMarkMessageAsUsed() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingGetRoomListLimitGUI() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceDestroyCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceDoCheckoutStartAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpDrmProcessExitSpawn2() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerRegisterCallback() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingGetConnectionFromNpId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - int sceNpScoreGetClansMembersRankingByNpIdAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpLookupCreateTransactionCtx() +int sceNpScoreGetClansMembersRankingByNpIdPcId() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetProductName() +int sceNpScoreGetClansMembersRankingByNpIdPcIdAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpManagerGetChatRestrictionFlag() +int sceNpScoreGetClansRankingByRange() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetCategoryInfo() +int sceNpScoreGetClansRankingByRangeAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicSendMessage() +int sceNpScoreGetClanMemberGameData() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpBasicGetMessageEntryCount() +int sceNpScoreGetClanMemberGameDataAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int _sceNpSysutilClientMalloc() +int sceNpScoreGetClansRankingByClanId() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpCommerceGetSkuName() +int sceNpScoreGetClansRankingByClanIdAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpScoreAbortTransaction() +int sceNpScoreGetClansMembersRankingByRange() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpMatchingGetRoomSearchFlag() +int sceNpScoreGetClansMembersRankingByRangeAsync() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; } -int sceNpFriendlist() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreRecordScoreAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreSanitizeComment() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} -int sceNpBasicGetBlockListEntry() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetOnlineName() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetBoardInfo() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpFriendlistAbortGui() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpUtilCmpNpIdInOrder() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreRecordGameDataAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpMatchingLeaveRoom() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCustomMenuActionSetActivation() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupDestroyTransactionCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpScoreGetRankingByRange() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpCommerceCreateCtx() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpSignalingDeactivateConnection() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpBasicGetFriendPresenceByNpId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpManagerGetNpId() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpLookupUserProfileAsync() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpUtilBandwidthTestShutdown() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpUtilBandwidthTestInitStart() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpUtilBandwidthTestGetStatus() -{ - UNIMPLEMENTED_FUNC(sceNp); - return CELL_OK; -} - -int sceNpUtilBandwidthTestAbort() +int sceNpSignalingCreateCtx() { UNIMPLEMENTED_FUNC(sceNp); return CELL_OK; @@ -1506,236 +1454,397 @@ int sceNpSignalingDestroyCtx() return CELL_OK; } +int sceNpSignalingAddExtendedHandler() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingSetCtxOpt() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetCtxOpt() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingActivateConnection() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingDeactivateConnection() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingTerminateConnection() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetConnectionStatus() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetConnectionInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetConnectionFromNpId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetConnectionFromPeerAddress() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetLocalNetInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetPeerNetInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingCancelPeerNetInfo() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpSignalingGetPeerNetInfoResult() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpUtilCmpNpId() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpUtilCmpNpIdInOrder() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int sceNpUtilBandwidthTestInitStart(u32 prio, size_t stack) +{ + UNIMPLEMENTED_FUNC(sceNp); + + if (sceNpInstance.m_bSceNpUtilBandwidthTestInitialized) + return SCE_NP_ERROR_ALREADY_INITIALIZED; + + sceNpInstance.m_bSceNpUtilBandwidthTestInitialized = true; + + return CELL_OK; +} + +int sceNpUtilBandwidthTestGetStatus() +{ + UNIMPLEMENTED_FUNC(sceNp); + + if (!sceNpInstance.m_bSceNpUtilBandwidthTestInitialized) + return SCE_NP_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int sceNpUtilBandwidthTestShutdown() +{ + UNIMPLEMENTED_FUNC(sceNp); + + if (!sceNpInstance.m_bSceNpUtilBandwidthTestInitialized) + return SCE_NP_ERROR_NOT_INITIALIZED; + + sceNpInstance.m_bSceNpUtilBandwidthTestInitialized = false; + + return CELL_OK; +} + +int sceNpUtilBandwidthTestAbort() +{ + UNIMPLEMENTED_FUNC(sceNp); + + if (!sceNpInstance.m_bSceNpUtilBandwidthTestInitialized) + return SCE_NP_ERROR_NOT_INITIALIZED; + + return CELL_OK; +} + +int _sceNpSysutilClientMalloc() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +int _sceNpSysutilClientFree() +{ + UNIMPLEMENTED_FUNC(sceNp); + return CELL_OK; +} + +void sceNp_unload() +{ + sceNpInstance.m_bSceNpInitialized = false; + sceNpInstance.m_bSceNp2Initialized = false; + sceNpInstance.m_bScoreInitialized = false; + sceNpInstance.m_bLookupInitialized = false; + sceNpInstance.m_bSceNpUtilBandwidthTestInitialized = false; +} + void sceNp_init(Module *pxThis) { sceNp = pxThis; sceNp->AddFunc(0xbd28fdbf, sceNpInit); sceNp->AddFunc(0x41251f74, sceNp2Init); + sceNp->AddFunc(0xc2ced2b7, sceNpUtilBandwidthTestInitStart); sceNp->AddFunc(0x4885aa18, sceNpTerm); sceNp->AddFunc(0xaadb7c12, sceNp2Term); + sceNp->AddFunc(0x432b3cbf, sceNpUtilBandwidthTestShutdown); sceNp->AddFunc(0xad218faf, sceNpDrmIsAvailable); sceNp->AddFunc(0xf042b14f, sceNpDrmIsAvailable2); sceNp->AddFunc(0x2ecd48ed, sceNpDrmVerifyUpgradeLicense); sceNp->AddFunc(0xbe0e3ee2, sceNpDrmVerifyUpgradeLicense2); sceNp->AddFunc(0xf283c143, sceNpDrmExecuteGamePurchase); sceNp->AddFunc(0xcf51864b, sceNpDrmGetTimelimit); - sceNp->AddFunc(0xa7bff757, sceNpManagerGetStatus); - sceNp->AddFunc(0x000e53cc, sceNpManagerSubSignout); - sceNp->AddFunc(0x01cd9cfd, sceNpCommerceGetChildProductSkuInfo); - sceNp->AddFunc(0x01fbbc9b, sceNpBasicSendMessageGui); - sceNp->AddFunc(0x03c741a7, sceNpMatchingGetResult); - sceNp->AddFunc(0x04372385, sceNpBasicGetFriendListEntry); - sceNp->AddFunc(0x04ca5e6a, sceNpScoreRecordGameData); - sceNp->AddFunc(0x0561448b, sceNpCommerceGetDataFlagAbort); - sceNp->AddFunc(0x05af1cb8, sceNpBasicGetMatchingInvitationEntry); - sceNp->AddFunc(0x05d65dff, sceNpScoreGetRankingByNpId); - sceNp->AddFunc(0x0968aa36, sceNpManagerGetTicket); - sceNp->AddFunc(0x14497465, sceNpMatchingQuickMatchGUI); - sceNp->AddFunc(0x155de760, sceNpSignalingGetConnectionInfo); - sceNp->AddFunc(0x166dcc11, sceNpLookupNpId); - sceNp->AddFunc(0x1672170e, sceNpScoreRecordScore); - sceNp->AddFunc(0x168a3117, sceNpBasicAddPlayersHistory); - sceNp->AddFunc(0x168fcece, sceNpManagerGetAccountAge); - sceNp->AddFunc(0x16f88a6f, sceNpManagerGetPsHandle); - sceNp->AddFunc(0x1a2704f7, sceNpScoreWaitAsync); - sceNp->AddFunc(0x1a3fcb69, sceNpCommerceGetSkuUserData); - sceNp->AddFunc(0x1ae8a549, sceNpBasicAddBlockListEntry); - sceNp->AddFunc(0x1fdb3ec2, sceNpLookupUserProfileWithAvatarSizeAsync); - sceNp->AddFunc(0x21206642, sceNpScoreGetRankingByRangeAsync); - sceNp->AddFunc(0x227f8763, sceNpScoreGetClansRankingByClanIdAsync); - sceNp->AddFunc(0x259113b8, sceNpScoreDestroyTitleCtx); - sceNp->AddFunc(0x260caedd, sceNpBasicGetFriendPresenceByNpId2); - sceNp->AddFunc(0x2687a127, sceNpSignalingGetCtxOpt); - sceNp->AddFunc(0x26b3bc94, sceNpMatchingGetResultGUI); - sceNp->AddFunc(0x26f33146, sceNpCommerceGetProductCategoryStart); - sceNp->AddFunc(0x2706eaa1, sceNpScoreSetPlayerCharacterId); - sceNp->AddFunc(0x276c72b2, sceNpSignalingSetCtxOpt); - sceNp->AddFunc(0x27c69eba, sceNpBasicAddFriend); - sceNp->AddFunc(0x29dd45dc, sceNpScoreSetTimeout); - sceNp->AddFunc(0x2a76895a, sceNpScoreGetClansRankingByClanId); - sceNp->AddFunc(0x2ad7837d, sceNpMatchingAcceptInvitationGUI); - sceNp->AddFunc(0x2be41ece, sceNpCommerceGetNumOfChildCategory); - sceNp->AddFunc(0x2cd2a1af, sceNpScoreSanitizeCommentAsync); - sceNp->AddFunc(0x2e1c5068, sceNpMatchingDestroyCtx); - sceNp->AddFunc(0x2f2c6b3e, sceNpProfileAbortGui); - sceNp->AddFunc(0x2fccbfe0, sceNpLookupUserProfileWithAvatarSize); - sceNp->AddFunc(0x30d1cbde, sceNpBasicGetMessageEntry); - sceNp->AddFunc(0x32200389, sceNpManagerGetMyLanguages); - sceNp->AddFunc(0x32c78a6a, sceNpBasicGetFriendPresenceByIndex); - sceNp->AddFunc(0x32cf311f, sceNpScoreInit); - sceNp->AddFunc(0x32febb4c, sceNpMatchingSearchJoinRoomGUI); - sceNp->AddFunc(0x34cc0ca4, sceNpMatchingKickRoomMember); - sceNp->AddFunc(0x34ce82a0, sceNpSignalingGetConnectionFromPeerAddress); - sceNp->AddFunc(0x359642a6, sceNpCommerceGetCategoryDescription); - sceNp->AddFunc(0x36d0c2c5, sceNpManagerGetAvatarUrl); - sceNp->AddFunc(0x39a69619, sceNpCommerceGetSkuId); - sceNp->AddFunc(0x3b02418d, sceNpScoreGetGameData); - sceNp->AddFunc(0x3cc8588a, sceNpMatchingCreateRoomGUI); - sceNp->AddFunc(0x3d1760dc, sceNpLookupAbortTransaction); - sceNp->AddFunc(0x3db7914d, sceNpScoreGetRankingByNpIdAsync); - sceNp->AddFunc(0x3f0808aa, sceNpBasicSetPresence); - sceNp->AddFunc(0x3f195b3a, sceNpCommerceGetProductCategoryResult); - sceNp->AddFunc(0x4026eac5, sceNpBasicRegisterContextSensitiveHandler); - sceNp->AddFunc(0x41ffd4f2, sceNpScoreGetClansMembersRankingByNpIdPcId); - sceNp->AddFunc(0x433fcb30, sceNpScoreGetClansMembersRankingByNpIdPcIdAsync); - sceNp->AddFunc(0x43b989f5, sceNpBasicSendMessageAttachment); - sceNp->AddFunc(0x442381f7, sceNpManagerSubSignin); - sceNp->AddFunc(0x45f8f3aa, sceNpCustomMenuRegisterActions); - sceNp->AddFunc(0x474b7b13, sceNpMatchingJoinRoomGUI); - sceNp->AddFunc(0x481ce0e8, sceNpBasicAbortGui); - sceNp->AddFunc(0x4a18a89e, sceNpMatchingSetRoomInfoNoLimit); - sceNp->AddFunc(0x4b9efb7a, sceNpManagerGetCachedInfo); - sceNp->AddFunc(0x4d5e0670, sceNpScoreGetClansMembersRankingByRangeAsync); - sceNp->AddFunc(0x4d9c615d, sceNpBasicGetClanMessageEntry); - sceNp->AddFunc(0x50b86d94, sceNpSignalingAddExtendedHandler); - sceNp->AddFunc(0x52a6b523, sceNpManagerUnregisterCallback); - sceNp->AddFunc(0x58fa4fcd, sceNpManagerGetTicketParam); - sceNp->AddFunc(0x5d543bbe, sceNpBasicGetMessageAttachmentEntry); - sceNp->AddFunc(0x5de61626, sceNpLookupDestroyTitleCtx); - sceNp->AddFunc(0x5e117ed5, sceNpLookupTitleStorageAsync); - sceNp->AddFunc(0x5e849303, sceNpBasicSetPresenceDetails2); - sceNp->AddFunc(0x5f2d9257, sceNpLookupInit); - sceNp->AddFunc(0x60440c73, sceNpManagerSubSigninAbortGui); - sceNp->AddFunc(0x60897c38, sceNpSignalingActivateConnection); - sceNp->AddFunc(0x6356082e, sceNpSignalingCreateCtx); - sceNp->AddFunc(0x6453b27b, sceNpBasicGetFriendPresenceByIndex2); - sceNp->AddFunc(0x64a704cc, sceNpBasicRecvMessageAttachmentLoad); - sceNp->AddFunc(0x64dbb89d, sceNpSignalingCancelPeerNetInfo); - sceNp->AddFunc(0x674bb9ff, sceNpCommerceGetProductCategoryAbort); - sceNp->AddFunc(0x691f429d, sceNpMatchingGetRoomInfo); - sceNp->AddFunc(0x6cb81eb2, sceNpCommerceDestroyProductCategory); - sceNp->AddFunc(0x6d4adc3b, sceNpScoreGetClansMembersRankingByRange); - sceNp->AddFunc(0x6e2ab18b, sceNpCommerceGetCategoryName); - sceNp->AddFunc(0x6ee62ed2, sceNpManagerGetContentRatingFlag); - sceNp->AddFunc(0x6f5e8143, sceNpScoreCreateTransactionCtx); - sceNp->AddFunc(0x6f8fd267, sceNpMatchingSetRoomInfo); - sceNp->AddFunc(0x71e5af7e, sceNpLookupSetTimeout); - sceNp->AddFunc(0x7208dc08, sceNpCommerceGetNumOfChildProductSku); - sceNp->AddFunc(0x73931bd0, sceNpBasicGetBlockListEntryCount); - sceNp->AddFunc(0x73a2e36b, sceNpMatchingGetRoomMemberListLocal); - sceNp->AddFunc(0x741fbf24, sceNpScoreGetClanMemberGameData); - sceNp->AddFunc(0x7508112e, sceNpLookupPollAsync); - sceNp->AddFunc(0x75eb50cb, sceNpSignalingGetPeerNetInfo); - sceNp->AddFunc(0x78d7f9ad, sceNpCommerceGetSkuPrice); - sceNp->AddFunc(0x79225aa3, sceNpCommerceGetCurrencyCode); - sceNp->AddFunc(0x7b7e9137, sceNpScoreGetClansRankingByRangeAsync); - sceNp->AddFunc(0x7be47e61, sceNpScoreCensorCommentAsync); - sceNp->AddFunc(0x7deb244c, sceNpScoreCensorComment); - sceNp->AddFunc(0x7e2fef28, sceNpManagerRequestTicket); - sceNp->AddFunc(0x806960ab, sceNpBasicRecvMessageCustom); - sceNp->AddFunc(0x816c6a5f, _sceNpSysutilClientFree); - sceNp->AddFunc(0x8297f1ec, sceNpManagerRequestTicket2); - sceNp->AddFunc(0x8440537c, sceNpLookupTerm); - sceNp->AddFunc(0x860b1756, sceNpLookupTitleSmallStorageAsync); - sceNp->AddFunc(0x8b7bbd73, sceNpMatchingSendInvitationGUI); - sceNp->AddFunc(0x8d1d096c, sceNpCommerceInitProductCategory); - sceNp->AddFunc(0x8d4518a0, sceNpCommerceSetDataFlagFinish); - sceNp->AddFunc(0x9153bdf4, sceNpBasicGetMessageAttachmentEntryCount); - sceNp->AddFunc(0x9281e87a, sceNpCommerceGetDataFlagFinish); - sceNp->AddFunc(0x936df4aa, sceNpCommerceGetProductId); - sceNp->AddFunc(0x9452f4f8, sceNpCommerceGetCategoryImageURL); - sceNp->AddFunc(0x9458f464, sceNpCustomMenuRegisterExceptionList); - sceNp->AddFunc(0x95c7bba3, sceNpSignalingTerminateConnection); - sceNp->AddFunc(0x9851f805, sceNpScoreTerm); - sceNp->AddFunc(0x99ac9952, sceNpCommerceSetDataFlagStart); - sceNp->AddFunc(0x9ad7fbd1, sceNpSignalingGetLocalNetInfo); - sceNp->AddFunc(0x9ee9f97e, sceNpLookupTitleStorage); - sceNp->AddFunc(0xa15f35fe, sceNpBasicGetPlayersHistoryEntryCount); - sceNp->AddFunc(0xa1709abd, sceNpManagerGetEntitlementById); - sceNp->AddFunc(0xa284bd1d, sceNpMatchingSetRoomSearchFlag); - sceNp->AddFunc(0xa7a090e5, sceNpScorePollAsync); - sceNp->AddFunc(0xa85a4951, sceNpCommerceGetSkuDescription); - sceNp->AddFunc(0xa8afa7d4, sceNpBasicGetCustomInvitationEntryCount); sceNp->AddFunc(0xaa16695f, sceNpDrmProcessExitSpawn); - sceNp->AddFunc(0xac66568c, sceNpMatchingCreateCtx); - sceNp->AddFunc(0xacb9ee8e, sceNpBasicUnregisterHandler); - sceNp->AddFunc(0xaee8cf71, sceNpCommerceGetCategoryId); - sceNp->AddFunc(0xaf3eba5a, sceNpCommerceDoCheckoutFinishAsync); - sceNp->AddFunc(0xaf505def, sceNpBasicGetMatchingInvitationEntryCount); - sceNp->AddFunc(0xaf57d9c9, sceNpCommerceGetCurrencyDecimals); - sceNp->AddFunc(0xafef640d, sceNpBasicGetFriendListEntryCount); - sceNp->AddFunc(0xb020684e, sceNpMatchingGetRoomInfoNoLimit); - sceNp->AddFunc(0xb082003b, sceNpScoreGetClansRankingByRange); - sceNp->AddFunc(0xb1c02d66, sceNpCommerceGetCurrencyInfo); - sceNp->AddFunc(0xb1e0718b, sceNpManagerGetAccountRegion); - sceNp->AddFunc(0xb5cb2d56, sceNpBasicRecvMessageAttachment); - sceNp->AddFunc(0xb6017827, sceNpLookupAvatarImage); - sceNp->AddFunc(0xb66d1c46, sceNpManagerGetEntitlementIdList); - sceNp->AddFunc(0xb9f93bbb, sceNpScoreCreateTitleCtx); - sceNp->AddFunc(0xba65de6d, sceNpCommerceGetChildCategoryInfo); - sceNp->AddFunc(0xbab91fc9, sceNpBasicGetPlayersHistoryEntry); + sceNp->AddFunc(0xe6c8f3f9, sceNpDrmProcessExitSpawn2); sceNp->AddFunc(0xbcc09fe7, sceNpBasicRegisterHandler); + sceNp->AddFunc(0x4026eac5, sceNpBasicRegisterContextSensitiveHandler); + sceNp->AddFunc(0xacb9ee8e, sceNpBasicUnregisterHandler); + sceNp->AddFunc(0x3f0808aa, sceNpBasicSetPresence); + sceNp->AddFunc(0xbe81c71c, sceNpBasicSetPresenceDetails); + sceNp->AddFunc(0x5e849303, sceNpBasicSetPresenceDetails2); + sceNp->AddFunc(0xec0a1fbf, sceNpBasicSendMessage); + sceNp->AddFunc(0x01fbbc9b, sceNpBasicSendMessageGui); + sceNp->AddFunc(0x43b989f5, sceNpBasicSendMessageAttachment); + sceNp->AddFunc(0xb5cb2d56, sceNpBasicRecvMessageAttachment); + sceNp->AddFunc(0x64a704cc, sceNpBasicRecvMessageAttachmentLoad); + sceNp->AddFunc(0x806960ab, sceNpBasicRecvMessageCustom); + sceNp->AddFunc(0xe1c9f675, sceNpBasicMarkMessageAsUsed); + sceNp->AddFunc(0x481ce0e8, sceNpBasicAbortGui); + sceNp->AddFunc(0x27c69eba, sceNpBasicAddFriend); + sceNp->AddFunc(0xafef640d, sceNpBasicGetFriendListEntryCount); + sceNp->AddFunc(0x04372385, sceNpBasicGetFriendListEntry); + sceNp->AddFunc(0x32c78a6a, sceNpBasicGetFriendPresenceByIndex); + sceNp->AddFunc(0x6453b27b, sceNpBasicGetFriendPresenceByIndex2); + sceNp->AddFunc(0xfd39ae13, sceNpBasicGetFriendPresenceByNpId); + sceNp->AddFunc(0x260caedd, sceNpBasicGetFriendPresenceByNpId2); + sceNp->AddFunc(0x168a3117, sceNpBasicAddPlayersHistory); sceNp->AddFunc(0xbcdbb2ab, sceNpBasicAddPlayersHistoryAsync); + sceNp->AddFunc(0xa15f35fe, sceNpBasicGetPlayersHistoryEntryCount); + sceNp->AddFunc(0xbab91fc9, sceNpBasicGetPlayersHistoryEntry); + sceNp->AddFunc(0x1ae8a549, sceNpBasicAddBlockListEntry); + sceNp->AddFunc(0x73931bd0, sceNpBasicGetBlockListEntryCount); + sceNp->AddFunc(0xf2b3338a, sceNpBasicGetBlockListEntry); + sceNp->AddFunc(0x9153bdf4, sceNpBasicGetMessageAttachmentEntryCount); + sceNp->AddFunc(0x5d543bbe, sceNpBasicGetMessageAttachmentEntry); + sceNp->AddFunc(0xa8afa7d4, sceNpBasicGetCustomInvitationEntryCount); + sceNp->AddFunc(0xd053f113, sceNpBasicGetCustomInvitationEntry); + sceNp->AddFunc(0xaf505def, sceNpBasicGetMatchingInvitationEntryCount); + sceNp->AddFunc(0x05af1cb8, sceNpBasicGetMatchingInvitationEntry); + sceNp->AddFunc(0xbf607ec6, sceNpBasicGetClanMessageEntryCount); + sceNp->AddFunc(0x4d9c615d, sceNpBasicGetClanMessageEntry); + sceNp->AddFunc(0xecd503de, sceNpBasicGetMessageEntryCount); + sceNp->AddFunc(0x30d1cbde, sceNpBasicGetMessageEntry); + sceNp->AddFunc(0xe035f7d6, sceNpBasicGetEvent); + sceNp->AddFunc(0xfcac355a, sceNpCommerceCreateCtx); + sceNp->AddFunc(0xe2877bea, sceNpCommerceDestroyCtx); + sceNp->AddFunc(0x8d1d096c, sceNpCommerceInitProductCategory); + sceNp->AddFunc(0x6cb81eb2, sceNpCommerceDestroyProductCategory); + sceNp->AddFunc(0x26f33146, sceNpCommerceGetProductCategoryStart); + sceNp->AddFunc(0xcfd469e4, sceNpCommerceGetProductCategoryFinish); + sceNp->AddFunc(0x3f195b3a, sceNpCommerceGetProductCategoryResult); + sceNp->AddFunc(0x674bb9ff, sceNpCommerceGetProductCategoryAbort); + sceNp->AddFunc(0x936df4aa, sceNpCommerceGetProductId); + sceNp->AddFunc(0xeb5f2544, sceNpCommerceGetProductName); + sceNp->AddFunc(0x359642a6, sceNpCommerceGetCategoryDescription); + sceNp->AddFunc(0xaee8cf71, sceNpCommerceGetCategoryId); + sceNp->AddFunc(0x9452f4f8, sceNpCommerceGetCategoryImageURL); + sceNp->AddFunc(0xeb9df054, sceNpCommerceGetCategoryInfo); + sceNp->AddFunc(0x6e2ab18b, sceNpCommerceGetCategoryName); + sceNp->AddFunc(0x79225aa3, sceNpCommerceGetCurrencyCode); + sceNp->AddFunc(0xaf57d9c9, sceNpCommerceGetCurrencyDecimals); + sceNp->AddFunc(0xb1c02d66, sceNpCommerceGetCurrencyInfo); + sceNp->AddFunc(0x2be41ece, sceNpCommerceGetNumOfChildCategory); + sceNp->AddFunc(0x7208dc08, sceNpCommerceGetNumOfChildProductSku); + sceNp->AddFunc(0xa85a4951, sceNpCommerceGetSkuDescription); + sceNp->AddFunc(0x39a69619, sceNpCommerceGetSkuId); + sceNp->AddFunc(0xccbe2e69, sceNpCommerceGetSkuImageURL); + sceNp->AddFunc(0xee530059, sceNpCommerceGetSkuName); + sceNp->AddFunc(0x78d7f9ad, sceNpCommerceGetSkuPrice); + sceNp->AddFunc(0x1a3fcb69, sceNpCommerceGetSkuUserData); + sceNp->AddFunc(0x99ac9952, sceNpCommerceSetDataFlagStart); + sceNp->AddFunc(0xdbdb909f, sceNpCommerceGetDataFlagStart); + sceNp->AddFunc(0x8d4518a0, sceNpCommerceSetDataFlagFinish); + sceNp->AddFunc(0x9281e87a, sceNpCommerceGetDataFlagFinish); + sceNp->AddFunc(0xd03cea35, sceNpCommerceGetDataFlagState); + sceNp->AddFunc(0x0561448b, sceNpCommerceGetDataFlagAbort); + sceNp->AddFunc(0xba65de6d, sceNpCommerceGetChildCategoryInfo); + sceNp->AddFunc(0x01cd9cfd, sceNpCommerceGetChildProductSkuInfo); + sceNp->AddFunc(0xe36c660e, sceNpCommerceDoCheckoutStartAsync); + sceNp->AddFunc(0xaf3eba5a, sceNpCommerceDoCheckoutFinishAsync); + sceNp->AddFunc(0x45f8f3aa, sceNpCustomMenuRegisterActions); + sceNp->AddFunc(0xf9732ac8, sceNpCustomMenuActionSetActivation); + sceNp->AddFunc(0x9458f464, sceNpCustomMenuRegisterExceptionList); + sceNp->AddFunc(0xf0a9182b, sceNpFriendlist); + sceNp->AddFunc(0xd7fb1fa6, sceNpFriendlistCustom); + sceNp->AddFunc(0xf59e1da8, sceNpFriendlistAbortGui); + sceNp->AddFunc(0x5f2d9257, sceNpLookupInit); + sceNp->AddFunc(0x8440537c, sceNpLookupTerm); + sceNp->AddFunc(0xce81c7f0, sceNpLookupCreateTitleCtx); + sceNp->AddFunc(0x5de61626, sceNpLookupDestroyTitleCtx); + sceNp->AddFunc(0xea2e9ffc, sceNpLookupCreateTransactionCtx); + sceNp->AddFunc(0xfb87cf5e, sceNpLookupDestroyTransactionCtx); + sceNp->AddFunc(0x71e5af7e, sceNpLookupSetTimeout); + sceNp->AddFunc(0x3d1760dc, sceNpLookupAbortTransaction); + sceNp->AddFunc(0xd737fd2d, sceNpLookupWaitAsync); + sceNp->AddFunc(0x7508112e, sceNpLookupPollAsync); + sceNp->AddFunc(0x166dcc11, sceNpLookupNpId); + sceNp->AddFunc(0xd12e40ae, sceNpLookupNpIdAsync); + sceNp->AddFunc(0xdfd63b62, sceNpLookupUserProfile); + sceNp->AddFunc(0xff0a2378, sceNpLookupUserProfileAsync); + sceNp->AddFunc(0x2fccbfe0, sceNpLookupUserProfileWithAvatarSize); + sceNp->AddFunc(0x1fdb3ec2, sceNpLookupUserProfileWithAvatarSizeAsync); + sceNp->AddFunc(0xb6017827, sceNpLookupAvatarImage); + sceNp->AddFunc(0xbf9eea93, sceNpLookupAvatarImageAsync); + sceNp->AddFunc(0x9ee9f97e, sceNpLookupTitleStorage); + sceNp->AddFunc(0x5e117ed5, sceNpLookupTitleStorageAsync); + sceNp->AddFunc(0xca39c4b2, sceNpLookupTitleSmallStorage); + sceNp->AddFunc(0x860b1756, sceNpLookupTitleSmallStorageAsync); + sceNp->AddFunc(0xe7dcd3b4, sceNpManagerRegisterCallback); + sceNp->AddFunc(0x52a6b523, sceNpManagerUnregisterCallback); + sceNp->AddFunc(0xa7bff757, sceNpManagerGetStatus); sceNp->AddFunc(0xbdc07fd5, sceNpManagerGetNetworkTime); sceNp->AddFunc(0xbe07c708, sceNpManagerGetOnlineId); - sceNp->AddFunc(0xbe81c71c, sceNpBasicSetPresenceDetails); - sceNp->AddFunc(0xbef887e5, sceNpScoreGetClanMemberGameDataAsync); - sceNp->AddFunc(0xbf607ec6, sceNpBasicGetClanMessageEntryCount); - sceNp->AddFunc(0xbf9eea93, sceNpLookupAvatarImageAsync); + sceNp->AddFunc(0xfe37a7f4, sceNpManagerGetNpId); + sceNp->AddFunc(0xf42c0df8, sceNpManagerGetOnlineName); + sceNp->AddFunc(0x36d0c2c5, sceNpManagerGetAvatarUrl); + sceNp->AddFunc(0x32200389, sceNpManagerGetMyLanguages); + sceNp->AddFunc(0xb1e0718b, sceNpManagerGetAccountRegion); + sceNp->AddFunc(0x168fcece, sceNpManagerGetAccountAge); + sceNp->AddFunc(0x6ee62ed2, sceNpManagerGetContentRatingFlag); + sceNp->AddFunc(0xeb7a3d84, sceNpManagerGetChatRestrictionFlag); + sceNp->AddFunc(0x4b9efb7a, sceNpManagerGetCachedInfo); + sceNp->AddFunc(0x16f88a6f, sceNpManagerGetPsHandle); + sceNp->AddFunc(0x7e2fef28, sceNpManagerRequestTicket); + sceNp->AddFunc(0x8297f1ec, sceNpManagerRequestTicket2); + sceNp->AddFunc(0x0968aa36, sceNpManagerGetTicket); + sceNp->AddFunc(0x58fa4fcd, sceNpManagerGetTicketParam); + sceNp->AddFunc(0xb66d1c46, sceNpManagerGetEntitlementIdList); + sceNp->AddFunc(0xa1709abd, sceNpManagerGetEntitlementById); + sceNp->AddFunc(0x442381f7, sceNpManagerSubSignin); + sceNp->AddFunc(0x60440c73, sceNpManagerSubSigninAbortGui); + sceNp->AddFunc(0x000e53cc, sceNpManagerSubSignout); + sceNp->AddFunc(0xac66568c, sceNpMatchingCreateCtx); + sceNp->AddFunc(0x2e1c5068, sceNpMatchingDestroyCtx); + sceNp->AddFunc(0x03c741a7, sceNpMatchingGetResult); + sceNp->AddFunc(0x26b3bc94, sceNpMatchingGetResultGUI); + sceNp->AddFunc(0x6f8fd267, sceNpMatchingSetRoomInfo); + sceNp->AddFunc(0x4a18a89e, sceNpMatchingSetRoomInfoNoLimit); + sceNp->AddFunc(0x691f429d, sceNpMatchingGetRoomInfo); + sceNp->AddFunc(0xb020684e, sceNpMatchingGetRoomInfoNoLimit); + sceNp->AddFunc(0xa284bd1d, sceNpMatchingSetRoomSearchFlag); + sceNp->AddFunc(0xee64cf8e, sceNpMatchingGetRoomSearchFlag); + sceNp->AddFunc(0x73a2e36b, sceNpMatchingGetRoomMemberListLocal); + sceNp->AddFunc(0xe24eea19, sceNpMatchingGetRoomListLimitGUI); + sceNp->AddFunc(0x34cc0ca4, sceNpMatchingKickRoomMember); + sceNp->AddFunc(0xd20d7798, sceNpMatchingKickRoomMemberWithOpt); + sceNp->AddFunc(0x14497465, sceNpMatchingQuickMatchGUI); + sceNp->AddFunc(0x8b7bbd73, sceNpMatchingSendInvitationGUI); + sceNp->AddFunc(0x2ad7837d, sceNpMatchingAcceptInvitationGUI); + sceNp->AddFunc(0x3cc8588a, sceNpMatchingCreateRoomGUI); + sceNp->AddFunc(0x474b7b13, sceNpMatchingJoinRoomGUI); + sceNp->AddFunc(0xf806c54c, sceNpMatchingLeaveRoom); + sceNp->AddFunc(0x32febb4c, sceNpMatchingSearchJoinRoomGUI); + sceNp->AddFunc(0xdae2d351, sceNpMatchingGrantOwnership); + sceNp->AddFunc(0xceeebc7a, sceNpProfileCallGui); + sceNp->AddFunc(0x2f2c6b3e, sceNpProfileAbortGui); + sceNp->AddFunc(0x32cf311f, sceNpScoreInit); + sceNp->AddFunc(0x9851f805, sceNpScoreTerm); + sceNp->AddFunc(0xb9f93bbb, sceNpScoreCreateTitleCtx); + sceNp->AddFunc(0x259113b8, sceNpScoreDestroyTitleCtx); + sceNp->AddFunc(0x6f5e8143, sceNpScoreCreateTransactionCtx); + sceNp->AddFunc(0xc5f4cf82, sceNpScoreDestroyTransactionCtx); + sceNp->AddFunc(0x29dd45dc, sceNpScoreSetTimeout); + sceNp->AddFunc(0x2706eaa1, sceNpScoreSetPlayerCharacterId); + sceNp->AddFunc(0x1a2704f7, sceNpScoreWaitAsync); + sceNp->AddFunc(0xa7a090e5, sceNpScorePollAsync); + sceNp->AddFunc(0xf4e0f607, sceNpScoreGetBoardInfo); + sceNp->AddFunc(0xddce7d15, sceNpScoreGetBoardInfoAsync); + sceNp->AddFunc(0x1672170e, sceNpScoreRecordScore); + sceNp->AddFunc(0xf0b1e399, sceNpScoreRecordScoreAsync); + sceNp->AddFunc(0x04ca5e6a, sceNpScoreRecordGameData); + sceNp->AddFunc(0xf76847c2, sceNpScoreRecordGameDataAsync); + sceNp->AddFunc(0x3b02418d, sceNpScoreGetGameData); + sceNp->AddFunc(0xdb2e4dc2, sceNpScoreGetGameDataAsync); + sceNp->AddFunc(0x05d65dff, sceNpScoreGetRankingByNpId); + sceNp->AddFunc(0x3db7914d, sceNpScoreGetRankingByNpIdAsync); + sceNp->AddFunc(0xfbc82301, sceNpScoreGetRankingByRange); + sceNp->AddFunc(0x21206642, sceNpScoreGetRankingByRangeAsync); + sceNp->AddFunc(0x7deb244c, sceNpScoreCensorComment); + sceNp->AddFunc(0x7be47e61, sceNpScoreCensorCommentAsync); + sceNp->AddFunc(0xf1b77918, sceNpScoreSanitizeComment); + sceNp->AddFunc(0x2cd2a1af, sceNpScoreSanitizeCommentAsync); sceNp->AddFunc(0xc3a991ee, sceNpScoreGetRankingByNpIdPcId); sceNp->AddFunc(0xc4b6cd8f, sceNpScoreGetRankingByNpIdPcIdAsync); - sceNp->AddFunc(0xc5f4cf82, sceNpScoreDestroyTransactionCtx); - sceNp->AddFunc(0xca0a2d04, sceNpSignalingGetConnectionStatus); - sceNp->AddFunc(0xca39c4b2, sceNpLookupTitleSmallStorage); - sceNp->AddFunc(0xccbe2e69, sceNpCommerceGetSkuImageURL); - sceNp->AddFunc(0xce81c7f0, sceNpLookupCreateTitleCtx); - sceNp->AddFunc(0xceeebc7a, sceNpProfileCallGui); - sceNp->AddFunc(0xcfd469e4, sceNpCommerceGetProductCategoryFinish); - sceNp->AddFunc(0xd03cea35, sceNpCommerceGetDataFlagState); - sceNp->AddFunc(0xd053f113, sceNpBasicGetCustomInvitationEntry); - sceNp->AddFunc(0xd0958814, sceNpSignalingGetPeerNetInfoResult); - sceNp->AddFunc(0xd12e40ae, sceNpLookupNpIdAsync); - sceNp->AddFunc(0xd208f91d, sceNpUtilCmpNpId); - sceNp->AddFunc(0xd20d7798, sceNpMatchingKickRoomMemberWithOpt); - sceNp->AddFunc(0xd737fd2d, sceNpLookupWaitAsync); - sceNp->AddFunc(0xd7fb1fa6, sceNpFriendlistCustom); - sceNp->AddFunc(0xdae2d351, sceNpMatchingGrantOwnership); - sceNp->AddFunc(0xdb2e4dc2, sceNpScoreGetGameDataAsync); - sceNp->AddFunc(0xdbdb909f, sceNpCommerceGetDataFlagStart); - sceNp->AddFunc(0xddce7d15, sceNpScoreGetBoardInfoAsync); - sceNp->AddFunc(0xded17c26, sceNpScoreGetClansMembersRankingByNpId); - sceNp->AddFunc(0xdfd63b62, sceNpLookupUserProfile); - sceNp->AddFunc(0xe035f7d6, sceNpBasicGetEvent); - sceNp->AddFunc(0xe1c9f675, sceNpBasicMarkMessageAsUsed); - sceNp->AddFunc(0xe24eea19, sceNpMatchingGetRoomListLimitGUI); - sceNp->AddFunc(0xe2877bea, sceNpCommerceDestroyCtx); - sceNp->AddFunc(0xe36c660e, sceNpCommerceDoCheckoutStartAsync); - sceNp->AddFunc(0xe6c8f3f9, sceNpDrmProcessExitSpawn2); - sceNp->AddFunc(0xe7dcd3b4, sceNpManagerRegisterCallback); - sceNp->AddFunc(0xe853d388, sceNpSignalingGetConnectionFromNpId); - sceNp->AddFunc(0xe8a67160, sceNpScoreGetClansMembersRankingByNpIdAsync); - sceNp->AddFunc(0xea2e9ffc, sceNpLookupCreateTransactionCtx); - sceNp->AddFunc(0xeb5f2544, sceNpCommerceGetProductName); - sceNp->AddFunc(0xeb7a3d84, sceNpManagerGetChatRestrictionFlag); - sceNp->AddFunc(0xeb9df054, sceNpCommerceGetCategoryInfo); - sceNp->AddFunc(0xec0a1fbf, sceNpBasicSendMessage); - sceNp->AddFunc(0xecd503de, sceNpBasicGetMessageEntryCount); - sceNp->AddFunc(0xee0cc40c, _sceNpSysutilClientMalloc); - sceNp->AddFunc(0xee530059, sceNpCommerceGetSkuName); sceNp->AddFunc(0xee5b20d9, sceNpScoreAbortTransaction); - sceNp->AddFunc(0xee64cf8e, sceNpMatchingGetRoomSearchFlag); - sceNp->AddFunc(0xf0a9182b, sceNpFriendlist); - sceNp->AddFunc(0xf0b1e399, sceNpScoreRecordScoreAsync); - sceNp->AddFunc(0xf1b77918, sceNpScoreSanitizeComment); - sceNp->AddFunc(0xf2b3338a, sceNpBasicGetBlockListEntry); - sceNp->AddFunc(0xf42c0df8, sceNpManagerGetOnlineName); - sceNp->AddFunc(0xf4e0f607, sceNpScoreGetBoardInfo); - sceNp->AddFunc(0xf59e1da8, sceNpFriendlistAbortGui); - sceNp->AddFunc(0xf5ff5f31, sceNpUtilCmpNpIdInOrder); - sceNp->AddFunc(0xf76847c2, sceNpScoreRecordGameDataAsync); - sceNp->AddFunc(0xf806c54c, sceNpMatchingLeaveRoom); - sceNp->AddFunc(0xf9732ac8, sceNpCustomMenuActionSetActivation); - sceNp->AddFunc(0xfb87cf5e, sceNpLookupDestroyTransactionCtx); - sceNp->AddFunc(0xfbc82301, sceNpScoreGetRankingByRange); - sceNp->AddFunc(0xfcac355a, sceNpCommerceCreateCtx); + sceNp->AddFunc(0xded17c26, sceNpScoreGetClansMembersRankingByNpId); + sceNp->AddFunc(0xe8a67160, sceNpScoreGetClansMembersRankingByNpIdAsync); + sceNp->AddFunc(0x41ffd4f2, sceNpScoreGetClansMembersRankingByNpIdPcId); + sceNp->AddFunc(0x433fcb30, sceNpScoreGetClansMembersRankingByNpIdPcIdAsync); + sceNp->AddFunc(0x6d4adc3b, sceNpScoreGetClansMembersRankingByRange); + sceNp->AddFunc(0x4d5e0670, sceNpScoreGetClansMembersRankingByRangeAsync); + sceNp->AddFunc(0x741fbf24, sceNpScoreGetClanMemberGameData); + sceNp->AddFunc(0xbef887e5, sceNpScoreGetClanMemberGameDataAsync); + sceNp->AddFunc(0x2a76895a, sceNpScoreGetClansRankingByClanId); + sceNp->AddFunc(0x227f8763, sceNpScoreGetClansRankingByClanIdAsync); + sceNp->AddFunc(0xb082003b, sceNpScoreGetClansRankingByRange); + sceNp->AddFunc(0x7b7e9137, sceNpScoreGetClansRankingByRangeAsync); + sceNp->AddFunc(0x6356082e, sceNpSignalingCreateCtx); + sceNp->AddFunc(0xa8cf8451, sceNpSignalingDestroyCtx); + sceNp->AddFunc(0x50b86d94, sceNpSignalingAddExtendedHandler); + sceNp->AddFunc(0x276c72b2, sceNpSignalingSetCtxOpt); + sceNp->AddFunc(0x2687a127, sceNpSignalingGetCtxOpt); + sceNp->AddFunc(0x60897c38, sceNpSignalingActivateConnection); sceNp->AddFunc(0xfd0eb5ae, sceNpSignalingDeactivateConnection); - sceNp->AddFunc(0xfd39ae13, sceNpBasicGetFriendPresenceByNpId); - sceNp->AddFunc(0xfe37a7f4, sceNpManagerGetNpId); - sceNp->AddFunc(0xff0a2378, sceNpLookupUserProfileAsync); - sceNp->AddFunc(0x432b3cbf, sceNpUtilBandwidthTestShutdown); - sceNp->AddFunc(0xc2ced2b7, sceNpUtilBandwidthTestInitStart); + sceNp->AddFunc(0x95c7bba3, sceNpSignalingTerminateConnection); + sceNp->AddFunc(0xca0a2d04, sceNpSignalingGetConnectionStatus); + sceNp->AddFunc(0x155de760, sceNpSignalingGetConnectionInfo); + sceNp->AddFunc(0xe853d388, sceNpSignalingGetConnectionFromNpId); + sceNp->AddFunc(0x34ce82a0, sceNpSignalingGetConnectionFromPeerAddress); + sceNp->AddFunc(0x9ad7fbd1, sceNpSignalingGetLocalNetInfo); + sceNp->AddFunc(0x75eb50cb, sceNpSignalingGetPeerNetInfo); + sceNp->AddFunc(0x64dbb89d, sceNpSignalingCancelPeerNetInfo); + sceNp->AddFunc(0xd0958814, sceNpSignalingGetPeerNetInfoResult); + sceNp->AddFunc(0xd208f91d, sceNpUtilCmpNpId); + sceNp->AddFunc(0xf5ff5f31, sceNpUtilCmpNpIdInOrder); sceNp->AddFunc(0xc880f37d, sceNpUtilBandwidthTestGetStatus); sceNp->AddFunc(0xc99ee313, sceNpUtilBandwidthTestAbort); - sceNp->AddFunc(0xa8cf8451, sceNpSignalingDestroyCtx); + sceNp->AddFunc(0xee0cc40c, _sceNpSysutilClientMalloc); + sceNp->AddFunc(0x816c6a5f, _sceNpSysutilClientFree); } diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.h b/rpcs3/Emu/SysCalls/Modules/sceNp.h index 87a4540132..ddce57f3dd 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.h +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.h @@ -28,6 +28,40 @@ enum SCE_NP_ERROR_ALREADY_USED = 0x8002aa15, SCE_NP_ERROR_DIFFERENT_USER = 0x8002aa16, SCE_NP_ERROR_ALREADY_DONE = 0x8002aa17, + // NP Basic Utility + SCE_NP_BASIC_ERROR_ALREADY_INITIALIZED = 0x8002a661, + SCE_NP_BASIC_ERROR_NOT_INITIALIZED = 0x8002a662, + SCE_NP_BASIC_ERROR_NOT_SUPPORTED = 0x8002a663, + SCE_NP_BASIC_ERROR_OUT_OF_MEMORY = 0x8002a664, + SCE_NP_BASIC_ERROR_INVALID_ARGUMENT = 0x8002a665, + SCE_NP_BASIC_ERROR_BAD_ID = 0x8002a666, + SCE_NP_BASIC_ERROR_IDS_DIFFER = 0x8002a667, + SCE_NP_BASIC_ERROR_PARSER_FAILED = 0x8002a668, + SCE_NP_BASIC_ERROR_TIMEOUT = 0x8002a669, + SCE_NP_BASIC_ERROR_NO_EVENT = 0x8002a66a, + SCE_NP_BASIC_ERROR_EXCEEDS_MAX = 0x8002a66b, + SCE_NP_BASIC_ERROR_INSUFFICIENT = 0x8002a66c, + SCE_NP_BASIC_ERROR_NOT_REGISTERED = 0x8002a66d, + SCE_NP_BASIC_ERROR_DATA_LOST = 0x8002a66e, + SCE_NP_BASIC_ERROR_BUSY = 0x8002a66f, + SCE_NP_BASIC_ERROR_STATUS = 0x8002a670, + SCE_NP_BASIC_ERROR_CANCEL = 0x8002a671, + SCE_NP_BASIC_ERROR_INVALID_MEMORY_CONTAINER = 0x8002a672, + SCE_NP_BASIC_ERROR_INVALID_DATA_ID = 0x8002a673, + SCE_NP_BASIC_ERROR_BROKEN_DATA = 0x8002a674, + SCE_NP_BASIC_ERROR_BLOCKLIST_ADD_FAILED = 0x8002a675, + SCE_NP_BASIC_ERROR_BLOCKLIST_IS_FULL = 0x8002a676, + SCE_NP_BASIC_ERROR_SEND_FAILED = 0x8002a677, + SCE_NP_BASIC_ERROR_NOT_CONNECTED = 0x8002a678, + SCE_NP_BASIC_ERROR_INSUFFICIENT_DISK_SPACE = 0x8002a679, + SCE_NP_BASIC_ERROR_INTERNAL_FAILURE = 0x8002a67a, + SCE_NP_BASIC_ERROR_DOES_NOT_EXIST = 0x8002a67b, + SCE_NP_BASIC_ERROR_INVALID = 0x8002a67c, + SCE_NP_BASIC_ERROR_UNKNOWN = 0x8002a6bf, + SCE_NP_EXT_ERROR_CONTEXT_DOES_NOT_EXIST = 0x8002a6a1, + SCE_NP_EXT_ERROR_CONTEXT_ALREADY_EXISTS = 0x8002a6a2, + SCE_NP_EXT_ERROR_NO_CONTEXT = 0x8002a6a3, + SCE_NP_EXT_ERROR_NO_ORIGIN = 0x8002a6a4, // NP Community Utility SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED = 0x8002a101, SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED = 0x8002a102, @@ -62,6 +96,8 @@ enum SCE_NP_COMMUNITY_ERROR_TOO_MANY_SLOTID = 0x8002a1b1, }; +typedef int(*SceNpBasicEventHandler)(s32 event, s32 retCode, u32 reqId, vm::ptr arg); + // NP Manager Utility statuses enum { @@ -72,6 +108,38 @@ enum SCE_NP_MANAGER_STATUS_ONLINE = 3, }; +// Event types +enum +{ + SCE_NP_BASIC_EVENT_UNKNOWN = -1, + SCE_NP_BASIC_EVENT_OFFLINE = 0, + SCE_NP_BASIC_EVENT_PRESENCE = 1, + SCE_NP_BASIC_EVENT_MESSAGE = 2, + SCE_NP_BASIC_EVENT_ADD_FRIEND_RESULT = 3, + SCE_NP_BASIC_EVENT_INCOMING_ATTACHMENT = 4, + SCE_NP_BASIC_EVENT_INCOMING_INVITATION = 5, + SCE_NP_BASIC_EVENT_END_OF_INITIAL_PRESENCE = 6, + SCE_NP_BASIC_EVENT_SEND_ATTACHMENT_RESULT = 7, + SCE_NP_BASIC_EVENT_RECV_ATTACHMENT_RESULT = 8, + SCE_NP_BASIC_EVENT_OUT_OF_CONTEXT = 9, + SCE_NP_BASIC_EVENT_FRIEND_REMOVED = 10, + SCE_NP_BASIC_EVENT_ADD_BLOCKLIST_RESULT = 11, + SCE_NP_BASIC_EVENT_SEND_MESSAGE_RESULT = 12, + SCE_NP_BASIC_EVENT_SEND_INVITATION_RESULT = 13, + SCE_NP_BASIC_EVENT_RECV_INVITATION_RESULT = 14, + SCE_NP_BASIC_EVENT_MESSAGE_MARKED_AS_USED_RESULT = 15, + SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_INVITATION = 16, + SCE_NP_BASIC_EVENT_INCOMING_CLAN_MESSAGE = 17, + SCE_NP_BASIC_EVENT_ADD_PLAYERS_HISTORY_RESULT = 18, + SCE_NP_BASIC_EVENT_SEND_CUSTOM_DATA_RESULT = 19, + SCE_NP_BASIC_EVENT_RECV_CUSTOM_DATA_RESULT = 20, + SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_DATA_MESSAGE = 21, + SCE_NP_BASIC_EVENT_SEND_URL_ATTACHMENT_RESULT = 22, + SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_INVITATION = 23, + SCE_NP_BASIC_EVENT_BLOCKLIST_UPDATE = 24, + SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_CUSTOM_DATA_MESSAGE = 25, +}; + // IDs for attachment data objects enum { diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp index d2ea06cc48..392de7166f 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp @@ -6,6 +6,18 @@ Module *sceNpCommerce2 = nullptr; +struct sceNpCommerce2Internal +{ + bool m_bSceNpCommerce2Initialized; + + sceNpCommerce2Internal() + : m_bSceNpCommerce2Initialized(false) + { + } +}; + +sceNpCommerce2Internal sceNpCommerce2Instance; + int sceNpCommerce2ExecuteStoreBrowse() { UNIMPLEMENTED_FUNC(sceNpCommerce2); @@ -20,13 +32,25 @@ int sceNpCommerce2GetStoreBrowseUserdata() int sceNpCommerce2Init() { - UNIMPLEMENTED_FUNC(sceNpCommerce2); + sceNpCommerce2->Warning("sceNpCommerce2Init()"); + + if (sceNpCommerce2Instance.m_bSceNpCommerce2Initialized) + return SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED; + + sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = true; + return CELL_OK; } int sceNpCommerce2Term() { - UNIMPLEMENTED_FUNC(sceNpCommerce2); + sceNpCommerce2->Warning("sceNpCommerce2Term()"); + + if (!sceNpCommerce2Instance.m_bSceNpCommerce2Initialized) + return SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED; + + sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = false; + return CELL_OK; } @@ -290,7 +314,7 @@ int sceNpCommerce2DestroyReq() void sceNpCommerce2_unload() { - // TODO: Unload SNS module + sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = false; } void sceNpCommerce2_init(Module *pxThis) diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index 9577708714..612ddb9e2f 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -67,19 +67,20 @@ struct sceNpTrophyInternal } }; -sceNpTrophyInternal s_npTrophyInstance; +sceNpTrophyInternal sceNpTrophyInstance; // Functions int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options) { sceNpTrophy->Log("sceNpTrophyInit(pool_addr=0x%x, poolSize=%d, containerId=%d, options=0x%llx)", pool_addr, poolSize, containerId, options); - if (s_npTrophyInstance.m_bInitialized) + if (sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED; if (options) return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; - s_npTrophyInstance.m_bInitialized = true; + sceNpTrophyInstance.m_bInitialized = true; + return CELL_OK; } @@ -88,7 +89,7 @@ int sceNpTrophyCreateContext(vm::ptr> context, vm::ptrWarning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)", context.addr(), commID.addr(), commSign.addr(), options); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; if (options & (~(u64)1)) return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; @@ -108,8 +109,8 @@ int sceNpTrophyCreateContext(vm::ptr> context, vm::ptrIsOpened()) { - s_npTrophyInstance.contexts.emplace_back(); - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts.back(); + sceNpTrophyInstance.contexts.emplace_back(); + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts.back(); ctxt.trp_stream.reset(stream); ctxt.trp_name = entry->name; stream = nullptr; @@ -125,7 +126,7 @@ int sceNpTrophyCreateHandle(vm::ptr> handle) { sceNpTrophy->Warning("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.addr()); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; // TODO: There are other possible errors @@ -139,15 +140,15 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, vm::ptrWarning("sceNpTrophyRegisterContext(context=%d, handle=%d, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)", context, handle, statusCb.addr(), arg_addr, options); - if (!(s_npTrophyInstance.m_bInitialized)) + if (!(sceNpTrophyInstance.m_bInitialized)) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; if (options & (~(u64)1)) return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; - if (context >= s_npTrophyInstance.contexts.size()) + if (context >= sceNpTrophyInstance.contexts.size()) return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; // TODO: There are other possible errors - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts[context]; if (!ctxt.trp_stream) return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; @@ -216,13 +217,13 @@ int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr> sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)", context, handle, reqspace.addr(), options); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - if (context >= s_npTrophyInstance.contexts.size()) + if (context >= sceNpTrophyInstance.contexts.size()) return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; // TODO: There are other possible errors - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts[context]; if (!ctxt.trp_stream) return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; @@ -236,9 +237,15 @@ int sceNpTrophyDestroyContext() return CELL_OK; } -int sceNpTrophyAbortHandle() +int sceNpTrophyAbortHandle(u32 handle) { - UNIMPLEMENTED_FUNC(sceNpTrophy); + sceNpTrophy->Todo("sceNpTrophyAbortHandle(handle=%d)", handle); + + // TODO: ? + + if (!sceNpTrophyInstance.m_bInitialized) + return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; + return CELL_OK; } @@ -247,13 +254,13 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptrWarning("sceNpTrophyGetGameInfo(context=%d, handle=%d, details_addr=0x%x, data_addr=0x%x)", context, handle, details.addr(), data.addr()); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; // TODO: There are other possible errors std::string path; rXmlDocument doc; - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts[context]; Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user doc.Load(path); @@ -305,11 +312,11 @@ int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptrWarning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)", context, handle, trophyId, platinumId.addr()); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; // TODO: There are other possible errors - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts[context]; if (trophyId >= (s32)ctxt.tropusr->GetTrophiesCount()) return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID; if (ctxt.tropusr->GetTrophyUnlockState(trophyId)) @@ -327,7 +334,13 @@ int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptrWarning("sceNpTrophyTerm()"); + + if (!sceNpTrophyInstance.m_bInitialized) + return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; + + sceNpTrophyInstance.m_bInitialized = false; + return CELL_OK; } @@ -336,11 +349,11 @@ int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptrWarning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)", context, handle, flags.addr(), count.addr()); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; // TODO: There are other possible errors - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts[context]; *count = ctxt.tropusr->GetTrophiesCount(); if (*count > 128) sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!"); @@ -368,13 +381,13 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptrWarning("sceNpTrophyGetTrophyInfo(context=%u, handle=%u, trophyId=%d, details_addr=0x%x, data_addr=0x%x)", context, handle, trophyId, details.addr(), data.addr()); - if (!s_npTrophyInstance.m_bInitialized) + if (!sceNpTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; // TODO: There are other possible errors std::string path; rXmlDocument doc; - sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts[context]; Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user doc.Load(path); @@ -420,7 +433,7 @@ int sceNpTrophyGetGameIcon() void sceNpTrophy_unload() { - s_npTrophyInstance.m_bInitialized = false; + sceNpTrophyInstance.m_bInitialized = false; } void sceNpTrophy_init(Module *pxThis) diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index b32ad1286e..4a47ce1891 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -82,7 +82,7 @@ s64 sys_prx_exitspawn_with_level() int sys_spu_elf_get_information(u32 elf_img, vm::ptr> entry, vm::ptr> nseg) { - sysPrxForUser->Todo("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x", elf_img, entry.addr(), nseg.addr()); + sysPrxForUser->Todo("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x)", elf_img, entry.addr(), nseg.addr()); return CELL_OK; } @@ -137,14 +137,17 @@ int sys_raw_spu_image_load(int id, vm::ptr img) return CELL_OK; } -int sys_get_random_number(u32 addr, u64 size) +int sys_get_random_number(vm::ptr addr, u64 size) { - sysPrxForUser->Warning("sys_get_random_number(addr=0x%x, size=%d)", addr, size); + sysPrxForUser->Warning("sys_get_random_number(addr=0x%x, size=%d)", addr.addr(), size); if (size > 4096) size = 4096; - vm::write32(addr, rand() % size); + for (u64 i = 0; i < size - 1; i++) + { + addr[i] = rand() % 256; + } return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 377ab0970e..f055985e88 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -31,7 +31,7 @@ namespace detail{ template<> bool CheckId(u32 id, ID*& _id,const std::string &name) { - return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == name; + return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->GetName() == name; } } diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index bfeeed3434..f01e33ed14 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -12,7 +12,7 @@ namespace detail{ { ID* id_data; if(!CheckId(id, id_data,name)) return false; - data = id_data->m_data->get(); + data = id_data->GetData()->get(); return true; } @@ -40,7 +40,7 @@ public: bool CheckId(u32 id) const { - return GetIdManager().CheckID(id) && GetIdManager().GetID(id).m_name == GetName(); + return GetIdManager().CheckID(id) && GetIdManager().GetID(id).GetName() == GetName(); } template diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 902b079d0c..a11a094c35 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -406,6 +406,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(p_graphics, wxID_ANY, "Write Depth Buffer"); wxCheckBox* chbox_gs_dump_color = new wxCheckBox(p_graphics, wxID_ANY, "Write Color Buffers"); wxCheckBox* chbox_gs_vsync = new wxCheckBox(p_graphics, wxID_ANY, "VSync"); + wxCheckBox* chbox_gs_3dmonitor = new wxCheckBox(p_graphics, wxID_ANY, "3D Monitor"); wxCheckBox* chbox_audio_dump = new wxCheckBox(p_audio, wxID_ANY, "Dump to file"); wxCheckBox* chbox_audio_conv = new wxCheckBox(p_audio, wxID_ANY, "Convert to 16 bit"); wxCheckBox* chbox_hle_logging = new wxCheckBox(p_hle, wxID_ANY, "Log all SysCalls"); @@ -424,7 +425,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_spu_decoder->Append("SPU Interpreter"); cbox_spu_decoder->Append("SPU JIT (asmjit)"); - for(int i=1; iAppend("Null"); + cbox_gs_render->Append("OpenGL"); + //cbox_gs_render->Append("Software"); + + for(int i = 1; i < WXSIZEOF(ResolutionTable); ++i) { cbox_gs_resolution->Append(wxString::Format("%dx%d", ResolutionTable[i].width.ToLE(), ResolutionTable[i].height.ToLE())); } @@ -432,10 +437,6 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_gs_aspect->Append("4:3"); cbox_gs_aspect->Append("16:9"); - cbox_gs_render->Append("Null"); - cbox_gs_render->Append("OpenGL"); - //cbox_gs_render->Append("Software"); - cbox_pad_handler->Append("Null"); cbox_pad_handler->Append("Windows"); #if defined (_WIN32) @@ -491,6 +492,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) chbox_gs_dump_depth ->SetValue(Ini.GSDumpDepthBuffer.GetValue()); chbox_gs_dump_color ->SetValue(Ini.GSDumpColorBuffers.GetValue()); chbox_gs_vsync ->SetValue(Ini.GSVSyncEnable.GetValue()); + chbox_gs_3dmonitor ->SetValue(Ini.GS3DTV.GetValue()); chbox_audio_dump ->SetValue(Ini.AudioDumpToFile.GetValue()); chbox_audio_conv ->SetValue(Ini.AudioConvertToU16.GetValue()); chbox_hle_logging ->SetValue(Ini.HLELogging.GetValue()); @@ -555,6 +557,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_subpanel_graphics->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_graphics->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_graphics->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5).Expand()); + s_subpanel_graphics->Add(chbox_gs_3dmonitor, wxSizerFlags().Border(wxALL, 5).Expand()); // Input - Output s_subpanel_io->Add(s_round_io_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -609,10 +612,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) Ini.GSRenderMode.SetValue(cbox_gs_render->GetSelection()); Ini.GSResolution.SetValue(ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1)); Ini.GSAspectRatio.SetValue(cbox_gs_aspect->GetSelection() + 1); - Ini.GSVSyncEnable.SetValue(chbox_gs_vsync->GetValue()); Ini.GSLogPrograms.SetValue(chbox_gs_log_prog->GetValue()); Ini.GSDumpDepthBuffer.SetValue(chbox_gs_dump_depth->GetValue()); Ini.GSDumpColorBuffers.SetValue(chbox_gs_dump_color->GetValue()); + Ini.GSVSyncEnable.SetValue(chbox_gs_vsync->GetValue()); + Ini.GS3DTV.SetValue(chbox_gs_3dmonitor->GetValue()); Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection()); Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection()); Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection()); diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index 28f755e20e..227156a449 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -492,23 +492,24 @@ void RSXDebugger::GetFlags() #define LIST_FLAGS_ADD(name, value) \ m_list_flags->InsertItem(i, name); m_list_flags->SetItem(i, 1, value ? "Enabled" : "Disabled"); i++; - LIST_FLAGS_ADD("Alpha test", render.m_set_alpha_test); - LIST_FLAGS_ADD("Blend", render.m_set_blend); - LIST_FLAGS_ADD("Scissor", render.m_set_scissor_horizontal && render.m_set_scissor_vertical); - LIST_FLAGS_ADD("Cull face", render.m_set_cull_face); - LIST_FLAGS_ADD("Depth bounds test", render.m_set_depth_bounds_test); - LIST_FLAGS_ADD("Depth test", render.m_set_depth_test); - LIST_FLAGS_ADD("Dither", render.m_set_dither); - LIST_FLAGS_ADD("Line smooth", render.m_set_line_smooth); - LIST_FLAGS_ADD("Logic op", render.m_set_logic_op); - LIST_FLAGS_ADD("Poly smooth", render.m_set_poly_smooth); - LIST_FLAGS_ADD("Poly offset fill", render.m_set_poly_offset_fill); - LIST_FLAGS_ADD("Poly offset line", render.m_set_poly_offset_line); - LIST_FLAGS_ADD("Poly offset point", render.m_set_poly_offset_point); - LIST_FLAGS_ADD("Stencil test", render.m_set_stencil_test); - LIST_FLAGS_ADD("Primitive restart", render.m_set_restart_index); - LIST_FLAGS_ADD("Point Sprite", render.m_set_point_sprite_control); - LIST_FLAGS_ADD("Lighting ", render.m_set_specular); + LIST_FLAGS_ADD("Alpha test", render.m_set_alpha_test); + LIST_FLAGS_ADD("Blend", render.m_set_blend); + LIST_FLAGS_ADD("Scissor", render.m_set_scissor_horizontal && render.m_set_scissor_vertical); + LIST_FLAGS_ADD("Cull face", render.m_set_cull_face); + LIST_FLAGS_ADD("Depth bounds test", render.m_set_depth_bounds_test); + LIST_FLAGS_ADD("Depth test", render.m_set_depth_test); + LIST_FLAGS_ADD("Dither", render.m_set_dither); + LIST_FLAGS_ADD("Line smooth", render.m_set_line_smooth); + LIST_FLAGS_ADD("Logic op", render.m_set_logic_op); + LIST_FLAGS_ADD("Poly smooth", render.m_set_poly_smooth); + LIST_FLAGS_ADD("Poly offset fill", render.m_set_poly_offset_fill); + LIST_FLAGS_ADD("Poly offset line", render.m_set_poly_offset_line); + LIST_FLAGS_ADD("Poly offset point", render.m_set_poly_offset_point); + LIST_FLAGS_ADD("Stencil test", render.m_set_stencil_test); + LIST_FLAGS_ADD("Primitive restart", render.m_set_restart_index); + LIST_FLAGS_ADD("Two sided lighting", render.m_set_two_side_light_enable); + LIST_FLAGS_ADD("Point Sprite", render.m_set_point_sprite_control); + LIST_FLAGS_ADD("Lighting ", render.m_set_specular); #undef LIST_FLAGS_ADD } diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index 96a217a286..8315648075 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -104,10 +104,11 @@ public: IniEntry GSRenderMode; IniEntry GSResolution; IniEntry GSAspectRatio; - IniEntry GSVSyncEnable; IniEntry GSLogPrograms; IniEntry GSDumpColorBuffers; IniEntry GSDumpDepthBuffer; + IniEntry GSVSyncEnable; + IniEntry GS3DTV; // Audio IniEntry AudioOutMode; @@ -177,10 +178,11 @@ public: GSRenderMode.Init("GS_RenderMode", path); GSResolution.Init("GS_Resolution", path); GSAspectRatio.Init("GS_AspectRatio", path); - GSVSyncEnable.Init("GS_VSyncEnable", path); GSLogPrograms.Init("GS_LogPrograms", path); GSDumpColorBuffers.Init("GS_DumpColorBuffers", path); GSDumpDepthBuffer.Init("GS_DumpDepthBuffer", path); + GSVSyncEnable.Init("GS_VSyncEnable", path); + GS3DTV.Init("GS_3DTV", path); // Audio AudioOutMode.Init("Audio_AudioOutMode", path); @@ -246,10 +248,11 @@ public: GSRenderMode.Load(1); GSResolution.Load(4); GSAspectRatio.Load(2); - GSVSyncEnable.Load(false); GSLogPrograms.Load(false); GSDumpColorBuffers.Load(false); GSDumpDepthBuffer.Load(false); + GSVSyncEnable.Load(false); + GS3DTV.Load(false); // Audio AudioOutMode.Load(1); @@ -316,10 +319,11 @@ public: GSRenderMode.Save(); GSResolution.Save(); GSAspectRatio.Save(); - GSVSyncEnable.Save(); GSLogPrograms.Save(); GSDumpColorBuffers.Save(); GSDumpDepthBuffer.Save(); + GSVSyncEnable.Save(); + GS3DTV.Save(); // Audio AudioOutMode.Save(); diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index b8a917b6e7..90fb00cd5f 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -370,7 +370,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) if(!phdr.p_filesz) break; - auto& proc_param = vm::get_ref(offset + phdr.p_vaddr); + const sys_process_param& proc_param = vm::get_ref(offset + phdr.p_vaddr); if (proc_param.size < sizeof(sys_process_param)) { @@ -400,7 +400,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) if(!phdr.p_filesz) break; - sys_proc_prx_param proc_prx_param = vm::get_ref(offset + phdr.p_vaddr); + const sys_proc_prx_param& proc_prx_param = vm::get_ref(offset + phdr.p_vaddr); #ifdef LOADER_DEBUG @@ -414,21 +414,24 @@ bool ELF64Loader::LoadPhdrData(u64 offset) LOG_NOTICE(LOADER, "*** ver: 0x%x", proc_prx_param.ver.ToLE()); #endif - if (proc_prx_param.magic != 0x1b434cec) { + if (proc_prx_param.magic != 0x1b434cec) + { LOG_ERROR(LOADER, "Bad magic! (0x%x)", proc_prx_param.magic.ToLE()); break; } - for(u32 s=proc_prx_param.libstubstart; s(offset + s); + const Elf64_StubHeader& stub = vm::get_ref(offset + s); const std::string module_name = vm::get_ptr(stub.s_modulename); Module* module = Emu.GetModuleManager().GetModuleByName(module_name); - if (module) { + if (module) + { //module->SetLoaded(); } - else { + else + { LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str()); } @@ -447,10 +450,10 @@ bool ELF64Loader::LoadPhdrData(u64 offset) u64 tbl = Memory.MainMem.AllocAlign(stub.s_imports * 4 * 2); u64 dst = Memory.MainMem.AllocAlign(stub.s_imports * section); - for(u32 i=0; iLoad(nid)) { @@ -471,10 +474,10 @@ bool ELF64Loader::LoadPhdrData(u64 offset) out_tbl[0] = (u32)dst + i*section; out_tbl[1] = Emu.GetModuleManager().GetFuncNumById(nid); - auto out_dst = vm::ptr>::make((u32)dst + i*section); + auto out_dst = vm::ptr>::make((u32)dst + i * section); out_dst[0] = OR(11, 2, 2, 0); out_dst[1] = SC(2); - out_dst[2] = BCLR(0x10 | 0x04, 0, 0, 0); + out_dst[2] = BLR(); } } #ifdef LOADER_DEBUG diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 439d865c40..36fd98fa19 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -39,6 +39,7 @@ + NotUsing @@ -128,6 +129,7 @@ + @@ -243,6 +245,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 27371a0d22..5df44f8c9f 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -131,6 +131,9 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + Emu\SysCalls\Modules @@ -347,6 +350,9 @@ Emu\Memory + + Emu\Memory + Loader @@ -617,8 +623,8 @@ Utilities - - Emu\Memory + + Crypto @@ -724,6 +730,9 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + Emu\SysCalls\Modules @@ -1210,9 +1219,6 @@ Header Files - - Emu\SysCalls\Modules - Emu\SysCalls @@ -1222,5 +1228,8 @@ Emu\Memory + + Crypto + \ No newline at end of file