View Single Post
Old 10-31-2012, 11:30 PM   #230
The Stig
ensiform's Avatar
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Originally Posted by -=*Raz0r*=- View Post
There is a bug in jamp.exe where connecting to an invalid hostname or IP whilst ingame will shove you out to a black screen, unable to do anything (including open your console). A very ugly situation.

The function in question is CL_Connect_f (0x41D990)
The code in question is:
	//Taken from q3
	if (!NET_StringToAdr( cls.servername, &clc.serverAddress) ) {
		Com_Printf ("Bad server address\n");
		cls.state = CA_DISCONNECTED;
At the very least, it should be setting your connection state to CA_CONNECTING

Ideally, you would rewrite this function to have a different code path if you attempt to connect to a bad hostname or IP whilst ingame.
Another solution, is to patch the opcode setting cls.state to CA_DISCONNECTED

You will have to unlock the code page with VirtualProtect or mprotect
I suggest writing a wrapper.

UnlockMemory( 0x41DACB, 1 );
*(unsigned char *)0x41DACB = (unsigned char)0x03;
LockMemory( 0x41DACB, 1 );
At the moment this fix is only for Windows, but it is possible to fix on Mac with the right addresses.

With this fix, you will be sent to the "Connecting to someinvalidhostname...1" screen and things will carry on as normal. Not ideal, but it works.
This fix is actually wrong.

The problem is raven fail coding in the UI:

(Main menu is never actually loaded because you were in the server last which will tell UI_Init to be (qtrue) on ingameload so it will only load ingame related menus. (This is fine however)

When it goes to try to revert back to main menu with setactivemenu UIMENU_MAIN:

			if (uiInfo.inGameLoad) 
//				UI_LoadNonIngame();
because of this, it fails to actually "activate" main.

iojamp project lead / coder
ensiform is offline   you may: quote & reply,