Bug fixes

* Fixed mixed paths in outfit import feature
* Fixed paths in outfit import feature
* Fixed missing imports
This commit is contained in:
LoafyLemon 2024-03-30 19:20:46 +00:00
parent 7164a782e7
commit e93aa18285
2 changed files with 8 additions and 5 deletions

View File

@ -8,6 +8,7 @@ init python in image_payload:
import binascii import binascii
import struct import struct
import zlib import zlib
import os
CHUNK_TYPE_END = "IEND" CHUNK_TYPE_END = "IEND"
CHUNK_TYPE_PUNK = "wtSi" CHUNK_TYPE_PUNK = "wtSi"
@ -74,7 +75,7 @@ init python in image_payload:
print("Chunk injected!") print("Chunk injected!")
def list(input): def list(input):
path = os.path.join(config.gamedir, "outfits", input) path = os.path.join(renpy.config.gamedir, "outfits", input)
with open(path, "rb") as input_file: with open(path, "rb") as input_file:
@ -90,8 +91,8 @@ init python in image_payload:
return return
def inject(input, output, content): def inject(input, output, content):
input_path = os.path.join(config.gamedir, "outfits", input) input_path = os.path.join(renpy.config.gamedir, "outfits", input)
output_path = os.path.join(config.gamedir, "outfits", output) output_path = os.path.join(renpy.config.gamedir, "outfits", output)
content = zlib.compress(str(content).encode()) content = zlib.compress(str(content).encode())
with open(input_path, "rb") as input_file, open(output_path, "wb") as output_file: with open(input_path, "rb") as input_file, open(output_path, "wb") as output_file:
@ -117,7 +118,7 @@ init python in image_payload:
def extract(input): def extract(input):
print("Attempting to extract punked data from", input) print("Attempting to extract punked data from", input)
path = os.path.join(config.gamedir, "outfits", input) path = os.path.join(renpy.config.gamedir, input)
with open(path, "rb") as input_file: with open(path, "rb") as input_file:

View File

@ -1,4 +1,6 @@
init -1 python: init -1 python:
import os
def __check_exists(key): def __check_exists(key):
if not key in states.dolls: if not key in states.dolls:
raise KeyError(f"{key!r} character is undefined.") raise KeyError(f"{key!r} character is undefined.")
@ -179,7 +181,7 @@ init -1 python:
files = [] files = []
for f in os.listdir(path): for f in os.listdir(path):
fp = os.path.join(path, f) fp = os.path.join(path, f)
rp = os.path.relpath(fp, config.gamedir) rp = os.path.relpath(fp, config.gamedir).replace("\\", "/")
if os.path.isfile(os.path.join(path, f)) and f.endswith(".png"): if os.path.isfile(os.path.join(path, f)) and f.endswith(".png"):
files.append(build_button(rp)) files.append(build_button(rp))