LIJI32 / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
Other
1.68k stars 211 forks source link

(Proposal) GNUStep support for Cocoa UI #77

Closed wyatt8740 closed 8 months ago

wyatt8740 commented 6 years ago

This is mostly just a thought and suggestion; I am not sure if it is possible because I have next to zero Cocoa experience. Would it be possible to port the Cocoa UI to other platforms by using GNUStep? Is there any interest in doing so? It's not got all of the features of Cocoa, but there's enough that I think it's feasible from what I can glean from the documentation. Go ahead and close this if you're not interested.

LIJI32 commented 6 years ago

Not sure how possible it is (Not sure how active GNUStep is and what APIs it actually supports), but I'll keep it open as a "nice to have" feature.

wyatt8740 commented 6 years ago

Thanks for the quick follow-up. Does Cocoa SameBoy use OpenGL? Does Cocoa care about OpenGL, or is that handled outside of the framework?

(I haven't had a mac in ages and don't program for them much, but I might be interested to try learning some ObjC.)

The main thing that would need to be done would be getting away from requiring XCode to build the program. There are some tools that purportedly convert xcodeproj files, but I rarely have luck with them.

LIJI32 commented 6 years ago

Cocoa has NSOpenGLView which is an NSView subclass that lets you use OpenGL to render it, which is what SameBoy uses. Also, SameBoy doesn't use Xcode at all (I use a single make based build system for all platforms and targets).

wyatt8740 commented 6 years ago

Well that's excellent then. I should have checked, but typically I just anticipate OS X programs to use XCode (much to my chagrin). Looks like GNUStep does have NSOpenGLView, which is good. https://github.com/gnustep/tests-examples/tree/master/gui/MyGL

wyatt8740 commented 6 years ago

Looks like you use Carbon, so unless there's a way to work around it, that kills easy GNUstep compatibility. Whatever uses it will have to be rewritten to work. I wrote up a small custom Makefile to try to build it and it trips up there. Carbon is not part of the NEXTstep/Openstep framework. It looks (?) like you are using it for keyboard input. For a more complete list: http://mediawiki.gnustep.org/index.php/Writing_portable_code CoreAudio would need replacing, as would QuickLook's use of CoreFoundation and CoreServices - or at least, that's what a quick grep would indicate.

Also, typedef enum : NSUInteger {..} does not appear to be strictly valid ObjC, but rather an LLVM extension. GCC complains about it where you use it near the top of Cocoa/GBButtons.h. Removing the colon and NSUInteger makes that error go away, at least.

And you have some other places where you use LLVM-specific (i.e. nonstandard) conventions, like '@' signs. See http://clang.llvm.org/docs/ObjectiveCLiterals.html . I have noticed them in AppDelegate.m.

LIJI32 commented 6 years ago

Carbon is only used for input remapping, which definitely won't work on GNUStep because it also uses private APIs, but this isn't anything major.

LIJI32 commented 6 years ago

Correct me if I'm wrong, but it seems that GNUStep is missing AudioToolbox? If so, this makes audio output impossible.

paulwalker-dev commented 8 months ago

Is there any future plans to implement this?

LIJI32 commented 8 months ago

I did look into it a few months ago, GNUStep and related projects are lacking even in basic AppKit support. The best I could get is a single window with a menu bar (that didn't even work); no audio or video what-so-ever, and since menus (and keyboard shortcuts) didn't work either, I have no way to interact with anything. I'm closing this as it seems that GNUStep (and derived projects e.g. Cocotron) isn't reaching a state where it's usable for porting any non-trivial macOS app any time soon.