Log in

View Full Version : Bug Report Freezing with long filename on command line


French
May 2, 2020, 11:57 AM
Yet another f***ing bug.


If I run JJ2+ with a file path with more than 62 characters, it freezes (i.e. stops responding) when loading the level.
With JJ2 vanilla, I can get it work with a path length up to 128 characters (might be less if the tileset filename is longer than the level filename). When exceeding this limit, JJ2+ crashes the same way as JJ2 vanilla, i.e. with a fatal application error. (Uh, actually vanilla may crash with an access violation error instead, but not JJ2+… Never mind.)


62 characters is a bit short for me, you know, as my JJ2 folder is a subsubfolder of the ‘Program Files (x86)’ folder on my main disk partition. Then ‘Save & Run’ from JCS triggers the bug.

From Windows cmd, with my JJ2+ folder as working directory:

this works:
Jazz2.exe .\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \Easter1.j2l
this makes the game freeze (just one backslash more):
Jazz2.exe .\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\Easter1.j2l


I hope this helps. ;)

Violet CLM
May 2, 2020, 04:24 PM
Yeah, this is an annoying one. :( JJ2 stores (most? all?) strings in fixed-length character buffers, which mostly cap out at 32 or 64 characters. People tend to keep JJ2 close to the root to limit the issue, e.g. C:\Games\Jazz2 or D:\Games\Jazz2. I made some progress at fixing this a while back, but it involves finding every reference to the strings anywhere in the game and replacing all of them, and I never finished the job... thanks for the reminder.

French
May 3, 2020, 02:37 PM
Okay. But how do you explain that JJ2+ now needs a shorter filepath?

BTW, it seems not to work if the filepath contains spaces and is contained in a single argument, i.e. it is put between quotes on the command line. You must omit the quotes. It is very weird. I have no idea about how it is possible. (It is not new to JJ2+.)

So JJ2 vanilla used C-style strings and you try to use C++ ones instead, this is the idea?

Violet CLM
May 3, 2020, 04:04 PM
Right, C vs. C++ strings. The code in question is very old and I didn't write any of it, so I can't comment on how or why it differs from vanilla JJ2 on this front.

Violet CLM
Aug 19, 2022, 07:11 PM
Fix will be available in 5.10.