Using be_t in some cellGcm structs & minor fixes

* Using be_t in CellGcmControl, CellGcmConfig, CellGcmContextData and
CellGcmTileInfo.
* Fixed wrong names in Emu/SysCalls/Modules/sceNp.cpp
* Fixed ConLog's mount info strings in System.cpp
This commit is contained in:
Alexandro Sánchez Bach 2014-02-24 17:03:47 +01:00
parent d9d80d8fb4
commit 2827db0e2a
7 changed files with 55 additions and 56 deletions

View File

@ -75,27 +75,27 @@ enum
struct CellGcmControl
{
u32 put;
u32 get;
u32 ref;
be_t<u32> put;
be_t<u32> get;
be_t<u32> ref;
};
struct CellGcmConfig
{
u32 localAddress;
u32 ioAddress;
u32 localSize;
u32 ioSize;
u32 memoryFrequency;
u32 coreFrequency;
be_t<u32> localAddress;
be_t<u32> ioAddress;
be_t<u32> localSize;
be_t<u32> ioSize;
be_t<u32> memoryFrequency;
be_t<u32> coreFrequency;
};
struct CellGcmContextData
{
u32 begin;
u32 end;
u32 current;
u32 callback;
be_t<u32> begin;
be_t<u32> end;
be_t<u32> current;
be_t<u32> callback;
};
struct gcmInfo
@ -147,10 +147,10 @@ struct CellGcmZcullInfo
struct CellGcmTileInfo
{
u32 tile;
u32 limit;
u32 pitch;
u32 format;
be_t<u32> tile;
be_t<u32> limit;
be_t<u32> pitch;
be_t<u32> format;
};
struct GcmZcullInfo
@ -194,10 +194,10 @@ struct GcmTileInfo
{
CellGcmTileInfo ret;
re(ret.tile, (m_location + 1) | (m_bank << 4) | ((m_offset / 0x10000) << 16) | (m_location << 31));
re(ret.limit, ((m_offset + m_size - 1) / 0x10000) << 16 | (m_location << 31));
re(ret.pitch, (m_pitch / 0x100) << 8);
re(ret.format, m_base | ((m_base + ((m_size - 1) / 0x10000)) << 13) | (m_comp << 26) | (1 << 30));
ret.tile = (m_location + 1) | (m_bank << 4) | ((m_offset / 0x10000) << 16) | (m_location << 31);
ret.limit = ((m_offset + m_size - 1) / 0x10000) << 16 | (m_location << 31);
ret.pitch = (m_pitch / 0x100) << 8;
ret.format = m_base | ((m_base + ((m_size - 1) / 0x10000)) << 13) | (m_comp << 26) | (1 << 30);
return ret;
}

View File

@ -2,7 +2,7 @@
#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))))
#define ARGS(x) (x >= count ? OutOfArgsCount(x, cmd, count) : Memory.Read32(Memory.RSXIOMem.GetStartAddr() + m_ctrl->get + (4*(x+1))))
u32 methodRegisters[0xffff];
@ -208,7 +208,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
break;
case NV406E_SET_REFERENCE:
m_ctrl->ref = re32(ARGS(0));
m_ctrl->ref = ARGS(0);
break;
case_16(NV4097_SET_TEXTURE_OFFSET, 0x20):
@ -1510,7 +1510,7 @@ void RSXThread::Task()
{
u32 addr = cmd & ~(CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT);
//ConLog.Warning("rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", addr, m_ioAddress + get, cmd, get, put);
re(m_ctrl->get, addr);
m_ctrl->get = addr;
continue;
}
if(cmd & CELL_GCM_METHOD_FLAG_CALL)
@ -1519,7 +1519,7 @@ void RSXThread::Task()
u32 offs = cmd & ~CELL_GCM_METHOD_FLAG_CALL;
u32 addr = Memory.RSXIOMem.GetStartAddr() + offs;
//ConLog.Warning("rsx call(0x%x) #0x%x - 0x%x - 0x%x", offs, addr, cmd, get);
m_ctrl->get = re32(offs);
m_ctrl->get = offs;
continue;
}
if(cmd == CELL_GCM_METHOD_FLAG_RETURN)
@ -1527,7 +1527,7 @@ void RSXThread::Task()
//ConLog.Warning("rsx return!");
u32 get = m_call_stack.Pop();
//ConLog.Warning("rsx return(0x%x)", get);
m_ctrl->get = re32(get);
m_ctrl->get = get;
continue;
}
if(cmd & CELL_GCM_METHOD_FLAG_NON_INCREMENT)
@ -1538,7 +1538,7 @@ void RSXThread::Task()
if(cmd == 0)
{
ConLog.Warning("null cmd: addr=0x%x, put=0x%x, get=0x%x", Memory.RSXIOMem.GetStartAddr() + get, re(m_ctrl->put), get);
ConLog.Warning("null cmd: addr=0x%x, put=0x%x, get=0x%x", Memory.RSXIOMem.GetStartAddr() + get, m_ctrl->put, get);
Emu.Pause();
continue;
}
@ -1551,7 +1551,7 @@ void RSXThread::Task()
mem32_ptr_t args(Memory.RSXIOMem.GetStartAddr() + get + 4);
DoCmd(cmd, cmd & 0x3ffff, args, count);
re(m_ctrl->get, get + (count + 1) * 4);
m_ctrl->get = get + (count + 1) * 4;
//memset(Memory.GetMemFromAddr(p.m_ioAddress + get), 0, (count + 1) * 4);
}

View File

@ -70,12 +70,12 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress)
map_offset_addr = 0;
map_offset_pos = 0;
current_config.ioSize = re32(ioSize);
current_config.ioAddress = re32(ioAddress);
current_config.localSize = re32(local_size);
current_config.localAddress = re32(local_addr);
current_config.memoryFrequency = re32(650000000);
current_config.coreFrequency = re32(500000000);
current_config.ioSize = ioSize;
current_config.ioAddress = ioAddress;
current_config.localSize = local_size;
current_config.localAddress = local_addr;
current_config.memoryFrequency = 650000000;
current_config.coreFrequency = 500000000;
InitOffsetTable();
Memory.RSXCMDMem.AllocAlign(cmdSize);
@ -84,10 +84,10 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress)
u32 ctx_begin = ioAddress/* + 0x1000*/;
u32 ctx_size = 0x6ffc;
current_context.begin = re(ctx_begin);
current_context.end = re(ctx_begin + ctx_size);
current_context.begin = ctx_begin;
current_context.end = ctx_begin + ctx_size;
current_context.current = current_context.begin;
current_context.callback = re32(Emu.GetRSXCallback() - 4);
current_context.callback = Emu.GetRSXCallback() - 4;
gcm_info.context_addr = Memory.MainMem.AllocAlign(0x1000);
gcm_info.control_addr = gcm_info.context_addr + 0x40;
@ -169,8 +169,8 @@ int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could stall on exit
u32 current = re(ctxt->current);
u32 end = re(ctxt->end);
u32 current = ctxt->current;
u32 end = ctxt->end;
if(current + 8 >= end)
{
@ -178,15 +178,15 @@ int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
cellGcmCallback(ctxt.GetAddr(), current + 8 - end);
}
current = re(ctxt->current);
current = ctxt->current;
Memory.Write32(current, 0x3fead | (1 << 18));
Memory.Write32(current + 4, id);
re(ctxt->current, current + 8);
ctxt->current += 8;
if(ctxt.GetAddr() == gcm_info.context_addr)
{
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
re(ctrl.put, re(ctrl.put) + 8);
ctrl.put += 8;
}
return id;
@ -416,7 +416,8 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
{
cellGcmSys.Warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank);
//copied form cellGcmSetTileInfo
// Copied form cellGcmSetTileInfo
if(index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4)
{
return CELL_GCM_ERROR_INVALID_VALUE;
@ -434,7 +435,7 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
if(comp)
{
cellGcmSys.Error("cellGcmSetTileInfo: bad comp! (%d)", comp);
cellGcmSys.Error("cellGcmSetTile: bad comp! (%d)", comp);
}
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];

View File

@ -5,12 +5,10 @@
#include "sceNp.h"
void sceNpTrophy_init();
Module sceNp(0x0016, sceNpTrophy_init);
void sceNp_init();
Module sceNp(0x0016, sceNp_init);
void sceNpTrophy_init()
void sceNp_init()
{
}
#endif

View File

@ -12,13 +12,13 @@ int cellGcmCallback(u32 context_addr, u32 count)
CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
const s32 res = re(ctx.current) - re(ctx.begin) - re(ctrl.put);
const s32 res = ctx.current - ctx.begin - ctrl.put;
if(res > 0) memcpy(&Memory[re(ctx.begin)], &Memory[re(ctx.current) - res], res);
if(res > 0) memcpy(&Memory[ctx.begin], &Memory[ctx.current - res], res);
ctx.current = re(re(ctx.begin) + res);
ctx.current = ctx.begin + res;
ctrl.put = re(res);
ctrl.put = res;
ctrl.get = 0;
return CELL_OK;

View File

@ -217,7 +217,7 @@ void Emulator::Load()
ConLog.Write("Mount info:");
for(uint i=0; i<m_vfs.m_devices.GetCount(); ++i)
{
ConLog.Write("%s -> %s", static_cast<const char *>(m_vfs.m_devices[i].GetPs3Path()), static_cast<const char *>(m_vfs.m_devices[i].GetLocalPath().ToAscii()));
ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().wx_str(), m_vfs.m_devices[i].GetLocalPath().wx_str());
}
ConLog.SkipLn();

View File

@ -322,7 +322,7 @@ void RSXDebugger::GoToGet(wxCommandEvent& event)
{
if (!RSXReady()) return;
CellGcmControl* ctrl = (CellGcmControl*)&Memory[Emu.GetGSManager().GetRender().m_ctrlAddress];
m_addr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + re(ctrl->get));
m_addr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ctrl->get);
t_addr->SetValue(wxString::Format("%08x", m_addr));
UpdateInformation();
event.Skip();
@ -332,7 +332,7 @@ void RSXDebugger::GoToPut(wxCommandEvent& event)
{
if (!RSXReady()) return;
CellGcmControl* ctrl = (CellGcmControl*)&Memory[Emu.GetGSManager().GetRender().m_ctrlAddress];
m_addr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + re(ctrl->put));
m_addr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ctrl->put);
t_addr->SetValue(wxString::Format("%08x", m_addr));
UpdateInformation();
event.Skip();