2015-12-30 06:41:46 +00:00
|
|
|
#if defined(Hiro_Window)
|
|
|
|
|
2013-03-15 13:11:33 +00:00
|
|
|
@interface CocoaWindow : NSWindow <NSWindowDelegate> {
|
|
|
|
@public
|
2015-12-30 06:41:46 +00:00
|
|
|
hiro::mWindow* window;
|
2013-05-02 11:25:45 +00:00
|
|
|
NSMenu* menuBar;
|
|
|
|
NSMenu* rootMenu;
|
2018-07-02 01:55:42 +00:00
|
|
|
NSMenuItem* disableGatekeeper;
|
2013-05-02 11:25:45 +00:00
|
|
|
NSTextField* statusBar;
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
2015-12-30 06:41:46 +00:00
|
|
|
-(id) initWith:(hiro::mWindow&)window;
|
2013-03-15 13:11:33 +00:00
|
|
|
-(BOOL) canBecomeKeyWindow;
|
|
|
|
-(BOOL) canBecomeMainWindow;
|
2013-03-21 12:59:01 +00:00
|
|
|
-(void) windowDidBecomeMain:(NSNotification*)notification;
|
|
|
|
-(void) windowDidMove:(NSNotification*)notification;
|
|
|
|
-(void) windowDidResize:(NSNotification*)notification;
|
|
|
|
-(BOOL) windowShouldClose:(id)sender;
|
2013-07-29 09:42:45 +00:00
|
|
|
-(NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender;
|
|
|
|
-(BOOL) performDragOperation:(id<NSDraggingInfo>)sender;
|
2013-03-19 08:48:50 +00:00
|
|
|
-(NSMenu*) menuBar;
|
2013-03-15 13:11:33 +00:00
|
|
|
-(void) menuAbout;
|
|
|
|
-(void) menuPreferences;
|
2016-01-08 09:23:46 +00:00
|
|
|
-(void) menuDisableGatekeeperAutoRearm;
|
2013-03-15 13:11:33 +00:00
|
|
|
-(void) menuQuit;
|
2013-03-21 12:59:01 +00:00
|
|
|
-(NSTextField*) statusBar;
|
2013-03-15 13:11:33 +00:00
|
|
|
@end
|
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
namespace hiro {
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
struct pWindow : pObject {
|
|
|
|
Declare(Window, Object)
|
|
|
|
|
|
|
|
auto append(sLayout layout) -> void;
|
|
|
|
auto append(sMenuBar menuBar) -> void;
|
|
|
|
auto append(sStatusBar statusBar) -> void;
|
|
|
|
auto focused() const -> bool override;
|
|
|
|
auto frameMargin() const -> Geometry;
|
|
|
|
auto remove(sLayout layout) -> void;
|
|
|
|
auto remove(sMenuBar menuBar) -> void;
|
|
|
|
auto remove(sStatusBar statusBar) -> void;
|
|
|
|
auto setBackgroundColor(Color color) -> void;
|
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 setDismissable(bool dismissable) -> void;
|
2015-12-30 06:41:46 +00:00
|
|
|
auto setDroppable(bool droppable) -> void;
|
|
|
|
auto setFocused() -> void override;
|
|
|
|
auto setFullScreen(bool fullScreen) -> void;
|
|
|
|
auto setGeometry(Geometry geometry) -> void;
|
|
|
|
auto setModal(bool modal) -> void;
|
|
|
|
auto setResizable(bool resizable) -> void;
|
|
|
|
auto setTitle(const string& text) -> void;
|
|
|
|
auto setVisible(bool visible) -> void;
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto moveEvent() -> void;
|
|
|
|
auto sizeEvent() -> void;
|
|
|
|
auto statusBarHeight() -> uint;
|
|
|
|
auto statusBarReposition() -> void;
|
2013-03-15 13:11:33 +00:00
|
|
|
|
2015-12-30 06:41:46 +00:00
|
|
|
auto _append(mWidget& widget) -> void;
|
2016-01-08 09:23:46 +00:00
|
|
|
auto _geometry() -> Geometry;
|
2015-12-30 06:41:46 +00:00
|
|
|
|
|
|
|
CocoaWindow* cocoaWindow = nullptr;
|
2016-01-08 09:23:46 +00:00
|
|
|
Geometry windowedGeometry;
|
2013-03-15 13:11:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2015-12-30 06:41:46 +00:00
|
|
|
|
|
|
|
#endif
|