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

EAccessViolation when attempting to compile via CLI #117

Closed
Tracked by #130
VitalRus95 opened this issue Dec 21, 2020 · 4 comments
Closed
Tracked by #130

EAccessViolation when attempting to compile via CLI #117

VitalRus95 opened this issue Dec 21, 2020 · 4 comments
Labels
priority:p2 Medium priority scope:compiler type:bug Something isn't working workaround-available Users can fix for themselves
Milestone

Comments

@VitalRus95
Copy link

When I try to compile a small code (.txt) to .cs using command line in Sanny Builder, I get “Access violation” error.

Error screenshot:

SB_error

Script source code:

{$CLEO .cs}
    0000:
    repeat
    wait 0
    until player.Defined(0)
    player.Money(0) += 500
    018C: play_sound 1054 at 0.0 0.0 0.0
    0A93: terminate_this_custom_script

This source file can be compiled perfectly fine if manually open in SB. But when it is compiled through CLI, the resulting .cs gets somehow corrupted: the script actually works in the game but its decompiled code is full of some trash:
PyTest.txt

Additional information:

  • Tested on SB ver. 3.6.2 and 3.5.1.
  • Launched in .py, cmd, and sanny.exe shortcut.
  • Launching as admin didn't help.
  • The launch command in the shortcut is the following: "C:\Program Files (x86)\Sanny Builder 3\sanny.exe" -m sa --no-splash -c "D:\Games\GTA SA\CLEO\PyTest.txt" "D:\Games\GTA SA\CLEO\PyTest.cs".
  • Attempting to compile with SB v3.6.2 installed on D: drive yielded the same result.
  • Attempting to compile from .txt with UTF-8 with BOM encoding results in this absurd:
    PyTest.txt

Me and @wmysterio have struggled with this problem for some time but we didn't manage to find a solution yet. Thanks for any help!

@x87
Copy link
Collaborator

x87 commented Dec 21, 2020

@VitalRus95 Confirming this bug.

As a workaround add {$NOSOURCE} at the top of your script and it should compile.

@x87 x87 added priority:p2 Medium priority scope:compiler type:bug Something isn't working workaround-available Users can fix for themselves labels Dec 21, 2020
@wmysterio
Copy link

wmysterio commented Dec 22, 2020

I tested with {$NOSOURCE}. SB saved file with encoding ASCII (maybe). If use his or convert this file to ANSI or UTF-8 without BOM then compiling/decompiling complete successfully. Need answer from @VitalRus95 .

Vital's file generate compile.log with error: Unknown command п»ї{$CLEO .cs}. This is typical when use UTF-8 (with BOM) encoding. Need try to teach SB to save the source in the desired encoding so as not to use {$NOSOURCE} unnecessarily.

@VitalRus95
Copy link
Author

I tested with {$NOSOURCE}. SB saved file with encoding ASCII (maybe). If use his or convert this file to ANSI or UTF-8 without BOM then compiling/decompiling complete successfully. Need answer from @VitalRus95 .

Vital's file generate compile.log with error: Unknown command п»ї{$CLEO .cs}. This is typical when use UTF-8 (with BOM) encoding. Need try to teach SB to save the source in the desired encoding so as not to use {$NOSOURCE} unnecessarily.

Yes, both Python and SB generate .txt with UTF-8 (without BOM) encoding (as indicated in Notepad++). Yet manually it can be both compiled and decompiled without any issues and without {$NOSOURCE}.

@VitalRus95
Copy link
Author

@VitalRus95 Confirming this bug.

As a workaround add {$NOSOURCE} at the top of your script and it should compile.

{$NOSOURCE} works nice! No error is thrown, the script gets compiled and decompiled fine. Thanks a lot for this suggestion, I hope it won't be too difficult to eliminate the bug in future versions of SB! Good luck!

@x87 x87 mentioned this issue May 15, 2021
48 tasks
@x87 x87 closed this as completed May 31, 2021
@x87 x87 added this to the v3.8.0 milestone Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p2 Medium priority scope:compiler type:bug Something isn't working workaround-available Users can fix for themselves
Projects
None yet
Development

No branches or pull requests

3 participants