diff --git a/4J_Input/4J_Input.vcxproj b/4J_Input/4J_Input.vcxproj index edb9bd2..36a6072 100644 --- a/4J_Input/4J_Input.vcxproj +++ b/4J_Input/4J_Input.vcxproj @@ -239,9 +239,9 @@ Level3 - MaxSpeed + Full true - true + false _WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true ../Headers/Windows64;../Headers;$(ProjectDir);$(ProjectDir)Windows64\vendor\SDL\include;%(AdditionalIncludeDirectories) @@ -249,6 +249,7 @@ MultiThreaded true CompileAsCpp + Speed Windows diff --git a/4J_Profile/4J_Profile.vcxproj b/4J_Profile/4J_Profile.vcxproj index a641a60..e3822b7 100644 --- a/4J_Profile/4J_Profile.vcxproj +++ b/4J_Profile/4J_Profile.vcxproj @@ -121,7 +121,7 @@ true ../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories) stdafx.h - MultiThreadedDLL + MultiThreadedDebug true false @@ -153,15 +153,16 @@ Level3 NotUsing - MaxSpeed + Full true - true + false _WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true ../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories) stdafx.h MultiThreaded true + Speed Windows diff --git a/4J_Profile/Windows64/4J_Profile.cpp b/4J_Profile/Windows64/4J_Profile.cpp index 4a95c77..6c30087 100644 --- a/4J_Profile/Windows64/4J_Profile.cpp +++ b/4J_Profile/Windows64/4J_Profile.cpp @@ -23,6 +23,46 @@ SOFTWARE. */ #include "4J_Profile.h" +#include +#include C_4JProfile ProfileManager; +//str1k3r - GetSettings is basically snatched from smartCMD +void GetSettings(wchar_t *outPath, DWORD size) +{ + GetModuleFileNameW(NULL, outPath, size); //str1k3r - unlike smartCMD we use wide so we can handle non english characters + wchar_t *lastSlash = wcsrchr(outPath, '\\'); + if (lastSlash) *(lastSlash + 1) = '\0'; + wcsncat_s(outPath, size, L"settings.dat", _TRUNCATE); +} + +void C_4JProfile::LoadSettings(void* gs, size_t gsSize) +{ + if (!gs || gsSize == 0) return; + + wchar_t settingsPath[MAX_PATH] = {}; + GetSettings(settingsPath, MAX_PATH); + + FILE *file = NULL; + if (_wfopen_s(&file, settingsPath, L"rb") == 0 && file) //str1k3r - fun fact theres a version of fopen_s but for wide :3 + { + fread(gs, 1, gsSize, file); + fclose(file); + } +} + +void C_4JProfile::SaveSettings(void* gs, size_t gsSize) +{ + if (!gs || gsSize == 0) return; + + wchar_t settingsPath[MAX_PATH] = {}; + GetSettings(settingsPath, MAX_PATH); + + FILE *file = NULL; + if (_wfopen_s(&file, settingsPath, L"wb") == 0 && file) + { + fwrite(gs, 1, gsSize, file); + fclose(file); + } +} diff --git a/4J_Render/4J_Render.vcxproj b/4J_Render/4J_Render.vcxproj index cd23c4c..9024c05 100644 --- a/4J_Render/4J_Render.vcxproj +++ b/4J_Render/4J_Render.vcxproj @@ -187,9 +187,9 @@ Level3 NotUsing - MaxSpeed + Full true - true + false _WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true ../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories) @@ -197,6 +197,7 @@ MultiThreaded CompileAsCpp true + Speed Windows diff --git a/4J_Storage/4J_Storage.vcxproj b/4J_Storage/4J_Storage.vcxproj index 1bdc21c..a0ad35f 100644 --- a/4J_Storage/4J_Storage.vcxproj +++ b/4J_Storage/4J_Storage.vcxproj @@ -149,15 +149,16 @@ Level3 NotUsing - MaxSpeed + Full true - true + false _WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true ../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories) stdafx.h MultiThreaded true + Speed Windows diff --git a/4J_XTMS/4J_XTMS.vcxproj b/4J_XTMS/4J_XTMS.vcxproj index d4838bf..53037d0 100644 --- a/4J_XTMS/4J_XTMS.vcxproj +++ b/4J_XTMS/4J_XTMS.vcxproj @@ -96,7 +96,7 @@ true ../Headers;$(ProjectDir);%(AdditionalIncludeDirectories) stdafx.h - MultiThreadedDLL + MultiThreadedDebug Windows @@ -126,14 +126,15 @@ Level3 NotUsing - MaxSpeed + Full true - true + false _WINDOWS64;_CRT_SECURE_NO_WARNINGS true ../Headers;$(ProjectDir);%(AdditionalIncludeDirectories) stdafx.h MultiThreaded + Speed Windows diff --git a/Headers/Windows64/4J_Profile.h b/Headers/Windows64/4J_Profile.h index c8d41f6..92e79e6 100644 --- a/Headers/Windows64/4J_Profile.h +++ b/Headers/Windows64/4J_Profile.h @@ -97,6 +97,10 @@ public: void ResetProfileProcessState(); // after a sign out from the primary player, call this void Tick( void ); + // SETTINGS + void LoadSettings(void* gs, size_t gsSize); + void SaveSettings(void* gs, size_t gsSize); + // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false,