fix: don't store SortByInternal in db

This commit is contained in:
あかニャン 2024-08-30 17:20:26 +00:00
parent ebb78efcde
commit ca15fac6a1
3 changed files with 26 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net35</TargetFramework> <TargetFramework>net35</TargetFramework>
<Company>7EVENDAYS⇔HOLIDAYS</Company> <Company>7EVENDAYS⇔HOLIDAYS</Company>
<Version>2.3.0</Version> <Version>2.3.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>

View File

@ -0,0 +1,20 @@
using MU3.Client;
using MU3.DB;
namespace MU3.User;
class patch_UserDetail: UserDetail {
public extern void orig_copyTo(UserData userDetail);
public new void copyTo(UserData userDetail) {
orig_copyTo(userDetail);
// Attempting to use a profile with InternalLevel sorting enabled
// causes unpatched clients to crash thanks to enormous incompetence
// of Sxga's interns. So, unfortunately, this value has to be discarded.
// See:
// * MusicSelectViewDataList._sort1 set
// * UserDetail.copyFrom()
if(userDetail.tabSetting == (int)patch_MusicSort1ID.InternalLevel) {
userDetail.tabSetting = (int)patch_MusicSort1ID.Level;
}
}
}

View File

@ -15,6 +15,7 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
private CompareProc _compareProc1; private CompareProc _compareProc1;
private CompareProc _compareProc2; private CompareProc _compareProc2;
private GetCategoryNameProc _getCategoryNameProc; private GetCategoryNameProc _getCategoryNameProc;
private PropertyInfo _reMasterPi = null;
private extern void orig_set__sort1(MusicSort1ID value); private extern void orig_set__sort1(MusicSort1ID value);
private extern void orig_set__sort2(MusicSort2ID value); private extern void orig_set__sort2(MusicSort2ID value);
@ -36,19 +37,18 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
} }
} }
private PropertyInfo reMasterPi = null;
private bool isReMaster(Data.MusicData d) { private bool isReMaster(Data.MusicData d) {
// Fall back for pre-Act3 // Fall back for pre-Act3
if(reMasterPi == null) { if(_reMasterPi == null) {
return false; return false;
} }
return (bool)reMasterPi.GetValue(d, null); return (bool)_reMasterPi.GetValue(d, null);
} }
public extern void orig_create(GameViewData gameViewData, ChapterSelection chapterSelection, FumenDifficulty difficulty, MusicSort1ID sort1, MusicSort2ID sort2); public extern void orig_create(GameViewData gameViewData, ChapterSelection chapterSelection, FumenDifficulty difficulty, MusicSort1ID sort1, MusicSort2ID sort2);
public new void create(GameViewData gameViewData, ChapterSelection chapterSelection, FumenDifficulty difficulty, MusicSort1ID sort1, MusicSort2ID sort2) { public new void create(GameViewData gameViewData, ChapterSelection chapterSelection, FumenDifficulty difficulty, MusicSort1ID sort1, MusicSort2ID sort2) {
reMasterPi = typeof(Data.MusicData).GetProperty("isReMaster"); _reMasterPi = typeof(Data.MusicData).GetProperty("isReMaster");
orig_create(gameViewData, chapterSelection, difficulty, sort1, sort2); orig_create(gameViewData, chapterSelection, difficulty, sort1, sort2);
} }
@ -100,7 +100,7 @@ class patch_MusicSelectViewDataList: MusicSelectViewDataList {
private extern int orig_getMetaSortKey(MusicSelectViewData d, bool forCategorySort); private extern int orig_getMetaSortKey(MusicSelectViewData d, bool forCategorySort);
private int getMetaSortKey(MusicSelectViewData d, bool forCategorySort) { private int getMetaSortKey(MusicSelectViewData d, bool forCategorySort) {
if(reMasterPi == null) { if(_reMasterPi == null) {
return orig_getMetaSortKey(d, forCategorySort); return orig_getMetaSortKey(d, forCategorySort);
} }
var remas = isReMaster(d.musicViewData.data); var remas = isReMaster(d.musicViewData.data);