Jump to content

Recommended Posts

Posted (edited)

Hi, I updated the web version x16 emulator at https://sebastianvog.github.io/x16-emulator/x16emu.html

It has the latest R37 code, and some web assembly related fixes (audio, rendering on hdpi displays)

As an added feature for developers, who would like to show case their work online, you can now point a remote web folder to the emulator.

As example I used @SlithyMatt awesome ChaseVault game and put the chase vault files on a static web site and then pass in that URL via the ?manifest parameter

  https://sebastianvog.github.io/x16-emulator/x16emu.html?manifest=https://x16repos.s3.amazonaws.com/chasevault/

The web emulator expects/loads a manifest.json file from that location, loads all resources and then executes it. The manifest structure looks like this

{
  "manifest_version": "1.0",
  "name": "Chase Vault",
  "author": "Matt Heffernan",
  "app_version": "0.4",
  "license": "GPL 3",
  "start_prg": "CHASVALT.PRG",
  "resources": [
    "CHASVALT.PRG",
    "BITMAP.BIN",
    "MUSIC.BIN",
    "PAL.BIN",
    "SPRTATTR.BIN",
    "SPRITES.BIN",
    "STARTBG.BIN",
    "TILEMAP.BIN",
    "TILES.BIN",
    "WINMUSIC.BIN"
  ]
}

The format of the manifest is subject to change. This was a first shot at this. 

Let me know what you think. I hope this will be useful to showcase/share application with the community for easy consumption in a web browser.

cheers,

Sebastian

Edited by SebastianVoges
typo: manifest.json
  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites

Oh, that's pretty cool. Maybe we can have some sort of "Try it" button in the download section by reading such a manifest in the zip file?

  • Like 2

Share this post


Link to post
Share on other sites
30 minutes ago, Juju said:

Oh, that's pretty cool. Maybe we can have some sort of "Try it" button in the download section by reading such a manifest in the zip file?

Nice work Sebastian! And yes that's exactly what this feature is being developed for. We are aiming to have exactly that; a "Try it now" button in the software library that will load any program this way.

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, SlithyMatt said:

Very cool! Any plans to add sound support?

I have been looking into it and sound for WebAssembly is supported now(with issues).

Browsers don't allow playing of sound without prior user-interaction. There  is a audio icon (top left in fullscreen mode), which will toggle on/off the audio portion of the core emulator.. If you click it, the sound will start playing (not immediately sometimes, in ChaseVault you sometimes have to lose a life and then audio will start up again ).  Currently the audio output is  distorted, so something in the audio init is not correct for WebAssembly. I will look into it this weekend. Performance is also browser dependent, there is a noticeable slow down in Safari for me, whereas Chrome seems to run smoother.

 

Share this post


Link to post
Share on other sites

Hi @SebastianVoges! Impressive work! We have a copy of the emulator running on this site, available via the Try It Online Here button on the home page. Are you keeping the version on your Github page current? If so, maybe it would make sense to link directly there instead of having to keep our own version current, @Perifractic?

Share this post


Link to post
Share on other sites
13 minutes ago, MattGrandis said:

Hi @SebastianVoges! Impressive work! We have a copy of the emulator running on this site, available via the Try It Online Here button on the home page. Are you keeping the version on your Github page current? If so, maybe it would make sense to link directly there instead of having to keep our own version current, @Perifractic?

 I plan on keeping it current to the latest official release of the x16  emulator and plus changes on my end that might not have merged back yet to the main x16 emulator repo .  At some point I will move away from using GitHub pages as a static web-server and host the web emulator on AWS. It probably will also make sense to have a stable production version which lines up with official Emulator Releases and a development version which can change frequently.

 

Share this post


Link to post
Share on other sites
2 hours ago, SebastianVoges said:

Currently the audio output is  distorted, so something in the audio init is not correct for WebAssembly.

That's an issue that plagues Linux, too. It has to do with some bad assumptions in SDL. What you can do is cut down the sample rate so that you may have lower fidelity, but less distortion and "wobbliness".

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, SlithyMatt said:

That's an issue that plagues Linux, too. It has to do with some bad assumptions in SDL. What you can do is cut down the sample rate so that you may have lower fidelity, but less distortion and "wobbliness".

oh, that's good to know, ty!

Share this post


Link to post
Share on other sites
5 hours ago, MattGrandis said:

Hi @SebastianVoges! Impressive work! We have a copy of the emulator running on this site, available via the Try It Online Here button on the home page. Are you keeping the version on your Github page current? If so, maybe it would make sense to link directly there instead of having to keep our own version current, @Perifractic?

Yes I believe we do currently link directly to Sebastian's version (I changed it a few days ago) 😉

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, JimmyDansbo said:

@SebastianVoges Any chance you could help me understand why this does not work?

https://sebastianvog.github.io/x16-emulator/x16emu.html?manifest=https://cx16.dk/cx16maze/

It just stays at the loading screen

Thanks in advance

The following exception happened in the browser:

"Access to fetch at 'https://cx16.dk/cx16maze/manifest.json' from origin 'https://sebastianvog.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

This is a CORS issue. Basically the browser not allowing to fetch the resources from a different domain.

Not sure how much control you have over your backend, but can you configure the server to allow cross origin requests? This resource might help 

https://enable-cors.org/server.html

Oh and additionally: I made a mistake in my original post. it has to be a manifest.json file not a manifest.xml

but i still think CORS issue need to be fixed as well.

Also, I don't mind hosting for the short-term: https://sebastianvog.github.io/x16-emulator/x16emu.html?manifest=https://x16repos.s3.amazonaws.com/cx16maze/

 

Edited by SebastianVoges
link for s3 hosted cx16maze

Share this post


Link to post
Share on other sites

Once we can get the emulator on the final web domain it should then work for any apps uploaded to the software library at the same domain.

  • Like 1

Share this post


Link to post
Share on other sites

@MattGrandisBasic files I think it might not work currently due to how I pass it to the emulator. I can check later to see how this is implemented.  there might need to be an adjustment done, but the same concept should work.

I am also working on just supplying a .zip file to the emulator which can contain all the assets and manifest. I think that would be a bit easier to maintain instead of having to deal with folders. I am halfway done with it but stopped work on that a while ago. I will pick it up over the weekend. 

 

  • Like 2

Share this post


Link to post
Share on other sites

Passing a zip file would be great! We've already added a note to our implementation that it only works with PRG files. It is a fantastic feature nonetheless! Thanks for your work!

  • Like 2

Share this post


Link to post
Share on other sites

@MattGrandis @Perifractic

 I have an updated version here:

https://x16emu.s3.amazonaws.com/x16emu.html?manifest=https://x16repos.s3.amazonaws.com/chase.zip

Support for zip files in the ?manifest parameter was added. (the old way should also still work)

The emulator expects the manifest.json in the root of the zip.

Support for Basic programs was added: 

In the manifest, the basic file has to be specified with 

 "start_bas": "HELLO.BAS"

I also added error logging in the javascript console. If the emulator doesn't start as expected, the logging should hopefully point to the area of failure.

Lastly , I took some work-in-progress speed optimization code from @StephenHorn and Michael Browns Pull Request to make web emulator a lot more usable.

The zipped assets for the web emulator are under https://github.com/sebastianvog/x16-emulator/releases/tag/1.0.0-beta.2

By next weekend I hope to clean up the code,  add  some general readme for the manifest.json format, and create a pull request to get this back into the main x16 GitHub repo.

Cheers,

Sebastian

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Amazing work, @SebastianVoges! I'll upload that version to our site ASAP. It's going to make handling zip files so much easier for us, we definitely owe you a beverage of your choice!

  • Like 1

Share this post


Link to post
Share on other sites

I'm adding the new functionality now. I'll have to adapt some code on the server to add dealing with zip files, so until further notice, the Try it now function might break! I'll give notice here when everything's back to normal again.

  • Like 1

Share this post


Link to post
Share on other sites
54 minutes ago, MattGrandis said:

I'm adding the new functionality now. I'll have to adapt some code on the server to add dealing with zip files, so until further notice, the Try it now function might break! I'll give notice here when everything's back to normal again.

Sounds good.  And also if you think you the manifest/zip file mechanism for loading is missing something or could be done in a different/better way, please let me know. I am open to make modifications to make it as easy/useful as possible.

  • Like 1

Share this post


Link to post
Share on other sites

We've been mulling over whether it would be a good idea to be able to put the manifest.json OUTSIDE the zip file, but before you do any work in that direction (unless you want to), I'll try rewriting our code so it adds the manifest.json directly to the zip file. One thing though: it looks like the "old" way doesn't work anymore. It's throwing an error: "Unable to read manifest. Check the manifest http parameter".

See here: https://www.commanderx16.com/emulator/x16emu.html?manifest=/emulator/9-chase-vault/

The manifest.json file still exists like before.

Share this post


Link to post
Share on other sites
15 minutes ago, MattGrandis said:

We've been mulling over whether it would be a good idea to be able to put the manifest.json OUTSIDE the zip file, but before you do any work in that direction (unless you want to), I'll try rewriting our code so it adds the manifest.json directly to the zip file. One thing though: it looks like the "old" way doesn't work anymore. It's throwing an error: "Unable to read manifest. Check the manifest http parameter".

See here: https://www.commanderx16.com/emulator/x16emu.html?manifest=/emulator/9-chase-vault/

The manifest.json file still exists like before.

I am fixing that now... copy&paste bug. I wish I had some unit-tests that could have caught that.

In regards to the manifest.json separate from the zip, i thought about this too. Then inside the manifest we could have a link to the .zip file. also another thought if we do this, do we then really need the resources section or do we just load any file that is inside the zip the manifest is pointing to. That would make it easier to not have to maintain the list of resources to be loaded.

so the manifest could just be

{

...

start_prg: FILE.PRG

resource: https://x16repos.s3.amazonaws.com/chase.zip

}

I don't know, i kind of like that everything could be self-contained in one zip, but on the other hand it would simplify things. the developer would just upload a zip with all his x16 assets and just say what is the start_prg and don't worry about the resources section in the manifest

 

  • Like 1

Share this post


Link to post
Share on other sites

I'm with you. I think a self-contained zip file is best. I'm trying to help devs by creating the manifest.json on the fly and injecting it into the zip file, but if it already exists -- all the better!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use