diff options
| author | JustSomePwner <crotchyalt@gmail.com> | 2018-09-01 19:29:36 +0200 |
|---|---|---|
| committer | JustSomePwner <crotchyalt@gmail.com> | 2018-09-01 19:29:36 +0200 |
| commit | f98507c96886e9cc84809e4beed5fc066ea1177e (patch) | |
| tree | 810724c3fe416f64040737f7f30f4cb2f07e249c /internal_rewrite/simple_settings.hpp | |
| parent | 89d0110da2e65405fcbdac0e24f4fcc5cdce4c1c (diff) | |
gangsta shit
Diffstat (limited to 'internal_rewrite/simple_settings.hpp')
| -rw-r--r-- | internal_rewrite/simple_settings.hpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/internal_rewrite/simple_settings.hpp b/internal_rewrite/simple_settings.hpp index 71fd627..31701cd 100644 --- a/internal_rewrite/simple_settings.hpp +++ b/internal_rewrite/simple_settings.hpp @@ -31,21 +31,28 @@ public: setting_nodes_.push_back( node_ptr ); } - void load( const char* path, const char* file ) override { - char full_path[ 64 ]; - strcpy_s( full_path, path ); - strcat_s( full_path, "_" ); - strcat_s( full_path, name_ ); - for ( auto x : setting_nodes_ ) + __declspec( noinline ) void load( const char* path, const char* file ) override + { + static char full_path[1024];
+ memset( full_path, 0, 1024 ); +
+ strcpy_s( full_path, path );
+ strcat_s( full_path, "_" );
+ strcat_s( full_path, name_.c_str( ) ); +
+ for ( auto x : setting_nodes_ )
x->load( full_path, file ); } - void save( const char* path, const char* file ) const override { - char full_path[ 64 ]; - strcpy_s( full_path, path ); - strcat_s( full_path, "_" ); - strcat_s( full_path, name_ ); - for ( auto x : setting_nodes_ ) + __declspec( noinline ) void save( const char* path, const char* file ) const override + { + static char full_path[1024];
+ memset( full_path, 0, 1024 );
+
+ strcpy_s( full_path, path );
+ strcat_s( full_path, "_" );
+ strcat_s( full_path, name_.c_str( ) );
+ for ( auto x : setting_nodes_ )
x->save( full_path, file ); } @@ -58,7 +65,7 @@ public: } private: - const char* name_; + std::string name_; bool has_nodes_; std::vector<ISettingNode*> setting_nodes_; }; @@ -83,11 +90,11 @@ public: holder_ptr->register_( this ); }; - void load( const char* path, const char* file ) override { + __declspec( noinline ) void load( const char* path, const char* file ) override { GetPrivateProfileStringA( path, std::to_string( m_name ).c_str( ), "", m_value, L, file ); } - void save( const char* path, const char* file ) const override { + __declspec( noinline ) void save( const char* path, const char* file ) const override { WritePrivateProfileStringA( path, std::to_string( m_name ).c_str( ), m_value, file ); } @@ -103,13 +110,13 @@ private: template < typename T > class con_var : public ISetting { public: - __forceinline con_var( SettingHolder* holder_ptr, hash_t name ) : + __declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name ) : name_( name ), is_float_( std::is_floating_point_v< T > ), is_integral_( std::is_integral_v< T > ) { holder_ptr->register_( this ); } - __forceinline con_var( SettingHolder* holder_ptr, hash_t name , const T& rhs ) : + __declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name , const T& rhs ) : value_( rhs ), name_( name ), is_float_( std::is_floating_point_v< T > ), @@ -117,9 +124,9 @@ public: holder_ptr->register_( this ); } - void load( const char* path, const char* file ) override { simple_load( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); } + __declspec( noinline ) void load( const char* path, const char* file ) override { simple_load( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); } - void save( const char* path, const char* file ) const override { simple_save( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); } + __declspec( noinline ) void save( const char* path, const char* file ) const override { simple_save( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); } __forceinline operator T&( ) { return value_; } __forceinline T* operator &( ) { return &value_; } |
