VScode-BGforge-MLS icon indicating copy to clipboard operation
VScode-BGforge-MLS copied to clipboard

Add built-in compiler for Fallout2 .ssl files

Open roginvs opened this issue 9 months ago • 8 comments

Description

This PR embeds a WebAssembly-compiled compile.exe into this extension. It is under options flag and it is disabled by default.

Having this compiler as WebAssembly build allow using this extension on non-intel processors, for example on Mac M1 or others.

image

image

Notes

Currently it uses compiled files from my repo but I will change it into sfall repo as soon as https://github.com/sfall-team/sslc/pull/14 is merged

Lots of any because I have not found a good typescript definitions for emscripten module (@types/emscripten have no .FS property on the instance)

I have not tested this on Windows but likely it will also work there

roginvs avatar May 21 '25 17:05 roginvs

Interesting, I haven't considered M1. Does it not run wine? I thought there was some compatilibility layer.

burner1024 avatar May 22 '25 07:05 burner1024

Actually I have no idea, but i had an impression that it was not possible to run x86/x64 apps on M1 Macbooks.

Anyways, even if it is possible then it still requires some setup. Having a embedded cross-platform compiler should be better user experience in my opinion. Maybe later we can enable it by default

roginvs avatar May 22 '25 08:05 roginvs

CI fails on found npm access token: npm_i_save_dev_types_Slash but it also fails on almost empty PR https://github.com/roginvs/VScode-BGforge-MLS/pull/2

roginvs avatar May 22 '25 08:05 roginvs

https://github.com/microsoft/vscode-vsce/issues/1153 maybe

burner1024 avatar May 23 '25 17:05 burner1024

Yes, looks like it was a bug in vscode-vsce. Right now all checks passed.

I changed installation script, now it will check hash of downloaded release file. Just more security. With hash check it is not a big difference where this file was downloaded from

roginvs avatar May 23 '25 18:05 roginvs

So you aren't using an M1? What prompted you to work on this then?

burner1024 avatar May 24 '25 17:05 burner1024

@burner1024 I was making a PR with test scripts into fallout2-ce. In the README file I added some instructions about how to compile https://github.com/fallout2-ce/fallout2-ce/pull/140/files#diff-7e0064f2b1902c3c7083e171e90a0a91df55a38157bf30de762952196392b179 but then I though that having an additional step of installing compile.exe can be annoying.

I am simple user, I want a button which makes everything for me. As user I want to install extension and to have a ready-to-use IDE.

roginvs avatar May 24 '25 18:05 roginvs

I am simple user, I want a button which makes everything for me. As user I want to install extension and to have a ready-to-use IDE.

Well, the simplest way for that would be to just bundle compile.exe, I guess. But having native cross-platform builds paves the way for future improvements, so that's cool too.

Let's see when the upstream PR gets merged.

burner1024 avatar May 26 '25 07:05 burner1024

Looks like PR into sslc got stuck for a while. Let's hope it will be merged at some point.

I think there is no blockers right now for merging this PR. I tested it locally and it works for me. There is a hash of the package in package-lock.json so npm/pnpm will not allow to install something else which do not have the same hash

roginvs avatar Jun 03 '25 18:06 roginvs

I'll look it over soon.

burner1024 avatar Jun 05 '25 07:06 burner1024

@copilot review this

burner1024 avatar Jun 11 '25 08:06 burner1024

I'd assign Copilot to review this PR if I had permission to add reviewers. :)

roginvs avatar Jun 11 '25 20:06 roginvs

@copilot review this

I'd assign Copilot to review this PR if I had permission to add reviewers. :)

Copilot itself advised me to make that comment to request a review, apparently that didn't work :), so assigned it in GUI.

burner1024 avatar Jun 12 '25 11:06 burner1024

Updated to use sslc from https://github.com/sfall-team/sslc

roginvs avatar Jun 13 '25 21:06 roginvs

Looks like it has trouble working with symlinks. On my system, Fallout2_Restoration_Project/scripts_src/headers/sfall is a symlink to sfall headers. External compiler works with that, while built-in one doesn't. Also leaves cruft behind.

Screenshot_20250614_132921 Screenshot_20250614_132846

Linux build works fine too.

burner1024 avatar Jun 14 '25 06:06 burner1024

@burner1024 Thanks, I will take a look. I have Linux and symlink too but it is relative symlink. I tested now with absolute symlink and I confirm that it needs fixing.

I will try to use NODERAWFS again, very likely it fails to find path because of absolute symlink and because host FS is mounted into subfolder.

About leftover *.tmp: it also happens on Linux build, probably because of https://github.com/sfall-team/sslc/blob/master/compile.c#L239 and https://github.com/sfall-team/sslc/blob/master/compile.c#L261 . I will take a look on this too

roginvs avatar Jun 14 '25 06:06 roginvs

@burner1024

  • Leftover .tmp files are fixed. Merged in my repo, waiting to be merged in sslc repo
  • I changed filesystem back to NODERAWFS because we need to mount host FS into the root inside guest. Mounting host into sub-folder caused absolute symlinks to fail. Because NODERAWFS does not work good on multiple runs we have to spawn new process each time, similar to using compile.exe

roginvs avatar Jun 15 '25 21:06 roginvs

OK, merged and released, thanks.

burner1024 avatar Jun 22 '25 10:06 burner1024