Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Sep 25, 2017 5:09 pm

All times are UTC




Post new topic  This topic is locked, you cannot edit posts or make further replies.  [ 437 posts ]  Go to page 1 2 3 4 522 Next
Author Message
PostPosted: Thu Nov 11, 2004 7:07 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
UPDATE: NFORenum is now being maintained by members of the OpenTTD project. A thread discussing the latest preview release (as of August 2010) can be found here.

-------------------------------------------------------------------------------------------------------------------------------------

I have officially Gotten Tired of renumbering my NFO files by hand, and of having to copy and paste my 424-character-long ruler every time I code a pseudo-sprite longer than about 10 bytes.

Actually, that happened about the second time I renumbered an NFO file, I just didn't do anything about it until now.

Since I could not find renum.pl, I produced this GPLed (#include <std/no_warranty.h>) tool. (EDIT:Csaboka's right, renum.pl is in the source .zip.)


The source should compile with Visual Studio .NET, gcc 3.4.x, and gcc 4.
Source from before the move to SVN is available upon request.

UPDATE:

Version 3.4.6 released.
Features:
- Numbers all non-comment, non-blank lines.
- Corrects the size of pseudo-sprites.
- Comments are never modified, regardless of location.
- Spacing between bytes in pseudosprites is preserved.
- Creates a backup of of the file to be modified, unless the backup already exists.
- Sanity checks on input files, to help prevent renumbering, for example, GRF files.
- Outputs NFO header if one is not detected.
- Outputs correct sprite 0 on TTDPatch NFOs.
- Checks all sprites for validity.
- Supports strings, binary includes, binary imports, and recolor maps.
- Permits calculations and variables in realsprites.
- Accepts strings with UTF-8 encoded characters.
- Command-line arguments for globally applicable settings, including several comment-commands.
- Optionally, rewrites sprites in a more readable format.
- Optionally, attempt to correct faulty pseudosprites.

Changelog:
v3.4.5 to v3.4.6
- Data file updates for stations; canals; houses; industries; actions 2, 5, 7/9, B, and D; languages; TextIDs; and callbacks.
- Fixed parameter check for global 60+x variables.
- Allow variational 2s to take var 1A with an <and-mask> of 0.
- Check that variational 2 operator 0F's left-hand side side was stored.
- Prohibit storing to persistent registers when they don't exist.
- Fix several bugs in the formatting of variable-length properties.
- Check cargo types against the cargo translation table.
- Add \2ror and \2rot for Adv2 op 11.
- Add \d<YMD> and \d<DMY> to generate long format intro dates.

v3.4.4 to v3.4.5
- Data file updates for signals, snowline, and TextIDs
- Fix yet more array index vs char* problems.
- Add offset info to a message that failed to have it.
- Ensure that VERSIONCHECK gets its required two arguments.
- Fix version 1 industry production callback support.
- Support Action 7/9's new GRFID/mask format.
- (minime) Allow @@LET variables to be redefined.

v3.4.3 to v3.4.4
- Data file updates for industry tiles, industries, and objects.
- Make unknown action 5 types look for real sprites or recolor sprites.
- Recognize action 2 operations 0E, 0F, and 10
- Catch Action Fs that chain to themselves.
- Add escapes for the new action 2 operations 0E and 0F.
- Support new signals. (Actions 5, variational 2, and 3.)
- Process var. and random 2s and action 3 even when the feature is not recognized.
- (fix) Don't correct the feature of a var. or random 2 to match the preceding action 1.
- Industry production callback version 1.
- Produce a useful error message when data files are out of sync with each other.
- Make --data also report the data-file location.
- Check for duplicate IDs in an action 3.
- Check that prop 08 has been set before the action 3, when necessary.

v3.4.2 to v3.4.3
- Action 1/2/3 for bridges (Callback 33)
- Data file updates for vehicles, stations, action 7/9, TextIDs
- Add $HOMEDRIVE$HOMEPATH to the list of search paths for .renum/
- Allow multiple sizes for some action 7/9 variables.
- Accept GRF version 7 lang-id bytes in action Bs that preceed the action 8.
- Allow Action 6 <param-size> entries with bit 7 set.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Last edited by DaleStan on Tue Dec 11, 2007 5:50 pm, edited 92 times in total.

Top
   
 
 Post subject:
PostPosted: Thu Nov 11, 2004 9:27 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Nov 25, 2002 4:30 pm
Posts: 1202
Location: Tiszavasvári, Hungary
Renum.pl (written by Patchman) is surely included in the TTDPatch source file, but just in case someone's too lazy to download that, I'll include it in this post.

Since it's written in Perl, you'll need Perl to run it.

It doesn't just renumber the lines, it calculates the sizes of pseudo-sprites as well, and removes comments. You can for example start every pseudo-sprite with "0 * 0" because the script will fix both zeros to valid numbers.

Usage:
perl <path>renum.pl <path>yourfile.nfo

PS: After some extensive using, I found a bug as well: if the last line of your nfo is a comment, renum.pl seems to eat the last meaningful line as well. For a workaround, put a new line with only a space in it in the last line, so your comment will be in the last but one line.


Attachments:
File comment: GRF renumbering tool
renum.pl.zip [673 Bytes]
Downloaded 1079 times

_________________
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Top
   
 
 Post subject:
PostPosted: Thu Nov 11, 2004 10:37 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
I should have known I'd forget something if I posted after midnight. In this case, that something was the feature list. I think that feature list is complete.

The list doesn't exist anyplace else, except by the "There's a known issue regarding this feature, hence the feature must exist" reasoning.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
PostPosted: Thu Nov 11, 2004 8:40 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Version 0.2 is released.

Changelog:
- No longer silently destroys data in multi-line pseudo sprites. (It's quite noisy about it now.)
- Detects TTDPatch NFOs, and reports size stats.
- In TTDPatch NFOs, if sprite 0 does not report the exact size of the NFO, outputs corrected sprite 0 to the console, and, commented, as the last line of the NFO.
- Renum.bat will not delete the old version of the NFO if pseudosprite data may have been destroyed.
- Redefined return values.

See first post for full details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Fri Nov 19, 2004 7:35 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
One of these days, I'll remember that I've fixed a few things and need to post a new version.

Version 0.3 is released.
It contains mostly bugfixes.

Changelog:
- Now also reports on potential continued pseudo-sprites with trailing comments
- No longer eats whitespace before comments
- No longer eats blank lines

See first post for full details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Fri Nov 19, 2004 8:59 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
OK, now that that's fixed (please don't ask me how I failed to catch it)

Version 0.3.1 (bugfix) is released.
Changelog:
- No longer destroys real sprites.

See first post for full details and download.[/quote]

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Tue Nov 23, 2004 12:10 am 
Offline
Engineer
Engineer

Joined: Fri Mar 12, 2004 3:05 pm
Posts: 65
I tried the newer program and as you said it splits pseudo sprite lines.

You should be able to fix this. I had the same problem whien I first stated
my NFO alter/reader program. So keep at it you will fix it!

I like the program except for that.

What are you programmin in?

JEB


Top
   
 
 Post subject:
PostPosted: Tue Nov 23, 2004 1:44 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
JEB wrote:
I tried the newer program and as you said it splits pseudo sprite lines.
You should be able to fix this. I had the same problem whien I first stated
my NFO alter/reader program. So keep at it you will fix it!

The workaround is, of course, to manually remove the linefeeds that GRFCodec puts in, but I realized this was not an acceptable workaround when looking at the code for the USSet, so that is now #2 on my TODO. #1 is to test (Win32 and Linux versions. Sorry, I don't have a Mac, but stubs will be there if anyone wants to finish it), fix, and upload the version that does its own file handling, to free up standard in and -out for interactive use. This will also enable renum to write a correct sprite 0 at the correct location, instead of at the end of the file.

There are particularly obstinate lines, like
Code:
10 AD 10 15 01 15 15 10 10
that are perfectly valid as both as a continuation line of a pseudo-sprite, and as a real sprite, but this is a pathological case.
Actually, since I ignore whitespace completely in pseudo-sprite checking (and GRFCodec apparently does too),
Code:
10 AD 10 15 01 15 15 1 1
which is slightly more likely, would also be valid as either continued pseudo sprite, or real sprite.

I think I'll just count both of those as continued sprites, and leave this gem in the known issue file:
Quote:
Known Issue:
- Real sprites in PCX files with two-character names and no extention, where both characters are valid hex digits, may be attached to the preceding sprite if it is a pseudo sprite.
Status: Not a bug.

Come to think of it, I can make it even more specific, and only cause problems if the preceding pseudo sprite was not an action 1, ie only in(possibly) TTD's original GRF files, which really shouldn't be renumbered anyway, or very broken TTDPatch GRFs.

JEB wrote:
What are you programmin in?
C++.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Mon Nov 29, 2004 7:41 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
v0.4 is more internal changes than anything else, but a lot of (partly intentional) side effects came along with it.

Changelog:
v0.3.1 to v0.4
- (devel) Now does its own file handling (disable by #defining NO_FILE_HANDLING)
- Accepts absolute paths for .NFO locations.
- Drag&drop from Windows explorer now works.
- The executable is now UPX packed.
- renum.bat is no longer necessary; the executable is now renum.exe.
- GNU/Linux systems (GNU fileutils) receive a new backup everytime the NFO is renumbered.

See first post for full details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Tue Nov 30, 2004 1:17 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
I have fixed that multi-line pseudo-sprite problem, and decided that it's time to increment the major version number.

Changelog:
v0.4 to v1.0
- Now handles multi-line pseudo-sprites correctly. (And there was much rejoicing.)
- Now writes sprite 0 in the correct location.
- More permissive TTDPatch NFO detection--if the first sprite is a pseudo-sprite, treat as a TTDPatch NFO.
- Successful runs no longer produce output, other than the fixed NFOs.
- (devel) Now stores most of the NFO in memory while processing.

See first post for full details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Thu Dec 02, 2004 12:50 pm 
Offline
TTDPatch Developer
TTDPatch Developer
User avatar

Joined: Tue Apr 13, 2004 1:35 pm
Posts: 417
Location: Eindhoven, Netherlands
hmm.. why is it both this program and the renum.pl don't support the nice strings the latest grfcodec supports? no i still have to do the counting myself...


Top
   
 
 Post subject:
PostPosted: Fri Dec 03, 2004 12:35 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Mek wrote:
hmm.. why is it both this program and the renum.pl don't support the nice strings the latest grfcodec supports? no i still have to do the counting myself...

Because I didn't know that feature existed?
EXPN, please, or point me to where it is explained.
What's the version number for "latest"? and if it's not 0.9.5 where can it be found?

I just released a new version, but I doubt I managed to implement this request.

Changelog:
v1.0 to v1.1
- Now processes all files listed on the command line.
- Always produces output. (If I could just make a decision here...)
- Warning and error messages will now be sent to both the console and the NFO.
- Changed handling of invalid pseudo-sprites. Instead of dying, comments the sprite out and continues.
- (Bugfix) Added a check to ensure that the output file actually got opened.

See the first post for more details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Fri Dec 03, 2004 12:16 pm 
Offline
TTDPatch Developer
TTDPatch Developer
User avatar

Joined: Tue Apr 13, 2004 1:35 pm
Posts: 417
Location: Eindhoven, Netherlands
DaleStan wrote:
Mek wrote:
hmm.. why is it both this program and the renum.pl don't support the nice strings the latest grfcodec supports? no i still have to do the counting myself...

Because I didn't know that feature existed?
EXPN, please, or point me to where it is explained.
What's the version number for "latest"? and if it's not 0.9.5 where can it be found?

Hmm yes... you're right.. this feature isn't in the latest grf codec available. Since i'm running linux, I applied the unix patch to the 0.9.5 source, and apparently this doesn't only make grfcodec compatible with linux, but it also adds support for strings...


Top
   
 
 Post subject:
PostPosted: Fri Dec 03, 2004 8:05 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Well, I'll see what I can do.
Between Cygwin and this Linux box sitting next to me[0] I should be able to get something to work.

I'm making progress on sanity checking pseudo-sprites. I have coded (but not tested) checks for 1 and 5, as well as the data section that follows them. (all 1 byte pseudo-sprites are taken to be real sprites, to accomodate USSet, CSDset, and probably others.)

And in the "Let's be honest" department, v1.0 introduced another bug.
- Continuation lines of pseudo-sprites containing invalid characters will silently be destroyed, as will all following lines of that pseudo-sprite.

[0]FSVO "box" It runs beautifully as a console, but cannot handle X.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Wed Dec 08, 2004 12:43 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
New version.

Changelog:
v1.1 to v1.2
- Now adds missing NFO header.
- Checks real sprites for validity. This mostly solves the problem of destroying continuation pseudo-sprite lines with invalid characters.
- Corrected backup and temp file names in some cases.

See the first post for more details and download.

I am unable to get the GRFCodec source to compile (report over here), so I would have no way of properly testing string support were I to put it in.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Wed Dec 08, 2004 7:20 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Grr... Another bugfix. At least it's not as urgent as 0.3.1.

Changelog:
v1.2 to v1.2.1
- Fixed real-sprite validity check to agree with GRFCodec.
- Fixed condition where sprites could get numbered in hex.

See the first post for more details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Sat Dec 18, 2004 11:46 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Yes, I bumped the major version number again.

Two new features here: sanity checking and comment commands.

Sanity checking will check the NFO for pseudo-sprites with incorrect length, insufficient/excessive real sprites, potential mistakes, and anything else I deem incorrect. Output is to both the console and the NFO.

The comment commands can tell NFORenum to remove old messages from the NFO, so you don't have to manually remove messages when you fix a problem.
Comment commands also control sanity checking, to help keep it from outputting incorrect/unnecessary messages.

See the README for more information on how these work.

Changelog:
v1.2.1 to v2.0
- Added sanity checking for Actions 1-3, 5, and A
- Added comment commands.
- Changed *nix version to look in the "sprites/" directory.

See the first post for more details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Mon Dec 20, 2004 12:26 am 
Offline
Engineer
Engineer

Joined: Fri Mar 12, 2004 3:05 pm
Posts: 65
very good program, has saved me lots of work.
I added it to GRFMENU. A menu program that
allows me to not have to always change a bat
files name. I realeased a version of it here
last spring.

JEB


Top
   
 
 Post subject:
PostPosted: Mon Dec 20, 2004 8:07 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Bugfix, and a little bit more sanity checking.

v2.0 to v2.0.1
- Added sanity checking to ensure that there is a chain from all vehicle sprites to an action 3.
- Added a comment command (USESET) to work around unchecked Action 6s
- Fixed condition where certian pseudosprite continuations could be replaced with real sprites.

See the first post for more details and download.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 
 Post subject:
PostPosted: Wed Dec 22, 2004 7:47 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Apr 16, 2003 4:09 pm
Posts: 4290
Skype: george-vb
Location: SPb, Russia.
What is wrong with the following line?

//!!Sanity warning: Var02 declaring no variations
167 * 10 02 00 3A 81 41 00 FF 00 1A 00

_________________
Image Image Image Image


Top
   
 
Display posts from previous:  Sort by  
Post new topic  This topic is locked, you cannot edit posts or make further replies.  [ 437 posts ]  Go to page 1 2 3 4 522 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.