Minor changes: GCM command, PKG loader & SysCalls

* Fixed incorrect time displayed on NV4097_GET_REPORT.
* Fixed small bug in PKGLoader::UnpackEntry
* Moved some code in SC_Time.cpp
* Auxiliary function declarations of SC_Time.cpp in SC_Time.h
* Updated cellFsUnlink. *This won't work until ExistsFile is fully
implemented*.
This commit is contained in:
Alexandro Sánchez Bach 2014-02-24 07:54:42 +01:00
parent 696e00a570
commit 7379b0e2ed
6 changed files with 36 additions and 18 deletions

View File

@ -1198,6 +1198,7 @@ static const wxString GetMethodName(const u32 id)
{ NV4097_SET_TRANSFORM_CONSTANT_LOAD , "SetTransformConstantLoad" } ,
{ NV4097_SET_FREQUENCY_DIVIDER_OPERATION , "SetFrequencyDividerOperation" } ,
{ NV4097_INVALIDATE_L2 , "InvalidateL2" } ,
{ NV4097_SET_TRANSFORM_BRANCH_BITS, "SetTransformBranchBits" } ,
};
for(u32 i = 0; i < WXSIZEOF(METHOD_NAME_LIST); ++i)

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "RSXThread.h"
#include "Emu/SysCalls/lv2/SC_Time.h"
#define ARGS(x) (x >= count ? OutOfArgsCount(x, cmd, count) : Memory.Read32(Memory.RSXIOMem.GetStartAddr() + re(m_ctrl->get) + (4*(x+1))))
@ -1195,8 +1196,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
switch(type)
{
case 1:
data = std::chrono::steady_clock::now().time_since_epoch().count();
data *= 1000000;
data = get_system_time();
data *= 1000; // Microseconds to nanoseconds
break;
default:

View File

@ -323,9 +323,18 @@ int cellFsUnlink(u32 path_addr)
const wxString& ps3_path = Memory.ReadString(path_addr);
sys_fs.Warning("cellFsUnlink(path=\"%s\")", ps3_path.wx_str());
//wxString localPath;
//Emu.GetVFS().GetDevice(ps3_path, localPath);
//wxRemoveFile(localPath);
if (ps3_path.empty())
return CELL_EFAULT;
if (Emu.GetVFS().ExistsDir(ps3_path))
return CELL_EISDIR;
if (!Emu.GetVFS().ExistsFile(ps3_path))
return CELL_ENOENT;
if (!Emu.GetVFS().RemoveFile(ps3_path))
return CELL_EACCES;
return CELL_OK;
}

View File

@ -7,23 +7,14 @@
* */
#include "stdafx.h"
#include "Emu/SysCalls/SysCalls.h"
#include <sys/timeb.h>
#include "SC_Time.h"
SysCallBase sys_time("sys_time");
//static const u64 timebase_frequency = 79800000;
extern int cellSysutilGetSystemParamInt(int id, mem32_t value);
int sys_time_get_timezone(mem32_t timezone, mem32_t summertime)
{
int ret;
ret = cellSysutilGetSystemParamInt(0x0116, timezone); //0x0116 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE
if (ret != CELL_OK) return ret;
ret = cellSysutilGetSystemParamInt(0x0117, summertime); //0x0117 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE
if (ret != CELL_OK) return ret;
return CELL_OK;
}
// Auxiliary functions
u64 get_time()
{
#ifdef _WIN32
@ -39,12 +30,24 @@ u64 get_time()
#endif
}
// Returns some relative time in microseconds, don't change this fact
u64 get_system_time()
{
// returns some relative time in microseconds, don't change this fact
return get_time() / 10;
}
// Functions
int sys_time_get_timezone(mem32_t timezone, mem32_t summertime)
{
int ret;
ret = cellSysutilGetSystemParamInt(0x0116, timezone); //0x0116 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE
if (ret != CELL_OK) return ret;
ret = cellSysutilGetSystemParamInt(0x0117, summertime); //0x0117 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE
if (ret != CELL_OK) return ret;
return CELL_OK;
}
int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr)
{
sys_time.Log("sys_time_get_current_time(sec_addr=0x%x, nsec_addr=0x%x)", sec_addr, nsec_addr);

View File

@ -0,0 +1,4 @@
#pragma once
u64 get_time();
u64 get_system_time();

View File

@ -150,7 +150,7 @@ bool PKGLoader::UnpackEntry(wxFile& dec, const PKGEntry& entry, std::string dir)
dec.Read(buf, entry.name_size);
buf[entry.name_size] = 0;
switch (entry.type & (0xffff))
switch (entry.type & (0xff))
{
case PKG_FILE_ENTRY_NPDRM:
case PKG_FILE_ENTRY_NPDRMEDAT: