Skip to content

Commit

Permalink
v0.85
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshakami authored Oct 12, 2021
1 parent 781583a commit afbdd53
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 52 deletions.
2 changes: 1 addition & 1 deletion arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
create_list = []
a = Tk()
a.title(language[start])
a.minsize(660, 440)
a.minsize(880, 440)
a.config(bg='#aacfff')
a.iconbitmap('C:\\Yosh\\msm_stuff\\arc.ico')

Expand Down
6 changes: 3 additions & 3 deletions brsar.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def patch_brsar(file, index):
brsar.write(brstm_max_size)
cursor = cursor_save
button_list[index].destroy()
patched = Label(a, text=language[hashtag + 2].replace("#", patched_num), bg='#ffffaa', width=30)
patched = Label(a, text=language[hashtag + 2].replace("#", str(patched_num)), bg='#ffffaa', width=30)
patched.grid(row=button_row[index], column=button_col[index])


Expand Down Expand Up @@ -113,10 +113,10 @@ cwd_label.grid(row=0, column=1, columnspan=2)
entry_dir = Entry(a, width=30)
entry_dir.grid(row=1, column=1)

refreshbu = Button(a, text=language[msm + 19], command=change_directory, activebackground='#ff9999', width=30)
refreshbu = Button(a, text=language[msm + 40], command=change_directory, activebackground='#ff9999', width=30)
refreshbu.grid(row=1, column=2)

open_explorerbu = Button(a, text=language[msm + 40], command=open_explorer, activebackground='#96c7ff', width=15)
open_explorerbu = Button(a, text=language[msm + 19], command=open_explorer, activebackground='#96c7ff', width=15)
open_explorerbu.grid(row=1, column=0)

title = Label(a, text=language[start + 14], font=500, bg='#ffffaa', height=3)
Expand Down
2 changes: 1 addition & 1 deletion bstick.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ start = int(language[1].split(":")[9])
msm = int(language[1].split(":")[1])
a = Tk()
a.title(language[start])
a.minsize(660, 440)
a.minsize(880, 724)
a.config(bg='#aaaaff')
a.iconbitmap('C:\\Yosh\\msm_stuff\\bstick.ico')

Expand Down
2 changes: 1 addition & 1 deletion dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def dump(file, index):
with open(png_list[i], 'rb') as png:
zzzdump.write(sha256(png.read()).hexdigest()) # sha256 hash of the png
button_list[index].destroy()
dumped = Label(a, text=language[hashtag + 3].replace("#", counter), bg='#aaffbf', width=30)
dumped = Label(a, text=language[hashtag + 3].replace("#", str(counter)), bg='#aaffbf', width=30)
dumped.grid(row=button_row[index], column=button_col[index])


Expand Down
2 changes: 1 addition & 1 deletion isox.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
create_list = []
a = Tk()
a.title(language[start])
a.minsize(660, 440)
a.minsize(880, 440)
a.config(bg='#aaffaa')
a.iconbitmap('C:\\Yosh\\msm_stuff\\isox.ico')

Expand Down
3 changes: 2 additions & 1 deletion lh.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ def compress_file(brres, num):
continue
with open(file_to_extract, 'rb') as check_xfile:
header = check_xfile.read(4)
if header[0] in [b'@', b'\x10', b'\x11', b'\x81', b'\x82', b'$', b'(', b'0', b'P'] and header != b'PK\x03\x04': # lh @, old lz \x10, lz77 \x11, diff8 \x81, diff16 \x82, huff4 $, huff8 (, runlength 0, lrc P
if header[:1] in [b'@', b'\x10', b'\x11', b'\x81', b'\x82', b'$', b'(', b'0', b'P'] and header != b'PK\x03\x04': # lh @, old lz \x10, lz77 \x11, diff8 \x81, diff16 \x82, huff4 $, huff8 (, runlength 0, lrc P
run_extract_file = partial(extract_file, file_to_extract, i)
temp = Button(a, text=file_to_extract, command=run_extract_file, activebackground='#a9ff99', width=30)
temp.grid(row=burow_extract[i], column=bucolumn[i])
extract_list.append(temp)
print(file_to_extract, i)
i += 1

except PermissionError as error:
Expand Down
168 changes: 142 additions & 26 deletions msmhelp.pyw
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from tkinter import Tk, Canvas, PhotoImage, Button, Label, font
from textwrap import wrap
from functools import partial
from textwrap import wrap
from math import e, log
from PIL import Image
import random

with open('C:\\Yosh\\#language.txt', 'r', encoding="utf-8") as txt:
language = txt.read()
language = [''] + language.splitlines()

start = int(language[1].split(":")[27])
start = int(language[1].split(":")[31])
msm = int(language[1].split(":")[1])
hashtag = int(language[1].split(":")[3])
a = Tk()
a.title(language[start])
a.attributes('-fullscreen', True)
Expand All @@ -18,23 +21,25 @@ w = a.winfo_screenwidth()
h = a.winfo_screenheight()

s = font.Font(family='MARIO Font v3 Solid', size=15)
m = font.Font(family='MARIO Font v3 Solid', size=25) # , weight='bold')
big = font.Font(family='MARIO Font v3 Solid', size=50)
m = font.Font(family='MARIO Font v3 Solid', size=int(25 / 1536 * w)) # , weight='bold')
big = font.Font(family='MARIO Font v3 Solid', size=40)
man = font.Font(family='MARIO Font v3 Solid', size=50)

txt = Label(a, text=language[start + 2], font=300, bg="#ff9696")
txt.place(x=33 * w / 84, y=h / 20)
title = Label(a, text=language[start + 1], font=300, bg="#ff9696")
title.place(x=17 * w / 42, y=h / 50)
bye = Button(a, text=language[msm + 39], command=a.quit, bg="#9fff7f", font=2, activebackground='#8fff7f', width=24, height=2)
bye.place(x=63 * w / 80, y=h / 10)
dim = Label(a, text=f'Your screen dimensions\n are {w}x{h} pixels', font=s, bg='#ff9696', fg='#2f2fff')
dim = Label(a, text=language[hashtag + 11].replace('§', '\n').replace('#', str(w)).replace('%', str(h)), font=s, bg='#ff9696', fg='#2f2fff')
dim.place(x=w / 10, y=h / 10)
static = [title, txt, bye, dim]
# a.wm_attributes('-transparentcolor', a['bg'])


print(f"screen dimensions : {w}x{h}")
# print(font.families())


def menu(garbage): # goes back to the menu with 16 little pictures
for z in a.winfo_children():
if z in static:
Expand All @@ -48,26 +53,94 @@ def display(picture, garbage_sent_by_bind): # displays the big png
c.create_image(w / 2, h / 2, image=image_list[picture])
c.place(x=0, y=0)

centered_title = language[start + 19 + (picture-16) * 3]
# centered_title = language[start + (picture-16)]
# centered_title = (50 - 2 * len(string)) * ' ' + language[217 + (picture-16) * 3] + (12 - 2 * len(string)) * ' '
if picture != 8:
c.create_text((w / 3, h / 8), text=centered_title, font=big, fill=minicolor[picture-16]) # title
c.create_text((5 * w / 8, h / 4), text=language[start + 20 + (picture-16) * 3], font=m, fill=minicolor[picture-16]) # left text
c.create_text((w / 8, h / 5), text=language[start + 21 + (picture-16) * 3], font=m, fill=minicolor[picture-16]) # right text
text_list = []
for k in range(2):
# text_list.append(language[start + 20 + k + (picture-16) * 2])
splitted_txt = language[start + 20 + k + (picture-16) * 2].split('¤')
paragraph = ''
g = 1 # starting character of the text in #language.txt
if splitted_txt[0][:g] == '*': # * means the line won't be wrapped
g = 2
for line in splitted_txt:
b = 1
if line[1].isdigit():
b = 2
if g == 2:
list_txt = ['¤' + line]
else: # tries to adapt the font size to the screen
x = int(line[:b])
list_txt = wrap('¤' + line, int(1.5/(0.00226 * x) + 3 * log(e, 70/(6 * x)) + 6))
# list_txt = wrap('¤' + line, int(1 / (int(line[:b]) * w / 1920) * 990))
# print(int(1 / (int(line[:b]) * w / 1920) * 950))
for text1 in list_txt:
paragraph += text1.replace('§', '\n').replace('\\n', '\n').replace('\\t', '\t')
if text1 != list_txt[-1]:
paragraph += '\n'
# print(paragraph)
text_list.append(paragraph[g:])

if picture != 27:
# rendering the title text
title_text = language[start + picture-13]
if title_text[1].isnumeric():
c.create_text((2 * w / 7, h / 8), text=title_text[3:], font=('MARIO Font v3 Solid', int(int(title_text[:2]) / 1920 * w)),
fill=title[picture-16], anchor='w')
else:
c.create_text((0, h / 8), text=title_text[2:], font=('MARIO Font v3 Solid', int(int(title_text[:1]) / 1920 * w)),
fill=title[picture-16], anchor='w')

# rendering the left/right text with special markdown: type \n with 4 spaces to start a new line below,
# type ¤ then the font size then a number between 0 and 36 followed by a space to change the text color
# and ¤ for the colour id (from the list named minicolor). for example ¤0 for red or ¤36 for white text color
left_text = text_list[0].split('¤')
n_count = 0
for k in range(len(left_text)):
d = 1
while left_text[k][:d].isnumeric():
if left_text[k][:d] == left_text[k][:d+1]: # prevents infinite loop if there is nothing behind
break
d += 1
g = d + 1
while left_text[k][d:g].isnumeric():
if left_text[k][d:g] == left_text[k][d:g+1]: # prevents infinite loop if there is nothing behind
break
g += 1
beginning = g
c.create_text((w / 14, h / 4), text='\n' * n_count + left_text[k][beginning:], font=('MARIO Font v3 Solid', int(int(left_text[k][:d-1]) / 1536 * w)), fill=minicolor[int(left_text[k][d:g])], anchor='nw') # left text
n_count += left_text[k].count('\n')

right_text = text_list[1].split('¤')
n_count = 0
for x in range(len(right_text)):
d = 1
while right_text[x][:d].isnumeric():
if right_text[x][:d] == right_text[x][:d+1]: # prevents infinite loop if there is nothing behind
break
d += 1
g = d + 1
while right_text[x][d:g].isnumeric():
if right_text[x][d:g] == right_text[x][d:g+1]: # prevents infinite loop if there is nothing behind
break
g += 1
beginning = g
c.create_text((w / 2, 2 * h / 7), text='\n' * n_count + right_text[x][beginning:], font=('MARIO Font v3 Solid', int(int(right_text[x][:d-1]) / 1536 * w)), fill=minicolor[int(right_text[x][d:g])], anchor='nw') # right text
n_count += right_text[x].count('\n')


name = ["h", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9", "ha", "hb", "hc", "hd", "he", "hf", "hm", "m", "m2", "m3",
"m4", "m5", "m6", "m7", "how-to-run-msm", "m9", "ma", "mb", "mc", "md", "me", "mf", "mm"]
"m4", "m5", "m6", "m7", "m8", "m9", "ma", "mb", "how-to-run-msm", "md", "me", "mf", "mm"]
miniatures = name[:16] # from h to hm
large = name[16:] # from m to end

with open("C:\\Yosh\\msm_stuff\\h.png", 'rb') as minipic:
minipic.seek(16)
byte = minipic.read(4)
# pic_width = (byte[0] * 16777216) + (byte[1] * 65536) + (byte[2] * 256) + byte[3] - 64 # 4 bytes integer
pic_width = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] - 64 # 4 bytes integer
# pic_width = (byte[0] * 16777216) + (byte[1] * 65536) + (byte[2] * 256) + byte[3] # 4 bytes integer
pic_width = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] # 4 bytes integer
byte = minipic.read(4)
pic_height = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] - 64 # 4 bytes integer
pic_height = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] # 4 bytes integer

if (pic_width != w // 5) and (pic_height != h // 5):
for n in range(len(miniatures)):
Expand All @@ -79,16 +152,16 @@ if (pic_width != w // 5) and (pic_height != h // 5):
with open("C:\\Yosh\\msm_stuff\\m.png", 'rb') as minipic:
minipic.seek(16)
byte = minipic.read(4)
pic_width = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] - 64 # 4 bytes integer
pic_width = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] # 4 bytes integer
byte = minipic.read(4)
pic_height = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] - 64 # 4 bytes integer
pic_height = (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + byte[3] # 4 bytes integer

if (pic_width != w) and (pic_height != h):
for p in range(16, len(miniatures)):
picc = Image.open('C:\\Yosh\\msm_stuff\\' + miniatures[p] + '.png')
for p in range(len(large)):
picc = Image.open('C:\\Yosh\\msm_stuff\\' + large[p] + '.png')
new_pic = picc.resize((w, h))
picc.close()
new_pic.save('C:\\Yosh\\msm_stuff\\' + miniatures[p] + '.png')
new_pic.save('C:\\Yosh\\msm_stuff\\' + large[p] + '.png')

image_list = []
for j in range(0, 32):
Expand All @@ -97,24 +170,67 @@ for j in range(0, 32):
ListeNulle = [3, 7, 11]
eks = [0, w / 4, 2 * w / 4, 3 * w / 4]
whi = [h / 5, 2 * h / 5, 3 * h / 5, 4 * h / 5]
minicolor = ['#4fd5ff', '#0061ff', '#0000ff', '#7f00ff', '#006eff', '#952bff', '#ff00a1', '#ff5d00', '#5500a5',
'#ff77df', '#ff8282', '#ffbf00', '#35ff7f', '#99ff00', '#c700ff', '#b70f00']
minicolor = ['#ff0000', '#ff7f7f', '#ff5f00', '#ff9f00', '#ffcf00', # id 0 to 4
'#ffff00', '#ffff7f', '#cfff00', '#9fff00', '#5fff00', # id 5 to 9
'#00ff00', '#7fff7f', '#00ff5f', '#00ff9f', '#00ffcf', # id 10 to 14
'#00ffff', '#7fffff', '#00cfff', '#009fff', '#005fff', # id 15 to 19
'#0000ff', '#7f7fff', '#5500a5', '#5f00ff', '#9f00ff', '#cf00ff', # id 20 to 25
'#ff00ff', '#ff7fff', '#ff00cf', '#ff009f', '#ff005f', '#b70f00', # id 26 to 31
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff'] # if 32 to 36 - white to black

# 5'#ff0000', '#00ff00', '#0000ff', '#00ffff', '#ff00ff', '#ffff00', # 5primary and printing colours
# 11'#ff7f7f', '#7fff7f', '#7f7fff', '#7fffff', '#ff7fff', '#ffff7f', # 11primary and printing colours lighter
# 17'#ff5f00', '#ff005f', '#5fff00', '#5f00ff', '#005fff', '#00ff5f', # 17all combos with ff, 5f, and 00
# 23'#ff9f00', '#ff009f', '#9fff00', '#9f00ff', '#009fff', '#00ff9f', # 23all combos with ff, 9f, and 00
# 29'#ffcf00', '#ff00cf', '#cfff00', '#cf00ff', '#00cfff', '#00ffcf', # 29all combos with ff, cf, and 00
# 35'#5500a5', '#b70f00' # 35plum then maroon

print(f'there are {len(minicolor)} colours available')
# green_cyan = minicolor[0] '#03ff81',
# lighter_blue = minicolor[1] '#0061ff',
# light_blue = minicolor[4] '#006eff',
blue = minicolor[20]
purple = minicolor[24]
light_blue = minicolor[17]
violet = minicolor[25]

fushia = minicolor[29]
pink = minicolor[30]
pink_orange = minicolor[1]
orange = minicolor[3]

cyan = minicolor[16]
green_cyan = minicolor[13]
light_green = minicolor[8]
lighter_blue = minicolor[15]

# light_gray gray dark_gray black red green yellow light_red orchid
# plum = minicolor[22]
# maroon = minicolor[31]
# chartreuse = minicolor[7]
# dodger_blue = minicolor[18]

title = [blue, purple, light_blue, violet,
fushia, pink, pink_orange, orange,
cyan, green_cyan, light_green, "",
lighter_blue, blue, orange, violet]


for i in range(0, 16): # displays the 16 little pictures + bind left click to the full-screen ones
list_text = wrap(language[start + 3 + i], 12)
list_text = wrap(language[start + 3 + i].lstrip('0123456789 '), 12) # doesn't create a title larger than 12 characters else it's off-picture
text = ''
for string in list_text:
if string == list_text[-1]:
text += (13 - 2 * len(string)) * ' ' + string + (12 - 2 * len(string)) * ' '
text += string # (13 - 2 * len(string)) * ' ' + string + (12 - 2 * len(string)) * ' ' # old (and worse) method for justify="center"
else:
text += (13 - 2 * len(string)) * ' ' + string + (12 - 2 * len(string)) * ' ' + '\n'
text += string + '\n' # (13 - 2 * len(string)) * ' ' + string + (12 - 2 * len(string)) * ' ' + '\n'

f = Canvas(a, width=w / 4, height=h / 5, bd=-2, bg="#ff9696")
func = partial(display, i + 16)
f.bind("<Button-1>", func)
f.create_image(w / 8, h / 10, image=image_list[i])
f.place(x=eks[i % 4], y=whi[i // 4]) # + '\n' + language[201 + i][10:20] + '\n' + language[201 + i][20:]
info = f.create_text((w / 8, h / 9), text=text, font=m, fill=minicolor[i])
info = f.create_text((w / 8, h / 9), text=text, font=m, fill=minicolor[(i+random.choice((11, 18, 20, 23))) % 32], justify="center") # 11 18 20 23
static.append(f)
static.append(info)
a.mainloop()
10 changes: 5 additions & 5 deletions pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def pack(file, index):
name = line.split(' ', 3)[3]
# now just replace them inside the file
tex0 = -1
current = 0
current = -1
with open(file, 'r+b') as u8: # works with arc and brres, so it's just a basic u8 archive format I would say
for cursor in range(0, filesize - 17, 16):
u8.seek(cursor)
Expand All @@ -91,7 +91,7 @@ def pack(file, index):
if keep_encoded == b'0':
shutil.rmtree(encoded)
button_list[index].destroy()
patched = Label(a, text=language[hashtag + 4].replace("#", counter), bg='#ffaaaa', width=30)
patched = Label(a, text=language[hashtag + 4].replace("#", str(counter)), bg='#ffaaaa', width=30)
patched.grid(row=button_row[index], column=button_col[index])


Expand Down Expand Up @@ -172,13 +172,13 @@ def keep(): # each time the checkbutton keep_tex0 is triggered
open_explorerbu = Button(a, text=language[msm + 19], command=open_explorer, activebackground='#96c7ff', width=15)
open_explorerbu.grid(row=1, column=0)

T = Label(a, text=language[isox + 5].replace('5', '2'), bg='#ffaaaa', width=30)
T.grid(row=2, column=0, columnspan=3)
T = Label(a, text=language[isox + 5].replace('5', '2'), bg='#ffaaaa', width=40)
T.grid(row=2, column=1, columnspan=2)

title = Label(a, text=language[start + 1], font=(None, 15), bg='#ffaaaa', height=3)
title.grid(row=3, columnspan=9)

keep_tex0 = Checkbutton(a, text=language[start + 5], command=keep, bg="#ffaaaa", width=20)
keep_tex0 = Checkbutton(a, text=language[start + 5], command=keep, bg="#ffaaaa", width=25)
keep_tex0.grid(row=2, column=0)

with open('C:\\Yosh\\a', 'rb') as config:
Expand Down
4 changes: 2 additions & 2 deletions tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def encode(file, index):
nmipmap = nmipmap.strip(space25)
out = output.get()
if out == '':
out = os.path.splitext(file)
os.system(f'wimgt encode "{file}" -x {colourenc} --n-mm {nmipmap} -d "{out}.tex0"')
out = os.path.splitext(file)[0]
os.system(f'wimgt encode "{file}" -x {colourenc} --n-mm {nmipmap} -d "{out}.tex0" -o')

button_list[index].destroy()
patched = Label(a, text=language[start + 3], bg='#bfaaff', width=30)
Expand Down
2 changes: 1 addition & 1 deletion tex3.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ for element in os.listdir('./'):
continue

toaster = ToastNotifier()
toaster.show_toast(language[hashtag + 5].replace("#", count_tex), language[hashtag + 6].replace("#", count_files), icon_path="C:/Yosh/tex3.ico", duration=5)
toaster.show_toast(language[hashtag + 5].replace("#", str(count_tex)), language[hashtag + 6].replace("#", str(count_files)), icon_path="C:/Yosh/tex3.ico", duration=5)
Loading

0 comments on commit afbdd53

Please sign in to comment.