mirror of https://github.com/bsnes-emu/bsnes.git
Update to v077r04 release.
byuu says: Changelog: - setGeometry is called after append(layout) now. This fixes the window sizing on Qt. - removed enum Style {} code, as it's no longer necessary. - removed Filter, Shader path selection code from the file load dialog, since that is menu-driven now. - improved the file load dialog to remember last selected file when mode doesn't change (had to split a switch statement into two switches.) - added Hotkeys port onto input settings window, allowing one to dynamically see and remap GUI shortcuts - added power cycle / reset shortcuts Still very minimal with the hotkeys, so I packed them all into one group for now. A few more I'd like to add, but I don't want to get ridiculous like with the Qt GUI.
This commit is contained in:
parent
2bf3dbf375
commit
721e0b1762
|
@ -102,6 +102,10 @@ Widget::Widget(pWidget &p) : state(*new State), p(p) { p.constructor(); }
|
|||
void Button::setText(const string &text) { state.text = text; return p.setText(text); }
|
||||
Button::Button() : state(*new State), base_from_member<pButton&>(*new pButton(*this)), Widget(base_from_member<pButton&>::value), p(base_from_member<pButton&>::value) { p.constructor(); }
|
||||
|
||||
uint32_t* Canvas::buffer() { return p.buffer(); }
|
||||
void Canvas::update() { return p.update(); }
|
||||
Canvas::Canvas() : base_from_member<pCanvas&>(*new pCanvas(*this)), Widget(base_from_member<pCanvas&>::value), p(base_from_member<pCanvas&>::value) { p.constructor(); }
|
||||
|
||||
bool CheckBox::checked() { return p.checked(); }
|
||||
void CheckBox::setChecked(bool checked) { state.checked = checked; return p.setChecked(checked); }
|
||||
void CheckBox::setText(const string &text) { state.text = text; return p.setText(text); }
|
||||
|
|
|
@ -16,6 +16,7 @@ struct pRadioItem;
|
|||
struct pLayout;
|
||||
struct pWidget;
|
||||
struct pButton;
|
||||
struct pCanvas;
|
||||
struct pCheckBox;
|
||||
struct pComboBox;
|
||||
struct pHexEdit;
|
||||
|
@ -235,6 +236,14 @@ struct Button : private nall::base_from_member<pButton&>, Widget {
|
|||
pButton &p;
|
||||
};
|
||||
|
||||
struct Canvas : private nall::base_from_member<pCanvas&>, Widget {
|
||||
uint32_t* buffer();
|
||||
void update();
|
||||
|
||||
Canvas();
|
||||
pCanvas &p;
|
||||
};
|
||||
|
||||
struct CheckBox : private nall::base_from_member<pCheckBox&>, Widget {
|
||||
nall::function<void ()> onTick;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "widget/widget.cpp"
|
||||
#include "widget/button.cpp"
|
||||
#include "widget/canvas.cpp"
|
||||
#include "widget/check-box.cpp"
|
||||
#include "widget/combo-box.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
|
|
|
@ -173,7 +173,7 @@ struct pWidget : public pObject {
|
|||
void setEnabled(bool enabled);
|
||||
virtual void setFocused();
|
||||
virtual void setFont(Font &font);
|
||||
void setGeometry(const Geometry &geometry);
|
||||
virtual void setGeometry(const Geometry &geometry);
|
||||
void setVisible(bool visible);
|
||||
|
||||
pWidget(Widget &widget) : widget(widget) {}
|
||||
|
@ -190,6 +190,20 @@ struct pButton : public pWidget {
|
|||
void constructor();
|
||||
};
|
||||
|
||||
struct pCanvas : public pWidget {
|
||||
Canvas &canvas;
|
||||
uint32_t *bufferRGB;
|
||||
uint32_t *bufferBGR;
|
||||
|
||||
uint32_t* buffer();
|
||||
void setGeometry(const Geometry &geometry);
|
||||
void update();
|
||||
|
||||
pCanvas(Canvas &canvas) : pWidget(canvas), canvas(canvas) {}
|
||||
void constructor();
|
||||
void redraw();
|
||||
};
|
||||
|
||||
struct pCheckBox : public pWidget {
|
||||
CheckBox &checkBox;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "widget/widget.cpp"
|
||||
#include "widget/button.cpp"
|
||||
#include "widget/canvas.cpp"
|
||||
#include "widget/check-box.cpp"
|
||||
#include "widget/combo-box.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'qt.moc.hpp'
|
||||
**
|
||||
** Created: Wed Mar 23 03:03:27 2011
|
||||
** Created: Wed Mar 23 16:17:23 2011
|
||||
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
|
@ -311,6 +311,57 @@ int pButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|||
}
|
||||
return _id;
|
||||
}
|
||||
static const uint qt_meta_data_pCanvas[] = {
|
||||
|
||||
// content:
|
||||
5, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
0, 0, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
0, // flags
|
||||
0, // signalCount
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_pCanvas[] = {
|
||||
"pCanvas\0"
|
||||
};
|
||||
|
||||
const QMetaObject pCanvas::staticMetaObject = {
|
||||
{ &QObject::staticMetaObject, qt_meta_stringdata_pCanvas,
|
||||
qt_meta_data_pCanvas, 0 }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &pCanvas::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *pCanvas::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *pCanvas::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_pCanvas))
|
||||
return static_cast<void*>(const_cast< pCanvas*>(this));
|
||||
if (!strcmp(_clname, "pWidget"))
|
||||
return static_cast< pWidget*>(const_cast< pCanvas*>(this));
|
||||
return QObject::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int pCanvas::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QObject::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
return _id;
|
||||
}
|
||||
static const uint qt_meta_data_pCheckBox[] = {
|
||||
|
||||
// content:
|
||||
|
|
|
@ -200,7 +200,7 @@ struct pWidget : public pObject {
|
|||
void setEnabled(bool enabled);
|
||||
void setFocused();
|
||||
void setFont(Font &font);
|
||||
void setGeometry(const Geometry &geometry);
|
||||
virtual void setGeometry(const Geometry &geometry);
|
||||
void setVisible(bool visible);
|
||||
|
||||
pWidget(Widget &widget) : widget(widget) {}
|
||||
|
@ -224,6 +224,28 @@ public slots:
|
|||
void onTick();
|
||||
};
|
||||
|
||||
struct pCanvas : public QObject, public pWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Canvas &canvas;
|
||||
QImage *qtImage;
|
||||
struct QtCanvas : public QWidget {
|
||||
pCanvas &self;
|
||||
void paintEvent(QPaintEvent*);
|
||||
QtCanvas(pCanvas &self);
|
||||
} *qtCanvas;
|
||||
|
||||
uint32_t* buffer();
|
||||
void setGeometry(const Geometry &geometry);
|
||||
void update();
|
||||
|
||||
pCanvas(Canvas &canvas) : pWidget(canvas), canvas(canvas) {}
|
||||
void constructor();
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
struct pCheckBox : public QObject, public pWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "widget/widget.cpp"
|
||||
#include "widget/button.cpp"
|
||||
#include "widget/canvas.cpp"
|
||||
#include "widget/check-box.cpp"
|
||||
#include "widget/combo-box.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
|
@ -183,6 +184,18 @@ void pOS::initialize() {
|
|||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
RegisterClass(&wc);
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
|
||||
wc.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.lpfnWndProc = Canvas_windowProc;
|
||||
wc.lpszClassName = L"phoenix_canvas";
|
||||
wc.lpszMenuName = 0;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
RegisterClass(&wc);
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
|
||||
|
|
|
@ -182,6 +182,19 @@ struct pButton : public pWidget {
|
|||
void setParent(Window &parent);
|
||||
};
|
||||
|
||||
struct pCanvas : public pWidget {
|
||||
Canvas &canvas;
|
||||
uint32_t *bufferRGB;
|
||||
|
||||
uint32_t* buffer();
|
||||
void setGeometry(const Geometry &geometry);
|
||||
void update();
|
||||
|
||||
pCanvas(Canvas &canvas) : pWidget(canvas), canvas(canvas) {}
|
||||
void constructor();
|
||||
void setParent(Window &parent);
|
||||
};
|
||||
|
||||
struct pCheckBox : public pWidget {
|
||||
CheckBox &checkBox;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace SNES {
|
||||
namespace Info {
|
||||
static const char Name[] = "bsnes";
|
||||
static const char Version[] = "077.03";
|
||||
static const char Version[] = "077.04";
|
||||
static const unsigned SerializerVersion = 19;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,23 +55,3 @@ private:
|
|||
};
|
||||
|
||||
extern Application application;
|
||||
|
||||
struct Style {
|
||||
enum : unsigned {
|
||||
#if defined(PLATFORM_WIN)
|
||||
ButtonHeight = 25,
|
||||
CheckBoxHeight = 15,
|
||||
ComboBoxHeight = 22,
|
||||
LabelHeight = 15,
|
||||
SliderHeight = 25,
|
||||
LineEditHeight = 22,
|
||||
#else
|
||||
ButtonHeight = 25,
|
||||
CheckBoxHeight = 15,
|
||||
ComboBoxHeight = 22,
|
||||
LabelHeight = 15,
|
||||
SliderHeight = 22,
|
||||
LineEditHeight = 22,
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
|
|
@ -23,9 +23,8 @@ void Console::create() {
|
|||
controlLayout.append(spacer, 120, ~0 );
|
||||
controlLayout.append(clearConsole, 120, 0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 585, 350 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 585, 350 });
|
||||
|
||||
onClose = []() {
|
||||
debugger.showConsole.setChecked(false);
|
||||
|
|
|
@ -18,9 +18,8 @@ void CPUDebugger::create() {
|
|||
controlLayout.append(proceed, 80, 0 );
|
||||
controlLayout.append(spacer, 80, ~0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });
|
||||
|
||||
onClose = []() {
|
||||
debugger.showCPUDebugger.setChecked(false);
|
||||
|
|
|
@ -35,9 +35,8 @@ void Debugger::create() {
|
|||
layout.append(showSMPDebugger, ~0, 0);
|
||||
layout.append(showBreakpointEditor, ~0, 0);
|
||||
layout.append(showMemoryEditor, ~0, 0);
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
|
||||
|
||||
//windows shown by default
|
||||
showConsole.setChecked();
|
||||
|
|
|
@ -18,9 +18,8 @@ void SMPDebugger::create() {
|
|||
controlLayout.append(proceed, 80, 0 );
|
||||
controlLayout.append(spacer, 80, ~0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });
|
||||
|
||||
onClose = []() {
|
||||
debugger.showSMPDebugger.setChecked(false);
|
||||
|
|
|
@ -26,11 +26,11 @@ void BreakpointEditor::create() {
|
|||
breakpointLayout[n].append(valueBox[n], 30, 0, 5);
|
||||
breakpointLayout[n].append(typeBox[n], 0, 0, 5);
|
||||
breakpointLayout[n].append(sourceBox[n], 0, 0 );
|
||||
layout.append(breakpointLayout[n], 5);
|
||||
layout.append(breakpointLayout[n], n < Breakpoints - 1 ? 5 : 0);
|
||||
}
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
|
||||
|
||||
onClose = []() {
|
||||
debugger.showBreakpointEditor.setChecked(false);
|
||||
|
|
|
@ -21,9 +21,8 @@ void MemoryEditor::create() {
|
|||
controlLayout.append(refreshButton, 80, 0 );
|
||||
controlLayout.append(spacer, 80, ~0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 475, 230 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 475, 230 });
|
||||
|
||||
onClose = []() {
|
||||
debugger.showMemoryEditor.setChecked(false);
|
||||
|
|
|
@ -12,9 +12,8 @@ void FileBrowser::create() {
|
|||
pathLayout.append(upButton, 25, 25 );
|
||||
layout.append(pathLayout, 5);
|
||||
layout.append(contentsBox, ~0, ~0 );
|
||||
|
||||
setGeometry({ 0, 0, 640, layout.minimumGeometry().height + 400 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 640, layout.minimumGeometry().height + 400 });
|
||||
|
||||
pathBox.onActivate = []() {
|
||||
string path = fileBrowser.pathBox.text();
|
||||
|
@ -31,11 +30,20 @@ void FileBrowser::create() {
|
|||
void FileBrowser::fileOpen(FileBrowser::Mode requestedMode, function<void (string)> requestedCallback) {
|
||||
callback = requestedCallback;
|
||||
|
||||
//if(mode == requestedMode && folder == config.path.current) {
|
||||
// setVisible();
|
||||
// contentsBox.setFocused();
|
||||
// return;
|
||||
//}
|
||||
switch(requestedMode) {
|
||||
case Mode::Cartridge: folderPath = "sfc"; break;
|
||||
case Mode::Satellaview: folderPath = "bs"; break;
|
||||
case Mode::SufamiTurbo: folderPath = "st"; break;
|
||||
case Mode::GameBoy: folderPath = "gb"; break;
|
||||
}
|
||||
string activePath = path.load(folderPath);
|
||||
|
||||
//if path has not changed, do not reload list; this will preserve previously selected file
|
||||
if(mode == requestedMode && folder == activePath) {
|
||||
setVisible();
|
||||
contentsBox.setFocused();
|
||||
return;
|
||||
}
|
||||
|
||||
setVisible(false);
|
||||
filters.reset();
|
||||
|
@ -43,45 +51,32 @@ void FileBrowser::fileOpen(FileBrowser::Mode requestedMode, function<void (strin
|
|||
switch(mode = requestedMode) {
|
||||
case Mode::Cartridge: {
|
||||
setTitle("Load Cartridge");
|
||||
folderPath = "sfc";
|
||||
filters.append(".sfc");
|
||||
break;
|
||||
}
|
||||
|
||||
case Mode::Satellaview: {
|
||||
setTitle("Load Satellaview Cartridge");
|
||||
folderPath = "bs";
|
||||
filters.append(".bs");
|
||||
break;
|
||||
}
|
||||
|
||||
case Mode::SufamiTurbo: {
|
||||
setTitle("Load Sufami Turbo Cartridge");
|
||||
folderPath = "st";
|
||||
filters.append(".st");
|
||||
break;
|
||||
}
|
||||
|
||||
case Mode::GameBoy: {
|
||||
setTitle("Load Game Boy Cartridge");
|
||||
folderPath = "gb";
|
||||
filters.append(".gb");
|
||||
filters.append(".gbc");
|
||||
filters.append(".sgb");
|
||||
break;
|
||||
}
|
||||
case Mode::Filter: {
|
||||
setTitle("Load Video Filter");
|
||||
folderPath = "filter";
|
||||
filters.append(".filter");
|
||||
break;
|
||||
}
|
||||
case Mode::Shader: {
|
||||
setTitle("Load Pixel Shader");
|
||||
folderPath = "shader";
|
||||
filters.append(".shader");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setFolder(path.load(folderPath));
|
||||
setFolder(activePath);
|
||||
setVisible(true);
|
||||
contentsBox.setFocused();
|
||||
}
|
||||
|
@ -94,6 +89,7 @@ void FileBrowser::setFolder(const string &pathname) {
|
|||
folder.transform("\\", "/");
|
||||
pathBox.setText(folder);
|
||||
lstring contentsList = directory::contents(folder);
|
||||
|
||||
foreach(item, contentsList) {
|
||||
if(strend(item, "/")) {
|
||||
contents.append(item);
|
||||
|
@ -104,6 +100,7 @@ void FileBrowser::setFolder(const string &pathname) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(item, contents) contentsBox.append(item);
|
||||
contentsBox.setSelection(0);
|
||||
contentsBox.setFocused();
|
||||
|
|
|
@ -6,7 +6,7 @@ struct FileBrowser : TopLevelWindow {
|
|||
Button upButton;
|
||||
ListView contentsBox;
|
||||
|
||||
enum class Mode : unsigned { Cartridge, Satellaview, SufamiTurbo, GameBoy, Filter, Shader } mode;
|
||||
enum class Mode : unsigned { Cartridge, Satellaview, SufamiTurbo, GameBoy } mode;
|
||||
void fileOpen(Mode mode, function<void (string)> callback);
|
||||
void create();
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@ void SingleSlotLoader::create() {
|
|||
controlLayout.append(spacer, ~0, 0 );
|
||||
controlLayout.append(okButton, 80, 0 );
|
||||
layout.append(controlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
|
||||
baseBrowse.onTick = []() {
|
||||
fileBrowser.fileOpen(FileBrowser::Mode::Cartridge, [](string filename) {
|
||||
|
@ -120,9 +119,8 @@ void DoubleSlotLoader::create() {
|
|||
controlLayout.append(spacer, ~0, 0 );
|
||||
controlLayout.append(okButton, 80, 0 );
|
||||
layout.append(controlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
|
||||
baseBrowse.onTick = []() {
|
||||
fileBrowser.fileOpen(FileBrowser::Mode::Cartridge, [](string filename) {
|
||||
|
|
|
@ -9,31 +9,31 @@ void InputMapper::poll_hotkeys(unsigned scancode, int16_t value) {
|
|||
if(mainWindow.focused() == false) return;
|
||||
|
||||
//save states
|
||||
if(scancode == keyboard(0)[Keyboard::F5]) {
|
||||
if(scancode == hotkeysGeneral.stateSave.scancode) {
|
||||
utility.saveState(activeSlot);
|
||||
}
|
||||
|
||||
if(scancode == keyboard(0)[Keyboard::F7]) {
|
||||
if(scancode == hotkeysGeneral.stateLoad.scancode) {
|
||||
utility.loadState(activeSlot);
|
||||
}
|
||||
|
||||
if(scancode == keyboard(0)[Keyboard::F6]) {
|
||||
if(scancode == hotkeysGeneral.stateDecrement.scancode) {
|
||||
activeSlot = (activeSlot == 1 ? 5 : activeSlot - 1);
|
||||
utility.showMessage({ "Slot ", activeSlot, " selected" });
|
||||
}
|
||||
|
||||
if(scancode == keyboard(0)[Keyboard::F8]) {
|
||||
if(scancode == hotkeysGeneral.stateIncrement.scancode) {
|
||||
activeSlot = (activeSlot == 5 ? 1 : activeSlot + 1);
|
||||
utility.showMessage({ "Slot ", activeSlot, " selected" });
|
||||
}
|
||||
|
||||
//fullscreen
|
||||
if(scancode == keyboard(0)[Keyboard::F11]) {
|
||||
if(scancode == hotkeysGeneral.fullscreenToggle.scancode) {
|
||||
utility.setFullscreen(!utility.fullscreen);
|
||||
}
|
||||
|
||||
//mouse capture
|
||||
if(scancode == keyboard(0)[Keyboard::F12]) {
|
||||
if(scancode == hotkeysGeneral.mouseCaptureToggle.scancode) {
|
||||
if(input.acquired() == false) {
|
||||
input.acquire();
|
||||
} else {
|
||||
|
@ -42,12 +42,12 @@ void InputMapper::poll_hotkeys(unsigned scancode, int16_t value) {
|
|||
}
|
||||
|
||||
//pause
|
||||
if(scancode == keyboard(0)[Keyboard::P]) {
|
||||
if(scancode == hotkeysGeneral.pauseToggle.scancode) {
|
||||
application.pause = !application.pause;
|
||||
}
|
||||
|
||||
//fast forward
|
||||
if(scancode == keyboard(0)[Keyboard::Tilde]) {
|
||||
if(scancode == hotkeysGeneral.fastForward.scancode) {
|
||||
videoSync = config.video.synchronize;
|
||||
audioSync = config.audio.synchronize;
|
||||
video.set(Video::Synchronize, config.video.synchronize = false);
|
||||
|
@ -56,12 +56,22 @@ void InputMapper::poll_hotkeys(unsigned scancode, int16_t value) {
|
|||
SNES::ppu.set_frameskip(9);
|
||||
#endif
|
||||
}
|
||||
|
||||
//power cycle
|
||||
if(scancode == hotkeysGeneral.power.scancode) {
|
||||
mainWindow.systemPower.onTick();
|
||||
}
|
||||
|
||||
//reset
|
||||
if(scancode == hotkeysGeneral.reset.scancode) {
|
||||
mainWindow.systemReset.onTick();
|
||||
}
|
||||
} else {
|
||||
//key released
|
||||
if(mainWindow.focused() == false) return;
|
||||
|
||||
//fast forward
|
||||
if(scancode == keyboard(0)[Keyboard::Tilde]) {
|
||||
if(scancode == hotkeysGeneral.fastForward.scancode) {
|
||||
video.set(Video::Synchronize, config.video.synchronize = videoSync);
|
||||
audio.set(Audio::Synchronize, config.audio.synchronize = audioSync);
|
||||
#if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE)
|
||||
|
@ -70,3 +80,46 @@ void InputMapper::poll_hotkeys(unsigned scancode, int16_t value) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputMapper::HotkeysGeneral::create(const char *deviceName, const char *configName) {
|
||||
name = deviceName;
|
||||
|
||||
stateSave.name = "Save State";
|
||||
stateLoad.name = "Load State";
|
||||
stateDecrement.name = "Decrement State";
|
||||
stateIncrement.name = "Increment State";
|
||||
fullscreenToggle.name = "Fullscreen";
|
||||
mouseCaptureToggle.name = "Mouse Capture";
|
||||
pauseToggle.name = "Pause Emulation";
|
||||
fastForward.name = "Fast-Forward";
|
||||
power.name = "Power Cycle";
|
||||
reset.name = "Reset";
|
||||
|
||||
append(&stateSave);
|
||||
append(&stateLoad);
|
||||
append(&stateDecrement);
|
||||
append(&stateIncrement);
|
||||
append(&fullscreenToggle);
|
||||
append(&mouseCaptureToggle);
|
||||
append(&pauseToggle);
|
||||
append(&fastForward);
|
||||
append(&power);
|
||||
append(&reset);
|
||||
|
||||
config.attach(stateSave.mapping = "KB0::F5", string("input.", configName, ".stateSave"));
|
||||
config.attach(stateLoad.mapping = "KB0::F7", string("input.", configName, ".stateLoad"));
|
||||
config.attach(stateDecrement.mapping = "KB0::F6", string("input.", configName, ".stateDecrement"));
|
||||
config.attach(stateIncrement.mapping = "KB0::F8", string("input.", configName, ".stateIncrement"));
|
||||
config.attach(fullscreenToggle.mapping = "KB0::F11", string("input.", configName, ".fullscreenToggle"));
|
||||
config.attach(mouseCaptureToggle.mapping = "KB0::F12", string("input.", configName, ".mouseCaptureToggle"));
|
||||
config.attach(pauseToggle.mapping = "KB0::P", string("input.", configName, ".pauseToggle"));
|
||||
config.attach(fastForward.mapping = "KB0::Tilde", string("input.", configName, ".fastForward"));
|
||||
config.attach(power.mapping = "", string("input.", configName, ".power"));
|
||||
config.attach(reset.mapping = "", string("input.", configName, ".reset"));
|
||||
}
|
||||
|
||||
void InputMapper::create_hotkeys() {
|
||||
hotkeys.name = "Hotkeys";
|
||||
hotkeysGeneral.create("General", "hotkeys.general");
|
||||
hotkeys.append(&hotkeysGeneral);
|
||||
}
|
||||
|
|
|
@ -227,6 +227,8 @@ void InputMapper::create() {
|
|||
port2.append(&port2.superScope);
|
||||
port2.append(&port2.justifierA);
|
||||
port2.append(&port2.justifierB);
|
||||
|
||||
create_hotkeys();
|
||||
}
|
||||
|
||||
void InputMapper::bind() {
|
||||
|
@ -238,6 +240,10 @@ void InputMapper::bind() {
|
|||
Controller &controller = *port2[i];
|
||||
for(unsigned n = 0; n < controller.size(); n++) controller[n]->bind();
|
||||
}
|
||||
for(unsigned i = 0; i < hotkeys.size(); i++) {
|
||||
Controller &controller = *hotkeys[i];
|
||||
for(unsigned n = 0; n < controller.size(); n++) controller[n]->bind();
|
||||
}
|
||||
}
|
||||
|
||||
void InputMapper::poll() {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
struct InputMapper {
|
||||
int16_t state[2][Scancode::Limit];
|
||||
bool activeState;
|
||||
|
||||
struct AbstractInput {
|
||||
enum class Type : unsigned { Button, MouseAxis, MouseButton, HatUp, HatDown, HatLeft, HatRight, AxisLo, AxisHi } type;
|
||||
string name;
|
||||
|
@ -73,13 +76,13 @@ struct InputMapper {
|
|||
Justifier justifierB;
|
||||
} port2;
|
||||
|
||||
int16_t state[2][Scancode::Limit];
|
||||
bool activeState;
|
||||
#include "hotkeys.hpp"
|
||||
|
||||
void create();
|
||||
void bind();
|
||||
void poll();
|
||||
int16_t poll(bool port, SNES::Input::Device device, unsigned index, unsigned id);
|
||||
void create_hotkeys();
|
||||
void poll_hotkeys(unsigned scancode, int16_t value);
|
||||
int16_t value(unsigned scancode);
|
||||
};
|
||||
|
|
|
@ -33,9 +33,8 @@ void AdvancedSettings::create() {
|
|||
focusPolicyLayout.append(focusPolicyIgnore, ~0, 0, 5);
|
||||
focusPolicyLayout.append(focusPolicyAllow, ~0, 0);
|
||||
layout.append(focusPolicyLayout);
|
||||
|
||||
setGeometry({ 0, 0, 640, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 640, layout.minimumGeometry().height });
|
||||
|
||||
lstring list;
|
||||
|
||||
|
|
|
@ -18,9 +18,8 @@ void AudioSettings::create() {
|
|||
frequencyLayout.append(frequencyValue, 60, 0);
|
||||
frequencyLayout.append(frequencySlider, ~0, 0);
|
||||
layout.append(frequencyLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
|
||||
volumeSlider.onChange = []() {
|
||||
config.audio.volume = audioSettings.volumeSlider.position();
|
||||
|
|
|
@ -13,6 +13,7 @@ void InputSettings::create() {
|
|||
portLabel.setText("Port:");
|
||||
portBox.append(inputMapper.port1.name);
|
||||
portBox.append(inputMapper.port2.name);
|
||||
portBox.append(inputMapper.hotkeys.name);
|
||||
deviceLabel.setText("Device:");
|
||||
mappingList.setHeaderText("Name", "Mapping");
|
||||
mappingList.setHeaderVisible(true);
|
||||
|
@ -47,10 +48,10 @@ void InputSettings::create() {
|
|||
buttonControlLayout.append(mouseRight, 100, 0, 5);
|
||||
buttonLayout.append(buttonControlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
append(layout);
|
||||
append(axisLayout);
|
||||
append(buttonLayout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
|
||||
axisLayout.setVisible(false);
|
||||
buttonLayout.setVisible(false);
|
||||
|
@ -74,9 +75,9 @@ void InputSettings::create() {
|
|||
void InputSettings::portChanged() {
|
||||
deviceBox.reset();
|
||||
InputMapper::ControllerPort &port = (
|
||||
portBox.selection() == 0
|
||||
? (InputMapper::ControllerPort&)inputMapper.port1
|
||||
: (InputMapper::ControllerPort&)inputMapper.port2
|
||||
portBox.selection() == 0 ? (InputMapper::ControllerPort&)inputMapper.port1 :
|
||||
portBox.selection() == 1 ? (InputMapper::ControllerPort&)inputMapper.port2 :
|
||||
/*portBox.selection() == 2*/ (InputMapper::ControllerPort&)inputMapper.hotkeys
|
||||
);
|
||||
|
||||
for(unsigned i = 0; i < port.size(); i++) deviceBox.append(port[i]->name);
|
||||
|
@ -86,9 +87,9 @@ void InputSettings::portChanged() {
|
|||
void InputSettings::deviceChanged() {
|
||||
mappingList.reset();
|
||||
InputMapper::ControllerPort &port = (
|
||||
portBox.selection() == 0
|
||||
? (InputMapper::ControllerPort&)inputMapper.port1
|
||||
: (InputMapper::ControllerPort&)inputMapper.port2
|
||||
portBox.selection() == 0 ? (InputMapper::ControllerPort&)inputMapper.port1 :
|
||||
portBox.selection() == 1 ? (InputMapper::ControllerPort&)inputMapper.port2 :
|
||||
/*portBox.selection() == 2*/ (InputMapper::ControllerPort&)inputMapper.hotkeys
|
||||
);
|
||||
InputMapper::Controller &controller = (InputMapper::Controller&)*port[deviceBox.selection()];
|
||||
|
||||
|
@ -102,9 +103,9 @@ void InputSettings::deviceChanged() {
|
|||
|
||||
void InputSettings::mappingChanged() {
|
||||
InputMapper::ControllerPort &port = (
|
||||
portBox.selection() == 0
|
||||
? (InputMapper::ControllerPort&)inputMapper.port1
|
||||
: (InputMapper::ControllerPort&)inputMapper.port2
|
||||
portBox.selection() == 0 ? (InputMapper::ControllerPort&)inputMapper.port1 :
|
||||
portBox.selection() == 1 ? (InputMapper::ControllerPort&)inputMapper.port2 :
|
||||
/*portBox.selection() == 2*/ (InputMapper::ControllerPort&)inputMapper.hotkeys
|
||||
);
|
||||
InputMapper::Controller &controller = (InputMapper::Controller&)*port[deviceBox.selection()];
|
||||
|
||||
|
@ -119,9 +120,9 @@ void InputSettings::mappingChanged() {
|
|||
void InputSettings::assignInput() {
|
||||
if(mappingList.selected() == false) return;
|
||||
InputMapper::ControllerPort &port = (
|
||||
portBox.selection() == 0
|
||||
? (InputMapper::ControllerPort&)inputMapper.port1
|
||||
: (InputMapper::ControllerPort&)inputMapper.port2
|
||||
portBox.selection() == 0 ? (InputMapper::ControllerPort&)inputMapper.port1 :
|
||||
portBox.selection() == 1 ? (InputMapper::ControllerPort&)inputMapper.port2 :
|
||||
/*portBox.selection() == 2*/ (InputMapper::ControllerPort&)inputMapper.hotkeys
|
||||
);
|
||||
InputMapper::Controller &controller = (InputMapper::Controller&)*port[deviceBox.selection()];
|
||||
|
||||
|
@ -143,9 +144,9 @@ void InputSettings::assignInput() {
|
|||
void InputSettings::clearInput() {
|
||||
if(mappingList.selected() == false) return;
|
||||
InputMapper::ControllerPort &port = (
|
||||
portBox.selection() == 0
|
||||
? (InputMapper::ControllerPort&)inputMapper.port1
|
||||
: (InputMapper::ControllerPort&)inputMapper.port2
|
||||
portBox.selection() == 0 ? (InputMapper::ControllerPort&)inputMapper.port1 :
|
||||
portBox.selection() == 1 ? (InputMapper::ControllerPort&)inputMapper.port2 :
|
||||
/*portBox.selection() == 2*/ (InputMapper::ControllerPort&)inputMapper.hotkeys
|
||||
);
|
||||
InputMapper::Controller &controller = (InputMapper::Controller&)*port[deviceBox.selection()];
|
||||
|
||||
|
|
|
@ -40,9 +40,8 @@ void VideoSettings::create() {
|
|||
fullscreenLayout.append(fullscreenScale, ~0, 0, 5);
|
||||
fullscreenLayout.append(fullscreenStretch, ~0, 0 );
|
||||
layout.append(fullscreenLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
|
||||
brightnessSlider.setPosition(config.video.brightness);
|
||||
brightnessValue.setText({ config.video.brightness, "%" });
|
||||
|
|
|
@ -15,8 +15,8 @@ void CheatDatabase::create() {
|
|||
controlLayout.append(spacerWidget, ~0, 0 );
|
||||
controlLayout.append(okButton, 80, 0 );
|
||||
layout.append(controlLayout );
|
||||
setGeometry({ 0, 0, 600, layout.minimumGeometry().height + 350 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 600, layout.minimumGeometry().height + 350 });
|
||||
|
||||
selectAllButton.onTick = [this]() {
|
||||
foreach(item, this->listData, n) this->listView.setChecked(n, true);
|
||||
|
|
|
@ -104,9 +104,8 @@ void CheatEditor::create() {
|
|||
controlLayout.append(clearAllButton, 80, 0, 5);
|
||||
controlLayout.append(clearButton, 80, 0 );
|
||||
layout.append(controlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
|
||||
synchronize();
|
||||
|
||||
|
|
|
@ -21,9 +21,8 @@ void StateManager::create() {
|
|||
controlLayout.append(saveButton, 80, 0, 5);
|
||||
controlLayout.append(eraseButton, 80, 0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
append(layout);
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
|
||||
synchronize();
|
||||
|
||||
|
|
Loading…
Reference in New Issue