Skip to content

Commit 5620a17

Browse files
committed
Merge branch 'development'
2 parents 00ac8f0 + 752e567 commit 5620a17

File tree

3 files changed

+184
-175
lines changed

3 files changed

+184
-175
lines changed

src/Config.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,48 @@
55
#include <string.h>
66
#include <map>
77
struct Config {
8-
std::string configPath = "config.ini";
9-
std::string keymapPath = "keymap.cfg";
8+
std::string configPath;
9+
std::string keymapPath;
1010
int altcmkp = 0;
11-
char keymap[256];
11+
bool hwsc = false;
12+
char keymap[256]; // idx is midi key code (0-127, typically), value is vk code (1-254)
1213

13-
Config() {
14-
for (size_t i = 0; i < 255; i++) {
15-
keymap[i] = 0; // idx is midi key code (0-127, typically), value is vk code (1-254)
16-
}
14+
void use(std::string configPath, std::string keymapPath) {
15+
this->configPath = configPath;
16+
this->keymapPath = keymapPath;
1717
}
1818

1919
void save() {
2020
ini::IniFile storage;
2121
storage["Compatibility"]["altcmkp"] = altcmkp;
22+
storage["Compatibility"]["hwsc"] = hwsc;
2223
storage.save(configPath);
2324

2425
std::ofstream out;
2526
out.open(keymapPath);
2627
if (out) out.write(keymap, 256);
2728
out.close();
28-
return;
2929
}
3030

3131
void load() {
3232
ini::IniFile storage;
3333
storage.load(configPath);
3434
if (storage["Compatibility"]["altcmkp"].as<std::string>() != "") altcmkp = storage["Compatibility"]["altcmkp"].as<int>();
35+
if (storage["Compatibility"]["hwsc"].as<std::string>() != "") hwsc = storage["Compatibility"]["hwsc"].as<bool>();
3536

37+
for (size_t i = 0; i < 255; i++) {
38+
keymap[i] = 0;
39+
}
3640
std::ifstream in;
3741
in.open(keymapPath);
3842
if (in) in.getline(keymap, 256);
3943
in.close();
40-
return;
4144
}
4245

43-
auto getEntries() {
46+
auto repr() {
4447
std::map<std::string, std::string> entries = {
4548
{ "altcmkp", std::to_string(altcmkp) },
49+
{ "hwsc", std::to_string(hwsc) },
4650
};
4751
return entries;
4852
}

0 commit comments

Comments
 (0)