2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
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
|
|
|
vector<pWindow*> pWindow::modal;
|
|
|
|
|
2013-04-14 08:52:47 +00:00
|
|
|
//EnableWindow(hwnd, false) sends WM_KILLFOCUS; deactivating said window
|
|
|
|
//EnableWindow(hwnd, true) does not restore lost focus
|
|
|
|
//when a modal loop finishes, and the dialog is dismissed, the application loses focus entirely
|
|
|
|
//due to anti-focus-stealing code in Windows, SetForegroundWindow() cannot restore lost focus
|
|
|
|
//further, GetActiveWindow() returns nothing when all windows have lost focus
|
|
|
|
//thus, we must use a focus-stealing hack to reclaim the focus we never intended to dismiss;
|
|
|
|
//and we must replicate GetActiveWindow() by scanning the Z-order of windows for this process
|
|
|
|
|
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
|
|
|
void pWindow::updateModality() {
|
2013-04-14 08:52:47 +00:00
|
|
|
//bind thread input to process that currently has input focus
|
|
|
|
auto threadId = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
|
|
|
|
AttachThreadInput(threadId, GetCurrentThreadId(), TRUE);
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
pWindow* topMost = nullptr;
|
|
|
|
for(auto& object : pObject::objects) {
|
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
|
|
|
if(dynamic_cast<pWindow*>(object) == nullptr) continue;
|
2013-05-02 11:25:45 +00:00
|
|
|
pWindow* p = (pWindow*)object;
|
2013-04-14 08:52:47 +00:00
|
|
|
bool enable = modal.size() == 0 || modal.find(p);
|
2013-05-02 11:25:45 +00:00
|
|
|
if(IsWindowEnabled(p->hwnd) != enable) EnableWindow(p->hwnd, enable);
|
2013-04-14 08:52:47 +00:00
|
|
|
if(enable && p->window.visible()) {
|
|
|
|
if(topMost == nullptr) topMost = p;
|
|
|
|
else if(GetWindowZOrder(p->hwnd) < GetWindowZOrder(topMost->hwnd)) topMost = p;
|
|
|
|
}
|
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
|
|
|
}
|
2013-04-14 08:52:47 +00:00
|
|
|
|
|
|
|
//set input focus on top-most window
|
|
|
|
if(topMost) {
|
|
|
|
SetForegroundWindow(topMost->hwnd);
|
|
|
|
SetActiveWindow(topMost->hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
//unbind thread input hook
|
|
|
|
AttachThreadInput(threadId, GetCurrentThreadId(), FALSE);
|
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
|
|
|
}
|
|
|
|
|
2011-02-27 09:11:01 +00:00
|
|
|
static const unsigned FixedStyle = WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX | WS_BORDER;
|
|
|
|
static const unsigned ResizableStyle = WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME;
|
2011-02-24 09:25:20 +00:00
|
|
|
|
2012-08-07 13:28:00 +00:00
|
|
|
Window& pWindow::none() {
|
2013-05-02 11:25:45 +00:00
|
|
|
static Window* window = nullptr;
|
2012-08-07 13:28:00 +00:00
|
|
|
if(window == nullptr) window = new Window;
|
|
|
|
return *window;
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pWindow::append(Layout& layout) {
|
2011-02-24 09:25:20 +00:00
|
|
|
Geometry geom = window.state.geometry;
|
|
|
|
geom.x = geom.y = 0;
|
|
|
|
layout.setGeometry(geom);
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pWindow::append(Menu& menu) {
|
2011-09-09 04:16:25 +00:00
|
|
|
menu.p.parentWindow = &window;
|
2011-02-24 09:25:20 +00:00
|
|
|
updateMenu();
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pWindow::append(Widget& widget) {
|
2013-11-28 10:29:01 +00:00
|
|
|
if(GetParentWidget(&widget)) {
|
|
|
|
widget.p.parentHwnd = GetParentWidget(&widget)->p.hwnd;
|
|
|
|
} else {
|
|
|
|
widget.p.parentHwnd = window.p.hwnd;
|
|
|
|
}
|
2011-09-05 03:48:23 +00:00
|
|
|
widget.p.orphan();
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
if(widget.font().empty() && !window.state.widgetFont.empty()) {
|
|
|
|
widget.setFont(window.state.widgetFont);
|
|
|
|
}
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool pWindow::focused() {
|
|
|
|
return (GetForegroundWindow() == hwnd);
|
|
|
|
}
|
|
|
|
|
2011-02-27 09:05:10 +00:00
|
|
|
Geometry pWindow::frameMargin() {
|
|
|
|
unsigned style = window.state.resizable ? ResizableStyle : FixedStyle;
|
|
|
|
if(window.state.fullScreen) style = 0;
|
2013-05-02 11:25:45 +00:00
|
|
|
RECT rc = {0, 0, 640, 480};
|
2011-02-27 09:05:10 +00:00
|
|
|
AdjustWindowRect(&rc, style, window.state.menuVisible);
|
|
|
|
unsigned statusHeight = 0;
|
|
|
|
if(window.state.statusVisible) {
|
|
|
|
RECT src;
|
|
|
|
GetClientRect(hstatus, &src);
|
|
|
|
statusHeight = src.bottom - src.top;
|
|
|
|
}
|
2013-05-02 11:25:45 +00:00
|
|
|
return {abs(rc.left), abs(rc.top), (rc.right - rc.left) - 640, (rc.bottom - rc.top) + statusHeight - 480};
|
2011-02-27 09:05:10 +00:00
|
|
|
}
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
Geometry pWindow::geometry() {
|
|
|
|
Geometry margin = frameMargin();
|
2011-06-05 03:45:04 +00:00
|
|
|
|
2011-08-06 14:03:52 +00:00
|
|
|
RECT rc;
|
|
|
|
if(IsIconic(hwnd)) {
|
|
|
|
//GetWindowRect returns -32000(x),-32000(y) when window is minimized
|
|
|
|
WINDOWPLACEMENT wp;
|
|
|
|
GetWindowPlacement(hwnd, &wp);
|
|
|
|
rc = wp.rcNormalPosition;
|
|
|
|
} else {
|
|
|
|
GetWindowRect(hwnd, &rc);
|
|
|
|
}
|
2011-02-24 09:25:20 +00:00
|
|
|
|
|
|
|
signed x = rc.left + margin.x;
|
|
|
|
signed y = rc.top + margin.y;
|
|
|
|
unsigned width = (rc.right - rc.left) - margin.width;
|
|
|
|
unsigned height = (rc.bottom - rc.top) - margin.height;
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
return {x, y, width, height};
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pWindow::remove(Layout& layout) {
|
2011-09-05 03:48:23 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pWindow::remove(Menu& menu) {
|
2011-09-05 03:48:23 +00:00
|
|
|
updateMenu();
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pWindow::remove(Widget& widget) {
|
2011-09-05 03:48:23 +00:00
|
|
|
widget.p.orphan();
|
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setBackgroundColor(Color color) {
|
2011-02-24 09:25:20 +00:00
|
|
|
if(brush) DeleteObject(brush);
|
2011-08-06 14:03:52 +00:00
|
|
|
brushColor = RGB(color.red, color.green, color.blue);
|
2011-02-24 09:25:20 +00:00
|
|
|
brush = CreateSolidBrush(brushColor);
|
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setDroppable(bool droppable) {
|
|
|
|
DragAcceptFiles(hwnd, droppable);
|
|
|
|
}
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
void pWindow::setFocused() {
|
|
|
|
if(window.state.visible == false) setVisible(true);
|
|
|
|
SetFocus(hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::setFullScreen(bool fullScreen) {
|
2011-02-24 09:27:21 +00:00
|
|
|
locked = true;
|
|
|
|
if(fullScreen == false) {
|
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE, WS_VISIBLE | (window.state.resizable ? ResizableStyle : FixedStyle));
|
|
|
|
setGeometry(window.state.geometry);
|
|
|
|
} else {
|
2014-01-05 09:59:17 +00:00
|
|
|
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};
|
2011-02-24 09:27:21 +00:00
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE, WS_VISIBLE | WS_POPUP);
|
|
|
|
Geometry margin = frameMargin();
|
2014-01-05 09:59:17 +00:00
|
|
|
setGeometry({
|
|
|
|
geometry.x + margin.x, geometry.y + margin.y,
|
|
|
|
geometry.width - margin.width, geometry.height - margin.height
|
|
|
|
});
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
|
|
|
locked = false;
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setGeometry(Geometry geometry) {
|
2011-02-24 09:25:20 +00:00
|
|
|
locked = true;
|
|
|
|
Geometry margin = frameMargin();
|
|
|
|
SetWindowPos(
|
|
|
|
hwnd, NULL,
|
|
|
|
geometry.x - margin.x, geometry.y - margin.y,
|
|
|
|
geometry.width + margin.width, geometry.height + margin.height,
|
|
|
|
SWP_NOZORDER | SWP_FRAMECHANGED
|
|
|
|
);
|
|
|
|
SetWindowPos(hstatus, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED);
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& layout : window.state.layout) {
|
2011-02-24 09:25:20 +00:00
|
|
|
Geometry geom = this->geometry();
|
|
|
|
geom.x = geom.y = 0;
|
|
|
|
layout.setGeometry(geom);
|
|
|
|
}
|
|
|
|
locked = false;
|
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setMenuFont(string font) {
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::setMenuVisible(bool visible) {
|
|
|
|
locked = true;
|
|
|
|
SetMenu(hwnd, visible ? hmenu : 0);
|
|
|
|
setGeometry(window.state.geometry);
|
|
|
|
locked = false;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void pWindow::setModal(bool modality) {
|
2013-03-15 13:11:33 +00:00
|
|
|
if(modality == true) {
|
2013-12-07 09:12:37 +00:00
|
|
|
modal.appendOnce(this);
|
2013-03-15 13:11:33 +00:00
|
|
|
updateModality();
|
|
|
|
while(window.state.modal) {
|
|
|
|
Application::processEvents();
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
if(Application::main) {
|
|
|
|
Application::main();
|
|
|
|
} else {
|
|
|
|
usleep(20 * 1000);
|
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
if(auto position = modal.find(this)) modal.remove(position());
|
|
|
|
updateModality();
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
void pWindow::setResizable(bool resizable) {
|
|
|
|
SetWindowLongPtr(hwnd, GWL_STYLE, window.state.resizable ? ResizableStyle : FixedStyle);
|
|
|
|
setGeometry(window.state.geometry);
|
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setStatusFont(string font) {
|
2011-09-05 03:48:23 +00:00
|
|
|
if(hstatusfont) DeleteObject(hstatusfont);
|
|
|
|
hstatusfont = pFont::create(font);
|
|
|
|
SendMessage(hstatus, WM_SETFONT, (WPARAM)hstatusfont, 0);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setStatusText(string text) {
|
2011-02-24 09:25:20 +00:00
|
|
|
SendMessage(hstatus, SB_SETTEXT, 0, (LPARAM)(wchar_t*)utf16_t(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::setStatusVisible(bool visible) {
|
|
|
|
locked = true;
|
|
|
|
ShowWindow(hstatus, visible ? SW_SHOWNORMAL : SW_HIDE);
|
|
|
|
setGeometry(window.state.geometry);
|
|
|
|
locked = false;
|
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setTitle(string text) {
|
2011-02-24 09:25:20 +00:00
|
|
|
SetWindowText(hwnd, utf16_t(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::setVisible(bool visible) {
|
|
|
|
ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE);
|
Update to v088r15 release.
byuu says:
Changelog:
- default placement of presentation window optimized for 1024x768
displays or larger (sorry if yours is smaller, move the window
yourself.)
- Direct3D waits until a previous Vblank ends before waiting for the
next Vblank to begin (fixes video timing analysis, and ---really---
fast computers.)
- Window::setVisible(false) clears modality, but also fixed in Browser
code as well (fixes loading images on Windows hanging)
- Browser won't consume full CPU resources (but timing analysis will,
I don't want stalls to affect the results.)
- closing settings window while analyzing stops analysis
- you can load the SGB BIOS without a game (why the hell you would want
to ...)
- escape closes the Browser window (it won't close other dialogs, it has
to be hooked up per-window)
- just for fun, joypad hat up/down moves in Browser file list, any
joypad button loads selected game [not very useful, lacks repeat, and
there aren't GUI load file open buttons]
- Super Scope and Justifier crosshairs render correctly (probably
doesn't belong in the core, but it's not something I suspect people
want to do themselves ...)
- you can load GB, SGB, GB, SGB ... without problems (not happy with how
I did this, but I don't want to add an Interface::setInterface()
function yet)
- PAL timing works as I want now (if you want 50fps on a 60hz monitor,
you must not use sync video) [needed to update the DSP frequency when
toggling video/audio sync]
- not going to save input port selection for now (lot of work), but it
will properly keep your port setting across cartridge loads at least
[just goes to controller on emulator restart]
- SFC overscan on and off both work as expected now (off centers image,
on shows entire image)
- laevateinn compiles properly now
- ethos goes to ~/.config/bsnes now that target-ui is dead [honestly,
I recommend deleting the old folder and starting over]
- Emulator::Interface callbacks converted to virtual binding structure
that GUI inherits from (simplifies binding callbacks)
- this breaks Super Game Boy for a bit, I need to rethink
system-specific bindings without direct inheritance
Timing analysis works spectacularly well on Windows, too. You won't get
your 100% perfect rate (unless maybe you leave the analysis running
overnight?), but it'll get really freaking close this way.
2012-05-07 23:29:03 +00:00
|
|
|
if(visible == false) setModal(false);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 09:42:45 +00:00
|
|
|
void pWindow::setWidgetFont(string font) {
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::constructor() {
|
|
|
|
brush = 0;
|
|
|
|
|
|
|
|
hwnd = CreateWindow(L"phoenix_window", L"", ResizableStyle, 128, 128, 256, 256, 0, 0, GetModuleHandle(0), 0);
|
|
|
|
hmenu = CreateMenu();
|
|
|
|
hstatus = CreateWindow(STATUSCLASSNAME, L"", WS_CHILD, 0, 0, 0, 0, hwnd, 0, GetModuleHandle(0), 0);
|
2011-09-05 03:48:23 +00:00
|
|
|
hstatusfont = 0;
|
2013-11-28 10:29:01 +00:00
|
|
|
setStatusFont(Font::sans(8));
|
2011-02-24 09:25:20 +00:00
|
|
|
|
|
|
|
//status bar will be capable of receiving tab focus if it is not disabled
|
|
|
|
SetWindowLongPtr(hstatus, GWL_STYLE, GetWindowLong(hstatus, GWL_STYLE) | WS_DISABLED);
|
|
|
|
|
|
|
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&window);
|
2013-07-29 09:42:45 +00:00
|
|
|
setDroppable(window.state.droppable);
|
2013-05-02 11:25:45 +00:00
|
|
|
setGeometry({128, 128, 256, 256});
|
2013-11-28 10:29:01 +00:00
|
|
|
|
|
|
|
DWORD color = GetSysColor(COLOR_3DFACE);
|
|
|
|
window.state.backgroundColor = Color((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color >> 0), 255u);
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
2011-09-05 03:48:23 +00:00
|
|
|
void pWindow::destructor() {
|
|
|
|
DeleteObject(hstatusfont);
|
|
|
|
DestroyWindow(hstatus);
|
|
|
|
DestroyMenu(hmenu);
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
void pWindow::updateMenu() {
|
|
|
|
if(hmenu) DestroyMenu(hmenu);
|
|
|
|
hmenu = CreateMenu();
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& menu : window.state.menu) {
|
2011-09-05 03:48:23 +00:00
|
|
|
menu.p.update(window);
|
2011-09-09 04:16:25 +00:00
|
|
|
if(menu.visible()) {
|
|
|
|
AppendMenu(hmenu, MF_STRING | MF_POPUP, (UINT_PTR)menu.p.hmenu, utf16_t(menu.state.text));
|
|
|
|
}
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetMenu(hwnd, window.state.menuVisible ? hmenu : 0);
|
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2013-11-28 10:29:01 +00:00
|
|
|
void pWindow::onClose() {
|
|
|
|
if(window.onClose) window.onClose();
|
|
|
|
else window.setVisible(false);
|
|
|
|
if(window.state.modal && !window.state.visible) window.setModal(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::onDrop(WPARAM wparam) {
|
|
|
|
lstring paths = DropPaths(wparam);
|
|
|
|
if(paths.empty()) return;
|
|
|
|
if(window.onDrop) window.onDrop(paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pWindow::onEraseBackground() {
|
|
|
|
if(brush == 0) return false;
|
|
|
|
RECT rc;
|
|
|
|
GetClientRect(hwnd, &rc);
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
BeginPaint(hwnd, &ps);
|
|
|
|
FillRect(ps.hdc, &rc, brush);
|
|
|
|
EndPaint(hwnd, &ps);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::onModalBegin() {
|
|
|
|
if(Application::Windows::onModalBegin) Application::Windows::onModalBegin();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::onModalEnd() {
|
|
|
|
if(Application::Windows::onModalEnd) Application::Windows::onModalEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::onMove() {
|
|
|
|
if(locked) return;
|
|
|
|
|
|
|
|
Geometry windowGeometry = geometry();
|
|
|
|
window.state.geometry.x = windowGeometry.x;
|
|
|
|
window.state.geometry.y = windowGeometry.y;
|
|
|
|
|
|
|
|
if(window.onMove) window.onMove();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pWindow::onSize() {
|
|
|
|
if(locked) return;
|
|
|
|
SetWindowPos(hstatus, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED);
|
|
|
|
|
|
|
|
Geometry windowGeometry = geometry();
|
|
|
|
window.state.geometry.width = windowGeometry.width;
|
|
|
|
window.state.geometry.height = windowGeometry.height;
|
|
|
|
|
|
|
|
for(auto& layout : window.state.layout) {
|
|
|
|
Geometry geom = geometry();
|
|
|
|
geom.x = geom.y = 0;
|
|
|
|
layout.setGeometry(geom);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(window.onSize) window.onSize();
|
|
|
|
}
|
|
|
|
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|