Jump to content
Eternal Lands Official Forums
Zep

Cal3D

Recommended Posts

Did it work?

I have two linker errors left.

../Dev-Cpp/lib/cal3d.a(loader.o)(.data$_ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE+0x1c):loader.cpp: undefined reference to `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::seekpos(std::fpos<mbstate_t>, std::_Ios_Openmode)'
../Dev-Cpp/lib/cal3d.a(loader.o)(.data$_ZTVSt13basic_filebufIcSt11char_traitsIcEE+0x1c):loader.cpp: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::seekpos(std::fpos<mbstate_t>, std::_Ios_Openmode)'

Share this post


Link to post
Share on other sites
Did it work?

I have two linker errors left.

../Dev-Cpp/lib/cal3d.a(loader.o)(.data$_ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE+0x1c):loader.cpp: undefined reference to `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::seekpos(std::fpos<mbstate_t>, std::_Ios_Openmode)'
../Dev-Cpp/lib/cal3d.a(loader.o)(.data$_ZTVSt13basic_filebufIcSt11char_traitsIcEE+0x1c):loader.cpp: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::seekpos(std::fpos<mbstate_t>, std::_Ios_Openmode)'

177760[/snapback]

It's working great! Post to follow on my edit to platform.h for cal3d to compile under dev-cpp as a dll

Share this post


Link to post
Share on other sites
It's working great! Post to follow on my edit to platform.h for cal3d to compile under dev-cpp as a dll

177762[/snapback]

In cal3d, the file platform.h at line 32, I changed it ti

#if (defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) ) || defined(__GNUWIN32__)

To always allow creating the DLL exports id DLL is desired. From my checking, that is the only thing I changed in cal3d to fet it to compile & link properly.

Share this post


Link to post
Share on other sites

I don't understand. You will need to make a lib file (.a), not a DLL. the DLL is for runtime, I can't even link it!

Share this post


Link to post
Share on other sites

I can get cal3d to compile (I use visual studios)... that's easy enough. takes some modifications to ELC tog et that to compile, and then it still dun run right. maybe someone can spot my mistake

 

okay, all changes from CVS:

 

I copied the sources from cal3d into a dir called cal3d

 

commented out print_sound_objects() in gamewin.c (only a problem in debug, but it won't compile at all otherwise)

 

mkeysort.c: visual studios chucked a fruity sbout the inline int min. removing the inline part makes it compile, but I kinda worry about this

 

global.h: the __inline def for VC

 

 

 

at this stage, trying to compile will come up with a number of "function already defined in cal3d_wrapper.obj" results... if I #ifdef comment those out from cal3d_wrapper.cpp (leaving 5) then it builds.

so then I can try to run it, and I get the following:

"Unhandled exception at 0x05e58384 in elc-d.exe: 0xC0000005: Access violation reading location 0x00000024."

VC gives the following backtrace:

  cal3d.dll!05e58384()  
>	elc-d.exe!CalCoreSkeleton_Scale(CalCoreSkeleton * self=0x00000000, float factor=1.0000000)  Line 534 + 0xf
 elc-d.exe!parse_actor_script(_xmlNode * cfg=0x0ee77fc0)  Line 1954 + 0x1c  	elc-d.exe!parse_actor_defs(_xmlNode * node=0x0ee6aef0)  Line 1970 + 0x9
 elc-d.exe!parse_actor_defs(_xmlNode * node=0x0ee6c878)  Line 1976 + 0xc
 elc-d.exe!read_actor_defs(const char * dir=0x0012fac4, const char * index=0x004f08e8)  Line 2008 + 0x9
 elc-d.exe!init_actor_defs()  Line 2029 + 0x10
 elc-d.exe!init_stuff()  Line 522
 elc-d.exe!Main(int argc=3, char * * argv=0x0ed55ac0)  Line 147
 elc-d.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * hPrev=0x00000000, char * lpCmd=0x00141f0b, int nShow=1)  Line 203 + 0xd
 elc-d.exe!WinMainCRTStartup()  Line 390 + 0x39
 kernel32.dll!7c816d4f()  
 ntdll.dll!7c915b4f()  
 kernel32.dll!7c8399f3()  

and points to line 534 of cal3d_wrapper.cpp (remember the #ifdefs will put this slightly off): in function `CalCoreSkeleton_Scale', the command `self->scale(factor);'

trying to continue doesn't go forwards, it goes back to that same error again. same numbers in the error message too.

 

I've tried this with several versions of cal3d.dll (one I made, one that was in 1.0.2test2.zip, one that was in cal3d' download of binary viewers). no help :rolleyes:

 

anyone know what I've done wrong?

Share this post


Link to post
Share on other sites

You should NOT change cal3d_wrapper.{cpp,h}

Share this post


Link to post
Share on other sites
You should NOT change cal3d_wrapper.{cpp,h}

177802[/snapback]

well, leaving it alone I get a lot of entries similar to the following snippets (trimmed it, there's many dozen lines. all trimmed are just other function name versions of lines below anyway)

elc warning LNK4049: locally defined symbol _CalCoreAnimation_Scale imported
elc error LNK2005: _CalModel_Update already defined in cal3d_wrapper.obj
elc warning LNK4217: locally defined symbol _CalMixer_RemoveAction imported in function _cal_actor_set_random_idle
elc warning LNK4049: locally defined symbol _CalMixer_RemoveAction imported
elc warning LNK4217: locally defined symbol _CalCoreAnimation_Scale imported in function _cal_load_idle
elc fatal error LNK1169: one or more multiply defined symbols found

 

how else to attack the problem?

Edited by ttlanhil

Share this post


Link to post
Share on other sites

Ugh, this is getting very ugly... No idea how to fix that problem, it seems that the libraries created by cal3d are different from one person to another.

Share this post


Link to post
Share on other sites
I don't understand. You will need to make a lib file (.a), not a DLL. the DLL is for runtime, I can't even link it!

177769[/snapback]

When you make it as a dll, you get a lib (.a) and the .dll. the .a file is tiny and is what you link in. The .dll is where the real work is and has to be found at run time.

Share this post


Link to post
Share on other sites

I'll try to explain a bit more what I think is happening, in case it points to a problem/bad asumption

the problem is that there's two projects using cal3d_wrapper.cpp. the one in ELC has had about 5 functions added to what was copied from cal3d itself.

so the cal3d lib has all except those extra 5 already, and when ELC tries to link against cal3d.lib, it finds that there are function with the same name both in the cal3d.lib and the cal3d_wrapper.obj (which was just made)

 

this is why I tried trimming out all of the functions that are done twice, and while this does get it to compile, it won't run. calls to cal3d.dll result in an error (I'm asuming what's in cal3d.dll should be similar in intent to cal3d.lib... they're made at the same time)

removing cal3d_wrapper.cpp from the cal3d library project gets the same results.

 

also, I'm pretty sure that the dll is not the problem, at least not alone, since using copies from other source results the same.

 

does it sound like my logic is skewiff, and I've taken a wrong path? or does the fact that both have the same file mean I got a wrong version or tried to use it the wrong way?

 

anyone else got cal3d up and running using VC++?

Share this post


Link to post
Share on other sites

ttlanhil: cal3d_wrapper.cpp are NOT to be built with ELC. This is what you should do:

 

1)In Cal3D, substitute the cal3d_Wrapper.cpp and cal3d_wrapper.h files with the ones I gave you.

2)Compile Cal3d, getting cal3d.dll and cal3d.lib

3)Compile ELC(without including cal3d_wrapper.cpp in the build) and link with the cal3d.lib you just created. You'll get the .exe

4)Put the cal3d.dll you created in the same folder as the .exe, and run the .exe. It should work.

Share this post


Link to post
Share on other sites

you really should try to make sure that no changes are needed to the cal3d library. How about a wrapper that only has your custom functions?

 

As it is, I got it working under Dev-cpp with the wrapper in both and linking in the cal3d as a dll without any problems now. Only change I made in cal3d was in platform.h to help it build the .dll

Share this post


Link to post
Share on other sites
ttlanhil: cal3d_wrapper.cpp are NOT to be built with ELC. This is what you should do:

 

1)In Cal3D, substitute the cal3d_Wrapper.cpp and cal3d_wrapper.h files with the ones I gave you.

2)Compile Cal3d, getting cal3d.dll and cal3d.lib

3)Compile ELC(without including cal3d_wrapper.cpp in the build) and link with the cal3d.lib you just created. You'll get the .exe

4)Put the cal3d.dll you created in the same folder as the .exe, and run the .exe. It should work.

177837[/snapback]

it all works up until trying to run the client. then if I'm debugging with VS I get the error box saying "Unhandled exception at 0x05e41cd4 in elc-d.exe: 0xC0000005: Access violation reading location 0x00000020."

 

it points at line 1954 of actor_scripts.c, the line saying "CalCoreSkeleton_Scale(skel,act->skel_scale);"

 

and backtrace as follows

 cal3d.dll!05e41cd4()  
 cal3d.dll!05e3878e()  
>	elc-d.exe!parse_actor_script(_xmlNode * cfg=0x0ed67bc8)  Line 1954 + 0x1c	
 elc-d.exe!parse_actor_defs(_xmlNode * node=0x0ed5ab98)  Line 1970 + 0x9	
 elc-d.exe!parse_actor_defs(_xmlNode * node=0x0ed5c498)  Line 1976 + 0xc	
 elc-d.exe!read_actor_defs(const char * dir=0x0012fac4, const char * index=0x004e68e8)  Line 2008 + 0x9	
 elc-d.exe!init_actor_defs()  Line 2029 + 0x10	
 elc-d.exe!init_stuff()  Line 522	
 elc-d.exe!Main(int argc=3, char * * argv=0x0ed42520)  Line 147	
 elc-d.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * hPrev=0x00000000, char * lpCmd=0x00141f0b, int nShow=1)  Line 203 + 0xd	
 elc-d.exe!WinMainCRTStartup()  Line 390 + 0x39	
 kernel32.dll!7c816d4f()  
 ntdll.dll!7c915b4f()  
 kernel32.dll!7c8399f3()  

 

attempting to continue either loops or the client normally goes through that code many times on startup

Share this post


Link to post
Share on other sites

ttlanhil: That problem doesn't have to do with compiling correctly, the program is failing to find and load a skeleton file. Do you have setup all the files correctly(actor_defs,Meshes,Animations,Skeletons)...

 

Ok, it seems I've managed to sort things out here, and I'll take Learner's advice, don't mess with Cal3D source, just build a mini lib that has only the extra functions I need. I advice you all to stop trying for a while until I fix all this, and I'll post my progress soon.

Edited by mikeman

Share this post


Link to post
Share on other sites

FYI - got it compiling on VS (2k3 version) wihtout modifications to any files (other than the project files to add linker libs etc.)

 

How I did it:

 

Start with pre-cal3d solution file so I woun't go in to setting up SDL/OpenGL etc. libs....

 

1) I downloaded cal3d from here -> http://prdownloads.sourceforge.net/cal3d/c...tar.gz?download

 

2) extracted somewhere / run the included dsw file / upgrade it to VS 2K3 format (and delete all the non-existing projects that are in it but not included in the download) save it / close

 

3) take cal3d_wrapper.cpp and cal3d_wrapper.h from the client cvs and replace the 2 files in cal3d ditribution wiht them (these are in \cal3d-0.10.0\src\cal3d)

 

4) open the solution file you created in 2) and build it wihtout any changes - you get 3 files under \cal3d-0.10.0\bin\release (ofc if you building debug you get it under debug....) - cal3d.dll, cal3d.lib, cal3d.exp

 

5) copy cal3d.dll to your EL folder

 

6) open the EL Client solution file and go to elc project properties -> C++ / General options and add C:\Projects\ELClient\SDK\cal3d-0.10.0\src (or where ever your cal3d is) to additional include directories, next go to linker -> general options and add C:\Projects\ELClient\SDK\cal3d-0.10.0\bin\release to there, next in linker-> input -> additional dependencies add cal3d.lib, apply / ok

 

7) try to build - at this point I tried building the client and got one more linker error that I traced down to gluProject in lights.c -> go back to project properies linker-> input -> additional dependencies add Glu32.lib (I'm listing this separatly since it is possible your OpenGL files might have this function and you might not have to link against Glu32.lib at all, glu32.lib is probably part of the MS platform SDK so youm ight have to install that if you don;t have it)

 

8) get the package with meshes/textures etc. Wytter posted ( http://el.tfm.ro/update_1.0.2-test2.tar.bz2) and put that in to yuor EL client directory (back it up first...!), put the compiled exe in to it

 

 

run it! That's it...seems to work evne tho my average FPS seems to have dropped by 8-10 (70 -> 60) and IP has no snow /server thinks its a differnt map so cna get a bit werid there...

~C

Edited by Cajs

Share this post


Link to post
Share on other sites
ttlanhil: That problem doesn't have to do with compiling correctly, the program is failing to find and load a skeleton file. Do you have setup all the files correctly(actor_defs,Meshes,Animations,Skeletons)...

177853[/snapback]

well, I think so, I unpacked http://el.tfm.ro/update_1.0.2-test2.tar.bz2 into my EL directory. though maybe there's something that wasn't in there I need.

is there any chance that it's an end of line issue (since .bz2 is usually made on *nix and I'm in windows)?

 

erm... d'oh, error_log.txt of course. I put a copy http://ttlanhil.tripod.com/EL/win_cal_err_log.txt here. there seems to be some stuff missing, though I don't think they're skeletons

 

IP has no snow /server thinks its a differnt map so cna get  a bit werid there...

~C

177858[/snapback]

it is a different map. the one for 1.0.2 as in another thread. go back to the old copy if you want to be able to use it for now 8^)

Share this post


Link to post
Share on other sites

My current executable and dll for P3 and higher under windows is available at http://www.other-life.com/downloads/elc-cal3d.zip.

 

One concern I have is whether or not my other development dlls (like SDL and ogg) are compatible with everyone elses.

 

A developer file has been uploaded to http://www.other-life.com/downloads/elc-cal3d-dev.zip which will contain the .a and .dll bundled. My cal3d does NOT have the custom cal3d_wrapper in it, just the normal, so you still need to compile in the custom cal3d_wrapper.

Share this post


Link to post
Share on other sites

Guys, stop trying with those custom cal3d_wrap stuff, I'm taking them out as we speak. I've managed to get a clean build of Cal3D as it is(no tweaking from my part) with all symbols exported, and compile ELC with just those extra functions missing. I'm writing a cal3d_wrap_ext.cpp to include them, and I'm done. I'll post again soon.

Share this post


Link to post
Share on other sites
Guys, stop trying with those custom cal3d_wrap stuff, I'm taking them out as we speak. I've managed to get a clean build of Cal3D as it is(no tweaking from my part) with all symbols exported, and compile ELC with just those extra functions missing. I'm writing a cal3d_wrap_ext.cpp to include them, and I'm done. I'll post again soon.

177878[/snapback]

Just use the same file name you did before, no need to use a new name. Then we just include that file into ELC.

Share this post


Link to post
Share on other sites

Hm, I actually named them "cal3d_wrapper_custom.h" and "cal3d_wrapper.custom.cpp" so it won't be confused in any way with the ones that Cal3D distribution has.

Share this post


Link to post
Share on other sites

We could also just add a note on top of the cal3d_wrapper.cpp saying that it's limited to the ELC project, and only holds a few more necissary functions.

 

On another note, I noticed that we could set the LOD for each actor... I was thinking about setting the LOD to be lower on low-end computers (using poor_man). Will that be feasible?

Share this post


Link to post
Share on other sites

:P:angry:

 

The thing DOES NOT want to compile with Dev-C. I don't know what else to do. I thought I had compile Cal3D correctly, but I looked at the .def file and there are things missing(like "CalMixer::" functions) for no reason at all. Does anyone succeded in this?

Edited by mikeman

Share this post


Link to post
Share on other sites
:P:angry:

 

The thing DOES NOT want to compile with Dev-C. I don't know what else to do. I thought I had compile Cal3D correctly, but I looked at the .def file and there are things missing(like "CalMixer::" functions) for no reason at all. Does anyone succeded in this? I can't think what else to do.

177925[/snapback]

Check my other posts, I have it compiled under dev-cpp and cal3d as a dll with a one line patch to platform.h in cal3d. I also posted the .a and .dll for people.

Share this post


Link to post
Share on other sites
Check my other posts, I have it compiled under dev-cpp and cal3d as a dll with a one line patch to platform.h in cal3d. I also posted the .a and .dll for people.

177926[/snapback]

 

No, when I do that patch it doesn't export anything. Did you set any parameters?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×