/[pcsx2_0.9.7]/trunk/pcsx2/Config.h
ViewVC logotype

Contents of /trunk/pcsx2/Config.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (10 years, 1 month ago) by william
File MIME type: text/plain
File size: 16948 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #pragma once
17
18 #include "x86emitter/tools.h"
19
20 class IniInterface;
21
22 enum PluginsEnum_t
23 {
24 PluginId_GS = 0,
25 PluginId_PAD,
26 PluginId_SPU2,
27 PluginId_CDVD,
28 PluginId_USB,
29 PluginId_FW,
30 PluginId_DEV9,
31 PluginId_Count,
32
33 // Memorycard plugin support is preliminary, and is only hacked/hardcoded in at this
34 // time. So it's placed afer PluginId_Count so that it doesn't show up in the conf
35 // screens or other plugin tables.
36
37 PluginId_Mcd
38 };
39
40 enum GamefixId
41 {
42 GamefixId_FIRST = 0,
43
44 Fix_VuAddSub = GamefixId_FIRST,
45 Fix_VuClipFlag,
46 Fix_FpuCompare,
47 Fix_FpuMultiply,
48 Fix_FpuNegDiv,
49 Fix_XGKick,
50 Fix_IpuWait,
51 Fix_EETiming,
52 Fix_SkipMpeg,
53 Fix_OPHFlag,
54
55 GamefixId_COUNT
56 };
57
58 ImplementEnumOperators( GamefixId );
59
60 //------------ DEFAULT sseMXCSR VALUES ---------------
61 #define DEFAULT_sseMXCSR 0xffc0 //FPU rounding > DaZ, FtZ, "chop"
62 #define DEFAULT_sseVUMXCSR 0xffc0 //VU rounding > DaZ, FtZ, "chop"
63
64 // --------------------------------------------------------------------------------------
65 // TraceFiltersEE
66 // --------------------------------------------------------------------------------------
67 struct TraceFiltersEE
68 {
69 BITFIELD32()
70 bool
71 m_EnableAll :1, // Master Enable switch (if false, no logs at all)
72 m_EnableDisasm :1,
73 m_EnableRegisters:1,
74 m_EnableEvents :1; // Enables logging of event-driven activity -- counters, DMAs, etc.
75 BITFIELD_END
76
77 TraceFiltersEE()
78 {
79 bitset = 0;
80 }
81
82 bool operator ==( const TraceFiltersEE& right ) const
83 {
84 return OpEqu( bitset );
85 }
86
87 bool operator !=( const TraceFiltersEE& right ) const
88 {
89 return !this->operator ==( right );
90 }
91 };
92
93 // --------------------------------------------------------------------------------------
94 // TraceFiltersIOP
95 // --------------------------------------------------------------------------------------
96 struct TraceFiltersIOP
97 {
98 BITFIELD32()
99 bool
100 m_EnableAll :1, // Master Enable switch (if false, no logs at all)
101 m_EnableDisasm :1,
102 m_EnableRegisters:1,
103 m_EnableEvents :1; // Enables logging of event-driven activity -- counters, DMAs, etc.
104 BITFIELD_END
105
106 TraceFiltersIOP()
107 {
108 bitset = 0;
109 }
110
111 bool operator ==( const TraceFiltersIOP& right ) const
112 {
113 return OpEqu( bitset );
114 }
115
116 bool operator !=( const TraceFiltersIOP& right ) const
117 {
118 return !this->operator ==( right );
119 }
120 };
121
122 // --------------------------------------------------------------------------------------
123 // TraceLogFilters
124 // --------------------------------------------------------------------------------------
125 struct TraceLogFilters
126 {
127 // Enabled - global toggle for high volume logging. This is effectively the equivalent to
128 // (EE.Enabled() || IOP.Enabled() || SIF) -- it's cached so that we can use the macros
129 // below to inline the conditional check. This is desirable because these logs are
130 // *very* high volume, and debug builds get noticably slower if they have to invoke
131 // methods/accessors to test the log enable bits. Debug builds are slow enough already,
132 // so I prefer this to help keep them usable.
133 bool Enabled;
134
135 TraceFiltersEE EE;
136 TraceFiltersIOP IOP;
137
138 TraceLogFilters()
139 {
140 Enabled = false;
141 }
142
143 void LoadSave( IniInterface& ini );
144
145 bool operator ==( const TraceLogFilters& right ) const
146 {
147 return OpEqu( Enabled ) && OpEqu( EE ) && OpEqu( IOP );
148 }
149
150 bool operator !=( const TraceLogFilters& right ) const
151 {
152 return !this->operator ==( right );
153 }
154 };
155
156 // --------------------------------------------------------------------------------------
157 // Pcsx2Config class
158 // --------------------------------------------------------------------------------------
159 // This is intended to be a public class library between the core emulator and GUI only.
160 // It is *not* meant to be shared data between core emulation and plugins, due to issues
161 // with version incompatibilities if the structure formats are changed.
162 //
163 // When GUI code performs modifications of this class, it must be done with strict thread
164 // safety, since the emu runs on a separate thread. Additionally many components of the
165 // class require special emu-side resets or state save/recovery to be applied. Please
166 // use the provided functions to lock the emulation into a safe state and then apply
167 // chances on the necessary scope (see Core_Pause, Core_ApplySettings, and Core_Resume).
168 //
169 struct Pcsx2Config
170 {
171 struct ProfilerOptions
172 {
173 BITFIELD32()
174 bool
175 Enabled:1, // universal toggle for the profiler.
176 RecBlocks_EE:1, // Enables per-block profiling for the EE recompiler [unimplemented]
177 RecBlocks_IOP:1, // Enables per-block profiling for the IOP recompiler [unimplemented]
178 RecBlocks_VU0:1, // Enables per-block profiling for the VU0 recompiler [unimplemented]
179 RecBlocks_VU1:1; // Enables per-block profiling for the VU1 recompiler [unimplemented]
180 BITFIELD_END
181
182 // Default is Disabled, with all recs enabled underneath.
183 ProfilerOptions() : bitset( 0xfffffffe ) {}
184 void LoadSave( IniInterface& conf );
185
186 bool operator ==( const ProfilerOptions& right ) const
187 {
188 return OpEqu( bitset );
189 }
190
191 bool operator !=( const ProfilerOptions& right ) const
192 {
193 return !OpEqu( bitset );
194 }
195 };
196
197 // ------------------------------------------------------------------------
198 struct RecompilerOptions
199 {
200 BITFIELD32()
201 bool
202 EnableEE :1,
203 EnableIOP :1,
204 EnableVU0 :1,
205 EnableVU1 :1;
206
207 bool
208 UseMicroVU0 :1,
209 UseMicroVU1 :1;
210
211 bool
212 vuOverflow :1,
213 vuExtraOverflow :1,
214 vuSignOverflow :1,
215 vuUnderflow :1;
216
217 bool
218 fpuOverflow :1,
219 fpuExtraOverflow:1,
220 fpuFullMode :1;
221
222 bool
223 StackFrameChecks:1,
224 PreBlockCheckEE :1,
225 PreBlockCheckIOP:1;
226 BITFIELD_END
227
228 RecompilerOptions();
229 void ApplySanityCheck();
230
231 void LoadSave( IniInterface& conf );
232
233 bool operator ==( const RecompilerOptions& right ) const
234 {
235 return OpEqu( bitset );
236 }
237
238 bool operator !=( const RecompilerOptions& right ) const
239 {
240 return !OpEqu( bitset );
241 }
242
243 } Recompiler;
244
245 // ------------------------------------------------------------------------
246 struct CpuOptions
247 {
248 RecompilerOptions Recompiler;
249
250 SSE_MXCSR sseMXCSR;
251 SSE_MXCSR sseVUMXCSR;
252
253 CpuOptions();
254 void LoadSave( IniInterface& conf );
255 void ApplySanityCheck();
256
257 bool operator ==( const CpuOptions& right ) const
258 {
259 return OpEqu( sseMXCSR ) && OpEqu( sseVUMXCSR ) && OpEqu( Recompiler );
260 }
261
262 bool operator !=( const CpuOptions& right ) const
263 {
264 return !this->operator ==( right );
265 }
266 };
267
268 // ------------------------------------------------------------------------
269 struct GSOptions
270 {
271 // forces the MTGS to execute tags/tasks in fully blocking/synchronous
272 // style. Useful for debugging potential bugs in the MTGS pipeline.
273 bool SynchronousMTGS;
274 bool DisableOutput;
275 int VsyncQueueSize;
276
277 bool FrameLimitEnable;
278 bool FrameSkipEnable;
279 bool VsyncEnable;
280
281 // The region mode controls the default Maximum/Minimum FPS settings and also
282 // regulates the vsync rates (which in turn control the IOP's SPU2 tick sync and ensure
283 // proper audio playback speed).
284 int DefaultRegionMode; // 0=NTSC and 1=PAL
285
286 int FramesToDraw; // number of consecutive frames (fields) to render
287 int FramesToSkip; // number of consecutive frames (fields) to skip
288
289 Fixed100 LimitScalar;
290 Fixed100 FramerateNTSC;
291 Fixed100 FrameratePAL;
292
293 GSOptions();
294 void LoadSave( IniInterface& conf );
295
296 bool operator ==( const GSOptions& right ) const
297 {
298 return
299 OpEqu( SynchronousMTGS ) &&
300 OpEqu( DisableOutput ) &&
301 OpEqu( VsyncQueueSize ) &&
302
303 OpEqu( FrameSkipEnable ) &&
304 OpEqu( FrameLimitEnable ) &&
305 OpEqu( VsyncEnable ) &&
306
307 OpEqu( LimitScalar ) &&
308 OpEqu( FramerateNTSC ) &&
309 OpEqu( FrameratePAL ) &&
310
311 OpEqu( DefaultRegionMode ) &&
312 OpEqu( FramesToDraw ) &&
313 OpEqu( FramesToSkip );
314 }
315
316 bool operator !=( const GSOptions& right ) const
317 {
318 return !this->operator ==( right );
319 }
320
321 };
322
323 // ------------------------------------------------------------------------
324 // NOTE: The GUI's GameFixes panel is dependent on the order of bits in this structure.
325 struct GamefixOptions
326 {
327 BITFIELD32()
328 bool
329 VuAddSubHack :1, // Tri-ace games, they use an encryption algorithm that requires VU ADDI opcode to be bit-accurate.
330 VuClipFlagHack :1, // Persona games, maybe others. It's to do with the VU clip flag (again).
331 FpuCompareHack :1, // Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu.
332 FpuMulHack :1, // Tales of Destiny hangs.
333 FpuNegDivHack :1, // Gundam games messed up camera-view.
334 XgKickHack :1, // Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics, but breaks Tri-ace games and others.
335 IPUWaitHack :1, // FFX FMV, makes GIF flush before doing IPU work. Fixes bad graphics overlay.
336 EETimingHack :1, // General purpose timing hack.
337 SkipMPEGHack :1, // Skips MPEG videos (Katamari and other games need this)
338 OPHFlagHack :1; // Skips MPEG videos (Katamari and other games need this)
339 BITFIELD_END
340
341 // all gamefixes are disabled by default.
342 GamefixOptions() : bitset( 0 ) {}
343 void LoadSave( IniInterface& conf );
344
345 void Set( const wxString& list, bool enabled=true );
346 void Clear( const wxString& list ) { Set( list, false ); }
347
348 bool Get( GamefixId id ) const;
349 void Set( GamefixId id, bool enabled=true );
350 void Clear( GamefixId id ) { Set( id, false ); }
351
352 bool operator ==( const GamefixOptions& right ) const
353 {
354 return OpEqu( bitset );
355 }
356
357 bool operator !=( const GamefixOptions& right ) const
358 {
359 return !OpEqu( bitset );
360 }
361 };
362
363 // ------------------------------------------------------------------------
364 struct SpeedhackOptions
365 {
366 BITFIELD32()
367 bool
368 fastCDVD :1, // enables fast CDVD access
369 IntcStat :1, // tells Pcsx2 to fast-forward through intc_stat waits.
370 WaitLoop :1, // enables constant loop detection and fast-forwarding
371 vuFlagHack :1, // microVU specific flag hack
372 vuBlockHack :1, // microVU specific block flag no-propagation hack
373 vuMinMax :1; // microVU specific MinMax hack
374 BITFIELD_END
375
376 u8 EECycleRate; // EE cycle rate selector (1.0, 1.5, 2.0)
377 u8 VUCycleSteal; // VU Cycle Stealer factor (0, 1, 2, or 3)
378
379 SpeedhackOptions();
380 void LoadSave( IniInterface& conf );
381
382 bool operator ==( const SpeedhackOptions& right ) const
383 {
384 return OpEqu( bitset ) && OpEqu( EECycleRate ) && OpEqu( VUCycleSteal );
385 }
386
387 bool operator !=( const SpeedhackOptions& right ) const
388 {
389 return !this->operator ==( right );
390 }
391 };
392
393 BITFIELD32()
394 bool
395 CdvdVerboseReads :1, // enables cdvd read activity verbosely dumped to the console
396 CdvdDumpBlocks :1, // enables cdvd block dumping
397 EnablePatches :1, // enables patch detection and application
398 EnableCheats :1, // enables cheat detection and application
399
400 // when enabled uses BOOT2 injection, skipping sony bios splashes
401 UseBOOT2Injection :1,
402
403 // enables simulated ejection of memory cards when loading savestates
404 McdEnableEjection :1,
405
406 MultitapPort0_Enabled:1,
407 MultitapPort1_Enabled:1,
408
409 ConsoleToStdio :1,
410 HostFs :1;
411 BITFIELD_END
412
413 CpuOptions Cpu;
414 GSOptions GS;
415 SpeedhackOptions Speedhacks;
416 GamefixOptions Gamefixes;
417 ProfilerOptions Profiler;
418
419 TraceLogFilters Trace;
420
421 wxFileName BiosFilename;
422
423 Pcsx2Config();
424 void LoadSave( IniInterface& ini );
425
426 void Load( const wxString& srcfile );
427 void Load( const wxInputStream& srcstream );
428 void Save( const wxString& dstfile );
429 void Save( const wxOutputStream& deststream );
430
431 bool MultitapEnabled( uint port ) const;
432
433 bool operator ==( const Pcsx2Config& right ) const
434 {
435 return
436 OpEqu( bitset ) &&
437 OpEqu( Cpu ) &&
438 OpEqu( GS ) &&
439 OpEqu( Speedhacks ) &&
440 OpEqu( Gamefixes ) &&
441 OpEqu( Profiler ) &&
442 OpEqu( Trace ) &&
443 OpEqu( BiosFilename );
444 }
445
446 bool operator !=( const Pcsx2Config& right ) const
447 {
448 return !this->operator ==( right );
449 }
450 };
451
452 extern const Pcsx2Config EmuConfig;
453
454 Pcsx2Config::GSOptions& SetGSConfig();
455 Pcsx2Config::RecompilerOptions& SetRecompilerConfig();
456 Pcsx2Config::GamefixOptions& SetGameFixConfig();
457 TraceLogFilters& SetTraceConfig();
458
459
460 /////////////////////////////////////////////////////////////////////////////////////////
461 // Helper Macros for Reading Emu Configurations.
462 //
463
464 // ------------ CPU / Recompiler Options ---------------
465
466 #define CHECK_MICROVU0 (EmuConfig.Cpu.Recompiler.UseMicroVU0)
467 #define CHECK_MICROVU1 (EmuConfig.Cpu.Recompiler.UseMicroVU1)
468 #define CHECK_EEREC (EmuConfig.Cpu.Recompiler.EnableEE && GetCpuProviders().IsRecAvailable_EE())
469 #define CHECK_IOPREC (EmuConfig.Cpu.Recompiler.EnableIOP && GetCpuProviders().IsRecAvailable_IOP())
470
471 //------------ SPECIAL GAME FIXES!!! ---------------
472 #define CHECK_VUADDSUBHACK (EmuConfig.Gamefixes.VuAddSubHack) // Special Fix for Tri-ace games, they use an encryption algorithm that requires VU addi opcode to be bit-accurate.
473 #define CHECK_FPUCOMPAREHACK (EmuConfig.Gamefixes.FpuCompareHack) // Special Fix for Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu.
474 #define CHECK_VUCLIPFLAGHACK (EmuConfig.Gamefixes.VuClipFlagHack) // Special Fix for Persona games, maybe others. It's to do with the VU clip flag (again).
475 #define CHECK_FPUMULHACK (EmuConfig.Gamefixes.FpuMulHack) // Special Fix for Tales of Destiny hangs.
476 #define CHECK_FPUNEGDIVHACK (EmuConfig.Gamefixes.FpuNegDivHack) // Special Fix for Gundam games messed up camera-view.
477 #define CHECK_XGKICKHACK (EmuConfig.Gamefixes.XgKickHack) // Special Fix for Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics.
478 #define CHECK_IPUWAITHACK (EmuConfig.Gamefixes.IPUWaitHack) // Special Fix For FFX
479 #define CHECK_EETIMINGHACK (EmuConfig.Gamefixes.EETimingHack) // Fix all scheduled events to happen in 1 cycle.
480 #define CHECK_SKIPMPEGHACK (EmuConfig.Gamefixes.SkipMPEGHack) // Finds sceMpegIsEnd pattern to tell the game the mpeg is finished (Katamari and a lot of games need this)
481 #define CHECK_OPHFLAGHACK (EmuConfig.Gamefixes.OPHFlagHack)
482
483 //------------ Advanced Options!!! ---------------
484 #define CHECK_VU_OVERFLOW (EmuConfig.Cpu.Recompiler.vuOverflow)
485 #define CHECK_VU_EXTRA_OVERFLOW (EmuConfig.Cpu.Recompiler.vuExtraOverflow) // If enabled, Operands are clamped before being used in the VU recs
486 #define CHECK_VU_SIGN_OVERFLOW (EmuConfig.Cpu.Recompiler.vuSignOverflow)
487 #define CHECK_VU_UNDERFLOW (EmuConfig.Cpu.Recompiler.vuUnderflow)
488 #define CHECK_VU_EXTRA_FLAGS 0 // Always disabled now // Sets correct flags in the sVU recs
489
490 #define CHECK_FPU_OVERFLOW (EmuConfig.Cpu.Recompiler.fpuOverflow)
491 #define CHECK_FPU_EXTRA_OVERFLOW (EmuConfig.Cpu.Recompiler.fpuExtraOverflow) // If enabled, Operands are checked for infinities before being used in the FPU recs
492 #define CHECK_FPU_EXTRA_FLAGS 1 // Always enabled now // Sets D/I flags on FPU instructions
493 #define CHECK_FPU_FULL (EmuConfig.Cpu.Recompiler.fpuFullMode)
494
495 //------------ EE Recompiler defines - Comment to disable a recompiler ---------------
496
497 #define SHIFT_RECOMPILE // Speed majorly reduced if disabled
498 #define BRANCH_RECOMPILE // Speed extremely reduced if disabled - more then shift
499
500 // Disabling all the recompilers in this block is interesting, as it still runs at a reasonable rate.
501 // It also adds a few glitches. Really reminds me of the old Linux 64-bit version. --arcum42
502 #define ARITHMETICIMM_RECOMPILE
503 #define ARITHMETIC_RECOMPILE
504 #define MULTDIV_RECOMPILE
505 #define JUMP_RECOMPILE
506 #define LOADSTORE_RECOMPILE
507 #define MOVE_RECOMPILE
508 #define MMI_RECOMPILE
509 #define MMI0_RECOMPILE
510 #define MMI1_RECOMPILE
511 #define MMI2_RECOMPILE
512 #define MMI3_RECOMPILE
513 #define FPU_RECOMPILE
514 #define CP0_RECOMPILE
515 #define CP2_RECOMPILE
516
517 // You can't recompile ARITHMETICIMM without ARITHMETIC.
518 #ifndef ARITHMETIC_RECOMPILE
519 #undef ARITHMETICIMM_RECOMPILE
520 #endif
521
522 #define EE_CONST_PROP 1 // rec2 - enables constant propagation (faster)
523
524 // Change to 1 if working on getting PS1 emulation working.
525 // This disables the exception normally caused by trying to load PS1
526 // games. Note: currently PS1 games will error out even without this
527 // commented, so this is for development purposes only.
528 #define ENABLE_LOADING_PS1_GAMES 0

  ViewVC Help
Powered by ViewVC 1.1.22