00001 /// \file GASPilot.h 00002 /// \brief GASPilot game/utility launcher main header 00003 /// \ingroup GASPilot 00004 /// 00005 /// This utility launches games with the various subutilities. 00006 /// 00007 /// Copyright (c) 2007-2008 by Michael Ellison. 00008 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00009 /// 00010 // $Author: mikeellison $ 00011 // $Date: 2008-01-31 03:05:52 -0600 (Thu, 31 Jan 2008) $ 00012 // $Revision: $ 00013 // $NoKeywords: $ 00014 #ifndef _GASPilot_H_ 00015 #define _GASPilot_H_ 00016 00017 #include "CATApp.h" 00018 #include "GASProtoMapper.h" 00019 #include "CATGUI.h" 00020 00021 00022 class GASPilot : public CATApp 00023 { 00024 public: 00025 /// App construct - requires you to specify a runmode in the 00026 /// constructor. 00027 /// 00028 /// \param runMode - current runmode. See CATRunMode 00029 /// 00030 GASPilot(CATINSTANCE appInstance, CATRunMode runMode, const CATString& appName); 00031 virtual ~GASPilot(); 00032 00033 virtual CATResult OnStart(); 00034 virtual CATResult OnEnd(const CATResult& result); 00035 virtual CATResult OnEvent(const CATEvent& event, CATInt32& retVal); 00036 virtual CATResult MainLoop(); 00037 00038 /// OnHelp() is called when the user requests help. 00039 virtual void OnHelp(); 00040 00041 /// OnCommand() is called each time a command is received by the application. 00042 /// 00043 /// Most often, commands will come up from the Skin from controls. Each time 00044 /// a button is clicked or a knob turned, for example. 00045 /// 00046 /// The commands are a class, primarily containing a command string that the 00047 /// application should check to see if it supports. If so, the command should 00048 /// be performed. 00049 /// 00050 /// \param command - the command to execute 00051 /// \param ctrl - the control that sent the command, or 0 00052 /// \param wnd - the window of the control, or 0 00053 /// \param skin - the skin the command came from, or 0 00054 virtual void OnCommand( CATCommand& command, 00055 CATControl* ctrl, 00056 CATWindow* wnd, 00057 CATSkin* skin); 00058 00059 CATResult StartGame(const CATWChar* executable); 00060 00061 protected: 00062 /// Yeah, Steam gets it's own thread. Otherwise doesn't currently connect to 00063 /// the server if I inject into it. 00064 HANDLE fSteamThread; 00065 void SteamWatch(); 00066 static unsigned int __stdcall SteamWatcher(void *param); 00067 00068 bool OnInjectWindow(HWND hwnd); 00069 static BOOL CALLBACK FillInjectWindow( HWND hwnd, 00070 LPARAM lParam); 00071 00072 00073 void UpdateMappingMenu(); ///< Update the mapping menu 00074 CATResult SetActiveMapping (const CATString& mappingName); 00075 00076 void UpdateControllerMenu(); 00077 00078 protected: 00079 GASProtoMapper* fMapper; 00080 CATMenu* fMappingMenu; ///< Menu from skin for selecting mapping 00081 CATMenu* fControllerMenu; 00082 CATWindow* fWindow; 00083 CATWindow* fInjectWindow; 00084 CATWindow* fCfgWindow; 00085 CATUInt32 fCurBtn; 00086 }; 00087 00088 #endif // _GASPilot_H_