Last active
October 4, 2019 20:44
-
-
Save Andoryuuta/240e2b2ca8ae8688804f1907dfbd85ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import sys | |
with open('interface.plx', 'rb') as ifx: | |
version = struct.unpack('<I', ifx.read(4))[0] | |
if version != 1: | |
sys.exit(1) | |
ifx.read(4*3) # Read into the same variable and then ignored. | |
plasmaGraphicsSig = ifx.read(15) | |
if plasmaGraphicsSig != b'PlasmaGraphics\x00': | |
sys.exit(1) | |
str_count = struct.unpack('<I', ifx.read(4))[0] | |
for i in range(str_count): | |
str_size = struct.unpack('<I', ifx.read(4))[0] | |
if str_size > 512: | |
sys.exit(1) | |
str_data = ifx.read(str_size).decode('utf8').rstrip('\0') | |
str_id = struct.unpack('<I', ifx.read(4))[0] | |
print('Str:{0}, ID:{1}'.format(str_data, str_id)) | |
# The code uses these, but I've never seen the `unused_vec_entry_count` be != 0. | |
unused_vec_entry_count = struct.unpack('<I', ifx.read(4))[0] | |
for i in range(unused_vec_entry_count): | |
unk_entry = struct.unpack('<I', ifx.read(4))[0] | |
print('Unk entry:{}'.format(unk_entry)) | |
index_vec_count = struct.unpack('<I', ifx.read(4))[0] | |
if index_vec_count <= 0: | |
sys.exit(1) | |
for i in index_vec_count: | |
some_index = struct.unpack('<I', ifx.read(4))[0] | |
print("some_index: {}", some_index) | |
""" | |
if (this->ProductionUnusedVector.Length > 0 ) | |
{ | |
do | |
{ | |
pu_entry = this->ProductionUnusedVector_start[i_1]; | |
index_vec = this->SomeIndexVector; | |
function_idx = pu_entry - index_vec[pu_entry]; | |
argument = pu_entry + 1 - index_vec[pu_entry + 1]; | |
fnPtr = this->fnPtrArray[function_idx]; | |
if ( fnPtr ) | |
fnPtr(this, argument); | |
++i; | |
} | |
while ( i < this->ProductionUnusedVector.Length); | |
} | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment