Page 1 of 1

Woes of MQ2Spawns.cpp

Posted: Mon Mar 15, 2004 4:35 am
by Preocts

Code: Select all

Compiling...
MQ2Spawns.cpp
MQ2Spawns.cpp(75) : error C2420: 'EQItemList_Trampoline' : illegal symbol in first operand
MQ2Spawns.cpp(76) : error C2415: improper operand type
MQ2Spawns.cpp(90) : warning C4035: 'EQItemList_Detour' : no return Value
MQ2Spawns.cpp(101) : error C2420: 'dEQItemList_Trampoline' : illegal symbol in first operand
MQ2Spawns.cpp(102) : error C2415: improper operand type
Error executing cl.exe.

MQ2Spawns.obj - 4 error(s), 1 warning(s)
Bleh, I'm VB coder not a C+ wiz. Errr, help.

Getting this as I'm building MQ2Main.dll as per the instructions that I've followed for years now :?

Gonna dig into it mahself and see if I can figure out why I'm getting errors when I never did before. /shrug.

---Edit
:evil: is all I have to say about this. I no have da skillz 4 this! sigh, glad to know, at least, that I'm not the only programmer in the world that has random problems appear in his code.

Posted: Mon Mar 15, 2004 5:13 am
by DJPrez
Aye,,, same here ::

Code: Select all

MQ2Spawns.cpp
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(75) : error C2420: 'EQItemList_Trampoline' : illegal symbol in first operand
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(76) : error C2415: improper operand type
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(90) : warning C4035: 'EQItemList_Detour' : no return value
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(101) : error C2420: 'dEQItemList_Trampoline' : illegal symbol in first operand
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(102) : error C2415: improper operand type

Posted: Mon Mar 15, 2004 5:35 am
by smelly wang

Code: Select all

	DWORD EQItemList_Detour()
	{
		[color=red]EQItemList_Trampoline();[/color]
		__asm {
			push eax;
			push ebx;
			push ecx;
			push edx;
			push esi;
			push edi;
			call AddGroundItem;
			pop edi;
			pop esi;
			pop edx;
			pop ecx;
			pop ebx;
			pop eax;
		};
	}

Code: Select all

		__asm {
			push ecx;
			push ecx;
			call RemoveGroundItem;
			pop ecx;
			pop ecx;
		};
		[color=red]dEQItemList_Trampoline();[/color]

Code: Select all

	void dEQPlayer_Detour(void)
	{
		__asm {
			push ecx;
			push ecx;
			call PluginsRemoveSpawn;
			pop ecx;
			pop ecx;
		};
		[color=red]dEQPlayer_Trampoline();[/color]
/*
		PSPAWNINFO pSpawn;
		__asm {mov [pSpawn], ecx};
		__asm {push ecx};
//		PreserveRegisters(PluginsRemoveSpawn((PSPAWNINFO)pSpawn));
		PluginsRemoveSpawn((PSPAWNINFO)pSpawn);
		__asm {pop ecx};
		dEQPlayer_Trampoline();
/**/
	}

Posted: Mon Mar 15, 2004 5:35 am
by dont_know_at_all
Untested, but compiles and should work:

Code: Select all

Index: MQ2Spawns.cpp
===================================================================
RCS file: /cvsroot/macroquest/macroquest2/MQ2Main/MQ2Spawns.cpp,v
retrieving revision 1.4
diff -u -r1.4 MQ2Spawns.cpp
--- MQ2Spawns.cpp	15 Mar 2004 02:41:10 -0000	1.4
+++ MQ2Spawns.cpp	15 Mar 2004 10:24:02 -0000
@@ -71,8 +71,9 @@
 	DWORD EQItemList_Trampoline();
 	DWORD EQItemList_Detour()
 	{
+            unsigned long (EQItemListHook::*tmp)(void) = EQItemList_Trampoline;
 		__asm {
-			call EQItemList_Trampoline;
+			call [tmp];
 			push eax;
 			push ebx;
 			push ecx;
@@ -92,13 +93,14 @@
 	void dEQItemList_Trampoline();
 	void dEQItemList_Detour()
 	{
+            void (EQItemListHook::*tmp)(void) = dEQItemList_Trampoline;
 		__asm {
 			push ecx;
 			push ecx;
 			call RemoveGroundItem;
 			pop ecx;
 			pop ecx;
-			call dEQItemList_Trampoline;
+			call [tmp];
 		};
 	}
 };
@@ -143,13 +145,14 @@
 	void dEQPlayer_Trampoline(void);
 	void dEQPlayer_Detour(void)
 	{
+            void (EQPlayerHook::*tmp)(void) = dEQPlayer_Trampoline;
 		__asm {
 			push ecx;
 			push ecx;
 			call PluginsRemoveSpawn;
 			pop ecx;
 			pop ecx;
-			call dEQPlayer_Trampoline;
+			call [tmp];
 		};
 /*
 		PSPAWNINFO pSpawn;

Posted: Mon Mar 15, 2004 5:37 am
by dont_know_at_all
This may be fixed by VS6SP5. I'd like some confirmation one way or another, please, if someone has SP5 installed.

Posted: Mon Mar 15, 2004 6:42 am
by Kint
just installed SP5, still got those 4 errors so reverting back to the fix you posted in the diff.

edit: although I do get this warning with the diff'd changes
'EQItemList_Detour' : no return value

Wonderful

Posted: Mon Mar 15, 2004 7:04 am
by Preocts
Ran those changes through and no more errors. I don't pretend to understand what I just did but hey, it works and that is what counts. Maybe if I'm bored and have a month to spare I'll walk the whole source and then might understand a quarter of it.

Thanks for the fix anyways! :D

Posted: Mon Mar 15, 2004 9:41 am
by DJPrez
I just installed Service pack 5 and still receive the errors =(

Code: Select all

MQ2Spawns.cpp
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(75) : error C2420: 'EQItemList_Trampoline' : illegal symbol in first operand
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(76) : error C2415: improper operand type
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(90) : warning C4035: 'EQItemList_Detour' : no return value
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(101) : error C2420: 'dEQItemList_Trampoline' : illegal symbol in first operand
C:\Documents and Settings\DJPrez\Desktop\MQ2-Latest\MQ2Main\MQ2Spawns.cpp(102) : error C2415: improper operand type
MQ2UserVars.cpp
MQ2Utilities.cpp
MQ2Windows.cpp
Error executing cl.exe.

MQ2Main.dll - 4 error(s), 1 warning(s)



+,,, what were we suppose to do *exactly* with that new code above? Copy and paste over the Spawn.cpp file? Add it somewhere? Create a new plugin? I was uncertain as what to do to try it out. Thanks =)

Posted: Mon Mar 15, 2004 10:33 am
by Preocts
+,,, what were we suppose to do *exactly* with that new code above? Copy and paste over the Spawn.cpp file? Add it somewhere? Create a new plugin? I was uncertain as what to do to try it out. Thanks =)

Code: Select all

[color=blue]@@ -71,8 +71,9 @@[/color]
   DWORD EQItemList_Trampoline(); 
   DWORD EQItemList_Detour() 
   { 
[color=red]+[/color]            unsigned long (EQItemListHook::*tmp)(void) = EQItemList_Trampoline; 
      __asm { 
[color=red]-[/color]         call EQItemList_Trampoline; 
[color=red]+[/color]         call [tmp]; 
         push eax; 
         push ebx; 
         push ecx; 
Remove the line with the -
Add the line with the +

The Location is given with the @ numbers. That's line number 71 in this snippet. Don't include the '+''s btw, just the code.[/code]

Posted: Mon Mar 15, 2004 11:38 am
by Lax
oh man... vs6 really is the retarded child. ah well, tested this on my other machine, cvsed it, and now im going to update the zip.

Posted: Mon Mar 15, 2004 11:50 am
by Lax
fixed, locking thread. if you have a new issue post a new fucking thread.