/[pcsx2_0.9.7]/trunk/pcsx2/gui/Panels/VideoPanel.cpp
ViewVC logotype

Contents of /trunk/pcsx2/gui/Panels/VideoPanel.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 2 months ago) by william
File size: 11559 byte(s)
re-commit (had local access denied errors when committing)
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 #include "App.h"
18 #include "Dialogs/ConfigurationDialog.h"
19 #include "ConfigurationPanels.h"
20
21 #include <wx/spinctrl.h>
22
23 using namespace pxSizerFlags;
24
25 // --------------------------------------------------------------------------------------
26 // FramelimiterPanel Implementations
27 // --------------------------------------------------------------------------------------
28
29 Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent )
30 : BaseApplicableConfigPanel( parent )
31 {
32 SetMinWidth( 280 );
33
34 m_check_LimiterDisable = new pxCheckBox( this, _("Disable Framelimiting"),
35 _("Useful for running benchmarks. Toggle this option in-game by pressing F4.") );
36
37 m_check_LimiterDisable->SetToolTip( pxEt( "!ContextTip:Framelimiter:Disable",
38 L"Note that when Framelimiting is disabled, Turbo and SlowMotion modes will not "
39 L"be available either."
40 ) );
41
42 pxFitToDigits( m_spin_NominalPct = new wxSpinCtrl( this ), 6 );
43 pxFitToDigits( m_spin_SlomoPct = new wxSpinCtrl( this ), 6 );
44 pxFitToDigits( m_spin_TurboPct = new wxSpinCtrl( this ), 6 );
45
46 m_text_BaseNtsc = CreateNumericalTextCtrl( this, 7 );
47 m_text_BasePal = CreateNumericalTextCtrl( this, 7 );
48
49 m_spin_NominalPct ->SetRange( 10, 1000 );
50 m_spin_SlomoPct ->SetRange( 1, 1000 );
51 m_spin_TurboPct ->SetRange( 10, 1000 );
52
53 // ------------------------------------------------------------
54 // Sizers and Layouts
55
56 *this += m_check_LimiterDisable;
57
58 wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 5 ) );
59 s_spins.AddGrowableCol( 0 );
60
61 s_spins += Label(_("Base Framerate Adjust:")) | StdExpand();
62 s_spins += 5;
63 s_spins += m_spin_NominalPct | pxBorder(wxTOP, 3);
64 s_spins += Label(L"%") | StdExpand();
65 s_spins += 5;
66
67 s_spins += Label(_("Slow Motion Adjust:")) | StdExpand();
68 s_spins += 5;
69 s_spins += m_spin_SlomoPct | pxBorder(wxTOP, 3);
70 s_spins += Label(L"%") | StdExpand();
71 s_spins += 5;
72
73 s_spins += Label(_("Turbo Adjust:")) | StdExpand();
74 s_spins += 5;
75 s_spins += m_spin_TurboPct | pxBorder(wxTOP, 3);
76 s_spins += Label(L"%" ) | StdExpand();
77 s_spins += 5;
78
79 s_spins += 15;
80 s_spins += 15;
81 s_spins += 15;
82 s_spins += 15;
83 s_spins += 15;
84
85 wxFlexGridSizer& s_fps( *new wxFlexGridSizer( 5 ) );
86 s_fps.AddGrowableCol( 0 );
87
88 s_fps += Label(_("NTSC Framerate:")) | StdExpand();
89 s_fps += 5;
90 s_fps += m_text_BaseNtsc | pxBorder(wxTOP, 2).Right();
91 s_fps += Label(_("FPS")) | StdExpand();
92 s_fps += 5;
93
94 s_fps += Label(_("PAL Framerate:")) | StdExpand();
95 s_fps += 5;
96 s_fps += m_text_BasePal | pxBorder(wxTOP, 2).Right();
97 s_fps += Label(_("FPS")) | StdExpand();
98 s_fps += 5;
99
100 *this += s_spins | pxExpand;
101 *this += s_fps | pxExpand;
102
103 *this += 5;
104
105 //*this += Heading( pxE( "!Panel:Framelimiter:Heading",
106 *this += new pxStaticText( this, pxE( "!Panel:Framelimiter:Heading",
107 L"The internal framelimiter regulates the speed of the virtual machine. Adjustment values below are in "
108 L"percentages of the default region-based framerate, which can also be configured below." )
109 );
110
111 AppStatusEvent_OnSettingsApplied();
112 }
113
114 void Panels::FramelimiterPanel::AppStatusEvent_OnSettingsApplied()
115 {
116 const AppConfig::GSWindowOptions& appwin( g_Conf->GSWindow );
117 const AppConfig::FramerateOptions& appfps( g_Conf->Framerate );
118 const Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS );
119
120 m_check_LimiterDisable->SetValue( !gsconf.FrameLimitEnable );
121
122 m_spin_NominalPct ->SetValue( appfps.NominalScalar.Raw );
123 m_spin_TurboPct ->SetValue( appfps.TurboScalar.Raw );
124 m_spin_SlomoPct ->SetValue( appfps.SlomoScalar.Raw );
125
126 m_text_BaseNtsc ->SetValue( gsconf.FramerateNTSC.ToString() );
127 m_text_BasePal ->SetValue( gsconf.FrameratePAL.ToString() );
128 }
129
130 void Panels::FramelimiterPanel::Apply()
131 {
132 AppConfig::FramerateOptions& appfps( g_Conf->Framerate );
133 Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS );
134
135 gsconf.FrameLimitEnable = !m_check_LimiterDisable->GetValue();
136
137 appfps.NominalScalar.Raw = m_spin_NominalPct ->GetValue();
138 appfps.TurboScalar.Raw = m_spin_TurboPct ->GetValue();
139 appfps.SlomoScalar.Raw = m_spin_SlomoPct ->GetValue();
140
141 try {
142 gsconf.FramerateNTSC = Fixed100::FromString( m_text_BaseNtsc->GetValue() );
143 gsconf.FrameratePAL = Fixed100::FromString( m_text_BasePal->GetValue() );
144 }
145 catch( Exception::ParseError& )
146 {
147 throw Exception::CannotApplySettings( this )
148 .SetDiagMsg(wxsFormat(
149 L"Error while parsing either NTSC or PAL framerate settings.\n\tNTSC Input = %s\n\tPAL Input = %s",
150 m_text_BaseNtsc->GetValue().c_str(), m_text_BasePal->GetValue().c_str()
151 ) )
152 .SetUserMsg(_("Error while parsing either NTSC or PAL framerate settings. Settings must be valid floating point numerics."));
153 }
154
155 appfps.SanityCheck();
156 }
157
158 // --------------------------------------------------------------------------------------
159 // FrameSkipPanel Implementations
160 // --------------------------------------------------------------------------------------
161
162 Panels::FrameSkipPanel::FrameSkipPanel( wxWindow* parent )
163 : BaseApplicableConfigPanel( parent )
164 {
165 SetMinWidth( 280 );
166 /*m_check_EnableSkipOnTurbo = new pxCheckBox( this, _("Use Frameskip for Turbo") );
167
168 m_check_EnableSkip = new pxCheckBox( this, _("Use Frameskip"),
169 _(".") );
170
171 m_check_EnableSkip->SetToolTip( pxEt( "!ContextTip:Frameskip:Disable",
172 L""
173 L""
174 ) );
175
176 m_check_EnableSkipOnTurbo->SetToolTip( pxEt( "!ContextTip:Frameskip:UseForTurbo",
177 L"Recommended option! Since frameskipping glitches typically aren't as annoying when you're "
178 L" just trying to speed through stuff."
179 ) );*/
180
181 const RadioPanelItem FrameskipOptions[] =
182 {
183 RadioPanelItem(
184 _("Disabled [default]")
185 ),
186
187 RadioPanelItem(
188 _("Skip when on Turbo only")
189 ),
190
191 RadioPanelItem(
192 _("Constant skipping"),
193 wxEmptyString,
194 _("Normal and Turbo limit rates skip frames. Slow motion mode will still disable frameskipping.")
195 ),
196 };
197
198 m_radio_SkipMode = new pxRadioPanel( this, FrameskipOptions );
199 m_radio_SkipMode->Realize();
200
201 pxFitToDigits( m_spin_FramesToDraw = new wxSpinCtrl( this ), 6 );
202 pxFitToDigits( m_spin_FramesToSkip = new wxSpinCtrl( this ), 6 );
203
204 // Set tooltips for spinners.
205
206
207 // ------------------------------------------------------------
208 // Sizers and Layouts
209
210 //*this += m_check_EnableSkipOnTurbo;
211 //*this += m_check_EnableSkip;
212
213 *this += m_radio_SkipMode;
214
215 wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 4 ) );
216 //s_spins.AddGrowableCol( 0 );
217
218 s_spins += m_spin_FramesToDraw | pxBorder(wxTOP, 2);
219 s_spins += 10;
220 s_spins += Label(_("Frames to Draw")) | StdExpand();
221 s_spins += 10;
222
223 s_spins += m_spin_FramesToSkip | pxBorder(wxTOP, 2);
224 s_spins += 10;
225 s_spins += Label(_("Frames to Skip")) | StdExpand();
226 s_spins += 10;
227
228 *this += s_spins | StdExpand();
229
230 *this += Text( pxE( "!Panel:Frameskip:Heading",
231 L"Notice: Due to PS2 hardware design, precise frame skipping is impossible. "
232 L"Enabling it will cause severe graphical errors in some games." )
233 ) | StdExpand();
234
235 AppStatusEvent_OnSettingsApplied();
236 }
237
238 void Panels::FrameSkipPanel::AppStatusEvent_OnSettingsApplied()
239 {
240 const AppConfig::FramerateOptions& appfps( g_Conf->Framerate );
241 const Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS );
242
243 //m_check_EnableSkip ->SetValue( !appfps.SkipOnLimit );
244 //m_check_EnableSkipOnTurbo ->SetValue( !appfps.SkipOnTurbo );
245
246 m_radio_SkipMode ->SetSelection( appfps.SkipOnLimit ? 2 : (appfps.SkipOnTurbo ? 1 : 0) );
247
248 m_spin_FramesToDraw ->SetValue( gsconf.FramesToDraw );
249 m_spin_FramesToSkip ->SetValue( gsconf.FramesToSkip );
250 }
251
252 void Panels::FrameSkipPanel::Apply()
253 {
254 AppConfig::FramerateOptions& appfps( g_Conf->Framerate );
255 Pcsx2Config::GSOptions& gsconf( g_Conf->EmuOptions.GS );
256
257 gsconf.FramesToDraw = m_spin_FramesToDraw->GetValue();
258 gsconf.FramesToSkip = m_spin_FramesToSkip->GetValue();
259
260 switch( m_radio_SkipMode->GetSelection() )
261 {
262 case 0:
263 appfps.SkipOnLimit = false;
264 appfps.SkipOnTurbo = false;
265 break;
266
267 case 1:
268 appfps.SkipOnLimit = false;
269 appfps.SkipOnTurbo = true;
270 break;
271
272 case 2:
273 appfps.SkipOnLimit = true;
274 appfps.SkipOnTurbo = true;
275 break;
276 }
277
278 appfps.SanityCheck();
279 }
280
281 // --------------------------------------------------------------------------------------
282 // VideoPanel Implementation
283 // --------------------------------------------------------------------------------------
284
285 Panels::VideoPanel::VideoPanel( wxWindow* parent ) :
286 BaseApplicableConfigPanel( parent )
287 {
288 wxPanelWithHelpers* left = new wxPanelWithHelpers( this, wxVERTICAL );
289 wxPanelWithHelpers* right = new wxPanelWithHelpers( this, wxVERTICAL );
290
291 m_check_SynchronousGS = new pxCheckBox( right, _("Use Synchronized MTGS"),
292 _("For troubleshooting potential bugs in the MTGS only, as it is potentially very slow.")
293 );
294
295 m_check_DisableOutput = new pxCheckBox( right, _("Disable all GS output"),
296 _("Completely disables all GS plugin activity; ideal for benchmarking EEcore components.")
297 );
298
299 m_check_SynchronousGS->SetToolTip( pxEt( "!ContextTip:GS:SyncMTGS",
300 L"Enable this if you think MTGS thread sync is causing crashes or graphical errors.")
301 ) ;
302
303 m_check_DisableOutput->SetToolTip( pxEt( "!ContextTip:GS:DisableOutput",
304 L"Removes any benchmark noise caused by the MTGS thread or GPU overhead. This option is best used in conjunction with savestates: "
305 L"save a state at an ideal scene, enable this option, and re-load the savestate.\n\n"
306 L"Warning: This option can be enabled on-the-fly but typically cannot be disabled on-the-fly (video will typically be garbage)."
307 ) );
308
309 //GSWindowSettingsPanel* winpan = new GSWindowSettingsPanel( left );
310 //winpan->AddFrame(_("Display/Window"));
311
312 FrameSkipPanel* span = new FrameSkipPanel( right );
313 span->AddFrame(_("Frame Skipping"));
314
315 FramelimiterPanel* fpan = new FramelimiterPanel( left );
316 fpan->AddFrame(_("Framelimiter"));
317
318 wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 );
319 s_table->AddGrowableCol( 0, 1 );
320 s_table->AddGrowableCol( 1, 1 );
321
322 *right += span | pxExpand;
323 *right += 5;
324 *right += m_check_SynchronousGS;
325 *right += m_check_DisableOutput;
326
327 *left += fpan | pxExpand;
328 *left += 5;
329
330 *s_table += left | StdExpand();
331 *s_table += right | StdExpand();
332
333 *this += s_table | pxExpand;
334
335 AppStatusEvent_OnSettingsApplied();
336 }
337
338 void Panels::VideoPanel::OnOpenWindowSettings( wxCommandEvent& evt )
339 {
340 AppOpenDialog<Dialogs::ComponentsConfigDialog>( this );
341
342 // don't evt.skip, this prevents the Apply button from being activated. :)
343 }
344
345 void Panels::VideoPanel::Apply()
346 {
347 g_Conf->EmuOptions.GS.SynchronousMTGS = m_check_SynchronousGS->GetValue();
348 g_Conf->EmuOptions.GS.DisableOutput = m_check_DisableOutput->GetValue();
349 }
350
351 void Panels::VideoPanel::AppStatusEvent_OnSettingsApplied()
352 {
353 m_check_SynchronousGS->SetValue( g_Conf->EmuOptions.GS.SynchronousMTGS );
354 m_check_DisableOutput->SetValue( g_Conf->EmuOptions.GS.DisableOutput );
355 }

  ViewVC Help
Powered by ViewVC 1.1.22