yoshisuga / MAME4iOS

Multiple Arcade Machine Emulator for iOS, iPadOS, tvOS, macOS (Catalyst)
Other
667 stars 105 forks source link

Benchmark mode, UIMODE key, and Developer.xcconfig #364

Closed ToddLa closed 2 years ago

ToddLa commented 2 years ago
yoshisuga commented 2 years ago

@ToddLa I also started on working on keyboard support. Let's chat about this and see where we want to go.

My implementation uses a custom view: https://github.com/yoshisuga/MAME4iOS/compare/custom_keyboard?expand=1

I ported over an existing implementation I started, and it uses swift. Mapping the MAME keys in swift was pretty painless as the C-interop with swift is ok as long as you don't have to deal with C structs and pointers (kind of a pain but doable through UnsafePointers) or C arrays (become tuples in swift and is a major pain).

The benchmark mode and dev xcconfig are really nice-to-haves though!

yoshisuga commented 2 years ago

I do prefer using a custom view over the system keyboard because there's no support for keyup/keydown events (you need to dispatch a keyup event with a delay), and landscape keyboard takes up too much space and would be unusable.

ToddLa commented 2 years ago

Yup as you see i emulate an up/down for a key from the keyboard, but a key on the toolbar does correct up/down

My code sets up the framework for a software keyboard, all that needs to happen is a custom view (instead of an empty one) gets returned from inputView when _showSoftwareKeyboard is YES

ToddLa commented 2 years ago

Also with a custom view we could set alpha when in full screen or landscape…..

Again I wanted to lay the groundwork for a keyboard (get all the firstRespojder crap working) by using the system One. Should be easy to add a custom view now

-Todd

On Jan 7, 2022, at 9:53 PM, Todd Laney @.***> wrote:

 Yup as you see i emulate an up/down for a key from the keyboard, but a key on the toolbar does correct up/down

My code sets up the framework for a software keyboard, all that needs to happen is a custom view (instead of an empty one) gets returned from inputView when _showSoftwareKeyboard is YES

Todd

On Jan 7, 2022, at 1:51 AM, yoshisuga @.***> wrote:



I do prefer using a custom view over the system keyboard because there's no support for keyup/keydown events (you need to dispatch a keyup event with a delay), and landscape keyboard takes up too much space and would be unusable.

— Reply to this email directly, view it on GitHubhttps://github.com/yoshisuga/MAME4iOS/pull/364#issuecomment-1007273902, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABCJK2SFOC3YQAHJD57IL53UU2ZQXANCNFSM5LGGLJWA. You are receiving this because you were mentioned.Message ID: @.***>

ToddLa commented 2 years ago

I removed the software keyboard from this PR, but I left in the KeyboardView property showSoftwareKeyboard, and the code in EmuController that set it. I also kept code set the UIMODE key to CMD+DELETE.

ToddLa commented 2 years ago

C-interop with swift is ok as long as you don't have to deal with C structs and pointers (kind of a pain but doable through UnsafePointers) or C arrays.

We can easily add some Swift callable functions to KeyboardView (or EmuController) to push a MAME key (ie set UP/DOWN) so the Swift code does not need to "get hands dirty"