Skip to content

Commit

Permalink
version 0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PandaTeemo committed Nov 14, 2016
1 parent 6f560ce commit f0180aa
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build/Installer32/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="YoloMouse" Language="1033" Version="0.8.0.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">
<Product Id="*" Name="YoloMouse" Language="1033" Version="0.8.1.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">

<Package Id="*" InstallerVersion="200" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.SolutionDir)\..\etc\Eula.rtf" />
Expand Down
2 changes: 1 addition & 1 deletion build/Installer64/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="YoloMouse" Language="1033" Version="0.8.0.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">
<Product Id="*" Name="YoloMouse" Language="1033" Version="0.8.1.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">

<Package Id="*" InstallerVersion="200" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" Platform="x64"/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.SolutionDir)\..\etc\Eula.rtf" />
Expand Down
2 changes: 1 addition & 1 deletion source/Core/Root.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define MAKEHUGE(low, high) ((unsigned long long)(low) | ((unsigned long long)(high) << 32))

// defines
#define LOG_PATH "d:\\debug.log"//!!!
#define LOG_PATH "debug.log"
#define INVALID_ID (~0)
#define INVALID_INDEX (~0)

Expand Down
15 changes: 11 additions & 4 deletions source/Core/Windows/ShellUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,18 @@ namespace Core

void ShellUi::Stop()
{
// destroy window
DestroyWindow(_hwnd);
// if window created
if( _hwnd != NULL )
{
// destroy window
DestroyWindow(_hwnd);

// unregister class
UnregisterClass(_name, _hinstance);

// unregister class
UnregisterClass(_name, _hinstance);
// clear state
_hwnd = NULL;
}
}

//--------------------------------------------------------------------------
Expand Down
15 changes: 13 additions & 2 deletions source/Core/Windows/SystemMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,23 @@ namespace Core
//-------------------------------------------------------------------------
Bool SystemMonitor::Start()
{
return
SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, NULL, _WinEvent, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS) != 0;
// set window event hook
_handle = SetWinEventHook( EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, NULL, _WinEvent, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS );

return _handle != NULL;
}

//-------------------------------------------------------------------------
void SystemMonitor::Stop()
{
// if window event hook set
if( _handle != NULL )
{
// destroy window event hook
UnhookWinEvent(_handle);

// clear state
_handle = NULL;
}
}
}
3 changes: 3 additions & 0 deletions source/Core/Windows/SystemMonitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ namespace Core
/**/
Bool Start();
void Stop();

// fields
HWINEVENTHOOK _handle = NULL;
};
}
27 changes: 15 additions & 12 deletions source/YoloMouse/Dll/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace YoloMouse
// fields
//-------------------------------------------------------------------------
Bool App::_active (false);
HWND App::_hwnd = NULL;
CursorBindings App::_bindings;
CursorVault App::_vault;
HandleCache App::_cache;
Expand Down Expand Up @@ -177,6 +178,9 @@ namespace YoloMouse
return false;
}

// update active window
_hwnd = hwnd;

// get thread id of this thread (the one Loader's CreateRemoteThread created).
DWORD current_thread_id = GetCurrentThreadId();

Expand All @@ -201,17 +205,8 @@ namespace YoloMouse
// set refresh state
_refresh_ready = true;

// set current cursor to force update using SetClassLong method
#if CPU_64
SetClassLongPtrA(hwnd, GCLP_HCURSOR, (LONG_PTR)refresh_cursor);
#else
SetClassLongA(hwnd, GCL_HCURSOR, (LONG)refresh_cursor);
#endif

// next use SetCursor/PostMassage method in case SetClassLong method doesn't work

// set current cursor to force update
SetCursor(refresh_cursor);
SetCursor( refresh_cursor );

// then trigger application to call SetCursor with its own cursor
PostMessage(hwnd, WM_SETCURSOR, (WPARAM)hwnd, MAKELPARAM(HTCLIENT, WM_MOUSEMOVE));
Expand Down Expand Up @@ -594,8 +589,16 @@ namespace YoloMouse
//-------------------------------------------------------------------------
VOID HOOK_CALL App::_OnHookSetCursor( Native* arguments )
{
// update cursor
_OnCursorHook((HCURSOR&)arguments[1], (HCURSOR)arguments[1]);
// update cursor using setclasslong method first
#if CPU_64
SetClassLongPtrA( _hwnd, GCLP_HCURSOR, (LONG_PTR)arguments[1] );
#else
SetClassLongA( _hwnd, GCL_HCURSOR, (LONG)arguments[1] );
#endif

// if replacement cursor was set pass it out to setcursor method
if( _replace_cursor != NULL )
arguments[1] = (Native)_replace_cursor;
}

VOID HOOK_CALL App::_OnHookSetClassLong( Native* arguments )
Expand Down
1 change: 1 addition & 0 deletions source/YoloMouse/Dll/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace YoloMouse

// fields: state
static Bool _active;
static HWND _hwnd;
static CursorBindings _bindings;
static CursorVault _vault;
static HandleCache _cache;
Expand Down
50 changes: 30 additions & 20 deletions source/YoloMouse/Loader/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,41 @@ namespace YoloMouse
//-------------------------------------------------------------------------
static ExitStatus Main()
{
App app;
App app;
ExitStatus status;

// start
app.Start();
// run main
try
{
// start
app.Start();

// run
app.Run();

// run
app.Run();
// stop
app.Stop();

// stop
app.Stop();
// normal or elevated exit
status = app.GetElevate() ? EXIT_ELEVATE : EXIT_NORMAL;
}
// catch eggs
catch( const Char* error )
{
// show error message
SharedTools::MessagePopup(true, error);

// stop
app.Stop();

// error exit
status = EXIT_PLATFORM_MAIN;
}

// return exit status
return app.GetElevate() ? EXIT_ELEVATE : EXIT_NORMAL;
return status;
}

// debugging
// unit testing area
//-------------------------------------------------------------------------
void _UnitTest()
{
Expand Down Expand Up @@ -84,16 +103,7 @@ int WINAPI WinMain(
if(SystemTools::GetProcessDirectory(path, COUNT(path)) && SetCurrentDirectory(path))
{
// run main
try
{
status = Main();
}
// catch eggs
catch( const Char* error )
{
SharedTools::MessagePopup(true, error);
status = EXIT_PLATFORM_MAIN;
}
status = Main();
}
// path change failed
else
Expand Down
2 changes: 1 addition & 1 deletion source/YoloMouse/Share/Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace YoloMouse

// numeric
//-------------------------------------------------------------------------
static const ULong APP_VERSION[] = { 0, 8, 0 };
static const ULong APP_VERSION[] = { 0, 8, 1 };
static const ULong APP_NAME_LIMIT = 64;
static const ULong LOG_MEMORY_LIMIT = KILOBYTES(8);
static const ULong LOADER_TARGET_LIMIT = 20;
Expand Down

0 comments on commit f0180aa

Please sign in to comment.