bsnes/hiro/windows/window.cpp

408 lines
12 KiB
C++
Raw Normal View History

#if defined(Hiro_Window)
namespace hiro {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
static auto CALLBACK Window_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -> LRESULT {
if(Application::state().quit) return DefWindowProc(hwnd, msg, wparam, lparam);
if(auto window = (mWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA)) {
if(auto self = window->self()) {
if(auto result = self->windowProc(hwnd, msg, wparam, lparam)) {
return result();
}
}
}
return Shared_windowProc(DefWindowProc, hwnd, msg, wparam, lparam);
}
//warning: do not add WS_CLIPCHILDREN; this will break painting of Frame ("BUTTON" BS_GROUPBOX) controls
static const uint PopupStyle = WS_POPUP;
static const uint FixedStyle = WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX | WS_BORDER;
static const uint ResizableStyle = WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME;
uint pWindow::minimumStatusHeight = 0;
auto pWindow::initialize() -> void {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
pApplication::state().modalTimer.setInterval(1);
pApplication::state().modalTimer.onActivate([] { Application::doMain(); });
HWND hwnd = CreateWindow(L"hiroWindow", L"", ResizableStyle, 128, 128, 256, 256, 0, 0, GetModuleHandle(0), 0);
HWND hstatus = CreateWindow(STATUSCLASSNAME, L"", WS_CHILD, 0, 0, 0, 0, hwnd, nullptr, GetModuleHandle(0), 0);
SetWindowPos(hstatus, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
RECT rc;
GetWindowRect(hstatus, &rc);
minimumStatusHeight = rc.bottom - rc.top;
DestroyWindow(hstatus);
DestroyWindow(hwnd);
}
auto pWindow::construct() -> void {
hwnd = CreateWindow(L"hiroWindow", L"", ResizableStyle, 128, 128, 256, 256, 0, 0, GetModuleHandle(0), 0);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&reference);
setDroppable(state().droppable);
setGeometry({128, 128, 256, 256});
windows.append(self().instance);
}
auto pWindow::destruct() -> void {
if(auto position = windows.find(self().instance)) windows.remove(*position);
if(hbrush) { DeleteObject(hbrush); hbrush = nullptr; }
DestroyWindow(hwnd);
}
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
auto pWindow::append(sMenuBar menuBar) -> void {
}
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
auto pWindow::append(sSizable sizable) -> void {
}
auto pWindow::append(sStatusBar statusBar) -> void {
}
auto pWindow::focused() const -> bool {
return (GetForegroundWindow() == hwnd);
}
auto pWindow::frameMargin() const -> Geometry {
RECT rc{0, 0, 640, 480};
uint style = state().fullScreen ? 0 : state().resizable ? ResizableStyle : FixedStyle;
bool menuVisible = state().menuBar && state().menuBar->visible();
AdjustWindowRect(&rc, style, menuVisible);
auto& efb = state().fullScreen ? settings.efbPopup : !state().resizable ? settings.efbFixed : settings.efbResizable;
return {
abs(rc.left) - efb.x,
abs(rc.top) - efb.y,
(rc.right - rc.left) - 640 - efb.width,
(rc.bottom - rc.top) + _statusHeight() - 480 - efb.height
};
}
auto pWindow::handle() const -> uintptr_t {
return (uintptr_t)hwnd;
}
auto pWindow::monitor() const -> uint {
//TODO
return 0;
}
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
auto pWindow::remove(sMenuBar menuBar) -> void {
}
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
auto pWindow::remove(sSizable sizable) -> void {
}
auto pWindow::remove(sStatusBar statusBar) -> void {
}
auto pWindow::setBackgroundColor(Color color) -> void {
hbrushColor = CreateRGB(color);
if(hbrush) { DeleteObject(hbrush); hbrush = nullptr; }
if(color) hbrush = CreateSolidBrush(hbrushColor);
}
Update to v103r13 release. byuu says: Changelog: - gb/interface: fix Game Boy Color extension to be "gbc" and not "gb" [hex\_usr] - ms/interface: move Master System hardware controls below controller ports - sfc/ppu: improve latching behavior of BGnHOFS registers (not hardware verified) [AWJ] - tomoko/input: rework port/device mapping to support non-sequential ports and devices¹ - todo: should add move() to inputDevice.mappings.append and inputPort.devices.append - note: there's a weird GCC 4.9 bug with brace initialization of InputEmulator; have to assign each field separately - tomoko: all windows sans the main presentation window can be dismissed with the escape key - icarus: the single file selection dialog ("Load ROM Image...") can be dismissed with the escape key - tomoko: do not pause emulation when FocusLoss/Pause is set during exclusive fullscreen mode - hiro/(windows,gtk,qt): implemented Window::setDismissable() function (missing from cocoa port, sorry) - nall/string: fixed printing of largest possible negative numbers (eg `INT_MIN`) [Sintendo] - only took eight months! :D ¹: When I tried to move the Master System hardware port below the controller ports, I ran into a world of pain. The input settings list expects every item in the `InputEmulator<InputPort<InputDevice<InputMapping>>>>` arrays to be populated with valid results. But these would be sparsely populated based on the port and device IDs from inside higan. And that is done so that the Interface::inputPoll can have O(1) lookup of ports and devices. This worked because all the port and device IDs were sequential (they left no gaps in the maps upon creating the lists.) Unfortunately by changing the expectation of port ID to how it appears in the list, inputs would not poll correctly. By leaving them alone and just moving Hardware to the third position, the Game Gear would be missing port IDs of 0 and 1 (the controller ports of the Master System). Even by trying to make separate MasterSystemHardware and GameGearHardware ports, things still fractured when the devices were no longer contigious. I got pretty sick of this and just decided to give up on O(1) port/device lookup, and moved to O(n) lookup. It only knocked the framerate down by maybe one frame per second, enough to be in the margin of error. Inputs aren't polled *that* often for loops that usually terminate after 1-2 cycles to be too detrimental to performance. So the new input system now allows non-sequential port and device IDs. Remember that I killed input IDs a while back. There's never any reason for those to need IDs ... it was easier to just order the inputs in the order you want to see them in the user interface. So the input lookup is still O(1). Only now, everything's safer and I return a maybe<InputMapping&>, and won't crash out the program trying to use a mapping that isn't found for some reason. Errata: the escape key isn't working on the browser/message dialogs on Windows, because of course nothing can ever just be easy and work for me. If anyone else wouldn't mind looking into that, I'd greatly appreciate it. Having the `WM_KEYDOWN` test inside the main `Application_sharedProc`, it seems to not respond to the escape key on modal dialogs. If I put the `WM_KEYDOWN` test in the main window proc, then it doesn't seem to get called for `VK_ESCAPE` at all, and doesn't get called period for modal windows. So I'm at a loss and it's past 4AM here >_>
2017-07-12 08:24:27 +00:00
auto pWindow::setDismissable(bool dismissable) -> void {
}
auto pWindow::setDroppable(bool droppable) -> void {
DragAcceptFiles(hwnd, droppable);
}
auto pWindow::setEnabled(bool enabled) -> void {
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
if(auto& sizable = state().sizable) {
if(auto self = sizable->self()) self->setEnabled(sizable->enabled(true));
}
}
auto pWindow::setFocused() -> void {
if(!self().visible()) self().setVisible(true);
SetFocus(hwnd);
}
Update to v094r43 release. byuu says: Updated to compile with all of the new hiro changes. My next step is to write up hiro API documentation, and move the API from alpha (constantly changing) to beta (rarely changing), in preparation for the first stable release (backward-compatible changes only.) Added "--fullscreen" command-line option. I like this over a configuration file option. Lets you use the emulator in both modes without having to modify the config file each time. Also enhanced the command-line game loading. You can now use any of these methods: higan /path/to/game-folder.sfc higan /path/to/game-folder.sfc/ higan /path/to/game-folder.sfc/program.rom The idea is to support launchers that insist on loading files only. Technically, the file can be any name (manifest.bml also works); the only criteria is that the file actually exists and is a file, and not a directory. This is a requirement to support the first version (a directory lacking the trailing / identifier), because I don't want my nall::string class to query the file system to determine if the string is an actual existing file or directory for its pathname() / dirname() functions. Anyway, every game folder I've made so far has program.rom, and that's very unlikely to change, so this should be fine. Now, of course, if you drop a regular "game.sfc" file on the emulator, it won't even try to load it, unless it's in a folder that ends in .fc, .sfc, etc. In which case, it'll bail out immediately by being unable to produce a manifest for what is obviously not really a game folder.
2015-08-30 02:08:26 +00:00
auto pWindow::setFont(const Font& font) -> void {
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
if(auto& sizable = state().sizable) {
if(auto self = sizable->self()) self->setFont(sizable->font(true));
}
}
auto pWindow::setFullScreen(bool fullScreen) -> void {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto lock = acquire();
auto style = GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VISIBLE;
if(fullScreen) {
windowedGeometry = self().geometry();
HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
MONITORINFOEX info;
memset(&info, 0, sizeof(MONITORINFOEX));
info.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(monitor, &info);
RECT rc = info.rcMonitor;
Geometry geometry = {rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top};
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_POPUP);
Geometry margin = frameMargin();
self().setGeometry({
geometry.x() + margin.x(), geometry.y() + margin.y(),
geometry.width() - margin.width(), geometry.height() - margin.height()
});
} else {
SetWindowLongPtr(hwnd, GWL_STYLE, style | (state().resizable ? ResizableStyle : FixedStyle));
self().setGeometry(windowedGeometry);
}
}
auto pWindow::setGeometry(Geometry geometry) -> void {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto lock = acquire();
Geometry margin = frameMargin();
auto& efb = state().fullScreen ? settings.efbPopup : !state().resizable ? settings.efbFixed : settings.efbResizable;
SetWindowPos(
hwnd, nullptr,
geometry.x() - margin.x() - efb.x,
geometry.y() - margin.y() - efb.y,
geometry.width() + margin.width() + efb.width,
geometry.height() + margin.height() + efb.height,
Update to v103r11 release. byuu says: Changelog: - tomoko: removed "Settings→Video Emulation→Overscan Mask" setting¹ - tomoko: remove a few unnecessary calls to resizeViewport on startup - tomoko: only resize main window from video settings when in adaptive or toggling adaptive mode² - hiro/windows: add `SWP_NOACTIVATE` flag to prevent focus stealing on resizing invisible windows³ - hiro/windows: suppress spurious API-generated `onSize()` callback when calling `setVisible()` ¹: it just seemed like bad design to default to overscan masking being disabled with overscan masks of 8 horizontal, 8 vertical out of the box. Users would adjust the sliders and not see anything happening. Instead, I've set the default masks to zero. If you want to turn off overscan masking, simply slide those to zero again. ²: I figure the only way we're going to be able to fairly evaluate Screwtape's suggestion is to try it both ways. And I will admit, I kind of like the way this works as well ... a lot more so than I thought I would, so I think it was a great suggestion. Still, now's the time if people have strong opinions on this. Be sure to try both r10 and r11 to compare. Barring no other feedback, I'm going to keep it this way. ³: this fixes the blinking of the main window on startup. Screwtape, thanks again for the improvement suggestions. At this point though, I am not using a tiling window manager. If you are able to patch hiro/gtk and/or hiro/qt (I mostly use GTK) to work with tiling window managers better, I wouldn't mind applying said patches, so long as they don't break things on my own Xfce desktop with xfwm4. Also, I noticed one issue with Xfce ... if the window is maximized and I try to call `Window::setSize()`, it's not actually removing the maximize flag. We'll need to look into how to add that to GTK, but I don't think it's a huge issue. A similar glitch happens on windows where the icon still reflects being maximized, but it does actually shrink, it just sticks to the top left corner of the screen. So this isn't really a critical bug, but would be extra polish.
2017-07-08 01:02:01 +00:00
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED
);
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
if(auto& statusBar = state().statusBar) {
if(auto self = statusBar->self()) {
Update to v103r11 release. byuu says: Changelog: - tomoko: removed "Settings→Video Emulation→Overscan Mask" setting¹ - tomoko: remove a few unnecessary calls to resizeViewport on startup - tomoko: only resize main window from video settings when in adaptive or toggling adaptive mode² - hiro/windows: add `SWP_NOACTIVATE` flag to prevent focus stealing on resizing invisible windows³ - hiro/windows: suppress spurious API-generated `onSize()` callback when calling `setVisible()` ¹: it just seemed like bad design to default to overscan masking being disabled with overscan masks of 8 horizontal, 8 vertical out of the box. Users would adjust the sliders and not see anything happening. Instead, I've set the default masks to zero. If you want to turn off overscan masking, simply slide those to zero again. ²: I figure the only way we're going to be able to fairly evaluate Screwtape's suggestion is to try it both ways. And I will admit, I kind of like the way this works as well ... a lot more so than I thought I would, so I think it was a great suggestion. Still, now's the time if people have strong opinions on this. Be sure to try both r10 and r11 to compare. Barring no other feedback, I'm going to keep it this way. ³: this fixes the blinking of the main window on startup. Screwtape, thanks again for the improvement suggestions. At this point though, I am not using a tiling window manager. If you are able to patch hiro/gtk and/or hiro/qt (I mostly use GTK) to work with tiling window managers better, I wouldn't mind applying said patches, so long as they don't break things on my own Xfce desktop with xfwm4. Also, I noticed one issue with Xfce ... if the window is maximized and I try to call `Window::setSize()`, it's not actually removing the maximize flag. We'll need to look into how to add that to GTK, but I don't think it's a huge issue. A similar glitch happens on windows where the icon still reflects being maximized, but it does actually shrink, it just sticks to the top left corner of the screen. So this isn't really a critical bug, but would be extra polish.
2017-07-08 01:02:01 +00:00
SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
}
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
if(auto& sizable = state().sizable) {
sizable->setGeometry(geometry.setPosition());
}
}
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
auto pWindow::setMaximized(bool maximized) -> void {
if(state().minimized) return;
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto lock = acquire();
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
ShowWindow(hwnd, maximized ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
}
auto pWindow::setMaximumSize(Size size) -> void {
}
auto pWindow::setMinimized(bool minimized) -> void {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto lock = acquire();
Update to v106r47 release. byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
2018-07-14 03:59:29 +00:00
ShowWindow(hwnd, minimized ? SW_MINIMIZE : state().maximized ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
}
auto pWindow::setMinimumSize(Size size) -> void {
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
//never call this directly: use Window::setModal() instead
//this function does not confirm the modality has actually changed before adjusting modalCount
auto pWindow::setModal(bool modality) -> void {
if(modality) {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
modalIncrement();
_modalityUpdate();
while(!Application::state().quit && state().modal) {
if(Application::state().onMain) {
Application::doMain();
} else {
usleep(20 * 1000);
}
Application::processEvents();
}
_modalityUpdate();
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
} else {
modalDecrement();
Update to v088r11 release. byuu says: Changelog: - phoenix has added Window::setModal(bool modal = true); - file dialog is now modal. This allows emulation cores to request data and get it immediately before continuing the loading process - save data is hooked up for most systems, still need to handle subsystem slot saves (Sufami Turbo, basically.) - toggle fullscreen key binding added (Alt+Enter for now. I think F11 is probably better though, Enter is often mapped to game start button.) - video scaling is in (center, scale, stretch), works the same in windowed and fullscreen mode (stretch hides resize window option), all in the settings menu now - enough structure to map all saved paths for the browser and to load BS-X slotted carts, BS-X carts, single Sufami Turbo carts Caveats / Missing: - Super Game Boy input doesn't work yet (due to change in callback binding) - doesn't load secondary Sufami Turbo slot yet - BS-X BIOS isn't show the data pack games to load for some reason (ugh, I hate the shit out of debugging BS-X stuff ...) - need mute audio, sync audio+video toggle, save/load state menu and quick keys, XML mapping information window - need cheat editor and cheat database - need state manager - need to sort subsystems below main systems in load menu (basically just see if media.slot.size() > 0) - need video shaders (will probably leave off filters for the time being ... due to that 24/30-bit thing) - need video adjustments (contrast etc, overscan masks) - need audio adjustments (frequency, latency, resampler, volume, per-system frequency) - need driver selection and input focus policy (driver crash detection would be nice too) - need NSS DIP switch settings (that one will be really fun) - need to save and load window geometry settings - need to hook up controller selection (won't be fun), create a map to hide controllers with no inputs to reassign
2012-05-03 12:36:47 +00:00
}
}
auto pWindow::setResizable(bool resizable) -> void {
auto style = GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VISIBLE;
SetWindowLongPtr(hwnd, GWL_STYLE, style | (state().resizable ? ResizableStyle : FixedStyle));
setGeometry(state().geometry);
}
auto pWindow::setTitle(string text) -> void {
SetWindowText(hwnd, utf16_t(text));
}
auto pWindow::setVisible(bool visible) -> void {
auto lock = acquire();
ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE);
if(auto& sizable = state().sizable) {
sizable->setGeometry(self().geometry().setPosition());
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(!visible) self().setModal(false);
//calculate window extended frame bounds: DwmGetWindowAttributes is only valid after the window is visible
//by then, it's too late to position the window correctly, but we can cache the results here for next time
//because GetWindowRect and DwmGetWindowAttribute returns different unit types, the hiro application *must* be DPI aware
if(visible) {
//in logical units
RECT rc;
GetWindowRect(hwnd, &rc);
//in physical units
RECT fc;
DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &fc, sizeof(RECT));
//convert to offsets useful to hiro
auto& efb = state().fullScreen ? settings.efbPopup : !state().resizable ? settings.efbFixed : settings.efbResizable;
efb.x = fc.left - rc.left;
efb.y = fc.top - rc.top;
efb.width = efb.x + (rc.right - fc.right);
efb.height = efb.y + (rc.bottom - fc.bottom);
//sanitize inputs: if the bounds are obviously nonsense, give up on trying to compensate for them
if(efb.x > 100 || efb.y > 100 || efb.width > 100 || efb.height > 100) efb = {};
}
}
//
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto pWindow::modalIncrement() -> void {
if(pApplication::state().modalCount++ == 0) {
pApplication::state().modalTimer.setEnabled(true);
}
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto pWindow::modalDecrement() -> void {
if(--pApplication::state().modalCount == 0) {
pApplication::state().modalTimer.setEnabled(false);
}
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
auto pWindow::windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -> maybe<LRESULT> {
if(msg == WM_CLOSE || (msg == WM_KEYDOWN && wparam == VK_ESCAPE && state().dismissable)) {
if(state().onClose) {
self().doClose();
//doClose() may end up destroying the window when terminating the application ...
//forcefully return early in said case, so that the modal check below doesn't access the destroyed pWindow object
if(Application::state().quit) return true;
} else {
self().setVisible(false);
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(state().modal && !self().visible()) self().setModal(false);
return true;
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(msg == WM_MOVE && !locked()) {
state().geometry.setPosition(_geometry().position());
self().doMove();
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(msg == WM_SIZE && !locked()) {
if(auto statusBar = state().statusBar) {
if(auto self = statusBar->self()) {
SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
}
state().geometry.setSize(_geometry().size());
if(auto& sizable = state().sizable) {
sizable->setGeometry(_geometry().setPosition());
}
self().doSize();
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(msg == WM_DROPFILES) {
if(auto paths = DropPaths(wparam)) self().doDrop(paths);
return false;
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(msg == WM_ERASEBKGND && hbrush) {
RECT rc;
GetClientRect(hwnd, &rc);
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
FillRect(ps.hdc, &rc, hbrush);
EndPaint(hwnd, &ps);
return true;
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(msg == WM_ENTERMENULOOP || msg == WM_ENTERSIZEMOVE) {
modalIncrement();
return false;
}
if(msg == WM_EXITMENULOOP || msg == WM_EXITSIZEMOVE) {
modalDecrement();
return false;
}
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
if(msg == WM_SYSCOMMAND) {
if(wparam == SC_SCREENSAVE || wparam == SC_MONITORPOWER) {
if(!Application::screenSaver()) return 0;
}
}
return {};
}
//
auto pWindow::_geometry() -> Geometry {
Geometry margin = frameMargin();
RECT rc;
if(IsIconic(hwnd)) {
Update to 20180809 release. byuu says: The Windows port can now run the emulation while navigating menus, moving windows, and resizing windows. The main window also doesn't try so hard to constantly clear itself. This may leave a bit of unwelcome residue behind in some video drivers during resize, but under most drivers, it lets you resize without a huge amount of flickering. On all platforms, I now also run the emulation during MessageWindow modal events, where I didn't before. I'm thinking we should probably mute the audio during modal periods, since it can generate a good deal of distortion. The tooltip timeout was increased to ten seconds. On Windows, the enter key can now activate buttons, so you can more quickly dismiss MessageDialog windows. This part may not actually work ... I'm in the middle of trying to get messages out of the global `Application_windowProc` hook and into the individual `Widget_windowProc` hooks, so I need to do some testing. I fixed a bug where changing the input driver wouldn't immediately reload the input/hotkey settings lists properly. I also went from disabling the driver "Change" button when the currently active driver is selected in the list, to instead setting it to say "Reload", and I also added a tool tip to the input driver reload button, advising that if you're using DirectInput or SDL, you can hit "Reload" to rescan for hotplugged gamepads without needing to restart the emulator. XInput and udev have auto hotswap support. If we can ever get that into DirectInput and SDL, then I'll remove the tooltip. But regardless, the reload functionality is nice to have for all drivers. I'm not sure what should happen when a user changes their driver selection while a game is loaded, gets the warning dialog, chooses not to change it, and then closes the emulator. Currently, it will make the change happen the next time you start the emulator. This feels a bit unexpected, but when you change the selection without a game loaded, it takes immediate effect. So I'm not really sure what's best here.
2018-08-10 05:02:59 +00:00
//GetWindowRect returns x=-32000,y=-32000 when window is minimized
WINDOWPLACEMENT wp;
GetWindowPlacement(hwnd, &wp);
rc = wp.rcNormalPosition;
} else {
GetWindowRect(hwnd, &rc);
}
auto& efb = state().fullScreen ? settings.efbPopup : !state().resizable ? settings.efbFixed : settings.efbResizable;
auto x = rc.left + margin.x() + efb.x;
auto y = rc.top + margin.y() + efb.y;
auto width = (rc.right - rc.left) - margin.width() - efb.width;
auto height = (rc.bottom - rc.top) - margin.height() - efb.height;
return {x, y, width, height};
}
auto pWindow::_modalityCount() -> unsigned {
unsigned modalWindows = 0;
for(auto& weak : windows) {
if(auto object = weak.acquire()) {
if(auto window = dynamic_cast<mWindow*>(object.data())) {
if(window->modal()) modalWindows++;
}
}
}
return modalWindows;
}
auto pWindow::_modalityDisabled() -> bool {
if(_modalityCount() == 0) return false;
return !state().modal;
}
auto pWindow::_modalityUpdate() -> void {
unsigned modalWindows = _modalityCount();
for(auto& weak : windows) {
if(auto object = weak.acquire()) {
if(auto window = dynamic_cast<mWindow*>(object.data())) {
if(auto self = window->self()) {
bool enabled = !modalWindows || window->modal();
if(IsWindowEnabled(self->hwnd) != enabled) {
EnableWindow(self->hwnd, enabled);
}
}
}
}
}
}
auto pWindow::_statusHeight() const -> int {
int height = 0;
if(auto& statusBar = state().statusBar) {
if(statusBar->visible()) {
auto& text = statusBar->state.text;
height = statusBar->font(true).size(text ? text : " ").height();
height = max(height, minimumStatusHeight);
}
}
return height;
}
}
#endif