Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('feria.lsr', 'rb')
- x = f.read()
- f.close()
- # Position of the strings data segment
- pos = x[0x2c] | x[0x2d]<<8 | x[0x2e]<<16 | x[0x2f]<<24
- # Length of this segment (excluding next 32 bits)
- l = x[pos] | x[pos+1]<<8 | x[pos+2]<<16 | x[pos+3]<<24
- # Number of 0-separated strings that follow this number
- num = x[pos+4] | x[pos+5]<<8 | x[pos+6]<<16 | x[pos+7]<<24
- s = x[pos+8:pos+8+l].split(b'\0')[:-1]
- if len(s) != num:
- print("Warning: expected %d strings, got %d!" % (num, len(s)))
- f = open('feria.txt', 'wb')
- f.write('\r\n|\r\n'.join([i.decode('shift-jis') for i in s]).encode('utf-8'))
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement