void ezDecalAtlasResource::ReportResourceIsMissing()
{
#if EZ_ENABLED(EZ_COMPILE_FOR_DEVELOPMENT)
  // normal during development, don't care much
  ezLog::Debug("Decal Atlas Resource is missing: '{0}' ('{1}')", GetResourceID(), GetResourceDescription());
#else
  // should probably exist for shipped applications, report this
  ezLog::Warning("Decal Atlas Resource is missing: '{0}' ('{1}')", GetResourceID(), GetResourceDescription());
#endif
}
Exemple #2
0
bool CResourceDef::SetResourceName( LPCTSTR pszName )
{
	ADDTOCALLSTACK("CResourceDef::SetResourceName");
	ASSERT(pszName);

	// This is the global def for this item.
	for ( size_t i = 0; pszName[i]; i++ )
	{
		if ( i >= EXPRESSION_MAX_KEY_LEN )
		{
			DEBUG_ERR(( "Too long DEFNAME=%s\n", pszName ));
			return( false );
		}
		if ( ! _ISCSYM(pszName[i]))
		{
			DEBUG_ERR(( "Bad chars in DEFNAME=%s\n", pszName ));
			return( false );
		}
	}

	int iVarNum;

	CVarDefCont * pVarKey = g_Exp.m_VarDefs.GetKey( pszName );
	if ( pVarKey )
	{
		if ( (DWORD)pVarKey->GetValNum() == GetResourceID().GetPrivateUID() )
		{
			return( true );
		}

		if ( RES_GET_INDEX(pVarKey->GetValNum()) == GetResourceID().GetResIndex())
		{
			DEBUG_WARN(( "The DEFNAME=%s has a strange type mismatch? 0%llx!=0%lx\n", pszName, pVarKey->GetValNum(), GetResourceID().GetPrivateUID() ));
		}
		else
		{
			DEBUG_WARN(( "The DEFNAME=%s already exists! 0%llx!=0%x\n", pszName, RES_GET_INDEX(pVarKey->GetValNum()), GetResourceID().GetResIndex() ));
		}

		iVarNum = g_Exp.m_VarDefs.SetNum( pszName, GetResourceID().GetPrivateUID() );
	}
	else
	{
		iVarNum = g_Exp.m_VarDefs.SetNumNew( pszName, GetResourceID().GetPrivateUID() );
	}

	if ( iVarNum < 0 )
		return( false );

	SetResourceVar( dynamic_cast <const CVarDefContNum*>( g_Exp.m_VarDefs.GetAt( iVarNum )));
	return( true );
}
Exemple #3
0
void WrappedID3D11DeviceContext::AttemptCapture()
{
	m_State = WRITING_CAPFRAME;

	m_FailureReason = CaptureSucceeded;

	// deferred contexts are initially NOT successful unless empty. That's because we don't have the serialised
	// contents of whatever is in them up until now (could be anything).
	// Only after they have been through a Finish() and then in CAPFRAME mode are they considered
	// successful.
	if(GetType() == D3D11_DEVICE_CONTEXT_DEFERRED)
	{
		RDCDEBUG("Deferred Context %llu Attempting capture - initially %s, %s", GetResourceID(), m_SuccessfulCapture ? "successful" : "unsuccessful", m_EmptyCommandList ? "empty" : "non-empty");

		m_SuccessfulCapture |= m_EmptyCommandList;

		if(m_SuccessfulCapture)
			m_FailureReason = CaptureSucceeded;
		else
			m_FailureReason = CaptureFailed_UncappedCmdlist;
		
		RDCDEBUG("Deferred Context %llu Attempting capture - now %s", GetResourceID(), m_SuccessfulCapture ? "successful" : "unsuccessful");
	}
	else
	{
		RDCDEBUG("Immediate Context %llu Attempting capture", GetResourceID());

		m_SuccessfulCapture = true;
		m_FailureReason = CaptureSucceeded;

		for(auto it=m_DeferredRecords.begin(); it != m_DeferredRecords.end(); ++it)
			(*it)->Delete(m_pDevice->GetResourceManager());
		m_DeferredRecords.clear();

		m_ContextRecord->LockChunks();
		while(m_ContextRecord->HasChunks())
		{
			Chunk *chunk = m_ContextRecord->GetLastChunk();

			SAFE_DELETE(chunk);
			m_ContextRecord->PopChunk();
		}
		m_ContextRecord->UnlockChunks();

		m_ContextRecord->FreeParents(m_pDevice->GetResourceManager());
	}
}
Exemple #4
0
LPCTSTR CResourceDef::GetResourceName() const
{
	ADDTOCALLSTACK("CResourceDef::GetResourceName");
	if ( m_pDefName )
		return m_pDefName->GetKey();

	TemporaryString pszTmp;
	sprintf(pszTmp, "0%x", GetResourceID().GetResIndex());
	return pszTmp;
}
Exemple #5
0
WrappedID3D12GraphicsCommandList::~WrappedID3D12GraphicsCommandList()
{
  if(m_pReal)
    m_pDevice->GetResourceManager()->RemoveWrapper(m_pReal);

  m_pDevice->GetResourceManager()->ReleaseCurrentResource(GetResourceID());

  SAFE_RELEASE(m_WrappedDebug.m_pReal);
  SAFE_RELEASE(m_pReal);
}
Exemple #6
0
bool CRCFile::ProcessRCFile()
{
    int iPos;
    CString strData;
    std::vector<CString> vStrTable;
    for (std::vector<CString>::iterator it=m_vInRCFile.begin(); it != m_vInRCFile.end(); it++)
    {
        if ( (iPos=it->Find(_T(" MENU "))) != -1 )
        {
            // add the line to the output rc with no change
            m_vOutRCFile.push_back(*it);

            UINT uiID = GetResourceID(it->Left(iPos));

            // begin enumerating items
            it++;

            // process the menu
            ProcessMenu(uiID, &it);
        }
        else if ( (iPos=it->Find(_T(" DIALOGEX "))) != -1)
        {
            // add the line to the output rc with no change
            m_vOutRCFile.push_back(*it);

            UINT uiID = GetResourceID(it->Left(iPos));
            // begin processing dialog template
            it++;
            ProcessDialog(uiID, &it);
        }
        else if ( (iPos=it->Find(_T("STRINGTABLE "))) != -1)
        {
            // begin of the string table
            it++;
            ProcessStringTable(0, &it);
        }
        else
            m_vOutRCFile.push_back(*it);
    }

    return true;
}
Exemple #7
0
bool CDialogDef::GumpSetup( int iPage, CClient * pClient, CObjBase * pObjSrc, lpctstr Arguments )
{
    ADDTOCALLSTACK("CDialogDef::GumpSetup");
    CResourceLock	s;

    m_uiControls	= 0;
    m_uiTexts		= 0;
    m_pObj			= pObjSrc;
    m_iOriginX		= 0;
    m_iOriginY		= 0;
    m_wPage			= (word)(iPage);
    m_fNoDispose	= false;

    CScriptTriggerArgs	Args(iPage, 0, pObjSrc);
    //DEBUG_ERR(("Args.m_s1_raw %s  Args.m_s1 %s  Arguments 0x%x\n",Args.m_s1_raw, Args.m_s1, Arguments));
    Args.m_s1_raw = Args.m_s1 = Arguments;

    // read text first
    if ( g_Cfg.ResourceLock( s, CResourceID( RES_DIALOG, GetResourceID().GetResIndex(), RES_DIALOG_TEXT ) ) )
    {
        while ( s.ReadKey())
        {
            if ( m_uiTexts >= (CountOf(m_sText) - 1) )
                break;
            m_pObj->ParseText( s.GetKeyBuffer(), pClient->GetChar() );
            m_sText[m_uiTexts] = s.GetKey();
            m_uiTexts++;
        }
    }
    else
    {
        // no gump text?
    }

    // read the main dialog
    if ( !ResourceLock( s ) )
        return false;
    if ( !s.ReadKey() )		// read the size.
        return false;

    // starting x,y location.
    int64 iSizes[2];
    tchar * pszBuf = s.GetKeyBuffer();
    m_pObj->ParseText( pszBuf, pClient->GetChar() );

    Str_ParseCmds( pszBuf, iSizes, CountOf(iSizes) );
    m_x		= (int)(iSizes[0]);
    m_y		= (int)(iSizes[1]);

    if ( OnTriggerRunVal( s, TRIGRUN_SECTION_TRUE, pClient->GetChar(), &Args ) == TRIGRET_RET_TRUE )
        return false;
    return true;
}
Exemple #8
0
bool BaseWordForm::Init()
{
	__WCtrl = WordCtrl::GetInstance();

	Construct(GetResourceID());
	//AddOrientationEventListener(*this);
	// context menu must be first
	// because when is created
	// show menu button in footer
	PrepareContextMenu();
	PrepareHeader();
	PrepareFooter();

	return true;
}
Exemple #9
0
EZ_RESOURCE_IMPLEMENT_CREATEABLE(ezMeshResource, ezMeshResourceDescriptor)
{
  // if there is an existing mesh buffer to use, take that
  m_hMeshBuffer = descriptor.GetExistingMeshBuffer();

  // otherwise create a new mesh buffer from the descriptor
  if (!m_hMeshBuffer.IsValid())
  {
    s_MeshBufferNameSuffix++;
    ezStringBuilder sMbName;
    sMbName.Format("{0}  [MeshBuffer {1}]", GetResourceID(), ezArgU(s_MeshBufferNameSuffix, 4, true, 16, true));

    // note: this gets move'd, might be invalid afterwards
    ezMeshBufferResourceDescriptor& mb = descriptor.MeshBufferDesc();

    m_hMeshBuffer = ezResourceManager::CreateResource<ezMeshBufferResource>(sMbName, std::move(mb), GetResourceDescription());
  }

  m_SubMeshes = descriptor.GetSubMeshes();

  m_Materials.Clear();
  m_Materials.Reserve(descriptor.GetMaterials().GetCount());

  // copy all the material assignments and load the materials
  for (const auto& mat : descriptor.GetMaterials())
  {
    ezMaterialResourceHandle hMat;

    if (!mat.m_sPath.IsEmpty())
      hMat = ezResourceManager::LoadResource<ezMaterialResource>(mat.m_sPath);

    m_Materials.PushBack(hMat); // may be an invalid handle
  }

  m_Bounds = descriptor.GetBounds();
  EZ_ASSERT_DEV(m_Bounds.IsValid(), "The mesh bounds are invalid. Make sure to call ezMeshResourceDescriptor::ComputeBounds()");

  // copy the skeleton handle over, will be an invalid handle for static meshes
  m_hSkeleton = descriptor.GetSkeleton();

  ezResourceLoadDesc res;
  res.m_uiQualityLevelsDiscardable = 0;
  res.m_uiQualityLevelsLoadable = 0;
  res.m_State = ezResourceState::Loaded;

  return res;
}
void ezDecalAtlasResource::CreateLayerTexture(const ezImage& img, bool bSRGB, ezTexture2DResourceHandle& out_hTexture)
{
  ezTexture2DResourceDescriptor td;
  td.m_SamplerDesc.m_AddressU = ezImageAddressMode::Clamp;
  td.m_SamplerDesc.m_AddressV = ezImageAddressMode::Clamp;
  td.m_SamplerDesc.m_AddressW = ezImageAddressMode::Clamp;

  ezUInt32 uiMemory;
  ezHybridArray<ezGALSystemMemoryDescription, 32> initData;
  ezTexture2DResource::FillOutDescriptor(td, &img, bSRGB, img.GetNumMipLevels(), uiMemory, initData);
  ezTextureUtils::ConfigureSampler(ezTextureFilterSetting::HighQuality, td.m_SamplerDesc);

  ezStringBuilder sTexId;
  sTexId.Format("{0}_Tex{1}", GetResourceID(), s_uiDecalAtlasResources);
  ++s_uiDecalAtlasResources;

  out_hTexture = ezResourceManager::CreateResource<ezTexture2DResource>(sTexId, std::move(td));
}
Exemple #11
0
void CRCFile::ProcessStringTable(UINT uiStringGroupID, std::vector<CString>::iterator *init)
{
    element_map* pElementMap = GetElementMap(uiStringGroupID);
    if(!pElementMap)
        return;

    CString str;
    for (; (*init) != m_vInRCFile.end(); (*init)++)
    {
        str=**init;
        str.TrimLeft(_T(" \t"));
        str.TrimRight(_T(" \t"));

        if ( str == _T("END") )
            return;
        else if ( str != _T("BEGIN") )
        {
            // the first stuff is ID, the second is text
            int iPos=str.Find(_T("\""), 0);
            if (iPos == -1)
            {
                (*init)++;
                str+=**init;
                iPos=str.Find(_T("\""), 0);
            }

            if (iPos != -1)
            {
                CString strID=str.Left(iPos);
                strID.TrimRight(_T(" \"\t\n\r"));

                CString strText=str.Mid(iPos+1);
                strText.Replace(_T("\"\""), _T("\""));
                strText=strText.Left(strText.ReverseFind(_T('\"')));

                UINT uiID = GetResourceID(strID);
                pElementMap->insert(std::make_pair(uiID, strText));

                str=**init;
                str.Replace(_T("\"")+strText+_T("\""), _T("\"\""));
            }
        }
    }
}
Exemple #12
0
LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
	styleValue &= ~WS_CAPTION;
	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
	RECT rcClient;
	::GetClientRect(*this, &rcClient);
	::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
		rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

	m_PaintManager.Init(m_hWnd);
	m_PaintManager.AddPreMessageFilter(this);

	CDialogBuilder builder;
	CDuiString strResourcePath=m_PaintManager.GetResourcePath();
	if (strResourcePath.IsEmpty())
	{
		strResourcePath=m_PaintManager.GetInstancePath();
		strResourcePath+=GetSkinFolder().GetData();
	}
	m_PaintManager.SetResourcePath(strResourcePath.GetData());

	switch(GetResourceType())
	{
	case UILIB_ZIP:
		m_PaintManager.SetResourceZip(GetZIPFileName().GetData(), true);
		break;
	case UILIB_ZIPRESOURCE:
		{
			HRSRC hResource = ::FindResource(m_PaintManager.GetResourceDll(), GetResourceID(), _T("ZIPRES"));
			if( hResource == NULL )
				return 0L;
			DWORD dwSize = 0;
			HGLOBAL hGlobal = ::LoadResource(m_PaintManager.GetResourceDll(), hResource);
			if( hGlobal == NULL ) 
			{
#if defined(WIN32) && !defined(UNDER_CE)
				::FreeResource(hResource);
#endif
				return 0L;
			}
			dwSize = ::SizeofResource(m_PaintManager.GetResourceDll(), hResource);
			if( dwSize == 0 )
				return 0L;
			m_lpResourceZIPBuffer = new BYTE[ dwSize ];
			if (m_lpResourceZIPBuffer != NULL)
			{
				::CopyMemory(m_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize);
			}
#if defined(WIN32) && !defined(UNDER_CE)
			::FreeResource(hResource);
#endif
			m_PaintManager.SetResourceZip(m_lpResourceZIPBuffer, dwSize);
		}
		break;
	}

	CControlUI* pRoot=NULL;
	if (GetResourceType()==UILIB_RESOURCE)
	{
		STRINGorID xml(_ttoi(GetSkinFile().GetData()));
		pRoot = builder.Create(xml, _T("xml"), this, &m_PaintManager);
	}
	else
		pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
	ASSERT(pRoot);
	if (pRoot==NULL)
	{
		MessageBox(NULL,_T("加载资源文件失败"),_T("Duilib"),MB_OK|MB_ICONERROR);
		ExitProcess(1);
		return 0;
	}
	m_PaintManager.AttachDialog(pRoot);
	m_PaintManager.AddNotifier(this);

	InitWindow();
	return 0;
}
Exemple #13
0
void CRCFile::ProcessMenu(UINT uiMenuID, std::vector<CString>::iterator *init)
{
    element_map* pElementMap = GetElementMap(uiMenuID);
    if(!pElementMap)
        return;

    CString str;
    for (; (*init) != m_vInRCFile.end(); (*init)++)
    {
        str=**init;
        str.TrimLeft(_T(" "));
        str.TrimRight(_T(" "));

        // check for exit
        if ( str == _T("END") )
        {
            // add the line to the outrc wo changes
            m_vOutRCFile.push_back(**init);
            return;
        }
        else if (str.Left(5) == _T("POPUP")) // if that is the popup string - call the function once more
        {
            // add the line to the outrc with changes - replace string inside "" with P
            str=**init;

            // processing menuitem - find the text
            int iPos=str.Find(_T("\""), 0);
            CString strText;
            if (iPos != -1)
            {
                strText=str.Mid(iPos+1);
                int iPos2=strText.Find(_T("\""));
                if (iPos2 != -1)
                    strText=strText.Left(iPos2);
            }

            // now find the | that separates the text from the pseudo-ID
            int iBar=strText.ReverseFind(_T('|'));
            if (iBar != -1)
            {
                // there is a text with an ID
                CString strID=strText.Mid(iBar+1);
                strText=strText.Left(iBar);

                // put the id and text in the translation file
                // find the equiv for the id
                UINT uiID = GetResourceID(strID);
                pElementMap->insert(std::make_pair(uiID, strText));

                // put the found ID as output text
                CString out;
                out.Format(_T("\"%lu\""), uiID);
                str=str.Left(iPos)+out;
            }
            else
            {
                // no pseudoID in menu name
                str=str.Left(iPos)+_T("\"P\"");
            }

            m_vOutRCFile.push_back(str);

            (*init)++;
            ProcessMenu(uiMenuID, init);
        }
        else
        {
            // if the line has MENUITEM
            if (str.Left(8) == _T("MENUITEM") && str.Right(9) != _T("SEPARATOR"))
            {
                // restore original
                str=**init;

                // check if there is any text after the comma
                int iPos=str.Find(_T(","), 0);
                CString strTest=str.Mid(iPos);
                strTest.TrimLeft(_T(" ,\t\r\n"));
                if (strTest.IsEmpty())
                {
                    (*init)++;

                    CString tmp=**init;
                    tmp.Trim(_T(" ,\t\r\n"));
                    str+=tmp;
                }

                // processing menuitem - find the text
                iPos=str.Find(_T("\""), 0);
                CString strText;
                if (iPos != -1)
                {
                    strText=str.Mid(iPos+1);
                    int iPos2=strText.Find(_T("\""));
                    if (iPos2 != -1)
                        strText=strText.Left(iPos2);
                }

                // find the ID
                iPos=str.Find(_T(","), 0);
                CString strID;
                if (iPos != -1)
                {
                    strID=str.Mid(iPos+1);
                    int iPos2=strID.Find(_T(","), 0);
                    if (iPos2 != -1)
                        strID=strID.Left(iPos2);
                }
                strID.TrimLeft(_T(" \t"));
                strID.TrimRight(_T(" \t"));

                // find the equiv for the id
                UINT uiID = GetResourceID(strID);
                pElementMap->insert(std::make_pair(uiID, strText));
                CString out = str;
                //				out=**init;
                out.Replace(_T("\"")+strText+_T("\""), _T("\"i\""));
                m_vOutRCFile.push_back(out);
            }
            else
                m_vOutRCFile.push_back(**init);
        }
    }
}
Exemple #14
0
LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    m_PaintManager.Init(m_hWnd);
    m_PaintManager.AddPreMessageFilter(this);

    CDialogBuilder builder;
    if (m_PaintManager.GetResourcePath().IsEmpty())
    {   // 允许更灵活的资源路径定义
        CDuiString strResourcePath=m_PaintManager.GetInstancePath();
        strResourcePath+=GetSkinFolder().GetData();
        m_PaintManager.SetResourcePath(strResourcePath.GetData());
    }

    switch(GetResourceType())
    {
    case UILIB_ZIP:
        m_PaintManager.SetResourceZip(GetZIPFileName().GetData(), true);
        break;
    case UILIB_ZIPRESOURCE:
    {
        HRSRC hResource = ::FindResource(m_PaintManager.GetResourceDll(), GetResourceID(), _T("ZIPRES"));
        if( hResource == NULL )
            return 0L;
        DWORD dwSize = 0;
        HGLOBAL hGlobal = ::LoadResource(m_PaintManager.GetResourceDll(), hResource);
        if( hGlobal == NULL )
        {
#if defined(WIN32) && !defined(UNDER_CE)
            ::FreeResource(hResource);
#endif
            return 0L;
        }
        dwSize = ::SizeofResource(m_PaintManager.GetResourceDll(), hResource);
        if( dwSize == 0 )
            return 0L;
        m_lpResourceZIPBuffer = new BYTE[ dwSize ];
        if (m_lpResourceZIPBuffer != NULL)
        {
            ::CopyMemory(m_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize);
        }
#if defined(WIN32) && !defined(UNDER_CE)
        ::FreeResource(hResource);
#endif
        m_PaintManager.SetResourceZip(m_lpResourceZIPBuffer, dwSize);
    }
    break;
    }

    CControlUI* pRoot=NULL;
    if (GetResourceType()==UILIB_RESOURCE)
    {
        STRINGorID xml(_ttoi(GetSkinFile().GetData()));
        pRoot = builder.Create(xml, _T("xml"), this, &m_PaintManager);
    }
    else
        pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
    ASSERT(pRoot);
    if (pRoot==NULL)
    {
        MessageBox(NULL,_T("加载资源文件失败"),_T("Duilib"),MB_OK|MB_ICONERROR);
        ExitProcess(1);
        return 0;
    }
    m_PaintManager.AttachDialog(pRoot);
    m_PaintManager.AddNotifier(this);
    m_PaintManager.SetBackgroundTransparent(TRUE);

    InitWindow();
    return 0;
}
Exemple #15
0
void CRCFile::ProcessDialog(UINT uiDialogID, std::vector<CString>::iterator *init)
{
    element_map* pElementMap = GetElementMap(uiDialogID);
    if(!pElementMap)
        return;

    CString str;
    for (; (*init) != m_vInRCFile.end(); (*init)++)
    {
        str=**init;
        str.TrimLeft(_T(" "));
        str.TrimRight(_T(" "));

        // check for exit
        if ( str == _T("END") )
        {
            // add the line to the outrc wo changes
            m_vOutRCFile.push_back(**init);
            return;
        }
        else if ( str.Left(7) == _T("CAPTION") )
        {
            // read the caption
            CString strText=str.Mid(7);
            strText.TrimLeft(_T(" \t\""));
            strText.TrimRight(_T(" \t\""));

            pElementMap->insert(std::make_pair(0, strText));

            // save to rc wo title
            str=**init;
            str.Replace(_T("\"")+strText+_T("\""), _T("\"\""));
            m_vOutRCFile.push_back(str);
        }
        else if ( str.Left(5) == _T("LTEXT") || str.Left(5) == _T("CTEXT") || str.Left(5) == _T("RTEXT") || str.Left(13) == _T("DEFPUSHBUTTON") || str.Left(10) == _T("PUSHBUTTON") || str.Left(7) == _T("CONTROL") || str.Left(8) == _T("GROUPBOX") )
        {
            // needed only 2 commas (outside the '\"')
            if ( GetCommasCount(str) < 3 )
                str+=*((*init)+1);

            // the first thing after LTEXT(and other) is the caption
            CString strText;
            bool bControl = false;

            if (str.Left(5) == _T("LTEXT") || str.Left(5) == _T("CTEXT") || str.Left(5) == _T("RTEXT"))
                str=str.Mid(5);
            else if (str.Left(13) == _T("DEFPUSHBUTTON"))
                str=str.Mid(13);
            else if (str.Left(10) == _T("PUSHBUTTON"))
                str=str.Mid(10);
            else if (str.Left(7) == _T("CONTROL"))
            {
                bControl = true;
                str=str.Mid(7);
            }
            else if (str.Left(8) == _T("GROUPBOX"))
                str=str.Mid(8);

            str=str.Mid(str.Find(_T("\""))+1);
            int iPos=str.Find(_T("\""), 0);
            if (iPos != -1)
                strText=str.Left(iPos);
            else
                THROW(_T("Error: cannot find a comma in processed text"), 0, 0, 0);

            str = str.Mid(iPos+1);

            // after the first comma there is an ID
            iPos=str.Find(_T(","), 0);
            CString strID;
            if (iPos != -1)
            {
                str=str.Mid(iPos+1);
                iPos=str.Find(_T(","), 0);
                if (iPos != -1)
                    strID=str.Left(iPos);
                else
                    THROW(_T("Error: cannot find a comma in processed text"), 0, 0, 0);

                strID.TrimLeft(_T(" \t"));
                strID.TrimRight(_T(" \t"));
            }
            else
                THROW(_T("Error: cannot find a comma in processed text"), 0, 0, 0);

            bool bSkip = false;
            if(bControl)
            {
                str = str.Mid(iPos+1);
                iPos = str.Find(_T(","), 0);
                if(iPos == -1)
                    THROW(_T("Error: cannot find a comma in processed text"), 0, 0, 0);

                CString strType = str.Left(iPos);
                strType.Trim(_T("\""));
                if(strType == _T("SysListView32") || strType == _T("msctls_progress32") ||
                        strType == _T("ComboBoxEx32") || strType == _T("msctls_updown32") ||
                        strType == _T("SysDateTimePick32"))
                {
                    bSkip = true;
                }
            }

            if(!bSkip)
            {
                // find id
                UINT uiID = GetResourceID(strID);
                CString out;
                pElementMap->insert(std::make_pair(uiID, strText));
            }

            // now add the data to output rc
            str=**init;
            str.Replace(_T("\"")+strText+_T("\""), _T("\"\""));

            m_vOutRCFile.push_back(str);
        }
        else
            m_vOutRCFile.push_back(**init);
    }
}
Exemple #16
0
	CControlUI* CWin::CreateRoot(STRINGorID xml, LPCTSTR type /* = NULL */, IDialogBuilderCallback* pCallback /* = NULL */, CControlUI* pParent /* = NULL */)
	{
		CDialogBuilder builder;

		CDuiString strResourcePath = GetSkinPath();
		strResourcePath += GetSkinFolder().GetData();
		_paintManager->SetResourcePath(strResourcePath.GetData());

		CControlUI* pRoot = NULL;

		switch (GetResourceType())
		{
		case UILIB_FILE:
			{
				pRoot = builder.Create(xml, type, pCallback, _paintManager, pParent);
			}
			break;
		case UILIB_ZIP:
			{
				_paintManager->SetResourceZip(GetZIPFileName().GetData(), true);
				pRoot = builder.Create(xml, type, pCallback, _paintManager, pParent);
			}
			break;
		case UILIB_RESOURCE:
			{
				HINSTANCE hCurInst = CPaintManagerUI::GetResourceDll();
				_paintManager->SetCurResInstance(hCurInst);
				pRoot = builder.Create(xml, type, pCallback, _paintManager, pParent);
			}
			break;
		case UILIB_ZIPRESOURCE:
			{
				HINSTANCE hCurInst = _paintManager->GetCurResInstance();
				if (!hCurInst)
					hCurInst = CPaintManagerUI::GetResourceDll();

				_paintManager->SetCurResInstance(hCurInst);

				HRSRC hResource = ::FindResource(hCurInst, GetResourceID(), _T("ZIPRES"));
				if (hResource == NULL)
					return NULL;
				DWORD dwSize = 0;
				HGLOBAL hGlobal = ::LoadResource(hCurInst, hResource);
				if (hGlobal == NULL)
				{
	#if defined(WIN32) && !defined(UNDER_CE)
					::FreeResource(hResource);
	#endif
					return NULL;
				}
				dwSize = ::SizeofResource(hCurInst, hResource);
				if (dwSize == 0)
					return NULL;
				m_lpResourceZIPBuffer = new BYTE[dwSize];
				if (m_lpResourceZIPBuffer != NULL)
				{
					::CopyMemory(m_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize);
				}
	#if defined(WIN32) && !defined(UNDER_CE)
				::FreeResource(hResource);
	#endif
				_paintManager->SetResourceZip(m_lpResourceZIPBuffer, dwSize);

				pRoot = builder.Create(xml, type, pCallback, _paintManager, pParent);
			}
		}

		ASSERT(pRoot);
		if (pRoot == NULL)
		{
			MessageBox(NULL, _T("加载资源文件失败"), _T("Duilib"), MB_OK | MB_ICONERROR);
			ExitProcess(1);
			return NULL;
		}
		return pRoot;
	}
Exemple #17
0
bool CBaseBaseDef::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
	ADDTOCALLSTACK("CBaseBaseDef::r_WriteVal");
	EXC_TRY("WriteVal");
	bool	fZero	= false;
	int index = FindTableHeadSorted( pszKey, sm_szLoadKeys, COUNTOF( sm_szLoadKeys )-1 );

	switch ( index )
	{
		//return as string or hex number or NULL if not set
		case OBC_CATEGORY:
		case OBC_DESCRIPTION:
		case OBC_SUBSECTION:
		case OBC_HITSPELL:
		case OBC_SLAYER:
		case OBC_SLAYERLESSER:
		case OBC_SLAYERMISC:
		case OBC_SLAYERSUPER:
		case OBC_ABILITYPRIMARY:
		case OBC_ABILITYSECONDARY:
		case OBC_MANABURST:
			sVal = GetDefStr(pszKey, false);
			break;
		//return as decimal number or 0 if not set
		case OBC_BALANCED:
		case OBC_BANE:
		case OBC_BATTLELUST:
		case OBC_BLOODDRINKER:
		case OBC_CASTINGFOCUS:
		case OBC_DAMCHAOS:
		case OBC_DAMCOLD:
		case OBC_DAMDIRECT:
		case OBC_DAMENERGY:
		case OBC_DAMFIRE:
		case OBC_DAMMODIFIER:
		case OBC_DAMPHYSICAL:
		case OBC_DECREASEHITCHANCE:
		case OBC_DAMPOISON:
		case OBC_EATERCOLD:
		case OBC_EATERDAM:
		case OBC_EATERENERGY:
		case OBC_EATERFIRE:
		case OBC_EATERKINETIC:
		case OBC_EATERPOISON:
		case OBC_ENHANCEPOTIONS:
		case OBC_EXPANSION:
		case OBC_FASTERCASTING:
		case OBC_FASTERCASTRECOVERY:
		case OBC_HITAREACOLD:
		case OBC_HITAREAENERGY:
		case OBC_HITAREAFIRE:
		case OBC_HITAREAPHYSICAL:
		case OBC_HITAREAPOISON:
		case OBC_HITCURSE:
		case OBC_HITDISPEL:
		case OBC_HITFATIGUE:
		case OBC_HITFIREBALL:
		case OBC_HITHARM:
		case OBC_HITLEECHLIFE:
		case OBC_HITLEECHMANA:
		case OBC_HITLEECHSTAM:
		case OBC_HITLIGHTNING:
		case OBC_HITLOWERATK:
		case OBC_HITLOWERDEF:
		case OBC_HITMAGICARROW:
		case OBC_HITMANADRAIN:
		case OBC_INCREASEDAM:
		case OBC_INCREASEDEFCHANCE:
		case OBC_INCREASEDEFCHANCEMAX:
		case OBC_INCREASEHITCHANCE:
		case OBC_INCREASEGOLD:
		case OBC_INCREASEKARMALOSS:
		case OBC_INCREASESPELLDAM:
		case OBC_INCREASESWINGSPEED:
		case OBC_LOWERAMMOCOST:
		case OBC_LOWERMANACOST:
		case OBC_LOWERREAGENTCOST:
		case OBC_LOWERREQ:
		case OBC_LUCK:
		case OBC_MANABURSTFREQUENCY:
		case OBC_MANABURSTKARMA:
		case OBC_NIGHTSIGHT:
		case OBC_RAGEFOCUS:
		case OBC_REACTIVEPARALYZE:
		case OBC_REFLECTPHYSICALDAM:
		case OBC_REGENFOOD:
		case OBC_REGENHITS:
		case OBC_REGENMANA:
		case OBC_REGENSTAM:
		case OBC_REGENVALFOOD:
		case OBC_REGENVALHITS:
		case OBC_REGENVALMANA:
		case OBC_REGENVALSTAM:
		case OBC_RESCOLD:
		case OBC_RESFIRE:
		case OBC_RESENERGY:
		case OBC_RESPHYSICAL:
		case OBC_RESPOISON:
		case OBC_RESCOLDMAX:
		case OBC_RESFIREMAX:
		case OBC_RESENERGYMAX:
		case OBC_RESPHYSICALMAX:
		case OBC_RESPOISONMAX:
		case OBC_RESONANCECOLD:
		case OBC_RESONANCEENERGY:
		case OBC_RESONANCEFIRE:
		case OBC_RESONANCEKINETIC:
		case OBC_RESONANCEPOISON:
		case OBC_SOULCHARGE:
		case OBC_SOULCHARGECOLD:
		case OBC_SOULCHARGEENERGY:
		case OBC_SOULCHARGEFIRE:
		case OBC_SOULCHARGEKINETIC:
		case OBC_SOULCHARGEPOISON:
		case OBC_SPELLCONSUMPTION:
		case OBC_SPELLFOCUSING:
		case OBC_SPLINTERINGWEAPON:
		case OBC_VELOCITY:
		case OBC_SPELLCHANNELING:
		case OBC_NAMELOC:
		case OBC_HITSPELLSTR:
		case OBC_WEIGHTREDUCTION:
		case OBC_COMBATBONUSSTAT:
		case OBC_COMBATBONUSPERCENT:
			sVal.FormatLLVal(GetDefNum(pszKey, true));
			break;

		case OBC_DEFNAME:
			sVal = GetResourceName();
			break;

		case OBC_ARMOR:
			{
				pszKey += strlen(sm_szLoadKeys[index]); // 9;
				if ( *pszKey == '.' )
				{
					SKIP_SEPARATORS( pszKey );

					if ( !strnicmp( pszKey, "LO", 2 ) )
					{
						sVal.Format( "%d", m_defenseBase );
					}
					else if ( !strnicmp( pszKey, "HI", 2 ) )
					{
						sVal.Format( "%d", m_defenseBase+m_defenseRange );
					}
				}
				else
				{
					sVal.Format( "%d,%d", m_defenseBase, m_defenseBase+m_defenseRange );
				}
			} break;
		case OBC_DAM:
			{
				pszKey += strlen(sm_szLoadKeys[index]); // 9;
				if ( *pszKey == '.' )
				{
					SKIP_SEPARATORS( pszKey );

					if ( !strnicmp( pszKey, "LO", 2 ) )
					{
						sVal.Format( "%d", m_attackBase );
					}
					else if ( !strnicmp( pszKey, "HI", 2 ) )
					{
						sVal.Format( "%d", m_attackBase+m_attackRange );
					}
				}
				else
				{
					sVal.Format( "%d,%d", m_attackBase, m_attackBase+m_attackRange );
				}
			} break;
		case OBC_BASEID:
			sVal = g_Cfg.ResourceGetName( GetResourceID());
			break;
		case OBC_CAN:
			sVal.FormatHex( m_Can );
			break;
		case OBC_HEIGHT:
			{
				//CBaseBaseDef * pBaseBaseDef = dynamic_cast<CBaseBaseDef*>(this);
				//DEBUG_ERR(("OBC_HEIGHT  -  m_dwDispIndex %d  GetHeight() %d  pBaseBaseDef->GetHeight() %d  pBaseBaseDef 0x%x\n",m_wDispIndex,GetHeight(),pBaseBaseDef->GetHeight(),pBaseBaseDef));
				sVal.FormatVal( GetHeight() );
			}
			break;
		case OBC_INSTANCES:
			sVal.FormatVal( GetRefInstances());
			break;
		case OBC_NAME:
			sVal = GetName();
			break;

		case OBC_RANGE:
			if ( RangeH() == 0 ) sVal.Format( "%d", RangeL() );
			else sVal.Format( "%d,%d", RangeH(), RangeL() );
			break;
		case OBC_RANGEL: // internally: rangel seems to be Range Highest value
			sVal.FormatVal( RangeH() );
			break;
		case OBC_RANGEH: // but rangeh seems to be the Range Lowest value.
			sVal.FormatVal( RangeL() );
			break;

		case OBC_RESOURCES:		// Print the resources
			{
				pszKey += strlen(sm_szLoadKeys[index]); // 9;
				if ( *pszKey == '.' )
				{
					SKIP_SEPARATORS( pszKey );

					if ( !strnicmp( pszKey, "COUNT", 5 ))
					{
						sVal.FormatVal(m_BaseResources.GetCount());
					}
					else
					{
						bool fQtyOnly = false;
						bool fKeyOnly = false;
						index = Exp_GetVal( pszKey );
						SKIP_SEPARATORS( pszKey );

						if ( !strnicmp( pszKey, "KEY", 3 ))
							fKeyOnly	= true;
						else if ( !strnicmp( pszKey, "VAL", 3 ))
							fQtyOnly	= true;

						TCHAR *pszTmp = Str_GetTemp();
						m_BaseResources.WriteKeys( pszTmp, index, fQtyOnly, fKeyOnly );
						if ( fQtyOnly && pszTmp[0] == '\0' )
							strcpy( pszTmp, "0" );

						sVal = pszTmp;
					}
				}
				else
				{
					TCHAR *pszTmp = Str_GetTemp();
					m_BaseResources.WriteKeys( pszTmp );
					sVal = pszTmp;
				}
			}
			break;
		case OBC_RESLEVEL:
			sVal.FormatVal( GetResLevel() );
			break;
		case OBC_RESDISPDNHUE:
			sVal.FormatHex( GetResDispDnHue() );
			break;
		case OBC_TAG0:
			fZero	= true;
			pszKey++;
		case OBC_TAG:			// "TAG" = get/set a local tag.
			if ( pszKey[3] != '.' )
				return( false );
			pszKey += 4;
			sVal = m_TagDefs.GetKeyStr(pszKey, fZero );
			break;
		case OBC_TEVENTS:
			m_TEvents.WriteResourceRefList( sVal );
			break;
		default:
			return false;
	}
	return true;
	EXC_CATCH;

	EXC_DEBUG_START;
	EXC_ADD_KEYRET(pSrc);
	EXC_DEBUG_END;
	return false;
}
Exemple #18
0
CControlUI* IDuiWindow::CreateRoot()
{
	CDialogBuilder builder;

	CDuiString strResourcePath = GetSkinPath();
	strResourcePath += GetSkinFolder().GetData();
	m_PaintManager.SetResourcePath(strResourcePath.GetData());

	CControlUI* pRoot = NULL;

	switch (GetResourceType())
	{
	case UILIB_FILE:
		{
			pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
		}
		break;
	case UILIB_ZIP:
		{
			m_PaintManager.SetResourceZip(GetZIPFileName().GetData(), true);
			pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
		}
		break;
	case UILIB_RESOURCE:
		{
			HINSTANCE hCurInst = CPaintManagerUI::GetResourceDll();
			m_PaintManager.SetCurResInstance(hCurInst);
			pRoot = builder.Create(_ttoi(GetSkinFile().GetData()), _T("xml"), this, &m_PaintManager);
		}
		break;
	case UILIB_ZIPRESOURCE:
		{
			HINSTANCE hCurInst = m_PaintManager.GetCurResInstance();
			if (!hCurInst)
				hCurInst = CPaintManagerUI::GetResourceDll();

			m_PaintManager.SetCurResInstance(hCurInst);

			HRSRC hResource = ::FindResource(hCurInst, GetResourceID(), _T("ZIPRES"));
			if (hResource == NULL)
				return NULL;
			DWORD dwSize = 0;
			HGLOBAL hGlobal = ::LoadResource(hCurInst, hResource);
			if (hGlobal == NULL)
			{
	#if defined(WIN32) && !defined(UNDER_CE)
				::FreeResource(hResource);
	#endif
				return NULL;
			}
			dwSize = ::SizeofResource(hCurInst, hResource);
			if (dwSize == 0)
				return NULL;
			m_lpResourceZIPBuffer = new BYTE[dwSize];
			if (m_lpResourceZIPBuffer != NULL)
			{
				::CopyMemory(m_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize);
			}
	#if defined(WIN32) && !defined(UNDER_CE)
			::FreeResource(hResource);
	#endif
			m_PaintManager.SetResourceZip(m_lpResourceZIPBuffer, dwSize);

			pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
		}
	}

	ASSERT(pRoot);
	if (pRoot == NULL)
	{
		MessageBox(NULL, _T("加载资源文件失败"), _T("Duilib"), MB_OK | MB_ICONERROR);
		ExitProcess(1);
		return NULL;
	}
	return pRoot;
}
	LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		// 调整窗口样式
		LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
		styleValue &= ~WS_CAPTION;
		::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

		// 调整窗口尺寸
		RECT rcClient;
		::GetClientRect(*this, &rcClient);
		::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

		// 关联UI管理器
		m_PaintManager.Init(m_hWnd, GetManagerName());
		// 注册PreMessage回调
		m_PaintManager.AddPreMessageFilter(this);

		// 允许更灵活的资源路径定义
		if (CPaintManagerUI::GetResourcePath().IsEmpty()) {
			CDuiString strResourcePath = CPaintManagerUI::GetInstancePath();
			strResourcePath += GetSkinFolder().GetData();
			CPaintManagerUI::SetResourcePath(strResourcePath.GetData());
		}
		// 加载资源
		switch(GetResourceType())
		{
		case UILIB_ZIP:
			CPaintManagerUI::SetResourceZip(GetZIPFileName().GetData(), true);
			break;
		case UILIB_ZIPRESOURCE:
			{
				HRSRC hResource = ::FindResource(m_PaintManager.GetResourceDll(), GetResourceID(), _T("ZIPRES"));
				if( hResource == NULL ) return 0L;
				DWORD dwSize = 0;
				HGLOBAL hGlobal = ::LoadResource(m_PaintManager.GetResourceDll(), hResource);
				if( hGlobal == NULL ) {
#if defined(WIN32) && !defined(UNDER_CE)
					::FreeResource(hResource);
#endif
					return 0L;
				}
				dwSize = ::SizeofResource(m_PaintManager.GetResourceDll(), hResource);
				if( dwSize == 0 ) return 0L;

				CPaintManagerUI::SetResourceZip((LPBYTE)::LockResource(hGlobal), dwSize);
#if defined(WIN32) && !defined(UNDER_CE)
				::FreeResource(hResource);
#endif
			}
			break;
		}
		// 资源管理器接口
		InitResource();

		// 创建主窗口
		CControlUI* pRoot=NULL;
		CDialogBuilder builder;
		if (GetResourceType() == UILIB_RESOURCE) {
			STRINGorID xml(_ttoi(GetSkinFile().GetData()));
			pRoot = builder.Create(xml, _T("xml"), this, &m_PaintManager);
		}
		else {
			pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
		}

		if (pRoot == NULL) {
			MessageBox(NULL,_T("加载资源文件失败"),_T("Duilib"),MB_OK|MB_ICONERROR);
			ExitProcess(1);
			return 0;
		}
		m_PaintManager.AttachDialog(pRoot);
		// 添加Notify事件接口
		m_PaintManager.AddNotifier(this);
		// 窗口初始化完毕
		InitWindow();
		return 0;
	}
Exemple #20
0
bool CRegionBase::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
	ADDTOCALLSTACK("CRegionBase::r_WriteVal");
	EXC_TRY("WriteVal");
	bool fZero = false;
	int index = FindTableHeadSorted(pszKey, sm_szLoadKeys, COUNTOF(sm_szLoadKeys) - 1);
	if ( index < 0 )
		return CScriptObj::r_WriteVal(pszKey, sVal, pSrc);

	switch ( index )
	{
		case RC_ANNOUNCE:
			sVal.FormatVal( IsFlag(REGION_FLAG_ANNOUNCE));
			break;
		case RC_ARENA:
			sVal.FormatVal( IsFlag(REGION_FLAG_ARENA));
			break;
		case RC_BUILDABLE:
			sVal.FormatVal( ! IsFlag(REGION_FLAG_NOBUILDING));
			break;
		case RC_CLIENTS:
			{
				int i = 0;
				size_t iClients = 0;
				for ( ; ; i++ )
				{
					CSector	*pSector = GetSector(i);
					if ( pSector == NULL ) break;
					iClients += pSector->m_Chars_Active.HasClients();
				}
				sVal.FormatVal(static_cast<long>(iClients));
				break;
			}
		case RC_EVENTS:
			m_Events.WriteResourceRefList( sVal );
			break;
		case RC_ISEVENT:
			if ( pszKey[7] != '.' )
				return( false );
			pszKey += 8;
			sVal.FormatVal(m_Events.ContainsResourceName(RES_EVENTS, pszKey));
			return( true );
		case RC_FLAGS:
			sVal.FormatHex( GetRegionFlags() );
			break;
		case RC_GATE:
			sVal.FormatVal( ! IsFlag(REGION_ANTIMAGIC_GATE));
			break;
		case RC_GROUP:
			sVal = m_sGroup;
			break;
		case RC_GUARDED:
			sVal.FormatVal( IsFlag(REGION_FLAG_GUARDED));
			break;
		case RC_MAGIC:
			sVal.FormatVal( ! IsFlag(REGION_ANTIMAGIC_ALL));
			break;
		case RC_MAP:
			sVal.FormatVal( m_pt.m_map );
			break;
		case RC_MARK:
		case RC_RECALLIN:
			sVal.FormatVal( ! IsFlag(REGION_ANTIMAGIC_RECALL_IN));
			break;
		case RC_NAME:
			// The previous name was really the DEFNAME ???
			sVal = GetName();
			break;
		case RC_NOBUILD:
			sVal.FormatVal( IsFlag(REGION_FLAG_NOBUILDING));
			break;
		case RC_NODECAY:
			sVal.FormatVal( IsFlag(REGION_FLAG_NODECAY));
			break;
		case RC_NOPVP:
			sVal.FormatVal( IsFlag(REGION_FLAG_NO_PVP));
			break;
		case RC_P:
			sVal = m_pt.WriteUsed();
			break;
		case RC_RECALL:
		case RC_RECALLOUT:
			sVal.FormatVal( ! IsFlag(REGION_ANTIMAGIC_RECALL_OUT));
			break;
		case RC_RECT:
			{
				size_t iQty = m_Rects.GetCount();
				pszKey += 4;
				if ( *pszKey == '\0' )
				{
					sVal.FormatVal( static_cast<long>(iQty));
					return true;
				}
				SKIP_SEPARATORS( pszKey );
				size_t iRect = Exp_GetVal( pszKey );
				if ( iRect <= 0 )
				{
					sVal = m_rectUnion.Write();
					return true;
				}
	
				iRect -= 1;
				if ( !m_Rects.IsValidIndex( iRect ) )
				{
					sVal.FormatVal( 0 );
					return true;
				}
				sVal = m_Rects[iRect].Write();
				return( true );
			}
		case RC_SAFE:
			sVal.FormatVal( IsFlag(REGION_FLAG_SAFE));
			break;
		case RC_TAGCOUNT:
			sVal.FormatVal( static_cast<long>(m_TagDefs.GetCount()) );
			break;
		case RC_TAGAT:
			{
				pszKey += 5; // eat the 'TAGAT'
				if ( *pszKey == '.' ) // do we have an argument?
				{
					SKIP_SEPARATORS( pszKey );
					size_t iQty = static_cast<size_t>( Exp_GetVal( pszKey ) ); 
					if ( iQty >= m_TagDefs.GetCount() )
						return( false ); // trying to get non-existant tag
						
					CVarDefCont * pTagAt = m_TagDefs.GetAt( iQty );
					if ( !pTagAt )
						return( false ); // trying to get non-existant tag
						
					SKIP_SEPARATORS( pszKey );
					if ( ! *pszKey )
					{
						sVal.Format("%s=%s", pTagAt->GetKey(), pTagAt->GetValStr());
						return( true );
					}
					else if ( !strnicmp( pszKey, "KEY", 3 )) // key?
					{
						sVal = pTagAt->GetKey();
						return( true );
					}
					else if ( !strnicmp( pszKey, "VAL", 3 )) // val?
					{
						sVal = pTagAt->GetValStr();
						return( true );
					}
				}
					
				return( false );
			} 
			break;
		case RC_TAG0:
			fZero = true;
			++pszKey;
			// fall through
		case RC_TAG:	// "TAG" = get/set a local tag.
			{	
				if ( pszKey[3] != '.' )
					return( false );
				pszKey += 4;
				sVal = m_TagDefs.GetKeyStr( pszKey, fZero );
				return( true );
			}
		case RC_TYPE:
			{
				const CItemBase * pBase = NULL;
				const CItem * pItem = GetResourceID().ItemFind();
				if (pItem != NULL)
					pBase = pItem->Item_GetDef();
				
				if (pBase != NULL)
					sVal = pBase->GetResourceName();
				else
					sVal = "";
			} break;
		case RC_UID:
			// Allow use of UID.x.KEY on the REGION object
			if ( pszKey[3] == '.' )
				return CScriptObj::r_WriteVal( pszKey, sVal, pSrc );

			sVal.FormatHex( GetResourceID() );
			break;
		case RC_UNDERGROUND:
			sVal.FormatVal( IsFlag(REGION_FLAG_UNDERGROUND));
			break;
		default:
			return false;
	}
	return true;
	EXC_CATCH;

	EXC_DEBUG_START;
	g_Log.EventDebug("command '%s' ret '%s' [%p]\n", pszKey, static_cast<LPCTSTR>(sVal), static_cast<void *>(pSrc));
	EXC_DEBUG_END;
	return false;
}
Exemple #21
0
bool CBaseBaseDef::r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc)
{
	ADDTOCALLSTACK("CBaseBaseDef::r_WriteVal");
	EXC_TRY("WriteVal");
	bool fZero = false;

	switch ( FindTableHeadSorted(pszKey, sm_szLoadKeys, COUNTOF(sm_szLoadKeys) - 1) )
	{
		// Return as string or hex number (NULL if not set)
		case OBC_CATEGORY:
		case OBC_DESCRIPTION:
		case OBC_SUBSECTION:
			sVal = GetDefStr(pszKey, false);
			break;
		// Return as decimal number (0 if not set)
		case OBC_COMBATBONUSPERCENT:
		case OBC_COMBATBONUSSTAT:
		case OBC_DAMCHAOS:
		case OBC_DAMDIRECT:
		case OBC_EXPANSION:
		case OBC_NAMELOC:
		case OBC_REGENFOOD:
		case OBC_REGENHITS:
		case OBC_REGENMANA:
		case OBC_REGENSTAM:
		case OBC_REGENVALFOOD:
		case OBC_REGENVALHITS:
		case OBC_REGENVALMANA:
		case OBC_REGENVALSTAM:
			sVal.FormatLLVal(GetDefNum(pszKey));
			break;
		case OBC_ARMOR:
		{
			pszKey += 5;
			if ( *pszKey == '.' )
			{
				SKIP_SEPARATORS(pszKey);
				if ( !strnicmp(pszKey, "LO", 2) )
					sVal.Format("%hu", m_defenseBase);
				else if ( !strnicmp(pszKey, "HI", 2) )
					sVal.Format("%hu", m_defenseBase + m_defenseRange);
			}
			else
				sVal.Format("%hu,%hu", m_defenseBase, m_defenseBase + m_defenseRange);
			break;
		}
		case OBC_BASEID:
			sVal = g_Cfg.ResourceGetName(GetResourceID());
			break;
		case OBC_CAN:
			sVal.FormatHex(m_Can);
			break;
		case OBC_DAM:
		{
			pszKey += 3;
			if ( *pszKey == '.' )
			{
				SKIP_SEPARATORS(pszKey);
				if ( !strnicmp(pszKey, "LO", 2) )
					sVal.Format("%hu", m_attackBase);
				else if ( !strnicmp(pszKey, "HI", 2) )
					sVal.Format("%hu", m_attackBase + m_attackRange);
			}
			else
				sVal.Format("%hu,%hu", m_attackBase, m_attackBase + m_attackRange);
			break;
		}
		case OBC_DAMCOLD:
			sVal.FormatVal(m_DamCold);
			break;
		case OBC_DAMENERGY:
			sVal.FormatVal(m_DamEnergy);
			break;
		case OBC_DAMFIRE:
			sVal.FormatVal(m_DamFire);
			break;
		case OBC_DAMPHYSICAL:
			sVal.FormatVal(m_DamPhysical);
			break;
		case OBC_DAMPOISON:
			sVal.FormatVal(m_DamPoison);
			break;
		case OBC_DEFNAME:
			sVal = GetResourceName();
			break;
		case OBC_ENHANCEPOTIONS:
			sVal.FormatVal(m_EnhancePotions);
			break;
		case OBC_FASTERCASTING:
			sVal.FormatVal(m_FasterCasting);
			break;
		case OBC_FASTERCASTRECOVERY:
			sVal.FormatVal(m_FasterCastRecovery);
			break;
		case OBC_HEIGHT:
			sVal.FormatVal(GetHeight());
			break;
		case OBC_HITLEECHLIFE:
			sVal.FormatVal(m_HitLifeLeech);
			break;
		case OBC_HITLEECHMANA:
			sVal.FormatVal(m_HitManaLeech);
			break;
		case OBC_HITLEECHSTAM:
			sVal.FormatVal(m_HitStaminaLeech);
			break;
		case OBC_HITMANADRAIN:
			sVal.FormatVal(m_HitManaDrain);
			break;
		case OBC_INCREASEDAM:
			sVal.FormatVal(m_DamIncrease);
			break;
		case OBC_INCREASEDEFCHANCE:
			sVal.FormatVal(m_DefChanceIncrease);
			break;
		case OBC_INCREASEDEFCHANCEMAX:
			sVal.FormatVal(m_DefChanceIncreaseMax);
			break;
		case OBC_INCREASEHITCHANCE:
			sVal.FormatVal(m_HitChanceIncrease);
			break;
		case OBC_INCREASESPELLDAM:
			sVal.FormatVal(m_SpellDamIncrease);
			break;
		case OBC_INCREASESWINGSPEED:
			sVal.FormatVal(m_SwingSpeedIncrease);
			break;
		case OBC_INSTANCES:
			sVal.FormatUVal(GetRefInstances());
			break;
		case OBC_LOWERMANACOST:
			sVal.FormatVal(m_LowerManaCost);
			break;
		case OBC_LOWERREAGENTCOST:
			sVal.FormatVal(m_LowerReagentCost);
			break;
		case OBC_LUCK:
			sVal.FormatVal(m_Luck);
			break;
		case OBC_NAME:
			sVal = GetName();
			break;
		case OBC_NIGHTSIGHT:
			sVal.FormatVal(m_NightSight);
			break;
		case OBC_REFLECTPHYSICALDAM:
			sVal.FormatVal(m_ReflectPhysicalDamage);
			break;
		case OBC_RANGE:
			if ( GetRangeH() == 0 )
				sVal.Format("%hhu", GetRangeL());
			else
				sVal.Format("%hhu,%hhu", GetRangeH(), GetRangeL());
			break;
		case OBC_RANGEH:
			sVal.FormatUVal(GetRangeL());
			break;
		case OBC_RANGEL:
			sVal.FormatUVal(GetRangeH());
			break;
		case OBC_RESCOLD:
			sVal.FormatVal(m_ResCold);
			break;
		case OBC_RESCOLDMAX:
			sVal.FormatVal(m_ResColdMax);
			break;
		case OBC_RESDISPDNHUE:
			sVal.FormatHex(GetResDispDnHue());
			break;
		case OBC_RESENERGY:
			sVal.FormatVal(m_ResEnergy);
			break;
		case OBC_RESENERGYMAX:
			sVal.FormatVal(m_ResEnergyMax);
			break;
		case OBC_RESFIRE:
			sVal.FormatVal(m_ResFire);
			break;
		case OBC_RESFIREMAX:
			sVal.FormatVal(m_ResFireMax);
			break;
		case OBC_RESLEVEL:
			sVal.FormatUVal(GetResLevel());
			break;
		case OBC_RESOURCES:
		{
			pszKey += 9;
			if ( *pszKey == '.' )
			{
				SKIP_SEPARATORS(pszKey);
				if ( !strnicmp(pszKey, "COUNT", 5) )
					sVal.FormatVal(m_BaseResources.GetCount());
				else
				{
					size_t index = static_cast<size_t>(Exp_GetLLVal(pszKey));
					SKIP_SEPARATORS(pszKey);

					bool fQtyOnly = false;
					bool fKeyOnly = false;
					if ( !strnicmp(pszKey, "KEY", 3) )
						fKeyOnly = true;
					else if ( !strnicmp(pszKey, "VAL", 3) )
						fQtyOnly = true;

					TCHAR *pszTmp = Str_GetTemp();
					m_BaseResources.WriteKeys(pszTmp, index, fQtyOnly, fKeyOnly);
					if ( fQtyOnly && (pszTmp[0] == '\0') )
						strcpy(pszTmp, "0");
					sVal = pszTmp;
				}
			}
			else
			{
				TCHAR *pszTmp = Str_GetTemp();
				m_BaseResources.WriteKeys(pszTmp);
				sVal = pszTmp;
			}
			break;
		}
		case OBC_RESPHYSICAL:
			sVal.FormatVal(m_ResPhysical);
			break;
		case OBC_RESPHYSICALMAX:
			sVal.FormatVal(m_ResPhysicalMax);
			break;
		case OBC_RESPOISON:
			sVal.FormatVal(m_ResPoison);
			break;
		case OBC_RESPOISONMAX:
			sVal.FormatVal(m_ResPoisonMax);
			break;
		case OBC_TAG0:
			fZero = true;
			++pszKey;
			// fall through
		case OBC_TAG:
			if ( pszKey[3] != '.' )
				return false;
			pszKey += 4;
			sVal = m_TagDefs.GetKeyStr(pszKey, fZero);
			break;
		case OBC_TEVENTS:
			m_TEvents.WriteResourceRefList(sVal);
			break;
		default:
			return false;
	}
	return true;
	EXC_CATCH;

	EXC_DEBUG_START;
	EXC_ADD_KEYRET(pSrc);
	EXC_DEBUG_END;
	return false;
}
Exemple #22
0
WrappedID3D12GraphicsCommandList::WrappedID3D12GraphicsCommandList(ID3D12GraphicsCommandList *real,
                                                                   WrappedID3D12Device *device,
                                                                   Serialiser *serialiser,
                                                                   LogState &state)
    : RefCounter12(real), m_pDevice(device), m_State(state)
{
  if(RenderDoc::Inst().GetCrashHandler())
    RenderDoc::Inst().GetCrashHandler()->RegisterMemoryRegion(
        this, sizeof(WrappedID3D12GraphicsCommandList));

  if(m_pReal)
    m_pReal->QueryInterface(__uuidof(ID3D12DebugCommandList), (void **)&m_WrappedDebug.m_pReal);

  if(RenderDoc::Inst().IsReplayApp())
  {
    m_pSerialiser = serialiser;
  }
  else
  {
    m_pSerialiser = new Serialiser(NULL, Serialiser::WRITING, true);

    m_pSerialiser->SetDebugText(true);
  }

  m_pSerialiser->SetUserData(m_pDevice->GetResourceManager());

  // create a temporary and grab its resource ID
  m_ResourceID = ResourceIDGen::GetNewUniqueID();

  RDCEraseEl(m_Init);

  m_ListRecord = NULL;
  m_Cmd = NULL;

  m_CurGfxRootSig = NULL;

  if(!RenderDoc::Inst().IsReplayApp())
  {
    m_ListRecord = m_pDevice->GetResourceManager()->AddResourceRecord(m_ResourceID);
    m_ListRecord->type = Resource_GraphicsCommandList;
    m_ListRecord->DataInSerialiser = false;
    m_ListRecord->SpecialResource = true;
    m_ListRecord->Length = 0;

    m_ListRecord->cmdInfo = new CmdListRecordingInfo();

    // this is set up in the implicit Reset() right after creation
    m_ListRecord->bakedCommands = NULL;
  }
  else
  {
    m_Cmd = m_pDevice->GetQueue()->GetCommandData();
  }

  if(m_pReal)
  {
    bool ret = m_pDevice->GetResourceManager()->AddWrapper(this, m_pReal);
    if(!ret)
      RDCERR("Error adding wrapper for ID3D12GraphicsCommandList");
  }

  m_pDevice->GetResourceManager()->AddCurrentResource(GetResourceID(), this);

  m_pDevice->SoftRef();
}
bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(UINT NumCommandLists,
                                                              ID3D12CommandList *const *ppCommandLists)
{
  SERIALISE_ELEMENT(ResourceId, queueId, GetResourceID());
  SERIALISE_ELEMENT(UINT, numCmds, NumCommandLists);

  vector<ResourceId> cmdIds;
  ID3D12GraphicsCommandList **cmds =
      m_State >= WRITING ? NULL : new ID3D12GraphicsCommandList *[numCmds];

  if(m_State >= WRITING)
  {
    for(UINT i = 0; i < numCmds; i++)
    {
      D3D12ResourceRecord *record = GetRecord(ppCommandLists[i]);
      RDCASSERT(record->bakedCommands);
      if(record->bakedCommands)
        cmdIds.push_back(record->bakedCommands->GetResourceID());
    }
  }

  m_pSerialiser->Serialise("ppCommandLists", cmdIds);

  if(m_State < WRITING)
  {
    for(UINT i = 0; i < numCmds; i++)
    {
      cmds[i] = cmdIds[i] != ResourceId()
                    ? GetResourceManager()->GetLiveAs<ID3D12GraphicsCommandList>(cmdIds[i])
                    : NULL;
    }
  }

  const string desc = m_pSerialiser->GetDebugStr();

  // debug messages
  {
    vector<DebugMessage> debugMessages;

    if(m_State == WRITING_CAPFRAME)
      debugMessages = m_pDevice->GetDebugMessages();

    SERIALISE_ELEMENT(uint32_t, NumMessages, (uint32_t)debugMessages.size());

    for(uint32_t i = 0; i < NumMessages; i++)
    {
      ScopedContext msgscope(m_pSerialiser, "DebugMessage", "DebugMessage", 0, false);

      string msgDesc;
      if(m_State >= WRITING)
        msgDesc = debugMessages[i].description.elems;

      SERIALISE_ELEMENT(uint32_t, Category, debugMessages[i].category);
      SERIALISE_ELEMENT(uint32_t, Severity, debugMessages[i].severity);
      SERIALISE_ELEMENT(uint32_t, ID, debugMessages[i].messageID);
      SERIALISE_ELEMENT(string, Description, msgDesc);

      if(m_State == READING)
      {
        DebugMessage msg;
        msg.source = eDbgSource_API;
        msg.category = (DebugMessageCategory)Category;
        msg.severity = (DebugMessageSeverity)Severity;
        msg.messageID = ID;
        msg.description = Description;

        m_Cmd.m_EventMessages.push_back(msg);
      }
    }
  }

  ID3D12CommandQueue *real = NULL;

  if(m_State <= EXECUTING)
    real = Unwrap(GetResourceManager()->GetLiveAs<ID3D12CommandQueue>(queueId));

  if(m_State == READING)
  {
    for(uint32_t i = 0; i < numCmds; i++)
    {
      if(m_Cmd.m_BakedCmdListInfo[cmdIds[i]].executeEvents.empty() ||
         m_Cmd.m_BakedCmdListInfo[cmdIds[i]].executeEvents[0].patched)
      {
        ID3D12CommandList *list = Unwrap(cmds[i]);
        real->ExecuteCommandLists(1, &list);
#if ENABLED(SINGLE_FLUSH_VALIDATE)
        m_pDevice->GPUSync();
#endif
      }
      else
      {
        BakedCmdListInfo &info = m_Cmd.m_BakedCmdListInfo[cmdIds[i]];

        // execute the first half of the cracked list
        ID3D12CommandList *list = Unwrap(info.crackedLists[0]);
        real->ExecuteCommandLists(1, &list);

        for(size_t c = 1; c < info.crackedLists.size(); c++)
        {
          m_pDevice->GPUSync();

          // readback the patch buffer and perform patching
          m_ReplayList->PatchExecuteIndirect(info, uint32_t(c - 1));

          // execute next list with this indirect.
          list = Unwrap(info.crackedLists[c]);
          real->ExecuteCommandLists(1, &list);
        }

#if ENABLED(SINGLE_FLUSH_VALIDATE)
        m_pDevice->GPUSync();
#endif
      }
    }

    for(uint32_t i = 0; i < numCmds; i++)
    {
      ResourceId cmd = GetResourceManager()->GetLiveID(cmdIds[i]);
      m_pDevice->ApplyBarriers(m_Cmd.m_BakedCmdListInfo[cmd].barriers);
    }

    m_Cmd.AddEvent(desc);

    // we're adding multiple events, need to increment ourselves
    m_Cmd.m_RootEventID++;

    string basename = "ExecuteCommandLists(" + ToStr::Get(numCmds) + ")";

    for(uint32_t c = 0; c < numCmds; c++)
    {
      string name = StringFormat::Fmt("=> %s[%u]: ID3D12CommandList(%s)", basename.c_str(), c,
                                      ToStr::Get(cmdIds[c]).c_str());

      // add a fake marker
      FetchDrawcall draw;
      draw.name = name;
      draw.flags |= eDraw_SetMarker;
      m_Cmd.AddEvent(name);
      m_Cmd.AddDrawcall(draw, true);
      m_Cmd.m_RootEventID++;

      BakedCmdListInfo &cmdBufInfo = m_Cmd.m_BakedCmdListInfo[cmdIds[c]];

      // insert the baked command list in-line into this list of notes, assigning new event and
      // drawIDs
      m_Cmd.InsertDrawsAndRefreshIDs(cmdIds[c], cmdBufInfo.draw->children);

      for(size_t e = 0; e < cmdBufInfo.draw->executedCmds.size(); e++)
      {
        vector<uint32_t> &submits =
            m_Cmd.m_Partial[D3D12CommandData::Secondary].cmdListExecs[cmdBufInfo.draw->executedCmds[e]];

        for(size_t s = 0; s < submits.size(); s++)
          submits[s] += m_Cmd.m_RootEventID;
      }

      for(size_t i = 0; i < cmdBufInfo.debugMessages.size(); i++)
      {
        DebugMessage msg = cmdBufInfo.debugMessages[i];
        msg.eventID += m_Cmd.m_RootEventID;
        m_pDevice->AddDebugMessage(msg);
      }

      // only primary command lists can be submitted
      m_Cmd.m_Partial[D3D12CommandData::Primary].cmdListExecs[cmdIds[c]].push_back(
          m_Cmd.m_RootEventID);

      m_Cmd.m_RootEventID += cmdBufInfo.eventCount;
      m_Cmd.m_RootDrawcallID += cmdBufInfo.drawCount;

      name = StringFormat::Fmt("=> %s[%u]: Close(%s)", basename.c_str(), c,
                               ToStr::Get(cmdIds[c]).c_str());
      draw.name = name;
      m_Cmd.AddEvent(name);
      m_Cmd.AddDrawcall(draw, true);
      m_Cmd.m_RootEventID++;
    }

    // account for the outer loop thinking we've added one event and incrementing,
    // since we've done all the handling ourselves this will be off by one.
    m_Cmd.m_RootEventID--;
  }
  else if(m_State == EXECUTING)
  {
    // account for the queue submit event
    m_Cmd.m_RootEventID++;

    uint32_t startEID = m_Cmd.m_RootEventID;

    // advance m_CurEventID to match the events added when reading
    for(uint32_t c = 0; c < numCmds; c++)
    {
      // 2 extra for the virtual labels around the command list
      m_Cmd.m_RootEventID += 2 + m_Cmd.m_BakedCmdListInfo[cmdIds[c]].eventCount;
      m_Cmd.m_RootDrawcallID += 2 + m_Cmd.m_BakedCmdListInfo[cmdIds[c]].drawCount;
    }

    // same accounting for the outer loop as above
    m_Cmd.m_RootEventID--;

    if(numCmds == 0)
    {
      // do nothing, don't bother with the logic below
    }
    else if(m_Cmd.m_LastEventID <= startEID)
    {
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
      RDCDEBUG("Queue Submit no replay %u == %u", m_Cmd.m_LastEventID, startEID);
#endif
    }
    else if(m_Cmd.m_DrawcallCallback && m_Cmd.m_DrawcallCallback->RecordAllCmds())
    {
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
      RDCDEBUG("Queue Submit re-recording from %u", m_Cmd.m_RootEventID);
#endif

      vector<ID3D12CommandList *> rerecordedCmds;

      for(uint32_t c = 0; c < numCmds; c++)
      {
        ID3D12CommandList *cmd = m_Cmd.RerecordCmdList(cmdIds[c]);
        ResourceId rerecord = GetResID(cmd);
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
        RDCDEBUG("Queue Submit fully re-recorded replay of %llu, using %llu", cmdIds[c], rerecord);
#endif
        rerecordedCmds.push_back(Unwrap(cmd));

        m_pDevice->ApplyBarriers(m_Cmd.m_BakedCmdListInfo[rerecord].barriers);
      }

#if ENABLED(SINGLE_FLUSH_VALIDATE)
      for(size_t i = 0; i < rerecordedCmds.size(); i++)
      {
        real->ExecuteCommandLists(1, &rerecordedCmds[i]);
        m_pDevice->GPUSync();
      }
#else
      real->ExecuteCommandLists((UINT)rerecordedCmds.size(), &rerecordedCmds[0]);
#endif
    }
    else if(m_Cmd.m_LastEventID > startEID && m_Cmd.m_LastEventID < m_Cmd.m_RootEventID)
    {
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
      RDCDEBUG("Queue Submit partial replay %u < %u", m_Cmd.m_LastEventID, m_Cmd.m_RootEventID);
#endif

      uint32_t eid = startEID;

      vector<ResourceId> trimmedCmdIds;
      vector<ID3D12CommandList *> trimmedCmds;

      for(uint32_t c = 0; c < numCmds; c++)
      {
        // account for the virtual label at the start of the events here
        // so it matches up to baseEvent
        eid++;

        uint32_t end = eid + m_Cmd.m_BakedCmdListInfo[cmdIds[c]].eventCount;

        if(eid == m_Cmd.m_Partial[D3D12CommandData::Primary].baseEvent)
        {
          ID3D12GraphicsCommandList *list =
              m_Cmd.RerecordCmdList(cmdIds[c], D3D12CommandData::Primary);
          ResourceId partial = GetResID(list);
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
          RDCDEBUG("Queue Submit partial replay of %llu at %u, using %llu", cmdIds[c], eid, partial);
#endif
          trimmedCmdIds.push_back(partial);
          trimmedCmds.push_back(Unwrap(list));
        }
        else if(m_Cmd.m_LastEventID >= end)
        {
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
          RDCDEBUG("Queue Submit full replay %llu", cmdIds[c]);
#endif
          trimmedCmdIds.push_back(cmdIds[c]);
          trimmedCmds.push_back(Unwrap(GetResourceManager()->GetLiveAs<ID3D12CommandList>(cmdIds[c])));
        }
        else
        {
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
          RDCDEBUG("Queue not submitting %llu", cmdIds[c]);
#endif
        }

        // 1 extra to account for the virtual end command list label (begin is accounted for
        // above)
        eid += 1 + m_Cmd.m_BakedCmdListInfo[cmdIds[c]].eventCount;
      }

      RDCASSERT(trimmedCmds.size() > 0);

#if ENABLED(SINGLE_FLUSH_VALIDATE)
      for(size_t i = 0; i < trimmedCmds.size(); i++)
      {
        real->ExecuteCommandLists(1, &trimmedCmds[i]);
        m_pDevice->GPUSync();
      }
#else
      real->ExecuteCommandLists((UINT)trimmedCmds.size(), &trimmedCmds[0]);
#endif

      for(uint32_t i = 0; i < trimmedCmdIds.size(); i++)
      {
        ResourceId cmd = trimmedCmdIds[i];
        m_pDevice->ApplyBarriers(m_Cmd.m_BakedCmdListInfo[cmd].barriers);
      }
    }
    else
    {
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
      RDCDEBUG("Queue Submit full replay %u >= %u", m_Cmd.m_LastEventID, m_Cmd.m_RootEventID);
#endif

      ID3D12CommandList **unwrapped = new ID3D12CommandList *[numCmds];
      for(uint32_t i = 0; i < numCmds; i++)
        unwrapped[i] = Unwrap(cmds[i]);

#if ENABLED(SINGLE_FLUSH_VALIDATE)
      for(UINT i = 0; i < numCmds; i++)
      {
        real->ExecuteCommandLists(1, &unwrapped[i]);
        m_pDevice->GPUSync();
      }
#else
      real->ExecuteCommandLists(numCmds, unwrapped);
#endif

      SAFE_DELETE_ARRAY(unwrapped);

      for(uint32_t i = 0; i < numCmds; i++)
      {
        ResourceId cmd = GetResourceManager()->GetLiveID(cmdIds[i]);
        m_pDevice->ApplyBarriers(m_Cmd.m_BakedCmdListInfo[cmd].barriers);
      }
    }
  }

  SAFE_DELETE_ARRAY(cmds);

  return true;
}