Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Problem with InputManager::createInputSystem  (Read 1514 times)

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Problem with InputManager::createInputSystem
« on: October 12, 2009, 09:54:00 AM »

Hello.

InputManager::createInputSystem() is not working for me. I don't know if it's an OIS issue or if something is wrong with the handle that i recieve from OGRE. I have read several threads in this forum section, but i haven't found a solution that has worked for me. Here is my original thread on OGRE's forum: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=53029.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Problem with InputManager::createInputSystem
« Reply #1 on: October 12, 2009, 06:08:31 PM »

What OS are you using and what exactly is your error? Are you getting a segfault and/or uninitialized variable exception? Make sure you are executing your code in the correct order:
1. Create Ogre Window
2. Create OIS from that Window Handle
3. Then use create InputManager instance.
Logged

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Re: Problem with InputManager::createInputSystem
« Reply #2 on: October 13, 2009, 03:00:45 PM »

What OS are you using and what exactly is your error? Are you getting a segfault and/or uninitialized variable exception? Make sure you are executing your code in the correct order:
1. Create Ogre Window
2. Create OIS from that Window Handle
3. Then use create InputManager instance.
Yes that's what i'm doing. The error is "Access violation" which means segfault IIRC. I have tested this on Windows XP.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Problem with InputManager::createInputSystem
« Reply #3 on: October 13, 2009, 07:42:57 PM »

Well, access violation is usually very easy to solve. Either the pointer is invalid (points to garbage), is null/0, or is overwritten by something else. You should examine the pointer/instance from when you create it to when you use it.

Make sure you are not having issues with different builds of libs (ie using debug libs with release builds), are not passing in an invalid 'this' pointer to your method (ie you called (null)->SomeMethod()) or have other memory issues - buffer overruns, double frees, etc.

Logged

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Re: Problem with InputManager::createInputSystem
« Reply #4 on: October 14, 2009, 05:41:19 AM »

Well, access violation is usually very easy to solve. Either the pointer is invalid (points to garbage), is null/0, or is overwritten by something else. You should examine the pointer/instance from when you create it to when you use it.

Make sure you are not having issues with different builds of libs (ie using debug libs with release builds), are not passing in an invalid 'this' pointer to your method (ie you called (null)->SomeMethod()) or have other memory issues - buffer overruns, double frees, etc.


There are some additional details in the link to the post at OGRE's forum. Do you think it's better to post it here directly?

I have done everything in that order, and i'm using debug builds for everything. Running it in release mode with release builds results in the same behaviour.

I know what causes the segfault, and i have made sure several times that the pointer does not point to NULL after the call to OIS::InputManager::createInputSystem, and the crash occurs whenever i dereference the pointer. The handle variable changes value after i pass it to Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()->getCustomAttribute("WINDOW", &windowHnd) so that seems to work as well.
« Last Edit: October 14, 2009, 06:11:24 AM by EXetoC »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Problem with InputManager::createInputSystem
« Reply #5 on: October 14, 2009, 07:35:19 PM »

If you could recreate a sample app that shows the problem, that I could easily build (VC8 / VC9), I could take a look. I'm not really seeing anything obvious here.
Logged

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Re: Problem with InputManager::createInputSystem
« Reply #6 on: October 16, 2009, 05:58:21 PM »

I would, but something strange has happened to Visual C++ and i haven't been able to fix it. Reinstalling it doesn't work beacuse the installer gives me an error. Atleast the application does fine at runtime in Linux. No segfaults or anything.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Problem with InputManager::createInputSystem
« Reply #7 on: October 17, 2009, 09:50:50 AM »

What version of VC? I haven't really seen too many install/uninstall issues... though, I rarely try to uninstall it (usually only ever happens if I reinstall the OS). I can't imagine VC being at fault for a random segfault, but suppose it is possible.
Logged

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Re: Problem with InputManager::createInputSystem
« Reply #8 on: October 17, 2009, 12:24:25 PM »

I should've been more specific. I was referring to the fact that i can't create new projects in order to create a minimal test case. I may've removed one component too much from Windows using XPlite. I'm using version 9.0.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Problem with InputManager::createInputSystem
« Reply #9 on: October 17, 2009, 02:46:02 PM »

Well, you could modify the project you are having problems with to reduce its size. Also, may help you find the problem.
Logged

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Re: Problem with InputManager::createInputSystem
« Reply #10 on: December 01, 2009, 10:28:37 AM »

Well, you could modify the project you are having problems with to reduce its size. Also, may help you find the problem.
It's minimal enough already, but I've made a test case anyway. I haven't created a msvc project yet though (setting up a development environment in Windows is tedious). Does anyone feel like testing it in msvc 9.0? If so, download and extract this http://data.fuskbugg.se/skalman01/test.zip and move RenderSystem_GL.dll to the application root. You can also use RenderSystem_GL_d.dll if you want to try the debug dll or specify another path for the plugins by changing plugins.cfg accordingly.
Logged

EXetoC

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 7
    • View Profile
Re: Problem with InputManager::createInputSystem
« Reply #11 on: December 04, 2009, 02:50:42 PM »

It's working now. I haven't changed anything of relevance since the first time i got a runtime error, and i think i stumbled upon the same issue in my previous project. Maybe i used object files for another version of VC or something. Does anyone know anything about this? Assuming, of course, that i personally haven't done anything wrong.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Problem with InputManager::createInputSystem
« Reply #12 on: December 06, 2009, 06:02:38 PM »

Well, it could be something as simple as a VCSP1 update (from a couple months back) vs libs built without the update.
Logged