forked from AxTps/Starlight_Lancher
feat:添加了启动进度的显示
This commit is contained in:
8
tools/icon_work/check_exe_icon.py
Normal file
8
tools/icon_work/check_exe_icon.py
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
p = r"D:\Project\Starlight_Lancher\target\release\Starlight Launcher.exe"
|
||||
data = open(p, "rb").read()
|
||||
print("exe 大小:", len(data))
|
||||
print("内嵌 PNG 数量(粗估):", data.count(b"\x89PNG\r\n\x1a\n"))
|
||||
ico = open(r"D:\Project\Starlight_Lancher\apps\app\icons\icon.ico", "rb").read()
|
||||
print("icon.ico 大小:", len(ico))
|
||||
print("icon.ico 原样出现在 exe:", ico in data)
|
||||
42
tools/icon_work/extract_ico.py
Normal file
42
tools/icon_work/extract_ico.py
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
import struct
|
||||
|
||||
p = r"D:\Project\Starlight_Lancher\target\release\Starlight Launcher.exe"
|
||||
data = open(p, "rb").read()
|
||||
|
||||
# 粗解析 PE,找 .rsrc 段的 RT_GROUP_ICON 和 RT_ICON
|
||||
# 简化:直接找所有 PNG(现代 ico 用 png 存大图)和 BMP(ico用)
|
||||
# 提取第一个 PNG 看尺寸
|
||||
import io
|
||||
PNG_SIG = b"\x89PNG\r\n\x1a\n"
|
||||
results = []
|
||||
idx = 0
|
||||
while True:
|
||||
i = data.find(PNG_SIG, idx)
|
||||
if i < 0:
|
||||
break
|
||||
# PNG IHDR: 宽高在 sig 后 16 字节起 (8 sig + 4 len + 4 'IHDR' = 16)
|
||||
try:
|
||||
w = struct.unpack(">I", data[i+16:i+20])[0]
|
||||
h = struct.unpack(">I", data[i+20:i+24])[0]
|
||||
if 8 <= w <= 1024 and 8 <= h <= 1024:
|
||||
results.append((i, w, h))
|
||||
except Exception:
|
||||
pass
|
||||
idx = i + 8
|
||||
|
||||
print("找到疑似图标 PNG (offset,w,h) 前 30 个:")
|
||||
for r in results[:30]:
|
||||
print(r)
|
||||
|
||||
# 对比:icon.ico 里各图像尺寸
|
||||
ico = open(r"D:\Project\Starlight_Lancher\apps\app\icons\icon.ico", "rb").read()
|
||||
n = struct.unpack("<H", ico[4:6])[0]
|
||||
print(f"\nicon.ico 含 {n} 个图像:")
|
||||
off = 6
|
||||
for k in range(n):
|
||||
w = ico[off] or 256
|
||||
h = ico[off+1] or 256
|
||||
size = struct.unpack("<I", ico[off+8:off+12])[0]
|
||||
print(f" 图像{k}: {w}x{h}, {size} bytes")
|
||||
off += 16
|
||||
26
tools/icon_work/fix_lp.py
Normal file
26
tools/icon_work/fix_lp.py
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\components\home\HomeLaunchProgress.vue"
|
||||
t = open(p, encoding="utf-8").read()
|
||||
|
||||
# 1) 给最外层 section 加 v-if
|
||||
t = t.replace(
|
||||
'\t<section\n\t\tclass="flex min-w-0 flex-col gap-3 border-0 border-b-[1px] border-solid border-[--brand-gradient-border] p-4"\n\t>',
|
||||
'\t<section\n\t\tv-if="hasProgress"\n\t\tclass="flex min-w-0 flex-col gap-3 border-0 border-b-[1px] border-solid border-[--brand-gradient-border] p-4"\n\t>',
|
||||
)
|
||||
|
||||
# 2) 删空态 <p v-if="!hasProgress">...</p>
|
||||
import re
|
||||
t = re.sub(
|
||||
r'\t\t<p v-if="!hasProgress"[^>]*>\n\t\t\t\{\{ formatMessage\(messages\.empty\) \}\}\n\t\t</p>\n',
|
||||
"",
|
||||
t,
|
||||
)
|
||||
|
||||
# 3) <ul v-else ...> 改 <ul ...>
|
||||
t = t.replace('<ul v-else class="m-0 flex list-none flex-col gap-2 p-0">', '<ul class="m-0 flex list-none flex-col gap-2 p-0">')
|
||||
|
||||
open(p, "w", encoding="utf-8", newline="\n").write(t)
|
||||
print("done")
|
||||
print("--- 78-95 ---")
|
||||
for i, line in enumerate(t.split("\n")[77:95], 78):
|
||||
print(f"{i}: {line}")
|
||||
BIN
tools/icon_work/icon_test_copy.exe
Normal file
BIN
tools/icon_work/icon_test_copy.exe
Normal file
Binary file not shown.
6
tools/icon_work/read_emit.py
Normal file
6
tools/icon_work/read_emit.py
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
import glob
|
||||
for f in glob.glob("packages/app-lib/src/event/*.rs"):
|
||||
print("=== " + f + " ===")
|
||||
print(open(f, encoding="utf-8").read()[:4000])
|
||||
print()
|
||||
5
tools/icon_work/scan_launch.py
Normal file
5
tools/icon_work/scan_launch.py
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
l = open("packages/app-lib/src/launcher/mod.rs", encoding="utf-8").read().split("\n")
|
||||
for i, line in enumerate(l):
|
||||
if "init_loading" in line or "emit_loading" in line or "MinecraftDownload" in line or "InstanceUpdate" in line:
|
||||
print(f"{i+1}: {line.strip()}")
|
||||
29
tools/icon_work/wire_lp.py
Normal file
29
tools/icon_work/wire_lp.py
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\pages\Index.vue"
|
||||
lines = open(p, encoding="utf-8").read().split("\n")
|
||||
|
||||
# 1) import:在 HomePlayInsights import 行后加一行
|
||||
imp_i = None
|
||||
for i, ln in enumerate(lines):
|
||||
if "import HomePlayInsights from '@/components/home/HomePlayInsights.vue'" in ln:
|
||||
imp_i = i
|
||||
break
|
||||
assert imp_i is not None, "找不到 HomePlayInsights import"
|
||||
lines.insert(imp_i, "import HomeLaunchProgress from '@/components/home/HomeLaunchProgress.vue'")
|
||||
|
||||
# 2) 模板:在 <HomePlayInsights /> 前插入 <HomeLaunchProgress />
|
||||
tpl_i = None
|
||||
for i, ln in enumerate(lines):
|
||||
if ln.strip() == "<HomePlayInsights />":
|
||||
tpl_i = i
|
||||
break
|
||||
assert tpl_i is not None, "找不到 <HomePlayInsights />"
|
||||
lines.insert(tpl_i, "\t\t\t<HomeLaunchProgress />")
|
||||
|
||||
open(p, "w", encoding="utf-8", newline="\n").write("\n".join(lines))
|
||||
print("done")
|
||||
for i in range(imp_i - 1, imp_i + 2):
|
||||
print(f"{i+1}: {lines[i]}")
|
||||
print("...")
|
||||
for i in range(tpl_i - 2, tpl_i + 3):
|
||||
print(f"{i+1}: {lines[i]}")
|
||||
Reference in New Issue
Block a user