1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

sys_process_is_spu_lock_line_reservation_address

Formatting changed a bit
This commit is contained in:
Nekotekina 2014-09-17 17:15:17 +04:00
parent 626133c0eb
commit 0044141631
17 changed files with 72 additions and 81 deletions

View File

@ -123,7 +123,7 @@ static struct { inline operator Log::LogType() { return Log::LogType::PPU; } } P
static struct { inline operator Log::LogType() { return Log::LogType::SPU; } } SPU;
static struct { inline operator Log::LogType() { return Log::LogType::TTY; } } TTY;
inline void log_message(Log::LogType type, Log::LogSeverity sev, std::string text)
inline void log_message(Log::LogType type, Log::LogSeverity sev, const char* text)
{
//another msvc bug makes this not work, uncomment this and delete everything else in this function when it's fixed
//Log::LogManager::getInstance().log({logType, severity, text})
@ -133,8 +133,8 @@ inline void log_message(Log::LogType type, Log::LogSeverity sev, std::string tex
}
template<typename T, typename ...Ts>
inline void log_message(Log::LogType type, Log::LogSeverity sev, std::string text, T arg, Ts... args)
inline void log_message(Log::LogType type, Log::LogSeverity sev, const char* text, T arg, Ts... args)
{
Log::LogMessage msg{type, sev, fmt::Format(text,arg,args...)};
Log::LogMessage msg{type, sev, fmt::Format(text, arg, args...)};
Log::LogManager::getInstance().log(msg);
}

View File

@ -4,38 +4,6 @@
extern const std::string fmt::placeholder = "???";
//wrapper to deal with advance sprintf formating options with automatic length finding
//can't take strings by reference because of "va_start", so overload it with char *
std::string fmt::FormatV(const char *fmt, va_list args)
{
size_t length = 256;
std::string str;
for (;;)
{
std::vector<char> buffptr(length);
#if !defined(_MSC_VER)
size_t printlen = vsnprintf(buffptr.data(), length, fmt, args);
#else
size_t printlen = vsnprintf_s(buffptr.data(), length, length - 1, fmt, args);
#endif
if (printlen < length)
{
str = std::string(buffptr.data(), printlen);
break;
}
length *= 2;
}
return str;
}
std::string fmt::FormatV(std::string fmt, va_list args)
{
std::string str = FormatV(fmt.c_str(), args);
return str;
}
std::string replace_first(const std::string& src, const std::string& from, const std::string& to)
{
auto pos = src.find(from);

View File

@ -96,15 +96,9 @@ namespace fmt{
template<typename T>
T by_value(T x) { return x; }
//wrapper to deal with advance sprintf formating options with automatic length finding
//can't take strings by reference because of "va_start", so overload it with char *
string FormatV(const char *fmt, va_list args);
string FormatV(string fmt, va_list args);
//wrapper to deal with advance sprintf formating options with automatic length finding
template<typename ... Args>
string Format(const string &fmt, Args ... parameters)
string Format(const char* fmt, Args ... parameters)
{
size_t length = 256;
string str;
@ -115,10 +109,10 @@ namespace fmt{
#if !defined(_MSC_VER)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
size_t printlen = snprintf(buffptr.data(), length, fmt.c_str(), std::forward<Args>(parameters)...);
size_t printlen = snprintf(buffptr.data(), length, fmt, std::forward<Args>(parameters)...);
#pragma clang diagnostic pop
#else
size_t printlen = _snprintf_s(buffptr.data(), length, length - 1, fmt.c_str(), std::forward<Args>(parameters)...);
size_t printlen = _snprintf_s(buffptr.data(), length, length - 1, fmt, std::forward<Args>(parameters)...);
#endif
if (printlen < length)
{

View File

@ -3983,7 +3983,7 @@ private:
void UNK(const std::string& err, bool pause = true)
{
LOG_ERROR(PPU, err + fmt::Format(" #pc: 0x%x", CPU.PC));
LOG_ERROR(PPU, "%s #pc: 0x%x", err.c_str(), CPU.PC);
if(!pause) return;
@ -3992,17 +3992,17 @@ private:
for(uint i=0; i<32; ++i) LOG_NOTICE(PPU, "r%d = 0x%llx", i, CPU.GPR[i]);
for(uint i=0; i<32; ++i) LOG_NOTICE(PPU, "f%d = %llf", i, CPU.FPR[i]);
for(uint i=0; i<32; ++i) LOG_NOTICE(PPU, "v%d = 0x%s [%s]", i, CPU.VPR[i].to_hex().c_str(), CPU.VPR[i].to_xyzw().c_str());
LOG_NOTICE(PPU, "CR = 0x%08x", CPU.CR);
LOG_NOTICE(PPU, "CR = 0x%08x", CPU.CR.CR);
LOG_NOTICE(PPU, "LR = 0x%llx", CPU.LR);
LOG_NOTICE(PPU, "CTR = 0x%llx", CPU.CTR);
LOG_NOTICE(PPU, "XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]", CPU.XER, fmt::by_value(CPU.XER.CA), fmt::by_value(CPU.XER.OV), fmt::by_value(CPU.XER.SO));
LOG_NOTICE(PPU, "XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]", CPU.XER.XER, fmt::by_value(CPU.XER.CA), fmt::by_value(CPU.XER.OV), fmt::by_value(CPU.XER.SO));
LOG_NOTICE(PPU, "FPSCR = 0x%x "
"[RN=%d | NI=%d | XE=%d | ZE=%d | UE=%d | OE=%d | VE=%d | "
"VXCVI=%d | VXSQRT=%d | VXSOFT=%d | FPRF=%d | "
"FI=%d | FR=%d | VXVC=%d | VXIMZ=%d | "
"VXZDZ=%d | VXIDI=%d | VXISI=%d | VXSNAN=%d | "
"XX=%d | ZX=%d | UX=%d | OX=%d | VX=%d | FEX=%d | FX=%d]",
CPU.FPSCR,
CPU.FPSCR.FPSCR,
fmt::by_value(CPU.FPSCR.RN),
fmt::by_value(CPU.FPSCR.NI), fmt::by_value(CPU.FPSCR.XE), fmt::by_value(CPU.FPSCR.ZE), fmt::by_value(CPU.FPSCR.UE), fmt::by_value(CPU.FPSCR.OE), fmt::by_value(CPU.FPSCR.VE),
fmt::by_value(CPU.FPSCR.VXCVI), fmt::by_value(CPU.FPSCR.VXSQRT), fmt::by_value(CPU.FPSCR.VXSOFT), fmt::by_value(CPU.FPSCR.FPRF),

View File

@ -1497,7 +1497,7 @@ private:
void UNK(const std::string& err)
{
LOG_ERROR(Log::SPU, err + fmt::Format(" #pc: 0x%x", CPU.PC));
LOG_ERROR(Log::SPU, "%s #pc: 0x%x", err.c_str(), CPU.PC);
Emu.Pause();
for(uint i=0; i<128; ++i) LOG_NOTICE(Log::SPU, "r%d = 0x%s", i, CPU.GPR[i].to_hex().c_str());
}

View File

@ -3779,7 +3779,7 @@ private:
void UNK(const std::string& err)
{
LOG_ERROR(Log::SPU, err + fmt::Format(" #pc: 0x%x", CPU.PC));
LOG_ERROR(Log::SPU, "%s #pc: 0x%x", err.c_str(), CPU.PC);
c.mov(cpu_dword(PC), CPU.PC);
do_finalize = true;
Emu.Pause();

View File

@ -593,8 +593,8 @@ void GLTexture::Save(RSXTexture& tex)
if (!rExists(dir_path)) rMkdir(dir_path);
u32 count = 0;
while (rExists(fmt::Format(file_fmt, count))) count++;
Save(tex, fmt::Format(file_fmt, count));
while (rExists(fmt::Format(file_fmt.c_str(), count))) count++;
Save(tex, fmt::Format(file_fmt.c_str(), count));
}
void GLTexture::Bind()

View File

@ -436,7 +436,7 @@ std::string GLVertexDecompilerThread::BuildCode()
"%s\n"
"%s";
return fmt::Format(prot, p.c_str(), fp.c_str(), f.c_str());
return fmt::Format(prot.c_str(), p.c_str(), fp.c_str(), f.c_str());
}
void GLVertexDecompilerThread::Task()
@ -648,7 +648,7 @@ void GLVertexProgram::Compile()
delete[] buf;
}
LOG_NOTICE(RSX, shader);
LOG_NOTICE(RSX, "%s", shader.c_str());
Emu.Pause();
}
//else LOG_WARNING(RSX, "Vertex shader compiled successfully!");

View File

@ -149,7 +149,7 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons
debug += "(";
for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
debug += ")";
LOG_NOTICE(RSX, "OutOfArgsCount(x=%u, count=%u): " + debug, x, count);
LOG_NOTICE(RSX, "OutOfArgsCount(x=%u, count=%u): %s", x, count, debug.c_str());
return 0;
}
@ -2086,7 +2086,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
log += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
}
log += ")";
LOG_ERROR(RSX, "TODO: " + log);
LOG_ERROR(RSX, "TODO: %s", log.c_str());
}
break;
}

View File

@ -29,12 +29,12 @@ public:
virtual const std::string& GetName() const = 0;
template<typename... Targs> void Notice(const u32 id, const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Notice(const u32 id, const char* fmt, Targs... args) const
{
LogOutput(LogNotice, id, ": ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Notice(const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Notice(const char* fmt, Targs... args) const
{
LogOutput(LogNotice, ": ", fmt::Format(fmt, args...));
}
@ -55,42 +55,42 @@ public:
}
}
template<typename... Targs> void Success(const u32 id, const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Success(const u32 id, const char* fmt, Targs... args) const
{
LogOutput(LogSuccess, id, ": ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Success(const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Success(const char* fmt, Targs... args) const
{
LogOutput(LogSuccess, ": ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Warning(const u32 id, const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Warning(const u32 id, const char* fmt, Targs... args) const
{
LogOutput(LogWarning, id, " warning: ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Warning(const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Warning(const char* fmt, Targs... args) const
{
LogOutput(LogWarning, " warning: ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Error(const u32 id, const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Error(const u32 id, const char* fmt, Targs... args) const
{
LogOutput(LogError, id, " error: ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Error(const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Error(const char* fmt, Targs... args) const
{
LogOutput(LogError, " error: ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Todo(const u32 id, const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Todo(const u32 id, const char* fmt, Targs... args) const
{
LogOutput(LogError, id, " TODO: ", fmt::Format(fmt, args...));
}
template<typename... Targs> void Todo(const char* fmt, Targs... args) const
template<typename... Targs> __noinline void Todo(const char* fmt, Targs... args) const
{
LogOutput(LogError, " TODO: ", fmt::Format(fmt, args...));
}

View File

@ -187,7 +187,6 @@ int cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentInfoPath, vm:
return CELL_GAME_ERROR_FAILURE;
}
// TODO: make it better
strcpy_trunc(*contentInfoPath, contentInfo);
strcpy_trunc(*usrdirPath, usrdir);

View File

@ -60,7 +60,7 @@ static func_caller* sc_table[kSyscallTableLength] =
bind_func(sys_process_get_number_of_object), //12 (0x00C)
bind_func(sys_process_get_id), //13 (0x00D)
null_func,//bind_func(sys_process_is_spu_lock_line_reservation_address), //14 (0x00E)
bind_func(sys_process_is_spu_lock_line_reservation_address), //14 (0x00E)
null_func, null_func, null_func, //15-17 UNS

View File

@ -1,13 +1,22 @@
#pragma once
#define SYS_MEMORY_CONTAINER_ID_INVALID 0xFFFFFFFF
#define SYS_MEMORY_ACCESS_RIGHT_NONE 0x00000000000000F0ULL
#define SYS_MEMORY_ACCESS_RIGHT_PPU_THREAD 0x0000000000000008ULL
#define SYS_MEMORY_ACCESS_RIGHT_HANDLER 0x0000000000000004ULL
#define SYS_MEMORY_ACCESS_RIGHT_SPU_THREAD 0x0000000000000002ULL
#define SYS_MEMORY_ACCESS_RIGHT_SPU_RAW 0x0000000000000001ULL
#define SYS_MEMORY_ATTR_READ_ONLY 0x0000000000080000ULL
#define SYS_MEMORY_ATTR_READ_WRITE 0x0000000000040000ULL
enum : u32
{
SYS_MEMORY_CONTAINER_ID_INVALID = 0xFFFFFFFF,
};
enum : u64
{
SYS_MEMORY_ACCESS_RIGHT_NONE = 0x00000000000000F0ULL,
SYS_MEMORY_ACCESS_RIGHT_ANY = 0x000000000000000FULL,
SYS_MEMORY_ACCESS_RIGHT_PPU_THR = 0x0000000000000008ULL,
SYS_MEMORY_ACCESS_RIGHT_HANDLER = 0x0000000000000004ULL,
SYS_MEMORY_ACCESS_RIGHT_SPU_THR = 0x0000000000000002ULL,
SYS_MEMORY_ACCESS_RIGHT_RAW_SPU = 0x0000000000000001ULL,
SYS_MEMORY_ATTR_READ_ONLY = 0x0000000000080000ULL,
SYS_MEMORY_ATTR_READ_WRITE = 0x0000000000040000ULL,
};
enum
{

View File

@ -3,6 +3,7 @@
#include "Emu/System.h"
#include "Emu/SysCalls/SysCalls.h"
#include "sys_memory.h"
#include "sys_process.h"
SysCallBase sys_process("sys_process");
@ -212,6 +213,24 @@ s32 sys_process_get_id(u32 object, vm::ptr<be_t<u32>> buffer, u32 size, vm::ptr<
return CELL_OK;
}
s32 process_is_spu_lock_line_reservation_address(u32 addr, u64 flags)
{
if (!flags || flags & ~(SYS_MEMORY_ACCESS_RIGHT_SPU_THR | SYS_MEMORY_ACCESS_RIGHT_RAW_SPU))
{
return CELL_EINVAL;
}
// TODO
return CELL_OK;
}
s32 sys_process_is_spu_lock_line_reservation_address(u32 addr, u64 flags)
{
sys_process.Warning("sys_process_is_spu_lock_line_reservation_address(addr=0x%x, flags=0x%llx)", addr, flags);
return process_is_spu_lock_line_reservation_address(addr, flags);
}
s32 sys_process_get_paramsfo(vm::ptr<u8> buffer)
{
sys_process.Todo("sys_process_get_paramsfo(buffer_addr=0x%x) -> CELL_ENOENT", buffer.addr());

View File

@ -26,6 +26,7 @@ enum
// Auxiliary functions
s32 process_getpid();
s32 process_get_sdk_version(u32 pid, s32& ver);
s32 process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
// SysCalls
s32 sys_process_getpid();
@ -35,6 +36,7 @@ s32 sys_process_get_id(u32 object, vm::ptr<be_t<u32>> buffer, u32 size, vm::ptr<
s32 sys_process_get_paramsfo(vm::ptr<u8> buffer);
s32 sys_process_get_sdk_version(u32 pid, vm::ptr<be_t<s32>> version);
s32 sys_process_get_status(u64 unk);
s32 sys_process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
s32 sys_process_exit(s32 errorcode);
s32 sys_process_kill(u32 pid);
s32 sys_process_wait_for_child(u32 pid, vm::ptr<be_t<u32>> status, u64 unk);

View File

@ -269,7 +269,7 @@ void Emulator::Load()
}
catch(const std::string& e)
{
LOG_ERROR(LOADER, e);
LOG_ERROR(LOADER, "%s", e.c_str());
is_error = true;
}
catch(...)

View File

@ -251,9 +251,9 @@ void VHDDExplorer::OnCreateDir(wxCommandEvent& event)
{
int i = 1;
static const std::string& fmt = "New Dir (%d)";
while(m_hdd->HasEntry(fmt::Format(fmt, i))) i++;
while(m_hdd->HasEntry(fmt::Format(fmt.c_str(), i))) i++;
m_hdd->Create(vfsHDD_Entry_Dir, fmt::Format(fmt, i));
m_hdd->Create(vfsHDD_Entry_Dir, fmt::Format(fmt.c_str(), i));
UpdateList();
}
@ -261,9 +261,9 @@ void VHDDExplorer::OnCreateFile(wxCommandEvent& event)
{
int i = 1;
static const std::string& fmt = "New File (%d)";
while (m_hdd->HasEntry(fmt::Format(fmt, i))) i++;
while (m_hdd->HasEntry(fmt::Format(fmt.c_str(), i))) i++;
m_hdd->Create(vfsHDD_Entry_File, fmt::Format(fmt, i));
m_hdd->Create(vfsHDD_Entry_File, fmt::Format(fmt.c_str(), i));
UpdateList();
}