Initial commit: Complete open-source Decal rebuild
All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
d1442e3747
1382 changed files with 170725 additions and 0 deletions
93
Native/PlainText/ScriptView.cpp
Normal file
93
Native/PlainText/ScriptView.cpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
// ScriptView.cpp : Implementation of CScriptView
|
||||
#include "stdafx.h"
|
||||
#include "PlainText.h"
|
||||
#include "ScriptView.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CScriptView
|
||||
|
||||
|
||||
void CScriptView::loadView( cScriptPlugin *pPlugin, MSXML::IXMLDOMElementPtr &pView, LPDISPATCH *ppNewView )
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
// Get IPluginSite
|
||||
CComPtr< IDecal > pDecal;
|
||||
CComPtr< IInjectService > pInject;
|
||||
pPlugin->m_pSite->get_Decal ( &pDecal );
|
||||
pDecal->get_Object ( _bstr_t ( _T( "services\\DecalPlugins.InjectService" ) ),
|
||||
__uuidof ( IInjectService ), reinterpret_cast< LPVOID * > ( &pInject ) );
|
||||
|
||||
pInject->get_Site(&m_pOldSite);
|
||||
|
||||
m_pPlugin = pPlugin;
|
||||
|
||||
// Initialize a new script engine
|
||||
CComBSTR strLanguage;
|
||||
pPlugin->getLanguage( &strLanguage );
|
||||
|
||||
HRESULT hRes = createScriptEngine( strLanguage );
|
||||
|
||||
CComPtr< IActiveScriptParse > pParse;
|
||||
m_pScript->QueryInterface( &pParse );
|
||||
|
||||
pParse->InitNew();
|
||||
|
||||
m_pOldSite->LoadViewObject( pView, &m_pView );
|
||||
|
||||
IViewEventsImpl< VIEW_ID, CScriptView >::DispEventAdvise( m_pView );
|
||||
|
||||
// Add in the plugin
|
||||
CComPtr< IDispatch > pDispPlugin;
|
||||
pPlugin->m_pScript->GetScriptDispatch( NULL, &pDispPlugin );
|
||||
addNamedItem( T2OLE( _T( "Plugin" ) ), pDispPlugin );
|
||||
|
||||
// Add in the site
|
||||
addNamedItem( T2OLE( _T( "Site" ) ), static_cast< IDispatch * >( pPlugin ) );
|
||||
|
||||
// Add in the view as a base object
|
||||
addNamedItem( T2OLE( _T( "View" ) ), static_cast< IDispatch * >( m_pView ) );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pScript = pView->selectSingleNode( _T( "script" ) );
|
||||
|
||||
if( pScript.GetInterfacePtr() != NULL )
|
||||
{
|
||||
EXCEPINFO ei;
|
||||
HRESULT hRes = pParse->ParseScriptText( pScript->text, NULL, NULL, NULL, 0, 0,
|
||||
SCRIPTTEXT_ISVISIBLE, NULL, &ei );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
|
||||
MSXML::IXMLDOMNodeListPtr pControls = pView->selectNodes( _T( ".//control[@name]" ) );
|
||||
for( MSXML::IXMLDOMElementPtr pControl = pControls->nextNode(); pControl.GetInterfacePtr() != NULL; pControl = pControls->nextNode() )
|
||||
{
|
||||
CComPtr< IControl > pCtl;
|
||||
_bstr_t strName = pControl->getAttribute( _T( "name" ) ).bstrVal;
|
||||
m_pView->get_Control( strName, &pCtl );
|
||||
addNamedItem( strName, pCtl );
|
||||
}
|
||||
|
||||
// Add ourself into the view list
|
||||
m_pPlugin->m_views.push_back( this );
|
||||
|
||||
m_pScript->SetScriptState( SCRIPTSTATE_CONNECTED );
|
||||
m_pScript->GetScriptDispatch( NULL, ppNewView );
|
||||
|
||||
_ASSERTE( *ppNewView != NULL );
|
||||
|
||||
Fire_Initialize();
|
||||
}
|
||||
|
||||
void CScriptView::destroy()
|
||||
{
|
||||
Fire_Terminate();
|
||||
IViewEventsImpl< VIEW_ID, CScriptView >::DispEventUnadvise( m_pView );
|
||||
|
||||
m_pScript->SetScriptState( SCRIPTSTATE_DISCONNECTED );
|
||||
m_pScript->Close();
|
||||
|
||||
// Remove ourself from the list, the next line might destroy this object
|
||||
m_pView.Release();
|
||||
m_pPlugin->removeView( this );
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue