SilentNightSound / GI-Model-Importer

Tools and instructions for importing custom models into a certain anime game
https://discord.gg/agmg
GNU General Public License v3.0
2.56k stars 355 forks source link

Game crashes. Require lazy loading mod functionality 游戏闪退,需要延迟加载mod功能 #287

Open AzusaTsang opened 1 month ago

AzusaTsang commented 1 month ago

I've found that when mods exceed a certain number (I currently have 20 mods totaling 4.42GB), the injected program will emit the beep sound of pressing F10 before the game has finished loading and the window has appeared. Then the game will crash.

But if I reduce the number of mods to a certain number first, or directly clear the mod folder, and then start the injection program, the game runs normally. Then put the mods back into the mod folder, and press F10, and the game will run normally. But doing this will clear the settings of the previous mod and return all mods to their default options.

So I think I need a function that can load mods only after entering the game.

我发现当mod超过一定数量时(我目前20个mod,共4.42GB), 注入程序会在游戏还没加载完,窗口还没出现时就已经发出按F10时发出的嘟声, 然后游戏就会闪退。

但是如果先把mod减少到一定数量,或者直接把mod文件夹清空,再启动注入程序, 游戏则正常运行。 之后再把mod重新放回mod文件夹,再按F10,游戏正常运行。 但这样做会清空之前mod的设置,所有mod会恢复到默认选项。

因此我想我需要一个能够在进入游戏之后才加载mod的功能。

AzusaTsang commented 1 month ago

I wrote a script to deal with it temporarily. Save this code as delay_load_mod.py along with 3DMigoto Loader.exe and use Python to run it. Press F10 20 seconds after the game launched to load mods.

If you want to keep your mods' settings, add a line user_config = my_config.ini below exclude_recursive = DISABLED* in d3dx.ini. Then rename the current d3dx_user.ini to my_config.ini.

自己写了个脚本先暂时应付一下。 把这段代码保存为 delay_load_mod.py (丢雷楼某)3DMigoto Loader.exe 放在一起 然后用 Python 运行。 游戏运行后 20 秒按 F10 加载 mod。

如果想保存mod设置 在 d3dx.iniexclude_recursive = DISABLED* 下面 加一行 user_config = my_config.ini 然后把 d3dx_user.ini 重命名为 my_config.ini

game_path = r"G:\Genshin Impact\Genshin Impact Game\YuanShen.exe"

import os
import time

with open("./d3dx.ini", 'r', encoding="utf-8") as f:
    lines = f.readlines()

with open("./d3dx.ini", 'w', encoding="utf-8") as f:
    for line in lines:
        if line.startswith(("include_recursive", "exclude_recursive", "user_config")):
            f.write("; " + line)
        else:
            f.write(line)

os.system('start "" "3DMigoto Loader.exe"')

os.system(f'start "" "{game_path}"')

time.sleep(20)

with open("./d3dx.ini", 'w', encoding="utf-8") as f:
    f.writelines(lines)
TQSJ-TPR commented 1 month ago

How do I use this line of code?

TQSJ-TPR commented 1 month ago

I found the solution, there's a fixed 3DM at this link https://shiroka.top/posts/start3dm

AzusaTsang commented 1 month ago

How do I use this line of code?

Put it along with 3DMigoto Loader.exe and use Python to run it.

AzusaTsang commented 1 month ago

I found the solution, there's a fixed 3DM at this link https://shiroka.top/posts/start3dm

I think this tool also uses the same mod lazy loading method.