mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
5d5a4f804b
Also fix some Seek methods return types being unsigned, while returning negative errors. Added the CHECK_ASSERTION macro checks in a couple more places. Simplified CHECK_ASSERTION macro usage.
69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
#include "stdafx.h"
|
|
#include "restore_new.h"
|
|
#include "Utilities/Log.h"
|
|
#pragma warning(push)
|
|
#pragma message("TODO: remove wx dependency: <wx/image.h>")
|
|
#pragma warning(disable : 4996)
|
|
#include <wx/image.h>
|
|
#pragma warning(pop)
|
|
#include "define_new_memleakdetect.h"
|
|
|
|
#ifndef _WIN32
|
|
#include <dirent.h>
|
|
#include <errno.h>
|
|
#endif
|
|
|
|
#include "rPlatform.h"
|
|
|
|
rImage::rImage()
|
|
{
|
|
handle = static_cast<void*>(new wxImage());
|
|
}
|
|
|
|
rImage::~rImage()
|
|
{
|
|
delete static_cast<wxImage*>(handle);
|
|
}
|
|
|
|
void rImage::Create(int width, int height, void *data, void *alpha)
|
|
{
|
|
static_cast<wxImage*>(handle)->Create(width, height, static_cast<unsigned char*>(data), static_cast<unsigned char*>(alpha));
|
|
}
|
|
void rImage::SaveFile(const std::string& name, rImageType type)
|
|
{
|
|
if (type == rBITMAP_TYPE_PNG)
|
|
{
|
|
static_cast<wxImage*>(handle)->SaveFile(fmt::FromUTF8(name),wxBITMAP_TYPE_PNG);
|
|
}
|
|
else
|
|
{
|
|
throw EXCEPTION("unsupported type");
|
|
}
|
|
}
|
|
|
|
std::string rPlatform::getConfigDir()
|
|
{
|
|
static std::string dir = ".";
|
|
if (dir == ".")
|
|
{
|
|
#ifdef _WIN32
|
|
dir = "";
|
|
//mkdir(dir.c_str());
|
|
#else
|
|
if (getenv("XDG_CONFIG_HOME") != NULL)
|
|
dir = getenv("XDG_CONFIG_HOME");
|
|
else if (getenv("HOME") != NULL)
|
|
dir = getenv("HOME") + std::string("/.config");
|
|
else // Just in case
|
|
dir = "./config";
|
|
dir = dir + "/rpcs3/";
|
|
|
|
if (mkdir(dir.c_str(), 0777) == -1)
|
|
{
|
|
printf("An error occured during the creation of the configuration directory. (%d)", errno);
|
|
}
|
|
#endif
|
|
}
|
|
return dir;
|
|
}
|