/[pcsx2_0.9.7]/trunk/pcsx2/gui/App.h
ViewVC logotype

Contents of /trunk/pcsx2/gui/App.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 1 month ago) by william
File MIME type: text/plain
File size: 22622 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 #pragma once
17
18 #include "Utilities/wxAppWithHelpers.h"
19
20 #include <wx/fileconf.h>
21 #include <wx/apptrait.h>
22
23 #include "pxEventThread.h"
24
25 #include "AppCommon.h"
26 #include "AppCoreThread.h"
27 #include "RecentIsoList.h"
28
29 #include "System.h"
30 #include "System/SysThreads.h"
31
32 typedef void FnType_OnThreadComplete(const wxCommandEvent& evt);
33 typedef void (Pcsx2App::*FnPtr_Pcsx2App)();
34
35 BEGIN_DECLARE_EVENT_TYPES()
36 DECLARE_EVENT_TYPE( pxEvt_LoadPluginsComplete, -1 )
37 DECLARE_EVENT_TYPE( pxEvt_LogicalVsync, -1 )
38 DECLARE_EVENT_TYPE( pxEvt_ThreadTaskTimeout_SysExec, -1 )
39 END_DECLARE_EVENT_TYPES()
40
41 // This is used when the GS plugin is handling its own window. Messages from the PAD
42 // are piped through to an app-level message handler, which dispatches them through
43 // the universal Accelerator table.
44 static const int pxID_PadHandler_Keydown = 8030;
45
46 // Plugin ID sections are spaced out evenly at intervals to make it easy to use a
47 // single for-loop to create them.
48 static const int PluginMenuId_Interval = 0x10;
49
50 // ID and return code used for modal popups that have a custom button.
51 static const wxWindowID pxID_CUSTOM = wxID_LOWEST - 1;
52
53 // Return code used by first time wizard if the dialog needs to be automatically recreated
54 // (assigned an arbitrary value)
55 static const wxWindowID pxID_RestartWizard = wxID_LOWEST - 100;
56
57
58 // Forces the Interface to destroy the GS viewport window when the GS plugin is
59 // destroyed. This has the side effect of forcing all plugins to close and re-open
60 // along with the GS, since the GS viewport window handle will have changed.
61 static const bool CloseViewportWithPlugins = false;
62
63 // ------------------------------------------------------------------------
64 // All Menu Options for the Main Window! :D
65 // ------------------------------------------------------------------------
66
67 enum MenuIdentifiers
68 {
69 // Main Menu Section
70 MenuId_Boot = 1,
71 MenuId_Emulation,
72 MenuId_Config, // General config, plus non audio/video plugins.
73 MenuId_Video, // Video options filled in by GS plugin
74 MenuId_Audio, // audio options filled in by SPU2 plugin
75 MenuId_Misc, // Misc options and help!
76
77 MenuId_Exit = wxID_EXIT,
78 MenuId_About = wxID_ABOUT,
79
80 MenuId_EndTopLevel = 20,
81
82 // Run SubSection
83 MenuId_Cdvd_Source,
84 MenuId_Src_Iso,
85 MenuId_Src_Plugin,
86 MenuId_Src_NoDisc,
87 MenuId_Boot_Iso, // Opens submenu with Iso browser, and recent isos.
88 MenuId_IsoSelector, // Contains a submenu of selectable "favorite" isos
89 MenuId_IsoBrowse, // Open dialog, runs selected iso.
90 MenuId_Boot_CDVD,
91 MenuId_Boot_CDVD2,
92 MenuId_Boot_ELF,
93 MenuId_Boot_Recent, // Menu populated with recent source bootings
94
95
96 MenuId_Sys_SuspendResume, // suspends/resumes active emulation, retains plugin states
97 MenuId_Sys_Restart, // Issues a complete VM reset (wipes preserved states)
98 MenuId_Sys_Shutdown, // Closes virtual machine, shuts down plugins, wipes states.
99 MenuId_Sys_LoadStates, // Opens load states submenu
100 MenuId_Sys_SaveStates, // Opens save states submenu
101 MenuId_EnablePatches,
102 MenuId_EnableCheats,
103 MenuId_EnableHostFs,
104
105 MenuId_State_Load,
106 MenuId_State_LoadOther,
107 MenuId_State_Load01, // first of many load slots
108 MenuId_State_Save = MenuId_State_Load01+20,
109 MenuId_State_SaveOther,
110 MenuId_State_Save01, // first of many save slots
111
112 MenuId_State_EndSlotSection = MenuId_State_Save01+20,
113
114 // Config Subsection
115 MenuId_Config_SysSettings,
116 MenuId_Config_McdSettings,
117 MenuId_Config_AppSettings,
118 MenuId_Config_GameDatabase,
119 MenuId_Config_BIOS,
120 MenuId_Config_Language,
121
122 // Plugin ID order is important. Must match the order in tbl_PluginInfo.
123 MenuId_Config_GS,
124 MenuId_Config_PAD,
125 MenuId_Config_SPU2,
126 MenuId_Config_CDVD,
127 MenuId_Config_USB,
128 MenuId_Config_FireWire,
129 MenuId_Config_DEV9,
130 MenuId_Config_Patches,
131
132 MenuId_Config_Multitap0Toggle,
133 MenuId_Config_Multitap1Toggle,
134
135 // Plugin Sections
136 // ---------------
137 // Each plugin menu begins with its name, which is a grayed out option that's
138 // intended for display purposes only. Plugin ID sections are spaced out evenly
139 // at intervals to make it easy to use a single for-loop to create them.
140
141 MenuId_PluginBase_Name = 0x100,
142 MenuId_PluginBase_Settings = 0x101,
143
144 MenuId_Video_CoreSettings = 0x200,// includes frame timings and skippings settings
145 MenuId_Video_WindowSettings,
146
147 // Miscellaneous Menu! (Misc)
148 MenuId_Website, // Visit our awesome website!
149 MenuId_Profiler, // Enable profiler
150 MenuId_Console, // Enable console
151 MenuId_Console_Stdio, // Enable Stdio
152 MenuId_CDVD_Info,
153
154 // Debug Subsection
155 MenuId_Debug_Open, // opens the debugger window / starts a debug session
156 MenuId_Debug_MemoryDump,
157 MenuId_Debug_Logging, // dialog for selection additional log options
158 MenuId_Config_ResetAll,
159 };
160
161 namespace Exception
162 {
163 // --------------------------------------------------------------------------
164 // Exception used to perform an "errorless" termination of the app during OnInit
165 // procedures. This happens when a user cancels out of startup prompts/wizards.
166 //
167 class StartupAborted : public CancelEvent
168 {
169 DEFINE_RUNTIME_EXCEPTION( StartupAborted, CancelEvent, L"Startup initialization was aborted by the user." )
170
171 public:
172 StartupAborted( const wxString& reason )
173 {
174 m_message_diag = L"Startup aborted: " + reason;
175 }
176 };
177
178 }
179
180 // --------------------------------------------------------------------------------------
181 // AppImageIds - Config and Toolbar Images and Icons
182 // --------------------------------------------------------------------------------------
183 struct AppImageIds
184 {
185 struct ConfigIds
186 {
187 int Paths,
188 Plugins,
189 Speedhacks,
190 Gamefixes,
191 MemoryCard,
192 Video,
193 Cpu,
194 Appearance;
195
196 ConfigIds()
197 {
198 Paths = Plugins =
199 Speedhacks = Gamefixes =
200 Video = Cpu =
201 MemoryCard = Appearance = -1;
202 }
203 } Config;
204
205 struct ToolbarIds
206 {
207 int Settings,
208 Play,
209 Resume,
210 PluginVideo,
211 PluginAudio,
212 PluginPad;
213
214 ToolbarIds()
215 {
216 Settings = Play =
217 PluginVideo =
218 PluginAudio =
219 PluginPad = -1;
220 }
221 } Toolbars;
222 };
223
224 // -------------------------------------------------------------------------------------------
225 // pxAppResources
226 // -------------------------------------------------------------------------------------------
227 // Container class for resources that should (or must) be unloaded prior to the ~wxApp() destructor.
228 // (typically this object is deleted at OnExit() or just prior to OnExit()).
229 //
230 class pxAppResources
231 {
232 public:
233 AppImageIds ImageId;
234
235 ScopedPtr<wxImageList> ConfigImages;
236 ScopedPtr<wxImageList> ToolbarImages;
237 ScopedPtr<wxIconBundle> IconBundle;
238 ScopedPtr<wxBitmap> Bitmap_Logo;
239 ScopedPtr<AppGameDatabase> GameDB;
240
241 pxAppResources();
242 virtual ~pxAppResources() throw();
243 };
244
245 // --------------------------------------------------------------------------------------
246 // FramerateManager
247 // --------------------------------------------------------------------------------------
248 class FramerateManager
249 {
250 public:
251 static const uint FramerateQueueDepth = 64;
252
253 protected:
254 u64 m_fpsqueue[FramerateQueueDepth];
255 int m_fpsqueue_writepos;
256 uint m_initpause;
257
258 uint m_FrameCounter;
259
260 public:
261 FramerateManager() { Reset(); }
262 virtual ~FramerateManager() throw() {}
263
264 void Reset();
265 void Resume();
266 void DoFrame();
267 double GetFramerate() const;
268 };
269
270 class StartupOptions
271 {
272 public:
273 bool ForceWizard;
274 bool ForceConsole;
275
276 // Disables the fast boot option when auto-running games. This option only applies
277 // if SysAutoRun is also true.
278 bool NoFastBoot;
279
280 // Specifies the Iso file to boot; used only if SysAutoRun is enabled and CdvdSource
281 // is set to ISO.
282 wxString IsoFile;
283
284 // Specifies the CDVD source type to use when AutoRunning
285 CDVD_SourceType CdvdSource;
286
287 // Indicates if PCSX2 should autorun the configured CDVD source and/or ISO file.
288 bool SysAutoRun;
289
290 StartupOptions()
291 {
292 ForceWizard = false;
293 NoFastBoot = false;
294 ForceConsole = false;
295 SysAutoRun = false;
296 CdvdSource = CDVDsrc_NoDisc;
297 }
298 };
299
300 enum GsWindowMode_t
301 {
302 GsWinMode_Unspecified = 0,
303 GsWinMode_Windowed,
304 GsWinMode_Fullscreen,
305 };
306
307 class CommandlineOverrides
308 {
309 public:
310 AppConfig::FilenameOptions Filenames;
311 wxDirName SettingsFolder;
312 wxFileName SettingsFile;
313
314 bool DisableSpeedhacks;
315
316 // Note that gamefixes in this array should only be honored if the
317 // "HasCustomGamefixes" boolean is also enabled.
318 Pcsx2Config::GamefixOptions Gamefixes;
319 bool ApplyCustomGamefixes;
320
321 GsWindowMode_t GsWindowMode;
322
323 public:
324 CommandlineOverrides()
325 {
326 DisableSpeedhacks = false;
327 ApplyCustomGamefixes = false;
328 GsWindowMode = GsWinMode_Unspecified;
329 }
330
331 // Returns TRUE if either speedhacks or gamefixes are being overridden.
332 bool HasCustomHacks() const
333 {
334 return DisableSpeedhacks || ApplyCustomGamefixes;
335 }
336
337 void RemoveCustomHacks()
338 {
339 DisableSpeedhacks = false;
340 ApplyCustomGamefixes = false;
341 }
342
343 bool HasSettingsOverride() const
344 {
345 return SettingsFolder.IsOk() || SettingsFile.IsOk();
346 }
347
348 bool HasPluginsOverride() const
349 {
350 for( int i=0; i<PluginId_Count; ++i )
351 if( Filenames.Plugins[i].IsOk() ) return true;
352
353 return false;
354 }
355 };
356
357 // --------------------------------------------------------------------------------------
358 // Pcsx2AppTraits
359 // --------------------------------------------------------------------------------------
360 // Overrides and customizes some default wxWidgets behaviors. This class is instanized by
361 // calls to Pcsx2App::CreateTraits(), which is called from wxWidgets as-needed. wxWidgets
362 // does cache an instance of the traits, so the object construction need not be trivial
363 // (translation: it can be complicated-ish -- it won't affect performance).
364 //
365 class Pcsx2AppTraits : public wxGUIAppTraits
366 {
367 typedef wxGUIAppTraits _parent;
368
369 public:
370 virtual ~Pcsx2AppTraits() {}
371 wxMessageOutput* CreateMessageOutput();
372
373 #ifdef wxUSE_STDPATHS
374 wxStandardPathsBase& GetStandardPaths();
375 #endif
376 };
377
378 // =====================================================================================================
379 // Pcsx2App - main wxApp class
380 // =====================================================================================================
381 class Pcsx2App : public wxAppWithHelpers
382 {
383 typedef wxAppWithHelpers _parent;
384
385 // ----------------------------------------------------------------------------
386 // Event Sources!
387 // These need to be at the top of the App class, because a lot of other things depend
388 // on them and they are, themselves, fairly self-contained.
389
390 protected:
391 EventSource<IEventListener_Plugins> m_evtsrc_CorePluginStatus;
392 EventSource<IEventListener_CoreThread> m_evtsrc_CoreThreadStatus;
393 EventSource<IEventListener_AppStatus> m_evtsrc_AppStatus;
394
395 public:
396 void AddListener( IEventListener_Plugins& listener )
397 {
398 m_evtsrc_CorePluginStatus.Add( listener );
399 }
400
401 void AddListener( IEventListener_CoreThread& listener )
402 {
403 m_evtsrc_CoreThreadStatus.Add( listener );
404 }
405
406 void AddListener( IEventListener_AppStatus& listener )
407 {
408 m_evtsrc_AppStatus.Add( listener );
409 }
410
411 void RemoveListener( IEventListener_Plugins& listener )
412 {
413 m_evtsrc_CorePluginStatus.Remove( listener );
414 }
415
416 void RemoveListener( IEventListener_CoreThread& listener )
417 {
418 m_evtsrc_CoreThreadStatus.Remove( listener );
419 }
420
421 void RemoveListener( IEventListener_AppStatus& listener )
422 {
423 m_evtsrc_AppStatus.Remove( listener );
424 }
425
426 void AddListener( IEventListener_Plugins* listener )
427 {
428 m_evtsrc_CorePluginStatus.Add( listener );
429 }
430
431 void AddListener( IEventListener_CoreThread* listener )
432 {
433 m_evtsrc_CoreThreadStatus.Add( listener );
434 }
435
436 void AddListener( IEventListener_AppStatus* listener )
437 {
438 m_evtsrc_AppStatus.Add( listener );
439 }
440
441 void RemoveListener( IEventListener_Plugins* listener )
442 {
443 m_evtsrc_CorePluginStatus.Remove( listener );
444 }
445
446 void RemoveListener( IEventListener_CoreThread* listener )
447 {
448 m_evtsrc_CoreThreadStatus.Remove( listener );
449 }
450
451 void RemoveListener( IEventListener_AppStatus* listener )
452 {
453 m_evtsrc_AppStatus.Remove( listener );
454 }
455
456 void DispatchEvent( PluginEventType evt );
457 void DispatchEvent( AppEventType evt );
458 void DispatchEvent( CoreThreadStatus evt );
459 void DispatchEvent( IniInterface& ini );
460
461 // ----------------------------------------------------------------------------
462 protected:
463 int m_PendingSaves;
464 bool m_ScheduledTermination;
465 bool m_UseGUI;
466
467 Threading::Mutex m_mtx_Resources;
468 Threading::Mutex m_mtx_LoadingGameDB;
469
470 public:
471 FramerateManager FpsManager;
472 ScopedPtr<CommandDictionary> GlobalCommands;
473 ScopedPtr<AcceleratorDictionary> GlobalAccels;
474
475 StartupOptions Startup;
476 CommandlineOverrides Overrides;
477
478 ScopedPtr<wxTimer> m_timer_Termination;
479
480 protected:
481 ScopedPtr<PipeRedirectionBase> m_StdoutRedirHandle;
482 ScopedPtr<PipeRedirectionBase> m_StderrRedirHandle;
483
484 ScopedPtr<RecentIsoList> m_RecentIsoList;
485 ScopedPtr<pxAppResources> m_Resources;
486
487 public:
488 // Executor Thread for complex VM/System tasks. This thread is used to execute such tasks
489 // in parallel to the main message pump, to allow the main pump to run without fear of
490 // blocked threads stalling the GUI.
491 ExecutorThread SysExecutorThread;
492 ScopedPtr<SysCpuProviderPack> m_CpuProviders;
493 ScopedPtr<SysMainMemory> m_VmReserve;
494
495 protected:
496 wxWindowID m_id_MainFrame;
497 wxWindowID m_id_GsFrame;
498 wxWindowID m_id_ProgramLogBox;
499
500 wxKeyEvent m_kevt;
501
502 public:
503 Pcsx2App();
504 virtual ~Pcsx2App();
505
506 void PostMenuAction( MenuIdentifiers menu_id ) const;
507 void PostAppMethod( FnPtr_Pcsx2App method );
508 void PostIdleAppMethod( FnPtr_Pcsx2App method );
509
510 void SysApplySettings();
511 void SysExecute();
512 void SysExecute( CDVD_SourceType cdvdsrc, const wxString& elf_override=wxEmptyString );
513 void LogicalVsync();
514
515 SysMainMemory& GetVmReserve();
516
517 GSFrame& GetGsFrame() const;
518 MainEmuFrame& GetMainFrame() const;
519
520 GSFrame* GetGsFramePtr() const { return (GSFrame*)wxWindow::FindWindowById( m_id_GsFrame ); }
521 MainEmuFrame* GetMainFramePtr() const { return (MainEmuFrame*)wxWindow::FindWindowById( m_id_MainFrame ); }
522
523 bool HasMainFrame() const { return GetMainFramePtr() != NULL; }
524
525 void OpenGsPanel();
526 void CloseGsPanel();
527 void OnGsFrameClosed( wxWindowID id );
528 void OnMainFrameClosed( wxWindowID id );
529
530 // --------------------------------------------------------------------------
531 // Startup / Shutdown Helpers
532 // --------------------------------------------------------------------------
533
534 void DetectCpuAndUserMode();
535 void OpenProgramLog();
536 void OpenMainFrame();
537 void PrepForExit();
538 void CleanupRestartable();
539 void CleanupResources();
540 void WipeUserModeSettings();
541 void ReadUserModeSettings();
542
543 void StartPendingSave();
544 void ClearPendingSave();
545
546 // --------------------------------------------------------------------------
547 // App-wide Resources
548 // --------------------------------------------------------------------------
549 // All of these accessors cache the resources on first use and retain them in
550 // memory until the program exits.
551
552 wxMenu& GetRecentIsoMenu();
553 RecentIsoManager& GetRecentIsoManager();
554
555 pxAppResources& GetResourceCache();
556 const wxIconBundle& GetIconBundle();
557 const wxBitmap& GetLogoBitmap();
558 wxImageList& GetImgList_Config();
559 wxImageList& GetImgList_Toolbars();
560
561 const AppImageIds& GetImgId() const;
562 AppGameDatabase* GetGameDatabase();
563
564 // --------------------------------------------------------------------------
565 // Overrides of wxApp virtuals:
566 // --------------------------------------------------------------------------
567 wxAppTraits* CreateTraits();
568 bool OnInit();
569 int OnExit();
570 void CleanUp();
571
572 void OnInitCmdLine( wxCmdLineParser& parser );
573 bool OnCmdLineParsed( wxCmdLineParser& parser );
574 bool OnCmdLineError( wxCmdLineParser& parser );
575 bool ParseOverrides( wxCmdLineParser& parser );
576
577 #ifdef __WXDEBUG__
578 void OnAssertFailure( const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg );
579 #endif
580
581 Threading::MutexRecursive m_mtx_ProgramLog;
582 ConsoleLogFrame* m_ptr_ProgramLog;
583
584 // ----------------------------------------------------------------------------
585 // Console / Program Logging Helpers
586 // ----------------------------------------------------------------------------
587 ConsoleLogFrame* GetProgramLog();
588 const ConsoleLogFrame* GetProgramLog() const;
589 void ProgramLog_PostEvent( wxEvent& evt );
590 Threading::Mutex& GetProgramLogLock();
591
592 void EnableAllLogging();
593 void DisableWindowLogging() const;
594 void DisableDiskLogging() const;
595 void OnProgramLogClosed( wxWindowID id );
596
597 protected:
598 bool AppRpc_TryInvoke( FnPtr_Pcsx2App method );
599 bool AppRpc_TryInvokeAsync( FnPtr_Pcsx2App method );
600
601 void AllocateCoreStuffs();
602 void InitDefaultGlobalAccelerators();
603 void BuildCommandHash();
604 bool TryOpenConfigCwd();
605 void CleanupOnExit();
606 void OpenWizardConsole();
607 void PadKeyDispatch( const keyEvent& ev );
608
609 void HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event) const;
610 void HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event);
611
612 void OnScheduledTermination( wxTimerEvent& evt );
613 void OnEmuKeyDown( wxKeyEvent& evt );
614 void OnSysExecutorTaskTimeout( wxTimerEvent& evt );
615 void OnDestroyWindow( wxWindowDestroyEvent& evt );
616
617 // ----------------------------------------------------------------------------
618 // Override wx default exception handling behavior
619 // ----------------------------------------------------------------------------
620
621 // Just rethrow exceptions in the main loop, so that we can handle them properly in our
622 // custom catch clauses in OnRun(). (ranting note: wtf is the point of this functionality
623 // in wx? Why would anyone ever want a generic catch-all exception handler that *isn't*
624 // the unhandled exception handler? Using this as anything besides a re-throw is terrible
625 // program design and shouldn't even be allowed -- air)
626 bool OnExceptionInMainLoop() { throw; }
627
628 // Just rethrow unhandled exceptions to cause immediate debugger fail.
629 void OnUnhandledException() { throw; }
630 };
631
632
633 DECLARE_APP(Pcsx2App)
634
635 // --------------------------------------------------------------------------------------
636 // s* macros! ['s' stands for 'shortcut']
637 // --------------------------------------------------------------------------------------
638 // Use these for "silent fail" invocation of PCSX2 Application-related constructs. If the
639 // construct (albeit wxApp, MainFrame, CoreThread, etc) is null, the requested method will
640 // not be invoked, and an optional "else" clause can be affixed for handling the end case.
641 //
642 // Usage Examples:
643 // sMainFrame.ApplySettings();
644 // sMainFrame.ApplySettings(); else Console.WriteLn( "Judge Wapner" ); // 'else' clause for handling NULL scenarios.
645 //
646 // Note! These macros are not "syntax complete", which means they could generate unexpected
647 // syntax errors in some situations, and more importantly, they cannot be used for invoking
648 // functions with return values.
649 //
650 // Rationale: There are a lot of situations where we want to invoke a void-style method on
651 // various volatile object pointers (App, Corethread, MainFrame, etc). Typically if these
652 // objects are NULL the most intuitive response is to simply ignore the call request and
653 // continue running silently. These macros make that possible without any extra boilerplate
654 // conditionals or temp variable defines in the code.
655 //
656 #define sApp \
657 if( Pcsx2App* __app_ = (Pcsx2App*)wxApp::GetInstance() ) (*__app_)
658
659 #define sLogFrame \
660 if( ConsoleLogFrame* __conframe_ = wxGetApp().GetProgramLog() ) (*__conframe_)
661
662 #define sMainFrame \
663 if( MainEmuFrame* __frame_ = GetMainFramePtr() ) (*__frame_)
664
665 // Use this within the scope of a wxWindow (wxDialog or wxFrame). If the window has a valid menu
666 // bar, the command will run, otherwise it will be silently ignored. :)
667 #define sMenuBar \
668 if( wxMenuBar* __menubar_ = GetMenuBar() ) (*__menubar_)
669
670 // --------------------------------------------------------------------------------------
671 // AppOpenDialog
672 // --------------------------------------------------------------------------------------
673 // Returns a wxWindow handle to the opened window.
674 //
675 template<typename DialogType>
676 wxWindow* AppOpenDialog( wxWindow* parent=NULL )
677 {
678 wxWindow* window = wxFindWindowByName( L"Dialog:" + DialogType::GetNameStatic() );
679
680 if( !window ) window = new DialogType( parent );
681
682 window->Show();
683 window->SetFocus();
684 return window;
685 }
686
687 extern pxDoAssertFnType AppDoAssert;
688
689 // --------------------------------------------------------------------------------------
690 // External App-related Globals and Shortcuts
691 // --------------------------------------------------------------------------------------
692
693 extern int EnumeratePluginsInFolder( const wxDirName& searchPath, wxArrayString* dest );
694 extern void LoadPluginsPassive();
695 extern void LoadPluginsImmediate();
696 extern void UnloadPlugins();
697 extern void ShutdownPlugins();
698
699 extern bool SysHasValidState();
700 extern void SysUpdateIsoSrcFile( const wxString& newIsoFile );
701 extern void SysStatus( const wxString& text );
702
703 extern bool HasMainFrame();
704 extern MainEmuFrame& GetMainFrame();
705 extern MainEmuFrame* GetMainFramePtr();
706
707 extern __aligned16 AppCoreThread CoreThread;
708 extern __aligned16 SysMtgsThread mtgsThread;
709 extern __aligned16 AppCorePlugins CorePlugins;
710
711 extern void UI_UpdateSysControls();
712
713 extern void UI_DisableStateActions();
714 extern void UI_EnableStateActions();
715
716 extern void UI_DisableSysActions();
717 extern void UI_EnableSysActions();
718
719 extern void UI_DisableSysReset();
720 extern void UI_DisableSysShutdown();
721
722
723 #define AffinityAssert_AllowFrom_SysExecutor() \
724 pxAssertMsg( wxGetApp().SysExecutorThread.IsSelf(), "Thread affinity violation: Call allowed from SysExecutor thread only." )
725
726 #define AffinityAssert_DisallowFrom_SysExecutor() \
727 pxAssertMsg( !wxGetApp().SysExecutorThread.IsSelf(), "Thread affinity violation: Call is *not* allowed from SysExecutor thread." )
728
729 extern ExecutorThread& GetSysExecutorThread();

  ViewVC Help
Powered by ViewVC 1.1.22