Skip to content

Commit

Permalink
version 0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
PandaTeemo committed Mar 20, 2015
1 parent 3b19d73 commit 26738f6
Show file tree
Hide file tree
Showing 21 changed files with 180 additions and 170 deletions.
1 change: 0 additions & 1 deletion build/Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<ClInclude Include="..\..\source\Core\Constants.hpp" />
<ClInclude Include="..\..\source\Core\Container\Array.hpp" />
<ClInclude Include="..\..\source\Core\Container\String.hpp" />
<ClInclude Include="..\..\source\Core\Macros.hpp" />
<ClInclude Include="..\..\source\Core\Root.hpp" />
<ClInclude Include="..\..\source\Core\Support\Debug.hpp" />
<ClInclude Include="..\..\source\Core\Support\Enum.hpp" />
Expand Down
1 change: 0 additions & 1 deletion build/Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\Core\Constants.hpp" />
<ClInclude Include="..\..\source\Core\Macros.hpp" />
<ClInclude Include="..\..\source\Core\Root.hpp" />
<ClInclude Include="..\..\source\Core\Types.hpp" />
<ClInclude Include="..\..\source\Core\Windows\InputMonitor.hpp">
Expand Down
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.5.2.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">
<Product Id="*" Name="YoloMouse" Language="1033" Version="0.5.3.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">

<Package Id="*" InstallerVersion="200" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
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.5.2.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">
<Product Id="*" Name="YoloMouse" Language="1033" Version="0.5.3.0" Manufacturer="HaPpY" UpgradeCode="69ce184e-a676-4169-a124-e1ee073bd0e6">

<Package Id="*" InstallerVersion="200" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" Platform="x64"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
Expand Down
1 change: 1 addition & 0 deletions build/YoloMouse.Dll/YoloMouse.Dll.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<LocalDebuggerAttach>false</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions build/YoloMouse.Loader/YoloMouse.Loader.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerDebuggerType>NativeOnly</LocalDebuggerDebuggerType>
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
Expand Down
Binary file modified build/YoloMouse.v11.suo
Binary file not shown.
23 changes: 0 additions & 23 deletions source/Core/Macros.hpp

This file was deleted.

6 changes: 1 addition & 5 deletions source/Core/Root.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ namespace Core
#define eggs(x) ((x) ? (void)0 : ExceptionMessage(#x, __FILE__, __LINE__))

/**/
#if 0
#define xlog(...) ((void)0)
#else
#define xlog Core::Debug::Log
#endif
#define xlog Core::Debug::Log

// forward declarations
template<typename TYPE> class Enum;
Expand Down
73 changes: 44 additions & 29 deletions source/YoloMouse/Dll/CursorHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ namespace YoloMouse

// public
//-------------------------------------------------------------------------
void CursorHook::Load( HWND hwnd )
Bool CursorHook::Load()
{
DWORD process_id = GetCurrentProcessId();

// if not already active
if( _active )
return;
return true;

// build id string
if( !SharedTools::BuildTargetId(_target_id, COUNT(_target_id), process_id) )
return false;

// load state
if( !_state.Open(false) )
return;
return false;

// load hooks
if( !_LoadHooks() )
return;

// build id string
if( !SharedTools::BuildTargetId(_target_id, COUNT(_target_id), hwnd) )
return;
return false;

// load cursor map from file
_bindings.Load(_target_id);
Expand All @@ -53,7 +55,9 @@ namespace YoloMouse
_active = true;

// refresh cursor
Refresh(hwnd);
Refresh();

return true;
}

void CursorHook::Unload()
Expand All @@ -75,26 +79,45 @@ namespace YoloMouse
}

//-------------------------------------------------------------------------
void CursorHook::Assign( HWND hwnd, Index cursor_index )
Bool CursorHook::Assign( Index cursor_index )
{
xassert(_active);
// require active
if( !_active )
return false;

// mark for update
_assign_index = cursor_index;
_assign_ready = true;

// refresh cursor
Refresh(hwnd);
Refresh();

return true;
}

//-------------------------------------------------------------------------
void CursorHook::Refresh( HWND hwnd )
Bool CursorHook::Refresh()
{
DWORD process_id;

// require active
if( !_active )
return false;

// get last cursor
HCURSOR refresh_cursor = _last_cursor;

// get current and window threads
DWORD hwnd_thread_id = GetWindowThreadProcessId(hwnd, 0);
// get active window
HWND hwnd = GetForegroundWindow();

// get thread and process id of this window
DWORD hwnd_thread_id = GetWindowThreadProcessId(hwnd, &process_id);

// require active window belongs to this process. otherwise dont bother refreshing.
if( process_id != GetCurrentProcessId() )
return false;

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

// attach to window thread. this is to make GetCursor and SetCursor work properly
Expand All @@ -110,7 +133,7 @@ namespace YoloMouse
if( _state.FindCursor(refresh_cursor) != INVALID_INDEX )
{
AttachThreadInput(hwnd_thread_id, current_thread_id, FALSE);
return;
return false;
}
}

Expand Down Expand Up @@ -139,6 +162,8 @@ namespace YoloMouse
// detach from window thread
AttachThreadInput(hwnd_thread_id, current_thread_id, FALSE);
}

return true;
}

// private
Expand Down Expand Up @@ -172,17 +197,6 @@ namespace YoloMouse
_hook_setcursor.Disable();
}

//-------------------------------------------------------------------------
HCURSOR CursorHook::_AdaptCursor( HCURSOR from )
{
// adapt null to special empty cursor
if(from == NULL)
return CURSOR_SPECIAL_EMPTY;
// else use given
else
return from;
}

//-------------------------------------------------------------------------
Bool CursorHook::_OnCursorAssign( HCURSOR hcursor, Index cursor_index )
{
Expand Down Expand Up @@ -265,8 +279,9 @@ namespace YoloMouse
//-------------------------------------------------------------------------
Bool CursorHook::_OnCursorEvent( HCURSOR& new_cursor, HCURSOR old_cursor )
{
// adapt cursor
old_cursor = _AdaptCursor(old_cursor);
// ignore null cursor
if( old_cursor == NULL )
return false;

// if cursor changing set refresh state
if( old_cursor != _last_cursor )
Expand Down
9 changes: 3 additions & 6 deletions source/YoloMouse/Dll/CursorHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,20 @@ namespace YoloMouse

public:
/**/
static void Load( HWND hwnd );
static Bool Load();
static void Unload();

/**/
static void Assign( HWND hwnd, Index cursor_index );
static Bool Assign( Index cursor_index );

/**/
static void Refresh( HWND hwnd );
static Bool Refresh();

private:
/**/
static Bool _LoadHooks();
static void _UnloadHooks();

/**/
static HCURSOR _AdaptCursor( HCURSOR from );

/**/
static Bool _OnCursorAssign( HCURSOR hcursor, Index cursor_index );
static Bool _OnCursorChanging( HCURSOR hcursor );
Expand Down
9 changes: 4 additions & 5 deletions source/YoloMouse/Dll/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@ using namespace YoloMouse;
void __declspec(dllexport)
YoloNotify( void* arg )
{
NotifyMessage& m = *reinterpret_cast<NotifyMessage*>(arg);
HWND hwnd = reinterpret_cast<HWND>(m.hwnd);
NotifyMessage& m = *reinterpret_cast<NotifyMessage*>(arg);

// handle notify
switch(m.id)
{
case NOTIFY_INIT:
CursorHook::Load(hwnd);
CursorHook::Load();
break;

case NOTIFY_ASSIGN:
CursorHook::Assign(hwnd, static_cast<Index>(m.parameter));
CursorHook::Assign(static_cast<Index>(m.parameter));
break;

case NOTIFY_REFRESH:
CursorHook::Refresh(hwnd);
CursorHook::Refresh();
break;
}
}
Expand Down
Loading

0 comments on commit 26738f6

Please sign in to comment.