2010-08-09 13:28:56 +00:00
|
|
|
/*
|
|
|
|
ruby
|
2013-12-21 10:45:58 +00:00
|
|
|
version: 0.11 (2013-12-19)
|
2010-08-09 13:28:56 +00:00
|
|
|
license: public domain
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RUBY_H
|
|
|
|
#define RUBY_H
|
|
|
|
|
2013-04-09 13:31:46 +00:00
|
|
|
#include <nall/nall.hpp>
|
2010-08-09 13:28:56 +00:00
|
|
|
#include <nall/input.hpp>
|
|
|
|
|
|
|
|
namespace ruby {
|
|
|
|
|
|
|
|
#include <ruby/video.hpp>
|
|
|
|
#include <ruby/audio.hpp>
|
|
|
|
#include <ruby/input.hpp>
|
|
|
|
|
2011-09-29 12:08:22 +00:00
|
|
|
struct VideoInterface {
|
2013-05-02 11:25:45 +00:00
|
|
|
void driver(const char* driver = "");
|
2013-07-29 09:42:45 +00:00
|
|
|
const char* optimalDriver();
|
|
|
|
const char* safestDriver();
|
|
|
|
const char* availableDrivers();
|
2010-08-09 13:28:56 +00:00
|
|
|
bool init();
|
|
|
|
void term();
|
|
|
|
|
|
|
|
bool cap(const nall::string& name);
|
|
|
|
nall::any get(const nall::string& name);
|
|
|
|
bool set(const nall::string& name, const nall::any& value);
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height);
|
2010-08-09 13:28:56 +00:00
|
|
|
void unlock();
|
|
|
|
void clear();
|
|
|
|
void refresh();
|
2013-12-21 10:45:58 +00:00
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
VideoInterface();
|
|
|
|
~VideoInterface();
|
|
|
|
|
|
|
|
private:
|
2013-05-02 11:25:45 +00:00
|
|
|
Video* p = nullptr;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2011-09-29 12:08:22 +00:00
|
|
|
struct AudioInterface {
|
2013-05-02 11:25:45 +00:00
|
|
|
void driver(const char* driver = "");
|
2013-07-29 09:42:45 +00:00
|
|
|
const char* optimalDriver();
|
|
|
|
const char* safestDriver();
|
|
|
|
const char* availableDrivers();
|
2010-08-09 13:28:56 +00:00
|
|
|
bool init();
|
|
|
|
void term();
|
|
|
|
|
|
|
|
bool cap(const nall::string& name);
|
|
|
|
nall::any get(const nall::string& name);
|
|
|
|
bool set(const nall::string& name, const nall::any& value);
|
|
|
|
|
|
|
|
void sample(uint16_t left, uint16_t right);
|
|
|
|
void clear();
|
2013-12-21 10:45:58 +00:00
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
AudioInterface();
|
|
|
|
~AudioInterface();
|
|
|
|
|
|
|
|
private:
|
2013-05-02 11:25:45 +00:00
|
|
|
Audio* p = nullptr;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2011-09-29 12:08:22 +00:00
|
|
|
struct InputInterface {
|
Update to v093r12 release.
byuu says:
I've completely redone the ethos InputManager and ruby to work on
HID::Device objects instead of one giant scancode pool.
Currently only the udev driver supports the changes to ruby, so only
Linux users will be able to compile and run this WIP build.
The nice thing about the new system is that it's now possible to
uniquely identify controllers, so if you swap out gamepads, you won't
end up with it working but with all the mappings all screwed up. Since
higan lets you map multiple physical inputs to one emulated input, you
can now configure your keyboard and multiple gamepads to the same
emulated input, and then just use whatever controller you want.
Because USB gamepad makers failed to provide unique serial#s with each
controller, we have to limit the mapping to specific USB ports.
Otherwise, we couldn't distinguish two otherwise identical gamepads. So
basically your computer USB ports act like real game console input port
numbers. Which is kind of neat, I guess.
And the really nice thing about the new system is that we now have the
capability to support hotplugging input devices. I haven't yet added
this to any drivers, but I'm definitely going to add it to udev for v094
official.
Finally, with the device ID (vendor ID + product ID) exposed, we gain
one last really cool feature that we may be able to develop more in the
future. Say we created a joypad.bml file to include with higan. In it,
we'd store the Xbox 360 controller, and pre-defined button mappings for
each emulated system. So if higan detects you have an Xbox 360
controller, you can just plug it in and use it. Even better, we can
clearly specify the difference between triggers and analog axes, and
name each individual input. So you'd see "Xbox 360 Gamepad #1: Left
Trigger" instead of higan v093's "JP0::Axis2.Hi"
Note: for right now, ethos' input manager isn't filtering the device IDs
to look pretty. So you're going to see a 64-bit hex value for a device
ID right now instead of something like Joypad#N for now.
2013-12-23 11:43:51 +00:00
|
|
|
nall::function<void (nall::HID::Device& device, unsigned group, unsigned input, int16_t oldValue, int16_t newValue)> onChange;
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void driver(const char* driver = "");
|
2013-07-29 09:42:45 +00:00
|
|
|
const char* optimalDriver();
|
|
|
|
const char* safestDriver();
|
|
|
|
const char* availableDrivers();
|
2010-08-09 13:28:56 +00:00
|
|
|
bool init();
|
|
|
|
void term();
|
|
|
|
|
|
|
|
bool cap(const nall::string& name);
|
|
|
|
nall::any get(const nall::string& name);
|
|
|
|
bool set(const nall::string& name, const nall::any& value);
|
|
|
|
|
|
|
|
bool acquire();
|
|
|
|
bool unacquire();
|
|
|
|
bool acquired();
|
|
|
|
|
Update to v093r12 release.
byuu says:
I've completely redone the ethos InputManager and ruby to work on
HID::Device objects instead of one giant scancode pool.
Currently only the udev driver supports the changes to ruby, so only
Linux users will be able to compile and run this WIP build.
The nice thing about the new system is that it's now possible to
uniquely identify controllers, so if you swap out gamepads, you won't
end up with it working but with all the mappings all screwed up. Since
higan lets you map multiple physical inputs to one emulated input, you
can now configure your keyboard and multiple gamepads to the same
emulated input, and then just use whatever controller you want.
Because USB gamepad makers failed to provide unique serial#s with each
controller, we have to limit the mapping to specific USB ports.
Otherwise, we couldn't distinguish two otherwise identical gamepads. So
basically your computer USB ports act like real game console input port
numbers. Which is kind of neat, I guess.
And the really nice thing about the new system is that we now have the
capability to support hotplugging input devices. I haven't yet added
this to any drivers, but I'm definitely going to add it to udev for v094
official.
Finally, with the device ID (vendor ID + product ID) exposed, we gain
one last really cool feature that we may be able to develop more in the
future. Say we created a joypad.bml file to include with higan. In it,
we'd store the Xbox 360 controller, and pre-defined button mappings for
each emulated system. So if higan detects you have an Xbox 360
controller, you can just plug it in and use it. Even better, we can
clearly specify the difference between triggers and analog axes, and
name each individual input. So you'd see "Xbox 360 Gamepad #1: Left
Trigger" instead of higan v093's "JP0::Axis2.Hi"
Note: for right now, ethos' input manager isn't filtering the device IDs
to look pretty. So you're going to see a 64-bit hex value for a device
ID right now instead of something like Joypad#N for now.
2013-12-23 11:43:51 +00:00
|
|
|
nall::vector<nall::HID::Device*> poll();
|
2013-05-02 11:25:45 +00:00
|
|
|
bool poll(int16_t* table);
|
Update to v093r12 release.
byuu says:
I've completely redone the ethos InputManager and ruby to work on
HID::Device objects instead of one giant scancode pool.
Currently only the udev driver supports the changes to ruby, so only
Linux users will be able to compile and run this WIP build.
The nice thing about the new system is that it's now possible to
uniquely identify controllers, so if you swap out gamepads, you won't
end up with it working but with all the mappings all screwed up. Since
higan lets you map multiple physical inputs to one emulated input, you
can now configure your keyboard and multiple gamepads to the same
emulated input, and then just use whatever controller you want.
Because USB gamepad makers failed to provide unique serial#s with each
controller, we have to limit the mapping to specific USB ports.
Otherwise, we couldn't distinguish two otherwise identical gamepads. So
basically your computer USB ports act like real game console input port
numbers. Which is kind of neat, I guess.
And the really nice thing about the new system is that we now have the
capability to support hotplugging input devices. I haven't yet added
this to any drivers, but I'm definitely going to add it to udev for v094
official.
Finally, with the device ID (vendor ID + product ID) exposed, we gain
one last really cool feature that we may be able to develop more in the
future. Say we created a joypad.bml file to include with higan. In it,
we'd store the Xbox 360 controller, and pre-defined button mappings for
each emulated system. So if higan detects you have an Xbox 360
controller, you can just plug it in and use it. Even better, we can
clearly specify the difference between triggers and analog axes, and
name each individual input. So you'd see "Xbox 360 Gamepad #1: Left
Trigger" instead of higan v093's "JP0::Axis2.Hi"
Note: for right now, ethos' input manager isn't filtering the device IDs
to look pretty. So you're going to see a 64-bit hex value for a device
ID right now instead of something like Joypad#N for now.
2013-12-23 11:43:51 +00:00
|
|
|
void rumble(uint64_t id, bool enable);
|
2013-12-21 10:45:58 +00:00
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
InputInterface();
|
|
|
|
~InputInterface();
|
|
|
|
|
|
|
|
private:
|
2013-05-02 11:25:45 +00:00
|
|
|
Input* p = nullptr;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern VideoInterface video;
|
|
|
|
extern AudioInterface audio;
|
|
|
|
extern InputInterface input;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|