vm::null usage

This commit is contained in:
Nekotekina 2015-04-21 23:26:21 +03:00
parent 5aa6daf58f
commit f4540c2793
11 changed files with 50 additions and 50 deletions

View File

@ -258,7 +258,7 @@ namespace sce_libc_func
psv_log_base sceLibc("SceLibc", []()
{
g_dso.set(0);
g_dso = vm::null;
g_atexit.clear();
sceLibc.on_load = nullptr;

View File

@ -33,7 +33,7 @@ struct ModuleFunc
{
}
ModuleFunc(u32 id, u32 flags, Module* module, const char* name, ppu_func_caller func, vm::ptr<void()> lle_func = vm::ptr<void()>::make(0))
ModuleFunc(u32 id, u32 flags, Module* module, const char* name, ppu_func_caller func, vm::ptr<void()> lle_func = vm::null)
: id(id)
, flags(flags)
, module(module)

View File

@ -84,7 +84,7 @@ vm::ptr<void> cellFiberPpuSelf()
cellFiber.Log("cellFiberPpuSelf() -> nullptr"); // TODO
// returns fiber structure (zero for simple PPU thread)
return vm::ptr<void>::make(0);
return vm::null;
}
int cellFiberPpuSendSignal()

View File

@ -86,7 +86,7 @@ vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 lo
if (location == CELL_GCM_LOCATION_LOCAL) {
if (index >= 2048) {
cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index);
return vm::ptr<CellGcmReportData>::make(0);
return vm::null;
}
return vm::ptr<CellGcmReportData>::make((u32)Memory.RSXFBMem.GetStartAddr() + index * 0x10);
}
@ -94,14 +94,14 @@ vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 lo
if (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024 * 1024) {
cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index);
return vm::ptr<CellGcmReportData>::make(0);
return vm::null;
}
// TODO: It seems m_report_main_addr is not initialized
return vm::ptr<CellGcmReportData>::make(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10);
}
cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location);
return vm::ptr<CellGcmReportData>::make(0);
return vm::null;
}
u64 cellGcmGetTimeStamp(u32 index)

View File

@ -20,7 +20,7 @@ extern Module cellPngDec;
s32 pngDecCreate(
vm::ptr<u32> mainHandle,
vm::ptr<const CellPngDecThreadInParam> param,
vm::ptr<const CellPngDecExtThreadInParam> ext = vm::ptr<const CellPngDecExtThreadInParam>::make(0))
vm::ptr<const CellPngDecExtThreadInParam> ext = vm::null)
{
// alloc memory (should probably use param->cbCtrlMallocFunc)
auto dec = CellPngDecMainHandle::make(Memory.Alloc(sizeof(PngDecoder), 128));
@ -61,8 +61,8 @@ s32 pngDecOpen(
vm::ptr<u32> subHandle,
vm::ptr<const CellPngDecSrc> src,
vm::ptr<CellPngDecOpnInfo> openInfo,
vm::ptr<const CellPngDecCbCtrlStrm> cb = vm::ptr<const CellPngDecCbCtrlStrm>::make(0),
vm::ptr<const CellPngDecOpnParam> param = vm::ptr<const CellPngDecOpnParam>::make(0))
vm::ptr<const CellPngDecCbCtrlStrm> cb = vm::null,
vm::ptr<const CellPngDecOpnParam> param = vm::null)
{
// alloc memory (should probably use dec->malloc)
auto stream = CellPngDecSubHandle::make(Memory.Alloc(sizeof(PngStream), 128));
@ -128,7 +128,7 @@ s32 pngDecClose(CellPngDecSubHandle stream)
s32 pngReadHeader(
CellPngDecSubHandle stream,
vm::ptr<CellPngDecInfo> info,
vm::ptr<CellPngDecExtInfo> extInfo = vm::ptr<CellPngDecExtInfo>::make(0))
vm::ptr<CellPngDecExtInfo> extInfo = vm::null)
{
CellPngDecInfo& current_info = stream->info;
@ -194,8 +194,8 @@ s32 pngDecSetParameter(
CellPngDecSubHandle stream,
vm::ptr<const CellPngDecInParam> inParam,
vm::ptr<CellPngDecOutParam> outParam,
vm::ptr<const CellPngDecExtInParam> extInParam = vm::ptr<const CellPngDecExtInParam>::make(0),
vm::ptr<CellPngDecExtOutParam> extOutParam = vm::ptr<CellPngDecExtOutParam>::make(0))
vm::ptr<const CellPngDecExtInParam> extInParam = vm::null,
vm::ptr<CellPngDecExtOutParam> extOutParam = vm::null)
{
CellPngDecInfo& current_info = stream->info;
CellPngDecOutParam& current_outParam = stream->outParam;
@ -240,8 +240,8 @@ s32 pngDecodeData(
vm::ptr<u8> data,
vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam,
vm::ptr<CellPngDecDataOutInfo> dataOutInfo,
vm::ptr<const CellPngDecCbCtrlDisp> cbCtrlDisp = vm::ptr<const CellPngDecCbCtrlDisp>::make(0),
vm::ptr<CellPngDecDispParam> dispParam = vm::ptr<CellPngDecDispParam>::make(0))
vm::ptr<const CellPngDecCbCtrlDisp> cbCtrlDisp = vm::null,
vm::ptr<CellPngDecDispParam> dispParam = vm::null)
{
dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;

View File

@ -603,7 +603,7 @@ void cellRescExit()
if (IsPalTemporal())
{
cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_DISABLE);
cellGcmSetVBlankHandler(vm::ptr<void(u32)>::make(0));
cellGcmSetVBlankHandler(vm::null);
//GcmSysTypePrefix::cellGcmSetSecondVHandler(NULL);
if (IsPalInterpolate())
@ -770,7 +770,7 @@ int cellRescSetDisplayMode(u32 displayMode)
videocfg->aspect = CELL_VIDEO_OUT_ASPECT_AUTO;
videocfg->pitch = s_rescInternalInstance->m_dstPitch;
cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, videocfg, vm::ptr<CellVideoOutOption>::make(0), 0);
cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, videocfg, vm::null, 0);
if (IsPalInterpolate())
{
@ -780,20 +780,20 @@ int cellRescSetDisplayMode(u32 displayMode)
cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ);
//cellGcmSetVBlankHandler(IntrHandler50);
//cellGcmSetSecondVHandler(IntrHandler60);
cellGcmSetFlipHandler(vm::ptr<void(u32)>::make(0));
cellGcmSetFlipHandler(vm::null);
}
else if (IsPalDrop())
{
//InitLabels();
cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ);
cellGcmSetVBlankHandler(vm::ptr<void(u32)>::make(0));
cellGcmSetVBlankHandler(vm::null);
//cellGcmSetSecondVHandler(IntrHandler60Drop);
cellGcmSetFlipHandler(vm::ptr<void(u32)>::make(0));
cellGcmSetFlipHandler(vm::null);
}
else if (IsPal60Hsync())
{
cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ);
cellGcmSetVBlankHandler(vm::ptr<void(u32)>::make(0));
cellGcmSetVBlankHandler(vm::null);
}
if (s_rescInternalInstance->s_applicationVBlankHandler) SetVBlankHandler(s_rescInternalInstance->s_applicationVBlankHandler);

View File

@ -306,7 +306,7 @@ s32 spursInit(
{
assert(!"sys_spu_thread_group_start() failed");
}
if (s32 res = sys_spu_thread_group_join(spurs->m.spuTG, vm::ptr<u32>::make(0), vm::ptr<u32>::make(0)))
if (s32 res = sys_spu_thread_group_join(spurs->m.spuTG, vm::null, vm::null))
{
if (res == CELL_ESTAT)
{
@ -1051,10 +1051,10 @@ s32 cellSpursAddWorkload(
*priorityTable,
minContention,
maxContention,
vm::ptr<const char>::make(0),
vm::ptr<const char>::make(0),
vm::ptr<CellSpursShutdownCompletionEventHook>::make(0),
vm::ptr<void>::make(0));
vm::null,
vm::null,
vm::null,
vm::null);
}
s32 _cellSpursWorkloadAttributeInitialize(
@ -1160,16 +1160,16 @@ s32 cellSpursAddWorkloadWithAttribute(vm::ptr<CellSpurs> spurs, const vm::ptr<u3
return spursAddWorkload(
spurs,
wid,
vm::ptr<const void>::make(attr->m.pm.addr()),
attr->m.pm,
attr->m.size,
attr->m.data,
attr->m.priority,
attr->m.minContention,
attr->m.maxContention,
vm::ptr<const char>::make(attr->m.nameClass.addr()),
vm::ptr<const char>::make(attr->m.nameInstance.addr()),
vm::ptr<CellSpursShutdownCompletionEventHook>::make(attr->m.hook.addr()),
vm::ptr<void>::make(attr->m.hookArg.addr()));
attr->m.nameClass,
attr->m.nameInstance,
attr->m.hook,
attr->m.hookArg);
}
s32 cellSpursRemoveWorkload()
@ -2183,14 +2183,14 @@ s32 spursCreateTaskset(vm::ptr<CellSpurs> spurs, vm::ptr<CellSpursTaskset> tasks
taskset.addr(), priority, 8 /*min_contention*/, max_contention);
// TODO: Check return code
cellSpursWorkloadAttributeSetName(wkl_attr, vm::ptr<const char>::make(0), name);
cellSpursWorkloadAttributeSetName(wkl_attr, vm::null, name);
// TODO: Check return code
// TODO: cellSpursWorkloadAttributeSetShutdownCompletionEventHook(wkl_attr, hook, taskset);
// TODO: Check return code
vm::var<be_t<u32>> wid;
cellSpursAddWorkloadWithAttribute(spurs, vm::ptr<u32>::make(wid.addr()), vm::ptr<const CellSpursWorkloadAttribute>::make(wkl_attr.addr()));
cellSpursAddWorkloadWithAttribute(spurs, vm::ptr<u32>::make(wid.addr()), wkl_attr);
// TODO: Check return code
taskset->m.wkl_flag_wait_task = 0x80;
@ -2236,7 +2236,7 @@ s32 cellSpursCreateTaskset(vm::ptr<CellSpurs> spurs, vm::ptr<CellSpursTaskset> t
cellSpurs.Warning("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%llx, priority_addr=0x%x, maxContention=%d)",
spurs.addr(), taskset.addr(), args, priority.addr(), maxContention);
return spursCreateTaskset(spurs, taskset, args, priority, maxContention, vm::ptr<const char>::make(0), 6400/*CellSpursTaskset::size*/, 0);
return spursCreateTaskset(spurs, taskset, args, priority, maxContention, vm::null, 6400/*CellSpursTaskset::size*/, 0);
}
s32 cellSpursJoinTaskset(vm::ptr<CellSpursTaskset> taskset)
@ -2396,8 +2396,8 @@ s32 spursTaskStart(vm::ptr<CellSpursTaskset> taskset, u32 taskId)
pendingReady._bit[taskId] = true;
taskset->m.pending_ready = pendingReady;
cellSpursSendWorkloadSignal(vm::ptr<CellSpurs>::make((u32)taskset->m.spurs.addr()), taskset->m.wid);
auto rc = cellSpursWakeUp(GetCurrentPPUThread(), vm::ptr<CellSpurs>::make((u32)taskset->m.spurs.addr()));
cellSpursSendWorkloadSignal(taskset->m.spurs, taskset->m.wid);
auto rc = cellSpursWakeUp(GetCurrentPPUThread(), taskset->m.spurs);
if (rc != CELL_OK)
{
if (rc == CELL_SPURS_POLICY_MODULE_ERROR_STAT)
@ -2479,8 +2479,8 @@ s32 _cellSpursSendSignal(vm::ptr<CellSpursTaskset> taskset, u32 taskId)
taskset->m.signalled = signalled;
if (shouldSignal)
{
cellSpursSendWorkloadSignal(vm::ptr<CellSpurs>::make((u32)taskset->m.spurs.addr()), taskset->m.wid);
auto rc = cellSpursWakeUp(GetCurrentPPUThread(), vm::ptr<CellSpurs>::make((u32)taskset->m.spurs.addr()));
cellSpursSendWorkloadSignal(taskset->m.spurs, taskset->m.wid);
auto rc = cellSpursWakeUp(GetCurrentPPUThread(), taskset->m.spurs);
if (rc == CELL_SPURS_POLICY_MODULE_ERROR_STAT)
{
return CELL_SPURS_TASK_ERROR_STAT;
@ -2566,7 +2566,7 @@ s32 _cellSpursTasksetAttribute2Initialize(vm::ptr<CellSpursTasksetAttribute2> at
memset(attribute.get_ptr(), 0, CellSpursTasksetAttribute2::size);
attribute->m.revision = revision;
attribute->m.name.set(0);
attribute->m.name = vm::null;
attribute->m.args = 0;
for (s32 i = 0; i < 8; i++)
@ -2666,7 +2666,7 @@ s32 cellSpursCreateTaskset2(vm::ptr<CellSpurs> spurs, vm::ptr<CellSpursTaskset2>
auto rc = spursCreateTaskset(spurs, vm::ptr<CellSpursTaskset>::make(taskset.addr()), attr->m.args,
vm::ptr<const u8[8]>::make(attr.addr() + offsetof(CellSpursTasksetAttribute, m.priority)),
attr->m.max_contention, vm::ptr<const char>::make(attr->m.name.addr()), CellSpursTaskset2::size, (u8)attr->m.enable_clear_ls);
attr->m.max_contention, attr->m.name, CellSpursTaskset2::size, (u8)attr->m.enable_clear_ls);
if (rc != CELL_OK)
{
return rc;
@ -2774,7 +2774,7 @@ s32 cellSpursLookUpTasksetAddress(vm::ptr<CellSpurs> spurs, vm::ptr<CellSpursTas
}
vm::var<be_t<u64>> data;
auto rc = cellSpursGetWorkloadData(spurs, vm::ptr<u64>::make(data.addr()), id);
auto rc = cellSpursGetWorkloadData(spurs, data, id);
if (rc != CELL_OK)
{
// Convert policy module error code to a task error code

View File

@ -289,7 +289,7 @@ s32 syncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer
}
// prx: zeroize first u16 and second u16, write buffer_size in second u32, write buffer_addr in second u64 and sync
rwm->m_size = be_t<u32>::make(buffer_size);
rwm->m_size = buffer_size;
rwm->m_buffer = buffer;
rwm->data.exchange({});
@ -488,9 +488,9 @@ s32 syncQueueInitialize(vm::ptr<CellSyncQueue> queue, vm::ptr<u8> buffer, u32 si
}
// prx: zeroize first u64, write size in third u32, write depth in fourth u32, write address in third u64 and sync
queue->m_size = be_t<u32>::make(size);
queue->m_depth = be_t<u32>::make(depth);
queue->m_buffer.set(buffer.addr());
queue->m_size = size;
queue->m_depth = depth;
queue->m_buffer = buffer;
queue->data.exchange({});
return CELL_OK;
@ -1104,7 +1104,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
}
}
if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::ptr<sys_event_t>::make(0), 0))
if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::null, 0))
{
assert(!"sys_event_queue_receive() failed");
}
@ -1448,7 +1448,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
}
}
if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::ptr<sys_event_t>::make(0), 0))
if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::null, 0))
{
assert(!"sys_event_queue_receive() failed");
}

View File

@ -1019,7 +1019,7 @@ vm::ptr<char> _sys_strncpy(vm::ptr<char> dest, vm::ptr<const char> source, u32 l
if (!dest || !source)
{
return vm::ptr<char>::make(0);
return vm::null;
}
if (strncpy(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr())

View File

@ -19,7 +19,7 @@ extern "C"
extern Module sys_net;
vm::ptr<s32> g_lastError = vm::ptr<s32>::make(0);
vm::ptr<s32> g_lastError = vm::null;
// Auxiliary Functions
@ -478,7 +478,7 @@ s32 sys_net_finalize_network()
{
sys_net.Warning("sys_net_initialize_network_ex()");
Memory.Free(g_lastError.addr());
g_lastError = vm::ptr<s32>::make(0);
g_lastError = vm::null;
#ifdef _WIN32
WSACleanup();
#endif

View File

@ -144,7 +144,7 @@ namespace loader
u32 vnid_addr = 0;
std::unordered_map<u32, u32> vnid_list;
auto proc_param = vm::psv::ptr<psv_process_param_t>::make(0);
vm::psv::ptr<psv_process_param_t> proc_param = vm::null;
for (auto& shdr : m_shdrs)
{