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
90 stars 20 forks source link

--parse-check broken for BAF #237

Closed burner1024 closed 1 month ago

burner1024 commented 8 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 6 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 6 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 2 months 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.

FredrikLindgren commented 2 months ago

Oh, yeah, the parsing function called checks the file name and parses .BAF extensions as BAF files and everything else as BCS. I'll see what I can do.

burner1024 commented 1 month ago

Oh, it also can do BCS parsing? That's news. I assume the same for D/DLG?

FredrikLindgren commented 1 month ago

Not really, I just used the wrong function, one that dispatches on file name to possibly get it onto a BCS track. Do you want parse-support for BCS and DLG?

Anyway, the filename stuff has been fixed in 68436676720063267d08c6f8c83cd4611ce7cd7a.

burner1024 commented 1 month ago

Do you want parse-support for BCS and DLG

No, can't think of a usage for it at the moment.

Anyway, the filename stuff has been fixed.

Thanks!