Merge branch 'misc-fixes3' of https://github.com/shadps4-emu/shadPS4 into misc-fixes3
This commit is contained in:
commit
10a7110c7d
|
@ -79,7 +79,7 @@ std::filesystem::path MntPoints::GetHostPath(const std::string& guest_directory)
|
||||||
bool found_match = false;
|
bool found_match = false;
|
||||||
for (const auto& path : std::filesystem::directory_iterator(current_path)) {
|
for (const auto& path : std::filesystem::directory_iterator(current_path)) {
|
||||||
const auto candidate = path.path().filename();
|
const auto candidate = path.path().filename();
|
||||||
const auto filename = Common::ToLower(candidate);
|
const auto filename = Common::ToLower(candidate.string());
|
||||||
// Check if a filename matches in case insensitive manner.
|
// Check if a filename matches in case insensitive manner.
|
||||||
if (filename != part_low) {
|
if (filename != part_low) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
EventFlagInternal(const std::string& name, ThreadMode thread_mode, QueueMode queue_mode,
|
EventFlagInternal(const std::string& name, ThreadMode thread_mode, QueueMode queue_mode,
|
||||||
uint64_t bits)
|
uint64_t bits)
|
||||||
: m_name(name), m_thread_mode(thread_mode), m_queue_mode(queue_mode), m_bits(bits) {};
|
: m_name(name), m_thread_mode(thread_mode), m_queue_mode(queue_mode), m_bits(bits){};
|
||||||
|
|
||||||
int Wait(u64 bits, WaitMode wait_mode, ClearMode clear_mode, u64* result, u32* ptr_micros);
|
int Wait(u64 bits, WaitMode wait_mode, ClearMode clear_mode, u64* result, u32* ptr_micros);
|
||||||
int Poll(u64 bits, WaitMode wait_mode, ClearMode clear_mode, u64* result);
|
int Poll(u64 bits, WaitMode wait_mode, ClearMode clear_mode, u64* result);
|
||||||
|
|
|
@ -58,7 +58,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
||||||
if (directory) {
|
if (directory) {
|
||||||
file->is_directory = true;
|
file->is_directory = true;
|
||||||
file->m_guest_name = path;
|
file->m_guest_name = path;
|
||||||
file->m_host_name = mnt->GetHostPath(file->m_guest_name);
|
file->m_host_name = mnt->GetHostPath(file->m_guest_name).string();
|
||||||
if (!std::filesystem::is_directory(file->m_host_name)) { // directory doesn't exist
|
if (!std::filesystem::is_directory(file->m_host_name)) { // directory doesn't exist
|
||||||
h->DeleteHandle(handle);
|
h->DeleteHandle(handle);
|
||||||
return ORBIS_KERNEL_ERROR_ENOTDIR;
|
return ORBIS_KERNEL_ERROR_ENOTDIR;
|
||||||
|
@ -72,7 +72,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
file->m_guest_name = path;
|
file->m_guest_name = path;
|
||||||
file->m_host_name = mnt->GetHostPath(file->m_guest_name);
|
file->m_host_name = mnt->GetHostPath(file->m_guest_name).string();
|
||||||
int e = 0;
|
int e = 0;
|
||||||
if (read) {
|
if (read) {
|
||||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
||||||
|
@ -174,7 +174,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
||||||
return SCE_KERNEL_ERROR_EPERM;
|
return SCE_KERNEL_ERROR_EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* file = h->getFile(host_path);
|
auto* file = h->getFile(host_path.string());
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
file->f.Unlink();
|
file->f.Unlink();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,12 @@ namespace Libraries::LibC {
|
||||||
|
|
||||||
std::FILE* PS4_SYSV_ABI ps4_fopen(const char* filename, const char* mode) {
|
std::FILE* PS4_SYSV_ABI ps4_fopen(const char* filename, const char* mode) {
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
const auto host_path = mnt->GetHostPath(filename);
|
const auto host_path = mnt->GetHostPath(filename).string();
|
||||||
FILE* f = std::fopen(host_path.c_str(), mode);
|
FILE* f = std::fopen(host_path.c_str(), mode);
|
||||||
if (f != nullptr) {
|
if (f != nullptr) {
|
||||||
LOG_INFO(Lib_LibC, "fopen = {}", host_path.native());
|
LOG_INFO(Lib_LibC, "fopen = {}", host_path);
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO(Lib_LibC, "fopen can't open = {}", host_path.native());
|
LOG_INFO(Lib_LibC, "fopen can't open = {}", host_path);
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ int PS4_SYSV_ABI sceSaveDataCheckBackupData(const OrbisSaveDataCheckBackupData*
|
||||||
if (!std::filesystem::exists(mount_dir)) {
|
if (!std::filesystem::exists(mount_dir)) {
|
||||||
return ORBIS_SAVE_DATA_ERROR_NOT_FOUND;
|
return ORBIS_SAVE_DATA_ERROR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
LOG_INFO(Lib_SaveData, "called = {}", mount_dir.native());
|
LOG_INFO(Lib_SaveData, "called = {}", mount_dir.string());
|
||||||
|
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ int PS4_SYSV_ABI sceSaveDataLoadIcon(const OrbisSaveDataMountPoint* mountPoint,
|
||||||
OrbisSaveDataIcon* icon) {
|
OrbisSaveDataIcon* icon) {
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||||
LOG_INFO(Lib_SaveData, "called: dir = {}", mount_dir.native());
|
LOG_INFO(Lib_SaveData, "called: dir = {}", mount_dir.string());
|
||||||
|
|
||||||
if (icon != nullptr) {
|
if (icon != nullptr) {
|
||||||
Common::FS::IOFile file(mount_dir / "save_data.png", Common::FS::FileAccessMode::Read);
|
Common::FS::IOFile file(mount_dir / "save_data.png", Common::FS::FileAccessMode::Read);
|
||||||
|
@ -534,7 +534,7 @@ int PS4_SYSV_ABI sceSaveDataSaveIcon(const OrbisSaveDataMountPoint* mountPoint,
|
||||||
const OrbisSaveDataIcon* icon) {
|
const OrbisSaveDataIcon* icon) {
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||||
LOG_INFO(Lib_SaveData, "called = {}", mount_dir.native());
|
LOG_INFO(Lib_SaveData, "called = {}", mount_dir.string());
|
||||||
|
|
||||||
if (icon != nullptr) {
|
if (icon != nullptr) {
|
||||||
Common::FS::IOFile file(mount_dir / "save_data.png", Common::FS::FileAccessMode::Write);
|
Common::FS::IOFile file(mount_dir / "save_data.png", Common::FS::FileAccessMode::Write);
|
||||||
|
@ -558,7 +558,7 @@ int PS4_SYSV_ABI sceSaveDataSetParam(const OrbisSaveDataMountPoint* mountPoint,
|
||||||
size_t paramBufSize) {
|
size_t paramBufSize) {
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||||
LOG_INFO(Lib_SaveData, "called = {}, mountPoint->data = {}", mount_dir.native(),
|
LOG_INFO(Lib_SaveData, "called = {}, mountPoint->data = {}", mount_dir.string(),
|
||||||
mountPoint->data);
|
mountPoint->data);
|
||||||
|
|
||||||
if (paramBuf != nullptr) {
|
if (paramBuf != nullptr) {
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
namespace Shader::IR {
|
namespace Shader::IR {
|
||||||
|
|
||||||
template <typename Pred>
|
template <typename Pred>
|
||||||
auto BreadthFirstSearch(const Value& value,
|
auto BreadthFirstSearch(const Value& value, Pred&& pred)
|
||||||
Pred&& pred) -> std::invoke_result_t<Pred, const Inst*> {
|
-> std::invoke_result_t<Pred, const Inst*> {
|
||||||
if (value.IsImmediate()) {
|
if (value.IsImmediate()) {
|
||||||
// Nothing to do with immediates
|
// Nothing to do with immediates
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
|
@ -52,7 +52,7 @@ constexpr Type F64x2{Type::F64x2};
|
||||||
constexpr Type F64x3{Type::F64x3};
|
constexpr Type F64x3{Type::F64x3};
|
||||||
constexpr Type F64x4{Type::F64x4};
|
constexpr Type F64x4{Type::F64x4};
|
||||||
|
|
||||||
constexpr OpcodeMeta META_TABLE[] {
|
constexpr OpcodeMeta META_TABLE[]{
|
||||||
#define OPCODE(name_token, type_token, ...) \
|
#define OPCODE(name_token, type_token, ...) \
|
||||||
{ \
|
{ \
|
||||||
.name{#name_token}, \
|
.name{#name_token}, \
|
||||||
|
|
|
@ -263,7 +263,8 @@ private:
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
IR::Value AddPhiOperands(Type variable, IR::Inst& phi, IR::Block* block) {
|
IR::Value AddPhiOperands(Type variable, IR::Inst& phi, IR::Block* block) {
|
||||||
for (IR::Block* const imm_pred : block->ImmPredecessors()) {
|
for (IR::Block* const imm_pred : block->ImmPredecessors()) {
|
||||||
const bool is_thread_bit = std::is_same_v<Type, IR::ScalarReg> && phi.Flags<IR::Type>() == IR::Type::U1;
|
const bool is_thread_bit =
|
||||||
|
std::is_same_v<Type, IR::ScalarReg> && phi.Flags<IR::Type>() == IR::Type::U1;
|
||||||
phi.AddPhiOperand(imm_pred, ReadVariable(variable, imm_pred, is_thread_bit));
|
phi.AddPhiOperand(imm_pred, ReadVariable(variable, imm_pred, is_thread_bit));
|
||||||
}
|
}
|
||||||
return TryRemoveTrivialPhi(phi, block, UndefOpcode(variable));
|
return TryRemoveTrivialPhi(phi, block, UndefOpcode(variable));
|
||||||
|
@ -347,7 +348,8 @@ void VisitInst(Pass& pass, IR::Block* block, IR::Inst& inst) {
|
||||||
case IR::Opcode::GetThreadBitScalarReg:
|
case IR::Opcode::GetThreadBitScalarReg:
|
||||||
case IR::Opcode::GetScalarRegister: {
|
case IR::Opcode::GetScalarRegister: {
|
||||||
const IR::ScalarReg reg{inst.Arg(0).ScalarReg()};
|
const IR::ScalarReg reg{inst.Arg(0).ScalarReg()};
|
||||||
inst.ReplaceUsesWith(pass.ReadVariable(reg, block, opcode == IR::Opcode::GetThreadBitScalarReg));
|
inst.ReplaceUsesWith(
|
||||||
|
pass.ReadVariable(reg, block, opcode == IR::Opcode::GetThreadBitScalarReg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::GetVectorRegister: {
|
case IR::Opcode::GetVectorRegister: {
|
||||||
|
|
Loading…
Reference in New Issue