2015-03-02 09:13:28 +00:00
|
|
|
InputSettings::InputSettings(TabFrame* parent) : TabFrameItem(parent) {
|
2016-01-07 08:14:33 +00:00
|
|
|
setIcon(Icon::Device::Joypad);
|
2015-03-02 09:13:28 +00:00
|
|
|
setText("Input");
|
|
|
|
|
|
|
|
layout.setMargin(5);
|
2016-01-15 10:28:51 +00:00
|
|
|
focusLabel.setText("When Focus is Lost:");
|
|
|
|
pauseEmulation.setText("Pause Emulation").setChecked(settings["Input/FocusLoss/Pause"].boolean()).onToggle([&] {
|
|
|
|
settings["Input/FocusLoss/Pause"].setValue(pauseEmulation.checked());
|
|
|
|
allowInput.setEnabled(!pauseEmulation.checked());
|
|
|
|
}).doToggle();
|
|
|
|
allowInput.setText("Allow Input").setChecked(settings["Input/FocusLoss/AllowInput"].boolean()).onToggle([&] {
|
|
|
|
settings["Input/FocusLoss/AllowInput"].setValue(allowInput.checked());
|
|
|
|
});
|
2015-03-02 09:13:28 +00:00
|
|
|
for(auto& emulator : inputManager->emulators) {
|
|
|
|
emulatorList.append(ComboButtonItem().setText(emulator.name));
|
|
|
|
}
|
|
|
|
emulatorList.onChange([&] { reloadPorts(); });
|
|
|
|
portList.onChange([&] { reloadDevices(); });
|
|
|
|
deviceList.onChange([&] { reloadMappings(); });
|
2015-04-13 11:16:33 +00:00
|
|
|
mappingList.onActivate([&] { assignMapping(); });
|
2015-05-23 05:29:18 +00:00
|
|
|
mappingList.onChange([&] { updateControls(); });
|
|
|
|
assignMouse1.setVisible(false).onActivate([&] { assignMouseInput(0); });
|
|
|
|
assignMouse2.setVisible(false).onActivate([&] { assignMouseInput(1); });
|
|
|
|
assignMouse3.setVisible(false).onActivate([&] { assignMouseInput(2); });
|
Update to v094r13 release.
byuu says:
This version polishes up the input dialogue (reset, erase, disable
button when item not focused, split device ID from mapping name), adds
color emulation toggle, and add dummy menu items for remaining features
(to be filled in later.)
Also, it now compiles cleanly on Windows with GTK.
I didn't test with TDM-GCC-32, because for god knows what reason, the
32-bit version ships with headers from Windows 95 OSR2 only. So I built
with TDM-GCC-64 with arch=x86.
And uh, apparently, moving or resizing a window causes a Visual C++
runtime exception in the GTK+ DLLs. This doesn't happen with trance or
renshuu built with TDM-GCC-32. So, yeah, like I said, don't use -m32.
2015-03-07 10:21:47 +00:00
|
|
|
resetButton.setText("Reset").onActivate([&] {
|
Update to v094r23 release.
byuu says:
The library window is gone, and replaced with
hiro::BrowserWindow::openFolder(). This gives navigation capabilities to
game loading, and it also completes our slotted cart selection code. As
an added bonus, it's less code this way, too.
I also set the window size to consistent sizes between all emulated
systems, so that switching between SFC and GB don't cause the window
size to keep changing, and so that the scaling size is consistent (eg at
normal scale, GB @ 3x is closer to SNES @ 2x.) This means black borders
in GB/GBA mode, but it doesn't look that bad, and it's not like many
people ever use these modes anyway.
Finally, added the placeholder tabs for video, audio and timing. I don't
intend to add the timing calculator code to v095 (it might be better as
a separate tool), but I'll add the ability to set video/audio rates, at
least.
Glitch 1: despite selecting the first item in the BrowserDialog list, if
you press enter when the window appears, it doesn't activate the item
until you press an arrow key first.
Glitch 2: in Game Boy mode, if you set the 4x window size, it's not
honoring the full requested height because the viewport is smaller than
the window. 8+ years of trying to get GTK+ and Qt to simply set the god
damned window size I ask for, and I still can't get them to do it
reliably.
Remaining issues:
- finish configuration panels (video, audio, timing)
- fix ruby driver compilation on Windows
- add DIP switch selection window (NSS) [I may end up punting this one
to v096]
2015-05-30 11:39:09 +00:00
|
|
|
if(MessageDialog("Are you sure you want to erase all mappings for this device?").setParent(*settingsManager).question() == "Yes") {
|
2016-06-26 08:54:12 +00:00
|
|
|
for(auto& mapping : activeDevice().mappings) mapping.unbind();
|
Update to v094r13 release.
byuu says:
This version polishes up the input dialogue (reset, erase, disable
button when item not focused, split device ID from mapping name), adds
color emulation toggle, and add dummy menu items for remaining features
(to be filled in later.)
Also, it now compiles cleanly on Windows with GTK.
I didn't test with TDM-GCC-32, because for god knows what reason, the
32-bit version ships with headers from Windows 95 OSR2 only. So I built
with TDM-GCC-64 with arch=x86.
And uh, apparently, moving or resizing a window causes a Visual C++
runtime exception in the GTK+ DLLs. This doesn't happen with trance or
renshuu built with TDM-GCC-32. So, yeah, like I said, don't use -m32.
2015-03-07 10:21:47 +00:00
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
eraseButton.setText("Erase").onActivate([&] {
|
|
|
|
if(auto mapping = mappingList.selected()) {
|
2016-06-26 08:54:12 +00:00
|
|
|
activeDevice().mappings[mapping.offset()].unbind();
|
Update to v094r13 release.
byuu says:
This version polishes up the input dialogue (reset, erase, disable
button when item not focused, split device ID from mapping name), adds
color emulation toggle, and add dummy menu items for remaining features
(to be filled in later.)
Also, it now compiles cleanly on Windows with GTK.
I didn't test with TDM-GCC-32, because for god knows what reason, the
32-bit version ships with headers from Windows 95 OSR2 only. So I built
with TDM-GCC-64 with arch=x86.
And uh, apparently, moving or resizing a window causes a Visual C++
runtime exception in the GTK+ DLLs. This doesn't happen with trance or
renshuu built with TDM-GCC-32. So, yeah, like I said, don't use -m32.
2015-03-07 10:21:47 +00:00
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
});
|
2015-04-13 11:16:33 +00:00
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
reloadPorts();
|
|
|
|
}
|
|
|
|
|
2015-05-23 05:29:18 +00:00
|
|
|
auto InputSettings::updateControls() -> void {
|
|
|
|
eraseButton.setEnabled((bool)mappingList.selected());
|
|
|
|
assignMouse1.setVisible(false);
|
|
|
|
assignMouse2.setVisible(false);
|
|
|
|
assignMouse3.setVisible(false);
|
|
|
|
|
|
|
|
if(auto mapping = mappingList.selected()) {
|
2016-06-26 08:54:12 +00:00
|
|
|
auto& input = activeDevice().mappings[mapping.offset()];
|
2015-05-23 05:29:18 +00:00
|
|
|
|
2016-06-26 08:54:12 +00:00
|
|
|
if(input.isDigital()) {
|
2015-05-23 05:29:18 +00:00
|
|
|
assignMouse1.setVisible().setText("Mouse Left");
|
|
|
|
assignMouse2.setVisible().setText("Mouse Middle");
|
|
|
|
assignMouse3.setVisible().setText("Mouse Right");
|
2016-06-26 08:54:12 +00:00
|
|
|
} else if(input.isAnalog()) {
|
2015-05-23 05:29:18 +00:00
|
|
|
assignMouse1.setVisible().setText("Mouse X-axis");
|
|
|
|
assignMouse2.setVisible().setText("Mouse Y-axis");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
auto InputSettings::activeEmulator() -> InputEmulator& {
|
2015-12-21 09:16:47 +00:00
|
|
|
return inputManager->emulators[emulatorList.selected().offset()];
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::activePort() -> InputPort& {
|
2015-12-21 09:16:47 +00:00
|
|
|
return activeEmulator().ports[portList.selected().offset()];
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::activeDevice() -> InputDevice& {
|
2015-12-21 09:16:47 +00:00
|
|
|
auto index = deviceList.selected().property("index").natural();
|
|
|
|
return activePort().devices[index];
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::reloadPorts() -> void {
|
|
|
|
portList.reset();
|
|
|
|
for(auto& port : activeEmulator().ports) {
|
|
|
|
portList.append(ComboButtonItem().setText(port.name));
|
|
|
|
}
|
|
|
|
reloadDevices();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::reloadDevices() -> void {
|
|
|
|
deviceList.reset();
|
2015-12-21 09:16:47 +00:00
|
|
|
for(auto n : range(activePort().devices)) {
|
|
|
|
auto& device = activePort().devices[n];
|
|
|
|
if(!device.mappings) continue; //do not display devices that have no configurable inputs
|
|
|
|
deviceList.append(ComboButtonItem().setText(device.name).setProperty("index", n));
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
reloadMappings();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::reloadMappings() -> void {
|
Update to v094r13 release.
byuu says:
This version polishes up the input dialogue (reset, erase, disable
button when item not focused, split device ID from mapping name), adds
color emulation toggle, and add dummy menu items for remaining features
(to be filled in later.)
Also, it now compiles cleanly on Windows with GTK.
I didn't test with TDM-GCC-32, because for god knows what reason, the
32-bit version ships with headers from Windows 95 OSR2 only. So I built
with TDM-GCC-64 with arch=x86.
And uh, apparently, moving or resizing a window causes a Visual C++
runtime exception in the GTK+ DLLs. This doesn't happen with trance or
renshuu built with TDM-GCC-32. So, yeah, like I said, don't use -m32.
2015-03-07 10:21:47 +00:00
|
|
|
eraseButton.setEnabled(false);
|
2015-03-02 09:13:28 +00:00
|
|
|
mappingList.reset();
|
2016-05-04 10:07:13 +00:00
|
|
|
mappingList.append(TableViewHeader().setVisible()
|
|
|
|
.append(TableViewColumn().setText("Name"))
|
|
|
|
.append(TableViewColumn().setText("Mapping").setExpandable())
|
Update to v094r40 release.
byuu says:
Changelog:
- updated to newest hiro API
- SFC performance profile builds once again
- hiro: Qt port completed
Errata 1: the hiro/Qt target won't run tomoko just yet. Starts by
crashing inside InputSettings because hiro/Qt isn't forcefully selecting
the first item added to a ComboButton just yet. Even with a monkey patch
to get around that, the UI is incredibly unstable. Lots of geometry
calculation bugs, and a crash when you try and access certain folders in
the browser dialog. Lots of work left to be done there, sadly.
Errata 2: the hiro/Windows port has black backgrounds on all ListView
items. It's because I need to test for unassigned colors and grab the
default Windows brush colors in those cases.
Note: alternating row colors on multi-column ListView widgets is gone
now. Not a bug. May add it back later, but I'm not sure. It doesn't
interact nicely with per-cell background colors.
Things left to do:
First, I have to fix the Windows and Qt target bugs.
Next, I need to go through and revise the hiro API even more (nothing
too major.)
Next, I need to update icarus to use the new hiro API, and add support
for the SFC games database.
Next, I have to rewrite my TSV->BML cheat code tool.
Next, I need to post a final WIP of higan+icarus publicly and wait a few
days.
Next, I need to fix any bugs reported from the final WIP that I can.
Finally, I should be able to release v095.
2015-08-18 10:18:00 +00:00
|
|
|
);
|
2015-03-02 09:13:28 +00:00
|
|
|
for(auto& mapping : activeDevice().mappings) {
|
2016-05-04 10:07:13 +00:00
|
|
|
mappingList.append(TableViewItem()
|
2016-06-26 08:54:12 +00:00
|
|
|
.append(TableViewCell().setText(mapping.name))
|
2016-05-04 10:07:13 +00:00
|
|
|
.append(TableViewCell())
|
2015-06-12 13:14:38 +00:00
|
|
|
);
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::refreshMappings() -> void {
|
2015-12-21 09:16:47 +00:00
|
|
|
uint position = 0;
|
2015-03-02 09:13:28 +00:00
|
|
|
for(auto& mapping : activeDevice().mappings) {
|
Update to v102r21 release.
byuu says:
Changelog:
- GBA: fixed WININ2 reads, BG3PB writes [Jonas Quinn]
- R65816: added support for yielding/resuming from WAI/STP¹
- SFC: removed status.dmaCounter functionality (also fixes possible
TAS desync issue)
- tomoko: added support for combinatorial inputs [hex\_usr\]²
- nall: fixed missing return value from Arithmetic::operator--
[Hendricks266]
Now would be the time to start looking for major regressions with the
new GBA PPU renderer, I suppose ...
¹: this doesn't matter for the master thread (SNES CPU), but is
important for slave threads (SNES SA1). If you try to save a state and
the SA1 is inside of a WAI instruction, it will get stuck there forever.
This was causing attempts to create a save state in Super Bomberman
- Panic Bomber W to deadlock the emulator and crash it. This is now
finally fixed.
Note that I still need to implement similar functionality into the Mega
Drive 68K and Z80 cores. They still have the possibility of deadlocking.
The SNES implementation was more a dry-run test for this new
functionality. This possible crashing bug in the Mega Drive core is the
major blocking bug for a new official release.
²: many, many thanks to hex\_usr for coming up with a really nice
design. I mostly implemented it the exact same way, but with a few tiny
differences that don't really matter (display " and ", " or " instead of
" & ", " | " in the input settings windows; append → bind;
assignmentName changed to displayName.)
The actual functionality is identical to the old higan v094 and earlier
builds. Emulated digital inputs let you combine multiple possible keys
to trigger the buttons. This is OR logic, so you can map to eg
keyboard.up OR gamepad.up for instance. Emulated analog inputs always
sum together. Emulated rumble outputs will cause all mapped devices to
rumble, which is probably not at all useful but whatever. Hotkeys use
AND logic, so you have to press every key mapped to trigger them. Useful
for eg Ctrl+F to trigger fullscreen.
Obviously, there are cases where OR logic would be nice for hotkeys,
too. Eg if you want both F11 and your gamepad's guide button to trigger
the fullscreen toggle. Unfortunately, this isn't supported, and likely
won't ever be in tomoko. Something I might consider is a throw switch in
the configuration file to swap between AND or OR logic for hotkeys, but
I'm not going to allow construction of mappings like "(Keyboard.Ctrl and
Keyboard.F) or Gamepad.Guide", as that's just too complicated to code,
and too complicated to make a nice GUI to set up the mappings for.
2017-06-06 13:44:40 +00:00
|
|
|
mappingList.item(position).cell(1).setText(mapping.displayName());
|
2015-06-12 13:14:38 +00:00
|
|
|
position++;
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
mappingList.resizeColumns();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto InputSettings::assignMapping() -> void {
|
|
|
|
inputManager->poll(); //clear any pending events first
|
|
|
|
|
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
|
|
|
if(auto mapping = mappingList.selected()) {
|
2016-06-26 08:54:12 +00:00
|
|
|
activeMapping = &activeDevice().mappings[mapping.offset()];
|
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
|
|
|
settingsManager->layout.setEnabled(false);
|
|
|
|
settingsManager->statusBar.setText({"Press a key or button to map [", activeMapping->name, "] ..."});
|
|
|
|
}
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
|
2015-12-21 09:16:47 +00:00
|
|
|
auto InputSettings::assignMouseInput(uint id) -> void {
|
2015-05-23 05:29:18 +00:00
|
|
|
if(auto mouse = inputManager->findMouse()) {
|
|
|
|
if(auto mapping = mappingList.selected()) {
|
2016-06-26 08:54:12 +00:00
|
|
|
activeMapping = &activeDevice().mappings[mapping.offset()];
|
2015-05-23 05:29:18 +00:00
|
|
|
|
|
|
|
if(activeMapping->isDigital()) {
|
2015-05-24 09:44:28 +00:00
|
|
|
return inputEvent(mouse, HID::Mouse::GroupID::Button, id, 0, 1, true);
|
2015-05-23 05:29:18 +00:00
|
|
|
} else if(activeMapping->isAnalog()) {
|
2015-05-24 09:44:28 +00:00
|
|
|
return inputEvent(mouse, HID::Mouse::GroupID::Axis, id, 0, +32767, true);
|
2015-05-23 05:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-21 09:16:47 +00:00
|
|
|
auto InputSettings::inputEvent(shared_pointer<HID::Device> device, uint group, uint input, int16 oldValue, int16 newValue, bool allowMouseInput) -> void {
|
2015-03-02 09:13:28 +00:00
|
|
|
if(!activeMapping) return;
|
2015-05-24 09:44:28 +00:00
|
|
|
if(device->isMouse() && !allowMouseInput) return;
|
2015-03-02 09:13:28 +00:00
|
|
|
|
|
|
|
if(activeMapping->bind(device, group, input, oldValue, newValue)) {
|
|
|
|
activeMapping = nullptr;
|
2016-01-08 09:23:46 +00:00
|
|
|
settingsManager->statusBar.setText("Mapping assigned.");
|
2015-03-02 09:13:28 +00:00
|
|
|
refreshMappings();
|
2016-01-08 09:23:46 +00:00
|
|
|
timer.onActivate([&] {
|
|
|
|
timer.setEnabled(false);
|
|
|
|
settingsManager->statusBar.setText();
|
|
|
|
settingsManager->layout.setEnabled();
|
Update to v096r07 release.
byuu says:
Changelog:
- configuration files are now stored in localpath() instead of configpath()
- Video gamma/saturation/luminance sliders are gone now, sorry
- added Video Filter->Blur Emulation [1]
- added Video Filter->Scanline Emulation [2]
- improvements to GBA audio emulation (fixes Minish Cap) [Jonas Quinn]
[1] For the Famicom, this does nothing. For the Super Famicom, this
performs horizontal blending for proper pseudo-hires translucency. For
the Game Boy, Game Boy Color, and Game Boy Advance, this performs
interframe blending (each frame is the average of the current and
previous frame), which is important for things like the GBVideoPlayer.
[2] Right now, this only applies to the Super Famicom, but it'll come to
the Famicom in the future. For the Super Famicom, this option doesn't
just add scanlines, it simulates the phosphor decay that's visible in
interlace mode. If you observe an interlaced game like RPM Racing on
a real SNES, you'll notice that even on perfectly still screens, the
image appears to shake. This option emulates that effect.
Note 1: the buffering right now is a little sub-optimal, so there will
be a slight speed hit with this new support. Since the core is now
generating native ARGB8888 colors, it might as well call out to the
interface to lock/unlock/refresh the video, that way it can render
directly to the screen. Although ... that might not be such a hot idea,
since the GBx interframe blending reads from the target buffer, and that
tends to be a catastrophic option for performance.
Note 2: the balanced and performance profiles for the SNES are
completely busted again. This WIP took 6 1/2 hours, and I'm exhausted.
Very much not looking forward to working on those, since those two have
all kinds of fucked up speedup tricks for non-interlaced and/or
non-hires video modes.
Note 3: if you're on Windows and you saved your system folders somewhere
else, now'd be a good time to move them to %localappdata%/higan
2016-01-15 10:06:51 +00:00
|
|
|
}).setInterval(200).setEnabled();
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
}
|