Browse code

update for C++17 compliance, update to latest 2sf, add WINE cross-compile makefiles

Adam Higerd authored on 2021/02/11 15:36:17
Showing 1 changed files
... ...
@@ -21,6 +21,7 @@
21 21
 #include <memory>
22 22
 #include <string>
23 23
 #include <cstring>
24
+#include <stdlib.h>
24 25
 #include "armcpu.h"
25 26
 #include "MMU.h"
26 27
 #include "SPU.h"
... ...
@@ -289,8 +290,34 @@ extern struct TCommonSettings
289 290
 		strcpy(this->Firmware, "firmware.bin");
290 291
 		NDS_FillDefaultFirmwareConfigData(&this->InternalFirmConf);
291 292
 
292
-		for (int i = 0; i < 16; ++i)
293
-			this->spu_muteChannels[i] = false;
293
+    bool solo = false;
294
+    static char* soloEnv = strdup("SOLO_2SF_n");
295
+    static char* muteEnv = strdup("MUTE_2SF_n");
296
+		for (int i = 0; i < 16; ++i) {
297
+      if (i < 10) {
298
+        soloEnv[9] = '0' + i;
299
+      } else {
300
+        soloEnv[9] = 'A' + (i - 10);
301
+      }
302
+      char* soloVal = getenv(soloEnv);
303
+      if (soloVal && soloVal[0] == '1') {
304
+        solo = true;
305
+        this->spu_muteChannels[i] = false;
306
+      } else {
307
+        this->spu_muteChannels[i] = true;
308
+      }
309
+    }
310
+    if (!solo) {
311
+      for (int i = 0; i < 16; ++i) {
312
+        if (i < 10) {
313
+          muteEnv[9] = '0' + i;
314
+        } else {
315
+          muteEnv[9] = 'A' + (i - 10);
316
+        }
317
+        char* muteVal = getenv(muteEnv);
318
+        this->spu_muteChannels[i] = muteVal && muteVal[0] == '1';
319
+      }
320
+    }
294 321
 
295 322
 #ifdef HAVE_JIT
296 323
 		// zero 06-sep-2012 - shouldnt be defaulting this to true for now, since the jit is buggy.
Browse code

Use #pragma once instead of include guards.

Naram Qashat authored on 2014/09/08 14:47:36
Showing 1 changed files
... ...
@@ -16,8 +16,7 @@
16 16
 	along with the this software.  If not, see <http://www.gnu.org/licenses/>.
17 17
 */
18 18
 
19
-#ifndef NDSSYSTEM_H
20
-#define NDSSYSTEM_H
19
+#pragma once
21 20
 
22 21
 #include <memory>
23 22
 #include <string>
... ...
@@ -331,5 +330,3 @@ extern struct TCommonSettings
331 330
 	bool spu_captureMuted;
332 331
 	bool spu_advanced;
333 332
 } CommonSettings;
334
-
335
-#endif
Browse code

Removed a bunch of casts, they seem to be fine without them in most cases.

Naram Qashat authored on 2013/04/18 23:22:54
Showing 1 changed files
... ...
@@ -212,7 +212,7 @@ struct GameInfo
212 212
 	{
213 213
 		this->resize(size);
214 214
 		memcpy(&this->romdata[0], buf, size);
215
-		this->romsize = static_cast<uint32_t>(size);
215
+		this->romsize = size;
216 216
 		this->fillGap();
217 217
 	}
218 218
 
Browse code

Updating in_2sf to use a newish version of DeSmuME, 0.9.9 from SVN. Somewhat cleaned up as well, but not everything because it's a pain in the ass.

Naram Qashat authored on 2013/04/18 17:22:55
Showing 1 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 /*
2 2
 	Copyright (C) 2006 yopyop
3
-	Copyright (C) 2008-2012 DeSmuME team
3
+	Copyright (C) 2008-2013 DeSmuME team
4 4
 
5 5
 	This file is free software: you can redistribute it and/or modify
6 6
 	it under the terms of the GNU General Public License as published by
... ...
@@ -19,28 +19,22 @@
19 19
 #ifndef NDSSYSTEM_H
20 20
 #define NDSSYSTEM_H
21 21
 
22
+#include <memory>
23
+#include <string>
22 24
 #include <cstring>
23
-
24 25
 #include "armcpu.h"
25 26
 #include "MMU.h"
26
-//#include "driver.h"
27
-//#include "GPU.h"
28 27
 #include "SPU.h"
29 28
 #include "mem.h"
30
-//#include "wifi.h"
31 29
 #include "emufile.h"
32 30
 #include "firmware.h"
33 31
 
34
-#include <string>
35
-
36
-#if defined(_WINDOWS) && !defined(WXPORT)
37
-#include "pathsettings.h"
38
-#endif
39
-
40
-template<typename Type>
41
-struct buttonstruct {
42
-	union {
43
-		struct {
32
+template<typename Type> struct buttonstruct
33
+{
34
+	union
35
+	{
36
+		struct
37
+		{
44 38
 			// changing the order of these fields would break stuff
45 39
 			//fRLDUTSBAYXWEg
46 40
 			Type G; // debug
... ...
@@ -62,101 +56,65 @@ struct buttonstruct {
62 56
 	};
63 57
 };
64 58
 
65
-//extern buttonstruct<bool> Turbo;
66
-extern buttonstruct<int> TurboTime;
67
-//extern buttonstruct<bool> AutoHold;
68
-
69
-//int NDS_WritePNG(const char *fname);
70
-
71 59
 extern volatile bool execute;
72
-//extern bool click;
73
-
74
-/*
75
- * The firmware language values
76
- */
77
-/*#define NDS_FW_LANG_JAP 0
78
-#define NDS_FW_LANG_ENG 1
79
-#define NDS_FW_LANG_FRE 2
80
-#define NDS_FW_LANG_GER 3
81
-#define NDS_FW_LANG_ITA 4
82
-#define NDS_FW_LANG_SPA 5
83
-#define NDS_FW_LANG_CHI 6
84
-#define NDS_FW_LANG_RES 7*/
85
-
86
-
87
-//#define LOG_ARM9
88
-//#define LOG_ARM7
89 60
 
90 61
 struct NDS_header
91 62
 {
92
-       char     gameTile[12];
93
-       char     gameCode[4];
94
-       uint16_t      makerCode;
95
-       uint8_t       unitCode;
96
-       uint8_t       deviceCode;
97
-       uint8_t       cardSize;
98
-       uint8_t       cardInfo[8];
99
-       uint8_t       flags;
100
-	   uint8_t		romversion;
101
-
102
-       uint32_t      ARM9src;
103
-       uint32_t      ARM9exe;
104
-       uint32_t      ARM9cpy;
105
-       uint32_t      ARM9binSize;
106
-
107
-       uint32_t      ARM7src;
108
-       uint32_t      ARM7exe;
109
-       uint32_t      ARM7cpy;
110
-       uint32_t      ARM7binSize;
111
-
112
-       uint32_t      FNameTblOff;
113
-       uint32_t      FNameTblSize;
114
-
115
-       uint32_t      FATOff;
116
-       uint32_t      FATSize;
117
-
118
-       uint32_t     ARM9OverlayOff;
119
-       uint32_t     ARM9OverlaySize;
120
-       uint32_t     ARM7OverlayOff;
121
-       uint32_t     ARM7OverlaySize;
122
-
123
-       uint32_t     unknown2a;
124
-       uint32_t     unknown2b;
125
-
126
-       uint32_t     IconOff;
127
-       uint16_t     CRC16;
128
-       uint16_t     ROMtimeout;
129
-       uint32_t     ARM9unk;
130
-       uint32_t     ARM7unk;
131
-
132
-       uint8_t      unknown3c[8];
133
-       uint32_t     ROMSize;
134
-       uint32_t     HeaderSize;
135
-       uint8_t      unknown5[56];
136
-       uint8_t      logo[156];
137
-       uint16_t     logoCRC16;
138
-       uint16_t     headerCRC16;
139
-       uint8_t      reserved[160];
63
+	char gameTile[12];
64
+	char gameCode[4];
65
+	uint16_t makerCode;
66
+	uint8_t unitCode;
67
+	uint8_t deviceCode;
68
+	uint8_t cardSize;
69
+	uint8_t cardInfo[8];
70
+	uint8_t flags;
71
+	uint8_t romversion;
72
+
73
+	uint32_t ARM9src;
74
+	uint32_t ARM9exe;
75
+	uint32_t ARM9cpy;
76
+	uint32_t ARM9binSize;
77
+
78
+	uint32_t ARM7src;
79
+	uint32_t ARM7exe;
80
+	uint32_t ARM7cpy;
81
+	uint32_t ARM7binSize;
82
+
83
+	uint32_t FNameTblOff;
84
+	uint32_t FNameTblSize;
85
+
86
+	uint32_t FATOff;
87
+	uint32_t FATSize;
88
+
89
+	uint32_t ARM9OverlayOff;
90
+	uint32_t ARM9OverlaySize;
91
+	uint32_t ARM7OverlayOff;
92
+	uint32_t ARM7OverlaySize;
93
+
94
+	uint32_t unknown2a;
95
+	uint32_t unknown2b;
96
+
97
+	uint32_t IconOff;
98
+	uint16_t CRC16;
99
+	uint16_t ROMtimeout;
100
+	uint32_t ARM9unk;
101
+	uint32_t ARM7unk;
102
+
103
+	uint8_t unknown3c[8];
104
+	uint32_t ROMSize;
105
+	uint32_t HeaderSize;
106
+	uint8_t unknown5[56];
107
+	uint8_t logo[156];
108
+	uint16_t logoCRC16;
109
+	uint16_t headerCRC16;
110
+	uint8_t reserved[160];
140 111
 };
141 112
 
142
-//extern void debug();
143
-//void emu_halt();
144
-
145 113
 extern uint64_t nds_timer;
146 114
 void NDS_Reschedule();
147
-//void NDS_RescheduleGXFIFO(uint32_t cost);
148 115
 void NDS_RescheduleDMA();
149 116
 void NDS_RescheduleTimers();
150 117
 
151
-/*enum ENSATA_HANDSHAKE
152
-{
153
-	ENSATA_HANDSHAKE_none = 0,
154
-	ENSATA_HANDSHAKE_query = 1,
155
-	ENSATA_HANDSHAKE_ack = 2,
156
-	ENSATA_HANDSHAKE_confirm = 3,
157
-	ENSATA_HANDSHAKE_complete = 4
158
-};*/
159
-
160 118
 enum NDS_CONSOLE_TYPE
161 119
 {
162 120
 	NDS_CONSOLE_TYPE_FAT,
... ...
@@ -167,17 +125,11 @@ enum NDS_CONSOLE_TYPE
167 125
 
168 126
 struct NDSSystem
169 127
 {
170
-	//int32_t wifiCycle;
171 128
 	int32_t cycles;
172 129
 	uint64_t timerCycle[2][4];
173 130
 	uint32_t VCount;
174 131
 	uint32_t old;
175 132
 
176
-	//uint16_t touchX;
177
-	//uint16_t touchY;
178
-	//bool isTouch;
179
-	//uint16_t pad;
180
-
181 133
 	uint8_t *FW_ARM9BootCode;
182 134
 	uint8_t *FW_ARM7BootCode;
183 135
 	uint32_t FW_ARM9BootCodeAddr;
... ...
@@ -189,92 +141,41 @@ struct NDSSystem
189 141
 	bool cardEjected;
190 142
 	uint32_t freezeBus;
191 143
 
192
-	//this is not essential NDS runtime state.
193
-	//it was perhaps a mistake to put it here.
194
-	//it is far less important than the above.
195
-	//maybe I should move it.
196
-	//int32_t idleCycles[2];
197
-	//int32_t runCycleCollector[2][16];
198
-	//int32_t idleFrameCounter;
199
-	//int32_t cpuloopIterationCount; //counts the number of times during a frame that a reschedule happened
200
-
201
-	//if the game was booted on a debug console, this is set
202
-	//bool debugConsole;
203
-
204
-	//console type must be copied in when the system boots. it can't be changed on the fly.
144
+	// console type must be copied in when the system boots. it can't be changed on the fly.
205 145
 	int ConsoleType;
206
-	bool Is_DSI() { return ConsoleType == NDS_CONSOLE_TYPE_DSI; }
207
-
208
-	//set if the user requests ensata emulation
209
-	//bool ensataEmulation;
210
-
211
-	//there is a hack in the ipc sync for ensata. this tracks its state
212
-	//uint32_t ensataIpcSyncCounter;
146
+	bool Is_DSI() { return this->ConsoleType == NDS_CONSOLE_TYPE_DSI; }
213 147
 
214
-	//maintains the state of the ensata handshaking protocol
215
-	//uint32_t ensataHandshake;
216
-
217
-	/*struct {
218
-		uint8_t lcd, gpuMain, gfx3d_render, gfx3d_geometry, gpuSub, dispswap;
219
-	} power1;*/ //POWCNT1
220
-
221
-	/*struct {
222
-		uint8_t speakers, wifi*/ /*(initial value=0)*//*;
223
-	} power2;*/ //POWCNT2
224
-
225
-	bool isInVblank() const { return VCount >= 192; }
226
-	bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
148
+	bool isInVblank() const { return this->VCount >= 192; }
149
+	bool isIn3dVblank() const { return this->VCount >= 192 && this->VCount < 215; }
227 150
 };
228 151
 
229
-/** /brief A touchscreen calibration point.
230
- */
231
-/*struct NDS_fw_touchscreen_cal {
232
-  uint16_t adc_x;
233
-  uint16_t adc_y;
234
-
235
-  uint8_t screen_x;
236
-  uint8_t screen_y;
237
-};*/
238
-
239 152
 #define MAX_FW_NICKNAME_LENGTH 10
240 153
 #define MAX_FW_MESSAGE_LENGTH 26
241 154
 
242
-struct NDS_fw_config_data {
243
-  NDS_CONSOLE_TYPE ds_type;
244
-
245
-  uint8_t fav_colour;
246
-  uint8_t birth_month;
247
-  uint8_t birth_day;
155
+struct NDS_fw_config_data
156
+{
157
+	NDS_CONSOLE_TYPE ds_type;
248 158
 
249
-  uint16_t nickname[MAX_FW_NICKNAME_LENGTH];
250
-  uint8_t nickname_len;
159
+	uint8_t fav_colour;
160
+	uint8_t birth_month;
161
+	uint8_t birth_day;
251 162
 
252
-  uint16_t message[MAX_FW_MESSAGE_LENGTH];
253
-  uint8_t message_len;
163
+	uint16_t nickname[MAX_FW_NICKNAME_LENGTH];
164
+	uint8_t nickname_len;
254 165
 
255
-  uint8_t language;
166
+	uint16_t message[MAX_FW_MESSAGE_LENGTH];
167
+	uint8_t message_len;
256 168
 
257
-  /* touchscreen calibration */
258
-  //struct NDS_fw_touchscreen_cal touch_cal[2];
169
+	uint8_t language;
259 170
 };
260 171
 
261 172
 extern NDSSystem nds;
262 173
 
263
-#ifdef GDB_STUB
264
-int NDS_Init( struct armcpu_memory_iface *arm9_mem_if,
265
-              struct armcpu_ctrl_iface **arm9_ctrl_iface,
266
-              struct armcpu_memory_iface *arm7_mem_if,
267
-              struct armcpu_ctrl_iface **arm7_ctrl_iface);
268
-#else
269 174
 int NDS_Init ();
270
-#endif
271
-
272
-//void Desmume_InitOnce();
273 175
 
274 176
 void NDS_DeInit();
275 177
 
276 178
 bool NDS_SetROM(uint8_t * rom, uint32_t mask);
277
-NDS_header * NDS_getROMHeader();
278 179
 
279 180
 struct RomBanner
280 181
 {
... ...
@@ -285,97 +186,71 @@ struct RomBanner
285 186
 	uint8_t bitmap[0x200]; //Icon Bitmap  (32x32 pix) (4x4 tiles, each 4x8 bytes, 4bit depth)
286 187
 	uint16_t palette[0x10]; //Icon Palette (16 colors, 16bit, range 0000h-7FFFh) (Color 0 is transparent, so the 1st palette entry is ignored)
287 188
 	enum { NUM_TITLES = 6 };
288
-	union {
289
-		struct {
290
-			uint16_t title_jp[0x80]; //Title 0 Japanese (128 characters, 16bit Unicode)
291
-			uint16_t title_en[0x80]; //Title 1 English  ("")
292
-			uint16_t title_fr[0x80]; //Title 2 French   ("")
293
-			uint16_t title_de[0x80]; //Title 3 German   ("")
294
-			uint16_t title_it[0x80]; //Title 4 Italian  ("")
295
-			uint16_t title_es[0x80]; //Title 5 Spanish  ("")
189
+	union
190
+	{
191
+		struct
192
+		{
193
+			uint16_t title_jp[0x80]; // Title 0 Japanese (128 characters, 16bit Unicode)
194
+			uint16_t title_en[0x80]; // Title 1 English  ("")
195
+			uint16_t title_fr[0x80]; // Title 2 French   ("")
196
+			uint16_t title_de[0x80]; // Title 3 German   ("")
197
+			uint16_t title_it[0x80]; // Title 4 Italian  ("")
198
+			uint16_t title_es[0x80]; // Title 5 Spanish  ("")
296 199
 		};
297 200
 		uint16_t titles[NUM_TITLES][0x80];
298 201
 	};
299 202
 	uint8_t end0xFF[0x1C0];
300
-  //840h  ?    (Maybe newer/chinese firmware do also support chinese title?)
301
-  //840h  -    End of Icon/Title structure (next 1C0h bytes usually FFh-filled)
203
+	//840h  ?    (Maybe newer/chinese firmware do also support chinese title?)
204
+	//840h  -    End of Icon/Title structure (next 1C0h bytes usually FFh-filled)
302 205
 };
303 206
 
304 207
 struct GameInfo
305 208
 {
306
-	GameInfo()
307
-		: romdata(NULL)
308
-	{}
209
+	GameInfo() : romdata() { }
309 210
 
310
-	void loadData(char* buf, int size)
211
+	void loadData(char *buf, int size)
311 212
 	{
312
-		resize(size);
313
-		memcpy(romdata,buf,size);
314
-		romsize = (uint32_t)size;
315
-		fillGap();
213
+		this->resize(size);
214
+		memcpy(&this->romdata[0], buf, size);
215
+		this->romsize = static_cast<uint32_t>(size);
216
+		this->fillGap();
316 217
 	}
317 218
 
318 219
 	void fillGap()
319 220
 	{
320
-		memset(romdata+romsize,0xFF,allocatedSize-romsize);
221
+		memset(&this->romdata[this->romsize], 0xFF, this->allocatedSize - this->romsize);
321 222
 	}
322 223
 
323
-	void resize(int size) {
324
-		if(romdata != NULL) delete[] romdata;
325
-
326
-		//calculate the necessary mask for the requested size
327
-		mask = size-1;
328
-		mask |= (mask >>1);
329
-		mask |= (mask >>2);
330
-		mask |= (mask >>4);
331
-		mask |= (mask >>8);
332
-		mask |= (mask >>16);
333
-
334
-		//now, we actually need to over-allocate, because bytes from anywhere protected by that mask
335
-		//could be read from the rom
336
-		allocatedSize = mask+4;
337
-
338
-		romdata = new char[allocatedSize];
339
-		romsize = size;
224
+	void resize(int size)
225
+	{
226
+		// calculate the necessary mask for the requested size
227
+		mask = size - 1;
228
+		mask |= mask >> 1;
229
+		mask |= mask >> 2;
230
+		mask |= mask >> 4;
231
+		mask |= mask >> 8;
232
+		mask |= mask >> 16;
233
+
234
+		// now, we actually need to over-allocate, because bytes from anywhere protected by that mask
235
+		// could be read from the rom
236
+		this->allocatedSize = mask + 4;
237
+
238
+		this->romdata.reset(new char[allocatedSize]);
239
+		this->romsize = size;
340 240
 	}
341 241
 	uint32_t crc;
342 242
 	NDS_header header;
343 243
 	char ROMserial[20];
344 244
 	char ROMname[20];
345
-	//char ROMfullName[7][0x100];
346
-	//void populate();
347
-	char* romdata;
245
+	std::unique_ptr<char[]> romdata;
348 246
 	uint32_t romsize;
349 247
 	uint32_t allocatedSize;
350 248
 	uint32_t mask;
351
-	//const RomBanner& getRomBanner();
352
-	//bool hasRomBanner();
353 249
 	bool isHomebrew;
354 250
 };
355 251
 
356
-/*typedef struct TSCalInfo
357
-{
358
-	struct adc
359
-	{
360
-		uint16_t x1, x2;
361
-		uint16_t y1, y2;
362
-		uint16_t width;
363
-		uint16_t height;
364
-	} adc;
365
-
366
-	struct scr
367
-	{
368
-		uint8_t x1, x2;
369
-		uint8_t y1, y2;
370
-		uint16_t width;
371
-		uint16_t height;
372
-	} scr;
373
-
374
-} TSCalInfo;*/
375
-
376 252
 extern GameInfo gameInfo;
377 253
 
378
-
379 254
 struct UserButtons : buttonstruct<bool>
380 255
 {
381 256
 };
... ...
@@ -396,126 +271,36 @@ struct UserInput
396 271
 	UserMicrophone mic;
397 272
 };
398 273
 
399
-// set physical user input
400
-// these functions merely request the input to be changed.
401
-// the actual change happens later at a specific time during the frame.
402
-// this is to minimize the risk of desyncs.
403
-//void NDS_setTouchPos(uint16_t x, uint16_t y);
404
-//void NDS_releaseTouch();
405
-//void NDS_setPad(bool right,bool left,bool down,bool up,bool select,bool start,bool B,bool A,bool Y,bool X,bool leftShoulder,bool rightShoulder,bool debug, bool lid);
406
-//void NDS_setMic(bool pressed);
407
-
408
-// get physical user input
409
-// not including the results of autofire/etc.
410
-// the effects of calls to "set physical user input" functions will be immediately reflected here though.
411
-//const UserInput& NDS_getRawUserInput();
412
-//const UserInput& NDS_getPrevRawUserInput();
413
-
414
-// get final (fully processed) user input
415
-// this should match whatever was or would be sent to the game
416
-//const UserInput& NDS_getFinalUserInput();
417
-
418
-// set/get to-be-processed or in-the-middle-of-being-processed user input
419
-// to process input, simply call this function and edit the return value.
420
-// (applying autofire is one example of processing the input.)
421
-// (movie playback is another example.)
422
-// this must be done after the raw user input is set
423
-// and before that input is sent to the game's memory.
424
-//UserInput& NDS_getProcessingUserInput();
425
-//bool NDS_isProcessingUserInput();
426
-// call once per frame to prepare input for processing
427
-//void NDS_beginProcessingInput();
428
-// call once per frame to copy the processed input to the final input
429
-//void NDS_endProcessingInput();
430
-
431
-// this is in case something needs reentrancy while processing input
432
-//void NDS_suspendProcessingInput(bool suspend);
433
-
434
-
435
-
436
-//int NDS_LoadROM(const char *filename, const char* logicalFilename=0);
437 274
 void NDS_FreeROM();
438 275
 void NDS_Reset();
439
-//int NDS_ImportSave(const char *filename);
440
-//bool NDS_ExportSave(const char *filename);
441
-
442
-//void nds_savestate(EMUFILE* os);
443
-bool nds_loadstate(EMUFILE* is, int size);
444
-
445
-//int NDS_WriteBMP(const char *filename);
446 276
 
447 277
 void NDS_Sleep();
448
-//void NDS_ToggleCardEject();
449
-
450
-//void NDS_SkipNextFrame();
451
-//#define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame();
452
-//void NDS_OmitFrameSkip(int force=0);
453
-
454
-//void NDS_debug_break();
455
-//void NDS_debug_continue();
456
-//void NDS_debug_step();
457 278
 
458 279
 void execHardware_doAllDma(EDMAMode modeNum);
459 280
 
460
-template<bool FORCE> void NDS_exec(int32_t nb = 560190<<1);
461
-
462
-//extern int lagframecounter;
281
+template<bool FORCE> void NDS_exec(int32_t nb = 560190 << 1);
463 282
 
464
-/*static INLINE void NDS_swapScreen()
283
+extern struct TCommonSettings
465 284
 {
466
-   uint16_t tmp = MainScreen.offset;
467
-   MainScreen.offset = SubScreen.offset;
468
-   SubScreen.offset = tmp;
469
-}*/
470
-
471
-//int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
472
-
473
-extern struct TCommonSettings {
474
-	TCommonSettings()
475
-		: //GFX3D_HighResolutionInterpolateColor(true)
476
-		//, GFX3D_EdgeMark(true)
477
-		//, GFX3D_Fog(true)
478
-		//, GFX3D_Texture(true)
479
-		//, GFX3D_Zelda_Shadow_Depth_Hack(0)
480
-		/*,*/ UseExtBIOS(false)
481
-		, SWIFromBIOS(false)
482
-		, PatchSWI3(false)
483
-		, UseExtFirmware(false)
484
-		, BootFromFirmware(false)
485
-		, ConsoleType(NDS_CONSOLE_TYPE_FAT)
486
-		//, DebugConsole(false)
487
-		//, EnsataEmulation(false)
488
-		//, cheatsDisable(false)
489
-		//, num_cores(1)
490
-		, rigorous_timing(false)
491
-		, advanced_timing(true)
492
-		//, micMode(InternalNoise)
493
-		, spuInterpolationMode(SPUInterpolation_Linear)
494
-		, manualBackupType(0)
495
-		, spu_captureMuted(false)
496
-		, spu_advanced(false)
285
+	TCommonSettings() : UseExtBIOS(false), SWIFromBIOS(false), PatchSWI3(false), UseExtFirmware(false), BootFromFirmware(false), ConsoleType(NDS_CONSOLE_TYPE_FAT), rigorous_timing(false), advanced_timing(true),
286
+		spuInterpolationMode(SPUInterpolation_Linear), manualBackupType(0), spu_captureMuted(false), spu_advanced(false)
497 287
 	{
498
-		strcpy(ARM9BIOS, "biosnds9.bin");
499
-		strcpy(ARM7BIOS, "biosnds7.bin");
500
-		strcpy(Firmware, "firmware.bin");
501
-		NDS_FillDefaultFirmwareConfigData(&InternalFirmConf);
502
-
503
-		/* WIFI mode: adhoc = 0, infrastructure = 1 */
504
-		//wifi.mode = 1;
505
-		//wifi.infraBridgeAdapter = 0;
506
-
507
-		for(int i=0;i<16;i++)
508
-			spu_muteChannels[i] = false;
509
-
510
-		/*for(int g=0;g<2;g++)
511
-			for(int x=0;x<5;x++)
512
-				dispLayers[g][x]=true;*/
288
+		strcpy(this->ARM9BIOS, "biosnds9.bin");
289
+		strcpy(this->ARM7BIOS, "biosnds7.bin");
290
+		strcpy(this->Firmware, "firmware.bin");
291
+		NDS_FillDefaultFirmwareConfigData(&this->InternalFirmConf);
292
+
293
+		for (int i = 0; i < 16; ++i)
294
+			this->spu_muteChannels[i] = false;
295
+
296
+#ifdef HAVE_JIT
297
+		// zero 06-sep-2012 - shouldnt be defaulting this to true for now, since the jit is buggy.
298
+		// id rather have people discover a bonus speedhack than discover new bugs in a new version
299
+		this->use_jit = false;
300
+#else
301
+		this->use_jit = false;
302
+#endif
513 303
 	}
514
-	//bool GFX3D_HighResolutionInterpolateColor;
515
-	//bool GFX3D_EdgeMark;
516
-	//bool GFX3D_Fog;
517
-	//bool GFX3D_Texture;
518
-	//int  GFX3D_Zelda_Shadow_Depth_Hack;
519 304
 
520 305
 	bool UseExtBIOS;
521 306
 	char ARM9BIOS[256];
... ...
@@ -529,77 +314,22 @@ extern struct TCommonSettings {
529 314
 	struct NDS_fw_config_data InternalFirmConf;
530 315
 
531 316
 	NDS_CONSOLE_TYPE ConsoleType;
532
-	//bool DebugConsole;
533
-	//bool EnsataEmulation;
534 317
 
535
-	//bool cheatsDisable;
536
-
537
-	//int num_cores;
538
-	//bool single_core() { return num_cores==1; }
539 318
 	bool rigorous_timing;
540 319
 
541
-	//bool dispLayers[2][5];
542
-
543
-	/*FAST_ALIGN*/ bool advanced_timing;
544
-
545
-	/*struct _Wifi {
546
-		int mode;
547
-		int infraBridgeAdapter;
548
-	} wifi;*/
549
-
550
-	/*enum MicMode
551
-	{
552
-		InternalNoise = 0,
553
-		Sample = 1,
554
-		Random = 2,
555
-		Physical = 3
556
-	} micMode;*/
320
+	bool advanced_timing;
557 321
 
322
+	bool use_jit;
323
+	uint32_t jit_max_block_size;
558 324
 
559 325
 	SPUInterpolationMode spuInterpolationMode;
560 326
 
561
-	//this is a temporary hack until we straighten out the flushing logic and/or gxfifo
562
-	//int gfx3d_flushMode;
563
-
564
-	//this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
327
+	// this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
565 328
 	int manualBackupType;
566 329
 
567 330
 	bool spu_muteChannels[16];
568 331
 	bool spu_captureMuted;
569 332
 	bool spu_advanced;
570
-
571
-	/*struct _ShowGpu {
572
-		_ShowGpu() : main(true), sub(true) {}
573
-		union {
574
-			struct { bool main,sub; };
575
-			bool screens[2];
576
-		};
577
-	} showGpu;*/
578
-
579
-	/*struct _Hud {
580
-		_Hud()
581
-			: ShowInputDisplay(false)
582
-			, ShowGraphicalInputDisplay(false)
583
-			, FpsDisplay(false)
584
-			, FrameCounterDisplay(false)
585
-			, ShowLagFrameCounter(false)
586
-			, ShowMicrophone(false)
587
-			, ShowRTC(false)
588
-		{}
589
-		bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone, ShowRTC;
590
-	} hud;*/
591
-
592 333
 } CommonSettings;
593 334
 
594
-
595
-//extern std::string InputDisplayString;
596
-//extern int LagFrameFlag;
597
-//extern int lastLag, TotalLagFrames;
598
-
599
-//void MovieSRAM();
600
-
601
-//void ClearAutoHold();
602
-
603
-//bool ValidateSlot2Access(uint32_t procnum, uint32_t demandSRAMSpeed, uint32_t demand1stROMSpeed, uint32_t demand2ndROMSpeed, int clockbits);
604
-
605 335
 #endif
Browse code

Import actual code.

Naram Qashat authored on 2013/03/26 02:41:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,605 @@
1
+/*
2
+	Copyright (C) 2006 yopyop
3
+	Copyright (C) 2008-2012 DeSmuME team
4
+
5
+	This file is free software: you can redistribute it and/or modify
6
+	it under the terms of the GNU General Public License as published by
7
+	the Free Software Foundation, either version 2 of the License, or
8
+	(at your option) any later version.
9
+
10
+	This file is distributed in the hope that it will be useful,
11
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+	GNU General Public License for more details.
14
+
15
+	You should have received a copy of the GNU General Public License
16
+	along with the this software.  If not, see <http://www.gnu.org/licenses/>.
17
+*/
18
+
19
+#ifndef NDSSYSTEM_H
20
+#define NDSSYSTEM_H
21
+
22
+#include <cstring>
23
+
24
+#include "armcpu.h"
25
+#include "MMU.h"
26
+//#include "driver.h"
27
+//#include "GPU.h"
28
+#include "SPU.h"
29
+#include "mem.h"
30
+//#include "wifi.h"
31
+#include "emufile.h"
32
+#include "firmware.h"
33
+
34
+#include <string>
35
+
36
+#if defined(_WINDOWS) && !defined(WXPORT)
37
+#include "pathsettings.h"
38
+#endif
39
+
40
+template<typename Type>
41
+struct buttonstruct {
42
+	union {
43
+		struct {
44
+			// changing the order of these fields would break stuff
45
+			//fRLDUTSBAYXWEg
46
+			Type G; // debug
47
+			Type E; // right shoulder
48
+			Type W; // left shoulder
49
+			Type X;
50
+			Type Y;
51
+			Type A;
52
+			Type B;
53
+			Type S; // start
54
+			Type T; // select
55
+			Type U; // up
56
+			Type D; // down
57
+			Type L; // left
58
+			Type R; // right
59
+			Type F; // lid
60
+		};
61
+		Type array[14];
62
+	};
63
+};
64
+
65
+//extern buttonstruct<bool> Turbo;
66
+extern buttonstruct<int> TurboTime;
67
+//extern buttonstruct<bool> AutoHold;
68
+
69
+//int NDS_WritePNG(const char *fname);
70
+
71
+extern volatile bool execute;
72
+//extern bool click;
73
+
74
+/*
75
+ * The firmware language values
76
+ */
77
+/*#define NDS_FW_LANG_JAP 0
78
+#define NDS_FW_LANG_ENG 1
79
+#define NDS_FW_LANG_FRE 2
80
+#define NDS_FW_LANG_GER 3
81
+#define NDS_FW_LANG_ITA 4
82
+#define NDS_FW_LANG_SPA 5
83
+#define NDS_FW_LANG_CHI 6
84
+#define NDS_FW_LANG_RES 7*/
85
+
86
+
87
+//#define LOG_ARM9
88
+//#define LOG_ARM7
89
+
90
+struct NDS_header
91
+{
92
+       char     gameTile[12];
93
+       char     gameCode[4];
94
+       uint16_t      makerCode;
95
+       uint8_t       unitCode;
96
+       uint8_t       deviceCode;
97
+       uint8_t       cardSize;
98
+       uint8_t       cardInfo[8];
99
+       uint8_t       flags;
100
+	   uint8_t		romversion;
101
+
102
+       uint32_t      ARM9src;
103
+       uint32_t      ARM9exe;
104
+       uint32_t      ARM9cpy;
105
+       uint32_t      ARM9binSize;
106
+
107
+       uint32_t      ARM7src;
108
+       uint32_t      ARM7exe;
109
+       uint32_t      ARM7cpy;
110
+       uint32_t      ARM7binSize;
111
+
112
+       uint32_t      FNameTblOff;
113
+       uint32_t      FNameTblSize;
114
+
115
+       uint32_t      FATOff;
116
+       uint32_t      FATSize;
117
+
118
+       uint32_t     ARM9OverlayOff;
119
+       uint32_t     ARM9OverlaySize;
120
+       uint32_t     ARM7OverlayOff;
121
+       uint32_t     ARM7OverlaySize;
122
+
123
+       uint32_t     unknown2a;
124
+       uint32_t     unknown2b;
125
+
126
+       uint32_t     IconOff;
127
+       uint16_t     CRC16;
128
+       uint16_t     ROMtimeout;
129
+       uint32_t     ARM9unk;
130
+       uint32_t     ARM7unk;
131
+
132
+       uint8_t      unknown3c[8];
133
+       uint32_t     ROMSize;
134
+       uint32_t     HeaderSize;
135
+       uint8_t      unknown5[56];
136
+       uint8_t      logo[156];
137
+       uint16_t     logoCRC16;
138
+       uint16_t     headerCRC16;
139
+       uint8_t      reserved[160];
140
+};
141
+
142
+//extern void debug();
143
+//void emu_halt();
144
+
145
+extern uint64_t nds_timer;
146
+void NDS_Reschedule();
147
+//void NDS_RescheduleGXFIFO(uint32_t cost);
148
+void NDS_RescheduleDMA();
149
+void NDS_RescheduleTimers();
150
+
151
+/*enum ENSATA_HANDSHAKE
152
+{
153
+	ENSATA_HANDSHAKE_none = 0,
154
+	ENSATA_HANDSHAKE_query = 1,
155
+	ENSATA_HANDSHAKE_ack = 2,
156
+	ENSATA_HANDSHAKE_confirm = 3,
157
+	ENSATA_HANDSHAKE_complete = 4
158
+};*/
159
+
160
+enum NDS_CONSOLE_TYPE
161
+{
162
+	NDS_CONSOLE_TYPE_FAT,
163
+	NDS_CONSOLE_TYPE_LITE,
164
+	NDS_CONSOLE_TYPE_IQUE,
165
+	NDS_CONSOLE_TYPE_DSI
166
+};
167
+
168
+struct NDSSystem
169
+{
170
+	//int32_t wifiCycle;
171
+	int32_t cycles;
172
+	uint64_t timerCycle[2][4];
173
+	uint32_t VCount;
174
+	uint32_t old;
175
+
176
+	//uint16_t touchX;
177
+	//uint16_t touchY;
178
+	//bool isTouch;
179
+	//uint16_t pad;
180
+
181
+	uint8_t *FW_ARM9BootCode;
182
+	uint8_t *FW_ARM7BootCode;
183
+	uint32_t FW_ARM9BootCodeAddr;
184
+	uint32_t FW_ARM7BootCodeAddr;
185
+	uint32_t FW_ARM9BootCodeSize;
186
+	uint32_t FW_ARM7BootCodeSize;
187
+
188
+	bool sleeping;
189
+	bool cardEjected;
190
+	uint32_t freezeBus;
191
+
192
+	//this is not essential NDS runtime state.
193
+	//it was perhaps a mistake to put it here.
194
+	//it is far less important than the above.
195
+	//maybe I should move it.
196
+	//int32_t idleCycles[2];
197
+	//int32_t runCycleCollector[2][16];
198
+	//int32_t idleFrameCounter;
199
+	//int32_t cpuloopIterationCount; //counts the number of times during a frame that a reschedule happened
200
+
201
+	//if the game was booted on a debug console, this is set
202
+	//bool debugConsole;
203
+
204
+	//console type must be copied in when the system boots. it can't be changed on the fly.
205
+	int ConsoleType;
206
+	bool Is_DSI() { return ConsoleType == NDS_CONSOLE_TYPE_DSI; }
207
+
208
+	//set if the user requests ensata emulation
209
+	//bool ensataEmulation;
210
+
211
+	//there is a hack in the ipc sync for ensata. this tracks its state
212
+	//uint32_t ensataIpcSyncCounter;
213
+
214
+	//maintains the state of the ensata handshaking protocol
215
+	//uint32_t ensataHandshake;
216
+
217
+	/*struct {
218
+		uint8_t lcd, gpuMain, gfx3d_render, gfx3d_geometry, gpuSub, dispswap;
219
+	} power1;*/ //POWCNT1
220
+
221
+	/*struct {
222
+		uint8_t speakers, wifi*/ /*(initial value=0)*//*;
223
+	} power2;*/ //POWCNT2
224
+
225
+	bool isInVblank() const { return VCount >= 192; }
226
+	bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
227
+};
228
+
229
+/** /brief A touchscreen calibration point.
230
+ */
231
+/*struct NDS_fw_touchscreen_cal {
232
+  uint16_t adc_x;
233
+  uint16_t adc_y;
234
+
235
+  uint8_t screen_x;
236
+  uint8_t screen_y;
237
+};*/
238
+
239
+#define MAX_FW_NICKNAME_LENGTH 10
240
+#define MAX_FW_MESSAGE_LENGTH 26
241
+
242
+struct NDS_fw_config_data {
243
+  NDS_CONSOLE_TYPE ds_type;
244
+
245
+  uint8_t fav_colour;
246
+  uint8_t birth_month;
247
+  uint8_t birth_day;
248
+
249
+  uint16_t nickname[MAX_FW_NICKNAME_LENGTH];
250
+  uint8_t nickname_len;
251
+
252
+  uint16_t message[MAX_FW_MESSAGE_LENGTH];
253
+  uint8_t message_len;
254
+
255
+  uint8_t language;
256
+
257
+  /* touchscreen calibration */
258
+  //struct NDS_fw_touchscreen_cal touch_cal[2];
259
+};
260
+
261
+extern NDSSystem nds;
262
+
263
+#ifdef GDB_STUB
264
+int NDS_Init( struct armcpu_memory_iface *arm9_mem_if,
265
+              struct armcpu_ctrl_iface **arm9_ctrl_iface,
266
+              struct armcpu_memory_iface *arm7_mem_if,
267
+              struct armcpu_ctrl_iface **arm7_ctrl_iface);
268
+#else
269
+int NDS_Init ();
270
+#endif
271
+
272
+//void Desmume_InitOnce();
273
+
274
+void NDS_DeInit();
275
+
276
+bool NDS_SetROM(uint8_t * rom, uint32_t mask);
277
+NDS_header * NDS_getROMHeader();
278
+
279
+struct RomBanner
280
+{
281
+	RomBanner(bool defaultInit);
282
+	uint16_t version; //Version  (0001h)
283
+	uint16_t crc16; //CRC16 across entries 020h..83Fh
284
+	uint8_t reserved[0x1C]; //Reserved (zero-filled)
285
+	uint8_t bitmap[0x200]; //Icon Bitmap  (32x32 pix) (4x4 tiles, each 4x8 bytes, 4bit depth)
286
+	uint16_t palette[0x10]; //Icon Palette (16 colors, 16bit, range 0000h-7FFFh) (Color 0 is transparent, so the 1st palette entry is ignored)
287
+	enum { NUM_TITLES = 6 };
288
+	union {
289
+		struct {
290
+			uint16_t title_jp[0x80]; //Title 0 Japanese (128 characters, 16bit Unicode)
291
+			uint16_t title_en[0x80]; //Title 1 English  ("")
292
+			uint16_t title_fr[0x80]; //Title 2 French   ("")
293
+			uint16_t title_de[0x80]; //Title 3 German   ("")
294
+			uint16_t title_it[0x80]; //Title 4 Italian  ("")
295
+			uint16_t title_es[0x80]; //Title 5 Spanish  ("")
296
+		};
297
+		uint16_t titles[NUM_TITLES][0x80];
298
+	};
299
+	uint8_t end0xFF[0x1C0];
300
+  //840h  ?    (Maybe newer/chinese firmware do also support chinese title?)
301
+  //840h  -    End of Icon/Title structure (next 1C0h bytes usually FFh-filled)
302
+};
303
+
304
+struct GameInfo
305
+{
306
+	GameInfo()
307
+		: romdata(NULL)
308
+	{}
309
+
310
+	void loadData(char* buf, int size)
311
+	{
312
+		resize(size);
313
+		memcpy(romdata,buf,size);
314
+		romsize = (uint32_t)size;
315
+		fillGap();
316
+	}
317
+
318
+	void fillGap()
319
+	{
320
+		memset(romdata+romsize,0xFF,allocatedSize-romsize);
321
+	}
322
+
323
+	void resize(int size) {
324
+		if(romdata != NULL) delete[] romdata;
325
+
326
+		//calculate the necessary mask for the requested size
327
+		mask = size-1;
328
+		mask |= (mask >>1);
329
+		mask |= (mask >>2);
330
+		mask |= (mask >>4);
331
+		mask |= (mask >>8);
332
+		mask |= (mask >>16);
333
+
334
+		//now, we actually need to over-allocate, because bytes from anywhere protected by that mask
335
+		//could be read from the rom
336
+		allocatedSize = mask+4;
337
+
338
+		romdata = new char[allocatedSize];
339
+		romsize = size;
340
+	}
341
+	uint32_t crc;
342
+	NDS_header header;
343
+	char ROMserial[20];
344
+	char ROMname[20];
345
+	//char ROMfullName[7][0x100];
346
+	//void populate();
347
+	char* romdata;
348
+	uint32_t romsize;
349
+	uint32_t allocatedSize;
350
+	uint32_t mask;
351
+	//const RomBanner& getRomBanner();
352
+	//bool hasRomBanner();
353
+	bool isHomebrew;
354
+};
355
+
356
+/*typedef struct TSCalInfo
357
+{
358
+	struct adc
359
+	{
360
+		uint16_t x1, x2;
361
+		uint16_t y1, y2;
362
+		uint16_t width;
363
+		uint16_t height;
364
+	} adc;
365
+
366
+	struct scr
367
+	{
368
+		uint8_t x1, x2;
369
+		uint8_t y1, y2;
370
+		uint16_t width;
371
+		uint16_t height;
372
+	} scr;
373
+
374
+} TSCalInfo;*/
375
+
376
+extern GameInfo gameInfo;
377
+
378
+
379
+struct UserButtons : buttonstruct<bool>
380
+{
381
+};
382
+struct UserTouch
383
+{
384
+	uint16_t touchX;
385
+	uint16_t touchY;
386
+	bool isTouch;
387
+};
388
+struct UserMicrophone
389
+{
390
+	uint32_t micButtonPressed;
391
+};
392
+struct UserInput
393
+{
394
+	UserButtons buttons;
395
+	UserTouch touch;
396
+	UserMicrophone mic;
397
+};
398
+
399
+// set physical user input
400
+// these functions merely request the input to be changed.
401
+// the actual change happens later at a specific time during the frame.
402
+// this is to minimize the risk of desyncs.
403
+//void NDS_setTouchPos(uint16_t x, uint16_t y);
404
+//void NDS_releaseTouch();
405
+//void NDS_setPad(bool right,bool left,bool down,bool up,bool select,bool start,bool B,bool A,bool Y,bool X,bool leftShoulder,bool rightShoulder,bool debug, bool lid);
406
+//void NDS_setMic(bool pressed);
407
+
408
+// get physical user input
409
+// not including the results of autofire/etc.
410
+// the effects of calls to "set physical user input" functions will be immediately reflected here though.
411
+//const UserInput& NDS_getRawUserInput();
412
+//const UserInput& NDS_getPrevRawUserInput();
413
+
414
+// get final (fully processed) user input
415
+// this should match whatever was or would be sent to the game
416
+//const UserInput& NDS_getFinalUserInput();
417
+
418
+// set/get to-be-processed or in-the-middle-of-being-processed user input
419
+// to process input, simply call this function and edit the return value.
420
+// (applying autofire is one example of processing the input.)
421
+// (movie playback is another example.)
422
+// this must be done after the raw user input is set
423
+// and before that input is sent to the game's memory.
424
+//UserInput& NDS_getProcessingUserInput();
425
+//bool NDS_isProcessingUserInput();
426
+// call once per frame to prepare input for processing
427
+//void NDS_beginProcessingInput();
428
+// call once per frame to copy the processed input to the final input
429
+//void NDS_endProcessingInput();
430
+
431
+// this is in case something needs reentrancy while processing input
432
+//void NDS_suspendProcessingInput(bool suspend);
433
+
434
+
435
+
436
+//int NDS_LoadROM(const char *filename, const char* logicalFilename=0);
437
+void NDS_FreeROM();
438
+void NDS_Reset();
439
+//int NDS_ImportSave(const char *filename);
440
+//bool NDS_ExportSave(const char *filename);
441
+
442
+//void nds_savestate(EMUFILE* os);
443
+bool nds_loadstate(EMUFILE* is, int size);
444
+
445
+//int NDS_WriteBMP(const char *filename);
446
+
447
+void NDS_Sleep();
448
+//void NDS_ToggleCardEject();
449
+
450
+//void NDS_SkipNextFrame();
451
+//#define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame();
452
+//void NDS_OmitFrameSkip(int force=0);
453
+
454
+//void NDS_debug_break();
455
+//void NDS_debug_continue();
456
+//void NDS_debug_step();
457
+
458
+void execHardware_doAllDma(EDMAMode modeNum);
459
+
460
+template<bool FORCE> void NDS_exec(int32_t nb = 560190<<1);
461
+
462
+//extern int lagframecounter;
463
+
464
+/*static INLINE void NDS_swapScreen()
465
+{
466
+   uint16_t tmp = MainScreen.offset;
467
+   MainScreen.offset = SubScreen.offset;
468
+   SubScreen.offset = tmp;
469
+}*/
470
+
471
+//int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
472
+
473
+extern struct TCommonSettings {
474
+	TCommonSettings()
475
+		: //GFX3D_HighResolutionInterpolateColor(true)
476
+		//, GFX3D_EdgeMark(true)
477
+		//, GFX3D_Fog(true)
478
+		//, GFX3D_Texture(true)
479
+		//, GFX3D_Zelda_Shadow_Depth_Hack(0)
480
+		/*,*/ UseExtBIOS(false)
481
+		, SWIFromBIOS(false)
482
+		, PatchSWI3(false)
483
+		, UseExtFirmware(false)
484
+		, BootFromFirmware(false)
485
+		, ConsoleType(NDS_CONSOLE_TYPE_FAT)
486
+		//, DebugConsole(false)
487
+		//, EnsataEmulation(false)
488
+		//, cheatsDisable(false)
489
+		//, num_cores(1)
490
+		, rigorous_timing(false)
491
+		, advanced_timing(true)
492
+		//, micMode(InternalNoise)
493
+		, spuInterpolationMode(SPUInterpolation_Linear)
494
+		, manualBackupType(0)
495
+		, spu_captureMuted(false)
496
+		, spu_advanced(false)
497
+	{
498
+		strcpy(ARM9BIOS, "biosnds9.bin");
499
+		strcpy(ARM7BIOS, "biosnds7.bin");
500
+		strcpy(Firmware, "firmware.bin");
501
+		NDS_FillDefaultFirmwareConfigData(&InternalFirmConf);
502
+
503
+		/* WIFI mode: adhoc = 0, infrastructure = 1 */
504
+		//wifi.mode = 1;
505
+		//wifi.infraBridgeAdapter = 0;
506
+
507
+		for(int i=0;i<16;i++)
508
+			spu_muteChannels[i] = false;
509
+
510
+		/*for(int g=0;g<2;g++)
511
+			for(int x=0;x<5;x++)
512
+				dispLayers[g][x]=true;*/
513
+	}
514
+	//bool GFX3D_HighResolutionInterpolateColor;
515
+	//bool GFX3D_EdgeMark;
516
+	//bool GFX3D_Fog;
517
+	//bool GFX3D_Texture;
518
+	//int  GFX3D_Zelda_Shadow_Depth_Hack;
519
+
520
+	bool UseExtBIOS;
521
+	char ARM9BIOS[256];
522
+	char ARM7BIOS[256];
523
+	bool SWIFromBIOS;
524
+	bool PatchSWI3;
525
+
526
+	bool UseExtFirmware;
527
+	char Firmware[256];
528
+	bool BootFromFirmware;
529
+	struct NDS_fw_config_data InternalFirmConf;
530
+
531
+	NDS_CONSOLE_TYPE ConsoleType;
532
+	//bool DebugConsole;
533
+	//bool EnsataEmulation;
534
+
535
+	//bool cheatsDisable;
536
+
537
+	//int num_cores;
538
+	//bool single_core() { return num_cores==1; }
539
+	bool rigorous_timing;
540
+
541
+	//bool dispLayers[2][5];
542
+
543
+	/*FAST_ALIGN*/ bool advanced_timing;
544
+
545
+	/*struct _Wifi {
546
+		int mode;
547
+		int infraBridgeAdapter;
548
+	} wifi;*/
549
+
550
+	/*enum MicMode
551
+	{
552
+		InternalNoise = 0,
553
+		Sample = 1,
554
+		Random = 2,
555
+		Physical = 3
556
+	} micMode;*/
557
+
558
+
559
+	SPUInterpolationMode spuInterpolationMode;
560
+
561
+	//this is a temporary hack until we straighten out the flushing logic and/or gxfifo
562
+	//int gfx3d_flushMode;
563
+
564
+	//this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
565
+	int manualBackupType;
566
+
567
+	bool spu_muteChannels[16];
568
+	bool spu_captureMuted;
569
+	bool spu_advanced;
570
+
571
+	/*struct _ShowGpu {
572
+		_ShowGpu() : main(true), sub(true) {}
573
+		union {
574
+			struct { bool main,sub; };
575
+			bool screens[2];
576
+		};
577
+	} showGpu;*/
578
+
579
+	/*struct _Hud {
580
+		_Hud()
581
+			: ShowInputDisplay(false)
582
+			, ShowGraphicalInputDisplay(false)
583
+			, FpsDisplay(false)
584
+			, FrameCounterDisplay(false)
585
+			, ShowLagFrameCounter(false)
586
+			, ShowMicrophone(false)
587
+			, ShowRTC(false)
588
+		{}
589
+		bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone, ShowRTC;
590
+	} hud;*/
591
+
592
+} CommonSettings;
593
+
594
+
595
+//extern std::string InputDisplayString;
596
+//extern int LagFrameFlag;
597
+//extern int lastLag, TotalLagFrames;
598
+
599
+//void MovieSRAM();
600
+
601
+//void ClearAutoHold();
602
+
603
+//bool ValidateSlot2Access(uint32_t procnum, uint32_t demandSRAMSpeed, uint32_t demand1stROMSpeed, uint32_t demand2ndROMSpeed, int clockbits);
604
+
605
+#endif