예제 #1
0
/** Creates the buffers and sets up the rest od the object */
HRESULT EditorLinePrimitive::CreatePrimitive(LineVertex* PrimVerts, UINT NumVertices, D3D11_PRIMITIVE_TOPOLOGY Topology)
{
	HRESULT hr=S_OK;

	// Clean up previous data
	DeleteContent();

	// Copy over the new data
	Vertices = new LineVertex[NumVertices];
	memcpy(Vertices, PrimVerts, sizeof(LineVertex)*NumVertices);
	this->NumVertices = NumVertices;
	
	//Create the vertex buffer
	D3D11_BUFFER_DESC bufferDesc;
    bufferDesc.ByteWidth = NumVertices * sizeof(LineVertex);
    bufferDesc.Usage = D3D11_USAGE_DEFAULT;
    bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    bufferDesc.CPUAccessFlags = 0;
    bufferDesc.MiscFlags = 0;

	D3D11_SUBRESOURCE_DATA InitData;
    InitData.pSysMem = &Vertices[0];
	InitData.SysMemPitch = 0;
	InitData.SysMemSlicePitch = 0;

	D3D11GraphicsEngineBase* engine = (D3D11GraphicsEngineBase*)Engine::GraphicsEngine;

	LE(engine->GetDevice()->CreateBuffer(&bufferDesc,&InitData,&PrimVB));

	PrimitiveTopology = Topology;

	return hr;
}
예제 #2
0
IPCCommandResult ES::DeleteContent(const IOCtlVRequest& request)
{
  if (!request.HasNumberOfValidVectors(2, 0) || request.in_vectors[0].size != sizeof(u64) ||
      request.in_vectors[1].size != sizeof(u32))
  {
    return GetDefaultReply(ES_EINVAL);
  }
  return GetDefaultReply(DeleteContent(Memory::Read_U64(request.in_vectors[0].address),
                                       Memory::Read_U32(request.in_vectors[1].address)));
}
예제 #3
0
/*----------------------------------------------------------------------------
>  Function Name: RtStatus_t FileRemove(int32_t RecordNumber,int32_t HandleNumber)

   FunctionType:  Reentrant

   Inputs:        1) Record Number
                  2) Handle Number  

   Outputs:       Returns SUCCESS on success else an Error Code 
                   
   Description:   Updates the handle to associate with the file to be deleted and
                  deletes the contents of the file i.e. marks all the clusters occupied by 
	              the file as zero in FAT Table.

<
----------------------------------------------------------------------------*/
RtStatus_t FileRemove(int32_t RecordNumber, int32_t HandleNumber)
{
    RtStatus_t RetValue = SUCCESS;
    uint8_t Buffer[32];
    int32_t ClusterNumber = 0, FileSize;
    HandleTable_t Temp;
    //  int64_t lTemp;

    Temp = Handle[HandleNumber];

    if (Handle[HandleNumber].StartingCluster != 0) {
        if ((RetValue = Fseek(HandleNumber, -DIRRECORDSIZE, SEEK_CUR)))
            return RetValue;
    }

    if (ReadDirectoryRecord(HandleNumber, RecordNumber, Buffer) < 0)
        return ERROR_OS_FILESYSTEM_NO_MATCHING_RECORD;

    if (Handle[HandleNumber].StartingCluster != 0) {
        if ((RetValue = Fseek(HandleNumber, -DIRRECORDSIZE, SEEK_CUR)))
            return RetValue;
    }

    if ((RetValue = DeleteRecord(HandleNumber, RecordNumber)) < 0)
        return RetValue;

    /* Set the Handle to original position */
    if ((RetValue = Fseek(HandleNumber, (RecordNumber * DIRRECORDSIZE), SEEK_SET)) < 0)
        return RetValue;

    FileSize = FSGetDWord(Buffer, DIR_FILESIZEOFFSET);

    // sdk2.6 changed this to left shift instead of right shift. 
    ClusterNumber =
        ((FSGetWord(Buffer, DIR_FSTCLUSLOOFFSET)) | (FSGetWord(Buffer, DIR_FSTCLUSHIOFFSET) << 16));

    if (((FSGetByte(Buffer, DIR_ATTRIBUTEOFFSET)) & DIRECTORY_MODE) == DIRECTORY_MODE)
        FileSize = 0x7fffffff;

    if ((ClusterNumber != 0) && (FileSize) != 0) {
        /* update the handle to associate with the file to be deleted */
        UpdateHandle(HandleNumber, ClusterNumber);

        /* Delete the contents of the file (i.e. Mark all the clusters occupied by 
           the file as zero in FAT Table) */
        if ((RetValue = DeleteContent(HandleNumber, 0)) < 0)
            return RetValue;
    }
    Handle[HandleNumber] = Temp;

    return SUCCESS;
}
예제 #4
0
void TBHashTable::RemoveAll(bool delete_content)
{
#ifdef TB_RUNTIME_DEBUG_INFO
    //Debug();
#endif
    for (uint32 i = 0; i < m_num_buckets; i++)
    {
        ITEM *item = m_buckets[i];
        while (item)
        {
            ITEM *item_next = item->next;
            if (delete_content)
                DeleteContent(item->content);
            delete item;
            item = item_next;
        }
    }
    delete [] m_buckets;
    m_buckets = nullptr;
    m_num_buckets = m_num_items = 0;
}
예제 #5
0
void TBHashTable::Delete(uint32 key)
{
    DeleteContent(Remove(key));
}