Skip to content

Commit

Permalink
Improved PSF loader.
Browse files Browse the repository at this point in the history
Improved Game Viewer.
Implemented cellPadGetInfo.
Minor improvements.
  • Loading branch information
DHrpcs3 committed Dec 8, 2013
1 parent 34f5997 commit eaef09d
Show file tree
Hide file tree
Showing 10 changed files with 1,022 additions and 1,038 deletions.
6 changes: 4 additions & 2 deletions rpcs3/Emu/Cell/SPUInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1238,8 +1238,10 @@ class SPUInterpreter : public SPUOpcodes
}
void AI(u32 rt, u32 ra, s32 i10)
{
const __u32x4 imm = {i10, i10, i10, i10};
CPU.GPR[rt]._m128i = _mm_add_epi32(CPU.GPR[ra]._m128i, imm.m128i);
CPU.GPR[rt]._i32[0] = CPU.GPR[ra]._i32[0] + i10;
CPU.GPR[rt]._i32[1] = CPU.GPR[ra]._i32[1] + i10;
CPU.GPR[rt]._i32[2] = CPU.GPR[ra]._i32[2] + i10;
CPU.GPR[rt]._i32[3] = CPU.GPR[ra]._i32[3] + i10;
}
void AHI(u32 rt, u32 ra, s32 i10)
{
Expand Down
2 changes: 0 additions & 2 deletions rpcs3/Emu/GS/GL/GLGSRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,6 @@ void GLGSRender::Flip()
u32 height = re(buffers[m_gcm_current_buffer].height);
u32 addr = GetAddress(re(buffers[m_gcm_current_buffer].offset), CELL_GCM_LOCATION_LOCAL);

glRotated(90, 1, 0, 0);

if(Memory.IsGoodAddr(addr))
{
//TODO
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/SysCalls/Modules/sys_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void sys_io_init()
sys_io.AddFunc(0x8b72cda1, cellPadGetData);
sys_io.AddFunc(0x6bc09c61, cellPadGetDataExtra);
sys_io.AddFunc(0xf65544ee, cellPadSetActDirect);
sys_io.AddFunc(0x3aaad464, cellPadGetInfo);
sys_io.AddFunc(0xa703a51d, cellPadGetInfo2);
sys_io.AddFunc(0x578e3c98, cellPadSetPortSetting);

Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/SysCalls/SysCalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ extern int cellPadClearBuf(u32 port_no);
extern int cellPadGetData(u32 port_no, u32 data_addr);
extern int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr);
extern int cellPadSetActDirect(u32 port_no, u32 param_addr);
extern int cellPadGetInfo(u32 info_addr);
extern int cellPadGetInfo2(u32 info_addr);
extern int cellPadSetPortSetting(u32 port_no, u32 port_setting);

Expand Down
40 changes: 38 additions & 2 deletions rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,28 @@ int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_a
{
sc_mem.Warning("sys_mmapper_allocate_address(size=0x%x, flags=0x%llx, alignment=0x%x, alloc_addr=0x%x)", size, flags, alignment, alloc_addr);

Memory.Write32(alloc_addr, Memory.Alloc(size, alignment));
if(!Memory.IsGoodAddr(alloc_addr)) return CELL_EFAULT;

if(!alignment)
alignment = 1;

u32 addr;

switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
{
default:
case SYS_MEMORY_PAGE_SIZE_1M:
if(Memory.AlignAddr(size, alignment) & 0xfffff) return CELL_EALIGN;
addr = Memory.Alloc(size, 0x100000);
break;

case SYS_MEMORY_PAGE_SIZE_64K:
if(Memory.AlignAddr(size, alignment) & 0xffff) return CELL_EALIGN;
addr = Memory.Alloc(size, 0x10000);
break;
}

Memory.Write32(alloc_addr, addr);

return CELL_OK;
}
Expand All @@ -91,7 +112,22 @@ int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr)

if(!Memory.IsGoodAddr(mem_id_addr)) return CELL_EFAULT;

u64 addr = Memory.Alloc(size, 4);
u32 addr;
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
{
case SYS_MEMORY_PAGE_SIZE_1M:
if(size & 0xfffff) return CELL_EALIGN;
addr = Memory.Alloc(size, 0x100000);
break;

case SYS_MEMORY_PAGE_SIZE_64K:
if(size & 0xffff) return CELL_EALIGN;
addr = Memory.Alloc(size, 0x10000);
break;

default:
return CELL_EINVAL;
}

if(!addr)
return CELL_ENOMEM;
Expand Down
39 changes: 39 additions & 0 deletions rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ struct CellPadData
u16 button[CELL_PAD_MAX_CODES];
};

struct CellPadInfo
{
u32 max_connect;
u32 now_connect;
u32 system_info;
u16 vendor_id[CELL_MAX_PADS];
u16 product_id[CELL_MAX_PADS];
u8 status[CELL_MAX_PADS];
};

struct CellPadInfo2
{
u32 max_connect;
Expand Down Expand Up @@ -142,6 +152,35 @@ int cellPadSetActDirect(u32 port_no, u32 param_addr)
return CELL_OK;
}

int cellPadGetInfo(u32 info_addr)
{
sys_io.Log("cellPadGetInfo(info_addr=0x%x)", info_addr);
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;

CellPadInfo info;
memset(&info, 0, sizeof(CellPadInfo));

const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
info.max_connect = re(rinfo.max_connect);
info.now_connect = re(rinfo.now_connect);
info.system_info = re(rinfo.system_info);

const Array<Pad>& pads = Emu.GetPadManager().GetPads();

for(u32 i=0; i<CELL_MAX_PADS; ++i)
{
if(i >= pads.GetCount()) break;

info.status[i] = re(pads[i].m_port_status);
info.product_id[i] = 0xdead; //TODO
info.vendor_id[i] = 0xbeaf; //TODO
}

Memory.WriteData(info_addr, info);

return CELL_OK;
}

int cellPadGetInfo2(u32 info_addr)
{
sys_io.Log("cellPadGetInfo2(info_addr=0x%x)", info_addr);
Expand Down
17 changes: 7 additions & 10 deletions rpcs3/Gui/GameViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GameViewer::GameViewer(wxWindow* parent) : wxListView(parent)
LoadSettings();
m_columns.Show(this);

m_path = wxGetCwd(); //TODO
m_path = wxGetCwd() + "\\dev_hdd0\\game\\"; //TODO

Connect(GetId(), wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler(GameViewer::DClick));

Expand All @@ -34,16 +34,13 @@ void GameViewer::LoadGames()
if(!dir.HasSubDirs()) return;

wxString buf;
if(!dir.GetFirst(&buf)) return;
if(wxDirExists(buf)) m_games.Add(buf);

for(;;)
for(bool ok = dir.GetFirst(&buf); ok; ok = dir.GetNext(&buf))
{
if(!dir.GetNext(&buf)) break;
if(wxDirExists(buf)) m_games.Add(buf);
if(wxDirExists(m_path + buf))
m_games.Add(buf);
}

//ConLog.Write("path: %s", m_path);
//ConLog.Write("path: %s", m_path.c_str());
//ConLog.Write("folders count: %d", m_games.GetCount());
}

Expand All @@ -52,7 +49,7 @@ void GameViewer::LoadPSF()
m_game_data.Clear();
for(uint i=0; i<m_games.GetCount(); ++i)
{
const wxString& path = m_games[i] + "\\" + "PARAM.SFO";
const wxString& path = m_path + m_games[i] + "\\PARAM.SFO";
if(!wxFileExists(path)) continue;
vfsLocalFile f(path);
PSFLoader psf(f);
Expand Down Expand Up @@ -91,7 +88,7 @@ void GameViewer::DClick(wxListEvent& event)
long i = GetFirstSelected();
if(i < 0) return;

const wxString& path = m_path + "\\" + m_game_data[i].root + "\\" + "USRDIR" + "\\" + "BOOT.BIN";
const wxString& path = m_path + "\\" + m_game_data[i].root + "\\USRDIR\\BOOT.BIN";
if(!wxFileExists(path))
{
ConLog.Error("Boot error: elf not found! [%s]", path.mb_str());
Expand Down

0 comments on commit eaef09d

Please sign in to comment.