2016-01-07 08:14:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
/* ruby
|
|
|
|
* author: byuu
|
|
|
|
* license: ISC
|
2016-04-18 10:49:45 +00:00
|
|
|
* version: 0.15 (2016-04-18)
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
*
|
2016-04-18 10:49:45 +00:00
|
|
|
* ruby is a cross-platform hardware abstraction layer.
|
|
|
|
* it provides a common interface to video, audio and input devices.
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
*/
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-04-09 13:31:46 +00:00
|
|
|
#include <nall/nall.hpp>
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
namespace ruby {
|
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
struct Video {
|
|
|
|
static const nall::string Handle;
|
|
|
|
static const nall::string Synchronize;
|
|
|
|
static const nall::string Depth;
|
|
|
|
static const nall::string Filter;
|
|
|
|
static const nall::string Shader;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
static const unsigned FilterNearest;
|
|
|
|
static const unsigned FilterLinear;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
static auto create(const nall::string& driver = "") -> Video*;
|
|
|
|
static auto optimalDriver() -> nall::string;
|
|
|
|
static auto safestDriver() -> nall::string;
|
2016-07-01 11:58:12 +00:00
|
|
|
static auto availableDrivers() -> nall::string_vector;
|
Update to v094r22 release.
byuu says:
I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.
I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.
I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.
I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)
I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.
Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
- add more configuration panels (video, audio, timing)
2015-05-25 12:23:49 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual ~Video() = default;
|
Update to v094r22 release.
byuu says:
I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.
I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.
I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.
I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)
I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.
Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
- add more configuration panels (video, audio, timing)
2015-05-25 12:23:49 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto cap(const nall::string& name) -> bool { return false; }
|
|
|
|
virtual auto get(const nall::string& name) -> nall::any { return false; }
|
|
|
|
virtual auto set(const nall::string& name, const nall::any& value) -> bool { return false; }
|
Update to v094r22 release.
byuu says:
I fixed the hiro layout enable bug, so when you go to assign joypad
input, the window disables itself so your input doesn't mess with the
controls.
I added "reset" to the hotkeys, in case you feel like clearing all of
them at once.
I added device selection support and the ability to disable audio
synchronization (run > 60fps) to the ruby/OSS driver. This is exposed in
tomoko's configuration file.
I added checks to stringify so that assigning null char* strings to
nall::string won't cause crashes anymore (technically the crash was in
strlen(), which doesn't check for null strings, but whatever ... I'll do
the check myself.)
I hooked up BrowserDialog::folderSelect() to loading slotted media for
now. Tested it by loading a Game Boy game successfully through the Super
Game Boy. Definitely want to write a custom window for this though, that
looks more like the library dialog.
Remaining issues:
- finish slotted cart loader (SGB, BSX, ST)
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
- add more configuration panels (video, audio, timing)
2015-05-25 12:23:49 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool { return false; }
|
|
|
|
virtual auto unlock() -> void {}
|
|
|
|
virtual auto clear() -> void {}
|
|
|
|
virtual auto refresh() -> void {}
|
|
|
|
|
|
|
|
virtual auto init() -> bool { return true; }
|
|
|
|
virtual auto term() -> void {}
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
struct Audio {
|
|
|
|
static const nall::string Device;
|
2015-11-21 07:36:48 +00:00
|
|
|
static const nall::string Exclusive;
|
2015-06-20 05:44:05 +00:00
|
|
|
static const nall::string Handle;
|
|
|
|
static const nall::string Synchronize;
|
|
|
|
static const nall::string Frequency;
|
|
|
|
static const nall::string Latency;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
static auto create(const nall::string& driver = "") -> Audio*;
|
|
|
|
static auto optimalDriver() -> nall::string;
|
|
|
|
static auto safestDriver() -> nall::string;
|
2016-07-01 11:58:12 +00:00
|
|
|
static auto availableDrivers() -> nall::string_vector;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual ~Audio() = default;
|
2013-12-21 10:45:58 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto cap(const nall::string& name) -> bool { return false; }
|
|
|
|
virtual auto get(const nall::string& name) -> nall::any { return false; }
|
|
|
|
virtual auto set(const nall::string& name, const nall::any& value) -> bool { return false; }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-04-18 10:49:45 +00:00
|
|
|
virtual auto sample(int16_t left, int16_t right) -> void {}
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto clear() -> void {}
|
|
|
|
|
|
|
|
virtual auto init() -> bool { return true; }
|
|
|
|
virtual auto term() -> void {}
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
struct Input {
|
|
|
|
static const nall::string Handle;
|
|
|
|
static const nall::string KeyboardSupport;
|
|
|
|
static const nall::string MouseSupport;
|
|
|
|
static const nall::string JoypadSupport;
|
|
|
|
static const nall::string JoypadRumbleSupport;
|
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
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
static auto create(const nall::string& driver = "") -> Input*;
|
|
|
|
static auto optimalDriver() -> nall::string;
|
|
|
|
static auto safestDriver() -> nall::string;
|
2016-07-01 11:58:12 +00:00
|
|
|
static auto availableDrivers() -> nall::string_vector;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual ~Input() = default;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto cap(const nall::string& name) -> bool { return false; }
|
|
|
|
virtual auto get(const nall::string& name) -> nall::any { return false; }
|
|
|
|
virtual auto set(const nall::string& name, const nall::any& value) -> bool { return false; }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto acquire() -> bool { return false; }
|
|
|
|
virtual auto release() -> bool { return false; }
|
|
|
|
virtual auto acquired() -> bool { return false; }
|
|
|
|
virtual auto poll() -> nall::vector<nall::shared_pointer<nall::HID::Device>> { return {}; }
|
|
|
|
virtual auto rumble(uint64_t id, bool enable) -> bool { return false; }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
virtual auto init() -> bool { return true; }
|
|
|
|
virtual auto term() -> void {}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
auto onChange(const nall::function<void (nall::shared_pointer<nall::HID::Device>, unsigned, unsigned, int16_t, int16_t)>& callback) { _onChange = callback; }
|
|
|
|
auto doChange(nall::shared_pointer<nall::HID::Device> device, unsigned group, unsigned input, int16_t oldValue, int16_t newValue) -> void {
|
|
|
|
if(_onChange) _onChange(device, group, input, oldValue, newValue);
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
private:
|
|
|
|
nall::function<void (nall::shared_pointer<nall::HID::Device> device, unsigned group, unsigned input, int16_t oldValue, int16_t newValue)> _onChange;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2015-06-20 05:44:05 +00:00
|
|
|
}
|