diff options
| author | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
| commit | 3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch) | |
| tree | 26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/internal_rewrite/simple_settings.cpp | |
| parent | e4729e4393d90271a3814c7a79950a660c48325a (diff) | |
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
Diffstat (limited to 'cheat/internal_rewrite/simple_settings.cpp')
| -rw-r--r-- | cheat/internal_rewrite/simple_settings.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cheat/internal_rewrite/simple_settings.cpp b/cheat/internal_rewrite/simple_settings.cpp new file mode 100644 index 0000000..b6b3281 --- /dev/null +++ b/cheat/internal_rewrite/simple_settings.cpp @@ -0,0 +1,32 @@ +#include "settings.hpp" + +SettingHolder data::holder_{ "iloveyou" }; +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 |
