Nice CE,
That eeaddin sample was a bit tricky, when i did as follows I got it working.
This is how i did it in VS2008.
Create an empty win32 (.dll) project. I called it CEGUIDbg.
Remove unicode setting for the project in properties.
Add the preprocessor define CEGUI_STATIC.
Add CEGUIString.h and CEGUIString.cpp to the project.
Remove precompiled header usage on CEGUIString.cpp.
Add the search path to CEGUI\inc directory, CEGUIBase.h needs to be in that search path.
add this postbuild event
, this will copy ceguidbg.dll to the same folder as devenv.exe, usually C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
(There might be security issue with this copy in Windows Vista, can be done manually.)
This is the file: CEGUIDbg.cpp
Code: Select all
// CEGUIDbg.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "tchar.h"
#include "ceguistring.h"
#define ADDIN_API __declspec(dllexport)
typedef struct tagDEBUGHELPER
{
DWORD dwVersion;
HRESULT (WINAPI *ReadDebuggeeMemory)( struct tagDEBUGHELPER *pThis, DWORD dwAddr,
DWORD nWant, VOID* pWhere, DWORD *nGot );
// from here only when dwVersion >= 0x20000
DWORDLONG (WINAPI *GetRealAddress)( struct tagDEBUGHELPER *pThis );
HRESULT (WINAPI *ReadDebuggeeMemoryEx)( struct tagDEBUGHELPER *pThis, DWORDLONG qwAddr,
DWORD nWant, VOID* pWhere, DWORD *nGot );
int (WINAPI *GetProcessorType)( struct tagDEBUGHELPER *pThis );
} DEBUGHELPER;
static void CEGUI_print(char *pResult, int max, int len, const char *pbuf)
{
try
{
sprintf_s(pResult, max, "%d,\"%s\"", len, pbuf);
}
catch(...)
{
sprintf_s(pResult, max, "%d,\"%10s<Err>", len, pbuf);
}
}
ADDIN_API HRESULT WINAPI CEGUIDbg_String(DWORD dwAddress, DEBUGHELPER *pHelper,
int nBase, BOOL bUniStrings, char *pResult,
size_t max, DWORD reserved )
{
CEGUI::String s;
DWORD nGot;
if (pHelper->ReadDebuggeeMemory(pHelper,dwAddress,sizeof(s),&s,&nGot) != S_OK)
return E_FAIL;
int len = s.length();
if (!len)
{
CEGUI_print(pResult, max, len, "");
}
else if (s.capacity() < STR_QUICKBUFF_SIZE)
{
CEGUI_print(pResult, max, len, s.c_str());
}
else
{
UINT32 *buf = new UINT32[len + 1];
CEGUI::String s1;
if (pHelper->ReadDebuggeeMemory(pHelper, (DWORD)s.ptr(), sizeof(UINT32) * len, buf, &nGot) != S_OK)
{
delete [] buf;
return E_FAIL;
}
for (int i = 0; i < len; i++)
s1 += buf[i];
delete[] buf;
CEGUI_print(pResult, max, len, s1.c_str());
}
return S_OK;
}
Find the file autoexp.dat, usually in this path
C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger
Add this line under the section [AutoExpand]
Code: Select all
CEGUI::String=$ADDIN(ceguidbg.dll,?CEGUIDbg_String@@YGJKPAUtagDEBUGHELPER@@HHPADIK@Z)
Now build and you will see the strings as utf8 encoded strings in VStudio.
HTH,
Gring