From 7b3e2e4bf793466a351510c7fbbd08234e93bb0e Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Thu, 21 Sep 2023 11:16:29 -0500 Subject: 1.20.2 (#99) * add configuration state * start updating to 23w31a * implement a bit more of 23w31a * chunk batching * start adding configuration state * ioasfhjgsd * almost works * configuration state mostly implemented * handle other packets in configuration state and fix keepalive * cleanup, fix warnings * 23w32a * fix some doctests * 23w33a * 23w35a * 1.20.2-pre2 * fix system conflicts * 1.20.2-pre4 * make tests compile * tests pass * 1.20.2-rc2 * 1.20.2 * Revert "1.20.2" This reverts commit dd152fd265332ead333c919e585ded6d609d7468. * didn't mean to commit that code --------- Co-authored-by: mat --- codegen/lib/code/packet.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'codegen/lib/code/packet.py') diff --git a/codegen/lib/code/packet.py b/codegen/lib/code/packet.py index 58e50136..b34d3455 100755 --- a/codegen/lib/code/packet.py +++ b/codegen/lib/code/packet.py @@ -237,12 +237,16 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p field_type_rs = None field_comment = None - print('instruction', instruction) + print('instruction', instruction, next_instruction, next_next_instruction) # iterators - if instruction['operation'] == 'write' and instruction['field'].endswith('.size()') and next_instruction and next_instruction['type'] == 'Iterator' and next_next_instruction and next_next_instruction['operation'] == 'loop': - obfuscated_field_name = instruction['field'].split('.')[ - 0] + if instruction['operation'] == 'write'\ + and instruction['field'].endswith('.size()')\ + and next_instruction\ + and next_instruction['type'] == 'Iterator'\ + and next_next_instruction\ + and next_next_instruction['operation'] == 'loop': + obfuscated_field_name = instruction['field'].split('.')[0] field_name = mappings.get_field( obfuscated_class_name, obfuscated_field_name) @@ -303,6 +307,11 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p condition_types_rs = [] for condition_instruction in condition_instructions: + print('condition_instruction', condition_instruction) + if 'type' not in condition_instruction: + # weird type, maybe it's a loop or something + condition_types_rs.append('todo!("weird type, maybe it\'s a loop or something")') + continue condition_type_rs, is_var, this_uses, this_extra_code = burger_type_to_rust_type( condition_instruction['type'], None, condition_instruction, mappings, obfuscated_class_name) condition_types_rs.append(condition_type_rs) @@ -381,8 +390,11 @@ def burger_field_to_type(field, mappings: Mappings, obfuscated_class_name: str, if obfuscated_first in known_variable_types: first_type = known_variable_types[obfuscated_first] else: - first_type = mappings.get_field_type( - obfuscated_class_name, obfuscated_first) + try: + first_type = mappings.get_field_type( + obfuscated_class_name, obfuscated_first) + except: + first_type = 'TODO' first_obfuscated_class_name: Optional[str] = mappings.get_class_from_deobfuscated_name( first_type) if first_obfuscated_class_name: -- cgit v1.2.3