mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-19 13:37:00 +00:00
Add all the files
This commit is contained in:
parent
e3db07a16a
commit
d60742f52b
1445 changed files with 430238 additions and 0 deletions
79
src/input/api/InputAPI.h
Normal file
79
src/input/api/InputAPI.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
namespace InputAPI
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Keyboard,
|
||||
SDLController,
|
||||
XInput,
|
||||
DirectInput,
|
||||
DSUClient,
|
||||
GameCube,
|
||||
Wiimote,
|
||||
|
||||
WGIGamepad,
|
||||
WGIRawController,
|
||||
|
||||
MAX
|
||||
};
|
||||
|
||||
constexpr std::string_view to_string(Type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Keyboard:
|
||||
return "Keyboard";
|
||||
case DirectInput:
|
||||
return "DirectInput";
|
||||
case XInput:
|
||||
return "XInput";
|
||||
case Wiimote:
|
||||
return "Wiimote";
|
||||
case GameCube:
|
||||
return "GameCube";
|
||||
case DSUClient:
|
||||
return "DSUController";
|
||||
case WGIGamepad:
|
||||
return "WGIGamepad";
|
||||
case WGIRawController:
|
||||
return "WGIRawController";
|
||||
case SDLController:
|
||||
return "SDLController";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
throw std::runtime_error(fmt::format("unknown input api: {}", to_underlying(type)));
|
||||
}
|
||||
|
||||
constexpr Type from_string(std::string_view str)
|
||||
{
|
||||
if (str == to_string(Keyboard))
|
||||
return Keyboard;
|
||||
else if (str == to_string(DirectInput))
|
||||
return DirectInput;
|
||||
else if (str == to_string(XInput))
|
||||
return XInput;
|
||||
else if (str == to_string(Wiimote))
|
||||
return Wiimote;
|
||||
else if (str == to_string(GameCube))
|
||||
return GameCube;
|
||||
else if (str == to_string(DSUClient))
|
||||
return DSUClient;
|
||||
else if (str == to_string(SDLController))
|
||||
return SDLController;
|
||||
else if (str == "DSU") // legacy
|
||||
return DSUClient;
|
||||
|
||||
//else if (str == "WGIGamepad")
|
||||
// return WGIGamepad;
|
||||
//
|
||||
//else if (str == "WGIRawController")
|
||||
// return WGIRawController;
|
||||
|
||||
throw std::runtime_error(fmt::format("unknown input api: {}", str));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue