SDLDevil 0.5 released!
#21
I made some changes to include paths to fix 'file not found' errors, nothing serious this time - but I had to create new makefile.......after that still... same problem.
here is compilation log : https://dl.dropboxusercontent.com/u/3261...ompile.zip
Reply
#22
(12-16-2013, 10:30 PM)v66r link Wrote:The levels your version contains 2 bytes of "garbage" - one between header and mine data and one between mine and game data.
You most likely removed the PACKED_ATTR from some of the structs? Without it the compiler aligns these structs to 32 bit. Unfortunately the saving routines save the complete struct and this way the bytes introduced by the compiler for alignment also get written to the file.

well... I redownloaded it and it looks like level format is not handled properly there...
readlvl.c

Code:
struct D2_REG_levelfilehead {
    struct fileheadversion fh;
    uint32_t minedata_offset;
    uint32_t gamedata_offset;
    char *palname;        /* terminated by a linefeed */
    uint32_t reactor_time, reactor_strength;
    /* 0x1e and 0xffffffff */
    uint32_t flickering_lights;
    uint32_t secret_cubenum;
    uint32_t secret_orient[9];
last line makes orientation with 36 bytes -> shouldn't be 34 bytes instead? (http://descent2.com/ddn/specs/rl2/)

Code:
struct D1_minedata {
    unsigned char version;    /* always 0 */
    uint16_t numpts, numcubes;
} PACKED_ATTR;

struct D2_minedata {
    unsigned char version;    /* always 0 */
 
    uint16_t numpts, numcubes;
} PACKED_ATTR;
Are these zeros really needed?
from above reference:
Quote:from minedata-offset [MINEDATA]:
0-1 Number of verticies [NUM_VERTICIES]
2-3 Number of cubes [NUM_CUBES]

I've checked working levels with this specs: http://descent2.com/ddn/specs/rl2/ except offests being absolute not relative anything else seems right.
Reply
#23
(12-17-2013, 10:11 PM)aqqman link Wrote:last line makes orientation with 36 bytes -> shouldn't be 34 bytes instead? (http://descent2.com/ddn/specs/rl2/)
No, the documentation on descent2.com seems to be wrong here. The orientation is a 3x3 matrix consisting of 32 bit (4 byte) integers (or better FIX).
3*3*4 = 36

(12-17-2013, 10:11 PM)aqqman link Wrote:Are these zeros really needed?
Here also the documentation seems to be wrong or unclear on descent2.com. The game also relies on these bytes, according to main/gamemine.c:948 (d1x-rebirth).

Reply
#24
(12-17-2013, 10:35 PM)v66r link Wrote:No, the documentation on descent2.com seems to be wrong here. The orientation is a 3x3 matrix consisting of 32 bit (4 byte) integers (or better FIX).
3*3*4 = 36

Strange... then why every level opened with hex shows mine data offset as 4F (if groupa.256 palette used) which indicates that header is 78 bytes long, not 80?

Ok I got that part with zeros,my mistake, the offset always points at 0.
Reply
#25
Can you please also provide your DevC++ project file?
Reply
#26
Sure, this is the latest version of it along with makefile. I've tried different settings but this is just the last before I gave up - it still compiles but the exe is useless.
https://dl.dropboxusercontent.com/u/3261...evcppP.zip
Reply
#27
Today I tested it with old 4.6.2 MinGw compiler (the one which I used back with 0.3 SDLDevil) - no luck, same problem. It wont open any existing RDL ("Can't open level").
It is real mystery for me and I still find it interesting that the exe comes out with only 750kB size which is a lot smaller than original one (1,5MB)
Reply
#28
now if you can get this to work with the latest code on git....
Reply
#29
Done.
I had some problems with includes. It doesn't seem to take paths to some files so I had to change them despite the fact that makefile has them set:

src/structs.h
Code:
35: <wins_all.h>               changed to    "wins/wins_all.h"

40: <english/text.h>         changed to    "language/english/text.h"

src/askcfg.c
Code:
43: <english/askcfg.c>      changed to    "language/english/askcfg.c"

src/do_stat.c
Code:
29: <english/do_stat.c>    changed to    "language/english/do_stat.c"

Now some weird stuff:

src/wins/w_system.c
Code:
24: //#include <fnmatch.h> 

751:          __S_IFREG        changed to        _S_IFREG
765:          __S_IFDIR         changed to        _S_IFDIR

Makefile.win and Dev-C++ project file: http://dl.dropboxusercontent.com/u/32615...l_snap.zip

All this above is for snapshot.
To compile 0.5 with Dev-C++ only include paths have to be changed (above).
Tools used: Orwell Dev-C++ 5.2.0.3 with MinGW32 4.6.2

Reply
#30
(12-16-2013, 11:17 PM)Kp link Wrote:Relying on packed structures is a major problem in the core Descent code, too.  There was a bug related to loading resources that I tracked down to mingw32-gcc 4.7 and later not respecting the __packed attribute.  Other platforms and mingw32-gcc <4.7 were fine.  Adding -mno-ms-bitfields fixed the problem for >=4.7.

[Edit: the option is -mno-ms-bitfields, not -mms-bitfields as I originally said.  MS bitfields were enabled by default in 4.7, which was the cause of the problem.]

Fixing the SConstruct file to account for this would have saved me a few hours of frustration.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)