2014-05-02 08:30:32 +02:00
|
|
|
#include "stdafx.h"
|
2014-09-07 09:49:25 +02:00
|
|
|
#include "restore_new.h"
|
2015-04-23 18:58:37 +02:00
|
|
|
#pragma warning(push)
|
|
|
|
#pragma message("TODO: remove wx dependency: <wx/image.h>")
|
2015-01-25 17:23:24 +01:00
|
|
|
#pragma warning(disable : 4996)
|
2014-08-29 00:49:26 +02:00
|
|
|
#include <wx/image.h>
|
2015-04-23 18:58:37 +02:00
|
|
|
#pragma warning(pop)
|
2014-09-07 09:49:25 +02:00
|
|
|
#include "define_new_memleakdetect.h"
|
2014-05-02 08:30:32 +02:00
|
|
|
|
2014-07-10 21:45:07 +02:00
|
|
|
#ifndef _WIN32
|
|
|
|
#include <dirent.h>
|
|
|
|
#endif
|
|
|
|
|
2014-08-24 19:42:19 +02:00
|
|
|
#include "rPlatform.h"
|
2014-05-02 08:30:32 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2015-07-02 03:54:36 +02:00
|
|
|
throw EXCEPTION("unsupported type");
|
2014-05-02 08:30:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-10 21:45:07 +02:00
|
|
|
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/";
|
2014-08-29 15:06:58 +02:00
|
|
|
mkdir(dir.c_str(), 0777);
|
2014-07-10 21:45:07 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return dir;
|
|
|
|
}
|