Qt: Implement Swap Controller 1 & 2

This commit is contained in:
BearOso 2024-04-22 15:54:56 -05:00
parent 98cac16b46
commit 582128bce7
3 changed files with 9 additions and 4 deletions

View File

@ -361,6 +361,15 @@ void EmuApplication::handleBinding(std::string name, bool pressed)
{
loadState(save_slot);
}
else if (name == "SwapControllers1and2")
{
int num_bindings = EmuConfig::num_controller_bindings * EmuConfig::allowed_bindings;
EmuBinding temp[num_bindings];
memcpy(temp, config->binding.controller[0].buttons, sizeof(temp));
memcpy(config->binding.controller[0].buttons, config->binding.controller[1].buttons, sizeof(temp));
memcpy(config->binding.controller[1].buttons, temp, sizeof(temp));
updateBindings();
}
}
}

View File

@ -1,6 +1,5 @@
#include <cstdio>
#include <string>
#include <fstream>
#include <filesystem>
namespace fs = std::filesystem;

View File

@ -1,15 +1,12 @@
#include "Snes9xController.hpp"
#include "EmuConfig.hpp"
#include "SoftwareScalers.hpp"
#include <memory>
#include <filesystem>
namespace fs = std::filesystem;
#include "snes9x.h"
#include "memmap.h"
#include "srtc.h"
#include "apu/apu.h"
#include "apu/bapu/snes/snes.hpp"
#include "gfx.h"
#include "snapshot.h"
#include "controls.h"