From 5df4bac6d28b5263ca0fdcdccd68da7d3abc4bf6 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Wed, 25 Jan 2017 10:04:54 +0100 Subject: [PATCH] Delete some left behind unused code --- Common/CommonFuncs.h | 4 ---- Common/FileUtil.cpp | 23 +----------------- Common/LogManager.cpp | 4 ++-- Common/MemArena.cpp | 34 +++++---------------------- Common/Misc.cpp | 8 ------- Common/Swap.h | 10 -------- Common/Timer.cpp | 6 +---- Core/HLE/proAdhoc.h | 5 +--- Core/HLE/proAdhocServer.cpp | 5 +--- Core/HLE/sceIo.cpp | 5 ---- Core/HLE/sceRtc.cpp | 2 -- Core/MemMap.cpp | 17 -------------- GPU/Directx9/DepalettizeShaderDX9.cpp | 2 +- GPU/Directx9/FramebufferDX9.cpp | 2 +- GPU/Directx9/TextureCacheDX9.cpp | 6 ++--- GPU/Directx9/helper/global.cpp | 4 ---- GPU/Directx9/helper/global.h | 7 ------ 17 files changed, 17 insertions(+), 127 deletions(-) diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h index a533e2df6a..a1d26ba26d 100644 --- a/Common/CommonFuncs.h +++ b/Common/CommonFuncs.h @@ -75,7 +75,6 @@ inline u64 __rotr64(u64 x, unsigned int shift){ #define ftello _ftelli64 #define atoll _atoi64 #define fileno _fileno -#ifndef _XBOX #if _M_IX86 #define Crash() {__asm int 3} #else @@ -84,9 +83,6 @@ extern "C" { } #define Crash() {DebugBreak();} #endif // M_IX86 -#else - #define Crash() {DebugBreak();} -#endif // _XBOX ndef #endif // WIN32 ndef // Generic function to get last error message. diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index e6d207f790..05a70d0923 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -27,11 +27,9 @@ #ifdef _WIN32 #include "CommonWindows.h" -#ifndef _XBOX #include // for SHGetFolderPath #include #include // for GetSaveFileName -#endif #include #include // getcwd #else @@ -711,7 +709,6 @@ void openIniFile(const std::string fileName) { std::string GetCurrentDir() { char *dir; -#ifndef _XBOX // Get the current working directory (getcwd uses malloc) if (!(dir = __getcwd(NULL, 0))) { @@ -722,28 +719,19 @@ std::string GetCurrentDir() std::string strDir = dir; free(dir); return strDir; -#else - return "game:\\"; -#endif } // Sets the current directory to the given directory bool SetCurrentDir(const std::string &directory) { -#ifndef _XBOX return __chdir(directory.c_str()) == 0; -#else - return false; -#endif } const std::string &GetExeDirectory() { static std::string ExePath; - if (ExePath.empty()) -#ifndef _XBOX - { + if (ExePath.empty()) { #ifdef _WIN32 TCHAR program_path[4096] = {0}; GetModuleFileName(NULL, program_path, ARRAY_SIZE(program_path) - 1); @@ -789,10 +777,6 @@ const std::string &GetExeDirectory() } return ExePath; -#else - static std::wstring ExePath = L"game:\\"; - return ExePath; -#endif } @@ -880,7 +864,6 @@ bool IOFile::Flush() bool IOFile::Resize(u64 size) { -#ifndef _XBOX if (!IsOpen() || 0 != #ifdef _WIN32 // ector: _chsize sucks, not 64-bit safe @@ -894,10 +877,6 @@ bool IOFile::Resize(u64 size) m_good = false; return m_good; -#else - // TODO: Implement. - return false; -#endif } } // namespace diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 15a58d8474..d9b7a5fbe5 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -99,7 +99,7 @@ LogManager::LogManager() { } // Remove file logging on small devices -#if !(defined(MOBILE_DEVICE) || defined(_XBOX)) || defined(_DEBUG) +#if !(defined(MOBILE_DEVICE) || defined(_DEBUG)) fileLog_ = new FileLogListener(""); consoleLog_ = new ConsoleListener(); debuggerLog_ = new DebuggerLogListener(); @@ -112,7 +112,7 @@ LogManager::LogManager() { for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { log_[i]->SetEnable(true); -#if !(defined(MOBILE_DEVICE) || defined(_XBOX)) || defined(_DEBUG) +#if !(defined(MOBILE_DEVICE) || defined(_DEBUG)) log_[i]->AddListener(fileLog_); log_[i]->AddListener(consoleLog_); #if defined(_MSC_VER) && defined(USING_WIN_UI) diff --git a/Common/MemArena.cpp b/Common/MemArena.cpp index 4b08ce77b1..afd336592a 100644 --- a/Common/MemArena.cpp +++ b/Common/MemArena.cpp @@ -91,7 +91,9 @@ int ashmem_unpin_region(int fd, size_t offset, size_t len) { } #endif // Android -#ifndef _WIN32 +#ifdef _WIN32 +SYSTEM_INFO sysInfo; +#else static const std::string tmpfs_location = "/dev/shm"; static const std::string tmpfs_ram_temp_file = "/dev/shm/gc_mem.tmp"; @@ -101,19 +103,12 @@ std::string ram_temp_file = "/home/root/gc_mem.tmp"; #else std::string ram_temp_file = "/tmp/gc_mem.tmp"; #endif -#elif !defined(_XBOX) -SYSTEM_INFO sysInfo; #endif - // Windows mappings need to be on 64K boundaries, due to Alpha legacy. #ifdef _WIN32 size_t MemArena::roundup(size_t x) { -#ifndef _XBOX int gran = sysInfo.dwAllocationGranularity ? sysInfo.dwAllocationGranularity : 0x10000; -#else - int gran = 0x10000; // 64k in 360 -#endif return (x + gran - 1) & ~(gran - 1); } #else @@ -125,10 +120,8 @@ size_t MemArena::roundup(size_t x) { void MemArena::GrabLowMemSpace(size_t size) { #ifdef _WIN32 -#ifndef _XBOX hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL); GetSystemInfo(&sysInfo); -#endif #elif defined(__ANDROID__) // Use ashmem so we don't have to allocate a file on disk! fd = ashmem_create_region("PPSSPP_RAM", size); @@ -169,9 +162,7 @@ void MemArena::GrabLowMemSpace(size_t size) #endif } - -void MemArena::ReleaseSpace() -{ +void MemArena::ReleaseSpace() { #ifdef _WIN32 CloseHandle(hMemoryMapping); hMemoryMapping = 0; @@ -180,20 +171,12 @@ void MemArena::ReleaseSpace() #endif } - void *MemArena::CreateView(s64 offset, size_t size, void *base) { #ifdef _WIN32 -#ifdef _XBOX - size = roundup(size); - // use 64kb pages - void * ptr = VirtualAlloc(NULL, size, MEM_COMMIT|MEM_LARGE_PAGES, PAGE_READWRITE); - return ptr; -#else size = roundup(size); void *ptr = MapViewOfFileEx(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size, base); return ptr; -#endif #else void *retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | // Do not sync memory to underlying file. Linux has this by default. @@ -211,20 +194,15 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base) #endif } - -void MemArena::ReleaseView(void* view, size_t size) -{ +void MemArena::ReleaseView(void* view, size_t size) { #ifdef _WIN32 -#ifndef _XBOX UnmapViewOfFile(view); -#endif #else munmap(view, size); #endif } -u8* MemArena::Find4GBBase() -{ +u8* MemArena::Find4GBBase() { #ifdef _M_X64 #ifdef _WIN32 // 64 bit diff --git a/Common/Misc.cpp b/Common/Misc.cpp index dc9c0e8b9a..73307cdbb8 100644 --- a/Common/Misc.cpp +++ b/Common/Misc.cpp @@ -33,20 +33,15 @@ // This function might change the error code. const char *GetLastErrorMsg() { -#ifndef _XBOX #ifdef _WIN32 return GetStringErrorMsg(GetLastError()); #else return GetStringErrorMsg(errno); #endif -#else - return "GetLastErrorMsg"; -#endif } const char *GetStringErrorMsg(int errCode) { static const size_t buff_size = 1023; -#ifndef _XBOX #ifdef _WIN32 static __declspec(thread) wchar_t err_strw[buff_size] = {}; @@ -66,7 +61,4 @@ const char *GetStringErrorMsg(int errCode) { #endif return err_str; -#else - return "GetStringErrorMsg"; -#endif } diff --git a/Common/Swap.h b/Common/Swap.h index 77dea7b7c4..2109ba42a9 100644 --- a/Common/Swap.h +++ b/Common/Swap.h @@ -48,11 +48,7 @@ // MSVC #elif defined(_MSC_VER) && !defined(COMMON_BIG_ENDIAN) && !defined(COMMON_LITTLE_ENDIAN) -#ifdef _XBOX -#define COMMON_BIG_ENDIAN 1 -#else #define COMMON_LITTLE_ENDIAN 1 -#endif #endif @@ -62,15 +58,9 @@ #endif #ifdef _MSC_VER -#ifndef _XBOX inline unsigned long long bswap64(unsigned long long x) { return _byteswap_uint64(x); } inline unsigned int bswap32(unsigned int x) { return _byteswap_ulong(x); } inline unsigned short bswap16(unsigned short x) { return _byteswap_ushort(x); } -#else -inline unsigned long long bswap64(unsigned long long x) { return __loaddoublewordbytereverse(0, &x); } -inline unsigned int bswap32(unsigned int x) { return __loadwordbytereverse(0, &x); } -inline unsigned short bswap16(unsigned short x) { return __loadshortbytereverse(0, &x); } -#endif #elif defined(__DragonFly__) || defined(__FreeBSD__) || \ defined(__NetBSD__) || defined(__OpenBSD__) #include diff --git a/Common/Timer.cpp b/Common/Timer.cpp index 26a05b13d7..b8cc80f184 100644 --- a/Common/Timer.cpp +++ b/Common/Timer.cpp @@ -19,9 +19,7 @@ #ifdef _WIN32 #include "CommonWindows.h" -#ifndef _XBOX #include -#endif #include #else #include @@ -35,9 +33,7 @@ namespace Common u32 Timer::GetTimeMs() { -#ifdef _XBOX - return GetTickCount(); -#elif defined(_WIN32) +#if defined(_WIN32) return timeGetTime(); #else // REALTIME is probably not a good idea for measuring updates. diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index c0bdd4aacf..e03923da5b 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -36,10 +36,7 @@ class PointerWrap; // Net stuff -#ifdef _XBOX -#include -typedef int socklen_t; -#elif defined(_MSC_VER) +#if defined(_MSC_VER) #include #else #include diff --git a/Core/HLE/proAdhocServer.cpp b/Core/HLE/proAdhocServer.cpp index c3b4d50994..43f04c7dc2 100644 --- a/Core/HLE/proAdhocServer.cpp +++ b/Core/HLE/proAdhocServer.cpp @@ -32,10 +32,7 @@ #include // Net stuff -#ifdef _XBOX -#include -typedef int socklen_t; -#elif defined(_MSC_VER) +#if defined(_MSC_VER) #include #else #include diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 2936e56cfd..a73220102a 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -588,11 +588,6 @@ void __IoInit() { if (ioManagerThreadEnabled) { Core_ListenShutdown(&__IoWakeManager); ioManagerThread = new std::thread(&__IoManagerThread); -#ifdef _XBOX - SuspendThread(ioManagerThread->native_handle()); - XSetThreadProcessor(ioManagerThread->native_handle(), 4); - ResumeThread(ioManagerThread->native_handle()); -#endif ioManagerThread->detach(); } diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 4d23fc5661..b88b911e80 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -17,10 +17,8 @@ #ifdef _WIN32 #include "Common/CommonWindows.h" -#ifndef _XBOX // timeval already defined in xtl.h #include -#endif #else #include #endif diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 92a25c6d87..a4a66e1b2c 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -138,12 +138,8 @@ static bool Memory_TryBase(u32 flags) { // OK, we know where to find free space. Now grab it! // We just mimic the popular BAT setup. -#if defined(_XBOX) - void *ptr; -#else size_t position = 0; size_t last_position = 0; -#endif // Zero all the pointers to be sure. for (int i = 0; i < num_views; i++) @@ -162,13 +158,6 @@ static bool Memory_TryBase(u32 flags) { continue; SKIP(flags, view.flags); -#if defined(_XBOX) - if (!CanIgnoreView(view)) { - *(view.out_ptr_low) = (u8*)(base + view.virtual_address); - ptr = VirtualAlloc(base + (view.virtual_address & MEMVIEW32_MASK), view.size, MEM_COMMIT, PAGE_READWRITE); - } - *(view.out_ptr) = (u8*)base + (view.virtual_address & MEMVIEW32_MASK); -#else if (view.flags & MV_MIRROR_PREVIOUS) { position = last_position; } else { @@ -192,7 +181,6 @@ static bool Memory_TryBase(u32 flags) { #endif last_position = position; position += g_arena.roundup(view.size); -#endif } return true; @@ -223,9 +211,6 @@ bail: void MemoryMap_Setup(u32 flags) { // Find a base to reserve 256MB -#if defined(_XBOX) - base = (u8*)VirtualAlloc(0, 0x10000000, MEM_RESERVE|MEM_LARGE_PAGES, PAGE_READWRITE); -#else size_t total_mem = 0; for (int i = 0; i < num_views; i++) @@ -244,8 +229,6 @@ void MemoryMap_Setup(u32 flags) // Linux32 is fine with the x64 method, although limited to 32-bit with no automirrors. base = MemArena::Find4GBBase(); #endif -#endif - // Now, create views in high memory where there's plenty of space. #if defined(_WIN32) && !defined(_M_X64) diff --git a/GPU/Directx9/DepalettizeShaderDX9.cpp b/GPU/Directx9/DepalettizeShaderDX9.cpp index a85f6282db..3d48862c01 100644 --- a/GPU/Directx9/DepalettizeShaderDX9.cpp +++ b/GPU/Directx9/DepalettizeShaderDX9.cpp @@ -89,7 +89,7 @@ LPDIRECT3DTEXTURE9 DepalShaderCacheDX9::GetClutTexture(GEPaletteFormat clutForma usage = D3DUSAGE_DYNAMIC; // TODO: Switch to using a staging texture? } - HRESULT hr = pD3Ddevice->CreateTexture(texturePixels, 1, 1, usage, (D3DFORMAT)D3DFMT(dstFmt), pool, &tex->texture, NULL); + HRESULT hr = pD3Ddevice->CreateTexture(texturePixels, 1, 1, usage, dstFmt, pool, &tex->texture, NULL); if (FAILED(hr)) { ERROR_LOG(G3D, "Failed to create D3D texture for depal"); delete tex; diff --git a/GPU/Directx9/FramebufferDX9.cpp b/GPU/Directx9/FramebufferDX9.cpp index 798a89f327..024c659bb2 100644 --- a/GPU/Directx9/FramebufferDX9.cpp +++ b/GPU/Directx9/FramebufferDX9.cpp @@ -125,7 +125,7 @@ namespace DX9 { pool = D3DPOOL_DEFAULT; usage = D3DUSAGE_DYNAMIC; } - HRESULT hr = pD3Ddevice->CreateTexture(width, height, 1, usage, D3DFMT(D3DFMT_A8R8G8B8), pool, &drawPixelsTex_, NULL); + HRESULT hr = pD3Ddevice->CreateTexture(width, height, 1, usage, D3DFMT_A8R8G8B8, pool, &drawPixelsTex_, NULL); if (FAILED(hr)) { drawPixelsTex_ = nullptr; ERROR_LOG(G3D, "Failed to create drawpixels texture"); diff --git a/GPU/Directx9/TextureCacheDX9.cpp b/GPU/Directx9/TextureCacheDX9.cpp index e6ef466af7..c2f56547a1 100644 --- a/GPU/Directx9/TextureCacheDX9.cpp +++ b/GPU/Directx9/TextureCacheDX9.cpp @@ -1340,7 +1340,7 @@ ReplacedTextureFormat FromD3D9Format(u32 fmt) { } } -u32 ToD3D9Format(ReplacedTextureFormat fmt) { +D3DFORMAT ToD3D9Format(ReplacedTextureFormat fmt) { switch (fmt) { case ReplacedTextureFormat::F_5650: return D3DFMT_R5G6B5; @@ -1369,9 +1369,9 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re } int levels = scaleFactor == 1 ? maxLevel + 1 : 1; int tw = w, th = h; - D3DFORMAT tfmt = (D3DFORMAT)D3DFMT(dstFmt); + D3DFORMAT tfmt = (D3DFORMAT)(dstFmt); if (replaced.GetSize(level, tw, th)) { - tfmt = (D3DFORMAT)D3DFMT(ToD3D9Format(replaced.Format(level))); + tfmt = ToD3D9Format(replaced.Format(level)); } else { tw *= scaleFactor; th *= scaleFactor; diff --git a/GPU/Directx9/helper/global.cpp b/GPU/Directx9/helper/global.cpp index 351e90efc7..bab51a6c3e 100644 --- a/GPU/Directx9/helper/global.cpp +++ b/GPU/Directx9/helper/global.cpp @@ -219,10 +219,6 @@ void DirectxInit(HWND window) { // TODO } -#ifdef _XBOX - pD3Ddevice->SetRingBufferParameters( &d3dr ); -#endif - std::string errorMessage; CompileShaders(errorMessage); diff --git a/GPU/Directx9/helper/global.h b/GPU/Directx9/helper/global.h index 011602204b..ea83628cbd 100644 --- a/GPU/Directx9/helper/global.h +++ b/GPU/Directx9/helper/global.h @@ -1,13 +1,6 @@ #pragma once #include "Common/CommonWindows.h" -#ifdef _XBOX -// Used on XBox to create a linear format -// TODO: Might actually want to use nonlinear on xbox? -#define D3DFMT(x) (D3DFORMAT)MAKELINFMT(x) -#else -#define D3DFMT(x) x -#endif #include #include