random diffs

Moderator: MacroQuest Developers

onetimehero
a ghoul
a ghoul
Posts: 105
Joined: Fri Sep 05, 2003 2:42 pm

random diffs

Post by onetimehero » Mon Apr 25, 2005 8:12 pm

Couple diffs for timer datatype and fixing inheritance, and adding IS console output to ISXEQChatWnd:

Code: Select all

--- \temp\mqsrc.pristine\mq2main\isxeq\isxeq.cpp        2005-04-25 17:03:41.6293
14400 -0700
+++ isxeq.cpp   2005-04-24 23:56:25.667037700 -0700
@@ -140,11 +140,15 @@
        // pISInterface->AddLSType(*pMyType);

 #define DATATYPE(_class_,_variable_) _variable_ = new _class_; pISInterface->Ad
dLSType(*_variable_);
 #include "ISXEQDataTypes.h"
 #undef DATATYPE
-
+// NOTE: SetInheritance does NOT make it inherit, just notifies the syntax checker...
+       pGroupMemberType->SetInheritance(pSpawnType);
+       pCharacterType->SetInheritance(pSpawnType);
+       pBuffType->SetInheritance(pSpellType);
+       pRaidMemberType->SetInheritance(pSpawnType);
 }

 void CISXEQ::RegisterTopLevelObjects()
 {
        // add any Top-Level Objects

Code: Select all

--- \temp\mqsrc.pristine\mq2main\isxeq\isxeqPulse.cpp   2005-04-25 17:03:43.4892
48700 -0700
+++ isxeqPulse.cpp      2005-04-24 09:35:21.167507500 -0700
@@ -198,12 +198,44 @@
        }
        DWORD GameState=*(DWORD*)(0xB54+pEverQuest);
        return GameState;
 }

+VOID DropTimers(VOID)
+{
+       PMQTIMER pTimer=gTimer;
+       CHAR szOrig[MAX_STRING] = {0};
+       while(pTimer)
+       {
+               if (pTimer->Current)
+                       pTimer->Current--;
+               pTimer=pTimer->pNext;
+       }
+}
+
+
 void Heartbeat()
 {
+    static DWORD LastGetTick = 0;
+       static bool bFirstHeartBeat = true;
+       static DWORD TickDiff=0;
+    DWORD Tick = GetTickCount();
+       if (bFirstHeartBeat)
+       {
+               LastGetTick=Tick;
+               bFirstHeartBeat=false;
+       }
+       // This accounts for rollover
+       TickDiff += (Tick-LastGetTick);
+       LastGetTick=Tick;
+
+    while (TickDiff>=100) {
+        TickDiff-=100;
+        if (gDelay>0) gDelay--;
+               DropTimers();
+    }
+
        if (!gStringTableFixed && pStringTable)
        {
                FixStringTable();
                gStringTableFixed=TRUE;
        }

Code: Select all

--- \temp\mqsrc.pristine\mq2chatwnd\isxeqchatwnd.cpp    2005-04-25 17:03:24.4366
44400 -0700
+++ isxeqchatwnd.cpp    2005-04-22 14:55:48.727546700 -0700
@@ -107,10 +107,11 @@

 ISInterface *pISInterface=0;
 HISXSERVICE hPulseService=0;
 HISXSERVICE hMemoryService=0;
 HISXSERVICE hServicesService=0;
+HISXSERVICE hConsoleService=0;

 HISXSERVICE hEQChatService=0;
 HISXSERVICE hEQUIService=0;
 HISXSERVICE hEQGamestateService=0;
 HISXSERVICE hEQSpawnService=0;
@@ -118,10 +119,11 @@

 // Forward declarations of callbacks
 void __cdecl PulseService(bool Broadcast, unsigned long MSG, void *lpData);
 void __cdecl MemoryService(bool Broadcast, unsigned long MSG, void *lpData);
 void __cdecl ServicesService(bool Broadcast, unsigned long MSG, void *lpData);
+void __cdecl ConsoleService(bool Broadcast, unsigned long MSG, void *lpData);


 // Initialize is called by Inner Space when the extension should initialize.
 bool ISXEQChatWnd::Initialize(ISInterface *p_ISInterface)
 {      pISInterface=p_ISInterface;
@@ -195,10 +197,11 @@
        // message every frame (after the frame is displayed) and "Memory" which

        // wraps "detours" and memory modifications
        hPulseService=pISInterface->ConnectService(this,"Pulse",PulseService);
        hMemoryService=pISInterface->ConnectService(this,"Memory",MemoryService)
;
        hServicesService=pISInterface->ConnectService(this,"Services",ServicesSe
rvice);
+       hConsoleService=pISInterface->ConnectService(this,"Console",ConsoleServi
ce);


 }

 void ISXEQChatWnd::RegisterCommands()
@@ -239,10 +242,13 @@
 }

 void ISXEQChatWnd::DisconnectServices()
 {
        // gracefully disconnect from services
+       if (hConsoleService)
+               pISInterface->DisconnectService(this,hConsoleService);
+
        if (hPulseService)
                pISInterface->DisconnectService(this,hPulseService);
        if (hMemoryService)
        {
                pISInterface->DisconnectService(this,hMemoryService);
@@ -470,10 +476,62 @@
                break;
        }
 #undef pChat
 }

+void __cdecl ConsoleService(bool Broadcast, unsigned long MSG, void *lpData)
+{
+#define pConsOutput ((char *)lpData)
+       switch(MSG)
+       {
+       case CONSOLE_OUTPUT:
+               {
+                       // same as OnWriteChatColor
+                       if (!MQChatWnd)
+                       {
+                               EQGamestateService(false,GAMESTATESERVICE_CHANGE
D,(void*)gGameState);
+                               if (!MQChatWnd)
+                                       return;
+                       }
+                       MQChatWnd->Show=1;
+
+                       PFILTER pFilter = gpFilters;
+
+                       while (pFilter) {
+                               if (!pFilter->pEnabled || (*pFilter->pEnabled))
{
+                                       if (!strnicmp(pConsOutput,pFilter->Filte
rText,pFilter->Length))
+                                       {
+                                               return;
+                                       }
+                               }
+                               pFilter = pFilter->pNext;
+                       }
+                       DWORD Color=pChatManager->GetRGBAFromIndex(USERCOLOR_DEF
AULT);
+
+                       CHAR szProcessed[MAX_STRING];
+                       MQToSTML(pConsOutput,szProcessed,MAX_STRING,Color);
+                       strcat(szProcessed,"<br>");
+                       CXStr NewText(szProcessed);
+                       DebugTry(ConvertItemTags(NewText,0));
+
+                       ChatBuffer *pNewBuffer = new ChatBuffer;
+                       GetCXStr(NewText.Ptr,pNewBuffer->Text,MAX_STRING);
+                       pNewBuffer->pPrev=pPendingChatTail;
+                       pNewBuffer->pNext=0;
+                       if (pPendingChatTail)
+                               pPendingChatTail->pNext=pNewBuffer;
+                       else
+                               pPendingChat=pNewBuffer;
+                       pPendingChatTail=pNewBuffer;
+                       PendingChatLines++;
+               }
+               break;
+       }
+#undef pConsOutput
+}
+
+
 // This uses the Services service to connect to ISXEQ services
 void __cdecl ServicesService(bool Broadcast, unsigned long MSG, void *lpData)
 {
 #define Name ((char*)lpData)
        switch(MSG)
Hmm. That's odd.

onetimehero
a ghoul
a ghoul
Posts: 105
Joined: Fri Sep 05, 2003 2:42 pm

More Diffs

Post by onetimehero » Wed Apr 27, 2005 7:42 pm

Code: Select all

--- \temp\mqsrc.pristine\mq2main\mq2windows.cpp	2005-04-25 17:03:53.914258600 -0700
+++ ..\mq2windows.cpp	2005-04-27 14:56:54.735439900 -0700
@@ -145,15 +145,21 @@
 	int XMLRead_Trampoline(CXStr *A, CXStr *B, CXStr *C);
 };
 DETOUR_TRAMPOLINE_EMPTY(int CXMLSOMDocumentBaseHook::XMLRead_Trampoline(CXStr *A, CXStr *B, CXStr *C)); 
 
 
-
+#ifndef ISXEQ
 VOID ListWindows(PSPAWNINFO pChar, PCHAR szLine);
 VOID WndNotify(PSPAWNINFO pChar, PCHAR szLine);
 VOID ItemNotify(PSPAWNINFO pChar, PCHAR szLine);
 VOID ListItemSlots(PSPAWNINFO pChar, PCHAR szLine);
+#else
+int ListWindows(int argc, char *argv[]);
+int WndNotify(int argc, char *argv[]);
+int ItemNotify(int argc, char *argv[]);
+int ListItemSlots(int argc, char *argv[]);
+#endif
 
 void InitializeMQ2Windows()
 {
         int i;
 	DebugSpew("Initializing MQ2 Windows");
@@ -189,10 +195,15 @@
 #ifndef ISXEQ
 	AddCommand("/windows",ListWindows,false,true,false);
 	AddCommand("/notify",WndNotify,false,true,false);
 	AddCommand("/itemnotify",ItemNotify,false,true,false);
 	AddCommand("/itemslots",ListItemSlots,false,true,false);
+#else
+	pISInterface->AddCommand("EQWindows",ListWindows);
+	pISInterface->AddCommand("EQNotify",WndNotify);
+	pISInterface->AddCommand("EQItemNotify",ItemNotify);
+	pISInterface->AddCommand("EQItemSlots",ListItemSlots);
 #endif
 
 	if (pWndMgr)
 	{
 		CHAR Name[MAX_STRING]={0};
@@ -274,10 +285,15 @@
 #ifndef ISXEQ
 	RemoveCommand("/windows");
 	RemoveCommand("/notify");
 	RemoveCommand("/itemnotify");
 	RemoveCommand("/itemslots");
+#else
+	pISInterface->RemoveCommand("EQWindows");
+	pISInterface->RemoveCommand("EQNotify");
+	pISInterface->RemoveCommand("EQItemNotify");
+	pISInterface->RemoveCommand("EQItemSlots");
 #endif
 	RemoveDetour(CXMLSOMDocumentBase__XMLRead);
 	RemoveDetour(CSidlScreenWnd__SetScreen);
 	RemoveDetour(CXWndManager__RemoveWnd);
 	WindowList.Cleanup();
@@ -681,12 +697,27 @@
 			WindowList[N]=0;
 		}
 	}
 }
 
+#ifndef ISXEQ
+#define RETURN(x) return;
+#else
+#define RETURN(x) return x;
+#endif
+
+#ifndef ISXEQ
 VOID ListWindows(PSPAWNINFO pChar, PCHAR szLine)
 {
+#else
+int ListWindows(int argc, char *argv[])
+{
+	PCHAR szLine = NULL;
+	if (argc>0)
+		szLine = argv[1];
+
+#endif
 	CHAR Name[MAX_STRING]={0};
 	CHAR AltName[MAX_STRING]={0};
 	CHAR Type[MAX_STRING]={0};
 	unsigned long Count=0;
 	if (!szLine || !szLine[0])
@@ -708,11 +739,11 @@
 		MakeLower(WindowName);
 		unsigned long N = WindowMap[WindowName];
 		if (!N)
 		{
 			WriteChatf("Window '%s' not available",szLine);
-			return;
+			RETURN(0);
 		}
 		N--;
 		WriteChatf("Listing child windows of '%s'",szLine);
 		WriteChatColor("-------------------------");
 		if (_WindowInfo *pInfo=WindowList[N])
@@ -739,10 +770,11 @@
 				pWnd=(PCSIDLWND)pInfo->pWnd->GetNextChildWnd((CXWnd*)pWnd);
 			}
 			WriteChatf("%d child windows",Count);
 		}
 	}
+	RETURN(0);
 }
 
 PCHAR szWndNotification[] = { 
 	0,			//0 
 	"leftmouse",	//1
@@ -777,35 +809,53 @@
 }; 
 
 #ifndef ISXEQ
 VOID WndNotify(PSPAWNINFO pChar, PCHAR szLine)
 {
+#else
+int WndNotify(int argc, char *argv[])
+{
+	PSPAWNINFO pChar = (PSPAWNINFO)pLocalPlayer;
+#endif
+	unsigned long Data=0;
+#ifndef ISXEQ
 	CHAR szArg1[MAX_STRING] = {0}; 
 	CHAR szArg2[MAX_STRING] = {0}; 
 	CHAR szArg3[MAX_STRING] = {0}; 
 	CHAR szArg4[MAX_STRING] = {0}; 
-
 	GetArg(szArg1, szLine, 1);
 	GetArg(szArg2, szLine, 2);
 	GetArg(szArg3, szLine, 3);
 	GetArg(szArg4, szLine, 4);
 
 	if (!szArg3[0])
 	{
 		SyntaxError("Syntax: /notify <window|\"item\"> <control|0> <notification> [notification data]");
-		return;
+		RETURN(0);
 	}
-	unsigned long Data=0;
 	if (szArg4[0])
 		Data=atoi(szArg4);
+#else
+	if (argc<3)
+	{
+		printf("%s syntax: %s <window|\"item\"> <control|0> <notification> [notification data]",argv[0],argv[0]);
+		RETURN(0);
+	}
+	if (argc>3)
+		Data=atoi(argv[4]);
+	CHAR *szArg1=argv[1];
+	CHAR *szArg2=argv[2];
+	CHAR *szArg3=argv[3];
+
+#endif
 
 	if (Data==0 && SendWndClick(szArg1,szArg2,szArg3))
-		return;
+		RETURN(0);
 	if (!stricmp(szArg3,"listselect"))
 	{
 		SendListSelect(szArg1,szArg2,Data-1);
-		return;
+		RETURN(0);
 	}
 
 	for (unsigned long i = 0 ; i < 30 ; i++)
 	{
 		if (szWndNotification[i] && !stricmp(szWndNotification[i],szArg3))
@@ -819,14 +869,15 @@
 			}
 			else if (!SendWndNotification(szArg1,szArg2,i,(void*)Data))
 			{
 				MacroError("Could not send notification to %s %s",szArg1,szArg2);
 			}
-			return;
+			RETURN(0);
 		}
 	}
 	MacroError("Invalid notification '%s'",szArg3);
+	RETURN(0);
 }
 
 // item slots:
 // 2000-2015 bank window
 // 2500-2501 shared bank
@@ -837,41 +888,64 @@
 // 7000-7080 bazaar window
 // 8000-8031 inspect window
 
 
 
+#ifndef ISXEQ
 VOID ItemNotify(PSPAWNINFO pChar, PCHAR szLine)
 {
 	CHAR szArg1[MAX_STRING] = {0}; 
 	CHAR szArg2[MAX_STRING] = {0}; 
-//	CHAR szOut[MAX_STRING] = {0};
-
-	PCHAR pNotification=&szArg2[0];
-
+	CHAR szArg3[MAX_STRING] = {0};
+	CHAR szArg4[MAX_STRING] = {0};
 	GetArg(szArg1, szLine, 1);
 	GetArg(szArg2, szLine, 2);
-	CInvSlot *pSlot=0;
+	GetArg(szArg3, szLine, 3);
+	GetArg(szArg4, szLine, 4);
 	if (!szArg2[0])
 	{
 		WriteChatColor("Syntax: /itemnotify <slot|#> <notification>");
 		WriteChatColor("     or /itemnotify in <bag slot> <slot # in bag> <notification>");
-		return;
+		RETURN(0);
 	}
 	if (!stricmp(szArg1,"in"))
 	{
-		CHAR szArg3[MAX_STRING] = {0};
-		CHAR szArg4[MAX_STRING] = {0};
-
-		GetArg(szArg3, szLine, 3);
-		GetArg(szArg4, szLine, 4);
 		if (!szArg4[0])
 		{
 			WriteChatColor("Syntax: /itemnotify <slot|#> <notification>");
 			WriteChatColor("     or /itemnotify in <bag slot> <slot # in bag> <notification>");
-			return;
+			RETURN(0);
 		}
+	}
+#else
+int ItemNotify(int argc, char *argv[])
+{
+	if (argc!=3 && argc != 5)
+	{
+		WriteChatf("ItemNotify got %d args", argc);
+		WriteChatColor("Syntax: /itemnotify <slot|#> <notification>");
+		WriteChatColor("     or /itemnotify in <bag slot> <slot # in bag> <notification>");
+		RETURN(0);
+	}
+	char *szArg1=argv[1];
+	char *szArg2=argv[2];
+	char *szArg3=NULL;
+	char *szArg4=NULL;
+	
+	if (argc==4)
+	{
+		szArg3=argv[3];
+		szArg4=argv[4];
+	}
+	PSPAWNINFO pChar = (PSPAWNINFO)pLocalPlayer;
+
+#endif
+	PCHAR pNotification=&szArg2[0];
+	CInvSlot *pSlot=0;
 
+	if (!stricmp(szArg1,"in"))
+	{
 		PCONTENTS pPack=0;
 		if (!strnicmp(szArg2,"bank",4))
 		{
 			unsigned long nPack=atoi(&szArg2[4]);
 			if (nPack && nPack<=NUM_BANK_SLOTS)
@@ -901,17 +975,17 @@
 		}
 
 		if (!pPack)
 		{
 			WriteChatf("No item at '%s'",szArg2);
-			return;
+			RETURN(0);
 		}
 		PEQCONTAINERWINDOW pWnd=FindContainerForContents(pPack);
 		if (!pWnd)
 		{
 			WriteChatf("No container at '%s' open",szArg2);
-			return;
+			RETURN(0);
 		}
 		unsigned long nSlot=atoi(szArg3);
 		if (nSlot && nSlot <= 10)
 		{
 			PEQINVSLOTWND pSlotWnd=(PEQINVSLOTWND)pWnd->pSlots[nSlot-1];
@@ -927,34 +1001,40 @@
 			Slot=ItemSlotMap[strlwr(szArg1)];
 		}
 		if (Slot==0 && szArg1[0]!='0' && stricmp(szArg1,"charm"))
 		{
 			WriteChatf("Invalid item slot '%s'",szArg1);
-			return;
+			RETURN(0);
 		}
 		DebugTry(pSlot=pInvSlotMgr->FindInvSlot(Slot));
 	}
 	if (!pSlot)
 	{
 		WriteChatf("Could not send notification to %s %s",szArg1,szArg2);
-		return;
+		RETURN(0);
 	}
 	DebugSpew("ItemNotify: Calling SendWndClick");
 	if (!SendWndClick((CXWnd*)((PEQINVSLOT)pSlot)->pInvSlotWnd,pNotification))
 	{
 		WriteChatf("Could not send notification to %s %s",szArg1,szArg2);
 	}
+	RETURN(0);
 }
 
+#ifndef ISXEQ
 VOID ListItemSlots(PSPAWNINFO pChar, PCHAR szLine)
 {
+#else
+int ListItemSlots(int argc, char *argv[])
+{
+#endif
 	PEQINVSLOTMGR pMgr=(PEQINVSLOTMGR)pInvSlotMgr;
 	if (!pMgr)
-		return;
+		RETURN(0);
 //	CHAR szOut[MAX_STRING]={0};
-	if (!szLine || !szLine[0])
-	{
+//	if (!szLine || !szLine[0])
+//	{
 		unsigned long Count=0;
 		WriteChatColor("List of available item slots");
 		WriteChatColor("-------------------------");
 		for (unsigned long N = 0 ; N < 0x400 ; N++)
 			if (PEQINVSLOT pSlot=pMgr->SlotArray[N])
@@ -964,8 +1044,9 @@
 					WriteChatf("inv slot %d",pSlot->pInvSlotWnd->InvSlot);
 					Count++;
 				}
 			}
 		WriteChatf("%d available item slots",Count);
-	}
+//	}
+	RETURN(0);
 }
-#endif
+
ISXEQCommands.cpp

Code: Select all

+
+
+// CMD_EQModKey
+int CMD_EQModKey(int argc, char *argv[])
+{
+       CHAR chCommand[2048] = {0};
+       bool KeyboardFlags[4] = {false,false,false,false};
+
+       if (argc<1)
+       {
+               WriteChatf("Usage: %s <command>", argv[0]);
+               return 0;
+       }
+       pISInterface->GetArgs(1,argc,argv,chCommand);
+       *(DWORD*)&KeyboardFlags=*(DWORD*)&((PCXWNDMGR)pWndMgr)->KeyboardFlags;
+       if (!stricmp(argv[0],"nomodkey"))
+               *(DWORD*)&((PCXWNDMGR)pWndMgr)->KeyboardFlags=0;
+       else if (!stricmp(argv[0],"shift"))
+               ((PCXWNDMGR)pWndMgr)->KeyboardFlags[0]=1;
+       else if (!stricmp(argv[0],"ctrl"))
+               ((PCXWNDMGR)pWndMgr)->KeyboardFlags[1]=1;
+       else if (!stricmp(argv[0],"alt"))
+               ((PCXWNDMGR)pWndMgr)->KeyboardFlags[2]=1;
+       DebugSpew("CMD_EQModKey Executing %s", chCommand);
+       pISInterface->ExecuteCommand(chCommand);
+       *(DWORD*)&((PCXWNDMGR)pWndMgr)->KeyboardFlags=*(DWORD*)&KeyboardFlags;
+       return 0;
+}

ISXEQCommandList.cpp

Code: Select all

+COMMAND("NoModKey",CMD_EQModKey,true,false);
+COMMAND("ctrl",CMD_EQModKey,true,false);
+COMMAND("alt",CMD_EQModKey,true,false);
+COMMAND("shift",CMD_EQModKey,true,false);
Hmm. That's odd.