r/pythonhelp • • May 30 '23

Absolute beginner, trying to fix a python script to support past 2 bytes size

There's this game utility written in Python which among other things, compiles files in assembly (ASM) into the game's own maps format (BVM):

https://github.com/mp-s/edftools

Wherein its only scripts used for this operation, are:

bvm_compiler.py https://drive.google.com/file/d/1BMnwQlbLi9TW31PPh7qVI87BFBzLtXvk/view?usp=sharing

bvm_model.py https://drive.google.com/file/d/1BMnwQlbLi9TW31PPh7qVI87BFBzLtXvk/view?usp=sharing

Now, the issue is that it cannot compile ASMs over a certain filesize: after a few tries, I calculated that it can accept up to 6553 commands. Which I assume means there's a list that supports only up to 65535 bits or 2 bytes. In fact when you try to compile a map that's too large, you get this stack overflow error: https://postimg.cc/mzrBsbBg

Which references this part of the code, mentioning 2 bytes: https://postimg.cc/t1kpw10c

So I'm looking for help to extend this max bytes limit. I tried changing that 2 into a 4, and it ended up allowing for the script to compile larger files... but also corrupts the maps and makes them useless. For reference, here are two ASM files of different size:

ASM, Small, Can be compiled https://drive.google.com/file/d/1hvnUTbu0KzYPHjlUO8Ndc63c_pBjVeqb/view?usp=sharing

ASM, Large, Cannot be compiled https://drive.google.com/file/d/1cDa18pKzSr6o0WpJyFwoFp1PaurSZ0g3/view?usp=sharing

Thanks for any help!

2 Upvotes

0 comments sorted by