Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Get' does not seem to work for reading from a binary file in HTML/js #118

Open
D-m-K-123 opened this issue Oct 28, 2024 · 3 comments
Open

Comments

@D-m-K-123
Copy link

First of all, BIG thanks. QBjs - make BASIC programs alive again!
Here is an issue: I am trying to put up a game at itch.io The code (somewhat) works in QBjs, but once exported to HTML/js hangs in the browser.
QB64:

   Const FILE_SCORE_MAP = 1
   Const FILE_SCORE_MAP_NAME = "bestscore.bin"
   Const SZ_BEST_SCORE_FILE = 32768 
   Open FILE_SCORE_MAP_NAME For Binary As #FILE_SCORE_MAP
   Dim idx As Long
   For idx = 1 To CLng(SZ_BEST_SCORE_FILE)
    Get #FILE_SCORE_MAP, , rec ' rec is a UDT
    ...
    Next idx

First, notice CLng(SZ_BEST_SCORE_FILE). QBjs will not do GET without it (b/c 32768 exceeds 16 bit signed int)? When exported to HTML (Launch mode=PLAY) I cannot get past GET.

@D-m-K-123
Copy link
Author

The issue is probably that 'open' does not return a valid file handle? I forgot to mention that I had to remove _FileExists(FILE_SCORE_MAP_NAME) check b/c it would report that file "bestscore.bin" does not exist, even though the file is right there in the same directory. This, again, worked fine in https://qbjs.org/, but stopped working after exporting.

@boxgaming
Copy link
Owner

Hi @D-m-K-123, thanks for reporting. We’ll look into the issue.

@D-m-K-123
Copy link
Author

D-m-K-123 commented Nov 6, 2024

Hello @boxgaming, if this will take a while to fix the right way... is it possible to cook-up something quickly and produce a working HTML/js folder of the game? I can then upload it to itch io and my game will at least play. Attaching QB64 code.
circlesfe.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants