JOric

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
User avatar
dreamseal
Flying Officer
Posts: 164
Joined: Sat Mar 17, 2018 6:14 pm
Contact:

Re: JOric

Post by dreamseal »

coco.oric wrote: Sat Mar 29, 2025 7:51 am Hello, Joric is a very good idea. Let us able to launch games quicker than with Oricutron ;)
Thanks! :D
coco.oric wrote: Sat Mar 29, 2025 7:51 am Question, are the files uploaded stored in your server or does it remains locally ?
There are a few different ways to load the programs but none of those ways store anything on the server:

1. Using the "Open File": This one is solely local. The chosen file is read in by the Javascript running in the browser and the emulator runs it directly.

2. Drag and Drop: This is also solely local. The file you drop onto JOric is processed by the Javascript running in the browser and the emulator runs it directly.

3. The use of the "?url=" request parameter: This does involve the server, but only for the purposes of working around the CORS security checks. When client side Javascript fetches a program from a URL, it usually needs to be from the same website that the Javascript came from. So I have a small script running on the server that the fetch of the program is proxied through. This meets the CORS requirement. Nothing it actually stored on the server though. The program comes from the external website, e.g. oric.org, every time.

4. The game selection pages: This is similar to #3. It's just a convenience mechanism really, where those pages are kind of like bookmarks of games that are then fetched from external websites via the same CORS proxy script. The majority are fetched from oric.org, some from the defence-force.org website, and a few others.

In summary, no games are stored on the server. I wanted to avoid that and instead fetch from existing popular Oric websites.
User avatar
Hialmar
Flight Lieutenant
Posts: 357
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: JOric

Post by Hialmar »

Hello there

I just found out about Joric thanks to Maximus’ post on the Oric.org French forums.

I am the guy who worked on the web version of Oricutron. This works with emscripten which translates C executables to webasm.
It’s quite buggy and very difficult to debug applications. Your solution is a very good one IMHO.

I was trying to make a full JS emulator but I am not as good as you at programming emulators and stopped on the way.

Anyway I have some code that stores disks and tapes in the local storage. If you need help with that I can try to help you.
Hialmar
CEO and Silicium member.
User avatar
ibisum
Wing Commander
Posts: 1968
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: JOric

Post by ibisum »

Hi hialmar! I continued your work on Oricutrons' web build, and pushed things a bit further. I'd love to collaborate on getting Oricutron in the same sort of state as J'Oric, in terms of being able to reliably host Oric VM's in the browser. The more the merrier, right! :)
User avatar
dreamseal
Flying Officer
Posts: 164
Joined: Sat Mar 17, 2018 6:14 pm
Contact:

Re: JOric

Post by dreamseal »

Hialmar wrote: Mon Mar 31, 2025 8:05 pm Hello there

I just found out about Joric thanks to Maximus’ post on the Oric.org French forums.
I don't often look at the French forums, as I know very little French, but I'm happy that JOric has now been mentioned there. I do plan to broadcast its existence a bit wider over the coming weeks. I have been trying to tidy things up a bit, add a few more of the suggestions people had. A big one that was missing was sound on the iPad, but this is now working, so I'm tempted to start advertising JOric a bit more. I keep thinking of things that really should be there though, and the current one is machine state snapshots. I feel like it needs to have such a feature, so that would be one of the next things on my list to look at.
Hialmar wrote: Mon Mar 31, 2025 8:05 pm I am the guy who worked on the web version of Oricutron. This works with emscripten which translates C executables to webasm.
It’s quite buggy and very difficult to debug applications. Your solution is a very good one IMHO.
Pleased to meet you :) . That is really cool work that you did with the web version of Oricutron. I think that continuing with that effort is the best long term solution for Oric on the web, as it benefits from all the past work on Oricutron. With JOric, it is focused on only a single type of machine, with almost no support for the various options that Oricutron provides. 100% accurate emulation of everything available for the Oric wasn't the main focus for JOric. Instead I was trying to come up with something that was very easy to use, particularly on mobile and tablet devices via their browsers.
Hialmar wrote: Mon Mar 31, 2025 8:05 pm I was trying to make a full JS emulator but I am not as good as you at programming emulators and stopped on the way.
I took a shortcut in that most of the code isn't written in Javascript. It uses GWT (Google Web Toolkit) to convert Java code to Javascript. Libgdx also supports TeaVM for generating Javascript from Java but I haven't yet tried that option.
Hialmar wrote: Mon Mar 31, 2025 8:05 pm Anyway I have some code that stores disks and tapes in the local storage. If you need help with that I can try to help you.
Is that to support writing to disk and tape? - I would be interested in taking a look at the code.

The browser API that I am thinking of using for machine snapshots is something called OPFS (Origin Private File System). It is one of the newer browser APIs but I think is is supported by all browsers now. It provides a mechanism for writing to what look like files within what look like folders but the storage is instead within the browser's private storage.
User avatar
Hialmar
Flight Lieutenant
Posts: 357
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: JOric

Post by Hialmar »

What I am using is emscripten file systems.

There are several available and I mainly use the MEMFS and the IDBFS.

Explanations are here: https://emscripten.org/docs/api_referen ... -api-idbfs

IO works to MEMFS (a file system that is memory mapped) and in order not to loose everything I ask emscripten to sync it with the IDBFS.

The IDBFS is mapped on an IndexedDb in the browser.

The last part that we did (someone on the forum helped me with this) is to let the user download the files from the IndexedDB to his computer FS.

Here is the code for this:

Code: Select all

<script>
    var downloadBlob, downloadURL;

    downloadBlob = function (data, fileName, mimeType) {
        var blob, url;
        blob = new Blob([data], {
            type: mimeType
        });
        url = window.URL.createObjectURL(blob);
        downloadURL(url, fileName);
        setTimeout(function () {
            var fileList = document.getElementById('fileList');
            fileList.innerHTML = '';
            return window.URL.revokeObjectURL(url);
        }, 1000);
    };

    downloadURL = function (data, fileName) {
        var a;
        a = document.createElement('a');
        a.href = data;
        a.download = fileName;
        document.body.appendChild(a);
        a.style = 'display: none';
        a.click();
        a.remove();
    };

    function createLink(file) {
        var newLink = document.createElement('a');
        newLink.setAttribute('href', '');
        newLink.addEventListener("click", function (event) {
            event.preventDefault();
            var ret = FS.readFile('/readwritefs/' + file, {flags: 'r'});
            console.log(ret);
            downloadBlob(ret, file, 'application/octet-stream');
        });
        var newText = document.createTextNode(file);
        newLink.appendChild(newText);

        return newLink;
    }

    function getFileList() {
        var node = FS.readdir('/readwritefs/');

        console.log(node);

        var fileList = document.getElementById('fileList');
        node.forEach(function (file) {
            if (file !== '.' && file !== '..') {
                var newLink = createLink(file);
                fileList.appendChild(newLink);
                fileList.appendChild(document.createElement('br'));
            }
        });
    }
Hialmar
CEO and Silicium member.
User avatar
Hialmar
Flight Lieutenant
Posts: 357
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: JOric

Post by Hialmar »

I have found more information on the file systems found out by jumpjack:

https://forum.defence-force.org/viewtop ... 794#p27794
Hialmar
CEO and Silicium member.
Post Reply