/[pcsx2_0.9.7]/trunk/pcsx2/Pcsx2Config.cpp
ViewVC logotype

Contents of /trunk/pcsx2/Pcsx2Config.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (10 years, 4 months ago) by william
File size: 7670 byte(s)
committing r3113 initial commit again...
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 #include "PrecompiledHeader.h"
17
18 #include <wx/fileconf.h>
19
20 #include "IniInterface.h"
21 #include "Config.h"
22 #include "GS.h"
23
24 void TraceLogFilters::LoadSave( IniInterface& ini )
25 {
26 TraceLogFilters defaults;
27 IniScopedGroup path( ini, L"TraceLog" );
28
29 IniEntry( Enabled );
30 IniEntry( SIF );
31
32 // Retaining backwards compat of the trace log enablers isn't really important, and
33 // doing each one by hand would be murder. So let's cheat and just save it as an int:
34
35 IniEntry( EE.bitset );
36 IniEntry( IOP.bitset );
37 }
38
39 // all speedhacks are disabled by default
40 Pcsx2Config::SpeedhackOptions::SpeedhackOptions()
41 {
42 bitset = 0;
43 EECycleRate = 0;
44 VUCycleSteal = 0;
45 }
46
47 ConsoleLogFilters::ConsoleLogFilters()
48 {
49 ELF = false;
50 StdoutEE = true;
51 StdoutIOP = true;
52 Deci2 = true;
53 }
54
55 void ConsoleLogFilters::LoadSave( IniInterface& ini )
56 {
57 ConsoleLogFilters defaults;
58 IniScopedGroup path( ini, L"ConsoleLog" );
59
60 IniBitBool( ELF );
61 IniBitBool( StdoutEE );
62 IniBitBool( StdoutIOP );
63 IniBitBool( Deci2 );
64 }
65
66 void Pcsx2Config::SpeedhackOptions::LoadSave( IniInterface& ini )
67 {
68 SpeedhackOptions defaults;
69 IniScopedGroup path( ini, L"Speedhacks" );
70
71 IniBitfield( EECycleRate );
72 IniBitfield( VUCycleSteal );
73 IniBitBool( IopCycleRate_X2 );
74 IniBitBool( IntcStat );
75 IniBitBool( WaitLoop );
76 IniBitBool( vuFlagHack );
77 IniBitBool( vuMinMax );
78 }
79
80 void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini )
81 {
82 ProfilerOptions defaults;
83 IniScopedGroup path( ini, L"Profiler" );
84
85 IniBitBool( Enabled );
86 IniBitBool( RecBlocks_EE );
87 IniBitBool( RecBlocks_IOP );
88 IniBitBool( RecBlocks_VU0 );
89 IniBitBool( RecBlocks_VU1 );
90 }
91
92 Pcsx2Config::RecompilerOptions::RecompilerOptions()
93 {
94 bitset = 0;
95
96 StackFrameChecks = false;
97
98 // All recs are enabled by default.
99
100 EnableEE = true;
101 EnableIOP = true;
102 EnableVU0 = true;
103 EnableVU1 = true;
104
105 UseMicroVU0 = true;
106 UseMicroVU1 = true;
107
108 // vu and fpu clamping default to standard overflow.
109 vuOverflow = true;
110 //vuExtraOverflow = false;
111 //vuSignOverflow = false;
112 //vuUnderflow = false;
113
114 fpuOverflow = true;
115 //fpuExtraOverflow = false;
116 //fpuFullMode = false;
117 }
118
119 void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
120 {
121 bool fpuIsRight = true;
122
123 if( fpuExtraOverflow )
124 fpuIsRight = fpuOverflow;
125
126 if( fpuFullMode )
127 fpuIsRight = fpuOverflow && fpuExtraOverflow;
128
129 if( !fpuIsRight )
130 {
131 // Values are wonky; assume the defaults.
132 fpuOverflow = RecompilerOptions().fpuOverflow;
133 fpuExtraOverflow= RecompilerOptions().fpuExtraOverflow;
134 fpuFullMode = RecompilerOptions().fpuFullMode;
135 }
136
137 bool vuIsOk = true;
138
139 if( vuExtraOverflow ) vuIsOk = vuIsOk && vuOverflow;
140 if( vuSignOverflow ) vuIsOk = vuIsOk && vuExtraOverflow;
141
142 if( !vuIsOk )
143 {
144 // Values are wonky; assume the defaults.
145 vuOverflow = RecompilerOptions().vuOverflow;
146 vuExtraOverflow = RecompilerOptions().vuExtraOverflow;
147 vuSignOverflow = RecompilerOptions().vuSignOverflow;
148 vuUnderflow = RecompilerOptions().vuUnderflow;
149 }
150 }
151
152 void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini )
153 {
154 RecompilerOptions defaults;
155 IniScopedGroup path( ini, L"Recompiler" );
156
157 IniBitBool( EnableEE );
158 IniBitBool( EnableIOP );
159 IniBitBool( EnableVU0 );
160 IniBitBool( EnableVU1 );
161
162 IniBitBool( UseMicroVU0 );
163 IniBitBool( UseMicroVU1 );
164
165 IniBitBool( vuOverflow );
166 IniBitBool( vuExtraOverflow );
167 IniBitBool( vuSignOverflow );
168 IniBitBool( vuUnderflow );
169
170 IniBitBool( fpuOverflow );
171 IniBitBool( fpuExtraOverflow );
172 IniBitBool( fpuFullMode );
173
174 IniBitBool( StackFrameChecks );
175 }
176
177 Pcsx2Config::CpuOptions::CpuOptions()
178 {
179 sseMXCSR.bitmask = DEFAULT_sseMXCSR;
180 sseVUMXCSR.bitmask = DEFAULT_sseVUMXCSR;
181 }
182
183 void Pcsx2Config::CpuOptions::ApplySanityCheck()
184 {
185 sseMXCSR.ClearExceptionFlags().DisableExceptions();
186 sseVUMXCSR.ClearExceptionFlags().DisableExceptions();
187
188 Recompiler.ApplySanityCheck();
189 }
190
191 void Pcsx2Config::CpuOptions::LoadSave( IniInterface& ini )
192 {
193 CpuOptions defaults;
194 IniScopedGroup path( ini, L"CPU" );
195
196 IniBitBoolEx( sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero" );
197 IniBitBoolEx( sseMXCSR.FlushToZero, "FPU.FlushToZero" );
198 IniBitfieldEx( sseMXCSR.RoundingControl, "FPU.Roundmode" );
199
200 IniBitBoolEx( sseVUMXCSR.DenormalsAreZero, "VU.DenormalsAreZero" );
201 IniBitBoolEx( sseVUMXCSR.FlushToZero, "VU.FlushToZero" );
202 IniBitfieldEx( sseVUMXCSR.RoundingControl, "VU.Roundmode" );
203
204 Recompiler.LoadSave( ini );
205 }
206
207 // Default GSOptions
208 Pcsx2Config::GSOptions::GSOptions()
209 {
210 FrameLimitEnable = true;
211 FrameSkipEnable = false;
212 VsyncEnable = false;
213
214 SynchronousMTGS = false;
215 DisableOutput = false;
216
217 DefaultRegionMode = Region_NTSC;
218 FramesToDraw = 2;
219 FramesToSkip = 2;
220
221 LimitScalar = 1.0;
222 FramerateNTSC = 59.94;
223 FrameratePAL = 50.0;
224 }
225
226 void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
227 {
228 GSOptions defaults;
229 IniScopedGroup path( ini, L"GS" );
230
231 IniEntry( SynchronousMTGS );
232 IniEntry( DisableOutput );
233
234 IniEntry( FrameLimitEnable );
235 IniEntry( FrameSkipEnable );
236 IniEntry( VsyncEnable );
237
238 IniEntry( LimitScalar );
239 IniEntry( FramerateNTSC );
240 IniEntry( FrameratePAL );
241
242 static const wxChar * const ntsc_pal_str[2] = { L"ntsc", L"pal" };
243 ini.EnumEntry( L"DefaultRegionMode", DefaultRegionMode, ntsc_pal_str, defaults.DefaultRegionMode );
244
245 IniEntry( FramesToDraw );
246 IniEntry( FramesToSkip );
247 }
248
249 void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
250 {
251 GamefixOptions defaults;
252 IniScopedGroup path( ini, L"Gamefixes" );
253
254 IniBitBool( VuAddSubHack );
255 IniBitBool( VuClipFlagHack );
256 IniBitBool( FpuCompareHack );
257 IniBitBool( FpuMulHack );
258 IniBitBool( FpuNegDivHack );
259 IniBitBool( XgKickHack );
260 IniBitBool( IPUWaitHack );
261 IniBitBool( EETimingHack );
262 }
263
264 Pcsx2Config::Pcsx2Config()
265 {
266 bitset = 0;
267 McdEnableEjection = true;
268 }
269
270 void Pcsx2Config::LoadSave( IniInterface& ini )
271 {
272 Pcsx2Config defaults;
273 IniScopedGroup path( ini, L"EmuCore" );
274
275 IniBitBool( CdvdVerboseReads );
276 IniBitBool( CdvdDumpBlocks );
277 IniBitBool( EnablePatches );
278 IniBitBool( EnableCheats );
279 IniBitBool( ConsoleToStdio );
280 IniBitBool( HostFs );
281
282 IniBitBool( McdEnableEjection );
283 IniBitBool( MultitapPort0_Enabled );
284 IniBitBool( MultitapPort1_Enabled );
285
286 // Process various sub-components:
287
288 Speedhacks .LoadSave( ini );
289 Cpu .LoadSave( ini );
290 GS .LoadSave( ini );
291 Gamefixes .LoadSave( ini );
292 Profiler .LoadSave( ini );
293
294 Trace .LoadSave( ini );
295 Log .LoadSave( ini );
296
297 ini.Flush();
298 }
299
300 bool Pcsx2Config::MultitapEnabled( uint port ) const
301 {
302 pxAssert( port < 2 );
303 return (port==0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
304 }
305
306 void Pcsx2Config::Load( const wxString& srcfile )
307 {
308 //m_IsLoaded = true;
309
310 // Note: Extra parenthesis resolves "I think this is a function" issues with C++.
311 wxFileConfig cfg( srcfile );
312 IniLoader loader( (IniLoader( cfg )) );
313 LoadSave( loader );
314 }
315
316 void Pcsx2Config::Save( const wxString& dstfile )
317 {
318 //if( !m_IsLoaded ) return;
319
320 wxFileConfig cfg( dstfile );
321 IniSaver saver( (IniSaver( cfg )) );
322 LoadSave( saver );
323 }

  ViewVC Help
Powered by ViewVC 1.1.22