diff --git a/clicker.vcxproj b/clicker.vcxproj
index 42f1b14..7774cff 100644
--- a/clicker.vcxproj
+++ b/clicker.vcxproj
@@ -57,7 +57,7 @@
-
+
@@ -115,7 +115,7 @@
- Level1
+ TurnOffAllWarnings
true
%(PreprocessorDefinitions)
true
@@ -131,7 +131,7 @@
%(AdditionalLibraryDirectories)
- AsInvoker
+ RequireAdministrator
true
@@ -148,6 +148,7 @@
stdcpp17
+ MultiThreadedDLL
Windows
@@ -155,9 +156,9 @@
true
false
d3d9.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- AsInvoker
+ RequireAdministrator
/DEBUG:NONE /EMITPOGOPHASEINFO %(AdditionalOptions)
- true
+ false
diff --git a/clicker.vcxproj.filters b/clicker.vcxproj.filters
index 938d2ad..5c337b5 100644
--- a/clicker.vcxproj.filters
+++ b/clicker.vcxproj.filters
@@ -71,9 +71,6 @@
def\utils
-
- def\utils
-
def\include\imgui\fonts
@@ -113,5 +110,8 @@
menu
+
+ def\utils
+
\ No newline at end of file
diff --git a/clicker/clicker.cpp b/clicker/clicker.cpp
index 85e97cb..d7bff04 100644
--- a/clicker/clicker.cpp
+++ b/clicker/clicker.cpp
@@ -4,78 +4,97 @@ void clicker::work( )
{
while ( true )
{
- std::this_thread::sleep_for( std::chrono::milliseconds( 1 ) );
+ // Please PR if you found a better way to do this. CPU Usage is high without.
+ sleep( 1 );
- if ( config.clicker.hotkey_enabled && util::get_active_window_title( ).find( config.clicker.window_title ) != std::string::npos )
+ if ( vars::b_hotkey_enabled && util::get_active_window_title( ).find( config.clicker.window_title ) != std::string::npos ) // if hotkey is enabled, and selected window is active
{
- if ( config.clicker.left_enabled && vars::b_l_mouse_down )
+ if ( config.clicker.left_enabled && vars::b_l_mouse_down && !vars::b_r_mouse_down ) // if left is enabled, left mouse is down and right mouse isn't down start clicking.
{
- if ( vars::b_l_first_click )
- {
- std::this_thread::sleep_for( std::chrono::milliseconds( 30 ) );
- g_mouse->left_up( );
- vars::b_l_first_click = false;
- }
- else
- {
- // Old meth logic, will change to something better later ;c
- auto random_delay = util::random_int
- (
- 1000 / ( config.clicker.l_min_cps + config.clicker.l_max_cps * ( int ) 0.2 ),
- 1000 / ( config.clicker.l_min_cps + config.clicker.l_max_cps * ( int ) 0.48 )
- );
-
- if ( ( std::clock( ) - vars::l_last_click_time ) > random_delay )
- {
- g_mouse->left_down( );
- vars::l_last_click_time = std::clock( );
-
- if ( config.clicker.blockhit && config.clicker.blockhit_chance > 0 && std::rand( ) % ( 100 / config.clicker.blockhit_chance ) == 0 )
- g_mouse->right_down( );
-
- std::this_thread::sleep_for( std::chrono::milliseconds( util::random_int( 30, 50 ) ) );
- g_mouse->left_up( );
-
- if ( config.clicker.blockhit )
- g_mouse->right_up( );
-
- vars::i_clicks_this_session++;
-
- _log( LDEBUG, "l_click random_delay %d clock %d last click time %d", random_delay, std::clock( ), vars::l_last_click_time );
- }
- }
+ g_clicker->click( LBUTTON, config.clicker.l_cps, &vars::b_l_first_click ); // click!
}
- if ( config.clicker.right_enabled && vars::b_r_mouse_down )
+ if ( config.clicker.right_enabled && vars::b_r_mouse_down ) // if right is enabled, right mouse is down start clicking.
{
- if ( vars::b_r_first_click )
- {
- std::this_thread::sleep_for( std::chrono::milliseconds( 30 ) );
- g_mouse->right_up( );
- vars::b_r_first_click = false;
- }
- else
- {
- auto random_delay = util::random_int
- (
- 1000 / ( config.clicker.r_min_cps + config.clicker.r_max_cps * ( int ) 0.2 ),
- 1000 / ( config.clicker.r_min_cps + config.clicker.r_max_cps * ( int ) 0.48 )
- );
-
- if ( ( std::clock( ) - vars::l_last_click_time ) > random_delay )
- {
- g_mouse->right_down( );
- vars::l_last_click_time = std::clock( );
-
- std::this_thread::sleep_for( std::chrono::milliseconds( util::random_int( 30, 50 ) ) );
- g_mouse->right_up( );
-
- vars::i_clicks_this_session++;
-
- _log( LDEBUG, "r_click random_delay %d clock %d last click time %d", random_delay, std::clock( ), vars::l_last_click_time );
- }
- }
+ g_clicker->click( RBUTTON, config.clicker.r_cps, &vars::b_r_first_click ); // click!
}
}
}
+}
+
+void clicker::click( bool b_button, int i_cps, bool *b_first_click )
+{
+ if ( i_cps <= 0 ) // return if our cps is 0. let's not divide it by 0.
+ return;
+
+ if ( !config.clicker.blatant ) // if blatant is not enabled randomize values.
+ {
+ random = util::random_int( -( i_cps / 5 ), ( i_cps / 5 ) ); // random int between negative 1 / 5 of our cps and 1 / 5 of our cps
+ i_cps += random; // add our values to the i_cps variable.
+
+ // TODO:
+ /*
+ if ( config.clicker.cps_drop_chance && config.clicker.cps_drop_chance_val > 0 && std::rand( ) % ( 100 / config.clicker.cps_drop_chance_val ) == 0 )
+ {
+ // cps drop code
+ }
+
+ if ( config.clicker.cps_spike_chance && config.clicker.cps_spike_chance_val > 0 && std::rand( ) % ( 100 / config.clicker.cps_spike_chance_val ) == 0 )
+ {
+ // cps spike code
+ }
+ */
+ }
+
+ delay = ( 1000 / i_cps ) / 2; // delay is half because we'll be calling it two times, on mouse down and up.
+
+ if ( *b_first_click ) // if it's our first click, delay and send a up input to our function.
+ {
+ sleep( delay );
+ g_clicker->click_mouse( INPUT_UP, b_button );
+ *b_first_click = false;
+ _log( LDEBUG, "[ clicker ] first click" );
+ }
+
+ sleep( delay ); // sleep on input down
+
+ if ( config.clicker.blockhit && config.clicker.blockhit_chance > 0 && std::rand( ) % ( 100 / config.clicker.blockhit_chance ) == 0 ) // if blockhit is enabled and blockhit chance is higher than 0 and blockhit chance matches
+ {
+ if_blockhitted = true; // set blockhitted bool to true
+ g_clicker->click_mouse( INPUT_DOWN, RBUTTON ); // right click
+ }
+
+ g_clicker->click_mouse( INPUT_DOWN, b_button ); // the actual input down call
+
+ sleep( delay ); // sleep on input up
+
+ if ( if_blockhitted ) // check if blockhitted bool was true
+ {
+ g_clicker->click_mouse( INPUT_UP, RBUTTON ); // right click up
+ if_blockhitted = false; // set blockhitted variable back to false.
+ }
+
+ g_clicker->click_mouse( INPUT_UP, b_button ); // the actual input up call
+
+ _log( LDEBUG, "[ clicker ] i_cps: %d delay %d", i_cps, delay );
+}
+
+void clicker::click_mouse( bool down, bool button ) // le button
+{
+ if ( down ) // if our mouse is down
+ {
+ if ( button ) // set left down
+ g_mouse->left_down( );
+ else // set right down
+ g_mouse->right_down( );
+ }
+ else // if our mouse isn't down
+ {
+ if ( button ) // set left up
+ g_mouse->left_up( );
+ else // set right up
+ g_mouse->right_up( );
+ }
+
+ vars::i_clicks_this_session += 1;
}
\ No newline at end of file
diff --git a/clicker/clicker.hpp b/clicker/clicker.hpp
index 9f7cbee..6f58bc6 100644
--- a/clicker/clicker.hpp
+++ b/clicker/clicker.hpp
@@ -3,13 +3,28 @@
#include "../def/includes.hpp"
#include "../mouse/mouse.hpp"
+#define sleep(ms) (std::this_thread::sleep_for(std::chrono::milliseconds(ms)));
+
class clicker
{
public:
void work( );
+ void click( bool b_button, int i_cps, bool *b_first_click );
+ void click_mouse( bool down, bool button );
~clicker( ) = default;
clicker( ) = default;
+
+private:
+ int delay = 0; // delay for the sleep
+ int random = 0; // random cps
+ bool if_blockhitted = false;
+
+ bool RBUTTON = false;
+ bool LBUTTON = true;
+
+ bool INPUT_UP = false;
+ bool INPUT_DOWN = true;
};
inline auto g_clicker = std::make_unique( );
\ No newline at end of file
diff --git a/def/config/config.hpp b/def/config/config.hpp
index 756cfd0..d55892e 100644
--- a/def/config/config.hpp
+++ b/def/config/config.hpp
@@ -25,8 +25,8 @@ class c_config final
bool left_enabled { false };
bool right_enabled { false };
- bool hotkey_enabled { false };
bool blockhit { false };
+ bool blatant { false };
bool delete_file_on_exit { false };
bool clear_string_on_exit { false };
@@ -36,13 +36,15 @@ class c_config final
int activation_type { 0 };
int version_type { 0 };
- int l_min_cps { 0 };
- int l_max_cps { 0 };
-
- int r_min_cps { 0 };
- int r_max_cps { 0 };
+ int l_cps { 0 };
+ int r_cps { 0 };
int blockhit_chance { 0 };
+ int cps_spike_chance_val { 0 };
+ int cps_drop_chance_val { 0 };
+
+ bool cps_spike_chance { false };
+ bool cps_drop_chance { false };
std::string window_title;
}
diff --git a/def/includes.hpp b/def/includes.hpp
index ed0e934..c41e7a2 100644
--- a/def/includes.hpp
+++ b/def/includes.hpp
@@ -18,6 +18,6 @@
// header files
#include "config/config.hpp"
-#include "utils/vars.hpp"
#include "utils/util.hpp"
+#include "vars.hpp"
#include "console.hpp"
\ No newline at end of file
diff --git a/def/scanner/scanner.cpp b/def/scanner/scanner.cpp
index 4badb05..321db5f 100644
--- a/def/scanner/scanner.cpp
+++ b/def/scanner/scanner.cpp
@@ -51,7 +51,7 @@ std::vector scanner::scan_unicode( std::string string )
if ( y == ___length - 1 )
{
_mem_locations.push_back( this->_address + x * 2 );
- _log( LDEBUG, "Read unicode: 0x%x", _address + x * 2 );
+ _log( LDEBUG, "[ string_scan ] Read unicode: 0x%x", _address + x * 2 );
}
}
}
@@ -84,7 +84,7 @@ std::vector scanner::scan_multibyte( std::string string )
if ( y == ___length - 1 )
{
_mem_locations.push_back( this->_address + x );
- _log( LDEBUG, "Read multibyte: 0x%x", _address + x );
+ _log( LDEBUG, "[ string_scan ] Read multibyte: 0x%x", _address + x );
}
}
}
@@ -100,7 +100,7 @@ void scanner::rewrite_unicode( size_t addr, std::string str )
ZwWriteVirtualMemory( this->p_handle, ( LPVOID ) ( addr + x * 2 ), &str[ x ], 1, nullptr );
}
- _log( LDEBUG, "Write unicode: 0x%x", addr );
+ _log( LDEBUG, "[ string_scan ] Write unicode: 0x%x", addr );
}
@@ -111,5 +111,5 @@ void scanner::rewrite_multibyte( size_t addr, std::string str )
ZwWriteVirtualMemory( this->p_handle, ( LPVOID ) ( addr + x ), &str[ x ], 1, nullptr );
}
- _log( LDEBUG, "Write multibyte: 0x%x", addr );
+ _log( LDEBUG, "[ string_scan ] Write multibyte: 0x%x", addr );
}
\ No newline at end of file
diff --git a/def/utils/util.cpp b/def/utils/util.cpp
index 742c67b..6a82777 100644
--- a/def/utils/util.cpp
+++ b/def/utils/util.cpp
@@ -36,14 +36,6 @@ std::string util::get_active_window_title( )
return title;
}
-std::string util::get_serial( )
-{
- DWORD disk_serial;
- GetVolumeInformationA( R"(C:)", nullptr, 0, &disk_serial, nullptr, nullptr, nullptr, 0 );
-
- return std::to_string( disk_serial );
-}
-
DWORD util::get_process_id_by_name( const std::string &str_proc )
{
if ( str_proc.empty( ) )
@@ -79,18 +71,9 @@ void util::self_delete( std::string file_path )
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
- StringCbPrintf( szCmd, 2 * MAX_PATH, "cmd.exe /C ping 1.1.1.1 -n 5 > nul & del /f /q \"%s\"", file_path.c_str( ) );
+ StringCbPrintf( szCmd, 2 * MAX_PATH, "cmd.exe /C timeout /t 5 > nul & del /f /q \"%s\"", file_path.c_str( ) );
CreateProcess( NULL, szCmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi );
CloseHandle( pi.hThread );
CloseHandle( pi.hProcess );
-}
-
-template
-static std::string util::format( const std::string &format, args ... arg )
-{
- const size_t size = std::snprintf( nullptr, 0, format.c_str( ), arg ... ) + 1;
- std::unique_ptr buf( new char[ size ] );
- std::snprintf( buf.get( ), size, format.c_str( ), arg ... );
- return std::string( buf.get( ), buf.get( ) + size - 1 );
}
\ No newline at end of file
diff --git a/def/utils/util.hpp b/def/utils/util.hpp
index 0a95cb1..c315edd 100644
--- a/def/utils/util.hpp
+++ b/def/utils/util.hpp
@@ -8,7 +8,7 @@
#include
#include
-#include "vars.hpp"
+#include "../vars.hpp"
namespace util
{
@@ -16,9 +16,6 @@ namespace util
std::wstring string_to_wstring( std::string str );
int random_int( int i_start, int i_end );
std::string get_active_window_title( );
- std::string get_serial( );
DWORD get_process_id_by_name( const std::string &str_proc );
void self_delete( std::string file_path );
- template
- static std::string format( const std::string &format, args ...arg );
}
diff --git a/def/utils/vars.hpp b/def/vars.hpp
similarity index 88%
rename from def/utils/vars.hpp
rename to def/vars.hpp
index 4eaa54c..973bb7e 100644
--- a/def/utils/vars.hpp
+++ b/def/vars.hpp
@@ -11,7 +11,7 @@ namespace vars
inline bool b_is_clicked { false };
inline bool b_is_down { false };
- inline int i_clicks_this_session { 0 };
+ inline bool b_hotkey_enabled { false };
- inline long l_last_click_time;
+ inline int i_clicks_this_session { 0 };
}
\ No newline at end of file
diff --git a/entry.cpp b/entry.cpp
index e455ca7..dbb3185 100644
--- a/entry.cpp
+++ b/entry.cpp
@@ -6,7 +6,7 @@
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
- // self-destruct
+ // self-destruct at exit
std::atexit( [ ]( )
{
TCHAR szFileName[ MAX_PATH ]; GetModuleFileName( NULL, szFileName, MAX_PATH );
@@ -16,24 +16,26 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
// clear explorer.exe
{
- auto _scanner = std::make_unique( OpenProcess( PROCESS_ALL_ACCESS, FALSE, util::get_process_id_by_name( "explorer" ) ) );
if ( config.clicker.clear_string_on_exit )
{
+ auto _scanner = std::make_unique( OpenProcess( PROCESS_ALL_ACCESS, FALSE, util::get_process_id_by_name( "explorer" ) ) );
+
auto _ptrs = _scanner->scan_unicode( file_name.c_str( ) );
for ( size_t _loc : _ptrs )
_scanner->rewrite_unicode( _loc, " " );
- }
- if ( config.clicker.clear_string_multibyte )
- {
- auto _ptrs_multibyte = _scanner->scan_multibyte( file_name.c_str( ) );
+ if ( config.clicker.clear_string_multibyte )
+ {
+ auto _ptrs_multibyte = _scanner->scan_multibyte( file_name.c_str( ) );
- for ( size_t _loc_m : _ptrs_multibyte )
- _scanner->rewrite_multibyte( _loc_m, " " );
+ for ( size_t _loc_m : _ptrs_multibyte )
+ _scanner->rewrite_multibyte( _loc_m, " " );
+ }
}
+
if ( config.clicker.delete_file_on_exit )
{
util::self_delete( full_path );
@@ -44,20 +46,17 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
}
// clear other processes {...}
-
} );
- _log( LDEBUG, "Initializing." );
+ _log( LDEBUG, "[ clicker_thread ] Initializing clicker thread." );
- HW_PROFILE_INFO hwProfileInfo;
-
- GetCurrentHwProfile( &hwProfileInfo );
+ std::thread thread_clicker( [ ]( ) { g_clicker->work( ); } );
- config.run( "w_w_oo" );
+ _log( LDEBUG, "[ mouse_thread ] Initializing mouse thread." );
std::thread thread_mouse( [ ]( ) { g_mouse->work( ); } );
- std::thread thread_clicker( [ ]( ) { g_clicker->work( ); } );
+ _log( LDEBUG, "[ ui_create ] Initializing menu thread." );
if ( !g_menu->create( 550, 350 ) )
{
@@ -65,5 +64,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
return EXIT_FAILURE;
}
+ config.run( "clicker" );
+
return EXIT_SUCCESS;
}
diff --git a/menu/menu.cpp b/menu/menu.cpp
index 71135e2..7948e86 100644
--- a/menu/menu.cpp
+++ b/menu/menu.cpp
@@ -10,6 +10,8 @@ void menu::render_objects( HWND hwnd, int width, int height )
if ( ImGui::IsMouseClicked( ImGuiMouseButton_Left ) )
g_menu->get_mouse_offset( x, y, hwnd );
+ g_menu->activation_type( );
+
ImGui::Begin( "##clicker_title", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove );
{
if ( y >= 0 && y <= ImGui::GetTextLineHeight( ) + ImGui::GetStyle( ).FramePadding.y * 2.0f && ImGui::IsMouseDragging( ImGuiMouseButton_Left ) )
@@ -17,16 +19,31 @@ void menu::render_objects( HWND hwnd, int width, int height )
ImGui::Text( "clicker" );
- ImGui::SameLine( 0.0f, static_cast< float >( width ) - 80.0f );
-
ImGui::PushStyleColor( ImGuiCol_Button, color( 255, 255, 255, 0 ) );
+ ImGui::SameLine( 0.0f, static_cast< float >( width ) - 150.0f );
+
+ if ( ImGui::Button( "Github" ) )
+ {
+ ShellExecute( 0, 0, "https://github.com/b1scoito/clicker", 0, 0, SW_SHOW );
+ }
+
+ ImGui::SameLine( );
+
+ if ( ImGui::Button( ICON_FA_CLONE ) )
+ {
+ ::ShowWindow( hwnd, SW_MINIMIZE );
+ }
+
+ ImGui::SameLine( );
+
if ( ImGui::Button( ICON_FA_TIMES ) )
{
::ShowWindow( hwnd, SW_HIDE ); // Hiding for the string cleaning operation
std::exit( 0 ); // This will trigger atexit
}
+
ImGui::PopStyleColor( );
if ( ImGui::BeginTabBar( "##tabs", ImGuiTabBarFlags_None ) )
@@ -35,57 +52,84 @@ void menu::render_objects( HWND hwnd, int width, int height )
{
ImGui::Text( "Keybindings" );
ImGui::Separator( );
- {
- ImGui::Combo( "##cmb_kb_type", &config.clicker.activation_type, "Always On\0Hold\0Toggle\0\0" );
+ ImGui::Combo( "##cmb_kb_type", &config.clicker.activation_type, "Always On\0Hold\0Toggle\0\0" );
- ImGui::SameLine( );
+ ImGui::SameLine( );
- g_menu->key_bind_button( config.clicker.key, 155, 20 );
- g_menu->activation_type( );
- }
+ g_menu->key_bind_button( config.clicker.key, 155, 20 );
ImGui::Separator( );
ImGui::Text( "Clicker configuration" );
ImGui::Separator( );
- {
- ImGui::Checkbox( "Left clicker enabled##lc_enabled", &config.clicker.left_enabled );
- ImGui::SliderInt( "##l_maxcps", &config.clicker.l_min_cps, 1, 20, "Maximum CPS %d" );
- ImGui::SliderInt( "##l_mincps", &config.clicker.l_max_cps, 1, 20, "Minimum CPS %d" );
+ ImGui::Text( "Press Ctrl + Left click on the slider for custom values.\nValues between 9-12 are recommended for bypassing server-sided anti-cheats." );
- ImGui::Separator( );
+ ImGui::Checkbox( "Left clicker enabled##lc_enabled", &config.clicker.left_enabled );
- ImGui::Checkbox( "Right clicker enabled##lr_enabled", &config.clicker.right_enabled );
+ ImGui::SliderInt( "##l_cps", &config.clicker.l_cps, 1, 20, "%d cps" );
- ImGui::SliderInt( "##r_maxcps", &config.clicker.r_min_cps, 1, 20, "Maximum CPS %d" );
- ImGui::SliderInt( "##r_mincps", &config.clicker.r_max_cps, 1, 20, "Minimum CPS %d" );
+ ImGui::Separator( );
- ImGui::Combo( "Client Version##cl_ver", &config.clicker.version_type, "Lunar\0Badlion\0Minecraft / Forge\0Custom\0\0" );
+ ImGui::Checkbox( "Right clicker enabled##lr_enabled", &config.clicker.right_enabled );
- static char buffer_w[ 16 ];
- switch ( config.clicker.version_type )
- {
- case 0:
- config.clicker.window_title = "Lunar";
- break;
- case 1:
- config.clicker.window_title = "Badlion";
- break;
- case 2:
- config.clicker.window_title = "Minecraft";
- break;
- case 3:
- ImGui::InputText( "Window Title##wnd_title", buffer_w, IM_ARRAYSIZE( buffer_w ) );
- config.clicker.window_title = buffer_w;
- break;
- }
+ ImGui::SliderInt( "##r_cps", &config.clicker.r_cps, 1, 20, "%d cps" );
+
+ ImGui::Separator( );
+ ImGui::Checkbox( "Blatant", &config.clicker.blatant );
+
+ if ( ImGui::IsItemHovered( ) )
+ ImGui::SetTooltip( "If this is checked no randomization\nwill be added. Use it at your own risk." );
+
+ if ( !config.clicker.blatant )
+ {
ImGui::Checkbox( "Blockhit", &config.clicker.blockhit );
if ( config.clicker.blockhit )
{
- ImGui::SliderInt( "##blockhit_chance", &config.clicker.blockhit_chance, 1, 100, "Blockhit chance %d%%" );
+ ImGui::SliderInt( "##blockhit_chance", &config.clicker.blockhit_chance, 1, 100, "blockhit chance %d%%" );
+ }
+
+ // TODO:
+ /*
+ ImGui::Checkbox( "Spike chance", &config.clicker.cps_spike_chance );
+ if ( config.clicker.cps_spike_chance )
+ {
+ ImGui::SliderInt( "##cps_spike_chance", &config.clicker.cps_spike_chance_val, 1, 100, "cps spike chance %d%%" );
}
+
+ ImGui::Checkbox( "Drop chance", &config.clicker.cps_drop_chance );
+ if ( config.clicker.cps_drop_chance )
+ {
+ ImGui::SliderInt( "##cps_drop_chance", &config.clicker.cps_drop_chance_val, 1, 100, "cps drop chance %d%%" );
+ }
+ */
}
+
+ ImGui::Separator( );
+
+ ImGui::Combo( "Client Version##cl_ver", &config.clicker.version_type, "Lunar\0Badlion\0Minecraft / Forge\0Custom\0\0" );
+
+ if ( ImGui::IsItemHovered( ) )
+ ImGui::SetTooltip( "Select custom and leave it blank for it to work anywhere." );
+
+ static char buffer_w[ 16 ];
+ switch ( config.clicker.version_type )
+ {
+ case 0:
+ config.clicker.window_title = "Lunar";
+ break;
+ case 1:
+ config.clicker.window_title = "Badlion";
+ break;
+ case 2:
+ config.clicker.window_title = "Minecraft";
+ break;
+ case 3:
+ ImGui::InputText( "Window Title##wnd_title", buffer_w, IM_ARRAYSIZE( buffer_w ) );
+ config.clicker.window_title = buffer_w;
+ break;
+ }
+
ImGui::EndTabItem( );
}
@@ -93,92 +137,90 @@ void menu::render_objects( HWND hwnd, int width, int height )
{
ImGui::Text( "Config settings" );
ImGui::Separator( );
- {
- if ( ImGui::Button( "Open config folder" ) )
+ if ( ImGui::Button( "Open config folder" ) )
+ {
+ PIDLIST_ABSOLUTE pidl;
+ if ( SUCCEEDED( SHParseDisplayName( util::string_to_wstring( config.config_path.c_str( ) ).c_str( ), 0, &pidl, 0, 0 ) ) )
{
- PIDLIST_ABSOLUTE pidl;
- if ( SUCCEEDED( SHParseDisplayName( util::string_to_wstring( config.config_path.c_str( ) ).c_str( ), 0, &pidl, 0, 0 ) ) )
- {
- ITEMIDLIST idNull = { 0 };
- LPCITEMIDLIST pidlNull[ 1 ] = { &idNull };
- SHOpenFolderAndSelectItems( pidl, 1, pidlNull, 0 );
- ILFree( pidl );
- }
+ ITEMIDLIST idNull = { 0 };
+ LPCITEMIDLIST pidlNull[ 1 ] = { &idNull };
+ SHOpenFolderAndSelectItems( pidl, 1, pidlNull, 0 );
+ ILFree( pidl );
}
+ }
- constexpr auto &config_items = config.get_configs( );
- static int current_config = -1;
+ constexpr auto &config_items = config.get_configs( );
+ static int current_config = -1;
- if ( static_cast< size_t >( current_config ) >= config_items.size( ) )
- current_config = -1;
+ if ( static_cast< size_t >( current_config ) >= config_items.size( ) )
+ current_config = -1;
- static char buffer[ 16 ];
+ static char buffer[ 16 ];
- if ( ImGui::ListBox( "Configs", ¤t_config, [ ]( void *data, int idx, const char **out_text )
- {
- auto &vector = *static_cast< std::vector * >( data );
- *out_text = vector[ idx ].c_str( );
- return true;
- }, &config_items, config_items.size( ), 5 ) && current_config != -1 )
+ if ( ImGui::ListBox( "Configs", ¤t_config, [ ]( void *data, int idx, const char **out_text )
+ {
+ auto &vector = *static_cast< std::vector * >( data );
+ *out_text = vector[ idx ].c_str( );
+ return true;
+ }, &config_items, config_items.size( ), 5 ) && current_config != -1 )
- strcpy_s( buffer, config_items[ current_config ].c_str( ) );
+ strcpy_s( buffer, config_items[ current_config ].c_str( ) );
- if ( ImGui::InputText( "Config name", buffer, IM_ARRAYSIZE( buffer ), ImGuiInputTextFlags_EnterReturnsTrue ) )
- {
- if ( current_config != -1 )
- config.rename( current_config, buffer );
- }
+ if ( ImGui::InputText( "Config name", buffer, IM_ARRAYSIZE( buffer ), ImGuiInputTextFlags_EnterReturnsTrue ) )
+ {
+ if ( current_config != -1 )
+ config.rename( current_config, buffer );
+ }
+
+ if ( ImGui::Button( ( "Create" ), ImVec2( 60, 25 ) ) )
+ {
+ config.add( buffer );
+ }
- if ( ImGui::Button( ( "Create" ), ImVec2( 75, 20 ) ) )
+ ImGui::SameLine( );
+
+ if ( ImGui::Button( ( "Reset" ), ImVec2( 60, 25 ) ) )
+ {
+ config.reset( );
+ }
+
+ ImGui::SameLine( );
+
+ if ( current_config != -1 )
+ {
+ if ( ImGui::Button( ( "Load" ), ImVec2( 60, 25 ) ) )
{
- config.add( buffer );
+ config.load( current_config );
}
ImGui::SameLine( );
- if ( ImGui::Button( ( "Reset" ), ImVec2( 75, 20 ) ) )
+ if ( ImGui::Button( ( "Save" ), ImVec2( 60, 25 ) ) )
{
- config.reset( );
+ config.save( current_config );
}
- if ( current_config != -1 )
- {
- if ( ImGui::Button( ( "Load" ), ImVec2( 75, 20 ) ) )
- {
- config.load( current_config );
- }
-
- ImGui::SameLine( );
-
- if ( ImGui::Button( ( "Save" ), ImVec2( 75, 20 ) ) )
- {
- config.save( current_config );
- }
-
- ImGui::SameLine( );
+ ImGui::SameLine( );
- if ( ImGui::Button( ( "Delete" ), ImVec2( 75, 20 ) ) )
- {
- config.remove( current_config );
- }
+ if ( ImGui::Button( ( "Delete" ), ImVec2( 60, 25 ) ) )
+ {
+ config.remove( current_config );
}
- }
+ }
- ImGui::EndTabItem( );
+ ImGui::EndTabItem( );
}
if ( ImGui::BeginTabItem( "Info" ) )
{
ImGui::Text( "Information" );
ImGui::Separator( );
- {
- ImGui::Text( "Is left button down: %s", vars::b_l_mouse_down ? ICON_FA_CHECK " " : ICON_FA_TIMES " " );
- ImGui::Text( "Is right button down: %s", vars::b_r_mouse_down ? ICON_FA_CHECK " " : ICON_FA_TIMES " " );
- ImGui::Text( "Is hotkey toggled: %s", config.clicker.hotkey_enabled ? ICON_FA_CHECK " " : ICON_FA_TIMES " " );
- ImGui::Text( "Clicks this session: %d", vars::i_clicks_this_session );
- ImGui::Text( "Application average %.1f ms (%.1f fps)", 1000.0f / ImGui::GetIO( ).Framerate, ImGui::GetIO( ).Framerate );
- }
+ ImGui::Text( "Is left button down: %s", vars::b_l_mouse_down ? ICON_FA_CHECK " " : ICON_FA_TIMES " " );
+ ImGui::Text( "Is right button down: %s", vars::b_r_mouse_down ? ICON_FA_CHECK " " : ICON_FA_TIMES " " );
+ ImGui::Text( "Is hotkey toggled: %s", vars::b_hotkey_enabled ? ICON_FA_CHECK " " : ICON_FA_TIMES " " );
+ ImGui::Text( "Clicks this session: %d", vars::i_clicks_this_session );
+ ImGui::Text( "Application average: %.1f ms (%.1f fps)", 1000.0f / ImGui::GetIO( ).Framerate, ImGui::GetIO( ).Framerate );
ImGui::EndTabItem( );
}
@@ -186,37 +228,33 @@ void menu::render_objects( HWND hwnd, int width, int height )
{
ImGui::Text( "Self-destruct settings" );
ImGui::Separator( );
- {
- ImGui::Text( "The self-destruct works when you close the program.\nIt will hide itself and exit when the cleaning process finishes.\nYou will hear a beep when it finishes." );
+ ImGui::Text( "The self-destruct works when you close the program.\nIt will hide itself and exit when the cleaning process finishes.\nYou will hear a beep when it finishes." );
- ImGui::Checkbox( "Delete file on exit", &config.clicker.delete_file_on_exit );
+ ImGui::Checkbox( "Delete file on exit", &config.clicker.delete_file_on_exit );
- if ( ImGui::IsItemHovered( ) )
- ImGui::SetTooltip( "Will self delete the executable on exit." );
+ if ( ImGui::IsItemHovered( ) )
+ ImGui::SetTooltip( "Will self delete the executable on exit." );
- ImGui::Checkbox( "Clear strings on exit", &config.clicker.clear_string_on_exit );
+ ImGui::Checkbox( "Clear strings on exit", &config.clicker.clear_string_on_exit );
- if ( ImGui::IsItemHovered( ) )
- ImGui::SetTooltip( "Will clear strings on explorer matching filename." );
+ if ( ImGui::IsItemHovered( ) )
+ ImGui::SetTooltip( "Will clear strings on explorer matching filename." );
+ if ( config.clicker.clear_string_on_exit )
+ {
ImGui::Checkbox( "Clear multibyte strings (slow)", &config.clicker.clear_string_multibyte );
if ( ImGui::IsItemHovered( ) )
ImGui::SetTooltip( "Will delete more strings \nat the cost of taking longer to finish the process." );
}
+
ImGui::EndTabItem( );
}
ImGui::EndTabBar( );
}
- if ( config.clicker.l_min_cps <= config.clicker.l_max_cps && !( config.clicker.l_max_cps > 19 ) )
- config.clicker.l_min_cps += 1;
-
- if ( config.clicker.r_min_cps <= config.clicker.r_max_cps && !( config.clicker.r_max_cps > 19 ) )
- config.clicker.r_min_cps += 1;
-
ImGui::End( );
}
}
@@ -274,19 +312,18 @@ bool menu::create( int width, int height )
ImVec4 *colors = style.Colors;
- io.Fonts->AddFontDefault( );
io.IniFilename = nullptr;
- ImFontConfig f_config;
- f_config.MergeMode = true;
- f_config.PixelSnapH = true;
+ static const ImWchar ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
+ ImFontConfig f_config; f_config.MergeMode = true; f_config.PixelSnapH = true;
- static const ImWchar ranges[] =
+ if ( PWSTR path_to_fonts; SUCCEEDED( SHGetKnownFolderPath( FOLDERID_Fonts, 0, nullptr, &path_to_fonts ) ) )
{
- ICON_MIN_FA,
- ICON_MAX_FA,
- 0
- };
+ const std::filesystem::path path { path_to_fonts };
+ CoTaskMemFree( path_to_fonts );
+
+ io.Fonts->AddFontFromFileTTF( ( path / "tahoma.ttf" ).string( ).c_str( ), 15.0f, NULL );
+ }
io.Fonts->AddFontFromMemoryCompressedTTF( fa_compressed_data, fa_compressed_size, 13.0f, &f_config, ranges );
@@ -294,41 +331,45 @@ bool menu::create( int width, int height )
style.ChildRounding = 1.0f;
style.FrameRounding = 3.0f;
style.GrabRounding = 3.0f;
+ // style.WindowRounding = 3.0f;
- // Use demo to see color documentation and stuff
+ // Use demo to see color documentation and stuff.
colors[ ImGuiCol_Text ] = color( 250, 250, 250 );
colors[ ImGuiCol_TextDisabled ] = color( 204, 204, 204 );
colors[ ImGuiCol_WindowBg ] = color( 25, 25, 25 );
colors[ ImGuiCol_PopupBg ] = color( 31, 31, 31 );
- colors[ ImGuiCol_Border ] = color( 244, 154, 255 );
- colors[ ImGuiCol_BorderShadow ] = color( 241, 123, 255 );
+ colors[ ImGuiCol_Border ] = color( 130, 61, 184 );
+ colors[ ImGuiCol_BorderShadow ] = color( 130, 61, 184 );
colors[ ImGuiCol_FrameBg ] = color( 32, 32, 32 );
colors[ ImGuiCol_FrameBgHovered ] = color( 51, 51, 51 );
colors[ ImGuiCol_FrameBgActive ] = color( 74, 74, 74 );
- colors[ ImGuiCol_Button ] = color( 239, 104, 255 );
- colors[ ImGuiCol_ButtonHovered ] = color( 240, 123, 254 );
- colors[ ImGuiCol_ButtonActive ] = color( 240, 142, 252 );
- colors[ ImGuiCol_ScrollbarGrab ] = color( 244, 154, 255 );
+ colors[ ImGuiCol_Button ] = color( 75, 0, 130 );
+ colors[ ImGuiCol_ButtonHovered ] = color( 130, 61, 184 );
+ colors[ ImGuiCol_ButtonActive ] = color( 130, 81, 187 );
+ colors[ ImGuiCol_ScrollbarGrab ] = color( 130, 61, 184 );
colors[ ImGuiCol_ScrollbarBg ] = color( 25, 25, 25 );
- colors[ ImGuiCol_ScrollbarGrabHovered ] = color( 240, 123, 254 );
- colors[ ImGuiCol_ScrollbarGrabActive ] = color( 240, 142, 252 );
- colors[ ImGuiCol_SliderGrab ] = color( 239, 104, 255 );
- colors[ ImGuiCol_SliderGrabActive ] = color( 240, 142, 252 );
- colors[ ImGuiCol_CheckMark ] = color( 240, 142, 252 );
- colors[ ImGuiCol_Header ] = color( 240, 142, 252 );
- colors[ ImGuiCol_HeaderHovered ] = color( 240, 123, 254 );
- colors[ ImGuiCol_HeaderActive ] = color( 240, 142, 252 );
+ colors[ ImGuiCol_ScrollbarGrabHovered ] = color( 75, 0, 130 );
+ colors[ ImGuiCol_ScrollbarGrabActive ] = color( 130, 61, 184 );
+ colors[ ImGuiCol_SliderGrab ] = color( 130, 81, 187 );
+ colors[ ImGuiCol_SliderGrabActive ] = color( 157, 103, 219 );
+ colors[ ImGuiCol_CheckMark ] = color( 130, 81, 187 );
+ colors[ ImGuiCol_Header ] = color( 130, 81, 187 );
+ colors[ ImGuiCol_HeaderHovered ] = color( 130, 81, 187 );
+ colors[ ImGuiCol_HeaderActive ] = color( 130, 81, 187 );
colors[ ImGuiCol_Separator ] = color( 239, 104, 255, 150 );
- colors[ ImGuiCol_Tab ] = color( 239, 104, 255 );
- colors[ ImGuiCol_TabHovered ] = color( 240, 123, 254 );
- colors[ ImGuiCol_TabActive ] = color( 240, 142, 252 );
+ colors[ ImGuiCol_Tab ] = color( 75, 0, 130 );
+ colors[ ImGuiCol_TabHovered ] = color( 130, 81, 187 );
+ colors[ ImGuiCol_TabActive ] = color( 157, 103, 219 );
ImGui_ImplWin32_Init( hwnd );
ImGui_ImplDX9_Init( g_pd3dDevice );
ImVec4 clear_color = color( 0, 0, 0 );
- _log( LDEBUG, "Waiting for program end." );
+ _log( LDEBUG, "[ ui_loop ] Waiting for program end." );
+
+ if ( 1000.f / ImGui::GetIO( ).Framerate < 1000.f / 60 )
+ std::this_thread::sleep_for( std::chrono::milliseconds( ( long long ) ( 1000.f / 60 ) ) ); // fixing issues related to performance and frame capping?
MSG msg;
ZeroMemory( &msg, sizeof( msg ) );
@@ -345,9 +386,6 @@ bool menu::create( int width, int height )
ImGui_ImplWin32_NewFrame( );
ImGui::NewFrame( );
- // if ( 1000.f / ImGui::GetIO( ).Framerate < 1000.f / 60 )
- // std::this_thread::sleep_for( std::chrono::milliseconds( ( long long ) ( 1000.f / 60 ) ) );
-
g_menu->render_objects( hwnd, width, height );
ImGui::EndFrame( );
diff --git a/menu/menu.hpp b/menu/menu.hpp
index 8890fc0..a66672c 100644
--- a/menu/menu.hpp
+++ b/menu/menu.hpp
@@ -12,8 +12,6 @@
#include "../def/includes.hpp"
-#define DIRECTINPUT_VERSION 0x0800
-
class menu
{
public:
@@ -126,14 +124,14 @@ class menu
{
case 0:
if ( config.clicker.left_enabled || config.clicker.right_enabled )
- config.clicker.hotkey_enabled = true;
+ vars::b_hotkey_enabled = true;
break;
case 1:
if ( GetAsyncKeyState( config.clicker.key ) )
- config.clicker.hotkey_enabled = true;
+ vars::b_hotkey_enabled = true;
else
- config.clicker.hotkey_enabled = false;
+ vars::b_hotkey_enabled = false;
break;
case 2:
@@ -154,7 +152,7 @@ class menu
}
if ( vars::b_is_clicked )
- config.clicker.hotkey_enabled = !config.clicker.hotkey_enabled;
+ vars::b_hotkey_enabled = !vars::b_hotkey_enabled;
break;
}
diff --git a/mouse/mouse.cpp b/mouse/mouse.cpp
index b51960c..151e44a 100644
--- a/mouse/mouse.cpp
+++ b/mouse/mouse.cpp
@@ -29,6 +29,7 @@ LRESULT CALLBACK m_hook( int nCode, WPARAM wParam, LPARAM lParam )
break;
case WM_RBUTTONUP:
vars::b_r_mouse_down = false;
+ break;
}
}