Load the config as part of loading the mouse DLL.

master
Pacman Ghost 7 years ago
parent 2edede86f8
commit 7d114e9f33
  1. 10
      MainApp/MouseDll.cs
  2. 4
      MouseDll/api.cpp
  3. 3
      MouseDll/main.cpp
  4. 2
      MouseDll/main.hpp

@ -10,7 +10,9 @@ namespace MouseInterception
[DllImport( @DLL_NAME , CallingConvention=CallingConvention.Cdecl )]
[return: MarshalAs(UnmanagedType.BStr)]
private static extern string open_api( int initConsole ) ;
private static extern string open_api(
ref AppConfig.Settings pAppSettings , ref DebugConfig.Settings pDebugSettings , int initConsole
) ;
[DllImport( @DLL_NAME , CallingConvention=CallingConvention.Cdecl )]
[return: MarshalAs(UnmanagedType.BStr)]
@ -23,11 +25,11 @@ namespace MouseInterception
public MouseDll( bool initConsole )
{
// open the mouse API
string errorMsg = open_api( initConsole ? 1 : 0 ) ;
AppConfig.Settings appSettings = Program.appConfig.settings ;
DebugConfig.Settings debugSettings = Program.debugConfig.settings ;
string errorMsg = open_api( ref appSettings , ref debugSettings , initConsole?1:0 ) ;
if ( errorMsg != null )
throw new Exception( errorMsg ) ;
// initialize
reloadConfig() ;
}
~MouseDll()

@ -8,12 +8,12 @@ using namespace std ;
// ---------------------------------------------------------------------
extern "C" __declspec(dllexport) BSTR
open_api( int initConsole )
open_api( const AppConfig* pAppConfig , const DebugConfig* pDebugConfig , int initConsole )
{
// open the API
try
{
openApi( initConsole != 0 ) ;
openApi( pAppConfig , pDebugConfig , initConsole != 0 ) ;
return NULL ;
}
catch ( exception& xcptn )

@ -33,7 +33,7 @@ static ofstream gLogFile ;
// ---------------------------------------------------------------------
void
openApi( bool initConsole )
openApi( const AppConfig* pAppConfig , const DebugConfig* pDebugConfig , bool initConsole )
{
// check if we are open
if ( ghInterceptionDll != NULL )
@ -41,6 +41,7 @@ openApi( bool initConsole )
// initialize
gEnableConsole = initConsole ;
reloadConfig( pAppConfig , pDebugConfig ) ;
// load Interception
wchar_t buf[ _MAX_PATH+1 ] ;

@ -16,7 +16,7 @@ struct DebugConfig
// ---------------------------------------------------------------------
extern void openApi( bool initConsole ) ;
extern void openApi( const AppConfig* pAppConfig , const DebugConfig* pDebugConfig , bool initConsole ) ;
extern void closeApi() ;
extern void reloadConfig( const AppConfig* pAppConfig , const DebugConfig* pDebugConfig ) ;

Loading…
Cancel
Save