jeffpar / pcjs

The original IBM PC and other machine emulations in JavaScript
https://www.pcjs.org
Other
822 stars 124 forks source link

Disk images are pulled from internet when running locally #37

Open agr opened 2 years ago

agr commented 2 years ago

The "Running locally" guide mentions that when doing so local disk images are used, but I don't see it to be the case:

image

From what I managed to understand, the following code is responsible for this:

image

Unfortunately, the actual web page uses its "compiled" version, where this check is thrown away which forces it not to even consider trying fetching the disk locally:

image

image

Now, looking at https://github.com/jeffpar/pcjs/tree/master/machines/pcx86/releases, it seems there are many different versions of that pcx86.js file and it seems different images use different versions and some of them even reference "uncompiled" versions of it. How does it happen?

How do I fix this?

Ultimately, I want my custom diskette image loaded. I added it to /configs/pcx86/diskettes.json and I see it appear in the drop down box, but when I actually try to load it, the request is sent to diskettes.pcjs.org where it obviously does not exist.

agr commented 2 years ago

Apparently, adding uncompiled="true" attribute to the machine tag in the appropriate machine.xml makes it include proper -uncompiled.js file that causes it to try to read locally, unfortunately now I am getting these errors:

[2022-02-19 17:18:29] ERROR `/diskettes/pcx86/sys/dos/compaq/3.31/COMPAQ-DOS331-DISK3.json' not found.
[2022-02-19 17:18:29] ERROR `/diskettes/pcx86/sys/dos/compaq/3.31/COMPAQ-DOS331-DISK2.json' not found.

The web page complains accordingly: image

The file is present if looking from the repo root, so not sure what exactly Jekyll doesn't like.

agr commented 2 years ago

OK, the diskettes directory is explicitly excluded by https://github.com/jeffpar/pcjs/blob/13bad3f094cff4e925850bb6f18c7fefab3ca539/_config.yml#L29

removing that line fixes the issue.

jeffpar commented 2 years ago

Apologies for not checking on open issues more regularly. Glad you were persistent and found a resolution.

When I'm running locally, I'm usually doing it through VSCode, which I've configured to start Jekyll using the "bundle serve uncompiled" task in tasks.json, which includes _developer.yml and overrides _config.yml with, um, less exclusive excludes.

I've updated Running PCjs Locally with that small detail.

agr commented 2 years ago

Thanks for the update! Unfortunately, simply adding _developer.yml config doesn't seem to work in my case. Jekyll reports that it reads it on startup, but I still see that compiled version of pcx86.js is loaded which causes the disk images to get downloaded from internet.

This is how I start it:

> bundle exec jekyll serve --config _config.yml,_developer.yml
Configuration file: _config.yml
Configuration file: _developer.yml
            Source: C:/Users/andre/source/repos/pcjs
       Destination: C:/Users/andre/source/repos/pcjs/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
                    done in 86.796 seconds.
 Auto-regeneration: enabled for 'C:/Users/andre/source/repos/pcjs'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

And then I go to http://localhost:4000/configs/pcx86/machine/compaq/deskpro386/vga/4096kb/machine.xml. After trying a few other images, it seems the issue is specific to Compaq DeskPro386 based VMs. Everything else seem to load things locally.