Author Topic: Possible bug in scient patch 2.0  (Read 2144 times)

0 Members and 1 Guest are viewing this topic.

Offline Petek

Possible bug in scient patch 2.0
« on: July 21, 2019, 01:37:10 PM »
I recently bought a new system. Installed SMACX from GOG, then scient's 2.0 patch. In a new game, when I built the Weather Paradigm, the game crashed to the desktop. I tried disabling SP movies and renamed the file (playuv15.exe) that plays the movies. Also tried changing other video settings. I have DirectDraw=1 in my Alphacentauri.ini file. A Google search for Alpha Centauri Weather Paradigm crash returns several hits with the same problem. I only recently started using v2.0 of scient's patch and don't recall such a problem with v1.0.

I then uninstalled the 2.0 patch and the problem disappeared. System specs are OS Windows 10 Home 64-bit (10.0 build 17763), video card is Nvidia geforce RTX 2080 TI with most recent drivers. 16GB system RAM and 11GB video RAM. Other info available upon request.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Possible bug in scient patch 2.0
« Reply #1 on: July 21, 2019, 03:08:16 PM »
This may only be a workaround, not a diagnosis or fix, but wouldn't you prefer DirectDraw=0 ?  That's what allows you to use full screen resolution on modern computers.  Without that you'd be stuck back on 1024x768 I think.

Offline Petek

Re: Possible bug in scient patch 2.0
« Reply #2 on: July 21, 2019, 03:55:36 PM »
Thanks. That was a typo. I am using DirectDraw=0. Also, I forgot to attach a save file. This is from one turn before building the WP.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Possible bug in scient patch 2.0
« Reply #3 on: July 21, 2019, 06:33:42 PM »
Bug confirmed.  Tested on Windows 10 Pro, Version 1809, OS build 17763.165.  First I tried the .sav file in a plain SMAC installation, GOG version 2.0.2.23.  No problems.  Then I installed a brand new copy of SMAC to a new folder, and installed Scient 2.0 into that folder.  Set DirectDraw=0 and loaded the .sav file.  When the game tries to play the Weather Paradigm movie, it crashes.

Offline Petek

Re: Possible bug in scient patch 2.0
« Reply #4 on: July 21, 2019, 07:28:30 PM »
I think I've identified the problem. A thread on reddit described the same problem and mentioned that opening the datalinks entry for the WP also crashed the game (and the same was true for the Longevity Vaccine). I compared the original version of helpx.txt (where the datalinks entries reside) with the one in scient's 2.0 patch.  Scient's helpx.txt contains many entries (including for the WP and LV) with very long lines. The original helpx.txt inserts carriage returns to make the lines shorter. So, the problem can be fixed by restoring the original helpx.txt. (Scient's 2.0 patch makes a backup of the original files in the folder \Alpha Centauri\_backup_v2.00.) This fixes the problem.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Possible bug in scient patch 2.0
« Reply #5 on: July 22, 2019, 06:38:06 AM »
Wow, just a Unix vs. Windows /cr vs. /cr /lf problem?  What a crud world we live in.  Well at least it's 90s software, maybe things have gotten better.  (Don't count on it.)

That's a really good reason for a version 2.1.

Offline Induktio

Re: Possible bug in scient patch 2.0
« Reply #6 on: July 22, 2019, 02:31:49 PM »
Wow, just a Unix vs. Windows /cr vs. /cr /lf problem?  What a crud world we live in.  Well at least it's 90s software, maybe things have gotten better.  (Don't count on it.)

Why would this be related to EOL types at all? Both the vanilla and 2.0 version of helpx.txt seem to be using Windows CRLF encoding only. I verified this issue and it really exists with 2.0 patch files: looking up either Weather Paradigm or Longetivity Vaccine from datalinks crashes the game every time. No other project entry in datalinks crashes the game, so there's one really OBVIOUS and common problem with C code to look at here.

Both the WP and LV descriptions contain lines that are longer than 255 characters in the new helpx.txt file, so this really looks like a buffer overflow in some parser code. Looking at it with debugger, some function really seems to overwrite part of the stack with WP's text description, so that one is pretty much guaranteed to crash the game.

Also I think Thinker Mod users never experienced this crash because I didn't ship those modified txt files with my distribution. Thinker only contains the binary patches plus a couple of smaller fixes, but nothing to do with helpx.txt. It's really nice Petek managed to finally isolate this crash, it seemed to be affecting some players.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Possible bug in scient patch 2.0
« Reply #7 on: July 22, 2019, 03:42:52 PM »
You're probably right, I was thinking about "different kinds of lines" rather than "buffer overflow".

Offline scient

Re: Possible bug in scient patch 2.0
« Reply #8 on: July 23, 2019, 04:44:21 PM »
I think someone else ran into same issues with modified helpx.txt bundled with my patch.
http://alphacentauri2.info/index.php?topic=21180.msg118308#msg118308

Fairly certain my own edits to helpx.txt were minimal in conjunction with some exe patches. The rest of the work was done by others, likely not realizing about internal length restrictions.

I still haven't finished parse_string where crash takes place, some really funky logic and nested loops. I'll definitely include some error handling / better parsing to handle situations like this at least for DLL redirect.

Offline Induktio

Re: Possible bug in scient patch 2.0
« Reply #9 on: July 25, 2019, 07:07:50 PM »
I didn't even remember that thread, that being said, the bug exists in the vanilla binary too if one uses the same text files. So in that sense it was not caused by the patch, but we should issue a new version of 2.0 with those long lines fixed. Otherwise people will just keep running into this issue.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Possible bug in scient patch 2.0
« Reply #10 on: July 25, 2019, 08:01:09 PM »
a new version of 2.0 with those long lines fixed.

AKA a 2.1, a 2.0.1, a 2.01, a 2.0a, something other than just calling it 2.0, so that people don't continue to blithely use the older release.

Offline Induktio

Re: Possible bug in scient patch 2.0
« Reply #11 on: July 25, 2019, 11:09:30 PM »
I think whoever makes these patches knows how to assign version numbers. Originally it was uploaded by Drazhar but he's probably not active, maybe Scient then wants to update it himself? Does Scient know which text types this limit applies to other than the secret project messages?

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Possible bug in scient patch 2.0
« Reply #12 on: July 26, 2019, 05:02:43 AM »
It would probably be best not to try to "know it", but rather, follow the practices of the original files everywhere.  And a CHANGELOG as to why it was done.  Maybe a comment if the file takes a comment.

Offline DrazharLn

Re: Possible bug in scient patch 2.0
« Reply #13 on: August 01, 2019, 11:20:20 AM »
I don't think I modified the help files between receiving them from Scient and building the patch.

I'm happy to build a v2.1 with updated helpx.txt

So lines need to be hard-wrapped at X characters? Do we know what X is? Otherwise I guess I can just wrap them at whatever the original helpx had as its max length. (Edit the max length in the GOG helpx.txt is 121 chars, so I'll wrap them there).

Checking line lengths with python, it looks like there are 295 lines longer than 79 characters.

>>> helpx = open("helpx.txt", encoding="latin1")
>>> lines = helpx.readlines()
>>> max(map(len, lines))
735
>>> len([len(line) for line in lines if len(line) > 79])
295

>>> import seaborn
>>> import matplotlib.pyplot
>>> seaborn.distplot(list(map(len, lines)))
<matplotlib.axes._subplots.AxesSubplot object at 0x7fe9b826b6d8>
>>> matplotlib.pyplot.show() # see attachment
« Last Edit: August 01, 2019, 11:37:51 AM by DrazharLn »

Offline DrazharLn

Re: Possible bug in scient patch 2.0
« Reply #14 on: August 01, 2019, 02:26:27 PM »
Well, that was simple enough to do.

Here are the original max line lengths (including carriage return, not including linefeed, because that's just how awk works):

(click to show/hide)

And just the ones that get included in the patch executable:

(click to show/hide)

After running my script the helpx.txt is trimmed to 124 characters. The longest remaining file is conceptsx.txt at 298 characters. The original conceptsx English is 175 chars, original French 614.

I attach my git repo for the scient patch with the code for wrapping lines and some other minor changes. I also attach a beta-version of v2.1 of the patch on the next post.

Edit: fixed the below, too

Where the help text for some categories is also too long and those help fields don't scroll (e.g. Mag Tube), the overflowing text appears outside of the box it should do and is not cleared when looking at the next datalinks entry, which is another slightly annoying bug.

I guess Googly and Scient didn't test this stuff. I know I didn't ;)

Steps to reproduce: go to datalinks, click all categories, hold down arrow.

There are only a few entries that are too long, so I might just revert them myself. Haven't decided yet.
« Last Edit: August 02, 2019, 01:39:54 PM by DrazharLn »

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

The ancient Chinese had a name for it: Feng Shui. We call it energy flow. It is the same thing, the same thought: energy is everywhere, but only a fraction of it is tapped by humans for their purposes. Now the Progenitors have taught us that we can tap not only our own latent abilities, but the latent abilities of the Universe itself.
~Prophet Cha Dawn 'Planet Rising'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 41.

[Show Queries]