• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ASSERTMSG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ASSERTMSG函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERTMSG函数的具体用法?C++ ASSERTMSG怎么用?C++ ASSERTMSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ASSERTMSG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: neoSystemOpen

bool neoSystemOpen(const char* szFileName)
{
	TNeoRomHeader header;
	int rom;
	u32 bit;

	ASSERT(g_neo->cpuClockDivide == 2 || g_neo->cpuClockDivide == 3);

	guiConsoleLogf("Loading %s...", szFileName);
	guiConsoleDump();

	rom = systemOpen(szFileName, false);

	ASSERTMSG(g_neo->cpuClockDivide == 2 || g_neo->cpuClockDivide == 3, "%d", g_neo->cpuClockDivide);

	if(rom < 0) {
		guiConsoleLogf(" -> Failed!");
		ASSERT(0);
		return false;
	}
	systemRead(rom, &header, sizeof(TNeoRomHeader));

	if(header.magic != NEO_ROM_MAGIC ||
		header.version != NEO_ROM_VERSION ||
		header.sectionCount != NEOROM_COUNT) {

		systemClose(rom);
		guiConsoleLogf(" -> invalid rom");
		guiConsoleLogf(" -> magic %08X / %08X", header.magic, NEO_ROM_MAGIC);
		guiConsoleLogf(" -> version %d / %d", header.version, NEO_ROM_VERSION);
		guiConsoleLogf(" -> section %d / %d", header.sectionCount, NEOROM_COUNT);
		ASSERT(0);
		return false;
	}

	neoSystemClose();

	g_romSize = systemFileSize(rom) - NEO_HEADER_SIZE;
	g_header = header;
	g_rom = rom;

	linearHeapReset(&g_vramHHeap);
	linearHeapClear(&g_vramHHeap);

	g_neo->scanline = 0;
	g_neo->frameCount = 0;
	g_neo->irqPending = 0;
	g_neo->paletteBank = 0;
	g_neo->fixedBank = 0;
	g_neo->sramProtectCount = 0;
	g_neo->debug = true;

	g_neo->irqVectorLatch = false;
	g_neo->screenDarkLatch = false;
	g_neo->fixedRomLatch = false;
	g_neo->sramProtectLatch = false;
	g_neo->paletteRamLatch = false;
	g_neo->smaRand = 0x2345;
	NEOIPC->audioCommandPending = 0;
	NEOIPC->audioResult = 0;
	
	//sram hack gets around watchdog protection check...values taken from GnGeo
	//added samsho5 variations
	g_neo->sramProtection = g_header.sramProtection;

	guiConsoleLogf("Loaded Game: %s", g_header.name);
	
	g_neo->spriteCount = g_header.romEntry[NEOROM_SPRITEDATA].size / SPRITE_SIZE;
	g_neo->spriteMask = 0xffffffff;
	for(bit = 0x80000000; bit != 0; bit >>= 1) {
		if((g_neo->spriteCount - 1) & bit) break;
		g_neo->spriteMask >>= 1;
	}

	g_neo->romBankCount = 0;
	const s32 bankSize = (s32)g_header.romEntry[NEOROM_MAINPROGRAM].size - 1*MB;
	if(bankSize > 0) {
		g_neo->romBankCount = bankSize / (1*MB);
		if(g_neo->romBankCount * 1*MB != bankSize) {
			g_neo->romBankCount++;
			guiConsoleLogf(" -> partial rom bank");
		}
	}

	guiConsoleLogf(" -> sprites: %d", g_neo->spriteCount);
	guiConsoleLogf(" -> mask: %08X", g_neo->spriteMask);
	guiConsoleLogf(" -> rom bank(s): %d", g_neo->romBankCount);
	if(g_neo->sramProtection == -1) {
		guiConsoleLogf(" -> sramProtection off");
	} else {
		guiConsoleLogf(" -> sramProtection: %08X", g_neo->sramProtection);
	}
	guiConsoleDump();

	systemRamReset();

	cpuInit();
	neoMemoryInit();
	neoIOInit();
	pd4990a_init();
//.........这里部分代码省略.........
开发者ID:Leerz,项目名称:NeoDS,代码行数:101,代码来源:NeoSystem.c


示例2: ASSERTMSG

void CDAVCLanSettingsImpl::requestSettingInformationNotification_02A1(const DAVCLanSettings::SettingInformationNotificationType tSettingInformationNotification)
{
   ASSERTMSG ( "mpLogic is 0", 0 != mpLogic );
   mpLogic->requestSettingInformationNotification_02A1( tSettingInformationNotification );
}
开发者ID:connectivityTester,项目名称:System,代码行数:5,代码来源:CDAVCLanSettingsImpl.cpp


示例3: DiskReadPartitionTableEx

NTSTATUS
NTAPI
DiskReadPartitionTableEx(
    IN PFUNCTIONAL_DEVICE_EXTENSION Fdo,
    IN BOOLEAN BypassCache,
    OUT PDRIVE_LAYOUT_INFORMATION_EX* DriveLayout
    )
/*++

Routine Description:

    This routine will return the current layout information for the disk.
    If the cached information is still valid then it will be returned, 
    otherwise the layout will be retreived from the kernel and cached for 
    future use.
    
    This routine must be called with the partitioning lock held.  The 
    partition list which is returned is not guaranteed to remain valid 
    once the lock has been released.
    
Arguments:

    Fdo - a pointer to the FDO for the disk.
    
    DriveLayout - a location to store a pointer to the drive layout information.    

Return Value:

    STATUS_SUCCESS if successful or an error status indicating what failed.
    
--*/        
    
{
    PDISK_DATA diskData = Fdo->CommonExtension.DriverData;
    NTSTATUS status;
    PDRIVE_LAYOUT_INFORMATION_EX layoutEx;

    layoutEx = NULL;

    if(BypassCache) {
        diskData->CachedPartitionTableValid = FALSE;
        DebugPrint((PtCache, "DiskRPTEx: cache bypassed and invalidated for "
                             "FDO %#p\n", Fdo));
    }

    //
    // If the cached partition table is present then return a copy of it.
    //

    if(diskData->CachedPartitionTableValid == TRUE) {

        ULONG partitionNumber;
        PDRIVE_LAYOUT_INFORMATION_EX layout = diskData->CachedPartitionTable;

        //
        // Clear the partition numbers from the list entries
        //

        for(partitionNumber = 0;
            partitionNumber < layout->PartitionCount;
            partitionNumber++) {
            layout->PartitionEntry[partitionNumber].PartitionNumber = 0;
        }

        *DriveLayout = diskData->CachedPartitionTable;

        DebugPrint((PtCache, "DiskRPTEx: cached PT returned (%#p) for "
                             "FDO %#p\n", 
                    *DriveLayout, Fdo));
                    
        return STATUS_SUCCESS;
    }

    ASSERTMSG("DiskReadPartitionTableEx is not using cached partition table",
              (DiskBreakOnPtInval == FALSE));

    //
    // If there's a cached partition table still around then free it.
    //

    if(diskData->CachedPartitionTable) {
        DebugPrint((PtCache, "DiskRPTEx: cached PT (%#p) freed for FDO %#p\n",
                    diskData->CachedPartitionTable, Fdo));

        ExFreePool(diskData->CachedPartitionTable);
        diskData->CachedPartitionTable = NULL;
    }

    //
    // By default, X86 disables recognition of GPT disks. Instead we
    // return the protective MBR partition. Use IoReadPartitionTable
    // to get this.
    //
    
    status = IoReadPartitionTableEx(Fdo->DeviceObject, &layoutEx);

    if (DiskDisableGpt) {
        PDRIVE_LAYOUT_INFORMATION layout;

        if (NT_SUCCESS (status) &&
//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,代码来源:part.c


示例4: HwSetControl

NTSTATUS
HwSetControl(
    PMIXER_INFO MixerInfo,
    ULONG ControlId,
    ULONG DataLength,
    PVOID ControlData
)
{
    PLOCAL_MIXER_CONTROL_INFO ControlInfo;
    int i;
    BOOLEAN Changed;
    LONG Values[2];
    BOOLEAN MixerSetResult;
    PGLOBAL_DEVICE_INFO pGDI;

    pGDI = CONTAINING_RECORD(MixerInfo, GLOBAL_DEVICE_INFO, MixerInfo);

    /*
    **  Validate control ID
    */

    if (ControlId > MAXCONTROLS) {
        return STATUS_INVALID_PARAMETER;
    }

    /*
    **  Establish pointers to our structures
    */

    ControlInfo = &pGDI->LocalMixerData.ControlInfo[ControlId];

    ASSERTMSG("Set index out of range",
              ControlInfo->SetIndex < MAXSETTABLECONTROLS ||
              ControlInfo->SetIndex == MIXER_SET_INDEX_INVALID);

    /*
    **  Validate data length and values
    */

    switch (DataLength) {
        case sizeof(LONG):
            Values[0] = *(PLONG)ControlData;
            Values[1] = Values[0];
            break;

        case sizeof(LONG) * 2:
            Values[0] = *(PLONG)ControlData;
            Values[1] = ((PLONG)ControlData)[1];
            break;

        default:
            return STATUS_BUFFER_TOO_SMALL;
    }

    /*
    **  Apparently Boolean values can be anything
    */

    if (ControlInfo->Boolean) {
        Values[0] = (ULONG)!!Values[0];
        Values[1] = (ULONG)!!Values[1];
    }

    /*
    **  Check the item ranges and assign the values.  Note that
    **  this stuff only works for <= 2 channels/items.
    */

    for (i = 0, Changed = FALSE; i < 2; i++) {
        if (ControlInfo->Signed) {
            if (Values[i] < (LONG)ControlInfo->Range.Min.s ||
                Values[i] > (LONG)ControlInfo->Range.Max.s) {

                return STATUS_INVALID_PARAMETER;
            } else {
                if ((SHORT)((PLONG)Values)[i] != ControlInfo->Data.v[i].s) {
                    Changed = TRUE;
                    ControlInfo->Data.v[i].s = (SHORT)((PLONG)Values)[i];
                }
            }
        } else {

            if ((((PULONG)Values)[i] < (ULONG)ControlInfo->Range.Min.u ||
                 ((PULONG)Values)[i] > (ULONG)ControlInfo->Range.Max.u)) {

                return STATUS_INVALID_PARAMETER;
            } else {

                /*
                **  Do muxes slightly differently so we don't store a big
                **  array of n - 1 zeros and 1 one
                */

                if (ControlInfo->Mux) {
                    if (Values[i] != (LONG)ControlInfo->Range.Min.s) {
                        /*
                        **  'On' - only turn ONE on
                        */

                        if ((USHORT)i != ControlInfo->Data.v[0].u) {
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:101,代码来源:mixer.c


示例5: NICHandleSendInterrupt

NTSTATUS
NICHandleSendInterrupt(
    __in  PFDO_DATA  FdoData
    )
/*++
Routine Description:

    Interrupt handler for sending processing. Re-claim the send resources,
    complete sends and get more to send from the send wait queue.

    Assumption: Send spinlock has been acquired

Arguments:

    FdoData     Pointer to our FdoData

Return Value:

    NTSTATUS code

--*/
{
    NTSTATUS        status = STATUS_SUCCESS;
    PMP_TCB         pMpTcb;

#if DBG
    LONG            i;
#endif

    DebugPrint(TRACE, DBG_WRITE, "---> NICHandleSendInterrupt\n");

    //
    // Any packets being sent? Any packet waiting in the send queue?
    //
    if (FdoData->nBusySend == 0 &&
        IsListEmpty(&FdoData->SendQueueHead))
    {
        ASSERT(FdoData->CurrSendHead == FdoData->CurrSendTail);
        DebugPrint(TRACE, DBG_WRITE, "<--- NICHandleSendInterrupt\n");
        return status;
    }

    //
    // Check the first TCB on the send list
    //
    while (FdoData->nBusySend > 0)
    {

#if DBG
        pMpTcb = FdoData->CurrSendHead;
        for (i = 0; i < FdoData->nBusySend; i++)
        {
            pMpTcb = pMpTcb->Next;
        }

        if (pMpTcb != FdoData->CurrSendTail)
        {
            DebugPrint(ERROR, DBG_WRITE, "nBusySend= %d\n", FdoData->nBusySend);
            DebugPrint(ERROR, DBG_WRITE, "CurrSendhead= %p\n", FdoData->CurrSendHead);
            DebugPrint(ERROR, DBG_WRITE, "CurrSendTail= %p\n", FdoData->CurrSendTail);
            ASSERT(FALSE);
        }
#endif

        pMpTcb = FdoData->CurrSendHead;

        //
        // Is this TCB completed?
        //
        if (pMpTcb->HwTcb->TxCbHeader.CbStatus & CB_STATUS_COMPLETE)
        {
            //
            // Check if this is a multicast hw workaround packet
            //
            if ((pMpTcb->HwTcb->TxCbHeader.CbCommand & CB_CMD_MASK) != CB_MULTICAST)
            {
                MP_FREE_SEND_PACKET(FdoData, pMpTcb, STATUS_SUCCESS);

            } else {
                ASSERTMSG("Not sure what to do", FALSE);
            }
        }
        else
        {
            break;
        }
    }

    //
    // If we queued any transmits because we didn't have any TCBs earlier,
    // dequeue and send those packets now, as long as we have free TCBs.
    //
    while (!IsListEmpty(&FdoData->SendQueueHead) &&
        MP_TCB_RESOURCES_AVAIABLE(FdoData))
    {
        PIRP irp;
        PLIST_ENTRY pEntry;

        pEntry = RemoveHeadList(&FdoData->SendQueueHead);

//.........这里部分代码省略.........
开发者ID:kcrazy,项目名称:winekit,代码行数:101,代码来源:nic_send.c


示例6: ASSERTMSG

String SensorFileSysWalker::getFileOnly( String file ) {
	int index = file.findLast( '\\' );
	ASSERTMSG( index >= 0 , "Unexpected: " + file );

	return( file.getMid( index + 1 ) );
}
开发者ID:AbhishekGhosh,项目名称:Artificial-Human,代码行数:6,代码来源:filesyswalker.cpp


示例7: SoundReportResourceUsage


//.........这里部分代码省略.........
        //
        // Get the processor affinity and vector
        //


        InterruptVector = HalGetInterruptVector(BusType,
                                                BusNumber,
                                                *InterruptNumber,
                                                *InterruptNumber,
                                                &InterruptRequestLevel,
                                                &Affinity);



        ResourceList->List[0].PartialResourceList.Count++;

        Descriptor->Type = CmResourceTypeInterrupt;

        Descriptor->ShareDisposition = (UCHAR)(InterruptShareDisposition ?
                                               CmResourceShareShared :
                                               CmResourceShareDeviceExclusive);

        Descriptor->Flags =
           InterruptMode == Latched ? CM_RESOURCE_INTERRUPT_LATCHED :
                                      CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;

        Descriptor->u.Interrupt.Level = *InterruptNumber;

        Descriptor->u.Interrupt.Vector = InterruptVector;

        Descriptor->u.Interrupt.Affinity = (ULONG)Affinity;

        //
        // Move on to next resource descriptor entry
        //

        Descriptor++;
    }

    //
    // Add DMA description if any
    //

    if (ARGUMENT_PRESENT(DmaChannel)) {
        ResourceList->List[0].PartialResourceList.Count++;

        Descriptor->Type = CmResourceTypeDma;

        Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;

        Descriptor->u.Dma.Channel = *DmaChannel;

        Descriptor->u.Dma.Port = 0;  // ???

        //
        // Move on to next resource descriptor entry
        //

        Descriptor++;
    }

    //
    // Report our resource usage and detect conflicts
    //

    switch (DeviceObject->Type) {
    case IO_TYPE_DEVICE:
        Status = IoReportResourceUsage(NULL,
                                       DeviceObject->DriverObject,
                                       NULL,
                                       0,
                                       DeviceObject,
                                       ResourceList,
                                       (PUCHAR)Descriptor - (PUCHAR)ResourceList,
                                       FALSE,
                                       &ResourceConflict);
        break;
    case IO_TYPE_DRIVER:
        Status = IoReportResourceUsage(NULL,
                                       (PDRIVER_OBJECT)DeviceObject,
                                       ResourceList,
                                       (PUCHAR)Descriptor - (PUCHAR)ResourceList,
                                       NULL,
                                       NULL,
                                       0,
                                       FALSE,
                                       &ResourceConflict);
        break;

    default:
        ASSERTMSG("SoundReportResourceUsage - invalid object", FALSE);
    }

    if (ResourceConflict) {
        dprintf1(("Resource conflict reported"));
        Status = STATUS_DEVICE_CONFIGURATION_ERROR;
    }

    return Status;
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:101,代码来源:soundlib.c


示例8: SmpExecuteImage

NTSTATUS
NTAPI
SmpExecuteImage(IN PUNICODE_STRING FileName,
                IN PUNICODE_STRING Directory,
                IN PUNICODE_STRING CommandLine,
                IN ULONG MuSessionId,
                IN ULONG Flags,
                IN PRTL_USER_PROCESS_INFORMATION ProcessInformation)
{
    PRTL_USER_PROCESS_INFORMATION ProcessInfo;
    NTSTATUS Status;
    RTL_USER_PROCESS_INFORMATION LocalProcessInfo;
    PRTL_USER_PROCESS_PARAMETERS ProcessParameters;

    /* Use the input process information if we have it, otherwise use local */
    ProcessInfo = ProcessInformation;
    if (!ProcessInfo) ProcessInfo = &LocalProcessInfo;

    /* Create parameters for the target process */
    Status = RtlCreateProcessParameters(&ProcessParameters,
                                        FileName,
                                        SmpDefaultLibPath.Length ?
                                        &SmpDefaultLibPath : NULL,
                                        Directory,
                                        CommandLine,
                                        SmpDefaultEnvironment,
                                        NULL,
                                        NULL,
                                        NULL,
                                        0);
    if (!NT_SUCCESS(Status))
    {
        /* This is a pretty bad failure. ASSERT on checked builds and exit */
        ASSERTMSG("RtlCreateProcessParameters", NT_SUCCESS(Status));
        DPRINT1("SMSS: RtlCreateProcessParameters failed for %wZ - Status == %lx\n",
                FileName, Status);
        return Status;
    }

    /* Set the size field as required */
    ProcessInfo->Size = sizeof(RTL_USER_PROCESS_INFORMATION);

    /* Check if the debug flag was requested */
    if (Flags & SMP_DEBUG_FLAG)
    {
        /* Write it in the process parameters */
        ProcessParameters->DebugFlags = 1;
    }
    else
    {
        /* Otherwise inherit the flag that was passed to SMSS itself */
        ProcessParameters->DebugFlags = SmpDebug;
    }

    /* Subsystems get the first 1MB of memory reserved for DOS/IVT purposes */
    if (Flags & SMP_SUBSYSTEM_FLAG)
    {
        ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB;
    }

    /* And always force NX for anything that SMSS launches */
    ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_NX;

    /* Now create the process */
    Status = RtlCreateUserProcess(FileName,
                                  OBJ_CASE_INSENSITIVE,
                                  ProcessParameters,
                                  NULL,
                                  NULL,
                                  NULL,
                                  FALSE,
                                  NULL,
                                  NULL,
                                  ProcessInfo);
    RtlDestroyProcessParameters(ProcessParameters);
    if (!NT_SUCCESS(Status))
    {
        /* If we couldn't create it, fail back to the caller */
        DPRINT1("SMSS: Failed load of %wZ - Status  == %lx\n",
                FileName, Status);
        return Status;
    }

    /* Associate a session with this process */
    Status = SmpSetProcessMuSessionId(ProcessInfo->ProcessHandle, MuSessionId);

    /* If the application is deferred (suspended), there's nothing to do */
    if (Flags & SMP_DEFERRED_FLAG) return Status;

    /* Otherwise, get ready to start it, but make sure it's a native app */
    if (ProcessInfo->ImageInformation.SubSystemType == IMAGE_SUBSYSTEM_NATIVE)
    {
        /* Resume it */
        NtResumeThread(ProcessInfo->ThreadHandle, NULL);
        if (!(Flags & SMP_ASYNC_FLAG))
        {
            /* Block on it unless Async was requested */
            NtWaitForSingleObject(ProcessInfo->ThreadHandle, FALSE, NULL);
        }

//.........这里部分代码省略.........
开发者ID:RPG-7,项目名称:reactos,代码行数:101,代码来源:smss.c


示例9: ASSERTMSG

BOOL CTileManager::CollisonCheck(VECTOR3* pStart,VECTOR3* pEnd,VECTOR3* pRtCollisonPos,CObject* pObj)
{	
	if( pStart->x >= 51200 || pStart->x < 0 ||
		pStart->z >= 51200 || pStart->z < 0 )
	{
		ASSERTMSG(0,"À̵¿¿µ¿ªÀ» ¹þ¾î³µ½À´Ï´Ù.");
		pRtCollisonPos->x = 25000;
		pRtCollisonPos->z = 25000;
		return TRUE;
	}

	int x0 = int(pStart->x / fTILE_WIDTH);
	int y0 = int(pStart->z / fTILE_HEIGHT);
	int x1 = int(pEnd->x / fTILE_WIDTH);
	int y1 = int(pEnd->z / fTILE_HEIGHT);
	
	int dx = x1-x0,dy = y1-y0;
	int sx,sy;
	if(dx >= 0)
	{
		sx = 1;
	}
	else
	{
		sx = -1;
		dx *= -1;
	}
	if(dy >= 0)
	{
		sy = 1;
	}
	else
	{
		sy = -1;
		dy *= -1;
	}
	
	int ax = 2*dx,ay = 2*dy;

	int x = x0, y = y0;
	int lastx = x, lasty = y;
	
	BOOL bFirst = TRUE;
	if(dx == 0 && dy == 0)
	{
		//bFirst = FALSE;
		return FALSE;	//CSW
	}
	
	if(dx >= dy)
	{
		for(int desc = ay - dx; ;x += sx,desc += ay)
		{
			if(bFirst == TRUE)
			{
				bFirst = FALSE;
				continue;
			}

			CTile *pTile = GetTile((DWORD)x, (DWORD)y);
			
#ifdef _DEBUG
			if(pTile == NULL)
			{
				//LOGFILE("TILENOTFOUND\t%s",OBJECTLOG(pObj));
				//LOGFILE("StartPos\t%4.2f\t%4.2f\t\tEndPos\t%4.2f\t%4.2f",
				//	pStart->x,pStart->z,pEnd->x,pEnd->z);
				ASSERTMSG(0,"ÀÌ ¿¡·¯ ¸Þ¼¼Áö º¸½Ã¸é À±È£ÇÑÅ× ²À! ¿¬¶ôÇØÁÖ¼¼¿ä");
				break;
			}			
#endif
			if(pTile == NULL || pTile->IsCollisonTile())
			{
				pRtCollisonPos->x = (float)(lastx*fTILE_WIDTH);
				pRtCollisonPos->y = 0;
				pRtCollisonPos->z = (float)(lasty*fTILE_HEIGHT);
				return TRUE;
			}

			if(x == x1)
				break;

			lastx = x;
			lasty = y;

			if(desc > 0)
			{
				y += sy;
				desc -= ax;
			}
		}
	}
	else
	{
		for(int desc = ax - dy; ;y += sy,desc += ax)
		{
			if(bFirst == TRUE)
			{
				bFirst = FALSE;
				continue;
//.........这里部分代码省略.........
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:101,代码来源:TileManager.cpp


示例10: int

BOOL CTileManager::NonCollisionLine( VECTOR3* pStart, VECTOR3* pEnd, VECTOR3* pRtNonCollisonPos, MAPTYPE MapNum, CObject* pObj )
{
	int x1 = int(pStart->x / TILECOLLISON_DETAIL);
	int y1 = int(pStart->z / TILECOLLISON_DETAIL);
	int x2 = int(pEnd->x / TILECOLLISON_DETAIL);
	int y2 = int(pEnd->z / TILECOLLISON_DETAIL);

	int dx = x1 - x2;
	int dy = y1 - y2;
	
	int absDX = abs(dx);
	int absDY = abs(dy);
	int MaxDelta = max(absDX, absDY);
	
	int CellX = x1;
	int CellY = y1;

	CTile *pCurTile = GetTile((DWORD)CellX, (DWORD)CellY);
	if(pCurTile == NULL)
	{
		if(pRtNonCollisonPos)
		{
			pRtNonCollisonPos->x = CellX * TILECOLLISON_DETAIL;
			pRtNonCollisonPos->y = 0;
			pRtNonCollisonPos->z = CellY * TILECOLLISON_DETAIL;
		}

		char temp[256] = {0,};
		sprintf(temp, "%d %d %s", CellX, CellY, pObj->GetObjectName() );
		ASSERTMSG(0,temp);

		return FALSE;
	}
	if(FALSE == pCurTile->IsCollisonTile())	//현재 위치가 충돌 타일이 아니면 이 함수의 역할과 무관
	{
		if(pRtNonCollisonPos)
		{
			pRtNonCollisonPos->x = CellX * TILECOLLISON_DETAIL;
			pRtNonCollisonPos->y = 0;
			pRtNonCollisonPos->z = CellY * TILECOLLISON_DETAIL;
		}

		return FALSE;
	}

	int x = 0;
	int y = 0;

	int signDX = -sign(dx);
	int signDY = -sign(dy);
	
	int PrevCellX = 0;
	int PrevCellY = 0;

#define THROUGH_PERMIT_TILE_INDEX 2

	for( int i = 0 ; i <= MaxDelta ; ++i )
	{
		if( i > THROUGH_PERMIT_TILE_INDEX )
		{
			if(pRtNonCollisonPos)
			{
				pRtNonCollisonPos->x = CellX*TILECOLLISON_DETAIL;
				pRtNonCollisonPos->y = 0;
				pRtNonCollisonPos->z = CellY*TILECOLLISON_DETAIL;
			}

			return FALSE;
		}

		PrevCellX = CellX;
		PrevCellY = CellY;

		x += absDX;  
		y += absDY;
		
		if( x > MaxDelta)  
		{  
			x -= MaxDelta;
			CellX += signDX;
		}
		
		if( y > MaxDelta ) 
		{  
			y -= MaxDelta;  
			CellY += signDY;  
		}
		CTile *pTile = GetTile((DWORD)CellX, (DWORD)CellY);
		if(pTile == NULL)
		{
			if(pRtNonCollisonPos)
			{
				pRtNonCollisonPos->x = PrevCellX*TILECOLLISON_DETAIL;
				pRtNonCollisonPos->y = 0;
				pRtNonCollisonPos->z = PrevCellY*TILECOLLISON_DETAIL;
			}
			
			char temp[256];
			sprintf(temp,"%d %d %s",CellX,CellY,pObj->GetObjectName());
			ASSERTMSG(0,temp);
//.........这里部分代码省略.........
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:101,代码来源:TileManager.cpp


示例11: SoundMixerInit


//.........这里部分代码省略.........
                    **  What if it's invalid?
                    */

                pGDI->LocalMixerData.ControlInfo[i].Data =
                    SavedControlData[SetIndex];
            } else {
                /*
                **  For us it's either Mute, a volume or a Mux.
                **
                **    Muxes are assumed to be set to MUXINPUT_MIC as default
                **    Only one mute is set
                **
                **    Volumes are set to a fixed value
                **
                **    Nothing is muted
                */

                switch (i) {
                case ControlLineoutVolume:
                case ControlLineoutAux1Volume:
                case ControlLineoutWaveoutVolume:
                case ControlLineoutMidioutVolume:
                case ControlWaveInAux1Volume:
                case ControlWaveInMicVolume:
                case ControlVoiceInAux1Volume:
                case ControlVoiceInMicVolume:

                    /*
                    **  Half volume
                    */

                    pGDI->LocalMixerData.ControlInfo[i].Data.v[0].u = 32767;
                    pGDI->LocalMixerData.ControlInfo[i].Data.v[1].u = 32767;
                    break;

                case ControlWaveInMux:
                case ControlVoiceInMux:

                    /*
                    **  Microphone input
                    */

                    pGDI->LocalMixerData.ControlInfo[i].Data.v[0].u = MUXINPUT_MIC;
                    break;
                }
            }
            SetIndex++;
        } else {
            pGDI->LocalMixerData.ControlInfo[i].SetIndex = MIXER_SET_INDEX_INVALID;
        }
    }

    ASSERTMSG("MAXSETTABLECONTROLS wrong!", SetIndex == MAXSETTABLECONTROLS);

    /*
    **  Create line info
    */

    for (i = 0; i < MAXLINES; i++) {
        SoundInitDataItem(MixerInfo,
                          &pGDI->LocalMixerData.LineNotification[i],
                          (USHORT)MM_MIXM_LINE_CHANGE,
                          (USHORT)i);
    }

    /*
    **  Set up line notifications and volume control ids for non-mixer devices
    */

    SoundSetLineNotify(
        (PLOCAL_DEVICE_INFO)pGDI->DeviceObject[WaveInDevice]->DeviceExtension,
        SoundWaveinLineChanged);
    SoundSetLineNotify(
        (PLOCAL_DEVICE_INFO)pGDI->DeviceObject[WaveOutDevice]->DeviceExtension,
        SoundWaveoutLineChanged);


    if (pGDI->Synth.DeviceObject) {
        SoundSetLineNotify(
            (PLOCAL_DEVICE_INFO)pGDI->Synth.DeviceObject->DeviceExtension,
            SoundSynthLineChanged);
    }

    SoundSetVolumeControlId(
        (PLOCAL_DEVICE_INFO)pGDI->DeviceObject[WaveOutDevice]->DeviceExtension,
        ControlLineoutWaveoutVolume);

    SoundSetVolumeControlId(
        (PLOCAL_DEVICE_INFO)pGDI->DeviceObject[LineInDevice]->DeviceExtension,
        ControlLineoutAux1Volume);

    /*
    **  Set the volume levels - this only affects the output for this card's
    **  initial settings (ie wave in not active).
    */

    MixSetMasterVolume(pGDI, 0);

    return STATUS_SUCCESS;
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:101,代码来源:mixer.c


示例12: ConDrvDeleteConsole

VOID NTAPI
ConDrvDeleteConsole(IN PCONSOLE Console)
{
    DPRINT("ConDrvDeleteConsole(0x%p)\n", Console);

    /*
     * Forbid validation of any console by other threads
     * during the deletion of this console.
     */
    ConDrvLockConsoleListExclusive();

    /*
     * If the console is already being destroyed, i.e. not running
     * or finishing to be initialized, just return.
     */
    if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE) &&
        !ConDrvValidateConsoleUnsafe(Console, CONSOLE_INITIALIZING, TRUE))
    {
        /* Unlock the console list and return */
        ConDrvUnlockConsoleList();
        return;
    }

    /*
     * We are about to be destroyed. Signal it to other people
     * so that they can terminate what they are doing, and that
     * they cannot longer validate the console.
     */
    Console->State = CONSOLE_TERMINATING;

    /*
     * Allow other threads to finish their job: basically, unlock
     * all other calls to EnterCriticalSection(&Console->Lock); by
     * ConDrvValidateConsoleUnsafe functions so that they just see
     * that we are not in CONSOLE_RUNNING state anymore, or unlock
     * other concurrent calls to ConDrvDeleteConsole so that they
     * can see that we are in fact already deleting the console.
     */
    LeaveCriticalSection(&Console->Lock);
    ConDrvUnlockConsoleList();

    /* Deregister the terminal */
    DPRINT("Deregister terminal\n");
    ConDrvDetachTerminal(Console);
    DPRINT("Terminal deregistered\n");

    /***
     * Check that the console is in terminating state before continuing
     * (the cleanup code must not change the state of the console...
     * ...unless to cancel console deletion ?).
     ***/

    ConDrvLockConsoleListExclusive();

    if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_TERMINATING, TRUE))
    {
        ConDrvUnlockConsoleList();
        return;
    }

    /* We are now in destruction */
    Console->State = CONSOLE_IN_DESTRUCTION;

    /* We really delete the console. Reset the count to be sure. */
    Console->ReferenceCount = 0;

    /* Remove the console from the list */
    RemoveConsole(Console);

    /* Delete the last screen buffer */
    ConDrvDeleteScreenBuffer(Console->ActiveBuffer);
    Console->ActiveBuffer = NULL;
    if (!IsListEmpty(&Console->BufferList))
    {
        /***ConDrvUnlockConsoleList();***/
        ASSERTMSG("BUGBUGBUG!! screen buffer list not empty\n", FALSE);
    }

    /* Deinitialize the input buffer */
    ConDrvDeinitInputBuffer(Console);

    if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent);

    DPRINT("ConDrvDeleteConsole - Unlocking\n");
    LeaveCriticalSection(&Console->Lock);
    DPRINT("ConDrvDeleteConsole - Destroying lock\n");
    DeleteCriticalSection(&Console->Lock);
    DPRINT("ConDrvDeleteConsole - Lock destroyed ; freeing console\n");

    ConsoleFreeHeap(Console);
    DPRINT("ConDrvDeleteConsole - Console destroyed\n");

    /* Unlock the console list and return */
    ConDrvUnlockConsoleList();
}
开发者ID:GYGit,项目名称:reactos,代码行数:95,代码来源:console.c


示例13: HwGetControl


//.........这里部分代码省略.........
                    if (ControlId == ControlWaveInMicPeak) {
                        break;
                    }
                }
                ComputePeak = TRUE;
                break;

            case ControlVoiceInAux1Peak:
            case ControlVoiceInMicPeak:

                if (pGDI->DeviceInUse != WaveInDevice) {
                    break;
                }
                if (WaveInfo->LowPriorityHandle == NULL ||
                    WaveInfo->LowPrioritySaved) {
                    break;
                }

                if (pGDI->LocalMixerData.ControlInfo[ControlVoiceInMux].Data.v[0].u ==
                    MUXINPUT_MIC) {

                    if (ControlId == ControlVoiceInAux1Peak) {
                        break;
                    }
                } else {
                    if (ControlId == ControlVoiceInMicPeak) {
                        break;
                    }
                }
                ComputePeak = TRUE;
                break;

            default:
                ASSERTMSG("Invalid control id", FALSE);
                break;
        }

        if (ComputePeak) {
            SoundPeakMeter(WaveInfo, Values);
        }

        /*
        **  Note that we should round these values to the min/max
        **  expected in the control but in this case these values
        **  are always within range
        */

    } else {
        ASSERTMSG("Set index out of range",
                  ControlInfo->SetIndex < MAXSETTABLECONTROLS);

        if (ControlInfo->Mux) {
            Values[ControlInfo->Data.v[0].s] = (LONG)ControlInfo->Range.Max.s;
            Values[1 - ControlInfo->Data.v[0].s] = (LONG)ControlInfo->Range.Min.s;
        } else {
            if (ControlInfo->Signed) {
                Values[0] = (LONG)ControlInfo->Data.v[0].s;
                Values[1] = (LONG)ControlInfo->Data.v[1].s;
            } else {
                Values[0] = (LONG)(ULONG)ControlInfo->Data.v[0].u;
                Values[1] = (LONG)(ULONG)ControlInfo->Data.v[1].u;
            }
        }
    }

    /*
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:67,代码来源:mixer.c


示例14: ExInitializeResource

NTSTATUS
ExInitializeResource (
    IN PNTDDK_ERESOURCE Resource
    )

/*++

Routine Description:

    This routine initializes the input resource variable

Arguments:

    Resource - Supplies the resource variable being initialized

Return Value:

    Status of the operation.

--*/

{
    ULONG   i;

    ASSERTMSG("A resource cannot be in paged pool ", MmDeterminePoolType(Resource) == NonPagedPool);
    //
    //  Initialize the shared and exclusive waiting counters and semaphore.
    //  The counters indicate how many are waiting for access to the resource
    //  and the semaphores are used to wait on the resource.  Note that
    //  the semaphores can also indicate the number waiting for a resource
    //  however there is a race condition in the algorithm on the acquire
    //  side if count if not updated before the critical section is exited.
    //  So we need to have an outside counter.
    //

    Resource->NumberOfSharedWaiters    = 0;
    Resource->NumberOfExclusiveWaiters = 0;

    KeInitializeSemaphore ( &Resource->SharedWaiters, 0, MAXLONG );
    KeInitializeEvent     ( &Resource->ExclusiveWaiters, SynchronizationEvent, FALSE );
    KeInitializeSpinLock  ( &Resource->SpinLock );

    Resource->OwnerThreads = Resource->InitialOwnerThreads;
    Resource->OwnerCounts  = Resource->InitialOwnerCounts;

    Resource->TableSize    = INITIAL_TABLE_SIZE;
    Resource->ActiveCount  = 0;
    Resource->TableRover   = 1;
    Resource->Flag         = 0;

    for(i=0; i < INITIAL_TABLE_SIZE; i++) {
        Resource->OwnerThreads[i] = 0;
        Resource->OwnerCounts[i] = 0;
    }

    Resource->ContentionCount = 0;
    InitializeListHead( &Resource->SystemResourcesList );

#if defined(_X86_) && !FPO
    if (NtGlobalFlag & FLG_KERNEL_STACK_TRACE_DB) {
        Resource->CreatorBackTraceIndex = RtlLogStackBackTrace();
        }
    else {
        Resource->CreatorBackTraceIndex = 0;
        }
#endif // _X86_ && !FPO
    if (Resource >= (PNTDDK_ERESOURCE)MM_USER_PROBE_ADDRESS) {
        ExInterlockedInsertTailList (
                &ExpSystemResourcesList,
                &Resource->SystemResourcesList,
                &ExpResourceSpinLock );
    }

    return STATUS_SUCCESS;
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:75,代码来源:ddkresrc.c


示例15: PortIOEvtDevicePrepareHardware

NTSTATUS
PortIOEvtDevicePrepareHardware(
    _In_ WDFDEVICE  Device,    
    _In_ WDFCMRESLIST  ResourcesRaw,    
    _In_ WDFCMRESLIST  ResourcesTranslated    
    )
/*++

Routine Description:

    This event is called by the Framework when the device is started
    or restarted after a suspend operation.

Arguments:

    Device - Handle to a framework device object.

Return Value:

    NTSTATUS - Failures will result in the device stack being torn down.

--*/
{
    ULONG  i;
    PCM_PARTIAL_RESOURCE_DESCRIPTOR  desc;
    PCM_PARTIAL_RESOURCE_DESCRIPTOR  descTranslated;
    PDEVICE_CONTEXT deviceContext = NULL;
    NTSTATUS status = STATUS_SUCCESS;

    PAGED_CODE();
    
    if ((NULL == ResourcesRaw) || 
        (NULL == ResourcesTranslated)){
        return STATUS_DEVICE_CONFIGURATION_ERROR;        
    }
        
    deviceContext = PortIOGetDeviceContext(Device);
    
    for (i=0; i < WdfCmResourceListGetCount(ResourcesRaw); i++) {
        
        desc = WdfCmResourceListGetDescriptor(ResourcesRaw, i);
        descTranslated =  WdfCmResourceListGetDescriptor(ResourcesTranslated, i);
        
        switch(desc ->Type) {
        case CmResourceTypePort:

            switch(descTranslated -> Type) {
            case CmResourceTypePort:
                deviceContext -> PortWasMapped = FALSE;
                deviceContext -> PortBase = ULongToPtr(descTranslated->u.Port.Start.LowPart);
                deviceContext -> PortCount = descTranslated ->u.Port.Length;
                KdPrint(("Resource Translated Port: (%x) Length: (%d)\n",
                         descTranslated->u.Port.Start.LowPart,
                         descTranslated->u.Port.Length));                        
                break;
            case CmResourceTypeMemory:
                //
                // Map the memory
                //
                deviceContext-> PortBase = (PVOID)
                                    MmMapIoSpace(descTranslated->u.Memory.Start,
                                                 descTranslated->u.Memory.Length,
                                                 MmNonCached);
                deviceContext-> PortCount = descTranslated->u.Memory.Length;

                deviceContext-> PortWasMapped = TRUE;
                
                KdPrint(("Resource Translated Memory: (%x) Length: (%d)\n",
                         descTranslated->u.Memory.Start.LowPart,
                         descTranslated->u.Memory.Length));                        
                break;
            default:
                KdPrint(("Unhandled resource_type (0x%x)\n", descTranslated->Type));
                status = STATUS_UNSUCCESSFUL;
                ASSERTMSG("Unhandled resource_type in start request\n", FALSE);                        
            }
            break;

        case CmResourceTypeMemory:
            deviceContext-> PortBase = (PVOID)
                                    MmMapIoSpace (descTranslated->u.Memory.Start,
                                    descTranslated->u.Memory.Length,
                                    MmNonCached);
            deviceContext-> PortCount = descTranslated->u.Memory.Length;

            deviceContext-> PortWasMapped = TRUE;
                    
            KdPrint(("Resource Translated Memory: (%x) Length: (%d)\n",
                    descTranslated->u.Memory.Start.LowPart,
                    descTranslated->u.Memory.Length));                        
            
            break;
        case CmResourceTypeInterrupt:
        default:
        KdPrint(("Unhandled resource type (0x%x)\n", desc->Type));
        status = STATUS_UNSUCCESSFUL;
        break;
        }

    }
//.........这里部分代码省略.........
开发者ID:340211173,项目名称:Driver,代码行数:101,代码来源:device.c


示例16: ExAcquireResourceExclusive

BOOLEAN
ExAcquireResourceExclusive(
    IN PNTDDK_ERESOURCE Resource,
    IN BOOLEAN Wait
    )

/*++

Routine Description:

    The routine acquires the resource for exclusive access.  Upon return from
    the procedure the resource is acquired for exclusive access.

Arguments:

    Resource - Supplies the resource to acquire

    Wait - Indicates if the call is allowed to wait for the resource
        to become available for must return immediately

Return Value:

    BOOLEAN - TRUE if the resource is acquired and FALSE otherwise

--*/

{
    KIRQL OldIrql;
    ERESOURCE_THREAD  OurThread;

    ASSERTMSG("Routine cannot be called at DPC ", !KeIsExecutingDpc() );

    ASSERT((Resource->Flag & ResourceNeverExclusive) == 0);

    OurThread = (ULONG_PTR)ExGetCurrentResourceThread();

    //
    //  Get exclusive access to this resource structure
    //

    AcquireResourceLock( Resource, &OldIrql );

    //
    //  Loop until the resource is ours or exit if we cannot wait.
    //

    while (TRUE) {
        if (Resource->ActiveCount == 0) {

            //
            // Resource is un-owned, obtain it exclusive
            //

            Resource->InitialOwnerThreads[0] = OurThread;
            Resource->OwnerThreads[0] = OurThread;
            Resource->OwnerCounts[0]  = 1;
            Resource->ActiveCount     = 1;
            Resource->Flag           |= ResourceOwnedExclusive;
            ReleaseResourceLock ( Resource, OldIrql );
            return TRUE;
        }

        if (IsOwnedExclusive(Resource) &&
            Resource->OwnerThreads[0] == OurThread) {

            //
            // Our thread is already the exclusive resource owner
            //

            Resource->OwnerCounts[0] += 1;
            ReleaseResourceLock( Resource, OldIrql );
            return TRUE;
        }

        //
        //  Check if we are allowed to wait or must return immediately, and
        //  indicate that we didn't acquire the resource
        //

        if (!Wait) {
            ReleaseResourceLock( Resource, OldIrql );
            return FALSE;
        }

        //
        //  Otherwise we need to wait to acquire the resource.
        //

        WaitForResourceExclusive ( Resource, OldIrql );
    }
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:91,代码来源:ddkresrc.c


示例17: ASSERTMSG

SchedulerTask::~SchedulerTask() {
	ASSERTMSG( taskThread == ( RFC_HND )NULL , "thread is running for task name=" + name );
	rfc_hnd_evdestroy( stopEvent 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASSERTN函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSERT2函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap