TTDPatch hanging when reloading saved games

Got a problem with TTDPatch? Get help here.

Moderator: TTDPatch Moderators

RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

TTDPatch hanging when reloading saved games

Post by RichNagel »

I'm having a strange hanging problem when attempting to load the attached saved game. First, a bit of info...

My goal was to use TTDPatch *ONLY* for performing extremely tedious tasks... such as converting all of my rails to MagLev (sending all trains to their depots, converting to MagLev, purchasing new MagLev engines and cars, and then sending them on their way again). My game plan was to normally play the game in regular TTD, and then load the saved game when running TTDPatch in order to accomplish these tasks.

Hence, I have disabled *EVERYTHING* in my "TTDPATCH.CFG" file (using the "off" commands for each entry/option), except for the following things/features:

cheatscost on
signcheats on

So, I load the saved game when running TTDPatch, use the sign cheat "cht: tracks 2", and then the sign cheat "cht: renew". I then save the game.

After exiting the game while running TTDPatch, I start up regular TTD, load the saved game, and play a while. Then, I save the game.

After exiting the game, any time that I run TTDPatch again and attempt to load the saved game, the game/TTDPatch hangs.

In other words... TTD/Load&Save -> TTDPatch/Load&Save -> TTD/Load&Save -> TTDPatch/Load/HANG.

I see the "Zzzzz" mouse cursor, I can actually MOVE the mouse cursor, and the music continues to play... meaning that TTDPatch hasn't really locked up I suppose.

SOMETIMES (no too often though) if I sit there LONG ENOUGH, the game will finally load... sometimes and long as 10 minutes or so <aarrggh>.

In those cases, if I then save the game while TTDPatch is running, I can usually reload the saved game with TTDPatch, and it loads just fine (in a few seconds).

BTW, I've been able to reproduce this problem each and every time... take one of my normal TTD saved games, load while running TTDPatch, save the game; exit and start regular TTD, save the game, exit and start TTDPatch, and it hangs every time.

P.S. I'm running the DOS version of TTDPatch v2.5 Beta 9 and the game (under DOSBox), but I've ALSO tried the regular version 2.0 release verion, as well as the latest/last "nightly" build... having the same problem with all of the various versions of TTDPatch.

Lastly, I've also tried loading the saved game when running TTDPatch (all of the above mentioned versions) using the default "TTDPATCH.CFG" file, but also still have the hanging problem.

Anyone have any idea why TTDPatch is hanging?
Attachments
TRT97.SV1
(343.31 KiB) Downloaded 342 times
TRT98.SV1
(343.76 KiB) Downloaded 351 times
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

P.S. Something that I just discovered (not sure how helpful it is though)... Attempting to load these saved games into OpenTTD (release version 1.3.3) results in the following error message:

Game load failed
Data integrity check failed
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: TTDPatch hanging when reloading saved games

Post by WWTBAM »

I may have a look later in the week.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

roboboy wrote:I may have a look later in the week.
Many thanks :)

BTW, I forgot to mention that I ALSO tried the same thing in TTDLX and TTDPatch for Windows, but experienced the same hanging problem.

Lastly, just to clarify: The attached saved games load into regular TTD just fine... they only hang when running TTDPatch.
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Sorry to dig up this message thread, but has anyone discovered anything that might shed some light on this problem?
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: TTDPatch hanging when reloading saved games

Post by WWTBAM »

Sorry I haven't had time to look at this. I would like to have a look once I finish my studies in the next few months. From reading your first post, no matter what version of TTDPatch be it 2.0 r1 (Effectively unsupported), 2.5 Beta 9 or the "Latest" 2.6 build you have this issue. Can you please recheck that the issue occurs with both 2.5 r2372 and 2.6 r2384. They can be found in the stickies in the General TTDPatch Forum.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

roboboy wrote:Sorry I haven't had time to look at this. I would like to have a look once I finish my studies in the next few months.
No problem, and many thanks :)

roboboy wrote:From reading your first post, no matter what version of TTDPatch be it 2.0 r1 (Effectively unsupported), 2.5 Beta 9 or the "Latest" 2.6 build you have this issue.
That is correct.

roboboy wrote:Can you please recheck that the issue occurs with both 2.5 r2372 and 2.6 r2384. They can be found in the stickies in the General TTDPatch Forum.
Yes, same issue with both of those versions (TTDPatch v2.5 r2372 and TTDPatch v2.6 r2384).
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: TTDPatch hanging when reloading saved games

Post by Lakie »

I'm assuming a saved game never altered by TTDPatch doesn't exhibit the same behaviour?

From a fairly brief debug of the newloadproc function I find that some information stored by TTDPatch in the edge tiles is causing the issue, possibly due to partial corruption of that information by TTD. The pause is actually caused by TTDPatch believing it has additional unknown chunks (of large size) and trying to thus skip them (through a loop).

I'm currently unsure how to resolve the issue, however there does seem to be a pattern (at least in the two saved games I tested from yourself) to the chunk identifier which might a possible avenue of investigation.

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Lakie wrote:I'm assuming a saved game never altered by TTDPatch doesn't exhibit the same behaviour?
The problem still exists even if I make no changes using TTDPatch (the "cht" signs, etc...).

In other words:

1 - Load and save with TTDPatch (making no changes using TTDPatch)

2 - Load and save with TTDlx

3 - ...and then attempting to load the saved game again using TTDPatch.

Lakie wrote:I'm currently unsure how to resolve the issue, however there does seem to be a pattern (at least in the two saved games I tested from yourself) to the chunk identifier which might a possible avenue of investigation.
Thanks for the info and help :)
Last edited by RichNagel on 04 Apr 2014 18:19, edited 1 time in total.
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: TTDPatch hanging when reloading saved games

Post by Lakie »

But has still been loaded (and saved by) by TTDPatch at some point at least?

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Lakie wrote:But has still been loaded (and saved by) by TTDPatch at some point at least?
Yes, that is correct.
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: TTDPatch hanging when reloading saved games

Post by Lakie »

That would explain the presence of some of the TTDPatch information on the edge tiles.
Do you have a copy of such a game I could look at?

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Lakie wrote:That would explain the presence of some of the TTDPatch information on the edge tiles. Do you have a copy of such a game I could look at?
Sure enough :) Attached is a ZIP containing three saved games of the same currently running game:

TRT90.SV1 - Original saved game using TTDlx.

TRT91.SV1 - "TRT90.SV1", which has then been loaded and saved using TTDPatch.

TRT92.SV1 - "TRT91.SV1", which has then been loaded and saved using TTDlx.

Note that this was using TTDPatch version 2.5 Beta 9, and using a default "TTDPATCH.CFG" file
Attachments
TTDlx_and_TTDPatch_Saved_Games.zip
(527.89 KiB) Downloaded 363 times
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: TTDPatch hanging when reloading saved games

Post by Lakie »

The last file doesn't seem to exhibit the same behaviour (and all lack the TTDPatch data, as nothing has changed that's understandable).
You always keep them paused whilst traversing them between TTDLX and TTDPatch right? From the looks of it that doesn't change (or harm) the saved game at all.

[Edit] Well, the files are definitely different, but it doesn't seem to add the TTDPatch data at least.

[Edit #2] My working theory is that the games affected were originally saved with additional TTDPatch chunk(s) which have been disregarded by TTDLX thus causing issues when loading with TTDPatch.

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Lakie wrote:The last file doesn't seem to exhibit the same behaviour (and all lack the TTDPatch data, as nothing has changed that's understandable).
Hmmm, I just discovered that as well. Strange... maybe it was because I didn't allow the game to run long enough for the additional chunks to be added to the saved games (?).

Lakie wrote:You always keep them paused whilst traversing them between TTDLX and TTDPatch right? From the looks of it that doesn't change (or harm) the saved game at all. [Edit] Well, the files are definitely different, but it doesn't seem to add the TTDPatch data at least.
In this case, yes. I figured that I'd pause them immediately upon loading them, and then save them while paused... I mistakenly thought that this might help with the troubleshooting.


Anyhow, attached is another ZIP that includes three additional saved games ("TRT90.SV1" is the same as the one inlcuded in the previous ZIP). For these saved games, I allowed the game to run for a short while (instead of loading and saving them paused), and the "TRT92.SV1" saved game definitely exhibits the behavior (hangs TTDPatch).

Filename convention and scheme is the same as my previous post:

TRT90.SV1 - Original saved game using TTDlx.

TRT91.SV1 - "TRT90.SV1", which has then been loaded and saved using TTDPatch.

TRT92.SV1 - "TRT91.SV1", which has then been loaded and saved using TTDlx.
Attachments
TTDlx_and_TTDPatch_Saved_Games_2.zip
(527.53 KiB) Downloaded 309 times
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: TTDPatch hanging when reloading saved games

Post by Lakie »

The issue definitely seems to be caused by TTDPatch saving additional chunks (which are later disregarded by TTD), and the load system trying to skip over 'phantom' chunks.
I can't see an obvious solution as yet, I believe TTD(Patch) uses a buffer system which ignores whether all requested bytes were read (i.e. whether its hit the end of the file).

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Many thanks for the info and investigation, Lakie :)

I'm sure that this is probably a no-go, but any chance of coding a separate command-line utility that could strip the additional chunks from a savegame file?
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: TTDPatch hanging when reloading saved games

Post by Lakie »

Whilst it won't solve the issue completely you can use sv1codec to expand the saved game data ('.big', so it can be edited) and then re-compress it (for playing).
In particular you'd need to hex edit (using a hex editor) address 0x44CB8 in the raw data to 0 (for 2 bytes), this can also be achieved quite easily through simple programs or scripting languages.
That should prevent saved games attempting to load additional chunks.

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Lakie wrote:Whilst it won't solve the issue completely you can use sv1codec to expand the saved game data ('.big', so it can be edited) and then re-compress it (for playing).

In particular you'd need to hex edit (using a hex editor) address 0x44CB8 in the raw data to 0 (for 2 bytes), this can also be achieved quite easily through simple programs or scripting languages.

That should prevent saved games attempting to load additional chunks.
MANY MANY MANY THANKS for that info, Lakie!! :) THAT is EXACTLY what I was looking for, and I'll give it a whirl later today :)
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
RichNagel
Engineer
Engineer
Posts: 21
Joined: 23 Dec 2013 20:21
Location: Out in the woods of Crystal River, Florida USA
Contact:

Re: TTDPatch hanging when reloading saved games

Post by RichNagel »

Hehe, I was so exited I couldn't wait for "later today" <grin>... IT WORKS PERFECTLY! A BIG thanks again! :)
Rich ¥Weeds¥ Nagel
http://www.richnagel.net
Post Reply

Return to “Problems with TTDPatch”

Who is online

Users browsing this forum: No registered users and 1 guest