Skip to content

Commit

Permalink
1.2.6rc3 适配本体2024年04月30日劳动节更新,修复bug,优化执行 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ginsakura committed Apr 30, 2024
1 parent af36fc3 commit a2b781c
Show file tree
Hide file tree
Showing 14 changed files with 1,985 additions and 172 deletions.
2 changes: 1 addition & 1 deletion CSharp Code/GloHasConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace BMSLib
public static class GloHasConsole
{
static GloHasConsole(){}
public static int hasConsole = 1;
public static int hasConsole = 0;
}
}
74 changes: 18 additions & 56 deletions CSharp Code/JudgeGrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ public class JudgeGrade
{
public static void Reset()
{
JudgeGrade.baseAccuracy = 0f;
JudgeGrade.exAccuracy = 0f;
JudgeGrade.exactAccuracy = 0f;
JudgeGrade.greatAccuracy = 0f;
JudgeGrade.rightAccuracy = 0f;
JudgeGrade.TotalEx = 0;
JudgeGrade.TotalExact = 0;
JudgeGrade.TotalGreat = 0;
JudgeGrade.TotalRight = 0;
JudgeGrade.TotalMiss = 0;
JudgeGrade.TotalCombo = 0;
JudgeGrade.uploadScore = new float[6];
if (GloHasConsole.hasConsole == 1)
//JudgeGrade.baseAccuracy = 0f;
//JudgeGrade.exAccuracy = 0f;
//JudgeGrade.exactAccuracy = 0f;
//JudgeGrade.greatAccuracy = 0f;
//JudgeGrade.rightAccuracy = 0f;
//JudgeGrade.TotalEx = 0;
//JudgeGrade.TotalExact = 0;
//JudgeGrade.TotalGreat = 0;
//JudgeGrade.TotalRight = 0;
//JudgeGrade.TotalMiss = 0;
//JudgeGrade.TotalCombo = 0;
//JudgeGrade.uploadScore = new float[6];
if (GloHasConsole.hasConsole == 0)
{
new ConsoleWindow().Initialize();
Console.Title = "MUSYNX Delay";
Console.ForegroundColor = ConsoleColor.Red;
Console.BackgroundColor = ConsoleColor.White;
Console.SetWindowSize(30, 4);
GloHasConsole.hasConsole = 0;
GloHasConsole.hasConsole = 1;
}
Console.Clear();
JudgeGrade.ci.kD = 9999f;
Expand All @@ -35,53 +35,15 @@ public static void Reset()

public static int GetJudgeGrade(long knockDistance)
{
int result = -1;
bool flag = knockDistance < 0L;
//int result = -1;
//bool flag = knockDistance < 0L;
if (knockDistance >= -1500000L)
{
JudgeGrade.ci.kD = (float)knockDistance / 10000f;
JudgeGrade.ci.OnEnter();
}
knockDistance = Math.Abs(knockDistance);
if (knockDistance < 450000L)
{
result = 0;
JudgeGrade.baseAccuracy += 1f;
JudgeGrade.exAccuracy += 0.05f + 0.1f * (1f - (float)knockDistance / 450000f);
JudgeGrade.exactAccuracy += 1f;
JudgeGrade.TotalEx++;
JudgeGrade.TotalExact++;
}
else if (knockDistance < 900000L)
{
result = 1;
JudgeGrade.baseAccuracy += 1f;
JudgeGrade.exactAccuracy += 1f;
JudgeGrade.TotalExact++;
}
else if (knockDistance < 1500000L)
{
result = 2;
JudgeGrade.baseAccuracy += 0.7f + 0.2f * (1f - (float)(knockDistance - 900000L) / 600000f);
JudgeGrade.greatAccuracy += 0.7f + 0.2f * (1f - (float)(knockDistance - 900000L) / 600000f);
JudgeGrade.TotalGreat++;
}
else if (knockDistance < 2500000L)
{
if (!flag)
{
result = 3;
JudgeGrade.baseAccuracy += 0.1f + 0.5f * (1f - (float)(knockDistance - 900000L) / 1600000f);
JudgeGrade.rightAccuracy += 0.1f + 0.5f * (1f - (float)(knockDistance - 900000L) / 1600000f);
JudgeGrade.TotalRight++;
}
}
else if (!flag)
{
result = 4;
JudgeGrade.TotalMiss++;
}
return result;
// knockDistance = Math.Abs(knockDistance);
// if (knockDistance < 450000L){}
}
public static ConsoleInput ci = new ConsoleInput();
}
Expand Down
10 changes: 5 additions & 5 deletions FileExport.py

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ def CheckFileBeforeStarting(fonts):
json.dump({"DisableCheckUpdate": False,"EnableDLLInjection": False},
open('./musync_data/ExtraFunction.cfg','w'),indent="",ensure_ascii=False)
if not '霞鹜文楷等宽' in fonts:
if os.path.isfile('./musync_data/LXGW.ttf'):
os.system(f'{os.getcwd()}/musync_data/LXGW.ttf')
else:
if not os.path.isfile('./musync_data/LXGW.ttf'):
FileExport.WriteTTF()
os.system(f'{os.getcwd()}/musync_data/LXGW.ttf')
os.system(f'{os.getcwd()}/musync_data/LXGW.ttf')
if not os.path.exists("./skin/"):
os.makedirs('./skin/')
if (not os.path.isfile('./musync_data/HitDelayHistory_v2.db')) and os.path.isfile('./musync_data/HitDelayHistory.db'):
Expand Down
2 changes: 1 addition & 1 deletion HitDelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self):
self.DLLCheck()

def DLLCheck(self):
# 'D41D8CD98F00B204E9800998ECF8427E' is 0B file
# 'D41D8CD98F00B204E9800998ECF8427E' is a Null file
with open(self.spfr,'rb') as spfrb:
md5o = md5(spfrb.read()).hexdigest().upper()
if (md5o != "D41D8CD98F00B204E9800998ECF8427E") and (md5o == self.md5o) and (not md5o == self.md5l):
Expand Down
2 changes: 1 addition & 1 deletion How_to_use.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

⑦ 通过下方筛选过的谱面计算综合同步率

⑧ 游戏启动监测,游戏启动时回自动变成绿色,红色时点击可通过steam接口(`steam://rungameid/952040`)启动游戏
⑧ 游戏启动监测,游戏启动时会自动变成绿色,红色时点击可通过steam接口(`steam://rungameid/952040`)启动游戏

⑨ 成绩分布窗口,使用matlablib绘制,通过读取存档内所有谱面的成绩生成散点图,通过散点计算平均值折线图

Expand Down
37 changes: 31 additions & 6 deletions MainWindowOldStyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fixed_map(option):
self.avgSyncVar.set(f'{(self.totalSync / (1 if self.saveCount==0 else self.saveCount))}')
self.dataSortMethodsort = [None,True]
self.dataSelectMethod = None
self.treeviewColumns = ["SpeedStall",'SongName',"Keys","Difficulty","DifficultyNumber","SyncNumber","Rank","UploadScore","PlayCount","IsFav"]
self.treeviewColumns = ["SpeedStall",'SongName',"Keys","Difficulty","DifficultyNumber","SyncNumber","Rank","UploadScore","PlayCount","Status"]
self.difficute = 3
self.keys = 0
self.isDLC = 0
Expand Down Expand Up @@ -192,12 +192,12 @@ def CheckGameIsStart():
print("CheckGameIsStart Run Time: %f ms"%((endTime - startTime)/1000000))
time.sleep(5)
threading.Thread(target=CheckGameIsStart).start()
threading.Thread(target=self.CheckJsonUpdate).start()

if self.config['DisableCheckUpdate']:
self.gitHubLink.configure(text='更新已禁用 点击打开GitHub仓库页')
else:
threading.Thread(target=self.CheckUpdate).start()
# threading.Thread(target=self.CheckJsonUpdate).start()
if not os.path.isfile('./musync_data/SaveFilePath.sfp'):
self.GetSaveFile()
else:
Expand Down Expand Up @@ -360,6 +360,8 @@ def CheckJsonUpdate(self):
githubVersion = response.content.decode('utf8')
with open("./musync_data/SongName.update",'r',encoding='utf8') as snju:
localVersion = snju.read()
print(f" Local Json Version: {localVersion}")
print(f" Terget Json Version: {githubVersion}")
if githubVersion>localVersion:
response = requests.get("https://raw.githubusercontent.com/Ginsakura/MUSYNCSave/main/musync_data/songname.json")
songNameJson = response.json()
Expand All @@ -369,6 +371,7 @@ def CheckJsonUpdate(self):
snju.write(githubVersion)
except Exception as e:
messagebox.showerror("Error", f'发生错误: {e}')
messagebox.showerror("Error", f'若游戏本体已更新,请访问仓库更新songname.update和songname.json两个文件')
endTime = time.perf_counter_ns()
print("CheckJsonUpdate Run Time: %f ms"%((endTime - startTime)/1000000))

Expand Down Expand Up @@ -501,7 +504,7 @@ def Rank(sync):
elif self.dataSelectMethod == "Unplay":
if not ((saveLine["PlayCount"] == 0) and (float(saveLine["SyncNumber"][0:-1]) == 0)):continue
elif self.dataSelectMethod == "IsFav":
if saveLine["IsFav"] == '0x00':continue
if saveLine["Status"] != 'Favo':continue
elif self.dataSelectMethod == "Sync122":
if float(saveLine["SyncNumber"][0:-1]) < 122:continue
elif self.dataSelectMethod == "Sync120":
Expand All @@ -525,7 +528,7 @@ def Rank(sync):
("" if saveLine["SongName"] is None else ("" if saveLine["SongName"][3]=="00" else saveLine["SongName"][3])), #等级
saveLine["SyncNumber"], #本地同步率
("" if ((saveLine["PlayCount"] == 0) and (saveLine["UploadScore"] == "0.00000000000000%")) else Rank(saveLine["SyncNumber"])), #Rank
saveLine["UploadScore"], saveLine["PlayCount"], saveLine["IsFav"]))
saveLine["UploadScore"], saveLine["PlayCount"], saveLine["Status"]))
# print(songNameJson["NotDLCSong"])
if not self.dataSortMethodsort[0] is None:
self.SortClick(self.dataSortMethodsort)
Expand All @@ -545,7 +548,7 @@ def TreeviewColumnUpdate(self):
self.saveData.heading("Rank",anchor="center",text="Rank"+(('⇓' if self.dataSortMethodsort[1] else '⇑') if self.dataSortMethodsort[0]=='Rank' else ''))
self.saveData.heading("UploadScore",anchor="center",text="云端同步率"+(('⇓' if self.dataSortMethodsort[1] else '⇑') if self.dataSortMethodsort[0]=='UploadScore' else ''))
self.saveData.heading("PlayCount",anchor="center",text="游玩计数"+(('⇓' if self.dataSortMethodsort[1] else '⇑') if self.dataSortMethodsort[0]=='PlayCount' else ''))
self.saveData.heading("IsFav",anchor="center",text="IsFav"+(('⇓ ' if self.dataSortMethodsort[1] else '⇑ ') if self.dataSortMethodsort[0]=='IsFav' else ' '))
self.saveData.heading("Status",anchor="center",text="Status"+(('⇓ ' if self.dataSortMethodsort[1] else '⇑ ') if self.dataSortMethodsort[0]=='Status' else ' '))
self.root.update()

def TreeviewWidthUptate(self):
Expand All @@ -558,7 +561,7 @@ def TreeviewWidthUptate(self):
self.saveData.column("Rank",anchor="center",width=55)
self.saveData.column("UploadScore",anchor="e",width=160)
self.saveData.column("PlayCount",anchor="e",width=90)
self.saveData.column("IsFav",anchor="w",width=80)
self.saveData.column("Status",anchor="w",width=80)

def UpdateWindowInfo(self):

Expand Down Expand Up @@ -626,3 +629,25 @@ def UpdateWindow(self):
self.globalSync.heading("SyncNumber",anchor="center",text="同步率")

self.VScroll.place(x=self.windowInfo[2]-40, y=1, width=20, relheight=1)


if __name__ == '__main__':
version = '1.2.6rc3'
isPreRelease = True
preVersion = "1.2.6pre7"

root = Tk()
ctypes.windll.shcore.SetProcessDpiAwareness(1)
fonts = list(font.families())
Functions.CheckFileBeforeStarting(fonts)
del fonts
Functions.CheckConfig()
with open('./musync_data/ExtraFunction.cfg','r',encoding='utf8') as cfg:
cfg = json.load(cfg)
if cfg['ChangeConsoleStyle']:
Functions.ChangeConsoleStyle()
root.tk.call('tk', 'scaling', 1.25)
root.resizable(False, True) #允许改变窗口高度,不允许改变窗口宽度
window = MusyncSavDecodeGUI(root=root,version=version,preVersion=preVersion,isPreRelease=isPreRelease)
root.update()
root.mainloop()
40 changes: 24 additions & 16 deletions MusyncSavDecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def SaveFileAnalyze(self):
self.SaveAnalyzeFileWrite(self.saveData[136:162].decode()) #'<PlayCount>k__BackingField'
self.SaveAnalyzeFileWrite(self.saveData[163:185].decode()) #'<Isfav>k__BackingField'
self.SaveBinFileRead(37)
self.SaveAnalyzeFileWrite('| SongID | Unknown0 | SpeedStall | Unknown1 | SyncNumber | UploadScore | PlayCount | IsFav |')
self.SaveAnalyzeFileWrite('| SongID | Unknown0 | SpeedStall | Unknown1 | SyncNumber | UploadScore | PlayCount | statu |')
self.Analyze2Json()
self.savBinFile.close()
self.savAnalyzeFile.close()
Expand Down Expand Up @@ -153,35 +153,43 @@ def OldAprilFoolsDay(ss):
UploadScore = unpack('<f',bytes.fromhex(self.Bytes2HexString(self.saveData[20:24])))[0]
PlayCount = int.from_bytes(self.saveData[24:28], 'little')

if self.saveData[28]==1:
statu = "Favo"
# FavSong.write(songName[0]+"\n")
self.FavSong.append(songName[0])
else:
statu = ' '

if NoCopyright(SpeedStall):
print(SpeedStall,"NoCopyright")
continue
statu = "NoCR"
if OldAprilFoolsDay(SpeedStall):
print(SpeedStall,'OldAprilFoolsDay')
continue
statu = "Fool"
songName = GetSongName(SpeedStall)
if songName is None:
self.SaveAnalyzeFileWrite(SpeedStall+' ,No Name')
continue
statu = "NoName"

if self.saveData[28]==1:
IsFav = '0x01'
# FavSong.write(songName[0]+"\n")
self.FavSong.append(songName[0])
else:
IsFav = '0x00'
if len(SyncNumber) == 5:SyncNumber = f'{SyncNumber[0:3]}.{SyncNumber[3:]}%'
elif len(SyncNumber) == 4:SyncNumber = f'{SyncNumber[0:2]}.{SyncNumber[2:]}%'
elif len(SyncNumber) == 3:SyncNumber = f'{SyncNumber[0]}.{SyncNumber[1:]}%'
elif len(SyncNumber) == 2:SyncNumber = f'0.{SyncNumber}%'
else:SyncNumber = f'0.0{SyncNumber}%'

UploadScore = UploadScore*100
if UploadScore == 0:UploadScore = '0.00000000000000%'
elif UploadScore < 10:UploadScore = ZeroFormat(UploadScore,16) #'%.16f%%'%UploadScore
elif UploadScore < 100:UploadScore = ZeroFormat(UploadScore,17)
else:UploadScore = ZeroFormat(UploadScore,18)
self.SaveAnalyzeFileWrite(f'| {" "*(6-len(str(SongID)))}{SongID} | {Unknown0} | {SpeedStall} | {Unknown1} | {" "*(7-len(SyncNumber))}{SyncNumber} | {" "*(19-len(UploadScore))}{UploadScore} | {" "*(9-len(str(PlayCount)))}{PlayCount} | {IsFav} |')
saveDataAnalyzeJson["SaveData"].append(dict(SpeedStall=SpeedStall,SongName=songName,SyncNumber=SyncNumber,UploadScore=UploadScore,PlayCount=PlayCount,IsFav=IsFav))

self.SaveAnalyzeFileWrite(f'| {" "*(6-len(str(SongID)))}{SongID} | {Unknown0} | {SpeedStall} | {Unknown1} | {" "*(7-len(SyncNumber))}{SyncNumber} | {" "*(19-len(UploadScore))}{UploadScore} | {" "*(9-len(str(PlayCount)))}{PlayCount} | {statu:^6} |')
if statu == 'NoName': continue
saveDataAnalyzeJson["SaveData"].append(dict(
SpeedStall=SpeedStall,
SongName=songName,
SyncNumber=SyncNumber,
UploadScore=UploadScore,
PlayCount=PlayCount,
Status=statu
))
json.dump(saveDataAnalyzeJson,saveDataAnalyze,indent="",ensure_ascii=False)
saveDataAnalyze.close()
# FavSong.close()
Expand All @@ -204,7 +212,7 @@ def FavFix(self):
print(f"Favorites List:{self.FavSong}")
for ids in range(len(saveJsonFavFix["SaveData"])):
if saveJsonFavFix["SaveData"][ids]["SongName"][0] in self.FavSong:
saveJsonFavFix["SaveData"][ids]["IsFav"] = "0x01"
saveJsonFavFix["SaveData"][ids]["statu"] = "Favo"
json.dump(saveJsonFavFix,saveJsonFile,indent="",ensure_ascii=False)
saveJsonFile.close()
endTime = time.perf_counter_ns()
Expand Down
Loading

0 comments on commit a2b781c

Please sign in to comment.