1 //////////////////////////////////////////////////////////////////////////////////////// 2 // 3 // Nestopia - NES/Famicom emulator written in C++ 4 // 5 // Copyright (C) 2003-2008 Martin Freij 6 // 7 // This file is part of Nestopia. 8 // 9 // Nestopia is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 13 // 14 // Nestopia is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with Nestopia; if not, write to the Free Software 21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 // 23 //////////////////////////////////////////////////////////////////////////////////////// 24 25 #ifndef NST_MAIN_H 26 #define NST_MAIN_H 27 28 #pragma once 29 30 #include "../core/NstBase.hpp" 31 32 #if NST_MSVC >= 1200 || NST_ICC >= 800 33 #pragma warning( push ) 34 #endif 35 36 #include "../core/NstCore.hpp" 37 #include "../core/NstAssert.hpp" 38 39 #if NST_MSVC >= 1200 || NST_ICC >= 800 40 #pragma warning( pop ) 41 #endif 42 43 #if UINT_MAX < 0xFFFFFFFF || INT_MAX < 2147483647 || INT_MIN > -2147483647 44 #error Unsupported plattform! 45 #endif 46 47 #if NST_ICC 48 49 #pragma warning( disable : 11 304 373 383 444 810 981 1572 1599 1786 ) 50 51 #elif NST_MSVC 52 53 #pragma warning( disable : 4018 4127 4244 4245 4355 4389 4512 4800 4996 ) 54 55 #if NST_MSVC >= 1400 56 57 #pragma warning( default : 4263 4287 4289 4296 4350 4545 4546 4547 4549 4555 4557 4686 4836 4905 4906 4928 4946 ) 58 59 #if 0 60 #pragma warning( default : 4820 ) // byte padding on structs 61 #pragma warning( default : 4710 ) // function not inlined 62 #pragma warning( default : 4711 ) // function auto inlined 63 #endif 64 65 #endif 66 67 #endif 68 69 // minimum operating system: Windows 98 2nd.edition 70 71 #define WINVER 0x0500 72 #define _WIN32_WINDOWS 0x0410 73 #define _WIN32_WINNT 0x0500 74 #define _WIN32_IE 0x0401 75 76 #define _WIN32_DCOM 77 78 #define STRICT 79 #define WIN32_LEAN_AND_MEAN 80 81 // <windows.h> 82 83 #ifndef NOMINMAX 84 #define NOMINMAX 85 #endif 86 87 #define NOGDICAPMASKS 88 #define NOICONS 89 #define NOKEYSTATES 90 #define NORASTEROPS 91 #define NOATOM 92 #define NOKERNEL 93 #define NOMEMMGR 94 #define NOMETAFILE 95 #define NOOPENFILE 96 #define NOSERVICE 97 #define NOSOUND 98 #define NOCOMM 99 #define NOKANJI 100 #define NOHELP 101 #define NOPROFILER 102 #define NODEFERWINDOWPOS 103 #define NOMCX 104 105 // <commctrl.h> 106 107 #define NOUPDOWN 108 #define NOMENUHELP 109 #define NODRAGLIST 110 #define NOPROGRESS 111 #define NOHOTKEY 112 #define NOHEADER 113 #define NOTABCONTROL 114 #define NOANIMATE 115 #define NOBUTTON 116 #define NOSTATIC 117 #define NOEDIT 118 #define NOLISTBOX 119 #define NOCOMBOBOX 120 #define NOSCROLLBAR 121 122 namespace Nestopia 123 { 124 typedef signed char schar; 125 typedef unsigned char uchar; 126 typedef unsigned short ushort; 127 typedef unsigned int uint; 128 typedef unsigned long ulong; 129 typedef uint ibool; 130 typedef const char* cstring; 131 typedef const wchar_t* wcstring; 132 typedef Nes::qaword qaword; 133 134 #define NST_CLAMP(t_,x_,y_) ((t_) < (x_) ? (x_) : (t_) > (y_) ? (y_) : (t_)) 135 136 template<typename T,uint N> 137 char(& array(T(&)[N]))[N]; 138 139 template<typename T> 140 class ImplicitBool; 141 142 template<> 143 class ImplicitBool<void> 144 { 145 public: 146 147 int type; 148 typedef int ImplicitBool<void>::*Type; 149 }; 150 151 template<typename T> 152 class ImplicitBool 153 { 154 template<typename U> void operator == (const ImplicitBool<U>&) const; 155 template<typename U> void operator != (const ImplicitBool<U>&) const; 156 157 public: 158 operator ImplicitBool<void>::Type() const159 operator ImplicitBool<void>::Type () const 160 { 161 return !static_cast<const T&>(*this) ? 0 : &ImplicitBool<void>::type; 162 } 163 }; 164 165 template<uchar A=0,uchar B=0,uchar C=0,uchar D=0> 166 struct FourCC 167 { 168 enum 169 { 170 V = uint(A) << 0 | uint(B) << 8 | uint(C) << 16 | uint(D) << 24 171 }; 172 173 template<typename P> 174 static uint T(const P*); 175 }; 176 177 template<uchar A,uchar B,uchar C,uchar D> template<typename P> T(const P * p)178 uint FourCC<A,B,C,D>::T(const P* p) 179 { 180 return (p[0] & 0xFFU) << 0 | (p[1] & 0xFFU) << 8 | (p[2] & 0xFFU) << 16 | (p[3] & 0xFFU) << 24; 181 } 182 183 namespace Collection 184 { 185 template<typename> class Vector; 186 typedef Vector<char> Buffer; 187 } 188 189 namespace Application 190 { 191 class Configuration; 192 } 193 194 enum 195 { 196 IDM_POS_FILE = 0, 197 IDM_POS_FILE_QUICKLOADSTATE = 6, 198 IDM_POS_FILE_QUICKSAVESTATE = 7, 199 IDM_POS_FILE_SOUNDRECORDER = 12, 200 IDM_POS_FILE_MOVIE = 13, 201 IDM_POS_FILE_RECENTFILES = 17, 202 IDM_POS_FILE_RECENTDIRS = 18, 203 IDM_POS_MACHINE = 1, 204 IDM_POS_MACHINE_RESET = 1, 205 IDM_POS_MACHINE_INPUT = 3, 206 IDM_POS_MACHINE_INPUT_PORT1 = 2, 207 IDM_POS_MACHINE_INPUT_PORT2 = 3, 208 IDM_POS_MACHINE_INPUT_PORT3 = 4, 209 IDM_POS_MACHINE_INPUT_PORT4 = 5, 210 IDM_POS_MACHINE_INPUT_EXP = 6, 211 IDM_POS_MACHINE_INPUT_ADAPTER = 8, 212 IDM_POS_MACHINE_EXT = 4, 213 IDM_POS_MACHINE_EXT_FDS = 0, 214 IDM_POS_MACHINE_EXT_KEYBOARD = 1, 215 IDM_POS_MACHINE_EXT_TAPE = 2, 216 IDM_POS_MACHINE_EXT_FDS_INSERT = 0, 217 IDM_POS_MACHINE_NSF = 5, 218 IDM_POS_MACHINE_REGION = 6, 219 IDM_POS_MACHINE_OPTIONS = 7, 220 IDM_POS_VIEW = 3, 221 IDM_POS_VIEW_SCREENSIZE = 3, 222 IDM_POS_OPTIONS = 4, 223 IDM_POS_OPTIONS_AUTOSAVER = 10, 224 IDM_POS_OPTIONS_AUTOSAVER_OPTIONS = 0, 225 IDM_POS_OPTIONS_AUTOSAVER_START 226 }; 227 } 228 229 #endif 230