本文整理汇总了C++中common::Flag::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ Flag::Set方法的具体用法?C++ Flag::Set怎么用?C++ Flag::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Flag
的用法示例。
在下文中一共展示了Flag::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Video_AccessEFB
u32 VideoBackendHardware::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
{
if (s_BackendInitialized && g_ActiveConfig.bEFBAccessEnable)
{
s_accessEFBArgs.type = type;
s_accessEFBArgs.x = x;
s_accessEFBArgs.y = y;
s_accessEFBArgs.Data = InputData;
s_efbAccessRequested.Set();
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread)
{
s_efbAccessReadyEvent.Reset();
if (s_FifoShuttingDown.IsSet())
return 0;
s_efbAccessRequested.Set();
s_efbAccessReadyEvent.Wait();
}
else
VideoFifo_CheckEFBAccess();
return s_AccessEFBResult;
}
return 0;
}
示例2: Video_ExitLoop
void VideoBackendHardware::Video_ExitLoop()
{
ExitGpuLoop();
s_FifoShuttingDown.Set();
s_efbAccessReadyEvent.Set();
s_perfQueryReadyEvent.Set();
}
示例3: Video_EndField
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendHardware::Video_EndField()
{
if (s_BackendInitialized)
{
s_swapRequested.Set();
}
}
示例4: signal_handler
static void signal_handler(int)
{
const char message[] = "A signal was received. A second signal will force Dolphin to stop.\n";
if (write(STDERR_FILENO, message, sizeof(message)) < 0)
{
}
s_shutdown_requested.Set();
}
示例5: EmulatorState
void EmulatorState(bool running)
{
s_emu_running_state.Set(running);
if (running)
s_gpu_mainloop.Wakeup();
else
s_gpu_mainloop.AllowSleep();
}
示例6: ExitGpuLoop
// May be executed from any thread, even the graphics thread.
// Created to allow for self shutdown.
void ExitGpuLoop()
{
// This should break the wait loop in CPU thread
CommandProcessor::fifo.bFF_GPReadEnable = false;
FlushGpu();
// Terminate GPU thread loop
s_emu_running_state.Set();
s_gpu_mainloop.Stop(false);
}
示例7: Shutdown
void HiresTexture::Shutdown()
{
if (s_prefetcher.joinable())
{
s_textureCacheAbortLoading.Set();
s_prefetcher.join();
}
s_textureMap.clear();
s_textureCache.clear();
}
示例8: StopDVDThread
static void StopDVDThread()
{
ASSERT(s_dvd_thread.joinable());
// By setting s_DVD_thread_exiting, we ask the DVD thread to cleanly exit.
// In case the request queue is empty, we need to set s_request_queue_expanded
// so that the DVD thread will wake up and check s_DVD_thread_exiting.
s_dvd_thread_exiting.Set();
s_request_queue_expanded.Set();
s_dvd_thread.join();
}
示例9: Video_GetQueryResult
u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type)
{
if (!g_perf_query->ShouldEmulate())
{
return 0;
}
// TODO: Is this check sane?
if (!g_perf_query->IsFlushed())
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread)
{
s_perfQueryReadyEvent.Reset();
if (s_FifoShuttingDown.IsSet())
return 0;
s_perfQueryRequested.Set();
s_perfQueryReadyEvent.Wait();
}
else
g_perf_query->FlushResults();
}
return g_perf_query->GetQueryResult(type);
}
示例10: Update
void HiresTexture::Update()
{
bool BuildMaterialMaps = g_ActiveConfig.bHiresMaterialMapsBuild;
if (s_prefetcher.joinable())
{
s_textureCacheAbortLoading.Set();
s_prefetcher.join();
}
if (!g_ActiveConfig.bHiresTextures)
{
s_textureMap.clear();
s_textureCache.clear();
size_sum.store(0);
return;
}
if (!g_ActiveConfig.bCacheHiresTextures)
{
s_textureCache.clear();
size_sum.store(0);
}
s_textureMap.clear();
const std::string& game_id = SConfig::GetInstance().GetGameID();
const std::string texture_directory = GetTextureDirectory(game_id);
std::string ddscode(".dds");
std::string cddscode(".DDS");
std::vector<std::string> Extensions;
Extensions.push_back(".png");
if (!BuildMaterialMaps)
{
Extensions.push_back(".dds");
}
std::vector<std::string> filenames =
Common::DoFileSearch({texture_directory}, Extensions, /*recursive*/ true);
const std::string miptag = "mip";
for (const std::string& fileitem : filenames)
{
std::string filename;
std::string Extension;
SplitPath(fileitem, nullptr, &filename, &Extension);
if (filename.substr(0, s_format_prefix.length()) != s_format_prefix)
{
// Discard wrong files
continue;
}
size_t map_index = 0;
size_t max_type = BuildMaterialMaps ? MapType::specular : MapType::normal;
bool arbitrary_mips = false;
for (size_t tag = 1; tag <= MapType::specular; tag++)
{
if (StringEndsWith(filename, s_maps_tags[tag]))
{
map_index = tag;
filename = filename.substr(0, filename.size() - s_maps_tags[tag].size());
break;
}
}
if (map_index > max_type)
{
continue;
}
if (BuildMaterialMaps && map_index == MapType::material)
{
continue;
}
else if (!BuildMaterialMaps && map_index == MapType::color)
{
const size_t arb_index = filename.rfind("_arb");
arbitrary_mips = arb_index != std::string::npos;
if (arbitrary_mips)
filename.erase(arb_index, 4);
}
const bool is_compressed = Extension.compare(ddscode) == 0 || Extension.compare(cddscode) == 0;
hires_mip_level mip_level_detail(fileitem, Extension, is_compressed);
u32 level = 0;
size_t idx = filename.find_last_of('_');
std::string miplevel = filename.substr(idx + 1, std::string::npos);
if (miplevel.substr(0, miptag.length()) == miptag)
{
sscanf(miplevel.substr(3, std::string::npos).c_str(), "%i", &level);
filename = filename.substr(0, idx);
}
HiresTextureCache::iterator iter = s_textureMap.find(filename);
u32 min_item_size = level + 1;
if (iter == s_textureMap.end())
{
HiresTextureCacheItem item(min_item_size);
if (arbitrary_mips)
{
item.has_arbitrary_mips = true;
}
item.maps[map_index].resize(min_item_size);
std::vector<hires_mip_level>& dst = item.maps[map_index];
dst[level] = mip_level_detail;
//.........这里部分代码省略.........
示例11: MainLoop
void MainLoop() override
{
bool fullscreen = SConfig::GetInstance().bFullscreen;
int last_window_width = SConfig::GetInstance().iRenderWindowWidth;
int last_window_height = SConfig::GetInstance().iRenderWindowHeight;
if (fullscreen)
{
rendererIsFullscreen = X11Utils::ToggleFullscreen(dpy, win);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(True);
#endif
}
// The actual loop
while (s_running.IsSet())
{
if (s_shutdown_requested.TestAndClear())
{
const auto ios = IOS::HLE::GetIOS();
const auto stm = ios ? ios->GetDeviceByName("/dev/stm/eventhook") : nullptr;
if (!s_tried_graceful_shutdown.IsSet() && stm &&
std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->HasHookInstalled())
{
ProcessorInterface::PowerButton_Tap();
s_tried_graceful_shutdown.Set();
}
else
{
s_running.Clear();
}
}
XEvent event;
KeySym key;
for (int num_events = XPending(dpy); num_events > 0; num_events--)
{
XNextEvent(dpy, &event);
switch (event.type)
{
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if (key == XK_Escape)
{
if (Core::GetState() == Core::State::Running)
{
if (SConfig::GetInstance().bHideCursor)
XUndefineCursor(dpy, win);
Core::SetState(Core::State::Paused);
}
else
{
if (SConfig::GetInstance().bHideCursor)
XDefineCursor(dpy, win, blankCursor);
Core::SetState(Core::State::Running);
}
}
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
{
fullscreen = !fullscreen;
X11Utils::ToggleFullscreen(dpy, win);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(fullscreen);
#endif
}
else if (key >= XK_F1 && key <= XK_F8)
{
int slot_number = key - XK_F1 + 1;
if (event.xkey.state & ShiftMask)
State::Save(slot_number);
else
State::Load(slot_number);
}
else if (key == XK_F9)
Core::SaveScreenShot();
else if (key == XK_F11)
State::LoadLastSaved();
else if (key == XK_F12)
{
if (event.xkey.state & ShiftMask)
State::UndoLoadState();
else
State::UndoSaveState();
}
break;
case FocusIn:
rendererHasFocus = true;
if (SConfig::GetInstance().bHideCursor && Core::GetState() != Core::State::Paused)
XDefineCursor(dpy, win, blankCursor);
break;
case FocusOut:
rendererHasFocus = false;
if (SConfig::GetInstance().bHideCursor)
XUndefineCursor(dpy, win);
break;
case ClientMessage:
if ((unsigned long)event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False))
s_shutdown_requested.Set();
break;
case ConfigureNotify:
//.........这里部分代码省略.........
示例12: Update
void HiresTexture::Update()
{
s_check_native_format = false;
s_check_new_format = false;
if (s_prefetcher.joinable())
{
s_textureCacheAbortLoading.Set();
s_prefetcher.join();
}
if (!g_ActiveConfig.bHiresTextures)
{
s_textureMap.clear();
s_textureCache.clear();
size_sum.store(0);
return;
}
if (!g_ActiveConfig.bCacheHiresTextures)
{
s_textureCache.clear();
size_sum.store(0);
}
s_textureMap.clear();
const std::string& gameCode = SConfig::GetInstance().m_strUniqueID;
std::string szDir = StringFromFormat("%s%s", File::GetUserPath(D_HIRESTEXTURES_IDX).c_str(), gameCode.c_str());
std::string ddscode(".dds");
std::string cddscode(".DDS");
std::vector<std::string> Extensions = {
".png",
".dds"
};
auto rFilenames = DoFileSearch(Extensions, { szDir }, /*recursive*/ true);
const std::string code = StringFromFormat("%s_", gameCode.c_str());
const std::string miptag = "mip";
const std::string normaltag = ".nrm";
for (u32 i = 0; i < rFilenames.size(); i++)
{
std::string FileName;
std::string Extension;
SplitPath(rFilenames[i], nullptr, &FileName, &Extension);
if (FileName.substr(0, code.length()) == code)
{
s_check_native_format = true;
}
else if (FileName.substr(0, s_format_prefix.length()) == s_format_prefix)
{
s_check_new_format = true;
}
else
{
// Discard wrong files
continue;
}
const bool is_compressed = Extension.compare(ddscode) == 0 || Extension.compare(cddscode) == 0;
const bool is_normal_map = hasEnding(FileName, normaltag);
if (is_normal_map)
{
FileName = FileName.substr(0, FileName.size() - normaltag.size());
}
hires_mip_level mip_level_detail(rFilenames[i], Extension, is_compressed);
u32 level = 0;
size_t idx = FileName.find_last_of('_');
std::string miplevel = FileName.substr(idx + 1, std::string::npos);
if (miplevel.substr(0, miptag.length()) == miptag)
{
sscanf(miplevel.substr(3, std::string::npos).c_str(), "%i", &level);
FileName = FileName.substr(0, idx);
}
HiresTextureCache::iterator iter = s_textureMap.find(FileName);
u32 min_item_size = level + 1;
if (iter == s_textureMap.end())
{
HiresTextureCacheItem item(min_item_size);
if (is_normal_map)
{
item.normal_map.resize(min_item_size);
}
std::vector<hires_mip_level> &dst = is_normal_map ? item.normal_map : item.color_map;
dst[level] = mip_level_detail;
s_textureMap.emplace(FileName, item);
}
else
{
std::vector<hires_mip_level> &dst = is_normal_map ? iter->second.normal_map : iter->second.color_map;
if (dst.size() < min_item_size)
{
dst.resize(min_item_size);
}
dst[level] = mip_level_detail;
}
}
if (g_ActiveConfig.bCacheHiresTextures && s_textureMap.size() > 0)
{
// remove cached but deleted textures
//.........这里部分代码省略.........
示例13: Video_ExitLoop
void VideoBackendHardware::Video_ExitLoop()
{
ExitGpuLoop();
s_FifoShuttingDown.Set();
}
示例14: Video_ExitLoop
void VideoBackendBase::Video_ExitLoop()
{
Fifo::ExitGpuLoop();
s_FifoShuttingDown.Set();
}
示例15: Update
void HiresTexture::Update()
{
if (s_prefetcher.joinable())
{
s_textureCacheAbortLoading.Set();
s_prefetcher.join();
}
if (!g_ActiveConfig.bHiresTextures)
{
s_textureMap.clear();
s_textureCache.clear();
return;
}
if (!g_ActiveConfig.bCacheHiresTextures)
{
s_textureCache.clear();
}
const std::string& game_id = SConfig::GetInstance().m_strUniqueID;
const std::string texture_directory = GetTextureDirectory(game_id);
std::vector<std::string> extensions {
".png",
".bmp",
".tga",
".dds",
".jpg" // Why not? Could be useful for large photo-like textures
};
std::vector<std::string> filenames = DoFileSearch(extensions, {texture_directory}, /*recursive*/ true);
const std::string code = game_id + "_";
for (auto& rFilename : filenames)
{
std::string FileName;
SplitPath(rFilename, nullptr, &FileName, nullptr);
if (FileName.substr(0, code.length()) == code)
{
s_textureMap[FileName] = rFilename;
s_check_native_format = true;
}
if (FileName.substr(0, s_format_prefix.length()) == s_format_prefix)
{
s_textureMap[FileName] = rFilename;
s_check_new_format = true;
}
}
if (g_ActiveConfig.bCacheHiresTextures)
{
// remove cached but deleted textures
auto iter = s_textureCache.begin();
while (iter != s_textureCache.end())
{
if (s_textureMap.find(iter->first) == s_textureMap.end())
{
iter = s_textureCache.erase(iter);
}
else
{
iter++;
}
}
s_textureCacheAbortLoading.Clear();
s_prefetcher = std::thread(Prefetch);
}
}