ok, if anyone need a portable toolchain (just extract and run) there it is...
https://github.com/MyTDT-Mysoft/emsdk32 ... -0.1-alpha
some tests/code that i have that i compiled using it
https://mysoft.codeberg.page/FreebasicWebShowcase
later i will upload the fork repository of freebasic where i keep releases of this for windows, while fixing bugs and making it more direct usable
with ports of common used libraries, extra functions for specific but important things over the web (like mounting special file systems)
by default the fbc with the fbjs target is generating .js and .wasm files, but imo the default should be generating just a single .html file , and only generate .js/.wasm files when generating a library so that then dylibload can dynamically load those, which means extra .data files can be loaded when using single .html files as well (to avoid needing to have all games maps/assets/libraries/everything in memory)
one great advantage of "--single-file" is that it works just like an executable you just click and it runs on the browser... no server needed (does the same in mobile), so that's a good default
but some features like "Fetch" trigger cors when used to local local .html HOWEVER there's DOM ways to bypass that (i used them to load the background music in piranha... and to load an optional "skin" file, which can be easily modified for different environment (like the keypad mapping one), either way it's possible to use that same method to load wasm files and bypass cors... so i will go over this route for freebasic's sake (i think i can even extend that to generate blob links to create workers, which is another thing that ends blocked by cors with local files)... and last but not least, many important new javascript features seems to require a "secure" environment i.e. they dont work with HTTP only HTTPS (which is ridiculous, but they DO work with local .html files), and having a local server that is also a verifiable https server would be a crazy requirement for freebasic by default.
the huge sad thing is that the web environment does not allow sockets to be used without proxies... so it ends requiring some local server to bypass that for sockets or even http/https request that are bypassing cors... imo they screwed up that, and they should had used permissions (like they have to access local folders in chrome now), but... oh well i guess a generic shared server that will query for access (like when apps use web auth permissions), to prevent the local proxy to be abused is something that will be taken in account.
and later i will actually include the FBC with a minimal emscripten toolchain (similar as we have with the minimal GCC option). But first i will get rid of the python garbage requirement of emscripten (not sure what i can do about the NODE requirement to build tough, but node is just a single .exe anyway)
emscripten windows 7 - 32bit
-
- Posts: 8642
- Joined: May 28, 2005 3:28
- Contact:
Re: emscripten windows 7 - 32bit
Hello Mysoft,
can you share the FreebasicWebShowcase folder as a zip file to run it local on a web server
and the freebasic source codes and the command line arguments to buld the FreebasicWebShowcase files ?
Thank you
Joshy
can you share the FreebasicWebShowcase folder as a zip file to run it local on a web server
and the freebasic source codes and the command line arguments to buld the FreebasicWebShowcase files ?
Thank you
Joshy
-
- Posts: 847
- Joined: Jul 28, 2005 13:56
- Location: Brazil, Santa Catarina, Indaial (ouch!)
- Contact:
Re: emscripten windows 7 - 32bit
yes i can, right now the source codes are scattered all over the place, since i was just compiling stuff from my own coding folder, but yes all of them have the #cmdline that will work when compiled for js , using fbjs.bat (since i didnt wanted to change the defaults from the fbc at this point yet)D.J.Peters wrote: ↑Jun 04, 2025 2:27 Hello Mysoft,
can you share the FreebasicWebShowcase folder as a zip file to run it local on a web server
and the freebasic source codes and the command line arguments to buld the FreebasicWebShowcase files ?
Thank you
Joshy
but yes this is the showcase zip ... no local webserver is required to run any of those... just run the .html copy to linux/android/whatever and launch the .html as a file and it should work everywhere (that's the goal)
https://drive.google.com/file/d/1WmIuGz ... drive_link
and this is the fbjs "fbc" compiled for windows (it also includes bat files to compile freebasic/rtlib itself without needing msys, so it works in plain cmd with mingw-w64), i didnt released this or made any attempts to have that merged on official freebasic, because there's a bunch of stuff to be done for it to be perfectly functional.
https://drive.google.com/file/d/18ABixE ... drive_link
the only difference from the regular tutorial (which included compiling fbc and rtlib and making the emcc wrapper), is that i have the fbjs.bat for better defaults on js target (as well defaulting to generate a single .html file)... the modified shell .html to be ready for extra functionality and to have a very good default for web... and there's some includes with the extra libraries i made/ported (ttf / tts / some audio / import/export files / local storage / etc...)
as for the #cmdline... when using "fbjs.bat" instead of "fbc.exe" all that is required to compile regular freebasic stuff (depending on dependencies ofcourse), is to include the folders/files to add to the .html as file system
and so for that i'm using
Code: Select all
#cmdline "-s gui -Wl '--embed-file SubFolder'"
i'm also researching to implement the chrome newer API that allow access to local files as used by (visual studio code online), and have that integrated with emscripten file system... so lot of stuff going on.
yeah as i get everything extra stable and documented (as WEB is always a dangling platform), i will then make a proper release like i promissed.
-
- Posts: 8642
- Joined: May 28, 2005 3:28
- Contact:
Re: emscripten windows 7 - 32bit
Why are gfx modes are limited to 640 x 480 ?Shouldn't "fbjs.bat" call "emsdk_env.bat" before ?
(I mean "emcc.bat" and "python" etc must be in the emscripten environment)
Again can you share one of the *.bas files from your showcases please ?
I need to know how the FreeBASIC main loop locks like.
The FreeBASIC code to update sound/keyboard/mouse/joystick and gfx refresh in a loop
so the browser can do it 60 times per second.
Joshy
Code: Select all
static int modes[] = {
SCREENLIST(640, 480),
SCREENLIST(512, 512),
SCREENLIST(320, 240),
SCREENLIST(320, 200),
SCREENLIST(320, 100),
SCREENLIST(256, 256),
SCREENLIST(160, 120),
SCREENLIST(80, 80)
};
(I mean "emcc.bat" and "python" etc must be in the emscripten environment)
Again can you share one of the *.bas files from your showcases please ?
I need to know how the FreeBASIC main loop locks like.
The FreeBASIC code to update sound/keyboard/mouse/joystick and gfx refresh in a loop
so the browser can do it 60 times per second.
Joshy
-
- Posts: 847
- Joined: Jul 28, 2005 13:56
- Location: Brazil, Santa Catarina, Indaial (ouch!)
- Contact:
Re: emscripten windows 7 - 32bit
that's what i'm telling you... thatD.J.Peters wrote: ↑Jun 09, 2025 7:58 Why are gfx modes are limited to 640 x 480 ?Shouldn't "fbjs.bat" call "emsdk_env.bat" before ?Code: Select all
static int modes[] = { SCREENLIST(640, 480), SCREENLIST(512, 512), SCREENLIST(320, 240), SCREENLIST(320, 200), SCREENLIST(320, 100), SCREENLIST(256, 256), SCREENLIST(160, 120), SCREENLIST(80, 80) };
(I mean "emcc.bat" and "python" etc must be in the emscripten environment)
Again can you share one of the *.bas files from your showcases please ?
I need to know how the FreeBASIC main loop locks like.
The FreeBASIC code to update sound/keyboard/mouse/joystick and gfx refresh in a loop
so the browser can do it 60 times per second.
Joshy
Code: Select all
#include "fbgfx.bi"
screenres 640,480
dim as long iX=320,iY=240,iSX=1,iSY=1
do
screenlock
cls
circle(iX,iY),64,10,,,,f
locate 1,1 : print multikey(fb.SC_A)
screenunlock
sleep 1,1 'screensync
iX += iSX : iY += iSY
if iX=64 orelse iX=(640-64) then iSX = -iSX
if iY=64 orelse iY=(480-64) then iSY = -iSY
loop
must work just fine

and the current freebasic rtlib implementation of sleep forgot to properly implement the "sleep" (that waits for a key to be pressed), so it hangs... like an infinite loop, but i should fix that soon.
but yeah i will give the source to more samples asap

-
- Posts: 8642
- Joined: May 28, 2005 3:28
- Contact:
Re: emscripten windows 7 - 32bit
I don't wait longer for your support I needed !
I use the free and open source engine 'Defold' instead.
You can export from same code base to: MAC, LINUX, WINDOWS, ANDROID, IOS, wasm/HTML5.
https://defold.com
Joshy