DrazharLn / pracx

PlotinusRedux's Patch for SMACX
Other
105 stars 6 forks source link

Random letters in info windows (ticker) #30

Open Marty651 opened 4 years ago

Marty651 commented 4 years ago

When applying Pracx V1.10 or 1.11 to terranx.exe everythig works. But the info text in the "ticker" windows creates random letters. Every time the "ticker" gets to the end of the line it produces a letter at that position but one line below. The issues is also descibed here: http://alphacentauri2.info/index.php?topic=14308.msg126675#msg126675

I tried it with different installations from GOG, Yitzi 3.5d patch, Thinker 2.0 patch on two different computers (both Windows 10) and had always this issue. Further note: The issue does not occur under Linux within a wine environment.

DrazharLn commented 1 year ago

Occurs only on Alien Crossfire. Looks like a memory corruption bug. Telling PRACX not to overwrite the tile view box (the only thing that we deliberately do to the infowin struct) doesn't fix it.

Possibly some of our other overwrites or injected assembly are going out of bounds. I think it's beyond my skill to find and fix it.

Workaround: ignore it or don't use the expansion.

Edit: This bug also appears in Thinker but not Scient's patch, so it's probably being caused by one of the bits of pracx that induktio copied out.

Marty651 commented 1 year ago

Thanks for looking into this. It's definitely only a minor issue. So if a quick fix is not possible, I would see no problem just to leave it as it is.

induktio commented 1 year ago

Have not seen this issue before. How do you actually reproduce it? Does it occur only on some versions on Windows 10?

Marty651 commented 1 year ago

Have not seen this issue before. How do you actually reproduce it? Does it occur only on some versions on Windows 10?

This is interesting. I don't see this issue on my newer desktop PC with Windows 11 either. But I see it on an old Sony Notebook running latest Windows 10 (22H2) using ScientV2.1 and PracX v1.11 patches.

induktio commented 1 year ago

Okay, was able to confirm the issue with Win 10. It occurs somewhere in InfoWin_draw_text > Buffer_write_l calls and looks like some usual off-by-one string handling error. It seems to be related to a particular optimization setting which is not a present at -O1 or below but release builds used it because they had -O2. The bug is still strange because the mod is not supposed to patch this particular rendering code in InfoWin. The newest build from Feb 26 is recompiled without this optimization setting, it would be useful if you can confirm it fixes the issue.

Marty651 commented 7 months ago

@induktio The Steam Release of SMAC and SMAX brought me back looking after this issue. I see that I have missed your latest statement a year ago. I don't find a Feb26 release. Where can I find it?

induktio commented 7 months ago

Those dates refer to Thinker's develop builds that implement some experimental features. But the fix in this case (or more specifically, building the mod with an extra compiler flag) has been included in every release since, including version 4.0. So you can just get the latest version and see if the problem is fixed. At least in my tests it was not present anymore.

Marty651 commented 7 months ago

Thanks. Just tested Thinker mod version 4 and can confirm that the issue is fixed there. Does this allow any conclusions how to resolve the issue for PRACX?

induktio commented 7 months ago

Is the issue still present if you use PRACX and newest Thinker at the same time? Otherwise I'm not sure how this could be ported since the compilers are different. The issue was fixed by adding -fno-optimize-sibling-calls option on GCC. This particular optimization has been reported to cause bugs in other projects but the exact cause seems uncertain. Some kind of a very low level issue with the ABI probably.