WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
87 stars 19 forks source link

--parse-check broken for BAF #237

Open burner1024 opened 6 months ago

burner1024 commented 6 months ago

Doesn't appear to work anymore

$ cat 2.baf
IF
    True()
THEN
    RESPONSE #100
    NoAction()
END

$ weidu --game /bg2-test --no-exit-pause --noautoupdate --debug-assign --parse-check baf 2.baf
[weidu] WeiDU version 24900
[/bg2-test/chitin.key] 184 BIFFs, 42148 resources
SET %SAVE_DIRECTORY% = ~./save~
SET %MPSAVE_DIRECTORY% = ~./mpsave~
SET %USER_DIRECTORY% = ~.~
[/bg2-test/dialog.tlk] 74204 string entries

[2] LEXER ERROR at line 1 column 0-1
Near Text: IF
    invalid keyword [IF]

[2]  ERROR at line 1 column 0-1
Near Text: IF
    Parsing.Parse_error
ERROR: parsing [2]: Parsing.Parse_error
ERROR: File [2] was NOT successfully parsed as type [baf]

FATAL ERROR: Parsing.Parse_error
FredrikLindgren commented 3 months ago

I think something in your command line or game setup is preventing WeiDU from loading IDS files and the like. --parse-check works for me when I do a simple weidu --parse-check baf test/test.baf with CWD being a game directory.

burner1024 commented 3 months ago

I tried it just now, seems to work. It's likely my test was borked, yes. I'll add more info if I manage to reproduce it.

burner1024 commented 1 week ago

OK, it seems that weidu expects the file to actually have .baf extension, and fails otherwise.

$ weidu --game ~/bg2-test --no-exit-pause --noautoupdate --debug-assign --parse-check baf tmp.baf
[weidu] WeiDU version 24900
[/home/userbg2-test/chitin.key] 184 BIFFs, 42148 resources
SET %SAVE_DIRECTORY% = ~./save~
SET %MPSAVE_DIRECTORY% = ~./mpsave~
SET %USER_DIRECTORY% = ~.~
[/home/user/bg2-test/dialog.tlk] 74265 string entries
File [tmp.baf] was successfully parsed as type [baf]

$ weidu --game ~/bg2-test --no-exit-pause --noautoupdate --debug-assign --parse-check baf tmp.txt
[weidu] WeiDU version 24900
[/home/user/bg2-test/chitin.key] 184 BIFFs, 42148 resources
SET %SAVE_DIRECTORY% = ~./save~
SET %MPSAVE_DIRECTORY% = ~./mpsave~
SET %USER_DIRECTORY% = ~.~
[/home/user/bg2-test/dialog.tlk] 74265 string entries

[tmp.txt] LEXER ERROR at line 1 column 0-1
Near Text: IF
    invalid keyword [IF]

[tmp.txt]  ERROR at line 1 column 0-1
Near Text: IF
    Parsing.Parse_error
ERROR: parsing [tmp.txt]: Parsing.Parse_error
ERROR: File [tmp.txt] was NOT successfully parsed as type [baf]

FATAL ERROR: Parsing.Parse_error

$ md5sum tmp.*
8ef7bf661b2311e0c893706d962c9221  tmp.baf
8ef7bf661b2311e0c893706d962c9221  tmp.txt

It does pass, however, if tmp.txt is empty. So, not a big problem, but not sure if this is intended behaviour.