Small changes

This commit is contained in:
Nekotekina 2015-04-18 20:18:23 +03:00
parent f2276bb70c
commit 2cafa84b75
11 changed files with 86 additions and 70 deletions

View file

@ -46,7 +46,7 @@ namespace psv_func_detail
ARG_STACK,
};
static const auto FIXED_STACK_FRAME_SIZE = 0x100; // described in CB_FUNC.h
static const auto FIXED_STACK_FRAME_SIZE = 0x80; // described in CB_FUNC.h
template<typename T, arg_class type, int g_count, int f_count, int v_count>
struct bind_arg;

View file

@ -136,6 +136,7 @@ void VFS::UnMountAll()
vfsFileBase* VFS::OpenFile(const std::string& ps3_path, vfsOpenMode mode) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
if (vfsFileBase* res = dev->GetNewFileStream())
@ -167,9 +168,10 @@ vfsDirBase* VFS::OpenDir(const std::string& ps3_path) const
bool VFS::CreateFile(const std::string& ps3_path, bool overwrite) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
std::unique_ptr<vfsFileBase> res(dev->GetNewFileStream());
if (res)
{
@ -183,9 +185,10 @@ bool VFS::CreateFile(const std::string& ps3_path, bool overwrite) const
bool VFS::CreateDir(const std::string& ps3_path) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
std::unique_ptr<vfsDirBase> res(dev->GetNewDirStream());
if (res)
{
@ -199,9 +202,10 @@ bool VFS::CreateDir(const std::string& ps3_path) const
bool VFS::RemoveFile(const std::string& ps3_path) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
std::unique_ptr<vfsFileBase> res(dev->GetNewFileStream());
if (res)
{
@ -215,9 +219,10 @@ bool VFS::RemoveFile(const std::string& ps3_path) const
bool VFS::RemoveDir(const std::string& ps3_path) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
std::unique_ptr<vfsDirBase> res(dev->GetNewDirStream());
if (res)
{
@ -231,9 +236,10 @@ bool VFS::RemoveDir(const std::string& ps3_path) const
bool VFS::ExistsFile(const std::string& ps3_path) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
std::unique_ptr<vfsFileBase> res(dev->GetNewFileStream());
if (res)
{
@ -247,9 +253,10 @@ bool VFS::ExistsFile(const std::string& ps3_path) const
bool VFS::ExistsDir(const std::string& ps3_path) const
{
std::string path;
if (vfsDevice* dev = GetDevice(ps3_path, path))
{
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
std::unique_ptr<vfsDirBase> res(dev->GetNewDirStream());
if (res)
{
@ -268,7 +275,7 @@ bool VFS::RenameFile(const std::string& ps3_path_from, const std::string& ps3_pa
{
if (vfsDevice* dev_ = GetDevice(ps3_path_to, path_to))
{
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
std::unique_ptr<vfsFileBase> res(dev->GetNewFileStream());
if (res)
{
@ -288,7 +295,7 @@ bool VFS::RenameDir(const std::string& ps3_path_from, const std::string& ps3_pat
{
if (vfsDevice* dev_ = GetDevice(ps3_path_to, path_to))
{
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
std::unique_ptr<vfsDirBase> res(dev->GetNewDirStream());
if (res)
{

View file

@ -252,4 +252,4 @@ void vfsDevice::Unlock() const
bool vfsDevice::TryLock() const
{
return m_mtx_lock.try_lock();
}
}

View file

@ -1,6 +1,6 @@
#pragma once
class CPUThread;
class PPUThread;
struct ARMv7Context;
namespace vm
@ -354,7 +354,7 @@ namespace vm
public:
typedef RT(type)(T...);
RT operator()(CPUThread& CPU, T... args) const; // defined in CB_FUNC.h, call using specified PPU thread context
RT operator()(PPUThread& CPU, T... args) const; // defined in CB_FUNC.h, call using specified PPU thread context
RT operator()(ARMv7Context& context, T... args) const; // defined in ARMv7Callback.h, passing context is mandatory

View file

@ -162,14 +162,13 @@ namespace cb_detail
namespace vm
{
template<typename AT, typename RT, typename... T>
__forceinline RT _ptr_base<RT(T...), 1, AT>::operator()(CPUThread& CPU, T... args) const
__forceinline RT _ptr_base<RT(T...), 1, AT>::operator()(PPUThread& CPU, T... args) const
{
auto data = vm::get_ptr<be_t<u32>>(vm::cast(m_addr));
const auto data = vm::get_ptr<be_t<u32>>(vm::cast(m_addr));
const u32 pc = data[0];
const u32 rtoc = data[1];
assert(CPU.GetType() == CPU_THREAD_PPU);
return cb_detail::_func_caller<RT, T...>::call(static_cast<PPUThread&>(CPU), pc, rtoc, args...);
return cb_detail::_func_caller<RT, T...>::call(CPU, pc, rtoc, args...);
}
template<typename AT, typename RT, typename... T>

View file

@ -109,8 +109,8 @@ s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
{
switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE)
{
case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: cellSysutil.Warning("%s", msg.c_str()); break;
case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: cellSysutil.Error("%s", msg.c_str()); break;
case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: cellSysutil.Warning("%s", msg); break;
case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: cellSysutil.Error("%s", msg); break;
}
g_msg_dialog->status = CELL_MSGDIALOG_BUTTON_NONE;
@ -120,7 +120,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
{
if (Emu.IsStopped()) return;
g_msg_dialog->Create(type, msg.c_str());
g_msg_dialog->Create(type, msg);
m_signal = true;
});
@ -266,6 +266,7 @@ s32 cellMsgDialogClose(float delay)
}
g_msg_dialog->wait_until = get_system_time() + static_cast<u64>(std::max<float>(delay, 0.0f) * 1000);
return CELL_OK;
}
@ -306,12 +307,7 @@ s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::ptr<const char> msg
return CELL_MSGDIALOG_ERROR_PARAM;
}
std::string text = msgString.get_ptr();
CallAfter([text, progressBarIndex]()
{
g_msg_dialog->ProgressBarSetMsg(progressBarIndex, text.c_str());
});
g_msg_dialog->ProgressBarSetMsg(progressBarIndex, msgString.get_ptr());
return CELL_OK;
}
@ -330,10 +326,7 @@ s32 cellMsgDialogProgressBarReset(u32 progressBarIndex)
return CELL_MSGDIALOG_ERROR_PARAM;
}
CallAfter([=]()
{
g_msg_dialog->ProgressBarReset(progressBarIndex);
});
g_msg_dialog->ProgressBarReset(progressBarIndex);
return CELL_OK;
}
@ -352,10 +345,7 @@ s32 cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
return CELL_MSGDIALOG_ERROR_PARAM;
}
CallAfter([=]()
{
g_msg_dialog->ProgressBarInc(progressBarIndex, delta);
});
g_msg_dialog->ProgressBarInc(progressBarIndex, delta);
return CELL_OK;
}

View file

@ -103,9 +103,9 @@ struct MsgDialogInstance
virtual void Close();
virtual void Create(u32 type, const char* msg) = 0;
virtual void Create(u32 type, std::string msg) = 0;
virtual void Destroy() = 0;
virtual void ProgressBarSetMsg(u32 progressBarIndex, const char* msg) = 0;
virtual void ProgressBarSetMsg(u32 progressBarIndex, std::string msg) = 0;
virtual void ProgressBarReset(u32 progressBarIndex) = 0;
virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) = 0;
};

View file

@ -183,13 +183,13 @@ struct CellSaveDataDirStat
struct CellSaveDataFileStat
{
be_t<u32> fileType;
u8 reserved1[4];
char reserved1[4];
be_t<u64> size;
be_t<s64> atime;
be_t<s64> mtime;
be_t<s64> ctime;
char fileName[CELL_SAVEDATA_FILENAME_SIZE];
u8 reserved2[3];
char reserved2[3];
};
struct CellSaveDataStatGet

View file

@ -719,7 +719,11 @@ s32 cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
case CELL_VDEC_PICFMT_RGBA32_ILV: out_f = AV_PIX_FMT_RGBA; alpha_plane.reset(new u8[w * h]); break;
case CELL_VDEC_PICFMT_UYVY422_ILV: out_f = AV_PIX_FMT_UYVY422; break;
case CELL_VDEC_PICFMT_YUV420_PLANAR: out_f = AV_PIX_FMT_YUV420P; break;
default: cellVdec.Fatal("cellVdecGetPicture: unknown formatType(%d)", type);
default:
{
cellVdec.Fatal("cellVdecGetPicture: unknown formatType(%d)", type);
}
}
if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709)
@ -737,7 +741,11 @@ s32 cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
switch (f)
{
case AV_PIX_FMT_YUV420P: in_f = alpha_plane ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; break;
default: cellVdec.Fatal("cellVdecGetPicture: unknown pix_fmt(%d)", f);
default:
{
cellVdec.Fatal("cellVdecGetPicture: unknown pix_fmt(%d)", f);
}
}
std::unique_ptr<SwsContext, void(*)(SwsContext*)> sws(sws_getContext(w, h, in_f, w, h, out_f, SWS_POINT, NULL, NULL, NULL), sws_freeContext);

View file

@ -1,10 +1,11 @@
#include "stdafx_gui.h"
#include "rpcs3.h"
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/lv2/sys_time.h"
#include "MsgDialog.h"
void MsgDialogFrame::Create(u32 type, const char* msg)
void MsgDialogFrame::Create(u32 type, std::string msg)
{
wxWindow* parent = nullptr; // TODO: align the window better
@ -23,7 +24,7 @@ void MsgDialogFrame::Create(u32 type, const char* msg)
m_sizer1 = new wxBoxSizer(wxVERTICAL);
m_text = new wxStaticText(m_dialog, wxID_ANY, wxString(msg, wxConvUTF8));
m_text = new wxStaticText(m_dialog, wxID_ANY, wxString(msg.c_str(), wxConvUTF8));
m_sizer1->Add(m_text, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
@ -46,6 +47,7 @@ void MsgDialogFrame::Create(u32 type, const char* msg)
m_sizer1->Add(m_gauge1, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 16);
m_gauge1->SetValue(0);
}
if (m_gauge2)
{
m_sizer1->Add(m_text2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 8);
@ -53,15 +55,15 @@ void MsgDialogFrame::Create(u32 type, const char* msg)
m_gauge2->SetValue(0);
}
wxBoxSizer* buttons = new wxBoxSizer(wxHORIZONTAL);
m_buttons = new wxBoxSizer(wxHORIZONTAL);
switch (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE)
if (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO)
{
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO:
m_button_yes = new wxButton(m_dialog, wxID_YES);
buttons->Add(m_button_yes, 0, wxALIGN_CENTER_HORIZONTAL | wxRIGHT, 8);
m_buttons->Add(m_button_yes, 0, wxALIGN_CENTER_HORIZONTAL | wxRIGHT, 8);
m_button_no = new wxButton(m_dialog, wxID_NO);
buttons->Add(m_button_no, 0, wxALIGN_CENTER_HORIZONTAL, 16);
m_buttons->Add(m_button_no, 0, wxALIGN_CENTER_HORIZONTAL, 16);
if ((type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) == CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO)
{
m_button_no->SetFocus();
@ -71,19 +73,20 @@ void MsgDialogFrame::Create(u32 type, const char* msg)
m_button_yes->SetFocus();
}
m_sizer1->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
break;
m_sizer1->Add(m_buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
}
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
if (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK)
{
m_button_ok = new wxButton(m_dialog, wxID_OK);
buttons->Add(m_button_ok, 0, wxALIGN_CENTER_HORIZONTAL, 16);
m_buttons->Add(m_button_ok, 0, wxALIGN_CENTER_HORIZONTAL, 16);
if ((type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) == CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK)
{
m_button_ok->SetFocus();
}
m_sizer1->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
break;
m_sizer1->Add(m_buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
}
m_sizer1->AddSpacer(16);
@ -100,7 +103,6 @@ void MsgDialogFrame::Create(u32 type, const char* msg)
this->Close();
});
m_dialog->Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& event)
{
if (type & CELL_MSGDIALOG_TYPE_DISABLE_CANCEL)
@ -121,31 +123,40 @@ void MsgDialogFrame::Destroy()
m_dialog = nullptr;
}
void MsgDialogFrame::ProgressBarSetMsg(u32 index, const char* msg)
void MsgDialogFrame::ProgressBarSetMsg(u32 index, std::string msg)
{
if (m_dialog)
wxGetApp().CallAfter([=]()
{
if (index == 0 && m_text1) m_text1->SetLabelText(wxString(msg, wxConvUTF8));
if (index == 1 && m_text2) m_text2->SetLabelText(wxString(msg, wxConvUTF8));
m_dialog->Layout();
m_dialog->Fit();
}
if (m_dialog)
{
if (index == 0 && m_text1) m_text1->SetLabelText(wxString(msg.c_str(), wxConvUTF8));
if (index == 1 && m_text2) m_text2->SetLabelText(wxString(msg.c_str(), wxConvUTF8));
m_dialog->Layout();
m_dialog->Fit();
}
});
}
void MsgDialogFrame::ProgressBarReset(u32 index)
{
if (m_dialog)
wxGetApp().CallAfter([=]()
{
if (index == 0 && m_gauge1) m_gauge1->SetValue(0);
if (index == 1 && m_gauge2) m_gauge2->SetValue(0);
}
if (m_dialog)
{
if (index == 0 && m_gauge1) m_gauge1->SetValue(0);
if (index == 1 && m_gauge2) m_gauge2->SetValue(0);
}
});
}
void MsgDialogFrame::ProgressBarInc(u32 index, u32 delta)
{
if (m_dialog)
wxGetApp().CallAfter([=]()
{
if (index == 0 && m_gauge1) m_gauge1->SetValue(m_gauge1->GetValue() + delta);
if (index == 1 && m_gauge2) m_gauge2->SetValue(m_gauge2->GetValue() + delta);
}
if (m_dialog)
{
if (index == 0 && m_gauge1) m_gauge1->SetValue(m_gauge1->GetValue() + delta);
if (index == 1 && m_gauge2) m_gauge2->SetValue(m_gauge2->GetValue() + delta);
}
});
}

View file

@ -14,11 +14,12 @@ class MsgDialogFrame : public MsgDialogInstance
wxButton* m_button_no;
wxStaticText* m_text;
wxSizer* m_sizer1;
wxSizer* m_buttons;
public:
virtual void Create(u32 type, const char* msg) override;
virtual void Create(u32 type, std::string msg) override;
virtual void Destroy() override;
virtual void ProgressBarSetMsg(u32 progressBarIndex, const char* msg) override;
virtual void ProgressBarSetMsg(u32 progressBarIndex, std::string msg) override;
virtual void ProgressBarReset(u32 progressBarIndex) override;
virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) override;
};