Endianness in relation to a Java game (Minecraft) and PowerPC Macs.

Discussion in 'Mac Programming' started by Xandros, Dec 19, 2010.

  1. Xandros macrumors regular

    Joined:
    Sep 19, 2010
    #1
    Minecraft, a game built upon java, seems to suffer from a particularly game-breaking graphical and sound glitch on PowerPC Mac's. With respect to graphics the colours appear to be inverted, and the sound is distorted to the point where it is merely bursts of static. Descriptions of the problems and pictures can be found in this topic if you're interested in seeing it for yourself.

    The point of this topic is I'm wondering, with regards to Java developer's point of view, if this problem could be attributed to endianness. Currently several people have theorised the reason why Minecraft now experiences these problems only on PPC Mac's (the old original Minecraft "free" version does not suffer from the same problems), is because one way or another, Minecraft's been coded to automatically assume it is running on a Little-Endian system, like an x86 based computer such as, for instance, Intel Macs.

    And as a result, something or other is telling the graphics to display the wrong way round, causing them to become inverted (and apparently the sound is suffering from the same problem). Is this a feasible possibility? And many of the same people seem sure it is "easily" fixable by making sure Minecraft detects what platform it is running on to be sure of endianness. But I do wonder...
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    I don't know if this game might utilize some JNI to get to some C libraries, etc. but the JVM is big-endian everywhere. There might be some Java libs that are endian-specific, but it seems like you'd have to go out of your way to break this in plain Java.

    -Lee
     
  3. Xandros thread starter macrumors regular

    Joined:
    Sep 19, 2010
    #3
    Would it therefore be more likely that OpenGL is the root of the cause?
     
  4. Krevnik macrumors 68040

    Krevnik

    Joined:
    Sep 8, 2003
    #4
    Not if you are getting sound issues as well. Without delving into an install of the game, I'd not be terribly surprised if there is some endian nonsense going on from the description.

    If Minecraft is using LWJGL, which does include a sound engine, I'd bet that's the source of the problem.
     
  5. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    I have no idea. If the OpenGL interface is via JNI, and there's something like an unconditional byte swap in the C to swap to little-endian or the bytes are just laid out little-endian in java with no swap in the native code, this could be the issue.

    -Lee
     
  6. Xandros thread starter macrumors regular

    Joined:
    Sep 19, 2010
    #6
    Apparently, yes it does use LWJGL.
     

Share This Page