aboutsummaryrefslogtreecommitdiff
path: root/libretro-common/include/retro_miscellaneous.h
diff options
context:
space:
mode:
Diffstat (limited to 'libretro-common/include/retro_miscellaneous.h')
-rw-r--r--libretro-common/include/retro_miscellaneous.h72
1 files changed, 63 insertions, 9 deletions
diff --git a/libretro-common/include/retro_miscellaneous.h b/libretro-common/include/retro_miscellaneous.h
index 02aa521..f0dfb5c 100644
--- a/libretro-common/include/retro_miscellaneous.h
+++ b/libretro-common/include/retro_miscellaneous.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2017 The RetroArch team
+/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_miscellaneous.h).
@@ -23,17 +23,24 @@
#ifndef __RARCH_MISCELLANEOUS_H
#define __RARCH_MISCELLANEOUS_H
+#define RARCH_MAX_SUBSYSTEMS 10
+#define RARCH_MAX_SUBSYSTEM_ROMS 10
+
#include <stdint.h>
#include <boolean.h>
#include <retro_inline.h>
-#if defined(_WIN32) && !defined(_XBOX)
+#if defined(_WIN32)
+
+#if defined(_XBOX)
+#include <Xtl.h>
+#else
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
-#elif defined(_WIN32) && defined(_XBOX)
-#include <Xtl.h>
+#endif
+
#endif
#include <limits.h>
@@ -68,7 +75,7 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
}
#ifndef PATH_MAX_LENGTH
-#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(GEKKO)|| defined(WIIU)
+#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__)
#define PATH_MAX_LENGTH 512
#else
#define PATH_MAX_LENGTH 4096
@@ -97,8 +104,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
#define BIT16_GET(a, bit) (((a) >> ((bit) & 15)) & 1)
#define BIT16_CLEAR_ALL(a) ((a) = 0)
-#define BIT32_SET(a, bit) ((a) |= (1 << ((bit) & 31)))
-#define BIT32_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 31)))
+#define BIT32_SET(a, bit) ((a) |= (UINT32_C(1) << ((bit) & 31)))
+#define BIT32_CLEAR(a, bit) ((a) &= ~(UINT32_C(1) << ((bit) & 31)))
#define BIT32_GET(a, bit) (((a) >> ((bit) & 31)) & 1)
#define BIT32_CLEAR_ALL(a) ((a) = 0)
@@ -107,8 +114,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
#define BIT64_GET(a, bit) (((a) >> ((bit) & 63)) & 1)
#define BIT64_CLEAR_ALL(a) ((a) = 0)
-#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (1 << ((bit) & 31)))
-#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(1 << ((bit) & 31)))
+#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (UINT32_C(1) << ((bit) & 31)))
+#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(UINT32_C(1) << ((bit) & 31)))
#define BIT128_GET(a, bit) (((a).data[(bit) >> 5] >> ((bit) & 31)) & 1)
#define BIT128_CLEAR_ALL(a) memset(&(a), 0, sizeof(a))
@@ -127,6 +134,16 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
#define BIT256_GET_PTR(a, bit) BIT256_GET(*a, bit)
#define BIT256_CLEAR_ALL_PTR(a) BIT256_CLEAR_ALL(*a)
+#define BIT512_SET(a, bit) BIT256_SET(a, bit)
+#define BIT512_CLEAR(a, bit) BIT256_CLEAR(a, bit)
+#define BIT512_GET(a, bit) BIT256_GET(a, bit)
+#define BIT512_CLEAR_ALL(a) BIT256_CLEAR_ALL(a)
+
+#define BIT512_SET_PTR(a, bit) BIT512_SET(*a, bit)
+#define BIT512_CLEAR_PTR(a, bit) BIT512_CLEAR(*a, bit)
+#define BIT512_GET_PTR(a, bit) BIT512_GET(*a, bit)
+#define BIT512_CLEAR_ALL_PTR(a) BIT512_CLEAR_ALL(*a)
+
#define BITS_COPY16_PTR(a,bits) \
{ \
BIT128_CLEAR_ALL_PTR(a); \
@@ -139,6 +156,13 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
BITS_GET_ELEM_PTR(a, 0) = (bits); \
}
+#define BITS_COPY64_PTR(a,bits) \
+{ \
+ BIT128_CLEAR_ALL_PTR(a); \
+ BITS_GET_ELEM_PTR(a, 0) = (bits); \
+ BITS_GET_ELEM_PTR(a, 1) = (bits >> 32); \
+}
+
/* Helper macros and struct to keep track of many booleans. */
/* This struct has 256 bits. */
typedef struct
@@ -146,4 +170,34 @@ typedef struct
uint32_t data[8];
} retro_bits_t;
+/* This struct has 512 bits. */
+typedef struct
+{
+ uint32_t data[16];
+} retro_bits_512_t;
+
+#ifdef _WIN32
+# ifdef _WIN64
+# define PRI_SIZET PRIu64
+# else
+# if _MSC_VER == 1800
+# define PRI_SIZET PRIu32
+# else
+# define PRI_SIZET "u"
+# endif
+# endif
+#elif defined(PS2)
+# define PRI_SIZET "u"
+#else
+# if (SIZE_MAX == 0xFFFF)
+# define PRI_SIZET "hu"
+# elif (SIZE_MAX == 0xFFFFFFFF)
+# define PRI_SIZET "u"
+# elif (SIZE_MAX == 0xFFFFFFFFFFFFFFFF)
+# define PRI_SIZET "lu"
+# else
+# error PRI_SIZET: unknown SIZE_MAX
+# endif
+#endif
+
#endif