Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of sync if not same cpu #3

Open
vince1016 opened this issue Apr 18, 2024 · 16 comments
Open

Out of sync if not same cpu #3

vince1016 opened this issue Apr 18, 2024 · 16 comments

Comments

@vince1016
Copy link

I know thats something you have found something and you doesn't really understand the code, but just trying to let you know thats something that would be great to resolve. I think thats really related to not having the same cpu brand. Will test it when i can.
I can join no problem with hamachi tho on windows 10

@Ododo
Copy link
Owner

Ododo commented Apr 20, 2024

yeah.. that would be great indeed.
i'm very busy at the moment however.
if anyone has findings on their side they can post them in this issue.

@Splainte
Copy link

Hi !
First of all, thanks a lot for your work.
My brother and I wanted to play this game Coop for a long time, and now we are closer than ever to be able to !

I just want to let you know that indeed, there is a problem with Ryzen (or at least, with the Intel/Ryzen coop combo).
I tried to play on my main PC which has a R9 5900X with my brother who has an Intel Core i5, and at the first input, we are disconnected.

I then tried on my laptop which is Intel based, and it worked !! First try we got a disconnection, but second try worked !

If you find something to correct this issue, that would be awesome.

Thanks again !

@ThirteenAG
Copy link

if anyone has findings on their side they can post them in this issue.

I checked and the error displayed has "DivergenceMessageBoxMessage" id in localization files, and that id is used only by one function.

...
      *(float *)&dword_142EB64 = *(float *)&dword_13A31CC + *(float *)&dword_142EB64;
      if ( *(float *)&dword_142EB64 >= 2.0 && sub_8C4079((_DWORD **)dword_142EB7C) )
      {
        v3 = sub_792B49();
        v4 = (*(int (__thiscall **)(int))(*(_DWORD *)v3 + 496))(v3);
        if ( !(*(int (__thiscall **)(int))(*(_DWORD *)v4 + 400))(v4) )
        {
          if ( dword_142EB7C )
            sub_8C409B(dword_142EB7C);
          sub_40C3A0((void *)&Caption);
          sub_40C3A0((void *)&Caption);
          sub_40C3A0((void *)&Caption);
          sub_40C3A0((void *)&Caption);
          sub_77BB27(83, v14, v12, 1, 0, 0, v15, v13, 1, 1, -1.0);
          sub_40C40E(v14);
          sub_40C40E(v12);
          sub_40C40E(v15);
          sub_40C40E(v13);
          v9 = 11;
          v5 = sub_445900((int)&off_10D3024, (int)L"DivergenceMessageBoxTitle", (int)"Localization\\System", 0, 0);
          sub_40DBB2(v10, v5);
          v6 = sub_445900((int)&off_10D3024, (int)L"DivergenceMessageBoxMessage", (int)"Localization\\System", 0, 0);
          sub_40DBB2(v11, v6);
          v11[7] = dword_142EB84;
          v11[5] = 1;
          v11[6] = 1;
          v7 = sub_792B49();
          (*(void (__thiscall **)(int, int *, int))(*(_DWORD *)v7 + 340))(v7, &v9, 3);
          sub_77BC47(&v9);
        }
...

Tried to disable this code path, but the game just gets stuck without an error message. This code is not executed until the button is pressed, or rather character movement occurs.

int __usercall sub_7C4A7A@<eax>(MassiveAdClient3::CMassiveAsset *a1@<ebx>, float a2)
{
  int result; // eax
  int v3; // esi

  result = sub_7C0894();
  if ( result )
  {
    sub_45FA0A();
    sub_45F36B(0);
    v3 = sub_7C2FCF(LODWORD(a2)); // this is executed always
    sub_45FA0A();
    result = sub_45F36B(1);
    if ( v3 ) // false until player moves and out of sync occurs
    {
      result = sub_7C0745();
      if ( !result )
        return sub_7C465E(a1); // out of sync error message displayed here
    }
  }
  return result;
}

Overall it might be an issue described here, since many people confirmed different CPUs cause out of sync error.

https://cookieplmonster.github.io/2020/07/19/silentpatch-mass-effect/#part-3

@pancake-re
Copy link

pancake-re commented Jul 23, 2024

if anyone has findings on their side they can post them in this issue.
Overall it might be an issue described here, since many people confirmed different CPUs cause out of sync error.

https://cookieplmonster.github.io/2020/07/19/silentpatch-mass-effect/#part-3

I can send you some Wireshark records from intel-ryzen and intel-intel sessions, if it may help in research

@ThirteenAG
Copy link

I wouldn't know what to do with them, just upload them here and maybe someone else can take a look.

@Ododo
Copy link
Owner

Ododo commented Jul 27, 2024

Thanks for sharing @ThirteenAG
I have bit searched for sse related issues but did not come across this paper.
We might aswell just blindy test the solutions proposed here then ..

Thats where i stopped so far: dword_13A31CC or dword_142EB64 seems to be some kind of divergence accumulator which main calculation resides in a function syncing both players. It is the same routine capping both player at a fixed framerate (30).

Function starts like this:

void FUN_0042ce22(int *param_1)
  ...
  (**(code **)(*(int *)PTR_PTR_01265ee4 + 0xac))(1);
  local_c = 0x78;
  (**(code **)(*DAT_013a0fe0 + 4))("Engine.Display","MaxFPS",&local_c,"User.ini");
  iVar5 = 0x1e;
  if ((0x1d < local_c) && (iVar5 = 1000, local_c < 1000)) {
    iVar5 = local_c;
  }

Then something like:

For frame:
  float delayAcc;
  float tpf = 1/MAXFPS // time per frame
  s = QueryPerformanceCounter();  // portable across platforms
  do_stuff_for_player1();
  a = QueryPerformanceCounter();
  probably_do_stuff_with(a-s)(&delayAcc);
  do_stuff_for_player2();
  b = QueryPerformanceCounter();
  probably_do_stuff_with(b-a)(&delayAcc);
  diff  = b-s:
  if (diff > tpf) { delayAcc += (diff - tpf) }
  if (diff < tpf) { wait_until_frame_is_finished; go to next frame }

Disabling the threshold completly gives pretty much same results as yours, but i have some generic error message instead smthing like "connection with remote player lost". So I was even wondering if the divergence is the main issue here, or if it just a result of some previous operation failing and the game happens to catch it as divergence event.

@ThirteenAG
Copy link

Something I also noticed while testing coop with two instances of exe, after initial movement game freezes for a bit, and normally after that, when playing with another pc, out of sync error appears, yet locally it unfreezes and continues. Maybe the problem is localized to whatever is happening during that freeze.

@Ododo
Copy link
Owner

Ododo commented Jul 28, 2024

Overall it might be an issue described here, since many people confirmed different CPUs cause out of sync error.

https://cookieplmonster.github.io/2020/07/19/silentpatch-mass-effect/#part-3

Unless i did something wrong disabling PSGP did not help..
Tried with:
DisablePSGP
DisableD3DXPSGP
DisableD3DX10PSGP
On both intel and amd machines.

Do note that for dx9 the variable is DisableD3DXPSGP, but it is DisableD3DX10PSGP for dx10.

I wonder what could happen if we spoof cpuid though..

@ThirteenAG
Copy link

Well, I tried to nop all cpuid instructions, doesn't make any difference.

@r3538987
Copy link

r3538987 commented Aug 17, 2024

Just played with friend first coop map.
No issues what's so ever, silky smooth 60fps. Used scc_lan_helper EXE version.
My CPU - Ryzen 9 5900X
His CPU - Ryzen 7 3800XT

2nd map - quite some desyncs.
3rd map - no desyncs.

Not sure if these are map related things or not.

@englerd
Copy link

englerd commented Oct 1, 2024

@r3538987 my CPU: AMD Ryzen 5 6600H - Shall we play together in co-op mode?

@agret
Copy link

agret commented Oct 15, 2024

Overall it might be an issue described here, since many people confirmed different CPUs cause out of sync error.

https://cookieplmonster.github.io/2020/07/19/silentpatch-mass-effect/#part-3

I have tried to put this dll into the game folder but it won't work because Conviction uses d3dx9_41.dll not d3dx9_31.dll

Unrelated but for your fusion mod, if you add a file to the game folder called steam_appid.txt and put inside that 33220 it will let the game open directly from the EXE without giving the weird Steam error. Steam Overlay isn't loaded this way but otherwise launches okay.

@ThirteenAG
Copy link

Unrelated but for your fusion mod, if you add a file to the game folder called steam_appid.txt and put inside that 33220 it will let the game open directly from the EXE without giving the weird Steam error. Steam Overlay isn't loaded this way but otherwise launches okay.

It works with steam version, or any version rather.

@agret
Copy link

agret commented Oct 16, 2024

Your fusion mod patch works with any version of the game, it's the DirectX patch from Mass Effect 3 that redirects the math functions that i'm talking about. Splinter Cell targets a slightly newer version of the dll so just dropping in that one doesn't work, neither does renaming it to d3d9x_41.dll as it has some new functions in the updated file it just gives a missing export error when trying to launch the game. To fix those DirectX math functions we need an updated version of the dll targetting d3d9x_41.dll.

or did I misunderstand this reply? I haven't tested the steam_appid.txt addition on any non-steam version of the game to see if it causes any issue but it shouldn't do anything with that file unless it has the Steam imports in the game exe. This fix will work for any Steam version of Splinter Cell Conviction yes, doesn't matter what update it's on. Originally I thought we might need to add steam_api.dll or steamclient.dll but seems that it is statically linked to the game exe on Steam version so the only file we need to add is the missing steam_appid.txt

@ThirteenAG
Copy link

I tried the dll and it doesn't make any difference. The problem is in exe.

@Ododo
Copy link
Owner

Ododo commented Oct 16, 2024

This thread is dedicated to solving this particular issue, so please only post what is relevant.

I'll just post this: openssl/openssl#2848 , as we might want to look into something similar, although it does not match the fact that nopping cpuid changes nothing.
Conviction embeds openssl 0.9.8l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants