mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
More cleanup
This commit is contained in:
parent
961fc27215
commit
4a6ef91eb3
@ -1472,63 +1472,12 @@ bool waiter_map_t::is_stopped(u64 signal_id)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(Log::HLE, "%s: waiter_op() aborted (signal_id=0x%llx)", m_name.c_str(), signal_id);
|
||||
LOG_WARNING(Log::HLE, "%s: waiter_op() aborted (signal_id=0x%llx)", name.c_str(), signal_id);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void waiter_map_t::waiter_reg_t::init()
|
||||
{
|
||||
if (!thread)
|
||||
{
|
||||
thread = GetCurrentNamedThread();
|
||||
|
||||
std::lock_guard<std::mutex> lock(map.m_mutex);
|
||||
|
||||
// add waiter
|
||||
map.m_waiters.push_back({ signal_id, thread });
|
||||
}
|
||||
}
|
||||
|
||||
waiter_map_t::waiter_reg_t::~waiter_reg_t()
|
||||
{
|
||||
if (thread)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(map.m_mutex);
|
||||
|
||||
// remove waiter
|
||||
for (s64 i = map.m_waiters.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (map.m_waiters[i].signal_id == signal_id && map.m_waiters[i].thread == thread)
|
||||
{
|
||||
map.m_waiters.erase(map.m_waiters.begin() + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_ERROR(HLE, "%s(): waiter not found (signal_id=0x%llx, map='%s')", __FUNCTION__, signal_id, map.m_name.c_str());
|
||||
Emu.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
void waiter_map_t::notify(u64 signal_id)
|
||||
{
|
||||
if (m_waiters.size())
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
// find waiter and signal
|
||||
for (auto& v : m_waiters)
|
||||
{
|
||||
if (v.signal_id == signal_id)
|
||||
{
|
||||
v.thread->Notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const std::function<bool()> SQUEUE_ALWAYS_EXIT = [](){ return true; };
|
||||
const std::function<bool()> SQUEUE_NEVER_EXIT = [](){ return false; };
|
||||
|
||||
|
@ -103,65 +103,54 @@ class slw_shared_mutex_t
|
||||
|
||||
};
|
||||
|
||||
class waiter_map_t
|
||||
struct waiter_map_t
|
||||
{
|
||||
// TODO: optimize (use custom lightweight readers-writer lock)
|
||||
std::mutex m_mutex;
|
||||
static const size_t size = 32;
|
||||
|
||||
struct waiter_t
|
||||
{
|
||||
u64 signal_id;
|
||||
NamedThreadBase* thread;
|
||||
};
|
||||
std::array<std::mutex, size> mutex;
|
||||
std::array<std::condition_variable, size> cv;
|
||||
|
||||
std::vector<waiter_t> m_waiters;
|
||||
const std::string name;
|
||||
|
||||
std::string m_name;
|
||||
|
||||
struct waiter_reg_t
|
||||
{
|
||||
NamedThreadBase* thread;
|
||||
const u64 signal_id;
|
||||
waiter_map_t& map;
|
||||
|
||||
waiter_reg_t(waiter_map_t& map, u64 signal_id)
|
||||
: thread(nullptr)
|
||||
, signal_id(signal_id)
|
||||
, map(map)
|
||||
{
|
||||
}
|
||||
|
||||
~waiter_reg_t();
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
bool is_stopped(u64 signal_id);
|
||||
|
||||
public:
|
||||
waiter_map_t(const char* name)
|
||||
: m_name(name)
|
||||
: name(name)
|
||||
{
|
||||
}
|
||||
|
||||
bool is_stopped(u64 signal_id);
|
||||
|
||||
// wait until waiter_func() returns true, signal_id is an arbitrary number
|
||||
template<typename WT> __forceinline void wait_op(u64 signal_id, const WT waiter_func)
|
||||
template<typename S, typename WT> __forceinline __safebuffers void wait_op(const S& signal_id, const WT waiter_func)
|
||||
{
|
||||
// register waiter
|
||||
waiter_reg_t waiter(*this, signal_id);
|
||||
// generate hash
|
||||
const auto hash = std::hash<S>()(signal_id) % size;
|
||||
|
||||
// set mutex locker
|
||||
std::unique_lock<std::mutex> locker(mutex[hash], std::defer_lock);
|
||||
|
||||
// check the condition or if the emulator is stopped
|
||||
while (!waiter_func() && !is_stopped(signal_id))
|
||||
{
|
||||
// initialize waiter (only once)
|
||||
waiter.init();
|
||||
// wait for 1 ms or until signal arrived
|
||||
waiter.thread->WaitForAnySignal(1);
|
||||
// lock the mutex and initialize waiter (only once)
|
||||
if (!locker.owns_lock())
|
||||
{
|
||||
locker.lock();
|
||||
}
|
||||
|
||||
// wait on appropriate condition variable for 1 ms or until signal arrived
|
||||
cv[hash].wait_for(locker, std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
// signal all threads waiting on waiter_op() with the same signal_id (signaling only hints those threads that corresponding conditions are *probably* met)
|
||||
void notify(u64 signal_id);
|
||||
template<typename S> __forceinline void notify(const S& signal_id)
|
||||
{
|
||||
// generate hash
|
||||
const auto hash = std::hash<S>()(signal_id) % size;
|
||||
|
||||
// signal appropriate condition variable
|
||||
cv[hash].notify_all();
|
||||
}
|
||||
};
|
||||
|
||||
extern const std::function<bool()> SQUEUE_ALWAYS_EXIT;
|
||||
|
@ -110,4 +110,4 @@ psv_log_base sceDisplay("SceDisplay", []()
|
||||
REG_FUNC(0x3E796EF5, sceDisplayWaitSetFrameBufMultiCB);
|
||||
REG_FUNC(0x6BDF4C4D, sceDisplayRegisterVblankStartCallback);
|
||||
REG_FUNC(0x98436A80, sceDisplayUnregisterVblankStartCallback);
|
||||
});
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ s32 sceKernelCreateThread(
|
||||
s32 cpuAffinityMask,
|
||||
vm::psv::ptr<const SceKernelThreadOptParam> pOptParam)
|
||||
{
|
||||
sceLibKernel.Warning("sceKernelCreateThread(pName=0x%x, entry=0x%x, initPriority=%d, stackSize=0x%x, attr=0x%x, cpuAffinityMask=0x%x, pOptParam=0x%x)",
|
||||
sceLibKernel.Warning("sceKernelCreateThread(pName=*0x%x, entry=*0x%x, initPriority=%d, stackSize=0x%x, attr=0x%x, cpuAffinityMask=0x%x, pOptParam=*0x%x)",
|
||||
pName, entry, initPriority, stackSize, attr, cpuAffinityMask, pOptParam);
|
||||
|
||||
auto t = Emu.GetCPU().AddThread(CPU_THREAD_ARMv7);
|
||||
@ -62,7 +62,7 @@ s32 sceKernelCreateThread(
|
||||
|
||||
s32 sceKernelStartThread(s32 threadId, u32 argSize, vm::psv::ptr<const void> pArgBlock)
|
||||
{
|
||||
sceLibKernel.Warning("sceKernelStartThread(threadId=0x%x, argSize=0x%x, pArgBlock=0x%x)", threadId, argSize, pArgBlock);
|
||||
sceLibKernel.Warning("sceKernelStartThread(threadId=0x%x, argSize=0x%x, pArgBlock=*0x%x)", threadId, argSize, pArgBlock);
|
||||
|
||||
std::shared_ptr<CPUThread> t = Emu.GetCPU().GetThread(threadId, CPU_THREAD_ARMv7);
|
||||
|
||||
@ -185,7 +185,7 @@ s32 sceKernelChangeCurrentThreadAttr(u32 clearAttr, u32 setAttr)
|
||||
|
||||
s32 sceKernelGetThreadExitStatus(s32 threadId, vm::psv::ptr<s32> pExitStatus)
|
||||
{
|
||||
sceLibKernel.Todo("sceKernelGetThreadExitStatus(threadId=0x%x, pExitStatus=0x%x)", threadId, pExitStatus);
|
||||
sceLibKernel.Todo("sceKernelGetThreadExitStatus(threadId=0x%x, pExitStatus=*0x%x)", threadId, pExitStatus);
|
||||
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
@ -206,21 +206,21 @@ s32 sceKernelCheckWaitableStatus()
|
||||
|
||||
s32 sceKernelGetThreadInfo(s32 threadId, vm::psv::ptr<SceKernelThreadInfo> pInfo)
|
||||
{
|
||||
sceLibKernel.Todo("sceKernelGetThreadInfo(threadId=0x%x, pInfo=0x%x)", threadId, pInfo);
|
||||
sceLibKernel.Todo("sceKernelGetThreadInfo(threadId=0x%x, pInfo=*0x%x)", threadId, pInfo);
|
||||
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
|
||||
s32 sceKernelGetThreadRunStatus(vm::psv::ptr<SceKernelThreadRunStatus> pStatus)
|
||||
{
|
||||
sceLibKernel.Todo("sceKernelGetThreadRunStatus(pStatus=0x%x)", pStatus);
|
||||
sceLibKernel.Todo("sceKernelGetThreadRunStatus(pStatus=*0x%x)", pStatus);
|
||||
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
|
||||
s32 sceKernelGetSystemInfo(vm::psv::ptr<SceKernelSystemInfo> pInfo)
|
||||
{
|
||||
sceLibKernel.Todo("sceKernelGetSystemInfo(pInfo=0x%x)", pInfo);
|
||||
sceLibKernel.Todo("sceKernelGetSystemInfo(pInfo=*0x%x)", pInfo);
|
||||
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
@ -262,7 +262,7 @@ s32 sceKernelDelayThreadCB(u32 usec)
|
||||
|
||||
s32 sceKernelWaitThreadEnd(s32 threadId, vm::psv::ptr<s32> pExitStatus, vm::psv::ptr<u32> pTimeout)
|
||||
{
|
||||
sceLibKernel.Warning("sceKernelWaitThreadEnd(threadId=0x%x, pExitStatus=0x%x, pTimeout=0x%x)", threadId, pExitStatus, pTimeout);
|
||||
sceLibKernel.Warning("sceKernelWaitThreadEnd(threadId=0x%x, pExitStatus=*0x%x, pTimeout=*0x%x)", threadId, pExitStatus, pTimeout);
|
||||
|
||||
std::shared_ptr<CPUThread> t = Emu.GetCPU().GetThread(threadId, CPU_THREAD_ARMv7);
|
||||
|
||||
@ -297,7 +297,7 @@ s32 sceKernelWaitThreadEnd(s32 threadId, vm::psv::ptr<s32> pExitStatus, vm::psv:
|
||||
|
||||
s32 sceKernelWaitThreadEndCB(s32 threadId, vm::psv::ptr<s32> pExitStatus, vm::psv::ptr<u32> pTimeout)
|
||||
{
|
||||
sceLibKernel.Todo("sceKernelWaitThreadEndCB(threadId=0x%x, pExitStatus=0x%x, pTimeout=0x%x)", threadId, pExitStatus, pTimeout);
|
||||
sceLibKernel.Todo("sceKernelWaitThreadEndCB(threadId=0x%x, pExitStatus=*0x%x, pTimeout=*0x%x)", threadId, pExitStatus, pTimeout);
|
||||
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
@ -395,7 +395,7 @@ s32 sceKernelWaitMultipleEventsCB(vm::psv::ptr<SceKernelWaitEvent> pWaitEventLis
|
||||
|
||||
s32 sceKernelCreateEventFlag(vm::psv::ptr<const char> pName, u32 attr, u32 initPattern, vm::psv::ptr<const SceKernelEventFlagOptParam> pOptParam)
|
||||
{
|
||||
sceLibKernel.Error("sceKernelCreateEventFlag(pName=0x%x, attr=0x%x, initPattern=0x%x, pOptParam=0x%x)", pName, attr, initPattern, pOptParam);
|
||||
sceLibKernel.Error("sceKernelCreateEventFlag(pName=*0x%x, attr=0x%x, initPattern=0x%x, pOptParam=*0x%x)", pName, attr, initPattern, pOptParam);
|
||||
|
||||
if (s32 id = g_psv_ef_list.add(new psv_event_flag_t(pName.get_ptr(), attr, initPattern), 0))
|
||||
{
|
||||
@ -459,7 +459,7 @@ s32 sceKernelGetEventFlagInfo(s32 evfId, vm::psv::ptr<SceKernelEventFlagInfo> pI
|
||||
|
||||
s32 sceKernelCreateSema(vm::psv::ptr<const char> pName, u32 attr, s32 initCount, s32 maxCount, vm::psv::ptr<const SceKernelSemaOptParam> pOptParam)
|
||||
{
|
||||
sceLibKernel.Error("sceKernelCreateSema(pName=0x%x, attr=0x%x, initCount=%d, maxCount=%d, pOptParam=0x%x)", pName, attr, initCount, maxCount, pOptParam);
|
||||
sceLibKernel.Error("sceKernelCreateSema(pName=*0x%x, attr=0x%x, initCount=%d, maxCount=%d, pOptParam=*0x%x)", pName, attr, initCount, maxCount, pOptParam);
|
||||
|
||||
if (s32 id = g_psv_sema_list.add(new psv_sema_t(pName.get_ptr(), attr, initCount, maxCount), 0))
|
||||
{
|
||||
@ -500,7 +500,7 @@ s32 sceKernelCloseSema(s32 semaId)
|
||||
|
||||
s32 sceKernelWaitSema(s32 semaId, s32 needCount, vm::psv::ptr<u32> pTimeout)
|
||||
{
|
||||
sceLibKernel.Error("sceKernelWaitSema(semaId=0x%x, needCount=%d, pTimeout=0x%x)", semaId, needCount, pTimeout);
|
||||
sceLibKernel.Error("sceKernelWaitSema(semaId=0x%x, needCount=%d, pTimeout=*0x%x)", semaId, needCount, pTimeout);
|
||||
|
||||
ref_t<psv_sema_t> sema = g_psv_sema_list.get(semaId);
|
||||
|
||||
@ -543,7 +543,7 @@ s32 sceKernelGetSemaInfo(s32 semaId, vm::psv::ptr<SceKernelSemaInfo> pInfo)
|
||||
|
||||
s32 sceKernelCreateMutex(vm::psv::ptr<const char> pName, u32 attr, s32 initCount, vm::psv::ptr<const SceKernelMutexOptParam> pOptParam)
|
||||
{
|
||||
sceLibKernel.Error("sceKernelCreateMutex(pName=0x%x, attr=0x%x, initCount=%d, pOptParam=0x%x)", pName, attr, initCount, pOptParam);
|
||||
sceLibKernel.Error("sceKernelCreateMutex(pName=*0x%x, attr=0x%x, initCount=%d, pOptParam=*0x%x)", pName, attr, initCount, pOptParam);
|
||||
|
||||
if (s32 id = g_psv_mutex_list.add(new psv_mutex_t(pName.get_ptr(), attr, initCount), 0))
|
||||
{
|
||||
@ -644,7 +644,7 @@ s32 sceKernelGetLwMutexInfoById(s32 lwMutexId, vm::psv::ptr<SceKernelLwMutexInfo
|
||||
|
||||
s32 sceKernelCreateCond(vm::psv::ptr<const char> pName, u32 attr, s32 mutexId, vm::psv::ptr<const SceKernelCondOptParam> pOptParam)
|
||||
{
|
||||
sceLibKernel.Error("sceKernelCreateCond(pName=0x%x, attr=0x%x, mutexId=0x%x, pOptParam=0x%x)", pName, attr, mutexId, pOptParam);
|
||||
sceLibKernel.Error("sceKernelCreateCond(pName=*0x%x, attr=0x%x, mutexId=0x%x, pOptParam=*0x%x)", pName, attr, mutexId, pOptParam);
|
||||
|
||||
if (s32 id = g_psv_cond_list.add(new psv_cond_t(pName.get_ptr(), attr, mutexId), 0))
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ namespace sce_libc_func
|
||||
{
|
||||
void __cxa_atexit(vm::psv::ptr<atexit_func_t> func, vm::psv::ptr<void> arg, vm::psv::ptr<void> dso)
|
||||
{
|
||||
sceLibc.Warning("__cxa_atexit(func=0x%x, arg=0x%x, dso=0x%x)", func, arg, dso);
|
||||
sceLibc.Warning("__cxa_atexit(func=*0x%x, arg=*0x%x, dso=*0x%x)", func, arg, dso);
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
@ -162,7 +162,7 @@ namespace sce_libc_func
|
||||
|
||||
void __aeabi_atexit(vm::psv::ptr<void> arg, vm::psv::ptr<atexit_func_t> func, vm::psv::ptr<void> dso)
|
||||
{
|
||||
sceLibc.Warning("__aeabi_atexit(arg=0x%x, func=0x%x, dso=0x%x)", arg, func, dso);
|
||||
sceLibc.Warning("__aeabi_atexit(arg=*0x%x, func=*0x%x, dso=*0x%x)", arg, func, dso);
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
@ -195,7 +195,7 @@ namespace sce_libc_func
|
||||
|
||||
void printf(ARMv7Context& context, vm::psv::ptr<const char> fmt) // va_args...
|
||||
{
|
||||
sceLibc.Warning("printf(fmt=0x%x)", fmt);
|
||||
sceLibc.Warning("printf(fmt=*0x%x)", fmt);
|
||||
sceLibc.Log("*** *fmt = '%s'", fmt.get_ptr());
|
||||
|
||||
const std::string& result = armv7_fmt(context, fmt, 1, 0, 0);
|
||||
@ -206,7 +206,7 @@ namespace sce_libc_func
|
||||
|
||||
void sprintf(ARMv7Context& context, vm::psv::ptr<char> str, vm::psv::ptr<const char> fmt) // va_args...
|
||||
{
|
||||
sceLibc.Warning("sprintf(str=0x%x, fmt=0x%x)", str, fmt);
|
||||
sceLibc.Warning("sprintf(str=*0x%x, fmt=*0x%x)", str, fmt);
|
||||
sceLibc.Log("*** *fmt = '%s'", fmt.get_ptr());
|
||||
|
||||
const std::string& result = armv7_fmt(context, fmt, 2, 0, 0);
|
||||
@ -217,28 +217,28 @@ namespace sce_libc_func
|
||||
|
||||
void __cxa_set_dso_handle_main(vm::psv::ptr<void> dso)
|
||||
{
|
||||
sceLibc.Warning("__cxa_set_dso_handle_main(dso=0x%x)", dso);
|
||||
sceLibc.Warning("__cxa_set_dso_handle_main(dso=*0x%x)", dso);
|
||||
|
||||
g_dso = dso;
|
||||
}
|
||||
|
||||
void memcpy(vm::psv::ptr<void> dst, vm::psv::ptr<const void> src, u32 size)
|
||||
{
|
||||
sceLibc.Warning("memcpy(dst=0x%x, src=0x%x, size=0x%x)", dst, src, size);
|
||||
sceLibc.Warning("memcpy(dst=*0x%x, src=*0x%x, size=0x%x)", dst, src, size);
|
||||
|
||||
::memcpy(dst.get_ptr(), src.get_ptr(), size);
|
||||
}
|
||||
|
||||
void memset(vm::psv::ptr<void> dst, s32 value, u32 size)
|
||||
{
|
||||
sceLibc.Warning("memset(dst=0x%x, value=%d, size=0x%x)", dst, value, size);
|
||||
sceLibc.Warning("memset(dst=*0x%x, value=%d, size=0x%x)", dst, value, size);
|
||||
|
||||
::memset(dst.get_ptr(), value, size);
|
||||
}
|
||||
|
||||
void _Assert(ARMv7Context& context, vm::psv::ptr<const char> text, vm::psv::ptr<const char> func)
|
||||
{
|
||||
sceLibc.Error("_Assert(text=0x%x, func=0x%x)", text, func);
|
||||
sceLibc.Error("_Assert(text=*0x%x, func=*0x%x)", text, func);
|
||||
|
||||
LOG_ERROR(TTY, "%s : %s\n", func.get_ptr(), text.get_ptr());
|
||||
LOG_NOTICE(ARMv7, context.thread.RegsToString());
|
||||
|
@ -187,7 +187,7 @@ s32 scePerfArmPmonStop(ARMv7Context& context, s32 threadId)
|
||||
|
||||
s32 scePerfArmPmonGetCounterValue(ARMv7Context& context, s32 threadId, u32 counter, vm::psv::ptr<u32> pValue)
|
||||
{
|
||||
scePerf.Warning("scePerfArmPmonGetCounterValue(threadId=0x%x, counter=%d, pValue=0x%x)", threadId, counter, pValue);
|
||||
scePerf.Warning("scePerfArmPmonGetCounterValue(threadId=0x%x, counter=%d, pValue=*0x%x)", threadId, counter, pValue);
|
||||
|
||||
if (threadId != SCE_PERF_ARM_PMON_THREAD_ID_SELF)
|
||||
{
|
||||
|
@ -42,8 +42,8 @@ struct FsRingBufferConfig
|
||||
|
||||
s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<const void> arg, u64 size)
|
||||
{
|
||||
sys_fs.Log("cellFsOpen(path_addr=0x%x, flags=0x%x, fd=0x%x, arg=0x%x, size=0x%llx)", path.addr(), flags, fd, arg, size);
|
||||
sys_fs.Log("cellFsOpen(path='%s')", path.get_ptr());
|
||||
sys_fs.Log("cellFsOpen(path=*0x%x, flags=0x%x, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size);
|
||||
sys_fs.Log("*** path = '%s'", path.get_ptr());
|
||||
|
||||
const std::string _path = path.get_ptr();
|
||||
|
||||
@ -145,7 +145,7 @@ s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread)
|
||||
|
||||
s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite)
|
||||
{
|
||||
sys_fs.Log("cellFsWrite(fd=0x%x, buf=0x%x, nbytes=0x%llx, nwrite=0x%x)", fd, buf, nbytes, nwrite);
|
||||
sys_fs.Log("cellFsWrite(fd=0x%x, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file)) return CELL_ESRCH;
|
||||
@ -173,8 +173,8 @@ s32 cellFsClose(u32 fd)
|
||||
|
||||
s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd)
|
||||
{
|
||||
sys_fs.Warning("cellFsOpendir(path_addr=0x%x, fd=0x%x)", path.addr(), fd);
|
||||
sys_fs.Warning("cellFsOpendir(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsOpendir(path=*0x%x, fd=*0x%x)", path, fd);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
std::shared_ptr<vfsDirBase> dir(Emu.GetVFS().OpenDir(path.get_ptr()));
|
||||
if (!dir || !dir->IsOpened())
|
||||
@ -188,7 +188,7 @@ s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd)
|
||||
|
||||
s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
|
||||
{
|
||||
sys_fs.Warning("cellFsReaddir(fd=0x%x, dir=0x%x, nread=0x%x)", fd, dir, nread);
|
||||
sys_fs.Warning("cellFsReaddir(fd=0x%x, dir=*0x%x, nread=*0x%x)", fd, dir, nread);
|
||||
|
||||
std::shared_ptr<vfsDirBase> directory;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, directory))
|
||||
@ -222,8 +222,8 @@ s32 cellFsClosedir(u32 fd)
|
||||
|
||||
s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
|
||||
{
|
||||
sys_fs.Warning("cellFsStat(path_addr=0x%x, sb=0x%x)", path.addr(), sb);
|
||||
sys_fs.Warning("cellFsStat(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsStat(path=*0x%x, sb=*0x%x)", path, sb);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
const std::string _path = path.get_ptr();
|
||||
|
||||
@ -305,7 +305,7 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
|
||||
|
||||
s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
|
||||
{
|
||||
sys_fs.Warning("cellFsFstat(fd=0x%x, sb=0x%x)", fd, sb);
|
||||
sys_fs.Warning("cellFsFstat(fd=0x%x, sb=*0x%x)", fd, sb);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -330,8 +330,8 @@ s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
|
||||
|
||||
s32 cellFsMkdir(vm::ptr<const char> path, u32 mode)
|
||||
{
|
||||
sys_fs.Warning("cellFsMkdir(path_addr=0x%x, mode=0x%x)", path.addr(), mode);
|
||||
sys_fs.Warning("cellFsMkdir(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsMkdir(path=*0x%x, mode=0x%x)", path, mode);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
const std::string _path = path.get_ptr();
|
||||
|
||||
@ -347,8 +347,9 @@ s32 cellFsMkdir(vm::ptr<const char> path, u32 mode)
|
||||
|
||||
s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
|
||||
{
|
||||
sys_fs.Warning("cellFsRename(from_addr=0x%x, to_addr=0x%x)", from.addr(), to.addr());
|
||||
sys_fs.Warning("cellFsRename(from='%s', to='%s')", from.get_ptr(), to.get_ptr());
|
||||
sys_fs.Warning("cellFsRename(from=*0x%x, to=*0x%x)", from, to);
|
||||
sys_fs.Warning("*** from = '%s'", from.get_ptr());
|
||||
sys_fs.Warning("*** to = '%s'", to.get_ptr());
|
||||
|
||||
std::string _from = from.get_ptr();
|
||||
std::string _to = to.get_ptr();
|
||||
@ -382,8 +383,8 @@ s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
|
||||
}
|
||||
s32 cellFsChmod(vm::ptr<const char> path, u32 mode)
|
||||
{
|
||||
sys_fs.Todo("cellFsChmod(path_addr=0x%x, mode=0x%x)", path.addr(), mode);
|
||||
sys_fs.Todo("cellFsChmod(path='%s')", path.get_ptr());
|
||||
sys_fs.Todo("cellFsChmod(path=*0x%x, mode=0x%x)", path, mode);
|
||||
sys_fs.Todo("*** path = '%s'", path.get_ptr());
|
||||
|
||||
// TODO:
|
||||
|
||||
@ -401,8 +402,8 @@ s32 cellFsFsync(u32 fd)
|
||||
|
||||
s32 cellFsRmdir(vm::ptr<const char> path)
|
||||
{
|
||||
sys_fs.Warning("cellFsRmdir(path_addr=0x%x)", path.addr());
|
||||
sys_fs.Warning("cellFsRmdir(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsRmdir(path=*0x%x)", path);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
std::string _path = path.get_ptr();
|
||||
|
||||
@ -419,8 +420,8 @@ s32 cellFsRmdir(vm::ptr<const char> path)
|
||||
|
||||
s32 cellFsUnlink(vm::ptr<const char> path)
|
||||
{
|
||||
sys_fs.Warning("cellFsUnlink(path_addr=0x%x)", path.addr());
|
||||
sys_fs.Warning("cellFsUnlink(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsUnlink(path=*0x%x)", path);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
std::string _path = path.get_ptr();
|
||||
|
||||
@ -439,7 +440,7 @@ s32 cellFsUnlink(vm::ptr<const char> path)
|
||||
|
||||
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos)
|
||||
{
|
||||
sys_fs.Log("cellFsLseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=0x%x)", fd, offset, whence, pos);
|
||||
sys_fs.Log("cellFsLseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos);
|
||||
|
||||
vfsSeekMode seek_mode;
|
||||
switch(whence)
|
||||
@ -490,8 +491,8 @@ s32 cellFsFtruncate(u32 fd, u64 size)
|
||||
|
||||
s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
|
||||
{
|
||||
sys_fs.Warning("cellFsTruncate(path_addr=0x%x, size=0x%llx)", path.addr(), size);
|
||||
sys_fs.Warning("cellFsTruncate(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsTruncate(path=*0x%x, size=0x%llx)", path, size);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
vfsFile f(path.get_ptr(), vfsReadWrite);
|
||||
if (!f.IsOpened())
|
||||
@ -521,7 +522,7 @@ s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
|
||||
|
||||
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
|
||||
{
|
||||
sys_fs.Warning("cellFsFGetBlockSize(fd=0x%x, sector_size=0x%x, block_size=0x%x)", fd, sector_size, block_size);
|
||||
sys_fs.Warning("cellFsFGetBlockSize(fd=0x%x, sector_size=*0x%x, block_size=*0x%x)", fd, sector_size, block_size);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -535,8 +536,8 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_siz
|
||||
|
||||
s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
|
||||
{
|
||||
sys_fs.Warning("cellFsGetBlockSize(path_addr=0x%x, sector_size=0x%x, block_size=0x%x)", path.addr(), sector_size, block_size);
|
||||
sys_fs.Warning("cellFsGetBlockSize(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsGetBlockSize(path=*0x%x, sector_size=*0x%x, block_size=*0x%x)", path, sector_size, block_size);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
*sector_size = 4096; // ?
|
||||
*block_size = 4096; // ?
|
||||
@ -546,8 +547,8 @@ s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::p
|
||||
|
||||
s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count)
|
||||
{
|
||||
sys_fs.Warning("cellFsGetFreeSize(path_addr=0x%x, block_size=0x%x, block_count=0x%x)", path.addr(), block_size, block_count);
|
||||
sys_fs.Warning("cellFsGetFreeSize(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsGetFreeSize(path=*0x%x, block_size=*0x%x, block_count=*0x%x)", path, block_size, block_count);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
|
||||
*block_size = 4096; // ?
|
||||
@ -558,7 +559,7 @@ s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr
|
||||
|
||||
s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count)
|
||||
{
|
||||
sys_fs.Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=0x%x, entries_size=0x%x, data_count=0x%x)", fd, entries, entries_size, data_count);
|
||||
sys_fs.Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count);
|
||||
|
||||
std::shared_ptr<vfsDirBase> directory;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, directory))
|
||||
@ -594,7 +595,7 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32
|
||||
|
||||
s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
|
||||
{
|
||||
sys_fs.Warning("cellFsStReadInit(fd=0x%x, ringbuf=0x%x)", fd, ringbuf);
|
||||
sys_fs.Warning("cellFsStReadInit(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -633,7 +634,7 @@ s32 cellFsStReadFinish(u32 fd)
|
||||
|
||||
s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
|
||||
{
|
||||
sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=0x%x)", fd, ringbuf);
|
||||
sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -648,7 +649,7 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
|
||||
|
||||
s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
|
||||
{
|
||||
sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, status=0x%x)", fd, status);
|
||||
sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, status=*0x%x)", fd, status);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -661,7 +662,7 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
|
||||
|
||||
s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
|
||||
{
|
||||
sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=0x%x)", fd, regid);
|
||||
sys_fs.Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=*0x%x)", fd, regid);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -701,7 +702,7 @@ s32 cellFsStReadStop(u32 fd)
|
||||
|
||||
s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
|
||||
{
|
||||
sys_fs.Warning("cellFsStRead(fd=0x%x, buf=0x%x, size=0x%llx, rsize=0x%x)", fd, buf, size, rsize);
|
||||
sys_fs.Warning("cellFsStRead(fd=0x%x, buf=*0x%x, size=0x%llx, rsize=*0x%x)", fd, buf, size, rsize);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -720,7 +721,7 @@ s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
|
||||
|
||||
s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<vm::ptr<u8>> addr, vm::ptr<u64> size)
|
||||
{
|
||||
sys_fs.Todo("cellFsStReadGetCurrentAddr(fd=0x%x, addr=0x%x, size=0x%x)", fd, addr, size);
|
||||
sys_fs.Todo("cellFsStReadGetCurrentAddr(fd=0x%x, addr=*0x%x, size=*0x%x)", fd, addr, size);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -731,7 +732,7 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<vm::ptr<u8>> addr, vm::ptr<u64> s
|
||||
|
||||
s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr<u8> addr, u64 size)
|
||||
{
|
||||
sys_fs.Todo("cellFsStReadPutCurrentAddr(fd=0x%x, addr=0x%x, size=0x%llx)", fd, addr, size);
|
||||
sys_fs.Todo("cellFsStReadPutCurrentAddr(fd=0x%x, addr=*0x%x, size=0x%llx)", fd, addr, size);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -753,7 +754,7 @@ s32 cellFsStReadWait(u32 fd, u64 size)
|
||||
|
||||
s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void(int xfd, u64 xsize)> func)
|
||||
{
|
||||
sys_fs.Todo("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=0x%x)", fd, size, func);
|
||||
sys_fs.Todo("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=*0x%x)", fd, size, func);
|
||||
|
||||
std::shared_ptr<vfsStream> file;
|
||||
if (!Emu.GetIdManager().GetIDData(fd, file))
|
||||
@ -864,8 +865,8 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
|
||||
|
||||
s32 cellFsSdataOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<const void> arg, u64 size)
|
||||
{
|
||||
sys_fs.Warning("cellFsSdataOpen(path_addr=0x%x, flags=0x%x, fd=0x%x, arg=0x%x, size=0x%llx) -> cellFsOpen()", path.addr(), flags, fd, arg, size);
|
||||
sys_fs.Warning("cellFsSdataOpen(path='%s')", path.get_ptr());
|
||||
sys_fs.Warning("cellFsSdataOpen(path=*0x%x, flags=0x%x, fd=*0x%x, arg=*0x%x, size=0x%llx) -> cellFsOpen()", path, flags, fd, arg, size);
|
||||
sys_fs.Warning("*** path = '%s'", path.get_ptr());
|
||||
|
||||
/*if (flags != CELL_O_RDONLY)
|
||||
return CELL_EINVAL;
|
||||
@ -889,7 +890,7 @@ s32 cellFsSdataOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd,
|
||||
|
||||
s32 cellFsSdataOpenByFd(u32 mself_fd, s32 flags, vm::ptr<u32> sdata_fd, u64 offset, vm::ptr<const void> arg, u64 size)
|
||||
{
|
||||
sys_fs.Todo("cellFsSdataOpenByFd(mself_fd=0x%x, flags=0x%x, sdata_fd=0x%x, offset=0x%llx, arg=0x%x, size=0x%llx)", mself_fd, flags, sdata_fd, offset, arg, size);
|
||||
sys_fs.Todo("cellFsSdataOpenByFd(mself_fd=0x%x, flags=0x%x, sdata_fd=*0x%x, offset=0x%llx, arg=*0x%x, size=0x%llx)", mself_fd, flags, sdata_fd, offset, arg, size);
|
||||
|
||||
// TODO:
|
||||
|
||||
@ -957,7 +958,7 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(vm::ptr<Cel
|
||||
|
||||
s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)> func)
|
||||
{
|
||||
sys_fs.Warning("cellFsAioRead(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func);
|
||||
sys_fs.Warning("cellFsAioRead(aio=*0x%x, id=*0x%x, func=*0x%x)", aio, id, func);
|
||||
|
||||
if (!aio_init)
|
||||
{
|
||||
@ -982,7 +983,7 @@ s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<
|
||||
|
||||
s32 cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr<CellFsAio> xaio, s32 error, s32 xid, u64 size)> func)
|
||||
{
|
||||
sys_fs.Todo("cellFsAioWrite(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func);
|
||||
sys_fs.Todo("cellFsAioWrite(aio=*0x%x, id=*0x%x, func=*0x%x)", aio, id, func);
|
||||
|
||||
// TODO:
|
||||
|
||||
@ -991,8 +992,8 @@ s32 cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, vm::ptr<void(vm::ptr
|
||||
|
||||
s32 cellFsAioInit(vm::ptr<const char> mount_point)
|
||||
{
|
||||
sys_fs.Warning("cellFsAioInit(mount_point_addr=0x%x)", mount_point.addr());
|
||||
sys_fs.Warning("cellFsAioInit(mount_point='%s')", mount_point.get_ptr());
|
||||
sys_fs.Warning("cellFsAioInit(mount_point=*0x%x)", mount_point);
|
||||
sys_fs.Warning("*** mount_point = '%s'", mount_point.get_ptr());
|
||||
|
||||
aio_init = true;
|
||||
return CELL_OK;
|
||||
@ -1000,8 +1001,8 @@ s32 cellFsAioInit(vm::ptr<const char> mount_point)
|
||||
|
||||
s32 cellFsAioFinish(vm::ptr<const char> mount_point)
|
||||
{
|
||||
sys_fs.Warning("cellFsAioFinish(mount_point_addr=0x%x)", mount_point.addr());
|
||||
sys_fs.Warning("cellFsAioFinish(mount_point='%s')", mount_point.get_ptr());
|
||||
sys_fs.Warning("cellFsAioFinish(mount_point=*0x%x)", mount_point);
|
||||
sys_fs.Warning("*** mount_point = '%s'", mount_point.get_ptr());
|
||||
|
||||
//aio_init = false;
|
||||
return CELL_OK;
|
||||
@ -1009,7 +1010,7 @@ s32 cellFsAioFinish(vm::ptr<const char> mount_point)
|
||||
|
||||
s32 cellFsReadWithOffset(PPUThread& CPU, u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size, vm::ptr<be_t<u64>> nread)
|
||||
{
|
||||
sys_fs.Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=0x%x, buffer_size=%lld, nread=0x%llx)", fd, offset, buf, buffer_size, nread);
|
||||
sys_fs.Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, buffer_size=%lld, nread=*0x%llx)", fd, offset, buf, buffer_size, nread);
|
||||
|
||||
int ret;
|
||||
vm::stackvar<be_t<u64>> oldPos(CPU), newPos(CPU);
|
||||
|
@ -266,12 +266,14 @@ s32 sys_spu_thread_group_destroy(u32 id)
|
||||
|
||||
Memory.MainMem.Free(spu.offset);
|
||||
Emu.GetCPU().RemoveThread(spu.GetId());
|
||||
|
||||
t.reset();
|
||||
}
|
||||
}
|
||||
|
||||
group->threads = {};
|
||||
group->state = SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED; // hack
|
||||
Emu.GetIdManager().RemoveID(id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user