summaryrefslogtreecommitdiff
path: root/internal_rewrite/simple_settings.hpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2018-09-03 23:48:51 +0200
committernavewindre <boneyaard@gmail.com>2018-09-03 23:48:51 +0200
commit39f70b7b843d926eeb534ac1de25cc38b13c493d (patch)
tree654ac4c96dd9fb2355998d63ad866a3b52c71632 /internal_rewrite/simple_settings.hpp
parenta988afb947e653b96f2b188d455865cd6fc80ea0 (diff)
ah
Diffstat (limited to 'internal_rewrite/simple_settings.hpp')
-rw-r--r--internal_rewrite/simple_settings.hpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/internal_rewrite/simple_settings.hpp b/internal_rewrite/simple_settings.hpp
index 5d5636e..6371992 100644
--- a/internal_rewrite/simple_settings.hpp
+++ b/internal_rewrite/simple_settings.hpp
@@ -143,22 +143,38 @@ public:
__declspec( noinline ) void load( const char* path, const char* file ) override {
static char str[ MAX_PATH ];
+ static char full_path[ MAX_PATH ];
+ static bool taken = false;
- GetModuleFileNameA( nullptr, str, MAX_PATH - 1 );
- PathRemoveFileSpecA( str );
- strcat_s< MAX_PATH >( str, "\\csgo\\cfg\\" );
- strcat_s< MAX_PATH >( str, file );
+ if( !taken ) {
+ GetModuleFileNameA( nullptr, str, MAX_PATH - 1 );
+ PathRemoveFileSpecA( str );
+ strcat_s< MAX_PATH >( str, "\\csgo\\cfg\\" );
+
+ taken = true;
+ }
+
+ memcpy( full_path, str, MAX_PATH );
+ strcat_s< MAX_PATH >( full_path, file );
simple_load( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), str );
}
__declspec( noinline ) void save( const char* path, const char* file ) const override {
static char str[ MAX_PATH ];
+ static char full_path[ MAX_PATH ];
+ static bool taken = false;
+
+ if( !taken ) {
+ GetModuleFileNameA( nullptr, str, MAX_PATH - 1 );
+ PathRemoveFileSpecA( str );
+ strcat_s< MAX_PATH >( str, "\\csgo\\cfg\\" );
+
+ taken = true;
+ }
- GetModuleFileNameA( nullptr, str, MAX_PATH - 1 );
- PathRemoveFileSpecA( str );
- strcat_s< MAX_PATH >( str, "\\csgo\\cfg\\" );
- strcat_s< MAX_PATH >( str, file );
+ memcpy( full_path, str, MAX_PATH );
+ strcat_s< MAX_PATH >( full_path, file );
simple_save( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), str );
}