openttd / grfcodec Goto Github PK
View Code? Open in Web Editor NEWnfo (de-)compiler for NewGRFs
License: GNU General Public License v2.0
nfo (de-)compiler for NewGRFs
License: GNU General Public License v2.0
GRF development tools README Last updated: 2016-06-27 Release version: 6.0.6 ------------------------------------------------------------------------ Table of Contents: ------------------ 1) About 2) Contact 3) Installation 4) Running 5) Known issues 6) Compiling 1) About: -- ------ The GRF development tools are a set of tools for developing (New)GRFs. It includes a number of smaller programs, each with a specific task. GRFCodec decodes and encodes GRF files for Transport Tycoon (Deluxe and Original), TTDPatch and OpenTTD. These GRFs are a collection of sprites, although for TTDPatch and OpenTTD these can be so-called pseudosprites which allow changes of behaviour of the game. GRFID is a small tool for extracting the so-called GRF ID from a GRF. NFORenum is a tool checking NFO code for errors, and for beautifying that code -- inasmuch as NFO can be beautified :) GRFCodec, GRFID and GRFStrip are licensed under the GNU General Public License version 2.0. For more information, see the file 'COPYING'. GRFID contains the MD5 implementation written by L. Peter Deutsch and this MD5 implementation is licensed under the zlib license. NFORenum is licensed under the GNU General Public License version 2, or at your option, any later version. For more information, see 'COPYING' (GPL version 2), or later versions at <http://www.gnu.org/licenses/>. 2) Contact: -- -------- Contact can be made via the issue tracker / source repository at https://github.com/OpenTTD/grfcodec or via IRC on the #openttd channel on OFTC. 3) Installation: -- ------------- Installing the GRF development tools is fairly straightforward. Just copy the executable into any directory. It is advised to put the executable in one of the directories in your path so it can be easily found. For example when compiling OpenGFX. NFORenum will (if necessary) create a .nforenum directory. All its data files will be placed in that directory, and updated as needed. It is not necessary to remove the .nforenum directory before upgrading. To uninstall, delete the executables and any .nforenum directories. 4) Usage: -- ------ Information about the usage of the different tools can be found in their respective man pages as well as grfcodec.txt, grftut.txt and nforenum.txt. 6) Compiling: -- ---------- GCC/ICC: Just use "make", or on non-GNU systems "gmake".
src/data.cpp: In function ‘void _myfread(FILE*, uchar*, uint, files, const char*, int)’:
src/data.cpp:1188:52: error: reference to ‘data’ is ambiguous
1188 | IssueMessage(0,DATAFILE_ERROR,LOAD,data[file].name+NFORENUM_DIR_LEN,FILELINE,src,line);
| ^~~~
In file included from /usr/include/c++/11/string:54,
from src/data.cpp:29:
/usr/include/c++/11/bits/range_access.h:318:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’
318 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:309:5: note: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’
309 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:299:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’
299 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/11/bits/range_access.h:289:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’
289 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
src/data.cpp:1049:33: note: ‘const dat data [14]’
1049 | #define DATA() static const dat data[]={
| ^~~~
src/data.h:37:1: note: in expansion of macro ‘DATA’
37 | DATA()
| ^~~~
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984158
I haven't looked closely, but at first glance it seems like the gcc/libstdc++ header files define a data()
function or method that conflicts with a data
variable. Maybe the gcc-defined version is new in gcc-11? It might be a matter of renaming our own data
variable, or maybe there is a better fix.
When using grfcodec to decode on macOS 13.5, I get completely wrong colours. (It is not an issue with Win vs. Dos palette.) Does anybody know a fix for this?
Attached is a part of the png obtained from openttd.grf. (For some reason, this does not affect the original TTD files like trg1r.grf, but any newgrf I have tried.) Works fine under Wine/Windows.
grfcodec> LC_ALL=C make
Makefile:55: *** invalid syntax in conditional. Stop.
Version: master (5a00dc3)
OS: Linux/OpenSUSE
Trying to build 6.0.6 fails with the following error:
x86_64-pc-linux-gnu-c++ -c -o objs/command.o -idirafter/usr/include -O2 -DGCC32 -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wno-format-nonliteral -DWITH_FMEMOPEN -DWITH_PNG -I/usr/x86_64-pc-linux-gnu/include/libpng16 -march=native -O2 -pipe -MMD -MF objs/command.o.d -MT objs/command.o src/command.cpp
src/command.cpp: In function 'bool parse_comment(const string&)':
src/command.cpp:306:9: error: narrowing conversion of '-1' from 'int' to 'unsigned int' [-Wnarrowing]
306 | case -1:
Fedora patched it:
https://src.fedoraproject.org/rpms/grfcodec/blob/master/f/gcc10.patch
In 'compression' part:
If the high bit is not set, what follows is code&0x7f bytes of
verbatim data.
Code:
int len = (code == 0) ? 0x80 : code;
I suppose this case must be documented too?
https://dev.openttdcoop.org/projects/grfcodec points to github, but the README here points back to ottdc. Should the README be updated?
Also, what is the official download location? There is a list of tags with source tarballs here (which are just git snapshots), but there is also https://www.openttd.org/downloads/grfcodec-releases/latest.html that has binaries (and possibly post-processed) source tarballs?
It seems grfid has a single error message, which it currently prints to stdout:
Line 253 in 045774d
It should really print this to stderr, since typical usecase of grfid is to redirect to a file, which hides the error message (i.e. when building opengfx/opensfx, make aborts due to the non-zero exit code, but provides no idea about what is wrong).
GRFCodec produces invalid property warnings for industry properties 25+, and presumably every other property, variable, callback and feature that has been added since 2016 (roadtypes?).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.