Menu

Patch for fixing PL2Loader.py

John
2013-08-23
2013-11-24
  • John

    John - 2013-08-23

    Hi,
    PL2Loader.py is broken for me. The following fixes it:

    --- OPL2-r9-src/src/PL2Loader.py        2013-03-23      13:36:10.000000000 +0000
    +++ ../src/PL2Loader.py 2013-08-23 15:15:28.701753403 +0000
    @@ -124,7 +124,7 @@
                                    tmp = source.read(1)
                                    buffer[dstPos % 4096] = tmp
                                    destination[dstPos] = tmp
    
    -                               dstpos += 1
    +                               dstPos += 1
    
                            else: # elif mask & flag == 0:
                                    tmp =             int(struct.unpack('<B', source.read(1))[0])
    @@ -132,7 +132,7 @@
                                    offset = (((tmp2 & 0xF0) << 4 ) | tmp) + 18
                                    lenght = (tmp2 & 0x0F) + 3
    
    
    -                               while lenght > 0 and dstpos < dstlen:
    +                               while lenght > 0 and dstPos < dstLen:
                                            temp = buffer[offset % 4096] # remember that var name "tmp" has already been taken
                                            offset += 1
                                            buffer[dstPos % 4096] = temp
    

    (i.e. rename dstpos to dstPos and dstlen to dstLen. Please also consider fixing the spelling of "lenght" to "length")

    Also, please consider adding the following to main.py:

    --- OPL2-r9-src/main.py 2013-02-05 15:06:46.000000000 +0000
    +++ ../main.py  2013-08-22 22:48:47.332153433 +0000
    @@ -1,3 +1,4 @@
    +#!/usr/bin/python
     from panda3d.core import * # note that there is an older importing method: 'from pandac.PandaModules import *'
    
     import os
    

    (i.e. add #!/usr/bin/python to the top)

     

    Last edit: John 2013-08-23
  • ingen58

    ingen58 - 2013-11-24

    Weird, SF didn't notify me of a forum post. Saw this only now.

    Okay.
    I understand why I didn't notice those bugs. In Windows, the fast C version of the decompressor is used instead.

    BTW, If you're using Linux or Mac, consider helping us and compiling a pyd for those platforms as well.

    Also, if you'd like to help us out, we can try to make a TSB animation importer/exporter for Blender 2.6 together. I've tried several times with not much luck. The Blender 2.4 ones I've written work fine though. Blender 2.6 has an animation retargeting plugin, you can see how useful such plugins could be (people can port animations from other games, etc.) :)

     

    Last edit: ingen58 2013-11-24

Log in to post a comment.

MongoDB Logo MongoDB