Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Code] Fix custom asset loading for client

Featured Replies

Опубликовано:

I noticed that custom menu and weapon files are not loaded when you join a modded server, for example with the promod_v3.3. So I said to myself why not fix this and came quickly up with this solution.

 

Index: PatchMW2DownloadCL.cpp
===================================================================
--- PatchMW2DownloadCL.cpp	(revision 122)
+++ PatchMW2DownloadCL.cpp	(working copy)
@@ -486,6 +486,8 @@

			dls.isDownloading = false;
			CL_DownloadsComplete(0);
+			//afaik iw3 also reconnects after download, cl_modVidRestart dvar should probably be changed but I'll let NTA do this 
+			Cmd_ExecuteSingleCommand(0, 0, "reconnect");
		}
	}
}
@@ -564,6 +566,59 @@
	}
}

+void GetFS_Game()
+{
+	char* msg = (char *)0x1CB7EB9;//it actually starts at 0x1CB7EB8
+
+	while(true)
+	{
+		if(msg[0]==0)
+			return; //this should never happen
+		if(memcmp("fs_game", msg, sizeof("fs_game") - 1) == 0)
+			break;
+		msg++;
+	}
+
+	msg += 8; //old value + sizeof("fs_game\\")
+	int length = 0;
+	do
+	{
+		length++;
+	}
+	while(msg[length]!='\\');
+
+	if(length==0)
+		Dvar_SetCommand("fs_game", "");
+	else
+	{
+		char* buffer = (char*)malloc(length + 1);
+		buffer[length] = 0; //terminate string
+		memcpy(buffer, msg, length);
+		Dvar_SetCommand("fs_game", buffer);
+		free(buffer);
+	}
+}
+
+void __declspec(naked) clParseGamestateHookStub()
+{
+	__asm
+	{
+		mov ebx,[esp]
+		mov [esp+4],ebx
+		//code we've overwritten
+		add esp,4
+		mov ebx,eax
+
+		test edi,edi //some kind of ID
+		jne back
+		pushad
+		call GetFS_Game
+		popad
+back:
+		ret
+	}
+}
+
// hook definitions
CallHook clInitDownloadsHook; // from CL_ParseGamestate, currently calls CL_DownloadsComplete
DWORD clInitDownloadsHookLoc = 0x5AC6E9;
@@ -574,6 +629,9 @@
CallHook connStatusDisplayHook;
DWORD connStatusDisplayHookLoc = 0x49FA39;

+DWORD clParseGamestateHookLoc = 0x5AC4B0;
+
+
#include "ExtDLL.h"
extern IExtDLL* g_extDLL;

@@ -625,6 +683,11 @@
	connStatusDisplayHook.initialize(connStatusDisplayHookLoc, DisplayConnectionStatusHookStub);
	connStatusDisplayHook.installHook();

+	if(!GAME_FLAG(GAME_FLAG_DEDICATED))
+	{
+		call(clParseGamestateHookLoc, clParseGamestateHookStub, eCallPatcher::PATCH_CALL);
+	}
+
	// switch table in CL_ParseServerMessage
	*(DWORD*)0x4A9FD8 = (DWORD)CL_ParseServerMessageHookStub - (0x4A9FD6 + 6);

Requires the reconnect patch I posted here: viewtopic.php?f=17&t=26688#p225039

 

Greetings to banz, this is for you. I want to thank you for all your contributions.

Опубликовано:

Ah, the bug that has plauged mods that load custom assets. Nice work on fixing it, should really be implemented into the client.

Опубликовано:
  • Автор
they aren't loaded because fs_game is set after fs_startup process, fix this and you won't even need to reconnect.

Seems you didn't read the code. That's exactly what I do, it's just reconnecting when you need to download the mod (not even sure if this is needed but IW3 also does it).

Опубликовано:
  • Автор
Seems you didn't read the code. That's exactly what I do, it's just reconnecting when you need to download the mod (not even sure if this is needed but IW3 also does it).

 

ups, yeah, I guess you are right, the code it really messy, but thanks for showing us proof of concept

I'd appreciate any try to make it better.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.