mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-13 03:40:49 +00:00
o_append implemented
This commit is contained in:
parent
2f4d6fc2a1
commit
ed6fb7cc43
@ -404,11 +404,14 @@ bool rfile_t::open(const std::string& filename, u32 mode)
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD access = 0;
|
||||
switch (mode & (o_read | o_write))
|
||||
switch (mode & (o_read | o_write | o_append))
|
||||
{
|
||||
case o_read: access |= GENERIC_READ; break;
|
||||
case o_read | o_append: access |= GENERIC_READ; break;
|
||||
case o_write: access |= GENERIC_WRITE; break;
|
||||
case o_write | o_append: access |= FILE_APPEND_DATA; break;
|
||||
case o_read | o_write: access |= GENERIC_READ | GENERIC_WRITE; break;
|
||||
case o_read | o_write | o_append: access |= GENERIC_READ | FILE_APPEND_DATA; break;
|
||||
default:
|
||||
{
|
||||
LOG_ERROR(GENERAL, "rfile_t::open('%s') failed: neither o_read nor o_write specified (0x%x)", filename, mode);
|
||||
@ -427,7 +430,7 @@ bool rfile_t::open(const std::string& filename, u32 mode)
|
||||
case o_create | o_excl | o_trunc: disp = CREATE_NEW; break;
|
||||
}
|
||||
|
||||
if (!disp || (mode & ~(o_read | o_write | o_create | o_trunc | o_excl)))
|
||||
if (!disp || (mode & ~(o_read | o_write | o_append | o_create | o_trunc | o_excl)))
|
||||
{
|
||||
LOG_ERROR(GENERAL, "rfile_t::open('%s') failed: unknown mode specified (0x%x)", filename, mode);
|
||||
return false;
|
||||
@ -449,11 +452,12 @@ bool rfile_t::open(const std::string& filename, u32 mode)
|
||||
}
|
||||
}
|
||||
|
||||
if (mode & o_append) flags |= O_APPEND;
|
||||
if (mode & o_create) flags |= O_CREAT;
|
||||
if (mode & o_trunc) flags |= O_TRUNC;
|
||||
if (mode & o_excl) flags |= O_EXCL;
|
||||
|
||||
if (((mode & o_excl) && !(mode & o_create)) || (mode & ~(o_read | o_write | o_create | o_trunc | o_excl)))
|
||||
if (((mode & o_excl) && !(mode & o_create)) || (mode & ~(o_read | o_write | o_append | o_create | o_trunc | o_excl)))
|
||||
{
|
||||
LOG_ERROR(GENERAL, "rfile_t::open('%s') failed: unknown mode specified (0x%x)", filename, mode);
|
||||
return false;
|
||||
@ -538,15 +542,17 @@ bool rfile_t::close()
|
||||
#ifdef _WIN32
|
||||
if (CloseHandle(fd))
|
||||
{
|
||||
fd = INVALID_HANDLE_VALUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
fd = INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
if (!::close(fd))
|
||||
{
|
||||
fd = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
fd = -1;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
@ -34,9 +34,10 @@ enum rfile_open_mode : u32
|
||||
{
|
||||
o_read = 1 << 0,
|
||||
o_write = 1 << 1,
|
||||
o_create = 1 << 2,
|
||||
o_trunc = 1 << 3,
|
||||
o_excl = 1 << 4,
|
||||
o_append = 1 << 2,
|
||||
o_create = 1 << 3,
|
||||
o_trunc = 1 << 4,
|
||||
o_excl = 1 << 5,
|
||||
};
|
||||
|
||||
struct rfile_t final
|
||||
|
@ -7,9 +7,6 @@
|
||||
#include "Emu/System.h"
|
||||
#include "Utilities/Log.h"
|
||||
|
||||
#undef CreateFile
|
||||
#undef CopyFile
|
||||
|
||||
std::vector<std::string> simplify_path_blocks(const std::string& path)
|
||||
{
|
||||
// fmt::tolower() removed
|
||||
|
@ -45,9 +45,6 @@ struct VFSManagerEntry
|
||||
std::vector<std::string> simplify_path_blocks(const std::string& path);
|
||||
std::string simplify_path(const std::string& path, bool is_dir, bool is_ps3);
|
||||
|
||||
#undef CreateFile
|
||||
#undef CopyFile
|
||||
|
||||
struct VFS
|
||||
{
|
||||
~VFS();
|
||||
|
@ -6,15 +6,15 @@
|
||||
|
||||
extern Module cellAvconfExt;
|
||||
|
||||
int cellVideoOutConvertCursorColor()
|
||||
s32 cellVideoOutConvertCursorColor()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAvconfExt);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize)
|
||||
s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize)
|
||||
{
|
||||
cellAvconfExt.Warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize_addr=0x%x)", videoOut, screenSize.addr());
|
||||
cellAvconfExt.Warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize=*0x%x)", videoOut, screenSize);
|
||||
|
||||
if (videoOut != CELL_VIDEO_OUT_PRIMARY)
|
||||
{
|
||||
@ -23,8 +23,8 @@ int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize)
|
||||
|
||||
//TODO: Use virtual screen size
|
||||
#ifdef _WIN32
|
||||
HDC screen = GetDC(NULL);
|
||||
float diagonal = roundf(sqrtf((powf(float(GetDeviceCaps(screen, HORZSIZE)), 2) + powf(float(GetDeviceCaps(screen, VERTSIZE)), 2))) * 0.0393f);
|
||||
//HDC screen = GetDC(NULL);
|
||||
//float diagonal = roundf(sqrtf((powf(float(GetDeviceCaps(screen, HORZSIZE)), 2) + powf(float(GetDeviceCaps(screen, VERTSIZE)), 2))) * 0.0393f);
|
||||
#else
|
||||
// TODO: Linux implementation, without using wx
|
||||
// float diagonal = roundf(sqrtf((powf(wxGetDisplaySizeMM().GetWidth(), 2) + powf(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393f);
|
||||
@ -32,22 +32,20 @@ int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize)
|
||||
|
||||
if (Ini.GS3DTV.GetValue())
|
||||
{
|
||||
#ifdef _WIN32
|
||||
*screenSize = diagonal;
|
||||
#endif
|
||||
*screenSize = 24.0f;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
return CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET;
|
||||
}
|
||||
|
||||
int cellVideoOutGetGamma()
|
||||
s32 cellVideoOutGetGamma()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAvconfExt);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellVideoOutSetGamma()
|
||||
s32 cellVideoOutSetGamma()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAvconfExt);
|
||||
return CELL_OK;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/rPlatform.h"
|
||||
#include "Utilities/StrFmt.h"
|
||||
#include "Utilities/simpleini/SimpleIni.h"
|
||||
|
||||
#include "Ini.h"
|
||||
#include <cctype>
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
#define DEF_CONFIG_NAME "./rpcs3.ini"
|
||||
|
||||
//TODO: make thread safe/remove static singleton
|
||||
CSimpleIniCaseA *getIniFile()
|
||||
{
|
||||
static bool inited = false;
|
||||
@ -98,7 +99,7 @@ static std::string WindowInfoToString(const WindowInfo& wind)
|
||||
//Ini
|
||||
Ini::Ini()
|
||||
{
|
||||
m_Config = getIniFile();
|
||||
m_config = getIniFile();
|
||||
}
|
||||
|
||||
Ini::~Ini()
|
||||
@ -109,55 +110,55 @@ Ini::~Ini()
|
||||
//TODO: saving the file after each change seems like overkill but that's how wx did it
|
||||
void Ini::Save(const std::string& section, const std::string& key, int value)
|
||||
{
|
||||
m_Config->SetLongValue(section.c_str(), key.c_str(), value);
|
||||
static_cast<CSimpleIniCaseA*>(m_config)->SetLongValue(section.c_str(), key.c_str(), value);
|
||||
saveIniFile();
|
||||
}
|
||||
|
||||
void Ini::Save(const std::string& section, const std::string& key, bool value)
|
||||
{
|
||||
m_Config->SetBoolValue(section.c_str(), key.c_str(), value);
|
||||
static_cast<CSimpleIniCaseA*>(m_config)->SetBoolValue(section.c_str(), key.c_str(), value);
|
||||
saveIniFile();
|
||||
}
|
||||
|
||||
void Ini::Save(const std::string& section, const std::string& key, std::pair<int, int> value)
|
||||
{
|
||||
m_Config->SetValue(section.c_str(), key.c_str(), SizeToString(value).c_str());
|
||||
static_cast<CSimpleIniCaseA*>(m_config)->SetValue(section.c_str(), key.c_str(), SizeToString(value).c_str());
|
||||
saveIniFile();
|
||||
}
|
||||
|
||||
void Ini::Save(const std::string& section, const std::string& key, const std::string& value)
|
||||
{
|
||||
m_Config->SetValue(section.c_str(), key.c_str(), value.c_str());
|
||||
static_cast<CSimpleIniCaseA*>(m_config)->SetValue(section.c_str(), key.c_str(), value.c_str());
|
||||
saveIniFile();
|
||||
}
|
||||
|
||||
void Ini::Save(const std::string& section, const std::string& key, WindowInfo value)
|
||||
{
|
||||
m_Config->SetValue(section.c_str(), key.c_str(), WindowInfoToString(value).c_str());
|
||||
static_cast<CSimpleIniCaseA*>(m_config)->SetValue(section.c_str(), key.c_str(), WindowInfoToString(value).c_str());
|
||||
saveIniFile();
|
||||
}
|
||||
|
||||
int Ini::Load(const std::string& section, const std::string& key, const int def_value)
|
||||
{
|
||||
return m_Config->GetLongValue(section.c_str(), key.c_str(), def_value);
|
||||
return static_cast<CSimpleIniCaseA*>(m_config)->GetLongValue(section.c_str(), key.c_str(), def_value);
|
||||
}
|
||||
|
||||
bool Ini::Load(const std::string& section, const std::string& key, const bool def_value)
|
||||
{
|
||||
return StringToBool(m_Config->GetValue(section.c_str(), key.c_str(), BoolToString(def_value).c_str()));
|
||||
return StringToBool(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), BoolToString(def_value).c_str()));
|
||||
}
|
||||
|
||||
std::pair<int, int> Ini::Load(const std::string& section, const std::string& key, const std::pair<int, int> def_value)
|
||||
{
|
||||
return StringToSize(m_Config->GetValue(section.c_str(), key.c_str(), SizeToString(def_value).c_str()));
|
||||
return StringToSize(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), SizeToString(def_value).c_str()));
|
||||
}
|
||||
|
||||
std::string Ini::Load(const std::string& section, const std::string& key, const std::string& def_value)
|
||||
{
|
||||
return std::string(m_Config->GetValue(section.c_str(), key.c_str(), def_value.c_str()));
|
||||
return std::string(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), def_value.c_str()));
|
||||
}
|
||||
|
||||
WindowInfo Ini::Load(const std::string& section, const std::string& key, const WindowInfo& def_value)
|
||||
{
|
||||
return StringToWindowInfo(m_Config->GetValue(section.c_str(), key.c_str(), WindowInfoToString(def_value).c_str()));
|
||||
return StringToWindowInfo(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), WindowInfoToString(def_value).c_str()));
|
||||
}
|
||||
|
@ -1,11 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include "Utilities/simpleini/SimpleIni.h"
|
||||
|
||||
//TODO: make thread safe/remove static singleton
|
||||
CSimpleIniCaseA *getIniFile();
|
||||
|
||||
//TODO: move this to the gui module
|
||||
struct WindowInfo
|
||||
{
|
||||
@ -26,7 +20,7 @@ public:
|
||||
virtual ~Ini();
|
||||
|
||||
protected:
|
||||
CSimpleIniCaseA *m_Config;
|
||||
void* m_config;
|
||||
|
||||
Ini();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user