mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
More header changes.
This commit is contained in:
parent
6e06fdf638
commit
c09b0f511e
@ -104,7 +104,7 @@ struct FileListener : LogListener
|
||||
{
|
||||
if (!mFile.IsOpened())
|
||||
{
|
||||
rMessageBox("Can't create log file! (" + name + ".log)", rMessageBoxCaptionStr, rICON_ERROR);
|
||||
rMessageBox("Can't create log file! (" + name + ".log)", "Error", rICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,19 @@
|
||||
#include "stdafx.h"
|
||||
#include <wx/dir.h>
|
||||
|
||||
const int rPATH_MKDIR_FULL = wxPATH_MKDIR_FULL;
|
||||
#ifdef _WIN32
|
||||
// Maybe in StrFmt?
|
||||
std::wstring ConvertUTF8ToWString(const std::string &source) {
|
||||
int len = (int)source.size();
|
||||
int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, NULL, 0);
|
||||
std::wstring str;
|
||||
str.resize(size);
|
||||
if (size > 0) {
|
||||
MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, &str[0], size);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxFile::OpenMode convertOpenMode(rFile::OpenMode open)
|
||||
{
|
||||
@ -140,7 +153,13 @@ bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access)
|
||||
|
||||
bool rFile::Exists(const std::string &file)
|
||||
{
|
||||
return wxFile::Exists(fmt::FromUTF8(file));
|
||||
#ifdef _WIN32
|
||||
std::wstring wstr = ConvertUTF8ToWString(filename);
|
||||
return GetFileAttributes(wstr.c_str()) != 0xFFFFFFFF;
|
||||
#else
|
||||
struct stat buffer;
|
||||
return (stat (file.c_str(), &buffer) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool rFile::IsOpened() const
|
||||
@ -173,14 +192,25 @@ std::string rGetCwd()
|
||||
return fmt::ToUTF8(wxGetCwd());
|
||||
}
|
||||
|
||||
bool rMkdir(const std::string &path)
|
||||
bool rMkdir(const std::string &dir)
|
||||
{
|
||||
return wxMkdir(fmt::FromUTF8(path));
|
||||
return mkdir(dir.c_str());
|
||||
}
|
||||
|
||||
bool rRmdir(const std::string &path)
|
||||
bool rMkpath(const std::string& path)
|
||||
{
|
||||
return wxRmdir(fmt::FromUTF8(path));
|
||||
return wxFileName::Mkdir(fmt::FromUTF8(path), 0777, wxPATH_MKDIR_FULL);
|
||||
}
|
||||
|
||||
bool rRmdir(const std::string &dir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!RemoveDirectory(ConvertUTF8ToWString(dir).c_str())) {
|
||||
ELOG("Error deleting directory %s: %i", dir, GetLastError());
|
||||
}
|
||||
#else
|
||||
rmdir(dir.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool rDirExists(const std::string &path)
|
||||
@ -235,7 +265,7 @@ bool rDir::Open(const std::string& path)
|
||||
|
||||
bool rDir::Exists(const std::string &path)
|
||||
{
|
||||
return wxDir::Exists(fmt::FromUTF8(path));
|
||||
return rFile::Exists(path);
|
||||
}
|
||||
|
||||
bool rDir::GetFirst(std::string *filename) const
|
||||
@ -299,11 +329,6 @@ std::string rFileName::GetFullName()
|
||||
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetFullName());
|
||||
}
|
||||
|
||||
bool rFileName::Mkdir(const std::string& name, int permissions , int flags )
|
||||
{
|
||||
return wxFileName::Mkdir(fmt::FromUTF8(name), permissions, flags);
|
||||
}
|
||||
|
||||
bool rFileName::Normalize()
|
||||
{
|
||||
return reinterpret_cast<wxFileName*>(handle)->Normalize();
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
extern const int rPATH_MKDIR_FULL;
|
||||
|
||||
enum rSeekMode
|
||||
{
|
||||
rFromStart,
|
||||
@ -44,8 +42,9 @@ public:
|
||||
};
|
||||
|
||||
std::string rGetCwd();
|
||||
bool rMkdir(const std::string &path);
|
||||
bool rRmdir(const std::string &path);
|
||||
bool rRmdir(const std::string& dir);
|
||||
bool rMkdir(const std::string& dir);
|
||||
bool rMkpath(const std::string& path);
|
||||
bool rDirExists(const std::string &path);
|
||||
bool rFileExists(const std::string &path);
|
||||
bool rRemoveFile(const std::string &path);
|
||||
@ -77,7 +76,6 @@ struct rFileName
|
||||
std::string GetPath();
|
||||
std::string GetName();
|
||||
std::string GetFullName();
|
||||
static bool Mkdir(const std::string& name, int permissions=0777, int flags=0);
|
||||
bool Normalize();
|
||||
|
||||
void *handle;
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
std::string rMessageBoxCaptionStr = "Message";
|
||||
|
||||
#ifndef QT_UI
|
||||
rMessageDialog::rMessageDialog(void *parent, const std::string& msg, const std::string& title , long style )
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxMessageDialog(
|
||||
@ -28,24 +26,5 @@ long rMessageBox(const std::string& message, const std::string& title, long styl
|
||||
return wxMessageBox(fmt::FromUTF8(message), fmt::FromUTF8(title),style);
|
||||
}
|
||||
|
||||
std::string dummyApp::GetAppName()
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
return fmt::ToUTF8(reinterpret_cast<wxApp*>(handle)->GetAppName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return "NULL";
|
||||
}
|
||||
}
|
||||
dummyApp::dummyApp() : handle(nullptr)
|
||||
{
|
||||
#endif
|
||||
|
||||
}
|
||||
static dummyApp app;
|
||||
|
||||
dummyApp& rGetApp()
|
||||
{
|
||||
return app;
|
||||
}
|
@ -1,34 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
extern std::string rMessageBoxCaptionStr;// = "Message";
|
||||
|
||||
enum MsgBoxParams : unsigned long
|
||||
{
|
||||
rOK = 0x4
|
||||
, rYES =0x2//res
|
||||
, rNO = 0x8 //res
|
||||
, rID_YES = 5103 //resDialog
|
||||
, rCANCEL = 0x10
|
||||
, rYES_NO = 0xA
|
||||
, rHELP = 0x1000
|
||||
, rNO_DEFAULT = 0x80
|
||||
, rCANCEL_DEFAULT = 0x80000000
|
||||
, rYES_DEFAULT = 0x0
|
||||
, rOK_DEFAULT = 0x0
|
||||
, rICON_NONE = 0x40000
|
||||
, rICON_EXCLAMATION = 0x100
|
||||
, rICON_ERROR = 0x200
|
||||
, rICON_HAND = 0x200
|
||||
, rICON_QUESTION = 0x400
|
||||
, rICON_INFORMATION = 0x800
|
||||
, rICON_AUTH_NEEDED = 0x80000
|
||||
, rSTAY_ON_TOP = 0x8000
|
||||
, rCENTRE = 0x1
|
||||
rYES_DEFAULT = 0x0,
|
||||
rOK_DEFAULT = 0x0,
|
||||
rCENTRE = 0x1,
|
||||
rYES = 0x2, //res
|
||||
rOK = 0x4,
|
||||
rNO = 0x8, //res
|
||||
rCANCEL = 0x10,
|
||||
rYES_NO = 0xA,
|
||||
rNO_DEFAULT = 0x80,
|
||||
rICON_EXCLAMATION = 0x100,
|
||||
rICON_ERROR = 0x200,
|
||||
rICON_HAND = 0x200,
|
||||
rICON_QUESTION = 0x400,
|
||||
rICON_INFORMATION = 0x800,
|
||||
rHELP = 0x1000,
|
||||
rID_CANCEL = 0x13ED,
|
||||
rID_YES = 0x13EF, //resDialog
|
||||
rSTAY_ON_TOP = 0x8000,
|
||||
rICON_NONE = 0x40000,
|
||||
rICON_AUTH_NEEDED = 0x80000,
|
||||
rCANCEL_DEFAULT = 0x80000000,
|
||||
};
|
||||
|
||||
struct rMessageDialog
|
||||
{
|
||||
rMessageDialog(void *parent, const std::string& msg, const std::string& title = rMessageBoxCaptionStr, long style = rOK | rCENTRE);
|
||||
rMessageDialog(void *parent, const std::string& msg, const std::string& title = "RPCS3", long style = rOK | rCENTRE);
|
||||
rMessageDialog(const rMessageDialog& other) = delete;
|
||||
~rMessageDialog();
|
||||
long ShowModal();
|
||||
@ -37,11 +36,3 @@ struct rMessageDialog
|
||||
|
||||
long rMessageBox(const std::string& message, const std::string& title,long style);
|
||||
|
||||
struct dummyApp
|
||||
{
|
||||
dummyApp();
|
||||
std::string GetAppName();
|
||||
void* handle;
|
||||
};
|
||||
|
||||
dummyApp& rGetApp();
|
@ -40,7 +40,7 @@ bool vfsLocalDir::Open(const std::string& path)
|
||||
|
||||
bool vfsLocalDir::Create(const std::string& path)
|
||||
{
|
||||
return rFileName::Mkdir(path, 0777, rPATH_MKDIR_FULL);
|
||||
return rMkpath(path);
|
||||
}
|
||||
|
||||
bool vfsLocalDir::Rename(const std::string& from, const std::string& to)
|
||||
|
@ -1330,8 +1330,10 @@ static const std::string GetMethodName(const u32 id)
|
||||
{ NV4097_SET_TRANSFORM_BRANCH_BITS, "SetTransformBranchBits" } ,
|
||||
};
|
||||
|
||||
for(auto& s: METHOD_NAME_LIST)
|
||||
if(s.id == id) return "cellGcm" + s.name;
|
||||
for(auto& s: METHOD_NAME_LIST) {
|
||||
if(s.id == id)
|
||||
return "cellGcm" + s.name;
|
||||
}
|
||||
|
||||
return fmt::Format("unknown/illegal method [0x%08x]", id);
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
|
||||
|
||||
std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s",
|
||||
errorName.c_str(), errNeedSizeKB, dirName);
|
||||
rMessageBox(errorMsg, rGetApp().GetAppName(), rICON_ERROR | rOK);
|
||||
rMessageBox(errorMsg, "Error", rICON_ERROR | rOK);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -287,14 +287,12 @@ int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallba
|
||||
default: errorMessage = "An error has occurred."; break;
|
||||
}
|
||||
|
||||
char errorCodeHex[9];
|
||||
sprintf(errorCodeHex, "%08x", errorCode);
|
||||
errorMessage.append("\n(");
|
||||
char errorCodeHex[12];
|
||||
sprintf(errorCodeHex, "\n(%08x)", errorCode);
|
||||
errorMessage.append(errorCodeHex);
|
||||
errorMessage.append(")\n");
|
||||
|
||||
u64 status;
|
||||
int res = rMessageBox(errorMessage, rGetApp().GetAppName(), rICON_ERROR | rOK);
|
||||
int res = rMessageBox(errorMessage, "Error", rICON_ERROR | rOK);
|
||||
switch (res)
|
||||
{
|
||||
case rOK: status = CELL_MSGDIALOG_BUTTON_OK; break;
|
||||
|
@ -389,7 +389,7 @@ void CompilerELF::LoadElf(wxCommandEvent& event)
|
||||
"All Files (*.*)|*.*",
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
|
||||
if(ctrl.ShowModal() == wxID_CANCEL) return;
|
||||
if(ctrl.ShowModal() == rID_CANCEL) return;
|
||||
LoadElf(fmt::ToUTF8(ctrl.GetPath()));
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "GameViewer.h"
|
||||
#include "Loader/PSF.h"
|
||||
#include <wx/dir.h>
|
||||
|
||||
static const std::string m_class_name = "GameViewer";
|
||||
|
||||
@ -238,9 +239,9 @@ void GameViewer::RemoveGame(wxCommandEvent& event)
|
||||
|
||||
Emu.GetVFS().UnMountAll();
|
||||
|
||||
//TODO: Replace wxWidgetsSpecific filesystem stuff?
|
||||
if (!wxDirExists(fmt::FromUTF8(localPath)))
|
||||
if (!rFile::Exists(localPath))
|
||||
return;
|
||||
//TODO: Replace wxWidgetsSpecific filesystem stuff?
|
||||
WxDirDeleteTraverser deleter;
|
||||
wxDir localDir(localPath);
|
||||
localDir.Traverse(deleter);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "Gui/MainFrame.h"
|
||||
#include "Emu/DbgCommand.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include <wx/app.h>
|
||||
|
||||
class CPUThread;
|
||||
|
||||
|
@ -12,13 +12,9 @@
|
||||
#include <wx/config.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/propdlg.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/dcclient.h>
|
||||
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/datetime.h>
|
||||
#include <wx/filepicker.h>
|
||||
@ -32,8 +28,6 @@
|
||||
#include <wx/frame.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/aui/auibook.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user