Delete some left behind unused code
This commit is contained in:
parent
524854ac16
commit
5df4bac6d2
17 changed files with 17 additions and 127 deletions
|
@ -75,7 +75,6 @@ inline u64 __rotr64(u64 x, unsigned int shift){
|
||||||
#define ftello _ftelli64
|
#define ftello _ftelli64
|
||||||
#define atoll _atoi64
|
#define atoll _atoi64
|
||||||
#define fileno _fileno
|
#define fileno _fileno
|
||||||
#ifndef _XBOX
|
|
||||||
#if _M_IX86
|
#if _M_IX86
|
||||||
#define Crash() {__asm int 3}
|
#define Crash() {__asm int 3}
|
||||||
#else
|
#else
|
||||||
|
@ -84,9 +83,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#define Crash() {DebugBreak();}
|
#define Crash() {DebugBreak();}
|
||||||
#endif // M_IX86
|
#endif // M_IX86
|
||||||
#else
|
|
||||||
#define Crash() {DebugBreak();}
|
|
||||||
#endif // _XBOX ndef
|
|
||||||
#endif // WIN32 ndef
|
#endif // WIN32 ndef
|
||||||
|
|
||||||
// Generic function to get last error message.
|
// Generic function to get last error message.
|
||||||
|
|
|
@ -27,11 +27,9 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "CommonWindows.h"
|
#include "CommonWindows.h"
|
||||||
#ifndef _XBOX
|
|
||||||
#include <shlobj.h> // for SHGetFolderPath
|
#include <shlobj.h> // for SHGetFolderPath
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <commdlg.h> // for GetSaveFileName
|
#include <commdlg.h> // for GetSaveFileName
|
||||||
#endif
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <direct.h> // getcwd
|
#include <direct.h> // getcwd
|
||||||
#else
|
#else
|
||||||
|
@ -711,7 +709,6 @@ void openIniFile(const std::string fileName) {
|
||||||
std::string GetCurrentDir()
|
std::string GetCurrentDir()
|
||||||
{
|
{
|
||||||
char *dir;
|
char *dir;
|
||||||
#ifndef _XBOX
|
|
||||||
// Get the current working directory (getcwd uses malloc)
|
// Get the current working directory (getcwd uses malloc)
|
||||||
if (!(dir = __getcwd(NULL, 0))) {
|
if (!(dir = __getcwd(NULL, 0))) {
|
||||||
|
|
||||||
|
@ -722,28 +719,19 @@ std::string GetCurrentDir()
|
||||||
std::string strDir = dir;
|
std::string strDir = dir;
|
||||||
free(dir);
|
free(dir);
|
||||||
return strDir;
|
return strDir;
|
||||||
#else
|
|
||||||
return "game:\\";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the current directory to the given directory
|
// Sets the current directory to the given directory
|
||||||
bool SetCurrentDir(const std::string &directory)
|
bool SetCurrentDir(const std::string &directory)
|
||||||
{
|
{
|
||||||
#ifndef _XBOX
|
|
||||||
return __chdir(directory.c_str()) == 0;
|
return __chdir(directory.c_str()) == 0;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &GetExeDirectory()
|
const std::string &GetExeDirectory()
|
||||||
{
|
{
|
||||||
static std::string ExePath;
|
static std::string ExePath;
|
||||||
|
|
||||||
if (ExePath.empty())
|
if (ExePath.empty()) {
|
||||||
#ifndef _XBOX
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
TCHAR program_path[4096] = {0};
|
TCHAR program_path[4096] = {0};
|
||||||
GetModuleFileName(NULL, program_path, ARRAY_SIZE(program_path) - 1);
|
GetModuleFileName(NULL, program_path, ARRAY_SIZE(program_path) - 1);
|
||||||
|
@ -789,10 +777,6 @@ const std::string &GetExeDirectory()
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExePath;
|
return ExePath;
|
||||||
#else
|
|
||||||
static std::wstring ExePath = L"game:\\";
|
|
||||||
return ExePath;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -880,7 +864,6 @@ bool IOFile::Flush()
|
||||||
|
|
||||||
bool IOFile::Resize(u64 size)
|
bool IOFile::Resize(u64 size)
|
||||||
{
|
{
|
||||||
#ifndef _XBOX
|
|
||||||
if (!IsOpen() || 0 !=
|
if (!IsOpen() || 0 !=
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// ector: _chsize sucks, not 64-bit safe
|
// ector: _chsize sucks, not 64-bit safe
|
||||||
|
@ -894,10 +877,6 @@ bool IOFile::Resize(u64 size)
|
||||||
m_good = false;
|
m_good = false;
|
||||||
|
|
||||||
return m_good;
|
return m_good;
|
||||||
#else
|
|
||||||
// TODO: Implement.
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -99,7 +99,7 @@ LogManager::LogManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file logging on small devices
|
// Remove file logging on small devices
|
||||||
#if !(defined(MOBILE_DEVICE) || defined(_XBOX)) || defined(_DEBUG)
|
#if !(defined(MOBILE_DEVICE) || defined(_DEBUG))
|
||||||
fileLog_ = new FileLogListener("");
|
fileLog_ = new FileLogListener("");
|
||||||
consoleLog_ = new ConsoleListener();
|
consoleLog_ = new ConsoleListener();
|
||||||
debuggerLog_ = new DebuggerLogListener();
|
debuggerLog_ = new DebuggerLogListener();
|
||||||
|
@ -112,7 +112,7 @@ LogManager::LogManager() {
|
||||||
|
|
||||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
|
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
|
||||||
log_[i]->SetEnable(true);
|
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(fileLog_);
|
||||||
log_[i]->AddListener(consoleLog_);
|
log_[i]->AddListener(consoleLog_);
|
||||||
#if defined(_MSC_VER) && defined(USING_WIN_UI)
|
#if defined(_MSC_VER) && defined(USING_WIN_UI)
|
||||||
|
|
|
@ -91,7 +91,9 @@ int ashmem_unpin_region(int fd, size_t offset, size_t len) {
|
||||||
}
|
}
|
||||||
#endif // Android
|
#endif // Android
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifdef _WIN32
|
||||||
|
SYSTEM_INFO sysInfo;
|
||||||
|
#else
|
||||||
static const std::string tmpfs_location = "/dev/shm";
|
static const std::string tmpfs_location = "/dev/shm";
|
||||||
static const std::string tmpfs_ram_temp_file = "/dev/shm/gc_mem.tmp";
|
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
|
#else
|
||||||
std::string ram_temp_file = "/tmp/gc_mem.tmp";
|
std::string ram_temp_file = "/tmp/gc_mem.tmp";
|
||||||
#endif
|
#endif
|
||||||
#elif !defined(_XBOX)
|
|
||||||
SYSTEM_INFO sysInfo;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Windows mappings need to be on 64K boundaries, due to Alpha legacy.
|
// Windows mappings need to be on 64K boundaries, due to Alpha legacy.
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
size_t MemArena::roundup(size_t x) {
|
size_t MemArena::roundup(size_t x) {
|
||||||
#ifndef _XBOX
|
|
||||||
int gran = sysInfo.dwAllocationGranularity ? sysInfo.dwAllocationGranularity : 0x10000;
|
int gran = sysInfo.dwAllocationGranularity ? sysInfo.dwAllocationGranularity : 0x10000;
|
||||||
#else
|
|
||||||
int gran = 0x10000; // 64k in 360
|
|
||||||
#endif
|
|
||||||
return (x + gran - 1) & ~(gran - 1);
|
return (x + gran - 1) & ~(gran - 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -125,10 +120,8 @@ size_t MemArena::roundup(size_t x) {
|
||||||
void MemArena::GrabLowMemSpace(size_t size)
|
void MemArena::GrabLowMemSpace(size_t size)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef _XBOX
|
|
||||||
hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL);
|
hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL);
|
||||||
GetSystemInfo(&sysInfo);
|
GetSystemInfo(&sysInfo);
|
||||||
#endif
|
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
// Use ashmem so we don't have to allocate a file on disk!
|
// Use ashmem so we don't have to allocate a file on disk!
|
||||||
fd = ashmem_create_region("PPSSPP_RAM", size);
|
fd = ashmem_create_region("PPSSPP_RAM", size);
|
||||||
|
@ -169,9 +162,7 @@ void MemArena::GrabLowMemSpace(size_t size)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemArena::ReleaseSpace() {
|
||||||
void MemArena::ReleaseSpace()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CloseHandle(hMemoryMapping);
|
CloseHandle(hMemoryMapping);
|
||||||
hMemoryMapping = 0;
|
hMemoryMapping = 0;
|
||||||
|
@ -180,20 +171,12 @@ void MemArena::ReleaseSpace()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *MemArena::CreateView(s64 offset, size_t size, void *base)
|
void *MemArena::CreateView(s64 offset, size_t size, void *base)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#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);
|
size = roundup(size);
|
||||||
void *ptr = MapViewOfFileEx(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size, base);
|
void *ptr = MapViewOfFileEx(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size, base);
|
||||||
return ptr;
|
return ptr;
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
void *retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED |
|
void *retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED |
|
||||||
// Do not sync memory to underlying file. Linux has this by default.
|
// 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemArena::ReleaseView(void* view, size_t size) {
|
||||||
void MemArena::ReleaseView(void* view, size_t size)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef _XBOX
|
|
||||||
UnmapViewOfFile(view);
|
UnmapViewOfFile(view);
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
munmap(view, size);
|
munmap(view, size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* MemArena::Find4GBBase()
|
u8* MemArena::Find4GBBase() {
|
||||||
{
|
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// 64 bit
|
// 64 bit
|
||||||
|
|
|
@ -33,20 +33,15 @@
|
||||||
// This function might change the error code.
|
// This function might change the error code.
|
||||||
const char *GetLastErrorMsg()
|
const char *GetLastErrorMsg()
|
||||||
{
|
{
|
||||||
#ifndef _XBOX
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return GetStringErrorMsg(GetLastError());
|
return GetStringErrorMsg(GetLastError());
|
||||||
#else
|
#else
|
||||||
return GetStringErrorMsg(errno);
|
return GetStringErrorMsg(errno);
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
return "GetLastErrorMsg";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetStringErrorMsg(int errCode) {
|
const char *GetStringErrorMsg(int errCode) {
|
||||||
static const size_t buff_size = 1023;
|
static const size_t buff_size = 1023;
|
||||||
#ifndef _XBOX
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static __declspec(thread) wchar_t err_strw[buff_size] = {};
|
static __declspec(thread) wchar_t err_strw[buff_size] = {};
|
||||||
|
|
||||||
|
@ -66,7 +61,4 @@ const char *GetStringErrorMsg(int errCode) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return err_str;
|
return err_str;
|
||||||
#else
|
|
||||||
return "GetStringErrorMsg";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,7 @@
|
||||||
// MSVC
|
// MSVC
|
||||||
#elif defined(_MSC_VER) && !defined(COMMON_BIG_ENDIAN) && !defined(COMMON_LITTLE_ENDIAN)
|
#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
|
#define COMMON_LITTLE_ENDIAN 1
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -62,15 +58,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#ifndef _XBOX
|
|
||||||
inline unsigned long long bswap64(unsigned long long x) { return _byteswap_uint64(x); }
|
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 int bswap32(unsigned int x) { return _byteswap_ulong(x); }
|
||||||
inline unsigned short bswap16(unsigned short x) { return _byteswap_ushort(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__) || \
|
#elif defined(__DragonFly__) || defined(__FreeBSD__) || \
|
||||||
defined(__NetBSD__) || defined(__OpenBSD__)
|
defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "CommonWindows.h"
|
#include "CommonWindows.h"
|
||||||
#ifndef _XBOX
|
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#endif
|
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -35,9 +33,7 @@ namespace Common
|
||||||
|
|
||||||
u32 Timer::GetTimeMs()
|
u32 Timer::GetTimeMs()
|
||||||
{
|
{
|
||||||
#ifdef _XBOX
|
#if defined(_WIN32)
|
||||||
return GetTickCount();
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
return timeGetTime();
|
return timeGetTime();
|
||||||
#else
|
#else
|
||||||
// REALTIME is probably not a good idea for measuring updates.
|
// REALTIME is probably not a good idea for measuring updates.
|
||||||
|
|
|
@ -36,10 +36,7 @@
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
// Net stuff
|
// Net stuff
|
||||||
#ifdef _XBOX
|
#if defined(_MSC_VER)
|
||||||
#include <winsockx.h>
|
|
||||||
typedef int socklen_t;
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -32,10 +32,7 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
// Net stuff
|
// Net stuff
|
||||||
#ifdef _XBOX
|
#if defined(_MSC_VER)
|
||||||
#include <winsockx.h>
|
|
||||||
typedef int socklen_t;
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
|
@ -588,11 +588,6 @@ void __IoInit() {
|
||||||
if (ioManagerThreadEnabled) {
|
if (ioManagerThreadEnabled) {
|
||||||
Core_ListenShutdown(&__IoWakeManager);
|
Core_ListenShutdown(&__IoWakeManager);
|
||||||
ioManagerThread = new std::thread(&__IoManagerThread);
|
ioManagerThread = new std::thread(&__IoManagerThread);
|
||||||
#ifdef _XBOX
|
|
||||||
SuspendThread(ioManagerThread->native_handle());
|
|
||||||
XSetThreadProcessor(ioManagerThread->native_handle(), 4);
|
|
||||||
ResumeThread(ioManagerThread->native_handle());
|
|
||||||
#endif
|
|
||||||
ioManagerThread->detach();
|
ioManagerThread->detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,8 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "Common/CommonWindows.h"
|
#include "Common/CommonWindows.h"
|
||||||
#ifndef _XBOX
|
|
||||||
// timeval already defined in xtl.h
|
// timeval already defined in xtl.h
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -138,12 +138,8 @@ static bool Memory_TryBase(u32 flags) {
|
||||||
// OK, we know where to find free space. Now grab it!
|
// OK, we know where to find free space. Now grab it!
|
||||||
// We just mimic the popular BAT setup.
|
// We just mimic the popular BAT setup.
|
||||||
|
|
||||||
#if defined(_XBOX)
|
|
||||||
void *ptr;
|
|
||||||
#else
|
|
||||||
size_t position = 0;
|
size_t position = 0;
|
||||||
size_t last_position = 0;
|
size_t last_position = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Zero all the pointers to be sure.
|
// Zero all the pointers to be sure.
|
||||||
for (int i = 0; i < num_views; i++)
|
for (int i = 0; i < num_views; i++)
|
||||||
|
@ -162,13 +158,6 @@ static bool Memory_TryBase(u32 flags) {
|
||||||
continue;
|
continue;
|
||||||
SKIP(flags, view.flags);
|
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) {
|
if (view.flags & MV_MIRROR_PREVIOUS) {
|
||||||
position = last_position;
|
position = last_position;
|
||||||
} else {
|
} else {
|
||||||
|
@ -192,7 +181,6 @@ static bool Memory_TryBase(u32 flags) {
|
||||||
#endif
|
#endif
|
||||||
last_position = position;
|
last_position = position;
|
||||||
position += g_arena.roundup(view.size);
|
position += g_arena.roundup(view.size);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -223,9 +211,6 @@ bail:
|
||||||
void MemoryMap_Setup(u32 flags)
|
void MemoryMap_Setup(u32 flags)
|
||||||
{
|
{
|
||||||
// Find a base to reserve 256MB
|
// 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;
|
size_t total_mem = 0;
|
||||||
|
|
||||||
for (int i = 0; i < num_views; i++)
|
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.
|
// Linux32 is fine with the x64 method, although limited to 32-bit with no automirrors.
|
||||||
base = MemArena::Find4GBBase();
|
base = MemArena::Find4GBBase();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Now, create views in high memory where there's plenty of space.
|
// Now, create views in high memory where there's plenty of space.
|
||||||
#if defined(_WIN32) && !defined(_M_X64)
|
#if defined(_WIN32) && !defined(_M_X64)
|
||||||
|
|
|
@ -89,7 +89,7 @@ LPDIRECT3DTEXTURE9 DepalShaderCacheDX9::GetClutTexture(GEPaletteFormat clutForma
|
||||||
usage = D3DUSAGE_DYNAMIC; // TODO: Switch to using a staging texture?
|
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)) {
|
if (FAILED(hr)) {
|
||||||
ERROR_LOG(G3D, "Failed to create D3D texture for depal");
|
ERROR_LOG(G3D, "Failed to create D3D texture for depal");
|
||||||
delete tex;
|
delete tex;
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace DX9 {
|
||||||
pool = D3DPOOL_DEFAULT;
|
pool = D3DPOOL_DEFAULT;
|
||||||
usage = D3DUSAGE_DYNAMIC;
|
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)) {
|
if (FAILED(hr)) {
|
||||||
drawPixelsTex_ = nullptr;
|
drawPixelsTex_ = nullptr;
|
||||||
ERROR_LOG(G3D, "Failed to create drawpixels texture");
|
ERROR_LOG(G3D, "Failed to create drawpixels texture");
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ ReplacedTextureFormat FromD3D9Format(u32 fmt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ToD3D9Format(ReplacedTextureFormat fmt) {
|
D3DFORMAT ToD3D9Format(ReplacedTextureFormat fmt) {
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case ReplacedTextureFormat::F_5650:
|
case ReplacedTextureFormat::F_5650:
|
||||||
return D3DFMT_R5G6B5;
|
return D3DFMT_R5G6B5;
|
||||||
|
@ -1369,9 +1369,9 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re
|
||||||
}
|
}
|
||||||
int levels = scaleFactor == 1 ? maxLevel + 1 : 1;
|
int levels = scaleFactor == 1 ? maxLevel + 1 : 1;
|
||||||
int tw = w, th = h;
|
int tw = w, th = h;
|
||||||
D3DFORMAT tfmt = (D3DFORMAT)D3DFMT(dstFmt);
|
D3DFORMAT tfmt = (D3DFORMAT)(dstFmt);
|
||||||
if (replaced.GetSize(level, tw, th)) {
|
if (replaced.GetSize(level, tw, th)) {
|
||||||
tfmt = (D3DFORMAT)D3DFMT(ToD3D9Format(replaced.Format(level)));
|
tfmt = ToD3D9Format(replaced.Format(level));
|
||||||
} else {
|
} else {
|
||||||
tw *= scaleFactor;
|
tw *= scaleFactor;
|
||||||
th *= scaleFactor;
|
th *= scaleFactor;
|
||||||
|
|
|
@ -219,10 +219,6 @@ void DirectxInit(HWND window) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _XBOX
|
|
||||||
pD3Ddevice->SetRingBufferParameters( &d3dr );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
CompileShaders(errorMessage);
|
CompileShaders(errorMessage);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Common/CommonWindows.h"
|
#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 <string>
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue