2015-04-13 11:16:33 +00:00
|
|
|
HotkeySettings::HotkeySettings(TabFrame* parent) : TabFrameItem(parent) {
|
|
|
|
setIcon(Icon::Device::Keyboard);
|
|
|
|
setText("Hotkeys");
|
|
|
|
|
|
|
|
layout.setMargin(5);
|
|
|
|
mappingList.setHeaderVisible();
|
|
|
|
mappingList.onActivate([&] { assignMapping(); });
|
|
|
|
mappingList.onChange([&] {
|
|
|
|
eraseButton.setEnabled((bool)mappingList.selected());
|
|
|
|
});
|
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
|
|
|
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 hotkey mappings?").setParent(*settingsManager).question() == "Yes") {
|
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
|
|
|
for(auto& mapping : inputManager->hotkeys) mapping->unbind();
|
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
});
|
2015-04-13 11:16:33 +00:00
|
|
|
eraseButton.setText("Erase").onActivate([&] {
|
|
|
|
if(auto item = mappingList.selected()) {
|
|
|
|
inputManager->hotkeys[item->offset()]->unbind();
|
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
reloadMappings();
|
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto HotkeySettings::reloadMappings() -> void {
|
|
|
|
mappingList.reset();
|
|
|
|
mappingList.append(ListViewColumn().setText("Name"));
|
2015-06-12 13:14:38 +00:00
|
|
|
mappingList.append(ListViewColumn().setText("Mapping").setExpandable());
|
2015-04-13 11:16:33 +00:00
|
|
|
mappingList.append(ListViewColumn().setText("Device"));
|
|
|
|
for(auto& hotkey : inputManager->hotkeys) {
|
2015-06-12 13:14:38 +00:00
|
|
|
mappingList.append(ListViewItem()
|
|
|
|
.append(ListViewCell().setText(hotkey->name))
|
|
|
|
.append(ListViewCell())
|
|
|
|
.append(ListViewCell())
|
|
|
|
);
|
2015-04-13 11:16:33 +00:00
|
|
|
}
|
|
|
|
mappingList.resizeColumns();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto HotkeySettings::refreshMappings() -> void {
|
|
|
|
unsigned position = 0;
|
|
|
|
for(auto& hotkey : inputManager->hotkeys) {
|
2015-06-12 13:14:38 +00:00
|
|
|
mappingList.item(position)->cell(1)->setText(hotkey->assignmentName());
|
|
|
|
mappingList.item(position)->cell(2)->setText(hotkey->deviceName());
|
|
|
|
position++;
|
2015-04-13 11:16:33 +00:00
|
|
|
}
|
|
|
|
mappingList.resizeColumns();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto HotkeySettings::assignMapping() -> void {
|
|
|
|
inputManager->poll(); //clear any pending events first
|
|
|
|
|
|
|
|
if(auto item = mappingList.selected()) {
|
|
|
|
activeMapping = inputManager->hotkeys[item->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);
|
2015-04-13 11:16:33 +00:00
|
|
|
settingsManager->statusBar.setText({"Press a key or button to map [", activeMapping->name, "] ..."});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-24 09:44:28 +00:00
|
|
|
auto HotkeySettings::inputEvent(shared_pointer<HID::Device> device, unsigned group, unsigned input, int16 oldValue, int16 newValue) -> void {
|
2015-04-13 11:16:33 +00:00
|
|
|
if(!activeMapping) return;
|
2015-05-24 09:44:28 +00:00
|
|
|
if(!device->isKeyboard() || oldValue != 0 || newValue != 1) return;
|
2015-04-13 11:16:33 +00:00
|
|
|
|
|
|
|
if(activeMapping->bind(device, group, input, oldValue, newValue)) {
|
|
|
|
activeMapping = nullptr;
|
|
|
|
settingsManager->statusBar.setText("");
|
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(true);
|
2015-04-13 11:16:33 +00:00
|
|
|
refreshMappings();
|
|
|
|
}
|
|
|
|
}
|