#292 Can fix the compatibility issue of the channel of bilibili?

Closed
opened 2 years ago by QiE2035 · 28 comments
QiE2035 commented 2 years ago

[原文] 您好,当我在Linux lite(一个Ubuntu的衍生版)上测试的时候,mihoyo服(config.ini里的channel=1)一切正常的,但是当我将其改为bilibili服(config.ini里的channel=14),当我尝试"进门"时,出现错误代码:31-4302,能否考虑修复下?

[Translated by Google] Hello, when I tested on Linux lite (an Ubuntu derivative), the channel of mihoyo (channel=1 in config.ini) was working fine, but when I changed it to the channel of bilibili ( channel=14 in config.ini), when I try to "enter the door", the error code: 31-4302 appears, can you consider fixing it?

EDIT: 目前问题已经基本解决, 为后来者指路:

  1. 这个想项目可以解决 IE 的问题: https://github.com/QiE2035/gs_bili
  2. 版本 2.7 开始的补丁已经包含了 B 服
[原文] 您好,当我在Linux lite(一个Ubuntu的衍生版)上测试的时候,mihoyo服(config.ini里的channel=1)一切正常的,但是当我将其改为bilibili服(config.ini里的channel=14),当我尝试"进门"时,出现错误代码:31-4302,能否考虑修复下? [Translated by Google] Hello, when I tested on Linux lite (an Ubuntu derivative), the channel of mihoyo (channel=1 in config.ini) was working fine, but when I changed it to the channel of bilibili ( channel=14 in config.ini), when I try to "enter the door", the error code: 31-4302 appears, can you consider fixing it? EDIT: 目前问题已经基本解决, 为后来者指路: 1. 这个想项目可以解决 IE 的问题: https://github.com/QiE2035/gs_bili 2. 版本 2.7 开始的补丁已经包含了 B 服
Krock commented 2 years ago
Owner

@y0soro Would you please have a look at this?

EDIT: What's the difference between bilibili's version and YuanShen?

EDIT2: 32-4302 means checksum mismatch. Different game types have different checksums.

@y0soro Would you please have a look at this? EDIT: What's the difference between bilibili's version and YuanShen? EDIT2: 32-4302 means checksum mismatch. Different game types have different checksums.
QiE2035 commented 2 years ago
Poster

@Krock There is an artical about the difference between them: https://www.bilibili.com/read/cv14658037

It just the "channel=?" in "config.ini" and more a file "PCGameSDK.dll".

On Windows, but not patched, I just need to change "channel=1" to "channel=14" in "config.ini".(Maybe need to add the file "PCGameSDK.dll" manually.)

Maybe the channel of bilibili use another chacksum function?

@Krock There is an artical about the difference between them: https://www.bilibili.com/read/cv14658037 It just the "channel=?" in "config.ini" and more a file "PCGameSDK.dll". On Windows, but not patched, I just need to change "channel=1" to "channel=14" in "config.ini".(Maybe need to add the file "PCGameSDK.dll" manually.) Maybe the channel of bilibili use another chacksum function?
QiE2035 commented 2 years ago
Poster

There is a joke here: "the channel of mihoyo is looking for help, the channel of bilibili is self-improvement". (原文: 官服找帮忙,B服当自强)

Maybe I need to solve this problem by myself? ([wry smile] I hope that it just a joke.)

EDIT: A bad thing: Google mistranslated the title, maybe this caused a misunderstanding.

There is a joke here: "the channel of mihoyo is looking for help, the channel of bilibili is self-improvement". (原文: 官服找帮忙,B服当自强) Maybe I need to solve this problem by myself? ([wry smile] I hope that it just a joke.) EDIT: A bad thing: Google mistranslated the title, maybe this caused a misunderstanding.
Ghost commented 2 years ago

@QiE2035 轉換成B站客戶端需要:

  1. channel改成14
  2. sub_channel改成0
  3. cps改成bilibili
  4. PCGameSDK.dll放在Plugins資料夾

請看看粗體的步驟。我無法在此網站上傳PCGameSDK.dll,建議建立虛擬器以獲取。

I'm not going to bother translating this because this information is already in the link that OP sent. Also, the target audience will (hopefully) already be able to read it.

I just realized @Krock asked about the differences above. So, here goes:

  1. Change channel to 14
  2. Change sub_channel to 14
  3. Change cs to bilibili
  4. Put PCGameSDK.dll in the Plugins folder

OP seems to have missed the latter 3 steps.

@QiE2035 轉換成B站客戶端需要: 1. 把`channel`改成`14` 2. **把`sub_channel`改成`0`** 3. **把`cps`改成`bilibili`** 4. **把`PCGameSDK.dll`放在`Plugins`資料夾** 請看看粗體的步驟。我無法在此網站上傳`PCGameSDK.dll`,建議建立虛擬器以獲取。 ~~I'm not going to bother translating this because this information is already in the link that OP sent. Also, the target audience will (hopefully) already be able to read it.~~ I just realized @Krock asked about the differences above. So, here goes: 1. Change `channel` to `14` 2. Change `sub_channel` to `14` 3. Change `cs` to `bilibili` 4. Put `PCGameSDK.dll` in the `Plugins` folder OP seems to have missed the latter 3 steps.
QiE2035 commented 2 years ago
Poster

@Raymonf

[原文]

完整的确实是这些步骤,但实际上仅需修改channel=14和补全PCGameSDK.dll即可。其它的修改我不敢说没有必要,但就最终效果而言似乎没有影响,哪怕在朋友的电脑(原本安装的是mihoyo服)上也是如此。

而且另外一点是:我原本安装的就是bilibili服,改成mihoyo服仅仅只是在31-4302出现时为了测试官服(mihoyo服)能否正常使用。

所以我目前的猜测是:服务器转换的步骤应该不是问题所在,在官服时补丁是可以正常使用的,但是B服出现了31-4302错误,所以很可能是B服使用了额外的校验函数来校验某些文件。

[Translated by Google]

The complete set is indeed these steps, but in fact it only needs to modify channel=14 and complete PCGameSDK.dll. I can't say that the other changes are unnecessary, but it seems to have no effect in terms of the final effect, even on a friend's computer (the original mihoyo server was installed).

And another point is: I originally installed the bilibili server, and I changed it to the mihoyo server just to test whether the official server (mihoyo server) can be used normally when 31-4302 appeared.

So my current guess is: the server conversion step should not be the problem, the patch can be used normally in the official server, but the B server has errors 31-4302, so it is likely that the B server uses an additional verification function to verify certain files.

@Raymonf [原文] 完整的确实是这些步骤,但实际上仅需修改channel=14和补全PCGameSDK.dll即可。其它的修改我不敢说没有必要,但就最终效果而言似乎没有影响,哪怕在朋友的电脑(原本安装的是mihoyo服)上也是如此。 而且另外一点是:我原本安装的就是bilibili服,改成mihoyo服仅仅只是在31-4302出现时为了测试官服(mihoyo服)能否正常使用。 所以我目前的猜测是:服务器转换的步骤应该不是问题所在,在官服时补丁是可以正常使用的,但是B服出现了31-4302错误,所以很可能是B服使用了额外的校验函数来校验某些文件。 [Translated by Google] The complete set is indeed these steps, but in fact it only needs to modify channel=14 and complete PCGameSDK.dll. I can't say that the other changes are unnecessary, but it seems to have no effect in terms of the final effect, even on a friend's computer (the original mihoyo server was installed). And another point is: I originally installed the bilibili server, and I changed it to the mihoyo server just to test whether the official server (mihoyo server) can be used normally when 31-4302 appeared. So my current guess is: the server conversion step should not be the problem, the patch can be used normally in the official server, but the B server has errors 31-4302, so it is likely that the B server uses an additional verification function to verify certain files.
y0soro commented 2 years ago

There are 2 Genshin servers both have dedicated clients in China, one is hosted by miHoYo (i.e. official server) and another less popular one hosted by BiliBili.

According to the blog post mentioned by @QiE2035, one can switching between 2 servers by just swapping some files and properties.

Since both clients share a same UnityPlayer.dll, it's possible to apply the patch for BiliBili client.

The CN patch works for the official client since I created the patch based on it. But the patch also contains some hard-coded checksum just to bypass the 31-4302 error. Since BiliBili client has an additional PCGameSDK.dll, it's checksum might differ from the checksum of official client.

@Raymonf Does the patch works for you on BiliBili client? Is @QiE2035 failed because he/she missed some parts you mentioned above? If not, then BiliBili client would also need a dedicated patch contains some "correct" checksum exported from the client.

I personally don't play on BiliBili server, but if someone who plays and has basic ASM knowledge is able to help, we can cooperate together to create a patch for BiliBili client.

There are 2 Genshin servers both have dedicated clients in China, one is hosted by miHoYo (i.e. official server) and another less popular one hosted by BiliBili. According to the blog post mentioned by @QiE2035, one can switching between 2 servers by just swapping some files and properties. Since both clients share a same UnityPlayer.dll, it's possible to apply the patch for BiliBili client. The CN patch works for the official client since I created the patch based on it. But the patch also contains some hard-coded checksum just to bypass the 31-4302 error. Since BiliBili client has an additional `PCGameSDK.dll`, it's checksum might differ from the checksum of official client. @Raymonf Does the patch works for you on BiliBili client? Is @QiE2035 failed because he/she missed some parts you mentioned above? If not, then BiliBili client would also need a dedicated patch contains some "correct" checksum exported from the client. I personally don't play on BiliBili server, but if someone who plays and has basic ASM knowledge is able to help, we can cooperate together to create a patch for BiliBili client.
Ghost commented 2 years ago

@y0soro: I’m not from China (or even the greater China region), so I don’t have a Bilibili account. I can look into creating one tonight, but as a hunch, the checksum error indicates to me that the DLL is either missing or outdated.

The only differences with the Bilibili server client are documented above. To me, I’m not sure it really makes sense that there would be a second patch required… but time and research will tell, I suppose.

@QiE2035 also said that they originally started with the Bilibili client, so it’s quite interesting.

Edit: Sorry, I forgot about China's [insert political commentary adjective] video game laws. I wouldn't be able to do anything because I don't have a way to verify my identity.

@y0soro: I’m not from China (or even the greater China region), so I don’t have a Bilibili account. I can look into creating one tonight, but as a hunch, the checksum error indicates to me that the DLL is either missing or outdated. The only differences with the Bilibili server client are documented above. To me, I’m not sure it really makes sense that there would be a second patch required… but time and research will tell, I suppose. @QiE2035 also said that they originally started with the Bilibili client, so it’s quite interesting. **Edit:** Sorry, I forgot about China's _[insert political commentary adjective]_ video game laws. I wouldn't be able to do anything because I don't have a way to verify my identity.
y0soro commented 2 years ago

@Raymonf Thank you, but if you don't play on BiliBili server, you don't have to spend time on it.

@QiE2035 also said that they originally started with the Bilibili client, so it’s quite interesting.

From @QiE2035

And another point is: I originally installed the bilibili server, and I changed it to the mihoyo server just to test whether the official server (mihoyo server) can be used normally when 31-4302 appeared.

Yeah, maybe the checksum algorithm has changed, at least the process has now take some of those swapped files into account.

@Raymonf Thank you, but if you don't play on BiliBili server, you don't have to spend time on it. > @QiE2035 also said that they originally started with the Bilibili client, so it’s quite interesting. From @QiE2035 > And another point is: I originally installed the bilibili server, and I changed it to the mihoyo server just to test whether the official server (mihoyo server) can be used normally when 31-4302 appeared. Yeah, maybe the checksum algorithm has changed, at least the process has now take some of those swapped files into account.
QiE2035 commented 2 years ago
Poster

@y0soro If you need, I can at least provide my account of bilibili. May also help you to make a patch about the bilibili server. (But actually my konledge is not very good, so if we do, I may need a little guidance.

@y0soro If you need, I can at least provide my account of bilibili. May also help you to make a patch about the bilibili server. (But actually my konledge is not very good, so if we do, I may need a little guidance.
Krock commented 2 years ago
Owner

@y0soro The algorithm is the same but depends on the .dll, .exe and .sys files in the game path (and loaded modules). Hence PCGameSDK.dll will produce different hashes, hence needs a different patch.

@y0soro The algorithm is the same but depends on the .dll, .exe and .sys files in the game path (and loaded modules). Hence `PCGameSDK.dll` will produce different hashes, hence needs a different patch.
QiE2035 commented 2 years ago
Poster

So...Can anyone fix it? If possible, I want to drop my Windows 10 and turn to a Linux. (Just because the Genshin can't run on Linux, I have to continue to use the Windows 10 (which system I don't like

So...Can anyone fix it? If possible, I want to drop my Windows 10 and turn to a Linux. (Just because the Genshin can't run on Linux, I have to continue to use the Windows 10 (which system I don't like
AlieZ commented 2 years ago

哥们,你是怎么登录进去的?我登录的那个小框一直是空白的…… ———— Dude, how do you log in to your bilibili account in-game? The login window is blank when I try to log in.

哥们,你是怎么登录进去的?我登录的那个小框一直是空白的…… ———— Dude, how do you log in to your bilibili account in-game? The login window is blank when I try to log in.
QiE2035 commented 2 years ago
Poster

@AlieZ

[原文] 在Winetricks里安装 IE 和 urlmon。或许还需要一些手段把 IE 升级到9甚至更高。(但我当时其实没找到升级IE版本的办法所以就直接用 mitmproxy 把从 Firefox 抓到的登录数据送进去了。

[Translated] Install the IE and urlmon in the winetricks. And maybe need to use some method to update the IE version to 9 even bigger.But I didn't find the way IE version of the upgrade IE, so I sent it directly to the login data caught from Firefox with MitMProxy.

@AlieZ [原文] 在Winetricks里安装 IE 和 urlmon。或许还需要一些手段把 IE 升级到9甚至更高。(但我当时其实没找到升级IE版本的办法所以就直接用 mitmproxy 把从 Firefox 抓到的登录数据送进去了。 [Translated] Install the IE and urlmon in the winetricks. And maybe need to use some method to update the IE version to 9 even bigger.But I didn't find the way IE version of the upgrade IE, so I sent it directly to the login data caught from Firefox with MitMProxy.
AlieZ commented 2 years ago

求细说,有无教程文档啥的? ———— How should I operate? Is there a tutorial or something?

求细说,有无教程文档啥的? ———— How should I operate? Is there a tutorial or something?

@QiE2035,求抓登录的py脚本(b服) Py script (B service) for catching login

@QiE2035,求抓登录的py脚本(b服) Py script (B service) for catching login
QiE2035 commented 2 years ago
Poster

@AlieZ

额抱歉,请恕我说不太细…

@xiguayuyichao

我并没有使用py脚本而是从浏览器手动复制进mitmproxy里的

@AlieZ 额抱歉,请恕我说不太细… @xiguayuyichao 我并没有使用py脚本而是从浏览器手动复制进mitmproxy里的
QiE2035 commented 2 years ago
Poster

@Krock I try to create a hook dll to solve the "IE9 problem" for bilibili channel.(It has been success, I will publish it latter.) And there is an log on 2.6 created by Akebi-GC, Maybe it can help?

[Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 0 value '206a260f980399e260f55e31b8cd0782'
[Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 1 value 'a6d7b71dd82838bf44bf830ff89684d625'

Edit: OK, it is the true checksum!!! I am login the game by my bilibili account!!! @AlieZ @xiguayuyichao @y0soro @Raymonf

@Krock I try to create a hook dll to solve the "IE9 problem" for bilibili channel.(It has been success, I will publish it latter.) And there is an log on 2.6 created by [Akebi-GC](https://github.com/Akebi-Group/Akebi-GC), Maybe it can help? ``` [Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 0 value '206a260f980399e260f55e31b8cd0782' [Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 1 value 'a6d7b71dd82838bf44bf830ff89684d625' ``` Edit: OK, it is the true checksum!!! I am login the game by my bilibili account!!! @AlieZ @xiguayuyichao @y0soro @Raymonf
Krock commented 2 years ago
Owner

@QiE2035 That does definitely help. type 0 is identical to the miHoYo version, but type 1 is different do to the additional file.

If these values are correct, the following patch should let you join the game: https://drive.google.com/file/d/1S_MpDMqquwt3IYv-d16fA-9BvNglL7ya/view?usp=sharing

@QiE2035 That does definitely help. `type 0` is identical to the miHoYo version, but `type 1` is different do to the additional file. If these values are correct, the following patch should let you join the game: https://drive.google.com/file/d/1S_MpDMqquwt3IYv-d16fA-9BvNglL7ya/view?usp=sharing

@QIE2035 能用中文说一下不,这机翻我看不太懂

@QIE2035 能用中文说一下不,这机翻我看不太懂
QiE2035 commented 2 years ago
Poster

@xiguayuyichao 我这边用 MinHook 写了个动态注入,Hook 掉了 SDKShowLoginPanel (参考文档) 让它直接读取游戏目录的 login.json返回,这样就不需要 IE9+ 了。

具体代码和 dll 我优化下晚些发布(最近期末考试可能要六一之后吧,如果很急的话我也不介意就这样乱糟糟的给你自己研究)。

吐嘈:果然我这英文水平稀巴烂。

@xiguayuyichao 我这边用 [MinHook](https://github.com/TsudaKageyu/minhook) 写了个动态注入,Hook 掉了 SDKShowLoginPanel [(参考文档)](http://open.biligame.com/wiki/bili_pc_game/) 让它直接读取游戏目录的 login.json返回,这样就不需要 IE9+ 了。 具体代码和 dll 我优化下晚些发布(最近期末考试可能要六一之后吧,如果很急的话我也不介意就这样乱糟糟的给你自己研究)。 吐嘈:果然我这英文水平稀巴烂。
QiE2035 commented 2 years ago
Poster

@Krock Log for version 2.7, created by Akebi-GC, too.

[Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 0 value '9f8b3ab5b65093a2ad0c37e73275c7b5'
[Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 1 value '829ea74c7093b27467b692f7ac17943724'
@Krock Log for version 2.7, created by Akebi-GC, too. ``` [Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 0 value '9f8b3ab5b65093a2ad0c37e73275c7b5' [Debug] [ProtectionBypass.cpp:82] Sniffed correct signature for type 1 value '829ea74c7093b27467b692f7ac17943724' ```
y0soro commented 2 years ago

@QiE2035 I am the one in charge of creating patches for CN client. Since both mihoyo client and bilibili client share a same UnityPlayer.dll and the only difference between patches for two is the checksums, it's easier to create the "BB" patch from my side. Next time you could just send those checksums to my email address y0soro@protonmail.com (and to keep it a secret), so the "BB" patch could be made earlier.

Testing patch for bilibili client is available here: https://notabug.org/y0soro/dawn/src/cn-270/270/patch_files

In addition, it's possible to make a single patch that returns respective checksums for different clients (i.e. single patched dll but applies to both clients) by looking to channel id or the existence of PCGameSDK.dll from patch code, which might be trivial though.

@QiE2035 I am the one in charge of creating patches for CN client. Since both mihoyo client and bilibili client share a same `UnityPlayer.dll` and the only difference between patches for two is the checksums, it's easier to create the "BB" patch from my side. Next time you could just send those checksums to my email address `y0soro@protonmail.com` (and to keep it a secret), so the "BB" patch could be made earlier. Testing patch for bilibili client is available here: https://notabug.org/y0soro/dawn/src/cn-270/270/patch_files In addition, it's possible to make a single patch that returns respective checksums for different clients (i.e. single patched dll but applies to both clients) by looking to `channel` id or the existence of `PCGameSDK.dll` from patch code, which might be trivial though.
QiE2035 commented 2 years ago
Poster

@y0soro Is there such a possibility: we only need the checksum of "BB" to make mihoyo pass the check.

Edit:

Yeah, when I change the channel=1 in the config.ini, it has the same checksum with the 'BB' when the PCGameSDK.dll exists, and it can also pass the check for mhy channel.

Just like if we use the mhy checksum, only the mhy channel can pass the check, but if we use the bili checksum, both of the mhy and the bili channel can pass the check.

So we can just use the bili checksum to let both of them pass the check, no more checks are required for channel id or PCGameSDK.dll. Maybe a good idea, right?

@y0soro Is there such a possibility: we only need the checksum of "BB" to make mihoyo pass the check. Edit: Yeah, when I change the channel=1 in the config.ini, it has the same checksum with the 'BB' when the PCGameSDK.dll exists, and it can also pass the check for mhy channel. Just like if we use the mhy checksum, only the mhy channel can pass the check, but if we use the bili checksum, both of the mhy and the bili channel can pass the check. So we can just use the bili checksum to let both of them pass the check, no more checks are required for channel id or PCGameSDK.dll. Maybe a good idea, right?
y0soro commented 2 years ago

Maybe a good idea, right?

I don't think so, the check came from server side, an "incorrect" checksum increase the chance of being banned.

> Maybe a good idea, right? I don't think so, the check came from server side, an "incorrect" checksum increase the chance of being banned.
QiE2035 commented 2 years ago
Poster

@y0soro OK... maybe an another good method, hook, and it will not affect the checksum if you don't take the dll in the game folder (example, you can take it at the upper folder(..) of the game folder, and inject it like: '../inject.exe ../inject.dll'), like Akebi-GC, mhynot2, and so on.

My bili login patch dll (or say hook dll) use the hook,too. Maybe I can try to write a dll like this project to avoid change any files which let the checksum changed. (at least I can study some things about the hook.)

@y0soro OK... maybe an another good method, hook, and it will not affect the checksum if you don't take the dll in the game folder (example, you can take it at the upper folder(..) of the game folder, and inject it like: '../inject.exe ../inject.dll'), like Akebi-GC, mhynot2, and so on. My bili login patch dll (or say hook dll) use the hook,too. Maybe I can try to write a dll like this project to avoid change any files which let the checksum changed. (at least I can study some things about the hook.)
Krock commented 2 years ago
Owner

@QiE2035 I would very much prefer to avoid DLL injections. They allow to load any custom code rather easy, hence a potential abuse and security risk.

After the original patch is written, it is a task of a few minutes to insert the new value and generate a second patch. In my opinion this additional effort does not justify the need for a separate DLL.

@QiE2035 I would very much prefer to avoid DLL injections. They allow to load any custom code rather easy, hence a potential abuse and security risk. After the original patch is written, it is a task of a few minutes to insert the new value and generate a second patch. In my opinion this additional effort does not justify the need for a separate DLL.
QiE2035 commented 2 years ago
Poster

@Krock OK, I got it, so be it, no hook dll. However, I think my bili hook dll is a good solution for the IE problem. In my opinion, it's easier than patch the dll. (Maybe it's just because of my poor assembly language skills.

@Krock OK, I got it, so be it, no hook dll. However, I think my bili hook dll is a good solution for the IE problem. In my opinion, it's easier than patch the dll. (Maybe it's just because of my poor assembly language skills.
Krock commented 2 years ago
Owner

Closing. There seem to be a few volunteers who can provide the necessary hashes. Otherwise it should still be possible to dump them using morally questionable DLL injections.

Closing. There seem to be a few volunteers who can provide the necessary hashes. Otherwise it should still be possible to dump them using morally questionable DLL injections.
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.