Delete some left behind unused code

This commit is contained in:
Henrik Rydgard 2017-01-25 10:04:54 +01:00
parent 524854ac16
commit 5df4bac6d2
17 changed files with 17 additions and 127 deletions

View File

@ -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.

View File

@ -27,11 +27,9 @@
#ifdef _WIN32
#include "CommonWindows.h"
#ifndef _XBOX
#include <shlobj.h> // for SHGetFolderPath
#include <shellapi.h>
#include <commdlg.h> // for GetSaveFileName
#endif
#include <io.h>
#include <direct.h> // 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

View File

@ -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)

View File

@ -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

View File

@ -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
}

View File

@ -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 <sys/endian.h>

View File

@ -19,9 +19,7 @@
#ifdef _WIN32
#include "CommonWindows.h"
#ifndef _XBOX
#include <mmsystem.h>
#endif
#include <sys/timeb.h>
#else
#include <sys/time.h>
@ -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.

View File

@ -36,10 +36,7 @@
class PointerWrap;
// Net stuff
#ifdef _XBOX
#include <winsockx.h>
typedef int socklen_t;
#elif defined(_MSC_VER)
#if defined(_MSC_VER)
#include <WS2tcpip.h>
#else
#include <unistd.h>

View File

@ -32,10 +32,7 @@
#include <sys/types.h>
// Net stuff
#ifdef _XBOX
#include <winsockx.h>
typedef int socklen_t;
#elif defined(_MSC_VER)
#if defined(_MSC_VER)
#include <WS2tcpip.h>
#else
#include <sys/socket.h>

View File

@ -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();
}

View File

@ -17,10 +17,8 @@
#ifdef _WIN32
#include "Common/CommonWindows.h"
#ifndef _XBOX
// timeval already defined in xtl.h
#include <Winsock2.h>
#endif
#else
#include <sys/time.h>
#endif

View File

@ -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)

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -219,10 +219,6 @@ void DirectxInit(HWND window) {
// TODO
}
#ifdef _XBOX
pD3Ddevice->SetRingBufferParameters( &d3dr );
#endif
std::string errorMessage;
CompileShaders(errorMessage);

View File

@ -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 <string>
#include <d3d9.h>