migrant input: guarda el path del mando per a poder distingir mandos amb el mateix nom

This commit is contained in:
2025-08-04 20:47:47 +02:00
parent 8301ca0aef
commit 5d760fc97c
3 changed files with 35 additions and 24 deletions

View File

@@ -97,6 +97,7 @@ struct Settings {
struct Gamepad {
std::shared_ptr<Input::Gamepad> instance = nullptr; // Referencia al mando
std::string name; // Nombre del mando
std::string path; // Ruta física del dispositivo
Player::Id player_id; // Jugador asociado al mando
Gamepad(Player::Id custom_player_id = Player::Id::NO_PLAYER)
@@ -170,6 +171,7 @@ class GamepadManager {
for (size_t i = 0; i < MAX_PLAYERS; ++i) {
const auto& gamepad = gamepads[i];
file << "controller." << i << ".name=" << gamepad.name << "\n";
file << "controller." << i << ".path=" << gamepad.path << "\n";
file << "controller." << i << ".player=" << static_cast<int>(gamepad.player_id) << "\n";
}
}
@@ -185,6 +187,9 @@ class GamepadManager {
if (property == "name") {
gamepad.name = value;
return true;
} else if (property == "path") {
gamepad.path = value;
return true;
} else if (property == "player") {
try {
int player_int = std::stoi(value);