本文整理汇总了C++中INFO_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ INFO_LOG函数的具体用法?C++ INFO_LOG怎么用?C++ INFO_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INFO_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char *argv[] ) {
tf::options o;
o.register_option(tf::option("help", "Displays help", false, false, "help", 'h'));
o.register_option(tf::option("loglevel", "Logging level (DEBUG, INFO, WARNING, ERROR)", false, true, "loglevel", 'l'));
o.register_option(tf::option("url", "URL to connect to", true, true, "url", 'u'));
o.register_option(tf::option("rate", "Sending message rate", false, true, "rate", 'r'));
o.register_option(tf::option("count", "Number of messages to send", false, true, "count", 'c'));
try {
o.parse(argc, argv);
} catch (const tf::option_exception &e) {
ERROR_LOG(e.what());
o.printUsage();
return 1;
}
std::string loglevel;
if (o.get("loglevel", loglevel)) {
if (loglevel == "DEBUG") {
LOG_LEVEL(tf::logger::debug);
} else if (loglevel == "INFO") {
LOG_LEVEL(tf::logger::info);
} else if (loglevel == "WARNING") {
LOG_LEVEL(tf::logger::warning);
} else if (loglevel == "ERROR") {
LOG_LEVEL(tf::logger::error);
} else {
ERROR_LOG("Invalid log level");
return 1;
}
} else {
LOG_LEVEL(tf::logger::warning);
}
const size_t count = o.get("count", 1000ul);
const size_t rate = o.get("rate", 100ul);
try {
using TimeType = std::chrono::high_resolution_clock::time_point;
using ResultsType = std::pair<TimeType, TimeType>;
std::vector<ResultsType> m_times(count);
fp::Session::initialise();
if (std::thread::hardware_concurrency() >= 4) {
fp::Session::assign_to_cpu({2, 3});
} else if (std::thread::hardware_concurrency() >= 2) {
fp::Session::assign_to_cpu({0, 1});
}
const std::string url = o.getWithDefault("url", "");
fp::BlockingQueue queue;
auto transport = fp::make_realm_connection(url.c_str(), "");
if (!transport->valid()) {
ERROR_LOG("Failed to create transport");
return 1;
}
uint32_t id = 0;
bool shutdown = false;
fp::MutableMessage sendMsg;
sendMsg.setSubject("TEST.PERF.SOURCE");
sendMsg.addScalarField("id", id);
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::microseconds(1000000) / rate);
INFO_LOG("Sending a message every " << duration.count() << " us");
queue.registerEvent(duration, [&](fp::TimerEvent *event) noexcept {
if (id < count) {
sendMsg.clear();
sendMsg.setSubject("TEST.PERF.SOURCE");
sendMsg.addScalarField("id", id);
m_times[id].first = std::chrono::high_resolution_clock::now();
if (transport->sendMessage(sendMsg) == fp::OK) {
DEBUG_LOG("Message send successfully: " << sendMsg);
} else {
ERROR_LOG("Failed to send message");
exit(1);
}
id++;
}
});
fp::Subscriber subscriber(transport, "TEST.PERF.SINK", [&](const fp::Subscriber *event, const fp::Message *recvMsg) noexcept {
DEBUG_LOG("Received message from sink: " << *recvMsg);
// std::chrono::high_resolution_clock::time_point t = std::chrono::high_resolution_clock::now();
uint32_t recv_id = 0;
if (recvMsg->getScalarField("id", recv_id)) {
DEBUG_LOG("Processing message: " << recv_id);
uint64_t ts = 0;
if (recvMsg->getScalarField("timestamp", ts)) {
std::chrono::microseconds dur(ts);
std::chrono::time_point<std::chrono::high_resolution_clock> t(dur);
m_times[recv_id].second = t;
}
}
if (recv_id >= count - 1) {
shutdown = true;
//.........这里部分代码省略.........
示例2: sceIoIoctl
u32 sceIoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen)
{
u32 error;
FileNode *f = kernelObjects.Get<FileNode>(id, error);
if (error) {
return error;
}
//KD Hearts:
//56:46:434 HLE\sceIo.cpp:886 E[HLE]: UNIMPL 0=sceIoIoctrl id: 0000011f, cmd 04100001, indataPtr 08b313d8, inlen 00000010, outdataPtr 00000000, outLen 0
// 0000000
// TODO: This kind of stuff should be moved to the devices (wherever that would be)
// and does not belong in this file. Same thing with Devctl.
switch (cmd) {
// Define decryption key (amctrl.prx DRM)
case 0x04100001:
if (Memory::IsValidAddress(indataPtr) && inlen == 16) {
u8 keybuf[16];
memcpy(keybuf, Memory::GetPointer(indataPtr), 16);
ERROR_LOG(HLE, "PGD DRM not yet supported, sorry.");
}
break;
// Get UMD sector size
case 0x01020003:
INFO_LOG(HLE, "sceIoIoCtl: Asked for sector size of file %i", id);
if (Memory::IsValidAddress(outdataPtr) && outlen == 4) {
Memory::Write_U32(f->info.sectorSize, outdataPtr);
}
break;
// Get UMD file pointer
case 0x01020004:
INFO_LOG(HLE, "sceIoIoCtl: Asked for fpointer of file %i", id);
if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) {
Memory::Write_U32(f->info.fpointer, outdataPtr);
}
break;
// Get UMD file start sector .
case 0x01020006:
INFO_LOG(HLE, "sceIoIoCtl: Asked for start sector of file %i", id);
if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) {
Memory::Write_U32(f->info.startSector, outdataPtr);
}
break;
// Get UMD file size in bytes.
case 0x01020007:
INFO_LOG(HLE, "sceIoIoCtl: Asked for size of file %i", id);
if (Memory::IsValidAddress(outdataPtr) && outlen >= 8) {
Memory::Write_U64(f->info.size, outdataPtr);
}
break;
default:
ERROR_LOG(HLE, "UNIMPL 0=sceIoIoctl id: %08x, cmd %08x, indataPtr %08x, inlen %08x, outdataPtr %08x, outLen %08x", id,cmd,indataPtr,inlen,outdataPtr,outlen);
break;
}
return 0;
}
示例3: NativeInit
//.........这里部分代码省略.........
logLevel = LogTypes::LDEBUG;
break;
case 'g':
gfxLog = true;
break;
case 'j':
g_Config.bJit = true;
g_Config.bSaveSettings = false;
break;
case 'i':
g_Config.bJit = false;
g_Config.bSaveSettings = false;
break;
case '-':
if (!strncmp(argv[i], "--log=", strlen("--log=")) && strlen(argv[i]) > strlen("--log="))
fileToLog = argv[i] + strlen("--log=");
if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state="))
stateToLoad = argv[i] + strlen("--state=");
break;
}
} else {
if (boot_filename.empty()) {
boot_filename = argv[i];
if (!File::Exists(boot_filename))
{
fprintf(stderr, "File not found: %s\n", boot_filename.c_str());
exit(1);
}
} else {
fprintf(stderr, "Can only boot one file");
exit(1);
}
}
}
if (fileToLog != NULL)
LogManager::GetInstance()->ChangeFileLog(fileToLog);
#ifndef _WIN32
if (g_Config.currentDirectory == "") {
#if defined(ANDROID)
g_Config.currentDirectory = external_directory;
#elif defined(BLACKBERRY) || defined(__SYMBIAN32__) || defined(MEEGO_EDITION_HARMATTAN) || defined(IOS) || defined(_WIN32)
g_Config.currentDirectory = savegame_directory;
#else
g_Config.currentDirectory = getenv("HOME");
#endif
}
#if defined(ANDROID)
g_Config.internalDataDirectory = savegame_directory;
// Maybe there should be an option to use internal memory instead, but I think
// that for most people, using external memory (SDCard/USB Storage) makes the
// most sense.
g_Config.memCardDirectory = std::string(external_directory) + "/";
g_Config.flashDirectory = std::string(external_directory)+"/flash/";
#elif defined(BLACKBERRY) || defined(__SYMBIAN32__) || defined(MEEGO_EDITION_HARMATTAN) || defined(IOS) || defined(_WIN32)
g_Config.memCardDirectory = user_data_path;
#ifdef BLACKBERRY
g_Config.flashDirectory = "app/native/assets/flash/";
#elif defined(IOS)
g_Config.flashDirectory = std::string(external_directory) + "flash0/";
#elif defined(MEEGO_EDITION_HARMATTAN)
g_Config.flashDirectory = "/opt/PPSSPP/flash/";
#else
g_Config.flashDirectory = user_data_path+"/flash/";
#endif
#else
g_Config.memCardDirectory = std::string(getenv("HOME"))+"/.ppsspp/";
g_Config.flashDirectory = g_Config.memCardDirectory+"/flash/";
#endif
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
logman->SetEnable(type, true);
logman->SetLogLevel(type, gfxLog && i == LogTypes::G3D ? LogTypes::LDEBUG : logLevel);
#ifdef ANDROID
logman->AddListener(type, logger);
#endif
}
#ifdef __SYMBIAN32__
g_Config.bHardwareTransform = true;
g_Config.bUseVBO = false;
#endif
// Special hack for G3D as it's very spammy. Need to make a flag for this.
if (!gfxLog)
logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
INFO_LOG(BOOT, "Logger inited.");
#else
g_Config.memCardDirectory = "MemStick/";
#endif
i18nrepo.LoadIni(g_Config.languageIni);
if (!boot_filename.empty() && stateToLoad != NULL)
SaveState::Load(stateToLoad);
g_gameInfoCache.Init();
}
示例4: DMAWrite
void DMAWrite(u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);}
示例5: switch
s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize)
{
switch (_Parameter)
{
case IOCTL_GET_STATS:
{
if (_BufferOutSize < 0x1c)
return -1017;
WARN_LOG(WII_IPC_FILEIO, "FS: GET STATS - returning static values for now");
NANDStat fs;
//TODO: scrape the real amounts from somewhere...
fs.BlockSize = 0x4000;
fs.FreeUserBlocks = 0x5DEC;
fs.UsedUserBlocks = 0x1DD4;
fs.FreeSysBlocks = 0x10;
fs.UsedSysBlocks = 0x02F0;
fs.Free_INodes = 0x146B;
fs.Used_Inodes = 0x0394;
*(NANDStat*)Memory::GetPointer(_BufferOut) = fs;
return FS_RESULT_OK;
}
break;
case IOCTL_CREATE_DIR:
{
_dbg_assert_(WII_IPC_FILEIO, _BufferOutSize == 0);
u32 Addr = _BufferIn;
u32 OwnerID = Memory::Read_U32(Addr); Addr += 4;
u16 GroupID = Memory::Read_U16(Addr); Addr += 2;
std::string DirName(HLE_IPC_BuildFilename(Memory::GetString(Addr, 64))); Addr += 64;
Addr += 9; // owner attribs, permission
u8 Attribs = Memory::Read_U8(Addr);
INFO_LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s, OwnerID %#x, GroupID %#x, Attributes %#x", DirName.c_str(), OwnerID, GroupID, Attribs);
DirName += DIR_SEP;
File::CreateFullPath(DirName);
_dbg_assert_msg_(WII_IPC_FILEIO, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed", DirName.c_str());
return FS_RESULT_OK;
}
break;
case IOCTL_SET_ATTR:
{
u32 Addr = _BufferIn;
u32 OwnerID = Memory::Read_U32(Addr); Addr += 4;
u16 GroupID = Memory::Read_U16(Addr); Addr += 2;
std::string Filename = HLE_IPC_BuildFilename(Memory::GetString(_BufferIn, 64)); Addr += 64;
u8 OwnerPerm = Memory::Read_U8(Addr); Addr += 1;
u8 GroupPerm = Memory::Read_U8(Addr); Addr += 1;
u8 OtherPerm = Memory::Read_U8(Addr); Addr += 1;
u8 Attributes = Memory::Read_U8(Addr); Addr += 1;
INFO_LOG(WII_IPC_FILEIO, "FS: SetAttrib %s", Filename.c_str());
DEBUG_LOG(WII_IPC_FILEIO, " OwnerID: 0x%08x", OwnerID);
DEBUG_LOG(WII_IPC_FILEIO, " GroupID: 0x%04x", GroupID);
DEBUG_LOG(WII_IPC_FILEIO, " OwnerPerm: 0x%02x", OwnerPerm);
DEBUG_LOG(WII_IPC_FILEIO, " GroupPerm: 0x%02x", GroupPerm);
DEBUG_LOG(WII_IPC_FILEIO, " OtherPerm: 0x%02x", OtherPerm);
DEBUG_LOG(WII_IPC_FILEIO, " Attributes: 0x%02x", Attributes);
return FS_RESULT_OK;
}
break;
case IOCTL_GET_ATTR:
{
_dbg_assert_msg_(WII_IPC_FILEIO, _BufferOutSize == 76,
" GET_ATTR needs an 76 bytes large output buffer but it is %i bytes large",
_BufferOutSize);
u32 OwnerID = 0;
u16 GroupID = 0x3031; // this is also known as makercd, 01 (0x3031) for nintendo and 08 (0x3038) for MH3 etc
std::string Filename = HLE_IPC_BuildFilename(Memory::GetString(_BufferIn, 64));
u8 OwnerPerm = 0x3; // read/write
u8 GroupPerm = 0x3; // read/write
u8 OtherPerm = 0x3; // read/write
u8 Attributes = 0x00; // no attributes
if (File::IsDirectory(Filename))
{
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set", Filename.c_str());
}
else
{
if (File::Exists(Filename))
{
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR %s - all permission flags are set", Filename.c_str());
}
else
{
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR unknown %s", Filename.c_str());
return FS_FILE_NOT_EXIST;
//.........这里部分代码省略.........
示例6: while
// FastRun - inspired by GCemu (to imitate the JIT so that they can be compared).
void Interpreter::Run()
{
while (!PowerPC::GetState())
{
//we have to check exceptions at branches apparently (or maybe just rfi?)
if (SConfig::GetInstance().bEnableDebugging)
{
#ifdef SHOW_HISTORY
PCBlockVec.push_back(PC);
if (PCBlockVec.size() > ShowBlocks)
PCBlockVec.erase(PCBlockVec.begin());
#endif
// Debugging friendly version of inner loop. Tries to do the timing as similarly to the
// JIT as possible. Does not take into account that some instructions take multiple cycles.
while (PowerPC::ppcState.downcount > 0)
{
m_EndBlock = false;
int i;
for (i = 0; !m_EndBlock; i++)
{
#ifdef SHOW_HISTORY
PCVec.push_back(PC);
if (PCVec.size() > ShowSteps)
PCVec.erase(PCVec.begin());
#endif
//2: check for breakpoint
if (PowerPC::breakpoints.IsAddressBreakPoint(PC))
{
#ifdef SHOW_HISTORY
NOTICE_LOG(POWERPC, "----------------------------");
NOTICE_LOG(POWERPC, "Blocks:");
for (int j = 0; j < PCBlockVec.size(); j++)
NOTICE_LOG(POWERPC, "PC: 0x%08x", PCBlockVec.at(j));
NOTICE_LOG(POWERPC, "----------------------------");
NOTICE_LOG(POWERPC, "Steps:");
for (int j = 0; j < PCVec.size(); j++)
{
// Write space
if (j > 0)
{
if (PCVec.at(j) != PCVec.at(j-1) + 4)
NOTICE_LOG(POWERPC, "");
}
NOTICE_LOG(POWERPC, "PC: 0x%08x", PCVec.at(j));
}
#endif
INFO_LOG(POWERPC, "Hit Breakpoint - %08x", PC);
CCPU::Break();
if (PowerPC::breakpoints.IsTempBreakPoint(PC))
PowerPC::breakpoints.Remove(PC);
Host_UpdateDisasmDialog();
return;
}
SingleStepInner();
}
PowerPC::ppcState.downcount -= i;
}
}
else
{
// "fast" version of inner loop. well, it's not so fast.
while (PowerPC::ppcState.downcount > 0)
{
m_EndBlock = false;
int cycles = 0;
while (!m_EndBlock)
{
cycles += SingleStepInner();
}
PowerPC::ppcState.downcount -= cycles;
}
}
CoreTiming::Advance();
if (PowerPC::ppcState.Exceptions)
{
PowerPC::CheckExceptions();
PC = NPC;
}
}
// Let the waiting thread know we are done leaving
PowerPC::FinishStateMove();
}
示例7: ImmWrite
void ImmWrite(u32 data, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data);}
示例8: CommandBuffer
bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
{
SIOCtlVBuffer CommandBuffer(_CommandAddress);
u32 _BufferIn = 0, _BufferIn2 = 0, _BufferIn3 = 0;
u32 BufferInSize = 0, BufferInSize2 = 0, BufferInSize3 = 0;
u32 BufferOut = 0, BufferOut2 = 0, BufferOut3 = 0;
u32 BufferOutSize = 0, BufferOutSize2 = 0, BufferOutSize3 = 0;
if (CommandBuffer.InBuffer.size() > 0)
{
_BufferIn = CommandBuffer.InBuffer.at(0).m_Address;
BufferInSize = CommandBuffer.InBuffer.at(0).m_Size;
}
if (CommandBuffer.InBuffer.size() > 1)
{
_BufferIn2 = CommandBuffer.InBuffer.at(1).m_Address;
BufferInSize2 = CommandBuffer.InBuffer.at(1).m_Size;
}
if (CommandBuffer.InBuffer.size() > 2)
{
_BufferIn3 = CommandBuffer.InBuffer.at(2).m_Address;
BufferInSize3 = CommandBuffer.InBuffer.at(2).m_Size;
}
if (CommandBuffer.PayloadBuffer.size() > 0)
{
BufferOut = CommandBuffer.PayloadBuffer.at(0).m_Address;
BufferOutSize = CommandBuffer.PayloadBuffer.at(0).m_Size;
}
if (CommandBuffer.PayloadBuffer.size() > 1)
{
BufferOut2 = CommandBuffer.PayloadBuffer.at(1).m_Address;
BufferOutSize2 = CommandBuffer.PayloadBuffer.at(1).m_Size;
}
if (CommandBuffer.PayloadBuffer.size() > 2)
{
BufferOut3 = CommandBuffer.PayloadBuffer.at(2).m_Address;
BufferOutSize3 = CommandBuffer.PayloadBuffer.at(2).m_Size;
}
switch (CommandBuffer.Parameter)
{
case IOCTLV_NET_SSL_NEW:
{
int verifyOption = Memory::Read_U32(BufferOut);
const char * hostname = (const char*) Memory::GetPointer(BufferOut2);
int freeSSL = this->getSSLFreeID();
if (freeSSL)
{
int sslID = freeSSL - 1;
int ret = ssl_init(&_SSL[sslID].ctx);
if (ret)
{
// Cleanup possibly dirty ctx
memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
goto _SSL_NEW_ERROR;
}
entropy_init(&_SSL[sslID].entropy);
ssl_set_rng(&_SSL[sslID].ctx, entropy_func, &_SSL[sslID].entropy);
// For some reason we can't use TLSv1.2, v1.1 and below are fine!
ssl_set_max_version(&_SSL[sslID].ctx, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_2);
ssl_set_session(&_SSL[sslID].ctx, &_SSL[sslID].session);
ssl_set_endpoint(&_SSL[sslID].ctx, SSL_IS_CLIENT);
ssl_set_authmode(&_SSL[sslID].ctx, SSL_VERIFY_NONE);
ssl_set_renegotiation(&_SSL[sslID].ctx, SSL_RENEGOTIATION_ENABLED);
memcpy(_SSL[sslID].hostname, hostname, min((int)BufferOutSize2, NET_SSL_MAX_HOSTNAME_LEN));
_SSL[sslID].hostname[NET_SSL_MAX_HOSTNAME_LEN-1] = '\0';
ssl_set_hostname(&_SSL[sslID].ctx, _SSL[sslID].hostname);
_SSL[sslID].active = true;
Memory::Write_U32(freeSSL, _BufferIn);
}
else
{
_SSL_NEW_ERROR:
Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
}
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_NEW (%d, %s) "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
verifyOption, hostname,
_BufferIn, BufferInSize, _BufferIn2, BufferInSize2,
_BufferIn3, BufferInSize3, BufferOut, BufferOutSize,
BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);
break;
}
case IOCTLV_NET_SSL_SHUTDOWN:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
//.........这里部分代码省略.........
示例9: sceMp4Init
static u32 sceMp4Init()
{
INFO_LOG(ME, "sceMp4Init()");
return 0;
}
示例10: ChangeStatusShutdown
//.........这里部分代码省略.........
case SCE_UTILITY_SAVEDATA_TYPE_LOAD: // Only load and exit
case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD:
if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave))
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_SAVE: // Only save and exit
case SCE_UTILITY_SAVEDATA_TYPE_AUTOSAVE:
if (param.Save(param.GetPspParam(), GetSelectedSaveDirName()))
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_SIZES:
param.GetPspParam()->common.result = param.GetSizes(param.GetPspParam());
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_LIST:
param.GetList(param.GetPspParam());
param.GetPspParam()->common.result = 0;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_FILES:
param.GetPspParam()->common.result = param.GetFilesList(param.GetPspParam());
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_GETSIZE:
{
bool result = param.GetSize(param.GetPspParam());
// TODO: According to JPCSP, should test/verify this part but seems edge casey.
if (MemoryStick_State() != PSP_MEMORYSTICK_STATE_DRIVER_READY)
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_MEMSTICK;
else if (result)
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
}
break;
case SCE_UTILITY_SAVEDATA_TYPE_DELETEDATA:
DEBUG_LOG(SCEUTILITY, "sceUtilitySavedata DELETEDATA: %s", param.GetPspParam()->saveName);
param.GetPspParam()->common.result = param.DeleteData(param.GetPspParam());
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
//case SCE_UTILITY_SAVEDATA_TYPE_AUTODELETE:
case SCE_UTILITY_SAVEDATA_TYPE_SINGLEDELETE:
if (param.Delete(param.GetPspParam(), param.GetSelectedSave()))
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
// TODO: Should reset the directory's other files.
case SCE_UTILITY_SAVEDATA_TYPE_MAKEDATA:
case SCE_UTILITY_SAVEDATA_TYPE_MAKEDATASECURE:
if (param.Save(param.GetPspParam(), GetSelectedSaveDirName(), param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_MAKEDATASECURE))
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_WRITEDATA:
case SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE:
if (param.Save(param.GetPspParam(), GetSelectedSaveDirName(), param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE))
param.GetPspParam()->common.result = 0;
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA;
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
case SCE_UTILITY_SAVEDATA_TYPE_READDATA:
case SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE:
if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave, param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE))
param.GetPspParam()->common.result = 0;
else if (param.secureCanSkip(param.GetPspParam(),param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE)) {
INFO_LOG(SCEUTILITY,"Has not been saved yet, just skip.");
param.GetPspParam()->common.result = 0;
}
else
param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; // not sure if correct code
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
default:
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
}
}
break;
default:
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
break;
}
if (status == SCE_UTILITY_STATUS_FINISHED || pendingStatus == SCE_UTILITY_STATUS_FINISHED)
Memory::Memcpy(requestAddr, &request, request.common.size);
return 0;
}
示例11: useHWTransform_
LinkedShader::LinkedShader(Shader *vs, Shader *fs, u32 vertType, bool useHWTransform, LinkedShader *previous)
: useHWTransform_(useHWTransform), program(0), dirtyUniforms(0) {
PROFILE_THIS_SCOPE("shaderlink");
program = glCreateProgram();
vs_ = vs;
glAttachShader(program, vs->shader);
glAttachShader(program, fs->shader);
// Bind attribute locations to fixed locations so that they're
// the same in all shaders. We use this later to minimize the calls to
// glEnableVertexAttribArray and glDisableVertexAttribArray.
glBindAttribLocation(program, ATTR_POSITION, "position");
glBindAttribLocation(program, ATTR_TEXCOORD, "texcoord");
glBindAttribLocation(program, ATTR_NORMAL, "normal");
glBindAttribLocation(program, ATTR_W1, "w1");
glBindAttribLocation(program, ATTR_W2, "w2");
glBindAttribLocation(program, ATTR_COLOR0, "color0");
glBindAttribLocation(program, ATTR_COLOR1, "color1");
#ifndef USING_GLES2
if (gstate_c.featureFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) {
// Dual source alpha
glBindFragDataLocationIndexed(program, 0, 0, "fragColor0");
glBindFragDataLocationIndexed(program, 0, 1, "fragColor1");
} else if (gl_extensions.VersionGEThan(3, 3, 0)) {
glBindFragDataLocation(program, 0, "fragColor0");
}
#endif
glLinkProgram(program);
GLint linkStatus = GL_FALSE;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
if (linkStatus != GL_TRUE) {
GLint bufLength = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
if (bufLength) {
char* buf = new char[bufLength];
glGetProgramInfoLog(program, bufLength, NULL, buf);
#ifdef ANDROID
ELOG("Could not link program:\n %s", buf);
#endif
ERROR_LOG(G3D, "Could not link program:\n %s", buf);
ERROR_LOG(G3D, "VS desc:\n%s\n", vs->GetShaderString(SHADER_STRING_SHORT_DESC).c_str());
ERROR_LOG(G3D, "FS desc:\n%s\n", fs->GetShaderString(SHADER_STRING_SHORT_DESC).c_str());
std::string vs_source = vs->GetShaderString(SHADER_STRING_SOURCE_CODE);
std::string fs_source = fs->GetShaderString(SHADER_STRING_SOURCE_CODE);
ERROR_LOG(G3D, "VS:\n%s\n", vs_source.c_str());
ERROR_LOG(G3D, "FS:\n%s\n", fs_source.c_str());
Reporting::ReportMessage("Error in shader program link: info: %s / fs: %s / vs: %s", buf, fs_source.c_str(), vs_source.c_str());
#ifdef SHADERLOG
OutputDebugStringUTF8(buf);
OutputDebugStringUTF8(vs_source.c_str());
OutputDebugStringUTF8(fs_source.c_str());
#endif
delete [] buf; // we're dead!
}
// Prevent a buffer overflow.
numBones = 0;
return;
}
INFO_LOG(G3D, "Linked shader: vs %i fs %i", (int)vs->shader, (int)fs->shader);
u_tex = glGetUniformLocation(program, "tex");
u_proj = glGetUniformLocation(program, "u_proj");
u_proj_through = glGetUniformLocation(program, "u_proj_through");
u_texenv = glGetUniformLocation(program, "u_texenv");
u_fogcolor = glGetUniformLocation(program, "u_fogcolor");
u_fogcoef = glGetUniformLocation(program, "u_fogcoef");
u_alphacolorref = glGetUniformLocation(program, "u_alphacolorref");
u_alphacolormask = glGetUniformLocation(program, "u_alphacolormask");
u_stencilReplaceValue = glGetUniformLocation(program, "u_stencilReplaceValue");
u_testtex = glGetUniformLocation(program, "testtex");
u_fbotex = glGetUniformLocation(program, "fbotex");
u_blendFixA = glGetUniformLocation(program, "u_blendFixA");
u_blendFixB = glGetUniformLocation(program, "u_blendFixB");
u_fbotexSize = glGetUniformLocation(program, "u_fbotexSize");
// Transform
u_view = glGetUniformLocation(program, "u_view");
u_world = glGetUniformLocation(program, "u_world");
u_texmtx = glGetUniformLocation(program, "u_texmtx");
if (vertTypeGetWeightMask(vertType) != GE_VTYPE_WEIGHT_NONE)
numBones = TranslateNumBones(vertTypeGetNumBoneWeights(vertType));
else
numBones = 0;
u_depthRange = glGetUniformLocation(program, "u_depthRange");
#ifdef USE_BONE_ARRAY
u_bone = glGetUniformLocation(program, "u_bone");
#else
for (int i = 0; i < 8; i++) {
char name[10];
sprintf(name, "u_bone%i", i);
u_bone[i] = glGetUniformLocation(program, name);
}
#endif
//.........这里部分代码省略.........
示例12: ERROR_LOG_REPORT
int PSPSaveDialog::Init(int paramAddr)
{
// Ignore if already running
if (GetStatus() != SCE_UTILITY_STATUS_NONE) {
ERROR_LOG_REPORT(SCEUTILITY, "A save request is already running, not starting a new one");
return SCE_ERROR_UTILITY_INVALID_STATUS;
}
requestAddr = paramAddr;
int size = Memory::Read_U32(requestAddr);
memset(&request, 0, sizeof(request));
// Only copy the right size to support different save request format
if (size != SAVEDATA_DIALOG_SIZE_V1 && size != SAVEDATA_DIALOG_SIZE_V2 && size != SAVEDATA_DIALOG_SIZE_V3) {
ERROR_LOG_REPORT(SCEUTILITY, "sceUtilitySavedataInitStart: invalid size %d", size);
return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE;
}
Memory::Memcpy(&request, requestAddr, size);
Memory::Memcpy(&originalRequest, requestAddr, size);
int retval = param.SetPspParam(&request);
const u32 mode = (u32)param.GetPspParam()->mode;
const char *modeName = mode < ARRAY_SIZE(utilitySavedataTypeNames) ? utilitySavedataTypeNames[mode] : "UNKNOWN";
INFO_LOG(SCEUTILITY,"sceUtilitySavedataInitStart(%08x) - %s (%d)", paramAddr, modeName, mode);
INFO_LOG(SCEUTILITY,"sceUtilitySavedataInitStart(%08x) : Game key (hex): %s", paramAddr, param.GetKey(param.GetPspParam()).c_str());
yesnoChoice = 1;
switch ((SceUtilitySavedataFocus)(u32)param.GetPspParam()->focus)
{
case SCE_UTILITY_SAVEDATA_FOCUS_NAME:
currentSelectedSave = param.GetSaveNameIndex(param.GetPspParam());
break;
case SCE_UTILITY_SAVEDATA_FOCUS_FIRSTLIST:
currentSelectedSave = param.GetFirstListSave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_LASTLIST:
currentSelectedSave = param.GetLastListSave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_LATEST:
currentSelectedSave = param.GetLatestSave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_OLDEST:
currentSelectedSave = param.GetOldestSave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_FIRSTDATA:
currentSelectedSave = param.GetFirstDataSave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_LASTDATA:
currentSelectedSave = param.GetLastDataSave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_FIRSTEMPTY:
currentSelectedSave = param.GetFirstEmptySave();
break;
case SCE_UTILITY_SAVEDATA_FOCUS_LASTEMPTY:
currentSelectedSave = param.GetLastEmptySave();
break;
default:
WARN_LOG(SCEUTILITY, "Unknown save list focus option: %d", param.GetPspParam()->focus);
currentSelectedSave = 0;
break;
}
switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode)
{
case SCE_UTILITY_SAVEDATA_TYPE_LOAD:
DEBUG_LOG(SCEUTILITY, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
if (param.GetFileInfo(0).size != 0)
display = DS_LOAD_CONFIRM;
else
display = DS_LOAD_NODATA;
break;
case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD:
DEBUG_LOG(SCEUTILITY, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
display = DS_NONE;
// Is this necessary?
// currentSelectedSave = param.GetSelectedSave();
break;
case SCE_UTILITY_SAVEDATA_TYPE_LISTLOAD:
DEBUG_LOG(SCEUTILITY, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
if(param.GetFilenameCount() == 0)
display = DS_LOAD_NODATA;
else
display = DS_LOAD_LIST_CHOICE;
break;
case SCE_UTILITY_SAVEDATA_TYPE_SAVE:
DEBUG_LOG(SCEUTILITY, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
if (param.GetFileInfo(0).size != 0)
{
yesnoChoice = 0;
display = DS_SAVE_CONFIRM_OVERWRITE;
}
else
display = DS_SAVE_CONFIRM;
break;
case SCE_UTILITY_SAVEDATA_TYPE_AUTOSAVE:
DEBUG_LOG(SCEUTILITY, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
display = DS_NONE;
// Is this necessary?
// currentSelectedSave = param.GetSelectedSave();
break;
//.........这里部分代码省略.........
示例13: PanicAlertT
void GCMemcardDirectory::FlushToFile()
{
int errors = 0;
DEntry invalid;
for (u16 i = 0; i < m_saves.size(); ++i)
{
if (m_saves[i].m_dirty)
{
if (BE32(m_saves[i].m_gci_header.Gamecode) != 0xFFFFFFFF)
{
m_saves[i].m_dirty = false;
if (m_saves[i].m_filename.empty())
{
std::string defaultSaveName = m_SaveDirectory + m_saves[i].m_gci_header.GCI_FileName();
// Check to see if another file is using the same name
// This seems unlikely except in the case of file corruption
// otherwise what user would name another file this way?
for (int j = 0; File::Exists(defaultSaveName) && j < 10; ++j)
{
defaultSaveName.insert(defaultSaveName.end() - 4, '0');
}
if (File::Exists(defaultSaveName))
PanicAlertT("Failed to find new filename\n %s\n will be overwritten", defaultSaveName.c_str());
m_saves[i].m_filename = defaultSaveName;
}
File::IOFile GCI(m_saves[i].m_filename, "wb");
if (GCI)
{
GCI.WriteBytes(&m_saves[i].m_gci_header, DENTRY_SIZE);
GCI.WriteBytes(m_saves[i].m_save_data.data(), BLOCK_SIZE * m_saves[i].m_save_data.size());
if (GCI.IsGood())
{
Core::DisplayMessage(
StringFromFormat("Wrote save contents to %s", m_saves[i].m_filename.c_str()), 4000);
}
else
{
++errors;
Core::DisplayMessage(
StringFromFormat("Failed to write save contents to %s", m_saves[i].m_filename.c_str()),
4000);
ERROR_LOG(EXPANSIONINTERFACE, "Failed to save data to %s", m_saves[i].m_filename.c_str());
}
}
}
else if (m_saves[i].m_filename.length() != 0)
{
m_saves[i].m_dirty = false;
std::string &oldname = m_saves[i].m_filename;
std::string deletedname = oldname + ".deleted";
if (File::Exists(deletedname))
File::Delete(deletedname);
File::Rename(oldname, deletedname);
m_saves[i].m_filename.clear();
m_saves[i].m_save_data.clear();
m_saves[i].m_used_blocks.clear();
}
}
// Unload the save data for any game that is not running
// we could use !m_dirty, but some games have multiple gci files and may not write to them simultaneously
// this ensures that the save data for all of the current games gci files are stored in the savestate
u32 gamecode = BE32(m_saves[i].m_gci_header.Gamecode);
if (gamecode != m_GameId && gamecode != 0xFFFFFFFF && m_saves[i].m_save_data.size())
{
INFO_LOG(EXPANSIONINTERFACE, "Flushing savedata to disk for %s", m_saves[i].m_filename.c_str());
m_saves[i].m_save_data.clear();
}
}
#if _WRITE_MC_HEADER
u8 mc[BLOCK_SIZE * MC_FST_BLOCKS];
Read(0, BLOCK_SIZE * MC_FST_BLOCKS, mc);
File::IOFile hdrfile(m_SaveDirectory + MC_HDR, "wb");
hdrfile.WriteBytes(mc, BLOCK_SIZE * MC_FST_BLOCKS);
#endif
}
示例14: INFO_LOG
s32 GCMemcardDirectory::Write(u32 destaddress, s32 length, u8 *srcaddress)
{
if (length != 0x80)
INFO_LOG(EXPANSIONINTERFACE, "WRITING TO %x, len %x", destaddress, length);
s32 block = destaddress / BLOCK_SIZE;
u32 offset = destaddress % BLOCK_SIZE;
s32 extra = 0; // used for write calls that are across multiple blocks
if (offset + length > BLOCK_SIZE)
{
extra = length + offset - BLOCK_SIZE;
length -= extra;
// verify that we haven't calculated a length beyond BLOCK_SIZE
_dbg_assert_msg_(EXPANSIONINTERFACE, (destaddress + length) % BLOCK_SIZE == 0,
"Memcard directory Write Logic Error");
}
if (m_LastBlock != block)
{
switch (block)
{
case 0:
m_LastBlock = block;
m_LastBlockAddress = (u8 *)&m_hdr;
break;
case 1:
case 2:
{
m_LastBlock = -1;
s32 bytes_written = 0;
while (length > 0)
{
s32 to_write = std::min<s32>(DENTRY_SIZE, length);
bytes_written += DirectoryWrite(destaddress + bytes_written, to_write, srcaddress + bytes_written);
length -= to_write;
}
return bytes_written;
}
case 3:
m_LastBlock = block;
m_LastBlockAddress = (u8 *)&m_bat1;
break;
case 4:
m_LastBlock = block;
m_LastBlockAddress = (u8 *)&m_bat2;
break;
default:
m_LastBlock = SaveAreaRW(block, true);
if (m_LastBlock == -1)
{
PanicAlertT("Report: GCIFolder Writing to unallocated block %x", block);
exit(0);
}
}
}
memcpy(m_LastBlockAddress + offset, srcaddress, length);
if (extra)
extra = Write(destaddress + length, extra, srcaddress + length);
return length + extra;
}
示例15: DeleteDirRecursively
// Deletes the given directory and anything under it. Returns true on success.
bool DeleteDirRecursively(const std::string &directory)
{
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str());
#ifdef _WIN32
// Find the first file in the directory.
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd);
if (hFind == INVALID_HANDLE_VALUE)
{
FindClose(hFind);
return false;
}
// windows loop
do
{
const std::string virtualName(Common::TStrToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = NULL;
DIR *dirp = opendir(directory.c_str());
if (!dirp)
return false;
// non windows loop
while (!readdir_r(dirp, &dirent, &result) && result)
{
const std::string virtualName = result->d_name;
#endif
// check for "." and ".."
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
(virtualName[2] == '\0')))
continue;
std::string newPath = directory + DIR_SEP_CHR + virtualName;
if (IsDirectory(newPath))
{
if (!DeleteDirRecursively(newPath))
{
#ifndef _WIN32
closedir(dirp);
#endif
return false;
}
}
else
{
if (!FileUtil::Delete(newPath))
{
#ifndef _WIN32
closedir(dirp);
#endif
return false;
}
}
#ifdef _WIN32
} while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
#else
}
closedir(dirp);
#endif
FileUtil::DeleteDir(directory);
return true;
}