diff --git a/Utilities/Array.h b/Utilities/Array.h deleted file mode 100644 index 0855fdbdc7..0000000000 --- a/Utilities/Array.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -template class SizedStack -{ - T m_ptr[size]; - uint m_count; - -public: - SizedStack() - { - Clear(); - } - - ~SizedStack() - { - Clear(); - } - - void Clear() - { - m_count = 0; - } - - bool Pop(T& dst) - { - if(!m_count) - return false; - - dst = m_ptr[--m_count]; - return true; - } - - bool Push(const T& src) - { - if(m_count + 1 > size) - return false; - - m_ptr[m_count++] = src; - return true; - } - - size_t GetFreeCount() const - { - return size - m_count; - } - - size_t GetCount() const - { - return m_count; - } - - size_t GetMaxCount() const - { - return size; - } -}; - -template struct ScopedPtr -{ -private: - T* m_ptr; - -public: - ScopedPtr() : m_ptr(nullptr) - { - } - - ScopedPtr(T* ptr) : m_ptr(ptr) - { - } - - ~ScopedPtr() - { - Swap(nullptr); - } - - operator T*() { return m_ptr; } - operator const T*() const { return m_ptr; } - - T* operator ->() { return m_ptr; } - const T* operator ->() const { return m_ptr; } - - void Swap(T* ptr) - { - delete m_ptr; - m_ptr = ptr; - } -}; diff --git a/Utilities/GNU.cpp b/Utilities/GNU.cpp index bb0a784fe7..9f21a344ba 100644 --- a/Utilities/GNU.cpp +++ b/Utilities/GNU.cpp @@ -1,20 +1,23 @@ -#include -#include #include "GNU.h" #ifdef __APPLE__ -void * _aligned_malloc(size_t size, size_t alignment) { - void *buffer; - posix_memalign(&buffer, alignment, size); - return buffer; -} +#include +#include int clock_gettime(int foo, struct timespec *ts) { - struct timeval tv; + struct timeval tv; - gettimeofday(&tv, NULL); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * 1000; - return(0); + gettimeofday(&tv, NULL); + ts->tv_sec = tv.tv_sec; + ts->tv_nsec = tv.tv_usec * 1000; + return(0); } -#endif /* !__APPLE__ */ +#endif /* __APPLE__ */ +#if defined(__GNUG__) + +void * _aligned_malloc(size_t size, size_t alignment) { + void *buffer; + return (posix_memalign(&buffer, alignment, size) == 0) ? buffer : 0; +} +#endif + diff --git a/Utilities/GNU.h b/Utilities/GNU.h index a79dfbf3d0..c0286b0491 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -28,7 +28,6 @@ void strcpy_trunc(char (&dst)[size], const std::string& src) #define _byteswap_ushort(x) __builtin_bswap16(x) #define _byteswap_ulong(x) __builtin_bswap32(x) #define _byteswap_uint64(x) __builtin_bswap64(x) -#define Sleep(x) usleep(x * 1000) #define mkdir(x) mkdir(x, 0777) #define INFINITE 0xFFFFFFFF #define _CRT_ALIGN(x) __attribute__((aligned(x))) @@ -61,10 +60,10 @@ inline int64_t __mulh(int64_t a, int64_t b) return result; } -#ifndef __APPLE__ -#define _aligned_malloc(size,alignment) memalign(alignment,size) -#else + void * _aligned_malloc(size_t size, size_t alignment); + +#ifdef __APPLE__ int clock_gettime(int foo, struct timespec *ts); #define wxIsNaN(x) ((x) != (x)) @@ -72,7 +71,7 @@ int clock_gettime(int foo, struct timespec *ts); #define CLOCK_MONOTONIC 0 #endif /* !CLOCK_MONOTONIC */ -#endif /* !__APPLE__ */ +#endif /* __APPLE__ */ #define _aligned_free free diff --git a/Utilities/Log.cpp b/Utilities/Log.cpp index 8361dcbf9d..4613e39e8a 100644 --- a/Utilities/Log.cpp +++ b/Utilities/Log.cpp @@ -104,7 +104,7 @@ struct FileListener : LogListener { if (!mFile.IsOpened()) { - rMessageBox("Can't create log file! (" + name + ".log)", rMessageBoxCaptionStr, rICON_ERROR); + rMessageBox("Can't create log file! (" + name + ".log)", "Error", rICON_ERROR); } } diff --git a/Utilities/SMutex.cpp b/Utilities/SMutex.cpp index 157e9103f0..80c8798941 100644 --- a/Utilities/SMutex.cpp +++ b/Utilities/SMutex.cpp @@ -14,7 +14,7 @@ __forceinline void SM_Sleep() } else { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } diff --git a/Utilities/SSemaphore.cpp b/Utilities/SSemaphore.cpp index 47e9c76079..37c3cc6faa 100644 --- a/Utilities/SSemaphore.cpp +++ b/Utilities/SSemaphore.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/SSemaphore.h" +#include "Emu/System.h" void SSemaphore::wait() { @@ -84,4 +85,4 @@ bool SSemaphore::post_and_wait() wait(); return true; -} \ No newline at end of file +} diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 38912a139a..a98d8c6b63 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Emu/Memory/Memory.h" #include "Thread.h" diff --git a/Utilities/Thread.h b/Utilities/Thread.h index 4485227e2d..f38ff73162 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -1,5 +1,4 @@ #pragma once -#include "Array.h" #include #include #include @@ -8,6 +7,13 @@ #include #include +static std::thread::id main_thread; + +struct rThread +{ + static bool IsMain() { std::this_thread::get_id() == main_thread; } +}; + class ThreadExec; class NamedThreadBase @@ -171,7 +177,7 @@ private: Step(); } - while(!TestDestroy()) Sleep(0); + while(!TestDestroy()) std::this_thread::sleep_for(std::chrono::milliseconds(0)); if(m_destroy_sem.TryWait() != wxSEMA_NO_ERROR) m_destroy_sem.Post(); } @@ -192,7 +198,7 @@ public: { if(!IsRunning()) return; - while(m_main_sem.TryWait() != wxSEMA_NO_ERROR) Sleep(0); + while(m_main_sem.TryWait() != wxSEMA_NO_ERROR) std::this_thread::sleep_for(std::chrono::milliseconds(0)); } void Exit(bool wait = false) diff --git a/Utilities/rConcurrency.cpp b/Utilities/rConcurrency.cpp deleted file mode 100644 index c36f70e486..0000000000 --- a/Utilities/rConcurrency.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "stdafx.h" - -rTimer::rTimer() -{ - handle = reinterpret_cast(new wxTimer()); -} - -rTimer::~rTimer() -{ - delete reinterpret_cast(handle); -} - -void rTimer::Start() -{ - reinterpret_cast(handle)->Start(); -} - -void rTimer::Stop() -{ - reinterpret_cast(handle)->Stop(); -} - -void rSleep(u32 time) -{ - wxSleep(time); -} - -void rMicroSleep(u64 time) -{ - wxMicroSleep(time); -} - -bool rThread::IsMain() -{ - return wxThread::IsMain(); -} - -void rYieldIfNeeded() -{ - wxYieldIfNeeded(); -} \ No newline at end of file diff --git a/Utilities/rConcurrency.h b/Utilities/rConcurrency.h deleted file mode 100644 index 8504daef1b..0000000000 --- a/Utilities/rConcurrency.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -struct rTimer -{ - rTimer(); - rTimer(const rTimer& other) = delete; - ~rTimer(); - void Start(); - void Stop(); -private: - void *handle; -}; - -void rSleep(u32 time); -void rMicroSleep(u64 time); - -struct rThread -{ - static bool IsMain(); -}; - -void rYieldIfNeeded(); \ No newline at end of file diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp index 40cd2e0c49..0973fae502 100644 --- a/Utilities/rFile.cpp +++ b/Utilities/rFile.cpp @@ -1,6 +1,19 @@ #include "stdafx.h" +#include -const int rPATH_MKDIR_FULL = wxPATH_MKDIR_FULL; +#ifdef _WIN32 +// Maybe in StrFmt? +std::wstring ConvertUTF8ToWString(const std::string &source) { + int len = (int)source.size(); + int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, NULL, 0); + std::wstring str; + str.resize(size); + if (size > 0) { + MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, &str[0], size); + } + return str; +} +#endif wxFile::OpenMode convertOpenMode(rFile::OpenMode open) { @@ -140,7 +153,13 @@ bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access) bool rFile::Exists(const std::string &file) { - return wxFile::Exists(fmt::FromUTF8(file)); +#ifdef _WIN32 + std::wstring wstr = ConvertUTF8ToWString(filename); + return GetFileAttributes(wstr.c_str()) != 0xFFFFFFFF; +#else + struct stat buffer; + return (stat (file.c_str(), &buffer) == 0); +#endif } bool rFile::IsOpened() const @@ -173,14 +192,25 @@ std::string rGetCwd() return fmt::ToUTF8(wxGetCwd()); } -bool rMkdir(const std::string &path) +bool rMkdir(const std::string &dir) { - return wxMkdir(fmt::FromUTF8(path)); + return mkdir(dir.c_str()); } -bool rRmdir(const std::string &path) +bool rMkpath(const std::string& path) { - return wxRmdir(fmt::FromUTF8(path)); + return wxFileName::Mkdir(fmt::FromUTF8(path), 0777, wxPATH_MKDIR_FULL); +} + +bool rRmdir(const std::string &dir) +{ +#ifdef _WIN32 + if (!RemoveDirectory(ConvertUTF8ToWString(dir).c_str())) { + ELOG("Error deleting directory %s: %i", dir, GetLastError()); + } +#else + rmdir(dir.c_str()); +#endif } bool rDirExists(const std::string &path) @@ -235,7 +265,7 @@ bool rDir::Open(const std::string& path) bool rDir::Exists(const std::string &path) { - return wxDir::Exists(fmt::FromUTF8(path)); + return rFile::Exists(path); } bool rDir::GetFirst(std::string *filename) const @@ -299,11 +329,6 @@ std::string rFileName::GetFullName() return fmt::ToUTF8(reinterpret_cast(handle)->GetFullName()); } -bool rFileName::Mkdir(const std::string& name, int permissions , int flags ) -{ - return wxFileName::Mkdir(fmt::FromUTF8(name), permissions, flags); -} - bool rFileName::Normalize() { return reinterpret_cast(handle)->Normalize(); diff --git a/Utilities/rFile.h b/Utilities/rFile.h index cf4da0c284..35cb332661 100644 --- a/Utilities/rFile.h +++ b/Utilities/rFile.h @@ -2,8 +2,6 @@ #include -extern const int rPATH_MKDIR_FULL; - enum rSeekMode { rFromStart, @@ -44,8 +42,9 @@ public: }; std::string rGetCwd(); -bool rMkdir(const std::string &path); -bool rRmdir(const std::string &path); +bool rRmdir(const std::string& dir); +bool rMkdir(const std::string& dir); +bool rMkpath(const std::string& path); bool rDirExists(const std::string &path); bool rFileExists(const std::string &path); bool rRemoveFile(const std::string &path); @@ -77,7 +76,6 @@ struct rFileName std::string GetPath(); std::string GetName(); std::string GetFullName(); - static bool Mkdir(const std::string& name, int permissions=0777, int flags=0); bool Normalize(); void *handle; diff --git a/Utilities/rMsgBox.cpp b/Utilities/rMsgBox.cpp index bdc9fa4b07..716464a156 100644 --- a/Utilities/rMsgBox.cpp +++ b/Utilities/rMsgBox.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" - -std::string rMessageBoxCaptionStr = "Message"; - +#ifndef QT_UI rMessageDialog::rMessageDialog(void *parent, const std::string& msg, const std::string& title , long style ) { handle = reinterpret_cast(new wxMessageDialog( @@ -28,24 +26,5 @@ long rMessageBox(const std::string& message, const std::string& title, long styl return wxMessageBox(fmt::FromUTF8(message), fmt::FromUTF8(title),style); } -std::string dummyApp::GetAppName() -{ - if (handle) - { - return fmt::ToUTF8(reinterpret_cast(handle)->GetAppName()); - } - else - { - return "NULL"; - } -} -dummyApp::dummyApp() : handle(nullptr) -{ +#endif -} -static dummyApp app; - -dummyApp& rGetApp() -{ - return app; -} \ No newline at end of file diff --git a/Utilities/rMsgBox.h b/Utilities/rMsgBox.h index 354c850141..f19081fe5c 100644 --- a/Utilities/rMsgBox.h +++ b/Utilities/rMsgBox.h @@ -1,34 +1,33 @@ #pragma once -extern std::string rMessageBoxCaptionStr;// = "Message"; - enum MsgBoxParams : unsigned long { - rOK = 0x4 - , rYES =0x2//res - , rNO = 0x8 //res - , rID_YES = 5103 //resDialog - , rCANCEL = 0x10 - , rYES_NO = 0xA - , rHELP = 0x1000 - , rNO_DEFAULT = 0x80 - , rCANCEL_DEFAULT = 0x80000000 - , rYES_DEFAULT = 0x0 - , rOK_DEFAULT = 0x0 - , rICON_NONE = 0x40000 - , rICON_EXCLAMATION = 0x100 - , rICON_ERROR = 0x200 - , rICON_HAND = 0x200 - , rICON_QUESTION = 0x400 - , rICON_INFORMATION = 0x800 - , rICON_AUTH_NEEDED = 0x80000 - , rSTAY_ON_TOP = 0x8000 - , rCENTRE = 0x1 + rYES_DEFAULT = 0x0, + rOK_DEFAULT = 0x0, + rCENTRE = 0x1, + rYES = 0x2, //res + rOK = 0x4, + rNO = 0x8, //res + rCANCEL = 0x10, + rYES_NO = 0xA, + rNO_DEFAULT = 0x80, + rICON_EXCLAMATION = 0x100, + rICON_ERROR = 0x200, + rICON_HAND = 0x200, + rICON_QUESTION = 0x400, + rICON_INFORMATION = 0x800, + rHELP = 0x1000, + rID_CANCEL = 0x13ED, + rID_YES = 0x13EF, //resDialog + rSTAY_ON_TOP = 0x8000, + rICON_NONE = 0x40000, + rICON_AUTH_NEEDED = 0x80000, + rCANCEL_DEFAULT = 0x80000000, }; struct rMessageDialog { - rMessageDialog(void *parent, const std::string& msg, const std::string& title = rMessageBoxCaptionStr, long style = rOK | rCENTRE); + rMessageDialog(void *parent, const std::string& msg, const std::string& title = "RPCS3", long style = rOK | rCENTRE); rMessageDialog(const rMessageDialog& other) = delete; ~rMessageDialog(); long ShowModal(); @@ -37,11 +36,3 @@ struct rMessageDialog long rMessageBox(const std::string& message, const std::string& title,long style); -struct dummyApp -{ - dummyApp(); - std::string GetAppName(); - void* handle; -}; - -dummyApp& rGetApp(); \ No newline at end of file diff --git a/Utilities/rXml.cpp b/Utilities/rXml.cpp index 62da3d4c0c..0a8fabf51c 100644 --- a/Utilities/rXml.cpp +++ b/Utilities/rXml.cpp @@ -2,6 +2,7 @@ #include +#include "Utilities/rXml.h" #include rXmlNode::rXmlNode() diff --git a/Utilities/simpleini/ConvertUTF.h b/Utilities/simpleini/ConvertUTF.h index 14d7b70dca..4c8ab6086b 100644 --- a/Utilities/simpleini/ConvertUTF.h +++ b/Utilities/simpleini/ConvertUTF.h @@ -1,3 +1,5 @@ +#pragma once + /* * Copyright 2001-2004 Unicode, Inc. * diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 956b612d2b..5e713720d4 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -66,8 +66,6 @@ ${wxWidgets_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR} "${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/include" "${RPCS3_SRC_DIR}" -"${RPCS3_SRC_DIR}/Emu" -"${RPCS3_SRC_DIR}/Gui" "${RPCS3_SRC_DIR}/Loader" "${RPCS3_SRC_DIR}/Crypto" "${RPCS3_SRC_DIR}/.." diff --git a/rpcs3/Crypto/aes.h b/rpcs3/Crypto/aes.h index 7a9c20a567..6d85edc369 100644 --- a/rpcs3/Crypto/aes.h +++ b/rpcs3/Crypto/aes.h @@ -1,3 +1,5 @@ +#pragma once + /** * \file aes.h * @@ -174,4 +176,4 @@ void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/rpcs3/Crypto/lz.h b/rpcs3/Crypto/lz.h index 78cce623b6..c27192624c 100644 --- a/rpcs3/Crypto/lz.h +++ b/rpcs3/Crypto/lz.h @@ -1,3 +1,4 @@ +#pragma once #include int decode_range(unsigned int *range, unsigned int *code, unsigned char **src); diff --git a/rpcs3/Crypto/sha1.h b/rpcs3/Crypto/sha1.h index 9272d94746..84d4bd80d2 100644 --- a/rpcs3/Crypto/sha1.h +++ b/rpcs3/Crypto/sha1.h @@ -1,3 +1,4 @@ +#pragma once /** * \file sha1.h * @@ -158,4 +159,4 @@ void sha1_hmac( const unsigned char *key, size_t keylen, #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/rpcs3/Emu/Audio/AL/OpenALThread.cpp b/rpcs3/Emu/Audio/AL/OpenALThread.cpp index 9ed92f04e3..5d24514d46 100644 --- a/rpcs3/Emu/Audio/AL/OpenALThread.cpp +++ b/rpcs3/Emu/Audio/AL/OpenALThread.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Emu/System.h" #include "rpcs3/Ini.h" #include "OpenALThread.h" diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index df917d11aa..406721651a 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -3,6 +3,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/DbgCommand.h" #include "rpcs3/Ini.h" #include "CPUThread.h" @@ -333,7 +334,7 @@ void CPUThread::Task() if (status == CPUThread_Sleeping) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } @@ -368,7 +369,7 @@ s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) LOG_WARNING(PPU, "ExecAsCallback() aborted"); return CELL_ECANCELED; // doesn't mean anything } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } Stop(); @@ -394,7 +395,7 @@ s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) LOG_WARNING(PPU, "ExecAsCallback(wait=%s) aborted", wait ? "true" : "false"); return CELL_EABORT; // doesn't mean anything } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return wait * m_exit_status; diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index 87d9b9963d..c7db9d1c0d 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -153,7 +153,7 @@ public: { while(func(ThreadStatus())) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } diff --git a/rpcs3/Emu/CPU/CPUThreadManager.cpp b/rpcs3/Emu/CPU/CPUThreadManager.cpp index 245e01875f..01ba798add 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.cpp +++ b/rpcs3/Emu/CPU/CPUThreadManager.cpp @@ -2,6 +2,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/DbgCommand.h" #include "CPUThreadManager.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index e5b8e8bc47..3c8362178d 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -3,7 +3,6 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/Cell/PPUDecoder.h" diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index 57b65474aa..6a183fb0dc 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -1,7 +1,5 @@ -#ifndef PPUTHREAD_H -#define PPUTHREAD_H +#pragma once #include "Emu/Cell/PPCThread.h" -#include "Emu/SysCalls/SysCalls.h" #include enum @@ -861,4 +859,4 @@ protected: }; PPUThread& GetCurrentPPUThread(); -#endif //PPUTHREAD_H + diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index 2b0ab6c68e..4f81ccf513 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -105,7 +105,8 @@ bool RawSPUThread::Read32(const u64 addr, u32* value) case SPU_In_MBox_offs: { LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(SPU_In_MBox)", m_index); - while (!SPU.In_MBox.Pop(*value) && !Emu.IsStopped()) Sleep(1); + while (!SPU.In_MBox.Pop(*value) && !Emu.IsStopped()) + std::this_thread::sleep_for(std::chrono::milliseconds(1)); break; } @@ -250,7 +251,8 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value) case SPU_Out_MBox_offs: { LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_Out_MBox, 0x%x)", m_index, value); - while (!SPU.Out_MBox.Push(value) && !Emu.IsStopped()) Sleep(1); + while (!SPU.Out_MBox.Push(value) && !Emu.IsStopped()) + std::this_thread::sleep_for(std::chrono::milliseconds(1)); break; } diff --git a/rpcs3/Emu/Cell/SPURSManager.h b/rpcs3/Emu/Cell/SPURSManager.h index 9ad7ec0a4b..ff7a2b7ff5 100644 --- a/rpcs3/Emu/Cell/SPURSManager.h +++ b/rpcs3/Emu/Cell/SPURSManager.h @@ -1,5 +1,7 @@ #pragma once +#include "Emu/Memory/Memory.h" + // SPURS defines. enum SPURSKernelInterfaces { diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 502e754c5d..a8355bc296 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1,11 +1,9 @@ #include "stdafx.h" #include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/lv2/sys_lwmutex.h" #include "Emu/SysCalls/lv2/sys_event.h" - #include "Emu/Cell/SPUThread.h" #include "Emu/Cell/SPUDecoder.h" #include "Emu/Cell/SPUInterpreter.h" diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index b0e70f8da2..a5f848ce65 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -2,6 +2,8 @@ #include "PPCThread.h" #include "Emu/Event.h" #include "Emu/SysCalls/lv2/sys_spu.h" +#include "Emu/SysCalls/lv2/sys_event.h" +#include "Emu/SysCalls/lv2/sys_time.h" #include "MFC.h" #include "Emu/SysCalls/ErrorCodes.h" #include @@ -975,7 +977,7 @@ public: { while (t->IsAlive()) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (Emu.IsStopped()) { LOG_WARNING(Log::SPU, "%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); @@ -1106,7 +1108,7 @@ public: case SPU_WrOutMbox: { //ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v); - while (!SPU.Out_MBox.Push(v) && !Emu.IsStopped()) Sleep(1); + while (!SPU.Out_MBox.Push(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); break; } @@ -1206,41 +1208,41 @@ public: { case SPU_RdInMbox: { - while (!SPU.In_MBox.Pop(v) && !Emu.IsStopped()) Sleep(1); + while (!SPU.In_MBox.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; } case MFC_RdTagStat: { - while (!Prxy.TagStatus.Pop(v) && !Emu.IsStopped()) Sleep(1); + while (!Prxy.TagStatus.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; } case SPU_RdSigNotify1: { - while (!SPU.SNR[0].Pop(v) && !Emu.IsStopped()) Sleep(1); + while (!SPU.SNR[0].Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; } case SPU_RdSigNotify2: { - while (!SPU.SNR[1].Pop(v) && !Emu.IsStopped()) Sleep(1); + while (!SPU.SNR[1].Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; } case MFC_RdAtomicStat: { - while (!Prxy.AtomicStat.Pop(v) && !Emu.IsStopped()) Sleep(1); + while (!Prxy.AtomicStat.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); break; } case MFC_RdListStallStat: { - while (!StallStat.Pop(v) && !Emu.IsStopped()) Sleep(1); + while (!StallStat.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); break; } @@ -1334,7 +1336,7 @@ public: default: eq->sq.invalidate(tid); SPU.In_MBox.PushUncond(CELL_ECANCELED); return; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (Emu.IsStopped()) { LOG_WARNING(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x) aborted", spuq); diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index 83da350d73..3c79002e13 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -4,6 +4,7 @@ #include "VFS.h" #include "Emu/HDD/HDD.h" #include "vfsDeviceLocalFile.h" +#include "Ini.h" int sort_devices(const void* _a, const void* _b) { diff --git a/rpcs3/Emu/FS/vfsDir.cpp b/rpcs3/Emu/FS/vfsDir.cpp index ae32e0b05f..a161183549 100644 --- a/rpcs3/Emu/FS/vfsDir.cpp +++ b/rpcs3/Emu/FS/vfsDir.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "vfsDir.h" diff --git a/rpcs3/Emu/FS/vfsFile.cpp b/rpcs3/Emu/FS/vfsFile.cpp index 1a80009ba7..f30a2de9a5 100644 --- a/rpcs3/Emu/FS/vfsFile.cpp +++ b/rpcs3/Emu/FS/vfsFile.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "vfsFile.h" diff --git a/rpcs3/Emu/FS/vfsLocalDir.cpp b/rpcs3/Emu/FS/vfsLocalDir.cpp index 349923e749..e97f9a5ad7 100644 --- a/rpcs3/Emu/FS/vfsLocalDir.cpp +++ b/rpcs3/Emu/FS/vfsLocalDir.cpp @@ -40,7 +40,7 @@ bool vfsLocalDir::Open(const std::string& path) bool vfsLocalDir::Create(const std::string& path) { - return rFileName::Mkdir(path, 0777, rPATH_MKDIR_FULL); + return rMkpath(path); } bool vfsLocalDir::Rename(const std::string& from, const std::string& to) diff --git a/rpcs3/Emu/GS/GCM.h b/rpcs3/Emu/GS/GCM.h index 5c766ebf46..9f56cb2bab 100644 --- a/rpcs3/Emu/GS/GCM.h +++ b/rpcs3/Emu/GS/GCM.h @@ -1330,8 +1330,10 @@ static const std::string GetMethodName(const u32 id) { NV4097_SET_TRANSFORM_BRANCH_BITS, "SetTransformBranchBits" } , }; - for(auto& s: METHOD_NAME_LIST) - if(s.id == id) return "cellGcm" + s.name; + for(auto& s: METHOD_NAME_LIST) { + if(s.id == id) + return "cellGcm" + s.name; + } return fmt::Format("unknown/illegal method [0x%08x]", id); } diff --git a/rpcs3/Emu/GS/GL/GLProgram.cpp b/rpcs3/Emu/GS/GL/GLProgram.cpp index 303f5ccf14..e7e7fdaa0a 100644 --- a/rpcs3/Emu/GS/GL/GLProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLProgram.cpp @@ -51,8 +51,7 @@ void GLProgram::Create(const u32 vp, const u32 fp) if (bufLength) { - char* buf = new char[bufLength+1]; - memset(buf, 0, bufLength+1); + char* buf = new char[bufLength+1](); glGetProgramInfoLog(id, bufLength, NULL, buf); LOG_ERROR(RSX, "Could not link program: %s", buf); delete[] buf; @@ -70,8 +69,7 @@ void GLProgram::Create(const u32 vp, const u32 fp) if (bufLength) { - char* buf = new char[bufLength]; - memset(buf, 0, bufLength); + char* buf = new char[bufLength](); glGetProgramInfoLog(id, bufLength, NULL, buf); LOG_ERROR(RSX, "Could not link program: %s", buf); delete[] buf; diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index 1172b627ec..60a464f342 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -2409,7 +2409,7 @@ void RSXThread::Task() continue; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } is_vblank_stopped = true; @@ -2446,7 +2446,7 @@ void RSXThread::Task() m_sem_flush.post_and_wait(); } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } @@ -2510,7 +2510,7 @@ void RSXThread::Task() while (!is_vblank_stopped) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } LOG_NOTICE(RSX, "RSX thread ended"); diff --git a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h index 6bc225daca..10ada356ad 100644 --- a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h +++ b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h @@ -1,4 +1,4 @@ - +#pragma once //DynamicMemoryBlockBase template DynamicMemoryBlockBase::DynamicMemoryBlockBase() diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index dc21cc5b7b..cf1b8a8f9a 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -3,6 +3,8 @@ #include "Utilities/Log.h" #include "Memory.h" +#include "Emu/System.h" +#include "Ini.h" MemoryBase Memory; @@ -92,6 +94,7 @@ void MemoryBlock::Free() void MemoryBlock::Delete() { Free(); + safe_free(mem); Init(); } diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index b0fee3bac6..7d781a7a18 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -5,6 +5,7 @@ #endif #include "MemoryBlock.h" +#include "Emu/SysCalls/Callback.h" #include using std::nullptr_t; diff --git a/rpcs3/Emu/SysCalls/Callback.cpp b/rpcs3/Emu/SysCalls/Callback.cpp index 02fb9dc9cf..378830875f 100644 --- a/rpcs3/Emu/SysCalls/Callback.cpp +++ b/rpcs3/Emu/SysCalls/Callback.cpp @@ -69,7 +69,7 @@ again: LOG_WARNING(HLE, "Callback::Branch() aborted"); return 0; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } std::lock_guard lock(cb_mutex); @@ -112,7 +112,7 @@ again: LOG_WARNING(HLE, "Callback::Branch(true) aborted (end)"); return 0; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return thr.GetExitStatus(); diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index ecbdb085de..b538f37779 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -1,13 +1,9 @@ #include "stdafx.h" #include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Crypto/sha1.h" #include -#include "Emu/System.h" #include "ModuleManager.h" u32 getFunctionId(const std::string& name) diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index e0374db2bf..31947f14c0 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -1,8 +1,6 @@ #pragma once -#include "Emu/Memory/Memory.h" - -#define declCPU PPUThread& CPU = GetCurrentPPUThread +#include "Emu/SysCalls/SC_FUNC.h" //TODO struct ModuleFunc diff --git a/rpcs3/Emu/SysCalls/Modules/SC_Keyboard.cpp b/rpcs3/Emu/SysCalls/Modules/SC_Keyboard.cpp index af657d37de..f171ae5705 100644 --- a/rpcs3/Emu/SysCalls/Modules/SC_Keyboard.cpp +++ b/rpcs3/Emu/SysCalls/Modules/SC_Keyboard.cpp @@ -2,11 +2,8 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/Io/Keyboard.h" -#include "Emu/SysCalls/SysCalls.h" extern Module *sys_io; diff --git a/rpcs3/Emu/SysCalls/Modules/SC_Mouse.cpp b/rpcs3/Emu/SysCalls/Modules/SC_Mouse.cpp index 374b3dc3cc..44f3dad312 100644 --- a/rpcs3/Emu/SysCalls/Modules/SC_Mouse.cpp +++ b/rpcs3/Emu/SysCalls/Modules/SC_Mouse.cpp @@ -2,11 +2,8 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/Io/Mouse.h" -#include "Emu/SysCalls/SysCalls.h" extern Module *sys_io; diff --git a/rpcs3/Emu/SysCalls/Modules/SC_Pad.cpp b/rpcs3/Emu/SysCalls/Modules/SC_Pad.cpp index 639c7efa84..5a4dbf2123 100644 --- a/rpcs3/Emu/SysCalls/Modules/SC_Pad.cpp +++ b/rpcs3/Emu/SysCalls/Modules/SC_Pad.cpp @@ -2,11 +2,8 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/Io/Pad.h" -#include "Emu/SysCalls/SysCalls.h" extern Module *sys_io; @@ -462,4 +459,4 @@ int cellPadSetSensorMode(u32 port_no, u32 mode) pads[port_no].m_port_setting &= ~CELL_PAD_SETTING_SENSOR_ON; return CELL_OK; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp index 60b52a6c2c..63caf2f4b1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "cellPamf.h" @@ -39,7 +37,7 @@ next: LOG_WARNING(HLE, "adecRawRead(): aborted"); return 0; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } switch (adec.job.Peek().type) @@ -212,13 +210,13 @@ u32 adecOpen(AudioDecoder* data) if (!adec.job.GetCountUnsafe() && adec.is_running) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } /*if (adec.frames.GetCount() >= 50) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; }*/ @@ -283,8 +281,7 @@ u32 adecOpen(AudioDecoder* data) if (size) { - data = (u8*)av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); - memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + data = (u8*)av_calloc(1, size + FF_INPUT_BUFFER_PADDING_SIZE); this->size = size + FF_INPUT_BUFFER_PADDING_SIZE; } else @@ -618,7 +615,7 @@ int cellAdecClose(u32 handle) LOG_WARNING(HLE, "cellAdecClose(%d) aborted", handle); break; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } if (adec->adecCb) Emu.GetCPU().RemoveThread(adec->adecCb->GetId()); @@ -728,7 +725,7 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) } // copy data - u8* out = (u8*)malloc(af.size); + u8* out = (u8*)calloc(1, af.size); // reverse byte order, extract data: float* in_f[2]; @@ -774,7 +771,7 @@ int cellAdecGetPcmItem(u32 handle, mem32_t pcmItem_ptr) if (adec->frames.IsEmpty()) { - Sleep(1); // hack + std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return CELL_ADEC_ERROR_EMPTY; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp index 664d55024a..ef89f02ab4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp @@ -1,9 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" -#include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index 8fd2e0b9ac..9ff294a1aa 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "Utilities/SQueue.h" @@ -157,7 +155,7 @@ int cellAudioInit() // precise time of sleeping: 5,(3) ms (or 256/48000 sec) if (m_config.counter * 256000000 / 48000 >= stamp0 - m_config.start_time) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } @@ -469,7 +467,7 @@ abort: while (!internal_finished) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } m_config.m_is_audio_finalized = true; @@ -483,7 +481,7 @@ abort: LOG_WARNING(HLE, "cellAudioInit() aborted"); return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return CELL_OK; @@ -502,7 +500,7 @@ int cellAudioQuit() while (!m_config.m_is_audio_finalized) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (Emu.IsStopped()) { LOG_WARNING(HLE, "cellAudioQuit(): aborted"); diff --git a/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp b/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp index 72879e8d3b..1b0850cdd6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellBgdl.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp b/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp index ee00c683fa..3d2feac52c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCamera.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp b/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp index 70109e224a..28ee197457 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCelp8Enc.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp b/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp index 80bea81089..92b2c9acc9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index 3bde3766ac..b689c0682f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -3,10 +3,8 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "cellPamf.h" #include "cellDmux.h" @@ -148,14 +146,14 @@ u32 dmuxOpen(Demuxer* data) if (es.isfull()) { stream = backup; - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } /*if (es.hasunseen()) // hack, probably useless { stream = backup; - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; }*/ @@ -194,7 +192,7 @@ u32 dmuxOpen(Demuxer* data) ElementaryStream& es = *esAVC[ch]; if (es.isfull()) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } @@ -214,7 +212,7 @@ u32 dmuxOpen(Demuxer* data) /*if (es.hasunseen()) // hack, probably useless { stream = backup; - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; }*/ es.finish(stream); @@ -237,7 +235,7 @@ u32 dmuxOpen(Demuxer* data) if (es.isfull()) { stream = backup; - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } @@ -598,7 +596,7 @@ int cellDmuxClose(u32 demuxerHandle) return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } if (dmux->dmuxCb) Emu.GetCPU().RemoveThread(dmux->dmuxCb->GetId()); @@ -629,7 +627,7 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize LOG_WARNING(HLE, "cellDmuxSetStream(%d) aborted (waiting)", demuxerHandle); return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); return CELL_DMUX_ERROR_BUSY; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp index a64a9a914f..b192d56231 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index 3692abbcdd..177f716bd1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -3,7 +3,6 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/FS/vfsFile.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp index 19d3c204cd..8104be11f2 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "cellFont.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index d693772ff2..1022906f7d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -2,7 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" @@ -456,7 +455,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s", errorName.c_str(), errNeedSizeKB, dirName); - rMessageBox(errorMsg, rGetApp().GetAppName(), rICON_ERROR | rOK); + rMessageBox(errorMsg, "Error", rICON_ERROR | rOK); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index 297d6e00cf..9ebe134f35 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/GS/GCM.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index 5133ce51c4..bb93900168 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index 866d6d48dc..b21151bbdd 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "cellGifDec.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp b/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp index 97f94de794..e5ef30832f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellHttpUtil.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp b/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp index b3dc1bd5da..fea418acb9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellImejp.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index c24fcc5f8e..8a7aa659c7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellJpgDec.h" #include "stblib/stb_image.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgEnc.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgEnc.cpp index e8aa461f29..3bfebc50e6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgEnc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgEnc.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellKey2char.cpp b/rpcs3/Emu/SysCalls/Modules/cellKey2char.cpp index eef9eb72f7..3a635b569b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellKey2char.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellKey2char.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp index 571a332fe9..ea34d10566 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" // Requires GCC 4.10 apparently.. diff --git a/rpcs3/Emu/SysCalls/Modules/cellLv2dbg.cpp b/rpcs3/Emu/SysCalls/Modules/cellLv2dbg.cpp index 01dd518bba..13126bd402 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellLv2dbg.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellLv2dbg.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellMic.cpp b/rpcs3/Emu/SysCalls/Modules/cellMic.cpp index 23b2a9f61a..a8d0d74168 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMic.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMic.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp index 7fcc039748..d3959b9e32 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "rpcs3.h" @@ -185,7 +183,7 @@ int cellMsgDialogOpen2(u32 type, mem_list_ptr_t msgString, mem_func_ptr_t msgString, mem_func_ptr_tAddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync); cellNetCtl->AddFunc(0x3a12865f, cellNetCtlGetNatInfo); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp b/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp index 25907207e1..f47f403140 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index ccda72ca4a..b71d83ba35 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellPamf.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp index 9281f3c17b..34d893e1f9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp index 71dd6f5bc9..3268783bee 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoExport.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp index c5815b9f5b..ed24bfb5a0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index 1ab78ff7a0..1b7e153a4c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellPngDec.h" #include "stblib/stb_image.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp index 4b59e80a26..5d10680730 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngEnc.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp b/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp index 191c53c1d8..62b1d312ad 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPrint.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 60cd6fde8b..4b61ee5c34 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellSysutil.h" #include "cellResc.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index 2d62e82d8d..6856299797 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -1,9 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" -#include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellRtc.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp b/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp index 6cef6bbf08..e8c1261ec2 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp index b301af90b0..e590376216 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp b/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp index dce0b36acb..c3ff0bbe4f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSailRec.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp b/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp index bcc77d5466..6972ae06d4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp b/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp index 8ba73eba86..4da6818439 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSearch.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp b/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp index ea15f3819f..feee6c5245 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSheap.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp index 79d330909d..122c0ff1ff 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellSpurs.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp b/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp index c0a30dc9f7..3bf12e87ce 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSsl.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp index 467f82d29d..0f4c7ad87f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSubdisplay.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp index ab4ec91f5b..e66b8a4f3a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" //void cellSync_init(); @@ -90,7 +88,7 @@ int cellSyncMutexLock(mem_ptr_t mutex) while (old_order != mutex->m_freed) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (Emu.IsStopped()) { LOG_WARNING(HLE, "cellSyncMutexLock(mutex=0x%x) aborted", mutex.GetAddr()); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp index 1817f3c1b6..ecaa713f80 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync2.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp index 50c75daa24..4e0f949544 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/ModuleManager.h" #include "Emu/SysCalls/Modules.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index c1072297c4..caa363b96d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -2,9 +2,8 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" +#include "Emu/DbgCommand.h" #include "Emu/FS/vfsFile.h" #include "Emu/Audio/sysutil_audio.h" @@ -345,7 +344,7 @@ int cellSysutilCheckCallback() while (thr.IsAlive()) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (Emu.IsStopped()) { LOG_WARNING(HLE, "cellSysutilCheckCallback() aborted"); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp index e18d269089..2c2ddb95b3 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" //void cellSysutilAp_init(); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp index 2517a23fe5..2393b0c2ff 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/FS/vfsFile.h" #include "Emu/FS/vfsDir.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp b/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp index fa4323a05e..eb8d7dc369 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUsbd.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp b/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp index 9ce3671f2d..005c2741ca 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUsbpspcm.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp index 7143cca15f..615a1d392c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellUserInfo.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index d76d846c4d..f2dcf61696 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "cellPamf.h" @@ -38,7 +36,7 @@ next: LOG_WARNING(HLE, "vdecRead(): aborted"); return 0; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } switch (vdec.job.Peek().type) @@ -150,13 +148,13 @@ u32 vdecOpen(VideoDecoder* data) if (!vdec.job.GetCountUnsafe() && vdec.is_running) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } if (vdec.frames.GetCount() >= 50) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } @@ -509,7 +507,7 @@ int cellVdecClose(u32 handle) LOG_WARNING(HLE, "cellVdecClose(%d) aborted", handle); break; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } if (vdec->vdecCb) Emu.GetCPU().RemoveThread(vdec->vdecCb->GetId()); @@ -543,13 +541,13 @@ int cellVdecEndSeq(u32 handle) /*if (!vdec->job.IsEmpty()) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); return CELL_VDEC_ERROR_BUSY; // ??? } if (!vdec->frames.IsEmpty()) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); return CELL_VDEC_ERROR_BUSY; // ??? }*/ @@ -560,7 +558,7 @@ int cellVdecEndSeq(u32 handle) LOG_WARNING(HLE, "cellVdecEndSeq(%d) aborted", handle); return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } vdec->job.Push(VdecTask(vdecEndSeq)); @@ -680,7 +678,7 @@ int cellVdecGetPicItem(u32 handle, mem32_t picItem_ptr) if (vdec->frames.IsEmpty()) { - Sleep(1); // hack + std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return CELL_VDEC_ERROR_EMPTY; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp b/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp index 63dc1763d3..2330a2773e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVoice.cpp @@ -1,5 +1,5 @@ -#include "stdafx.h" #if 0 +#include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp index 8219861713..ae26d1a07c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp @@ -2,8 +2,6 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" extern "C" diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp index 09d75fcaa1..b3a2c194eb 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp @@ -3,7 +3,6 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/Audio/cellAudio.h" #include "libmixer.h" @@ -363,7 +362,7 @@ int cellSurMixerCreate(const mem_ptr_t config) if (mixcount > (port.tag + 14)) // preemptive buffer filling (probably hack) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); continue; } diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index 48db1ef644..dc326289a0 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rXml.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/FS/vfsDir.h" -#include "wx/xml/xml.h" #include "sceNp.h" #include "sceNpTrophy.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp index 9b08ead4d7..be6fe5291d 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp @@ -148,7 +148,7 @@ void fsAioRead(u32 fd, mem_ptr_t aio, int xid, mem_func_ptr_tsq.m_mutex.unlock(); while (eq->sq.list.size()) { - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (Emu.IsStopped()) { LOG_WARNING(HLE, "sys_event_queue_destroy(equeue=%d) aborted", equeue_id); @@ -222,7 +222,7 @@ s32 sys_event_queue_receive(u32 equeue_id, mem_ptr_t event, u64 default: eq->sq.invalidate(tid); return CELL_ECANCELED; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (counter++ > timeout || Emu.IsStopped()) { if (Emu.IsStopped()) LOG_WARNING(HLE, "sys_event_queue_receive(equeue=%d) aborted", equeue_id); @@ -569,7 +569,7 @@ s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 return CELL_ECANCELED; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (counter++ > max_counter) { diff --git a/rpcs3/Emu/SysCalls/lv2/sys_interrupt.cpp b/rpcs3/Emu/SysCalls/lv2/sys_interrupt.cpp index ba0c995a91..065f5cd4de 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_interrupt.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_interrupt.cpp @@ -4,7 +4,6 @@ #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" #include "Emu/Cell/RawSPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "sys_interrupt.h" @@ -108,4 +107,4 @@ void sys_interrupt_thread_eoi() GetCurrentPPUThread().Stop(); return; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp index 7bc6377c62..ee44e1601b 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_lwcond.cpp @@ -245,7 +245,7 @@ s32 sys_lwcond_wait(mem_ptr_t lwcond, u64 timeout) return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (counter++ > max_counter) { diff --git a/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp b/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp index 1708e2770a..969c39e680 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_lwmutex.cpp @@ -253,7 +253,7 @@ int sys_lwmutex_t::trylock(be_t tid) LOG_WARNING(HLE, "(hack) sys_lwmutex_t::(try)lock aborted (waiting for recursive attribute, attr=0x%x)", (u32)attribute); return CELL_ESRCH; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); }*/ if (tid == owner_tid) diff --git a/rpcs3/Emu/SysCalls/lv2/sys_ppu_thread.cpp b/rpcs3/Emu/SysCalls/lv2/sys_ppu_thread.cpp index 4761e13cd2..f42444ee12 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_ppu_thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_ppu_thread.cpp @@ -32,7 +32,8 @@ void sys_ppu_thread_exit(u64 errorcode) s32 sys_ppu_thread_yield() { sysPrxForUser->Log("sys_ppu_thread_yield()"); - Sleep(1); + // Note: Or do we actually want to yield? + std::this_thread::sleep_for(std::chrono::milliseconds(1)); return CELL_OK; } @@ -50,7 +51,7 @@ s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr) LOG_WARNING(PPU, "sys_ppu_thread_join(%d) aborted", thread_id); return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } vptr = thr->GetExitStatus(); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_prx.cpp b/rpcs3/Emu/SysCalls/lv2/sys_prx.cpp index bea1e06449..fccdee285f 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_prx.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_prx.cpp @@ -3,6 +3,7 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" +#include "Emu/FS/vfsFile.h" #include "sys_prx.h" SysCallBase sys_prx("sys_prx"); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp index 2ad0524cee..8f3e7750bc 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" #include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" -#include "Emu/System.h" #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SysCalls.h" #include "sys_rwlock.h" @@ -72,7 +70,7 @@ s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout) LOG_WARNING(HLE, "sys_rwlock_rlock(rw_lock_id=%d, ...) aborted", rw_lock_id); return CELL_ETIMEDOUT; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (rw->rlock_trylock(tid)) return CELL_OK; @@ -135,7 +133,7 @@ s32 sys_rwlock_wlock(u32 rw_lock_id, u64 timeout) LOG_WARNING(HLE, "sys_rwlock_wlock(rw_lock_id=%d, ...) aborted", rw_lock_id); return CELL_ETIMEDOUT; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (rw->wlock_trylock(tid, true)) return CELL_OK; diff --git a/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp b/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp index 08f3c73915..161f0945c0 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_semaphore.cpp @@ -3,6 +3,7 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" +#include "Emu/Cell/PPUThread.h" #include "sys_semaphore.h" #include "sys_time.h" diff --git a/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp b/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp index 39f39ee591..b7dae66aec 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_spu.cpp @@ -370,7 +370,7 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status) LOG_WARNING(Log::SPU, "sys_spu_thread_group_join(id=%d, ...) aborted", id); return CELL_OK; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } diff --git a/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp b/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp index 276c5a6474..7ff925b368 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_timer.cpp @@ -54,7 +54,12 @@ s32 sys_timer_start(u32 timer_id, s64 base_time, u64 period) timer_data->timer_information_t.period = period; timer_data->timer_information_t.timer_state = SYS_TIMER_STATE_RUN; //TODO: ? - timer_data->tmr.Start(); + std::function task(std::bind(sys_timer_stop, timer_id)); + std::thread([period, task]() { + std::this_thread::sleep_for(std::chrono::milliseconds(period)); + task(); + }).detach(); + return CELL_OK; } @@ -66,7 +71,6 @@ s32 sys_timer_stop(u32 timer_id) if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; timer_data->timer_information_t.timer_state = SYS_TIMER_STATE_STOP; - timer_data->tmr.Stop(); return CELL_OK; } @@ -100,7 +104,7 @@ s32 sys_timer_disconnect_event_queue(u32 timer_id) s32 sys_timer_sleep(u32 sleep_time) { sys_timer.Warning("sys_timer_sleep(sleep_time=%d)", sleep_time); - rSleep(sleep_time); + std::this_thread::sleep_for(std::chrono::seconds(sleep_time)); return CELL_OK; } @@ -108,6 +112,6 @@ s32 sys_timer_usleep(u64 sleep_time) { sys_timer.Log("sys_timer_usleep(sleep_time=%lld)", sleep_time); if (sleep_time > 0xFFFFFFFFFFFF) sleep_time = 0xFFFFFFFFFFFF; //2^48-1 - rMicroSleep(sleep_time); //TODO: If (sleep_time >= 2^32) shit may happen + std::this_thread::sleep_for(std::chrono::microseconds(sleep_time)); return CELL_OK; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/lv2/sys_timer.h b/rpcs3/Emu/SysCalls/lv2/sys_timer.h index def0f16c36..4332f75667 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_timer.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_timer.h @@ -16,7 +16,6 @@ struct sys_timer_information_t struct timer { - rTimer tmr; sys_timer_information_t timer_information_t; }; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index b44a4000a4..89a3bb748c 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -2,7 +2,7 @@ #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "Ini.h" +//#include "Ini.h" #include "Emu/GameInfo.h" #include "Emu/SysCalls/Static.h" @@ -12,6 +12,7 @@ #include "Emu/Cell/PPUInstrTable.h" #include "Emu/FS/vfsFile.h" #include "Emu/FS/vfsDeviceLocalFile.h" +#include "Emu/DbgCommand.h" #include "Emu/CPU/CPUThreadManager.h" //gui dependency @@ -388,7 +389,7 @@ void Emulator::Stop() LOG_NOTICE(HLE, "All threads stopped..."); break; } - Sleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if (counter++ > 3000) { LOG_ERROR(HLE, "%d threads not stopped (timeout)", (u32)(g_thread_count - uncounted)); diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index d64cc2e592..3b9f992ee4 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -8,9 +8,7 @@ #include "Emu/GS/GSManager.h" #include "Emu/Audio/AudioManager.h" #include "Emu/FS/VFS.h" -#include "Emu/DbgCommand.h" #include "Loader/Loader.h" -#include "SysCalls/Callback.h" enum Status { diff --git a/rpcs3/Gui/AboutDialog.h b/rpcs3/Gui/AboutDialog.h index 975a99278d..bee94e9b1a 100644 --- a/rpcs3/Gui/AboutDialog.h +++ b/rpcs3/Gui/AboutDialog.h @@ -1,3 +1,5 @@ +#pragma once + class AboutDialog : public wxDialog { diff --git a/rpcs3/Gui/CompilerELF.cpp b/rpcs3/Gui/CompilerELF.cpp index b2141c4794..c67dfe0703 100644 --- a/rpcs3/Gui/CompilerELF.cpp +++ b/rpcs3/Gui/CompilerELF.cpp @@ -389,7 +389,7 @@ void CompilerELF::LoadElf(wxCommandEvent& event) "All Files (*.*)|*.*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if(ctrl.ShowModal() == wxID_CANCEL) return; + if(ctrl.ShowModal() == rID_CANCEL) return; LoadElf(fmt::ToUTF8(ctrl.GetPath())); } diff --git a/rpcs3/Gui/DisAsmFrame.cpp b/rpcs3/Gui/DisAsmFrame.cpp index edc42b0741..66852a2f83 100644 --- a/rpcs3/Gui/DisAsmFrame.cpp +++ b/rpcs3/Gui/DisAsmFrame.cpp @@ -220,7 +220,8 @@ struct WaitDumperThread : public ThreadBase { for(uint i=0; i static const std::string m_class_name = "GameViewer"; @@ -238,9 +239,9 @@ void GameViewer::RemoveGame(wxCommandEvent& event) Emu.GetVFS().UnMountAll(); - //TODO: Replace wxWidgetsSpecific filesystem stuff? - if (!wxDirExists(fmt::FromUTF8(localPath))) + if (!rFile::Exists(localPath)) return; + //TODO: Replace wxWidgetsSpecific filesystem stuff? WxDirDeleteTraverser deleter; wxDir localDir(localPath); localDir.Traverse(deleter); diff --git a/rpcs3/Gui/InstructionEditor.h b/rpcs3/Gui/InstructionEditor.h index 4da800cbe6..6bf208ed58 100644 --- a/rpcs3/Gui/InstructionEditor.h +++ b/rpcs3/Gui/InstructionEditor.h @@ -1,3 +1,5 @@ +#pragma once + class InstructionEditorDialog : public wxDialog { diff --git a/rpcs3/Gui/RegisterEditor.h b/rpcs3/Gui/RegisterEditor.h index 9fac56a567..74d5229ca5 100644 --- a/rpcs3/Gui/RegisterEditor.h +++ b/rpcs3/Gui/RegisterEditor.h @@ -1,3 +1,5 @@ +#pragma once + class RegisterEditorDialog : public wxDialog { u64 pc; diff --git a/rpcs3/Gui/VHDDManager.cpp b/rpcs3/Gui/VHDDManager.cpp index 23c5e9974e..5bf185f04d 100644 --- a/rpcs3/Gui/VHDDManager.cpp +++ b/rpcs3/Gui/VHDDManager.cpp @@ -2,6 +2,7 @@ #include "Utilities/Log.h" #include "VHDDManager.h" #include "TextInputDialog.h" +#include "Ini.h" #include VHDDListDropTarget::VHDDListDropTarget(wxListView* parent) : m_parent(parent) diff --git a/rpcs3/Loader/TROPUSR.cpp b/rpcs3/Loader/TROPUSR.cpp index 2420733248..118bf182ae 100644 --- a/rpcs3/Loader/TROPUSR.cpp +++ b/rpcs3/Loader/TROPUSR.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rXml.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "TROPUSR.h" diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 0e9b70487d..058d68e32b 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -210,11 +210,9 @@ - - @@ -562,4 +560,4 @@ - \ No newline at end of file + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index aa9b035f34..36357d7e1a 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -940,9 +940,6 @@ Header Files - - Utilities - Utilities @@ -979,9 +976,6 @@ Utilities\SimpleIni - - Utilities - Emu @@ -1097,4 +1091,4 @@ Emu\Memory - \ No newline at end of file + diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 2997ca698a..4ea8af5587 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -26,6 +26,8 @@ bool Rpcs3App::OnInit() SetAppName(_PRGNAME_); wxInitAllImageHandlers(); + main_thread = std::this_thread::get_id(); + Ini.Load(); m_MainFrame = new MainFrame(); diff --git a/rpcs3/rpcs3.h b/rpcs3/rpcs3.h index f99984ddb7..77b35aa7fc 100644 --- a/rpcs3/rpcs3.h +++ b/rpcs3/rpcs3.h @@ -1,5 +1,8 @@ #pragma once #include "Gui/MainFrame.h" +#include "Emu/DbgCommand.h" +#include "Utilities/Thread.h" +#include class CPUThread; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 1f8f08d77d..b3befe689e 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -155,7 +155,6 @@ - @@ -192,12 +191,10 @@ - - @@ -232,4 +229,4 @@ - \ No newline at end of file + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 950a606fba..f1a38b6bb4 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -69,9 +69,6 @@ Utilities - - Utilities - Utilities @@ -104,9 +101,6 @@ - - Utilities - Utilities @@ -182,9 +176,6 @@ Gui - - Utilities - Utilities @@ -213,4 +204,4 @@ Utilities - \ No newline at end of file + diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index c61296bf72..cfb31964fc 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -12,13 +12,9 @@ #include #include #include -#include -#include -#include #include #include -#include #include #include #include @@ -26,14 +22,12 @@ #include #include #include -#include "wx/gauge.h" +#include #include -#include "wx/scrolbar.h" -#include "wx/frame.h" +#include +#include #include #include -#include "wx/app.h" -#include #include #include #endif @@ -66,27 +60,10 @@ typedef int64_t s64; #include "Utilities/BEType.h" #include "Utilities/rFile.h" #include "Utilities/rTime.h" -#include "Utilities/rXml.h" -#include "Utilities/rConcurrency.h" #include "Utilities/rMsgBox.h" #include "Utilities/Thread.h" -#include "Utilities/Array.h" #include "Utilities/Timer.h" #include "Utilities/IdManager.h" -#include "Emu/SysCalls/Callback.h" -#include "Emu/Cell/PPUThread.h" -#include "Emu/SysCalls/SC_FUNC.h" -#include "Emu/SysCalls/Modules.h" - -#include "Emu/FS/vfsDirBase.h" -#include "Emu/FS/vfsFileBase.h" -#include "Emu/FS/vfsLocalDir.h" -#include "Emu/FS/vfsLocalFile.h" -#include "Emu/FS/vfsStream.h" -#include "Emu/FS/vfsStreamMemory.h" -#include "Emu/FS/vfsFile.h" -#include "Emu/FS/vfsDir.h" - #define _PRGNAME_ "RPCS3" #define _PRGVER_ "0.0.0.4"