Page 1 of 1

Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 10:25 am
by Hialmar
https://jamesfriend.com.au/porting-pce-emulator-browser

As anyone tried to do the same as above for one of our dear emulators ?

I’ll try but wanted to know if anyone did that already.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 3:42 pm
by jbperin
I haven't heard of a web oric emulator up to now.

And I must admit that this idea sounds very interesting.

Something like what they have for Dragon or Tandy computer:

http://www.6809.org.uk/xroar/online/

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 3:49 pm
by Dbug
Fabrice Frances had a Java Applet running Oric games for the 2004 and 2005 minigame compos:
http://oric.free.fr/Java/Minigame2004.html
http://oric.free.fr/Java/Minigame2005.html
and I believe he also had one for the Microtan, but yeah, Java on the client == meh

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 4:02 pm
by Hialmar
Ah yes I remember this.

The port of Oricutron is starting to work :
https://torguet.net/oric/Oricutron.html

But please don't try to open the menus or you will have to restart your browser ;)

Edit : It works on my iPad as well (which was the goal ;) ) but for some reason the shift keys don't work as intended.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 7:14 pm
by jbperin
waou .. :shock: that's cool :o

is it possible to host this emulator with a preloaded tap file ?

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 7:57 pm
by Hialmar
Yes that’s my goal.

A tap or a dsk.

Then I’ll try to provide the same but with a list of taps and dsks.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 08, 2020 10:05 pm
by Hialmar
Example loading tap:
https://torguet.net/oric/cyclotron/Oricutron.html

There is a problem with the dsk loading. I will look at this asap.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 09, 2020 1:21 am
by iss
Great result, congrats!

Actually some time ago I gave a try of emscripten to compile Oricutron and with small hacks it worked (well, kind of).
Since then I have the idea to make an Oric IDE for browser with integrated C compiler and Oricutron, but you know the free-time problem...

Anyway, well done @Hialmar! We can merge the changes in main repo when it's ready.

EDIT: About the DSK problem - check if the Microdisc (and all other) ROM files are properly named i.e. upper/lower case.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 09, 2020 9:51 am
by Hialmar
Yes that was a part of the problem you are right.

It works now :
http://torguet.net/oric/aigle/Oricutron.html

I had some problems with the way Oricutron autoloads dsks so I'll look at it a bit more as I have had to add some code that shouldn't be there.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 11, 2020 3:51 pm
by Hialmar
I have created a branch called www on the git repository :
https://github.com/pete-gordon/oricutron/tree/www

You will find a www directory and a Readme.txt file there to build your own Orics in browsers ;)

The goal will be to integrate everything in master but as it is still bugged (can't manage to get the menu to open) I'll do it later on.

Edit : the menus are now working. Now I need to work on file selectors.
It will take some time as there are tight loops there and I cannot do that.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 11, 2020 6:05 pm
by jbperin
That looks very very cool .. I need to test that as soon as find time.

Thank you very much for this oric web plugin.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 11, 2020 6:13 pm
by iss
Great! Thanks, I'll check it asap.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 11, 2020 9:53 pm
by Hialmar
Well the code is quite horrible right now so don’t make fun of me please;)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 11, 2020 10:41 pm
by iss
Hialmar wrote: Wed Nov 11, 2020 9:53 pm Well the code is quite horrible right now so don’t make fun of me please;)
Your code is just fine! Don't worry about such things :).
I saw some changes in files related to Mac's XCode project files - actually nothing special, so do you mind to preserve originals when we do merge?

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 12, 2020 6:31 am
by Hialmar
I was trying to have it working again with no luck so far.
I’ll try again and if it doesn’t work will revert to the old files.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 15, 2020 1:16 pm
by Hialmar
The menus are starting to work now.

You can check them here:
https://torguet.net/oric/menus/Oricutron.html

You can load Disks or Tapes using the menus.

It's unrelated but I have also managed to compile Oricutron with SDL2 on OSX which is way faster.
Edit : just found out that iss already did the last part.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 16, 2020 1:09 pm
by ibisum
This is awesome. For the record, I had thought about doing this myself, but since you guys have gone ahead and sorted it, I guess the next frontier is open. I will therefore start a port of Oricutron to the PineWatch. ;P

I have always dreamed of having an Oric wrist-watch.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Tue Nov 17, 2020 4:36 am
by Hialmar
Thanks 😊
Good luck on the watch port ;)

Now using the following code examples I’ll work on menus for mobile platforms using multitouch gestures :
https://erik-larsen.github.io/emscripten-sdl2-ogles2/

Next will be downloading taps and dsks from remote locations.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Tue Nov 17, 2020 2:49 pm
by xahmol
Hialmar wrote: Sun Nov 15, 2020 1:16 pm You can load Disks or Tapes using the menus.
Just to verify: it is correct you can not load your own images (yet)? Can only select files already on the server.

Otherwise: tremendous work!

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 18, 2020 11:25 am
by Hialmar
Yes that's something I'll work on.

You can do that only if you download the branch, install emscripten and build your own emulator page for your own website.

And thanks ;)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Nov 18, 2020 8:33 pm
by xahmol
Great! Would love to embed on my own site with my own software :)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 8:20 am
by Hialmar
Yes that's the goal. Once it's stable I hope we can host on this very website one or more Oricutron in the browser with Defence Force games and demos as well.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 10:09 am
by Dbug
Hialmar wrote: Thu Nov 19, 2020 8:20 am Yes that's the goal. Once it's stable I hope we can host on this very website one or more Oricutron in the browser with Defence Force games and demos as well.
For games, sure, that makes sense: They are interactive.
For demos, I think videos are better, proper captures with the CRT scanlines, etc... better than emulation.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 2:30 pm
by Hialmar
Ah yes you are right.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 4:07 pm
by Chema
Hialmar wrote: Thu Nov 19, 2020 8:20 am Yes that's the goal. Once it's stable I hope we can host on this very website one or more Oricutron in the browser with Defence Force games and demos as well.
I'm thinking about Blake's7, which auto saves. Not sure how that could fit here.... :(

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 4:35 pm
by Dbug
Chema wrote: Thu Nov 19, 2020 4:07 pm
Hialmar wrote: Thu Nov 19, 2020 8:20 am Yes that's the goal. Once it's stable I hope we can host on this very website one or more Oricutron in the browser with Defence Force games and demos as well.
I'm thinking about Blake's7, which auto saves. Not sure how that could fit here.... :(
Good point, it's almost like if the thing should fork the dsk if they are modified, so each person get their own version.
Or maybe saved locally (cookies?)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 6:19 pm
by Hialmar
The saves can be done in the browser using the IndexedDB.

And I will try to allow the dsk to be downloaded as well.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 19, 2020 8:03 pm
by Chema
Great! A solution exists :)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sat Nov 21, 2020 9:58 am
by Hialmar
I have a strange behaviour on the iPad.

When I use the virtual keyboard sticky mod keys and press shift and then another key (here ' ) I end up with the same key being pressed instead of the modified key (here " ).

I have tried tracing things in ay_pressed but I end up with the same traces as can be seen in the images here:

iPad:
Image

Mac:
Image
Image

Anyone has an idea about what I could look up ?

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 29, 2020 5:30 pm
by Hialmar
I have pushed a new version to the www branch.

You can now download .dsk and .tap files from the emulator's directory.
Those files are then stored in the browser's IndexedDB so that you can save your changes there.

Next thing to do: Allow files from the IndexedDB to be downloaded.

You can see a live demo here:
https://torguet.net/oric/

Edit: dammit, it broke the emulator on IOS :(
Edit2: I love Apple ;( With the external debugger it works...

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sun Nov 29, 2020 6:06 pm
by jbperin
Thank you very much.
That's really cool.

I consider you've just invented the easiest and most convenient way of using Oric software on nowaday computers.

Very valuable contribution

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 30, 2020 2:57 pm
by Hialmar
Thanks ;)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Wed Dec 02, 2020 5:17 pm
by Hialmar
You can now save snapshots and ort tapes in the browser storage (IndexedDB).

This was easier than the download option.
I'll work on the download thing during the week-end if I can.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Dec 03, 2020 10:55 am
by xahmol
Nice!
What would be server side requirements of embedding this in your own website? Or would framing in your hosted version be the best option?

(background: my work in progress 8 bit website is an Amazon Web Services hosted static website hosted from a S3 bucket via an AWS Cloudfront distribution, deployed via AWS Amplify from a source based on Gatsby/React. Needing a 24/7 online EC2 instance just for embedding this emulator is not a very attractive option from a cost and maintainance perspective. If it would be possible to run this with AWS Lambda and AWS Dynamo DB serverless components that would be ideal)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sat Dec 05, 2020 11:34 am
by Hialmar
I'm unsure about this. I have absolutely no experience with AWS.

Basically you just need some webspace anywhere and if you are lazy (like me) PHP installed.

If you don't have PHP installed then you'll have to update the index_nophp.html webpage by hand.
There are two JavaScript static arrays there that you need to populate with the names of the files.

The dir.php file does that automatically. It should be easy to port it to NodeJS if this is more available on AWS.

Anyway, I have now added the button that will let you download your files on your computer so that you resume playing on your own machine after downloading a real emulator.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sat Dec 05, 2020 3:10 pm
by xahmol
Well, if I Google around Emcripten should work on AWS Lambda using NodeJS indeed. But really have to delve in the how sometime then.
Alternative would be using an AWS Lightsail instance that I use for another website (Lightsail provides a full virtual server including PHP and Wordpress in my case) but wanted to avoid cross domain issues. Or seeing if I can run it via Docker in AWS Fargate (on demand Docker compute).
But if Lambda/Dynamo DB would suffice that would be so much more cost effective as AWS serverless components are very cost efficient if traffic is very low (like what I suspect for my humble website). Presently my website runs for less than three dollars a month while still offering blazing fast speeds as it is locally cached via Cloudfront CDN globally. For a few months still even for free as it fully falls under the first year free tier. Also maintenance for the server is zero as AWS does all the patching for you.
(But will stop hijacking this threat now. Reason I really want to do it in AWS also is because I want to hobby in AWS also for professional reasons and to keep knowledge up to date also for my AWS certification).

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sat Dec 05, 2020 5:08 pm
by iss
@Hialmar: Great work! I have the good feeling we are very close to the for-a-long-time-expected Oricutron's version 1.3 ;).
Personally I have few small improvements to commit (which will not change anything globally) but I wish to run all sources trough a code formatter and make them in shape as Xeron choose to be and keep them persistent in good outlook - IMO this is important for all Oric/Oricutron users.

Related to your work: do you have any idea about JS-toolkit for a kind of future web-GUI? Or we leave it just as 'widged' (with some API).

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Sat Dec 05, 2020 5:39 pm
by Hialmar
A web GUI would be good indeed. I'll think about it.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Mar 04, 2021 12:19 pm
by jbperin
Hi,

I've installed the OricutronJS on a mini site on my RPI at home and I'm getting ready to serve my own TAP file from home thank to this marvel !!

I want to reiterate my deepest congrats and my warmest thanks for this great tool. It's so so so so coooooOOOooollll


I have one question about the caching of the TAP file.

I put a .tap file in the web server directory and added its name in the list in the javascript (because i don't use php) of the index_nophp.html
But I realise that the first time the web browser read the .tap file is also the last time.

It's like if, once the .tap file is in the readwritefs of the browser storage, it will not be updated when the version on the server changes.

Unless the domain name changes or the name of the tap file changes.
Is there a way to force reloading of the tap file rather than always using the same version saved in the browser once for ever ?

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Mar 04, 2021 4:02 pm
by jbperin
jbperin wrote: Thu Mar 04, 2021 12:19 pm Is there a way to force reloading of the tap file rather than always using the same version saved in the browser once for ever ?
This lil hack in oricutron.html does the job :

Code: Select all

<script>
    Module.preRun.push(function () {
        ENV.FILE = sessionStorage.file+"?"+Math.floor(Math.random() * Math.floor(1973))
    });
</script>
Adding "?<aRandomNumber>" to the url of file bypass the cache mecanism of oricutron.js.
And the part following the "?" is just ignored by my nginx.

Then the page always reloads the last up-to-date .tap file.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 10, 2022 2:16 pm
by jumpjack
Is this project still under development?
Can this source code be used to implement loading of dsk files from user PC in modern browsers?

https://github.com/jumpjack/ReadWriteJS

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Tue Nov 15, 2022 8:14 am
by OulanB
For a JS Oric emulator you can try https://github.com/OulanB/OricJS. You can install in Chrome as Extension, developper mode, unpacked app ... click on screen to get the tape interface

Keymap is for a french apple keyboard (can be changed in io.js). Very small base code, only tapes are emulated

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Thu Nov 17, 2022 9:00 am
by jumpjack
I forked only the www folder of www branch into my repository:

https://github.com/jumpjack/oricutronJS

But I don't get how the disk filename is passed to oricutronJS upon clicking a link to oricutron.html. I see that PHP is actually not mandatory at all, but I can't go further. I know how to load a binary file from local hard disk or from remote server, but then how do I pass it to oricutron engine?

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 21, 2022 1:46 pm
by Hialmar
Hi there.

We'd better talk here.

I'll copy paste our conversation so far.

About the filename passed to OricutronJS:
In the index.html I copy the filename in the sessionstorage:
https://github.com/pete-gordon/oricutro ... x.html#L24

Then in oricutron.html I get the file name from the sessionstorage and copy it to the emulator's environment:
https://github.com/pete-gordon/oricutro ... .html#L191

Lastly, in the emulator code I retrieve the filename from the environment:
https://github.com/pete-gordon/oricutro ... in.c#L1826
About files that can't be downloaded from remote websites:

jumpjack:
Replacing "fetch->url" in these lines:

oricutron/main.c

Line 1793 in 075c517

sprintf(path, "/readwritefs/%s", fetch->url),
oricutron/main.c

Line 1804 in 075c517

success(path, fetch->url);

by just the filename if the string contains a remote url, would allow loading any remote file into the emulator.
For example, the download of https://jumpjack.github.io/oricutronJS/space1999-en.dsk succeeds, but of course creation of emulator file

/readwritefs/https://jumpjack.github.io/oricutronJS/space1999-en.dsk
fails (but error is shown only in browser console, not in emulator console, where only the same messages of a valid download appear: "MFM DISK" and "STATUS 200").

Probably an alternative mode to use remote files in the emulator would be retrieving them from the web page and storing them into /readwritefs/ session storage key.... but I have no idea of how to do it. :-)

As a side note, probably this couple of lines ( https://github.com/pete-gordon/oricutro ... in.c#L1830 ) should be moved before the "downloading file" message.
Me:
Good idea. I'll try to do this ASAP. I need to merge changes from the main branch as well.
jumpjack:
In the meantime I found a method to load local files from user's PC:

https://jumpjack.github.io/oricutronJS/

I see there are two DBs, "/readwritefs" and "emscripten_filesystem", but the second one is apparently never used by the emulator, so I just ignore it.
Me:
It doesn't work on Chrome on a Mac. What browser did you test it on ?

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 21, 2022 1:52 pm
by Hialmar
Here is what I get in the JS console:

Code: Select all

sessionStorage.file= undefined
oricutron.html:172 Unable to open 'assets/roms/bd500.rom'
printErr @ oricutron.html:172
oricutron.html:172 
printErr @ oricutron.html:172
oricutron.html:172 Unable to open 'assets/roms/8dos2.rom'
printErr @ oricutron.html:172
oricutron.html:172 
printErr @ oricutron.html:172
Oricutron.js:1453 [Deprecation] The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://bit.ly/audio-worklet)
63532 @ Oricutron.js:1453
4oricutron.html:172 ubsan: shift-out-of-bounds
printErr @ oricutron.html:172
oricutron.html:172 Assertion failed: undefined
printErr @ oricutron.html:172
Oricutron.js:964 Uncaught RuntimeError: abort(Assertion failed: undefined). Build with -s ASSERTIONS=1 for more info.
    at abort (Oricutron.js:963:10)
    at assert (Oricutron.js:641:3)
    at Oricutron.js:1209:4
    at doCallback (Oricutron.js:2896:11)
    at done (Oricutron.js:2903:13)
    at Oricutron.js:2261:21
    at Oricutron.js:2367:12
    at req.onsuccess (Oricutron.js:2300:4)

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Mon Nov 21, 2022 2:13 pm
by jumpjack
As filename is read by emulator from sessionStorage, where it is stored upon clicking a link in the caller page, and file contents is stored into IndexedDb, into a database named "/readrwitefs", table "FILE_DATA" my page loads a file from local file system and populates sessionStorage.file variable with filename and "/readwritefs" indexdDb with file contents, which has this format:

Code: Select all

		
		fileobject = {
			contents: filecontents, // UInt8array
			mode: 33206,
			timestamp: new Date()
		};
I see there are two DBs, "/readwritefs" and "emscripten_filesystem", created by emulator, but the second one is apparently never used by the emulator, so I just ignore it.

Successfully tested in Windows 10 with Chrome and Edge.

On Firefox sometime it works, other it does not... Sometimes I'm getting your same error. Please try loading the space1999-en.dks file in "standard" way (click on the link), then go back to the page and try loading a local file. Maybe I forgot intiializing something, besides filename and fileocontents? Possibily "emscripten_filesystem", which I don't know how to populate, I can't see anything inside it in developer console.

Note: Github enabled some times ago the "discussion" feature, to... well, discuss features separately from issues; you can enable it in repo settings just by clicking its checkbox.

Re: Oricutron or Euphoric in the browser anyone ?

Posted: Fri Nov 25, 2022 8:07 am
by jumpjack
New version, more robust, should solve the issue.
Note that the URL has changed: I don't use anymore a "caller page", everything is into oricutron.html page.

https://jumpjack.github.io/oricutronJS/oricutron.html

At first run, with storage, IndexedDB and emulator filesystem empty, emulator should start anyway, regardless of some error messages in output panel.

Then it is possible to:
- load a local file
- restart emulator using one of previously loaded disks

Some debug buttons are available for testing.