2015-06-12 13:14:38 +00:00
|
|
|
#if defined(Hiro_StatusBar)
|
|
|
|
|
|
|
|
namespace hiro {
|
|
|
|
|
|
|
|
auto pStatusBar::construct() -> void {
|
|
|
|
if(auto parent = _parent()) {
|
Update to v106r27 release.
byuu says:
Changelog:
- nall: merged Path::config() and Path::local() to Path::userData()
- ~/.local/share or %appdata or ~/Library/ApplicationSupport
- higan, bsnes: render main window icon onto viewport instead of
canvas
- should hopefully fix a brief flickering glitch that appears on
Windows
- icarus: improved Super Famicom heuristics for Starfox / Starwing RAM
- ruby/Direct3D: handle viewport size changes in lock() instead of
output()
- fixes icon disappearing when resizing main window
- hiro/Windows: remove WS_DISABLED from StatusBar to fix window
resize grip
- this is experimental: I initially used WS_DISABLED to work
around a focus bug
- yet trying things now, said bug seems(?) to have gone away at
some point ...
- bsnes: added advanced settings panel with real-time driver change
support
I'd like feedback on the real-time driver change, for possible
consideration into adding this to higan as well.
Some drivers just crash, it's a fact of life. The ASIO driver in
particular likes to crash inside the driver itself, without any error
messages ever returned to try and catch.
When you try to change a driver with a game loaded, it gives you a scary
warning, asking if you want to proceed.
When you change a driver, it sets a crash flag, and if the driver
crashes while initializing, then restarting bsnes will disable the
errant driver. If it fails in a recoverable way, then it sets the driver
to “None” and warns you that the driver cannot be used.
What I'm thinking of further adding is to call emulator→save() to
write out the save RAM contents beforehand (although the periodic
auto-saving RAM will handle this anyway when it's enabled), and possibly
it might be wise to capture an emulator save state, although those can't
be taken without advancing the emulator to the next frame, so that might
not be a good idea.
I'm also thinking we should show some kind of message somewhere when a
driver is set to “None”. The status bar can be hidden, so perhaps on the
title bar? Or maybe just a warning on startup that a driver is set to
“None”.
2018-05-25 08:02:38 +00:00
|
|
|
hwnd = CreateWindow(STATUSCLASSNAME, L"", WS_CHILD, 0, 0, 0, 0, parent->hwnd, nullptr, GetModuleHandle(0), 0);
|
2015-06-12 13:14:38 +00:00
|
|
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&reference);
|
|
|
|
setEnabled(self().enabled(true));
|
|
|
|
setFont(self().font(true));
|
|
|
|
setText(self().text());
|
|
|
|
setVisible(self().visible(true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pStatusBar::destruct() -> void {
|
|
|
|
if(hfont) { DeleteObject(hfont); hfont = nullptr; }
|
|
|
|
if(hwnd) { DestroyWindow(hwnd); hwnd = nullptr; }
|
|
|
|
if(auto parent = _parent()) {
|
|
|
|
parent->setGeometry(parent->state().geometry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pStatusBar::setEnabled(bool enabled) -> void {
|
|
|
|
//unsupported
|
|
|
|
}
|
|
|
|
|
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 pStatusBar::setFont(const Font& font) -> void {
|
2015-06-12 13:14:38 +00:00
|
|
|
if(hfont) DeleteObject(hfont);
|
|
|
|
hfont = pFont::create(font);
|
|
|
|
if(hwnd) SendMessage(hwnd, WM_SETFONT, (WPARAM)hfont, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pStatusBar::setText(const string& text) -> void {
|
|
|
|
if(hwnd) SendMessage(hwnd, SB_SETTEXT, 0, (LPARAM)(wchar_t*)utf16_t(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pStatusBar::setVisible(bool visible) -> void {
|
|
|
|
if(hwnd) ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE);
|
|
|
|
if(auto parent = _parent()) {
|
|
|
|
parent->setGeometry(parent->state().geometry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pStatusBar::_parent() -> maybe<pWindow&> {
|
|
|
|
if(auto parent = self().parentWindow(true)) {
|
|
|
|
if(auto self = parent->self()) return *self;
|
|
|
|
}
|
|
|
|
return nothing;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|