summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2013-02-19 23:19:29 +1100
committerskidau <skidau@gmail.com>2013-02-19 23:19:29 +1100
commit351c74190689368e463c42da4cf49a3df2d40ee5 (patch)
treea65fefc0cffab96064046a707e28fa24eeeb052a /Source/Core/Common
parent0e2c3f3483e230079b5b6107d3cc634f60d92c78 (diff)
parent718a1b5dedd7e2d3c9905b72a40080addd14b16e (diff)
Merge branch 'master' into FIFO-BP
# By Jordan Woyak (9) and others * master: Fixed a buffer overflow in the OpenAL buffer. TextureCache: Fix D3D backends crashing when a game uses multiple 1x1-sized LODs. WII_IPC_HLE_Device_FileIO: don't rebuild the filename on every operation. Some cleanup of CWII_IPC_HLE_Device_FileIO: The real file was never kept open for longer than a single operation so there was no point in dealing with it in DoState. Saving the real path in the savestate was also probably a bad idea. Savestates should be a bit more portable now. Removing destination on rename when source isn't present doesn't make sense. IOCTL_RENAME_FILE still might not be totally correct. Change some CNANDContentLoader logic to what was probably intended. Kills some warn logs when opening Dolphin. Let's not CreateDir an empty string every time CreateFullPath is used, logging an error every time. Fix a memleak. Probably/maybe improve USBGecko performance. Remove the core count from the cpu info OSD message. It was often wrong and not rather important. Use omp_get_num_procs to set the number of OpenMP threads rather than our core count detection. Bulk send TCP data to the client with the emulated USB Gecko. Added the ability to reverse the direction of the force feedback by allowing negative range values. Changes/cleanup to TextureCache::Load and other mipmap related code. The significant change is what is now line 520 of TextureCacheBase.cpp: ((std::max(mipWidth, bsw) * std::max(mipHeight, bsh) * bsdepth) >> 1) to TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat);
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/CPUDetect.cpp9
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp24
-rw-r--r--Source/Core/Common/Src/FileUtil.h8
3 files changed, 30 insertions, 11 deletions
diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp
index 65cd6dbd0b..282929e7b2 100644
--- a/Source/Core/Common/Src/CPUDetect.cpp
+++ b/Source/Core/Common/Src/CPUDetect.cpp
@@ -205,14 +205,7 @@ void CPUInfo::Detect()
// Turn the cpu info into a string we can show
std::string CPUInfo::Summarize()
{
- std::string sum;
- if (num_cores == 1)
- sum = StringFromFormat("%s, %i core", cpu_string, num_cores);
- else
- {
- sum = StringFromFormat("%s, %i cores", cpu_string, num_cores);
- if (HTT) sum += StringFromFormat(" (%i logical threads per physical core)", logical_cpu_count);
- }
+ std::string sum(cpu_string);
if (bSSE) sum += ", SSE";
if (bSSE2) sum += ", SSE2";
if (bSSE3) sum += ", SSE3";
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index d74c99b7a2..d6ab33962a 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -42,6 +42,7 @@
#endif
#include <fstream>
+#include <algorithm>
#include <sys/stat.h>
#ifndef S_ISDIR
@@ -196,8 +197,9 @@ bool CreateFullPath(const std::string &fullPath)
// we're done, yay!
if (position == fullPath.npos)
return true;
-
- std::string subPath = fullPath.substr(0, position);
+
+ // Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
+ std::string const subPath(fullPath.substr(0, position + 1));
if (!File::IsDirectory(subPath))
File::CreateDir(subPath);
@@ -773,6 +775,24 @@ IOFile::~IOFile()
Close();
}
+IOFile::IOFile(IOFile&& other)
+ : m_file(NULL), m_good(true)
+{
+ Swap(other);
+}
+
+IOFile& IOFile::operator=(IOFile other)
+{
+ Swap(other);
+ return *this;
+}
+
+void IOFile::Swap(IOFile& other)
+{
+ std::swap(m_file, other.m_file);
+ std::swap(m_good, other.m_good);
+}
+
bool IOFile::Open(const std::string& filename, const char openmode[])
{
Close();
diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h
index 451b1b6929..2c8bf8f64b 100644
--- a/Source/Core/Common/Src/FileUtil.h
+++ b/Source/Core/Common/Src/FileUtil.h
@@ -150,7 +150,7 @@ bool ReadFileToString(bool text_file, const char *filename, std::string &str);
// simple wrapper for cstdlib file functions to
// hopefully will make error checking easier
// and make forgetting an fclose() harder
-class IOFile : NonCopyable
+class IOFile
{
public:
IOFile();
@@ -158,6 +158,11 @@ public:
IOFile(const std::string& filename, const char openmode[]);
~IOFile();
+
+ IOFile(IOFile&& other);
+ IOFile& operator=(IOFile other);
+
+ void Swap(IOFile& other);
bool Open(const std::string& filename, const char openmode[]);
bool Close();
@@ -212,6 +217,7 @@ public:
void Clear() { m_good = true; std::clearerr(m_file); }
private:
+ IOFile(const IOFile&) /*= delete*/;
IOFile& operator=(const IOFile&) /*= delete*/;
std::FILE* m_file;