mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-01 16:13:23 +00:00
ID manager simplified
ID manager refactoring, redundant "type" information removed
This commit is contained in:
parent
da8883d5d3
commit
dd665e7363
@ -253,7 +253,7 @@ void ARMv7Thread::fast_stop()
|
||||
|
||||
armv7_thread::armv7_thread(u32 entry, const std::string& name, u32 stack_size, s32 prio)
|
||||
{
|
||||
std::shared_ptr<ARMv7Thread> armv7 = Emu.GetIdManager().make_ptr<ARMv7Thread>(name);
|
||||
std::shared_ptr<ARMv7Thread> armv7 = idm::make_ptr<ARMv7Thread>(name);
|
||||
|
||||
armv7->PC = entry;
|
||||
armv7->stack_size = stack_size;
|
||||
|
@ -45,7 +45,7 @@ s32 sceKernelCreateThread(
|
||||
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 armv7 = Emu.GetIdManager().make_ptr<ARMv7Thread>(pName.get_ptr());
|
||||
auto armv7 = idm::make_ptr<ARMv7Thread>(pName.get_ptr());
|
||||
|
||||
armv7->PC = entry.addr();
|
||||
armv7->prio = initPriority;
|
||||
@ -59,7 +59,7 @@ s32 sceKernelStartThread(s32 threadId, u32 argSize, vm::cptr<void> pArgBlock)
|
||||
{
|
||||
sceLibKernel.Warning("sceKernelStartThread(threadId=0x%x, argSize=0x%x, pArgBlock=*0x%x)", threadId, argSize, pArgBlock);
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<ARMv7Thread>(threadId);
|
||||
const auto thread = idm::get<ARMv7Thread>(threadId);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -99,7 +99,7 @@ s32 sceKernelDeleteThread(s32 threadId)
|
||||
{
|
||||
sceLibKernel.Warning("sceKernelDeleteThread(threadId=0x%x)", threadId);
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<ARMv7Thread>(threadId);
|
||||
const auto thread = idm::get<ARMv7Thread>(threadId);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -113,7 +113,7 @@ s32 sceKernelDeleteThread(s32 threadId)
|
||||
// return SCE_KERNEL_ERROR_NOT_DORMANT;
|
||||
//}
|
||||
|
||||
Emu.GetIdManager().remove<ARMv7Thread>(threadId);
|
||||
idm::remove<ARMv7Thread>(threadId);
|
||||
return SCE_OK;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ s32 sceKernelExitDeleteThread(ARMv7Context& context, s32 exitStatus)
|
||||
|
||||
CallAfter([id]()
|
||||
{
|
||||
Emu.GetIdManager().remove<ARMv7Thread>(id);
|
||||
idm::remove<ARMv7Thread>(id);
|
||||
});
|
||||
|
||||
return SCE_OK;
|
||||
@ -258,7 +258,7 @@ s32 sceKernelWaitThreadEnd(s32 threadId, vm::ptr<s32> pExitStatus, vm::ptr<u32>
|
||||
{
|
||||
sceLibKernel.Warning("sceKernelWaitThreadEnd(threadId=0x%x, pExitStatus=*0x%x, pTimeout=*0x%x)", threadId, pExitStatus, pTimeout);
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<ARMv7Thread>(threadId);
|
||||
const auto thread = idm::get<ARMv7Thread>(threadId);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
CPUThread::CPUThread(CPUThreadType type, const std::string& name, std::function<std::string()> thread_name)
|
||||
: m_state({ CPU_STATE_STOPPED })
|
||||
, m_id(Emu.GetIdManager().get_current_id())
|
||||
, m_id(idm::get_current_id())
|
||||
, m_type(type)
|
||||
, m_name(name)
|
||||
{
|
||||
|
@ -32,22 +32,22 @@ std::vector<std::shared_ptr<CPUThread>> CPUThreadManager::GetAllThreads()
|
||||
{
|
||||
std::vector<std::shared_ptr<CPUThread>> result;
|
||||
|
||||
for (auto& t : Emu.GetIdManager().get_all<PPUThread>())
|
||||
for (auto& t : idm::get_all<PPUThread>())
|
||||
{
|
||||
result.emplace_back(t);
|
||||
}
|
||||
|
||||
for (auto& t : Emu.GetIdManager().get_all<SPUThread>())
|
||||
for (auto& t : idm::get_all<SPUThread>())
|
||||
{
|
||||
result.emplace_back(t);
|
||||
}
|
||||
|
||||
for (auto& t : Emu.GetIdManager().get_all<RawSPUThread>())
|
||||
for (auto& t : idm::get_all<RawSPUThread>())
|
||||
{
|
||||
result.emplace_back(t);
|
||||
}
|
||||
|
||||
for (auto& t : Emu.GetIdManager().get_all<ARMv7Thread>())
|
||||
for (auto& t : idm::get_all<ARMv7Thread>())
|
||||
{
|
||||
result.emplace_back(t);
|
||||
}
|
||||
@ -57,12 +57,12 @@ std::vector<std::shared_ptr<CPUThread>> CPUThreadManager::GetAllThreads()
|
||||
|
||||
void CPUThreadManager::Exec()
|
||||
{
|
||||
for (auto& t : Emu.GetIdManager().get_all<PPUThread>())
|
||||
for (auto& t : idm::get_all<PPUThread>())
|
||||
{
|
||||
t->exec();
|
||||
}
|
||||
|
||||
for (auto& t : Emu.GetIdManager().get_all<ARMv7Thread>())
|
||||
for (auto& t : idm::get_all<ARMv7Thread>())
|
||||
{
|
||||
t->exec();
|
||||
}
|
||||
@ -78,7 +78,7 @@ std::shared_ptr<RawSPUThread> CPUThreadManager::NewRawSPUThread()
|
||||
{
|
||||
if (m_raw_spu[i].expired())
|
||||
{
|
||||
m_raw_spu[i] = result = Emu.GetIdManager().make_ptr<RawSPUThread>(std::to_string(i), i);
|
||||
m_raw_spu[i] = result = idm::make_ptr<RawSPUThread>(std::to_string(i), i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ void Compiler::RunTest(const char * name, std::function<void()> test_case, std::
|
||||
|
||||
void Compiler::RunAllTests() {
|
||||
#ifdef PPU_LLVM_RECOMPILER_UNIT_TESTS
|
||||
s_ppu_state = Emu.GetIdManager().make_ptr<PPUThread>("Test Thread").get();
|
||||
s_ppu_state = idm::make_ptr<PPUThread>("Test Thread").get();
|
||||
PPUInterpreter interpreter(*s_ppu_state);
|
||||
s_interpreter = &interpreter;
|
||||
|
||||
@ -981,7 +981,6 @@ void Compiler::RunAllTests() {
|
||||
VERIFY_INSTRUCTION_AGAINST_INTERPRETER(DCBZ, 1, input, 14u, 23u);
|
||||
|
||||
m_recompilation_engine.Log() << "Finished Unit Tests\n";
|
||||
Emu.GetIdManager().remove<PPUThread>(s_ppu_state->get_id());
|
||||
idm::remove<PPUThread>(s_ppu_state->get_id());
|
||||
#endif // PPU_LLVM_RECOMPILER_UNIT_TESTS
|
||||
}
|
||||
#endif // LLVM_AVAILABLE
|
||||
}#endif // LLVM_AVAILABLE
|
@ -735,7 +735,7 @@ void PPUThread::task()
|
||||
|
||||
ppu_thread::ppu_thread(u32 entry, const std::string& name, u32 stack_size, s32 prio)
|
||||
{
|
||||
auto ppu = Emu.GetIdManager().make_ptr<PPUThread>(name);
|
||||
auto ppu = idm::make_ptr<PPUThread>(name);
|
||||
|
||||
if (entry)
|
||||
{
|
||||
|
@ -951,7 +951,7 @@ void SPUThread::set_ch_value(u32 ch, u32 value)
|
||||
LOG_WARNING(SPU, "sys_event_flag_set_bit(id=%d, value=0x%x (flag=%d))", data, value, flag);
|
||||
}
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(data);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(data);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -995,7 +995,7 @@ void SPUThread::set_ch_value(u32 ch, u32 value)
|
||||
LOG_WARNING(SPU, "sys_event_flag_set_bit_impatient(id=%d, value=0x%x (flag=%d))", data, value, flag);
|
||||
}
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(data);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(data);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -1476,7 +1476,7 @@ void SPUThread::halt()
|
||||
|
||||
spu_thread::spu_thread(u32 entry, const std::string& name, u32 stack_size, u32 prio)
|
||||
{
|
||||
auto spu = Emu.GetIdManager().make_ptr<SPUThread>(name, 0x13370666);
|
||||
auto spu = idm::make_ptr<SPUThread>(name, 0x13370666);
|
||||
|
||||
spu->PC = entry;
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto queue = Emu.GetIdManager().make_ptr<lv2_event_queue_t>(std::forward<Args>(args)...);
|
||||
auto queue = idm::make_ptr<lv2_event_queue_t>(std::forward<Args>(args)...);
|
||||
|
||||
if (key)
|
||||
{
|
||||
|
19
rpcs3/Emu/IdManager.cpp
Normal file
19
rpcs3/Emu/IdManager.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "stdafx.h"
|
||||
#include "IdManager.h"
|
||||
|
||||
namespace idm
|
||||
{
|
||||
std::mutex g_id_mutex;
|
||||
|
||||
std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
u32 g_cur_id = 1;
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
g_id_map.clear();
|
||||
g_cur_id = 1; // first ID
|
||||
}
|
||||
}
|
@ -2,136 +2,97 @@
|
||||
|
||||
#define ID_MANAGER_INCLUDED
|
||||
|
||||
// ID type
|
||||
enum : u32
|
||||
{
|
||||
ID_TYPE_NONE = 0,
|
||||
};
|
||||
|
||||
// Helper template to detect type
|
||||
template<typename T> struct ID_type
|
||||
{
|
||||
//static_assert(sizeof(T) == 0, "ID type not registered (use REG_ID_TYPE)");
|
||||
|
||||
static const u32 type = ID_TYPE_NONE; // default type
|
||||
};
|
||||
|
||||
class ID_data_t final
|
||||
{
|
||||
public:
|
||||
const std::shared_ptr<void> data;
|
||||
const std::type_info& info;
|
||||
const std::size_t hash;
|
||||
const u32 type;
|
||||
const u32 id;
|
||||
|
||||
template<typename T> force_inline ID_data_t(std::shared_ptr<T> data, u32 type, u32 id)
|
||||
template<typename T> force_inline ID_data_t(std::shared_ptr<T> data)
|
||||
: data(std::move(data))
|
||||
, info(typeid(T))
|
||||
, hash(typeid(T).hash_code())
|
||||
, type(type)
|
||||
, id(id)
|
||||
{
|
||||
}
|
||||
|
||||
ID_data_t(const ID_data_t& right)
|
||||
: data(right.data)
|
||||
, info(right.info)
|
||||
, hash(right.hash)
|
||||
, type(right.type)
|
||||
, id(right.id)
|
||||
{
|
||||
}
|
||||
|
||||
ID_data_t& operator =(const ID_data_t& right) = delete;
|
||||
|
||||
ID_data_t(ID_data_t&& right)
|
||||
: data(std::move(const_cast<std::shared_ptr<void>&>(right.data)))
|
||||
, info(right.info)
|
||||
, hash(right.hash)
|
||||
, type(right.type)
|
||||
, id(right.id)
|
||||
{
|
||||
}
|
||||
|
||||
ID_data_t& operator =(ID_data_t&& other) = delete;
|
||||
};
|
||||
|
||||
class ID_manager
|
||||
// ID Manager
|
||||
// 0 is invalid ID
|
||||
// 1..0x7fffffff : general purpose IDs
|
||||
// 0x80000000+ : occupied by fixed IDs
|
||||
namespace idm
|
||||
{
|
||||
std::mutex m_mutex;
|
||||
|
||||
// 0 is invalid ID
|
||||
// 1..0x7fffffff : general purpose IDs
|
||||
// 0x80000000+ : occupied by fixed IDs
|
||||
std::unordered_map<u32, ID_data_t> m_id_map;
|
||||
|
||||
// contains the next ID or 0x80000000 | current_ID
|
||||
u32 m_cur_id = 1;
|
||||
|
||||
static u32 get_type_fixed_id(const std::type_info& type)
|
||||
// for internal use
|
||||
inline u32 get_type_fixed_id(const std::type_info& type)
|
||||
{
|
||||
// TODO: more reliable way of fixed ID generation
|
||||
// TODO: better way of fixed ID generation
|
||||
return 0x80000000 | static_cast<u32>(type.hash_code());
|
||||
}
|
||||
|
||||
public:
|
||||
// check if ID exists and has specified type
|
||||
template<typename T> bool check_id(u32 id)
|
||||
// reinitialize ID manager
|
||||
void clear();
|
||||
|
||||
// check if ID exists
|
||||
template<typename T> bool check(u32 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
const auto f = m_id_map.find(id);
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
return f != m_id_map.end() && f->second.info == typeid(T);
|
||||
const auto f = g_id_map.find(id);
|
||||
|
||||
return f != g_id_map.end() && f->second.info == typeid(T);
|
||||
}
|
||||
|
||||
// check if ID exists and has specified type
|
||||
bool check_id(u32 id, u32 type)
|
||||
// check if fixed ID exists
|
||||
template<typename T> bool check_fixed()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
static const u32 id = get_type_fixed_id(typeid(T));
|
||||
|
||||
const auto f = m_id_map.find(id);
|
||||
|
||||
return f != m_id_map.end() && f->second.type == type;
|
||||
return check<T>(id);
|
||||
}
|
||||
|
||||
// must be called from the constructor called through make() or make_ptr() to get further ID of current object
|
||||
u32 get_current_id()
|
||||
inline u32 get_current_id()
|
||||
{
|
||||
if ((m_cur_id & 0x80000000) == 0)
|
||||
// contains the next ID or 0x80000000 | current_ID
|
||||
extern u32 g_cur_id;
|
||||
|
||||
if ((g_cur_id & 0x80000000) == 0)
|
||||
{
|
||||
throw EXCEPTION("Current ID is not available");
|
||||
}
|
||||
|
||||
return m_cur_id & 0x7fffffff;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
m_id_map.clear();
|
||||
m_cur_id = 1; // first ID
|
||||
return g_cur_id & 0x7fffffff;
|
||||
}
|
||||
|
||||
// add fixed ID of specified type only if it doesn't exist (each type has unique id)
|
||||
template<typename T, typename... Args, typename = std::enable_if_t<std::is_constructible<T, Args...>::value>> std::shared_ptr<T> make_fixed(Args&&... args)
|
||||
template<typename T, typename... Args> std::enable_if_t<std::is_constructible<T, Args...>::value, std::shared_ptr<T>> make_fixed(Args&&... args)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
const u32 type = ID_type<T>::type;
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
static const u32 id = get_type_fixed_id(typeid(T));
|
||||
|
||||
const auto found = m_id_map.find(id);
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
const auto found = g_id_map.find(id);
|
||||
|
||||
// ensure that this ID doesn't exist
|
||||
if (found == m_id_map.end())
|
||||
if (found == g_id_map.end())
|
||||
{
|
||||
auto ptr = std::make_shared<T>(std::forward<Args>(args)...);
|
||||
|
||||
m_id_map.emplace(id, ID_data_t(ptr, type, id));
|
||||
g_id_map.emplace(id, ID_data_t(ptr));
|
||||
|
||||
return std::move(ptr);
|
||||
}
|
||||
@ -146,21 +107,23 @@ public:
|
||||
}
|
||||
|
||||
// add new ID of specified type with specified constructor arguments (returns object)
|
||||
template<typename T, typename... Args, typename = std::enable_if_t<std::is_constructible<T, Args...>::value>> std::shared_ptr<T> make_ptr(Args&&... args)
|
||||
template<typename T, typename... Args> std::enable_if_t<std::is_constructible<T, Args...>::value, std::shared_ptr<T>> make_ptr(Args&&... args)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
extern u32 g_cur_id;
|
||||
|
||||
const u32 type = ID_type<T>::type;
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
m_cur_id |= 0x80000000;
|
||||
g_cur_id |= 0x80000000;
|
||||
|
||||
if (const u32 id = m_cur_id & 0x7fffffff)
|
||||
if (const u32 id = g_cur_id & 0x7fffffff)
|
||||
{
|
||||
auto ptr = std::make_shared<T>(std::forward<Args>(args)...);
|
||||
|
||||
m_id_map.emplace(id, ID_data_t(ptr, type, id));
|
||||
g_id_map.emplace(id, ID_data_t(ptr));
|
||||
|
||||
m_cur_id = id + 1;
|
||||
g_cur_id = id + 1;
|
||||
|
||||
return std::move(ptr);
|
||||
}
|
||||
@ -171,17 +134,19 @@ public:
|
||||
// add new ID of specified type with specified constructor arguments (returns id)
|
||||
template<typename T, typename... Args> std::enable_if_t<std::is_constructible<T, Args...>::value, u32> make(Args&&... args)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
extern u32 g_cur_id;
|
||||
|
||||
const u32 type = ID_type<T>::type;
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
m_cur_id |= 0x80000000;
|
||||
g_cur_id |= 0x80000000;
|
||||
|
||||
if (const u32 id = m_cur_id & 0x7fffffff)
|
||||
if (const u32 id = g_cur_id & 0x7fffffff)
|
||||
{
|
||||
m_id_map.emplace(id, ID_data_t(std::make_shared<T>(std::forward<Args>(args)...), type, id));
|
||||
g_id_map.emplace(id, ID_data_t(std::make_shared<T>(std::forward<Args>(args)...)));
|
||||
|
||||
m_cur_id = id + 1;
|
||||
g_cur_id = id + 1;
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -189,16 +154,19 @@ public:
|
||||
throw EXCEPTION("Out of IDs");
|
||||
}
|
||||
|
||||
// load fixed ID of specified type Orig, optionally static_cast to T
|
||||
template<typename T, typename Orig = T> auto get() -> decltype(std::shared_ptr<T>(static_cast<T*>(std::declval<Orig*>())))
|
||||
// get fixed ID of specified type
|
||||
template<typename T> std::shared_ptr<T> get_fixed()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
static const u32 id = get_type_fixed_id(typeid(T));
|
||||
|
||||
const auto found = m_id_map.find(id);
|
||||
const auto found = g_id_map.find(id);
|
||||
|
||||
if (found == m_id_map.end() || found->second.info != typeid(Orig))
|
||||
if (found == g_id_map.end() || found->second.info != typeid(T))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -206,14 +174,17 @@ public:
|
||||
return std::static_pointer_cast<T>(found->second.data);
|
||||
}
|
||||
|
||||
// load ID created with type Orig, optionally static_cast to T
|
||||
template<typename T, typename Orig = T> auto get(u32 id) -> decltype(std::shared_ptr<T>(static_cast<T*>(std::declval<Orig*>())))
|
||||
// get ID of specified type
|
||||
template<typename T> std::shared_ptr<T> get(u32 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
const auto found = m_id_map.find(id);
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
if (found == m_id_map.end() || found->second.info != typeid(Orig))
|
||||
const auto found = g_id_map.find(id);
|
||||
|
||||
if (found == g_id_map.end() || found->second.info != typeid(T))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -221,18 +192,21 @@ public:
|
||||
return std::static_pointer_cast<T>(found->second.data);
|
||||
}
|
||||
|
||||
// load all IDs created with type Orig, optionally static_cast to T
|
||||
template<typename T, typename Orig = T> auto get_all() -> std::vector<decltype(std::shared_ptr<T>(static_cast<T*>(std::declval<Orig*>())))>
|
||||
// load all IDs of specified type T
|
||||
template<typename T> std::vector<std::shared_ptr<T>> get_all()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
std::vector<std::shared_ptr<T>> result;
|
||||
|
||||
const std::size_t hash = typeid(Orig).hash_code();
|
||||
const std::size_t hash = typeid(T).hash_code();
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
for (auto& v : g_id_map)
|
||||
{
|
||||
if (v.second.hash == hash && v.second.info == typeid(Orig))
|
||||
if (v.second.hash == hash && v.second.info == typeid(T))
|
||||
{
|
||||
result.emplace_back(std::static_pointer_cast<T>(v.second.data));
|
||||
}
|
||||
@ -241,51 +215,46 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
// remove fixed ID created with type T
|
||||
template<typename T> bool remove()
|
||||
// remove ID created with type T
|
||||
template<typename T> bool remove(u32 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
static const u32 id = get_type_fixed_id(typeid(T));
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
const auto found = m_id_map.find(id);
|
||||
const auto found = g_id_map.find(id);
|
||||
|
||||
if (found == m_id_map.end() || found->second.info != typeid(T))
|
||||
if (found == g_id_map.end() || found->second.info != typeid(T))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_id_map.erase(found);
|
||||
g_id_map.erase(found);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// remove ID created with type T
|
||||
template<typename T> bool remove(u32 id)
|
||||
// remove fixed ID created with type T
|
||||
template<typename T> bool remove_fixed()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
static const u32 id = get_type_fixed_id(typeid(T));
|
||||
|
||||
const auto found = m_id_map.find(id);
|
||||
|
||||
if (found == m_id_map.end() || found->second.info != typeid(T))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_id_map.erase(found);
|
||||
|
||||
return true;
|
||||
return remove<T>(id);
|
||||
}
|
||||
|
||||
template<typename T> u32 get_count()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
u32 result = 0;
|
||||
|
||||
const std::size_t hash = typeid(T).hash_code();
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
for (auto& v : g_id_map)
|
||||
{
|
||||
if (v.second.hash == hash && v.second.info == typeid(T))
|
||||
{
|
||||
@ -296,33 +265,19 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 get_count(u32 type)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
u32 result = 0;
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
{
|
||||
if (v.second.type == type)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// get sorted ID list
|
||||
// get sorted ID list of specified type
|
||||
template<typename T> std::set<u32> get_set()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
std::set<u32> result;
|
||||
|
||||
const std::size_t hash = typeid(T).hash_code();
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
for (auto& v : g_id_map)
|
||||
{
|
||||
if (v.second.hash == hash && v.second.info == typeid(T))
|
||||
{
|
||||
@ -333,54 +288,23 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
// get sorted ID list
|
||||
std::set<u32> get_set(u32 type)
|
||||
// get sorted ID map (ID value -> ID data) of specified type
|
||||
template<typename T> std::map<u32, std::shared_ptr<T>> get_map()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
extern std::mutex g_id_mutex;
|
||||
extern std::unordered_map<u32, ID_data_t> g_id_map;
|
||||
|
||||
std::set<u32> result;
|
||||
std::lock_guard<std::mutex> lock(g_id_mutex);
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
{
|
||||
if (v.second.type == type)
|
||||
{
|
||||
result.insert(v.first);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T> std::vector<ID_data_t> get_data()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
std::vector<ID_data_t> result;
|
||||
std::map<u32, std::shared_ptr<T>> result;
|
||||
|
||||
const std::size_t hash = typeid(T).hash_code();
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
for (auto& v : g_id_map)
|
||||
{
|
||||
if (v.second.hash == hash && v.second.info == typeid(T))
|
||||
{
|
||||
result.emplace_back(v.second);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<ID_data_t> get_data(u32 type)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
std::vector<ID_data_t> result;
|
||||
|
||||
for (auto& v : m_id_map)
|
||||
{
|
||||
if (v.second.type == type)
|
||||
{
|
||||
result.emplace_back(v.second);
|
||||
result[v.first] = std::static_pointer_cast<T>(v.second.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void CallbackManager::Init()
|
||||
|
||||
if (vm::get(vm::main)->addr != 0x10000)
|
||||
{
|
||||
auto thread = Emu.GetIdManager().make_ptr<ARMv7Thread>("Callback Thread");
|
||||
auto thread = idm::make_ptr<ARMv7Thread>("Callback Thread");
|
||||
|
||||
thread->prio = 1001;
|
||||
thread->stack_size = 0x10000;
|
||||
@ -93,7 +93,7 @@ void CallbackManager::Init()
|
||||
}
|
||||
else
|
||||
{
|
||||
auto thread = Emu.GetIdManager().make_ptr<PPUThread>("Callback Thread");
|
||||
auto thread = idm::make_ptr<PPUThread>("Callback Thread");
|
||||
|
||||
thread->prio = 1001;
|
||||
thread->stack_size = 0x10000;
|
||||
|
@ -213,12 +213,12 @@ next:
|
||||
|
||||
void adecOpen(u32 adec_id) // TODO: call from the constructor
|
||||
{
|
||||
const auto sptr = Emu.GetIdManager().get<AudioDecoder>(adec_id);
|
||||
const auto sptr = idm::get<AudioDecoder>(adec_id);
|
||||
AudioDecoder& adec = *sptr;
|
||||
|
||||
adec.id = adec_id;
|
||||
|
||||
adec.adecCb = Emu.GetIdManager().make_ptr<PPUThread>(fmt::format("Demuxer[0x%x] Thread", adec_id));
|
||||
adec.adecCb = idm::make_ptr<PPUThread>(fmt::format("Demuxer[0x%x] Thread", adec_id));
|
||||
adec.adecCb->prio = 1001;
|
||||
adec.adecCb->stack_size = 0x10000;
|
||||
adec.adecCb->custom_task = [sptr](PPUThread& CPU)
|
||||
@ -525,7 +525,7 @@ s32 cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::
|
||||
return CELL_ADEC_ERROR_ARG;
|
||||
}
|
||||
|
||||
adecOpen(*handle = Emu.GetIdManager().make<AudioDecoder>(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
|
||||
adecOpen(*handle = idm::make<AudioDecoder>(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -539,7 +539,7 @@ s32 cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res,
|
||||
return CELL_ADEC_ERROR_ARG;
|
||||
}
|
||||
|
||||
adecOpen(*handle = Emu.GetIdManager().make<AudioDecoder>(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
|
||||
adecOpen(*handle = idm::make<AudioDecoder>(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -555,7 +555,7 @@ s32 cellAdecClose(u32 handle)
|
||||
{
|
||||
cellAdec.Warning("cellAdecClose(handle=0x%x)", handle);
|
||||
|
||||
const auto adec = Emu.GetIdManager().get<AudioDecoder>(handle);
|
||||
const auto adec = idm::get<AudioDecoder>(handle);
|
||||
|
||||
if (!adec)
|
||||
{
|
||||
@ -572,8 +572,8 @@ s32 cellAdecClose(u32 handle)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<PPUThread>(adec->adecCb->get_id());
|
||||
Emu.GetIdManager().remove<AudioDecoder>(handle);
|
||||
idm::remove<PPUThread>(adec->adecCb->get_id());
|
||||
idm::remove<AudioDecoder>(handle);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -581,7 +581,7 @@ s32 cellAdecStartSeq(u32 handle, u32 param)
|
||||
{
|
||||
cellAdec.Warning("cellAdecStartSeq(handle=0x%x, param=*0x%x)", handle, param);
|
||||
|
||||
const auto adec = Emu.GetIdManager().get<AudioDecoder>(handle);
|
||||
const auto adec = idm::get<AudioDecoder>(handle);
|
||||
|
||||
if (!adec)
|
||||
{
|
||||
@ -634,7 +634,7 @@ s32 cellAdecEndSeq(u32 handle)
|
||||
{
|
||||
cellAdec.Warning("cellAdecEndSeq(handle=0x%x)", handle);
|
||||
|
||||
const auto adec = Emu.GetIdManager().get<AudioDecoder>(handle);
|
||||
const auto adec = idm::get<AudioDecoder>(handle);
|
||||
|
||||
if (!adec)
|
||||
{
|
||||
@ -649,7 +649,7 @@ s32 cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo)
|
||||
{
|
||||
cellAdec.Log("cellAdecDecodeAu(handle=0x%x, auInfo=*0x%x)", handle, auInfo);
|
||||
|
||||
const auto adec = Emu.GetIdManager().get<AudioDecoder>(handle);
|
||||
const auto adec = idm::get<AudioDecoder>(handle);
|
||||
|
||||
if (!adec)
|
||||
{
|
||||
@ -672,7 +672,7 @@ s32 cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
|
||||
{
|
||||
cellAdec.Log("cellAdecGetPcm(handle=0x%x, outBuffer=*0x%x)", handle, outBuffer);
|
||||
|
||||
const auto adec = Emu.GetIdManager().get<AudioDecoder>(handle);
|
||||
const auto adec = idm::get<AudioDecoder>(handle);
|
||||
|
||||
if (!adec)
|
||||
{
|
||||
@ -788,7 +788,7 @@ s32 cellAdecGetPcmItem(u32 handle, vm::pptr<CellAdecPcmItem> pcmItem)
|
||||
{
|
||||
cellAdec.Log("cellAdecGetPcmItem(handle=0x%x, pcmItem=**0x%x)", handle, pcmItem);
|
||||
|
||||
const auto adec = Emu.GetIdManager().get<AudioDecoder>(handle);
|
||||
const auto adec = idm::get<AudioDecoder>(handle);
|
||||
|
||||
if (!adec)
|
||||
{
|
||||
|
@ -9,6 +9,75 @@
|
||||
|
||||
extern Module cellCamera;
|
||||
|
||||
static const char* get_camera_attr_name(s32 value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case CELL_CAMERA_GAIN: return "GAIN";
|
||||
case CELL_CAMERA_REDBLUEGAIN: return "REDBLUEGAIN";
|
||||
case CELL_CAMERA_SATURATION: return "SATURATION";
|
||||
case CELL_CAMERA_EXPOSURE: return "EXPOSURE";
|
||||
case CELL_CAMERA_BRIGHTNESS: return "BRIGHTNESS";
|
||||
case CELL_CAMERA_AEC: return "AEC";
|
||||
case CELL_CAMERA_AGC: return "AGC";
|
||||
case CELL_CAMERA_AWB: return "AWB";
|
||||
case CELL_CAMERA_ABC: return "ABC";
|
||||
case CELL_CAMERA_LED: return "LED";
|
||||
case CELL_CAMERA_AUDIOGAIN: return "AUDIOGAIN";
|
||||
case CELL_CAMERA_QS: return "QS";
|
||||
case CELL_CAMERA_NONZEROCOEFFS: return "NONZEROCOEFFS";
|
||||
case CELL_CAMERA_YUVFLAG: return "YUVFLAG";
|
||||
case CELL_CAMERA_JPEGFLAG: return "JPEGFLAG";
|
||||
case CELL_CAMERA_BACKLIGHTCOMP: return "BACKLIGHTCOMP";
|
||||
case CELL_CAMERA_MIRRORFLAG: return "MIRRORFLAG";
|
||||
case CELL_CAMERA_MEASUREDQS: return "MEASUREDQS";
|
||||
case CELL_CAMERA_422FLAG: return "422FLAG";
|
||||
case CELL_CAMERA_USBLOAD: return "USBLOAD";
|
||||
case CELL_CAMERA_GAMMA: return "GAMMA";
|
||||
case CELL_CAMERA_GREENGAIN: return "GREENGAIN";
|
||||
case CELL_CAMERA_AGCLIMIT: return "AGCLIMIT";
|
||||
case CELL_CAMERA_DENOISE: return "DENOISE";
|
||||
case CELL_CAMERA_FRAMERATEADJUST: return "FRAMERATEADJUST";
|
||||
case CELL_CAMERA_PIXELOUTLIERFILTER: return "PIXELOUTLIERFILTER";
|
||||
case CELL_CAMERA_AGCLOW: return "AGCLOW";
|
||||
case CELL_CAMERA_AGCHIGH: return "AGCHIGH";
|
||||
case CELL_CAMERA_DEVICELOCATION: return "DEVICELOCATION";
|
||||
case CELL_CAMERA_FORMATCAP: return "FORMATCAP";
|
||||
case CELL_CAMERA_FORMATINDEX: return "FORMATINDEX";
|
||||
case CELL_CAMERA_NUMFRAME: return "NUMFRAME";
|
||||
case CELL_CAMERA_FRAMEINDEX: return "FRAMEINDEX";
|
||||
case CELL_CAMERA_FRAMESIZE: return "FRAMESIZE";
|
||||
case CELL_CAMERA_INTERVALTYPE: return "INTERVALTYPE";
|
||||
case CELL_CAMERA_INTERVALINDEX: return "INTERVALINDEX";
|
||||
case CELL_CAMERA_INTERVALVALUE: return "INTERVALVALUE";
|
||||
case CELL_CAMERA_COLORMATCHING: return "COLORMATCHING";
|
||||
case CELL_CAMERA_PLFREQ: return "PLFREQ";
|
||||
case CELL_CAMERA_DEVICEID: return "DEVICEID";
|
||||
case CELL_CAMERA_DEVICECAP: return "DEVICECAP";
|
||||
case CELL_CAMERA_DEVICESPEED: return "DEVICESPEED";
|
||||
case CELL_CAMERA_UVCREQCODE: return "UVCREQCODE";
|
||||
case CELL_CAMERA_UVCREQDATA: return "UVCREQDATA";
|
||||
case CELL_CAMERA_DEVICEID2: return "DEVICEID2";
|
||||
case CELL_CAMERA_READMODE: return "READMODE";
|
||||
case CELL_CAMERA_GAMEPID: return "GAMEPID";
|
||||
case CELL_CAMERA_PBUFFER: return "PBUFFER";
|
||||
case CELL_CAMERA_READFINISH: return "READFINISH";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Custom struct to keep track of cameras
|
||||
struct camera_t
|
||||
{
|
||||
struct attr_t
|
||||
{
|
||||
u32 v1, v2;
|
||||
};
|
||||
|
||||
attr_t attr[500]{};
|
||||
};
|
||||
|
||||
s32 cellCameraInit()
|
||||
{
|
||||
cellCamera.Warning("cellCameraInit()");
|
||||
@ -18,7 +87,7 @@ s32 cellCameraInit()
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
const auto camera = Emu.GetIdManager().make_fixed<camera_t>();
|
||||
const auto camera = idm::make_fixed<camera_t>();
|
||||
|
||||
if (!camera)
|
||||
{
|
||||
@ -69,7 +138,7 @@ s32 cellCameraEnd()
|
||||
{
|
||||
cellCamera.Warning("cellCameraEnd()");
|
||||
|
||||
if (!Emu.GetIdManager().remove<camera_t>())
|
||||
if (!idm::remove_fixed<camera_t>())
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
@ -105,7 +174,7 @@ s32 cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
|
||||
{
|
||||
cellCamera.Warning("cellCameraGetType(dev_num=%d, type=*0x%x)", dev_num, type);
|
||||
|
||||
const auto camera = Emu.GetIdManager().get<camera_t>();
|
||||
const auto camera = idm::get_fixed<camera_t>();
|
||||
|
||||
if (!camera)
|
||||
{
|
||||
@ -157,9 +226,9 @@ s32 cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr<u32> arg1, vm::ptr<u
|
||||
{
|
||||
cellCamera.Warning("cellCameraGetAttribute(dev_num=%d, attrib=%d, arg1=*0x%x, arg2=*0x%x)", dev_num, attrib, arg1, arg2);
|
||||
|
||||
const auto attr_name = camera_t::get_attr_name(attrib);
|
||||
const auto attr_name = get_camera_attr_name(attrib);
|
||||
|
||||
const auto camera = Emu.GetIdManager().get<camera_t>();
|
||||
const auto camera = idm::get_fixed<camera_t>();
|
||||
|
||||
if (!camera)
|
||||
{
|
||||
@ -181,9 +250,9 @@ s32 cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2)
|
||||
{
|
||||
cellCamera.Warning("cellCameraSetAttribute(dev_num=%d, attrib=%d, arg1=%d, arg2=%d)", dev_num, attrib, arg1, arg2);
|
||||
|
||||
const auto attr_name = camera_t::get_attr_name(attrib);
|
||||
const auto attr_name = get_camera_attr_name(attrib);
|
||||
|
||||
const auto camera = Emu.GetIdManager().get<camera_t>();
|
||||
const auto camera = idm::get_fixed<camera_t>();
|
||||
|
||||
if (!camera)
|
||||
{
|
||||
|
@ -311,72 +311,3 @@ struct CellCameraReadEx
|
||||
be_t<s64> timestamp;
|
||||
vm::bptr<u8> pbuf;
|
||||
};
|
||||
|
||||
// Custom struct to keep track of cameras
|
||||
struct camera_t
|
||||
{
|
||||
struct attr_t
|
||||
{
|
||||
u32 v1, v2;
|
||||
};
|
||||
|
||||
attr_t attr[500]{};
|
||||
|
||||
static const char* get_attr_name(s32 value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case CELL_CAMERA_GAIN: return "CELL_CAMERA_GAIN";
|
||||
case CELL_CAMERA_REDBLUEGAIN: return "CELL_CAMERA_REDBLUEGAIN";
|
||||
case CELL_CAMERA_SATURATION: return "CELL_CAMERA_SATURATION";
|
||||
case CELL_CAMERA_EXPOSURE: return "CELL_CAMERA_EXPOSURE";
|
||||
case CELL_CAMERA_BRIGHTNESS: return "CELL_CAMERA_BRIGHTNESS";
|
||||
case CELL_CAMERA_AEC: return "CELL_CAMERA_AEC";
|
||||
case CELL_CAMERA_AGC: return "CELL_CAMERA_AGC";
|
||||
case CELL_CAMERA_AWB: return "CELL_CAMERA_AWB";
|
||||
case CELL_CAMERA_ABC: return "CELL_CAMERA_ABC";
|
||||
case CELL_CAMERA_LED: return "CELL_CAMERA_LED";
|
||||
case CELL_CAMERA_AUDIOGAIN: return "CELL_CAMERA_AUDIOGAIN";
|
||||
case CELL_CAMERA_QS: return "CELL_CAMERA_QS";
|
||||
case CELL_CAMERA_NONZEROCOEFFS: return "CELL_CAMERA_NONZEROCOEFFS";
|
||||
case CELL_CAMERA_YUVFLAG: return "CELL_CAMERA_YUVFLAG";
|
||||
case CELL_CAMERA_JPEGFLAG: return "CELL_CAMERA_JPEGFLAG";
|
||||
case CELL_CAMERA_BACKLIGHTCOMP: return "CELL_CAMERA_BACKLIGHTCOMP";
|
||||
case CELL_CAMERA_MIRRORFLAG: return "CELL_CAMERA_MIRRORFLAG";
|
||||
case CELL_CAMERA_MEASUREDQS: return "CELL_CAMERA_MEASUREDQS";
|
||||
case CELL_CAMERA_422FLAG: return "CELL_CAMERA_422FLAG";
|
||||
case CELL_CAMERA_USBLOAD: return "CELL_CAMERA_USBLOAD";
|
||||
case CELL_CAMERA_GAMMA: return "CELL_CAMERA_GAMMA";
|
||||
case CELL_CAMERA_GREENGAIN: return "CELL_CAMERA_GREENGAIN";
|
||||
case CELL_CAMERA_AGCLIMIT: return "CELL_CAMERA_AGCLIMIT";
|
||||
case CELL_CAMERA_DENOISE: return "CELL_CAMERA_DENOISE";
|
||||
case CELL_CAMERA_FRAMERATEADJUST: return "CELL_CAMERA_FRAMERATEADJUST";
|
||||
case CELL_CAMERA_PIXELOUTLIERFILTER: return "CELL_CAMERA_PIXELOUTLIERFILTER";
|
||||
case CELL_CAMERA_AGCLOW: return "CELL_CAMERA_AGCLOW";
|
||||
case CELL_CAMERA_AGCHIGH: return "CELL_CAMERA_AGCHIGH";
|
||||
case CELL_CAMERA_DEVICELOCATION: return "CELL_CAMERA_DEVICELOCATION";
|
||||
case CELL_CAMERA_FORMATCAP: return "CELL_CAMERA_FORMATCAP";
|
||||
case CELL_CAMERA_FORMATINDEX: return "CELL_CAMERA_FORMATINDEX";
|
||||
case CELL_CAMERA_NUMFRAME: return "CELL_CAMERA_NUMFRAME";
|
||||
case CELL_CAMERA_FRAMEINDEX: return "CELL_CAMERA_FRAMEINDEX";
|
||||
case CELL_CAMERA_FRAMESIZE: return "CELL_CAMERA_FRAMESIZE";
|
||||
case CELL_CAMERA_INTERVALTYPE: return "CELL_CAMERA_INTERVALTYPE";
|
||||
case CELL_CAMERA_INTERVALINDEX: return "CELL_CAMERA_INTERVALINDEX";
|
||||
case CELL_CAMERA_INTERVALVALUE: return "CELL_CAMERA_INTERVALVALUE";
|
||||
case CELL_CAMERA_COLORMATCHING: return "CELL_CAMERA_COLORMATCHING";
|
||||
case CELL_CAMERA_PLFREQ: return "CELL_CAMERA_PLFREQ";
|
||||
case CELL_CAMERA_DEVICEID: return "CELL_CAMERA_DEVICEID";
|
||||
case CELL_CAMERA_DEVICECAP: return "CELL_CAMERA_DEVICECAP";
|
||||
case CELL_CAMERA_DEVICESPEED: return "CELL_CAMERA_DEVICESPEED";
|
||||
case CELL_CAMERA_UVCREQCODE: return "CELL_CAMERA_UVCREQCODE";
|
||||
case CELL_CAMERA_UVCREQDATA: return "CELL_CAMERA_UVCREQDATA";
|
||||
case CELL_CAMERA_DEVICEID2: return "CELL_CAMERA_DEVICEID2";
|
||||
case CELL_CAMERA_READMODE: return "CELL_CAMERA_READMODE";
|
||||
case CELL_CAMERA_GAMEPID: return "CELL_CAMERA_GAMEPID";
|
||||
case CELL_CAMERA_PBUFFER: return "CELL_CAMERA_PBUFFER";
|
||||
case CELL_CAMERA_READFINISH: return "CELL_CAMERA_READFINISH";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ PesHeader::PesHeader(DemuxerStream& stream)
|
||||
|
||||
ElementaryStream::ElementaryStream(Demuxer* dmux, u32 addr, u32 size, u32 fidMajor, u32 fidMinor, u32 sup1, u32 sup2, vm::ptr<CellDmuxCbEsMsg> cbFunc, u32 cbArg, u32 spec)
|
||||
: dmux(dmux)
|
||||
, id(Emu.GetIdManager().get_current_id())
|
||||
, id(idm::get_current_id())
|
||||
, memAddr(align(addr, 128))
|
||||
, memSize(size - (addr - memAddr))
|
||||
, fidMajor(fidMajor)
|
||||
@ -297,12 +297,12 @@ void dmuxQueryEsAttr(u32 info /* may be 0 */, vm::cptr<CellCodecEsFilterId> esFi
|
||||
|
||||
void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
||||
{
|
||||
const auto sptr = Emu.GetIdManager().get<Demuxer>(dmux_id);
|
||||
const auto sptr = idm::get<Demuxer>(dmux_id);
|
||||
Demuxer& dmux = *sptr;
|
||||
|
||||
dmux.id = dmux_id;
|
||||
|
||||
dmux.dmuxCb = Emu.GetIdManager().make_ptr<PPUThread>(fmt::format("Demuxer[0x%x] Thread", dmux_id));
|
||||
dmux.dmuxCb = idm::make_ptr<PPUThread>(fmt::format("Demuxer[0x%x] Thread", dmux_id));
|
||||
dmux.dmuxCb->prio = 1001;
|
||||
dmux.dmuxCb->stack_size = 0x10000;
|
||||
dmux.dmuxCb->custom_task = [sptr](PPUThread& CPU)
|
||||
@ -700,7 +700,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
||||
}
|
||||
}
|
||||
es.dmux = nullptr;
|
||||
Emu.GetIdManager().remove<ElementaryStream>(task.es.es);
|
||||
idm::remove<ElementaryStream>(task.es.es);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -803,7 +803,7 @@ s32 cellDmuxOpen(vm::cptr<CellDmuxType> type, vm::cptr<CellDmuxResource> res, vm
|
||||
|
||||
// TODO: check demuxerResource and demuxerCb arguments
|
||||
|
||||
dmuxOpen(*handle = Emu.GetIdManager().make<Demuxer>(res->memAddr, res->memSize, cb->cbMsgFunc, cb->cbArg));
|
||||
dmuxOpen(*handle = idm::make<Demuxer>(res->memAddr, res->memSize, cb->cbMsgFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -819,7 +819,7 @@ s32 cellDmuxOpenEx(vm::cptr<CellDmuxType> type, vm::cptr<CellDmuxResourceEx> res
|
||||
|
||||
// TODO: check demuxerResourceEx and demuxerCb arguments
|
||||
|
||||
dmuxOpen(*handle = Emu.GetIdManager().make<Demuxer>(resEx->memAddr, resEx->memSize, cb->cbMsgFunc, cb->cbArg));
|
||||
dmuxOpen(*handle = idm::make<Demuxer>(resEx->memAddr, resEx->memSize, cb->cbMsgFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -842,7 +842,7 @@ s32 cellDmuxOpen2(vm::cptr<CellDmuxType2> type2, vm::cptr<CellDmuxResource2> res
|
||||
|
||||
// TODO: check demuxerType2, demuxerResource2 and demuxerCb arguments
|
||||
|
||||
dmuxOpen(*handle = Emu.GetIdManager().make<Demuxer>(res2->memAddr, res2->memSize, cb->cbMsgFunc, cb->cbArg));
|
||||
dmuxOpen(*handle = idm::make<Demuxer>(res2->memAddr, res2->memSize, cb->cbMsgFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -851,7 +851,7 @@ s32 cellDmuxClose(u32 handle)
|
||||
{
|
||||
cellDmux.Warning("cellDmuxClose(handle=0x%x)", handle);
|
||||
|
||||
const auto dmux = Emu.GetIdManager().get<Demuxer>(handle);
|
||||
const auto dmux = idm::get<Demuxer>(handle);
|
||||
|
||||
if (!dmux)
|
||||
{
|
||||
@ -872,8 +872,8 @@ s32 cellDmuxClose(u32 handle)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<PPUThread>(dmux->dmuxCb->get_id());
|
||||
Emu.GetIdManager().remove<Demuxer>(handle);
|
||||
idm::remove<PPUThread>(dmux->dmuxCb->get_id());
|
||||
idm::remove<Demuxer>(handle);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -881,7 +881,7 @@ s32 cellDmuxSetStream(u32 handle, u32 streamAddress, u32 streamSize, b8 disconti
|
||||
{
|
||||
cellDmux.Log("cellDmuxSetStream(handle=0x%x, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx)", handle, streamAddress, streamSize, discontinuity, userData);
|
||||
|
||||
const auto dmux = Emu.GetIdManager().get<Demuxer>(handle);
|
||||
const auto dmux = idm::get<Demuxer>(handle);
|
||||
|
||||
if (!dmux)
|
||||
{
|
||||
@ -909,7 +909,7 @@ s32 cellDmuxResetStream(u32 handle)
|
||||
{
|
||||
cellDmux.Warning("cellDmuxResetStream(handle=0x%x)", handle);
|
||||
|
||||
const auto dmux = Emu.GetIdManager().get<Demuxer>(handle);
|
||||
const auto dmux = idm::get<Demuxer>(handle);
|
||||
|
||||
if (!dmux)
|
||||
{
|
||||
@ -924,7 +924,7 @@ s32 cellDmuxResetStreamAndWaitDone(u32 handle)
|
||||
{
|
||||
cellDmux.Warning("cellDmuxResetStreamAndWaitDone(handle=0x%x)", handle);
|
||||
|
||||
const auto dmux = Emu.GetIdManager().get<Demuxer>(handle);
|
||||
const auto dmux = idm::get<Demuxer>(handle);
|
||||
|
||||
if (!dmux)
|
||||
{
|
||||
@ -985,7 +985,7 @@ s32 cellDmuxEnableEs(u32 handle, vm::cptr<CellCodecEsFilterId> esFilterId, vm::c
|
||||
{
|
||||
cellDmux.Warning("cellDmuxEnableEs(handle=0x%x, esFilterId=*0x%x, esResourceInfo=*0x%x, esCb=*0x%x, esSpecificInfo=*0x%x, esHandle=*0x%x)", handle, esFilterId, esResourceInfo, esCb, esSpecificInfo, esHandle);
|
||||
|
||||
const auto dmux = Emu.GetIdManager().get<Demuxer>(handle);
|
||||
const auto dmux = idm::get<Demuxer>(handle);
|
||||
|
||||
if (!dmux)
|
||||
{
|
||||
@ -994,7 +994,7 @@ s32 cellDmuxEnableEs(u32 handle, vm::cptr<CellCodecEsFilterId> esFilterId, vm::c
|
||||
|
||||
// TODO: check esFilterId, esResourceInfo, esCb and esSpecificInfo correctly
|
||||
|
||||
const auto es = Emu.GetIdManager().make_ptr<ElementaryStream>(dmux.get(), esResourceInfo->memAddr, esResourceInfo->memSize,
|
||||
const auto es = idm::make_ptr<ElementaryStream>(dmux.get(), esResourceInfo->memAddr, esResourceInfo->memSize,
|
||||
esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2,
|
||||
esCb->cbEsMsgFunc, esCb->cbArg, esSpecificInfo);
|
||||
|
||||
@ -1015,7 +1015,7 @@ s32 cellDmuxDisableEs(u32 esHandle)
|
||||
{
|
||||
cellDmux.Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1034,7 +1034,7 @@ s32 cellDmuxResetEs(u32 esHandle)
|
||||
{
|
||||
cellDmux.Log("cellDmuxResetEs(esHandle=0x%x)", esHandle);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1053,7 +1053,7 @@ s32 cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo, vm::ptr<u32> auSpecificInfo
|
||||
{
|
||||
cellDmux.Log("cellDmuxGetAu(esHandle=0x%x, auInfo=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfo, auSpecificInfo);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1076,7 +1076,7 @@ s32 cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo, vm::ptr<u32> auSpecificInf
|
||||
{
|
||||
cellDmux.Log("cellDmuxPeekAu(esHandle=0x%x, auInfo=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfo, auSpecificInfo);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1099,7 +1099,7 @@ s32 cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx, vm::ptr<u32> auSpecific
|
||||
{
|
||||
cellDmux.Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfoEx, auSpecificInfo);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1122,7 +1122,7 @@ s32 cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx, vm::ptr<u32> auSpecifi
|
||||
{
|
||||
cellDmux.Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfoEx, auSpecificInfo);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1145,7 +1145,7 @@ s32 cellDmuxReleaseAu(u32 esHandle)
|
||||
{
|
||||
cellDmux.Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
@ -1163,7 +1163,7 @@ s32 cellDmuxFlushEs(u32 esHandle)
|
||||
{
|
||||
cellDmux.Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle);
|
||||
|
||||
const auto es = Emu.GetIdManager().get<ElementaryStream>(esHandle);
|
||||
const auto es = idm::get<ElementaryStream>(esHandle);
|
||||
|
||||
if (!es)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32
|
||||
{
|
||||
cellFs.Warning("cellFsGetDirectoryEntries(fd=%d, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count);
|
||||
|
||||
const auto directory = Emu.GetIdManager().get<lv2_dir_t>(_fd_to_id(fd));
|
||||
const auto directory = idm::get<lv2_dir_t>(_fd_to_id(fd));
|
||||
|
||||
if (!directory)
|
||||
{
|
||||
@ -256,7 +256,7 @@ s32 cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size,
|
||||
|
||||
// TODO: use single sys_fs_fcntl syscall
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file || file->flags & CELL_FS_O_WRONLY)
|
||||
{
|
||||
@ -287,7 +287,7 @@ s32 cellFsWriteWithOffset(u32 fd, u64 offset, vm::cptr<void> buf, u64 data_size,
|
||||
|
||||
// TODO: use single sys_fs_fcntl syscall
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file || !(file->flags & CELL_FS_O_ACCMODE))
|
||||
{
|
||||
@ -331,7 +331,7 @@ s32 cellFsStReadInit(u32 fd, vm::cptr<CellFsRingBuffer> ringbuf)
|
||||
return CELL_FS_EINVAL;
|
||||
}
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -369,7 +369,7 @@ s32 cellFsStReadFinish(u32 fd)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadFinish(fd=%d)", fd);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -392,7 +392,7 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadGetRingBuf(fd=%d, ringbuf=*0x%x)", fd, ringbuf);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -416,7 +416,7 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadGetRingBuf(fd=%d, status=*0x%x)", fd, status);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -450,7 +450,7 @@ s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadGetRingBuf(fd=%d, regid=*0x%x)", fd, regid);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -471,7 +471,7 @@ s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -552,7 +552,7 @@ s32 cellFsStReadStop(u32 fd)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadStop(fd=%d)", fd);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -583,7 +583,7 @@ s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
|
||||
{
|
||||
cellFs.Warning("cellFsStRead(fd=%d, buf=*0x%x, size=0x%llx, rsize=*0x%x)", fd, buf, size, rsize);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -617,7 +617,7 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<u32> addr, vm::ptr<u64> size)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadGetCurrentAddr(fd=%d, addr=*0x%x, size=*0x%x)", fd, addr, size);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -650,7 +650,7 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr<u8> addr, u64 size)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadPutCurrentAddr(fd=%d, addr=*0x%x, size=0x%llx)", fd, addr, size);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -677,7 +677,7 @@ s32 cellFsStReadWait(u32 fd, u64 size)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadWait(fd=%d, size=0x%llx)", fd, size);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -706,7 +706,7 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, fs_st_cb_t func)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadWaitCallback(fd=%d, size=0x%llx, func=*0x%x)", fd, size, func);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -850,7 +850,7 @@ s32 cellFsSdataOpen(PPUThread& CPU, vm::cptr<char> path, s32 flags, vm::ptr<u32>
|
||||
s32 ret = sdata_unpack(path, unpacked_path);
|
||||
if (ret) return ret;
|
||||
|
||||
fd = Emu.GetIdManager().GetNewID(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), TYPE_FS_FILE);
|
||||
fd = idm::GetNewID(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), TYPE_FS_FILE);
|
||||
|
||||
return CELL_OK;
|
||||
*/
|
||||
@ -874,7 +874,7 @@ void fsAio(vm::ptr<CellFsAio> aio, bool write, s32 xid, fs_aio_cb_t func)
|
||||
s32 error = CELL_OK;
|
||||
u64 result = 0;
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(aio->fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(aio->fd));
|
||||
|
||||
if (!file || (!write && file->flags & CELL_FS_O_WRONLY) || (write && !(file->flags & CELL_FS_O_ACCMODE)))
|
||||
{
|
||||
@ -968,7 +968,7 @@ s32 cellFsSetIoBufferFromDefaultContainer(u32 fd, u32 buffer_size, u32 page_type
|
||||
{
|
||||
cellFs.Todo("cellFsSetIoBufferFromDefaultContainer(fd=%d, buffer_size=%d, page_type=%d)", fd, buffer_size, page_type);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
|
@ -18,33 +18,38 @@ extern "C"
|
||||
|
||||
extern Module cellGifDec;
|
||||
|
||||
s32 cellGifDecCreate(
|
||||
vm::ptr<CellGifDecMainHandle> mainHandle,
|
||||
vm::cptr<CellGifDecThreadInParam> threadInParam,
|
||||
vm::ptr<CellGifDecThreadOutParam> threadOutParam)
|
||||
// cellGifDec aliases (only for cellGifDec.cpp)
|
||||
using PPMainHandle = vm::pptr<GifDecoder>;
|
||||
using PMainHandle = vm::ptr<GifDecoder>;
|
||||
using PThreadInParam = vm::cptr<CellGifDecThreadInParam>;
|
||||
using PThreadOutParam = vm::ptr<CellGifDecThreadOutParam>;
|
||||
using PExtThreadInParam = vm::cptr<CellGifDecExtThreadInParam>;
|
||||
using PExtThreadOutParam = vm::ptr<CellGifDecExtThreadOutParam>;
|
||||
using PPSubHandle = vm::pptr<GifStream>;
|
||||
using PSubHandle = vm::ptr<GifStream>;
|
||||
using PSrc = vm::cptr<CellGifDecSrc>;
|
||||
using POpenInfo = vm::ptr<CellGifDecOpnInfo>;
|
||||
using PInfo = vm::ptr<CellGifDecInfo>;
|
||||
using PInParam = vm::cptr<CellGifDecInParam>;
|
||||
using POutParam = vm::ptr<CellGifDecOutParam>;
|
||||
using PDataCtrlParam = vm::cptr<CellGifDecDataCtrlParam>;
|
||||
using PDataOutInfo = vm::ptr<CellGifDecDataOutInfo>;
|
||||
|
||||
s32 cellGifDecCreate(PPMainHandle mainHandle, PThreadInParam threadInParam, PThreadOutParam threadOutParam)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGifDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellGifDecExtCreate(
|
||||
vm::ptr<CellGifDecMainHandle> mainHandle,
|
||||
vm::cptr<CellGifDecThreadInParam> threadInParam,
|
||||
vm::ptr<CellGifDecThreadOutParam> threadOutParam,
|
||||
vm::cptr<CellGifDecExtThreadInParam> extThreadInParam,
|
||||
vm::ptr<CellGifDecExtThreadOutParam> extThreadOutParam)
|
||||
s32 cellGifDecExtCreate(PPMainHandle mainHandle, PThreadInParam threadInParam, PThreadOutParam threadOutParam, PExtThreadInParam extThreadInParam, PExtThreadOutParam extThreadOutParam)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGifDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellGifDecOpen(
|
||||
CellGifDecMainHandle mainHandle,
|
||||
vm::ptr<CellGifDecSubHandle> subHandle,
|
||||
vm::cptr<CellGifDecSrc> src,
|
||||
vm::ptr<CellGifDecOpnInfo> openInfo)
|
||||
s32 cellGifDecOpen(PMainHandle mainHandle, PPSubHandle subHandle, PSrc src, POpenInfo openInfo)
|
||||
{
|
||||
cellGifDec.Warning("cellGifDecOpen(mainHandle=0x%x, subHandle=*0x%x, src=*0x%x, openInfo=*0x%x)", mainHandle, subHandle, src, openInfo);
|
||||
cellGifDec.Warning("cellGifDecOpen(mainHandle=*0x%x, subHandle=**0x%x, src=*0x%x, openInfo=*0x%x)", mainHandle, subHandle, src, openInfo);
|
||||
|
||||
GifStream current_subHandle;
|
||||
current_subHandle.fd = 0;
|
||||
@ -62,14 +67,15 @@ s32 cellGifDecOpen(
|
||||
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
|
||||
if (!file_s) return CELL_GIFDEC_ERROR_OPEN_FILE;
|
||||
|
||||
current_subHandle.fd = Emu.GetIdManager().make<lv2_file_t>(file_s, 0, 0);
|
||||
current_subHandle.fd = idm::make<lv2_file_t>(file_s, 0, 0);
|
||||
current_subHandle.fileSize = file_s->GetSize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// From now, every u32 subHandle argument is a pointer to a CellGifDecSubHandle struct.
|
||||
*subHandle = Emu.GetIdManager().make<GifStream>(current_subHandle);
|
||||
subHandle->set(vm::alloc(sizeof32(GifStream), vm::main));
|
||||
|
||||
**subHandle = current_subHandle;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -79,36 +85,26 @@ s32 cellGifDecExtOpen()
|
||||
throw EXCEPTION("");
|
||||
}
|
||||
|
||||
s32 cellGifDecReadHeader(
|
||||
CellGifDecMainHandle mainHandle,
|
||||
CellGifDecSubHandle subHandle,
|
||||
vm::ptr<CellGifDecInfo> info)
|
||||
s32 cellGifDecReadHeader(PMainHandle mainHandle, PSubHandle subHandle, PInfo info)
|
||||
{
|
||||
cellGifDec.Warning("cellGifDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info=*0x%x)", mainHandle, subHandle, info);
|
||||
cellGifDec.Warning("cellGifDecReadHeader(mainHandle=*0x%x, subHandle=*0x%x, info=*0x%x)", mainHandle, subHandle, info);
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
return CELL_GIFDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
const u32& fd = subHandle_data->fd;
|
||||
const u64& fileSize = subHandle_data->fileSize;
|
||||
CellGifDecInfo& current_info = subHandle_data->info;
|
||||
const u32& fd = subHandle->fd;
|
||||
const u64& fileSize = subHandle->fileSize;
|
||||
CellGifDecInfo& current_info = subHandle->info;
|
||||
|
||||
// Write the header to buffer
|
||||
u8 buffer[13];
|
||||
|
||||
switch(subHandle_data->src.srcSelect.value())
|
||||
switch (subHandle->src.srcSelect.value())
|
||||
{
|
||||
case CELL_GIFDEC_BUFFER:
|
||||
std::memcpy(buffer, subHandle_data->src.streamPtr.get_ptr(), sizeof(buffer));
|
||||
std::memcpy(buffer, subHandle->src.streamPtr.get_ptr(), sizeof(buffer));
|
||||
break;
|
||||
|
||||
case CELL_GIFDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
auto file = idm::get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
file->file->Read(buffer, sizeof(buffer));
|
||||
break;
|
||||
@ -141,23 +137,12 @@ s32 cellGifDecExtReadHeader()
|
||||
throw EXCEPTION("");
|
||||
}
|
||||
|
||||
s32 cellGifDecSetParameter(
|
||||
CellGifDecMainHandle mainHandle,
|
||||
CellGifDecSubHandle subHandle,
|
||||
vm::cptr<CellGifDecInParam> inParam,
|
||||
vm::ptr<CellGifDecOutParam> outParam)
|
||||
s32 cellGifDecSetParameter(PMainHandle mainHandle, PSubHandle subHandle, PInParam inParam, POutParam outParam)
|
||||
{
|
||||
cellGifDec.Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam);
|
||||
cellGifDec.Warning("cellGifDecSetParameter(mainHandle=*0x%x, subHandle=*0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam);
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
return CELL_GIFDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
CellGifDecInfo& current_info = subHandle_data->info;
|
||||
CellGifDecOutParam& current_outParam = subHandle_data->outParam;
|
||||
CellGifDecInfo& current_info = subHandle->info;
|
||||
CellGifDecOutParam& current_outParam = subHandle->outParam;
|
||||
|
||||
current_outParam.outputWidthByte = (current_info.SWidth * current_info.SColorResolution * 3)/8;
|
||||
current_outParam.outputWidth = current_info.SWidth;
|
||||
@ -182,40 +167,28 @@ s32 cellGifDecExtSetParameter()
|
||||
throw EXCEPTION("");
|
||||
}
|
||||
|
||||
s32 cellGifDecDecodeData(
|
||||
CellGifDecMainHandle mainHandle,
|
||||
CellGifDecSubHandle subHandle,
|
||||
vm::ptr<u8> data,
|
||||
vm::cptr<CellGifDecDataCtrlParam> dataCtrlParam,
|
||||
vm::ptr<CellGifDecDataOutInfo> dataOutInfo)
|
||||
s32 cellGifDecDecodeData(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<u8> data, PDataCtrlParam dataCtrlParam, PDataOutInfo dataOutInfo)
|
||||
{
|
||||
cellGifDec.Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)", mainHandle, subHandle, data, dataCtrlParam, dataOutInfo);
|
||||
cellGifDec.Warning("cellGifDecDecodeData(mainHandle=*0x%x, subHandle=*0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)", mainHandle, subHandle, data, dataCtrlParam, dataOutInfo);
|
||||
|
||||
dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
return CELL_GIFDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
const u32& fd = subHandle_data->fd;
|
||||
const u64& fileSize = subHandle_data->fileSize;
|
||||
const CellGifDecOutParam& current_outParam = subHandle_data->outParam;
|
||||
const u32& fd = subHandle->fd;
|
||||
const u64& fileSize = subHandle->fileSize;
|
||||
const CellGifDecOutParam& current_outParam = subHandle->outParam;
|
||||
|
||||
//Copy the GIF file to a buffer
|
||||
std::unique_ptr<u8[]> gif(new u8[fileSize]);
|
||||
|
||||
switch(subHandle_data->src.srcSelect.value())
|
||||
switch (subHandle->src.srcSelect.value())
|
||||
{
|
||||
case CELL_GIFDEC_BUFFER:
|
||||
std::memcpy(gif.get(), subHandle_data->src.streamPtr.get_ptr(), fileSize);
|
||||
std::memcpy(gif.get(), subHandle->src.streamPtr.get_ptr(), fileSize);
|
||||
break;
|
||||
|
||||
case CELL_GIFDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
auto file = idm::get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
file->file->Read(gif.get(), fileSize);
|
||||
break;
|
||||
@ -313,24 +286,18 @@ s32 cellGifDecExtDecodeData()
|
||||
throw EXCEPTION("");
|
||||
}
|
||||
|
||||
s32 cellGifDecClose(CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle)
|
||||
s32 cellGifDecClose(PMainHandle mainHandle, PSubHandle subHandle)
|
||||
{
|
||||
cellGifDec.Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle);
|
||||
cellGifDec.Warning("cellGifDecClose(mainHandle=*0x%x, subHandle=*0x%x)", mainHandle, subHandle);
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
|
||||
idm::remove<lv2_file_t>(subHandle->fd);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
return CELL_GIFDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_file_t>(subHandle_data->fd);
|
||||
Emu.GetIdManager().remove<CellGifDecSubHandle>(subHandle);
|
||||
vm::dealloc(subHandle.addr());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellGifDecDestroy(CellGifDecMainHandle mainHandle)
|
||||
s32 cellGifDecDestroy(PMainHandle mainHandle)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellGifDec);
|
||||
return CELL_OK;
|
||||
|
@ -52,10 +52,6 @@ enum CellGifDecDecodeStatus : s32
|
||||
CELL_GIFDEC_DEC_STATUS_STOP = 1, // Decoding was stopped
|
||||
};
|
||||
|
||||
// Handles
|
||||
using CellGifDecMainHandle = vm::ptr<struct GifDecoder>;
|
||||
using CellGifDecSubHandle = u32; // vm::ptr<struct GifStream>;
|
||||
|
||||
// Callbacks for memory management
|
||||
using CellGifDecCbControlMalloc = vm::ptr<void>(u32 size, vm::ptr<void> cbCtrlMallocArg);
|
||||
using CellGifDecCbControlFree = s32(vm::ptr<void> ptr, vm::ptr<void> cbCtrlFreeArg);
|
||||
|
@ -56,14 +56,14 @@ s32 cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc
|
||||
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
|
||||
if (!file_s) return CELL_JPGDEC_ERROR_OPEN_FILE;
|
||||
|
||||
current_subHandle.fd = Emu.GetIdManager().make<lv2_file_t>(file_s, 0, 0);
|
||||
current_subHandle.fd = idm::make<lv2_file_t>(file_s, 0, 0);
|
||||
current_subHandle.fileSize = file_s->GetSize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// From now, every u32 subHandle argument is a pointer to a CellJpgDecSubHandle struct.
|
||||
*subHandle = Emu.GetIdManager().make<CellJpgDecSubHandle>(current_subHandle);
|
||||
*subHandle = idm::make<CellJpgDecSubHandle>(current_subHandle);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -77,15 +77,15 @@ s32 cellJpgDecClose(u32 mainHandle, u32 subHandle)
|
||||
{
|
||||
cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle);
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<CellJpgDecSubHandle>(subHandle);
|
||||
const auto subHandle_data = idm::get<CellJpgDecSubHandle>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
return CELL_JPGDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_file_t>(subHandle_data->fd);
|
||||
Emu.GetIdManager().remove<CellJpgDecSubHandle>(subHandle);
|
||||
idm::remove<lv2_file_t>(subHandle_data->fd);
|
||||
idm::remove<CellJpgDecSubHandle>(subHandle);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -94,7 +94,7 @@ s32 cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
|
||||
{
|
||||
cellJpgDec.Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info=*0x%x)", mainHandle, subHandle, info);
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<CellJpgDecSubHandle>(subHandle);
|
||||
const auto subHandle_data = idm::get<CellJpgDecSubHandle>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
@ -116,7 +116,7 @@ s32 cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
|
||||
|
||||
case CELL_JPGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
auto file = idm::get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
file->file->Read(buffer.get(), fileSize);
|
||||
break;
|
||||
@ -173,7 +173,7 @@ s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::cp
|
||||
|
||||
dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP;
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<CellJpgDecSubHandle>(subHandle);
|
||||
const auto subHandle_data = idm::get<CellJpgDecSubHandle>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
@ -195,7 +195,7 @@ s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::cp
|
||||
|
||||
case CELL_JPGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
auto file = idm::get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
file->file->Read(jpg.get(), fileSize);
|
||||
break;
|
||||
@ -312,7 +312,7 @@ s32 cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::cptr<CellJpgDecInP
|
||||
{
|
||||
cellJpgDec.Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam);
|
||||
|
||||
const auto subHandle_data = Emu.GetIdManager().get<CellJpgDecSubHandle>(subHandle);
|
||||
const auto subHandle_data = idm::get<CellJpgDecSubHandle>(subHandle);
|
||||
|
||||
if (!subHandle_data)
|
||||
{
|
||||
|
@ -17,13 +17,32 @@ extern "C"
|
||||
|
||||
extern Module cellPngDec;
|
||||
|
||||
s32 pngDecCreate(
|
||||
vm::ptr<CellPngDecMainHandle> mainHandle,
|
||||
vm::cptr<CellPngDecThreadInParam> param,
|
||||
vm::cptr<CellPngDecExtThreadInParam> ext = vm::null)
|
||||
// cellPngDec aliases (only for cellPngDec.cpp)
|
||||
using PPMainHandle = vm::pptr<PngDecoder>;
|
||||
using PMainHandle = vm::ptr<PngDecoder>;
|
||||
using PThreadInParam = vm::cptr<CellPngDecThreadInParam>;
|
||||
using PThreadOutParam = vm::ptr<CellPngDecThreadOutParam>;
|
||||
using PExtThreadInParam = vm::cptr<CellPngDecExtThreadInParam>;
|
||||
using PExtThreadOutParam = vm::ptr<CellPngDecExtThreadOutParam>;
|
||||
using PPSubHandle = vm::pptr<PngStream>;
|
||||
using PSubHandle = vm::ptr<PngStream>;
|
||||
using PSrc = vm::cptr<CellPngDecSrc>;
|
||||
using POpenInfo = vm::ptr<CellPngDecOpnInfo>;
|
||||
using PInfo = vm::ptr<CellPngDecInfo>;
|
||||
using PExtInfo = vm::ptr<CellPngDecExtInfo>;
|
||||
using PInParam = vm::cptr<CellPngDecInParam>;
|
||||
using POutParam = vm::ptr<CellPngDecOutParam>;
|
||||
using PExtInParam = vm::cptr<CellPngDecExtInParam>;
|
||||
using PExtOutParam = vm::ptr<CellPngDecExtOutParam>;
|
||||
using PDataCtrlParam = vm::cptr<CellPngDecDataCtrlParam>;
|
||||
using PDataOutInfo = vm::ptr<CellPngDecDataOutInfo>;
|
||||
using PCbCtrlDisp = vm::cptr<CellPngDecCbCtrlDisp>;
|
||||
using PDispParam = vm::ptr<CellPngDecDispParam>;
|
||||
|
||||
s32 pngDecCreate(PPMainHandle mainHandle, PThreadInParam param, PExtThreadInParam ext = vm::null)
|
||||
{
|
||||
// alloc memory (should probably use param->cbCtrlMallocFunc)
|
||||
auto dec = CellPngDecMainHandle::make(vm::alloc(sizeof(PngDecoder), vm::main));
|
||||
auto dec = vm::ptr<PngDecoder>::make(vm::alloc(sizeof(PngDecoder), vm::main));
|
||||
|
||||
if (!dec)
|
||||
{
|
||||
@ -46,7 +65,7 @@ s32 pngDecCreate(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 pngDecDestroy(CellPngDecMainHandle dec)
|
||||
s32 pngDecDestroy(PMainHandle dec)
|
||||
{
|
||||
if (!vm::dealloc(dec.addr(), vm::main))
|
||||
{
|
||||
@ -56,16 +75,10 @@ s32 pngDecDestroy(CellPngDecMainHandle dec)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 pngDecOpen(
|
||||
CellPngDecMainHandle dec,
|
||||
vm::ptr<CellPngDecSubHandle> subHandle,
|
||||
vm::cptr<CellPngDecSrc> src,
|
||||
vm::ptr<CellPngDecOpnInfo> openInfo,
|
||||
vm::cptr<CellPngDecCbCtrlStrm> cb = vm::null,
|
||||
vm::cptr<CellPngDecOpnParam> param = vm::null)
|
||||
s32 pngDecOpen(PMainHandle dec, PPSubHandle subHandle, PSrc src, POpenInfo openInfo, vm::cptr<CellPngDecCbCtrlStrm> cb = vm::null, vm::cptr<CellPngDecOpnParam> param = vm::null)
|
||||
{
|
||||
// alloc memory (should probably use dec->malloc)
|
||||
auto stream = CellPngDecSubHandle::make(vm::alloc(sizeof(PngStream), vm::main));
|
||||
auto stream = vm::ptr<PngStream>::make(vm::alloc(sizeof(PngStream), vm::main));
|
||||
|
||||
if (!stream)
|
||||
{
|
||||
@ -88,7 +101,7 @@ s32 pngDecOpen(
|
||||
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
|
||||
if (!file_s) return CELL_PNGDEC_ERROR_OPEN_FILE;
|
||||
|
||||
stream->fd = Emu.GetIdManager().make<lv2_file_t>(file_s, 0, 0);
|
||||
stream->fd = idm::make<lv2_file_t>(file_s, 0, 0);
|
||||
stream->fileSize = file_s->GetSize();
|
||||
break;
|
||||
}
|
||||
@ -113,9 +126,9 @@ s32 pngDecOpen(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 pngDecClose(CellPngDecSubHandle stream)
|
||||
s32 pngDecClose(PSubHandle stream)
|
||||
{
|
||||
Emu.GetIdManager().remove<lv2_file_t>(stream->fd);
|
||||
idm::remove<lv2_file_t>(stream->fd);
|
||||
|
||||
if (!vm::dealloc(stream.addr(), vm::main))
|
||||
{
|
||||
@ -125,10 +138,7 @@ s32 pngDecClose(CellPngDecSubHandle stream)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 pngReadHeader(
|
||||
CellPngDecSubHandle stream,
|
||||
vm::ptr<CellPngDecInfo> info,
|
||||
vm::ptr<CellPngDecExtInfo> extInfo = vm::null)
|
||||
s32 pngReadHeader(PSubHandle stream, vm::ptr<CellPngDecInfo> info, PExtInfo extInfo = vm::null)
|
||||
{
|
||||
CellPngDecInfo& current_info = stream->info;
|
||||
|
||||
@ -147,7 +157,7 @@ s32 pngReadHeader(
|
||||
break;
|
||||
case CELL_PNGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(stream->fd);
|
||||
auto file = idm::get<lv2_file_t>(stream->fd);
|
||||
file->file->Seek(0);
|
||||
file->file->Read(buffer, sizeof(buffer));
|
||||
break;
|
||||
@ -189,12 +199,7 @@ s32 pngReadHeader(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 pngDecSetParameter(
|
||||
CellPngDecSubHandle stream,
|
||||
vm::cptr<CellPngDecInParam> inParam,
|
||||
vm::ptr<CellPngDecOutParam> outParam,
|
||||
vm::cptr<CellPngDecExtInParam> extInParam = vm::null,
|
||||
vm::ptr<CellPngDecExtOutParam> extOutParam = vm::null)
|
||||
s32 pngDecSetParameter(PSubHandle stream, PInParam inParam, POutParam outParam, PExtInParam extInParam = vm::null, PExtOutParam extOutParam = vm::null)
|
||||
{
|
||||
CellPngDecInfo& current_info = stream->info;
|
||||
CellPngDecOutParam& current_outParam = stream->outParam;
|
||||
@ -234,13 +239,7 @@ s32 pngDecSetParameter(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 pngDecodeData(
|
||||
CellPngDecSubHandle stream,
|
||||
vm::ptr<u8> data,
|
||||
vm::cptr<CellPngDecDataCtrlParam> dataCtrlParam,
|
||||
vm::ptr<CellPngDecDataOutInfo> dataOutInfo,
|
||||
vm::cptr<CellPngDecCbCtrlDisp> cbCtrlDisp = vm::null,
|
||||
vm::ptr<CellPngDecDispParam> dispParam = vm::null)
|
||||
s32 pngDecodeData(PSubHandle stream, vm::ptr<u8> data, PDataCtrlParam dataCtrlParam, PDataOutInfo dataOutInfo, PCbCtrlDisp cbCtrlDisp = vm::null, PDispParam dispParam = vm::null)
|
||||
{
|
||||
dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;
|
||||
|
||||
@ -259,7 +258,7 @@ s32 pngDecodeData(
|
||||
|
||||
case CELL_PNGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(stream->fd);
|
||||
auto file = idm::get<lv2_file_t>(stream->fd);
|
||||
file->file->Seek(0);
|
||||
file->file->Read(png.get(), fileSize);
|
||||
break;
|
||||
@ -365,10 +364,7 @@ s32 pngDecodeData(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecCreate(
|
||||
vm::ptr<CellPngDecMainHandle> mainHandle,
|
||||
vm::cptr<CellPngDecThreadInParam> threadInParam,
|
||||
vm::ptr<CellPngDecThreadOutParam> threadOutParam)
|
||||
s32 cellPngDecCreate(PPMainHandle mainHandle, PThreadInParam threadInParam, PThreadOutParam threadOutParam)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecCreate(mainHandle=**0x%x, threadInParam=*0x%x, threadOutParam=*0x%x)", mainHandle, threadInParam, threadOutParam);
|
||||
|
||||
@ -381,12 +377,7 @@ s32 cellPngDecCreate(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecExtCreate(
|
||||
vm::ptr<CellPngDecMainHandle> mainHandle,
|
||||
vm::cptr<CellPngDecThreadInParam> threadInParam,
|
||||
vm::ptr<CellPngDecThreadOutParam> threadOutParam,
|
||||
vm::cptr<CellPngDecExtThreadInParam> extThreadInParam,
|
||||
vm::ptr<CellPngDecExtThreadOutParam> extThreadOutParam)
|
||||
s32 cellPngDecExtCreate(PPMainHandle mainHandle, PThreadInParam threadInParam, PThreadOutParam threadOutParam, PExtThreadInParam extThreadInParam, PExtThreadOutParam extThreadOutParam)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecCreate(mainHandle=**0x%x, threadInParam=*0x%x, threadOutParam=*0x%x, extThreadInParam=*0x%x, extThreadOutParam=*0x%x)",
|
||||
mainHandle, threadInParam, threadOutParam, extThreadInParam, extThreadOutParam);
|
||||
@ -402,7 +393,7 @@ s32 cellPngDecExtCreate(
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle)
|
||||
s32 cellPngDecDestroy(PMainHandle mainHandle)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecDestroy(mainHandle=*0x%x)", mainHandle);
|
||||
|
||||
@ -410,11 +401,7 @@ s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle)
|
||||
return pngDecDestroy(mainHandle);
|
||||
}
|
||||
|
||||
s32 cellPngDecOpen(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
vm::ptr<CellPngDecSubHandle> subHandle,
|
||||
vm::cptr<CellPngDecSrc> src,
|
||||
vm::ptr<CellPngDecOpnInfo> openInfo)
|
||||
s32 cellPngDecOpen(PMainHandle mainHandle, PPSubHandle subHandle, PSrc src, POpenInfo openInfo)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecOpen(mainHandle=*0x%x, subHandle=**0x%x, src=*0x%x, openInfo=*0x%x)", mainHandle, subHandle, src, openInfo);
|
||||
|
||||
@ -422,13 +409,7 @@ s32 cellPngDecOpen(
|
||||
return pngDecOpen(mainHandle, subHandle, src, openInfo);
|
||||
}
|
||||
|
||||
s32 cellPngDecExtOpen(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
vm::ptr<CellPngDecSubHandle> subHandle,
|
||||
vm::cptr<CellPngDecSrc> src,
|
||||
vm::ptr<CellPngDecOpnInfo> openInfo,
|
||||
vm::cptr<CellPngDecCbCtrlStrm> cbCtrlStrm,
|
||||
vm::cptr<CellPngDecOpnParam> opnParam)
|
||||
s32 cellPngDecExtOpen(PMainHandle mainHandle, PPSubHandle subHandle, PSrc src, POpenInfo openInfo, vm::cptr<CellPngDecCbCtrlStrm> cbCtrlStrm, vm::cptr<CellPngDecOpnParam> opnParam)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecExtOpen(mainHandle=*0x%x, subHandle=**0x%x, src=*0x%x, openInfo=*0x%x, cbCtrlStrm=*0x%x, opnParam=*0x%x)", mainHandle, subHandle, src, openInfo, cbCtrlStrm, opnParam);
|
||||
|
||||
@ -436,61 +417,43 @@ s32 cellPngDecExtOpen(
|
||||
return pngDecOpen(mainHandle, subHandle, src, openInfo, cbCtrlStrm, opnParam);
|
||||
}
|
||||
|
||||
s32 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle)
|
||||
s32 cellPngDecClose(PMainHandle mainHandle, PSubHandle subHandle)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecClose(mainHandle=*0x%x, subHandle=*0x%x)", mainHandle, subHandle);
|
||||
|
||||
return pngDecClose(subHandle);
|
||||
}
|
||||
|
||||
s32 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info)
|
||||
s32 cellPngDecReadHeader(PMainHandle mainHandle, PSubHandle subHandle, PInfo info)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecReadHeader(mainHandle=*0x%x, subHandle=*0x%x, info=*0x%x)", mainHandle, subHandle, info);
|
||||
|
||||
return pngReadHeader(subHandle, info);
|
||||
}
|
||||
|
||||
s32 cellPngDecExtReadHeader(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::ptr<CellPngDecInfo> info,
|
||||
vm::ptr<CellPngDecExtInfo> extInfo)
|
||||
s32 cellPngDecExtReadHeader(PMainHandle mainHandle, PSubHandle subHandle, PInfo info, PExtInfo extInfo)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecExtReadHeader(mainHandle=*0x%x, subHandle=*0x%x, info=*0x%x, extInfo=*0x%x)", mainHandle, subHandle, info, extInfo);
|
||||
|
||||
return pngReadHeader(subHandle, info, extInfo);
|
||||
}
|
||||
|
||||
s32 cellPngDecSetParameter(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::cptr<CellPngDecInParam> inParam,
|
||||
vm::ptr<CellPngDecOutParam> outParam)
|
||||
s32 cellPngDecSetParameter(PMainHandle mainHandle, PSubHandle subHandle, PInParam inParam, POutParam outParam)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecSetParameter(mainHandle=*0x%x, subHandle=*0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam);
|
||||
|
||||
return pngDecSetParameter(subHandle, inParam, outParam);
|
||||
}
|
||||
|
||||
s32 cellPngDecExtSetParameter(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::cptr<CellPngDecInParam> inParam,
|
||||
vm::ptr<CellPngDecOutParam> outParam,
|
||||
vm::cptr<CellPngDecExtInParam> extInParam,
|
||||
vm::ptr<CellPngDecExtOutParam> extOutParam)
|
||||
s32 cellPngDecExtSetParameter(PMainHandle mainHandle, PSubHandle subHandle, PInParam inParam, POutParam outParam, PExtInParam extInParam, PExtOutParam extOutParam)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecExtSetParameter(mainHandle=*0x%x, subHandle=*0x%x, inParam=*0x%x, outParam=*0x%x, extInParam=*0x%x, extOutParam=*0x%x", mainHandle, subHandle, inParam, outParam, extInParam, extOutParam);
|
||||
cellPngDec.Warning("cellPngDecExtSetParameter(mainHandle=*0x%x, subHandle=*0x%x, inParam=*0x%x, outParam=*0x%x, extInParam=*0x%x, extOutParam=*0x%x",
|
||||
mainHandle, subHandle, inParam, outParam, extInParam, extOutParam);
|
||||
|
||||
return pngDecSetParameter(subHandle, inParam, outParam, extInParam, extOutParam);
|
||||
}
|
||||
|
||||
s32 cellPngDecDecodeData(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::ptr<u8> data,
|
||||
vm::cptr<CellPngDecDataCtrlParam> dataCtrlParam,
|
||||
vm::ptr<CellPngDecDataOutInfo> dataOutInfo)
|
||||
s32 cellPngDecDecodeData(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<u8> data, PDataCtrlParam dataCtrlParam, PDataOutInfo dataOutInfo)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecDecodeData(mainHandle=*0x%x, subHandle=*0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)",
|
||||
mainHandle, subHandle, data, dataCtrlParam, dataOutInfo);
|
||||
@ -498,14 +461,7 @@ s32 cellPngDecDecodeData(
|
||||
return pngDecodeData(subHandle, data, dataCtrlParam, dataOutInfo);
|
||||
}
|
||||
|
||||
s32 cellPngDecExtDecodeData(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::ptr<u8> data,
|
||||
vm::cptr<CellPngDecDataCtrlParam> dataCtrlParam,
|
||||
vm::ptr<CellPngDecDataOutInfo> dataOutInfo,
|
||||
vm::cptr<CellPngDecCbCtrlDisp> cbCtrlDisp,
|
||||
vm::ptr<CellPngDecDispParam> dispParam)
|
||||
s32 cellPngDecExtDecodeData(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<u8> data, PDataCtrlParam dataCtrlParam, PDataOutInfo dataOutInfo, PCbCtrlDisp cbCtrlDisp, PDispParam dispParam)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecExtDecodeData(mainHandle=*0x%x, subHandle=*0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x, cbCtrlDisp=*0x%x, dispParam=*0x%x)",
|
||||
mainHandle, subHandle, data, dataCtrlParam, dataOutInfo, cbCtrlDisp, dispParam);
|
||||
@ -513,111 +469,103 @@ s32 cellPngDecExtDecodeData(
|
||||
return pngDecodeData(subHandle, data, dataCtrlParam, dataOutInfo, cbCtrlDisp, dispParam);
|
||||
}
|
||||
|
||||
s32 cellPngDecGetUnknownChunks(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::pptr<CellPngUnknownChunk> unknownChunk,
|
||||
vm::ptr<u32> unknownChunkNumber)
|
||||
s32 cellPngDecGetUnknownChunks(PMainHandle mainHandle, PSubHandle subHandle, vm::pptr<CellPngUnknownChunk> unknownChunk, vm::ptr<u32> unknownChunkNumber)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal)
|
||||
s32 cellPngDecGetpCAL(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngPCAL> pcal)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm)
|
||||
s32 cellPngDecGetcHRM(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngCHRM> chrm)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal)
|
||||
s32 cellPngDecGetsCAL(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngSCAL> scal)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys)
|
||||
s32 cellPngDecGetpHYs(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngPHYS> phys)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs)
|
||||
s32 cellPngDecGetoFFs(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngOFFS> offs)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt)
|
||||
s32 cellPngDecGetsPLT(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngSPLT> splt)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd)
|
||||
s32 cellPngDecGetbKGD(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time)
|
||||
s32 cellPngDecGettIME(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngTIME> time)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist)
|
||||
s32 cellPngDecGethIST(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngHIST> hist)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns)
|
||||
s32 cellPngDecGettRNS(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngTRNS> trns)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit)
|
||||
s32 cellPngDecGetsBIT(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngSBIT> sbit)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp)
|
||||
s32 cellPngDecGetiCCP(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngICCP> iccp)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb)
|
||||
s32 cellPngDecGetsRGB(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngSRGB> srgb)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama)
|
||||
s32 cellPngDecGetgAMA(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngGAMA> gama)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte)
|
||||
s32 cellPngDecGetPLTE(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<CellPngPLTE> plte)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellPngDecGetTextChunk(
|
||||
CellPngDecMainHandle mainHandle,
|
||||
CellPngDecSubHandle subHandle,
|
||||
vm::ptr<u32> textInfoNum,
|
||||
vm::pptr<CellPngTextInfo> textInfo)
|
||||
s32 cellPngDecGetTextChunk(PMainHandle mainHandle, PSubHandle subHandle, vm::ptr<u32> textInfoNum, vm::pptr<CellPngTextInfo> textInfo)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
return CELL_OK;
|
||||
|
@ -83,10 +83,6 @@ enum CellPngDecDecodeStatus : s32
|
||||
CELL_PNGDEC_DEC_STATUS_STOP = 1,
|
||||
};
|
||||
|
||||
// Handles
|
||||
using CellPngDecMainHandle = vm::ptr<struct PngDecoder>;
|
||||
using CellPngDecSubHandle = vm::ptr<struct PngStream>;
|
||||
|
||||
// Callbacks for memory management
|
||||
using CellPngDecCbControlMalloc = vm::ptr<void>(u32 size, vm::ptr<void> cbCtrlMallocArg);
|
||||
using CellPngDecCbControlFree = s32(vm::ptr<void> ptr, vm::ptr<void> cbCtrlFreeArg);
|
||||
@ -277,7 +273,7 @@ struct PngDecoder
|
||||
|
||||
struct PngStream
|
||||
{
|
||||
CellPngDecMainHandle dec;
|
||||
vm::ptr<PngDecoder> dec;
|
||||
|
||||
// old data:
|
||||
u32 fd;
|
||||
|
@ -24,7 +24,7 @@ s32 cellRudpInit(vm::ptr<CellRudpAllocator> allocator)
|
||||
{
|
||||
cellRudp.Warning("cellRudpInit(allocator=*0x%x)", allocator);
|
||||
|
||||
const auto rudp = Emu.GetIdManager().make_fixed<rudp_t>();
|
||||
const auto rudp = idm::make_fixed<rudp_t>();
|
||||
|
||||
if (!rudp)
|
||||
{
|
||||
@ -59,7 +59,7 @@ s32 cellRudpEnd()
|
||||
{
|
||||
cellRudp.Warning("cellRudpEnd()");
|
||||
|
||||
if (!Emu.GetIdManager().remove<rudp_t>())
|
||||
if (!idm::remove_fixed<rudp_t>())
|
||||
{
|
||||
return CELL_RUDP_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
@ -77,7 +77,7 @@ s32 cellRudpSetEventHandler(vm::ptr<CellRudpEventHandler> handler, vm::ptr<void>
|
||||
{
|
||||
cellRudp.Todo("cellRudpSetEventHandler(handler=*0x%x, arg=*0x%x)", handler, arg);
|
||||
|
||||
const auto rudp = Emu.GetIdManager().get<rudp_t>();
|
||||
const auto rudp = idm::get_fixed<rudp_t>();
|
||||
|
||||
if (!rudp)
|
||||
{
|
||||
|
@ -1042,7 +1042,7 @@ s32 spursInit(
|
||||
memcpy(semAttr->name, "_spuWkl", 8);
|
||||
for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
|
||||
{
|
||||
if (s32 rc = sys_semaphore_create(sem, semAttr, 0, 1)) // Emu.GetIdManager().make<lv2_sema_t>(SYS_SYNC_PRIORITY, 1, *(u64*)"_spuWkl", 0)
|
||||
if (s32 rc = sys_semaphore_create(sem, semAttr, 0, 1))
|
||||
{
|
||||
return rollback(), rc;
|
||||
}
|
||||
@ -1051,7 +1051,7 @@ s32 spursInit(
|
||||
|
||||
if (isSecond)
|
||||
{
|
||||
if (s32 rc = sys_semaphore_create(sem, semAttr, 0, 1)) // Emu.GetIdManager().make<lv2_sema_t>(SYS_SYNC_PRIORITY, 1, *(u64*)"_spuWkl", 0)
|
||||
if (s32 rc = sys_semaphore_create(sem, semAttr, 0, 1))
|
||||
{
|
||||
return rollback(), rc;
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ s32 spursInit(
|
||||
// Create semaphore
|
||||
// TODO: Figure out why this semaphore is needed
|
||||
memcpy(semAttr->name, "_spuPrv", 8);
|
||||
if (s32 rc = sys_semaphore_create(sem, semAttr, 0, 1)) // Emu.GetIdManager().make<lv2_sema_t>(SYS_SYNC_PRIORITY, 1, *(u64*)"_spuPrv", 0);
|
||||
if (s32 rc = sys_semaphore_create(sem, semAttr, 0, 1))
|
||||
{
|
||||
return rollback(), rc;
|
||||
}
|
||||
@ -1153,7 +1153,7 @@ s32 spursInit(
|
||||
return rollback(), rc;
|
||||
}
|
||||
|
||||
const auto spuThread = Emu.GetIdManager().get<SPUThread>(spurs->spus[num] = spuThreadId.value());
|
||||
const auto spuThread = idm::get<SPUThread>(spurs->spus[num] = spuThreadId.value());
|
||||
|
||||
// entry point cannot be initialized immediately because SPU LS will be rewritten by sys_spu_thread_group_start()
|
||||
spuThread->custom_task = [spurs](SPUThread& spu)
|
||||
|
@ -204,13 +204,13 @@ u32 vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0 */, vm::ptr<C
|
||||
|
||||
void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
||||
{
|
||||
const auto sptr = Emu.GetIdManager().get<VideoDecoder>(vdec_id);
|
||||
const auto sptr = idm::get<VideoDecoder>(vdec_id);
|
||||
|
||||
VideoDecoder& vdec = *sptr;
|
||||
|
||||
vdec.id = vdec_id;
|
||||
|
||||
vdec.vdecCb = Emu.GetIdManager().make_ptr<PPUThread>(fmt::format("VideoDecoder[0x%x] Thread", vdec_id));
|
||||
vdec.vdecCb = idm::make_ptr<PPUThread>(fmt::format("VideoDecoder[0x%x] Thread", vdec_id));
|
||||
vdec.vdecCb->prio = 1001;
|
||||
vdec.vdecCb->stack_size = 0x10000;
|
||||
vdec.vdecCb->custom_task = [sptr](PPUThread& CPU)
|
||||
@ -560,7 +560,7 @@ s32 cellVdecOpen(vm::cptr<CellVdecType> type, vm::cptr<CellVdecResource> res, vm
|
||||
{
|
||||
cellVdec.Warning("cellVdecOpen(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
|
||||
|
||||
vdecOpen(*handle = Emu.GetIdManager().make<VideoDecoder>(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
|
||||
vdecOpen(*handle = idm::make<VideoDecoder>(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -569,7 +569,7 @@ s32 cellVdecOpenEx(vm::cptr<CellVdecTypeEx> type, vm::cptr<CellVdecResourceEx> r
|
||||
{
|
||||
cellVdec.Warning("cellVdecOpenEx(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
|
||||
|
||||
vdecOpen(*handle = Emu.GetIdManager().make<VideoDecoder>(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
|
||||
vdecOpen(*handle = idm::make<VideoDecoder>(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -578,7 +578,7 @@ s32 cellVdecClose(u32 handle)
|
||||
{
|
||||
cellVdec.Warning("cellVdecClose(handle=0x%x)", handle);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec)
|
||||
{
|
||||
@ -595,8 +595,8 @@ s32 cellVdecClose(u32 handle)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<PPUThread>(vdec->vdecCb->get_id());
|
||||
Emu.GetIdManager().remove<VideoDecoder>(handle);
|
||||
idm::remove<PPUThread>(vdec->vdecCb->get_id());
|
||||
idm::remove<VideoDecoder>(handle);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -604,7 +604,7 @@ s32 cellVdecStartSeq(u32 handle)
|
||||
{
|
||||
cellVdec.Log("cellVdecStartSeq(handle=0x%x)", handle);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec)
|
||||
{
|
||||
@ -619,7 +619,7 @@ s32 cellVdecEndSeq(u32 handle)
|
||||
{
|
||||
cellVdec.Warning("cellVdecEndSeq(handle=0x%x)", handle);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec)
|
||||
{
|
||||
@ -634,7 +634,7 @@ s32 cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::cptr<CellVdecAuInf
|
||||
{
|
||||
cellVdec.Log("cellVdecDecodeAu(handle=0x%x, mode=%d, auInfo=*0x%x)", handle, mode, auInfo);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec || mode > CELL_VDEC_DEC_MODE_PB_SKIP)
|
||||
{
|
||||
@ -664,7 +664,7 @@ s32 cellVdecGetPicture(u32 handle, vm::cptr<CellVdecPicFormat> format, vm::ptr<u
|
||||
{
|
||||
cellVdec.Log("cellVdecGetPicture(handle=0x%x, format=*0x%x, outBuff=*0x%x)", handle, format, outBuff);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec || !format)
|
||||
{
|
||||
@ -788,7 +788,7 @@ s32 cellVdecGetPicItem(u32 handle, vm::pptr<CellVdecPicItem> picItem)
|
||||
{
|
||||
cellVdec.Log("cellVdecGetPicItem(handle=0x%x, picItem=**0x%x)", handle, picItem);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec)
|
||||
{
|
||||
@ -933,7 +933,7 @@ s32 cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc)
|
||||
{
|
||||
cellVdec.Log("cellVdecSetFrameRate(handle=0x%x, frc=0x%x)", handle, frc);
|
||||
|
||||
const auto vdec = Emu.GetIdManager().get<VideoDecoder>(handle);
|
||||
const auto vdec = idm::get<VideoDecoder>(handle);
|
||||
|
||||
if (!vdec)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ s32 cellVpostOpen(vm::cptr<CellVpostCfgParam> cfgParam, vm::cptr<CellVpostResour
|
||||
cellVpost.Warning("cellVpostOpen(cfgParam=*0x%x, resource=*0x%x, handle=*0x%x)", cfgParam, resource, handle);
|
||||
|
||||
// TODO: check values
|
||||
*handle = Emu.GetIdManager().make<VpostInstance>(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV);
|
||||
*handle = idm::make<VpostInstance>(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ s32 cellVpostOpenEx(vm::cptr<CellVpostCfgParam> cfgParam, vm::cptr<CellVpostReso
|
||||
cellVpost.Warning("cellVpostOpenEx(cfgParam=*0x%x, resource=*0x%x, handle=*0x%x)", cfgParam, resource, handle);
|
||||
|
||||
// TODO: check values
|
||||
*handle = Emu.GetIdManager().make<VpostInstance>(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV);
|
||||
*handle = idm::make<VpostInstance>(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -49,14 +49,14 @@ s32 cellVpostClose(u32 handle)
|
||||
{
|
||||
cellVpost.Warning("cellVpostClose(handle=0x%x)", handle);
|
||||
|
||||
const auto vpost = Emu.GetIdManager().get<VpostInstance>(handle);
|
||||
const auto vpost = idm::get<VpostInstance>(handle);
|
||||
|
||||
if (!vpost)
|
||||
{
|
||||
return CELL_VPOST_ERROR_C_ARG_HDL_INVALID;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<VpostInstance>(handle);
|
||||
idm::remove<VpostInstance>(handle);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ s32 cellVpostExec(u32 handle, vm::cptr<u8> inPicBuff, vm::cptr<CellVpostCtrlPara
|
||||
{
|
||||
cellVpost.Log("cellVpostExec(handle=0x%x, inPicBuff=*0x%x, ctrlParam=*0x%x, outPicBuff=*0x%x, picInfo=*0x%x)", handle, inPicBuff, ctrlParam, outPicBuff, picInfo);
|
||||
|
||||
const auto vpost = Emu.GetIdManager().get<VpostInstance>(handle);
|
||||
const auto vpost = idm::get<VpostInstance>(handle);
|
||||
|
||||
if (!vpost)
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ s32 cellSurMixerCreate(vm::cptr<CellSurMixerConfig> config)
|
||||
|
||||
libmixer.Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", config->chStrips1, config->chStrips2, config->chStrips6, config->chStrips8);
|
||||
|
||||
const auto ppu = Emu.GetIdManager().make_ptr<PPUThread>("Surmixer Thread");
|
||||
const auto ppu = idm::make_ptr<PPUThread>("Surmixer Thread");
|
||||
ppu->prio = 1001;
|
||||
ppu->stack_size = 0x10000;
|
||||
ppu->custom_task = [](PPUThread& ppu)
|
||||
@ -445,7 +445,7 @@ s32 cellSurMixerCreate(vm::cptr<CellSurMixerConfig> config)
|
||||
g_surmx.mixcount++;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<PPUThread>(ppu.get_id());
|
||||
idm::remove<PPUThread>(ppu.get_id());
|
||||
};
|
||||
|
||||
ppu->run();
|
||||
|
@ -25,7 +25,7 @@ struct trophy_context_t
|
||||
std::unique_ptr<TROPUSRLoader> tropusr;
|
||||
|
||||
trophy_context_t()
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
: id(idm::get_current_id())
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -35,7 +35,7 @@ struct trophy_handle_t
|
||||
const u32 id;
|
||||
|
||||
trophy_handle_t()
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
: id(idm::get_current_id())
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -64,7 +64,7 @@ s32 sceNpTrophyCreateHandle(vm::ptr<u32> handle)
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*handle = Emu.GetIdManager().make<trophy_handle_t>();
|
||||
*handle = idm::make<trophy_handle_t>();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -73,14 +73,14 @@ s32 sceNpTrophyDestroyHandle(u32 handle)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyDestroyHandle(handle=0x%x)", handle);
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<trophy_handle_t>(handle);
|
||||
idm::remove<trophy_handle_t>(handle);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -89,7 +89,7 @@ s32 sceNpTrophyAbortHandle(u32 handle)
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyAbortHandle(handle=0x%x)", handle);
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
@ -122,7 +122,7 @@ s32 sceNpTrophyCreateContext(vm::ptr<u32> context, vm::cptr<SceNpCommunicationId
|
||||
}
|
||||
|
||||
// create trophy context
|
||||
const auto ctxt = Emu.GetIdManager().make_ptr<trophy_context_t>();
|
||||
const auto ctxt = idm::make_ptr<trophy_context_t>();
|
||||
|
||||
// set trophy context parameters (could be passed to constructor through make_ptr call)
|
||||
ctxt->trp_name = std::move(name);
|
||||
@ -136,14 +136,14 @@ s32 sceNpTrophyDestroyContext(u32 context)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyDestroyContext(context=0x%x)", context);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<trophy_context_t>(context);
|
||||
idm::remove<trophy_context_t>(context);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -152,7 +152,7 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb=*0x%x, arg=*0x%x, options=0x%llx)", context, handle, statusCb, arg, options);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
@ -160,7 +160,7 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
@ -232,14 +232,14 @@ s32 sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspa
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace*=0x%x, options=0x%llx)", context, handle, reqspace, options);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
@ -263,14 +263,14 @@ s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetai
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyGetGameInfo(context=0x%x, handle=0x%x, details=*0x%x, data=*0x%x)", context, handle, details, data);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
@ -324,14 +324,14 @@ s32 sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32>
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId=*0x%x)", context, handle, trophyId, platinumId);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
@ -355,14 +355,14 @@ s32 sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophy
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyGetTrophyUnlockState(context=0x%x, handle=0x%x, flags=*0x%x, count=*0x%x)", context, handle, flags, count);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
@ -390,14 +390,14 @@ s32 sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceN
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=0x%x, handle=0x%x, trophyId=%d, details=*0x%x, data=*0x%x)", context, handle, trophyId, details, data);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
const auto ctxt = idm::get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
const auto hndl = idm::get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
|
@ -22,14 +22,14 @@ u32 _sys_heap_create_heap(vm::cptr<char> name, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
sysPrxForUser.Warning("_sys_heap_create_heap(name=*0x%x, arg2=0x%x, arg3=0x%x, arg4=0x%x)", name, arg2, arg3, arg4);
|
||||
|
||||
return Emu.GetIdManager().make<HeapInfo>(name.get_ptr());
|
||||
return idm::make<HeapInfo>(name.get_ptr());
|
||||
}
|
||||
|
||||
s32 _sys_heap_delete_heap(u32 heap)
|
||||
{
|
||||
sysPrxForUser.Warning("_sys_heap_delete_heap(heap=0x%x)", heap);
|
||||
|
||||
Emu.GetIdManager().remove<HeapInfo>(heap);
|
||||
idm::remove<HeapInfo>(heap);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ s32 sys_lwcond_create(vm::ptr<sys_lwcond_t> lwcond, vm::ptr<sys_lwmutex_t> lwmut
|
||||
{
|
||||
sysPrxForUser.Warning("sys_lwcond_create(lwcond=*0x%x, lwmutex=*0x%x, attr=*0x%x)", lwcond, lwmutex, attr);
|
||||
|
||||
lwcond->lwcond_queue = Emu.GetIdManager().make<lv2_lwcond_t>(attr->name_u64);
|
||||
lwcond->lwcond_queue = idm::make<lv2_lwcond_t>(attr->name_u64);
|
||||
lwcond->lwmutex = lwmutex;
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -34,7 +34,7 @@ s32 sys_lwmutex_create(vm::ptr<sys_lwmutex_t> lwmutex, vm::ptr<sys_lwmutex_attri
|
||||
lwmutex->lock_var = { { lwmutex_free, 0 } };
|
||||
lwmutex->attribute = attr->recursive | attr->protocol;
|
||||
lwmutex->recursive_count = 0;
|
||||
lwmutex->sleep_queue = Emu.GetIdManager().make<lv2_lwmutex_t>(protocol, attr->name_u64);
|
||||
lwmutex->sleep_queue = idm::make<lv2_lwmutex_t>(protocol, attr->name_u64);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ s32 sys_mempool_create(vm::ptr<sys_mempool_t> mempool, vm::ptr<void> chunk, cons
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
auto id = Emu.GetIdManager().make<memory_pool_t>();
|
||||
auto id = idm::make<memory_pool_t>();
|
||||
*mempool = id;
|
||||
|
||||
auto memory_pool = Emu.GetIdManager().get<memory_pool_t>(id);
|
||||
auto memory_pool = idm::get<memory_pool_t>(id);
|
||||
|
||||
memory_pool->chunk = chunk;
|
||||
memory_pool->chunk_size = chunk_size;
|
||||
@ -76,14 +76,14 @@ void sys_mempool_destroy(sys_mempool_t mempool)
|
||||
{
|
||||
sysPrxForUser.Warning("sys_mempool_destroy(mempool=%d)", mempool);
|
||||
|
||||
Emu.GetIdManager().remove<memory_pool_t>(mempool);
|
||||
idm::remove<memory_pool_t>(mempool);
|
||||
}
|
||||
|
||||
s32 sys_mempool_free_block(sys_mempool_t mempool, vm::ptr<void> block)
|
||||
{
|
||||
sysPrxForUser.Warning("sys_mempool_free_block(mempool=%d, block=*0x%x)", mempool, block);
|
||||
|
||||
auto memory_pool = Emu.GetIdManager().get<memory_pool_t>(mempool);
|
||||
auto memory_pool = idm::get<memory_pool_t>(mempool);
|
||||
if (!memory_pool)
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
@ -102,7 +102,7 @@ u64 sys_mempool_get_count(sys_mempool_t mempool)
|
||||
{
|
||||
sysPrxForUser.Warning("sys_mempool_get_count(mempool=%d)", mempool);
|
||||
|
||||
auto memory_pool = Emu.GetIdManager().get<memory_pool_t>(mempool);
|
||||
auto memory_pool = idm::get<memory_pool_t>(mempool);
|
||||
if (!memory_pool)
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
@ -115,7 +115,7 @@ vm::ptr<void> sys_mempool_try_allocate_block(sys_mempool_t mempool)
|
||||
{
|
||||
sysPrxForUser.Warning("sys_mempool_try_allocate_block(mempool=%d)", mempool);
|
||||
|
||||
auto memory_pool = Emu.GetIdManager().get<memory_pool_t>(mempool);
|
||||
auto memory_pool = idm::get<memory_pool_t>(mempool);
|
||||
|
||||
if (!memory_pool || memory_pool->free_blocks.size() == 0)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribu
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_mutex_t>(mutex_id);
|
||||
const auto mutex = idm::get<lv2_mutex_t>(mutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -56,7 +56,7 @@ s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribu
|
||||
throw EXCEPTION("Unexpected cond_count");
|
||||
}
|
||||
|
||||
*cond_id = Emu.GetIdManager().make<lv2_cond_t>(mutex, attr->name_u64);
|
||||
*cond_id = idm::make<lv2_cond_t>(mutex, attr->name_u64);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -67,7 +67,7 @@ s32 sys_cond_destroy(u32 cond_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(cond_id);
|
||||
const auto cond = idm::get<lv2_cond_t>(cond_id);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
@ -84,7 +84,7 @@ s32 sys_cond_destroy(u32 cond_id)
|
||||
throw EXCEPTION("Unexpected cond_count");
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_cond_t>(cond_id);
|
||||
idm::remove<lv2_cond_t>(cond_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -95,7 +95,7 @@ s32 sys_cond_signal(u32 cond_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(cond_id);
|
||||
const auto cond = idm::get<lv2_cond_t>(cond_id);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
@ -118,7 +118,7 @@ s32 sys_cond_signal_all(u32 cond_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(cond_id);
|
||||
const auto cond = idm::get<lv2_cond_t>(cond_id);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
@ -142,7 +142,7 @@ s32 sys_cond_signal_to(u32 cond_id, u32 thread_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(cond_id);
|
||||
const auto cond = idm::get<lv2_cond_t>(cond_id);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
@ -175,7 +175,7 @@ s32 sys_cond_wait(PPUThread& ppu, u32 cond_id, u64 timeout)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(cond_id);
|
||||
const auto cond = idm::get<lv2_cond_t>(cond_id);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
|
@ -35,8 +35,6 @@ struct lv2_cond_t
|
||||
void notify(lv2_lock_t& lv2_lock, sleep_queue_t::value_type& thread);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_cond_t, 0x86); // SYS_COND_OBJECT
|
||||
|
||||
class PPUThread;
|
||||
|
||||
// SysCalls
|
||||
|
@ -15,7 +15,7 @@ SysCallBase sys_event("sys_event");
|
||||
extern u64 get_system_time();
|
||||
|
||||
lv2_event_queue_t::lv2_event_queue_t(u32 protocol, s32 type, u64 name, u64 key, s32 size)
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
: id(idm::get_current_id())
|
||||
, protocol(protocol)
|
||||
, type(type)
|
||||
, name(name)
|
||||
@ -115,7 +115,7 @@ s32 sys_event_queue_destroy(u32 equeue_id, s32 mode)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(equeue_id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(equeue_id);
|
||||
|
||||
if (!queue)
|
||||
{
|
||||
@ -134,7 +134,7 @@ s32 sys_event_queue_destroy(u32 equeue_id, s32 mode)
|
||||
|
||||
// cleanup
|
||||
Emu.GetEventManager().UnregisterKey(queue->key);
|
||||
Emu.GetIdManager().remove<lv2_event_queue_t>(equeue_id);
|
||||
idm::remove<lv2_event_queue_t>(equeue_id);
|
||||
|
||||
// signal all threads to return CELL_ECANCELED
|
||||
for (auto& thread : queue->sq)
|
||||
@ -164,7 +164,7 @@ s32 sys_event_queue_tryreceive(u32 equeue_id, vm::ptr<sys_event_t> event_array,
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(equeue_id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(equeue_id);
|
||||
|
||||
if (!queue)
|
||||
{
|
||||
@ -205,7 +205,7 @@ s32 sys_event_queue_receive(PPUThread& ppu, u32 equeue_id, vm::ptr<sys_event_t>
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(equeue_id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(equeue_id);
|
||||
|
||||
if (!queue)
|
||||
{
|
||||
@ -256,7 +256,7 @@ s32 sys_event_queue_receive(PPUThread& ppu, u32 equeue_id, vm::ptr<sys_event_t>
|
||||
|
||||
if (ppu.GPR[3])
|
||||
{
|
||||
if (Emu.GetIdManager().check_id<lv2_event_queue_t>(equeue_id))
|
||||
if (idm::check<lv2_event_queue_t>(equeue_id))
|
||||
{
|
||||
throw EXCEPTION("Unexpected");
|
||||
}
|
||||
@ -274,7 +274,7 @@ s32 sys_event_queue_drain(u32 equeue_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(equeue_id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(equeue_id);
|
||||
|
||||
if (!queue)
|
||||
{
|
||||
@ -296,7 +296,7 @@ s32 sys_event_port_create(vm::ptr<u32> eport_id, s32 port_type, u64 name)
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
*eport_id = Emu.GetIdManager().make<lv2_event_port_t>(port_type, name);
|
||||
*eport_id = idm::make<lv2_event_port_t>(port_type, name);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -307,7 +307,7 @@ s32 sys_event_port_destroy(u32 eport_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto port = Emu.GetIdManager().get<lv2_event_port_t>(eport_id);
|
||||
const auto port = idm::get<lv2_event_port_t>(eport_id);
|
||||
|
||||
if (!port)
|
||||
{
|
||||
@ -319,7 +319,7 @@ s32 sys_event_port_destroy(u32 eport_id)
|
||||
return CELL_EISCONN;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_event_port_t>(eport_id);
|
||||
idm::remove<lv2_event_port_t>(eport_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -330,8 +330,8 @@ s32 sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto port = Emu.GetIdManager().get<lv2_event_port_t>(eport_id);
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(equeue_id);
|
||||
const auto port = idm::get<lv2_event_port_t>(eport_id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(equeue_id);
|
||||
|
||||
if (!port || !queue)
|
||||
{
|
||||
@ -359,7 +359,7 @@ s32 sys_event_port_disconnect(u32 eport_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto port = Emu.GetIdManager().get<lv2_event_port_t>(eport_id);
|
||||
const auto port = idm::get<lv2_event_port_t>(eport_id);
|
||||
|
||||
if (!port)
|
||||
{
|
||||
@ -386,7 +386,7 @@ s32 sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto port = Emu.GetIdManager().get<lv2_event_port_t>(eport_id);
|
||||
const auto port = idm::get<lv2_event_port_t>(eport_id);
|
||||
|
||||
if (!port)
|
||||
{
|
||||
|
@ -89,8 +89,6 @@ struct lv2_event_queue_t
|
||||
void push(lv2_lock_t& lv2_lock, u64 source, u64 data1, u64 data2, u64 data3);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_event_queue_t, 0x8D); // SYS_EVENT_QUEUE_OBJECT
|
||||
|
||||
struct lv2_event_port_t
|
||||
{
|
||||
const s32 type; // port type, must be SYS_EVENT_PORT_LOCAL
|
||||
@ -105,8 +103,6 @@ struct lv2_event_port_t
|
||||
}
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_event_port_t, 0x0E); // SYS_EVENT_PORT_OBJECT
|
||||
|
||||
class PPUThread;
|
||||
|
||||
// SysCalls
|
||||
|
@ -75,7 +75,7 @@ s32 sys_event_flag_create(vm::ptr<u32> id, vm::ptr<sys_event_flag_attribute_t> a
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
*id = Emu.GetIdManager().make<lv2_event_flag_t>(init, protocol, type, attr->name_u64);
|
||||
*id = idm::make<lv2_event_flag_t>(init, protocol, type, attr->name_u64);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -86,7 +86,7 @@ s32 sys_event_flag_destroy(u32 id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -98,7 +98,7 @@ s32 sys_event_flag_destroy(u32 id)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_event_flag_t>(id);
|
||||
idm::remove<lv2_event_flag_t>(id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -124,7 +124,7 @@ s32 sys_event_flag_wait(PPUThread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr<u6
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -200,7 +200,7 @@ s32 sys_event_flag_trywait(u32 id, u64 bitptn, u32 mode, vm::ptr<u64> result)
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -225,7 +225,7 @@ s32 sys_event_flag_set(u32 id, u64 bitptn)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -246,7 +246,7 @@ s32 sys_event_flag_clear(u32 id, u64 bitptn)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -269,7 +269,7 @@ s32 sys_event_flag_cancel(u32 id, vm::ptr<u32> num)
|
||||
*num = 0;
|
||||
}
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
@ -316,7 +316,7 @@ s32 sys_event_flag_get(u32 id, vm::ptr<u64> flags)
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
const auto eflag = Emu.GetIdManager().get<lv2_event_flag_t>(id);
|
||||
const auto eflag = idm::get<lv2_event_flag_t>(id);
|
||||
|
||||
if (!eflag)
|
||||
{
|
||||
|
@ -108,8 +108,6 @@ struct lv2_event_flag_t
|
||||
void notify_all(lv2_lock_t& lv2_lock);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_event_flag_t, 0x98); // SYS_EVENT_FLAG_OBJECT
|
||||
|
||||
// Aux
|
||||
class PPUThread;
|
||||
|
||||
|
@ -142,7 +142,7 @@ s32 sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::c
|
||||
// try to reserve fd
|
||||
if (g_fds[i].compare_and_swap_test(0, ~0))
|
||||
{
|
||||
g_fds[i].store(Emu.GetIdManager().make<lv2_file_t>(std::move(file), mode, flags));
|
||||
g_fds[i].store(idm::make<lv2_file_t>(std::move(file), mode, flags));
|
||||
|
||||
*fd = i;
|
||||
|
||||
@ -158,7 +158,7 @@ s32 sys_fs_read(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread)
|
||||
{
|
||||
sys_fs.Log("sys_fs_read(fd=%d, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file || file->flags & CELL_FS_O_WRONLY)
|
||||
{
|
||||
@ -176,7 +176,7 @@ s32 sys_fs_write(u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite)
|
||||
{
|
||||
sys_fs.Log("sys_fs_write(fd=%d, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file || !(file->flags & CELL_FS_O_ACCMODE))
|
||||
{
|
||||
@ -196,7 +196,7 @@ s32 sys_fs_close(u32 fd)
|
||||
{
|
||||
sys_fs.Log("sys_fs_close(fd=%d)", fd);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -205,7 +205,7 @@ s32 sys_fs_close(u32 fd)
|
||||
|
||||
// TODO: return CELL_FS_EBUSY if locked
|
||||
|
||||
Emu.GetIdManager().remove<lv2_file_t>(_fd_to_id(fd));
|
||||
idm::remove<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
g_fds[fd].store(0);
|
||||
|
||||
@ -230,7 +230,7 @@ s32 sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd)
|
||||
// try to reserve fd
|
||||
if (g_fds[i].compare_and_swap_test(0, ~0))
|
||||
{
|
||||
g_fds[i].store(Emu.GetIdManager().make<lv2_dir_t>(std::move(dir)));
|
||||
g_fds[i].store(idm::make<lv2_dir_t>(std::move(dir)));
|
||||
|
||||
*fd = i;
|
||||
|
||||
@ -246,7 +246,7 @@ s32 sys_fs_readdir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
|
||||
{
|
||||
sys_fs.Warning("sys_fs_readdir(fd=%d, dir=*0x%x, nread=*0x%x)", fd, dir, nread);
|
||||
|
||||
const auto directory = Emu.GetIdManager().get<lv2_dir_t>(_fd_to_id(fd));
|
||||
const auto directory = idm::get<lv2_dir_t>(_fd_to_id(fd));
|
||||
|
||||
if (!directory)
|
||||
{
|
||||
@ -274,14 +274,14 @@ s32 sys_fs_closedir(u32 fd)
|
||||
{
|
||||
sys_fs.Log("sys_fs_closedir(fd=%d)", fd);
|
||||
|
||||
const auto directory = Emu.GetIdManager().get<lv2_dir_t>(_fd_to_id(fd));
|
||||
const auto directory = idm::get<lv2_dir_t>(_fd_to_id(fd));
|
||||
|
||||
if (!directory)
|
||||
{
|
||||
return CELL_FS_EBADF;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_dir_t>(_fd_to_id(fd));
|
||||
idm::remove<lv2_dir_t>(_fd_to_id(fd));
|
||||
|
||||
g_fds[fd].store(0);
|
||||
|
||||
@ -325,7 +325,7 @@ s32 sys_fs_fstat(u32 fd, vm::ptr<CellFsStat> sb)
|
||||
{
|
||||
sys_fs.Warning("sys_fs_fstat(fd=%d, sb=*0x%x)", fd, sb);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -474,7 +474,7 @@ s32 sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos)
|
||||
return CELL_FS_EINVAL;
|
||||
}
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -492,7 +492,7 @@ s32 sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_
|
||||
{
|
||||
sys_fs.Todo("sys_fs_fget_block_size(fd=%d, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", fd, sector_size, block_size, arg4, arg5);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file)
|
||||
{
|
||||
@ -540,7 +540,7 @@ s32 sys_fs_ftruncate(u32 fd, u64 size)
|
||||
{
|
||||
sys_fs.Warning("sys_fs_ftruncate(fd=%d, size=0x%llx)", fd, size);
|
||||
|
||||
const auto file = Emu.GetIdManager().get<lv2_file_t>(_fd_to_id(fd));
|
||||
const auto file = idm::get<lv2_file_t>(_fd_to_id(fd));
|
||||
|
||||
if (!file || !(file->flags & CELL_FS_O_ACCMODE))
|
||||
{
|
||||
|
@ -205,8 +205,6 @@ struct lv2_file_t
|
||||
~lv2_file_t();
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_file_t, 0x73); // SYS_FS_FD_OBJECT
|
||||
|
||||
class vfsDirBase;
|
||||
|
||||
struct lv2_dir_t
|
||||
@ -221,8 +219,6 @@ struct lv2_dir_t
|
||||
~lv2_dir_t();
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_dir_t, 0x73); // SYS_FS_FD_OBJECT
|
||||
|
||||
// SysCalls
|
||||
s32 sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> arg5, u32 arg6);
|
||||
s32 sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size);
|
||||
|
@ -10,13 +10,13 @@
|
||||
SysCallBase sys_interrupt("sys_interrupt");
|
||||
|
||||
lv2_int_tag_t::lv2_int_tag_t()
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
: id(idm::get_current_id())
|
||||
{
|
||||
}
|
||||
|
||||
lv2_int_serv_t::lv2_int_serv_t(const std::shared_ptr<PPUThread>& thread)
|
||||
: thread(thread)
|
||||
, id(Emu.GetIdManager().get_current_id())
|
||||
, id(idm::get_current_id())
|
||||
{
|
||||
}
|
||||
|
||||
@ -38,8 +38,8 @@ void lv2_int_serv_t::join(PPUThread& ppu, lv2_lock_t& lv2_lock)
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
Emu.GetIdManager().remove<lv2_int_serv_t>(id);
|
||||
Emu.GetIdManager().remove<PPUThread>(thread->get_id());
|
||||
idm::remove<lv2_int_serv_t>(id);
|
||||
idm::remove<PPUThread>(thread->get_id());
|
||||
}
|
||||
|
||||
s32 sys_interrupt_tag_destroy(u32 intrtag)
|
||||
@ -48,7 +48,7 @@ s32 sys_interrupt_tag_destroy(u32 intrtag)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto tag = Emu.GetIdManager().get<lv2_int_tag_t>(intrtag);
|
||||
const auto tag = idm::get<lv2_int_tag_t>(intrtag);
|
||||
|
||||
if (!tag)
|
||||
{
|
||||
@ -60,7 +60,7 @@ s32 sys_interrupt_tag_destroy(u32 intrtag)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_int_tag_t>(intrtag);
|
||||
idm::remove<lv2_int_tag_t>(intrtag);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -72,7 +72,7 @@ s32 _sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u32 intrthread
|
||||
LV2_LOCK;
|
||||
|
||||
// Get interrupt tag
|
||||
const auto tag = Emu.GetIdManager().get<lv2_int_tag_t>(intrtag);
|
||||
const auto tag = idm::get<lv2_int_tag_t>(intrtag);
|
||||
|
||||
if (!tag)
|
||||
{
|
||||
@ -80,7 +80,7 @@ s32 _sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u32 intrthread
|
||||
}
|
||||
|
||||
// Get interrupt thread
|
||||
const auto it = Emu.GetIdManager().get<PPUThread>(intrthread);
|
||||
const auto it = idm::get<PPUThread>(intrthread);
|
||||
|
||||
if (!it)
|
||||
{
|
||||
@ -100,7 +100,7 @@ s32 _sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u32 intrthread
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
|
||||
const auto handler = Emu.GetIdManager().make_ptr<lv2_int_serv_t>(it);
|
||||
const auto handler = idm::make_ptr<lv2_int_serv_t>(it);
|
||||
|
||||
tag->handler = handler;
|
||||
|
||||
@ -153,7 +153,7 @@ s32 _sys_interrupt_thread_disestablish(PPUThread& ppu, u32 ih, vm::ptr<u64> r13)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto handler = Emu.GetIdManager().get<lv2_int_serv_t>(ih);
|
||||
const auto handler = idm::get<lv2_int_serv_t>(ih);
|
||||
|
||||
if (!handler)
|
||||
{
|
||||
|
@ -13,8 +13,6 @@ struct lv2_int_tag_t
|
||||
lv2_int_tag_t();
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_int_tag_t, 0x0A); // SYS_INTR_TAG_OBJECT
|
||||
|
||||
struct lv2_int_serv_t
|
||||
{
|
||||
const std::shared_ptr<PPUThread> thread;
|
||||
@ -27,8 +25,6 @@ struct lv2_int_serv_t
|
||||
void join(PPUThread& ppu, lv2_lock_t& lv2_lock);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_int_serv_t, 0x0B); // SYS_INTR_SERVICE_HANDLE_OBJECT
|
||||
|
||||
// SysCalls
|
||||
s32 sys_interrupt_tag_destroy(u32 intrtag);
|
||||
s32 _sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u32 intrthread, u64 arg1, u64 arg2);
|
||||
|
@ -40,7 +40,7 @@ s32 _sys_lwcond_create(vm::ptr<u32> lwcond_id, u32 lwmutex_id, vm::ptr<sys_lwcon
|
||||
{
|
||||
sys_lwcond.Warning("_sys_lwcond_create(lwcond_id=*0x%x, lwmutex_id=0x%x, control=*0x%x, name=0x%llx, arg5=0x%x)", lwcond_id, lwmutex_id, control, name, arg5);
|
||||
|
||||
*lwcond_id = Emu.GetIdManager().make<lv2_lwcond_t>(name);
|
||||
*lwcond_id = idm::make<lv2_lwcond_t>(name);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -51,7 +51,7 @@ s32 _sys_lwcond_destroy(u32 lwcond_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto cond = idm::get<lv2_lwcond_t>(lwcond_id);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
@ -63,7 +63,7 @@ s32 _sys_lwcond_destroy(u32 lwcond_id)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_lwcond_t>(lwcond_id);
|
||||
idm::remove<lv2_lwcond_t>(lwcond_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -74,8 +74,8 @@ s32 _sys_lwcond_signal(u32 lwcond_id, u32 lwmutex_id, u32 ppu_thread_id, u32 mod
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto cond = idm::get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!cond || (lwmutex_id && !mutex))
|
||||
{
|
||||
@ -127,8 +127,8 @@ s32 _sys_lwcond_signal_all(u32 lwcond_id, u32 lwmutex_id, u32 mode)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto cond = idm::get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!cond || (lwmutex_id && !mutex))
|
||||
{
|
||||
@ -165,8 +165,8 @@ s32 _sys_lwcond_queue_wait(PPUThread& ppu, u32 lwcond_id, u32 lwmutex_id, u64 ti
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto cond = Emu.GetIdManager().get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto cond = idm::get<lv2_lwcond_t>(lwcond_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!cond || !mutex)
|
||||
{
|
||||
|
@ -35,8 +35,6 @@ struct lv2_lwcond_t
|
||||
void notify(lv2_lock_t& lv2_lock, sleep_queue_t::value_type& thread, const std::shared_ptr<lv2_lwmutex_t>& mutex, bool mode2);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_lwcond_t, 0x97); // SYS_LWCOND_OBJECT
|
||||
|
||||
// Aux
|
||||
class PPUThread;
|
||||
|
||||
|
@ -50,7 +50,7 @@ s32 _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sys_lwmut
|
||||
throw EXCEPTION("Unknown arguments (arg4=0x%x, arg6=0x%x)", arg4, arg6);
|
||||
}
|
||||
|
||||
*lwmutex_id = Emu.GetIdManager().make<lv2_lwmutex_t>(protocol, name);
|
||||
*lwmutex_id = idm::make<lv2_lwmutex_t>(protocol, name);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -61,7 +61,7 @@ s32 _sys_lwmutex_destroy(u32 lwmutex_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -73,7 +73,7 @@ s32 _sys_lwmutex_destroy(u32 lwmutex_id)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_lwmutex_t>(lwmutex_id);
|
||||
idm::remove<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -86,7 +86,7 @@ s32 _sys_lwmutex_lock(PPUThread& ppu, u32 lwmutex_id, u64 timeout)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -133,7 +133,7 @@ s32 _sys_lwmutex_trylock(u32 lwmutex_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -156,7 +156,7 @@ s32 _sys_lwmutex_unlock(u32 lwmutex_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_lwmutex_t>(lwmutex_id);
|
||||
const auto mutex = idm::get<lv2_lwmutex_t>(lwmutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
|
@ -70,8 +70,6 @@ struct lv2_lwmutex_t
|
||||
void unlock(lv2_lock_t& lv2_lock);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_lwmutex_t, 0x95); // SYS_LWMUTEX_OBJECT
|
||||
|
||||
// Aux
|
||||
class PPUThread;
|
||||
|
||||
|
@ -10,7 +10,7 @@ SysCallBase sys_memory("sys_memory");
|
||||
|
||||
lv2_memory_container_t::lv2_memory_container_t(u32 size)
|
||||
: size(size)
|
||||
, id(Emu.GetIdManager().get_current_id())
|
||||
, id(idm::get_current_id())
|
||||
{
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ s32 sys_memory_allocate_from_container(u32 size, u32 cid, u64 flags, vm::ptr<u32
|
||||
LV2_LOCK;
|
||||
|
||||
// Check if this container ID is valid
|
||||
const auto ct = Emu.GetIdManager().get<lv2_memory_container_t>(cid);
|
||||
const auto ct = idm::get<lv2_memory_container_t>(cid);
|
||||
|
||||
if (!ct)
|
||||
{
|
||||
@ -155,7 +155,7 @@ s32 sys_memory_free(u32 addr)
|
||||
const auto area = vm::get(vm::user_space);
|
||||
|
||||
// Check all memory containers
|
||||
for (auto& ct : Emu.GetIdManager().get_all<lv2_memory_container_t>())
|
||||
for (auto& ct : idm::get_all<lv2_memory_container_t>())
|
||||
{
|
||||
auto found = ct->allocs.find(addr);
|
||||
|
||||
@ -210,7 +210,7 @@ s32 sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info)
|
||||
u32 reserved = 0;
|
||||
|
||||
// Check all memory containers
|
||||
for (auto& ct : Emu.GetIdManager().get_all<lv2_memory_container_t>())
|
||||
for (auto& ct : idm::get_all<lv2_memory_container_t>())
|
||||
{
|
||||
reserved += ct->size;
|
||||
}
|
||||
@ -241,7 +241,7 @@ s32 sys_memory_container_create(vm::ptr<u32> cid, u32 size)
|
||||
u32 reserved = 0;
|
||||
|
||||
// Check all memory containers
|
||||
for (auto& ct : Emu.GetIdManager().get_all<lv2_memory_container_t>())
|
||||
for (auto& ct : idm::get_all<lv2_memory_container_t>())
|
||||
{
|
||||
reserved += ct->size;
|
||||
}
|
||||
@ -255,7 +255,7 @@ s32 sys_memory_container_create(vm::ptr<u32> cid, u32 size)
|
||||
}
|
||||
|
||||
// Create the memory container
|
||||
*cid = Emu.GetIdManager().make<lv2_memory_container_t>(size);
|
||||
*cid = idm::make<lv2_memory_container_t>(size);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -266,7 +266,7 @@ s32 sys_memory_container_destroy(u32 cid)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto ct = Emu.GetIdManager().get<lv2_memory_container_t>(cid);
|
||||
const auto ct = idm::get<lv2_memory_container_t>(cid);
|
||||
|
||||
if (!ct)
|
||||
{
|
||||
@ -279,7 +279,7 @@ s32 sys_memory_container_destroy(u32 cid)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_memory_container_t>(cid);
|
||||
idm::remove<lv2_memory_container_t>(cid);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -290,7 +290,7 @@ s32 sys_memory_container_get_size(vm::ptr<sys_memory_info_t> mem_info, u32 cid)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto ct = Emu.GetIdManager().get<lv2_memory_container_t>(cid);
|
||||
const auto ct = idm::get<lv2_memory_container_t>(cid);
|
||||
|
||||
if (!ct)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ SysCallBase sys_mmapper("sys_mmapper");
|
||||
lv2_memory_t::lv2_memory_t(u32 size, u32 align, u64 flags, const std::shared_ptr<lv2_memory_container_t> ct)
|
||||
: size(size)
|
||||
, align(align)
|
||||
, id(Emu.GetIdManager().get_current_id())
|
||||
, id(idm::get_current_id())
|
||||
, flags(flags)
|
||||
, ct(ct)
|
||||
{
|
||||
@ -118,7 +118,7 @@ s32 sys_mmapper_allocate_memory(u64 size, u64 flags, vm::ptr<u32> mem_id)
|
||||
throw EXCEPTION("Unexpected");
|
||||
|
||||
// Generate a new mem ID
|
||||
*mem_id = Emu.GetIdManager().make<lv2_memory_t>(static_cast<u32>(size), align, flags, nullptr);
|
||||
*mem_id = idm::make<lv2_memory_t>(static_cast<u32>(size), align, flags, nullptr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -130,7 +130,7 @@ s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, vm:
|
||||
LV2_LOCK;
|
||||
|
||||
// Check if this container ID is valid.
|
||||
const auto ct = Emu.GetIdManager().get<lv2_memory_container_t>(cid);
|
||||
const auto ct = idm::get<lv2_memory_container_t>(cid);
|
||||
|
||||
if (!ct)
|
||||
{
|
||||
@ -179,7 +179,7 @@ s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, vm:
|
||||
ct->used += size;
|
||||
|
||||
// Generate a new mem ID
|
||||
*mem_id = Emu.GetIdManager().make<lv2_memory_t>(size, align, flags, ct);
|
||||
*mem_id = idm::make<lv2_memory_t>(size, align, flags, ct);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -224,7 +224,7 @@ s32 sys_mmapper_free_memory(u32 mem_id)
|
||||
LV2_LOCK;
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
const auto mem = Emu.GetIdManager().get<lv2_memory_t>(mem_id);
|
||||
const auto mem = idm::get<lv2_memory_t>(mem_id);
|
||||
|
||||
if (!mem)
|
||||
{
|
||||
@ -243,7 +243,7 @@ s32 sys_mmapper_free_memory(u32 mem_id)
|
||||
}
|
||||
|
||||
// Release the allocated memory and remove the ID
|
||||
Emu.GetIdManager().remove<lv2_memory_t>(mem_id);
|
||||
idm::remove<lv2_memory_t>(mem_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -261,7 +261,7 @@ s32 sys_mmapper_map_memory(u32 addr, u32 mem_id, u64 flags)
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
const auto mem = Emu.GetIdManager().get<lv2_memory_t>(mem_id);
|
||||
const auto mem = idm::get<lv2_memory_t>(mem_id);
|
||||
|
||||
if (!mem)
|
||||
{
|
||||
@ -301,7 +301,7 @@ s32 sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, vm::ptr<u3
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
const auto mem = Emu.GetIdManager().get<lv2_memory_t>(mem_id);
|
||||
const auto mem = idm::get<lv2_memory_t>(mem_id);
|
||||
|
||||
if (!mem)
|
||||
{
|
||||
@ -333,7 +333,7 @@ s32 sys_mmapper_unmap_memory(u32 addr, vm::ptr<u32> mem_id)
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
for (auto& mem : Emu.GetIdManager().get_all<lv2_memory_t>())
|
||||
for (auto& mem : idm::get_all<lv2_memory_t>())
|
||||
{
|
||||
if (mem->addr == addr)
|
||||
{
|
||||
|
@ -17,8 +17,6 @@ struct lv2_memory_t
|
||||
lv2_memory_t(u32 size, u32 align, u64 flags, const std::shared_ptr<lv2_memory_container_t> ct);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_memory_t, 0x08); // SYS_MEM_OBJECT
|
||||
|
||||
// SysCalls
|
||||
s32 sys_mmapper_allocate_address(u64 size, u64 flags, u64 alignment, vm::ptr<u32> alloc_addr);
|
||||
s32 sys_mmapper_allocate_fixed_address();
|
||||
|
@ -62,7 +62,7 @@ s32 sys_mutex_create(vm::ptr<u32> mutex_id, vm::ptr<sys_mutex_attribute_t> attr)
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
*mutex_id = Emu.GetIdManager().make<lv2_mutex_t>(recursive, protocol, attr->name_u64);
|
||||
*mutex_id = idm::make<lv2_mutex_t>(recursive, protocol, attr->name_u64);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -73,7 +73,7 @@ s32 sys_mutex_destroy(u32 mutex_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_mutex_t>(mutex_id);
|
||||
const auto mutex = idm::get<lv2_mutex_t>(mutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -90,7 +90,7 @@ s32 sys_mutex_destroy(u32 mutex_id)
|
||||
return CELL_EPERM;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_mutex_t>(mutex_id);
|
||||
idm::remove<lv2_mutex_t>(mutex_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -103,7 +103,7 @@ s32 sys_mutex_lock(PPUThread& ppu, u32 mutex_id, u64 timeout)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_mutex_t>(mutex_id);
|
||||
const auto mutex = idm::get<lv2_mutex_t>(mutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -175,7 +175,7 @@ s32 sys_mutex_trylock(PPUThread& ppu, u32 mutex_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_mutex_t>(mutex_id);
|
||||
const auto mutex = idm::get<lv2_mutex_t>(mutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
@ -217,7 +217,7 @@ s32 sys_mutex_unlock(PPUThread& ppu, u32 mutex_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_mutex_t>(mutex_id);
|
||||
const auto mutex = idm::get<lv2_mutex_t>(mutex_id);
|
||||
|
||||
if (!mutex)
|
||||
{
|
||||
|
@ -43,8 +43,6 @@ struct lv2_mutex_t
|
||||
void unlock(lv2_lock_t& lv2_lock);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_mutex_t, 0x85); // SYS_MUTEX_OBJECT
|
||||
|
||||
class PPUThread;
|
||||
|
||||
// SysCalls
|
||||
|
@ -18,7 +18,7 @@ void _sys_ppu_thread_exit(PPUThread& ppu, u64 errorcode)
|
||||
LV2_LOCK;
|
||||
|
||||
// get all sys_mutex objects
|
||||
for (auto& mutex : Emu.GetIdManager().get_all<lv2_mutex_t>())
|
||||
for (auto& mutex : idm::get_all<lv2_mutex_t>())
|
||||
{
|
||||
// unlock mutex if locked by this thread
|
||||
if (mutex->owner.get() == &ppu)
|
||||
@ -31,7 +31,7 @@ void _sys_ppu_thread_exit(PPUThread& ppu, u64 errorcode)
|
||||
|
||||
if (!ppu.is_joinable)
|
||||
{
|
||||
Emu.GetIdManager().remove<PPUThread>(ppu.get_id());
|
||||
idm::remove<PPUThread>(ppu.get_id());
|
||||
}
|
||||
|
||||
ppu.exit();
|
||||
@ -50,7 +50,7 @@ s32 sys_ppu_thread_join(PPUThread& ppu, u32 thread_id, vm::ptr<u64> vptr)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -82,7 +82,7 @@ s32 sys_ppu_thread_join(PPUThread& ppu, u32 thread_id, vm::ptr<u64> vptr)
|
||||
*vptr = thread->GPR[3];
|
||||
|
||||
// cleanup
|
||||
Emu.GetIdManager().remove<PPUThread>(thread->get_id());
|
||||
idm::remove<PPUThread>(thread->get_id());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -93,7 +93,7 @@ s32 sys_ppu_thread_detach(u32 thread_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -131,7 +131,7 @@ s32 sys_ppu_thread_set_priority(u32 thread_id, s32 prio)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -154,7 +154,7 @@ s32 sys_ppu_thread_get_priority(u32 thread_id, vm::ptr<s32> priop)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -182,7 +182,7 @@ s32 sys_ppu_thread_stop(u32 thread_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -200,7 +200,7 @@ s32 sys_ppu_thread_restart(u32 thread_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -215,7 +215,7 @@ s32 sys_ppu_thread_restart(u32 thread_id)
|
||||
|
||||
u32 ppu_thread_create(u32 entry, u64 arg, s32 prio, u32 stacksize, bool is_joinable, bool is_interrupt, std::string name, std::function<void(PPUThread&)> task)
|
||||
{
|
||||
const auto ppu = Emu.GetIdManager().make_ptr<PPUThread>(name);
|
||||
const auto ppu = idm::make_ptr<PPUThread>(name);
|
||||
|
||||
ppu->prio = prio;
|
||||
ppu->stack_size = stacksize < 0x4000 ? 0x4000 : stacksize; // (hack) adjust minimal stack size
|
||||
@ -257,7 +257,7 @@ s32 _sys_ppu_thread_create(vm::ptr<u64> thread_id, vm::ptr<ppu_thread_param_t> p
|
||||
return CELL_EPERM;
|
||||
}
|
||||
|
||||
const auto ppu = Emu.GetIdManager().make_ptr<PPUThread>(threadname ? threadname.get_ptr() : "");
|
||||
const auto ppu = idm::make_ptr<PPUThread>(threadname ? threadname.get_ptr() : "");
|
||||
|
||||
ppu->prio = prio;
|
||||
ppu->stack_size = stacksize < 0x4000 ? 0x4000 : stacksize; // (hack) adjust minimal stack size
|
||||
@ -286,7 +286,7 @@ s32 sys_ppu_thread_start(u32 thread_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -304,7 +304,7 @@ s32 sys_ppu_thread_rename(u32 thread_id, vm::cptr<char> name)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<PPUThread>(thread_id);
|
||||
const auto thread = idm::get<PPUThread>(thread_id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
|
@ -7,7 +7,21 @@
|
||||
#include "Emu/FS/VFS.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Loader/PSF.h"
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_lwcond.h"
|
||||
#include "sys_mutex.h"
|
||||
#include "sys_cond.h"
|
||||
#include "sys_event.h"
|
||||
#include "sys_event_flag.h"
|
||||
#include "sys_interrupt.h"
|
||||
#include "sys_memory.h"
|
||||
#include "sys_mmapper.h"
|
||||
#include "sys_prx.h"
|
||||
#include "sys_rwlock.h"
|
||||
#include "sys_semaphore.h"
|
||||
#include "sys_timer.h"
|
||||
#include "sys_trace.h"
|
||||
#include "sys_fs.h"
|
||||
#include "sys_process.h"
|
||||
|
||||
SysCallBase sys_process("sys_process");
|
||||
@ -61,74 +75,77 @@ s32 sys_process_get_number_of_object(u32 object, vm::ptr<u32> nump)
|
||||
|
||||
switch(object)
|
||||
{
|
||||
case SYS_MEM_OBJECT:
|
||||
case SYS_MUTEX_OBJECT:
|
||||
case SYS_COND_OBJECT:
|
||||
case SYS_RWLOCK_OBJECT:
|
||||
case SYS_INTR_TAG_OBJECT:
|
||||
case SYS_INTR_SERVICE_HANDLE_OBJECT:
|
||||
case SYS_EVENT_QUEUE_OBJECT:
|
||||
case SYS_EVENT_PORT_OBJECT:
|
||||
case SYS_TRACE_OBJECT:
|
||||
case SYS_SPUIMAGE_OBJECT:
|
||||
case SYS_PRX_OBJECT:
|
||||
case SYS_SPUPORT_OBJECT:
|
||||
case SYS_LWMUTEX_OBJECT:
|
||||
case SYS_TIMER_OBJECT:
|
||||
case SYS_SEMAPHORE_OBJECT:
|
||||
case SYS_FS_FD_OBJECT:
|
||||
case SYS_LWCOND_OBJECT:
|
||||
case SYS_EVENT_FLAG_OBJECT:
|
||||
case SYS_MEM_OBJECT: *nump = idm::get_count<lv2_memory_t>(); break;
|
||||
case SYS_MUTEX_OBJECT: *nump = idm::get_count<lv2_mutex_t>(); break;
|
||||
case SYS_COND_OBJECT: *nump = idm::get_count<lv2_cond_t>(); break;
|
||||
case SYS_RWLOCK_OBJECT: *nump = idm::get_count<lv2_rwlock_t>(); break;
|
||||
case SYS_INTR_TAG_OBJECT: *nump = idm::get_count<lv2_int_tag_t>(); break;
|
||||
case SYS_INTR_SERVICE_HANDLE_OBJECT: *nump = idm::get_count<lv2_int_serv_t>(); break;
|
||||
case SYS_EVENT_QUEUE_OBJECT: *nump = idm::get_count<lv2_event_queue_t>(); break;
|
||||
case SYS_EVENT_PORT_OBJECT: *nump = idm::get_count<lv2_event_port_t>(); break;
|
||||
case SYS_TRACE_OBJECT: throw EXCEPTION("SYS_TRACE_OBJECT");
|
||||
case SYS_SPUIMAGE_OBJECT: throw EXCEPTION("SYS_SPUIMAGE_OBJECT");
|
||||
case SYS_PRX_OBJECT: *nump = idm::get_count<lv2_prx_t>(); break;
|
||||
case SYS_SPUPORT_OBJECT: throw EXCEPTION("SYS_SPUPORT_OBJECT");
|
||||
case SYS_LWMUTEX_OBJECT: *nump = idm::get_count<lv2_lwmutex_t>(); break;
|
||||
case SYS_TIMER_OBJECT: *nump = idm::get_count<lv2_timer_t>(); break;
|
||||
case SYS_SEMAPHORE_OBJECT: *nump = idm::get_count<lv2_sema_t>(); break;
|
||||
case SYS_FS_FD_OBJECT: throw EXCEPTION("SYS_FS_FD_OBJECT");
|
||||
case SYS_LWCOND_OBJECT: *nump = idm::get_count<lv2_lwcond_t>(); break;
|
||||
case SYS_EVENT_FLAG_OBJECT: *nump = idm::get_count<lv2_event_flag_t>(); break;
|
||||
|
||||
default:
|
||||
{
|
||||
*nump = Emu.GetIdManager().get_count(object);
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_EINVAL;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_process_get_id(u32 object, vm::ptr<u32> buffer, u32 size, vm::ptr<u32> set_size)
|
||||
{
|
||||
sys_process.Error("sys_process_get_id(object=0x%x, buffer=*0x%x, size=%d, set_size=*0x%x)", object, buffer, size, set_size);
|
||||
|
||||
std::set<u32> objects;
|
||||
|
||||
switch (object)
|
||||
{
|
||||
case SYS_MEM_OBJECT:
|
||||
case SYS_MUTEX_OBJECT:
|
||||
case SYS_COND_OBJECT:
|
||||
case SYS_RWLOCK_OBJECT:
|
||||
case SYS_INTR_TAG_OBJECT:
|
||||
case SYS_INTR_SERVICE_HANDLE_OBJECT:
|
||||
case SYS_EVENT_QUEUE_OBJECT:
|
||||
case SYS_EVENT_PORT_OBJECT:
|
||||
case SYS_TRACE_OBJECT:
|
||||
case SYS_SPUIMAGE_OBJECT:
|
||||
case SYS_PRX_OBJECT:
|
||||
case SYS_SPUPORT_OBJECT:
|
||||
case SYS_LWMUTEX_OBJECT:
|
||||
case SYS_TIMER_OBJECT:
|
||||
case SYS_SEMAPHORE_OBJECT:
|
||||
case SYS_FS_FD_OBJECT:
|
||||
case SYS_LWCOND_OBJECT:
|
||||
case SYS_EVENT_FLAG_OBJECT:
|
||||
case SYS_MEM_OBJECT: objects = idm::get_set<lv2_memory_t>(); break;
|
||||
case SYS_MUTEX_OBJECT: objects = idm::get_set<lv2_mutex_t>(); break;
|
||||
case SYS_COND_OBJECT: objects = idm::get_set<lv2_cond_t>(); break;
|
||||
case SYS_RWLOCK_OBJECT: objects = idm::get_set<lv2_rwlock_t>(); break;
|
||||
case SYS_INTR_TAG_OBJECT: objects = idm::get_set<lv2_int_tag_t>(); break;
|
||||
case SYS_INTR_SERVICE_HANDLE_OBJECT: objects = idm::get_set<lv2_int_serv_t>(); break;
|
||||
case SYS_EVENT_QUEUE_OBJECT: objects = idm::get_set<lv2_event_queue_t>(); break;
|
||||
case SYS_EVENT_PORT_OBJECT: objects = idm::get_set<lv2_event_port_t>(); break;
|
||||
case SYS_TRACE_OBJECT: throw EXCEPTION("SYS_TRACE_OBJECT");
|
||||
case SYS_SPUIMAGE_OBJECT: throw EXCEPTION("SYS_SPUIMAGE_OBJECT");
|
||||
case SYS_PRX_OBJECT: objects = idm::get_set<lv2_prx_t>(); break;
|
||||
case SYS_SPUPORT_OBJECT: throw EXCEPTION("SYS_SPUPORT_OBJECT");
|
||||
case SYS_LWMUTEX_OBJECT: objects = idm::get_set<lv2_lwmutex_t>(); break;
|
||||
case SYS_TIMER_OBJECT: objects = idm::get_set<lv2_timer_t>(); break;
|
||||
case SYS_SEMAPHORE_OBJECT: objects = idm::get_set<lv2_sema_t>(); break;
|
||||
case SYS_FS_FD_OBJECT: throw EXCEPTION("SYS_FS_FD_OBJECT");
|
||||
case SYS_LWCOND_OBJECT: objects = idm::get_set<lv2_lwcond_t>(); break;
|
||||
case SYS_EVENT_FLAG_OBJECT: objects = idm::get_set<lv2_event_flag_t>(); break;
|
||||
|
||||
default:
|
||||
{
|
||||
const auto objects = Emu.GetIdManager().get_set(object);
|
||||
|
||||
u32 i = 0;
|
||||
|
||||
for (auto id = objects.begin(); i < size && id != objects.end(); id++, i++)
|
||||
{
|
||||
buffer[i] = *id;
|
||||
}
|
||||
|
||||
*set_size = i;
|
||||
|
||||
return CELL_OK;
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_EINVAL;
|
||||
u32 i = 0;
|
||||
|
||||
for (auto id = objects.begin(); i < size && id != objects.end(); id++, i++)
|
||||
{
|
||||
buffer[i] = *id;
|
||||
}
|
||||
|
||||
*set_size = i;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 process_is_spu_lock_line_reservation_address(u32 addr, u64 flags)
|
||||
|
@ -19,7 +19,7 @@ SysCallBase sys_prx("sys_prx");
|
||||
extern void fill_ppu_exec_map(u32 addr, u32 size);
|
||||
|
||||
lv2_prx_t::lv2_prx_t()
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
: id(idm::get_current_id())
|
||||
{
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ s32 prx_load_module(std::string path, u64 flags, vm::ptr<sys_prx_load_module_opt
|
||||
loader::handlers::elf64::sprx_info info;
|
||||
loader.load_sprx(info);
|
||||
|
||||
auto prx = Emu.GetIdManager().make_ptr<lv2_prx_t>();
|
||||
auto prx = idm::make_ptr<lv2_prx_t>();
|
||||
|
||||
auto meta = info.modules[""];
|
||||
prx->start.set(meta.exports[0xBC9A0086]);
|
||||
@ -190,7 +190,7 @@ s32 sys_prx_start_module(s32 id, u64 flags, vm::ptr<sys_prx_start_module_option_
|
||||
{
|
||||
sys_prx.Warning("sys_prx_start_module(id=0x%x, flags=0x%llx, pOpt=*0x%x)", id, flags, pOpt);
|
||||
|
||||
const auto prx = Emu.GetIdManager().get<lv2_prx_t>(id);
|
||||
const auto prx = idm::get<lv2_prx_t>(id);
|
||||
|
||||
if (!prx)
|
||||
{
|
||||
@ -210,7 +210,7 @@ s32 sys_prx_stop_module(s32 id, u64 flags, vm::ptr<sys_prx_stop_module_option_t>
|
||||
{
|
||||
sys_prx.Warning("sys_prx_stop_module(id=0x%x, flags=0x%llx, pOpt=*0x%x)", id, flags, pOpt);
|
||||
|
||||
const auto prx = Emu.GetIdManager().get<lv2_prx_t>(id);
|
||||
const auto prx = idm::get<lv2_prx_t>(id);
|
||||
|
||||
if (!prx)
|
||||
{
|
||||
@ -231,7 +231,7 @@ s32 sys_prx_unload_module(s32 id, u64 flags, vm::ptr<sys_prx_unload_module_optio
|
||||
sys_prx.Warning("sys_prx_unload_module(id=0x%x, flags=0x%llx, pOpt=*0x%x)", id, flags, pOpt);
|
||||
|
||||
// Get the PRX, free the used memory and delete the object and its ID
|
||||
const auto prx = Emu.GetIdManager().get<lv2_prx_t>(id);
|
||||
const auto prx = idm::get<lv2_prx_t>(id);
|
||||
|
||||
if (!prx)
|
||||
{
|
||||
@ -241,7 +241,7 @@ s32 sys_prx_unload_module(s32 id, u64 flags, vm::ptr<sys_prx_unload_module_optio
|
||||
//Memory.Free(prx->address);
|
||||
|
||||
//s32 result = prx->exit ? prx->exit() : CELL_OK;
|
||||
Emu.GetIdManager().remove<lv2_prx_t>(id);
|
||||
idm::remove<lv2_prx_t>(id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -179,8 +179,6 @@ struct lv2_prx_t
|
||||
lv2_prx_t();
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_prx_t, 0x23); // SYS_PRX_OBJECT
|
||||
|
||||
// SysCalls
|
||||
s32 sys_prx_load_module(vm::cptr<char> path, u64 flags, vm::ptr<sys_prx_load_module_option_t> pOpt);
|
||||
s32 sys_prx_load_module_list(s32 count, vm::cpptr<char> path_list, u64 flags, vm::ptr<sys_prx_load_module_option_t> pOpt, vm::ptr<u32> id_list);
|
||||
|
@ -68,7 +68,7 @@ s32 sys_rwlock_create(vm::ptr<u32> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> a
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
*rw_lock_id = Emu.GetIdManager().make<lv2_rwlock_t>(protocol, attr->name_u64);
|
||||
*rw_lock_id = idm::make<lv2_rwlock_t>(protocol, attr->name_u64);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -79,7 +79,7 @@ s32 sys_rwlock_destroy(u32 rw_lock_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
@ -91,7 +91,7 @@ s32 sys_rwlock_destroy(u32 rw_lock_id)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_rwlock_t>(rw_lock_id);
|
||||
idm::remove<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -104,7 +104,7 @@ s32 sys_rwlock_rlock(PPUThread& ppu, u32 rw_lock_id, u64 timeout)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
@ -159,7 +159,7 @@ s32 sys_rwlock_tryrlock(u32 rw_lock_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
@ -185,7 +185,7 @@ s32 sys_rwlock_runlock(u32 rw_lock_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
@ -213,7 +213,7 @@ s32 sys_rwlock_wlock(PPUThread& ppu, u32 rw_lock_id, u64 timeout)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
@ -282,7 +282,7 @@ s32 sys_rwlock_trywlock(PPUThread& ppu, u32 rw_lock_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
@ -310,7 +310,7 @@ s32 sys_rwlock_wunlock(PPUThread& ppu, u32 rw_lock_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto rwlock = Emu.GetIdManager().get<lv2_rwlock_t>(rw_lock_id);
|
||||
const auto rwlock = idm::get<lv2_rwlock_t>(rw_lock_id);
|
||||
|
||||
if (!rwlock)
|
||||
{
|
||||
|
@ -39,8 +39,6 @@ struct lv2_rwlock_t
|
||||
void notify_all(lv2_lock_t& lv2_lock);
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_rwlock_t, 0x88); // SYS_RWLOCK_OBJECT
|
||||
|
||||
// Aux
|
||||
class PPUThread;
|
||||
|
||||
|
@ -40,7 +40,7 @@ s32 sys_semaphore_create(vm::ptr<u32> sem_id, vm::ptr<sys_semaphore_attribute_t>
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
*sem_id = Emu.GetIdManager().make<lv2_sema_t>(protocol, max_val, attr->name_u64, initial_val);
|
||||
*sem_id = idm::make<lv2_sema_t>(protocol, max_val, attr->name_u64, initial_val);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -51,7 +51,7 @@ s32 sys_semaphore_destroy(u32 sem_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto sem = Emu.GetIdManager().get<lv2_sema_t>(sem_id);
|
||||
const auto sem = idm::get<lv2_sema_t>(sem_id);
|
||||
|
||||
if (!sem)
|
||||
{
|
||||
@ -63,7 +63,7 @@ s32 sys_semaphore_destroy(u32 sem_id)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_sema_t>(sem_id);
|
||||
idm::remove<lv2_sema_t>(sem_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -76,7 +76,7 @@ s32 sys_semaphore_wait(PPUThread& ppu, u32 sem_id, u64 timeout)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto sem = Emu.GetIdManager().get<lv2_sema_t>(sem_id);
|
||||
const auto sem = idm::get<lv2_sema_t>(sem_id);
|
||||
|
||||
if (!sem)
|
||||
{
|
||||
@ -123,7 +123,7 @@ s32 sys_semaphore_trywait(u32 sem_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto sem = Emu.GetIdManager().get<lv2_sema_t>(sem_id);
|
||||
const auto sem = idm::get<lv2_sema_t>(sem_id);
|
||||
|
||||
if (!sem)
|
||||
{
|
||||
@ -146,7 +146,7 @@ s32 sys_semaphore_post(u32 sem_id, s32 count)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto sem = Emu.GetIdManager().get<lv2_sema_t>(sem_id);
|
||||
const auto sem = idm::get<lv2_sema_t>(sem_id);
|
||||
|
||||
if (!sem)
|
||||
{
|
||||
@ -197,7 +197,7 @@ s32 sys_semaphore_get_value(u32 sem_id, vm::ptr<s32> count)
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
const auto sem = Emu.GetIdManager().get<lv2_sema_t>(sem_id);
|
||||
const auto sem = idm::get<lv2_sema_t>(sem_id);
|
||||
|
||||
if (!sem)
|
||||
{
|
||||
|
@ -38,8 +38,6 @@ struct lv2_sema_t
|
||||
}
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_sema_t, 0x96); // SYS_SEMAPHORE_OBJECT
|
||||
|
||||
// Aux
|
||||
class PPUThread;
|
||||
|
||||
|
@ -100,11 +100,11 @@ u32 spu_thread_initialize(u32 group_id, u32 spu_num, vm::ptr<sys_spu_image> img,
|
||||
sys_spu.Error("Unsupported SPU Thread options (0x%x)", option);
|
||||
}
|
||||
|
||||
const auto spu = Emu.GetIdManager().make_ptr<SPUThread>(name, spu_num);
|
||||
const auto spu = idm::make_ptr<SPUThread>(name, spu_num);
|
||||
|
||||
spu->custom_task = task;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(group_id);
|
||||
const auto group = idm::get<spu_group_t>(group_id);
|
||||
|
||||
spu->tg = group;
|
||||
group->threads[spu_num] = spu;
|
||||
@ -140,7 +140,7 @@ s32 sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group_id, u32 spu_num, vm
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(group_id);
|
||||
const auto group = idm::get<spu_group_t>(group_id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -167,7 +167,7 @@ s32 sys_spu_thread_set_argument(u32 id, vm::ptr<sys_spu_thread_argument> arg)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -200,7 +200,7 @@ s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr<u32> status)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -237,7 +237,7 @@ s32 sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_
|
||||
sys_spu.Todo("Unsupported SPU Thread Group type (0x%x)", attr->type);
|
||||
}
|
||||
|
||||
*id = Emu.GetIdManager().make<spu_group_t>(std::string{ attr->name.get_ptr(), attr->nsize - 1 }, num, prio, attr->type, attr->ct);
|
||||
*id = idm::make<spu_group_t>(std::string{ attr->name.get_ptr(), attr->nsize - 1 }, num, prio, attr->type, attr->ct);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -248,7 +248,7 @@ s32 sys_spu_thread_group_destroy(u32 id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -265,14 +265,14 @@ s32 sys_spu_thread_group_destroy(u32 id)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
Emu.GetIdManager().remove<SPUThread>(t->get_id());
|
||||
idm::remove<SPUThread>(t->get_id());
|
||||
|
||||
t.reset();
|
||||
}
|
||||
}
|
||||
|
||||
group->state = SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED; // hack
|
||||
Emu.GetIdManager().remove<spu_group_t>(id);
|
||||
idm::remove<spu_group_t>(id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -283,7 +283,7 @@ s32 sys_spu_thread_group_start(u32 id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -345,7 +345,7 @@ s32 sys_spu_thread_group_suspend(u32 id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -395,7 +395,7 @@ s32 sys_spu_thread_group_resume(u32 id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -438,7 +438,7 @@ s32 sys_spu_thread_group_yield(u32 id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -462,8 +462,8 @@ s32 sys_spu_thread_group_terminate(u32 id, s32 value)
|
||||
LV2_LOCK;
|
||||
|
||||
// seems the id can be either SPU Thread Group or SPU Thread
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto group = thread ? thread->tg.lock() : Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
const auto group = thread ? thread->tg.lock() : idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group && !thread)
|
||||
{
|
||||
@ -515,7 +515,7 @@ s32 sys_spu_thread_group_join(u32 id, vm::ptr<u32> cause, vm::ptr<u32> status)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -598,7 +598,7 @@ s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -640,7 +640,7 @@ s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<u64> value, u32 type)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -682,7 +682,7 @@ s32 sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -718,7 +718,7 @@ s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -741,7 +741,7 @@ s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<u64> value)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -759,7 +759,7 @@ s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -794,8 +794,8 @@ s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(eq);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(eq);
|
||||
|
||||
if (!group || !queue)
|
||||
{
|
||||
@ -850,7 +850,7 @@ s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -905,8 +905,8 @@ s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(eq);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(eq);
|
||||
|
||||
if (!thread || !queue)
|
||||
{
|
||||
@ -937,7 +937,7 @@ s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -968,8 +968,8 @@ s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(spuq);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(spuq);
|
||||
|
||||
if (!thread || !queue)
|
||||
{
|
||||
@ -1012,7 +1012,7 @@ s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto thread = Emu.GetIdManager().get<SPUThread>(id);
|
||||
const auto thread = idm::get<SPUThread>(id);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
@ -1038,8 +1038,8 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, vm::
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(eq);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(eq);
|
||||
|
||||
if (!group || !queue)
|
||||
{
|
||||
@ -1109,7 +1109,7 @@ s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto group = Emu.GetIdManager().get<spu_group_t>(id);
|
||||
const auto group = idm::get<spu_group_t>(id);
|
||||
|
||||
if (!group)
|
||||
{
|
||||
@ -1182,11 +1182,11 @@ s32 sys_raw_spu_destroy(PPUThread& ppu, u32 id)
|
||||
intr.tag->handler->join(ppu, lv2_lock);
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_int_tag_t>(intr.tag->id);
|
||||
idm::remove<lv2_int_tag_t>(intr.tag->id);
|
||||
}
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<RawSPUThread>(thread->get_id());
|
||||
idm::remove<RawSPUThread>(thread->get_id());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -1216,7 +1216,7 @@ s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr
|
||||
return CELL_EAGAIN;
|
||||
}
|
||||
|
||||
int_ctrl.tag = Emu.GetIdManager().make_ptr<lv2_int_tag_t>();
|
||||
int_ctrl.tag = idm::make_ptr<lv2_int_tag_t>();
|
||||
|
||||
*intrtag = int_ctrl.tag->id;
|
||||
|
||||
|
@ -18,7 +18,7 @@ lv2_timer_t::lv2_timer_t()
|
||||
, period(0)
|
||||
, state(SYS_TIMER_STATE_STOP)
|
||||
{
|
||||
auto name = fmt::format("Timer[0x%x] Thread", Emu.GetIdManager().get_current_id());
|
||||
auto name = fmt::format("Timer[0x%x] Thread", idm::get_current_id());
|
||||
|
||||
thread.start([name]{ return name; }, [this]()
|
||||
{
|
||||
@ -68,7 +68,7 @@ s32 sys_timer_create(vm::ptr<u32> timer_id)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_create(timer_id=*0x%x)", timer_id);
|
||||
|
||||
*timer_id = Emu.GetIdManager().make<lv2_timer_t>();
|
||||
*timer_id = idm::make<lv2_timer_t>();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -79,7 +79,7 @@ s32 sys_timer_destroy(u32 timer_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
|
||||
const auto timer = idm::get<lv2_timer_t>(timer_id);
|
||||
|
||||
if (!timer)
|
||||
{
|
||||
@ -91,7 +91,7 @@ s32 sys_timer_destroy(u32 timer_id)
|
||||
return CELL_EISCONN;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<lv2_timer_t>(timer_id);
|
||||
idm::remove<lv2_timer_t>(timer_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -102,7 +102,7 @@ s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> inf
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
|
||||
const auto timer = idm::get<lv2_timer_t>(timer_id);
|
||||
|
||||
if (!timer)
|
||||
{
|
||||
@ -125,7 +125,7 @@ s32 _sys_timer_start(u32 timer_id, u64 base_time, u64 period)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
|
||||
const auto timer = idm::get<lv2_timer_t>(timer_id);
|
||||
|
||||
if (!timer)
|
||||
{
|
||||
@ -178,7 +178,7 @@ s32 sys_timer_stop(u32 timer_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
|
||||
const auto timer = idm::get<lv2_timer_t>(timer_id);
|
||||
|
||||
if (!timer)
|
||||
{
|
||||
@ -196,8 +196,8 @@ s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(queue_id);
|
||||
const auto timer = idm::get<lv2_timer_t>(timer_id);
|
||||
const auto queue = idm::get<lv2_event_queue_t>(queue_id);
|
||||
|
||||
if (!timer || !queue)
|
||||
{
|
||||
@ -223,7 +223,7 @@ s32 sys_timer_disconnect_event_queue(u32 timer_id)
|
||||
|
||||
LV2_LOCK;
|
||||
|
||||
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
|
||||
const auto timer = idm::get<lv2_timer_t>(timer_id);
|
||||
|
||||
if (!timer)
|
||||
{
|
||||
|
@ -37,8 +37,6 @@ struct lv2_timer_t final
|
||||
~lv2_timer_t();
|
||||
};
|
||||
|
||||
REG_ID_TYPE(lv2_timer_t, 0x11); // SYS_TIMER_OBJECT
|
||||
|
||||
s32 sys_timer_create(vm::ptr<u32> timer_id);
|
||||
s32 sys_timer_destroy(u32 timer_id);
|
||||
s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> info);
|
||||
|
@ -50,7 +50,6 @@ Emulator::Emulator()
|
||||
, m_pad_manager(new PadManager())
|
||||
, m_keyboard_manager(new KeyboardManager())
|
||||
, m_mouse_manager(new MouseManager())
|
||||
, m_id_manager(new ID_manager())
|
||||
, m_gs_manager(new GSManager())
|
||||
, m_audio_manager(new AudioManager())
|
||||
, m_callback_manager(new CallbackManager())
|
||||
@ -374,6 +373,10 @@ void Emulator::Stop()
|
||||
|
||||
LOG_NOTICE(GENERAL, "All threads stopped...");
|
||||
|
||||
idm::clear();
|
||||
|
||||
LOG_NOTICE(GENERAL, "ID manager cleared...");
|
||||
|
||||
finalize_psv_modules();
|
||||
clear_all_psv_objects();
|
||||
|
||||
@ -396,7 +399,6 @@ void Emulator::Stop()
|
||||
GetAudioManager().Close();
|
||||
GetEventManager().Clear();
|
||||
GetCPU().Close();
|
||||
GetIdManager().clear();
|
||||
GetPadManager().Close();
|
||||
GetKeyboardManager().Close();
|
||||
GetMouseManager().Close();
|
||||
|
@ -14,7 +14,6 @@ class CPUThreadManager;
|
||||
class PadManager;
|
||||
class KeyboardManager;
|
||||
class MouseManager;
|
||||
class ID_manager;
|
||||
class GSManager;
|
||||
class AudioManager;
|
||||
class CallbackManager;
|
||||
@ -69,7 +68,6 @@ class Emulator
|
||||
std::unique_ptr<PadManager> m_pad_manager;
|
||||
std::unique_ptr<KeyboardManager> m_keyboard_manager;
|
||||
std::unique_ptr<MouseManager> m_mouse_manager;
|
||||
std::unique_ptr<ID_manager> m_id_manager;
|
||||
std::unique_ptr<GSManager> m_gs_manager;
|
||||
std::unique_ptr<AudioManager> m_audio_manager;
|
||||
std::unique_ptr<CallbackManager> m_callback_manager;
|
||||
@ -130,7 +128,6 @@ public:
|
||||
PadManager& GetPadManager() { return *m_pad_manager; }
|
||||
KeyboardManager& GetKeyboardManager() { return *m_keyboard_manager; }
|
||||
MouseManager& GetMouseManager() { return *m_mouse_manager; }
|
||||
ID_manager& GetIdManager() { return *m_id_manager; }
|
||||
GSManager& GetGSManager() { return *m_gs_manager; }
|
||||
AudioManager& GetAudioManager() { return *m_audio_manager; }
|
||||
CallbackManager& GetCallbackManager() { return *m_callback_manager; }
|
||||
|
@ -80,112 +80,106 @@ void KernelExplorer::Update()
|
||||
// TODO: FileSystem
|
||||
|
||||
// Semaphores
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_sema_t>())
|
||||
if (u32 count = idm::get_count<lv2_sema_t>())
|
||||
{
|
||||
sprintf(name, "Semaphores (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_sema_t>())
|
||||
for (const auto& data : idm::get_map<lv2_sema_t>())
|
||||
{
|
||||
const auto sem = Emu.GetIdManager().get<lv2_sema_t>(id);
|
||||
sprintf(name, "Semaphore: ID = 0x%x '%s', Count = %d, Max Count = %d, Waiters = %#llx", id, &name64(sem->name), sem->value.load(), sem->max, sem->sq.size());
|
||||
const auto& sema = *data.second;
|
||||
sprintf(name, "Semaphore: ID = 0x%x '%s', Count = %d, Max Count = %d, Waiters = %#llx", data.first, &name64(sema.name), sema.value.load(), sema.max, sema.sq.size());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Mutexes
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_mutex_t>())
|
||||
if (u32 count = idm::get_count<lv2_mutex_t>())
|
||||
{
|
||||
sprintf(name, "Mutexes (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_mutex_t>())
|
||||
for (const auto& data : idm::get_map<lv2_mutex_t>())
|
||||
{
|
||||
const auto mutex = Emu.GetIdManager().get<lv2_mutex_t>(id);
|
||||
sprintf(name, "Mutex: ID = 0x%x '%s'", id, &name64(mutex->name));
|
||||
sprintf(name, "Mutex: ID = 0x%x '%s'", data.first, &name64(data.second->name));
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Light Weight Mutexes
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_lwmutex_t>())
|
||||
if (u32 count = idm::get_count<lv2_lwmutex_t>())
|
||||
{
|
||||
sprintf(name, "Lightweight Mutexes (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_lwmutex_t>())
|
||||
for (const auto& data : idm::get_map<lv2_lwmutex_t>())
|
||||
{
|
||||
const auto lwm = Emu.GetIdManager().get<lv2_lwmutex_t>(id);
|
||||
sprintf(name, "Lightweight Mutex: ID = 0x%x '%s'", id, &name64(lwm->name));
|
||||
sprintf(name, "Lightweight Mutex: ID = 0x%x '%s'", data.first, &name64(data.second->name));
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Condition Variables
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_cond_t>())
|
||||
if (u32 count = idm::get_count<lv2_cond_t>())
|
||||
{
|
||||
sprintf(name, "Condition Variables (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_cond_t>())
|
||||
for (const auto& data : idm::get_map<lv2_cond_t>())
|
||||
{
|
||||
const auto cond = Emu.GetIdManager().get<lv2_cond_t>(id);
|
||||
sprintf(name, "Condition Variable: ID = 0x%x '%s'", id, &name64(cond->name));
|
||||
sprintf(name, "Condition Variable: ID = 0x%x '%s'", data.first, &name64(data.second->name));
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Light Weight Condition Variables
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_lwcond_t>())
|
||||
if (u32 count = idm::get_count<lv2_lwcond_t>())
|
||||
{
|
||||
sprintf(name, "Lightweight Condition Variables (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_lwcond_t>())
|
||||
for (const auto& data : idm::get_map<lv2_lwcond_t>())
|
||||
{
|
||||
const auto lwc = Emu.GetIdManager().get<lv2_lwcond_t>(id);
|
||||
sprintf(name, "Lightweight Condition Variable: ID = 0x%x '%s'", id, &name64(lwc->name));
|
||||
sprintf(name, "Lightweight Condition Variable: ID = 0x%x '%s'", data.first, &name64(data.second->name));
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Event Queues
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_event_queue_t>())
|
||||
if (u32 count = idm::get_count<lv2_event_queue_t>())
|
||||
{
|
||||
sprintf(name, "Event Queues (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_event_queue_t>())
|
||||
for (const auto& data : idm::get_map<lv2_event_queue_t>())
|
||||
{
|
||||
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(id);
|
||||
sprintf(name, "Event Queue: ID = 0x%x '%s', Key = %#llx", id, &name64(queue->name), queue->key);
|
||||
sprintf(name, "Event Queue: ID = 0x%x '%s', Key = %#llx", data.first, &name64(data.second->name), data.second->key);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Event Ports
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_event_port_t>())
|
||||
if (u32 count = idm::get_count<lv2_event_port_t>())
|
||||
{
|
||||
sprintf(name, "Event Ports (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto id : Emu.GetIdManager().get_set<lv2_event_port_t>())
|
||||
for (const auto& data : idm::get_map<lv2_event_port_t>())
|
||||
{
|
||||
const auto port = Emu.GetIdManager().get<lv2_event_port_t>(id);
|
||||
sprintf(name, "Event Port: ID = 0x%x, Name = %#llx", id, port->name);
|
||||
sprintf(name, "Event Port: ID = 0x%x, Name = %#llx", data.first, data.second->name);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Modules
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_prx_t>())
|
||||
if (u32 count = idm::get_count<lv2_prx_t>())
|
||||
{
|
||||
sprintf(name, "Modules (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
//sprintf(name, "Segment List (%l)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good
|
||||
//m_tree->AppendItem(node, name);
|
||||
|
||||
for (const auto& id : Emu.GetIdManager().get_set<lv2_prx_t>())
|
||||
for (const auto id : idm::get_set<lv2_prx_t>())
|
||||
{
|
||||
sprintf(name, "PRX: ID = 0x%x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
@ -193,12 +187,12 @@ void KernelExplorer::Update()
|
||||
}
|
||||
|
||||
// Memory Containers
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_memory_container_t>())
|
||||
if (u32 count = idm::get_count<lv2_memory_container_t>())
|
||||
{
|
||||
sprintf(name, "Memory Containers (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& id : Emu.GetIdManager().get_set<lv2_memory_container_t>())
|
||||
for (const auto id : idm::get_set<lv2_memory_container_t>())
|
||||
{
|
||||
sprintf(name, "Memory Container: ID = 0x%x", id);
|
||||
m_tree->AppendItem(node, name);
|
||||
@ -206,58 +200,52 @@ void KernelExplorer::Update()
|
||||
}
|
||||
|
||||
// Event Flags
|
||||
if (u32 count = Emu.GetIdManager().get_count<lv2_event_flag_t>())
|
||||
if (u32 count = idm::get_count<lv2_event_flag_t>())
|
||||
{
|
||||
sprintf(name, "Event Flags (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& id : Emu.GetIdManager().get_set<lv2_event_flag_t>())
|
||||
for (const auto& data : idm::get_map<lv2_event_flag_t>())
|
||||
{
|
||||
sprintf(name, "Event Flag: ID = 0x%x", id);
|
||||
sprintf(name, "Event Flag: ID = 0x%x", data.first);
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
// PPU Threads
|
||||
if (u32 count = Emu.GetIdManager().get_count<PPUThread>())
|
||||
if (u32 count = idm::get_count<PPUThread>())
|
||||
{
|
||||
sprintf(name, "PPU Threads (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& thread : Emu.GetIdManager().get_all<PPUThread>())
|
||||
for (const auto& data : idm::get_map<PPUThread>())
|
||||
{
|
||||
sprintf(name, "Thread: ID = 0x%08x '%s', - %s", thread->get_id(), thread->get_name().c_str(), thread->ThreadStatusToString());
|
||||
sprintf(name, "Thread: ID = 0x%08x '%s', - %s", data.first, data.second->get_name().c_str(), data.second->ThreadStatusToString());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (u32 count = Emu.GetIdManager().get_count<SPUThread>())
|
||||
if (u32 count = idm::get_count<SPUThread>())
|
||||
{
|
||||
sprintf(name, "SPU Threads (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& thread : Emu.GetIdManager().get_all<SPUThread>())
|
||||
for (const auto& data : idm::get_map<SPUThread>())
|
||||
{
|
||||
if (thread->get_type() == CPU_THREAD_SPU)
|
||||
{
|
||||
sprintf(name, "Thread: ID = 0x%08x '%s', - %s", thread->get_id(), thread->get_name().c_str(), thread->ThreadStatusToString());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
sprintf(name, "Thread: ID = 0x%08x '%s', - %s", data.first, data.second->get_name().c_str(), data.second->ThreadStatusToString());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (u32 count = Emu.GetIdManager().get_count<RawSPUThread>())
|
||||
if (u32 count = idm::get_count<RawSPUThread>())
|
||||
{
|
||||
sprintf(name, "RawSPU Threads (%d)", count);
|
||||
const auto& node = m_tree->AppendItem(root, name);
|
||||
|
||||
for (const auto& thread : Emu.GetIdManager().get_all<RawSPUThread>())
|
||||
for (const auto& data : idm::get_map<RawSPUThread>())
|
||||
{
|
||||
if (thread->get_type() == CPU_THREAD_RAW_SPU)
|
||||
{
|
||||
sprintf(name, "Thread: ID = 0x%08x '%s', - %s", thread->get_id(), thread->get_name().c_str(), thread->ThreadStatusToString());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
sprintf(name, "Thread: ID = 0x%08x '%s', - %s", data.first, data.second->get_name().c_str(), data.second->ThreadStatusToString());
|
||||
m_tree->AppendItem(node, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
<ClCompile Include="Emu\Cell\PPUInterpreter.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPULLVMRecompilerCore.cpp" />
|
||||
<ClCompile Include="Emu\Cell\SPUInterpreter.cpp" />
|
||||
<ClCompile Include="Emu\IdManager.cpp" />
|
||||
<ClCompile Include="Emu\RSX\CgBinaryFragmentProgram.cpp" />
|
||||
<ClCompile Include="Emu\RSX\CgBinaryVertexProgram.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Common\FragmentProgramDecompiler.cpp" />
|
||||
|
@ -998,6 +998,9 @@
|
||||
<ClCompile Include="Emu\RSX\D3D12\D3D12Overlay.cpp">
|
||||
<Filter>Emu\GPU\RSX\D3D12</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\IdManager.cpp">
|
||||
<Filter>Emu</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Crypto\aes.h">
|
||||
|
@ -124,10 +124,6 @@ struct explicit_bool_t
|
||||
// return 32 bit alignof() to avoid widening/narrowing conversions with size_t
|
||||
#define alignof32(type) static_cast<u32>(__alignof(type))
|
||||
|
||||
template<typename T> struct ID_type;
|
||||
|
||||
#define REG_ID_TYPE(t, id) template<> struct ID_type<t> { enum : u32 { type = id }; }
|
||||
|
||||
#define WRAP_EXPR(expr) [&]{ return expr; }
|
||||
#define COPY_EXPR(expr) [=]{ return expr; }
|
||||
#define EXCEPTION(text, ...) fmt::exception(__FILE__, __LINE__, __FUNCTION__, text, ##__VA_ARGS__)
|
||||
|
Loading…
x
Reference in New Issue
Block a user