-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
EPPL_Auto_Modificator/!Source/EPPL_Auto_Modificator_009_for_McChinaDev.pyw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import wx | ||
import sys | ||
import os | ||
|
||
class MyFrame(wx.Frame): | ||
def __init__(self): | ||
super().__init__(parent=None, title='EPPL_Auto_Modificator', size=(350, 200)) | ||
self.filename = os.path.join('..','!McChinaDev','unpacked_Minecraft.Windows.exe') | ||
# остальной код | ||
self.panel = wx.Panel(self) | ||
self.checkbox = wx.CheckBox(self.panel, label='Enable/Disable the EPPL Mod', pos=(10, 10)) | ||
self.checkbox.Bind(wx.EVT_CHECKBOX, self.on_checkbox_toggle) | ||
static_text = wx.StaticText(self.panel, label='Developed by MaxRM for MDLC', pos=(10, 140)) | ||
# Чтение информации из файла конфигурации | ||
with open('config.txt', 'r') as config_file: | ||
lines = config_file.readlines() | ||
self.config_data = [line.strip().split(' >> ') for line in lines] | ||
|
||
# Преобразование строк в целые числа и шестнадцатеричные значения | ||
for i in range(len(self.config_data)): | ||
self.config_data[i][0] = int(self.config_data[i][0], 16) | ||
self.config_data[i][1:] = [value.strip() for value in self.config_data[i][1:]] | ||
|
||
self.update_checkbox_state() | ||
|
||
# Метод обновления состояния флажка | ||
def update_checkbox_state(self): | ||
with open(self.filename, 'rb') as file: | ||
file.seek(self.config_data[0][0]) | ||
hex_value1 = file.read(1).hex().upper() | ||
file.seek(self.config_data[1][0]) | ||
hex_value2 = file.read(1).hex().upper() | ||
if hex_value1 == self.config_data[0][2] and hex_value2 == self.config_data[1][2]: | ||
self.checkbox.SetValue(True) | ||
elif hex_value1 == self.config_data[0][1] and hex_value2 == self.config_data[1][1]: | ||
self.checkbox.SetValue(False) | ||
else: | ||
self.checkbox.Disable() | ||
wx.MessageBox("Error: Invalid values found", "Error", style=wx.OK | wx.ICON_ERROR) | ||
self.Close() | ||
|
||
def replace_hex(self, hex_value): | ||
with open(self.filename, 'rb+') as file: | ||
file.seek(self.config_data[0][0]) | ||
file.write(bytes.fromhex(hex_value)) | ||
file.seek(self.config_data[1][0]) | ||
file.write(bytes.fromhex(hex_value)) | ||
file.flush() | ||
|
||
def on_checkbox_toggle(self, event): | ||
if self.checkbox.GetValue(): | ||
self.replace_hex(self.config_data[0][2]) | ||
else: | ||
self.replace_hex(self.config_data[0][1]) | ||
self.update_checkbox_state() | ||
|
||
app = wx.App() | ||
frame = MyFrame() | ||
frame.Show() | ||
app.MainLoop() |
60 changes: 60 additions & 0 deletions
60
EPPL_Auto_Modificator/!Source/EPPL_Auto_Modificator_009_universal.pyw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import wx | ||
import sys | ||
import os | ||
|
||
class MyFrame(wx.Frame): | ||
def __init__(self): | ||
super().__init__(parent=None, title='EPPL_Auto_Modificator', size=(350, 200)) | ||
self.filename = os.path.join('Minecraft.Windows.exe') | ||
# остальной код | ||
self.panel = wx.Panel(self) | ||
self.checkbox = wx.CheckBox(self.panel, label='Enable/Disable the EPPL Mod', pos=(10, 10)) | ||
self.checkbox.Bind(wx.EVT_CHECKBOX, self.on_checkbox_toggle) | ||
static_text = wx.StaticText(self.panel, label='Developed by MaxRM for MDLC', pos=(10, 140)) | ||
# Чтение информации из файла конфигурации | ||
with open('config.txt', 'r') as config_file: | ||
lines = config_file.readlines() | ||
self.config_data = [line.strip().split(' >> ') for line in lines] | ||
|
||
# Преобразование строк в целые числа и шестнадцатеричные значения | ||
for i in range(len(self.config_data)): | ||
self.config_data[i][0] = int(self.config_data[i][0], 16) | ||
self.config_data[i][1:] = [value.strip() for value in self.config_data[i][1:]] | ||
|
||
self.update_checkbox_state() | ||
|
||
# Метод обновления состояния флажка | ||
def update_checkbox_state(self): | ||
with open(self.filename, 'rb') as file: | ||
file.seek(self.config_data[0][0]) | ||
hex_value1 = file.read(1).hex().upper() | ||
file.seek(self.config_data[1][0]) | ||
hex_value2 = file.read(1).hex().upper() | ||
if hex_value1 == self.config_data[0][2] and hex_value2 == self.config_data[1][2]: | ||
self.checkbox.SetValue(True) | ||
elif hex_value1 == self.config_data[0][1] and hex_value2 == self.config_data[1][1]: | ||
self.checkbox.SetValue(False) | ||
else: | ||
self.checkbox.Disable() | ||
wx.MessageBox("Error: Invalid values found", "Error", style=wx.OK | wx.ICON_ERROR) | ||
self.Close() | ||
|
||
def replace_hex(self, hex_value): | ||
with open(self.filename, 'rb+') as file: | ||
file.seek(self.config_data[0][0]) | ||
file.write(bytes.fromhex(hex_value)) | ||
file.seek(self.config_data[1][0]) | ||
file.write(bytes.fromhex(hex_value)) | ||
file.flush() | ||
|
||
def on_checkbox_toggle(self, event): | ||
if self.checkbox.GetValue(): | ||
self.replace_hex(self.config_data[0][2]) | ||
else: | ||
self.replace_hex(self.config_data[0][1]) | ||
self.update_checkbox_state() | ||
|
||
app = wx.App() | ||
frame = MyFrame() | ||
frame.Show() | ||
app.MainLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python png2ico.py EPPL_16.png EPPL_32.png EPPL_48.png EPPL_64.png EPPL_128.png EPPL_255.png |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from pathlib import Path | ||
from typing import Sequence | ||
from PIL import Image | ||
import argparse | ||
|
||
|
||
AUTO_RESIZE_OUTPUT_ICO_SIZES = ((16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (255, 255)) | ||
|
||
|
||
def png2ico(pngs_paths: Sequence[str], ico_path: str, *, auto_resize: bool = False): | ||
if auto_resize: | ||
imgs = {Path(png_path).stat().st_size: png_path for png_path in pngs_paths} | ||
largest_img_path = imgs[max(imgs.keys())] | ||
img = Image.open(largest_img_path) | ||
img.save(ico_path, sizes=AUTO_RESIZE_OUTPUT_ICO_SIZES) | ||
else: | ||
data = bytes((0, 0, 1, 0, len(pngs_paths), 0)) | ||
offset = 6 + len(pngs_paths) * 16 | ||
|
||
for png_path in pngs_paths: | ||
img = Image.open(png_path) | ||
try: | ||
data += bytes((img.width, img.height, 0, 0, 1, 0, 32, 0,)) | ||
except ValueError: | ||
raise ValueError('Image size can\'t be larger than 255x255 pixels. ' | ||
'Resize your image or use -r flag to continue.') | ||
bytesize = Path(png_path).stat().st_size | ||
data += bytesize.to_bytes(4, byteorder="little") | ||
data += offset.to_bytes(4, byteorder="little") | ||
offset += bytesize | ||
|
||
for png in pngs_paths: | ||
data += Path(png).read_bytes() | ||
|
||
Path(ico_path).write_bytes(data) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Converting multiple .PNG files to one multisize .ICO file') | ||
parser.add_argument('files', nargs='+', type=str, help='Input .PNG filenames') | ||
parser.add_argument('-o', '--output', default='icon.ico', type=str, required=False, help='Output .ICO filename') | ||
parser.add_argument('-r', '--resize', default=False, type=bool, action=argparse.BooleanOptionalAction, | ||
help='Resizes the largest .PNG file automatically. ' | ||
'The output is multisize .ICO file with sizes: ' | ||
'16x16, 24x24, 32x32, 48x48, 64x64, 128x128, 255x255.') | ||
args = parser.parse_args() | ||
png2ico(pngs_paths=args.files, ico_path=args.output, auto_resize=args.resize) |
Binary file not shown.
Binary file added
BIN
+14.6 MB
EPPL_Auto_Modificator/For_McChinaDev/EPPL_Auto_Modificator_009_for_McChinaDev.exe
Binary file not shown.
Empty file.
Binary file added
BIN
+14.6 MB
EPPL_Auto_Modificator/Universal/EPPL_Auto_Modificator_009_universal.exe
Binary file not shown.
Empty file.