All Uzebox Games Online! (Cuzebox and Emscripten)

The Uzebox now have a fully functional emulator! Download and discuss it here.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by nicksen782 »

You can now do your own button maps for whatever gamepad you have. They are saved to localStorage and reloaded when the page reloads. Additionally you can backup those settings and restore them via a JSON file. The JSON will add or replace existing entries.

This worked in Chrome, Firefox, and Opera. I think it will work in Microsoft Edge but Edge only seems to support Xbox gamepads so I cannot test this. I even tried the vJoy virtual gamepad (which also did not work but did work on other browsers.) Can someone else please test? Please PM me. I am especially interested in what "navigator.getGamepads" provides for "id" with Edge. I need that to link up gamepad button mappings.
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by L4rry »

nicksen782 wrote: Sun Jan 06, 2019 2:26 am You can now do your own button maps for whatever gamepad you have. They are saved to localStorage and reloaded when the page reloads. Additionally you can backup those settings and restore them via a JSON file. The JSON will add or replace existing entries.

This worked in Chrome, Firefox, and Opera. I think it will work in Microsoft Edge but Edge only seems to support Xbox gamepads so I cannot test this. I even tried the vJoy virtual gamepad (which also did not work but did work on other browsers.) Can someone else please test? Please PM me. I am especially interested in what "navigator.getGamepads" provides for "id" with Edge. I need that to link up gamepad button mappings.
Awesome! Gamepad support! I'll be able to test on Edge, Chrome and Firefox. I'll give you some feedback within the week (I've got a pair of logitech F310 gamepads). Good work :)
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by nicksen782 »

L4rry wrote: Sun Jan 06, 2019 6:54 am I'll be able to test on Edge, Chrome and Firefox.
Great! Thank you. Are those gamepads fairly common? I could add them to the built-in gamepad map list (which has MY gamepads at the moment, lol.)

... Oh, and also the eeprom.bin file is loaded/saved. You can resume your Alter Ego game now! I've even edited the file in Emuze (right in the emulator) when I cleared the file by mistake. I was on level 20. It works as expected.
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by L4rry »

nicksen782 wrote: Sun Jan 06, 2019 7:16 am Great! Thank you. Are those gamepads fairly common?
Yup, Logitech Gamepads are about as common as grass. Where I come from anyway :)

Ok, so I've done some testing. My feedback:
  • It works! :D
  • On an OSX machine (and I'm assuming any other Unix flavoured OS) the gamepad works for Chrome and Firefox in Direct Mode. For any browser on a Windows OS, you have to switch the controller from 'Direct Input' to 'XInput' mode. (Logitech controllers have a switch at the back to allow you to do this). I believe XInput is Microsoft specific.
  • I couldn't find my second controller to test multiplayer
  • There should be default button settings. I'm not familiar with the actual controller API but I would be surprised if there wasn't a standard layout. A player should be able to plug in a gamepad and just play without any setup
  • There should be some visual indication on the emulator landing page about controllers being connected
Hope this helps :)
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by nicksen782 »

It does help! Thank you.

Default Mapping:
There is actually a "standard" layout available. Unfortunately it matches up with gamepads with varying results, often totally wrong at least for the two gamepads I've been testing with. See, the issue is that you really do not know the button order that the browser will provide. For example, if you press the same button on Chrome and on Firefox it might not actually be shown as the same button in the list. The user might assume that the emu software is buggy. Garbage in, garbage out. A mapping really is needed. I could provide one that *works* but it would not work correctly most of the time. Better to tell the user to map their gamepad. The settings are saved automatically in browser storage for next time so the user should only need to do this once per gamepad. So, I could build in a mapping for the Xbox controller to be one of the available built-in defaults. That would be easy considering. Other controllers are all different though. I only have the two gamepads. Perhaps there are many common maps available. Still the button order may be presented differently in different browsers. Opera and Chrome appear to be the same. Firefox does things a little different.

Gamepad Statuses:
The only visual indication of gamepads working would be the small gamepad icon highlighted in the soft red. That actually indicates that the gamepads are being polled for. You are totally right, there should be some sort of indication that a gamepad became connected and if it needs to have a button mapping created. If a match exists then it is used automatically. Perhaps a status bar at the bottom could indicate which gamepads are seen and if they need mapping? I like that idea. What do you think?

I tested on the newest Linux Mint with Chrome, Firefox, and Opera. On Windows I tested in Edge and Chrome. Results were similar so unless the OS drivers are different they should be the same between each OS.

Oh, would you provide me a copy of your gamepad mapping for your Logitech gamepads? You can get it from the gamepad config screen. Click download there and you'll get a JSON file. Oh, from Firefox and Chrome. The mapping may turn out to be different.
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by L4rry »

nicksen782 wrote: Sun Jan 06, 2019 8:39 pm Oh, would you provide me a copy of your gamepad mapping for your Logitech gamepads? You can get it from the gamepad config screen. Click download there and you'll get a JSON file. Oh, from Firefox and Chrome. The mapping may turn out to be different.
I've attached those config files here as requested for my Logitech Gamepad F310:
EMU_gp_config_mappings_firefox.txt
(2.25 KiB) Downloaded 673 times
EMU_gp_config_mappings_chrome.txt
(2.25 KiB) Downloaded 689 times
I've changed the extensions to '.txt' from '.json' as phpBB refuses to attach '.json' files.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by nicksen782 »

Thanks! Confirmed. The browser reported gamepad buttons are not in the same order. Sure, the mapping works but only because you mapped the gamepad. So, a Firefox gamepad map does not match a Chrome gamepad map. In fact, the defaults (for my controllers) that I have in there would only work in one browser. Not a super big deal with the button mapping function but it is a big deal for automatic gamepad support. I guess I could indicate in the data the source browser since I do a small amount of fingerprinting on the gamepad id. That would be helpful as to have multiple browser configurations in the same file but would still need two configuration settings for a gamepad if you used two browsers. It is easy to map gamepads now though.

I'm working on the author db stuff now. This would be where a registered dev could add/remove/update games of their own.
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by L4rry »

nicksen782 wrote: Fri Dec 28, 2018 3:07 am Are there any features that you may like?
I ran into a problem this morning that I think could be solvable with a feature on the online emulator. I found myself without access this morning to the full game library when I needed it for a demo on hardware. I left my populated SD card at home.

Would it be feasible to have an option to download the entire games library as a zip file from the online player?
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by nicksen782 »

Yes. I could do that. Where would I put a button for that? I could just make the function and you could run it in the dev console too.

Or, I could just make the program acknowledge a new query string variable that when used would prompt you if you would like to download the whole library as a .zip. You would just need to use a special URL.

I had actually done this in the past. Here is a link I put on the wiki: http://uzebox.org/wiki/Latest_Rom_List . It is from January 5th, 2018 so the 2018 games are not in it. I'll update it soon and also add the feature.

A problem that I had was about files that may have the same name such as _hiscore.txt or something. Online I put each game and its files into their own separate folders. But, the bootloader does not recognize directories. I'm not sure if I want to take the risk in having the zip fail if a filename is not unique. What if I did a zip of the games folder and you just pulled out the files that you wanted?
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: All Uzebox Games Online! (Cuzebox and Emscripten)

Post by L4rry »

nicksen782 wrote: Fri Jan 11, 2019 7:12 am A problem that I had was about files that may have the same name such as _hiscore.txt or something. Online I put each game and its files into their own separate folders. But, the bootloader does not recognize directories. I'm not sure if I want to take the risk in having the zip fail if a filename is not unique. What if I did a zip of the games folder and you just pulled out the files that you wanted?
Yeah I think a couple of solutions spring to mind:
  • Zip the games library with sub folders as is, but also include a separate directory containing only the UZE files
  • Just Zip the games library with sub folders as is
  • Only include the UZE files and don't include any duplicate data files. Just select one. If two games use the same data file name and location, they won't be able to co-exist on an SD card anyway. This one is more work though.
Including just the games library with sub directories as is is likely the simplest and quickest to implement. The user can then sort out what combinations he/she wants on the sd card. This solution alone will already be very handy as a way to have a guaranteed complete and up to date library of games locally.
Post Reply