In a very special case (see below) i can make the ASL file requester (called from within scummvm) display random characters in the path section, see here:
I also had RO[Y:7ðRÖð(sâ Y:6Y:6°|ÕH and ]Ž(_ð`°d __°}øÈ in two other tests...so completely random.
I don't know if this is a bug in string.gadget, input.gadget, whatever.gadget, ASL itself or maybe coming from an uninitialized ASL window within the scummvm impolementation?
So if anyone wants to shed some light...especially OS4 betatesters as i remember some similar input.gadget problem which has been fixed in beta (iirc) in the meantime
if (ConfMan.hasKey("browser_lastpath")) {
strncpy(pathBuffer, ConfMan.get("browser_lastpath").c_str(), sizeof(pathBuffer) - 1);
}
If i understand that correctly it will *read* the browser_lastpath variable (if found?) and add it as a default path to the ASL path input field in line 68, correct?
If that is correct then, in this special scenario, there is no browser_lastpath variable set (because we are missing the scummvm.ini file that normally provides it)
So, it should not find/use that variable...but it seems it still does...or it's not using it, fails to set a default path and still continues to read random memory...maybe because of the pathBuffer not being initialized?
Now to know how to set a default pathBuffer...any ideas? Is it sufficient to do something like this:
The sys: solution triggers a warning about about cutting off before nullptr was read or something like that and the adapted strncpy line didn't fix it either.
then there are two solutions maybe (btw. this seems to be a scummvm implemented function so might work differently regarding null-termination)
since you are using the .c_str() you should have null termination automatically but... change the sizeof(pathBuffer) -1; to sizeof(pathBuffer); since the -1 could remove the the null termination.
you should probably printout pathBuffer in hexadecimal form so that any white space is 'visible', you could use good old sprintf() + printf() or sprintf() + anything that prints text to the console
the second solution is to add the null termination with '\0' if it is C++ or modern C then you just use +'\0';
instead of using printf() try fprintf(stderr,...) then the system shouldn't que it (I remember seeing this behavior when doing something a bit more complicated real-time stuff it held all output until the process had ended then it spit it out into a freshly opened console which auto-closed pretty much as soon as all output and been written) or use DBG().
instead of using printf() try fprintf(stderr,...) then the system shouldn't que it (I remember seeing this behavior when doing something a bit more complicated real-time stuff it held all output until the process had ended then it spit it out into a freshly opened console which auto-closed pretty much as soon as all output and been written) or use DBG().