Page 1 of 3

Oricutron patches for Mac OS X

Posted: Tue Mar 04, 2014 11:47 am
by Hialmar
Hi,

It's me again :)

Here are a few files I have modified for Oricutron so that it works better on the Macintosh:
http://torguet.net/Hialmar/machine.c - I have modified the mapkey function so that my keyboard works (I use a PC keyboard on a Mac Mini but I suppose the problem is here for other keyboard as well - I'll check that on other Macs at work);
http://torguet.net/Hialmar/gui.c - I have modified the savesnap function so that, if the save box doesn't open (which is the case on Mac OS X 10.9 right now) it will save in ./snapshots/snapshot.sna (which is better than nothing - I plan to solve the problem with the save box not opening but for now I'm trying to learn Objective C as I don't know it).

I will iron this out before proposing it to Oricutron developers but would like to know if other people wanted to test this on other Macs (with a non French system for example) to see if my patch is okay.

If you want to test it without compiling I have an executable for Mac OS X 10.9 here:
http://torguet.net/Hialmar/oricutron

Cheers,
Patrice

Re: Oricutron patches for Mac OS X

Posted: Tue Mar 04, 2014 6:45 pm
by Xeron
Good work! I look forward to your changes going into the emulator once they are ready.

Speaking of which, would you be interested in having commit access, and taking over maintenance of the Mac port? The Mac port is a bit unloved at the moment, and needs some TLC :-)

Re: Oricutron patches for Mac OS X

Posted: Tue Mar 04, 2014 7:24 pm
by Hialmar
I would love to.

I will first try to solve the save file dialog problem and then I'll be able to merge the changes.

Re: Oricutron patches for Mac OS X

Posted: Tue Mar 04, 2014 8:59 pm
by Xeron
ok cool. Send me the email you use (or want to use) as your google code account via PM when you're ready.

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 5:12 pm
by ibisum
I'd be happy to help with any ports too ..

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 7:56 pm
by Xeron
Cool. All help welcome :)

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 9:22 pm
by Hialmar
I have checked with several keyboards on Macs at work (and with the 1.22 localized ROMs) and it's a mess.
Each keyboard gives a different ASCII code for the same key (mainly for the number keys).

I'm wondering if the best wouldn't be to give several keyboard mapping files that people could choose.

We could have:
- 1 for french Mac keyboard with Atmos or Oric-1 ROM ;
- 1 for french Mac keyboard with the Fr 1.22 ROM ;
- 1 for french PC keyboard with Atmos or Oric-1 ROM ;
- 1 for french PC keyboard with the Fr 1.22 ROM ;
...

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 9:31 pm
by Xeron
Yep.. its horrendous. This is why I haven't tackled it in all this time.

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 10:06 pm
by Hialmar
I will work on this and propose something to you.

The key mapping files could be customizable by the user.

We could have files like this:
38 = '1'
161 = '2'
34 = '3'

Meaning, if the keyboard generates an ASCII code of 38, this should be translated into the Oric key 1 (which shifted gives !).

And we could put a switch in the configuration file that would output ASCII codes for key presses so that the user can customize the keyboard as he wants.

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 10:09 pm
by ibisum
I think we might need to re-work the SDL handling to properly exploit SDL_KeyboardEvent for the keys that we want to have properly mapped 1-1 across the various platform barriers, and also the 'function key/platform-event-msg->menu' style events too. Any rework of the SDL key handling should be done with caution about things like the Android IME and iOS softkey events, which of course is where a lot of the general 'platform port' code comes from, in the first place .. so if SDL is going to do that work for us on those platforms, hmm ..

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 10:29 pm
by Hialmar
The biggest problem here is the way the Oric manages the keyboard.

As far as I understand, you have to give it the keycode of the key that was pressed/released and it then manages the modifiers keys (shift, ctrl, funct).

This is very different from SDL which gives you the ASCII character that a keypress produces along with the modifier keys.

So for example, on my keyboard the PC key matching "6" will give you a '-' if pressed alone, '6' if pressed along with shift, and '|' if pressed along with "Alt Gr".

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 10:33 pm
by Hialmar
Ah no I'm wrong, in my case SDL will always give a '-' when pressing the above mentioned key.

This is why I couldn't get any numbers with my keyboard.

Re: Oricutron patches for Mac OS X

Posted: Wed Mar 05, 2014 11:32 pm
by peacer
Speaking of keyboard patch of Oricutron, I'd like to remind my previously described issue.

As you know, Oric keyboard is standart english keyboard style.
Image

When you use Oricutron with english PC keyboard layout there's no problem with it as keys are nearly identical to Oric keyboard
Image

But, as I am using Turkish style keyboard on my laptop or PC, things get strange. Turkish keyboard layout is quite different from standart english keyboard.
Image

So, what happens if I click shift-8 on my keyboard, oricutron types "*" instead of "(" as if its english keyboard.

As you can see, in Turkish keyboard layout, keys located rightmost part of the keyboard are special turkish characters like Ş, Ğ, Ö, Ç, Ü etc. For example, if I want to type "; " in oricutron, I have to press Ş key on my keyboard. "?" is located on shift-"." etc.

I think you got my idea. As turkish kayboard layout differs from oric and oricutron, typing on Oricutron with Oric keyboard becomes really hard by this manner. I need to remember where it should be the :,;?-*/"@ keys are located... Usually I have to try different keys to find what I really want to type..

In euphoric, there was an option like "native keyboard" or something like that. So that, pressing the key on my PC keyboard types exactly what I pressed on Euphoric. But I could not find such an option in Oricutron.

Is it possible to do such setting on Oricutron too?

Re: Oricutron patches for Mac OS X

Posted: Thu Mar 06, 2014 9:20 am
by Hialmar
I have the same kind of problem with a French keyboard.

I think that changing this will require even more modifications to the emulation than what I proposed.

Re: Oricutron patches for Mac OS X

Posted: Thu Mar 06, 2014 9:42 am
by ibisum
The important thing, I think, is that we don't re-invent the SDL_KeyboardEvent/SDL_EnableUNICODE mechanism in our attempts to fix this in Oricutron - i.e. do *not* make another keymapping implementation, but rather use the one that SDL itself provides - as this will enable us to deal with porting to other platforms a lot easier.

What I think should happen is that the key thats on your physical keyboard should be the key that you use to get the same key on the Oric/Atmos - so if you've got a French or UK keyboard on your PC, it just works the way the labels work - you type the £, you get the £. I think this means we should be using SDL_EnableUNICODE somewhere .. anyway, I will have time to hack on Oricutron on the weekend (only got a few minutes to read machine.c at the moment) but if anyone else wants to have a crack at it I'd be happy to help in IRC or whatever ..