mirror of
https://git.chinosk6.cn/chinosk/gkms-local.git
synced 2026-02-04 09:04:52 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c50fdfd678 | ||
|
|
3c1d1f139a | ||
|
|
6ac94178fa | ||
|
|
c27085772f | ||
|
|
361c48e2c9 | ||
|
|
e9ba8b58fd | ||
|
|
e03736bd7d |
@@ -15,8 +15,8 @@ android {
|
||||
applicationId "io.github.chinosk.gakumas.localify"
|
||||
minSdk 29
|
||||
targetSdk 34
|
||||
versionCode 4
|
||||
versionName "v1.6.5"
|
||||
versionCode 5
|
||||
versionName "v1.6.8"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@@ -466,12 +466,186 @@ namespace GakumasLocal::HookMain {
|
||||
// return UnityResolve::UnityType::String::New("[I18]" + ret->ToString());
|
||||
}
|
||||
|
||||
DEFINE_HOOK(void, PictureBookLiveThumbnailView_SetData, (void* self, void* liveData, bool isUnlocked, bool isNew, void* ct, void* mtd)) {
|
||||
// Log::DebugFmt("PictureBookLiveThumbnailView_SetData: isUnlocked: %d, isNew: %d", isUnlocked, isNew);
|
||||
/*
|
||||
DEFINE_HOOK(void*, UserDataManagerBase_get__userIdolCardSkinList, (void* self, void* mtd)) { // Live默认选择
|
||||
auto ret = UserDataManagerBase_get__userIdolCardSkinList_Orig(self, mtd);
|
||||
Log::DebugFmt("UserDataManagerBase_get__userIdolCardSkinList: %p", ret);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_HOOK(void*, UserDataManagerBase_get__userCostumeList, (void* self, void* mtd)) { // 服装选择界面
|
||||
auto ret = UserDataManagerBase_get__userCostumeList_Orig(self, mtd);
|
||||
Log::DebugFmt("UserDataManagerBase_get__userCostumeList: %p", ret);
|
||||
return ret;
|
||||
}
|
||||
DEFINE_HOOK(void*, UserDataManagerBase_get__userCostumeHeadList, (void* self, void* mtd)) { // 服装选择界面
|
||||
auto ret = UserDataManagerBase_get__userCostumeHeadList_Orig(self, mtd);
|
||||
Log::DebugFmt("UserDataManagerBase_get__userCostumeHeadList: %p", ret);
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
DEFINE_HOOK(bool, UserIdolCardSkinCollection_Exists, (void* self, Il2cppString* id, void* mtd)) { // Live默认选择
|
||||
auto ret = UserIdolCardSkinCollection_Exists_Orig(self, id, mtd);
|
||||
// Log::DebugFmt("UserIdolCardSkinCollection_Exists: %s, ret: %d", id->ToString().c_str(), ret);
|
||||
if (!Config::unlockAllLive) return ret;
|
||||
|
||||
if (id) {
|
||||
std::string idStr = id->ToString();
|
||||
if (idStr.starts_with("music") || idStr.starts_with("i_card-skin")) { // eg. music-all-kllj-006, i_card-skin-hski-3-002
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DEFINE_HOOK(void, PictureBookLiveThumbnailView_SetDataAsync, (void* self, void* liveData, bool isReleased, bool isUnlocked, bool isNew, bool hasLiveSkin, void* ct, void* mtd)) {
|
||||
// Log::DebugFmt("PictureBookLiveThumbnailView_SetDataAsync: isReleased: %d, isUnlocked: %d, isNew: %d, hasLiveSkin: %d", isReleased, isUnlocked, isNew, hasLiveSkin);
|
||||
if (Config::dbgMode && Config::unlockAllLive) {
|
||||
isUnlocked = true;
|
||||
isReleased = true;
|
||||
hasLiveSkin = true;
|
||||
}
|
||||
PictureBookLiveThumbnailView_SetData_Orig(self, liveData, isUnlocked, isNew, ct, mtd);
|
||||
PictureBookLiveThumbnailView_SetDataAsync_Orig(self, liveData, isReleased, isUnlocked, isNew, hasLiveSkin, ct, mtd);
|
||||
}
|
||||
|
||||
enum class GetIdolIdType {
|
||||
MusicId,
|
||||
CostumeId,
|
||||
CostumeHeadId
|
||||
};
|
||||
|
||||
std::vector<std::string> GetIdolMusicIdAll(const std::string& charaNameId = "", GetIdolIdType getType = GetIdolIdType::MusicId) {
|
||||
// 传入例: fktn
|
||||
// System.Collections.Generic.List`1<valuetype [mscorlib]System.ValueTuple`2<class Campus.Common.Proto.Client.Master.IdolCardSkin, class Campus.Common.Proto.Client.Master.Music>>
|
||||
static auto get_IdolCardSkinMaster = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Master", "MasterManager", "get_IdolCardSkinMaster");
|
||||
static auto Master_GetAllWithSortByKey = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Master", "IdolCardSkinMaster", "GetAllWithSortByKey");
|
||||
static auto IdolCardSkin_get_Id = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Master", "IdolCardSkin", "get_Id");
|
||||
static auto IdolCardSkin_get_IdolCardId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Master", "IdolCardSkin", "get_IdolCardId");
|
||||
static auto IdolCardSkin_GetMusic = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Master", "IdolCardSkin", "GetMusic");
|
||||
static auto IdolCardSkin_get_MusicId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Master", "IdolCardSkin", "get_MusicId");
|
||||
static auto IdolCardSkin_get_CostumeId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Master", "IdolCardSkin", "get_CostumeId");
|
||||
static auto IdolCardSkin_get_CostumeHeadId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Master", "IdolCardSkin", "get_CostumeHeadId");
|
||||
static auto GetLiveMusics = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.OutGame",
|
||||
"PictureBookWindowPresenter", "GetLiveMusics");
|
||||
|
||||
auto idolCardSkinMaster = get_IdolCardSkinMaster->Invoke<void*>(nullptr); // IdolCardSkinMaster
|
||||
|
||||
std::vector<std::string> ret{};
|
||||
|
||||
if (!idolCardSkinMaster) {
|
||||
Log::ErrorFmt("get_IdolCardSkinMaster failed: %p", idolCardSkinMaster);
|
||||
return ret;
|
||||
}
|
||||
// List<IdolCardSkin>
|
||||
auto idolCardSkinList = Master_GetAllWithSortByKey->Invoke<UnityResolve::UnityType::List<void*>*>(idolCardSkinMaster, 0x0, nullptr);
|
||||
|
||||
auto idolCardSkins = idolCardSkinList->ToArray()->ToVector();
|
||||
const auto checkStartCharaId = "i_card-" + charaNameId;
|
||||
// Log::DebugFmt("checkStartCharaId: %s", checkStartCharaId.c_str());
|
||||
|
||||
// origMusics->Clear();
|
||||
UnityResolve::Method* idGetFunc = nullptr;
|
||||
switch (getType) {
|
||||
case GetIdolIdType::MusicId: idGetFunc = IdolCardSkin_get_MusicId;
|
||||
break;
|
||||
case GetIdolIdType::CostumeId: idGetFunc = IdolCardSkin_get_CostumeId;
|
||||
break;
|
||||
case GetIdolIdType::CostumeHeadId: idGetFunc = IdolCardSkin_get_CostumeHeadId;
|
||||
break;
|
||||
default:
|
||||
idGetFunc = IdolCardSkin_get_MusicId;
|
||||
}
|
||||
|
||||
for (auto i : idolCardSkins) {
|
||||
if (!i) continue;
|
||||
// auto charaId = IdolCardSkin_get_Id->Invoke<Il2cppString*>(i);
|
||||
auto targetId = idGetFunc->Invoke<Il2cppString*>(i);
|
||||
auto cardId = IdolCardSkin_get_IdolCardId->Invoke<Il2cppString*>(i)->ToString();
|
||||
auto music = IdolCardSkin_GetMusic->Invoke<void*>(i);
|
||||
|
||||
if (charaNameId.empty() || cardId.starts_with(checkStartCharaId)) {
|
||||
std::string musicIdStr = targetId->ToString();
|
||||
// Log::DebugFmt("Add cardId: %s, musicId: %s", cardId.c_str(), musicIdStr.c_str());
|
||||
if (std::find(ret.begin(), ret.end(), musicIdStr) == ret.end()) {
|
||||
ret.emplace_back(musicIdStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void* AddIdsToUserDataCollectionFromMaster(void* origList, std::vector<std::string>& allIds,
|
||||
UnityResolve::Method* get_CostumeId, UnityResolve::Method* set_CostumeId, UnityResolve::Method* Clone) {
|
||||
std::unordered_set<std::string> existIds{};
|
||||
Il2cppUtils::Tools::CSListEditor listEditor(origList);
|
||||
if (listEditor.get_Count() <= 0) {
|
||||
return origList;
|
||||
}
|
||||
|
||||
for (auto i : listEditor) {
|
||||
auto costumeId = get_CostumeId->Invoke<Il2cppString*>(i);
|
||||
if (!costumeId) continue;
|
||||
existIds.emplace(costumeId->ToString());
|
||||
}
|
||||
|
||||
for (auto& i : allIds) {
|
||||
if (i.empty()) continue;
|
||||
// Log::DebugFmt("Try add %s", i.c_str());
|
||||
if (existIds.contains(i)) continue;
|
||||
|
||||
auto userCostume = Clone->Invoke<void*>(listEditor.get_Item(0));
|
||||
set_CostumeId->Invoke<void>(userCostume, Il2cppString::New(i));
|
||||
listEditor.Add(userCostume);
|
||||
}
|
||||
return origList;
|
||||
}
|
||||
|
||||
DEFINE_HOOK(void*, UserCostumeCollection_FindBy, (void* self, void* predicate, void* mtd)) {
|
||||
auto ret = UserCostumeCollection_FindBy_Orig(self, predicate, mtd);
|
||||
if (!Config::unlockAllLiveCostume) return ret;
|
||||
|
||||
auto this_klass = Il2cppUtils::get_class_from_instance(self);
|
||||
// auto predicate_klass = Il2cppUtils::get_class_from_instance(predicate); // System::Predicate`1
|
||||
// Log::DebugFmt("UserCostumeCollection_FindBy this: %s::%s, predicate: %s::%s", this_klass->namespaze, this_klass->name,
|
||||
// predicate_klass->namespaze, predicate_klass->name);
|
||||
|
||||
static auto UserCostumeCollection_klass = Il2cppUtils::GetClass("Assembly-CSharp.dll", "Campus.Common.User",
|
||||
"UserCostumeCollection");
|
||||
static auto UserCostumeCollection_GetAllList_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(
|
||||
UserCostumeCollection_klass->address, "GetAllList", 1);
|
||||
static auto UserCostumeCollection_GetAllList = reinterpret_cast<void* (*)(void*, void*)>(UserCostumeCollection_GetAllList_mtd->methodPointer);
|
||||
|
||||
std::string thisKlassName(this_klass->name);
|
||||
// Campus.Common.User::UserCostumeHeadCollection || Campus.Common.User::UserCostumeCollection
|
||||
// 两个 class 的 GetAllList 均使用的父类 Qua.UserDataManagement.UserDataCollectionBase`2 的方法,地址一致
|
||||
if (thisKlassName == "UserCostumeHeadCollection") {
|
||||
static auto UserCostume_Clone = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostumeHead", "Clone");
|
||||
static auto UserCostume_get_CostumeHeadId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostumeHead", "get_CostumeHeadId");
|
||||
static auto UserCostume_set_CostumeHeadId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostumeHead", "set_CostumeHeadId");
|
||||
|
||||
// auto ret_klass = Il2cppUtils::get_class_from_instance(ret); // WhereEnumerableIterator
|
||||
auto origList = UserCostumeCollection_GetAllList(self, nullptr);
|
||||
|
||||
auto allIds = GetIdolMusicIdAll("", GetIdolIdType::CostumeHeadId);
|
||||
|
||||
// List<Campus.Common.Proto.Client.Transaction.UserCostumeHead>
|
||||
return AddIdsToUserDataCollectionFromMaster(origList, allIds, UserCostume_get_CostumeHeadId, UserCostume_set_CostumeHeadId, UserCostume_Clone);
|
||||
}
|
||||
else if (thisKlassName == "UserCostumeCollection") {
|
||||
// static auto UserCostume_klass = Il2cppUtils::GetClass("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostume");
|
||||
static auto UserCostume_Clone = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostume", "Clone");
|
||||
static auto UserCostume_get_CostumeId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostume", "get_CostumeId");
|
||||
static auto UserCostume_set_CostumeId = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.Common.Proto.Client.Transaction", "UserCostume", "set_CostumeId");
|
||||
|
||||
// auto ret_klass = Il2cppUtils::get_class_from_instance(ret); // WhereEnumerableIterator
|
||||
auto origList = UserCostumeCollection_GetAllList(self, nullptr);
|
||||
|
||||
auto allIds = GetIdolMusicIdAll("", GetIdolIdType::CostumeId);
|
||||
|
||||
// List<Campus.Common.Proto.Client.Transaction.UserCostume>
|
||||
return AddIdsToUserDataCollectionFromMaster(origList, allIds, UserCostume_get_CostumeId, UserCostume_set_CostumeId, UserCostume_Clone);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void* PictureBookWindowPresenter_instance = nullptr;
|
||||
@@ -482,19 +656,44 @@ namespace GakumasLocal::HookMain {
|
||||
if (Config::unlockAllLive) {
|
||||
PictureBookWindowPresenter_instance = self;
|
||||
PictureBookWindowPresenter_charaId = charaId->ToString();
|
||||
|
||||
static auto PictureBookWindowPresenter_klass = Il2cppUtils::GetClass("Assembly-CSharp.dll", "Campus.OutGame",
|
||||
"PictureBookWindowPresenter");
|
||||
static auto existsMusicIds_field = PictureBookWindowPresenter_klass->Get<UnityResolve::Field>("_existsMusicIds");
|
||||
auto existsMusicIds = Il2cppUtils::ClassGetFieldValue<UnityResolve::UnityType::List<Il2cppString*>*>(self, existsMusicIds_field);
|
||||
|
||||
if (!existsMusicIds) {
|
||||
static auto List_String_klass = Il2cppUtils::get_system_class_from_reflection_type_str(
|
||||
"System.Collections.Generic.List`1[System.String]");
|
||||
static auto List_String_ctor_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(List_String_klass, ".ctor", 0);
|
||||
static auto List_String_ctor = reinterpret_cast<void (*)(void*, void*)>(List_String_ctor_mtd->methodPointer);
|
||||
|
||||
auto newList = UnityResolve::Invoke<void*>("il2cpp_object_new", List_String_klass);
|
||||
List_String_ctor(newList, List_String_ctor_mtd);
|
||||
Il2cppUtils::Tools::CSListEditor<Il2cppString*> newListEditor(newList);
|
||||
|
||||
auto fullIds = GetIdolMusicIdAll();
|
||||
|
||||
for (auto& i : fullIds) {
|
||||
// Log::DebugFmt("GetLiveMusics - Add: %s", i.c_str());
|
||||
newListEditor.Add(Il2cppString::New(i));
|
||||
}
|
||||
Il2cppUtils::ClassSetFieldValue(self, existsMusicIds_field, newList);
|
||||
// Log::DebugFmt("GetLiveMusics - set end: %d", fullIds.size());
|
||||
}
|
||||
}
|
||||
|
||||
return PictureBookWindowPresenter_GetLiveMusics_Orig(self, charaId, mtd);
|
||||
}
|
||||
|
||||
DEFINE_HOOK(void, PictureBookLiveSelectScreenModel_ctor, (void* self, void* transitionParam, void* musics, void* mtd)) {
|
||||
DEFINE_HOOK(void, PictureBookLiveSelectScreenModel_ctor, (void* self, void* transitionParam, UnityResolve::UnityType::List<void*>* musics, void* mtd)) {
|
||||
// Log::DebugFmt("PictureBookLiveSelectScreenModel_ctor");
|
||||
|
||||
if (Config::unlockAllLive) {
|
||||
static auto GetLiveMusics = Il2cppUtils::GetMethod("Assembly-CSharp.dll", "Campus.OutGame",
|
||||
"PictureBookWindowPresenter", "GetLiveMusics");
|
||||
if (PictureBookWindowPresenter_instance && !PictureBookWindowPresenter_charaId.empty()) {
|
||||
auto fullMusics = GetLiveMusics->Invoke<void*>(PictureBookWindowPresenter_instance,
|
||||
auto fullMusics = GetLiveMusics->Invoke<UnityResolve::UnityType::List<void*>*>(PictureBookWindowPresenter_instance,
|
||||
Il2cppString::New(PictureBookWindowPresenter_charaId));
|
||||
return PictureBookLiveSelectScreenModel_ctor_Orig(self, transitionParam, fullMusics, mtd);
|
||||
}
|
||||
@@ -936,9 +1135,45 @@ namespace GakumasLocal::HookMain {
|
||||
Il2cppUtils::GetMethodPointer("Octo.dll", "Octo",
|
||||
"OnDownloadProgress", "Invoke"));
|
||||
|
||||
ADD_HOOK(PictureBookLiveThumbnailView_SetData,
|
||||
/*
|
||||
auto UserDataManager_klass = Il2cppUtils::GetClass("Assembly-CSharp.dll", "Campus.Common.User",
|
||||
"UserDataManager");
|
||||
if (UserDataManager_klass) {
|
||||
auto UserDataManagerBase_klass = UnityResolve::Invoke<Il2cppUtils::Il2CppClassHead*>("il2cpp_class_get_parent", UserDataManager_klass->address);
|
||||
if (UserDataManagerBase_klass) {
|
||||
auto get_userIdolCardSkinList_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(UserDataManagerBase_klass, "get__userIdolCardSkinList", 0);
|
||||
if (get_userIdolCardSkinList_mtd) {
|
||||
ADD_HOOK(UserDataManagerBase_get__userIdolCardSkinList, get_userIdolCardSkinList_mtd->methodPointer);
|
||||
}
|
||||
auto get_userCostumeList_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(UserDataManagerBase_klass, "get__userCostumeList", 0);
|
||||
if (get_userCostumeList_mtd) {
|
||||
ADD_HOOK(UserDataManagerBase_get__userCostumeList, get_userCostumeList_mtd->methodPointer);
|
||||
}
|
||||
auto get_userCostumeHeadList_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(UserDataManagerBase_klass, "get__userCostumeHeadList", 0);
|
||||
if (get_userCostumeHeadList_mtd) {
|
||||
ADD_HOOK(UserDataManagerBase_get__userCostumeHeadList, get_userCostumeHeadList_mtd->methodPointer);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
auto UserIdolCardSkinCollection_klass = Il2cppUtils::GetClass("Assembly-CSharp.dll", "Campus.Common.User",
|
||||
"UserIdolCardSkinCollection");
|
||||
auto UserIdolCardSkinCollection_Exists_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(UserIdolCardSkinCollection_klass->address, "Exists", 1);
|
||||
if (UserIdolCardSkinCollection_Exists_mtd) {
|
||||
ADD_HOOK(UserIdolCardSkinCollection_Exists, UserIdolCardSkinCollection_Exists_mtd->methodPointer);
|
||||
}
|
||||
|
||||
auto UserCostumeCollection_klass = Il2cppUtils::GetClass("Assembly-CSharp.dll", "Campus.Common.User",
|
||||
"UserCostumeCollection");
|
||||
auto UserCostumeCollection_FindBy_mtd = Il2cppUtils::il2cpp_class_get_method_from_name(
|
||||
UserCostumeCollection_klass->address, "FindBy", 1);
|
||||
if (UserCostumeCollection_FindBy_mtd) {
|
||||
ADD_HOOK(UserCostumeCollection_FindBy, UserCostumeCollection_FindBy_mtd->methodPointer);
|
||||
}
|
||||
|
||||
ADD_HOOK(PictureBookLiveThumbnailView_SetDataAsync,
|
||||
Il2cppUtils::GetMethodPointer("Assembly-CSharp.dll", "Campus.OutGame.PictureBook",
|
||||
"PictureBookLiveThumbnailView", "SetDataAsync", {"*", "*", "*", "*"}));
|
||||
"PictureBookLiveThumbnailView", "SetDataAsync", {"*", "*", "*", "*", "*"}));
|
||||
ADD_HOOK(PictureBookWindowPresenter_GetLiveMusics,
|
||||
Il2cppUtils::GetMethodPointer("Assembly-CSharp.dll", "Campus.OutGame",
|
||||
"PictureBookWindowPresenter", "GetLiveMusics"));
|
||||
|
||||
@@ -36,6 +36,74 @@ namespace Il2cppUtils {
|
||||
uint8_t is_marshaled_from_native : 1;
|
||||
};
|
||||
|
||||
struct Il2CppObject
|
||||
{
|
||||
union
|
||||
{
|
||||
void* klass;
|
||||
void* vtable;
|
||||
};
|
||||
void* monitor;
|
||||
};
|
||||
|
||||
enum Il2CppTypeEnum
|
||||
{
|
||||
IL2CPP_TYPE_END = 0x00, /* End of List */
|
||||
IL2CPP_TYPE_VOID = 0x01,
|
||||
IL2CPP_TYPE_BOOLEAN = 0x02,
|
||||
IL2CPP_TYPE_CHAR = 0x03,
|
||||
IL2CPP_TYPE_I1 = 0x04,
|
||||
IL2CPP_TYPE_U1 = 0x05,
|
||||
IL2CPP_TYPE_I2 = 0x06,
|
||||
IL2CPP_TYPE_U2 = 0x07,
|
||||
IL2CPP_TYPE_I4 = 0x08,
|
||||
IL2CPP_TYPE_U4 = 0x09,
|
||||
IL2CPP_TYPE_I8 = 0x0a,
|
||||
IL2CPP_TYPE_U8 = 0x0b,
|
||||
IL2CPP_TYPE_R4 = 0x0c,
|
||||
IL2CPP_TYPE_R8 = 0x0d,
|
||||
IL2CPP_TYPE_STRING = 0x0e,
|
||||
IL2CPP_TYPE_PTR = 0x0f,
|
||||
IL2CPP_TYPE_BYREF = 0x10,
|
||||
IL2CPP_TYPE_VALUETYPE = 0x11,
|
||||
IL2CPP_TYPE_CLASS = 0x12,
|
||||
IL2CPP_TYPE_VAR = 0x13,
|
||||
IL2CPP_TYPE_ARRAY = 0x14,
|
||||
IL2CPP_TYPE_GENERICINST = 0x15,
|
||||
IL2CPP_TYPE_TYPEDBYREF = 0x16,
|
||||
IL2CPP_TYPE_I = 0x18,
|
||||
IL2CPP_TYPE_U = 0x19,
|
||||
IL2CPP_TYPE_FNPTR = 0x1b,
|
||||
IL2CPP_TYPE_OBJECT = 0x1c,
|
||||
IL2CPP_TYPE_SZARRAY = 0x1d,
|
||||
IL2CPP_TYPE_MVAR = 0x1e,
|
||||
IL2CPP_TYPE_CMOD_REQD = 0x1f,
|
||||
IL2CPP_TYPE_CMOD_OPT = 0x20,
|
||||
IL2CPP_TYPE_INTERNAL = 0x21,
|
||||
|
||||
IL2CPP_TYPE_MODIFIER = 0x40,
|
||||
IL2CPP_TYPE_SENTINEL = 0x41,
|
||||
IL2CPP_TYPE_PINNED = 0x45,
|
||||
|
||||
IL2CPP_TYPE_ENUM = 0x55
|
||||
};
|
||||
|
||||
typedef struct Il2CppType
|
||||
{
|
||||
void* dummy;
|
||||
unsigned int attrs : 16;
|
||||
Il2CppTypeEnum type : 8;
|
||||
unsigned int num_mods : 6;
|
||||
unsigned int byref : 1;
|
||||
unsigned int pinned : 1;
|
||||
} Il2CppType;
|
||||
|
||||
struct Il2CppReflectionType
|
||||
{
|
||||
Il2CppObject object;
|
||||
const Il2CppType* type;
|
||||
};
|
||||
|
||||
struct Resolution_t {
|
||||
int width;
|
||||
int height;
|
||||
@@ -160,5 +228,111 @@ namespace Il2cppUtils {
|
||||
*reinterpret_cast<RType*>(reinterpret_cast<uintptr_t>(obj) + field->offset) = value;
|
||||
}
|
||||
|
||||
void* get_system_class_from_reflection_type_str(const char* typeStr, const char* assemblyName = "mscorlib") {
|
||||
using Il2CppString = UnityResolve::UnityType::String;
|
||||
|
||||
static auto assemblyLoad = reinterpret_cast<void* (*)(Il2CppString*)>(
|
||||
GetMethodPointer("mscorlib.dll", "System.Reflection",
|
||||
"Assembly", "Load", {"*"})
|
||||
);
|
||||
static auto assemblyGetType = reinterpret_cast<Il2CppReflectionType * (*)(void*, Il2CppString*)>(
|
||||
GetMethodPointer("mscorlib.dll", "System.Reflection",
|
||||
"Assembly", "GetType", {"*"})
|
||||
);
|
||||
|
||||
static auto reflectionAssembly = assemblyLoad(Il2CppString::New(assemblyName));
|
||||
auto reflectionType = assemblyGetType(reflectionAssembly, Il2CppString::New(typeStr));
|
||||
return UnityResolve::Invoke<void*>("il2cpp_class_from_system_type", reflectionType);
|
||||
}
|
||||
|
||||
namespace Tools {
|
||||
|
||||
template <typename T = void*>
|
||||
class CSListEditor {
|
||||
public:
|
||||
CSListEditor(void* list) {
|
||||
list_klass = get_class_from_instance(list);
|
||||
lst = list;
|
||||
|
||||
lst_get_Count_method = il2cpp_class_get_method_from_name(list_klass, "get_Count", 0);
|
||||
lst_get_Item_method = il2cpp_class_get_method_from_name(list_klass, "get_Item", 1);
|
||||
lst_set_Item_method = il2cpp_class_get_method_from_name(list_klass, "set_Item", 2);
|
||||
lst_Add_method = il2cpp_class_get_method_from_name(list_klass, "Add", 1);
|
||||
|
||||
lst_get_Count = reinterpret_cast<lst_get_Count_t>(lst_get_Count_method->methodPointer);
|
||||
lst_get_Item = reinterpret_cast<lst_get_Item_t>(lst_get_Item_method->methodPointer);
|
||||
lst_set_Item = reinterpret_cast<lst_set_Item_t>(lst_set_Item_method->methodPointer);
|
||||
lst_Add = reinterpret_cast<lst_Add_t>(lst_Add_method->methodPointer);
|
||||
}
|
||||
|
||||
void Add(T value) {
|
||||
lst_Add(lst, value, lst_Add_method);
|
||||
}
|
||||
|
||||
T get_Item(int index) {
|
||||
return lst_get_Item(lst, index, lst_get_Item_method);
|
||||
}
|
||||
|
||||
void set_Item(int index, T value) {
|
||||
return lst_set_Item(lst, index, value, lst_set_Item_method);
|
||||
}
|
||||
|
||||
int get_Count() {
|
||||
return lst_get_Count(lst, lst_get_Count_method);
|
||||
}
|
||||
|
||||
T operator[] (int key) {
|
||||
return get_Item(key);
|
||||
}
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
Iterator(CSListEditor<T>* editor, int index) : editor(editor), index(index) {}
|
||||
|
||||
T operator*() const {
|
||||
return editor->get_Item(index);
|
||||
}
|
||||
|
||||
Iterator& operator++() {
|
||||
++index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator!=(const Iterator& other) const {
|
||||
return index != other.index;
|
||||
}
|
||||
|
||||
private:
|
||||
CSListEditor<T>* editor;
|
||||
int index;
|
||||
};
|
||||
|
||||
Iterator begin() {
|
||||
return Iterator(this, 0);
|
||||
}
|
||||
|
||||
Iterator end() {
|
||||
return Iterator(this, get_Count());
|
||||
}
|
||||
|
||||
void* lst;
|
||||
void* list_klass;
|
||||
private:
|
||||
typedef T(*lst_get_Item_t)(void*, int, void* mtd);
|
||||
typedef void(*lst_Add_t)(void*, T, void* mtd);
|
||||
typedef void(*lst_set_Item_t)(void*, int, T, void* mtd);
|
||||
typedef int(*lst_get_Count_t)(void*, void* mtd);
|
||||
|
||||
MethodInfo* lst_get_Item_method;
|
||||
MethodInfo* lst_Add_method;
|
||||
MethodInfo* lst_get_Count_method;
|
||||
MethodInfo* lst_set_Item_method;
|
||||
|
||||
lst_get_Item_t lst_get_Item;
|
||||
lst_set_Item_t lst_set_Item;
|
||||
lst_Add_t lst_Add;
|
||||
lst_get_Count_t lst_get_Count;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace GakumasLocal::Config {
|
||||
bool enableFreeCamera = false;
|
||||
int targetFrameRate = 0;
|
||||
bool unlockAllLive = false;
|
||||
bool unlockAllLiveCostume = false;
|
||||
|
||||
bool enableLiveCustomeDress = false;
|
||||
std::string liveCustomeHeadId = "";
|
||||
@@ -67,6 +68,7 @@ namespace GakumasLocal::Config {
|
||||
GetConfigItem(targetFrameRate);
|
||||
GetConfigItem(enableFreeCamera);
|
||||
GetConfigItem(unlockAllLive);
|
||||
GetConfigItem(unlockAllLiveCostume);
|
||||
GetConfigItem(enableLiveCustomeDress);
|
||||
GetConfigItem(liveCustomeHeadId);
|
||||
GetConfigItem(liveCustomeCostumeId);
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace GakumasLocal::Config {
|
||||
extern bool enableFreeCamera;
|
||||
extern int targetFrameRate;
|
||||
extern bool unlockAllLive;
|
||||
extern bool unlockAllLiveCostume;
|
||||
|
||||
extern bool enableLiveCustomeDress;
|
||||
extern std::string liveCustomeHeadId;
|
||||
|
||||
@@ -128,7 +128,15 @@ fun <T> T.onClickStartGame() where T : Activity, T : IHasConfigItems {
|
||||
"io.github.chinosk.gakumas.localify.fileprovider",
|
||||
File(targetFile.absolutePath)
|
||||
)
|
||||
intent.setDataAndType(dirUri, "resource/file")
|
||||
// intent.setDataAndType(dirUri, "resource/file")
|
||||
|
||||
grantUriPermission(
|
||||
"com.bandainamcoent.idolmaster_gakuen",
|
||||
dirUri,
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
||||
)
|
||||
intent.putExtra("resource_file", dirUri)
|
||||
// intent.clipData = ClipData.newRawUri("resource_file", dirUri)
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ interface ConfigListener {
|
||||
fun onEnableFreeCameraChanged(value: Boolean)
|
||||
fun onTargetFpsChanged(s: CharSequence, start: Int, before: Int, count: Int)
|
||||
fun onUnlockAllLiveChanged(value: Boolean)
|
||||
fun onUnlockAllLiveCostumeChanged(value: Boolean)
|
||||
fun onLiveCustomeDressChanged(value: Boolean)
|
||||
fun onLiveCustomeHeadIdChanged(s: CharSequence, start: Int, before: Int, count: Int)
|
||||
fun onLiveCustomeCostumeIdChanged(s: CharSequence, start: Int, before: Int, count: Int)
|
||||
@@ -152,6 +153,11 @@ interface ConfigUpdateListener: ConfigListener, IHasConfigItems {
|
||||
saveConfig()
|
||||
}
|
||||
|
||||
override fun onUnlockAllLiveCostumeChanged(value: Boolean) {
|
||||
config.unlockAllLiveCostume = value
|
||||
saveConfig()
|
||||
}
|
||||
|
||||
override fun onTargetFpsChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
try {
|
||||
val valueStr = s.toString()
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
@@ -282,7 +283,14 @@ class GakumasHookMain : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
|
||||
// 使用热更新文件
|
||||
if ((programConfig?.useRemoteAssets == true) || (programConfig?.useAPIAssets == true)) {
|
||||
val dataUri = intent.data
|
||||
// val dataUri = intent.data
|
||||
val dataUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
intent.getParcelableExtra("resource_file", Uri::class.java)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
intent.getParcelableExtra<Uri>("resource_file")
|
||||
}
|
||||
|
||||
if (dataUri != null) {
|
||||
if (!externalFilesChecked) {
|
||||
externalFilesChecked = true
|
||||
|
||||
@@ -645,7 +645,7 @@ class PatchActivity : ComponentActivity() {
|
||||
val copyFilesCmd: MutableList<String> = mutableListOf()
|
||||
val movedFiles: MutableList<String> = mutableListOf()
|
||||
savedFileNames.forEach { file ->
|
||||
val movedFileName = "$installDS/${file}"
|
||||
val movedFileName = "\"$installDS/${file}\""
|
||||
movedFiles.add(movedFileName)
|
||||
val dlSaveFileName = File(targetDirectory, file)
|
||||
copyFilesCmd.add("$action ${dlSaveFileName.absolutePath} $movedFileName")
|
||||
|
||||
@@ -15,6 +15,7 @@ data class GakumasConfig (
|
||||
var enableFreeCamera: Boolean = false,
|
||||
var targetFrameRate: Int = 0,
|
||||
var unlockAllLive: Boolean = false,
|
||||
var unlockAllLiveCostume: Boolean = false,
|
||||
var enableLiveCustomeDress: Boolean = false,
|
||||
var liveCustomeHeadId: String = "",
|
||||
var liveCustomeCostumeId: String = "",
|
||||
|
||||
@@ -357,6 +357,10 @@ fun AdvanceSettingsPage(modifier: Modifier = Modifier,
|
||||
checked = config.value.unlockAllLive) {
|
||||
v -> context?.onUnlockAllLiveChanged(v)
|
||||
}
|
||||
GakuSwitch(modifier, stringResource(R.string.unlockAllLiveCostume),
|
||||
checked = config.value.unlockAllLiveCostume) {
|
||||
v -> context?.onUnlockAllLiveCostumeChanged(v)
|
||||
}
|
||||
HorizontalDivider(
|
||||
thickness = 1.dp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f)
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
<string name="translation_repository">翻訳のリポジトリ</string>
|
||||
<string name="translation_resource_update">翻訳リソースをアップデート</string>
|
||||
<string name="unlockAllLive">すべてのライブを開放</string>
|
||||
<string name="unlockAllLiveCostume">すべてのライブ衣装を開放</string>
|
||||
<string name="useCustomeGraphicSettings">カスタムグラフィック設定を使用する</string>
|
||||
<string name="use_remote_zip_resource">リモート ZIP リソースを使用する</string>
|
||||
<string name="usearmcorrection">Arm コレクションを使用する</string>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<string name="start_game">以上述配置启动游戏/重载配置</string>
|
||||
<string name="setFpsTitle">最大 FPS (0 为保持游戏原设置)</string>
|
||||
<string name="unlockAllLive">解锁所有 Live</string>
|
||||
<string name="unlockAllLiveCostume">解锁所有 Live 服装</string>
|
||||
<string name="liveUseCustomeDress">Live 使用自定义角色</string>
|
||||
<string name="live_costume_head_id">Live 自定义头部 ID (例: costume_head_hski-cstm-0002)</string>
|
||||
<string name="live_custome_dress_id">Live 自定义服装 ID (例: hski-cstm-0002)</string>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<string name="start_game">Start Game / Hot Reload Config</string>
|
||||
<string name="setFpsTitle">Max FPS (0 is Use Original Settings)</string>
|
||||
<string name="unlockAllLive">Unlock All Live</string>
|
||||
<string name="unlockAllLiveCostume">Unlock All Live Costume</string>
|
||||
<string name="liveUseCustomeDress">Live Custom Character</string>
|
||||
<string name="live_costume_head_id">Live Custom Head ID (eg. costume_head_hski-cstm-0002)</string>
|
||||
<string name="live_custome_dress_id">Live Custom Dress ID (eg. hski-cstm-0002)</string>
|
||||
|
||||
Reference in New Issue
Block a user