Commit graph

83 commits

Author SHA1 Message Date
ChillerDragon 5581929e76 feat: implement dict for game and sys messages 2024-06-16 11:22:01 +08:00
ChillerDragon 47b1459129 chore: remove duplicated space 2024-06-16 11:10:39 +08:00
ChillerDragon 5291c403a0 feat: implement dict on connless messages 2024-06-16 11:08:55 +08:00
ChillerDragon 76b0a89375 fix: conless -> connless 2024-06-02 09:58:37 +08:00
ChillerDragon e87e3a1da8 chore: add pyright to CI 2024-04-23 12:41:31 +08:00
ChillerDragon 87fe5f3990 feat: support uuid type in code generation 2024-04-19 10:37:32 +08:00
ChillerDragon 5ef77a77a2 chore: use only list and not List 2024-04-19 09:03:30 +08:00
ChillerDragon 4f845ea7ee fix!: 0.6.5 chunk header
This change added a version flag to chunk header

``ChunkHeader()`` no longer works! You now have to do
``ChunkHeader(version = '0.6')`` or ``ChunkHeader(version = '0.7')``

This fixes 0.6 chunk header packing.
It has a suddle difference to 0.7 and it is now packed correctly.

Also unpacking 0.6.5 chunk headers is fixed by reading the correct size.
2024-03-10 20:10:43 +08:00
ChillerDragon d997c0b990 chore: run ruff format . --fix 2024-02-26 12:59:19 +08:00
ChillerDragon ad4befbc20 fix: pcap example test 2024-02-23 12:51:12 +08:00
ChillerDragon 240c605ec3 feat: do not call ChunkHeader constructor if not needed
Also stays consistent with the code in the PacketHeader
7a367acef3
2024-02-17 13:22:31 +08:00
ChillerDragon 8e02807c59 fix: chunk header being cached across messages
closed #14
2024-02-17 13:09:14 +08:00
ChillerDragon f6955fbc5b fix: conventional commit release messages 2023-07-13 13:00:44 +02:00
ChillerDragon cd7ec74bba feat: mark all msg 0 as ddnet_uuid for now
This will change as soon as ddnet uuids are properly implemented
2023-07-13 12:38:54 +02:00
ChillerDragon 936786901a chore: make it obvious the examples are 0.7 only 2023-07-13 11:34:25 +02:00
ChillerDragon e06ce8366f feat!: snap items in sys/game messages
This commit is not about snapshots!

Generated the snap item classes for 0.6 and 0.7
And changed the type used for snap items from int to the snap class

This now allows to properly serialize and deserialize
messages such as sys.input
2023-06-09 13:06:24 +02:00
ChillerDragon 4e270eb213 fix: do not shellcheck python venv 2023-06-04 11:54:59 +02:00
ChillerDragon 4fd648025f feat!: proper support for optional fields
This sets message fields to `None` if they were not set.
And also does not pack fields that are set to `None`

BREAKING CHANGE: earlier to this commit the control close reason field
was set to an empty string if it was not set. Now it is set to None
2023-06-04 11:43:18 +02:00
ChillerDragon 6c158c8841 Suggest minor bump on breaking changes
https://www.conventionalcommits.org/en/v1.0.0/

closed #11
2023-06-01 11:03:08 +02:00
ChillerDragon 7c70e32725 First 0.6 draft
No 0.6 code is tested yet
This commit is just about adding all 0.6 code without
breaking existing 0.7 tests
2023-05-19 18:27:39 +02:00
ChillerDragon 6be2f54103 Do not gen 0.6 code yet 2023-05-19 09:45:57 +02:00
ChillerDragon e4e1c40d85 Adapt gen script to support 0.6 2023-05-19 09:17:02 +02:00
ChillerDragon 81cee81e94 Remove snap message from generation
currently blocked by broken huffman decompression
2023-05-15 11:24:42 +02:00
ChillerDragon fb12b0a498 Fix snap damage "self" conflicting w python keyword 2023-05-15 10:13:39 +02:00
ChillerDragon 7684002a64 Finish poc snap item generation 2023-05-14 12:18:29 +02:00
ChillerDragon 211f470e7b Finish snap init args generation 2023-05-14 11:33:53 +02:00
ChillerDragon 37ec4349aa Make gen init header code shared 2023-05-14 10:41:05 +02:00
ChillerDragon 4801af9c59 A bit more snap generation prep 2023-05-13 16:33:12 +02:00
ChillerDragon 6fef3f1abb More snap preperation in generate script 2023-05-13 14:33:50 +02:00
ChillerDragon 08f71f60a2 Type out snap items for libtw2 json 2023-05-13 10:23:23 +02:00
ChillerDragon 8c13ce6c2b Add connless info (inf3) 2023-05-12 17:17:07 +02:00
ChillerDragon f7ab25ab78 Pick type for packed_addresses (pack not working yet) 2023-05-10 09:45:06 +02:00
ChillerDragon 1b445c3a12 Add connless fields to initialize 2023-05-10 09:05:48 +02:00
ChillerDragon 7874d769aa Start working on connection less messages 2023-05-09 17:06:40 +02:00
ChillerDragon 2ef0b07282 Add message_type field for control, game and system messages 2023-05-09 11:42:19 +02:00
ChillerDragon 5a85dfd7a0 Test pcap example 2023-05-07 12:55:19 +02:00
ChillerDragon 18dd35f4fa Create chunk header instance for every message 2023-04-16 16:51:28 +02:00
ChillerDragon 6a351073d3 Include ids in message classes 2023-04-16 16:06:23 +02:00
ChillerDragon 1fd099c3de Intentionally keep enums ints
https://gitlab.com/teeworlds-network/twnet_parser/-/issues/7
2023-04-16 11:25:31 +02:00
ChillerDragon 67c54c4be4 Use python enums for enums
I played a bit with getting the text instead
of the magic number in the string representation
but everything I tried got a bit ugly
2023-04-16 10:53:29 +02:00
ChillerDragon e4ab0a7791 Make 0 member msgs look nicer 2023-04-16 09:40:12 +02:00
ChillerDragon 90b43608b9 Use named default for enums and move enum file 2023-04-16 09:28:36 +02:00
ChillerDragon 58051469f2 Start using classes in gen script to avoid globals 2023-04-16 08:52:03 +02:00
ChillerDragon 1767d05f4e Generate enums 2023-04-16 08:43:37 +02:00
ChillerDragon 8b0cce28be Expect the sha256 field to be 32 bytes 2023-04-16 08:15:55 +02:00
ChillerDragon 3b93a6bba2 Packing python bools as tw net bools just works
python handles bools more like the ints 0 and 1
and those are exactly the values the
teeworlds network protocol expects

I can totally see this breaking in python4
or a new mypy version

maybe one day a ``get_bool()`` could make sense
also for readability

but for now this should be stable as long as the
tests pass
2023-04-09 12:14:13 +02:00
ChillerDragon 2b28e755bc Add support for the data size field 2023-04-09 11:44:43 +02:00
ChillerDragon 822074ea47 Add support for generating array chunk fields 2023-04-08 14:24:44 +02:00
ChillerDragon 7dfaeda45f Apply sanitize string cc to all messages that need it 2023-04-07 14:27:25 +02:00
ChillerDragon 3df2a7fb12 Make the errors of run_tests.sh more intense
I did run ./scripts/run_tests.sh and thought they passed lol
pylint is not using colored output so in the green wall
of tests its easy to over see.

This should not happen again after this change.
2023-04-07 13:08:56 +02:00