2024-04-14 17:37:36 +07:00

52 lines
1.3 KiB
C++

//
// Created by beerpsi on 4/14/2024.
//
#include <format>
#include <windows.h>
#include "io.h"
/*
Maimai DX Default key binding
1P: self-explanatory
2P: (Numpad) 8, 9, 6, 3, 2, 1, 4, 7, *
*/
static const int mai2_io_1p_default[] = {'W', 'E', 'D', 'C', 'X', 'Z', 'A', 'Q', '3'};
static const int mai2_io_2p_default[] = {0x68, 0x69, 0x66, 0x63, 0x62, 0x61, 0x64, 0x67, 0x54};
std::vector<Button> &games::mai2::get_buttons() {
static std::vector<Button> buttons;
if (!buttons.empty()) {
return buttons;
}
for (int i = 1; i <= 8; i++) {
std::string key = std::format("1p_btn{}", i);
buttons.emplace_back(
std::format("1P Button {}", i),
"button",
key,
mai2_io_1p_default[i - 1],
GetPrivateProfileIntA("button", key.c_str(), mai2_io_1p_default[i - 1], ".\\segatools.ini")
);
}
for (int i = 1; i <= 8; i++) {
std::string key = std::format("2p_btn{}", i);
buttons.emplace_back(
std::format("2P Button {}", i),
"button",
key,
mai2_io_2p_default[i - 1],
GetPrivateProfileIntA("button", key.c_str(), mai2_io_2p_default[i - 1], ".\\segatools.ini")
);
}
return buttons;
}