bouncing around plugins setting "NULL" by hand and returning true (in the event of TypeMembers not found
and the like). However MQ2 also has support for this within ParseMacroData(). Getting this to work as
intended seems to be another story; I'm looking for some clarity.
MQ2DataAPI.cpp L465
Code: Select all
if (!Result.Type->GetMember(Result.VarPtr,pStart,pIndex,Result))
{
if (!Result.Type->FindMember(pStart) && !Result.Type->InheritedMember(pStart))
{
MQ2DataError("No such '%s' member '%s'",Result.Type->GetName(),pStart);
}
return FALSE;
}
*CRASH* - the crash is happening on the FindMember() call. (debug info below)
My breakdown thus far ..
You cannot return TRUE from a dataXXX routine unless the Type is set.
What is minimum requirements of the Ret.Ptr within the datablock? Obviously it points to our data; but what if we have no dynamic data and point to specific data per typemember. Most plugins that work under this need will set DWord=1 however they also memcpy "NULL" before a TRUE return; presumably to avoid this crash problem. This works - but I want whats right.
I don't doubt this is something on my end ; but seeing as so many others are trying to work around this problem as I have, I felt posting on it in the hopes of resolving the "Why's" might be of benefit.
Relevant to my code:
Code: Select all
if (!Result.Type->GetMember(Result.VarPtr,pStart,pIndex,Result))
if (!Result.Type->FindMember(pStart) && !Result.Type->InheritedMember(pStart))
pStart = "Blah" (TypeMember) which does NOT exist .
pIndex = 0; ( [] Index ) ConfigType does not use an index.
// Cutout of relevant code ${BuffQueueConfig.Enabled}
BOOL dataBuffQueueCfg(PCHAR szIndex, MQ2TYPEVAR &Ret)
{
Ret.Ptr=0; // We don't need any Indexes; only a Typemember. however
// this _can become a pointer to ToString() no?
Ret.Type=pBuffQueueConfigType;
return true;
}
// ${BuffQueue[username].ID}
BOOL dataBuffQueue(PCHAR szIndex, MQ2TYPEVAR &Ret)
if (ISINDEX())
if (! ISNUMBER() )
if (Ret.Ptr=GetBQQueueByName( GetSpawnByName( GETFIRST()), NULL)) {
Ret.Type=pBuffQueueType;
return true;
}
return dataBuffQueueCfg(szIndex,Ret);
}
Code: Select all
[MQ2]MQ2BuffQueueConfigType::GetMember(Blah)()
(690.b90): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
MQ2Main!std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,unsigned long>,std::map<std::basic_string<char,std::char_traits<char>,std::alloca38fa3d6f+0x46:
00000000`02f304f6 8b4610 mov eax,[esi+0x10] ds:002b:00000000`00000010=????????
0:000:x86> r
eax=00000001 ebx=00000000 ecx=00000000 edx=00000004 esi=00000000 edi=00127e00
eip=02f304f6 esp=00127d78 ebp=0b7a04e0 iopl=0 nv up ei ng nz na pe cy
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010283
MQ2Main!std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,unsigned long>,std::map<std::basic_string<char,std::char_traits<char>,std::alloca38fa3d6f+0x46:
00000000`02f304f6 8b4610 mov eax,[esi+0x10] ds:002b:00000000`00000010=????????
0:000:x86> kv
ChildEBP RetAddr Args to Child
00127db0 02f349cb 00127de0 00127e00 0012864c MQ2Main!std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,unsigned long>,std::map<std::basic_string<char,std::char_traits<char>,std::alloca38fa3d6f+0x46 (FPO: [Uses EBP] [2,11,4]) (CONV: thiscall) [C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\xtree @ 222]
00127e1c 02f347a3 00128682 00128687 0012aee1 MQ2Main!MQ2Internal::MQ2Type::FindMember+0xab (FPO: [Uses EBP] [1,20,4]) (CONV: thiscall) [C:\Documents and Settings\username\My Documents\MQ2\MQ2-Current\MQ2Main\MQ2Internal.h @ 636]
00128648 02f34bbd 00128678 00128670 001296d6 MQ2Main!ParseMQ2DataPortion+0x7f3 (FPO: [Uses EBP] [2,517,4]) (CONV: cdecl) [C:\Documents and Settings\username\My Documents\MQ2\MQ2-Current\MQ2Main\MQ2DataAPI.cpp @ 236]
00128e74 02f5b616 0012aed0 00000000 03058e80 MQ2Main!ParseMacroData+0x15d (FPO: [Uses EBP] [1,516,4]) (CONV: cdecl) [C:\Documents and Settings\username\My Documents\MQ2\MQ2-Current\MQ2Main\MQ2DataAPI.cpp @ 565]
00128e84 02f26069 109d0ae0 0012aed0 ffffffff MQ2Main!ParseMacroParameter+0x26 (FPO: [2,0,1]) (CONV: cdecl) [C:\Documents and Settings\username\My Documents\MQ2\MQ2-Current\MQ2Main\MQ2ParseAPI.cpp @ 125]
0012b6d8 005358c7 109d0ae0 0012bc4c 0000001c MQ2Main!CCommandHook::Detour+0x639 (FPO: [Uses EBP] [2,2574,4]) (CONV: thiscall) [C:\Documents and Settings\username\My Documents\MQ2\MQ2-Current\MQ2Main\MQ2CommandAPI.cpp @ 266]
WARNING: Stack unwind information not available. Following frames may be wrong.
00000000 00000000 00000000 00000000 00000000 eqgame+0x1358c7
PMQ2TYPEMEMBER FindMember(PCHAR Name)
{
unsigned long N=MemberMap[Name]; <<<
if (!N)
return 0;
N--;
return Members[N];
}
xtree line: 222 (vb6)
template definition: _Pairib insert(const value_type& _V)
_Ans = key_compare(_Kfn()(_V), _Key(_X)); <<<


