Page 1 of 1

Runtime problems

Posted: Sun Jul 25, 2004 9:27 am
by Endar
I'm having problems when trying to run something that loads up a bsp map.

I've only tried it with the one distributed with irrlicht, and that won't load up.

I have copied the code directly from the quake map tutorial, and am using the original dll, and it won't work......it seems to have a problem during the call of "smgr->drawAll()" in the while loop.

When I try to run it within VC++, it gives an error "instruction at 0x1004f3aa referenced memory at 0xffffffff. The memory could not be read." that kind of thing, and when I run it out of VC++ (manually clicking on exe file) it gives the error:

"The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

Ideas?? Because things could kind of go down without being able to load bsps.

Posted: Mon Jul 26, 2004 10:53 am
by Endar
Hey guys, I really do need some help with this, because its gotten to the point where no irrlicht stuff (haven't tried non-irrlicht stuff) I compile doesn't work.

HELP

Posted: Mon Jul 26, 2004 11:14 am
by bal
I had this error too when the path to the bsp/pk3 was not right. So I'd advice you to check it.

Posted: Mon Jul 26, 2004 11:25 am
by buezi
Hello,
The calling convention error is also possible when you use a multithreaded library or dll in a single threaded projects in your vc++ (or vice versa?). You should make sure what kind of code you are generating. For a simple irrlicht project single threaded should work (it depends on your needs).
You can check this in "code generation" in the c/c++ folder within the project settings.
cheers buezi

Posted: Mon Jul 26, 2004 2:47 pm
by Endar
Okay, I've checked and it seems that the irrlicht dll is multithreaded and the irrlicht things I'm doing are single threaded.

So, should I change and make my irrlicht "projects" multithreaded, even though they are small (rarely over 200-300 lines of code) ??

Posted: Tue Jul 27, 2004 7:16 am
by Endar
I've changed and recompiled one of my projects as single-threaded and multi-threaded and it didn't work at all.

Lets just make absolutely sure that the problem isn't in the code:

Code: Select all

int main()
{
   IrrlichtDevice* device = createDevice(video::EDT_DIRECTX8,
core::dimension2d<s32>(640,480), 16);
   video::IVideoDriver* driver = device->getVideoDriver();
   scene::ISceneManager* smgr = device->getSceneManager();

   device->getFileSystem()->addZipFileArchive("map-20kdm2.pk3");
    scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");

    scene::ISceneNode* node = 0;
    if(mesh)
    	node = smgr->addOctTreeSceneNode(mesh->getMesh(0) );
    if(node)
    	node->setPosition(core::vector3df(-1300, -144, -1249) );
    smgr->addCameraSceneNodeFPS();

    device->getCursorControl()->setVisible(false);

    int lastFPS = -1;

    while( device->run() ){
		driver->beginScene(true, true, video::SColor(0,100,100,100) );
		smgr->drawAll();
		driver->endScene();

		int fps = driver->getFPS();

		if( lastFPS != fps ){
			wchar_t tmp[1024];
			swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d",
				fps, driver->getPrimitiveCountDrawn() );

			device->setWindowCaption(tmp);
			lastFPS = fps;
		}
    }
    device->drop();
return 0;
}
That's the code (without the #include, #pragma, etc, at the top). So, can anyone see anything wrong with the code? (probably not because it worked before, but now I'm getting a little desperate because I can't run anything I've compiled with irrlicht)

Posted: Tue Jul 27, 2004 8:08 am
by Endar
Okay I believe I have found the problem.

I was mixing and matching dll and lib files.

Hit me, really, right on the head....no its okay, I'm not actually using it! :D

Thanks for putting up with my complete stupidity guys. :oops: