Skip to content

Commit

Permalink
[PS] add map clearing during defaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
xan1242 committed Jul 7, 2023
1 parent ff55225 commit d8df5b1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void FixWorkingDirectory() {
}

void LoadMapping(std::string userProfileName);
void ClearAllMappings();
std::string gProfileName;

#ifdef GAME_MW
Expand Down Expand Up @@ -956,9 +957,9 @@ void __stdcall ResetMappingsToDefault() {
if (!PathFileExists(dirName.c_str())) CreateDirectory(dirName.c_str(), NULL);
if (CopyFile(defMappingName, mapFile.c_str(), TRUE) == FALSE) mapFile = defMappingName;
} else {
if (CopyFile(defMappingName, mapFile.c_str(), FALSE) == FALSE) mapFile = defMappingName;
DeleteFile(mapFile.c_str());
}

ClearAllMappings();
LoadMapping(gProfileName);


Expand All @@ -974,6 +975,15 @@ void __stdcall ResetMappingsToDefault() {
#pragma runtime_checks("", restore)
#endif

void ClearAllMappings() {
for (unsigned int i = 0; i < MAX_ACTIONID; i++) {
VKeyBindings_PRIMARY[i] = 0;
VKeyBindings_SECONDARY[i] = 0;
XInputBindings_PRIMARY[i] = 0;
XInputBindings_SECONDARY[i] = 0;
}
}

void LoadMapping(std::string userProfileName) {
std::string mapFile = userMappingDir;

Expand Down

0 comments on commit d8df5b1

Please sign in to comment.