Nihlathek Portal Fix#2

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Nihlathek Portal Fix#2

Post by devurandom » Mon Jun 19, 2017 7:29 am

Nilathek Portal fix that works... no multiple portals, you don't have to talk to Anya
It works flawless (as it should) before/after quest is finished.

Code: Select all

[1.13d]

//JMP PATCH @ 0x1FF27

	JZ SHORT GOODEXIT
	MOV EAX,DWORD PTR[ESP+0x14]		// pPlayer @ esp+0x14
	PUSH EAX
	CALL NilPortalFix				// Quests_CheckFlag is quest complete ?
	TEST EAX,EAX
	JNZ SHORT GOODEXIT
	JMP D2GP_NilPortRetJmp2			// 0x1FFEC Quest not started skip portal flag

GOODEXIT:
	JMP D2GP_NilPortRetJmp1 		// 0x1FF2D


Unfortunately I can't post Code for NilPortalFix "Call" because I'm not allowed.

Forbidden

You don't have permission to access /forum/posting.php on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
thaison
Junior Member
Paladin
Posts: 108
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

Re: Nihlathek Portal Fix#2

Post by thaison » Sat Oct 14, 2017 6:12 am

[1.13c]

Code: Select all

PATCH_JMP - 0x5AE67

__asm
{
	je Code1
	mov eax, [ESP+0x14]
	push eax
	call D2COMMON_QUESTS_CheckFlag     //#10174
	test eax, eax
	jnz Code1
	jmp Nihlathek_Portal_Fix_II     //0x5AF2C
Code1:
	jmp Nihlathek_Portal_Fix_I     //0x5AE6D
}


User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Nihlathek Portal Fix#2

Post by devurandom » Sat Oct 14, 2017 11:01 am

thaison" wrote:[1.13c]

Code: Select all

PATCH_JMP - 0x5AE67
__asm
{
	je Code1
	mov eax, [ESP+0x14]
	push eax
	call D2COMMON_QUESTS_CheckFlag     //#10174
	test eax, eax
	jnz Code1
	jmp Nihlathek_Portal_Fix_II     //0x5AF2C
Code1:
	jmp Nihlathek_Portal_Fix_I     //0x5AE6D
}

Your code will crash... or fail. Quests_CheckFlags takes 3 arguments.

NilPortalFix expands pPlayer to get -> QuestFlag* pQuest.
From that it checks Quests_CheckFlags, if the Nihlathak quest reward is pending or quest completed ... function returns true or false.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
thaison
Junior Member
Paladin
Posts: 108
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

Re: Nihlathek Portal Fix#2

Post by thaison » Sat Oct 14, 2017 12:08 pm

devurandom" wrote:
thaison" wrote:[1.13c]

Code: Select all

PATCH_JMP - 0x5AE67
__asm
{
	je Code1
	mov eax, [ESP+0x14]
	push eax
	call D2COMMON_QUESTS_CheckFlag     //#10174
	test eax, eax
	jnz Code1
	jmp Nihlathek_Portal_Fix_II     //0x5AF2C
Code1:
	jmp Nihlathek_Portal_Fix_I     //0x5AE6D
}

Your code will crash... or fail. Quests_CheckFlags takes 3 arguments.

NilPortalFix expands pPlayer to get -> QuestFlag* pQuest.
From that it checks Quests_CheckFlags, if the Nihlathak quest reward is pending or quest completed ... function returns true or false.
I did on my mod, it works very well.

Image

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Nihlathek Portal Fix#2

Post by devurandom » Sat Oct 14, 2017 8:19 pm

My code does not open the Nihlathak portal before the quest is started.
The portal remains open after Nihlathak quest is completed, or reward is pending.
Both conditions will close the portal in vanilla d2, if I recall correctly.

I haven't checked your code, but if it does all that correctly, then it's better than what I posted.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
Kaladann
Junior Member
Paladin
Posts: 108
Joined: Fri Oct 23, 2015 1:15 am
Location: France
France

Re: Nihlathek Portal Fix#2

Post by Kaladann » Wed Aug 29, 2018 7:00 am

thaison wrote:
Sat Oct 14, 2017 6:12 am
[1.13c]

Code: Select all

PATCH_JMP - 0x5AE67

__asm
{
	je Code1
	mov eax, [ESP+0x14]
	push eax
	call D2COMMON_QUESTS_CheckFlag     //#10174
	test eax, eax
	jnz Code1
	jmp Nihlathek_Portal_Fix_II     //0x5AF2C
Code1:
	jmp Nihlathek_Portal_Fix_I     //0x5AE6D
}


Hello !

Can someone translate me this CE as a 'search and replace' form please ?
Like this exemple:

Code: Select all

"Level Cap" ;it's hardcoded so you can't gain more than one level from this quest

D2Game.dll - 5BFF8

6FC7BFF8    3BDD            CMP EBX,EBP
6FC7BFFA    7E 04           JLE SHORT D2Game.6FC7C000

TO

6FC7BFF8    3BDD            CMP EBX,EBP
6FC7BFFA    EB 04           JMP SHORT D2Game.6FC7C000

;This will remove the level cap
Thank you in advance :drunk:
Want to play but not enought time to drop good stuff and raise decent level ? Try Casual Nostalgia !
ImageMore infos here : viewtopic.php?f=5&t=63800
CHEERS !

FearedBliss
Posts: 82
Joined: Sat Oct 16, 2010 4:29 pm
United States of America

Re: Nihlathek Portal Fix#2

Post by FearedBliss » Sat Oct 27, 2018 4:33 am

@devurandom

I only did some quick random testing of this, and it seems that if I simply NOP 0x1FF27, it works...

Before you rescue Anya (Nil is in town), the portal doesn't open, and if the quest is complete, the portal stays open. Is there anything else?

EDIT:

I got a chance to do more extensive testing. I can confirm that simply NOPping 0x1FF27 will work. That line means "Was the waypoint activated?". It runs after what seems to be a check of whether or not Nil was killed (quest complete).

I also tested the following scenarios with the simple NOP:

(No waypoint at this point from a character progression perspective)

1. Is portal displayed when Anya/Nil quest havent been started? [No]
2. Does portal show up when you are looking for Anya? [No]
3. Does portal show up when you rescued Anya? [It doesn't show here automatically, but will open as normal when you talk to Anya after rescuing her]
4. Does portal show up when you kill Nil without taking Waypoint? [Yes]
5. Does portal show up after you activate the waypoint? [Yes]

Thus all of the above situations pass the required behavior checks. Thanks for the fix @devurandom.

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Nihlathek Portal Fix#2

Post by devurandom » Sat Oct 27, 2018 7:39 am

Hey, that's a good find.. maybe I over thought this too much. But you may also check it in multiplayer
cause I found an bug issue, where things didn't work right in my previous version, partly posted above.

;)
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

FearedBliss
Posts: 82
Joined: Sat Oct 16, 2010 4:29 pm
United States of America

Re: Nihlathek Portal Fix#2

Post by FearedBliss » Sat Oct 27, 2018 4:21 pm

Hey devurandom,

I ran through my set of tests in a LAN game and the same thing. Everything works as expected.

Daemonjax
Posts: 12
Joined: Sat Sep 01, 2012 11:44 am

Re: Nihlathek Portal Fix#2

Post by Daemonjax » Sat May 09, 2020 5:04 am

Just wanted to say thanks for this and (for 1.13c) I simply NOP'd out (as per FearedBliss's post for 1.13d):

:6FC7AE60 E86DFCFAFF Call 6FC2AAD2
:6FC7AE65 85C0 test eax, eax
:6FC7AE67 0F85BF000000 jne 6FC7AF2C <---- NOP'd this line out
:6FC7AE6D 5E pop esi
:6FC7AE6E C6858900000001 mov byte ptr [ebp+00000089], 01
:6FC7AE75 5D pop ebp
:6FC7AE76 59 pop ecx
:6FC7AE77 C3 ret

And it seems to work as expected. Neato.

If anyone's wondering... In a hex editor, the line is at 0x5AE67 within D2Game.dll
You see 0x6FC7AE67 above because when you dissassemble d2game.dll (using win32dasm) it adds the imagebase (0x6FC20000) to the lines you get as the output.
So, 0x6FC20000 + 0x0005AE67 = 0x6FC7AE67.

NOPing something out means replacing it with a no-op instruction, which on intel x86 binaries is 0x90 (so NOPing out the above line uses six 90's).

And when you dissassemble a dll, win32dasm will give you the imagebase offset at the top of the output.

Post Reply

Return to “Code Editing”