Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: [1] 2

Author Topic: some keys like ^ and ¨ make OIS crash in Ogre3D when using the static lib in mac  (Read 2222 times)

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

Hi

We recently released a game, and someone on the Ogre forums said the game crashed when he pressed the ¨ key on his keyboard.
( http://www.ogre3d.org/forums/viewtopic.php?f=11&t=49671#p339537 )

I was able to reproduce this and found some other keys which made the game crash: ¨, ^ and `. (Belgian azerty keyboard)

According to the callstack it crashes somewhere in MacKeyboard::_keyDownCallback.

I just tried rebuilding ois and tried the libOIS.a and the OIS.framework version, just to try something out, and apparantly only the libOIS.a version crashes, the framework version just acts normal.

Any idea what causes this?

I'd rather use the static version in my game instead of the framework version ...


Btw: I'm building the OIS source XCode 2.2 version in XCode 3.1.2
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

I've actually had more luck using the static lib than the framework bundle. Can you post the call stack you got?
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

Here you go (but I don't think you'll get any wiser by this...):

Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

Unfortunately, I haven't seen this - and my macbook is currently down (stupid broken magsafe cord). Can you identify which particular line is crashing inside that function? Are you running with multiple threads? What text mode (ascii - default - or none?) are you running? I can't think of any significant difference between DLL and static lib that could account for this issue.
« Last Edit: May 09, 2009, 11:59:44 AM by pjcast »
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

No, I can't identify on what line it crashes, as I use OIS as a library.

I'm doing nothing fancy, everything default, I don't use threads for OIS, and text mode, i guess it's just default, as I don't set it.


Btw: I just discovered that all the Ogre samples also crash when pressing such a key.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

Would be great if you could try the other text modes setTextTranslation with Ascii and Off to see if either of these still presents the crash. I'm surprised that xcode won't let you step into that function with some breakpoints.
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

I just tried all three textTranslations and none off them help, they all crash.

And the reason why I can't see on what line it crashes, is because I don't have the OIS source code in my project. I just link against the static lib.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

You be great if you could grab the latest source (v1_2 branch). it is pretty trivial to build - no external dependencies on OSX at all - only OSX frameworks used. My best guess is a key code lookup table is probably missing some defines: keyConversion map, but that wouldn't really explain why it works as a bundle.
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

I am already using the latest OIS version: 1.2
Or should I get the latest version from cvs?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

The latest branch has some more changes/fixes. I don't think this particular issue has been addressed, but at least once you have the source you should be able to figure out which line is crashing when used from a static library.
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

Finally I managed to get the line where it crashes, that took me a while ...
This is using the latest source code from cvs.

Pay attention to the values of stringsize and i.

The crash is from pressing the "^" key btw, no idea why it says KC_LBRACKET ...



Edit: It seems like stringsize is 0 and you are then doing -- on it, causing it to overflow.
I can fix the crash by adding the line: if(stringsize == 0) return; but I don't know if that is a good fix?
« Last Edit: May 16, 2009, 05:41:27 AM by hostep »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

hmm, might be a good idea to add that check. Or maybe make it a signed number so it can go below 0. Anyway, i don't really know what the consequence of that is... suppose there is no character associated with that key? if you exit early you would probably not get the event at all. But, suppose better than crashing for now.
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

I noticed it's only the very first time you press such a key that the stringsize is 0, the next time you press it, it's 2.

So it would only ignore the event the very first time you press such a key, which is quit logical, as it's a special key, because it's ment to go on top of another key, like ê, ü or è, or something like that.
Logged

hostep

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 17
    • View Profile
    • Black Pillow

Pff, I don't get it anymore, if I build OIS inside my own project en link against the resulting libOIS.a file, it doesn't crash.
But if I build the OIS project using the OIS.xcodeproj project which came through cvs, and use the resulting libOIS.a file from that project, it crashes again when pressing one of those special keys :(
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com

I wonder if it is some kind of compile setting. For instance, MSVC has unicode compile flags that can affect builds. For the xcode project there may be something similar. Or maybe gcc version, of framework version, PPC vs Intel, etc.
Logged
Pages: [1] 2