本文整理汇总了C++中ERROR_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ ERROR_LOG函数的具体用法?C++ ERROR_LOG怎么用?C++ ERROR_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ERROR_LOG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ERROR_LOG
bool VirtualDiscFileSystem::RmDir(const std::string &dirname)
{
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot remove directory on virtual disc");
return false;
}
开发者ID:Bigpet,项目名称:ppsspp,代码行数:5,代码来源:VirtualDiscFileSystem.cpp
示例2: ERROR_LOG
/*---------------------------------------------------------------------------*/
struct xio_server *xio_bind(struct xio_context *ctx,
struct xio_session_ops *ops,
const char *uri,
uint16_t *src_port,
uint32_t session_flags,
void *cb_private_data)
{
struct xio_server *server;
int retval;
int backlog = 4;
if (!ctx || !ops || !uri) {
ERROR_LOG("invalid parameters ctx:%p, ops:%p, uri:%p\n",
ctx, ops, uri);
xio_set_error(EINVAL);
return NULL;
}
TRACE_LOG("bind to %s\n", uri);
/* create the server */
server = (struct xio_server *)
kcalloc(1, sizeof(struct xio_server), GFP_KERNEL);
if (!server) {
xio_set_error(ENOMEM);
return NULL;
}
kref_init(&server->kref);
/* fill server data*/
server->ctx = ctx;
server->cb_private_data = cb_private_data;
server->uri = kstrdup(uri, GFP_KERNEL);
server->session_flags = session_flags;
memcpy(&server->ops, ops, sizeof(*ops));
XIO_OBSERVER_INIT(&server->observer, server, xio_on_nexus_event);
XIO_OBSERVABLE_INIT(&server->nexus_observable, server);
server->listener = xio_nexus_open(ctx, uri, NULL, 0, 0, NULL);
if (!server->listener) {
ERROR_LOG("failed to create connection\n");
goto cleanup;
}
retval = xio_nexus_listen(server->listener,
uri, src_port, backlog);
if (retval != 0) {
ERROR_LOG("connection listen failed\n");
goto cleanup1;
}
xio_nexus_set_server(server->listener, server);
xio_idr_add_uobj(usr_idr, server, "xio_server");
return server;
cleanup1:
xio_nexus_close(server->listener, NULL);
cleanup:
kfree(server->uri);
kfree(server);
return NULL;
}
开发者ID:caomw,项目名称:accelio,代码行数:66,代码来源:xio_server.c
示例3: __KernelReceiveMsgPipe
static int __KernelReceiveMsgPipe(MsgPipe *m, u32 receiveBufAddr, u32 receiveSize, int waitMode, u32 resultAddr, u32 timeoutPtr, bool cbEnabled, bool poll, bool &needsResched, bool &needsWait)
{
u32 curReceiveAddr = receiveBufAddr;
SceUID uid = m->GetUID();
// MsgPipe buffer size is 0, receiving directly from waiting send threads
if (m->nmp.bufSize == 0)
{
m->SortSendThreads();
// While they're still sending waiting threads (which can send data)
while (!m->sendWaitingThreads.empty() && receiveSize != 0)
{
MsgPipeWaitingThread *thread = &m->sendWaitingThreads.front();
// For send threads, "freeSize" is "free to be read".
u32 bytesToReceive = std::min(thread->freeSize, receiveSize);
if (bytesToReceive > 0)
{
thread->ReadBuffer(curReceiveAddr, bytesToReceive);
receiveSize -= bytesToReceive;
curReceiveAddr += bytesToReceive;
if (thread->freeSize == 0 || thread->waitMode == SCE_KERNEL_MPW_ASAP)
{
thread->Complete(uid, 0);
m->sendWaitingThreads.erase(m->sendWaitingThreads.begin());
needsResched = true;
thread = NULL;
}
}
}
// All data hasn't been received and (mode isn't ASAP or nothing was received)
if (receiveSize != 0 && (waitMode != SCE_KERNEL_MPW_ASAP || curReceiveAddr == receiveBufAddr))
{
if (poll)
{
// Generally, result is not updated in this case. But for a 0 size buffer in ASAP mode, it is.
if (Memory::IsValidAddress(resultAddr) && waitMode == SCE_KERNEL_MPW_ASAP)
Memory::Write_U32(curReceiveAddr - receiveBufAddr, resultAddr);
return SCE_KERNEL_ERROR_MPP_EMPTY;
}
else
{
m->AddReceiveWaitingThread(__KernelGetCurThread(), curReceiveAddr, receiveSize, waitMode, resultAddr);
needsWait = true;
return 0;
}
}
}
// Getting data from the MsgPipe buffer
else
{
if (receiveSize > (u32) m->nmp.bufSize)
{
ERROR_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): size %d too large for buffer", uid, receiveSize);
return SCE_KERNEL_ERROR_ILLEGAL_SIZE;
}
while (m->GetUsedSize() > 0)
{
u32 bytesToReceive = std::min(receiveSize, m->GetUsedSize());
if (bytesToReceive != 0)
{
Memory::Memcpy(curReceiveAddr, m->buffer, bytesToReceive);
m->nmp.freeSize += bytesToReceive;
memmove(Memory::GetPointer(m->buffer), Memory::GetPointer(m->buffer) + bytesToReceive, m->GetUsedSize());
curReceiveAddr += bytesToReceive;
receiveSize -= bytesToReceive;
m->CheckSendThreads();
}
else
break;
}
if (receiveSize != 0 && (waitMode != SCE_KERNEL_MPW_ASAP || curReceiveAddr == receiveBufAddr))
{
if (poll)
return SCE_KERNEL_ERROR_MPP_EMPTY;
else
{
m->AddReceiveWaitingThread(__KernelGetCurThread(), curReceiveAddr, receiveSize, waitMode, resultAddr);
needsWait = true;
return 0;
}
}
}
if (Memory::IsValidAddress(resultAddr))
Memory::Write_U32(curReceiveAddr - receiveBufAddr, resultAddr);
return 0;
}
开发者ID:libretro,项目名称:PSP1,代码行数:95,代码来源:sceKernelMsgPipe.cpp
示例4: create_lost_req
int create_lost_req(xmlNode* location, char* service, loc_fmt d_loc_fmt, str* lost_req){
xmlDocPtr doc= NULL;
xmlNodePtr root_node;
xmlNodePtr loc_node = NULL, loc_copy=NULL;
char * id = "1234";
char * profile;
xmlChar * req_body = NULL;
int req_len = 0;
if(d_loc_fmt == ERR_LOC){
ERROR_LOG("cannot use location with errornous format\n");
goto error;
}
profile = map_profile[d_loc_fmt];
/* creating the xml doc for the LoST message*/
doc= xmlNewDoc(BAD_CAST "1.0");
if(doc== NULL){
ERROR_LOG("when creating new xml doc\n");
goto error;
}
root_node = xmlNewNode(NULL, BAD_CAST LOST_FIND_SERVICE_CMD);
if(root_node==0){
ERROR_LOG("when adding new node %s\n", LOST_FIND_SERVICE_CMD);
goto error;
}
xmlDocSetRootElement(doc, root_node);
if(!xmlNewNs(root_node, BAD_CAST LOST_NS_HREF, NULL)){
ERROR_LOG("could not add the namespace %s to the root node\n",
LOST_NS_HREF);
goto error;
}
loc_node = xmlNewNode(NULL, BAD_CAST LOST_LOCATION_NODE);
if(!loc_node){
ERROR_LOG("when creating new node %s\n", LOST_LOCATION_NODE);
goto error;
}
if(!xmlNewProp(loc_node, BAD_CAST LOST_ID_PROP , BAD_CAST id)){
ERROR_LOG("could not add the property %s\n", LOST_ID_PROP);
goto error;
}
if(!xmlNewProp(loc_node, BAD_CAST LOST_PROFILE_PROP , BAD_CAST profile)){
ERROR_LOG("could not add the property %s\n", LOST_ID_PROP);
goto error;
}
//do a recursive copy of the location information
loc_copy = xmlCopyNode(location, 1);
if(!loc_copy){
ERROR_LOG("could not duplicate the location information node\n");
goto error;
}
if(!xmlAddChild(loc_node, loc_copy)){
ERROR_LOG("could not add the location information to the location node\n");
goto error;
}
loc_copy = NULL;
if(!xmlAddChild(root_node, loc_node)){
ERROR_LOG("could not add the %s node to root\n", LOST_LOCATION_NODE);
goto error;
}
loc_node = NULL;
if(!xmlNewChild(root_node, NULL, BAD_CAST LOST_SERVICE_NODE, BAD_CAST service)){
ERROR_LOG("could not add the %s node to root\n", LOST_SERVICE_NODE);
goto error;
}
//print_element_names(root_node);
xmlDocDumpFormatMemoryEnc(doc, &req_body, &req_len, LOST_XML_ENC, 1);
lost_req->s = (char*) req_body;
lost_req->len = req_len;
if(!lost_req->s || !lost_req->len){
ERROR_LOG("could not output the xml document\n");
goto error;
}
//DEBUG_LOG("lost request: %.*s\n", lost_req->len, lost_req->s);
xmlFreeDoc(doc);
return 0;
error:
if(loc_node)
xmlFreeNode(loc_node);
if(loc_copy)
xmlFreeNode(loc_copy);
//.........这里部分代码省略.........
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:101,代码来源:client.c
示例5: get_mapped_psap
/* Get the value of the returned psap URI from a LoST response
* @param root - the root of an parsed xml LoST response other than error or redirect
* @param exp_type - used to get the type of mapping: no-cache, no-expiration or with an expiration date
* @param exp_timestamp- used to get the timestamp of when the mapping will expire
* @param parsed_uri- used to get the parsed uri
* @returns the name of the psap uri in shm memory
*/
str get_mapped_psap(xmlNode* root, expire_type * exp_type, time_t* exp_timestamp, struct sip_uri* parsed_uri){
xmlNode * mapping, *uri;
xmlAttr * expires_attr;
xmlChar* content;
str uri_str, shm_uri={NULL, 0};
char * expires_str;
if(!(mapping = child_named_node(root, LOST_MAPPING_NODE_NAME))){
ERROR_LOG("Could not find a mapping element in the LoST response\n");
return shm_uri;
}
if(!(uri = child_named_node(mapping, LOST_URI_NODE_NAME))){
ERROR_LOG("Could not find any uri child on the mapping element in the LoST response\n");
return shm_uri;
}
get_uri:
content = xmlNodeGetContent((xmlNodePtr)uri);
uri_str.s = (char*)content;
if(!uri_str.s || (uri_str.s[0] == '\0')){
ERROR_LOG("Could not get the content of the uri element\n");
return shm_uri;
}
uri_str.len = strlen(uri_str.s);
DEBUG_LOG("Found a uri: %.*s\n", uri_str.len, uri_str.s);
//check if the uri is a well formed sip uri
if((parse_uri(uri_str.s, uri_str.len, parsed_uri)<0) ||
((parsed_uri->type != SIP_URI_T) && (parsed_uri->type != SIPS_URI_T))){
ERROR_LOG("the URI %.*s is no SIP/SIPS URI, for the moment only SIP/SIPS URIs are supported\n",
uri_str.len, uri_str.s);
if(!(uri = sibling_named_node(uri, LOST_URI_NODE_NAME))){
ERROR_LOG("Could not find any other uri child on the mapping element in the LoST response\n");
return shm_uri;
}
goto get_uri;
}
if(!(expires_attr = get_attr(mapping, LOST_EXPIRES_ATTR_NAME))){
ERROR_LOG("Could not find an expires attr of mapping element in the LoST response\n");
return shm_uri;
}
expires_str = (char*)expires_attr->children->content;
if(!expires_str || !strlen(expires_str)){
ERROR_LOG("Expires attribute with null content\n");
return shm_uri;
}
DEBUG_LOG("expires is %s\n", expires_str);
//get expiration time ISO 8601
if(get_time(expires_str, exp_type, exp_timestamp)){
ERROR_LOG("Invalid value for the attribute expires %s\n", expires_str);
return shm_uri;
}
//copy in shm memory
shm_uri.s = (char*)cds_malloc(uri_str.len*sizeof(char));
if(!shm_uri.s){
ERROR_LOG("Out of shm memory\n");
}else{
memcpy(shm_uri.s, uri_str.s, uri_str.len*sizeof(char));
shm_uri.len = uri_str.len;
}
xmlFree(content);
return shm_uri;
}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:83,代码来源:client.c
示例6: ERROR_LOG
void StateManager::Apply()
{
if (!m_blendStates.empty())
{
if (m_currentBlendState != m_blendStates.top().get())
{
m_currentBlendState = (ID3D11BlendState*)m_blendStates.top().get();
D3D::context->OMSetBlendState(m_currentBlendState, nullptr, 0xFFFFFFFF);
}
}
else ERROR_LOG(VIDEO, "Tried to apply without blend state!");
if (!m_depthStates.empty())
{
if (m_currentDepthState != m_depthStates.top().get())
{
m_currentDepthState = (ID3D11DepthStencilState*)m_depthStates.top().get();
D3D::context->OMSetDepthStencilState(m_currentDepthState, 0);
}
}
else ERROR_LOG(VIDEO, "Tried to apply without depth state!");
if (!m_rasterizerStates.empty())
{
if (m_currentRasterizerState != m_rasterizerStates.top().get())
{
m_currentRasterizerState = (ID3D11RasterizerState*)m_rasterizerStates.top().get();
D3D::context->RSSetState(m_currentRasterizerState);
}
}
else ERROR_LOG(VIDEO, "Tried to apply without rasterizer state!");
if (!m_dirtyFlags)
{
return;
}
if (m_dirtyFlags & DirtyFlag_Constants)
{
if (use_partial_buffer_update)
{
if (m_dirtyFlags & DirtyFlag_PixelConstants)
{
if (m_pending.pixelConstantsSize[0] == 0 && m_pending.pixelConstantsSize[1] == 0)
{
D3D::context->PSSetConstantBuffers(0, m_pending.pixelConstants[1] ? 2 : 1, m_pending.pixelConstants);
}
else
{
D3D::context1->PSSetConstantBuffers1(0, m_pending.pixelConstants[1] ? 2 : 1, m_pending.pixelConstants, m_pending.pixelConstantsOffset, m_pending.pixelConstantsSize);
}
m_current.pixelConstants[0] = m_pending.pixelConstants[0];
m_current.pixelConstantsOffset[0] = m_pending.pixelConstantsOffset[0];
m_current.pixelConstantsSize[0] = m_pending.pixelConstantsSize[0];
m_current.pixelConstants[1] = m_pending.pixelConstants[1];
m_current.pixelConstantsOffset[1] = m_pending.pixelConstantsOffset[1];
m_current.pixelConstantsSize[1] = m_pending.pixelConstantsSize[1];
}
if (m_dirtyFlags & DirtyFlag_VertexConstants)
{
if (m_pending.vertexConstantsSize == 0)
{
D3D::context->VSSetConstantBuffers(0, 1, &m_pending.vertexConstants);
}
else
{
D3D::context1->VSSetConstantBuffers1(0, 1, &m_pending.vertexConstants, &m_pending.vertexConstantsOffset, &m_pending.vertexConstantsSize);
}
m_current.vertexConstants = m_pending.vertexConstants;
m_current.vertexConstantsOffset = m_pending.vertexConstantsOffset;
m_current.vertexConstantsSize = m_pending.vertexConstantsSize;
}
if (m_dirtyFlags & DirtyFlag_GeometryConstants)
{
if (m_pending.geometryConstantsSize == 0)
{
D3D::context->GSSetConstantBuffers(0, 1, &m_pending.geometryConstants);
}
else
{
D3D::context1->GSSetConstantBuffers1(0, 1, &m_pending.geometryConstants, &m_pending.geometryConstantsOffset, &m_pending.geometryConstantsSize);
}
m_current.geometryConstants = m_pending.geometryConstants;
m_current.geometryConstantsOffset = m_pending.geometryConstantsOffset;
m_current.geometryConstantsSize = m_pending.geometryConstantsSize;
}
if (m_dirtyFlags & DirtyFlag_HullDomainConstants)
{
if (g_ActiveConfig.backend_info.bSupportsTessellation)
{
if (m_pending.hulldomainConstantsSize == 0)
{
D3D::context->HSSetConstantBuffers(0, 3, m_pending.hulldomainConstants);
D3D::context->DSSetConstantBuffers(0, 3, m_pending.hulldomainConstants);
}
else
{
D3D::context1->HSSetConstantBuffers1(0, 3, m_pending.hulldomainConstants, m_pending.hulldomainConstantsOffset, m_pending.hulldomainConstantsSize);
D3D::context1->DSSetConstantBuffers1(0, 3, m_pending.hulldomainConstants, m_pending.hulldomainConstantsOffset, m_pending.hulldomainConstantsSize);
}
//.........这里部分代码省略.........
开发者ID:gamax92,项目名称:Ishiiruka,代码行数:101,代码来源:D3DState.cpp
示例7: ixEthDBNPEUpdateHandler
/**
* @brief standard NPE update handler
*
* @param portID id of the port to be updated
* @param type record type to be pushed during this update
*
* The NPE update handler manages updating the NPE databases
* given a certain record type.
*
* @internal
*/
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBNPEUpdateHandler(IxEthDBPortId portID, IxEthDBRecordType type)
{
UINT32 epDelta, blockCount;
IxNpeMhMessage message;
UINT32 treeSize = 0;
PortInfo *port = &ixEthDBPortInfo[portID];
/* size selection and type check */
if (type == IX_ETH_DB_FILTERING_RECORD || type == IX_ETH_DB_WIFI_RECORD)
{
treeSize = FULL_ELT_BYTE_SIZE;
}
else if (type == IX_ETH_DB_FIREWALL_RECORD)
{
treeSize = FULL_FW_BYTE_SIZE;
}
else if (type == IX_ETH_DB_MASKED_FIREWALL_RECORD)
{
treeSize = FULL_FW_M_BYTE_SIZE;
}
else
{
return IX_ETH_DB_INVALID_ARG;
}
/* serialize tree into memory */
ixEthDBNPETreeWrite(type, treeSize, port->updateMethod.npeUpdateZone, port->updateMethod.searchTree, &epDelta, &blockCount);
/* free internal copy */
if (port->updateMethod.searchTree != NULL)
{
ixEthDBFreeMacTreeNode(port->updateMethod.searchTree);
}
/* forget last used search tree */
port->updateMethod.searchTree = NULL;
port->updateMethod.searchTreePendingWrite = FALSE;
/* dependending on the update type we do different things */
if (type == IX_ETH_DB_FILTERING_RECORD || type == IX_ETH_DB_WIFI_RECORD)
{
IX_STATUS result;
FILL_SETMACADDRESSDATABASE_MSG(message, IX_ETHNPE_PHYSICAL_ID_TO_NODE_LOGICAL_ID(portID),
epDelta, blockCount,
IX_OSAL_MMU_VIRT_TO_PHYS(port->updateMethod.npeUpdateZone));
IX_ETHDB_SEND_NPE_MSG(IX_ETHNPE_PHYSICAL_ID_TO_NODE(portID), message, result);
if (result == IX_SUCCESS)
{
IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) Finished downloading NPE tree on port %d\n", portID);
}
else
{
ixEthDBPortInfo[portID].agingEnabled = FALSE;
ixEthDBPortInfo[portID].updateMethod.updateEnabled = FALSE;
ixEthDBPortInfo[portID].updateMethod.userControlled = TRUE;
ERROR_LOG("EthDB: (PortUpdate) disabling aging and updates on port %d (assumed dead)\n", portID);
ixEthDBDatabaseClear(portID, IX_ETH_DB_ALL_RECORD_TYPES);
return IX_ETH_DB_FAIL;
}
return IX_ETH_DB_SUCCESS;
}
else if (type & IX_ETH_DB_FIREWALL_RECORD)
{
return ixEthDBFirewallUpdate(portID, port->updateMethod.npeUpdateZone, epDelta);
}
return IX_ETH_DB_INVALID_ARG;
}
开发者ID:dafyddcrosby,项目名称:L4OS,代码行数:87,代码来源:IxEthDBPortUpdate.c
示例8: ERROR_LOG
void ISOFileSystem::ReadDirectory(u32 startsector, u32 dirsize, TreeEntry *root, size_t level)
{
for (u32 secnum = startsector, endsector = dirsize/2048 + startsector; secnum < endsector; ++secnum)
{
u8 theSector[2048];
blockDevice->ReadBlock(secnum, theSector);
for (int offset = 0; offset < 2048; )
{
DirectoryEntry &dir = *(DirectoryEntry *)&theSector[offset];
u8 sz = theSector[offset];
// Nothing left in this sector. There might be more in the next one.
if (sz == 0)
break;
const int IDENTIFIER_OFFSET = 33;
if (offset + IDENTIFIER_OFFSET + dir.identifierLength > 2048)
{
ERROR_LOG(FILESYS, "Directory entry crosses sectors, corrupt iso?");
return;
}
offset += dir.size;
bool isFile = (dir.flags & 2) ? false : true;
bool relative;
TreeEntry *e = new TreeEntry();
if (dir.identifierLength == 1 && (dir.firstIdChar == '\x00' || dir.firstIdChar == '.'))
{
e->name = ".";
relative = true;
}
else if (dir.identifierLength == 1 && dir.firstIdChar == '\x01')
{
e->name = "..";
relative = true;
}
else
{
e->name = std::string((char *)&dir.firstIdChar, dir.identifierLength);
relative = false;
}
e->size = dir.dataLength();
e->startingPosition = dir.firstDataSector() * 2048;
e->isDirectory = !isFile;
e->flags = dir.flags;
e->parent = root;
// Let's not excessively spam the log - I commented this line out.
//DEBUG_LOG(FILESYS, "%s: %s %08x %08x %i", e->isDirectory?"D":"F", e->name.c_str(), dir.firstDataSectorLE, e->startingPosition, e->startingPosition);
if (e->isDirectory && !relative)
{
if (dir.firstDataSector() == startsector)
{
ERROR_LOG(FILESYS, "WARNING: Appear to have a recursive file system, breaking recursion");
}
else
{
bool doRecurse = true;
if (!restrictTree.empty())
doRecurse = level < restrictTree.size() && restrictTree[level] == e->name;
if (doRecurse)
ReadDirectory(dir.firstDataSector(), dir.dataLength(), e, level + 1);
else
continue;
}
}
root->children.push_back(e);
}
}
}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:76,代码来源:ISOFileSystem.cpp
示例9: while
ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(std::string path, bool catchError)
{
if (path.length() == 0)
{
//Ah, the device! "umd0:"
return &entireISO;
}
if (path.substr(0,2) == "./")
path.erase(0,2);
if (path[0] == '/')
path.erase(0,1);
if (path == "umd0")
return &entireISO;
TreeEntry *e = treeroot;
if (path.length() == 0)
return e;
while (true)
{
TreeEntry *ne = 0;
std::string name = "";
if (path.length()>0)
{
for (size_t i=0; i<e->children.size(); i++)
{
std::string n = (e->children[i]->name);
for (size_t j = 0; j < n.size(); j++) {
n[j] = tolower(n[j]);
}
std::string curPath = path.substr(0, path.find_first_of('/'));
for (size_t j = 0; j < curPath.size(); j++) {
curPath[j] = tolower(curPath[j]);
}
if (curPath == n)
{
//yay we got it
ne = e->children[i];
name = n;
break;
}
}
}
if (ne)
{
e = ne;
size_t l = name.length();
path.erase(0, l);
if (path.length() == 0 || (path.length()==1 && path[0] == '/'))
return e;
path.erase(0, 1);
while (path[0] == '/')
path.erase(0, 1);
}
else
{
if (catchError)
{
ERROR_LOG(FILESYS,"File %s not found", path.c_str());
}
return 0;
}
}
}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:68,代码来源:ISOFileSystem.cpp
示例10: lk
//.........这里部分代码省略.........
// The new way to initialize the extension is by writing 0x55 to 0x(4)A400F0, then writing 0x00 to 0x(4)A400FB
// 52 16 04 A4 00 F0 01 55
// 52 16 04 A4 00 FB 01 00
u8 const disable_enc_pt1_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xf0, 0x01, 0x55};
u8 const disable_enc_pt2_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xfb, 0x01, 0x00};
CheckDeviceType_Write(dev_handle,
disable_enc_pt1_report,
sizeof(disable_enc_pt1_report),
1);
CheckDeviceType_Write(dev_handle,
disable_enc_pt2_report,
sizeof(disable_enc_pt2_report),
1);
int rc = CheckDeviceType_Write(dev_handle,
req_status_report,
sizeof(req_status_report),
1);
while (rc > 0 && --max_cycles > 0)
{
if ((rc = CheckDeviceType_Read(dev_handle, buf, 1)) <= 0)
{
// DEBUG_LOG(WIIMOTE, "CheckDeviceType: Read failed...");
break;
}
switch (buf[1])
{
case WM_STATUS_REPORT:
{
real_wiimote = true;
// DEBUG_LOG(WIIMOTE, "CheckDeviceType: Got Status Report");
wm_status_report * wsr = (wm_status_report*)&buf[2];
if (wsr->extension)
{
// Wiimote with extension, we ask it what kind.
u8 read_ext[MAX_PAYLOAD] = {0};
read_ext[0] = WM_SET_REPORT | WM_BT_OUTPUT;
read_ext[1] = WM_READ_DATA;
// Extension type register.
*(u32*)&read_ext[2] = Common::swap32(0x4a400fa);
// Size.
*(u16*)&read_ext[6] = Common::swap16(6);
rc = CheckDeviceType_Write(dev_handle, read_ext, 8, 1);
}
else
{
// Normal Wiimote, exit while and be happy.
rc = -1;
}
break;
}
case WM_ACK_DATA:
{
real_wiimote = true;
//wm_acknowledge * wm = (wm_acknowledge*)&buf[2];
//DEBUG_LOG(WIIMOTE, "CheckDeviceType: Got Ack Error: %X ReportID: %X", wm->errorID, wm->reportID);
break;
}
case WM_READ_DATA_REPLY:
{
// DEBUG_LOG(WIIMOTE, "CheckDeviceType: Got Data Reply");
wm_read_data_reply * wrdr
= (wm_read_data_reply*)&buf[2];
// Check if it has returned what we asked.
if (Common::swap16(wrdr->address) == 0x00fa)
{
real_wiimote = true;
// 0x020420A40000ULL means balance board.
u64 ext_type = (*(u64*)&wrdr->data[0]);
// DEBUG_LOG(WIIMOTE,
// "CheckDeviceType: GOT EXT TYPE %llX",
// ext_type);
is_bb = (ext_type == 0x020420A40000ULL);
}
else
{
ERROR_LOG(WIIMOTE,
"CheckDeviceType: GOT UNREQUESTED ADDRESS %X",
Common::swap16(wrdr->address));
}
// force end
rc = -1;
break;
}
default:
{
// We let read try again incase there is another packet waiting.
// DEBUG_LOG(WIIMOTE, "CheckDeviceType: GOT UNKNOWN REPLY: %X", buf[1]);
break;
}
}
}
}
CloseHandle(dev_handle);
}
开发者ID:Buddybenj,项目名称:dolphin,代码行数:101,代码来源:IOWin.cpp
示例11: main
int main(int argc, char **argv) {
msk_trans_t *trans, *listen_trans;
msk_trans_attr_t trans_attr;
char errbuf[PCAP_ERRBUF_SIZE];
char *pcap_file;
pcap_t *pcap;
size_t block_size = 0;
uint32_t recv_num = 0;
int banner = 0;
int i, rc;
uint8_t *rdmabuf;
struct ibv_mr *mr;
msk_data_t *data, *wdata;
struct privatedata priv;
// argument handling
int option_index = 0;
int op, last_op;
char *tmp_s;
static struct option long_options[] = {
{ "client", required_argument, 0, 'c' },
{ "server", required_argument, 0, 's' },
{ "banner", no_argument, 0, 'B' },
{ "help", no_argument, 0, 'h' },
{ "verbose", no_argument, 0, 'v' },
{ "quiet", no_argument, 0, 'q' },
{ "block-size", required_argument, 0, 'b' },
{ "file", required_argument, 0, 'f' },
{ "recv-num", required_argument, 0, 'r' },
{ "no-check", no_argument, 0, 'n' },
{ 0, 0, 0, 0 }
};
memset(&trans_attr, 0, sizeof(msk_trans_attr_t));
memset(&priv, 0, sizeof(struct privatedata));
priv.docheck = 1;
trans_attr.server = -1; // put an incorrect value to check if we're either client or server
// sane values for optional or non-configurable elements
trans_attr.debug = 1;
trans_attr.max_recv_sge = 1;
trans_attr.disconnect_callback = callback_disconnect;
trans_attr.worker_count = -1;
pcap_file = "pcap.out";
last_op = 0;
while ((op = getopt_long(argc, argv, "[email protected]:s:S:r:b:r:t:f:Bn", long_options, &option_index)) != -1) {
switch(op) {
case 1: // this means double argument
if (last_op == 'c') {
trans_attr.port = optarg;
} else if (last_op == 'S') {
trans_attr.port = optarg;
} else {
ERROR_LOG("Failed to parse arguments");
print_help(argv);
exit(EINVAL);
}
break;
case '@':
printf("%s compiled on %s at %s\n", argv[0], __DATE__, __TIME__);
printf("Release = %s\n", VERSION);
printf("Release comment = %s\n", VERSION_COMMENT);
printf("Git HEAD = %s\n", _GIT_HEAD_COMMIT ) ;
printf("Git Describe = %s\n", _GIT_DESCRIBE ) ;
exit(0);
case 'h':
print_help(argv);
exit(0);
case 'v':
trans_attr.debug = trans_attr.debug * 2 + 1;
break;
case 'c':
trans_attr.server = 0;
trans_attr.node = optarg;
break;
case 's':
trans_attr.server = 10;
trans_attr.node = "::";
trans_attr.port = optarg;
break;
case 'S':
trans_attr.server = 10;
trans_attr.node = optarg;
break;
case 'q':
trans_attr.debug = 0;
break;
case 'f':
pcap_file = optarg;
break;
case 'B':
banner = 1;
break;
case 'n':
//.........这里部分代码省略.........
开发者ID:cea-hpc,项目名称:mooshika,代码行数:101,代码来源:rreplay.c
示例12: GenerateVSOutputStructForGS
bool LineGeometryShader::SetShader(u32 components, float lineWidth,
float texOffset, float vpWidth, float vpHeight, const bool* texOffsetEnable)
{
if (!m_ready)
return false;
// Make sure geometry shader for "components" is available
ComboMap::iterator shaderIt = m_shaders.find(components);
if (shaderIt == m_shaders.end())
{
// Generate new shader. Warning: not thread-safe.
static char buffer[16384];
ShaderCode code;
code.SetBuffer(buffer);
GenerateVSOutputStructForGS(code, API_D3D);
code.Write("\n%s", LINE_GS_COMMON);
std::stringstream numTexCoordsStream;
numTexCoordsStream << xfmem.numTexGen.numTexGens;
INFO_LOG(VIDEO, "Compiling line geometry shader for components 0x%.08X (num texcoords %d)",
components, xfmem.numTexGen.numTexGens);
const std::string& numTexCoordsStr = numTexCoordsStream.str();
D3D_SHADER_MACRO macros[] = {
{ "NUM_TEXCOORDS", numTexCoordsStr.c_str() },
{ nullptr, nullptr }
};
ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code.GetBuffer(), macros);
if (!newShader)
{
WARN_LOG(VIDEO, "Line geometry shader for components 0x%.08X failed to compile", components);
// Add dummy shader to prevent trying to compile again
m_shaders[components] = nullptr;
return false;
}
shaderIt = m_shaders.insert(std::make_pair(components, newShader)).first;
}
if (shaderIt != m_shaders.end())
{
if (shaderIt->second)
{
D3D11_MAPPED_SUBRESOURCE map;
HRESULT hr = D3D::context->Map(m_paramsBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
if (SUCCEEDED(hr))
{
LineGSParams* params = (LineGSParams*)map.pData;
params->LineWidth = lineWidth;
params->TexOffset = texOffset;
params->VpWidth = vpWidth;
params->VpHeight = vpHeight;
for (int i = 0; i < 8; ++i)
params->TexOffsetEnable[i] = texOffsetEnable[i] ? 1.f : 0.f;
D3D::context->Unmap(m_paramsBuffer, 0);
}
else
ERROR_LOG(VIDEO, "Failed to map line gs params buffer");
DEBUG_LOG(VIDEO, "Line params: width %f, texOffset %f, vpWidth %f, vpHeight %f",
lineWidth, texOffset, vpWidth, vpHeight);
D3D::context->GSSetShader(shaderIt->second, nullptr, 0);
D3D::context->GSSetConstantBuffers(0, 1, &m_paramsBuffer);
return true;
}
else
return false;
}
else
return false;
}
开发者ID:Asmodean-,项目名称:dolphin,代码行数:76,代码来源:LineGeometryShader.cpp
示例13: GetSaveFilePath
bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &saveDirName, int saveId, bool secureMode)
{
if (!param) {
return false;
}
u8 *data_ = param->dataBuf;
std::string dirPath = GetSaveFilePath(param, GetSaveDir(param, saveDirName));
if (saveId >= 0 && saveNameListDataCount > 0) // if user selection, use it
{
if (saveDataList[saveId].size == 0) // don't read no existing file
{
return false;
}
}
std::string filePath = dirPath+"/"+GetFileName(param);
s64 readSize;
INFO_LOG(HLE,"Loading file with size %u in %s",param->dataBufSize,filePath.c_str());
u8* saveData = 0;
int saveSize = -1;
if (!ReadPSPFile(filePath, &saveData, saveSize, &readSize))
{
ERROR_LOG(HLE,"Error reading file %s",filePath.c_str());
return false;
}
saveSize = (int)readSize;
// copy back save name in request
strncpy(param->saveName, saveDirName.c_str(), 20);
ParamSFOData sfoFile;
std::string sfopath = dirPath+"/" + SFO_FILENAME;
PSPFileInfo sfoInfo = pspFileSystem.GetFileInfo(sfopath);
if(sfoInfo.exists) // Read sfo
{
u8 *sfoData = new u8[(size_t)sfoInfo.size];
size_t sfoSize = (size_t)sfoInfo.size;
if(ReadPSPFile(sfopath,&sfoData,sfoSize, NULL))
{
sfoFile.ReadSFO(sfoData,sfoSize);
// copy back info in request
strncpy(param->sfoParam.title,sfoFile.GetValueString("TITLE").c_str(),128);
strncpy(param->sfoParam.savedataTitle,sfoFile.GetValueString("SAVEDATA_TITLE").c_str(),128);
strncpy(param->sfoParam.detail,sfoFile.GetValueString("SAVEDATA_DETAIL").c_str(),1024);
param->sfoParam.parentalLevel = sfoFile.GetValueInt("PARENTAL_LEVEL");
}
delete[] sfoData;
}
// Don't know what it is, but PSP always respond this and this unlock some game
param->bind = 1021;
bool isCrypted = IsSaveEncrypted(param, saveDirName) && secureMode;
bool saveDone = false;
if(isCrypted)// Try to decrypt
{
int align_len = align16(saveSize);
u8* data_base = new u8[align_len];
u8* cryptKey = new u8[0x10];
memset(cryptKey,0,0x10);
if(param->key[0] != 0)
{
memcpy(cryptKey, param->key, 0x10);
}
memset(data_base + saveSize, 0, align_len - saveSize);
memcpy(data_base, saveData, saveSize);
int decryptMode = 1;
if(param->key[0] != 0)
{
decryptMode = (GetSDKMainVersion(sceKernelGetCompiledSdkVersion()) >= 4 ? 5 : 3);
}
if(DecryptSave(decryptMode, data_base, &saveSize, &align_len, ((param->key[0] != 0)?cryptKey:0)) == 0)
{
memcpy(data_, data_base, saveSize);
saveDone = true;
}
delete[] data_base;
delete[] cryptKey;
}
if(!saveDone) // not crypted or decrypt fail
{
memcpy(data_, saveData, saveSize);
}
param->dataSize = (SceSize)saveSize;
delete[] saveData;
return true;
}
开发者ID:aki21,项目名称:ppsspp,代码行数:93,代码来源:SavedataParam.cpp
示例14: INFO_LOG
bool Ardb::Init(uint32 check_expire_period)
{
if (NULL == m_engine)
{
INFO_LOG("Start init storage engine.");
m_engine = m_engine_factory->CreateDB(
m_engine_factory->GetName().c_str());
KeyObject verkey(Slice(), KEY_END, ARDB_GLOBAL_DB);
ValueObject ver;
if (0 == GetValue(verkey, &ver))
{
if (ver.v.int_v != ARDB_FORMAT_VERSION)
{
ERROR_LOG(
"Incompatible data format version:%d in DB", ver.v.int_v);
return false;
}
}
else
{
ver.v.int_v = ARDB_FORMAT_VERSION;
ver.type = INTEGER;
SetValue(verkey, ver);
}
if (NULL != m_engine)
{
INFO_LOG("Init storage engine success.");
//launch a threading task to check expired keys
struct ExpireCheckThread: public Thread
{
Ardb* adb;
volatile bool running;
uint32 check_period;
ExpireCheckThread(Ardb* db, uint32 period) :
adb(db), running(true), check_period(period)
{
}
void Run()
{
while (running)
{
DBID firstDB = 0, lastDB = 0;
if (0 == adb->LastDB(lastDB)
&& 0 == adb->FirstDB(firstDB))
{
for (DBID db = firstDB; db <= lastDB; db++)
{
DBID nexdb = db;
if (adb->DBExist(db, nexdb))
{
adb->CheckExpireKey(db);
}
else
{
if (nexdb == db)
{
break;
}
adb->CheckExpireKey(nexdb);
db = nexdb;
}
}
}
uint64 end = get_current_epoch_micros();
uint64 sleep = check_period;
if (adb->m_min_expireat > end)
{
sleep = (adb->m_min_expireat - end) / 1000;
if (sleep > check_period)
{
sleep = check_period;
}
if (sleep == 0)
{
sleep = 1;
}
}
Thread::Sleep(sleep);
}
}
~ExpireCheckThread()
{
running = false;
}
};
m_expire_check_thread = new ExpireCheckThread(this,
check_expire_period);
m_expire_check_thread->Start();
}
}
return m_engine != NULL;
}
开发者ID:Ivasek,项目名称:ardb,代码行数:94,代码来源:ardb.cpp
示例15: return
size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size)
{
EntryMap::iterator iter = entries.find(handle);
if (iter != entries.end())
{
OpenFileEntry &e = iter->second;
if (e.isBlockSectorMode)
{
// Whole sectors! Shortcut to this simple code.
for (int i = 0; i < size; i++)
{
blockDevice->ReadBlock(e.seekPos, pointer + i * 2048);
e.seekPos++;
}
return (size_t)size;
}
u32 positionOnIso;
if (e.isRawSector)
{
positionOnIso = e.sectorStart * 2048 + e.seekPos;
if (e.seekPos + size > e.openSize)
{
size = e.openSize - e.seekPos;
}
}
else
{
_dbg_assert_msg_(FILESYS, e.file != 0, "Expecting non-raw fd to have a tree entry.");
//clamp read length
if ((s64)e.seekPos > e.file->size - (s64)size)
{
size = e.file->size - (s64)e.seekPos;
}
positionOnIso = e.file->startingPosition + e.seekPos;
}
//okay, we have size and position, let's rock
u32 totalRead = 0;
int secNum = positionOnIso / 2048;
int posInSector = positionOnIso & 2047;
s64 remain = size;
u8 theSector[2048];
while (remain > 0)
{
blockDevice->ReadBlock(secNum, theSector);
size_t bytesToCopy = 2048 - posInSector;
if ((s64)bytesToCopy > remain)
bytesToCopy = (size_t)remain;
memcpy(pointer, theSector + posInSector, bytesToCopy);
totalRead += (u32)bytesToCopy;
pointer += bytesToCopy;
remain -= bytesToCopy;
posInSector = 0;
secNum++;
}
e.seekPos += (unsigned int)size;
return totalRead;
}
else
{
//This shouldn't happen...
ERROR_LOG(FILESYS, "Hey, what are you doing? Reading non-open files?");
return 0;
}
}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:73,代码来源:ISOFileSystem.cpp
示例16: ERROR_LOG
bool StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
{
if (!iIsTiled)
{
// currently, core creates grids for all maps, whether it has terrain tiles or not
// so we need "fake" tile loads to know when we can unload map geometry
iLoadedTiles[packTileID(tileX, tileY)] = false;
return true;
}
if (!iTreeValues)
{
ERROR_LOG("StaticMapTree::LoadMapTile(): Tree has not been initialized! [%u,%u]", tileX, tileY);
return false;
}
bool result = true;
std::string tilefile = iBasePath + getTileFileName(iMapID, tileX, tileY);
FILE* tf = fopen(tilefile.c_str(), "rb");
if (tf)
{
char chunk[8];
if (!readChunk(tf, chunk, VMAP_MAGIC, 8))
result = false;
uint32 numSpawns;
if (result && fread(&numSpawns, sizeof(uint32), 1, tf) != 1)
result = false;
for (uint32 i = 0; i < numSpawns && result; ++i)
{
// read model spawns
ModelSpawn spawn;
result = ModelSpawn::readFromFile(tf, spawn);
if (result)
{
// acquire model instance
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
if (!model)
ERROR_LOG("StaticMapTree::LoadMapTile() could not acquire WorldModel pointer for '%s'!", spawn.name.c_str());
// update tree
uint32 referencedVal;
fread(&referencedVal, sizeof(uint32), 1, tf);
if (!iLoadedSpawns.count(referencedVal))
{
#ifdef VMAP_DEBUG
if (referencedVal > iNTreeValues)
{
DEBUG_LOG("invalid tree element! (%u/%u)", referencedVal, iNTreeValues);
continue;
}
#endif
iTreeValues[referencedVal] = ModelInstance(spawn, model);
iLoadedSpawns[referencedVal] = 1;
}
else
{
++iLoadedSpawns[referencedVal];
#ifdef VMAP_DEBUG
if (iTreeValues[referencedVal].uniqueID != spawn.uniqueID)
DEBUG_LOG("Error: trying to load wrong spawn in node!");
else if (iTreeValues[referencedVal].name != spawn.name)
DEBUG_LOG("Error: name mismatch on GUID=%u", spawn.uniqueID);
#endif
}
}
}
iLoadedTiles[packTileID(tileX, tileY)] = true;
fclose(tf);
}
else
iLoadedTiles[packTileID(tileX, tileY)] = false;
return result;
}
开发者ID:Reamer,项目名称:mangos,代码行数:73,代码来源:MapTree.cpp
示例17: ixEthDBTreeInsert
/**
* @brief inserts a mac descriptor into an tree
*
* @param searchTree tree where the insertion is to be performed (may be NULL)
* @param descriptor descriptor to insert into tree
*
* @return the tree root
*
* @internal
*/
IX_ETH_DB_PRIVATE
MacTreeNode* ixEthDBTreeInsert(MacTreeNode *searchTree, MacDescriptor *descriptor)
{
MacTreeNode *currentNode = searchTree;
MacTreeNode *insertLocation = NULL;
MacTreeNode *newNode;
INT32 insertPosition = RIGHT;
if (descriptor == NULL)
{
return searchTree;
}
/* create a new node */
newNode = ixEthDBAllocMacTreeNode();
if (newNode == NULL)
{
/* out of memory */
ERROR_LOG("Warning: ixEthDBAllocMacTreeNode returned NULL in file %s:%d (out of memory?)\n", __FILE__, __LINE__);
ixEthDBFreeMacDescriptor(descriptor);
return NULL;
}
/* populate node */
newNode->descriptor = descriptor;
/* an empty initial tree is a special case */
if (searchTree == NULL)
{
return newNode;
}
/* get insertion location */
while (insertLocation == NULL)
{
MacTreeNode *nextNode;
/* compare given key with current node key */
insertPosition = ixEthDBAddressCompare(descriptor->macAddress, currentNode->descriptor->macAddress);
/* navigate down */
|
请发表评论