www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Software Development

Reply
 
Thread Tools
Old 23-11-13, 12:33   #391
pmatulka
Hobbyist
 
Join Date: Jun 2013
Location: Poland
Posts: 40
Default

After adding support for OpenAL, each compiled for the Linux version of the engine crash with segfault error.
Since I could not myself to deal with it, I contact with vobject user (a few months ago he wrote cmakefile for engine).
After consulting I get a version that works without any problems on Linux.

For this purpose it was necessary to make some changes in the code:

/opentomb/main_SDL.cpp:463:0
Code:
int SDL_main(int argc, char **argv)
change to:
Code:
int main(int argc, char **argv)
/opentomb/audio.cpp:985:0
Code:
    SDL_FreeRW(src);
change to:
Code:
//    SDL_FreeRW(src);
/opentomb/al/Alc/backends/backend.c:30:5
Code:
device->DeviceName = strdup(deviceName);
change to:
Code:
device->DeviceName = deviceName ? strdup(deviceName): NULL;
Explanations from Volker:
Quote:
Originally Posted by Volker Schneider
I managed to compile and run the current version under Linux (Archlinux, GCC 4.8.2) using the updated CMake script attached.
However, there are still two things that need to be fixed in the code to run on Linux:
1) main_SDL.cpp:SDL_main must be renamed to main()
2) remove "SDL_FreeRW(src);" calls from audio.cpp in line 791 and 870.

This is a bug. SDL_LoadWAV_RW() will free the memory when it is done, there is no need for SDL_FreeRW(). It is propably the reason that your version crashed.
Quote:
Originally Posted by Volker Schneider
(...) the code needs another bugfix to prevent the crash you described:

backend.c:30: must be changed to "device->DeviceName = deviceName ? strdup(deviceName) : NULL;".

strdup() gets passed a NULL pointer instead of a string - strange that it does not crash on Windows, though.
With these changes, the version for Linux works perfectly .
pmatulka is offline   Reply With Quote
Old 23-11-13, 13:33   #392
TeslaRus
Student
 
TeslaRus's Avatar
 
Join Date: Jan 2013
Posts: 195
Default Fixes

Thanks for information about SDL_LoadWAV_RW() working! The question: that function will free the memory in all cases (success and fail)?
strdup function works correct with NULL input in windows (I.E.: I write strdup(NULL); - no crashes). +
sprintf(buf, "str = %s", NULL);
made that: "str = (null)"
I do not know how does it works in other platforms.
About main function: will it works in Linux:
main_SDL.cpp:
#include <SDL2/SDL_main.h>
...
int SDL_main(int argc, char **argv)
{
...

In last binary was fixed TR5 sample loading critical errors (in samples loading) + fixed skeletal model crash in joby4.trc.
TeslaRus is offline   Reply With Quote
Old 23-11-13, 17:31   #393
A_De
Archaeologist
 
A_De's Avatar
 
Join Date: Jan 2012
Location: Beyond trf
Posts: 1,254
Default

Recently downloaded this engine, changed cvars in config file but the program crashes on loading tr4 file. I can load tr3 and tr2 game files but statics are not shown and leves geometry has holes everywhere. Besides all objects including lara look messy. What i'm doing wrong? Tried to change parameters in config but nothing helps. Using win XP 32
__________________
Everything burn, everyone screams...
A_De is offline   Reply With Quote
Old 23-11-13, 20:00   #394
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 951
Default

Hi!

I'm going to install VM software and try to run it on Windows XP (since I only have Win7-64 on my PC right now). So far I had no problems running it on my neighbor's WinXP nettop, but it was long ago, before all recend features had been developed.
Lwmte is offline   Reply With Quote
Old 24-11-13, 07:50   #395
TeslaRus
Student
 
TeslaRus's Avatar
 
Join Date: Jan 2013
Posts: 195
Default Wrong geometry

Quote:
Besides all objects including lara look messy. What i'm doing wrong? Tried to change parameters in config but nothing helps. Using win XP 32
Hmmm... I see 2 reasons:
- wrong config.lua version;
- video card or video card driver;
I test engine on 4 PC (video: GF 675MX, GF 550M, GF 8400M and ATI 5700) - all works correct (OS WIN7).
TeslaRus is offline   Reply With Quote
Old 24-11-13, 09:49   #396
A_De
Archaeologist
 
A_De's Avatar
 
Join Date: Jan 2012
Location: Beyond trf
Posts: 1,254
Default

^ my graphic card is gf fx 5200
the early version of engine worked without problems. The config came with downloaded archieve. So it might be OS related issues.
__________________
Everything burn, everyone screams...

Last edited by A_De; 24-11-13 at 09:50.
A_De is offline   Reply With Quote
Old 25-11-13, 05:25   #397
vobject
Hobbyist
 
vobject's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 40
Default

Quote:
Originally Posted by TeslaRus View Post
Thanks for information about SDL_LoadWAV_RW() working! The question: that function will free the memory in all cases (success and fail)?
strdup function works correct with NULL input in windows (I.E.: I write strdup(NULL); - no crashes). +
sprintf(buf, "str = %s", NULL);
made that: "str = (null)"
I do not know how does it works in other platforms.
About main function: will it works in Linux:
main_SDL.cpp:
#include <SDL2/SDL_main.h>
...
int SDL_main(int argc, char **argv)
{
...

In last binary was fixed TR5 sample loading critical errors (in samples loading) + fixed skeletal model crash in joby4.trc.
Hello TeslaRus, pmatulka, and everyone else,

I am the person that pmatulka recently quoted regarding Linux compatibility.

About my fixes:

The SDL_LoadWAV_RW() documentation is indeed an bit unspecific, so I took a look into the current SDL2.0.1 implementation (http://hg.libsdl.org/SDL/file/cf81e6...DL_wave.c#l404). Turns out, that SDL_LoadWAV_RW() frees the "src" argument even when there is an error. Btw. it does so by calling SDL_RWclose(), and not SDL_FreeRW().

The documentation for strdup() is, again, not very specific. However, all Linux and Unix systems seem to agree, that it needs to be passed a valid string, and that NULL is not a valid string:
http://stackoverflow.com/questions/6...n-passing-null

About the SDL_main() function: on Linux the linker complains about a missing reference to main(), which every valid program needs. SDL_main() is not enough, it needs a main() function. On Windows, SDL works with this weird SDLmain library (don't really remember how or why). But on Linux, there is not SDLmain needed. I have added a line to the CMake script do redefine "SDL_main" to "main". It works but isn't very nice.

Thanks to pmatulka, who contacted me a few days ago about the old CMake script I wrote in August, I have updated my fork and made it work with the current version: https://sourceforge.net/u/vobject/opentomb/
If you are interested, I can create a pull request to get official Linux support into the main repository
Building on Linux is very easy, a 3-lines instruction is written at the top of the CMake script. Hacking is equally easy: just open the CMakeLists.txt in QtCreator and follow its wizard.


Best regards
vobject is offline   Reply With Quote
Old 25-11-13, 09:39   #398
Titak
Moderator
 
Titak's Avatar
 
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 32,189
Default

Welcome to this forum, vobject!
__________________
If it walks like a duck and if it quacks like a duck, it is a duck.
Titak is offline   Reply With Quote
Old 01-12-13, 10:56   #399
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 951
Default

Hi, vobject! Thanks for your contributions to project! I have added you and pmatulka to developer list on the first page!

@A_De: I have successfully launched OpenTomb in VMWare on WinXP SP3, no artifacts. So possibly it is a driver issue...

Now, for the latest news. Lately, me and TeslaRus have been fixing audio engine all around (primarily to get rid of nasty clicks on sample play/replay/stop, but still no luck). Latest addition is support for TR3-5 various footstep sounds and reverb overrides for TR1 and TR2 (still, I believe it's better to do it with external script later).

Now we also finally have correct floordata parser which wanders through ALL TR1-5 trigger functions correctly. Surprisingly, leaked TR5 SDK came in handy again, as - you probably didn't know - TR5 has 4 extra types of triggers: skeleton, crawl, climb and tightrope.

Next step is making ladders and monkeyswing work - it will complete basic movement codebase, then I hope we'll begin to fill the world with actual working movables.
Lwmte is offline   Reply With Quote
Old 02-12-13, 00:10   #400
vobject
Hobbyist
 
vobject's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 40
Default

Quote:
Originally Posted by Lwmte View Post
Hi, vobject! Thanks for your contributions to project! I have added you and pmatulka to developer list on the first page!
Thanks Lwmte, that is very generous

I have merged the upstream version with my changes and created a pull request on sourceforge. Since you already integrated my previous suggestions in the main repo, the only thing that the pull request will add is the CMakeLists.txt into the main source folder.

The script works with the current version but it might need adjustments from time to time whenever the project's folder structure changes.


Somewhat off-topic:

What do you guys think about a Coop mode in opentomb



I wanted to suggest the idea of some sort of cooperative mode. It might be cool and maybe even not too hard to implement (as long as it's offline).

But to be clear: I am not working on this, nor have I plans to. This is a little experiment I hacked together while browsing the code. It adds and animates two Laras to the scene, not much more
vobject is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 02:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.