From 3d412a4b30a9f7c7f51ea6562e694315948bd3da Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 28 Nov 2018 16:00:02 +1300 Subject: cleaned up in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64 --- cheat/tf2/simple_settings.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cheat/tf2/simple_settings.cpp (limited to 'cheat/tf2/simple_settings.cpp') diff --git a/cheat/tf2/simple_settings.cpp b/cheat/tf2/simple_settings.cpp new file mode 100644 index 0000000..9d1d1de --- /dev/null +++ b/cheat/tf2/simple_settings.cpp @@ -0,0 +1,32 @@ +#include "settings.h" + +SettingHolder data::holder_{ "fucking_nerd" }; +data::c_settings g_settings; + +#pragma warning(disable: 4996) + +void simple_save( const char* path, const char* name, const void* src, size_t size, const char* filename ) { + auto buffer = reinterpret_cast< char* >( _alloca( size * 2 + 1 ) ); + auto data = reinterpret_cast< const uint8_t* >( src ); + + for( size_t i = 0; i < size; i++ ) + sprintf( &buffer[ 2 * i ], "%02X", data[ i ] ); + + WritePrivateProfileStringA( path, name, buffer, filename ); +} + +void simple_load( const char* path, const char* name, void* dest, size_t size, const char* filename ) { + auto buffer = reinterpret_cast< char* >( _alloca( size * 2 + 1 ) ); + auto data = reinterpret_cast< uint8_t* >( dest ); + + GetPrivateProfileStringA( path, name, "", buffer, size * 2 + 1, filename ); + + if( *buffer == 0 ) + return; + + for( size_t i = 0; i < size; i++ ) { + unsigned temp; + sscanf( &buffer[ 2 * i ], "%02X", &temp ); + data[ i ] = temp; + } +} \ No newline at end of file -- cgit v1.2.3