本文整理汇总了C++中LogManager::SetEnable方法的典型用法代码示例。如果您正苦于以下问题:C++ LogManager::SetEnable方法的具体用法?C++ LogManager::SetEnable怎么用?C++ LogManager::SetEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogManager
的用法示例。
在下文中一共展示了LogManager::SetEnable方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NativeInit
void NativeInit(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID)
{
std::string user_data_path = savegame_directory;
// We want this to be FIRST.
VFSRegister("", new DirectoryAssetReader("assets/"));
VFSRegister("", new DirectoryAssetReader(user_data_path.c_str()));
host = new NativeHost();
logger = new AndroidLogger();
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
ILOG("Logman: %p", logman);
if (argc > 1)
{
boot_filename = argv[1];
if (!File::Exists(boot_filename))
{
fprintf(stdout, "File not found: %s\n", boot_filename.c_str());
exit(1);
}
}
config_filename = user_data_path + "/config.ini";
g_Config.Load(config_filename.c_str());
if (g_Config.currentDirectory == "") {
#ifdef ANDROID
g_Config.currentDirectory = external_directory;
#else
g_Config.currentDirectory = getenv("HOME");
#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, LogTypes::LDEBUG);
#ifdef ANDROID
logman->AddListener(type, logger);
#endif
}
logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
INFO_LOG(BOOT, "Logger inited.");
}
示例2: main
int main(int argc, const char* argv[])
{
bool fullLog = false;
bool useJit = false;
bool fastInterpreter = false;
bool autoCompare = false;
bool useGraphics = false;
const char *bootFilename = 0;
const char *mountIso = 0;
bool readMount = false;
for (int i = 1; i < argc; i++)
{
if (readMount)
{
mountIso = argv[i];
readMount = false;
continue;
}
if (!strcmp(argv[i], "-m") || !strcmp(argv[i], "--mount"))
readMount = true;
else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--log"))
fullLog = true;
else if (!strcmp(argv[i], "-j"))
useJit = true;
else if (!strcmp(argv[i], "-f"))
fastInterpreter = true;
else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--compare"))
autoCompare = true;
else if (!strcmp(argv[i], "--graphics"))
useGraphics = true;
else if (bootFilename == 0)
bootFilename = argv[i];
else
{
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
printUsage(argv[0], NULL);
else
{
std::string reason = "Unexpected argument " + std::string(argv[i]);
printUsage(argv[0], reason.c_str());
}
return 1;
}
}
if (readMount)
{
printUsage(argv[0], "Missing argument after -m");
return 1;
}
if (!bootFilename)
{
printUsage(argv[0], argc <= 1 ? NULL : "No executable specified");
return 1;
}
HeadlessHost *headlessHost = useGraphics ? new HEADLESSHOST_CLASS() : new HeadlessHost();
host = headlessHost;
host->InitGL();
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
PrintfLogger *printfLogger = new PrintfLogger();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
logman->SetEnable(type, fullLog);
logman->SetLogLevel(type, LogTypes::LDEBUG);
logman->AddListener(type, printfLogger);
}
CoreParameter coreParameter;
coreParameter.fileToStart = bootFilename;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.cpuCore = useJit ? CPU_JIT : (fastInterpreter ? CPU_FASTINTERPRETER : CPU_INTERPRETER);
coreParameter.gpuCore = headlessHost->isGLWorking() ? GPU_GLES : GPU_NULL;
coreParameter.enableSound = false;
coreParameter.headLess = true;
coreParameter.printfEmuLog = true;
g_Config.bEnableSound = false;
g_Config.bFirstRun = false;
g_Config.bIgnoreBadMemAccess = true;
std::string error_string;
if (!PSP_Init(coreParameter, &error_string)) {
fprintf(stderr, "Failed to start %s. Error: %s\n", coreParameter.fileToStart.c_str(), error_string.c_str());
printf("TESTERROR\n");
return 1;
}
host->BootDone();
coreState = CORE_RUNNING;
//.........这里部分代码省略.........
示例3: NativeInit
//.........这里部分代码省略.........
// Enable debug logging
// Note that you must also change the max log level in Log.h.
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.");
#endif
i18nrepo.LoadIni(g_Config.languageIni);
if (!boot_filename.empty() && stateToLoad != NULL)
SaveState::Load(stateToLoad);
g_gameInfoCache.Init();
}
示例4: NativeInit
//.........这里部分代码省略.........
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=");
#if !defined(MOBILE_DEVICE)
if (!strncmp(argv[i], "--escape-exit", strlen("--escape-exit")))
g_Config.bPauseExitsEmulator = true;
#endif
break;
}
} else {
if (boot_filename.empty()) {
boot_filename = argv[i];
skipLogo = true;
FileInfo info;
if (!getFileInfo(boot_filename.c_str(), &info) || info.exists == false) {
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
}
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
}
// Special hack for G3D as it's very spammy. Need to make a flag for this.
if (!gfxLog)
logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
#endif
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
// test new languages without recompiling the entire app, which is a hassle).
const std::string langOverridePath = g_Config.memCardDirectory + "PSP/SYSTEM/lang/";
// If we run into the unlikely case that "lang" is actually a file, just use the built-in translations.
if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath))
i18nrepo.LoadIni(g_Config.sLanguageIni);
else
i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
I18NCategory *d = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
#ifdef _WIN32
// TODO: Could allow a setting to specify a font file to load?
// TODO: Make this a constant if we can sanely load the font on other systems?
AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
g_Config.sFont = d->T("Font", "Roboto");
#endif
if (!boot_filename.empty() && stateToLoad != NULL)
SaveState::Load(stateToLoad);
g_gameInfoCache.Init();
screenManager = new ScreenManager();
if (skipLogo) {
screenManager->switchScreen(new EmuScreen(boot_filename));
} else {
screenManager->switchScreen(new LogoScreen());
}
std::string sysName = System_GetProperty(SYSPROP_NAME);
isOuya = KeyMap::IsOuya(sysName);
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
MainWindow* mainWindow = new MainWindow(0);
mainWindow->show();
host = new QtHost(mainWindow);
#endif
}
示例5: NativeInit
//.........这里部分代码省略.........
boot_filename = ReplaceAll(boot_filename, "\\", "/");
#endif
skipLogo = true;
std::unique_ptr<FileLoader> fileLoader(ConstructFileLoader(boot_filename));
if (!fileLoader->Exists()) {
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_dir;
#elif defined(IOS) || defined(_WIN32)
g_Config.currentDirectory = savegame_dir;
#else
if (getenv("HOME") != NULL)
g_Config.currentDirectory = getenv("HOME");
else
g_Config.currentDirectory = "./";
#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, logLevel);
#ifdef __ANDROID__
logman->AddListener(type, logger);
#endif
}
#endif
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
// test new languages without recompiling the entire app, which is a hassle).
const std::string langOverridePath = g_Config.memStickDirectory + "PSP/SYSTEM/lang/";
// If we run into the unlikely case that "lang" is actually a file, just use the built-in translations.
if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath))
i18nrepo.LoadIni(g_Config.sLanguageIni);
else
i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
I18NCategory *des = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
// TODO: Could allow a setting to specify a font file to load?
// TODO: Make this a constant if we can sanely load the font on other systems?
AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
// The font goes by two names, let's allow either one.
if (CheckFontIsUsable(L"Roboto Condensed")) {
g_Config.sFont = des->T("Font", "Roboto Condensed");
} else {
g_Config.sFont = des->T("Font", "Roboto");
}
#endif
if (!boot_filename.empty() && stateToLoad != NULL) {
SaveState::Load(stateToLoad, [](bool status, const std::string &message, void *) {
if (!message.empty()) {
osm.Show(message, 2.0);
}
});
}
screenManager = new ScreenManager();
if (skipLogo) {
screenManager->switchScreen(new EmuScreen(boot_filename));
} else {
screenManager->switchScreen(new LogoScreen());
}
std::string sysName = System_GetProperty(SYSPROP_NAME);
isOuya = KeyMap::IsOuya(sysName);
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
MainWindow* mainWindow = new MainWindow(0,fs);
mainWindow->show();
host = new QtHost(mainWindow);
#endif
// We do this here, instead of in NativeInitGraphics, because the display may be reset.
// When it's reset we don't want to forget all our managed things.
SetGPUBackend((GPUBackend) g_Config.iGPUBackend);
if (GetGPUBackend() == GPUBackend::OPENGL) {
gl_lost_manager_init();
}
}
示例6: NativeInit
//.........这里部分代码省略.........
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'd':
// Enable debug logging
// Note that you must also change the max log level in Log.h.
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];
skipLogo = true;
FileInfo info;
if (!getFileInfo(boot_filename.c_str(), &info) || info.exists == false) {
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
}
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
}
// 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.");
#endif
i18nrepo.LoadIni(g_Config.sLanguageIni);
I18NCategory *d = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
#ifdef _WIN32
// TODO: Could allow a setting to specify a font file to load?
// TODO: Make this a constant if we can sanely load the font on other systems?
AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
g_Config.sFont = d->T("Font", "Roboto");
#endif
if (!boot_filename.empty() && stateToLoad != NULL)
SaveState::Load(stateToLoad);
g_gameInfoCache.Init();
screenManager = new ScreenManager();
if (skipLogo) {
screenManager->switchScreen(new EmuScreen(boot_filename));
} else {
screenManager->switchScreen(new LogoScreen());
}
std::string sysName = System_GetProperty(SYSPROP_NAME);
isOuya = KeyMap::IsOuya(sysName);
}
示例7: main
int main(int argc, const char* argv[])
{
bool fullLog = false;
bool useJit = true;
bool autoCompare = false;
bool useGraphics = false;
const char *bootFilename = 0;
const char *mountIso = 0;
const char *screenshotFilename = 0;
bool readMount = false;
for (int i = 1; i < argc; i++)
{
if (readMount)
{
mountIso = argv[i];
readMount = false;
continue;
}
if (!strcmp(argv[i], "-m") || !strcmp(argv[i], "--mount"))
readMount = true;
else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--log"))
fullLog = true;
else if (!strcmp(argv[i], "-i"))
useJit = false;
else if (!strcmp(argv[i], "-j"))
useJit = true;
else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--compare"))
autoCompare = true;
else if (!strcmp(argv[i], "--graphics"))
useGraphics = true;
else if (!strncmp(argv[i], "--screenshot=", strlen("--screenshot=")) && strlen(argv[i]) > strlen("--screenshot="))
screenshotFilename = argv[i] + strlen("--screenshot=");
else if (bootFilename == 0)
bootFilename = argv[i];
else
{
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
printUsage(argv[0], NULL);
else
{
std::string reason = "Unexpected argument " + std::string(argv[i]);
printUsage(argv[0], reason.c_str());
}
return 1;
}
}
if (readMount)
{
printUsage(argv[0], "Missing argument after -m");
return 1;
}
if (!bootFilename)
{
printUsage(argv[0], argc <= 1 ? NULL : "No executable specified");
return 1;
}
HeadlessHost *headlessHost = useGraphics ? new HEADLESSHOST_CLASS() : new HeadlessHost();
host = headlessHost;
std::string error_string;
bool glWorking = host->InitGL(&error_string);
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
PrintfLogger *printfLogger = new PrintfLogger();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
logman->SetEnable(type, fullLog);
logman->SetLogLevel(type, LogTypes::LDEBUG);
logman->AddListener(type, printfLogger);
}
CoreParameter coreParameter;
coreParameter.cpuCore = useJit ? CPU_JIT : CPU_INTERPRETER;
coreParameter.gpuCore = glWorking ? GPU_GLES : GPU_NULL;
coreParameter.enableSound = false;
coreParameter.fileToStart = bootFilename;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.enableDebugging = false;
coreParameter.printfEmuLog = true;
coreParameter.headLess = true;
coreParameter.renderWidth = 480;
coreParameter.renderHeight = 272;
coreParameter.outputWidth = 480;
coreParameter.outputHeight = 272;
coreParameter.pixelWidth = 480;
coreParameter.pixelHeight = 272;
coreParameter.unthrottle = true;
g_Config.bEnableSound = false;
g_Config.bFirstRun = false;
g_Config.bIgnoreBadMemAccess = true;
//.........这里部分代码省略.........
示例8: NativeInit
//.........这里部分代码省略.........
VFSRegister("", new DirectoryAssetReader(user_data_path.c_str()));
host = new NativeHost();
logger = new AndroidLogger();
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
ILOG("Logman: %p", logman);
config_filename = user_data_path + "ppsspp.ini";
g_Config.Load(config_filename.c_str());
const char *fileToLog = 0;
bool gfxLog = false;
// Parse command line
LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO;
for (int i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'd':
// Enable debug logging
logLevel = LogTypes::LDEBUG;
break;
case 'g':
gfxLog = true;
break;
case 'j':
g_Config.iCpuCore = CPU_JIT;
g_Config.bSaveSettings = false;
break;
case 'f':
g_Config.iCpuCore = CPU_FASTINTERPRETER;
g_Config.bSaveSettings = false;
break;
case 'i':
g_Config.iCpuCore = CPU_INTERPRETER;
g_Config.bSaveSettings = false;
break;
case '-':
if (!strncmp(argv[i], "--log=", strlen("--log=")) && strlen(argv[i]) > strlen("--log="))
fileToLog = argv[i] + strlen("--log=");
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);
if (g_Config.currentDirectory == "") {
#if defined(ANDROID) || defined(BLACKBERRY) || defined(__SYMBIAN32__)
g_Config.currentDirectory = external_directory;
#else
g_Config.currentDirectory = getenv("HOME");
#endif
}
#if defined(ANDROID)
// 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__)
g_Config.memCardDirectory = user_data_path;
g_Config.flashDirectory = user_data_path+"/flash/";
#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
}
// 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.");
}
示例9: main
//.........这里部分代码省略.........
testFilenames.clear();
char temp[2048];
temp[2047] = '\0';
while (scanf("%2047s", temp) == 1)
testFilenames.push_back(temp);
}
if (readMount)
{
printUsage(argv[0], "Missing argument after -m");
return 1;
}
if (testFilenames.empty())
{
printUsage(argv[0], argc <= 1 ? NULL : "No executables specified");
return 1;
}
HeadlessHost *headlessHost = getHost(gpuCore);
host = headlessHost;
std::string error_string;
bool glWorking = host->InitGL(&error_string);
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
PrintfLogger *printfLogger = new PrintfLogger();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
logman->SetEnable(type, fullLog);
logman->SetLogLevel(type, LogTypes::LDEBUG);
logman->AddListener(type, printfLogger);
}
CoreParameter coreParameter;
coreParameter.cpuCore = useJit ? CPU_JIT : CPU_INTERPRETER;
coreParameter.gpuCore = glWorking ? gpuCore : GPU_NULL;
coreParameter.enableSound = false;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.printfEmuLog = !autoCompare;
coreParameter.headLess = true;
coreParameter.renderWidth = 480;
coreParameter.renderHeight = 272;
coreParameter.pixelWidth = 480;
coreParameter.pixelHeight = 272;
coreParameter.unthrottle = true;
g_Config.bEnableSound = false;
g_Config.bFirstRun = false;
g_Config.bIgnoreBadMemAccess = true;
// Never report from tests.
g_Config.sReportHost = "";
g_Config.bAutoSaveSymbolMap = false;
g_Config.iRenderingMode = 0;
g_Config.bHardwareTransform = true;
#ifdef USING_GLES2
g_Config.iAnisotropyLevel = 0;
#else
g_Config.iAnisotropyLevel = 8;
#endif
g_Config.bVertexCache = true;
示例10: main
int main(int argc, const char* argv[])
{
bool fullLog = false;
bool useJit = true;
bool autoCompare = false;
bool useGraphics = false;
const char *bootFilename = 0;
const char *mountIso = 0;
const char *screenshotFilename = 0;
bool readMount = false;
for (int i = 1; i < argc; i++)
{
if (readMount)
{
mountIso = argv[i];
readMount = false;
continue;
}
if (!strcmp(argv[i], "-m") || !strcmp(argv[i], "--mount"))
readMount = true;
else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--log"))
fullLog = true;
else if (!strcmp(argv[i], "-i"))
useJit = false;
else if (!strcmp(argv[i], "-j"))
useJit = true;
else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--compare"))
autoCompare = true;
else if (!strcmp(argv[i], "--graphics"))
useGraphics = true;
else if (!strncmp(argv[i], "--screenshot=", strlen("--screenshot=")) && strlen(argv[i]) > strlen("--screenshot="))
screenshotFilename = argv[i] + strlen("--screenshot=");
else if (bootFilename == 0)
bootFilename = argv[i];
else
{
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
printUsage(argv[0], NULL);
else
{
std::string reason = "Unexpected argument " + std::string(argv[i]);
printUsage(argv[0], reason.c_str());
}
return 1;
}
}
if (readMount)
{
printUsage(argv[0], "Missing argument after -m");
return 1;
}
if (!bootFilename)
{
printUsage(argv[0], argc <= 1 ? NULL : "No executable specified");
return 1;
}
HeadlessHost *headlessHost = useGraphics ? new HEADLESSHOST_CLASS() : new HeadlessHost();
host = headlessHost;
std::string error_string;
host->InitGL(&error_string);
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
PrintfLogger *printfLogger = new PrintfLogger();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
logman->SetEnable(type, fullLog);
logman->SetLogLevel(type, LogTypes::LDEBUG);
logman->AddListener(type, printfLogger);
}
CoreParameter coreParameter;
coreParameter.fileToStart = bootFilename;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.cpuCore = useJit ? CPU_JIT : CPU_INTERPRETER;
coreParameter.gpuCore = headlessHost->isGLWorking() ? GPU_GLES : GPU_NULL;
coreParameter.enableSound = false;
coreParameter.headLess = true;
coreParameter.printfEmuLog = true;
coreParameter.useMediaEngine = false;
g_Config.bEnableSound = false;
g_Config.bFirstRun = false;
g_Config.bIgnoreBadMemAccess = true;
// Never report from tests.
g_Config.sReportHost = "";
#if defined(ANDROID)
#elif defined(BLACKBERRY) || defined(__SYMBIAN32__)
#elif !defined(_WIN32)
g_Config.memCardDirectory = std::string(getenv("HOME"))+"/.ppsspp/";
//.........这里部分代码省略.........
示例11: main
int main(int argc, const char* argv[])
{
bool fullLog = false;
bool useJit = false;
bool autoCompare = false;
const char *bootFilename = argc > 1 ? argv[1] : 0;
const char *mountIso = 0;
bool readMount = false;
for (int i = 2; i < argc; i++)
{
if (readMount)
{
mountIso = argv[i];
readMount = false;
continue;
}
if (!strcmp(argv[i], "-m"))
readMount = true;
else if (!strcmp(argv[i], "-l"))
fullLog = true;
else if (!strcmp(argv[i], "-j"))
useJit = true;
else if (!strcmp(argv[i], "-c"))
autoCompare = true;
}
if (!bootFilename)
{
printUsage();
return 1;
}
host = new HeadlessHost();
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
PrintfLogger *printfLogger = new PrintfLogger();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
logman->SetEnable(type, fullLog);
logman->SetLogLevel(type, LogTypes::LDEBUG);
logman->AddListener(type, printfLogger);
}
CoreParameter coreParameter;
coreParameter.fileToStart = bootFilename;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.cpuCore = useJit ? CPU_JIT : CPU_INTERPRETER;
coreParameter.gpuCore = GPU_NULL;
coreParameter.enableSound = false;
coreParameter.headLess = true;
coreParameter.printfEmuLog = true;
g_Config.bEnableSound = false;
g_Config.bFirstRun = false;
g_Config.bIgnoreBadMemAccess = true;
std::string error_string;
if (!PSP_Init(coreParameter, &error_string)) {
fprintf(stderr, "Failed to start %s. Error: %s\n", coreParameter.fileToStart.c_str(), error_string.c_str());
printf("TESTERROR\n");
return 1;
}
coreState = CORE_RUNNING;
while (coreState == CORE_RUNNING)
{
// Run for a frame at a time, just because.
u64 nowTicks = CoreTiming::GetTicks();
u64 frameTicks = usToCycles(1000000/60);
mipsr4k.RunLoopUntil(nowTicks + frameTicks);
}
// NOTE: we won't get here until I've gotten rid of the exit(0) in sceExitProcess or whatever it's called
PSP_Shutdown();
if (autoCompare)
{
std::string expect_filename = std::string(bootFilename).substr(strlen(bootFilename - 4)) + ".expected";
if (File::Exists(expect_filename))
{
// TODO: Do the compare here
}
else
{
fprintf(stderr, "Expectation file %s not found", expect_filename.c_str());
}
}
return 0;
}
示例12: NativeInit
//.........这里部分代码省略.........
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];
skipLogo = true;
FileInfo info;
if (!getFileInfo(boot_filename.c_str(), &info) || info.exists == false) {
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
}
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.bSeparateCPUThread = false;
g_Config.bSeparateIOThread = 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.");
#endif
i18nrepo.LoadIni(g_Config.sLanguageIni);
I18NCategory *d = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
#ifdef _WIN32
// TODO: Could allow a setting to specify a font file to load?
// TODO: Make this a constant if we can sanely load the font on other systems?
AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
g_Config.sFont = d->T("Font", "Roboto");
#endif
if (!boot_filename.empty() && stateToLoad != NULL)
SaveState::Load(stateToLoad);
g_gameInfoCache.Init();
screenManager = new ScreenManager();
if (boot_filename.empty()) {
#if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A) || (defined(MACOSX) && defined(_M_IX64))
if (Atrac3plus_Decoder::CanAutoInstall()) {
Atrac3plus_Decoder::DoAutoInstall();
}
#endif
}
if (skipLogo) {
screenManager->switchScreen(new EmuScreen(boot_filename));
} else {
screenManager->switchScreen(new LogoScreen(boot_filename));
}
}