Skip to content

Commit

Permalink
now checks script length before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
dekuNukem committed Feb 8, 2023
1 parent 50905f9 commit 0cd6056
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pc_software/ds3/duckypad_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ def compile_all_scripts():
for this_key in this_profile.keylist:
if this_key is not None:
this_key.binary_array = make_bytecode.make_dsb(this_key.script.split('\n'))
if len(this_key.binary_array) >= 2250:
messagebox.showerror("Error", f'Script size too large!\n\nProfile: {this_profile.name}\nKey: {this_key.name}')
return False
return True
except Exception as e:
error_msg = "Code contains error!\n"
Expand Down Expand Up @@ -637,9 +640,6 @@ def save_everything(save_path):
pre, ext = os.path.splitext(dsb_path)
dsb_path = pre + '.dsb'

if len(this_key.binary_array) >= 2250:
messagebox.showerror("Error", f'Profile {this_profile.name}\nKey {this_key.name}\n\nScript size too large')

with open(dsb_path, 'wb') as dsb_file:
dsb_file.write(this_key.binary_array)
if this_key.color is not None:
Expand Down
Binary file modified pc_software/ds3/duckypad_config_latest_source.zip
Binary file not shown.

0 comments on commit 0cd6056

Please sign in to comment.