Skip to content
This repository was archived by the owner on Jun 4, 2023. It is now read-only.

Commit 411c2c5

Browse files
authored
Add files via upload
1 parent ea0d953 commit 411c2c5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

patch.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import sys
1212
import struct
1313

14-
VERSION = (0, 3, 1)
14+
VERSION = (0, 3, 2)
1515

1616
class File():
1717
"""
@@ -164,6 +164,16 @@ def patch_realpaths(f, value):
164164
f.patch(0x2118e8, b"\x00")
165165
f.patch(0x1f48c0, b"\x00")
166166

167+
def patch_ads(f, value):
168+
if (len(value) != 5):
169+
tkinter.messagebox.showerror("Ads error", "The mod ID is invalid.")
170+
return
171+
172+
value = value.encode('utf-8')
173+
174+
f.patch(0x2129a0, b"http://smashhitlab.000webhostapp.com/\x00")
175+
f.patch(0x2129c8, b"ads.php?id=" + value + b"&x=\x00")
176+
167177
def patch_package(f, value):
168178
### This was the THIRD ATTEMPT to make it work.
169179
# It works by chaining it on after luaopen_base
@@ -197,6 +207,7 @@ def patch_roomlength(f, value):
197207
"seconds": patch_seconds,
198208
"realpaths_segments": patch_realpaths_segments,
199209
"realpaths": patch_realpaths,
210+
"ads": patch_ads,
200211
"package": patch_package,
201212
"vertical": patch_vertical,
202213
"roomlength": patch_roomlength,
@@ -322,6 +333,8 @@ def gui(default_path = None):
322333
fov_val = w.textbox(True)
323334
seconds = w.checkbox("Set the room time in seconds to (float):")
324335
seconds_val = w.textbox(True)
336+
ads = w.checkbox("Enable the Ad Service using mod ID (5 char string):")
337+
ads_val = w.textbox(True)
325338
realpaths_segments = w.checkbox("Use absolute paths for segments")
326339
realpaths = w.checkbox("Use absolute paths for rooms and levels")
327340
package = w.checkbox("Load package, io and os modules in scripts")
@@ -348,6 +361,8 @@ def x():
348361
"hit_val": hit_val.get(),
349362
"seconds": seconds.get(),
350363
"seconds_val": seconds_val.get(),
364+
"ads": ads.get(),
365+
"ads_val": ads_val.get(),
351366
"realpaths_segments": realpaths_segments.get(),
352367
"realpaths": realpaths.get(),
353368
"package": package.get(),

0 commit comments

Comments
 (0)