/dev_bdvd/ and /app_home/ fixed

This commit is contained in:
Nekotekina 2014-11-30 22:23:51 +03:00
parent d648957864
commit 1568930da6
5 changed files with 40 additions and 25 deletions

View File

@ -422,7 +422,7 @@ void VFS::Init(const std::string& path)
Mount(entry.mount, mpath, dev);
}
Link("/app_home/", cwd);
Link("/app_home/", "/host_root/" + cwd);
}
void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
@ -442,7 +442,7 @@ void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_flash/", "/dev_flash/");
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb000/");
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb/");
res.emplace_back(vfsDevice_LocalFile, "$(GameDir)/../", "/dev_bdvd/");
res.emplace_back(vfsDevice_LocalFile, "$(GameDir)/../../", "/dev_bdvd/");
res.emplace_back(vfsDevice_LocalFile, "", "/host_root/");
return;

View File

@ -1,5 +1,7 @@
#pragma once
#include "Emu/Memory/atomic_type.h"
enum
{
CELL_GCM_DISPLAY_HSYNC = 1,
@ -201,9 +203,9 @@ enum
struct CellGcmControl
{
be_t<u32> put;
be_t<u32> get;
be_t<u32> ref;
atomic_t<u32> put;
atomic_t<u32> get;
atomic_t<u32> ref;
};
struct CellGcmConfig

View File

@ -259,7 +259,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
// NV406E
case NV406E_SET_REFERENCE:
{
m_ctrl->ref = ARGS(0);
m_ctrl->ref.exchange(be_t<u32>::make(ARGS(0)));
}
break;
@ -2204,14 +2204,8 @@ void RSXThread::Task()
inc=1;
u32 put, get;
// this code produces only mov + bswap:
put = se_t<u32>::func(std::atomic_load((volatile std::atomic<u32>*)((u8*)m_ctrl + offsetof(CellGcmControl, put))));
get = se_t<u32>::func(std::atomic_load((volatile std::atomic<u32>*)((u8*)m_ctrl + offsetof(CellGcmControl, get))));
/*
se_t<u32>::func(put, InterlockedCompareExchange((volatile unsigned long*)((u8*)m_ctrl + offsetof(CellGcmControl, put)), 0, 0));
se_t<u32>::func(get, InterlockedCompareExchange((volatile unsigned long*)((u8*)m_ctrl + offsetof(CellGcmControl, get)), 0, 0));
*/
u32 get = m_ctrl->get.read_sync();
u32 put = m_ctrl->put.read_sync();
if(put == get || !Emu.IsRunning())
{
@ -2241,7 +2235,7 @@ void RSXThread::Task()
{
u32 addr = cmd & ~(CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT);
//LOG_WARNING(RSX, "rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", addr, m_ioAddress + get, cmd, get, put);
m_ctrl->get = addr;
m_ctrl->get.exchange(be_t<u32>::make(addr));
continue;
}
if(cmd & CELL_GCM_METHOD_FLAG_CALL)
@ -2250,7 +2244,7 @@ void RSXThread::Task()
u32 offs = cmd & ~CELL_GCM_METHOD_FLAG_CALL;
//u32 addr = offs;
//LOG_WARNING(RSX, "rsx call(0x%x) #0x%x - 0x%x - 0x%x", offs, addr, cmd, get);
m_ctrl->get = offs;
m_ctrl->get.exchange(be_t<u32>::make(offs));
continue;
}
if(cmd == CELL_GCM_METHOD_FLAG_RETURN)
@ -2259,7 +2253,7 @@ void RSXThread::Task()
u32 get = m_call_stack.top();
m_call_stack.pop();
//LOG_WARNING(RSX, "rsx return(0x%x)", get);
m_ctrl->get = get;
m_ctrl->get.exchange(be_t<u32>::make(get));
continue;
}
if(cmd & CELL_GCM_METHOD_FLAG_NON_INCREMENT)
@ -2273,7 +2267,10 @@ void RSXThread::Task()
LOG_ERROR(Log::RSX, "null cmd: cmd=0x%x, put=0x%x, get=0x%x (addr=0x%x)", cmd, put, get, (u32)Memory.RSXIOMem.RealAddr(get));
//Emu.Pause();
//HACK! We shouldn't be here
m_ctrl->get = get + (count + 1) * 4;
m_ctrl->get.atomic_op([](be_t<u32>& value)
{
value += 4;
});
continue;
}
@ -2286,7 +2283,10 @@ void RSXThread::Task()
DoCmd(cmd, cmd & 0x3ffff, args.addr(), count);
m_ctrl->get = get + (count + 1) * 4;
m_ctrl->get.atomic_op([count](be_t<u32>& value)
{
value += (count + 1) * 4;
});
//memset(Memory.GetMemFromAddr(p.m_ioAddress + get), 0, (count + 1) * 4);
}
catch (const std::string& e)

View File

@ -380,9 +380,9 @@ s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSiz
vm::write32(context.addr(), gcm_info.context_addr);
auto& ctrl = vm::get_ref<CellGcmControl>(gcm_info.control_addr);
ctrl.put = 0;
ctrl.get = 0;
ctrl.ref = -1;
ctrl.put.write_relaxed(be_t<u32>::make(0));
ctrl.get.write_relaxed(be_t<u32>::make(0));
ctrl.ref.write_relaxed(be_t<u32>::make(-1));
auto& render = Emu.GetGSManager().GetRender();
render.m_ctxt_addr = context.addr();
@ -526,7 +526,10 @@ s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
if(ctxt.addr() == gcm_info.context_addr)
{
auto& ctrl = vm::get_ref<CellGcmControl>(gcm_info.control_addr);
ctrl.put += 8;
ctrl.put.atomic_op([](be_t<u32>& value)
{
value += 8;
});
}
return id;
@ -1167,6 +1170,16 @@ s32 cellGcmCallback(vm::ptr<CellGcmContextData> context, u32 count)
{
cellGcmSys->Log("cellGcmCallback(context_addr=0x%x, count=0x%x)", context.addr(), count);
auto& ctrl = vm::get_ref<CellGcmControl>(gcm_info.control_addr);
{
const u32 address = context->current;
const u32 upper = offsetTable.ioAddress[address >> 20]; // 12 bits
assert(upper != 0xFFFF);
u32 offset = (upper << 20) | (address & 0xFFFFF);
//ctrl.put.exchange(be_t<u32>::make(offset)); // update put pointer
}
// TODO: this may be wrong
vm::write32(context->current, CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT | (0)); // set JUMP cmd

View File

@ -332,7 +332,7 @@ void RSXDebugger::GoToGet(wxCommandEvent& event)
if (!RSXReady()) return;
auto ctrl = vm::get_ptr<CellGcmControl>(Emu.GetGSManager().GetRender().m_ctrlAddress);
u64 realAddr;
if (Memory.RSXIOMem.getRealAddr(ctrl->get, realAddr)) {
if (Memory.RSXIOMem.getRealAddr(ctrl->get.read_relaxed(), realAddr)) {
m_addr = realAddr; // WARNING: Potential Truncation? Cast from u64 to u32
t_addr->SetValue(wxString::Format("%08x", m_addr));
UpdateInformation();
@ -346,7 +346,7 @@ void RSXDebugger::GoToPut(wxCommandEvent& event)
if (!RSXReady()) return;
auto ctrl = vm::get_ptr<CellGcmControl>(Emu.GetGSManager().GetRender().m_ctrlAddress);
u64 realAddr;
if (Memory.RSXIOMem.getRealAddr(ctrl->put, realAddr)) {
if (Memory.RSXIOMem.getRealAddr(ctrl->put.read_relaxed(), realAddr)) {
m_addr = realAddr; // WARNING: Potential Truncation? Cast from u64 to u32
t_addr->SetValue(wxString::Format("%08x", m_addr));
UpdateInformation();