Citra: Monster Hunter Online hub crash fix

Created on 30 Apr 2020  ·  4Comments  ·  Source: citra-emu/citra

Hi, Citra team.
We have community for monster hunter games.
We are making fun expiernce with Citra.

But, we still using some un-official custom build for a long time.
Because un-official have some fix for monster hunter.
When we play Monster Hunter online,
Citra sometimes crashes when a connection error occurs, etc.

Here. fix code.
https://github.com/raspberrrian/citra/commit/e366817ee63f4cabf39c753f49884c553ef60511

tywald know this issue.
He will be able to explain more than I can. My English is not good. :D

I want play monster hunter with official Citra.
I hope this fix applies.

I'm always rooting for the Citra team.
Thank you for gave to me a great experience.

(I'm korean. This text was assisted by google translate.)

Most helpful comment

Some of the asserts might fail due to a flaw in the node_info struct. Let me explain.

First we need to keep track what each player friend code seed is:

player1: 9952392226555710175
player2: 7151434748951174728
player3: 3685070402442245176
player4: 8959911473927937825

I will use MHGen as an example, here is how the game defines player slots:
image

When all four players are connected in order, node_info will look like this:
image

Now if player 2 & 4 leaves it becomes:
image

Now if player 2 tries to reconnect, it will fail and instead of filling up [1] it overwrites [2] making player 3 "disappear" from the struct however is infact still connected in-game:
image

If the host tries to close the hub, the host will crash triggering this assert: https://github.com/citra-emu/citra/blob/11754778bb443d83b6966138f7b222c6b6e4db19/src/core/hle/service/nwm/nwm_uds.cpp#L464
log: host.txt
Call Stack:

KernelBase.dll!00007ffd40b30aa2()
citra-qt.exe!assert_noinline_call<void <lambda>(void)>(const Service::NWM::NWM_UDS::HandleDeauthenticationFrame::__l15::void <lambda>(void) & fn) Line 27
    at C:\Programming\citra\src\common\assert.h(27)
citra-qt.exe!Service::NWM::NWM_UDS::HandleDeauthenticationFrame(const Network::WifiPacket & packet) Line 464
    at C:\Programming\citra\src\core\hle\service\nwm\nwm_uds.cpp(464)
[Inline Frame] citra-qt.exe!std::_Func_class<void,Network::WifiPacket const &>::operator()(const Network::WifiPacket &) Line 976
    at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\functional(976)
citra-qt.exe!Network::RoomMember::RoomMemberImpl::Invoke<Network::WifiPacket>(const Network::WifiPacket & data) Line 485
    at C:\Programming\citra\src\network\room_member.cpp(485)
citra-qt.exe!Network::RoomMember::RoomMemberImpl::HandleWifiPackets(const _ENetEvent * event) Line 367
    at C:\Programming\citra\src\network\room_member.cpp(367)
citra-qt.exe!Network::RoomMember::RoomMemberImpl::MemberLoop() Line 237
    at C:\Programming\citra\src\network\room_member.cpp(237)
[External Code]

It is possible for the vector to grow and shrink as expected by adding these in HandleDeauthenticationFrame() on L475

node_info.erase(node_it);
node_info.resize(network_info.max_nodes);

However that doesn't fix the issue because it looks like the position matters in this array:
image

All 4 comments

Can you try master branch + #5284 instead? because what you linked is not a fix at all

sorry. i dont; know programming much.
this link maybe have additional information
https://github.com/raspberrrian/citra/branches
https://github.com/raspberrrian/citra

Some of the asserts might fail due to a flaw in the node_info struct. Let me explain.

First we need to keep track what each player friend code seed is:

player1: 9952392226555710175
player2: 7151434748951174728
player3: 3685070402442245176
player4: 8959911473927937825

I will use MHGen as an example, here is how the game defines player slots:
image

When all four players are connected in order, node_info will look like this:
image

Now if player 2 & 4 leaves it becomes:
image

Now if player 2 tries to reconnect, it will fail and instead of filling up [1] it overwrites [2] making player 3 "disappear" from the struct however is infact still connected in-game:
image

If the host tries to close the hub, the host will crash triggering this assert: https://github.com/citra-emu/citra/blob/11754778bb443d83b6966138f7b222c6b6e4db19/src/core/hle/service/nwm/nwm_uds.cpp#L464
log: host.txt
Call Stack:

KernelBase.dll!00007ffd40b30aa2()
citra-qt.exe!assert_noinline_call<void <lambda>(void)>(const Service::NWM::NWM_UDS::HandleDeauthenticationFrame::__l15::void <lambda>(void) & fn) Line 27
    at C:\Programming\citra\src\common\assert.h(27)
citra-qt.exe!Service::NWM::NWM_UDS::HandleDeauthenticationFrame(const Network::WifiPacket & packet) Line 464
    at C:\Programming\citra\src\core\hle\service\nwm\nwm_uds.cpp(464)
[Inline Frame] citra-qt.exe!std::_Func_class<void,Network::WifiPacket const &>::operator()(const Network::WifiPacket &) Line 976
    at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\functional(976)
citra-qt.exe!Network::RoomMember::RoomMemberImpl::Invoke<Network::WifiPacket>(const Network::WifiPacket & data) Line 485
    at C:\Programming\citra\src\network\room_member.cpp(485)
citra-qt.exe!Network::RoomMember::RoomMemberImpl::HandleWifiPackets(const _ENetEvent * event) Line 367
    at C:\Programming\citra\src\network\room_member.cpp(367)
citra-qt.exe!Network::RoomMember::RoomMemberImpl::MemberLoop() Line 237
    at C:\Programming\citra\src\network\room_member.cpp(237)
[External Code]

It is possible for the vector to grow and shrink as expected by adding these in HandleDeauthenticationFrame() on L475

node_info.erase(node_it);
node_info.resize(network_info.max_nodes);

However that doesn't fix the issue because it looks like the position matters in this array:
image

Was this page helpful?
0 / 5 - 0 ratings