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

C++ decaf_check函数代码示例

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

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



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

示例1: getPauseInitiatorCoreId

uint32_t
getPauseInitiatorCoreId()
{
   decaf_check(paused());
   decaf_check(sPauseInitiatorCoreId < 3);
   return sPauseInitiatorCoreId;
}
开发者ID:achurch,项目名称:decaf-emu,代码行数:7,代码来源:debugger.cpp


示例2: flushActiveCommandBuffer

static void
flushActiveCommandBuffer()
{
   auto core = coreinit::OSGetCoreId();
   auto cb = sActiveBuffer[core];

   decaf_check(cb);
   decaf_check(!cb->displayList);

   // Lets make sure our lease is still active, and then release it.
   decaf_check(sBufferPoolLeased);
   sBufferPoolLeased = false;

   // Release the remaining space from the buffer back to the
   //  pool so it can be used by the next command buffer!
   returnToPool(cb->buffer, cb->curSize, cb->maxSize);
   cb->maxSize = cb->curSize;

   if (cb->curSize == 0) {
      // There was no space taken, we can directly free this...
      freeBufferObj(cb);
   } else {
      // Send buffer to our driver!
      gpu::queueCommandBuffer(cb);
   }

   // This is no longer the active buffer
   sActiveBuffer[core] = nullptr;
}
开发者ID:CarlKenner,项目名称:decaf-emu,代码行数:29,代码来源:gx2_cbpool.cpp


示例3: endUserCommandBuffer

uint32_t
endUserCommandBuffer(uint32_t *buffer)
{
   auto core = coreinit::OSGetCoreId();
   auto &cb = sActiveBuffer[core];

   decaf_check(cb);

   decaf_check(cb->displayList);

   if (buffer != cb->buffer) {
      // HACK: FAST Racing Neo shows this behaviour, gx2.rpl seems to not really care about what pointer
      // you pass into GX2EndDisplayList, so it's possible this is perfectly valid behaviour and the error
      // an application one, and not one caused by us.
      gLog->warn("Display list passed to GX2EndDisplayList did not match one passed to GX2BeginDisplayList");
   }

   // Pad and get its size
   padCommandBuffer(cb);
   auto usedSize = cb->curSize;

   // Release the buffer object to the pool
   freeBufferObj(sActiveBuffer[core]);
   sActiveBuffer[core] = nullptr;

   // Allocate a new buffer!
   if (core == getMainCoreId()) {
      sActiveBuffer[core] = allocateCommandBuffer(0x100);
   }

   return usedSize;
}
开发者ID:CarlKenner,项目名称:decaf-emu,代码行数:32,代码来源:gx2_cbpool.cpp


示例4: OSWaitAlarm

/**
 * Sleep the current thread until the alarm has been triggered or cancelled.
 *
 * \return Returns TRUE if alarm expired, FALSE if alarm cancelled
 */
BOOL
OSWaitAlarm(OSAlarm *alarm)
{
   internal::lockScheduler();
   internal::acquireIdLock(sAlarmLock, alarm);

   decaf_check(alarm);
   decaf_check(alarm->tag == OSAlarm::Tag);

   if (alarm->state != OSAlarmState::Set) {
      internal::releaseIdLock(sAlarmLock, alarm);
      internal::unlockScheduler();
      return FALSE;
   }

   OSGetCurrentThread()->alarmCancelled = false;
   internal::sleepThreadNoLock(&alarm->threadQueue);

   internal::releaseIdLock(sAlarmLock, alarm);
   internal::rescheduleSelfNoLock();

   auto cancelled = OSGetCurrentThread()->alarmCancelled;
   internal::unlockScheduler();

   if (cancelled) {
      return FALSE;
   } else {
      return TRUE;
   }
}
开发者ID:CarlKenner,项目名称:decaf-emu,代码行数:35,代码来源:coreinit_alarm.cpp


示例5: insertBlock

static void
insertBlock(virt_ptr<MEMExpHeapBlockList> list,
            virt_ptr<MEMExpHeapBlock> prev,
            virt_ptr<MEMExpHeapBlock> block)
{
   decaf_check(!block->prev);
   decaf_check(!block->next);

   if (!prev) {
      block->next = list->head;
      block->prev = nullptr;

      list->head = block;
   } else {
      block->next = prev->next;
      block->prev = prev;

      prev->next = block;
   }

   if (block->next) {
      block->next->prev = block;
   } else {
      list->tail = block;
   }
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:26,代码来源:coreinit_memexpheap.cpp


示例6: MEMGetAllocatableSizeForExpHeapEx

uint32_t
MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle handle,
                                  int32_t alignment)
{
   auto heap = virt_cast<MEMExpHeap *>(handle);
   auto largestFree = 0u;
   internal::HeapLock lock { virt_addrof(heap->header) };

   if (alignment > 0) {
      decaf_check((alignment & 0x3) == 0);

      for (auto block = heap->freeList.head; block; block = block->next) {
         auto alignedSize = getAlignedBlockSize(block, alignment, MEMExpHeapDirection::FromStart);

         if (alignedSize > largestFree) {
            largestFree = alignedSize;
         }
      }
   } else {
      alignment = -alignment;

      decaf_check((alignment & 0x3) == 0);

      for (auto block = heap->freeList.head; block; block = block->next) {
         auto alignedSize = getAlignedBlockSize(block, alignment, MEMExpHeapDirection::FromEnd);

         if (alignedSize > largestFree) {
            largestFree = alignedSize;
         }
      }
   }

   return largestFree;
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:34,代码来源:coreinit_memexpheap.cpp


示例7: OSWaitCond

/**
 * Sleep the current thread until the condition variable has been signalled.
 *
 * The mutex must be locked when entering this function.
 * Will unlock the mutex and then sleep, reacquiring the mutex when woken.
 *
 * Similar to <a href="http://en.cppreference.com/w/cpp/thread/condition_variable/wait">std::condition_variable::wait</a>.
 */
void
OSWaitCond(OSCondition *condition, OSMutex *mutex)
{
   auto thread = OSGetCurrentThread();
   internal::lockScheduler();
   decaf_check(mutex && mutex->tag == OSMutex::Tag);
   decaf_check(condition && condition->tag == OSCondition::Tag);
   decaf_check(mutex->owner == thread);

   // Force an unlock
   auto mutexCount = mutex->count;
   mutex->count = 1;
   unlockMutexNoLock(mutex);
   internal::rescheduleOtherCoreNoLock();

   // Sleep on the condition
   internal::sleepThreadNoLock(&condition->queue);
   internal::rescheduleSelfNoLock();

   // Restore lock
   lockMutexNoLock(mutex);
   mutex->count = mutexCount;

   internal::unlockScheduler();
}
开发者ID:degasus,项目名称:decaf-emu,代码行数:33,代码来源:coreinit_mutex.cpp


示例8: GX2RLockSurfaceEx

virt_ptr<void>
GX2RLockSurfaceEx(virt_ptr<GX2Surface> surface,
                  int32_t level,
                  GX2RResourceFlags flags)
{
   decaf_check(surface);
   decaf_check(surface->resourceFlags & ~GX2RResourceFlags::Locked);
   flags = surface->resourceFlags | internal::getOptionFlags(flags);

   // Set Locked flag
   surface->resourceFlags |= GX2RResourceFlags::Locked;
   surface->resourceFlags |= flags & GX2RResourceFlags::LockedReadOnly;

   // Check if we need to invalidate the surface.
   if ((flags & GX2RResourceFlags::UsageGpuWrite) ||
      (flags & GX2RResourceFlags::UsageDmaWrite)) {
      if (!(flags & GX2RResourceFlags::DisableCpuInvalidate)) {
         auto ptr = virt_ptr<void> { nullptr };
         auto size = uint32_t { 0 };
         internal::getSurfaceData(surface, level, &ptr, &size);
         DCInvalidateRange(virt_cast<virt_addr>(ptr), size);
      }
   }

   return surface->image;
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:26,代码来源:gx2r_surface.cpp


示例9: decaf_check

size_t
HostFileHandle::read(uint8_t *data,
                     size_t size,
                     size_t count)
{
   decaf_check(mHandle);
   decaf_check((mMode & File::Read) || (mMode & File::Update));
   return fread_s(data, size * count, size, count, mHandle);
}
开发者ID:SakataGintokiYT,项目名称:decaf-emu,代码行数:9,代码来源:filesystem_win_host_filehandle.cpp


示例10: MEMDestroyExpHeap

virt_ptr<void>
MEMDestroyExpHeap(MEMHeapHandle handle)
{
   auto heap = virt_cast<MEMExpHeap *>(handle);
   decaf_check(heap);
   decaf_check(heap->header.tag == MEMHeapTag::ExpandedHeap);
   internal::unregisterHeap(virt_addrof(heap->header));
   return heap;
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:9,代码来源:coreinit_memexpheap.cpp


示例11: LOOP_END

static void
LOOP_END(State &state, const ControlFlowInst &cf)
{
   // TODO: LOOP_END has different behaviour depending on which LOOP_START
   // instruction started the loop, currently we only handle LOOP_START_DX10
   auto &loopState = state.loopStack.top();
   auto loopIndex = state.loopStack.size() - 1;

   // Sanity check to ensure we are at the cfPC
   decaf_check(state.cfPC == loopState.endPC);
   decaf_check((cf.word0.ADDR - 1) == loopState.startPC);

   state.loopStack.pop();

   // If breakMask is set, lets break from the while
   insertLineStart(state);
   state.out << "if (activeMask == InactiveBreak) {";
   insertLineEnd(state);

   increaseIndent(state);
   insertLineStart(state);
   state.out << "break;";
   insertLineEnd(state);
   decreaseIndent(state);

   insertLineStart(state);
   state.out << "}";
   insertLineEnd(state);

   // If ContinueMask is set, lets break from the while
   insertLineStart(state);
   state.out << "if (activeMask == InactiveContinue) {";
   insertLineEnd(state);

   increaseIndent(state);
   insertLineStart(state);
   state.out << "activeMask = Active;";
   insertLineEnd(state);
   decreaseIndent(state);

   insertLineStart(state);
   state.out << "}";
   insertLineEnd(state);

   // Check the while condition but without checking loop masks
   decreaseIndent(state);
   insertLineStart(state);
   state.out << "} while (";
   insertCond(state, cf.word1.COND());
   state.out << ");";
   insertLineEnd(state);

   insertPop(state);
   condEnd(state);
}
开发者ID:degasus,项目名称:decaf-emu,代码行数:55,代码来源:glsl2_cf.cpp


示例12: getJoystickAxisState

static int
getJoystickAxisState(const config::input::InputDevice *device,
                     SDL_GameController *controller,
                     vpad::Channel channel,
                     vpad::CoreAxis axis)
{
   decaf_check(device);
   decaf_check(controller);

   auto joystick = SDL_GameControllerGetJoystick(controller);
   decaf_check(joystick);

   auto index = -1;
   auto name = SDL_CONTROLLER_AXIS_INVALID;
   auto invert = false;

   switch (axis) {
   case vpad::CoreAxis::LeftStickX:
      index = device->joystick.left_stick_x;
      name = SDL_CONTROLLER_AXIS_LEFTX;
      invert = device->joystick.left_stick_x_invert;
      break;
   case vpad::CoreAxis::LeftStickY:
      index = device->joystick.left_stick_y;
      name = SDL_CONTROLLER_AXIS_LEFTY;
      invert = device->joystick.left_stick_y_invert;
      break;
   case vpad::CoreAxis::RightStickX:
      index = device->joystick.right_stick_x;
      name = SDL_CONTROLLER_AXIS_RIGHTX;
      invert = device->joystick.right_stick_x_invert;
      break;
   case vpad::CoreAxis::RightStickY:
      index = device->joystick.right_stick_y;
      name = SDL_CONTROLLER_AXIS_RIGHTY;
      invert = device->joystick.right_stick_y_invert;
      break;
   }

   auto value = 0;

   if (index >= 0) {
      value = SDL_JoystickGetAxis(joystick, index);
   } else if (index == -2) {
      if (name != SDL_CONTROLLER_AXIS_INVALID) {
         value = SDL_GameControllerGetAxis(controller, name);
      }
   }

   if (invert) {
      value = -value;
   }

   return value;
}
开发者ID:SakataGintokiYT,项目名称:decaf-emu,代码行数:55,代码来源:decafsdl_input.cpp


示例13: copySurfacePixels

bool
copySurfacePixels(uint8_t *dstBasePtr,
   uint32_t dstWidth,
   uint32_t dstHeight,
   ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT &dstAddrInput,
   uint8_t *srcBasePtr,
   uint32_t srcWidth,
   uint32_t srcHeight,
   ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT &srcAddrInput)
{
   auto handle = getAddrLibHandle();

   decaf_check(srcAddrInput.bpp == dstAddrInput.bpp);
   auto bpp = dstAddrInput.bpp;

   if (USE_ADDRLIBOPT) {
      decaf_check(srcAddrInput.isDepth == dstAddrInput.isDepth);
      decaf_check(srcAddrInput.numSamples == dstAddrInput.numSamples);
      auto isDepth = dstAddrInput.isDepth;
      auto numSamples = dstAddrInput.numSamples;

      return gpu::addrlibopt::copySurfacePixels(
         dstBasePtr, dstWidth, dstHeight, dstAddrInput,
         srcBasePtr, srcWidth, srcHeight, srcAddrInput,
         bpp, isDepth, numSamples);
   } else {
      ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT srcAddrOutput;
      ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT dstAddrOutput;

      std::memset(&srcAddrOutput, 0, sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT));
      std::memset(&dstAddrOutput, 0, sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT));

      srcAddrOutput.size = sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT);
      dstAddrOutput.size = sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT);

      for (auto y = 0u; y < dstHeight; ++y) {
         for (auto x = 0u; x < dstWidth; ++x) {
            srcAddrInput.x = srcWidth * x / dstWidth;
            srcAddrInput.y = srcHeight * y / dstHeight;
            AddrComputeSurfaceAddrFromCoord(handle, &srcAddrInput, &srcAddrOutput);

            dstAddrInput.x = x;
            dstAddrInput.y = y;
            AddrComputeSurfaceAddrFromCoord(handle, &dstAddrInput, &dstAddrOutput);

            auto src = &srcBasePtr[srcAddrOutput.addr];
            auto dst = &dstBasePtr[dstAddrOutput.addr];
            std::memcpy(dst, src, bpp / 8);
         }
      }

      return true;
   }
}
开发者ID:achurch,项目名称:decaf-emu,代码行数:54,代码来源:gpu_tiling.cpp


示例14: lock

void
FSClient::removeOpenFile(FSFileHandle handle)
{
   std::lock_guard<std::mutex> lock(mMutex);

   decaf_check(handle < mOpenFiles.size());
   decaf_check(mOpenFiles[handle]);

   mOpenFiles[handle]->close();

   delete mOpenFiles[handle];
   mOpenFiles[handle] = nullptr;
}
开发者ID:achurch,项目名称:decaf-emu,代码行数:13,代码来源:coreinit_fs_client.cpp


示例15: OSGetSemaphoreCount

/**
 * Get the current semaphore count.
 */
int32_t
OSGetSemaphoreCount(OSSemaphore *semaphore)
{
   internal::lockScheduler();
   decaf_check(semaphore);
   decaf_check(semaphore->tag == OSSemaphore::Tag);

   // Return count
   auto count = semaphore->count;

   internal::unlockScheduler();
   return count;
}
开发者ID:CarlKenner,项目名称:decaf-emu,代码行数:16,代码来源:coreinit_semaphore.cpp


示例16: GX2RUnlockSurfaceEx

void
GX2RUnlockSurfaceEx(virt_ptr<GX2Surface> surface,
                    int32_t level,
                    GX2RResourceFlags flags)
{
   decaf_check(surface);
   decaf_check(surface->resourceFlags & GX2RResourceFlags::Locked);

   // Invalidate surface
   GX2RInvalidateSurface(surface, level, flags);

   // Clear locked flags.
   surface->resourceFlags &= ~GX2RResourceFlags::LockedReadOnly;
   surface->resourceFlags &= ~GX2RResourceFlags::Locked;
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:15,代码来源:gx2r_surface.cpp


示例17: getUsedMemBlock

static virt_ptr<MEMExpHeapBlock>
getUsedMemBlock(virt_ptr<void> mem)
{
   auto block = virt_cast<MEMExpHeapBlock *>(mem) - 1;
   decaf_check(block->tag == UsedTag);
   return block;
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:7,代码来源:coreinit_memexpheap.cpp


示例18: OSTryLockMutex

/**
 * Try to lock a mutex.
 *
 * If no one owns the mutex, set current thread as owner.
 * If the lock is owned by the current thread, increase the recursion count.
 * If the lock is owned by another thread, do not block, return FALSE.
 *
 * \return TRUE if the mutex is locked, FALSE if the mutex is owned by another thread.
 *
 * Similar to <a href="http://en.cppreference.com/w/cpp/thread/recursive_mutex/try_lock">std::recursive_mutex::try_lock</a>.
 */
BOOL
OSTryLockMutex(virt_ptr<OSMutex> mutex)
{
   internal::lockScheduler();
   auto thread = OSGetCurrentThread();
   decaf_check(thread->state == OSThreadState::Running);

   internal::testThreadCancelNoLock();

   if (mutex->owner == thread) {
      mutex->count++;
      internal::unlockScheduler();
      return TRUE;
   } else if (mutex->owner) {
      internal::unlockScheduler();
      return FALSE;
   }

   // Set thread to owner of mutex
   mutex->count++;
   mutex->owner = thread;
   MutexQueue::append(virt_addrof(thread->mutexQueue), mutex);
   thread->cancelState |= OSThreadCancelState::DisabledByMutex;

   internal::unlockScheduler();
   return TRUE;
}
开发者ID:decaf-emu,项目名称:decaf-emu,代码行数:38,代码来源:coreinit_mutex.cpp


示例19: registerHleModule

void
registerHleModule(const std::string &name,
                  HleModule *module)
{
   if (std::find(decaf::config::system::lle_modules.begin(),
                 decaf::config::system::lle_modules.end(),
                 name) != decaf::config::system::lle_modules.end()) {
      gLog->warn("Replacing HLE with LLE for module {}.", name);
      return;
   }

   // Register module
   decaf_check(sHleModules.find(name) == sHleModules.end());
   sHleModules.emplace(name, module);

   // Register every function symbol
   auto &symbolMap = module->getSymbolMap();

   for (auto &pair : symbolMap) {
      auto symbol = pair.second;

      if (symbol->type == HleSymbol::Function) {
         registerHleFunc(reinterpret_cast<HleFunction *>(symbol));
      }
   }
}
开发者ID:VelocityRa,项目名称:decaf-emu,代码行数:26,代码来源:kernel_hle.cpp


示例20: unlockLoader

void
unlockLoader()
{
   auto core = 1 << cpu::this_core::id();
   auto oldCore = sLoaderLock.exchange(0, std::memory_order_release);
   decaf_check(oldCore == core);
}
开发者ID:degasus,项目名称:decaf-emu,代码行数:7,代码来源:kernel_loader.cpp



注:本文中的decaf_check函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ decimals函数代码示例发布时间:2022-05-30
下一篇:
C++ dec_zone_page_state函数代码示例发布时间: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