mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-27 11:00:47 +00:00
3016e595f0
byuu says: New terminal is in. Much nicer to use now. Command history makes a major difference in usability. The SMP is now fully traceable and debuggable. Basically they act as separate entities, you can trace both at the same time, but for the most part running and stepping is performed on the chip you select. I'm going to put off CPU+SMP interleave support for a while. I don't actually think it'll be too hard. Will get trickier if/when we support coprocessor debugging. Remaining tasks: - aliases - hotkeys - save states - window geometry Basically, the debugger's done. Just have to add the UI fluff. I also removed tracing/memory export from higan. It was always meant to be temporary until the debugger was remade.
121 lines
2.5 KiB
C++
121 lines
2.5 KiB
C++
#ifndef NALL_HID_HPP
|
|
#define NALL_HID_HPP
|
|
|
|
namespace nall {
|
|
|
|
namespace HID {
|
|
struct Input {
|
|
string name;
|
|
int16_t value = 0;
|
|
|
|
Input() {}
|
|
Input(const string& name) : name(name) {}
|
|
};
|
|
|
|
struct Group {
|
|
string name;
|
|
vector<Input> input;
|
|
|
|
Group() {}
|
|
Group(const string& name) : name(name) {}
|
|
|
|
void append(const string& name) {
|
|
input.append({name});
|
|
}
|
|
|
|
maybe<unsigned> find(const string& name) {
|
|
for(unsigned id = 0; id < input.size(); id++) {
|
|
if(input[id].name == name) return id;
|
|
}
|
|
return nothing;
|
|
}
|
|
};
|
|
|
|
struct Device {
|
|
uint64_t id = 0;
|
|
string name;
|
|
vector<Group> group;
|
|
|
|
uint32_t pathID() const { return (uint32_t)(id >> 32); }
|
|
uint32_t deviceID() const { return (uint32_t)(id >> 0); }
|
|
uint16_t vendorID() const { return (uint16_t)(id >> 16); }
|
|
uint16_t productID() const { return (uint16_t)(id >> 0); }
|
|
|
|
virtual bool isNull() const { return false; }
|
|
virtual bool isKeyboard() const { return false; }
|
|
virtual bool isMouse() const { return false; }
|
|
virtual bool isJoypad() const { return false; }
|
|
|
|
void append(const string& name) {
|
|
group.append({name});
|
|
}
|
|
|
|
maybe<unsigned> find(const string& name) {
|
|
for(unsigned id = 0; id < group.size(); id++) {
|
|
if(group[id].name == name) return id;
|
|
}
|
|
return nothing;
|
|
}
|
|
};
|
|
|
|
struct Null : Device {
|
|
Null() {
|
|
name = "Null";
|
|
}
|
|
|
|
bool isNull() const { return true; }
|
|
};
|
|
|
|
struct Keyboard : Device {
|
|
enum GroupID : unsigned { Button };
|
|
|
|
Group& button() { return group[GroupID::Button]; }
|
|
|
|
Keyboard() {
|
|
name = "Keyboard";
|
|
append("Button");
|
|
}
|
|
|
|
bool isKeyboard() const { return true; }
|
|
};
|
|
|
|
struct Mouse : Device {
|
|
enum GroupID : unsigned { Axis, Button };
|
|
|
|
Group& axis() { return group[GroupID::Axis]; }
|
|
Group& button() { return group[GroupID::Button]; }
|
|
|
|
Mouse() {
|
|
name = "Mouse";
|
|
append("Axis");
|
|
append("Button");
|
|
}
|
|
|
|
bool isMouse() const { return true; }
|
|
};
|
|
|
|
struct Joypad : Device {
|
|
enum GroupID : unsigned { Axis, Hat, Trigger, Button };
|
|
|
|
Group& axis() { return group[GroupID::Axis]; }
|
|
Group& hat() { return group[GroupID::Hat]; }
|
|
Group& trigger() { return group[GroupID::Trigger]; }
|
|
Group& button() { return group[GroupID::Button]; }
|
|
bool rumble = false;
|
|
|
|
Joypad() {
|
|
name = "Joypad";
|
|
append("Axis");
|
|
append("Hat");
|
|
append("Trigger");
|
|
append("Button");
|
|
}
|
|
|
|
bool isJoypad() const { return true; }
|
|
};
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|