Introducing in-page emulator on Wiki pages!

Following @Jonathan 's suggestion I spent the past few hours implementing RVMPlayer for the wiki pages as well!

When a page contains a dsk image (such as XMas-tro 2009 - CPCWiki ) you’ll get a “Play” button next to the dsk image. This will bring up a modal with the emulator, CAT’ing automatically.

I tried implementing it directly on the page, but it caused some issues I couldn’t fix (not quickly, at least), but I think this implementation is nice, too!

Do test it and let me know what you think!

This is perfect. Maybe other websites will follow suit (e.g. https://www.cpc-power.com).

Thanks for implementing it.

Just something I notice.

First I have to explain one consequence of a browser (at least Firefox) implementing “resist fingerprinting”. When enabled, the Javascript APIs do not reveal the local keyboard layout to Javascript code. If Javascript code queries information about keyboard layout it get the same answer (maybe a common US keyboard layout) whatever the actual keyboard layout. You see where this is going now, right?

Now the issue.

An Amstrad CPC emulator in a browser is Javascript code that typically makes assumptions about the physical keyboard layout.

One result is that with a French layout and a browser profile that has “resist fingerprinting” enabled, visiting your example XMas-tro 2009 - CPCWiki, the keyboard layout is so botched that I cannot even type inside the emulator a quote ".

Strangely enough, all letters are okay. But pressing the letters 1 to 9 then 0 (which on a French keyboard produce symbols &é"'(-è_çà here produces 7;;9--. Some keys do nothing, the ones that do produce something (in order) are 134568. Confusing? Yeah, me too.

It’s one of the layers of mess which is less of a problem when creating prods that can fully work using only the keys that are the same in QWERTY AZERTY QWERTZ, see Why make such great games if most people can't play them properly? - #2 by cpcitor

So I’ve been looking into it. As far as I can tell, there’s no solution, only workarounds - like a running a profile with RFP disabled. Or switching the keyboard locale.

Because RVMPlayer’s engine provides no API to select a regional keyboard layout or remap individual keys, there is no code we can add to the wiki’s code that bypasses the browser’s deliberate spoofing. And, fro what I’m reading, FF users have to accept the increased privacy in exchange to functionality loss.

Regarding the symbols and numbers - no idea why FF does this :smiley: The top row normally produces symbols and numbers are shifted, and looks like FF with FRP enabled reports the physical buttons being pressed as under a US layout, but mixed with French localised key values?

Sorry I can’t help…

Is it possible for the emulator to also be displayed with the CPRs? :slight_smile:

If and when RVM Player supports it, I’m afraid!

There is an option that some emulators consider: don’t try to be smart about physical host keyboard layout, just refrain from assuming anything about it.

In other words accept when an API provides a symbol not a keyboard position.

In this case when Javascript APIs say “user pressed <whatever>” dont try to guess that “assuming a physical host with a regular PC105 keyboard with French Azerty layout this symbol should be what comes when user presses key at row x col y which I’ll map to CPC physical key row x’ col y’”.

Instead accept that e.g. the user pressed “some key that yields a quote symbol”. Have a map from symbol to CPC keys, independent from physical host keyboard. It may require a sequence in the emulated machine, like “press shift, press 2, release 2, release shift”.

Arnoldemu definitely allows a similar logic and calls it “translated”, as opposed to “positional”.
I would call it “symbol-based”.

I think caprice32 allows it, too.

One benefit is that you can type to the CPC with your PC keyboard just like in any program. Great for programming or editing any kind of text. And for typing run"disc.

Back to current situation: it depends on the emulator supporting such a physical-keyboard-independent logic. Which I guess RVM does not?

Spot on :smiley:

It doesn’t expose any options that I can see…