本文整理汇总了C++中PanicAlert函数的典型用法代码示例。如果您正苦于以下问题:C++ PanicAlert函数的具体用法?C++ PanicAlert怎么用?C++ PanicAlert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PanicAlert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// The audio thread.
void DSound::SoundLoop()
{
Common::SetCurrentThreadName("Audio thread - dsound");
currentPos = 0;
lastPos = 0;
dsBuffer->Play(0, 0, DSBPLAY_LOOPING);
while (!threadData)
{
// No blocking inside the csection
dsBuffer->GetCurrentPosition((DWORD*)¤tPos, 0);
int numBytesToRender = FIX128(ModBufferSize(currentPos - lastPos));
if (numBytesToRender >= 256)
{
if (numBytesToRender > sizeof(realtimeBuffer))
PanicAlert("soundThread: too big render call");
m_mixer->Mix(realtimeBuffer, numBytesToRender / 4);
WriteDataToBuffer(lastPos, (char*)realtimeBuffer, numBytesToRender);
lastPos = ModBufferSize(lastPos + numBytesToRender);
}
soundSyncEvent.Wait();
}
}
示例2: GetOrCreateEncodingShader
LPDIRECT3DPIXELSHADER9 GetOrCreateEncodingShader(u32 format)
{
if (format > NUM_ENCODING_PROGRAMS)
{
PanicAlert("Unknown texture copy format: 0x%x\n", format);
return s_encodingPrograms[0];
}
if (!s_encodingPrograms[format])
{
if(s_encodingProgramsFailed[format])
{
// we already failed to create a shader for this format,
// so instead of re-trying and showing the same error message every frame, just return.
return nullptr;
}
const char* shader = TextureConversionShaderLegacy::GenerateEncodingShader(format);
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) {
static int counter = 0;
char szTemp[MAX_PATH];
sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++);
SaveData(szTemp, shader);
}
#endif
s_encodingPrograms[format] = D3D::CompileAndCreatePixelShader(shader, (int)strlen(shader));
if (!s_encodingPrograms[format]) {
ERROR_LOG(VIDEO, "Failed to create encoding fragment program");
s_encodingProgramsFailed[format] = true;
}
}
return s_encodingPrograms[format];
}
示例3: _assert_msg_
void FPURegCache::MapReg(const int i, bool doLoad, bool makeDirty) {
pendingFlush = true;
_assert_msg_(JIT, !regs[i].location.IsImm(), "WTF - load - imm");
if (!regs[i].away) {
// Reg is at home in the memory register file. Let's pull it out.
X64Reg xr = GetFreeXReg();
_assert_msg_(JIT, xr >= 0 && xr < NUM_X_FPREGS, "WTF - load - invalid reg");
xregs[xr].mipsReg = i;
xregs[xr].dirty = makeDirty;
OpArg newloc = ::Gen::R(xr);
if (doLoad) {
if (!regs[i].location.IsImm() && (regs[i].location.offset & 0x3)) {
PanicAlert("WARNING - misaligned fp register location %i", i);
}
emit->MOVSS(xr, regs[i].location);
}
regs[i].location = newloc;
regs[i].away = true;
} else {
// There are no immediates in the FPR reg file, so we already had this in a register. Make dirty as necessary.
xregs[RX(i)].dirty |= makeDirty;
_assert_msg_(JIT, regs[i].location.IsSimpleReg(), "not loaded and not simple.");
}
}
示例4: SyncGPU
void SyncGPU(SyncGPUReason reason, bool may_move_read_ptr)
{
if (g_use_deterministic_gpu_thread && GpuRunningState)
{
std::unique_lock<std::mutex> lk(s_video_buffer_lock);
u8* write_ptr = s_video_buffer_write_ptr;
s_video_buffer_cond.wait(lk, [&]() {
return !GpuRunningState || s_video_buffer_seen_ptr == write_ptr;
});
if (!GpuRunningState)
return;
// Opportunistically reset FIFOs so we don't wrap around.
if (may_move_read_ptr && s_fifo_aux_write_ptr != s_fifo_aux_read_ptr)
PanicAlert("aux fifo not synced (%p, %p)", s_fifo_aux_write_ptr, s_fifo_aux_read_ptr);
memmove(s_fifo_aux_data, s_fifo_aux_read_ptr, s_fifo_aux_write_ptr - s_fifo_aux_read_ptr);
s_fifo_aux_write_ptr -= (s_fifo_aux_read_ptr - s_fifo_aux_data);
s_fifo_aux_read_ptr = s_fifo_aux_data;
if (may_move_read_ptr)
{
// what's left over in the buffer
size_t size = write_ptr - s_video_buffer_pp_read_ptr;
memmove(s_video_buffer, s_video_buffer_pp_read_ptr, size);
// This change always decreases the pointers. We write seen_ptr
// after write_ptr here, and read it before in RunGpuLoop, so
// 'write_ptr > seen_ptr' there cannot become spuriously true.
s_video_buffer_write_ptr = write_ptr = s_video_buffer + size;
s_video_buffer_pp_read_ptr = s_video_buffer;
s_video_buffer_read_ptr = s_video_buffer;
s_video_buffer_seen_ptr = write_ptr;
}
}
}
示例5: ERROR_LOG
void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle,
u16 startAttrID, u16 endAttrID,
u16 MaximumAttributeByteCount, u8* pContinuationState)
{
if (ServiceHandle != 0x10000)
{
ERROR_LOG(WII_IPC_WIIMOTE, "Unknown service handle %x" , ServiceHandle);
PanicAlert("Unknown service handle %x" , ServiceHandle);
}
// _dbg_assert_(WII_IPC_WIIMOTE, ServiceHandle == 0x10000);
u32 contState = ParseCont(pContinuationState);
u32 packetSize = 0;
const u8* pPacket = GetAttribPacket(ServiceHandle, contState, packetSize);
// generate package
u8 DataFrame[1000];
CBigEndianBuffer buffer(DataFrame);
int Offset = 0;
l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t);
pHeader->dcid = cid;
buffer.Write8 (Offset, 0x05); Offset++;
buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID
memcpy(buffer.GetPointer(Offset), pPacket, packetSize); Offset += packetSize;
pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t));
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
// Debugger::PrintDataBuffer(LogTypes::WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "test response: ");
}
示例6: PanicAlert
void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
{
this->vtx_decl = _vtx_decl;
vertex_stride = vtx_decl.stride;
// We will not allow vertex components causing uneven strides.
if (vertex_stride & 3)
PanicAlert("Uneven vertex stride: %i", vertex_stride);
VertexManager *vm = (OGL::VertexManager*)g_vertex_manager;
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
// the element buffer is bound directly to the vao, so we must it set for every vao
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->m_index_buffers);
glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);
SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, vtx_decl.position);
for (int i = 0; i < 3; i++) {
SetPointer(SHADER_NORM0_ATTRIB+i, vertex_stride, vtx_decl.normals[i]);
}
for (int i = 0; i < 2; i++) {
SetPointer(SHADER_COLOR0_ATTRIB+i, vertex_stride, vtx_decl.colors[i]);
}
for (int i = 0; i < 8; i++) {
SetPointer(SHADER_TEXTURE0_ATTRIB+i, vertex_stride, vtx_decl.texcoords[i]);
}
SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, vtx_decl.posmtx);
vm->m_last_vao = VAO;
}
示例7: AllocateAlignedMemory
void* AllocateAlignedMemory(size_t size,size_t alignment)
{
#ifdef _WIN32
void* ptr = _aligned_malloc(size,alignment);
#else
void* ptr = NULL;
#ifdef ANDROID
ptr = memalign(alignment, size);
#elif defined(__SYMBIAN32__)
// On Symbian, we will want to create an RChunk.
ptr = malloc(size);
#else
posix_memalign(&ptr, alignment, size);
#endif
#endif
// printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size);
if (ptr == NULL)
PanicAlert("Failed to allocate aligned memory");
return ptr;
}
示例8: DumpDSPCode
bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc)
{
const std::string binFile = StringFromFormat("%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc);
const std::string txtFile = StringFromFormat("%sDSP_UC_%08X.txt", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc);
File::IOFile pFile(binFile, "wb");
if (pFile)
{
pFile.WriteBytes(code_be, size_in_bytes);
pFile.Close();
}
else
{
PanicAlert("Can't open file (%s) to dump UCode!!", binFile.c_str());
return false;
}
// Load the binary back in.
std::vector<u16> code;
LoadBinary(binFile, code);
AssemblerSettings settings;
settings.show_hex = true;
settings.show_pc = true;
settings.ext_separator = '\'';
settings.decode_names = true;
settings.decode_registers = true;
std::string text;
DSPDisassembler disasm(settings);
if (!disasm.Disassemble(0, code, 0x0000, text))
return false;
return File::WriteStringToFile(text, txtFile);
}
示例9: defined
VertexLoaderBase* VertexLoaderBase::CreateVertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr)
{
VertexLoaderBase* loader;
//#define COMPARE_VERTEXLOADERS
#if defined(COMPARE_VERTEXLOADERS) && defined(_M_X86_64)
// first try: Any new VertexLoader vs the old one
loader = new VertexLoaderTester(
new VertexLoader(vtx_desc, vtx_attr), // the software one
new VertexLoaderX64(vtx_desc, vtx_attr), // the new one to compare
vtx_desc, vtx_attr);
if (loader->IsInitialized())
return loader;
delete loader;
#elif defined(_M_X86_64)
loader = new VertexLoaderX64(vtx_desc, vtx_attr);
if (loader->IsInitialized())
return loader;
delete loader;
#elif defined(_M_ARM_64)
loader = new VertexLoaderARM64(vtx_desc, vtx_attr);
if (loader->IsInitialized())
return loader;
delete loader;
#endif
// last try: The old VertexLoader
loader = new VertexLoader(vtx_desc, vtx_attr);
if (loader->IsInitialized())
return loader;
delete loader;
PanicAlert("No Vertex Loader found.");
return nullptr;
}
示例10: guard
ID3D11RasterizerState* StateCache::Get(RasterizationState state)
{
std::lock_guard<std::mutex> guard(m_lock);
auto it = m_raster.find(state.hex);
if (it != m_raster.end())
return it->second;
static constexpr std::array<D3D11_CULL_MODE, 4> cull_modes = {
{D3D11_CULL_NONE, D3D11_CULL_BACK, D3D11_CULL_FRONT, D3D11_CULL_BACK}};
D3D11_RASTERIZER_DESC desc = {};
desc.FillMode = D3D11_FILL_SOLID;
desc.CullMode = cull_modes[state.cullmode];
desc.ScissorEnable = TRUE;
ID3D11RasterizerState* res = nullptr;
HRESULT hr = D3D::device->CreateRasterizerState(&desc, &res);
if (FAILED(hr))
PanicAlert("Failed to create rasterizer state at %s %d\n", __FILE__, __LINE__);
D3D::SetDebugObjectName(res, "rasterizer state used to emulate the GX pipeline");
m_raster.emplace(state.hex, res);
return res;
}
示例11: JITDISABLE
void JitILBase::addex(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
IREmitter::InstLoc a = ibuild.EmitLoadGReg(inst.RA);
IREmitter::InstLoc b = ibuild.EmitLoadGReg(inst.RB);
IREmitter::InstLoc ab = ibuild.EmitAdd(a, b);
IREmitter::InstLoc new_carry = ibuild.EmitICmpUlt(ab, a);
IREmitter::InstLoc previous_carry = ibuild.EmitLoadCarry();
IREmitter::InstLoc abc = ibuild.EmitAdd(ab, previous_carry);
new_carry = ibuild.EmitOr(new_carry, ibuild.EmitICmpUlt(abc, ab));
ibuild.EmitStoreGReg(abc, inst.RD);
ibuild.EmitStoreCarry(new_carry);
if (inst.OE)
PanicAlert("OE: addex");
if (inst.Rc)
ComputeRC(ibuild, abc);
}
示例12: if
D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D11_BIND_FLAG bind, D3D11_USAGE usage, DXGI_FORMAT fmt, unsigned int levels, unsigned int slices, D3D11_SUBRESOURCE_DATA* data)
{
ID3D11Texture2D* pTexture = nullptr;
HRESULT hr;
D3D11_CPU_ACCESS_FLAG cpuflags;
if (usage == D3D11_USAGE_STAGING)
cpuflags = (D3D11_CPU_ACCESS_FLAG)((int)D3D11_CPU_ACCESS_WRITE|(int)D3D11_CPU_ACCESS_READ);
else if (usage == D3D11_USAGE_DYNAMIC)
cpuflags = D3D11_CPU_ACCESS_WRITE;
else
cpuflags = (D3D11_CPU_ACCESS_FLAG)0;
D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(fmt, width, height, slices, levels, bind, usage, cpuflags);
hr = D3D::device->CreateTexture2D(&texdesc, data, &pTexture);
if (FAILED(hr))
{
PanicAlert("Failed to create texture at %s, line %d: hr=%#x\n", __FILE__, __LINE__, hr);
return nullptr;
}
D3DTexture2D* ret = new D3DTexture2D(pTexture, bind);
SAFE_RELEASE(pTexture);
return ret;
}
示例13: PanicAlertT
void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, int count)
{
if (!file)
PanicAlertT("WaveFileWriter - file not open.");
if (count > BUF_SIZE * 2)
PanicAlert("WaveFileWriter - buffer too small (count = %i).", count);
if (skip_silence)
{
bool all_zero = true;
for (int i = 0; i < count * 2; i++)
if (sample_data[i])
all_zero = false;
if (all_zero)
return;
}
for (int i = 0; i < count * 2; i++)
conv_buffer[i] = Common::swap16((u16)sample_data[i]);
file.WriteBytes(conv_buffer, count * 4);
audio_size += count * 4;
}
示例14: WriteProfileResults
void WriteProfileResults(const std::string& filename)
{
ProfileStats prof_stats;
GetProfileResults(&prof_stats);
File::IOFile f(filename, "w");
if (!f)
{
PanicAlert("Failed to open %s", filename.c_str());
return;
}
fprintf(f.GetHandle(), "origAddr\tblkName\trunCount\tcost\ttimeCost\tpercent\ttimePercent\tOvAlli"
"nBlkTime(ms)\tblkCodeSize\n");
for (auto& stat : prof_stats.block_stats)
{
std::string name = g_symbolDB.GetDescription(stat.addr);
double percent = 100.0 * (double)stat.cost / (double)prof_stats.cost_sum;
double timePercent = 100.0 * (double)stat.tick_counter / (double)prof_stats.timecost_sum;
fprintf(f.GetHandle(),
"%08x\t%s\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%.2f\t%.2f\t%.2f\t%i\n", stat.addr,
name.c_str(), stat.run_count, stat.cost, stat.tick_counter, percent, timePercent,
(double)stat.tick_counter * 1000.0 / (double)prof_stats.countsPerSec, stat.block_size);
}
}
示例15: glActiveTexture
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level)
{
if (pcfmt != PC_TEX_FMT_DXT1)
{
glActiveTexture(GL_TEXTURE0+9);
glBindTexture(GL_TEXTURE_2D_ARRAY, texture);
if (expanded_width != width)
glPixelStorei(GL_UNPACK_ROW_LENGTH, expanded_width);
glTexImage3D(GL_TEXTURE_2D_ARRAY, level, gl_iformat, width, height, 1, 0, gl_format, gl_type, temp);
if (expanded_width != width)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
else
{
PanicAlert("PC_TEX_FMT_DXT1 support disabled");
//glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
//width, height, 0, expanded_width * expanded_height/2, temp);
}
TextureCache::SetStage();
}