Minor fixes

This commit is contained in:
Nekotekina 2015-05-08 12:45:21 +03:00
parent bb63ec0c83
commit f92c10ef71
16 changed files with 150 additions and 161 deletions

View File

@ -7,17 +7,16 @@
using namespace Debug; using namespace Debug;
//Even different from those tutorials on webpages, i use the method similiar from Log.h std::unique_ptr<AutoPause> g_autopause;
//TODO:: Question: Does such a Singleton struct get fully deallocated after its pointer?
AutoPause* gAutoPause = nullptr;
AutoPause& AutoPause::getInstance(void) AutoPause& AutoPause::getInstance(void)
{ {
if (!gAutoPause) if (!g_autopause)
{ {
gAutoPause = new AutoPause(); g_autopause.reset(new AutoPause);
} }
return *gAutoPause;
return *g_autopause;
} }
//Still use binary format. Default Setting should be "disable all auto pause". //Still use binary format. Default Setting should be "disable all auto pause".

View File

@ -20,6 +20,7 @@ std::unique_ptr<wchar_t[]> ConvertUTF8ToWChar(const std::string& source)
if (!MultiByteToWideChar(CP_UTF8, 0, source.c_str(), size, buffer.get(), size)) if (!MultiByteToWideChar(CP_UTF8, 0, source.c_str(), size, buffer.get(), size))
{ {
LOG_ERROR(GENERAL, "ConvertUTF8ToWChar(source='%s') failed: 0x%llx", source, GET_API_ERROR); LOG_ERROR(GENERAL, "ConvertUTF8ToWChar(source='%s') failed: 0x%llx", source, GET_API_ERROR);
throw __FUNCTION__;
} }
return buffer; return buffer;
@ -27,17 +28,28 @@ std::unique_ptr<wchar_t[]> ConvertUTF8ToWChar(const std::string& source)
std::string ConvertWCharToUTF8(const wchar_t* source) std::string ConvertWCharToUTF8(const wchar_t* source)
{ {
const int size = WideCharToMultiByte(CP_UTF8, 0, source, -1 /* NTS */, NULL, 0, NULL, NULL); // size const int length = lstrlenW(source); // source length
if (size < 1) throw std::length_error(__FUNCTION__); // ???
std::string result; std::string result;
result.resize(size - 1); if (length == 0)
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1 /* NTS */, &result.front(), size, NULL, NULL))
{ {
LOG_ERROR(GENERAL, "ConvertWCharToUTF8() failed: 0x%llx", GET_API_ERROR); return result;
}
const int size = WideCharToMultiByte(CP_UTF8, 0, source, length, NULL, 0, NULL, NULL); // output size
if (size <= 0)
{
LOG_ERROR(GENERAL, "ConvertWCharToUTF8(length=%d) failed: 0x%llx", length, GET_API_ERROR);
throw __FUNCTION__;
}
result.resize(size);
if (!WideCharToMultiByte(CP_UTF8, 0, source, length, &result.front(), size, NULL, NULL))
{
throw __FUNCTION__;
} }
return result; return result;

View File

@ -258,7 +258,7 @@ cpu_thread& armv7_thread::args(std::initializer_list<std::string> values)
for (auto& arg : values) for (auto& arg : values)
{ {
const u32 arg_size = vm::cast(arg.size(), "arg.size()"); // get arg size const u32 arg_size = arg.size(); // get arg size
for (char c : arg) for (char c : arg)
{ {

View File

@ -369,7 +369,7 @@ void SPUThread::do_dma_list_cmd(u32 cmd, spu_mfc_arg_t args)
if (rec->sb.data() & se16(0x8000)) if (rec->sb.data() & se16(0x8000))
{ {
ch_stall_stat.push_logical_or(1 << args.tag); ch_stall_stat.push_bit_or(1 << args.tag);
spu_mfc_arg_t stalled; spu_mfc_arg_t stalled;
stalled.ea = (args.ea & ~0xffffffff) | (list_addr + (i + 1) * 8); stalled.ea = (args.ea & ~0xffffffff) | (list_addr + (i + 1) * 8);

View File

@ -156,7 +156,7 @@ public:
return out_result; return out_result;
} }
void push_logical_or(u32 value) void push_bit_or(u32 value)
{ {
sync_var._or({ 1, value }); sync_var._or({ 1, value });
} }
@ -550,7 +550,7 @@ public:
{ {
if (snr_config & 1) if (snr_config & 1)
{ {
ch_snr1.push_logical_or(value); ch_snr1.push_bit_or(value);
} }
else else
{ {
@ -561,7 +561,7 @@ public:
{ {
if (snr_config & 2) if (snr_config & 2)
{ {
ch_snr2.push_logical_or(value); ch_snr2.push_bit_or(value);
} }
else else
{ {

View File

@ -103,19 +103,6 @@ namespace vm
} }
}; };
#ifdef __APPLE__
template<>
struct cast_ptr<unsigned long>
{
static_assert(sizeof(unsigned long) == 8, "Unexpected size of unsigned long");
__forceinline static u32 cast(const unsigned long addr, const char* func)
{
return cast_ptr<u64>::cast(addr, func);
}
};
#endif
template<> template<>
struct cast_ptr<u32> struct cast_ptr<u32>
{ {

View File

@ -139,13 +139,13 @@ std::string CgBinaryDisasm::FormatDisAsm(const std::string& code)
const std::pair<std::string, std::function<std::string()>> repl_list[] = const std::pair<std::string, std::function<std::string()>> repl_list[] =
{ {
{ "$$", []() -> std::string { return "$"; } }, { "$$", []() -> std::string { return "$"; } },
{ "$0", std::bind(std::mem_fn(&CgBinaryDisasm::GetSrcDisAsm<SRC0>), this, src0) }, { "$0", [this]{ return GetSrcDisAsm<SRC0>(src0); } },
{ "$1", std::bind(std::mem_fn(&CgBinaryDisasm::GetSrcDisAsm<SRC1>), this, src1) }, { "$1", [this]{ return GetSrcDisAsm<SRC1>(src1); } },
{ "$2", std::bind(std::mem_fn(&CgBinaryDisasm::GetSrcDisAsm<SRC2>), this, src2) }, { "$2", [this]{ return GetSrcDisAsm<SRC2>(src2); } },
{ "$t", std::bind(std::mem_fn(&CgBinaryDisasm::AddTexDisAsm), this) }, { "$t", [this]{ return AddTexDisAsm(); } },
{ "$m", std::bind(std::mem_fn(&CgBinaryDisasm::GetMask), this) }, { "$m", [this]{ return GetMask(); } },
{ "$cond", std::bind(std::mem_fn(&CgBinaryDisasm::GetCondDisAsm), this) }, { "$cond", [this]{ return GetCondDisAsm(); } },
{ "$c", std::bind(std::mem_fn(&CgBinaryDisasm::AddConstDisAsm), this) } { "$c", [this]{ return AddConstDisAsm(); } },
}; };
return fmt::replace_all(code, repl_list); return fmt::replace_all(code, repl_list);
@ -241,27 +241,27 @@ void CgBinaryDisasm::TaskFP()
while (true) while (true)
{ {
for (auto finded = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size); for (auto found = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size);
finded != m_end_offsets.end(); found != m_end_offsets.end();
finded = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size)) found = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size))
{ {
m_end_offsets.erase(finded); m_end_offsets.erase(found);
m_arb_shader += "ENDIF;\n"; m_arb_shader += "ENDIF;\n";
} }
for (auto finded = std::find(m_loop_end_offsets.begin(), m_loop_end_offsets.end(), m_size); for (auto found = std::find(m_loop_end_offsets.begin(), m_loop_end_offsets.end(), m_size);
finded != m_loop_end_offsets.end(); found != m_loop_end_offsets.end();
finded = std::find(m_loop_end_offsets.begin(), m_loop_end_offsets.end(), m_size)) found = std::find(m_loop_end_offsets.begin(), m_loop_end_offsets.end(), m_size))
{ {
m_loop_end_offsets.erase(finded); m_loop_end_offsets.erase(found);
m_arb_shader += "ENDLOOP;\n"; m_arb_shader += "ENDLOOP;\n";
} }
for (auto finded = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size); for (auto found = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size);
finded != m_else_offsets.end(); found != m_else_offsets.end();
finded = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size)) found = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size))
{ {
m_else_offsets.erase(finded); m_else_offsets.erase(found);
m_arb_shader += "ELSE;\n"; m_arb_shader += "ELSE;\n";
} }

View File

@ -175,22 +175,24 @@ std::string CgBinaryDisasm::FormatDisasm(const std::string& code)
const std::pair<std::string, std::function<std::string()>> repl_list[] = const std::pair<std::string, std::function<std::string()>> repl_list[] =
{ {
{ "$$", []() -> std::string { return "$"; } }, { "$$", []() -> std::string { return "$"; } },
{ "$0", std::bind(std::mem_fn(&CgBinaryDisasm::GetSRCDisasm), this, 0) }, { "$0", [this]{ return GetSRCDisasm(0); } },
{ "$1", std::bind(std::mem_fn(&CgBinaryDisasm::GetSRCDisasm), this, 1) }, { "$1", [this]{ return GetSRCDisasm(1); } },
{ "$2", std::bind(std::mem_fn(&CgBinaryDisasm::GetSRCDisasm), this, 2) }, { "$2", [this]{ return GetSRCDisasm(2); } },
{ "$s", std::bind(std::mem_fn(&CgBinaryDisasm::GetSRCDisasm), this, 2) }, { "$s", [this]{ return GetSRCDisasm(2); } },
{ "$am", std::bind(std::mem_fn(&CgBinaryDisasm::AddAddrMaskDisasm), this) }, { "$am", [this]{ return AddAddrMaskDisasm(); } },
{ "$a", std::bind(std::mem_fn(&CgBinaryDisasm::AddAddrRegDisasm), this) }, { "$a", [this]{ return AddAddrRegDisasm(); } },
{ "$t", std::bind(std::mem_fn(&CgBinaryDisasm::GetTexDisasm), this) }, { "$t", [this]{ return GetTexDisasm(); } },
{ "$fa", [this]()->std::string { return std::to_string(GetAddrDisasm()); } }, { "$fa", [this]{ return std::to_string(GetAddrDisasm()); } },
{ "$ifcond ", [this]() -> std::string
{ "$ifcond ", [this]
{ {
const std::string& cond = GetCondDisasm(); std::string cond = GetCondDisasm();
if (cond == "true") return ""; if (cond == "true") cond.clear();
return cond; return cond;
} }
}, },
{ "$cond", std::bind(std::mem_fn(&CgBinaryDisasm::GetCondDisasm), this) }
{ "$cond", [this]{ return GetCondDisasm(); } },
}; };
return fmt::replace_all(code, repl_list); return fmt::replace_all(code, repl_list);

View File

@ -124,11 +124,12 @@ std::string GLFragmentDecompilerThread::Format(const std::string& code)
const std::pair<std::string, std::function<std::string()>> repl_list[] = const std::pair<std::string, std::function<std::string()>> repl_list[] =
{ {
{ "$$", []() -> std::string { return "$"; } }, { "$$", []() -> std::string { return "$"; } },
{ "$0", std::bind(std::mem_fn(&GLFragmentDecompilerThread::GetSRC<SRC0>), this, src0) }, { "$0", [this]{ return GetSRC<SRC0>(src0); } },
{ "$1", std::bind(std::mem_fn(&GLFragmentDecompilerThread::GetSRC<SRC1>), this, src1) }, { "$1", [this]{ return GetSRC<SRC1>(src1); } },
{ "$2", std::bind(std::mem_fn(&GLFragmentDecompilerThread::GetSRC<SRC2>), this, src2) }, { "$2", [this]{ return GetSRC<SRC2>(src2); } },
{ "$t", std::bind(std::mem_fn(&GLFragmentDecompilerThread::AddTex), this) }, { "$t", [this]{ return AddTex(); } },
{ "$m", std::bind(std::mem_fn(&GLFragmentDecompilerThread::GetMask), this) }, { "$m", [this]{ return GetMask(); } },
{ "$ifcond ", [this]() -> std::string { "$ifcond ", [this]() -> std::string
{ {
const std::string& cond = GetCond(); const std::string& cond = GetCond();
@ -136,8 +137,9 @@ std::string GLFragmentDecompilerThread::Format(const std::string& code)
return "if(" + cond + ") "; return "if(" + cond + ") ";
} }
}, },
{ "$cond", std::bind(std::mem_fn(&GLFragmentDecompilerThread::GetCond), this) },
{ "$c", std::bind(std::mem_fn(&GLFragmentDecompilerThread::AddConst), this) } { "$cond", [this]{ return GetCond(); } },
{ "$c", [this]{ return AddConst(); } }
}; };
return fmt::replace_all(code, repl_list); return fmt::replace_all(code, repl_list);
@ -375,21 +377,21 @@ void GLFragmentDecompilerThread::Task()
while (true) while (true)
{ {
for (auto finded = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size); for (auto found = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size);
finded != m_end_offsets.end(); found != m_end_offsets.end();
finded = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size)) found = std::find(m_end_offsets.begin(), m_end_offsets.end(), m_size))
{ {
m_end_offsets.erase(finded); m_end_offsets.erase(found);
m_code_level--; m_code_level--;
AddCode("}"); AddCode("}");
m_loop_count--; m_loop_count--;
} }
for (auto finded = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size); for (auto found = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size);
finded != m_else_offsets.end(); found != m_else_offsets.end();
finded = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size)) found = std::find(m_else_offsets.begin(), m_else_offsets.end(), m_size))
{ {
m_else_offsets.erase(finded); m_else_offsets.erase(found);
m_code_level--; m_code_level--;
AddCode("}"); AddCode("}");
AddCode("else"); AddCode("else");

View File

@ -196,17 +196,16 @@ std::string GLVertexDecompilerThread::Format(const std::string& code)
const std::pair<std::string, std::function<std::string()>> repl_list[] = const std::pair<std::string, std::function<std::string()>> repl_list[] =
{ {
{ "$$", []() -> std::string { return "$"; } }, { "$$", []() -> std::string { return "$"; } },
{ "$0", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetSRC), this, 0) }, { "$0", [this]{ return GetSRC(0); } },
{ "$1", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetSRC), this, 1) }, { "$1", [this]{ return GetSRC(1); } },
{ "$2", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetSRC), this, 2) }, { "$2", [this]{ return GetSRC(2); } },
{ "$s", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetSRC), this, 2) }, { "$s", [this]{ return GetSRC(2); } },
{ "$am", std::bind(std::mem_fn(&GLVertexDecompilerThread::AddAddrMask), this) }, { "$am", [this]{ return AddAddrMask(); } },
{ "$a", std::bind(std::mem_fn(&GLVertexDecompilerThread::AddAddrReg), this) }, { "$a", [this]{ return AddAddrReg(); } },
{ "$t", [this]{ return GetTex(); } },
{ "$fa", [this]{ return std::to_string(GetAddr()); } },
{ "$f()", [this]{ return GetFunc(); } },
{ "$t", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetTex), this) },
{ "$fa", [this]()->std::string { return std::to_string(GetAddr()); } },
{ "$f()", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetFunc), this) },
{ "$ifcond ", [this]() -> std::string { "$ifcond ", [this]() -> std::string
{ {
const std::string& cond = GetCond(); const std::string& cond = GetCond();
@ -214,7 +213,8 @@ std::string GLVertexDecompilerThread::Format(const std::string& code)
return "if(" + cond + ") "; return "if(" + cond + ") ";
} }
}, },
{ "$cond", std::bind(std::mem_fn(&GLVertexDecompilerThread::GetCond), this) }
{ "$cond", [this]{ return GetCond(); } }
}; };
return fmt::replace_all(code, repl_list); return fmt::replace_all(code, repl_list);

View File

@ -598,10 +598,10 @@ s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
const u64 copied = file->st_copied.load(); const u64 copied = file->st_copied.load();
const u32 position = vm::cast(file->st_buffer + copied % file->st_ringbuf_size); const u32 position = vm::cast(file->st_buffer + copied % file->st_ringbuf_size);
const u64 total_read = file->st_total_read.load(); const u64 total_read = file->st_total_read.load();
const u32 copy_size = vm::cast(*rsize = std::min<u64>(size, total_read - copied)); const u64 copy_size = (*rsize = std::min<u64>(size, total_read - copied)); // write rsize
// copy data // copy data
const u32 first_size = std::min<u32>(copy_size, file->st_ringbuf_size - (position - file->st_buffer)); const u64 first_size = std::min<u64>(copy_size, file->st_ringbuf_size - (position - file->st_buffer));
memcpy(buf.get_ptr(), vm::get_ptr(position), first_size); memcpy(buf.get_ptr(), vm::get_ptr(position), first_size);
memcpy((buf + first_size).get_ptr(), vm::get_ptr(file->st_buffer), copy_size - first_size); memcpy((buf + first_size).get_ptr(), vm::get_ptr(file->st_buffer), copy_size - first_size);
@ -723,7 +723,7 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, fs_st_cb_t func)
return CELL_FS_ENXIO; return CELL_FS_ENXIO;
} }
if (!file->st_callback.compare_and_swap_test({}, { vm::cast(size, "size"), func })) if (!file->st_callback.compare_and_swap_test({}, { size, func }))
{ {
return CELL_FS_EIO; return CELL_FS_EIO;
} }
@ -940,7 +940,7 @@ s32 cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, fs_aio_cb_t func)
const s32 xid = (*id = ++g_fs_aio_id); const s32 xid = (*id = ++g_fs_aio_id);
thread_t("FS AIO Read Thread", std::bind(fsAio, aio, false, xid, func)).detach(); thread_t("FS AIO Read Thread", [=]{ fsAio(aio, false, xid, func); }).detach();
return CELL_OK; return CELL_OK;
} }
@ -958,7 +958,7 @@ s32 cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<s32> id, fs_aio_cb_t func)
const s32 xid = (*id = ++g_fs_aio_id); const s32 xid = (*id = ++g_fs_aio_id);
thread_t("FS AIO Write Thread", std::bind(fsAio, aio, true, xid, func)).detach(); thread_t("FS AIO Write Thread", [=]{ fsAio(aio, true, xid, func); }).detach();
return CELL_OK; return CELL_OK;
} }

View File

@ -19,51 +19,6 @@ SaveDataDialogInstance::SaveDataDialogInstance()
{ {
} }
// Auxiliary Classes
class SortSaveDataEntry
{
const u32 m_type;
const u32 m_order;
public:
SortSaveDataEntry(u32 type, u32 order)
: m_type(type)
, m_order(order)
{
}
bool operator()(const SaveDataEntry& entry1, const SaveDataEntry& entry2) const
{
if (m_order == CELL_SAVEDATA_SORTORDER_DESCENT)
{
if (m_type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME)
{
return entry1.mtime >= entry2.mtime;
}
if (m_type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
{
return entry1.subtitle >= entry2.subtitle;
}
}
if (m_order == CELL_SAVEDATA_SORTORDER_ASCENT)
{
if (m_type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME)
{
return entry1.mtime < entry2.mtime;
}
if (m_type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
{
return entry1.subtitle < entry2.subtitle;
}
}
return true;
}
};
enum : u32 enum : u32
{ {
SAVEDATA_OP_AUTO_SAVE = 0, SAVEDATA_OP_AUTO_SAVE = 0,
@ -182,7 +137,37 @@ __noinline s32 savedata_op(
} }
// Sort the entries // Sort the entries
std::sort(save_entries.begin(), save_entries.end(), SortSaveDataEntry(setList->sortType, setList->sortOrder)); {
const u32 order = setList->sortOrder;
const u32 type = setList->sortType;
if (order > CELL_SAVEDATA_SORTORDER_ASCENT || type > CELL_SAVEDATA_SORTTYPE_SUBTITLE)
{
// error
}
std::sort(save_entries.begin(), save_entries.end(), [=](const SaveDataEntry& entry1, const SaveDataEntry& entry2)
{
if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME)
{
return entry1.mtime >= entry2.mtime;
}
if (order == CELL_SAVEDATA_SORTORDER_DESCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
{
return entry1.subtitle >= entry2.subtitle;
}
if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_MODIFIEDTIME)
{
return entry1.mtime < entry2.mtime;
}
if (order == CELL_SAVEDATA_SORTORDER_ASCENT && type == CELL_SAVEDATA_SORTTYPE_SUBTITLE)
{
return entry1.subtitle < entry2.subtitle;
}
return true;
});
}
// Fill the listGet->dirList array // Fill the listGet->dirList array
auto dir_list = listGet->dirList.get_ptr(); auto dir_list = listGet->dirList.get_ptr();

View File

@ -1025,8 +1025,10 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
return CELL_SYNC_ERROR_PERM; return CELL_SYNC_ERROR_PERM;
} }
const s32 depth = queue->m_depth;
u32 var1 = 0; u32 var1 = 0;
s32 depth = queue->m_depth;
while (true) while (true)
{ {
while (true) while (true)
@ -1149,7 +1151,7 @@ s32 syncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer,
return CELL_SYNC_ERROR_PERM; return CELL_SYNC_ERROR_PERM;
} }
s32 depth = (u32)queue->m_depth; const s32 depth = queue->m_depth;
while (true) while (true)
{ {
@ -1343,8 +1345,8 @@ s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm:
} }
} }
const s32 depth = (u32)queue->m_depth; const s32 depth = queue->m_depth;
const s32 size = (u32)queue->m_size; const s32 size = queue->m_size;
const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1ull) + size * (position >= depth ? position - depth : position)); const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1ull) + size * (position >= depth ? position - depth : position));
memcpy(vm::get_ptr<void>(addr), buffer.get_ptr(), size); memcpy(vm::get_ptr<void>(addr), buffer.get_ptr(), size);
@ -1369,8 +1371,10 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
return CELL_SYNC_ERROR_PERM; return CELL_SYNC_ERROR_PERM;
} }
const s32 depth = queue->m_depth;
u32 var1 = 0; u32 var1 = 0;
s32 depth = (u32)queue->m_depth;
while (true) while (true)
{ {
while (true) while (true)
@ -1493,7 +1497,7 @@ s32 syncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, c
return CELL_SYNC_ERROR_PERM; return CELL_SYNC_ERROR_PERM;
} }
s32 depth = (u32)queue->m_depth; const s32 depth = queue->m_depth;
while (true) while (true)
{ {
@ -1686,8 +1690,8 @@ s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::
} }
} }
const s32 depth = (u32)queue->m_depth; const s32 depth = queue->m_depth;
const s32 size = (u32)queue->m_size; const s32 size = queue->m_size;
const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1) + size * (position >= depth ? position - depth : position)); const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1) + size * (position >= depth ? position - depth : position));
memcpy(buffer.get_ptr(), vm::get_ptr<void>(addr), size); memcpy(buffer.get_ptr(), vm::get_ptr<void>(addr), size);
@ -1807,9 +1811,9 @@ s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> depth)
return CELL_OK; return CELL_OK;
} }
s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> ppSignal) s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<vm::bptr<void>> ppSignal)
{ {
cellSync.Log("_cellSyncLFQueueGetSignalAddress(queue=*0x%x, ppSignal=*0x%x)", queue, ppSignal); cellSync.Log("_cellSyncLFQueueGetSignalAddress(queue=*0x%x, ppSignal=**0x%x)", queue, ppSignal);
if (!queue || !ppSignal) if (!queue || !ppSignal)
{ {
@ -1820,7 +1824,8 @@ s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::p
return CELL_SYNC_ERROR_ALIGN; return CELL_SYNC_ERROR_ALIGN;
} }
*ppSignal = (u32)queue->m_eaSignal.addr(); *ppSignal = queue->m_eaSignal;
return CELL_OK; return CELL_OK;
} }

View File

@ -108,7 +108,7 @@ s32 sys_cond_signal_all(u32 cond_id)
return CELL_ESRCH; return CELL_ESRCH;
} }
if (const u32 count = vm::cast(cond->waiters.size())) if (const u32 count = cond->waiters.size())
{ {
cond->signaled += count; cond->signaled += count;
cond->waiters.clear(); cond->waiters.clear();

View File

@ -135,7 +135,7 @@ s32 _sys_lwcond_signal_all(u32 lwcond_id, u32 lwmutex_id, u32 mode)
sys_lwcond.Error("_sys_lwcond_signal_all(%d): invalid mode (%d)", lwcond_id, mode); sys_lwcond.Error("_sys_lwcond_signal_all(%d): invalid mode (%d)", lwcond_id, mode);
} }
const u32 count = vm::cast(cond->waiters.size()); const u32 count = cond->waiters.size();
if (count) if (count)
{ {

View File

@ -577,7 +577,7 @@ namespace loader
{ {
if (phdr.p_memsz) if (phdr.p_memsz)
{ {
if (!vm::alloc(vm::cast(phdr.p_vaddr.addr()), vm::cast(phdr.p_memsz, "phdr.p_memsz"), vm::main)) if (!vm::alloc(phdr.p_vaddr.addr(), phdr.p_memsz, vm::main))
{ {
LOG_ERROR(LOADER, "%s(): AllocFixed(0x%llx, 0x%llx) failed", __FUNCTION__, phdr.p_vaddr.addr(), phdr.p_memsz); LOG_ERROR(LOADER, "%s(): AllocFixed(0x%llx, 0x%llx) failed", __FUNCTION__, phdr.p_vaddr.addr(), phdr.p_memsz);
@ -606,7 +606,7 @@ namespace loader
{ {
m_stream->Seek(handler::get_stream_offset() + phdr.p_offset); m_stream->Seek(handler::get_stream_offset() + phdr.p_offset);
m_stream->Read(phdr.p_vaddr.get_ptr(), phdr.p_filesz); m_stream->Read(phdr.p_vaddr.get_ptr(), phdr.p_filesz);
hook_ppu_funcs(vm::ptr<u32>::make(phdr.p_vaddr.addr()), vm::cast(phdr.p_filesz) / 4); hook_ppu_funcs(vm::ptr<u32>::make(phdr.p_vaddr.addr()), phdr.p_filesz / 4);
} }
} }
break; break;
@ -614,10 +614,7 @@ namespace loader
case 0x00000007: //TLS case 0x00000007: //TLS
{ {
Emu.SetTLSData( Emu.SetTLSData(phdr.p_vaddr.addr(), phdr.p_filesz, phdr.p_memsz);
vm::cast(phdr.p_vaddr.addr(), "TLS: phdr.p_vaddr"),
vm::cast(phdr.p_filesz.value(), "TLS: phdr.p_filesz"),
vm::cast(phdr.p_memsz.value(), "TLS: phdr.p_memsz"));
break; break;
} }