Skip to content

Commit

Permalink
2.0.0rc1 完成初步测试 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ginsakura authored and Ginsakura committed Feb 1, 2025
1 parent 66f01dd commit 525ebab
Show file tree
Hide file tree
Showing 11 changed files with 1,682 additions and 1,646 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- 'main'

env:
isPreRelease: true
Version: Init
CommitMessage: Init

Expand Down Expand Up @@ -47,6 +48,7 @@ jobs:
} else {
$version = py -c "import Version; print(Version.version)";
}
echo "isPreRelease=${isPreReleaseBool}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Version=${version}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Dist ${{ env.Version }}
Expand Down
3 changes: 2 additions & 1 deletion File2Base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FixDLL:str = "F39E7D866C2EF4F6A40E573EF5B0D2A8";
# Source Assembly-CSharp.dll
SourceDLL:str = '043799056B15948930F9BFCDDC6E5FEE';
SongNameVersion:int = 20250126;
SongNameVersion:int = 20250201;

def GetHash(filePath:str=None)->str:
if (filePath is None): return "";
Expand Down Expand Up @@ -114,6 +114,7 @@ def CompressAndEncodeToFile(readFilePath:str, writeFilePath:str)->(bytes|None):
# 修复文件结构
binaryInfo["GameLib"]["SourceHash"] = SourceDLL;
binaryInfo["SongName"]["Version"] = SongNameVersion;
print(json.dumps(binaryInfo, ensure_ascii=False, indent=4));
# 封装文件
# 创建一个BytesIO对象,用于存储压缩后的数据
# 使用gzip.GzipFile进行压缩
Expand Down
78 changes: 38 additions & 40 deletions HitDelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ def __init__(self,subroot):
self.txtButton.place(relx=0.7,y=40,height=30,relwidth=0.3)
else:
self.logButton.place(relx=0.7,y=40,height=90,relwidth=0.3)
self.keys = Config.Default4Keys # T=4, F=6
self.keysButton = Button(self.subroot,font=self.font, text=("4Key" if self.keys else "6Key"), command=self.ChangeKeys, bg="#4AA4C9")
self.keysButton = Button(self.subroot,font=self.font, text=("4Key" if Config.Default4Keys else "6Key"), command=self.ChangeKeys, bg="#4AA4C9")
self.keysButton.place(relx=0.5,y=100,height=30,relwidth=0.1)
self.diffcute = Config.DefaultDiffcute
self.diffcute = Config.DefaultDiffcute;
self.diffcuteButton = Button(self.subroot,font=self.font, text=["Easy","Hard","Inferno"][self.diffcute], command=self.ChangeDiffcute, bg="#4AA4C9")
self.diffcuteButton.place(relx=0.6,y=100,height=30,relwidth=0.1)

Expand Down Expand Up @@ -103,11 +102,12 @@ def __init__(self,subroot):
self.UpdateWindowInfo()

def ChangeKeys(self):
self.keys = not self.keys
self.keysButton.configure(text=("4Key" if self.keys else "6Key"))
Config.Default4Keys = not Config.Default4Keys;
self.keysButton.configure(text=("4Key" if Config.Default4Keys else "6Key"));
def ChangeDiffcute(self):
self.diffcute = (self.diffcute+1)%3
self.diffcuteButton.configure(text=["Easy","Hard","Inferno"][self.diffcute])
self.diffcute = (self.diffcute + 1) % 3;
Config.DefaultDiffcute = self.diffcute;
self.diffcuteButton.configure(text=["Easy","Hard","Inferno"][self.diffcute]);

def TestEntryString(self):
string = self.nameDelayEntry.get()
Expand All @@ -130,8 +130,6 @@ def HistoryUpdate(self):
self.UpdateWindowInfo()

def Draw(self):
Config.Default4Keys = self.keys;
Config.DefaultDiffcute = self.diffcute;
consoleFind = False
try:
win = uiauto.WindowControl(searchDepth=1,Name='MUSYNX Delay',searchInterval=1).DocumentControl(serchDepth=1,Name='Text Area',searchInterval=1)
Expand All @@ -145,36 +143,37 @@ def Draw(self):
win.SendKeys('{Ctrl}C',waitTime=0.1)
consoleFind = True
except Exception as e:
messagebox.showerror("Error", f'控制台窗口未找到\n请确认控制台窗口已开启\n{e}')
self.__logger.exception("控制台窗口未找到,请确认控制台窗口已开启");
messagebox.showerror("Error", f'控制台窗口未找到\n请确认控制台窗口已开启\n{e}');
if consoleFind:
data = pyperclip.paste().split('\n')
dataList=list()
n = self.nameDelayEntry.get().replace("\'","’")
k = "6K" if self.keys else "4K"
d = ["EZ","HD","IN"][self.diffcute]
name = f"{n} {k}{d}"
time = f"{dt.now()}"
data = pyperclip.paste().split('\n');
dataList=list();
n = self.nameDelayEntry.get().replace("\'","’");
k = "4K" if Config.Default4Keys else "6K";
d = ["EZ","HD","IN"][self.diffcute];
name = f"{n} {k}{d}";
time = f"{dt.now()}";
if data[-1] == "": #如果最后一行是空行,则去除
data.pop(-1)
data.pop(-1);
for ids in range(1,len(data)): # 去除第一行
dataList.append(float(data[ids][13:-3]))
allKeys = len(dataList)
sumNums,sumKeys = 0,0
dataList.append(float(data[ids][13:-3]));
allKeys = len(dataList);
sumNums,sumKeys = 0,0;
for ids in dataList:
if (ids < self.delayInterval) and (ids > -self.delayInterval):
sumNums += ids
sumKeys += 1
avgDelay = sumNums/sumKeys
avgAcc = sum([abs(i) for i in dataList])/allKeys
self.delayHistory.insert('', END, values=(name,allKeys,'%.6f ms'%avgDelay,'%.6f ms'%avgAcc))
dataListStr = ""
sumNums += ids;
sumKeys += 1;
avgDelay = sumNums/sumKeys;
avgAcc = sum([abs(i) for i in dataList])/allKeys;
self.delayHistory.insert('', END, values=(name,allKeys,'%.6f ms'%avgDelay,'%.6f ms'%avgAcc));
dataListStr = "";
for i in dataList:
dataListStr += f'{i}|'
self.cur.execute("INSERT into HitDelayHistory values(?,?,?,?,?,?)",(name,time,avgDelay,allKeys,avgAcc,dataListStr[:-1]))
self.db.commit()
self.HistoryUpdate()
dataList = [name,time,avgDelay,allKeys,avgAcc,dataList]
HitDelayDraw(dataList,isHistory=False)
dataListStr += f'{i}|';
self.cur.execute("INSERT into HitDelayHistory values(?,?,?,?,?,?)",(name,time,avgDelay,allKeys,avgAcc,dataListStr[:-1]));
self.db.commit();
self.HistoryUpdate();
dataList = [name,time,avgDelay,allKeys,avgAcc,dataList];
HitDelayDraw(dataList,isHistory=False);

def OpenTxt(self):
os.system('start notepad ./musync_data/Acc-Sync.json')
Expand All @@ -191,7 +190,7 @@ def ShowHistoryInfo(self,event):
isChange = False
historyName = historyItem[0].replace("\'",'’')
recordTime = historyItem[1]
self.__logger.debug("ShowHistoryInfo:",historyItem)
self.__logger.debug(f"ShowHistoryInfo: {historyItem}")
data = self.cur.execute(f"select * from HitDelayHistory where SongMapName=\'{historyName}\' and RecordTime=\'{recordTime}\'")
data = data.fetchone()
self.__logger.debug(data[:4])
Expand Down Expand Up @@ -249,7 +248,7 @@ def UpdateWindowInfo(self):
self.delayHistory.bind("<ButtonPress-1>",self.ShowHistoryInfo)
self.historyRecordTimeValueLabel['text'] = dt.now()

self.__logger.debug("VScroll1.get",self.VScroll1.get())
self.__logger.debug(f"VScroll1.get:{self.VScroll1.get()}")
self.delayHistory.place(x=0,y=130,height=self.subroot.winfo_height()-130,relwidth=0.684)
self.VScroll1.place(relx=0.684,y=132,height=self.subroot.winfo_height()-133,relwidth=0.015)
self.subroot.update()
Expand All @@ -260,7 +259,7 @@ class HitDelayDraw(object):
"""docstring for ClassName"""
def __init__(self, dataList,isHistory=False):
self.__logger:logging.Logger = Logger.GetLogger("HitDelay.HitDelayDraw");
self.__logger.info('Name:%s\nRecordTime:%s'%(dataList[0],dataList[1]));
self.__logger.info(f'Name:{dataList[0]}\nRecordTime:{dataList[1]}');
self.avgDelay = dataList[2]
self.allKeys = dataList[3]
self.avgAcc = dataList[4]
Expand All @@ -277,7 +276,7 @@ def __init__(self, dataList,isHistory=False):
self.exCount = [0,0,0,0]
for ids in self.dataList:
ids = abs(ids)
if ids < 45:
if ids < 45:
if ids < 5:self.exCount[0] += 1
elif ids < 10:self.exCount[1] += 1
elif ids < 20:self.exCount[2] += 1
Expand All @@ -288,15 +287,14 @@ def __init__(self, dataList,isHistory=False):
else: self.sum[4] += 1
self.sum[0] = sum(self.exCount)
self.exCount = self.exCount + self.sum[1:]
self.__logger.debug("HitDelayDraw:",self.sum,self.exCount);
self.__logger.debug(f"HitDelayDraw: {self.sum}, {self.exCount}");

self.DrawLine();
if Config.DonutChartinHitDelay: self.DrawBarPie();
plt.show();

def DrawLine(self):
fig = plt.figure(f'AvgDelay: {"%.4fms"%self.avgDelay} ' \
f'AllKeys: {self.allKeys} AvgAcc: {"%.4fms"%self.avgAcc}',figsize=(9, 4))
fig = plt.figure(f'AvgDelay: {self.avgDelay:.4f}ms AllKeys: {self.allKeys} AvgAcc: {self.avgAcc:.4f}ms',figsize=(9, 4))
fig.clear()
fig.subplots_adjust(**{"left":0.045,"bottom":0.055,"right":1,"top":1})
ax = fig.add_subplot()
Expand Down
81 changes: 41 additions & 40 deletions MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,33 +163,6 @@ def __init__(self, root:Tk=None, isTKroot:bool=True):
self.TreeviewWidthUptate()
self.TreeviewColumnUpdate()

def CheckGameRunning(self):
logger:logging.Logger = Logger.GetLogger("MusyncSavDecodeGUI.CheckGameRunning")
logger.info("Start Thread: CheckGameIsStart.");
def UpdateUI(text:str, bg:str)->None:
self.isGameRunning["text"] = text;"游戏未启动";
self.isGameRunning["bg"] = bg;"#FF8080";
while self.checkGameStartEvent.is_set():
startTime = time.perf_counter_ns()
try:
for ids in psutil.pids():
if psutil.Process(pid=ids).name() == "MUSYNX.exe":
# Config["MainExecPath"]
self.root.after(100, UpdateUI("游戏已启动", "#98E22B"));
logger.debug("Game is Running.");
break;
else:
self.root.after(100, UpdateUI("游戏未启动", "#FF8080"));
logger.debug("Game is not Running.");
except RuntimeError:
pass
except Exception:
# logger.exception("CheckGameRunning has Exception: ");
pass
logger.info("CheckGameIsStart Run Time: %f ms"%((time.perf_counter_ns() - startTime)/1000000));
time.sleep(5);
logger.warning("Stop Thread: CheckGameIsStart.");

self.checkGameStartEvent.set();
self.checkGameIsStartThread:threading.Thread = threading.Thread(target=self.CheckGameRunning);
self.checkGameIsStartThread.start();
Expand Down Expand Up @@ -461,6 +434,7 @@ def DataLoad(self):
startTime = time.perf_counter_ns();
self.InitLabel(text="正在分析存档文件中……");
self.logger.debug("正在分析存档文件中……");
time.sleep(0.1);

def Rank(sync:int):
if (sync == 0) : return "";
Expand All @@ -473,22 +447,22 @@ def Rank(sync:int):
else : return "黑Ex";

# songNameJson = SongName.SongNameData();
self.root.title(f'同步音律喵赛克Steam端本地存档分析 LastPlay: {SaveDataInfo.selectSongName}')
[self.saveData.delete(ids) for ids in self.saveData.get_children()]
self.saveCount = 0
self.totalSync = 0
self.root.title(f'同步音律喵赛克Steam端本地存档分析 LastPlay: {SaveDataInfo.selectSongName}');
[self.saveData.delete(ids) for ids in self.saveData.get_children()];
self.saveCount = 0;
self.totalSync = 0;
for saveInfo in SaveDataInfo.saveInfoList:
# 无名谱面筛选
if saveInfo.SongName is None: continue;
# 键数筛选
if ((self.keys != KeysEnum.All) and (self.keys.text != saveInfo.SongKeys)): continue;
if ((self.keys != KeysEnum.All) and (self.keys.stext != saveInfo.SongKeys)): continue;
# 难度筛选
if (self.difficute != DiffcuteEnum.All) and (self.difficute.text != saveInfo.SongDifficulty): continue;
if (self.difficute != DiffcuteEnum.All) and (self.difficute.stext != saveInfo.SongDifficulty): continue;
# 内置曲目筛选
if ((self.songSelect != SongSelectEnum.All) and (saveInfo.SongIsBuiltin != (self.songSelect == SongSelectEnum.Builtin))): continue;
# 互斥筛选
if (self.dataSelectMethod == "Played"):
if ((saveInfo.PlayCount == 0) or (saveInfo.SyncNumber == 0)): continue;
if ((saveInfo.PlayCount == 0) and (saveInfo.SyncNumber == 0)): continue;
elif (self.dataSelectMethod == "Unplay"):
if ((saveInfo.PlayCount != 0) or (saveInfo.SyncNumber != 0)): continue;
elif (self.dataSelectMethod == "IsFav"):
Expand Down Expand Up @@ -532,6 +506,33 @@ def Rank(sync:int):
self.UpdateWindowInfo()

# 控件更新功能组
def CheckGameRunning(self):
logger:logging.Logger = Logger.GetLogger("MusyncSavDecodeGUI.CheckGameRunning")
logger.info("Start Thread: CheckGameIsStart.");
def UpdateUI(text:str, bg:str)->None:
self.isGameRunning["text"] = text;"游戏未启动";
self.isGameRunning["bg"] = bg;"#FF8080";
while self.checkGameStartEvent.is_set():
startTime = time.perf_counter_ns()
try:
for ids in psutil.pids():
if psutil.Process(pid=ids).name() == "MUSYNX.exe":
# Config["MainExecPath"]
self.root.after(100, UpdateUI("游戏已启动", "#98E22B"));
logger.debug("Game is Running.");
break;
else:
self.root.after(100, UpdateUI("游戏未启动", "#FF8080"));
logger.debug("Game is not Running.");
except RuntimeError:
pass
except Exception:
# logger.exception("CheckGameRunning has Exception: ");
pass
logger.info("CheckGameIsStart Run Time: %f ms"%((time.perf_counter_ns() - startTime)/1000000));
time.sleep(5);
logger.warning("Stop Thread: CheckGameIsStart.");

def TreeviewColumnUpdate(self):
self.saveData.heading("SongId",anchor="center",text="谱面号"+(('⇓' if self.dataSortMethodsort[1] else '⇑') if self.dataSortMethodsort[0]=='SpeedStall' else ''))
self.saveData.heading("SongName",anchor="center",text="曲名"+(('⇓' if self.dataSortMethodsort[1] else '⇑') if self.dataSortMethodsort[0]=='SongName' else ''))
Expand Down Expand Up @@ -569,7 +570,7 @@ def UpdateWindowInfo(self,event=None):
self.saveInfoScroll.place(x=self.windowInfo[2]-22, y=1, width=20, height=self.windowInfo[3]-162)
# self.saveCountVar.set()
self.saveCountLabel.configure(text=str(self.saveCount+self.excludeCount))
self.avgSyncLabel.configure(text=f'{(self.totalSync / (1 if self.saveCount==0 else self.saveCount)):.6f}%')
self.avgSyncLabel.configure(text=f'{(self.totalSync * 100 / (1 if self.saveCount==0 else self.saveCount)):.6f}%')
self.developer.place(x=0,y=self.windowInfo[3]-30,width=420,height=30)
self.gitHubLink.place(x=420,y=self.windowInfo[3]-30,width=self.windowInfo[2]-420,height=30)

Expand All @@ -585,19 +586,19 @@ def UpdateWindowInfo(self,event=None):

def UpdateEnum(self)->None:
DiffcuteEnum.Easy.text = "简单难度";
DiffcuteEnum.Easy.stext = "EZ";
DiffcuteEnum.Easy.stext = "Easy";
DiffcuteEnum.Hard.text = "困难难度";
DiffcuteEnum.Hard.stext = "HD";
DiffcuteEnum.Hard.stext = "Hard";
DiffcuteEnum.Inferno.text = "地狱难度";
DiffcuteEnum.Inferno.stext = "IN";
DiffcuteEnum.Inferno.stext = "Inferno";
DiffcuteEnum.All.text = "所有难度";
DiffcuteEnum.All.stext = "ALL";

KeysEnum.Key4.text = "4 Key";
KeysEnum.Key4.stext = "4K";
KeysEnum.Key4.stext = "4Key";
KeysEnum.Key4.width = 72;
KeysEnum.Key6.text = "6 Key";
KeysEnum.Key6.stext = "6K";
KeysEnum.Key6.stext = "6Key";
KeysEnum.All.text = "4&6 Key";
KeysEnum.All.stext = "ALL";

Expand Down
6 changes: 3 additions & 3 deletions Push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ echo ======Release======;
echo $message[-1];
echo ===================;
if ($message[-1].Trim() -eq 'rc'){
$version = (py -c "import Version;print(Version.version)");
$version = (py -c "import Version;print(Version.version);");
$release = 'Release';
}elseif($message[-1].Trim() -eq 'pre'){
$version = (py -c "import Version;print(Version.preVersion)");
$version = (py -c "import Version;print(Version.preVersion);");
$release = 'PreRelease';
}else{
$version = (py -c "import Version;print(Version.preVersion)");
$version = (py -c "import Version;print(Version.preVersion);");
$release = '[no ci]';
}
if ($message[0].Trim() -eq ""){
Expand Down
6 changes: 3 additions & 3 deletions Resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def CompressLogFile()->None:
__logger.info(f"file: \"{__filePath}\" loaded.");

Version:str = __config.get("Version" , None);
LoggerFilterString:str = __config.get("LoggerFilterString" , "INFO");
LoggerFilterString:str = __config.get("LoggerFilterString" , "DEBUG");
LoggerFilter:int = __logLevelMapping.get(LoggerFilterString , logging.DEBUG);
Acc_Sync:bool = __config.get("Acc_Sync" , False);
CheckUpdate:bool = __config.get("CheckUpdate" , True);
Expand Down Expand Up @@ -153,7 +153,7 @@ def SaveConfig(cls) -> None:
# 保存为 JSON 文件
try:
with open(cls.__filePath, 'w', encoding='utf8') as configFile:
json.dump(config_data, configFile, ensure_ascii=False, indent=4);
json.dump(config_data, configFile, ensure_ascii=False, indent=2);
cls.__logger.info(f"Configuration saved to \"{cls.__filePath}\" successfully.");
except Exception as e:
cls.__logger.exception(f"Failed to save configuration to \"{cls.__filePath}\": {e}");
Expand Down Expand Up @@ -491,7 +491,7 @@ def DumpToJson(cls)->None:
filePath:str = ".\\musync_data\\SaveDataInfo.json";
try:
with open(filePath, "w", encoding="utf-8") as json_file:
json.dump(dataDict, json_file, indent=4, ensure_ascii=False)
json.dump(dataDict, json_file, ensure_ascii=False, indent=2)
cls.__logger.info(f"Data successfully saved to {filePath}")
except Exception:
cls.__logger.exception(f"Failed to save data to {filePath}")
4 changes: 2 additions & 2 deletions Version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = '2.0.0rc1'
isPreRelease = True
preVersion = "2.0.0pre6"
# isPreRelease = False
preVersion = "2.0.0pre7"
isPreRelease = False
2 changes: 1 addition & 1 deletion buildLauncher.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Write-Host "====
# Write-Host "已删除目录:./MusyncSaveDecode" -ForegroundColor Yellow;

# Step 1: 编译图标资源
BuildIcon;
# BuildIcon;

# Step 2: 检查构建目录
# CheckDir -Dir "MusyncSaveDecode/";
Expand Down
Binary file modified musync_data/Resources.bin
Binary file not shown.
Loading

0 comments on commit 525ebab

Please # to comment.