summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/common.h6
-rw-r--r--src/common/common_paths.h37
-rw-r--r--src/common/common_types.h16
-rw-r--r--src/common/file_util.cpp10
-rw-r--r--src/common/file_util.h5
-rw-r--r--src/common/mem_arena.cpp84
-rw-r--r--src/common/mem_arena.h8
-rw-r--r--src/common/platform.h1
-rw-r--r--src/common/swap.h4
9 files changed, 25 insertions, 146 deletions
diff --git a/src/common/common.h b/src/common/common.h
index ba33373ae..bf48ae667 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -154,16 +154,10 @@ enum EMUSTATE_CHANGE
#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
-#else
// TODO: speedup
inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); }
inline unsigned int bswap32(unsigned int x) { return (x >> 24) | ((x & 0xFF0000) >> 8) | ((x & 0xFF00) << 8) | (x << 24);}
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index e692e5492..0ecf2d9de 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -35,26 +35,23 @@
#define JAP_DIR "JAP"
// Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
-#define CONFIG_DIR "config"
-#define GAMECONFIG_DIR "game_config"
-#define MAPS_DIR "maps"
-#define CACHE_DIR "cache"
-#define SDMC_DIR "sdmc"
-#define EXTSAVEDATA_DIR "extsavedata"
-#define SAVEDATA_DIR "savedata"
-#define SAVEDATACHECK_DIR "savedatacheck"
-#define SYSDATA_DIR "sysdata"
-#define SYSSAVEDATA_DIR "syssavedata"
-#define SHADERCACHE_DIR "shader_cache"
-#define STATESAVES_DIR "state_saves"
-#define SCREENSHOTS_DIR "screenShots"
-#define DUMP_DIR "dump"
-#define DUMP_TEXTURES_DIR "textures"
-#define DUMP_FRAMES_DIR "frames"
-#define DUMP_AUDIO_DIR "audio"
-#define LOGS_DIR "logs"
-#define SHADERS_DIR "shaders"
-#define SYSCONF_DIR "sysconf"
+#define CONFIG_DIR "config"
+#define GAMECONFIG_DIR "game_config"
+#define MAPS_DIR "maps"
+#define CACHE_DIR "cache"
+#define SDMC_DIR "sdmc"
+#define NAND_DIR "nand"
+#define SYSDATA_DIR "sysdata"
+#define SHADERCACHE_DIR "shader_cache"
+#define STATESAVES_DIR "state_saves"
+#define SCREENSHOTS_DIR "screenShots"
+#define DUMP_DIR "dump"
+#define DUMP_TEXTURES_DIR "textures"
+#define DUMP_FRAMES_DIR "frames"
+#define DUMP_AUDIO_DIR "audio"
+#define LOGS_DIR "logs"
+#define SHADERS_DIR "shaders"
+#define SYSCONF_DIR "sysconf"
// Filenames
// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
diff --git a/src/common/common_types.h b/src/common/common_types.h
index c74c74f0f..94e1406b1 100644
--- a/src/common/common_types.h
+++ b/src/common/common_types.h
@@ -26,7 +26,7 @@
#include <cmath>
#include <cstdint>
-#include <xmmintrin.h> // data_types__m128.cpp
+#include <cstdlib>
typedef std::uint8_t u8; ///< 8-bit unsigned byte
typedef std::uint16_t u16; ///< 16-bit unsigned short
@@ -67,16 +67,6 @@ union t64 {
u8 _u8[8]; ///< 8-bit unsigned char(s)
};
-/// Union for fast 128-bit type casting
-union t128 {
- struct
- {
- t64 ps0; ///< 64-bit paired single 0
- t64 ps1; ///< 64-bit paired single 1
- };
- __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers)
-};
-
namespace Common {
/// Rectangle data structure
class Rect {
@@ -94,8 +84,8 @@ public:
int x1_; ///< Rect bottom left X-coordinate
int y1_; ///< Rect bottom right Y-coordinate
- inline u32 width() const { return abs(x1_ - x0_); }
- inline u32 height() const { return abs(y1_ - y0_); }
+ inline u32 width() const { return std::abs(x1_ - x0_); }
+ inline u32 height() const { return std::abs(y1_ - y0_); }
inline bool operator == (const Rect& val) const {
return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_);
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 0a6cd80c8..706e7c842 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -676,11 +676,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
- paths[D_EXTSAVEDATA] = paths[D_USER_IDX] + EXTSAVEDATA_DIR DIR_SEP;
- paths[D_SAVEDATA_IDX] = paths[D_USER_IDX] + SAVEDATA_DIR DIR_SEP;
- paths[D_SAVEDATACHECK_IDX] = paths[D_USER_IDX] + SAVEDATACHECK_DIR DIR_SEP;
+ paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP;
- paths[D_SYSSAVEDATA_IDX] = paths[D_USER_IDX] + SYSSAVEDATA_DIR DIR_SEP;
paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
@@ -722,10 +719,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
- paths[D_EXTSAVEDATA] = paths[D_USER_IDX] + EXTSAVEDATA_DIR DIR_SEP;
- paths[D_SAVEDATA_IDX] = paths[D_USER_IDX] + SAVEDATA_DIR DIR_SEP;
- paths[D_SAVEDATACHECK_IDX] = paths[D_USER_IDX] + SAVEDATACHECK_DIR DIR_SEP;
- paths[D_SYSSAVEDATA_IDX] = paths[D_USER_IDX] + SYSSAVEDATA_DIR DIR_SEP;
+ paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP;
paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
diff --git a/src/common/file_util.h b/src/common/file_util.h
index c83ecd87d..86aab2e3d 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -27,11 +27,8 @@ enum {
D_STATESAVES_IDX,
D_SCREENSHOTS_IDX,
D_SDMC_IDX,
- D_EXTSAVEDATA,
- D_SAVEDATA_IDX,
- D_SAVEDATACHECK_IDX,
+ D_NAND_IDX,
D_SYSDATA_IDX,
- D_SYSSAVEDATA_IDX,
D_HIRESTEXTURES_IDX,
D_DUMP_IDX,
D_DUMPFRAMES_IDX,
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp
index 9904d2472..a20361d6f 100644
--- a/src/common/mem_arena.cpp
+++ b/src/common/mem_arena.cpp
@@ -29,10 +29,6 @@
#endif
#endif
-#ifdef IOS
-void* globalbase = nullptr;
-#endif
-
#ifdef ANDROID
// Hopefully this ABI will never change...
@@ -95,7 +91,7 @@ int ashmem_unpin_region(int fd, size_t offset, size_t len)
#endif // Android
-#if defined(_WIN32) && !defined(_XBOX)
+#if defined(_WIN32)
SYSTEM_INFO sysInfo;
#endif
@@ -103,11 +99,7 @@ SYSTEM_INFO sysInfo;
// Windows mappings need to be on 64K boundaries, due to Alpha legacy.
#ifdef _WIN32
size_t 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
@@ -120,10 +112,8 @@ size_t roundup(size_t x) {
void MemArena::GrabLowMemSpace(size_t size)
{
#ifdef _WIN32
-#ifndef _XBOX
hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, (DWORD)(size), nullptr);
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);
@@ -163,9 +153,6 @@ void MemArena::ReleaseSpace()
#ifdef _WIN32
CloseHandle(hMemoryMapping);
hMemoryMapping = 0;
-#elif defined(__SYMBIAN32__)
- memmap->Close();
- delete memmap;
#else
close(fd);
#endif
@@ -175,22 +162,13 @@ void MemArena::ReleaseSpace()
void *MemArena::CreateView(s64 offset, size_t size, void *base)
{
#ifdef _WIN32
-#ifdef _XBOX
- size = roundup(size);
- // use 64kb pages
- void * ptr = VirtualAlloc(nullptr, 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.
-#ifdef BLACKBERRY
- MAP_NOSYNCFILE |
-#elif defined(__FreeBSD__)
+#ifdef __FreeBSD__
MAP_NOSYNC |
#endif
((base == nullptr) ? 0 : MAP_FIXED), fd, offset);
@@ -208,17 +186,12 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base)
void MemArena::ReleaseView(void* view, size_t size)
{
#ifdef _WIN32
-#ifndef _XBOX
UnmapViewOfFile(view);
-#endif
-#elif defined(__SYMBIAN32__)
- memmap->Decommit(((int)view - (int)memmap->Base()) & 0x3FFFFFFF, size);
#else
munmap(view, size);
#endif
}
-#ifndef __SYMBIAN32__
u8* MemArena::Find4GBBase()
{
#ifdef _M_X64
@@ -242,20 +215,6 @@ u8* MemArena::Find4GBBase()
}
return base;
#else
-#ifdef IOS
- void* base = nullptr;
- if (globalbase == nullptr){
- base = mmap(0, 0x08000000, PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_SHARED, -1, 0);
- if (base == MAP_FAILED) {
- PanicAlert("Failed to map 128 MB of memory space: %s", strerror(errno));
- return 0;
- }
- munmap(base, 0x08000000);
- globalbase = base;
- }
- else{ base = globalbase; }
-#else
void* base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0);
if (base == MAP_FAILED) {
@@ -263,12 +222,10 @@ u8* MemArena::Find4GBBase()
return 0;
}
munmap(base, 0x10000000);
-#endif
return static_cast<u8*>(base);
#endif
#endif
}
-#endif
// yeah, this could also be done in like two bitwise ops...
@@ -284,10 +241,6 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32
size_t position = 0;
size_t last_position = 0;
-#if defined(_XBOX)
- void *ptr;
-#endif
-
// Zero all the pointers to be sure.
for (int i = 0; i < num_views; i++)
{
@@ -308,18 +261,6 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32
position = last_position;
}
else {
-#ifdef __SYMBIAN32__
- *(view.out_ptr_low) = (u8*)((int)arena->memmap->Base() + view.virtual_address);
- arena->memmap->Commit(view.virtual_address & 0x3FFFFFFF, view.size);
- }
- *(view.out_ptr) = (u8*)((int)arena->memmap->Base() + view.virtual_address & 0x3FFFFFFF);
-#elif defined(_XBOX)
- *(view.out_ptr_low) = (u8*)(base + view.virtual_address);
- //arena->memmap->Commit(view.virtual_address & 0x3FFFFFFF, view.size);
- ptr = VirtualAlloc(base + (view.virtual_address & 0x3FFFFFFF), view.size, MEM_COMMIT, PAGE_READWRITE);
- }
- *(view.out_ptr) = (u8*)base + (view.virtual_address & 0x3FFFFFFF);
-#else
*(view.out_ptr_low) = (u8*)arena->CreateView(position, view.size);
if (!*view.out_ptr_low)
goto bail;
@@ -340,7 +281,6 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32
}
#endif
-#endif
last_position = position;
position += roundup(view.size);
}
@@ -389,9 +329,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
total_mem += roundup(views[i].size);
}
// Grab some pagefile backed memory out of the void ...
-#ifndef __SYMBIAN32__
arena->GrabLowMemSpace(total_mem);
-#endif
// Now, create views in high memory where there's plenty of space.
#ifdef _M_X64
@@ -403,15 +341,6 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
return 0;
}
-#elif defined(_XBOX)
- // Reserve 256MB
- u8 *base = (u8*)VirtualAlloc(0, 0x10000000, MEM_RESERVE | MEM_LARGE_PAGES, PAGE_READWRITE);
- if (!Memory_TryBase(base, views, num_views, flags, arena))
- {
- PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
- exit(0);
- return 0;
- }
#elif defined(_WIN32)
// Try a whole range of possible bases. Return once we got a valid one.
u32 max_base_addr = 0x7FFF0000 - 0x10000000;
@@ -428,15 +357,6 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
break;
}
}
-#elif defined(__SYMBIAN32__)
- arena->memmap = new RChunk();
- arena->memmap->CreateDisconnectedLocal(0, 0, 0x10000000);
- if (!Memory_TryBase(arena->memmap->Base(), views, num_views, flags, arena))
- {
- PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
- return 0;
- }
- u8* base = arena->memmap->Base();
#else
// Linux32 is fine with the x64 method, although limited to 32-bit with no automirrors.
u8 *base = MemArena::Find4GBBase();
diff --git a/src/common/mem_arena.h b/src/common/mem_arena.h
index b5f0aa890..3379d2529 100644
--- a/src/common/mem_arena.h
+++ b/src/common/mem_arena.h
@@ -21,10 +21,6 @@
#include <windows.h>
#endif
-#ifdef __SYMBIAN32__
-#include <e32std.h>
-#endif
-
#include "common/common.h"
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
@@ -39,12 +35,8 @@ public:
void *CreateView(s64 offset, size_t size, void *base = 0);
void ReleaseView(void *view, size_t size);
-#ifdef __SYMBIAN32__
- RChunk* memmap;
-#else
// This only finds 1 GB in 32-bit
static u8 *Find4GBBase();
-#endif
private:
#ifdef _WIN32
diff --git a/src/common/platform.h b/src/common/platform.h
index ce9cfd4a2..ba1109c9f 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -35,7 +35,6 @@
#define PLATFORM_MACOSX 2
#define PLATFORM_LINUX 3
#define PLATFORM_ANDROID 4
-#define PLATFORM_IOS 5
////////////////////////////////////////////////////////////////////////////////////////////////////
// Platform detection
diff --git a/src/common/swap.h b/src/common/swap.h
index 4f8f39efb..e2d918362 100644
--- a/src/common/swap.h
+++ b/src/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