Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.49 KB | None | 0 0
  1. #include "config.hpp"
  2. #include "options.hpp"
  3. #include "helpers/math.hpp"
  4. #include "helpers/utils.hpp"
  5. #include "menu.hpp"
  6. #include "helpers/input.hpp"
  7.  
  8. // For ints, chars, floats, and bools
  9. void CConfig::SetupValue( int& value, int def, std::string category, std::string name ) { value = def; ints.push_back( new ConfigValue< int >( category, name, &value, def ) ); }
  10. void CConfig::SetupValue( char* value, char* def, std::string category, std::string name ) { value = def; chars.push_back( new ConfigValue< char >( category, name, value, *def ) ); }
  11. void CConfig::SetupValue( float& value, float def, std::string category, std::string name ) { value = def; floats.push_back( new ConfigValue< float >( category, name, &value, def ) ); }
  12. void CConfig::SetupValue( bool& value, bool def, std::string category, std::string name ) { value = def; bools.push_back( new ConfigValue< bool >( category, name, &value, def ) ); }
  13. void CConfig::SetupColor( float value[4], std::string name ) {
  14. SetupValue( value[0], value[0], ( "colors" ), name + "_r" );
  15. SetupValue( value[1], value[1], ( "colors" ), name + "_g" );
  16. SetupValue( value[2], value[2], ( "colors" ), name + "_b" );
  17. SetupValue( value[3], value[3], ( "colors" ), name + "_a" );
  18. }
  19.  
  20. void CConfig::SetupLegit( ) {
  21. for( auto&[key, val] : weapon_names ) {
  22. SetupValue( g_Options.legitbot_items[key].enabled, false, ( val ), ( "enabled" ) );
  23. SetupValue( g_Options.legitbot_items[key].deathmatch, false, ( val ), ( "deathmatch" ) );
  24. SetupValue( g_Options.legitbot_items[key].autopistol, false, ( val ), ( "autopistol" ) );
  25. SetupValue( g_Options.legitbot_items[key].smoke_check, false, ( val ), ( "smoke_check" ) );
  26. SetupValue( g_Options.legitbot_items[key].flash_check, false, ( val ), ( "flash_check" ) );
  27. SetupValue( g_Options.legitbot_items[key].jump_check, false, ( val ), ( "jump_check" ) );
  28. SetupValue( g_Options.legitbot_items[key].autowall, false, ( val ), ( "autowall" ) );
  29. SetupValue( g_Options.legitbot_items[key].silent, false, ( val ), ( "silent" ) );
  30. SetupValue( g_Options.legitbot_items[key].autofire, false, (val), ("autofire") );
  31. SetupValue( g_Options.legitbot_items[key].on_key, true, (val), ("on_key") );
  32. SetupValue( g_Options.legitbot_items[key].rcs, false, ( val ), ( "rcs" ) );
  33. SetupValue( g_Options.legitbot_items[key].rcs_fov_enabled, false, ( val ), ( "rcs_fov_enabled" ) );
  34. SetupValue( g_Options.legitbot_items[key].rcs_smooth_enabled, false, ( val ), ( "rcs_smooth_enabled" ) );
  35. SetupValue( g_Options.legitbot_items[key].autostop, false, ( val ), ( "autostop" ) );
  36. SetupValue( g_Options.legitbot_items[key].backtrack_time, 0.0f, ( val ), ( "backtrack_time" ) );
  37. SetupValue( g_Options.legitbot_items[key].only_in_zoom, false, ( val ), ( "only_in_zoom" ) );
  38. SetupValue( g_Options.legitbot_items[key].autofire_key, 1, (val), ("autofire_key") );
  39. SetupValue( g_Options.legitbot_items[key].key, 1, (val), ("key") );
  40. SetupValue( g_Options.legitbot_items[key].aim_type, 1, ( val ), ( "aim_type" ) );
  41. SetupValue( g_Options.legitbot_items[key].priority, 0, ( val ), ( "priority" ) );
  42. SetupValue( g_Options.legitbot_items[key].fov_type, 0, ( val ), ( "fov_type" ) );
  43. SetupValue( g_Options.legitbot_items[key].rcs_type, 0, ( val ), ( "rcs_type" ) );
  44. SetupValue( g_Options.legitbot_items[key].smooth_type, 0, ( val ), ( "smooth_type" ) );
  45. SetupValue( g_Options.legitbot_items[key].hitbox, 1, ( val ), ( "hitbox" ) );
  46. SetupValue( g_Options.legitbot_items[key].fov, 0.f, ( val ), ( "fov" ) );
  47. SetupValue( g_Options.legitbot_items[key].silent_fov, 0.f, ( val ), ( "silent_fov" ) );
  48. SetupValue( g_Options.legitbot_items[key].rcs_fov, 0.f, ( val ), ( "rcs_fov" ) );
  49. SetupValue( g_Options.legitbot_items[key].smooth, 1, ( val ), ( "smooth" ) );
  50. SetupValue( g_Options.legitbot_items[key].rcs_smooth, 1, ( val ), ( "rcs_smooth" ) );
  51. SetupValue( g_Options.legitbot_items[key].shot_delay, 0, ( val ), ( "shot_delay" ) );
  52. SetupValue( g_Options.legitbot_items[key].kill_delay, 0, ( val ), ( "kill_delay" ) );
  53. SetupValue( g_Options.legitbot_items[key].rcs_x, 100, ( val ), ( "rcs_x" ) );
  54. SetupValue( g_Options.legitbot_items[key].rcs_y, 100, ( val ), ( "rcs_y" ) );
  55. SetupValue( g_Options.legitbot_items[key].rcs_start, 1, ( val ), ( "rcs_start" ) );
  56. SetupValue( g_Options.legitbot_items[key].min_damage, 1, ( val ), ( "min_damage" ) );
  57. }
  58. }
  59.  
  60. void CConfig::SetupVisuals( ) {
  61. SetupValue( g_Options.esp_enabled, false, ( "esp" ), ( "enabled" ) );
  62. SetupValue( g_Options.esp_enemies_only, false, ( "esp" ), ( "enemies_only" ) );
  63. SetupValue( g_Options.esp_player_skeleton, false, ( "esp" ), ( "player_skeleton" ) );
  64. SetupValue( g_Options.esp_player_boxes, false, ( "esp" ), ( "player_boxes" ) );
  65. SetupValue( g_Options.esp_player_boxes_type, 0, ( "esp" ), ( "player_boxes_type" ) );
  66. SetupValue( g_Options.esp_player_names, false, ( "esp" ), ( "player_names" ) );
  67. SetupValue( g_Options.esp_player_health, false, ( "esp" ), ( "player_health" ) );
  68. SetupValue( g_Options.esp_player_armour, false, ( "esp" ), ( "player_armour" ) );
  69. SetupValue( g_Options.esp_player_weapons, false, ( "esp" ), ( "player_weapons" ) );
  70. SetupValue( g_Options.esp_dropped_weapons, false, ( "esp" ), ( "dropped_weapons" ) );
  71. SetupValue( g_Options.esp_defuse_kit, false, ( "esp" ), ( "defuse_kit" ) );
  72. SetupValue( g_Options.esp_planted_c4, false, ( "esp" ), ( "planted_c4" ) );
  73. SetupValue( g_Options.esp_items, false, ( "esp" ), ( "items" ) );
  74. SetupValue( g_Options.esp_grenade_prediction, false, ( "esp" ), ( "grenade_prediction" ) );
  75. SetupValue( g_Options.esp_backtrack, false, ( "esp" ), ( "backtrack" ) );
  76. SetupValue( g_Options.esp_choke_indicator, false, ( "esp" ), ( "choke_indicator" ) );
  77. SetupValue( g_Options.esp_angle_lines, false, ( "esp" ), ( "angle_lines" ) );
  78. SetupValue( g_Options.esp_hitmarker, false, ( "esp" ), ( "hitmarker" ) );
  79.  
  80. SetupValue( g_Options.glow_enabled, false, ( "glow" ), ( "enabled" ) );
  81. SetupValue( g_Options.glow_enemies_only, false, ( "glow" ), ( "enemies_only" ) );
  82. SetupValue( g_Options.glow_players, false, ( "glow" ), ( "players" ) );
  83. SetupValue( g_Options.glow_chickens, false, ( "glow" ), ( "chickens" ) );
  84. SetupValue( g_Options.glow_c4_carrier, false, ( "glow" ), ( "c4_carrier" ) );
  85. SetupValue( g_Options.glow_planted_c4, false, ( "glow" ), ( "planted_c4" ) );
  86. SetupValue( g_Options.glow_defuse_kits, false, ( "glow" ), ( "defuse_kits" ) );
  87. SetupValue( g_Options.glow_weapons, false, ( "glow" ), ( "weapons" ) );
  88.  
  89. SetupValue( g_Options.chams_player_enabled, false, ( "chams" ), ( "player_enabled" ) );
  90. SetupValue( g_Options.chams_player_enemies_only, false, ( "chams" ), ( "player_enemies_only" ) );
  91. SetupValue( g_Options.chams_player_wireframe, false, ( "chams" ), ( "player_wireframe" ) );
  92. SetupValue( g_Options.chams_player_flat, false, ( "chams" ), ( "player_flat" ) );
  93. SetupValue( g_Options.chams_player_ignorez, false, ( "chams" ), ( "player_ignorez" ) );
  94. SetupValue( g_Options.chams_player_glass, false, ( "chams" ), ( "player_glass" ) );
  95. SetupValue( g_Options.chams_disable_occulusion, false, ( "chams" ), ( "disable_occulusion" ) );
  96. SetupValue( g_Options.chams_backtrack, 0, ( "chams" ), ( "backtrack" ) );
  97. SetupValue( g_Options.chams_backtrack_flat, false, ( "chams" ), ( "backtrack_flat" ) );
  98. SetupValue( g_Options.chams_desync, false, ( "chams" ), ( "desync" ) );
  99.  
  100. SetupValue(g_Options.other_nightmode, false, ("other"), ("nightmode"));
  101. SetupValue(g_Options.other_nightmode_size, 0.2f, ("other"), ("nightmode_size"));
  102. SetupValue(g_Options.other_mat_ambient_light_r, false, ("other"), ("mat_ambient_light_r"));
  103. SetupValue(g_Options.other_mat_ambient_light_g, false, ("other"), ("mat_ambient_light_g"));
  104. SetupValue(g_Options.other_mat_ambient_light_b, false, ("other"), ("mat_ambient_light_b"));
  105. SetupValue(g_Options.other_mat_ambient_light_rainbow, false, ("other"), ("mat_ambient_light_rainbow"));
  106.  
  107. SetupValue( g_Options.other_drawfov, false, ( "other" ), ( "drawfov" ) );
  108. SetupValue( g_Options.other_no_hands, false, ( "other" ), ( "no_hands" ) );
  109. SetupValue( g_Options.other_no_smoke, false, ( "other" ), ( "no_smoke" ) );
  110. SetupValue( g_Options.other_no_flash, false, ( "other" ), ( "no_flash" ) );
  111. }
  112.  
  113. void CConfig::SetupMisc( ) {
  114. SetupValue( g_Options.misc_bhop, false, ( "misc" ), ( "bhop" ) );
  115. SetupValue( g_Options.misc_autostrafe, false, ( "misc" ), ( "autostrafe" ) );
  116. SetupValue( g_Options.misc_edgejump, false, ( "misc" ), ( "edgejump" ) );
  117. SetupValue( g_Options.misc_spectatorlist, false, ( "misc" ), ( "spectatorlist" ) );
  118. SetupValue( g_Options.misc_radar, false, ( "misc" ), ( "radar" ) );
  119. SetupValue( g_Options.misc_radar_enemyonly, false, ( "misc" ), ( "radar_enemyonly" ) );
  120. SetupValue( g_Options.misc_thirdperson, false, ( "misc" ), ( "thirdperson" ) );
  121. SetupValue( g_Options.misc_thirdperson_bind, 0, ( "misc" ), ( "thirdperson_bind" ) );
  122. SetupValue( g_Options.misc_showranks, false, ( "misc" ), ( "showranks" ) );
  123. SetupValue( g_Options.misc_clantag, false, ("misc"), ("clantag"));
  124. SetupValue( g_Options.misc_watermark, false, ( "misc" ), ( "watermark" ) );
  125. SetupValue( g_Options.misc_desync, 0, ( "misc" ), ( "desync" ) );
  126. SetupValue( g_Options.misc_desync_bind, 0, ( "misc" ), ( "desync_bind" ) );
  127. //SetupValue( g_Options.misc_fakeduck_bind, false, ( "misc" ), ( "fakeduck_bind" ) );
  128. //SetupValue( g_Options.misc_fakeduck_ticks, 0, ( "misc" ), ( "fakeduck_ticks" ) );
  129. //SetupValue( g_Options.misc_block_ducked_attack, false, ( "misc" ), ( "block_ducked_attack" ) );
  130. SetupValue( g_Options.misc_thirdperson_dist, 50.f, ( "misc" ), ( "thirdperson_dist" ) );
  131. SetupValue( g_Options.misc_override_fov, 90, ( "misc" ), ( "override_fov" ) );
  132. SetupValue( g_Options.misc_viewmodel_fov, 68, ( "misc" ), ( "viewmodel_fov" ) );
  133. SetupValue( g_Options.misc_retrack_speed, 2.f, ( "misc" ), ( "misc_retrack_speed" ) );
  134.  
  135. SetupValue( g_Options.misc_slowwalk_bind, false, ( "misc" ), ( "slowwalk_bind" ) );
  136. SetupValue( g_Options.misc_slowwalk_speed, 1.0f, ( "misc" ), ( "slowwalk_speed" ) );
  137.  
  138. SetupValue( g_Options.fakelag_enabled, false, ( "fakelag" ), ( "enabled" ) );
  139. SetupValue( g_Options.fakelag_standing, false, ( "fakelag" ), ( "standing" ) );
  140. SetupValue( g_Options.fakelag_moving, false, ( "fakelag" ), ( "moving" ) );
  141. SetupValue( g_Options.fakelag_unducking, false, ( "fakelag" ), ( "unducking" ) );
  142. SetupValue( g_Options.fakelag_mode, 0, ( "fakelag" ), ( "mode" ) );
  143. SetupValue( g_Options.fakelag_factor, 0, ( "fakelag" ), ( "factor" ) );
  144. }
  145.  
  146. void CConfig::SetupSkins() {
  147. //for (auto&[key, val] : k_weapon_names) {
  148. for (auto& key : k_weapon_names) {
  149. SetupValue(g_Options.skins.m_items[key.definition_index].name, "Default",( key.name ), ("name"));
  150. SetupValue(g_Options.skins.m_items[key.definition_index].enabled, 0, (key.name), ("enabled"));
  151. SetupValue(g_Options.skins.m_items[key.definition_index].definition_vector_index, 0, ( key.name ), ("definition_vector_index"));
  152. SetupValue(g_Options.skins.m_items[key.definition_index].definition_index, 1, (key.name), ("definition_index"));
  153. SetupValue(g_Options.skins.m_items[key.definition_index].paint_kit_vector_index, 0, (key.name), ("paint_kit_vector_index"));
  154. SetupValue(g_Options.skins.m_items[key.definition_index].paint_kit_index, 0, (key.name), ("paint_kit_index"));
  155. SetupValue(g_Options.skins.m_items[key.definition_index].definition_override_vector_index, 0, (key.name), ("definition_override_vector_index"));
  156. SetupValue(g_Options.skins.m_items[key.definition_index].definition_override_index, 0, (key.name), ("definition_override_index"));
  157. SetupValue(g_Options.skins.m_items[key.definition_index].seed, 0, (key.name), ("seed"));
  158. SetupValue(g_Options.skins.m_items[key.definition_index].stat_trak, 0, (key.name), ("stat_trak"));
  159. SetupValue(g_Options.skins.m_items[key.definition_index].wear, 0.0f, (key.name), ("wear"));
  160. //SetupValue(g_Options.skins.m_items[key.definition_index].custom_name, "", (key.name), ("custom_name"));
  161. }
  162. }
  163.  
  164. void CConfig::SetupColors( ) {
  165. SetupColor( g_Options.color_esp_ally_visible, "color_esp_ally_visible" );
  166. SetupColor( g_Options.color_esp_enemy_visible, "color_esp_enemy_visible" );
  167. SetupColor( g_Options.color_esp_ally_occluded, "color_esp_ally_occluded" );
  168. SetupColor( g_Options.color_esp_enemy_occluded, "color_esp_enemy_occluded" );
  169. SetupColor( g_Options.color_esp_enemy_occluded, "color_esp_enemy_occluded" );
  170. SetupColor( g_Options.color_esp_weapons, "color_esp_weapons" );
  171. SetupColor( g_Options.color_esp_defuse, "color_esp_defuse" );
  172. SetupColor( g_Options.color_esp_c4, "color_esp_c4" );
  173. SetupColor( g_Options.color_esp_item, "color_esp_item" );
  174. SetupColor( g_Options.color_glow_ally, "color_glow_ally" );
  175. SetupColor( g_Options.color_glow_enemy, "color_glow_enemy" );
  176. SetupColor( g_Options.color_glow_chickens, "color_glow_chickens" );
  177. SetupColor( g_Options.color_glow_c4_carrier, "color_glow_c4_carrier" );
  178. SetupColor( g_Options.color_glow_planted_c4, "color_glow_planted_c4" );
  179. SetupColor( g_Options.color_glow_defuse, "color_glow_defuse" );
  180. SetupColor( g_Options.color_glow_weapons, "color_glow_weapons" );
  181. SetupColor( g_Options.color_chams_player_ally_visible, "color_chams_player_ally_visible" );
  182. SetupColor( g_Options.color_chams_player_ally_occluded, "color_chams_player_ally_occluded" );
  183. SetupColor( g_Options.color_chams_player_enemy_visible, "color_chams_player_enemy_visible" );
  184. SetupColor( g_Options.color_chams_player_enemy_occluded, "color_chams_player_enemy_occluded" );
  185. SetupColor( g_Options.color_chams_backtrack, "color_chams_backtrack" );
  186. SetupColor( g_Options.color_chams_desync, "color_chams_desync" );
  187. SetupColor( g_Options.color_grenade_prediction, "color_grenade_prediction" );
  188. }
  189.  
  190. void CConfig::Setup( ) {
  191. CConfig::SetupLegit( );
  192. CConfig::SetupVisuals( );
  193. CConfig::SetupMisc( );
  194. CConfig::SetupSkins();
  195. CConfig::SetupColors( );
  196. }
  197.  
  198. #include "helpers/utils.hpp"
  199. void CConfig::Save( const std::string& name ) {
  200. if( name.empty( ) )
  201. return;
  202.  
  203. CreateDirectoryA( u8"C:\\M0ne0N Free\\", NULL );
  204. std::string file = u8"C:\\M0ne0N Free\\" + name;
  205.  
  206. for( auto value : ints ) {
  207. WritePrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), std::to_string( *value->value ).c_str( ), file.c_str( ) );
  208. }
  209.  
  210. for( auto value : floats ) WritePrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), std::to_string( *value->value ).c_str( ), file.c_str( ) );
  211.  
  212. for (auto value : bools) WritePrivateProfileStringA(value->category.c_str(), value->name.c_str(), *value->value ? "true" : "false", file.c_str());
  213. for( auto value : bools ) WritePrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), *value->value ? "false" : "true", file.c_str( ) );
  214. }
  215.  
  216. void CConfig::Load( const std::string& name ) {
  217. if( name.empty( ) )
  218. return;
  219.  
  220. g_ClientState->ForceFullUpdate();
  221.  
  222. CreateDirectoryA( u8"C:\\M0ne0N Free\\", NULL );
  223. std::string file = u8"C:\\M0ne0N Free\\" + name;
  224.  
  225. char value_l[32] = { '\0' };
  226. for( auto value : ints ) {
  227. GetPrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), "0", value_l, 32, file.c_str( ) ); *value->value = atoi( value_l );
  228. }
  229.  
  230. for( auto value : floats ) {
  231. GetPrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), "0.0f", value_l, 32, file.c_str( ) ); *value->value = atof( value_l );
  232. }
  233.  
  234. for( auto value : bools ) {
  235. GetPrivateProfileStringA(value->category.c_str(), value->name.c_str(), "", value_l, 32, file.c_str());
  236. *value->value = !strcmp(value_l, "true");
  237.  
  238. }
  239.  
  240.  
  241. }
  242.  
  243. bool Unload = false;
  244. bool g_Save = false;
  245. bool g_Load = false;
  246. bool g_Clear = false;
  247. bool g_View = false;
  248.  
  249.  
  250. CConfig* Config = new CConfig( );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement