Open zawata opened 5 months ago
Also I haven't actually tested FFDemo, I've only confirmed it doesn't crash anymore. Gotta dig out an xbox controller and get it working with my mac to test it.
Ok So MacOS doesn't have force-feedback implemented I guess so no point in fixing FFDemo. I can try to implement it but it's a little too complex for this PR so I've backed out the FFDemo changes.
I did however find a bad string conversion that was segfaulting when a controller was attached so I've fixed that. Looks like game controllers are working now mostly. There's some bugs I'm still looking into.
Hey, I've been trying to implement OIS into my emulator but for reasons I haven't determined yet, it isn't working. Might have another patch for that in the near future when I figure it out.
While digging around in the codebase I learned that the demos barely supported macos so I took a quick stab at fixing them.
The FFDemo just need cocoa to be implemented but the ConsoleDemo was the interesting one.
ReceiveNextEvent
was actually returning an error-9874
which according to https://www.osstatus.com/ iseventNotHandledErr
which explains why the rest of the demo was non-functional.I assume that the carbon Api's became fully incompatible with Cocoa Objects on an older version of MacOS(I'm on sonoma). So i switched over to the cocoa versions of these functions. Custom event loops like this are not really recommended for Cocoa Apps for several reasons but I don't think any are relevant to this example.
I took some inspiration from wxWidgets for the implementation. you can read more about it here: https://github.com/wxWidgets/wxWidgets/blob/19aee81c1deb876e965661fd902565615a6a09f3/src/osx/cocoa/evtloop.mm and here: https://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
If you think we should instead be a little bit more supportive of Native Cocoa App Architecture then I'll probably need to do it in another PR and it would take some refactors to the demos to accomplish. Just let me know.
closes #35