Skip to content

Commit

Permalink
remove all hf lines (except bitfields)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickid2018 committed Jun 4, 2024
1 parent 265ca1b commit e1646e1
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 409 deletions.
44 changes: 34 additions & 10 deletions codegen_script/string_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,40 +54,64 @@


def add_default_fields():
hf_defines.append(f'hf_unknown_int8_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_int8_{edition}, " [int8]", "mc{edition}.unknown_int8", INT8, '
f'DEC)')
hf_defines.append(f'hf_unknown_uint8_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_uint8_{edition}, " [uint8]", "mc{edition}.unknown_uint8", UINT8, '
f'DEC)')
hf_defines.append(f'hf_unknown_int16_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_int16_{edition}, " [int16]", "mc{edition}.unknown_int16", INT16, '
f'DEC)')
hf_defines.append(f'hf_unknown_uint16_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_uint16_{edition}, " [uint16]", "mc{edition}.unknown_uint16", UINT16, '
f'DEC)')
hf_defines.append(f'hf_unknown_int_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_int_{edition}, "Unresolved Integer", "mc{edition}.unknown_int", INT32, DEC)')
f'\t\tDEFINE_HF(hf_unknown_int_{edition}, " [int32]", "mc{edition}.unknown_int", INT32, DEC)')
hf_defines.append(f'hf_unknown_uint_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_uint_{edition}, "Unresolved Unsigned Integer", "mc{edition}.unknown_uint", '
f'\t\tDEFINE_HF(hf_unknown_uint_{edition}, " [uint32]", "mc{edition}.unknown_uint", '
f'UINT32, DEC)')
hf_defines.append(f'hf_unknown_varint_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_varint_{edition}, " [var int]", "mc{edition}.unknown_varint", '
f'UINT32, DEC)')
hf_defines.append(f'hf_unknown_int64_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_int64_{edition}, "Unresolved Long Integer", "mc{edition}.unknown_int64", '
f'\t\tDEFINE_HF(hf_unknown_int64_{edition}, " [int64]", "mc{edition}.unknown_int64", '
f'INT64, DEC)')
hf_defines.append(f'hf_unknown_uint64_{edition}')
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_uint64_{edition}, "Unresolved Unsigned Long Integer", '
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_uint64_{edition}, " [uint64]", '
f'"mc{edition}.unknown_uint64", UINT64, DEC)')
hf_defines.append(f'hf_unknown_varlong_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_varlong_{edition}, " [var long]", "mc{edition}.unknown_varlong", '
f'UINT32, DEC)')
hf_defines.append(f'hf_unknown_float_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_float_{edition}, "Unresolved Float", "mc{edition}.unknown_float", FLOAT, '
f'\t\tDEFINE_HF(hf_unknown_float_{edition}, " [f32]", "mc{edition}.unknown_float", FLOAT, '
f'DEC)')
hf_defines.append(f'hf_unknown_double_{edition}')
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_double_{edition}, "Unresolved Double", "mc{edition}.unknown_double", '
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_double_{edition}, " [f64]", "mc{edition}.unknown_double", '
f'DOUBLE, DEC)')
hf_defines.append(f'hf_unknown_bytes_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_bytes_{edition}, "Unresolved Bytes", "mc{edition}.unknown_bytes", BYTES, '
f'\t\tDEFINE_HF(hf_unknown_bytes_{edition}, " [buffer]", "mc{edition}.unknown_bytes", BYTES, '
f'NONE)')
hf_defines.append(f'hf_unknown_string_{edition}')
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_string_{edition}, "Unresolved String", "mc{edition}.unknown_string", '
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_string_{edition}, " [string]", "mc{edition}.unknown_string", '
f'STRING, NONE)')
hf_defines.append(f'hf_unknown_boolean_{edition}')
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_boolean_{edition}, "Unresolved Boolean", "mc{edition}.unknown_boolean", '
hf_lines.append(f'\t\tDEFINE_HF(hf_unknown_boolean_{edition}, " [boolean]", "mc{edition}.unknown_boolean", '
f'BOOLEAN, NONE)')
hf_defines.append(f'hf_unknown_uuid_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_unknown_uuid_{edition}, "Unresolved UUID", "mc{edition}.unknown_uuid", GUID, NONE)')
f'\t\tDEFINE_HF(hf_unknown_uuid_{edition}, " [UUID]", "mc{edition}.unknown_uuid", GUID, NONE)')
hf_defines.append(f'hf_array_length_{edition}')
hf_lines.append(
f'\t\tDEFINE_HF(hf_array_length_{edition}, "Array Length", "mc{edition}.array_length", UINT32, DEC)')
Expand Down
6 changes: 6 additions & 0 deletions protocol_je/je_dissect.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ extern int hf_ping_time_je;
extern int hf_server_status_je;
extern int hf_legacy_slp_payload;

extern int hf_unknown_int8_je;
extern int hf_unknown_uint8_je;
extern int hf_unknown_int16_je;
extern int hf_unknown_uint16_je;
extern int hf_unknown_int_je;
extern int hf_unknown_uint_je;
extern int hf_unknown_int64_je;
Expand All @@ -38,6 +42,8 @@ extern int hf_unknown_string_je;
extern int hf_unknown_boolean_je;
extern int hf_unknown_uuid_je;
extern int hf_array_length_je;
extern int hf_unknown_varint_je;
extern int hf_unknown_varlong_je;

extern int ett_mcje;
extern int ett_je_proto;
Expand Down
9 changes: 6 additions & 3 deletions protocols/protocol_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#define FIELD_MAKE_TREE(name) \
gint make_tree_##name(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, extra_data *extra, protocol_field field, gint offset, gint remaining, data_recorder recorder, bool is_je)

#define SINGLE_LENGTH_FIELD_MAKE(name, len, func_add, func_parse, record) \
FIELD_MAKE_TREE(name) { \
#define SINGLE_LENGTH_FIELD_MAKE(id_name, hf, len, func_add, func_parse, record) \
FIELD_MAKE_TREE(id_name) { \
if (tree) \
func_add(tree, field->hf_index, tvb, offset, len, record(recorder, func_parse(tvb, offset))); \
proto_item_prepend_text( \
func_add(tree, hf, tvb, offset, len, record(recorder, func_parse(tvb, offset))), \
field->name \
); \
else \
record(recorder, func_parse(tvb, offset)); \
return len; \
Expand Down
Loading

0 comments on commit e1646e1

Please sign in to comment.