1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

fix shortcuts, fixes #824, fixes #512...

- add saving of shortcut configuration
- allow setting of shortcuts in title screen
This commit is contained in:
IntelOrca
2015-02-27 17:28:45 +00:00
parent b8f81b2c29
commit 4268c930e8
6 changed files with 83 additions and 44 deletions

View File

@@ -900,4 +900,48 @@ void config_reset_shortcut_keys()
memcpy(gShortcutKeys, _defaultShortcutKeys, sizeof(gShortcutKeys));
}
void config_shortcut_keys_get_path(char *outPath)
{
platform_get_user_directory(outPath, NULL);
strcat(outPath, "hotkeys.cfg");
}
bool config_shortcut_keys_load()
{
char path[MAX_PATH];
FILE *file;
int result;
config_shortcut_keys_get_path(path);
file = fopen(path, "rb");
if (file != NULL) {
result = fread(gShortcutKeys, sizeof(gShortcutKeys), 1, file) == 1;
fclose(file);
} else {
result = false;
}
return result;
}
bool config_shortcut_keys_save()
{
char path[MAX_PATH];
FILE *file;
int result;
config_shortcut_keys_get_path(path);
file = fopen(path, "wb");
if (file != NULL) {
result = fwrite(gShortcutKeys, sizeof(gShortcutKeys), 1, file) == 1;
fclose(file);
} else {
result = false;
}
return result;
}
#pragma endregion