Bug #1043

NML fails on TTDPatch

Added by Ammler over 9 years ago. Updated about 9 years ago.

Status:ClosedStart date:2010-06-26
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:-

Description

I tested the NML NewGRFs OGFX+, SwedishRails and the regression GRFs

Except 001_Action8, none worked...

nml_06.png (9.67 KB) Ammler, 2010-06-26 19:35

renum_output.txt Magnifier - renum output (765 Bytes) planetmaker, 2010-06-28 15:00

swedishrails.nfo - grfcodec's de-compiled nfo parsed through renum (37.8 KB) planetmaker, 2010-06-28 15:00

Associated revisions

Revision 703:6492687e440e
Added by yexo about 9 years ago

Fix #1043: byte-sized special parameters should not be read as dword. Fixed by masking the bits we want

Revision 703:6492687e440e
Added by yexo about 9 years ago

Fix #1043: byte-sized special parameters should not be read as dword. Fixed by masking the bits we want

History

#1 Updated by frosch over 9 years ago

006_vehicle.nml define roadvehicle no 89, which is out of range for TTDP. There are only RV 0 to 87 in TTD.
item(FEAT_ROADVEHS, foster_express_tram, 89) {

#2 Updated by yexo over 9 years ago

OGFX+ is not expected to work either but it doesn't have a version check yet. Swedishrails should work though, what error message do you get from it?

#3 Updated by Ammler over 9 years ago

Well, after a bit more investigation, this bugreport might be missplaced. ;-)

most regression tests fail because of missing Action8, SWR crashes TTDP on start so I don't have a error message, maybe it is more verbose on Windows,

#4 Updated by planetmaker over 9 years ago

Indeed, OpenGFX+ is not designed for TTDP as it on purpose and explicitly declares vehicle IDs which are not taken by default IDs in order to not overwrite any of them. On the other hand, SwedishRails is meant to also work with TTDPatch and should automatically detect running on that platform and disable the railtypes feature in that case, leaving only sprite replacements. It'd be interesting to know what exactly causes it...

#5 Updated by planetmaker over 9 years ago

I had wallyweb test SwedishRails on TTDP. It seems to be really an intrinsic problem. The parameter processing also seems to generate errors in nforenum, most notably:

Error on sprite 8.
Error on sprite 15.

which is part of my parameter initialization:

2 * 9     0D 42 \D- 9D FF 00 00 00 00
3 * 5 0D 42 \D/ 42 42
4 * 9 0D 42 \D- FF 42 01 00 00 00
5 * 9 0D 44 \D- 9D FF 01 00 00 00
6 * 5 0D 44 \D/ 44 44
7 * 9 0D 44 \D- FF 44 01 00 00 00
//!!Error (123): Source parameter 1 is invalid.
8 * 9 0D 45 \D- A1 FF 00 00 08 10
9 * 9 0D 45 \Du<< "Eˇ·ˇˇˇ"
10 * 5 0D 43 \D& 44 45
11 * 5 0D 41 \D| 42 43
12 * 9 0D 40 \D* 41 FF 03 00 00 00
13 * 5 0D 0A \D| 40 00
14 * 9 0D 40 \D= FF 00 "ˇˇˇˇ"
//!!Error (123): Source parameter 2 is invalid.
15 * 9 0D 41 \D- "ˇ°#N" 00 11
16 * 9 0D 41 \Du<< "Aˇ·ˇˇˇ"
17 * 9 09 41 04 \7= 00 00 00 00 05
18 * 9 0D 40 \D= FF 00 00 00 00 00
19 * 9 0D 0B \D= FF 00 B7 07 00 00
20 * 5 0D 42 \D= 01 00
21 * 9 09 42 04 \7= 00 00 00 00 01
22 * 5 0D 0B \D= 01 00
23 * 9 09 40 04 \7= 00 00 00 00 04
24 * 9 0D 0B \D= FF 00 40 4B 4C 00
25 * 5 0D 42 \D= 01 00
26 * 9 09 42 04 \7= 00 00 00 00 01
27 * 5 0D 0B \D= 01 00
28 * 9 07 0A 04 \7! 03 00 00 00 07

Last, one warning concerning parameter size is also interesting:

//!!Warning (76): 4 is not a valid <size> for variable 83.
274 * 9 07 83 04 \7! 00 00 00 00 12

#6 Updated by yexo over 9 years ago

According to http://wiki.ttdpatch.net/tiki-index.php?page=ActionD and http://wiki.ttdpatch.net/tiki-index.php?page=Action7 reading param A1 should be ok, and if I read the nforenum code correctly then it should be too, no idea why it gives that "error 123" there. The warning 76 is something I was not aware of, that is most likely a real bug in nml. Apparently 'special' parameters from http://wiki.ttdpatch.net/tiki-index.php?page=Action7 should be read only with the correct size, nml always uses size 4 to read parameters.

#7 Updated by yexo over 9 years ago

I just checked the openttd and ttdpatch code and ignoring the size of those special parameters is harmless, reading it always as dword sized works just fine. So all those nforenum errors/warnings can be ignored.

#8 Updated by frosch over 9 years ago

TTDP defines the action6/7/9/D variables 80 to A4 via the "externalvars" array. The array contains pointers to the actual variables. Some of them just refer to original TTD global variables.
As such the read size is important. If you read var 81 (current year) as dword, you will get current month in bits 8-15 and and the company colours of company 0 and 1 in the other two high bytes.

#9 Updated by yexo about 9 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset 6492687e440e.

Also available in: Atom PDF