Notable differences from upstream:
* Did not use the same #include setup for the new byuu apu and instead chose to do things more traditionally, as the latter is also much easier to deal with in Visual Studio than just including .cpp files into other .cpp files...
* MSU1 support not included (I see no need for this in a plugin meant to be used for original SNES music).
* The dynamic rate control on the APU not included (I also see no need for it in this plugin).
* The extra resamplers I added in were removed as the original hermite resampler was folded into a single non-inhertiable resampler.
* Bits of cleanup.
| ... | ... |
@@ -1,179 +1,8 @@ |
| 1 |
-/*********************************************************************************** |
|
| 1 |
+/*****************************************************************************\ |
|
| 2 | 2 |
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. |
| 3 |
- |
|
| 4 |
- (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com), |
|
| 5 |
- Jerremy Koot (jkoot@snes9x.com) |
|
| 6 |
- |
|
| 7 |
- (c) Copyright 2002 - 2004 Matthew Kendora |
|
| 8 |
- |
|
| 9 |
- (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) |
|
| 10 |
- |
|
| 11 |
- (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) |
|
| 12 |
- |
|
| 13 |
- (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) |
|
| 14 |
- |
|
| 15 |
- (c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca), |
|
| 16 |
- Kris Bleakley (codeviolation@hotmail.com) |
|
| 17 |
- |
|
| 18 |
- (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), |
|
| 19 |
- Nach (n-a-c-h@users.sourceforge.net), |
|
| 20 |
- |
|
| 21 |
- (c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com) |
|
| 22 |
- |
|
| 23 |
- (c) Copyright 2006 - 2007 nitsuja |
|
| 24 |
- |
|
| 25 |
- (c) Copyright 2009 - 2011 BearOso, |
|
| 26 |
- OV2 |
|
| 27 |
- |
|
| 28 |
- |
|
| 29 |
- BS-X C emulator code |
|
| 30 |
- (c) Copyright 2005 - 2006 Dreamer Nom, |
|
| 31 |
- zones |
|
| 32 |
- |
|
| 33 |
- C4 x86 assembler and some C emulation code |
|
| 34 |
- (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), |
|
| 35 |
- Nach, |
|
| 36 |
- zsKnight (zsknight@zsnes.com) |
|
| 37 |
- |
|
| 38 |
- C4 C++ code |
|
| 39 |
- (c) Copyright 2003 - 2006 Brad Jorsch, |
|
| 40 |
- Nach |
|
| 41 |
- |
|
| 42 |
- DSP-1 emulator code |
|
| 43 |
- (c) Copyright 1998 - 2006 _Demo_, |
|
| 44 |
- Andreas Naive (andreasnaive@gmail.com), |
|
| 45 |
- Gary Henderson, |
|
| 46 |
- Ivar (ivar@snes9x.com), |
|
| 47 |
- John Weidman, |
|
| 48 |
- Kris Bleakley, |
|
| 49 |
- Matthew Kendora, |
|
| 50 |
- Nach, |
|
| 51 |
- neviksti (neviksti@hotmail.com) |
|
| 52 |
- |
|
| 53 |
- DSP-2 emulator code |
|
| 54 |
- (c) Copyright 2003 John Weidman, |
|
| 55 |
- Kris Bleakley, |
|
| 56 |
- Lord Nightmare (lord_nightmare@users.sourceforge.net), |
|
| 57 |
- Matthew Kendora, |
|
| 58 |
- neviksti |
|
| 59 |
- |
|
| 60 |
- DSP-3 emulator code |
|
| 61 |
- (c) Copyright 2003 - 2006 John Weidman, |
|
| 62 |
- Kris Bleakley, |
|
| 63 |
- Lancer, |
|
| 64 |
- z80 gaiden |
|
| 65 |
- |
|
| 66 |
- DSP-4 emulator code |
|
| 67 |
- (c) Copyright 2004 - 2006 Dreamer Nom, |
|
| 68 |
- John Weidman, |
|
| 69 |
- Kris Bleakley, |
|
| 70 |
- Nach, |
|
| 71 |
- z80 gaiden |
|
| 72 |
- |
|
| 73 |
- OBC1 emulator code |
|
| 74 |
- (c) Copyright 2001 - 2004 zsKnight, |
|
| 75 |
- pagefault (pagefault@zsnes.com), |
|
| 76 |
- Kris Bleakley |
|
| 77 |
- Ported from x86 assembler to C by sanmaiwashi |
|
| 78 |
- |
|
| 79 |
- SPC7110 and RTC C++ emulator code used in 1.39-1.51 |
|
| 80 |
- (c) Copyright 2002 Matthew Kendora with research by |
|
| 81 |
- zsKnight, |
|
| 82 |
- John Weidman, |
|
| 83 |
- Dark Force |
|
| 84 |
- |
|
| 85 |
- SPC7110 and RTC C++ emulator code used in 1.52+ |
|
| 86 |
- (c) Copyright 2009 byuu, |
|
| 87 |
- neviksti |
|
| 88 |
- |
|
| 89 |
- S-DD1 C emulator code |
|
| 90 |
- (c) Copyright 2003 Brad Jorsch with research by |
|
| 91 |
- Andreas Naive, |
|
| 92 |
- John Weidman |
|
| 93 |
- |
|
| 94 |
- S-RTC C emulator code |
|
| 95 |
- (c) Copyright 2001 - 2006 byuu, |
|
| 96 |
- John Weidman |
|
| 97 |
- |
|
| 98 |
- ST010 C++ emulator code |
|
| 99 |
- (c) Copyright 2003 Feather, |
|
| 100 |
- John Weidman, |
|
| 101 |
- Kris Bleakley, |
|
| 102 |
- Matthew Kendora |
|
| 103 |
- |
|
| 104 |
- Super FX x86 assembler emulator code |
|
| 105 |
- (c) Copyright 1998 - 2003 _Demo_, |
|
| 106 |
- pagefault, |
|
| 107 |
- zsKnight |
|
| 108 |
- |
|
| 109 |
- Super FX C emulator code |
|
| 110 |
- (c) Copyright 1997 - 1999 Ivar, |
|
| 111 |
- Gary Henderson, |
|
| 112 |
- John Weidman |
|
| 113 |
- |
|
| 114 |
- Sound emulator code used in 1.5-1.51 |
|
| 115 |
- (c) Copyright 1998 - 2003 Brad Martin |
|
| 116 |
- (c) Copyright 1998 - 2006 Charles Bilyue' |
|
| 117 |
- |
|
| 118 |
- Sound emulator code used in 1.52+ |
|
| 119 |
- (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) |
|
| 120 |
- |
|
| 121 |
- SH assembler code partly based on x86 assembler code |
|
| 122 |
- (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) |
|
| 123 |
- |
|
| 124 |
- 2xSaI filter |
|
| 125 |
- (c) Copyright 1999 - 2001 Derek Liauw Kie Fa |
|
| 126 |
- |
|
| 127 |
- HQ2x, HQ3x, HQ4x filters |
|
| 128 |
- (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) |
|
| 129 |
- |
|
| 130 |
- NTSC filter |
|
| 131 |
- (c) Copyright 2006 - 2007 Shay Green |
|
| 132 |
- |
|
| 133 |
- GTK+ GUI code |
|
| 134 |
- (c) Copyright 2004 - 2011 BearOso |
|
| 135 |
- |
|
| 136 |
- Win32 GUI code |
|
| 137 |
- (c) Copyright 2003 - 2006 blip, |
|
| 138 |
- funkyass, |
|
| 139 |
- Matthew Kendora, |
|
| 140 |
- Nach, |
|
| 141 |
- nitsuja |
|
| 142 |
- (c) Copyright 2009 - 2011 OV2 |
|
| 143 |
- |
|
| 144 |
- Mac OS GUI code |
|
| 145 |
- (c) Copyright 1998 - 2001 John Stiles |
|
| 146 |
- (c) Copyright 2001 - 2011 zones |
|
| 147 |
- |
|
| 148 |
- |
|
| 149 |
- Specific ports contains the works of other authors. See headers in |
|
| 150 |
- individual files. |
|
| 151 |
- |
|
| 152 |
- |
|
| 153 |
- Snes9x homepage: http://www.snes9x.com/ |
|
| 154 |
- |
|
| 155 |
- Permission to use, copy, modify and/or distribute Snes9x in both binary |
|
| 156 |
- and source form, for non-commercial purposes, is hereby granted without |
|
| 157 |
- fee, providing that this license information and copyright notice appear |
|
| 158 |
- with all copies and any derived work. |
|
| 159 |
- |
|
| 160 |
- This software is provided 'as-is', without any express or implied |
|
| 161 |
- warranty. In no event shall the authors be held liable for any damages |
|
| 162 |
- arising from the use of this software or it's derivatives. |
|
| 163 |
- |
|
| 164 |
- Snes9x is freeware for PERSONAL USE only. Commercial users should |
|
| 165 |
- seek permission of the copyright holders first. Commercial use includes, |
|
| 166 |
- but is not limited to, charging money for Snes9x or software derived from |
|
| 167 |
- Snes9x, including Snes9x or derivatives in commercial game bundles, and/or |
|
| 168 |
- using Snes9x as a promotion for your commercial product. |
|
| 169 |
- |
|
| 170 |
- The copyright holders request that bug fixes and improvements to the code |
|
| 171 |
- should be forwarded to them so everyone can benefit from the modifications |
|
| 172 |
- in future versions. |
|
| 173 |
- |
|
| 174 |
- Super NES and Super Nintendo Entertainment System are trademarks of |
|
| 175 |
- Nintendo Co., Limited and its subsidiary companies. |
|
| 176 |
- ***********************************************************************************/ |
|
| 3 |
+ This file is licensed under the Snes9x License. |
|
| 4 |
+ For further information, consult the LICENSE file in the root directory. |
|
| 5 |
+\*****************************************************************************/ |
|
| 177 | 6 |
|
| 178 | 7 |
#pragma once |
| 179 | 8 |
|
| ... | ... |
@@ -208,7 +37,7 @@ |
| 208 | 37 |
# define strcasecmp stricmp |
| 209 | 38 |
#endif |
| 210 | 39 |
|
| 211 |
-#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) |
|
| 40 |
+#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) || (defined(__BYTE_ORDER__) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN__) |
|
| 212 | 41 |
# define LSB_FIRST |
| 213 | 42 |
# define FAST_LSB_WORD_ACCESS |
| 214 | 43 |
#else |
* [2SF] Used more up-to-date asmjit, despite the ugly looking code.
| ... | ... |
@@ -175,8 +175,7 @@ |
| 175 | 175 |
Nintendo Co., Limited and its subsidiary companies. |
| 176 | 176 |
***********************************************************************************/ |
| 177 | 177 |
|
| 178 |
-#ifndef _PORT_H_ |
|
| 179 |
-#define _PORT_H_ |
|
| 178 |
+#pragma once |
|
| 180 | 179 |
|
| 181 | 180 |
#include <cstdio> |
| 182 | 181 |
#include <cstdlib> |
| ... | ... |
@@ -217,13 +216,11 @@ |
| 217 | 216 |
#endif |
| 218 | 217 |
|
| 219 | 218 |
#ifdef FAST_LSB_WORD_ACCESS |
| 220 |
-inline uint16_t READ_WORD(uint8_t *s) { return *reinterpret_cast<uint16_t *>(s); }
|
|
| 221 |
-inline uint32_t READ_3WORD(uint8_t *s) { return *reinterpret_cast<uint32_t *>(s) & 0x00FFFFFF; }
|
|
| 219 |
+inline uint16_t READ_WORD(const uint8_t *s) { return *reinterpret_cast<const uint16_t *>(s); }
|
|
| 220 |
+inline uint32_t READ_3WORD(const uint8_t *s) { return *reinterpret_cast<const uint32_t *>(s) & 0x00FFFFFF; }
|
|
| 222 | 221 |
inline void WRITE_WORD(uint8_t *s, uint16_t d) { *reinterpret_cast<uint16_t *>(s) = d; }
|
| 223 | 222 |
#else |
| 224 |
-inline uint16_t READ_WORD(uint8_t *s) { return s | ((s + 1) << 8); }
|
|
| 225 |
-inline uint32-t READ_3WORD(uint8_t *s) { return s | ((s + 1) << 8) | ((s + 2) << 16); }
|
|
| 223 |
+inline uint16_t READ_WORD(const uint8_t *s) { return s | ((s + 1) << 8); }
|
|
| 224 |
+inline uint32-t READ_3WORD(const uint8_t *s) { return s | ((s + 1) << 8) | ((s + 2) << 16); }
|
|
| 226 | 225 |
inline void WRITE_WORD(uint8_t *s, uint16_t d) { *s = static_cast<uint8_t>(d); *(s + 1) = static_cast<uint8_t>(d >> 8); }
|
| 227 | 226 |
#endif |
| 228 |
- |
|
| 229 |
-#endif |
| ... | ... |
@@ -175,196 +175,55 @@ |
| 175 | 175 |
Nintendo Co., Limited and its subsidiary companies. |
| 176 | 176 |
***********************************************************************************/ |
| 177 | 177 |
|
| 178 |
- |
|
| 179 | 178 |
#ifndef _PORT_H_ |
| 180 | 179 |
#define _PORT_H_ |
| 181 | 180 |
|
| 182 | 181 |
#include <cstdio> |
| 183 | 182 |
#include <cstdlib> |
| 184 | 183 |
#include <climits> |
| 185 |
-//#include <memory.h> |
|
| 186 | 184 |
#include <ctime> |
| 187 | 185 |
#include <cstring> |
| 188 |
-/*#ifdef HAVE_STRINGS_H |
|
| 189 |
-#include <strings.h> |
|
| 190 |
-#endif*/ |
|
| 186 |
+#include <cstdint> |
|
| 191 | 187 |
#include <sys/types.h> |
| 192 | 188 |
|
| 193 | 189 |
#ifdef _WIN32 |
| 194 |
-//#define NOMINMAX |
|
| 195 |
-//#include <windows.h> |
|
| 196 |
-#include "windowsh_wrapper.h" |
|
| 197 |
-#endif |
|
| 198 |
- |
|
| 199 |
-//#define GFX_MULTI_FORMAT |
|
| 200 |
- |
|
| 201 |
-/*#ifdef _WIN32 |
|
| 202 |
-//#define RIGHTSHIFT_IS_SAR |
|
| 203 |
-#define RIGHTSHIFT_int8_IS_SAR |
|
| 204 |
-#define RIGHTSHIFT_int16_IS_SAR |
|
| 205 |
-#define RIGHTSHIFT_int32_IS_SAR |
|
| 206 |
-//#define SNES_JOY_READ_CALLBACKS |
|
| 207 |
-#endif*/ |
|
| 208 |
- |
|
| 209 |
-#ifdef __MACOSX__ |
|
| 210 |
-#undef GFX_MULTI_FORMAT |
|
| 211 |
-#define PIXEL_FORMAT RGB555 |
|
| 212 |
-#endif |
|
| 213 |
- |
|
| 214 |
-#include <cstdint> |
|
| 215 |
-/*#ifndef snes9x_types_defined |
|
| 216 |
-#define snes9x_types_defined |
|
| 217 |
-typedef unsigned char bool8; |
|
| 218 |
-#ifdef HAVE_STDINT_H |
|
| 219 |
-#include <stdint.h> |
|
| 220 |
-typedef intptr_t pint; |
|
| 221 |
-typedef int8_t int8; |
|
| 222 |
-typedef uint8_t uint8; |
|
| 223 |
-typedef int16_t int16; |
|
| 224 |
-typedef uint16_t uint16; |
|
| 225 |
-typedef int32_t int32; |
|
| 226 |
-typedef uint32_t uint32; |
|
| 227 |
-typedef int64_t int64; |
|
| 228 |
-typedef uint64_t uint64; |
|
| 229 |
-#else // HAVE_STDINT_H |
|
| 230 |
-#ifdef _WIN32 |
|
| 231 |
-typedef intptr_t pint; |
|
| 232 |
-#else // __WIN32__ |
|
| 233 |
-#ifdef PTR_NOT_INT |
|
| 234 |
-typedef long pint; |
|
| 235 |
-#else |
|
| 236 |
-typedef int pint; |
|
| 237 |
-#endif |
|
| 238 |
-#endif // __WIN32__ |
|
| 239 |
-#ifdef _WIN32 |
|
| 240 |
-#ifdef __BORLANDC__ |
|
| 241 |
-#include <systypes.h> |
|
| 242 |
-#else |
|
| 243 |
-typedef signed char int8; |
|
| 244 |
-typedef unsigned char uint8; |
|
| 245 |
-typedef signed short int16; |
|
| 246 |
-typedef unsigned short uint16; |
|
| 247 |
-#ifndef WSAAP |
|
| 248 |
-// winsock2.h typedefs int32 as well |
|
| 249 |
-typedef signed int int32; |
|
| 250 |
-#endif |
|
| 251 |
-typedef unsigned int uint32; |
|
| 252 |
-#endif |
|
| 253 |
-typedef unsigned char uint8_t; |
|
| 254 |
-typedef signed char int8_t; |
|
| 255 |
-typedef signed __int64 int64; |
|
| 256 |
-typedef unsigned __int64 uint64; |
|
| 257 |
-typedef int socklen_t; |
|
| 258 |
-#else // __WIN32__ |
|
| 259 |
-typedef signed char int8; |
|
| 260 |
-typedef unsigned char uint8; |
|
| 261 |
-typedef signed short int16; |
|
| 262 |
-typedef unsigned short uint16; |
|
| 263 |
-typedef signed int int32; |
|
| 264 |
-typedef unsigned int uint32; |
|
| 265 |
-#ifdef __GNUC__ |
|
| 266 |
-// long long is not part of ISO C++ |
|
| 267 |
-__extension__ |
|
| 268 |
-#endif |
|
| 269 |
-typedef long long int64; |
|
| 270 |
-typedef unsigned long long uint64; |
|
| 271 |
-#endif // __WIN32__ |
|
| 272 |
-#endif // HAVE_STDINT_H |
|
| 273 |
-#endif // snes9x_types_defined |
|
| 274 |
- |
|
| 275 |
-#ifndef TRUE |
|
| 276 |
-#define TRUE 1 |
|
| 277 |
-#endif |
|
| 278 |
-#ifndef FALSE |
|
| 279 |
-#define FALSE 0 |
|
| 280 |
-#endif*/ |
|
| 281 |
- |
|
| 282 |
-/*#define START_EXTERN_C extern "C" {
|
|
| 283 |
-#define END_EXTERN_C }*/ |
|
| 284 |
- |
|
| 285 |
-#ifndef _WIN32 |
|
| 286 |
-#ifndef PATH_MAX |
|
| 287 |
-#define PATH_MAX 1024 |
|
| 288 |
-#endif |
|
| 289 |
-#define _MAX_DRIVE 1 |
|
| 290 |
-#define _MAX_DIR PATH_MAX |
|
| 291 |
-#define _MAX_FNAME PATH_MAX |
|
| 292 |
-#define _MAX_EXT PATH_MAX |
|
| 293 |
-#define _MAX_PATH PATH_MAX |
|
| 294 |
-#else |
|
| 295 |
-#ifndef PATH_MAX |
|
| 296 |
-#define PATH_MAX _MAX_PATH |
|
| 297 |
-#endif |
|
| 190 |
+# include "windowsh_wrapper.h" |
|
| 298 | 191 |
#endif |
| 299 | 192 |
|
| 300 | 193 |
#ifndef _WIN32 |
| 301 |
-#define ZeroMemory(a, b) memset((a), 0, (b)) |
|
| 302 |
-void _splitpath (const char *, char *, char *, char *, char *); |
|
| 303 |
-void _makepath (char *, const char *, const char *, const char *, const char *); |
|
| 304 |
-//#define S9xDisplayString DisplayStringFromBottom |
|
| 194 |
+# ifndef PATH_MAX |
|
| 195 |
+# define PATH_MAX 1024 |
|
| 196 |
+# endif |
|
| 197 |
+# define _MAX_DRIVE 1 |
|
| 198 |
+# define _MAX_DIR PATH_MAX |
|
| 199 |
+# define _MAX_FNAME PATH_MAX |
|
| 200 |
+# define _MAX_EXT PATH_MAX |
|
| 201 |
+# define _MAX_PATH PATH_MAX |
|
| 305 | 202 |
#else |
| 306 |
-#define snprintf _snprintf |
|
| 307 |
-#define strcasecmp stricmp |
|
| 308 |
-#define strncasecmp _strnicmp |
|
| 309 |
-//void WinDisplayStringFromBottom(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap); |
|
| 310 |
-//#define S9xDisplayString WinDisplayStringFromBottom |
|
| 311 |
-//void SetInfoDlgColor(unsigned char, unsigned char, unsigned char); |
|
| 312 |
-//#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b) |
|
| 203 |
+# ifndef PATH_MAX |
|
| 204 |
+# define PATH_MAX _MAX_PATH |
|
| 205 |
+# endif |
|
| 313 | 206 |
#endif |
| 314 | 207 |
|
| 315 |
-/*#ifdef __DJGPP |
|
| 316 |
-#define SLASH_STR "\\" |
|
| 317 |
-#define SLASH_CHAR '\\' |
|
| 318 |
-#else |
|
| 319 |
-#define SLASH_STR "/" |
|
| 320 |
-#define SLASH_CHAR '/' |
|
| 321 |
-#endif*/ |
|
| 322 |
- |
|
| 323 |
-/*#ifndef SIG_PF |
|
| 324 |
-#define SIG_PF void (*) (int) |
|
| 325 |
-#endif*/ |
|
| 326 |
- |
|
| 327 |
-/*#ifdef __linux |
|
| 328 |
-#define TITLE "Snes9x: Linux" |
|
| 329 |
-#define SYS_CONFIG_FILE "/etc/snes9x/snes9x.conf" |
|
| 208 |
+#ifdef _WIN32 |
|
| 209 |
+# define strcasecmp stricmp |
|
| 330 | 210 |
#endif |
| 331 | 211 |
|
| 332 |
-#ifndef TITLE |
|
| 333 |
-#define TITLE "Snes9x" |
|
| 334 |
-#endif*/ |
|
| 335 |
- |
|
| 336 | 212 |
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) |
| 337 |
-#define LSB_FIRST |
|
| 338 |
-#define FAST_LSB_WORD_ACCESS |
|
| 213 |
+# define LSB_FIRST |
|
| 214 |
+# define FAST_LSB_WORD_ACCESS |
|
| 339 | 215 |
#else |
| 340 |
-#define MSB_FIRST |
|
| 216 |
+# define MSB_FIRST |
|
| 341 | 217 |
#endif |
| 342 | 218 |
|
| 343 | 219 |
#ifdef FAST_LSB_WORD_ACCESS |
| 344 |
-//#define READ_WORD(s) (*(uint16_t *) (s)) |
|
| 345 |
-static inline uint16_t READ_WORD(uint8_t *s) { return *reinterpret_cast<uint16_t *>(s); }
|
|
| 346 |
-//#define READ_3WORD(s) (*(uint32_t *) (s) & 0x00ffffff) |
|
| 347 |
-static inline uint32_t READ_3WORD(uint8_t *s) { return *reinterpret_cast<uint32_t *>(s) & 0x00FFFFFF; }
|
|
| 348 |
-//#define READ_DWORD(s) (*(uint32_t *) (s)) |
|
| 349 |
-//#define WRITE_WORD(s, d) *(uint16_t *) (s) = (d) |
|
| 350 |
-static inline void WRITE_WORD(uint8_t *s, uint16_t d) { *reinterpret_cast<uint16_t *>(s) = d; }
|
|
| 351 |
-//#define WRITE_3WORD(s, d) *(uint16_t *) (s) = (uint16_t) (d), *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16) |
|
| 352 |
-//#define WRITE_DWORD(s, d) *(uint32_t *) (s) = (d) |
|
| 220 |
+inline uint16_t READ_WORD(uint8_t *s) { return *reinterpret_cast<uint16_t *>(s); }
|
|
| 221 |
+inline uint32_t READ_3WORD(uint8_t *s) { return *reinterpret_cast<uint32_t *>(s) & 0x00FFFFFF; }
|
|
| 222 |
+inline void WRITE_WORD(uint8_t *s, uint16_t d) { *reinterpret_cast<uint16_t *>(s) = d; }
|
|
| 353 | 223 |
#else |
| 354 |
-//#define READ_WORD(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8)) |
|
| 355 |
-static inline uint16_t READ_WORD(uint8_t *s) { return s | ((s + 1) << 8); }
|
|
| 356 |
-//#define READ_3WORD(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8) | (*((uint8_t *) (s) + 2) << 16)) |
|
| 357 |
-static inline uint32-t READ_3WORD(uint8_t *s) { return s | ((s + 1) << 8) | ((s + 2) << 16); }
|
|
| 358 |
-//#define READ_DWORD(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8) | (*((uint8_t *) (s) + 2) << 16) | (*((uint8_t *) (s) + 3) << 24)) |
|
| 359 |
-//#define WRITE_WORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8) |
|
| 360 |
-static inline void WRITE_WORD(uint8_t *s, uint16_t) { *s = static_cast<uint8_t>(d); *(s + 1) = static_cast<uint8_t>(d >> 8); }
|
|
| 361 |
-//#define WRITE_3WORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8), *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16) |
|
| 362 |
-//#define WRITE_DWORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8), *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16), *((uint8_t *) (s) + 3) = (uint8_t) ((d) >> 24) |
|
| 224 |
+inline uint16_t READ_WORD(uint8_t *s) { return s | ((s + 1) << 8); }
|
|
| 225 |
+inline uint32-t READ_3WORD(uint8_t *s) { return s | ((s + 1) << 8) | ((s + 2) << 16); }
|
|
| 226 |
+inline void WRITE_WORD(uint8_t *s, uint16_t d) { *s = static_cast<uint8_t>(d); *(s + 1) = static_cast<uint8_t>(d >> 8); }
|
|
| 363 | 227 |
#endif |
| 364 | 228 |
|
| 365 |
-//#define SWAP_WORD(s) (s) = (((s) & 0xff) << 8) | (((s) & 0xff00) >> 8) |
|
| 366 |
-//#define SWAP_DWORD(s) (s) = (((s) & 0xff) << 24) | (((s) & 0xff00) << 8) | (((s) & 0xff0000) >> 8) | (((s) & 0xff000000) >> 24) |
|
| 367 |
- |
|
| 368 |
-//#include "pixform.h" |
|
| 369 |
- |
|
| 370 | 229 |
#endif |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,370 @@ |
| 1 |
+/*********************************************************************************** |
|
| 2 |
+ Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. |
|
| 3 |
+ |
|
| 4 |
+ (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com), |
|
| 5 |
+ Jerremy Koot (jkoot@snes9x.com) |
|
| 6 |
+ |
|
| 7 |
+ (c) Copyright 2002 - 2004 Matthew Kendora |
|
| 8 |
+ |
|
| 9 |
+ (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) |
|
| 10 |
+ |
|
| 11 |
+ (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) |
|
| 12 |
+ |
|
| 13 |
+ (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) |
|
| 14 |
+ |
|
| 15 |
+ (c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca), |
|
| 16 |
+ Kris Bleakley (codeviolation@hotmail.com) |
|
| 17 |
+ |
|
| 18 |
+ (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), |
|
| 19 |
+ Nach (n-a-c-h@users.sourceforge.net), |
|
| 20 |
+ |
|
| 21 |
+ (c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com) |
|
| 22 |
+ |
|
| 23 |
+ (c) Copyright 2006 - 2007 nitsuja |
|
| 24 |
+ |
|
| 25 |
+ (c) Copyright 2009 - 2011 BearOso, |
|
| 26 |
+ OV2 |
|
| 27 |
+ |
|
| 28 |
+ |
|
| 29 |
+ BS-X C emulator code |
|
| 30 |
+ (c) Copyright 2005 - 2006 Dreamer Nom, |
|
| 31 |
+ zones |
|
| 32 |
+ |
|
| 33 |
+ C4 x86 assembler and some C emulation code |
|
| 34 |
+ (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), |
|
| 35 |
+ Nach, |
|
| 36 |
+ zsKnight (zsknight@zsnes.com) |
|
| 37 |
+ |
|
| 38 |
+ C4 C++ code |
|
| 39 |
+ (c) Copyright 2003 - 2006 Brad Jorsch, |
|
| 40 |
+ Nach |
|
| 41 |
+ |
|
| 42 |
+ DSP-1 emulator code |
|
| 43 |
+ (c) Copyright 1998 - 2006 _Demo_, |
|
| 44 |
+ Andreas Naive (andreasnaive@gmail.com), |
|
| 45 |
+ Gary Henderson, |
|
| 46 |
+ Ivar (ivar@snes9x.com), |
|
| 47 |
+ John Weidman, |
|
| 48 |
+ Kris Bleakley, |
|
| 49 |
+ Matthew Kendora, |
|
| 50 |
+ Nach, |
|
| 51 |
+ neviksti (neviksti@hotmail.com) |
|
| 52 |
+ |
|
| 53 |
+ DSP-2 emulator code |
|
| 54 |
+ (c) Copyright 2003 John Weidman, |
|
| 55 |
+ Kris Bleakley, |
|
| 56 |
+ Lord Nightmare (lord_nightmare@users.sourceforge.net), |
|
| 57 |
+ Matthew Kendora, |
|
| 58 |
+ neviksti |
|
| 59 |
+ |
|
| 60 |
+ DSP-3 emulator code |
|
| 61 |
+ (c) Copyright 2003 - 2006 John Weidman, |
|
| 62 |
+ Kris Bleakley, |
|
| 63 |
+ Lancer, |
|
| 64 |
+ z80 gaiden |
|
| 65 |
+ |
|
| 66 |
+ DSP-4 emulator code |
|
| 67 |
+ (c) Copyright 2004 - 2006 Dreamer Nom, |
|
| 68 |
+ John Weidman, |
|
| 69 |
+ Kris Bleakley, |
|
| 70 |
+ Nach, |
|
| 71 |
+ z80 gaiden |
|
| 72 |
+ |
|
| 73 |
+ OBC1 emulator code |
|
| 74 |
+ (c) Copyright 2001 - 2004 zsKnight, |
|
| 75 |
+ pagefault (pagefault@zsnes.com), |
|
| 76 |
+ Kris Bleakley |
|
| 77 |
+ Ported from x86 assembler to C by sanmaiwashi |
|
| 78 |
+ |
|
| 79 |
+ SPC7110 and RTC C++ emulator code used in 1.39-1.51 |
|
| 80 |
+ (c) Copyright 2002 Matthew Kendora with research by |
|
| 81 |
+ zsKnight, |
|
| 82 |
+ John Weidman, |
|
| 83 |
+ Dark Force |
|
| 84 |
+ |
|
| 85 |
+ SPC7110 and RTC C++ emulator code used in 1.52+ |
|
| 86 |
+ (c) Copyright 2009 byuu, |
|
| 87 |
+ neviksti |
|
| 88 |
+ |
|
| 89 |
+ S-DD1 C emulator code |
|
| 90 |
+ (c) Copyright 2003 Brad Jorsch with research by |
|
| 91 |
+ Andreas Naive, |
|
| 92 |
+ John Weidman |
|
| 93 |
+ |
|
| 94 |
+ S-RTC C emulator code |
|
| 95 |
+ (c) Copyright 2001 - 2006 byuu, |
|
| 96 |
+ John Weidman |
|
| 97 |
+ |
|
| 98 |
+ ST010 C++ emulator code |
|
| 99 |
+ (c) Copyright 2003 Feather, |
|
| 100 |
+ John Weidman, |
|
| 101 |
+ Kris Bleakley, |
|
| 102 |
+ Matthew Kendora |
|
| 103 |
+ |
|
| 104 |
+ Super FX x86 assembler emulator code |
|
| 105 |
+ (c) Copyright 1998 - 2003 _Demo_, |
|
| 106 |
+ pagefault, |
|
| 107 |
+ zsKnight |
|
| 108 |
+ |
|
| 109 |
+ Super FX C emulator code |
|
| 110 |
+ (c) Copyright 1997 - 1999 Ivar, |
|
| 111 |
+ Gary Henderson, |
|
| 112 |
+ John Weidman |
|
| 113 |
+ |
|
| 114 |
+ Sound emulator code used in 1.5-1.51 |
|
| 115 |
+ (c) Copyright 1998 - 2003 Brad Martin |
|
| 116 |
+ (c) Copyright 1998 - 2006 Charles Bilyue' |
|
| 117 |
+ |
|
| 118 |
+ Sound emulator code used in 1.52+ |
|
| 119 |
+ (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) |
|
| 120 |
+ |
|
| 121 |
+ SH assembler code partly based on x86 assembler code |
|
| 122 |
+ (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) |
|
| 123 |
+ |
|
| 124 |
+ 2xSaI filter |
|
| 125 |
+ (c) Copyright 1999 - 2001 Derek Liauw Kie Fa |
|
| 126 |
+ |
|
| 127 |
+ HQ2x, HQ3x, HQ4x filters |
|
| 128 |
+ (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) |
|
| 129 |
+ |
|
| 130 |
+ NTSC filter |
|
| 131 |
+ (c) Copyright 2006 - 2007 Shay Green |
|
| 132 |
+ |
|
| 133 |
+ GTK+ GUI code |
|
| 134 |
+ (c) Copyright 2004 - 2011 BearOso |
|
| 135 |
+ |
|
| 136 |
+ Win32 GUI code |
|
| 137 |
+ (c) Copyright 2003 - 2006 blip, |
|
| 138 |
+ funkyass, |
|
| 139 |
+ Matthew Kendora, |
|
| 140 |
+ Nach, |
|
| 141 |
+ nitsuja |
|
| 142 |
+ (c) Copyright 2009 - 2011 OV2 |
|
| 143 |
+ |
|
| 144 |
+ Mac OS GUI code |
|
| 145 |
+ (c) Copyright 1998 - 2001 John Stiles |
|
| 146 |
+ (c) Copyright 2001 - 2011 zones |
|
| 147 |
+ |
|
| 148 |
+ |
|
| 149 |
+ Specific ports contains the works of other authors. See headers in |
|
| 150 |
+ individual files. |
|
| 151 |
+ |
|
| 152 |
+ |
|
| 153 |
+ Snes9x homepage: http://www.snes9x.com/ |
|
| 154 |
+ |
|
| 155 |
+ Permission to use, copy, modify and/or distribute Snes9x in both binary |
|
| 156 |
+ and source form, for non-commercial purposes, is hereby granted without |
|
| 157 |
+ fee, providing that this license information and copyright notice appear |
|
| 158 |
+ with all copies and any derived work. |
|
| 159 |
+ |
|
| 160 |
+ This software is provided 'as-is', without any express or implied |
|
| 161 |
+ warranty. In no event shall the authors be held liable for any damages |
|
| 162 |
+ arising from the use of this software or it's derivatives. |
|
| 163 |
+ |
|
| 164 |
+ Snes9x is freeware for PERSONAL USE only. Commercial users should |
|
| 165 |
+ seek permission of the copyright holders first. Commercial use includes, |
|
| 166 |
+ but is not limited to, charging money for Snes9x or software derived from |
|
| 167 |
+ Snes9x, including Snes9x or derivatives in commercial game bundles, and/or |
|
| 168 |
+ using Snes9x as a promotion for your commercial product. |
|
| 169 |
+ |
|
| 170 |
+ The copyright holders request that bug fixes and improvements to the code |
|
| 171 |
+ should be forwarded to them so everyone can benefit from the modifications |
|
| 172 |
+ in future versions. |
|
| 173 |
+ |
|
| 174 |
+ Super NES and Super Nintendo Entertainment System are trademarks of |
|
| 175 |
+ Nintendo Co., Limited and its subsidiary companies. |
|
| 176 |
+ ***********************************************************************************/ |
|
| 177 |
+ |
|
| 178 |
+ |
|
| 179 |
+#ifndef _PORT_H_ |
|
| 180 |
+#define _PORT_H_ |
|
| 181 |
+ |
|
| 182 |
+#include <cstdio> |
|
| 183 |
+#include <cstdlib> |
|
| 184 |
+#include <climits> |
|
| 185 |
+//#include <memory.h> |
|
| 186 |
+#include <ctime> |
|
| 187 |
+#include <cstring> |
|
| 188 |
+/*#ifdef HAVE_STRINGS_H |
|
| 189 |
+#include <strings.h> |
|
| 190 |
+#endif*/ |
|
| 191 |
+#include <sys/types.h> |
|
| 192 |
+ |
|
| 193 |
+#ifdef _WIN32 |
|
| 194 |
+//#define NOMINMAX |
|
| 195 |
+//#include <windows.h> |
|
| 196 |
+#include "windowsh_wrapper.h" |
|
| 197 |
+#endif |
|
| 198 |
+ |
|
| 199 |
+//#define GFX_MULTI_FORMAT |
|
| 200 |
+ |
|
| 201 |
+/*#ifdef _WIN32 |
|
| 202 |
+//#define RIGHTSHIFT_IS_SAR |
|
| 203 |
+#define RIGHTSHIFT_int8_IS_SAR |
|
| 204 |
+#define RIGHTSHIFT_int16_IS_SAR |
|
| 205 |
+#define RIGHTSHIFT_int32_IS_SAR |
|
| 206 |
+//#define SNES_JOY_READ_CALLBACKS |
|
| 207 |
+#endif*/ |
|
| 208 |
+ |
|
| 209 |
+#ifdef __MACOSX__ |
|
| 210 |
+#undef GFX_MULTI_FORMAT |
|
| 211 |
+#define PIXEL_FORMAT RGB555 |
|
| 212 |
+#endif |
|
| 213 |
+ |
|
| 214 |
+#include "pstdint.h" |
|
| 215 |
+/*#ifndef snes9x_types_defined |
|
| 216 |
+#define snes9x_types_defined |
|
| 217 |
+typedef unsigned char bool8; |
|
| 218 |
+#ifdef HAVE_STDINT_H |
|
| 219 |
+#include <stdint.h> |
|
| 220 |
+typedef intptr_t pint; |
|
| 221 |
+typedef int8_t int8; |
|
| 222 |
+typedef uint8_t uint8; |
|
| 223 |
+typedef int16_t int16; |
|
| 224 |
+typedef uint16_t uint16; |
|
| 225 |
+typedef int32_t int32; |
|
| 226 |
+typedef uint32_t uint32; |
|
| 227 |
+typedef int64_t int64; |
|
| 228 |
+typedef uint64_t uint64; |
|
| 229 |
+#else // HAVE_STDINT_H |
|
| 230 |
+#ifdef _WIN32 |
|
| 231 |
+typedef intptr_t pint; |
|
| 232 |
+#else // __WIN32__ |
|
| 233 |
+#ifdef PTR_NOT_INT |
|
| 234 |
+typedef long pint; |
|
| 235 |
+#else |
|
| 236 |
+typedef int pint; |
|
| 237 |
+#endif |
|
| 238 |
+#endif // __WIN32__ |
|
| 239 |
+#ifdef _WIN32 |
|
| 240 |
+#ifdef __BORLANDC__ |
|
| 241 |
+#include <systypes.h> |
|
| 242 |
+#else |
|
| 243 |
+typedef signed char int8; |
|
| 244 |
+typedef unsigned char uint8; |
|
| 245 |
+typedef signed short int16; |
|
| 246 |
+typedef unsigned short uint16; |
|
| 247 |
+#ifndef WSAAP |
|
| 248 |
+// winsock2.h typedefs int32 as well |
|
| 249 |
+typedef signed int int32; |
|
| 250 |
+#endif |
|
| 251 |
+typedef unsigned int uint32; |
|
| 252 |
+#endif |
|
| 253 |
+typedef unsigned char uint8_t; |
|
| 254 |
+typedef signed char int8_t; |
|
| 255 |
+typedef signed __int64 int64; |
|
| 256 |
+typedef unsigned __int64 uint64; |
|
| 257 |
+typedef int socklen_t; |
|
| 258 |
+#else // __WIN32__ |
|
| 259 |
+typedef signed char int8; |
|
| 260 |
+typedef unsigned char uint8; |
|
| 261 |
+typedef signed short int16; |
|
| 262 |
+typedef unsigned short uint16; |
|
| 263 |
+typedef signed int int32; |
|
| 264 |
+typedef unsigned int uint32; |
|
| 265 |
+#ifdef __GNUC__ |
|
| 266 |
+// long long is not part of ISO C++ |
|
| 267 |
+__extension__ |
|
| 268 |
+#endif |
|
| 269 |
+typedef long long int64; |
|
| 270 |
+typedef unsigned long long uint64; |
|
| 271 |
+#endif // __WIN32__ |
|
| 272 |
+#endif // HAVE_STDINT_H |
|
| 273 |
+#endif // snes9x_types_defined |
|
| 274 |
+ |
|
| 275 |
+#ifndef TRUE |
|
| 276 |
+#define TRUE 1 |
|
| 277 |
+#endif |
|
| 278 |
+#ifndef FALSE |
|
| 279 |
+#define FALSE 0 |
|
| 280 |
+#endif*/ |
|
| 281 |
+ |
|
| 282 |
+/*#define START_EXTERN_C extern "C" {
|
|
| 283 |
+#define END_EXTERN_C }*/ |
|
| 284 |
+ |
|
| 285 |
+#ifndef _WIN32 |
|
| 286 |
+#ifndef PATH_MAX |
|
| 287 |
+#define PATH_MAX 1024 |
|
| 288 |
+#endif |
|
| 289 |
+#define _MAX_DRIVE 1 |
|
| 290 |
+#define _MAX_DIR PATH_MAX |
|
| 291 |
+#define _MAX_FNAME PATH_MAX |
|
| 292 |
+#define _MAX_EXT PATH_MAX |
|
| 293 |
+#define _MAX_PATH PATH_MAX |
|
| 294 |
+#else |
|
| 295 |
+#ifndef PATH_MAX |
|
| 296 |
+#define PATH_MAX _MAX_PATH |
|
| 297 |
+#endif |
|
| 298 |
+#endif |
|
| 299 |
+ |
|
| 300 |
+#ifndef _WIN32 |
|
| 301 |
+#define ZeroMemory(a, b) memset((a), 0, (b)) |
|
| 302 |
+void _splitpath (const char *, char *, char *, char *, char *); |
|
| 303 |
+void _makepath (char *, const char *, const char *, const char *, const char *); |
|
| 304 |
+//#define S9xDisplayString DisplayStringFromBottom |
|
| 305 |
+#else |
|
| 306 |
+#define snprintf _snprintf |
|
| 307 |
+#define strcasecmp stricmp |
|
| 308 |
+#define strncasecmp _strnicmp |
|
| 309 |
+//void WinDisplayStringFromBottom(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap); |
|
| 310 |
+//#define S9xDisplayString WinDisplayStringFromBottom |
|
| 311 |
+//void SetInfoDlgColor(unsigned char, unsigned char, unsigned char); |
|
| 312 |
+//#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b) |
|
| 313 |
+#endif |
|
| 314 |
+ |
|
| 315 |
+/*#ifdef __DJGPP |
|
| 316 |
+#define SLASH_STR "\\" |
|
| 317 |
+#define SLASH_CHAR '\\' |
|
| 318 |
+#else |
|
| 319 |
+#define SLASH_STR "/" |
|
| 320 |
+#define SLASH_CHAR '/' |
|
| 321 |
+#endif*/ |
|
| 322 |
+ |
|
| 323 |
+/*#ifndef SIG_PF |
|
| 324 |
+#define SIG_PF void (*) (int) |
|
| 325 |
+#endif*/ |
|
| 326 |
+ |
|
| 327 |
+/*#ifdef __linux |
|
| 328 |
+#define TITLE "Snes9x: Linux" |
|
| 329 |
+#define SYS_CONFIG_FILE "/etc/snes9x/snes9x.conf" |
|
| 330 |
+#endif |
|
| 331 |
+ |
|
| 332 |
+#ifndef TITLE |
|
| 333 |
+#define TITLE "Snes9x" |
|
| 334 |
+#endif*/ |
|
| 335 |
+ |
|
| 336 |
+#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) |
|
| 337 |
+#define LSB_FIRST |
|
| 338 |
+#define FAST_LSB_WORD_ACCESS |
|
| 339 |
+#else |
|
| 340 |
+#define MSB_FIRST |
|
| 341 |
+#endif |
|
| 342 |
+ |
|
| 343 |
+#ifdef FAST_LSB_WORD_ACCESS |
|
| 344 |
+//#define READ_WORD(s) (*(uint16_t *) (s)) |
|
| 345 |
+static inline uint16_t READ_WORD(uint8_t *s) { return *reinterpret_cast<uint16_t *>(s); }
|
|
| 346 |
+//#define READ_3WORD(s) (*(uint32_t *) (s) & 0x00ffffff) |
|
| 347 |
+static inline uint32_t READ_3WORD(uint8_t *s) { return *reinterpret_cast<uint32_t *>(s) & 0x00FFFFFF; }
|
|
| 348 |
+//#define READ_DWORD(s) (*(uint32_t *) (s)) |
|
| 349 |
+//#define WRITE_WORD(s, d) *(uint16_t *) (s) = (d) |
|
| 350 |
+static inline void WRITE_WORD(uint8_t *s, uint16_t d) { *reinterpret_cast<uint16_t *>(s) = d; }
|
|
| 351 |
+//#define WRITE_3WORD(s, d) *(uint16_t *) (s) = (uint16_t) (d), *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16) |
|
| 352 |
+//#define WRITE_DWORD(s, d) *(uint32_t *) (s) = (d) |
|
| 353 |
+#else |
|
| 354 |
+//#define READ_WORD(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8)) |
|
| 355 |
+static inline uint16_t READ_WORD(uint8_t *s) { return s | ((s + 1) << 8); }
|
|
| 356 |
+//#define READ_3WORD(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8) | (*((uint8_t *) (s) + 2) << 16)) |
|
| 357 |
+static inline uint32-t READ_3WORD(uint8_t *s) { return s | ((s + 1) << 8) | ((s + 2) << 16); }
|
|
| 358 |
+//#define READ_DWORD(s) (*(uint8_t *) (s) | (*((uint8_t *) (s) + 1) << 8) | (*((uint8_t *) (s) + 2) << 16) | (*((uint8_t *) (s) + 3) << 24)) |
|
| 359 |
+//#define WRITE_WORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8) |
|
| 360 |
+static inline void WRITE_WORD(uint8_t *s, uint16_t) { *s = static_cast<uint8_t>(d); *(s + 1) = static_cast<uint8_t>(d >> 8); }
|
|
| 361 |
+//#define WRITE_3WORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8), *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16) |
|
| 362 |
+//#define WRITE_DWORD(s, d) *(uint8_t *) (s) = (uint8_t) (d), *((uint8_t *) (s) + 1) = (uint8_t) ((d) >> 8), *((uint8_t *) (s) + 2) = (uint8_t) ((d) >> 16), *((uint8_t *) (s) + 3) = (uint8_t) ((d) >> 24) |
|
| 363 |
+#endif |
|
| 364 |
+ |
|
| 365 |
+//#define SWAP_WORD(s) (s) = (((s) & 0xff) << 8) | (((s) & 0xff00) >> 8) |
|
| 366 |
+//#define SWAP_DWORD(s) (s) = (((s) & 0xff) << 24) | (((s) & 0xff00) << 8) | (((s) & 0xff0000) >> 8) | (((s) & 0xff000000) >> 24) |
|
| 367 |
+ |
|
| 368 |
+//#include "pixform.h" |
|
| 369 |
+ |
|
| 370 |
+#endif |