Remove all edits not in the scope of this PR

This commit is contained in:
Daniel Lim Wee Soong 2018-03-16 12:17:14 +08:00
parent 373efd3158
commit 98e669cf00
14 changed files with 13 additions and 182 deletions

View file

@ -36,12 +36,8 @@
#define SDMC_DIR "sdmc"
#define NAND_DIR "nand"
#define SYSDATA_DIR "sysdata"
#define LOG_DIR "log"
// Filenames
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
#define LOG_FILE "citra_log.txt"
// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
#define EMU_CONFIG "emu.ini"
#define DEBUGGER_CONFIG "debugger.ini"

View file

@ -715,8 +715,6 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP;
// TODO: Put the logs in a better location for each OS
paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOG_DIR DIR_SEP;
}
if (!newPath.empty()) {
@ -803,8 +801,8 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
IOFile::IOFile() {}
IOFile::IOFile(const std::string& filename, const char openmode[], int flags) {
Open(filename, openmode, flags);
IOFile::IOFile(const std::string& filename, const char openmode[]) {
Open(filename, openmode);
}
IOFile::~IOFile() {
@ -825,16 +823,11 @@ void IOFile::Swap(IOFile& other) {
std::swap(m_good, other.m_good);
}
bool IOFile::Open(const std::string& filename, const char openmode[], int flags) {
bool IOFile::Open(const std::string& filename, const char openmode[]) {
Close();
#ifdef _WIN32
if (flags != 0) {
m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(),
Common::UTF8ToUTF16W(openmode).c_str(), flags);
} else {
_wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(),
Common::UTF8ToUTF16W(openmode).c_str());
}
_wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(),
Common::UTF8ToUTF16W(openmode).c_str());
#else
m_file = fopen(filename.c_str(), openmode);
#endif

View file

@ -156,8 +156,7 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
class IOFile : public NonCopyable {
public:
IOFile();
/// Opens the file. flags is for windows shared file settings and are ignored on other oses
IOFile(const std::string& filename, const char openmode[], int flags = 0);
IOFile(const std::string& filename, const char openmode[]);
~IOFile();
@ -166,7 +165,7 @@ public:
void Swap(IOFile& other);
bool Open(const std::string& filename, const char openmode[], int flags = 0);
bool Open(const std::string& filename, const char openmode[]);
bool Close();
template <typename T>
@ -225,10 +224,6 @@ public:
return WriteArray(&object, 1);
}
size_t WriteString(const std::string& str) {
return WriteArray(str.c_str(), str.length());
}
bool IsOpen() const {
return nullptr != m_file;
}

View file

@ -484,4 +484,5 @@ const char* TrimSourcePath(const char* path, const char* root) {
}
return path;
}
} // namespace Common

View file

@ -9,7 +9,6 @@
#include <algorithm>
#include <atomic>
#include <chrono>
#include <cstddef>
#include <mutex>
#include "common/common_types.h"
@ -37,10 +36,6 @@ public:
T& Front() const {
return read_ptr->current;
}
/**
* Push data to the queue. If NeedSize=True then Push will notify the waiting consumer thread
*/
template <typename Arg>
void Push(Arg&& t) {
// create the element, add it to the queue
@ -50,11 +45,8 @@ public:
ElementPtr* new_ptr = new ElementPtr();
write_ptr->next.store(new_ptr, std::memory_order_release);
write_ptr = new_ptr;
if (NeedSize) {
std::lock_guard<std::mutex> lock(size_lock);
if (NeedSize)
size++;
size_cv.notify_one();
}
}
void Pop() {
@ -83,25 +75,6 @@ public:
return true;
}
/**
* Waits up to timeout for data to be Pushed to the queue. Push uses a condition variable to
* signal the waiting thread, but only if NeedSize = true. Returns false if the timeout is
* triggered. If the condition variable is signalled, returns the value from Pop
* @param T In parameter to store the value if this method returns true
* @param timeout Time in milliseconds to wait for a signal from a Push
*/
bool PopWait(T& t, u64 timeout = 500) {
if (NeedSize) {
std::unique_lock<std::mutex> lock(size_lock);
if (size_cv.wait_for(lock, std::chrono::milliseconds(timeout),
[& size = size] { return size > 0; })) {
return Pop(t);
}
return false;
}
return Pop(t);
}
// not thread-safe
void Clear() {
size.store(0);
@ -129,9 +102,6 @@ private:
ElementPtr* write_ptr;
ElementPtr* read_ptr;
std::atomic<u32> size;
std::mutex size_lock;
std::condition_variable size_cv;
};
// a simple thread-safe,