mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 12:12:50 +01:00
Log include fixes
This commit is contained in:
parent
efa538f9d7
commit
b005ee3cda
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Utilities/SMutex.h"
|
||||
|
||||
template<typename T, u32 SQSize = 666>
|
||||
class SQueue
|
||||
{
|
||||
|
@ -1,6 +1,20 @@
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
#include "aes.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
SELF_KEY::SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct)
|
||||
{
|
||||
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());
|
||||
curve_type = ct;
|
||||
}
|
||||
|
||||
KeyVault::KeyVault()
|
||||
{
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
|
||||
enum SELF_KEY_TYPE {
|
||||
KEY_LV0 = 1,
|
||||
@ -22,17 +21,7 @@ struct SELF_KEY {
|
||||
u8 priv[0x15];
|
||||
u32 curve_type;
|
||||
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct)
|
||||
{
|
||||
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());
|
||||
curve_type = ct;
|
||||
}
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct);
|
||||
};
|
||||
|
||||
static u8 PKG_AES_KEY[0x10] = {
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
#include "unedat.h"
|
||||
#include "Utilities/Log.h"
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
#define SDAT_FLAG 0x01000000
|
||||
#define EDAT_COMPRESSED_FLAG 0x00000001
|
||||
|
@ -1,4 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
#include "key_vault.h"
|
||||
#include "unpkg.h"
|
||||
#include <wx/progdlg.h>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
// Constants
|
||||
#define PKG_HEADER_SIZE 0xC0 //sizeof(pkg_header) + sizeof(pkg_unk_checksum)
|
||||
|
@ -1,8 +1,317 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
#include "utils.h"
|
||||
#include "Emu/FS/vfsLocalFile.h"
|
||||
#include "unself.h"
|
||||
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
void AppInfo::Load(vfsStream& f)
|
||||
{
|
||||
authid = Read64(f);
|
||||
vendor_id = Read32(f);
|
||||
self_type = Read32(f);
|
||||
version = Read64(f);
|
||||
padding = Read64(f);
|
||||
}
|
||||
|
||||
void AppInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "AuthID: 0x%llx", authid);
|
||||
LOG_NOTICE(LOADER, "VendorID: 0x%08x", vendor_id);
|
||||
LOG_NOTICE(LOADER, "SELF type: 0x%08x", self_type);
|
||||
LOG_NOTICE(LOADER, "Version: 0x%llx", version);
|
||||
}
|
||||
|
||||
void SectionInfo::Load(vfsStream& f)
|
||||
{
|
||||
offset = Read64(f);
|
||||
size = Read64(f);
|
||||
compressed = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read32(f);
|
||||
encrypted = Read32(f);
|
||||
}
|
||||
|
||||
void SectionInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Offset: 0x%llx", offset);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%llx", size);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
}
|
||||
|
||||
void SCEVersionInfo::Load(vfsStream& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
unknown = Read32(f);
|
||||
}
|
||||
|
||||
void SCEVersionInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Sub-header type: 0x%08x", subheader_type);
|
||||
LOG_NOTICE(LOADER, "Present: 0x%08x", present);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%08x", unknown);
|
||||
}
|
||||
|
||||
void ControlInfo::Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
size = Read32(f);
|
||||
next = Read64(f);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
control_flags.ctrl_flag1 = Read32(f);
|
||||
control_flags.unknown1 = Read32(f);
|
||||
control_flags.unknown2 = Read32(f);
|
||||
control_flags.unknown3 = Read32(f);
|
||||
control_flags.unknown4 = Read32(f);
|
||||
control_flags.unknown5 = Read32(f);
|
||||
control_flags.unknown6 = Read32(f);
|
||||
control_flags.unknown7 = Read32(f);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
f.Read(file_digest_30.digest, 20);
|
||||
file_digest_30.unknown = Read64(f);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
f.Read(file_digest_40.digest1, 20);
|
||||
f.Read(file_digest_40.digest2, 20);
|
||||
file_digest_40.unknown = Read64(f);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
npdrm.magic = Read32(f);
|
||||
npdrm.unknown1 = Read32(f);
|
||||
npdrm.license = Read32(f);
|
||||
npdrm.type = Read32(f);
|
||||
f.Read(npdrm.content_id, 48);
|
||||
f.Read(npdrm.digest, 16);
|
||||
f.Read(npdrm.invdigest, 16);
|
||||
f.Read(npdrm.xordigest, 16);
|
||||
npdrm.unknown2 = Read64(f);
|
||||
npdrm.unknown3 = Read64(f);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Next: 0x%llx", next);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", control_flags.unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", control_flags.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", control_flags.unknown3);
|
||||
LOG_NOTICE(LOADER, "Unknown4: 0x%08x", control_flags.unknown4);
|
||||
LOG_NOTICE(LOADER, "Unknown5: 0x%08x", control_flags.unknown5);
|
||||
LOG_NOTICE(LOADER, "Unknown6: 0x%08x", control_flags.unknown6);
|
||||
LOG_NOTICE(LOADER, "Unknown7: 0x%08x", control_flags.unknown7);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
std::string digest_str;
|
||||
for (int i = 0; i < 20; i++)
|
||||
digest_str += fmt::Format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_30.unknown);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
std::string digest_str1;
|
||||
std::string digest_str2;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
digest_str1 += fmt::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += fmt::Format("%02x", file_digest_40.digest2[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest1: %s", digest_str1.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest2: %s", digest_str2.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_40.unknown);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
std::string contentid_str;
|
||||
std::string digest_str;
|
||||
std::string invdigest_str;
|
||||
std::string xordigest_str;
|
||||
for (int i = 0; i < 48; i++)
|
||||
contentid_str += fmt::Format("%02x", npdrm.content_id[i]);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
digest_str += fmt::Format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += fmt::Format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += fmt::Format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Magic: 0x%08x", npdrm.magic);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", npdrm.unknown1);
|
||||
LOG_NOTICE(LOADER, "License: 0x%08x", npdrm.license);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", npdrm.type);
|
||||
LOG_NOTICE(LOADER, "ContentID: %s", contentid_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Inverse digest: %s", invdigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "XOR digest: %s", xordigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%llx", npdrm.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%llx", npdrm.unknown3);
|
||||
}
|
||||
}
|
||||
|
||||
void MetadataInfo::Load(u8* in)
|
||||
{
|
||||
memcpy(key, in, 0x10);
|
||||
memcpy(key_pad, in + 0x10, 0x10);
|
||||
memcpy(iv, in + 0x20, 0x10);
|
||||
memcpy(iv_pad, in + 0x30, 0x10);
|
||||
}
|
||||
|
||||
void MetadataInfo::Show()
|
||||
{
|
||||
std::string key_str;
|
||||
std::string key_pad_str;
|
||||
std::string iv_str;
|
||||
std::string iv_pad_str;
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
key_str += fmt::Format("%02x", key[i]);
|
||||
key_pad_str += fmt::Format("%02x", key_pad[i]);
|
||||
iv_str += fmt::Format("%02x", iv[i]);
|
||||
iv_pad_str += fmt::Format("%02x", iv_pad[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Key: %s", key_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Key pad: %s", key_pad_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV: %s", iv_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV pad: %s", iv_pad_str.c_str());
|
||||
}
|
||||
|
||||
void MetadataHeader::Load(u8* in)
|
||||
{
|
||||
memcpy(&signature_input_length, in, 8);
|
||||
memcpy(&unknown1, in + 8, 4);
|
||||
memcpy(§ion_count, in + 12, 4);
|
||||
memcpy(&key_count, in + 16, 4);
|
||||
memcpy(&opt_header_size, in + 20, 4);
|
||||
memcpy(&unknown2, in + 24, 4);
|
||||
memcpy(&unknown3, in + 28, 4);
|
||||
|
||||
// Endian swap.
|
||||
signature_input_length = swap64(signature_input_length);
|
||||
unknown1 = swap32(unknown1);
|
||||
section_count = swap32(section_count);
|
||||
key_count = swap32(key_count);
|
||||
opt_header_size = swap32(opt_header_size);
|
||||
unknown2 = swap32(unknown2);
|
||||
unknown3 = swap32(unknown3);
|
||||
}
|
||||
|
||||
void MetadataHeader::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Signature input length: 0x%llx", signature_input_length);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Section count: 0x%08x", section_count);
|
||||
LOG_NOTICE(LOADER, "Key count: 0x%08x", key_count);
|
||||
LOG_NOTICE(LOADER, "Optional header size: 0x%08x", opt_header_size);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", unknown3);
|
||||
}
|
||||
|
||||
void MetadataSectionHeader::Load(u8* in)
|
||||
{
|
||||
memcpy(&data_offset, in, 8);
|
||||
memcpy(&data_size, in + 8, 8);
|
||||
memcpy(&type, in + 16, 4);
|
||||
memcpy(&program_idx, in + 20, 4);
|
||||
memcpy(&hashed, in + 24, 4);
|
||||
memcpy(&sha1_idx, in + 28, 4);
|
||||
memcpy(&encrypted, in + 32, 4);
|
||||
memcpy(&key_idx, in + 36, 4);
|
||||
memcpy(&iv_idx, in + 40, 4);
|
||||
memcpy(&compressed, in + 44, 4);
|
||||
|
||||
// Endian swap.
|
||||
data_offset = swap64(data_offset);
|
||||
data_size = swap64(data_size);
|
||||
type = swap32(type);
|
||||
program_idx = swap32(program_idx);
|
||||
hashed = swap32(hashed);
|
||||
sha1_idx = swap32(sha1_idx);
|
||||
encrypted = swap32(encrypted);
|
||||
key_idx = swap32(key_idx);
|
||||
iv_idx = swap32(iv_idx);
|
||||
compressed = swap32(compressed);
|
||||
}
|
||||
|
||||
void MetadataSectionHeader::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Data offset: 0x%llx", data_offset);
|
||||
LOG_NOTICE(LOADER, "Data size: 0x%llx", data_size);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Program index: 0x%08x", program_idx);
|
||||
LOG_NOTICE(LOADER, "Hashed: 0x%08x", hashed);
|
||||
LOG_NOTICE(LOADER, "SHA1 index: 0x%08x", sha1_idx);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
LOG_NOTICE(LOADER, "Key index: 0x%08x", key_idx);
|
||||
LOG_NOTICE(LOADER, "IV index: 0x%08x", iv_idx);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
}
|
||||
|
||||
void SectionHash::Load(vfsStream& f)
|
||||
{
|
||||
f.Read(sha1, 20);
|
||||
f.Read(padding, 12);
|
||||
f.Read(hmac_key, 64);
|
||||
}
|
||||
|
||||
void CapabilitiesInfo::Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
capabilities_size = Read32(f);
|
||||
next = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read64(f);
|
||||
unknown3 = Read64(f);
|
||||
flags = Read64(f);
|
||||
unknown4 = Read32(f);
|
||||
unknown5 = Read32(f);
|
||||
}
|
||||
|
||||
void Signature::Load(vfsStream& f)
|
||||
{
|
||||
f.Read(r, 21);
|
||||
f.Read(s, 21);
|
||||
f.Read(padding, 6);
|
||||
}
|
||||
|
||||
void SelfSection::Load(vfsStream& f)
|
||||
{
|
||||
*data = Read32(f);
|
||||
size = Read64(f);
|
||||
offset = Read64(f);
|
||||
}
|
||||
|
||||
SELFDecrypter::SELFDecrypter(vfsStream& s)
|
||||
: self_f(s), key_v(), data_buf_length(0)
|
||||
{
|
||||
|
@ -1,10 +1,8 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
#include "Loader/ELF.h"
|
||||
|
||||
#include "Loader/SELF.h"
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/zstream.h>
|
||||
#include "Loader/ELF.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
struct AppInfo
|
||||
{
|
||||
@ -14,22 +12,9 @@ struct AppInfo
|
||||
u64 version;
|
||||
u64 padding;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
authid = Read64(f);
|
||||
vendor_id = Read32(f);
|
||||
self_type = Read32(f);
|
||||
version = Read64(f);
|
||||
padding = Read64(f);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "AuthID: 0x%llx", authid);
|
||||
LOG_NOTICE(LOADER, "VendorID: 0x%08x", vendor_id);
|
||||
LOG_NOTICE(LOADER, "SELF type: 0x%08x", self_type);
|
||||
LOG_NOTICE(LOADER, "Version: 0x%llx", version);
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
struct SectionInfo
|
||||
@ -41,25 +26,9 @@ struct SectionInfo
|
||||
u32 unknown2;
|
||||
u32 encrypted;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
offset = Read64(f);
|
||||
size = Read64(f);
|
||||
compressed = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read32(f);
|
||||
encrypted = Read32(f);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Offset: 0x%llx", offset);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%llx", size);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
struct SCEVersionInfo
|
||||
@ -69,21 +38,9 @@ struct SCEVersionInfo
|
||||
u32 size;
|
||||
u32 unknown;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
unknown = Read32(f);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Sub-header type: 0x%08x", subheader_type);
|
||||
LOG_NOTICE(LOADER, "Present: 0x%08x", present);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%08x", unknown);
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
struct ControlInfo
|
||||
@ -133,122 +90,9 @@ struct ControlInfo
|
||||
} npdrm;
|
||||
};
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
size = Read32(f);
|
||||
next = Read64(f);
|
||||
void Load(vfsStream& f);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
control_flags.ctrl_flag1 = Read32(f);
|
||||
control_flags.unknown1 = Read32(f);
|
||||
control_flags.unknown2 = Read32(f);
|
||||
control_flags.unknown3 = Read32(f);
|
||||
control_flags.unknown4 = Read32(f);
|
||||
control_flags.unknown5 = Read32(f);
|
||||
control_flags.unknown6 = Read32(f);
|
||||
control_flags.unknown7 = Read32(f);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
f.Read(file_digest_30.digest, 20);
|
||||
file_digest_30.unknown = Read64(f);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
f.Read(file_digest_40.digest1, 20);
|
||||
f.Read(file_digest_40.digest2, 20);
|
||||
file_digest_40.unknown = Read64(f);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
npdrm.magic = Read32(f);
|
||||
npdrm.unknown1 = Read32(f);
|
||||
npdrm.license = Read32(f);
|
||||
npdrm.type = Read32(f);
|
||||
f.Read(npdrm.content_id, 48);
|
||||
f.Read(npdrm.digest, 16);
|
||||
f.Read(npdrm.invdigest, 16);
|
||||
f.Read(npdrm.xordigest, 16);
|
||||
npdrm.unknown2 = Read64(f);
|
||||
npdrm.unknown3 = Read64(f);
|
||||
}
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Next: 0x%llx", next);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", control_flags.unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", control_flags.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", control_flags.unknown3);
|
||||
LOG_NOTICE(LOADER, "Unknown4: 0x%08x", control_flags.unknown4);
|
||||
LOG_NOTICE(LOADER, "Unknown5: 0x%08x", control_flags.unknown5);
|
||||
LOG_NOTICE(LOADER, "Unknown6: 0x%08x", control_flags.unknown6);
|
||||
LOG_NOTICE(LOADER, "Unknown7: 0x%08x", control_flags.unknown7);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
std::string digest_str;
|
||||
for (int i = 0; i < 20; i++)
|
||||
digest_str += fmt::Format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_30.unknown);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
std::string digest_str1;
|
||||
std::string digest_str2;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
digest_str1 += fmt::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += fmt::Format("%02x", file_digest_40.digest2[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest1: %s", digest_str1.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest2: %s", digest_str2.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_40.unknown);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
std::string contentid_str;
|
||||
std::string digest_str;
|
||||
std::string invdigest_str;
|
||||
std::string xordigest_str;
|
||||
for (int i = 0; i < 48; i++)
|
||||
contentid_str += fmt::Format("%02x", npdrm.content_id[i]);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
digest_str += fmt::Format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += fmt::Format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += fmt::Format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Magic: 0x%08x", npdrm.magic);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", npdrm.unknown1);
|
||||
LOG_NOTICE(LOADER, "License: 0x%08x", npdrm.license);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", npdrm.type);
|
||||
LOG_NOTICE(LOADER, "ContentID: %s", contentid_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Inverse digest: %s", invdigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "XOR digest: %s", xordigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%llx", npdrm.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%llx", npdrm.unknown3);
|
||||
}
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
|
||||
@ -259,33 +103,9 @@ struct MetadataInfo
|
||||
u8 iv[0x10];
|
||||
u8 iv_pad[0x10];
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(key, in, 0x10);
|
||||
memcpy(key_pad, in + 0x10, 0x10);
|
||||
memcpy(iv, in + 0x20, 0x10);
|
||||
memcpy(iv_pad, in + 0x30, 0x10);
|
||||
}
|
||||
void Load(u8* in);
|
||||
|
||||
void Show()
|
||||
{
|
||||
std::string key_str;
|
||||
std::string key_pad_str;
|
||||
std::string iv_str;
|
||||
std::string iv_pad_str;
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
key_str += fmt::Format("%02x", key[i]);
|
||||
key_pad_str += fmt::Format("%02x", key_pad[i]);
|
||||
iv_str += fmt::Format("%02x", iv[i]);
|
||||
iv_pad_str += fmt::Format("%02x", iv_pad[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Key: %s", key_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Key pad: %s", key_pad_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV: %s", iv_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV pad: %s", iv_pad_str.c_str());
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
struct MetadataHeader
|
||||
@ -298,36 +118,9 @@ struct MetadataHeader
|
||||
u32 unknown2;
|
||||
u32 unknown3;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&signature_input_length, in, 8);
|
||||
memcpy(&unknown1, in + 8, 4);
|
||||
memcpy(§ion_count, in + 12, 4);
|
||||
memcpy(&key_count, in + 16, 4);
|
||||
memcpy(&opt_header_size, in + 20, 4);
|
||||
memcpy(&unknown2, in + 24, 4);
|
||||
memcpy(&unknown3, in + 28, 4);
|
||||
void Load(u8* in);
|
||||
|
||||
// Endian swap.
|
||||
signature_input_length = swap64(signature_input_length);
|
||||
unknown1 = swap32(unknown1);
|
||||
section_count = swap32(section_count);
|
||||
key_count = swap32(key_count);
|
||||
opt_header_size = swap32(opt_header_size);
|
||||
unknown2 = swap32(unknown2);
|
||||
unknown3 = swap32(unknown3);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Signature input length: 0x%llx", signature_input_length);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Section count: 0x%08x", section_count);
|
||||
LOG_NOTICE(LOADER, "Key count: 0x%08x", key_count);
|
||||
LOG_NOTICE(LOADER, "Optional header size: 0x%08x", opt_header_size);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", unknown3);
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
struct MetadataSectionHeader
|
||||
@ -343,45 +136,9 @@ struct MetadataSectionHeader
|
||||
u32 iv_idx;
|
||||
u32 compressed;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&data_offset, in, 8);
|
||||
memcpy(&data_size, in + 8, 8);
|
||||
memcpy(&type, in + 16, 4);
|
||||
memcpy(&program_idx, in + 20, 4);
|
||||
memcpy(&hashed, in + 24, 4);
|
||||
memcpy(&sha1_idx, in + 28, 4);
|
||||
memcpy(&encrypted, in + 32, 4);
|
||||
memcpy(&key_idx, in + 36, 4);
|
||||
memcpy(&iv_idx, in + 40, 4);
|
||||
memcpy(&compressed, in + 44, 4);
|
||||
void Load(u8* in);
|
||||
|
||||
// Endian swap.
|
||||
data_offset = swap64(data_offset);
|
||||
data_size = swap64(data_size);
|
||||
type = swap32(type);
|
||||
program_idx = swap32(program_idx);
|
||||
hashed = swap32(hashed);
|
||||
sha1_idx = swap32(sha1_idx);
|
||||
encrypted = swap32(encrypted);
|
||||
key_idx = swap32(key_idx);
|
||||
iv_idx = swap32(iv_idx);
|
||||
compressed = swap32(compressed);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Data offset: 0x%llx", data_offset);
|
||||
LOG_NOTICE(LOADER, "Data size: 0x%llx", data_size);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Program index: 0x%08x", program_idx);
|
||||
LOG_NOTICE(LOADER, "Hashed: 0x%08x", hashed);
|
||||
LOG_NOTICE(LOADER, "SHA1 index: 0x%08x", sha1_idx);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
LOG_NOTICE(LOADER, "Key index: 0x%08x", key_idx);
|
||||
LOG_NOTICE(LOADER, "IV index: 0x%08x", iv_idx);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
}
|
||||
void Show();
|
||||
};
|
||||
|
||||
struct SectionHash {
|
||||
@ -389,12 +146,7 @@ struct SectionHash {
|
||||
u8 padding[12];
|
||||
u8 hmac_key[64];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(sha1, 20);
|
||||
f.Read(padding, 12);
|
||||
f.Read(hmac_key, 64);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
};
|
||||
|
||||
struct CapabilitiesInfo
|
||||
@ -409,18 +161,7 @@ struct CapabilitiesInfo
|
||||
u32 unknown4;
|
||||
u32 unknown5;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
capabilities_size = Read32(f);
|
||||
next = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read64(f);
|
||||
unknown3 = Read64(f);
|
||||
flags = Read64(f);
|
||||
unknown4 = Read32(f);
|
||||
unknown5 = Read32(f);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
};
|
||||
|
||||
struct Signature
|
||||
@ -429,12 +170,7 @@ struct Signature
|
||||
u8 s[21];
|
||||
u8 padding[6];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(r, 21);
|
||||
f.Read(s, 21);
|
||||
f.Read(padding, 6);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
};
|
||||
|
||||
struct SelfSection
|
||||
@ -443,12 +179,7 @@ struct SelfSection
|
||||
u64 size;
|
||||
u64 offset;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
*data = Read32(f);
|
||||
size = Read64(f);
|
||||
offset = Read64(f);
|
||||
}
|
||||
void Load(vfsStream& f);
|
||||
};
|
||||
|
||||
class SELFDecrypter
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Endian swap auxiliary functions.
|
||||
|
@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
|
||||
// Auxiliary functions (endian swap and xor).
|
||||
u16 swap16(u16 i);
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "rpcs3/Ini.h"
|
||||
#include "Emu/SysCalls/ErrorCodes.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
|
@ -4,7 +4,9 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/Static.h"
|
||||
#include "Emu/Cell/PPUDecoder.h"
|
||||
#include "Emu/Cell/PPUInterpreter.h"
|
||||
|
||||
@ -220,6 +222,11 @@ int FPRdouble::Cmp(PPCdouble a, PPCdouble b)
|
||||
return CR_SO;
|
||||
}
|
||||
|
||||
u64 PPUThread::GetStackArg(s32 i)
|
||||
{
|
||||
return Memory.Read64(GPR[1] + 0x70 + 0x8 * (i - 9));
|
||||
}
|
||||
|
||||
u64 PPUThread::FastCall(u64 addr, u64 rtoc, u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, u64 arg8)
|
||||
{
|
||||
GPR[3] = arg1;
|
||||
|
@ -842,6 +842,7 @@ public:
|
||||
public:
|
||||
virtual void InitRegs();
|
||||
virtual u64 GetFreeStackSize() const;
|
||||
u64 GetStackArg(s32 i);
|
||||
u64 FastCall(u64 addr, u64 rtoc, u64 arg1 = 0, u64 arg2 = 0, u64 arg3 = 0, u64 arg4 = 0, u64 arg5 = 0, u64 arg6 = 0, u64 arg7 = 0, u64 arg8 = 0);
|
||||
u64 FastCall2(u64 addr, u64 rtoc);
|
||||
void FastStop();
|
||||
@ -866,3 +867,4 @@ protected:
|
||||
|
||||
PPUThread& GetCurrentPPUThread();
|
||||
|
||||
#define declCPU PPUThread& CPU = GetCurrentPPUThread
|
||||
|
@ -1,10 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "SysCalls.h"
|
||||
|
||||
#define FUNC_LOG_ERROR(x) LOG_ERROR(HLE, x); return 0
|
||||
std::string SysCalls::GetHLEFuncName(const u32 fid)
|
||||
{
|
||||
switch(fid)
|
||||
|
@ -9,17 +9,24 @@ bool LogBase::CheckLogging() const
|
||||
return Ini.HLELogging.GetValue();
|
||||
}
|
||||
|
||||
void LogBase::LogNotice(const std::string& text)
|
||||
void LogBase::LogOutput(LogType type, const char* info, const std::string& text)
|
||||
{
|
||||
LOG_NOTICE(HLE, "%s", text.c_str());
|
||||
switch (type)
|
||||
{
|
||||
case LogNotice: LOG_NOTICE(HLE, "%s%s%s", GetName().c_str(), info, text.c_str()); break;
|
||||
case LogSuccess: LOG_SUCCESS(HLE, "%s%s%s", GetName().c_str(), info, text.c_str()); break;
|
||||
case LogWarning: LOG_WARNING(HLE, "%s%s%s", GetName().c_str(), info, text.c_str()); break;
|
||||
case LogError: LOG_ERROR(HLE, "%s%s%s", GetName().c_str(), info, text.c_str()); break;
|
||||
}
|
||||
}
|
||||
|
||||
void LogBase::LogWarning(const std::string& text)
|
||||
void LogBase::LogOutput(LogType type, const u32 id, const char* info, const std::string& text)
|
||||
{
|
||||
LOG_WARNING(HLE, "%s", text.c_str());
|
||||
}
|
||||
|
||||
void LogBase::LogError(const std::string& text)
|
||||
{
|
||||
LOG_ERROR(HLE, "%s", text.c_str());
|
||||
switch (type)
|
||||
{
|
||||
case LogNotice: LOG_NOTICE(HLE, "%s[%d]%s%s", GetName().c_str(), id, info, text.c_str()); break;
|
||||
case LogSuccess: LOG_SUCCESS(HLE, "%s[%d]%s%s", GetName().c_str(), id, info, text.c_str()); break;
|
||||
case LogWarning: LOG_WARNING(HLE, "%s[%d]%s%s", GetName().c_str(), id, info, text.c_str()); break;
|
||||
case LogError: LOG_ERROR(HLE, "%s[%d]%s%s", GetName().c_str(), id, info, text.c_str()); break;
|
||||
}
|
||||
}
|
@ -3,11 +3,18 @@
|
||||
class LogBase
|
||||
{
|
||||
bool m_logging;
|
||||
|
||||
bool CheckLogging() const;
|
||||
void LogNotice(const std::string& text);
|
||||
void LogWarning(const std::string& text);
|
||||
void LogError(const std::string& text);
|
||||
|
||||
enum LogType
|
||||
{
|
||||
LogNotice,
|
||||
LogSuccess,
|
||||
LogWarning,
|
||||
LogError,
|
||||
};
|
||||
|
||||
void LogOutput(LogType type, const char* info, const std::string& text);
|
||||
void LogOutput(LogType type, const u32 id, const char* info, const std::string& text);
|
||||
|
||||
public:
|
||||
void SetLogging(bool value)
|
||||
@ -24,12 +31,12 @@ public:
|
||||
|
||||
template<typename... Targs> void Notice(const u32 id, const char* fmt, Targs... args)
|
||||
{
|
||||
LogNotice(GetName() + fmt::Format("[%d]: ", id) + fmt::Format(fmt, args...));
|
||||
LogOutput(LogNotice, id, ": ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Notice(const char* fmt, Targs... args)
|
||||
{
|
||||
LogNotice(GetName() + ": " + fmt::Format(fmt, args...));
|
||||
LogOutput(LogNotice, ": ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> __forceinline void Log(const char* fmt, Targs... args)
|
||||
@ -48,33 +55,43 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... Targs> void Success(const u32 id, const char* fmt, Targs... args)
|
||||
{
|
||||
LogOutput(LogSuccess, id, ": ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Success(const char* fmt, Targs... args)
|
||||
{
|
||||
LogOutput(LogSuccess, ": ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Warning(const u32 id, const char* fmt, Targs... args)
|
||||
{
|
||||
LogWarning(GetName() + fmt::Format("[%d] warning: ", id) + fmt::Format(fmt, args...));
|
||||
LogOutput(LogWarning, id, " warning: ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Warning(const char* fmt, Targs... args)
|
||||
{
|
||||
LogWarning(GetName() + " warning: " + fmt::Format(fmt, args...));
|
||||
LogOutput(LogWarning, " warning: ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Error(const u32 id, const char* fmt, Targs... args)
|
||||
{
|
||||
LogError(GetName() + fmt::Format("[%d] error: ", id) + fmt::Format(fmt, args...));
|
||||
LogOutput(LogError, id, " error: ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Error(const char* fmt, Targs... args)
|
||||
{
|
||||
LogError(GetName() + " error: " + fmt::Format(fmt, args...));
|
||||
LogOutput(LogError, " error: ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Todo(const u32 id, const char* fmt, Targs... args)
|
||||
{
|
||||
LogError(GetName() + fmt::Format("[%d] TODO: ", id) + fmt::Format(fmt, args...));
|
||||
LogOutput(LogError, id, " TODO: ", fmt::Format(fmt, args...));
|
||||
}
|
||||
|
||||
template<typename... Targs> void Todo(const char* fmt, Targs... args)
|
||||
{
|
||||
LogError(GetName() + " TODO: " + fmt::Format(fmt, args...));
|
||||
LogOutput(LogError, " TODO: ", fmt::Format(fmt, args...));
|
||||
}
|
||||
};
|
@ -2,6 +2,7 @@
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/Static.h"
|
||||
#include "Crypto/sha1.h"
|
||||
#include <mutex>
|
||||
#include "ModuleManager.h"
|
||||
@ -179,7 +180,7 @@ IdManager& Module::GetIdManager() const
|
||||
return Emu.GetIdManager();
|
||||
}
|
||||
|
||||
StaticFuncManager& Module::GetSFuncManager() const
|
||||
void Module::PushNewFuncSub(SFunc* func)
|
||||
{
|
||||
return Emu.GetSFuncManager();
|
||||
Emu.GetSFuncManager().push_back(func);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "ErrorCodes.h"
|
||||
#include "LogBase.h"
|
||||
|
||||
//TODO
|
||||
@ -17,7 +17,7 @@ struct ModuleFunc
|
||||
|
||||
~ModuleFunc()
|
||||
{
|
||||
safe_delete(func);
|
||||
delete func;
|
||||
}
|
||||
};
|
||||
|
||||
@ -38,10 +38,12 @@ struct SFunc
|
||||
|
||||
~SFunc()
|
||||
{
|
||||
safe_delete(func);
|
||||
delete func;
|
||||
}
|
||||
};
|
||||
|
||||
class StaticFuncManager;
|
||||
|
||||
class Module : public LogBase
|
||||
{
|
||||
std::string m_name;
|
||||
@ -51,7 +53,7 @@ class Module : public LogBase
|
||||
void (*m_unload_func)();
|
||||
|
||||
IdManager& GetIdManager() const;
|
||||
StaticFuncManager& GetSFuncManager() const;
|
||||
void PushNewFuncSub(SFunc* func);
|
||||
|
||||
public:
|
||||
std::vector<ModuleFunc*> m_funcs_list;
|
||||
@ -155,5 +157,13 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
|
||||
op.crc = re(op.crc);
|
||||
sf->ops.push_back(op);
|
||||
}
|
||||
GetSFuncManager().push_back(sf);
|
||||
PushNewFuncSub(sf);
|
||||
}
|
||||
|
||||
#define REG_SUB(module, group, name, ...) \
|
||||
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
|
||||
module->AddFuncSub(group, name ## _table, #name, name)
|
||||
|
||||
#define REG_FUNC(module, name) module->AddFunc(getFunctionId(#name), name)
|
||||
|
||||
#define UNIMPLEMENTED_FUNC(module) module->Todo("%s", __FUNCTION__)
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "cellPamf.h"
|
||||
|
||||
extern std::mutex g_mutex_avcodec_open2;
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
Module *cellAtrac = nullptr;
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Utilities/SQueue.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
#include "Emu/Audio/cellAudio.h"
|
||||
#include "Emu/Audio/AudioManager.h"
|
||||
#include "Emu/Audio/AudioDumper.h"
|
||||
@ -359,7 +359,7 @@ int cellAudioInit()
|
||||
}
|
||||
}
|
||||
|
||||
const u64 stamp1 = get_system_time();
|
||||
//const u64 stamp1 = get_system_time();
|
||||
|
||||
if (first_mix)
|
||||
{
|
||||
@ -381,7 +381,7 @@ int cellAudioInit()
|
||||
oal_buffer_offset = 0;
|
||||
}
|
||||
|
||||
const u64 stamp2 = get_system_time();
|
||||
//const u64 stamp2 = get_system_time();
|
||||
|
||||
// send aftermix event (normal audio event)
|
||||
{
|
||||
@ -409,7 +409,7 @@ int cellAudioInit()
|
||||
Emu.GetEventManager().SendEvent(keys[i], 0x10103000e010e07, 0, 0, 0);
|
||||
}
|
||||
|
||||
const u64 stamp3 = get_system_time();
|
||||
//const u64 stamp3 = get_system_time();
|
||||
|
||||
if (do_dump && !first_mix)
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellBgdl_init();
|
||||
Module cellBgdl(0x003f, cellBgdl_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellCamera_init();
|
||||
Module cellCamera(0x0023, cellCamera_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellCelp8Enc_init();
|
||||
Module cellCelp8Enc(0x0048, cellCelp8Enc_init);
|
||||
|
@ -1,8 +1,5 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellCelpEnc_init();
|
||||
Module cellCelpEnc(0xf00a, cellCelpEnc_init);
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "cellPamf.h"
|
||||
#include "cellDmux.h"
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellFiber_init();
|
||||
Module cellFiber(0x0043, cellFiber_init);
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "cellFont.h"
|
||||
#include "stblib/stb_truetype.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "cellFont.h"
|
||||
|
||||
//void cellFontFT_init();
|
||||
|
@ -3,9 +3,7 @@
|
||||
#include "Utilities/rMsgBox.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
|
||||
#include "Loader/PSF.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/RSX/GCM.h"
|
||||
#include "Emu/SysCalls/lv2/sys_process.h"
|
||||
#include "sysPrxForUser.h"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "cellGem.h"
|
||||
|
||||
void cellGem_init();
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "cellGifDec.h"
|
||||
|
||||
#include "Emu/SysCalls/lv2/lv2Fs.h"
|
||||
#include "stblib/stb_image.h"
|
||||
#include "stblib/stb_image.c" // (TODO: Should we put this elsewhere?)
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellHttpUtil_init();
|
||||
Module cellHttpUtil(0x0002, cellHttpUtil_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellImejp_init();
|
||||
Module cellImejp(0xf023, cellImejp_init);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "cellJpgDec.h"
|
||||
#include "stblib/stb_image.h"
|
||||
#include "Emu/SysCalls/lv2/lv2Fs.h"
|
||||
|
||||
//void cellJpgDec_init();
|
||||
//Module cellJpgDec(0x000f, cellJpgDec_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellJpgEnc_init();
|
||||
Module cellJpgEnc(0x003d, cellJpgEnc_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellKey2char_init();
|
||||
Module cellKey2char(0x0021, cellKey2char_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellLv2dbg_init();
|
||||
Module cellLv2dbg(0x002e, cellLv2dbg_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellMic_init();
|
||||
Module cellMic(0x0022, cellMic_init);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
#include "rpcs3.h"
|
||||
|
||||
#include "cellSysutil.h"
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellMusicDecode_init();
|
||||
Module cellMusicDecode(0x004f, cellMusicDecode_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellMusicExport_init();
|
||||
Module cellMusicExport(0xf02c, cellMusicExport_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellOvis_init();
|
||||
Module cellOvis(0x000b, cellOvis_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellPhotoDecode_init();
|
||||
Module cellPhotoDecode(0xf02e, cellPhotoDecode_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellPhotoExport_init();
|
||||
Module cellPhotoExport(0xf029, cellPhotoExport_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellPhotoImport_init();
|
||||
Module cellPhotoImport(0xf02b, cellPhotoImport_init);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "cellPngDec.h"
|
||||
#include "stblib/stb_image.h"
|
||||
#include "Emu/SysCalls/lv2/lv2Fs.h"
|
||||
#include <map>
|
||||
|
||||
//void cellPngDec_init();
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellPngEnc_init();
|
||||
Module cellPngEnc(0x0052, cellPngEnc_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellPrint_init();
|
||||
Module cellPrint(0xf02a, cellPrint_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellRudp_init();
|
||||
Module cellRudp(0x0057, cellRudp_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellSailRec_init();
|
||||
Module cellSailRec(0xf034, cellSailRec_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellScreenshot_init();
|
||||
Module cellScreenshot(0x004e, cellScreenshot_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellSearch_init();
|
||||
Module cellSearch(0xf02f, cellSearch_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellSheap_init();
|
||||
Module cellSheap(0x000c, cellSheap_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellSsl_init();
|
||||
Module cellSsl(0x0003, cellSsl_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellSubdisplay_init();
|
||||
Module cellSubdisplay(0x0034, cellSubdisplay_init);
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/lv2/sys_process.h"
|
||||
#include "Emu/Event.h"
|
||||
|
||||
#include "cellSync.h"
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellSync2_init();
|
||||
Module cellSync2(0x0055, cellSync2_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellUsbd_init();
|
||||
Module cellUsbd(0x001c, cellUsbd_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellUsbpspcm_init();
|
||||
Module cellUsbpspcm(0x0030, cellUsbpspcm_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void cellVoice_init();
|
||||
Module cellVoice(0x0046, cellVoice_init);
|
||||
|
@ -127,16 +127,16 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
picInfo->reserved1 = 0;
|
||||
picInfo->reserved2 = 0;
|
||||
|
||||
u64 stamp0 = get_system_time();
|
||||
//u64 stamp0 = get_system_time();
|
||||
std::unique_ptr<u8[]> pA(new u8[w*h]);
|
||||
|
||||
memset(pA.get(), (const u8)ctrlParam->outAlpha, w*h);
|
||||
|
||||
u64 stamp1 = get_system_time();
|
||||
//u64 stamp1 = get_system_time();
|
||||
|
||||
SwsContext* sws = sws_getContext(w, h, AV_PIX_FMT_YUVA420P, ow, oh, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
|
||||
|
||||
u64 stamp2 = get_system_time();
|
||||
//u64 stamp2 = get_system_time();
|
||||
|
||||
u8* in_data[4] = { Memory.GetMemFromAddr(inPicBuff_addr), Memory.GetMemFromAddr(inPicBuff_addr + w*h), Memory.GetMemFromAddr(inPicBuff_addr + w*h + w*h / 4), pA.get() };
|
||||
int in_line[4] = { w, w/2, w/2, w };
|
||||
@ -145,7 +145,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
|
||||
sws_scale(sws, in_data, in_line, 0, h, out_data, out_line);
|
||||
|
||||
u64 stamp3 = get_system_time();
|
||||
//u64 stamp3 = get_system_time();
|
||||
|
||||
sws_freeContext(sws);
|
||||
|
||||
|
@ -349,12 +349,12 @@ int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config)
|
||||
|
||||
if (port.m_is_audio_port_started)
|
||||
{
|
||||
u64 stamp0 = get_system_time();
|
||||
//u64 stamp0 = get_system_time();
|
||||
|
||||
memset(mixdata, 0, sizeof(mixdata));
|
||||
if (surMixerCb) mixerCb->ExecAsCallback(surMixerCb, true, surMixerCbArg, mixcount, 256);
|
||||
|
||||
u64 stamp1 = get_system_time();
|
||||
//u64 stamp1 = get_system_time();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mixer_mutex);
|
||||
@ -435,7 +435,7 @@ int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config)
|
||||
}
|
||||
}
|
||||
|
||||
u64 stamp2 = get_system_time();
|
||||
//u64 stamp2 = get_system_time();
|
||||
|
||||
auto buf = (be_t<float>*)&Memory[m_config.m_buffer + (128 * 1024 * SUR_PORT) + (mixcount % port.block) * port.channel * 256 * sizeof(float)];
|
||||
|
||||
@ -445,7 +445,7 @@ int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config)
|
||||
buf[i] = mixdata[i];
|
||||
}
|
||||
|
||||
u64 stamp3 = get_system_time();
|
||||
//u64 stamp3 = get_system_time();
|
||||
|
||||
//ConLog.Write("Libmixer perf: start=%lld (cb=%lld, ssp=%lld, finalize=%lld)", stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2);
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void libsnd3_init();
|
||||
Module libsnd3("libsnd3", libsnd3_init);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void libsynth2_init();
|
||||
Module libsynth2("libsynth2", libsynth2_init);
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/FS/vfsDir.h"
|
||||
#include "Crypto/unedat.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/System.h"
|
||||
#include "cellRtc.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "cellRtc.h"
|
||||
#include "sceNpCommerce2.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/FS/vfsDir.h"
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "cellRtc.h"
|
||||
#include "sceNp.h"
|
||||
|
@ -3,11 +3,18 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Emu/FS/vfsStreamMemory.h"
|
||||
#include "Emu/SysCalls/lv2/sys_spu.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_spinlock.h"
|
||||
#include "Emu/SysCalls/lv2/sys_prx.h"
|
||||
#include "Emu/SysCalls/lv2/sys_ppu_thread.h"
|
||||
#include "Emu/SysCalls/lv2/sys_process.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
#include "Emu/SysCalls/lv2/sys_mmapper.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwcond.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
#include "sysPrxForUser.h"
|
||||
|
@ -4,9 +4,10 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
|
||||
#include "Emu/SysCalls/lv2/lv2Fs.h"
|
||||
|
||||
Module *sys_fs = nullptr;
|
||||
|
||||
bool sdata_check(u32 version, u32 flags, u64 filesizeInput, u64 filesizeTmp)
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#if 0
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void sys_http_init();
|
||||
Module sys_http(0x0001, sys_http_init);
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
|
||||
//void sys_io_init();
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
|
||||
#include "sys_net.h"
|
||||
|
@ -1,10 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#define RESULT(x) SC_ARGS_1 = (x)
|
||||
#define RESULT(x) CPU.GPR[3] = (x)
|
||||
|
||||
class func_caller
|
||||
{
|
||||
@ -25,7 +23,8 @@ struct get_arg<false, false, false, T, i> // not fp, not ptr, 1..8
|
||||
template<bool is_fp, typename T, int i>
|
||||
struct get_arg<false, is_fp, true, T, i> // ptr, 1..8
|
||||
{
|
||||
static __forceinline T func(PPUThread& CPU) { return CPU.GPR[i + 2] ? (T)&Memory[CPU.GPR[i + 2]] : nullptr; }
|
||||
static_assert(i == 0, "Invalid function argument type: pointer");
|
||||
static __forceinline T func(PPUThread& CPU) { return nullptr; }
|
||||
};
|
||||
|
||||
template<bool is_in_sp, typename T, int i>
|
||||
@ -37,13 +36,14 @@ struct get_arg<is_in_sp, true, false, T, i> // fp, 1..12
|
||||
template<typename T, int i>
|
||||
struct get_arg<true, false, false, T, i> // not fp, not ptr, 9..12
|
||||
{
|
||||
static __forceinline T func(PPUThread& CPU) { u64 res = Memory.Read64(CPU.GPR[1] + 0x70 + 0x8 * (i - 9)); return (T&)res; }
|
||||
static __forceinline T func(PPUThread& CPU) { u64 res = CPU.GetStackArg(i); return (T&)res; }
|
||||
};
|
||||
|
||||
template<bool is_fp, typename T, int i>
|
||||
struct get_arg<true, is_fp, true, T, i> // ptr, 9..12
|
||||
{
|
||||
static __forceinline T func(PPUThread& CPU) { u64 addr = Memory.Read64(CPU.GPR[1] + 0x70 + 0x8 * (i - 9)); return addr ? (T)&Memory[addr] : nullptr; }
|
||||
static_assert(i == 0, "Invalid function argument type: pointer");
|
||||
static __forceinline T func(PPUThread& CPU) { return nullptr; }
|
||||
};
|
||||
|
||||
#define ARG(n) get_arg<((n) > 8), std::is_floating_point<T##n>::value, std::is_pointer<T##n>::value, T##n, n>::func(CPU)
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Static.h"
|
||||
|
||||
|
@ -5,9 +5,34 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "ModuleManager.h"
|
||||
|
||||
#include "lv2/lv2Fs.h"
|
||||
#include "lv2/sys_cond.h"
|
||||
#include "lv2/sys_event.h"
|
||||
#include "lv2/sys_event_flag.h"
|
||||
#include "lv2/sys_interrupt.h"
|
||||
#include "lv2/sys_lwcond.h"
|
||||
#include "lv2/sys_lwmutex.h"
|
||||
#include "lv2/sys_memory.h"
|
||||
#include "lv2/sys_mmapper.h"
|
||||
#include "lv2/sys_ppu_thread.h"
|
||||
#include "lv2/sys_process.h"
|
||||
#include "lv2/sys_prx.h"
|
||||
#include "lv2/sys_rsx.h"
|
||||
#include "lv2/sys_rwlock.h"
|
||||
#include "lv2/sys_semaphore.h"
|
||||
#include "lv2/sys_spinlock.h"
|
||||
#include "lv2/sys_spu.h"
|
||||
#include "lv2/sys_time.h"
|
||||
#include "lv2/sys_timer.h"
|
||||
#include "lv2/sys_trace.h"
|
||||
#include "lv2/sys_tty.h"
|
||||
#include "lv2/sys_vm.h"
|
||||
|
||||
#include "SysCalls.h"
|
||||
|
||||
namespace detail{
|
||||
template<> bool CheckId(u32 id, ID*& _id,const std::string &name)
|
||||
{
|
||||
@ -20,6 +45,8 @@ static func_caller *null_func = bind_func(default_syscall);
|
||||
|
||||
static const int kSyscallTableLength = 1024;
|
||||
|
||||
extern int cellGcmCallback(u32 context_addr, u32 count);
|
||||
|
||||
// UNS = Unused
|
||||
// ROOT = Root
|
||||
// DBG = Debug
|
||||
|
@ -1,39 +1,9 @@
|
||||
#pragma once
|
||||
#include "ErrorCodes.h"
|
||||
#include "Static.h"
|
||||
|
||||
#include "Emu/Memory/Memory.h"
|
||||
|
||||
// Most of the headers below rely on Memory.h
|
||||
#include "lv2/lv2Fs.h"
|
||||
#include "lv2/sys_cond.h"
|
||||
#include "lv2/sys_event.h"
|
||||
#include "lv2/sys_event_flag.h"
|
||||
#include "lv2/sys_interrupt.h"
|
||||
#include "lv2/sys_lwcond.h"
|
||||
#include "lv2/sys_lwmutex.h"
|
||||
#include "lv2/sys_memory.h"
|
||||
#include "lv2/sys_mmapper.h"
|
||||
#include "lv2/sys_ppu_thread.h"
|
||||
#include "lv2/sys_process.h"
|
||||
#include "lv2/sys_prx.h"
|
||||
#include "lv2/sys_rsx.h"
|
||||
#include "lv2/sys_rwlock.h"
|
||||
#include "lv2/sys_semaphore.h"
|
||||
#include "lv2/sys_spinlock.h"
|
||||
#include "lv2/sys_spu.h"
|
||||
#include "lv2/sys_time.h"
|
||||
#include "lv2/sys_timer.h"
|
||||
#include "lv2/sys_trace.h"
|
||||
#include "lv2/sys_tty.h"
|
||||
#include "lv2/sys_vm.h"
|
||||
|
||||
#include "LogBase.h"
|
||||
|
||||
//#define SYSCALLS_DEBUG
|
||||
|
||||
#define declCPU PPUThread& CPU = GetCurrentPPUThread
|
||||
|
||||
class SysCallBase;
|
||||
|
||||
namespace detail{
|
||||
@ -84,42 +54,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//cellGcm (used as lv2 syscall #1023)
|
||||
extern int cellGcmCallback(u32 context_addr, u32 count);
|
||||
|
||||
|
||||
#define UNIMPLEMENTED_FUNC(module) module->Todo("%s", __FUNCTION__)
|
||||
|
||||
#define SC_ARG_0 CPU.GPR[3]
|
||||
#define SC_ARG_1 CPU.GPR[4]
|
||||
#define SC_ARG_2 CPU.GPR[5]
|
||||
#define SC_ARG_3 CPU.GPR[6]
|
||||
#define SC_ARG_4 CPU.GPR[7]
|
||||
#define SC_ARG_5 CPU.GPR[8]
|
||||
#define SC_ARG_6 CPU.GPR[9]
|
||||
#define SC_ARG_7 CPU.GPR[10]
|
||||
/* // these definitions are wrong:
|
||||
#define SC_ARG_8 CPU.GPR[11]
|
||||
#define SC_ARG_9 CPU.GPR[12]
|
||||
#define SC_ARG_10 CPU.GPR[13]
|
||||
#define SC_ARG_11 CPU.GPR[14]
|
||||
*/
|
||||
|
||||
#define SC_ARGS_1 SC_ARG_0
|
||||
#define SC_ARGS_2 SC_ARGS_1,SC_ARG_1
|
||||
#define SC_ARGS_3 SC_ARGS_2,SC_ARG_2
|
||||
#define SC_ARGS_4 SC_ARGS_3,SC_ARG_3
|
||||
#define SC_ARGS_5 SC_ARGS_4,SC_ARG_4
|
||||
#define SC_ARGS_6 SC_ARGS_5,SC_ARG_5
|
||||
#define SC_ARGS_7 SC_ARGS_6,SC_ARG_6
|
||||
#define SC_ARGS_8 SC_ARGS_7,SC_ARG_7
|
||||
/*
|
||||
#define SC_ARGS_9 SC_ARGS_8,SC_ARG_8
|
||||
#define SC_ARGS_10 SC_ARGS_9,SC_ARG_9
|
||||
#define SC_ARGS_11 SC_ARGS_10,SC_ARG_10
|
||||
#define SC_ARGS_12 SC_ARGS_11,SC_ARG_11
|
||||
*/
|
||||
|
||||
extern bool dump_enable;
|
||||
|
||||
class SysCalls
|
||||
@ -128,9 +62,3 @@ public:
|
||||
static void DoSyscall(u32 code);
|
||||
static std::string GetHLEFuncName(const u32 fid);
|
||||
};
|
||||
|
||||
#define REG_SUB(module, group, name, ...) \
|
||||
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
|
||||
module->AddFuncSub(group, name ## _table, #name, name)
|
||||
|
||||
#define REG_FUNC(module, name) module->AddFunc(getFunctionId(#name), name)
|
||||
|
@ -1,15 +1,12 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
//#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Emu/FS/vfsDir.h"
|
||||
|
||||
#include "lv2Fs.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
extern Module *sys_fs;
|
||||
|
||||
@ -112,7 +109,7 @@ s32 cellFsOpen(u32 path_addr, s32 flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
}
|
||||
|
||||
fd = sys_fs->GetNewId(stream, TYPE_FS_FILE);
|
||||
LOG_NOTICE(HLE, "\"%s\" opened: fd = %d", path.c_str(), fd.GetValue());
|
||||
sys_fs->Notice("\"%s\" opened: fd = %d", path.c_str(), fd.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_cond.h"
|
||||
|
||||
SysCallBase sys_cond("sys_cond");
|
||||
@ -74,13 +73,13 @@ s32 sys_cond_signal(u32 cond_id)
|
||||
|
||||
if (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop()))
|
||||
{
|
||||
cond->signal_stamp = get_system_time();
|
||||
//cond->signal_stamp = get_system_time();
|
||||
cond->signal.lock(target);
|
||||
Emu.GetCPU().NotifyThread(target);
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_cond_signal(id=%d) aborted", cond_id);
|
||||
sys_cond.Warning("sys_cond_signal(id=%d) aborted", cond_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,13 +101,13 @@ s32 sys_cond_signal_all(u32 cond_id)
|
||||
while (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop()))
|
||||
{
|
||||
cond->signaler = GetCurrentCPUThread()->GetId();
|
||||
cond->signal_stamp = get_system_time();
|
||||
//cond->signal_stamp = get_system_time();
|
||||
cond->signal.lock(target);
|
||||
Emu.GetCPU().NotifyThread(target);
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_cond_signal_all(id=%d) aborted", cond_id);
|
||||
sys_cond.Warning("sys_cond_signal_all(id=%d) aborted", cond_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -141,14 +140,14 @@ s32 sys_cond_signal_to(u32 cond_id, u32 thread_id)
|
||||
|
||||
u32 target = thread_id;
|
||||
{
|
||||
cond->signal_stamp = get_system_time();
|
||||
//cond->signal_stamp = get_system_time();
|
||||
cond->signal.lock(target);
|
||||
Emu.GetCPU().NotifyThread(target);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_cond_signal_to(id=%d, to=%d) aborted", cond_id, thread_id);
|
||||
sys_cond.Warning("sys_cond_signal_to(id=%d, to=%d) aborted", cond_id, thread_id);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
@ -189,7 +188,7 @@ s32 sys_cond_wait(u32 cond_id, u64 timeout)
|
||||
{
|
||||
if (cond->signal.unlock(tid, tid) == SMR_OK)
|
||||
{
|
||||
const u64 stamp2 = get_system_time();
|
||||
//const u64 stamp2 = get_system_time();
|
||||
if (SMutexResult res = mutex->m_mutex.trylock(tid))
|
||||
{
|
||||
if (res != SMR_FAILED)
|
||||
@ -231,6 +230,6 @@ s32 sys_cond_wait(u32 cond_id, u64 timeout)
|
||||
}
|
||||
|
||||
abort:
|
||||
LOG_WARNING(HLE, "sys_cond_wait(id=%d) aborted", cond_id);
|
||||
sys_cond.Warning("sys_cond_wait(id=%d) aborted", cond_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "sys_process.h"
|
||||
#include "sys_event.h"
|
||||
|
||||
SysCallBase sys_event("sys_event");
|
||||
@ -235,7 +237,7 @@ s32 sys_event_port_create(mem32_t eport_id, int port_type, u64 name)
|
||||
|
||||
EventPort* eport = new EventPort();
|
||||
u32 id = sys_event.GetNewId(eport, TYPE_EVENT_PORT);
|
||||
eport->name = name ? name : ((u64)sys_process_getpid() << 32) | (u64)id;
|
||||
eport->name = name ? name : ((u64)process_getpid() << 32) | (u64)id;
|
||||
eport_id = id;
|
||||
sys_event.Warning("*** sys_event_port created: id = %d", id);
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_event_flag.h"
|
||||
|
||||
SysCallBase sys_event_flag("sys_event_flag");
|
||||
@ -215,7 +214,7 @@ s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
|
||||
}
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_wait(id=%d) aborted", eflag_id);
|
||||
sys_event_flag.Warning("sys_event_flag_wait(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
@ -334,7 +333,7 @@ s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_cancel(id=%d) aborted", eflag_id);
|
||||
sys_event_flag.Warning("sys_event_flag_cancel(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_interrupt.h"
|
||||
|
||||
static SysCallBase sc_int("sys_interrupt");
|
||||
static SysCallBase sys_interrupt("sys_interrupt");
|
||||
|
||||
s32 sys_interrupt_tag_destroy(u32 intrtag)
|
||||
{
|
||||
sc_int.Warning("sys_interrupt_tag_destroy(intrtag=%d)", intrtag);
|
||||
sys_interrupt.Warning("sys_interrupt_tag_destroy(intrtag=%d)", intrtag);
|
||||
|
||||
u32 id = intrtag & 0xff;
|
||||
u32 class_id = intrtag >> 8;
|
||||
@ -39,7 +38,7 @@ s32 sys_interrupt_tag_destroy(u32 intrtag)
|
||||
|
||||
s32 sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64 arg)
|
||||
{
|
||||
sc_int.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.GetAddr(), intrtag, intrthread, arg);
|
||||
sys_interrupt.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.GetAddr(), intrtag, intrthread, arg);
|
||||
|
||||
u32 id = intrtag & 0xff;
|
||||
u32 class_id = intrtag >> 8;
|
||||
@ -78,7 +77,7 @@ s32 sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64
|
||||
|
||||
s32 sys_interrupt_thread_disestablish(u32 ih)
|
||||
{
|
||||
sc_int.Todo("sys_interrupt_thread_disestablish(ih=%d)", ih);
|
||||
sys_interrupt.Todo("sys_interrupt_thread_disestablish(ih=%d)", ih);
|
||||
|
||||
CPUThread* it = Emu.GetCPU().GetThread(ih);
|
||||
if (!it)
|
||||
@ -98,7 +97,7 @@ s32 sys_interrupt_thread_disestablish(u32 ih)
|
||||
|
||||
void sys_interrupt_thread_eoi()
|
||||
{
|
||||
sc_int.Log("sys_interrupt_thread_eoi()");
|
||||
sys_interrupt.Log("sys_interrupt_thread_eoi()");
|
||||
|
||||
GetCurrentPPUThread().FastStop();
|
||||
return;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_lwcond.h"
|
||||
|
||||
@ -63,7 +63,7 @@ s32 sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_lwcond_signal(id=%d) aborted", (u32)lwcond->lwcond_queue);
|
||||
sys_lwcond.Warning("sys_lwcond_signal(id=%d) aborted", (u32)lwcond->lwcond_queue);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ s32 sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_lwcond_signal_all(id=%d) aborted", (u32)lwcond->lwcond_queue);
|
||||
sys_lwcond.Warning("sys_lwcond_signal_all(id=%d) aborted", (u32)lwcond->lwcond_queue);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ s32 sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_lwcond_signal_to(id=%d, to=%d) aborted", (u32)lwcond->lwcond_queue, ppu_thread_id);
|
||||
sys_lwcond.Warning("sys_lwcond_signal_to(id=%d, to=%d) aborted", (u32)lwcond->lwcond_queue, ppu_thread_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
@ -213,6 +213,6 @@ s32 sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||
}
|
||||
|
||||
abort:
|
||||
LOG_WARNING(HLE, "sys_lwcond_wait(id=%d) aborted", (u32)lwcond->lwcond_queue);
|
||||
sys_lwcond.Warning("sys_lwcond_wait(id=%d) aborted", (u32)lwcond->lwcond_queue);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -1,32 +1,34 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_lwmutex.h"
|
||||
|
||||
SysCallBase sc_lwmutex("sys_lwmutex");
|
||||
SysCallBase sys_lwmutex("sys_lwmutex");
|
||||
|
||||
// TODO: move SleepQueue somewhere
|
||||
|
||||
s32 sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_attribute_t> attr)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_create(lwmutex_addr=0x%x, lwmutex_attr_addr=0x%x)",
|
||||
sys_lwmutex.Log("sys_lwmutex_create(lwmutex_addr=0x%x, lwmutex_attr_addr=0x%x)",
|
||||
lwmutex.GetAddr(), attr.GetAddr());
|
||||
|
||||
switch (attr->attr_recursive.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_RECURSIVE): break;
|
||||
case se32(SYS_SYNC_NOT_RECURSIVE): break;
|
||||
default: sc_lwmutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->attr_recursive); return CELL_EINVAL;
|
||||
default: sys_lwmutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->attr_recursive); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (attr->attr_protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
case se32(SYS_SYNC_RETRY): break;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sc_lwmutex.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_lwmutex.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL;
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
default: sc_lwmutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->attr_protocol); return CELL_EINVAL;
|
||||
default: sys_lwmutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->attr_protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
lwmutex->attribute = attr->attr_protocol | attr->attr_recursive;
|
||||
@ -36,10 +38,10 @@ s32 sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
||||
lwmutex->pad = 0;
|
||||
lwmutex->recursive_count = 0;
|
||||
|
||||
u32 sq_id = sc_lwmutex.GetNewId(new SleepQueue(attr->name_u64), TYPE_LWMUTEX);
|
||||
u32 sq_id = sys_lwmutex.GetNewId(new SleepQueue(attr->name_u64), TYPE_LWMUTEX);
|
||||
lwmutex->sleep_queue = sq_id;
|
||||
|
||||
sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d",
|
||||
sys_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id);
|
||||
|
||||
return CELL_OK;
|
||||
@ -47,7 +49,7 @@ s32 sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
||||
|
||||
s32 sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Warning("sys_lwmutex_destroy(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
sys_lwmutex.Warning("sys_lwmutex_destroy(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
u32 sq_id = lwmutex->sleep_queue;
|
||||
if (!Emu.GetIdManager().CheckID(sq_id)) return CELL_ESRCH;
|
||||
@ -66,7 +68,7 @@ s32 sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
|
||||
s32 sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_lock(lwmutex_addr=0x%x, timeout=%lld)", lwmutex.GetAddr(), timeout);
|
||||
sys_lwmutex.Log("sys_lwmutex_lock(lwmutex_addr=0x%x, timeout=%lld)", lwmutex.GetAddr(), timeout);
|
||||
|
||||
//ConLog.Write("*** lock mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
|
||||
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
|
||||
@ -76,14 +78,14 @@ s32 sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
|
||||
|
||||
s32 sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_trylock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
sys_lwmutex.Log("sys_lwmutex_trylock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
return lwmutex->trylock(be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId()));
|
||||
}
|
||||
|
||||
s32 sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_unlock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
sys_lwmutex.Log("sys_lwmutex_unlock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
//ConLog.Write("*** unlocking mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
|
||||
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, (u32)lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
|
||||
@ -158,7 +160,7 @@ u32 SleepQueue::pop_prio() // SYS_SYNC_PRIORITY
|
||||
|
||||
u32 SleepQueue::pop_prio_inherit() // (TODO)
|
||||
{
|
||||
LOG_ERROR(HLE, "TODO: SleepQueue::pop_prio_inherit()");
|
||||
sys_lwmutex.Error("TODO: SleepQueue::pop_prio_inherit()");
|
||||
Emu.Pause();
|
||||
return 0;
|
||||
}
|
||||
@ -278,7 +280,7 @@ int sys_lwmutex_t::unlock(be_t<u32> tid)
|
||||
{
|
||||
if (!recursive_count || (recursive_count.ToBE() != se32(1) && (attribute.ToBE() & se32(SYS_SYNC_NOT_RECURSIVE))))
|
||||
{
|
||||
sc_lwmutex.Error("sys_lwmutex_t::unlock(%d): wrong recursive value fixed (%d)", (u32)sleep_queue, (u32)recursive_count);
|
||||
sys_lwmutex.Error("sys_lwmutex_t::unlock(%d): wrong recursive value fixed (%d)", (u32)sleep_queue, (u32)recursive_count);
|
||||
recursive_count = 1;
|
||||
}
|
||||
recursive_count -= 1;
|
||||
@ -329,7 +331,7 @@ int sys_lwmutex_t::lock(be_t<u32> tid, u64 timeout)
|
||||
case SMR_TIMEOUT:
|
||||
sq->invalidate(tid); return CELL_ETIMEDOUT;
|
||||
case SMR_ABORT:
|
||||
if (Emu.IsStopped()) LOG_WARNING(HLE, "sys_lwmutex_t::lock(sq=%d) aborted", (u32)sleep_queue);
|
||||
if (Emu.IsStopped()) sys_lwmutex.Warning("sys_lwmutex_t::lock(sq=%d) aborted", (u32)sleep_queue);
|
||||
default:
|
||||
sq->invalidate(tid); return CELL_EINVAL;
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "sys_memory.h"
|
||||
#include <map>
|
||||
|
||||
SysCallBase sc_mem("memory");
|
||||
SysCallBase sys_memory("sys_memory");
|
||||
|
||||
s32 sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_allocate(size=0x%x, flags=0x%x)", size, flags);
|
||||
sys_memory.Log("sys_memory_allocate(size=0x%x, flags=0x%x)", size, flags);
|
||||
|
||||
// Check page size.
|
||||
u32 addr;
|
||||
@ -33,7 +33,7 @@ s32 sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
sc_mem.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", addr, size);
|
||||
sys_memory.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", addr, size);
|
||||
Memory.Write32(alloc_addr_addr, addr);
|
||||
|
||||
return CELL_OK;
|
||||
@ -41,11 +41,11 @@ s32 sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr)
|
||||
|
||||
s32 sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_addr_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_allocate_from_container(size=0x%x, cid=0x%x, flags=0x%x)", size, cid, flags);
|
||||
sys_memory.Log("sys_memory_allocate_from_container(size=0x%x, cid=0x%x, flags=0x%x)", size, cid, flags);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
if (!sys_memory.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Check page size.
|
||||
@ -70,7 +70,7 @@ s32 sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_a
|
||||
ct->size = size;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
sc_mem.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", ct->addr, ct->size);
|
||||
sys_memory.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", ct->addr, ct->size);
|
||||
Memory.Write32(alloc_addr_addr, ct->addr);
|
||||
|
||||
return CELL_OK;
|
||||
@ -78,7 +78,7 @@ s32 sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_a
|
||||
|
||||
s32 sys_memory_free(u32 start_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_free(start_addr=0x%x)", start_addr);
|
||||
sys_memory.Log("sys_memory_free(start_addr=0x%x)", start_addr);
|
||||
|
||||
// Release the allocated memory.
|
||||
if(!Memory.Free(start_addr))
|
||||
@ -89,7 +89,7 @@ s32 sys_memory_free(u32 start_addr)
|
||||
|
||||
s32 sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_page_attribute(addr=0x%x, attr_addr=0x%x)", addr, attr.GetAddr());
|
||||
sys_memory.Warning("sys_memory_get_page_attribute(addr=0x%x, attr_addr=0x%x)", addr, attr.GetAddr());
|
||||
|
||||
// TODO: Implement per thread page attribute setting.
|
||||
attr->attribute = 0;
|
||||
@ -102,7 +102,7 @@ s32 sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
|
||||
|
||||
s32 sys_memory_get_user_memory_size(mem_ptr_t<sys_memory_info_t> mem_info)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info.GetAddr());
|
||||
sys_memory.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info.GetAddr());
|
||||
|
||||
// Fetch the user memory available.
|
||||
mem_info->total_user_memory = Memory.GetUserMemTotalSize();
|
||||
@ -112,7 +112,7 @@ s32 sys_memory_get_user_memory_size(mem_ptr_t<sys_memory_info_t> mem_info)
|
||||
|
||||
s32 sys_memory_container_create(mem32_t cid, u32 yield_size)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.GetAddr(), yield_size);
|
||||
sys_memory.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.GetAddr(), yield_size);
|
||||
|
||||
yield_size &= ~0xfffff; //round down to 1 MB granularity
|
||||
u64 addr = Memory.Alloc(yield_size, 0x100000); //1 MB alignment
|
||||
@ -122,20 +122,20 @@ s32 sys_memory_container_create(mem32_t cid, u32 yield_size)
|
||||
|
||||
// Wrap the allocated memory in a memory container.
|
||||
MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size);
|
||||
cid = sc_mem.GetNewId(ct, TYPE_MEM);
|
||||
cid = sys_memory.GetNewId(ct, TYPE_MEM);
|
||||
|
||||
sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
|
||||
sys_memory.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_container_destroy(u32 cid)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_destroy(cid=%d)", cid);
|
||||
sys_memory.Warning("sys_memory_container_destroy(cid=%d)", cid);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
if (!sys_memory.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Release the allocated memory and remove the ID.
|
||||
@ -147,11 +147,11 @@ s32 sys_memory_container_destroy(u32 cid)
|
||||
|
||||
s32 sys_memory_container_get_size(mem_ptr_t<sys_memory_info_t> mem_info, u32 cid)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_get_size(mem_info_addr=0x%x, cid=%d)", mem_info.GetAddr(), cid);
|
||||
sys_memory.Warning("sys_memory_container_get_size(mem_info_addr=0x%x, cid=%d)", mem_info.GetAddr(), cid);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
if (!sys_memory.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// HACK: Return all memory.
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "sys_memory.h"
|
||||
#include "sys_mmapper.h"
|
||||
#include <map>
|
||||
|
@ -1,26 +1,25 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Utilities/SMutex.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_mutex.h"
|
||||
|
||||
SysCallBase sys_mtx("sys_mutex");
|
||||
SysCallBase sys_mutex("sys_mutex");
|
||||
|
||||
Mutex::~Mutex()
|
||||
{
|
||||
if (u32 owner = m_mutex.GetOwner())
|
||||
{
|
||||
LOG_NOTICE(HLE, "Mutex(%d) was owned by thread %d (recursive=%d)", id, owner, recursive);
|
||||
sys_mutex.Notice("Mutex(%d) was owned by thread %d (recursive=%d)", id, owner, recursive);
|
||||
}
|
||||
|
||||
if (!m_queue.m_mutex.try_lock()) return;
|
||||
|
||||
for (u32 i = 0; i < m_queue.list.size(); i++)
|
||||
{
|
||||
if (u32 owner = m_queue.list[i]) LOG_NOTICE(HLE, "Mutex(%d) was waited by thread %d", id, owner);
|
||||
if (u32 owner = m_queue.list[i]) sys_mutex.Notice("Mutex(%d) was waited by thread %d", id, owner);
|
||||
}
|
||||
|
||||
m_queue.m_mutex.unlock();
|
||||
@ -28,15 +27,15 @@ Mutex::~Mutex()
|
||||
|
||||
s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr());
|
||||
sys_mutex.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr());
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mtx.Todo("sys_mutex_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
|
||||
case se32(SYS_SYNC_RETRY): sys_mtx.Error("sys_mutex_create(): SYS_SYNC_RETRY"); return CELL_EINVAL;
|
||||
default: sys_mtx.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mutex.Todo("sys_mutex_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
|
||||
case se32(SYS_SYNC_RETRY): sys_mutex.Error("sys_mutex_create(): SYS_SYNC_RETRY"); return CELL_EINVAL;
|
||||
default: sys_mutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
bool is_recursive;
|
||||
@ -44,23 +43,23 @@ s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||
{
|
||||
case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break;
|
||||
case se32(SYS_SYNC_NOT_RECURSIVE): is_recursive = false; break;
|
||||
default: sys_mtx.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
|
||||
default: sys_mutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
sys_mtx.Error("Unknown pshared attribute(0x%x)", (u32)attr->pshared);
|
||||
sys_mutex.Error("Unknown pshared attribute(0x%x)", (u32)attr->pshared);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
Mutex* mutex = new Mutex((u32)attr->protocol, is_recursive, attr->name_u64);
|
||||
u32 id = sys_mtx.GetNewId(mutex, TYPE_MUTEX);
|
||||
u32 id = sys_mutex.GetNewId(mutex, TYPE_MUTEX);
|
||||
mutex->m_mutex.lock(tid);
|
||||
mutex->id = id;
|
||||
mutex_id = id;
|
||||
mutex->m_mutex.unlock(tid);
|
||||
sys_mtx.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d",
|
||||
sys_mutex.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32) attr->protocol,
|
||||
(is_recursive ? "true" : "false"), mutex_id.GetValue());
|
||||
|
||||
@ -71,7 +70,7 @@ s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||
|
||||
s32 sys_mutex_destroy(u32 mutex_id)
|
||||
{
|
||||
sys_mtx.Warning("sys_mutex_destroy(mutex_id=%d)", mutex_id);
|
||||
sys_mutex.Warning("sys_mutex_destroy(mutex_id=%d)", mutex_id);
|
||||
|
||||
Mutex* mutex;
|
||||
if (!Emu.GetIdManager().GetIDData(mutex_id, mutex))
|
||||
@ -104,7 +103,7 @@ s32 sys_mutex_destroy(u32 mutex_id)
|
||||
|
||||
s32 sys_mutex_lock(u32 mutex_id, u64 timeout)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_lock(mutex_id=%d, timeout=%lld)", mutex_id, timeout);
|
||||
sys_mutex.Log("sys_mutex_lock(mutex_id=%d, timeout=%lld)", mutex_id, timeout);
|
||||
|
||||
Mutex* mutex;
|
||||
if (!Emu.GetIdManager().GetIDData(mutex_id, mutex))
|
||||
@ -137,7 +136,7 @@ s32 sys_mutex_lock(u32 mutex_id, u64 timeout)
|
||||
}
|
||||
else
|
||||
{
|
||||
sys_mtx.Error("sys_mutex_lock(%d): deadlock on invalid thread(%d)", mutex_id, owner);
|
||||
sys_mutex.Error("sys_mutex_lock(%d): deadlock on invalid thread(%d)", mutex_id, owner);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +164,7 @@ s32 sys_mutex_lock(u32 mutex_id, u64 timeout)
|
||||
abort:
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
sys_mtx.Warning("sys_mutex_lock(id=%d) aborted", mutex_id);
|
||||
sys_mutex.Warning("sys_mutex_lock(id=%d) aborted", mutex_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_ESRCH;
|
||||
@ -173,7 +172,7 @@ abort:
|
||||
|
||||
s32 sys_mutex_trylock(u32 mutex_id)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_trylock(mutex_id=%d)", mutex_id);
|
||||
sys_mutex.Log("sys_mutex_trylock(mutex_id=%d)", mutex_id);
|
||||
|
||||
Mutex* mutex;
|
||||
if (!Emu.GetIdManager().GetIDData(mutex_id, mutex))
|
||||
@ -206,7 +205,7 @@ s32 sys_mutex_trylock(u32 mutex_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
sys_mtx.Error("sys_mutex_trylock(%d): deadlock on invalid thread(%d)", mutex_id, owner);
|
||||
sys_mutex.Error("sys_mutex_trylock(%d): deadlock on invalid thread(%d)", mutex_id, owner);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +219,7 @@ s32 sys_mutex_trylock(u32 mutex_id)
|
||||
|
||||
s32 sys_mutex_unlock(u32 mutex_id)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_unlock(mutex_id=%d)", mutex_id);
|
||||
sys_mutex.Log("sys_mutex_unlock(mutex_id=%d)", mutex_id);
|
||||
|
||||
Mutex* mutex;
|
||||
if (!Emu.GetIdManager().GetIDData(mutex_id, mutex))
|
||||
@ -235,7 +234,7 @@ s32 sys_mutex_unlock(u32 mutex_id)
|
||||
{
|
||||
if (!mutex->recursive || (mutex->recursive != 1 && !mutex->is_recursive))
|
||||
{
|
||||
sys_mtx.Error("sys_mutex_unlock(%d): wrong recursive value fixed (%d)", mutex_id, mutex->recursive);
|
||||
sys_mutex.Error("sys_mutex_unlock(%d): wrong recursive value fixed (%d)", mutex_id, mutex->recursive);
|
||||
mutex->recursive = 1;
|
||||
}
|
||||
mutex->recursive--;
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_ppu_thread.h"
|
||||
|
||||
extern Module *sysPrxForUser;
|
||||
static SysCallBase sys_ppu_thread("sys_ppu_thread");
|
||||
|
||||
static const u32 PPU_THREAD_ID_INVALID = 0xFFFFFFFFU/*UUUUUUUUUUuuuuuuuuuu~~~~~~~~*/;
|
||||
|
||||
@ -19,7 +17,7 @@ void ppu_thread_exit(u64 errorcode)
|
||||
|
||||
if (thr.owned_mutexes)
|
||||
{
|
||||
LOG_ERROR(PPU, "Owned mutexes found (%d)", thr.owned_mutexes);
|
||||
sys_ppu_thread.Error("Owned mutexes found (%d)", thr.owned_mutexes);
|
||||
thr.owned_mutexes = 0;
|
||||
}
|
||||
|
||||
@ -29,21 +27,21 @@ void ppu_thread_exit(u64 errorcode)
|
||||
|
||||
void sys_ppu_thread_exit(u64 errorcode)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_exit(0x%llx)", errorcode);
|
||||
sys_ppu_thread.Log("sys_ppu_thread_exit(0x%llx)", errorcode);
|
||||
|
||||
ppu_thread_exit(errorcode);
|
||||
}
|
||||
|
||||
void sys_internal_ppu_thread_exit(u64 errorcode)
|
||||
{
|
||||
sysPrxForUser->Log("sys_internal_ppu_thread_exit(0x%llx)", errorcode);
|
||||
sys_ppu_thread.Log("sys_internal_ppu_thread_exit(0x%llx)", errorcode);
|
||||
|
||||
ppu_thread_exit(errorcode);
|
||||
}
|
||||
|
||||
s32 sys_ppu_thread_yield()
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_yield()");
|
||||
sys_ppu_thread.Log("sys_ppu_thread_yield()");
|
||||
// Note: Or do we actually want to yield?
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
return CELL_OK;
|
||||
@ -51,7 +49,7 @@ s32 sys_ppu_thread_yield()
|
||||
|
||||
s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.GetAddr());
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.GetAddr());
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
@ -60,7 +58,7 @@ s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(PPU, "sys_ppu_thread_join(%d) aborted", thread_id);
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_join(%d) aborted", thread_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
@ -72,7 +70,7 @@ s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
|
||||
|
||||
s32 sys_ppu_thread_detach(u64 thread_id)
|
||||
{
|
||||
sysPrxForUser->Todo("sys_ppu_thread_detach(thread_id=%lld)", thread_id);
|
||||
sys_ppu_thread.Todo("sys_ppu_thread_detach(thread_id=%lld)", thread_id);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
@ -86,13 +84,13 @@ s32 sys_ppu_thread_detach(u64 thread_id)
|
||||
|
||||
void sys_ppu_thread_get_join_state(u32 isjoinable_addr)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_get_join_state(isjoinable_addr=0x%x)", isjoinable_addr);
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_get_join_state(isjoinable_addr=0x%x)", isjoinable_addr);
|
||||
Memory.Write32(isjoinable_addr, GetCurrentPPUThread().IsJoinable());
|
||||
}
|
||||
|
||||
s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_set_priority(thread_id=%lld, prio=%d)", thread_id, prio);
|
||||
sys_ppu_thread.Log("sys_ppu_thread_set_priority(thread_id=%lld, prio=%d)", thread_id, prio);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
@ -104,7 +102,7 @@ s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio)
|
||||
|
||||
s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_priority(thread_id=%lld, prio_addr=0x%x)", thread_id, prio_addr);
|
||||
sys_ppu_thread.Log("sys_ppu_thread_get_priority(thread_id=%lld, prio_addr=0x%x)", thread_id, prio_addr);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
@ -116,7 +114,7 @@ s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
|
||||
|
||||
s32 sys_ppu_thread_get_stack_information(u32 info_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_stack_information(info_addr=0x%x)", info_addr);
|
||||
sys_ppu_thread.Log("sys_ppu_thread_get_stack_information(info_addr=0x%x)", info_addr);
|
||||
|
||||
declCPU();
|
||||
|
||||
@ -128,7 +126,7 @@ s32 sys_ppu_thread_get_stack_information(u32 info_addr)
|
||||
|
||||
s32 sys_ppu_thread_stop(u64 thread_id)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_stop(thread_id=%lld)", thread_id);
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_stop(thread_id=%lld)", thread_id);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
@ -140,7 +138,7 @@ s32 sys_ppu_thread_stop(u64 thread_id)
|
||||
|
||||
s32 sys_ppu_thread_restart(u64 thread_id)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_restart(thread_id=%lld)", thread_id);
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_restart(thread_id=%lld)", thread_id);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
@ -156,7 +154,7 @@ s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 s
|
||||
std::string threadname = "";
|
||||
if (threadname_addr) threadname = Memory.ReadString(threadname_addr);
|
||||
|
||||
sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
|
||||
sys_ppu_thread.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
|
||||
thread_id.GetAddr(), entry, arg, prio, stacksize, flags, threadname_addr, threadname.c_str());
|
||||
|
||||
bool is_joinable = false;
|
||||
@ -175,7 +173,7 @@ s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 s
|
||||
is_interrupt = true;
|
||||
break;
|
||||
}
|
||||
default: sysPrxForUser->Error("sys_ppu_thread_create(): unknown flags value (0x%llx)", flags); return CELL_EPERM;
|
||||
default: sys_ppu_thread.Error("sys_ppu_thread_create(): unknown flags value (0x%llx)", flags); return CELL_EPERM;
|
||||
}
|
||||
|
||||
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
@ -190,7 +188,7 @@ s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 s
|
||||
new_thread.m_is_interrupt = is_interrupt;
|
||||
new_thread.SetName(threadname);
|
||||
|
||||
LOG_NOTICE(PPU, "*** New PPU Thread [%s] (flags=0x%llx, entry=0x%x): id = %d", new_thread.GetName().c_str(), flags, entry, new_thread.GetId());
|
||||
sys_ppu_thread.Notice("*** New PPU Thread [%s] (flags=0x%llx, entry=0x%x): id = %d", new_thread.GetName().c_str(), flags, entry, new_thread.GetId());
|
||||
|
||||
if (!is_interrupt)
|
||||
{
|
||||
@ -203,23 +201,18 @@ s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 s
|
||||
|
||||
void sys_ppu_thread_once(mem_ptr_t<std::atomic<be_t<u32>>> once_ctrl, u32 entry)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_once(once_ctrl_addr=0x%x, entry=0x%x)", once_ctrl.GetAddr(), entry);
|
||||
sys_ppu_thread.Warning("sys_ppu_thread_once(once_ctrl_addr=0x%x, entry=0x%x)", once_ctrl.GetAddr(), entry);
|
||||
|
||||
be_t<u32> old = be_t<u32>::MakeFromBE(se32(SYS_PPU_THREAD_ONCE_INIT));
|
||||
if (once_ctrl->compare_exchange_weak(old, be_t<u32>::MakeFromBE(se32(SYS_PPU_THREAD_DONE_INIT))))
|
||||
{
|
||||
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
new_thread.SetEntry(entry);
|
||||
new_thread.Run();
|
||||
new_thread.Exec();
|
||||
|
||||
while (new_thread.IsAlive()) SM_Sleep();
|
||||
GetCurrentPPUThread().FastCall2(Memory.Read32(entry), Memory.Read32(entry + 4));
|
||||
}
|
||||
}
|
||||
|
||||
s32 sys_ppu_thread_get_id(const u32 id_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_id(id_addr=0x%x)", id_addr);
|
||||
sys_ppu_thread.Log("sys_ppu_thread_get_id(id_addr=0x%x)", id_addr);
|
||||
|
||||
Memory.Write64(id_addr, GetCurrentPPUThread().GetId());
|
||||
return CELL_OK;
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "sys_process.h"
|
||||
#include "rpcs3.h"
|
||||
|
||||
SysCallBase sc_p("Process");
|
||||
SysCallBase sys_process("sys_process");
|
||||
|
||||
s32 process_getpid()
|
||||
{
|
||||
@ -16,21 +16,21 @@ s32 process_getpid()
|
||||
|
||||
s32 sys_process_getpid()
|
||||
{
|
||||
sc_p.Log("sys_process_getpid() -> 1");
|
||||
sys_process.Log("sys_process_getpid() -> 1");
|
||||
return process_getpid();
|
||||
}
|
||||
|
||||
s32 sys_process_getppid()
|
||||
{
|
||||
sc_p.Todo("sys_process_getppid() -> 0");
|
||||
sys_process.Todo("sys_process_getppid() -> 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sys_process_exit(s32 errorcode)
|
||||
{
|
||||
sc_p.Warning("sys_process_exit(%d)", errorcode);
|
||||
sys_process.Warning("sys_process_exit(%d)", errorcode);
|
||||
Emu.Pause();
|
||||
LOG_SUCCESS(HLE, "Process finished");
|
||||
sys_process.Success("Process finished");
|
||||
wxGetApp().CallAfter([]()
|
||||
{
|
||||
Emu.Stop();
|
||||
@ -51,14 +51,14 @@ void sys_game_process_exitspawn(
|
||||
u32 prio,
|
||||
u64 flags )
|
||||
{
|
||||
sc_p.Todo("sys_game_process_exitspawn()");
|
||||
sc_p.Warning("path: %s", Memory.ReadString(path_addr).c_str());
|
||||
sc_p.Warning("argv: 0x%x", argv_addr);
|
||||
sc_p.Warning("envp: 0x%x", envp_addr);
|
||||
sc_p.Warning("data: 0x%x", data_addr);
|
||||
sc_p.Warning("data_size: 0x%x", data_size);
|
||||
sc_p.Warning("prio: %d", prio);
|
||||
sc_p.Warning("flags: %d", flags);
|
||||
sys_process.Todo("sys_game_process_exitspawn()");
|
||||
sys_process.Warning("path: %s", Memory.ReadString(path_addr).c_str());
|
||||
sys_process.Warning("argv: 0x%x", argv_addr);
|
||||
sys_process.Warning("envp: 0x%x", envp_addr);
|
||||
sys_process.Warning("data: 0x%x", data_addr);
|
||||
sys_process.Warning("data_size: 0x%x", data_size);
|
||||
sys_process.Warning("prio: %d", prio);
|
||||
sys_process.Warning("flags: %d", flags);
|
||||
|
||||
std::string path = Memory.ReadString(path_addr);
|
||||
std::vector<std::string> argv;
|
||||
@ -78,10 +78,10 @@ void sys_game_process_exitspawn(
|
||||
}
|
||||
|
||||
for (auto &arg : argv){
|
||||
sc_p.Log("argument: %s", arg.c_str());
|
||||
sys_process.Log("argument: %s", arg.c_str());
|
||||
}
|
||||
for (auto &en : env){
|
||||
sc_p.Log("env_argument: %s", en.c_str());
|
||||
sys_process.Log("env_argument: %s", en.c_str());
|
||||
}
|
||||
//TODO: execute the file in <path> with the args in argv
|
||||
//and the environment parameters in envp and copy the data
|
||||
@ -99,14 +99,14 @@ void sys_game_process_exitspawn2(
|
||||
u32 prio,
|
||||
u64 flags)
|
||||
{
|
||||
sc_p.Todo("sys_game_process_exitspawn2");
|
||||
sc_p.Warning("path: %s", Memory.ReadString(path_addr).c_str());
|
||||
sc_p.Warning("argv: 0x%x", argv_addr);
|
||||
sc_p.Warning("envp: 0x%x", envp_addr);
|
||||
sc_p.Warning("data: 0x%x", data_addr);
|
||||
sc_p.Warning("data_size: 0x%x", data_size);
|
||||
sc_p.Warning("prio: %d", prio);
|
||||
sc_p.Warning("flags: %d", flags);
|
||||
sys_process.Todo("sys_game_process_exitspawn2");
|
||||
sys_process.Warning("path: %s", Memory.ReadString(path_addr).c_str());
|
||||
sys_process.Warning("argv: 0x%x", argv_addr);
|
||||
sys_process.Warning("envp: 0x%x", envp_addr);
|
||||
sys_process.Warning("data: 0x%x", data_addr);
|
||||
sys_process.Warning("data_size: 0x%x", data_size);
|
||||
sys_process.Warning("prio: %d", prio);
|
||||
sys_process.Warning("flags: %d", flags);
|
||||
|
||||
std::string path = Memory.ReadString(path_addr);
|
||||
std::vector<std::string> argv;
|
||||
@ -126,10 +126,10 @@ void sys_game_process_exitspawn2(
|
||||
}
|
||||
|
||||
for (auto &arg : argv){
|
||||
sc_p.Log("argument: %s", arg.c_str());
|
||||
sys_process.Log("argument: %s", arg.c_str());
|
||||
}
|
||||
for (auto &en : env){
|
||||
sc_p.Log("env_argument: %s", en.c_str());
|
||||
sys_process.Log("env_argument: %s", en.c_str());
|
||||
}
|
||||
//TODO: execute the file in <path> with the args in argv
|
||||
//and the environment parameters in envp and copy the data
|
||||
@ -140,7 +140,7 @@ void sys_game_process_exitspawn2(
|
||||
|
||||
s32 sys_process_get_number_of_object(u32 object, mem32_t nump)
|
||||
{
|
||||
sc_p.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
|
||||
sys_process.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
|
||||
object, nump.GetAddr());
|
||||
|
||||
switch(object)
|
||||
@ -175,7 +175,7 @@ s32 sys_process_get_number_of_object(u32 object, mem32_t nump)
|
||||
|
||||
s32 sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size)
|
||||
{
|
||||
sc_p.Todo("sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
|
||||
sys_process.Todo("sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
|
||||
object, buffer.GetAddr(), size, set_size.GetAddr());
|
||||
|
||||
switch(object)
|
||||
@ -219,7 +219,7 @@ s32 sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_siz
|
||||
|
||||
s32 sys_process_get_paramsfo(mem8_ptr_t buffer)
|
||||
{
|
||||
sc_p.Todo("sys_process_get_paramsfo(buffer_addr=0x%x) -> CELL_ENOENT", buffer.GetAddr());
|
||||
sys_process.Todo("sys_process_get_paramsfo(buffer_addr=0x%x) -> CELL_ENOENT", buffer.GetAddr());
|
||||
return CELL_ENOENT;
|
||||
|
||||
/*//Before uncommenting this code, we should check if it is actually working.
|
||||
@ -246,7 +246,7 @@ s32 process_get_sdk_version(u32 pid, s32& ver)
|
||||
|
||||
s32 sys_process_get_sdk_version(u32 pid, mem32_t version)
|
||||
{
|
||||
sc_p.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());
|
||||
sys_process.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());
|
||||
|
||||
s32 sdk_ver;
|
||||
s32 ret = process_get_sdk_version(pid, sdk_ver);
|
||||
@ -263,33 +263,33 @@ s32 sys_process_get_sdk_version(u32 pid, mem32_t version)
|
||||
|
||||
s32 sys_process_kill(u32 pid)
|
||||
{
|
||||
sc_p.Todo("sys_process_kill(pid=%d)", pid);
|
||||
sys_process.Todo("sys_process_kill(pid=%d)", pid);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_process_wait_for_child(u32 pid, mem32_t status, u64 unk)
|
||||
{
|
||||
sc_p.Todo("sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx",
|
||||
sys_process.Todo("sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx",
|
||||
pid, status.GetAddr(), unk);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6)
|
||||
{
|
||||
sc_p.Todo("sys_process_wait_for_child2(unk1=0x%llx, unk2=0x%llx, unk3=0x%llx, unk4=0x%llx, unk5=0x%llx, unk6=0x%llx)",
|
||||
sys_process.Todo("sys_process_wait_for_child2(unk1=0x%llx, unk2=0x%llx, unk3=0x%llx, unk4=0x%llx, unk5=0x%llx, unk6=0x%llx)",
|
||||
unk1, unk2, unk3, unk4, unk5, unk6);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_process_get_status(u64 unk)
|
||||
{
|
||||
sc_p.Todo("sys_process_get_status(unk=0x%llx)", unk);
|
||||
sys_process.Todo("sys_process_get_status(unk=0x%llx)", unk);
|
||||
//Memory.Write32(CPU.GPR[4], GetPPUThreadStatus(CPU));
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_process_detach_child(u64 unk)
|
||||
{
|
||||
sc_p.Todo("sys_process_detach_child(unk=0x%llx)", unk);
|
||||
sys_process.Todo("sys_process_detach_child(unk=0x%llx)", unk);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Crypto/unself.h"
|
||||
#include "sys_prx.h"
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "sys_rsx.h"
|
||||
|
||||
SysCallBase sys_rsx("sys_rsx");
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_rwlock.h"
|
||||
|
||||
SysCallBase sys_rwlock("sys_rwlock");
|
||||
@ -69,7 +71,7 @@ s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_rwlock_rlock(rw_lock_id=%d, ...) aborted", rw_lock_id);
|
||||
sys_rwlock.Warning("sys_rwlock_rlock(rw_lock_id=%d, ...) aborted", rw_lock_id);
|
||||
return CELL_ETIMEDOUT;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
@ -132,7 +134,7 @@ s32 sys_rwlock_wlock(u32 rw_lock_id, u64 timeout)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_rwlock_wlock(rw_lock_id=%d, ...) aborted", rw_lock_id);
|
||||
sys_rwlock.Warning("sys_rwlock_wlock(rw_lock_id=%d, ...) aborted", rw_lock_id);
|
||||
return CELL_ETIMEDOUT;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
@ -1,28 +1,29 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "sys_semaphore.h"
|
||||
#include "sys_time.h"
|
||||
//#include "Utilities/SMutex.h"
|
||||
|
||||
SysCallBase sys_sem("sys_semaphore");
|
||||
SysCallBase sys_semaphore("sys_semaphore");
|
||||
|
||||
s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count)
|
||||
{
|
||||
sys_sem.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
|
||||
sys_semaphore.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
|
||||
sem.GetAddr(), attr.GetAddr(), initial_count, max_count);
|
||||
|
||||
if (max_count <= 0 || initial_count > max_count || initial_count < 0)
|
||||
{
|
||||
sys_sem.Error("sys_semaphore_create(): invalid parameters (initial_count=%d, max_count=%d)", initial_count, max_count);
|
||||
sys_semaphore.Error("sys_semaphore_create(): invalid parameters (initial_count=%d, max_count=%d)", initial_count, max_count);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
sys_sem.Error("sys_semaphore_create(): invalid pshared value(0x%x)", (u32)attr->pshared);
|
||||
sys_semaphore.Error("sys_semaphore_create(): invalid pshared value(0x%x)", (u32)attr->pshared);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
@ -30,13 +31,13 @@ s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, i
|
||||
{
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_sem.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
|
||||
case se32(SYS_SYNC_RETRY): sys_sem.Error("SYS_SYNC_RETRY"); return CELL_EINVAL;
|
||||
default: sys_sem.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_semaphore.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
|
||||
case se32(SYS_SYNC_RETRY): sys_semaphore.Error("SYS_SYNC_RETRY"); return CELL_EINVAL;
|
||||
default: sys_semaphore.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
sem = sys_sem.GetNewId(new Semaphore(initial_count, max_count, attr->protocol, attr->name_u64), TYPE_SEMAPHORE);
|
||||
LOG_NOTICE(HLE, "*** semaphore created [%s] (protocol=0x%x): id = %d",
|
||||
sem = sys_semaphore.GetNewId(new Semaphore(initial_count, max_count, attr->protocol, attr->name_u64), TYPE_SEMAPHORE);
|
||||
sys_semaphore.Notice("*** semaphore created [%s] (protocol=0x%x): id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, sem.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
@ -44,7 +45,7 @@ s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, i
|
||||
|
||||
s32 sys_semaphore_destroy(u32 sem_id)
|
||||
{
|
||||
sys_sem.Warning("sys_semaphore_destroy(sem_id=%d)", sem_id);
|
||||
sys_semaphore.Warning("sys_semaphore_destroy(sem_id=%d)", sem_id);
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
@ -63,7 +64,7 @@ s32 sys_semaphore_destroy(u32 sem_id)
|
||||
|
||||
s32 sys_semaphore_wait(u32 sem_id, u64 timeout)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_wait(sem_id=%d, timeout=%lld)", sem_id, timeout);
|
||||
sys_semaphore.Log("sys_semaphore_wait(sem_id=%d, timeout=%lld)", sem_id, timeout);
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
@ -88,7 +89,7 @@ s32 sys_semaphore_wait(u32 sem_id, u64 timeout)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_semaphore_wait(%d) aborted", sem_id);
|
||||
sys_semaphore.Warning("sys_semaphore_wait(%d) aborted", sem_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -117,7 +118,7 @@ s32 sys_semaphore_wait(u32 sem_id, u64 timeout)
|
||||
|
||||
s32 sys_semaphore_trywait(u32 sem_id)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_trywait(sem_id=%d)", sem_id);
|
||||
sys_semaphore.Log("sys_semaphore_trywait(sem_id=%d)", sem_id);
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
@ -140,7 +141,7 @@ s32 sys_semaphore_trywait(u32 sem_id)
|
||||
|
||||
s32 sys_semaphore_post(u32 sem_id, int count)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_post(sem_id=%d, count=%d)", sem_id, count);
|
||||
sys_semaphore.Log("sys_semaphore_post(sem_id=%d, count=%d)", sem_id, count);
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
@ -162,7 +163,7 @@ s32 sys_semaphore_post(u32 sem_id, int count)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_semaphore_post(%d) aborted", sem_id);
|
||||
sys_semaphore.Warning("sys_semaphore_post(%d) aborted", sem_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -192,7 +193,7 @@ s32 sys_semaphore_post(u32 sem_id, int count)
|
||||
|
||||
s32 sys_semaphore_get_value(u32 sem_id, mem32_t count)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.GetAddr());
|
||||
sys_semaphore.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.GetAddr());
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "sys_lwmutex.h"
|
||||
|
||||
struct sys_semaphore_attribute
|
||||
{
|
||||
be_t<u32> protocol;
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "sys_spinlock.h"
|
||||
@ -35,7 +33,7 @@ void sys_spinlock_lock(mem_ptr_t<std::atomic<be_t<u32>>> lock)
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_spinlock_lock(0x%x) aborted", lock.GetAddr());
|
||||
sys_spinlock.Warning("sys_spinlock_lock(0x%x) aborted", lock.GetAddr());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "sys_spu.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Loader/ELF.h"
|
||||
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "sys_spu.h"
|
||||
#include <atomic>
|
||||
|
||||
static SysCallBase sc_spu("sys_spu");
|
||||
extern SysCallBase sys_event;
|
||||
static SysCallBase sys_spu("sys_spu");
|
||||
|
||||
u32 LoadSpuImage(vfsStream& stream, u32& spu_ep)
|
||||
{
|
||||
@ -26,12 +26,12 @@ u32 LoadSpuImage(vfsStream& stream, u32& spu_ep)
|
||||
s32 sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
||||
{
|
||||
const std::string path = Memory.ReadString(path_addr);
|
||||
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.c_str());
|
||||
sys_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.c_str());
|
||||
|
||||
vfsFile f(path);
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
sc_spu.Error("sys_spu_image_open error: '%s' not found!", path.c_str());
|
||||
sys_spu.Error("sys_spu_image_open error: '%s' not found!", path.c_str());
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ s32 sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
||||
//172
|
||||
s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)",
|
||||
sys_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)",
|
||||
thread.GetAddr(), group, spu_num, img.GetAddr(), attr.GetAddr(), arg.GetAddr());
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
@ -99,7 +99,7 @@ s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
||||
thread = group_info->list[spu_num] = new_thread.GetId();
|
||||
(*(SPUThread*)&new_thread).group = group_info;
|
||||
|
||||
sc_spu.Warning("*** New SPU Thread [%s] (img_offset=0x%x, ls_offset=0x%x, ep=0x%x, a1=0x%llx, a2=0x%llx, a3=0x%llx, a4=0x%llx): id=%d",
|
||||
sys_spu.Warning("*** New SPU Thread [%s] (img_offset=0x%x, ls_offset=0x%x, ep=0x%x, a1=0x%llx, a2=0x%llx, a3=0x%llx, a4=0x%llx): id=%d",
|
||||
(attr->name_addr ? name.c_str() : ""), (u32) img->segs_addr, ((SPUThread&) new_thread).dmac.ls_offset, spu_ep, a1, a2, a3, a4, thread.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
@ -108,7 +108,7 @@ s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
||||
//166
|
||||
s32 sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_set_argument(id=%d, arg_addr=0x%x)", id, arg.GetAddr());
|
||||
sys_spu.Warning("sys_spu_thread_set_argument(id=%d, arg_addr=0x%x)", id, arg.GetAddr());
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
@ -127,7 +127,7 @@ s32 sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
//165
|
||||
s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());
|
||||
sys_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -149,7 +149,7 @@ s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
||||
//171
|
||||
s32 sys_spu_thread_group_destroy(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_destroy(id=%d)", id);
|
||||
sys_spu.Warning("sys_spu_thread_group_destroy(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -165,7 +165,7 @@ s32 sys_spu_thread_group_destroy(u32 id)
|
||||
if ((group_info->m_state != SPU_THREAD_GROUP_STATUS_INITIALIZED)
|
||||
&& (group_info->m_state != SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED))
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_destroy(id=%d) is not in NOT_INITIALIZED / INITIALIZED, state=%d", id, group_info->m_state);
|
||||
sys_spu.Error("sys_spu_thread_group_destroy(id=%d) is not in NOT_INITIALIZED / INITIALIZED, state=%d", id, group_info->m_state);
|
||||
return CELL_ESTAT; //Indeed this should not be encountered. If program itself all right.
|
||||
}
|
||||
//SET BUSY
|
||||
@ -188,7 +188,7 @@ s32 sys_spu_thread_group_destroy(u32 id)
|
||||
//173
|
||||
s32 sys_spu_thread_group_start(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_start(id=%d)", id);
|
||||
sys_spu.Warning("sys_spu_thread_group_start(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -224,7 +224,7 @@ s32 sys_spu_thread_group_start(u32 id)
|
||||
//174
|
||||
s32 sys_spu_thread_group_suspend(u32 id)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_group_suspend(id=%d)", id);
|
||||
sys_spu.Log("sys_spu_thread_group_suspend(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -271,7 +271,7 @@ s32 sys_spu_thread_group_suspend(u32 id)
|
||||
//175
|
||||
s32 sys_spu_thread_group_resume(u32 id)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_group_resume(id=%d)", id);
|
||||
sys_spu.Log("sys_spu_thread_group_resume(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -319,7 +319,7 @@ s32 sys_spu_thread_group_resume(u32 id)
|
||||
//176: Left doing nothing, indeed
|
||||
s32 sys_spu_thread_group_yield(u32 id)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_yield(id=%d)", id);
|
||||
sys_spu.Error("sys_spu_thread_group_yield(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if (!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -362,7 +362,7 @@ s32 sys_spu_thread_group_yield(u32 id)
|
||||
//177: Left omit the EPERM check.
|
||||
s32 sys_spu_thread_group_terminate(u32 id, int value)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_terminate(id=%d, value=%d)", id, value);
|
||||
sys_spu.Error("sys_spu_thread_group_terminate(id=%d, value=%d)", id, value);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if (!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -401,7 +401,7 @@ s32 sys_spu_thread_group_terminate(u32 id, int value)
|
||||
//170
|
||||
s32 sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_create(id_addr=0x%x, num=%d, prio=%d, attr_addr=0x%x)",
|
||||
sys_spu.Warning("sys_spu_thread_group_create(id_addr=0x%x, num=%d, prio=%d, attr_addr=0x%x)",
|
||||
id.GetAddr(), num, prio, attr.GetAddr());
|
||||
|
||||
if (num > 256) return CELL_EINVAL;
|
||||
@ -410,9 +410,9 @@ s32 sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
||||
|
||||
const std::string name = Memory.ReadString(attr->name_addr, attr->name_len);
|
||||
|
||||
id = sc_spu.GetNewId(new SpuGroupInfo(name, num, prio, attr->type, attr->ct));
|
||||
id = sys_spu.GetNewId(new SpuGroupInfo(name, num, prio, attr->type, attr->ct));
|
||||
|
||||
sc_spu.Warning("*** SPU Thread Group created [%s] (type=0x%x, option.ct=0x%x): id=%d",
|
||||
sys_spu.Warning("*** SPU Thread Group created [%s] (type=0x%x, option.ct=0x%x): id=%d",
|
||||
name.c_str(), (int)attr->type, (u32)attr->ct, id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
@ -421,7 +421,7 @@ s32 sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
||||
//178
|
||||
s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());
|
||||
sys_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
@ -447,7 +447,7 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
}
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_join(id=%d) aborted", id);
|
||||
sys_spu.Warning("sys_spu_thread_group_join(id=%d) aborted", id);
|
||||
return CELL_OK;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
@ -461,7 +461,7 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
|
||||
s32 sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
{
|
||||
sc_spu.Todo("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x",
|
||||
sys_spu.Todo("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x",
|
||||
thread_id.GetAddr(), entry.GetAddr(), arg, prio, stacksize, flags, threadname_addr);
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -469,7 +469,7 @@ s32 sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u
|
||||
//169
|
||||
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
|
||||
sys_spu.Warning("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
|
||||
|
||||
if(max_raw_spu > 5)
|
||||
{
|
||||
@ -482,7 +482,7 @@ s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
||||
//181
|
||||
s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_ls(id=%d, address=0x%x, value=0x%llx, type=0x%x)",
|
||||
sys_spu.Log("sys_spu_thread_write_ls(id=%d, address=0x%x, value=0x%llx, type=0x%x)",
|
||||
id, address, value, type);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
@ -515,7 +515,7 @@ s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
//182
|
||||
s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
|
||||
sys_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
|
||||
id, address, value.GetAddr(), type);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
@ -548,7 +548,7 @@ s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
||||
//190
|
||||
s32 sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_spu_mb(id=%d, value=0x%x)", id, value);
|
||||
sys_spu.Log("sys_spu_thread_write_spu_mb(id=%d, value=0x%x)", id, value);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -565,7 +565,7 @@ s32 sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
//187
|
||||
s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
sys_spu.Warning("sys_spu_thread_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -587,7 +587,7 @@ s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
//188
|
||||
s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
sys_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -604,7 +604,7 @@ s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
||||
//184
|
||||
s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_snr(id=%d, number=%d, value=0x%x)", id, number, value);
|
||||
sys_spu.Log("sys_spu_thread_write_snr(id=%d, number=%d, value=0x%x)", id, number, value);
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
@ -624,14 +624,14 @@ s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
|
||||
s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et)
|
||||
{
|
||||
sc_spu.Todo("sys_spu_thread_group_connect_event(id=%d, eq=%d, et=0x%x)", id, eq, et);
|
||||
sys_spu.Todo("sys_spu_thread_group_connect_event(id=%d, eq=%d, et=0x%x)", id, eq, et);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et)
|
||||
{
|
||||
sc_spu.Todo("sys_spu_thread_group_disconnect_event(id=%d, et=0x%x)", id, et);
|
||||
sys_spu.Todo("sys_spu_thread_group_disconnect_event(id=%d, et=0x%x)", id, et);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -646,7 +646,7 @@ s32 sys_spu_thread_tryreceive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_
|
||||
|
||||
s32 sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_connect_event(id=%d, eq_id=%d, event_type=0x%x, spup=%d)", id, eq_id, et, spup);
|
||||
sys_spu.Warning("sys_spu_thread_connect_event(id=%d, eq_id=%d, event_type=0x%x, spup=%d)", id, eq_id, et, spup);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -663,13 +663,13 @@ s32 sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
||||
|
||||
if (spup > 63)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_connect_event: invalid spup (%d)", spup);
|
||||
sys_spu.Error("sys_spu_thread_connect_event: invalid spup (%d)", spup);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (et != SYS_SPU_THREAD_EVENT_USER)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_connect_event: unsupported event type (0x%x)", et);
|
||||
sys_spu.Error("sys_spu_thread_connect_event: unsupported event type (0x%x)", et);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
@ -695,7 +695,7 @@ s32 sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
||||
//
|
||||
s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_disconnect_event(id=%d, event_type=0x%x, spup=%d)", id, et, spup);
|
||||
sys_spu.Warning("sys_spu_thread_disconnect_event(id=%d, event_type=0x%x, spup=%d)", id, et, spup);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -706,13 +706,13 @@ s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
|
||||
if (spup > 63)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_connect_event: invalid spup (%d)", spup);
|
||||
sys_spu.Error("sys_spu_thread_connect_event: invalid spup (%d)", spup);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (et != SYS_SPU_THREAD_EVENT_USER)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_connect_event: unsupported event type (0x%x)", et);
|
||||
sys_spu.Error("sys_spu_thread_connect_event: unsupported event type (0x%x)", et);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
|
||||
s32 sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_bind_queue(id=%d, equeue_id=%d, spuq_num=0x%x)", id, eq_id, spuq_num);
|
||||
sys_spu.Warning("sys_spu_thread_bind_queue(id=%d, equeue_id=%d, spuq_num=0x%x)", id, eq_id, spuq_num);
|
||||
|
||||
EventQueue* eq;
|
||||
if (!Emu.GetIdManager().GetIDData(eq_id, eq))
|
||||
@ -765,7 +765,7 @@ s32 sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
|
||||
|
||||
s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_unbind_queue(id=0x%x, spuq_num=0x%x)", id, spuq_num);
|
||||
sys_spu.Warning("sys_spu_thread_unbind_queue(id=0x%x, spuq_num=0x%x)", id, spuq_num);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
@ -784,7 +784,7 @@ s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
|
||||
s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, mem8_t spup)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_connect_event_all_threads(id=%d, eq_id=%d, req=0x%llx, spup_addr=0x%x)",
|
||||
sys_spu.Warning("sys_spu_thread_group_connect_event_all_threads(id=%d, eq_id=%d, req=0x%llx, spup_addr=0x%x)",
|
||||
id, eq_id, req, spup.GetAddr());
|
||||
|
||||
EventQueue* eq;
|
||||
@ -811,7 +811,7 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, m
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(v);
|
||||
if (thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_connect_event_all_threads(): CELL_ESTAT (wrong thread type)");
|
||||
sys_spu.Error("sys_spu_thread_group_connect_event_all_threads(): CELL_ESTAT (wrong thread type)");
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
threads.push_back((SPUThread*)thr);
|
||||
@ -819,7 +819,7 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, m
|
||||
|
||||
if (threads.size() != group->m_count)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_connect_event_all_threads(): CELL_ESTAT (%d from %d)", (u32)threads.size(), group->m_count);
|
||||
sys_spu.Error("sys_spu_thread_group_connect_event_all_threads(): CELL_ESTAT (%d from %d)", (u32)threads.size(), group->m_count);
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
|
||||
@ -839,7 +839,7 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, m
|
||||
eq->ports.add(&(t->SPUPs[i]));
|
||||
t->SPUPs[i].eq = eq;
|
||||
}
|
||||
sc_spu.Warning("*** spup -> %d", i);
|
||||
sys_spu.Warning("*** spup -> %d", i);
|
||||
spup = (u8)i;
|
||||
}
|
||||
|
||||
@ -858,7 +858,7 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, m
|
||||
|
||||
s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
{
|
||||
sc_spu.Todo("sys_spu_thread_group_disconnect_event_all_threads(id=%d, spup=%d)", id, spup);
|
||||
sys_spu.Todo("sys_spu_thread_group_disconnect_event_all_threads(id=%d, spup=%d)", id, spup);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -866,7 +866,7 @@ s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
//160
|
||||
s32 sys_raw_spu_create(mem32_t id, u32 attr_addr)
|
||||
{
|
||||
sc_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.GetAddr(), attr_addr);
|
||||
sys_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.GetAddr(), attr_addr);
|
||||
|
||||
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_RAW_SPU);
|
||||
if (((RawSPUThread&)new_thread).GetIndex() >= 5)
|
||||
@ -882,7 +882,7 @@ s32 sys_raw_spu_create(mem32_t id, u32 attr_addr)
|
||||
|
||||
s32 sys_raw_spu_destroy(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_raw_spu_destroy(id=%d)", id);
|
||||
sys_spu.Warning("sys_raw_spu_destroy(id=%d)", id);
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
|
||||
@ -899,7 +899,7 @@ s32 sys_raw_spu_destroy(u32 id)
|
||||
|
||||
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag)
|
||||
{
|
||||
sc_spu.Warning("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());
|
||||
sys_spu.Warning("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
|
||||
@ -926,7 +926,7 @@ s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t
|
||||
|
||||
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
|
||||
{
|
||||
sc_spu.Warning("sys_raw_spu_set_int_mask(id=%d, class_id=%d, mask=0x%llx)", id, class_id, mask);
|
||||
sys_spu.Warning("sys_raw_spu_set_int_mask(id=%d, class_id=%d, mask=0x%llx)", id, class_id, mask);
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
@ -945,7 +945,7 @@ s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
|
||||
|
||||
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.GetAddr());
|
||||
sys_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.GetAddr());
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
@ -964,7 +964,7 @@ s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
|
||||
|
||||
s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_set_int_stat(id=%d, class_id=%d, stat=0x%llx)", id, class_id, stat);
|
||||
sys_spu.Log("sys_raw_spu_set_int_stat(id=%d, class_id=%d, stat=0x%llx)", id, class_id, stat);
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
@ -983,7 +983,7 @@ s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
|
||||
|
||||
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.GetAddr());
|
||||
sys_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.GetAddr());
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
@ -1002,7 +1002,7 @@ s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
|
||||
|
||||
s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
sys_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
@ -1018,7 +1018,7 @@ s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
|
||||
|
||||
s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
sys_spu.Log("sys_raw_spu_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
@ -1032,7 +1032,7 @@ s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value)
|
||||
|
||||
s32 sys_raw_spu_get_spu_cfg(u32 id, mem32_t value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_spu_afg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
sys_spu.Log("sys_raw_spu_get_spu_afg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user