您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetI18NCategory函数代码示例

51自学网 2021-06-01 21:09:05
  C++
这篇教程C++ GetI18NCategory函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetI18NCategory函数的典型用法代码示例。如果您正苦于以下问题:C++ GetI18NCategory函数的具体用法?C++ GetI18NCategory怎么用?C++ GetI18NCategory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetI18NCategory函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: UIShader_Prepare

void ErrorScreen::render(){	UIShader_Prepare();	UIBegin(UIShader_Get());	DrawBackground(1.0f);	ui_draw2d.SetFontScale(1.5f, 1.5f);	ui_draw2d.DrawText(UBUNTU24, errorTitle_.c_str(), dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER);	ui_draw2d.SetFontScale(1.0f, 1.0f);	ui_draw2d.DrawText(UBUNTU24, errorMessage_.c_str(), 40, 120, 0xFFFFFFFF, ALIGN_LEFT);	I18NCategory *g = GetI18NCategory("General");	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), 200, 0, g->T("Back"), ALIGN_BOTTOMRIGHT)) {		screenManager()->finishDialog(this, DR_OK);	}	UIEnd();}
开发者ID:CPkmn,项目名称:ppsspp,代码行数:20,


示例2: adapter

void FileSelectScreen::render() {	FileListAdapter adapter(options_, &listing_, screenManager()->getUIContext());	I18NCategory *g = GetI18NCategory("General");	UIShader_Prepare();	UIBegin(UIShader_Get());	DrawBackground(1.0f);	if (list_.Do(GEN_ID, 10, BUTTON_HEIGHT + 20, dp_xres-20, dp_yres - BUTTON_HEIGHT - 30, &adapter)) {		if (listing_[list_.selected].isDirectory) {			currentDirectory_ = listing_[list_.selected].fullName;			ILOG("%s", currentDirectory_.c_str());			updateListing();			list_.selected = -1;		} else {			std::string boot_filename = listing_[list_.selected].fullName;			ILOG("Selected: %i : %s", list_.selected, boot_filename.c_str());			list_.selected = -1;			g_Config.Save();			UIEnd();			screenManager()->switchScreen(new EmuScreen(boot_filename));			return;		}	}	ui_draw2d.DrawImageStretch(I_BUTTON, 0, 0, dp_xres, 70);	if (UIButton(GEN_ID, Pos(10,10), SMALL_BUTTON_WIDTH, 0, g->T("Up"), ALIGN_TOPLEFT)) {		currentDirectory_ = getDir(currentDirectory_);		updateListing();	}	ui_draw2d.DrawTextShadow(UBUNTU24, currentDirectory_.c_str(), 20 + SMALL_BUTTON_WIDTH, 10 + 25, 0xFFFFFFFF, ALIGN_LEFT | ALIGN_VCENTER);	if (UIButton(GEN_ID, Pos(dp_xres - 10, 10), SMALL_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT)) {		g_Config.Save();		screenManager()->switchScreen(new MenuScreen());	}	UIEnd();}
开发者ID:CPkmn,项目名称:ppsspp,代码行数:40,


示例3: GetLastError

size_t DirectoryFileHandle::Write(const u8* pointer, s64 size){	size_t bytesWritten = 0;	bool diskFull = false;#ifdef _WIN32	BOOL success = ::WriteFile(hFile, (LPVOID)pointer, (DWORD)size, (LPDWORD)&bytesWritten, 0);	if (success == FALSE) {		DWORD err = GetLastError();		diskFull = err == ERROR_DISK_FULL || err == ERROR_NOT_ENOUGH_QUOTA;	}#else	bytesWritten = write(hFile, pointer, size);	if (bytesWritten == (size_t)-1) {		diskFull = errno == ENOSPC;	}#endif	if (needsTrunc_ != -1) {		off_t off = (off_t)Seek(0, FILEMOVE_CURRENT);		if (needsTrunc_ < off) {			needsTrunc_ = off;		}	}	if (diskFull) {		// Sign extend on 64-bit.		ERROR_LOG(FILESYS, "Disk full");		I18NCategory *err = GetI18NCategory("Error");		osm.Show(err->T("Disk full while writing data"));		// We only return an error when the disk is actually full.		// When writing this would cause the disk to be full, so it wasn't written, we return 0.		if (MemoryStick_FreeSpace() == 0) {			return (size_t)(s64)(s32)SCE_KERNEL_ERROR_ERRNO_DEVICE_NO_FREE_SPACE;		}	}	return bytesWritten;}
开发者ID:VOID001,项目名称:ppsspp,代码行数:38,


示例4: GetI18NCategory

void PSPSaveDialog::DisplayBanner(int which){	I18NCategory *d = GetI18NCategory("Dialog");	PPGeDrawRect(0, 0, 480, 23, CalcFadedColor(0x65636358));	const char *title;	switch (which)	{	case DB_SAVE:		title = d->T("Save");		break;	case DB_LOAD:		title = d->T("Load");		break;	case DB_DELETE:		title = d->T("Delete");		break;	default:		title = "";		break;	}	// TODO: Draw a hexagon icon	PPGeDrawText(title, 30, 11, PPGE_ALIGN_VCENTER, 0.6f, CalcFadedColor(0xFFFFFFFF));}
开发者ID:jamesguo,项目名称:ppsspp,代码行数:23,


示例5: ERROR_LOG

void EmuScreen::bootGame(const std::string &filename) {	booted_ = true;	std::string fileToStart = filename;	CoreParameter coreParam;	coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER;	coreParam.gpuCore = g_Config.bSoftwareRendering ? GPU_SOFTWARE : GPU_GLES;	coreParam.enableSound = g_Config.bEnableSound;	coreParam.fileToStart = fileToStart;	coreParam.mountIso = "";	coreParam.startPaused = false;	coreParam.printfEmuLog = false;	coreParam.headLess = false;	if (g_Config.iInternalResolution == 0) {		coreParam.renderWidth = dp_xres;		coreParam.renderHeight = dp_yres;	} else {		if (g_Config.iInternalResolution < 0)			g_Config.iInternalResolution = 1;		coreParam.renderWidth = 480 * g_Config.iInternalResolution;		coreParam.renderHeight = 272 * g_Config.iInternalResolution;	}	coreParam.outputWidth = dp_xres;	coreParam.outputHeight = dp_yres;	coreParam.pixelWidth = pixel_xres;	coreParam.pixelHeight = pixel_yres;	std::string error_string;	if (PSP_Init(coreParam, &error_string)) {		invalid_ = false;	} else {		invalid_ = true;		errorMessage_ = error_string;		ERROR_LOG(BOOT, "%s", errorMessage_.c_str());		System_SendMessage("event", "failstartgame");		return;	}	globalUIState = UISTATE_INGAME;	host->BootDone();	host->UpdateDisassembly();	g_gameInfoCache.FlushBGs();	NOTICE_LOG(BOOT, "Loading %s...", fileToStart.c_str());	autoLoad();	I18NCategory *s = GetI18NCategory("Screen"); #ifdef _WIN32	if (g_Config.bFirstRun) {		osm.Show(s->T("PressESC", "Press ESC to open the pause menu"), 3.0f);	}#endif	memset(virtKeys, 0, sizeof(virtKeys));	const char *renderer = (const char*)glGetString(GL_RENDERER);	if (strstr(renderer, "Chainfire3D") != 0) {		osm.Show(s->T("Chainfire3DWarning", "WARNING: Chainfire3D detected, may cause problems"), 10.0f, 0xFF30a0FF, -1, true);	}	System_SendMessage("event", "startgame");}
开发者ID:716Girl,项目名称:ppsspp,代码行数:65,


示例6: UIShader_Prepare

void GraphicsScreenP2::render() {	UIShader_Prepare();	UIBegin(UIShader_Get());	DrawBackground(1.0f);	I18NCategory *g = GetI18NCategory("General");	I18NCategory *gs = GetI18NCategory("Graphics");	ui_draw2d.SetFontScale(1.5f, 1.5f);	ui_draw2d.DrawText(UBUNTU24, gs->T("Graphics Settings"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER);	ui_draw2d.SetFontScale(1.0f, 1.0f);	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) {		screenManager()->finishDialog(this, DR_OK);	}	HLinear hlinear(10, dp_yres - 10, 20.0f);	if (UIButton(GEN_ID, hlinear, LARGE_BUTTON_WIDTH + 10, 0, g->T("Prev Page"), ALIGN_BOTTOMLEFT)) {		screenManager()->switchScreen(new GraphicsScreenP1());	}	if (UIButton(GEN_ID, hlinear, LARGE_BUTTON_WIDTH + 10, 0, g->T("Next Page"), ALIGN_BOTTOMLEFT)) {		screenManager()->switchScreen(new GraphicsScreenP3());	}	int x = 30;	int y = 35;	int stride = 40;	int columnw = 400;	UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering);	bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0;	UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering);	if (AnisotropicFiltering) {		if (g_Config.iAnisotropyLevel == 0)			g_Config.iAnisotropyLevel = 2;		ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT);		HLinear hlinear1(x + 180, y, 20);		if (UIButton(GEN_ID, hlinear1, 45, 0, gs->T("2x"), ALIGN_LEFT))			g_Config.iAnisotropyLevel = 2;		if (UIButton(GEN_ID, hlinear1, 45, 0, gs->T("4x"), ALIGN_LEFT))			g_Config.iAnisotropyLevel = 4;		if (UIButton(GEN_ID, hlinear1, 45, 0, gs->T("8x"), ALIGN_LEFT))			g_Config.iAnisotropyLevel = 8;		if (UIButton(GEN_ID, hlinear1, 60, 0, gs->T("16x"), ALIGN_LEFT))			g_Config.iAnisotropyLevel = 16;		y += 20;	} else {		g_Config.iAnisotropyLevel = 0;	}	bool TexScaling = g_Config.iTexScalingLevel > 1;	UICheckBox(GEN_ID, x, y += stride, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &TexScaling);	if (TexScaling) {		if (g_Config.iTexScalingLevel <= 1)			g_Config.iTexScalingLevel = 2;		ui_draw2d.DrawText(UBUNTU24, gs->T("Type  :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT);		HLinear hlinear1(x + 180, y, 20);		if (UIButton(GEN_ID, hlinear1, 80, 0, gs->T("xBRZ"), ALIGN_LEFT))			g_Config.iTexScalingType = 0;		if (UIButton(GEN_ID, hlinear1, 150, 0, gs->T("Hybrid", "Hybrid(H)"), ALIGN_LEFT))			g_Config.iTexScalingType = 1;		if (UIButton(GEN_ID, hlinear1, 150, 0, gs->T("Bicubic", "Bicubic(B)"), ALIGN_LEFT))			g_Config.iTexScalingType = 2;		if (UIButton(GEN_ID, hlinear1, 80, 0, gs->T("H+B", "H+B"), ALIGN_LEFT))			g_Config.iTexScalingType = 3;		ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride + 20, 0xFFFFFFFF, ALIGN_LEFT);		HLinear hlinear2(x + 180, y, 20);		if (UIButton(GEN_ID, hlinear2, 45, 0, gs->T("2x"), ALIGN_LEFT))			g_Config.iTexScalingLevel = 2;		if (UIButton(GEN_ID, hlinear2, 45, 0, gs->T("3x"), ALIGN_LEFT))			g_Config.iTexScalingLevel = 3;		UICheckBox(GEN_ID, x + 60, y += stride + 20, gs->T("Deposterize"), ALIGN_LEFT, &g_Config.bTexDeposterize);	} else {		g_Config.iTexScalingLevel = 1;	}	UIEnd();}
开发者ID:jack00,项目名称:ppsspp,代码行数:80,


示例7: UIShader_Prepare

void GraphicsScreenP2::render() {	UIShader_Prepare();	UIBegin(UIShader_Get());	DrawBackground(1.0f);	I18NCategory *g = GetI18NCategory("General");	I18NCategory *gs = GetI18NCategory("Graphics");	ui_draw2d.SetFontScale(1.5f, 1.5f);	ui_draw2d.DrawText(UBUNTU24, gs->T("Graphics Settings"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER);	ui_draw2d.SetFontScale(1.0f, 1.0f);	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) {		screenManager()->finishDialog(this, DR_OK);	}	int x = 30;	int y = 30;	int stride = 40;	int columnw = 400;	if (g_Config.bBufferedRendering) {		if (UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti Aliasing"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing)) {			if (gpu)				gpu->Resized();		}	}	UICheckBox(GEN_ID, x, y += stride, gs->T("Draw Wireframe"), ALIGN_TOPLEFT, &g_Config.bDrawWireframe);	UICheckBox(GEN_ID, x, y += stride, gs->T("Display Raw Framebuffer"), ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer);	UICheckBox(GEN_ID, x, y += stride, gs->T("True Color"), ALIGN_TOPLEFT, &g_Config.bTrueColor);	bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0;	UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering);	if (AnisotropicFiltering) {		if (g_Config.iAnisotropyLevel == 0)			g_Config.iAnisotropyLevel = 2;		ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride - 5, 0xFFFFFFFF, ALIGN_LEFT);		HLinear hlinear1(x + 160 , y + 5, 20);		if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT))			g_Config.iAnisotropyLevel = 2;		if (UIButton(GEN_ID, hlinear1, 45, 0, "4x", ALIGN_LEFT))			g_Config.iAnisotropyLevel = 4;		if (UIButton(GEN_ID, hlinear1, 45, 0, "8x", ALIGN_LEFT))			g_Config.iAnisotropyLevel = 8;		if (UIButton(GEN_ID, hlinear1, 60, 0, "16x", ALIGN_LEFT))			g_Config.iAnisotropyLevel = 16;	} else {		g_Config.iAnisotropyLevel = 0;	}	bool TexScaling = g_Config.iTexScalingLevel > 1;	UICheckBox(GEN_ID, x, y += stride + 20, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &TexScaling);	if (TexScaling) {		if (g_Config.iTexScalingLevel <= 1)			g_Config.iTexScalingLevel = 2;		ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride + 5, 0xFFFFFFFF, ALIGN_LEFT);		HLinear hlinear1(x + 160 , y - 5, 20);		if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT))			g_Config.iTexScalingLevel = 2;		if (UIButton(GEN_ID, hlinear1, 45, 0, "3x", ALIGN_LEFT))			g_Config.iTexScalingLevel = 3;		HLinear hlinear2(x + 160 , y + 60, 20);		ui_draw2d.DrawText(UBUNTU24, gs->T("Type  :"), x + 60, y += stride + 20, 0xFFFFFFFF, ALIGN_LEFT);		if (UIButton(GEN_ID, hlinear2, 90, 0, "xBRZ", ALIGN_LEFT))			g_Config.iTexScalingType = 0;		if (UIButton(GEN_ID, hlinear2, 100, 0, "Hybrid", ALIGN_LEFT))			g_Config.iTexScalingType = 1;	} else {		g_Config.iTexScalingLevel = 1;	}	UIEnd();}
开发者ID:cemedine,项目名称:ppsspp,代码行数:74,


示例8: screenManager

void EmuScreen::update(InputState &input) {	globalUIState = UISTATE_INGAME;	if (errorMessage_.size()) {		screenManager()->push(new ErrorScreen(			"Error loading file",			errorMessage_));		errorMessage_ = "";		return;	}	if (invalid_)		return;	// First translate touches into native pad input.	// Do this no matter the value of g_Config.bShowTouchControls, some people	// like to use invisible controls...	// Don't force on platforms that likely don't have a touchscreen, like Win32, OSX, and Linux...	// TODO: What are good ifdefs for OSX and Linux, without breaking other mobile platforms?#ifdef _WIN32	if(g_Config.bShowTouchControls) {#endif		UpdateGamepad(input);		UpdateInputState(&input);#ifdef _WIN32	}#endif	// Then translate pad input into PSP pad input. Also, add in tilt.	static const int mapping[12][2] = {		{PAD_BUTTON_A, CTRL_CROSS},		{PAD_BUTTON_B, CTRL_CIRCLE},		{PAD_BUTTON_X, CTRL_SQUARE},		{PAD_BUTTON_Y, CTRL_TRIANGLE},		{PAD_BUTTON_UP, CTRL_UP},		{PAD_BUTTON_DOWN, CTRL_DOWN},		{PAD_BUTTON_LEFT, CTRL_LEFT},		{PAD_BUTTON_RIGHT, CTRL_RIGHT},		{PAD_BUTTON_LBUMPER, CTRL_LTRIGGER},		{PAD_BUTTON_RBUMPER, CTRL_RTRIGGER},		{PAD_BUTTON_START, CTRL_START},		{PAD_BUTTON_SELECT, CTRL_SELECT},	};	for (int i = 0; i < 12; i++) {		if (input.pad_buttons_down & mapping[i][0]) {			__CtrlButtonDown(mapping[i][1]);		}		if (input.pad_buttons_up & mapping[i][0]) {			__CtrlButtonUp(mapping[i][1]);		}	}	float stick_x = input.pad_lstick_x;	float stick_y = input.pad_lstick_y;	float rightstick_x = input.pad_rstick_x;	float rightstick_y = input.pad_rstick_y;		I18NCategory *s = GetI18NCategory("Screen"); 	// Apply tilt to left stick	if (g_Config.bAccelerometerToAnalogHoriz) {		// TODO: Deadzone, etc.		stick_x += clamp1(curve1(input.acc.y) * 2.0f);		stick_x = clamp1(stick_x);	}	__CtrlSetAnalog(stick_x, stick_y, 0);	__CtrlSetAnalog(rightstick_x, rightstick_x, 1);	if (PSP_CoreParameter().fpsLimit != 2) {		// Don't really need to show these, it's pretty obvious what unthrottle does,		// in contrast to the three state toggle		/*		if (input.pad_buttons_down & PAD_BUTTON_UNTHROTTLE) {			osm.Show(s->T("unlimited", "Speed: unlimited!"), 1.0, 0x50E0FF);		}		if (input.pad_buttons_up & PAD_BUTTON_UNTHROTTLE) {			osm.Show(s->T("standard", "Speed: standard"), 1.0);		}*/	}	if (input.pad_buttons & PAD_BUTTON_UNTHROTTLE) {		PSP_CoreParameter().unthrottle = true;	} else {		PSP_CoreParameter().unthrottle = false;	}	// Make sure fpsLimit starts at 0	if (PSP_CoreParameter().fpsLimit != 0 && PSP_CoreParameter().fpsLimit != 1 && PSP_CoreParameter().fpsLimit != 2) {		PSP_CoreParameter().fpsLimit = 0;	}	//Toggle between 3 different states of fpsLimit	if (input.pad_buttons_down & PAD_BUTTON_LEFT_THUMB) {		if (PSP_CoreParameter().fpsLimit == 0) {			PSP_CoreParameter().fpsLimit = 1;			osm.Show(s->T("fixed", "Speed: fixed"), 1.0);		}		else if (PSP_CoreParameter().fpsLimit == 1) {			PSP_CoreParameter().fpsLimit = 2;			osm.Show(s->T("unlimited", "Speed: unlimited!"), 1.0, 0x50E0FF);//.........这里部分代码省略.........
开发者ID:ScarletRhapsody,项目名称:ppsspp,代码行数:101,


示例9: bootGame

void EmuScreen::update(InputState &input) {	if (!booted_)		bootGame(gamePath_);	UIScreen::update(input);	// Simply forcibily update to the current screen size every frame. Doesn't cost much.	// If bounds is set to be smaller than the actual pixel resolution of the display, respect that.	// TODO: Should be able to use g_dpi_scale here instead. Might want to store the dpi scale in the UI context too.	const Bounds &bounds = screenManager()->getUIContext()->GetBounds();	PSP_CoreParameter().pixelWidth = pixel_xres * bounds.w / dp_xres;	PSP_CoreParameter().pixelHeight = pixel_yres * bounds.h / dp_yres;	UpdateUIState(UISTATE_INGAME);	if (errorMessage_.size()) {		// Special handling for ZIP files. It's not very robust to check an error message but meh,		// at least it's pre-translation.		if (errorMessage_.find("ZIP") != std::string::npos) {			screenManager()->push(new InstallZipScreen(gamePath_));			errorMessage_ = "";			quit_ = true;			return;		}		I18NCategory *g = GetI18NCategory("Error");		std::string errLoadingFile = g->T("Error loading file", "Could not load game");		errLoadingFile.append(" ");		errLoadingFile.append(g->T(errorMessage_.c_str()));		screenManager()->push(new PromptScreen(errLoadingFile, "OK", ""));		errorMessage_ = "";		quit_ = true;		return;	}	if (invalid_)		return;	// Virtual keys.	__CtrlSetRapidFire(virtKeys[VIRTKEY_RAPID_FIRE - VIRTKEY_FIRST]);	// Apply tilt to left stick	// TODO: Make into an axis#ifdef MOBILE_DEVICE	/*	if (g_Config.bAccelerometerToAnalogHoriz) {		// Get the "base" coordinate system which is setup by the calibration system		float base_x = g_Config.fTiltBaseX;		float base_y = g_Config.fTiltBaseY;		//convert the current input into base coordinates and normalize		//TODO: check if all phones give values between [-50, 50]. I'm not sure how iOS works.		float normalized_input_x = (input.acc.y - base_x) / 50.0 ;		float normalized_input_y = (input.acc.x - base_y) / 50.0 ;		//TODO: need a better name for computed x and y.		float delta_x =  tiltInputCurve(normalized_input_x * 2.0 * (g_Config.iTiltSensitivityX)) ;		//if the invert is enabled, invert the motion		if (g_Config.bInvertTiltX) {			delta_x *= -1;		}		float delta_y =  tiltInputCurve(normalized_input_y * 2.0 * (g_Config.iTiltSensitivityY)) ;				if (g_Config.bInvertTiltY) {			delta_y *= -1;		}		//clamp the delta between [-1, 1]		leftstick_x += clamp1(delta_x);		__CtrlSetAnalogX(clamp1(leftstick_x), CTRL_STICK_LEFT);				leftstick_y += clamp1(delta_y);		__CtrlSetAnalogY(clamp1(leftstick_y), CTRL_STICK_LEFT);	}	*/#endif	// Make sure fpsLimit starts at 0	if (PSP_CoreParameter().fpsLimit != 0 && PSP_CoreParameter().fpsLimit != 1) {		PSP_CoreParameter().fpsLimit = 0;	}	// This is here to support the iOS on screen back button.	if (pauseTrigger_) {		pauseTrigger_ = false;		screenManager()->push(new GamePauseScreen(gamePath_));	}}
开发者ID:Alwayssnarky,项目名称:ppsspp,代码行数:92,


示例10: ChangeStatusShutdown

int PSPSaveDialog::Update(int animSpeed){	if (GetStatus() != SCE_UTILITY_STATUS_RUNNING)		return SCE_ERROR_UTILITY_INVALID_STATUS;	if (!param.GetPspParam()) {		ChangeStatusShutdown(SAVEDATA_SHUTDOWN_DELAY_US);		return 0;	}	if (pendingStatus != SCE_UTILITY_STATUS_RUNNING) {		// We're actually done, we're just waiting to tell the game that.		return 0;	}	// The struct may have been updated by the game.  This happens in "Where Is My Heart?"	// Check if it has changed, reload it.	// TODO: Cut down on preloading?  This rebuilds the list from scratch.	int size = Memory::Read_U32(requestAddr);	if (memcmp(Memory::GetPointer(requestAddr), &originalRequest, size) != 0) {		memset(&request, 0, sizeof(request));		Memory::Memcpy(&request, requestAddr, size);		Memory::Memcpy(&originalRequest, requestAddr, size);		lock_guard guard(paramLock);		param.SetPspParam(&request);	}	UpdateButtons();	UpdateFade(animSpeed);	okButtonImg = I_CIRCLE;	cancelButtonImg = I_CROSS;	okButtonFlag = CTRL_CIRCLE;	cancelButtonFlag = CTRL_CROSS;	if (param.GetPspParam()->common.buttonSwap == 1) {		okButtonImg = I_CROSS;		cancelButtonImg = I_CIRCLE;		okButtonFlag = CTRL_CROSS;		cancelButtonFlag = CTRL_CIRCLE;	}	I18NCategory *di = GetI18NCategory("Dialog");	switch (display)	{		case DS_SAVE_LIST_CHOICE:			StartDraw();			DisplaySaveList();			DisplaySaveDataInfo1();			DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL);			DisplayBanner(DB_SAVE);			if (IsButtonPressed(cancelButtonFlag)) {				param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL;				StartFade(false);			} else if (IsButtonPressed(okButtonFlag)) {				// Save exist, ask user confirm				if (param.GetFileInfo(currentSelectedSave).size > 0) {					yesnoChoice = 0;					display = DS_SAVE_CONFIRM_OVERWRITE;				} else {					display = DS_SAVE_SAVING;					StartIOThread();				}			}			EndDraw();		break;		case DS_SAVE_CONFIRM:			StartDraw();			DisplaySaveIcon();			DisplaySaveDataInfo2();			DisplayMessage(di->T("Confirm Save", "Do you want to save this data?"), true);			DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL);			DisplayBanner(DB_SAVE);			if (IsButtonPressed(cancelButtonFlag) || (IsButtonPressed(okButtonFlag) && yesnoChoice == 0)) {				param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL;				StartFade(false);			} else if (IsButtonPressed(okButtonFlag)) {				display = DS_SAVE_SAVING;				StartIOThread();			}			EndDraw();		break;		case DS_SAVE_CONFIRM_OVERWRITE:			StartDraw();			DisplaySaveIcon();			DisplaySaveDataInfo2();			DisplayMessage(di->T("Confirm Overwrite","Do you want to overwrite the data?"), true);			DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL);			DisplayBanner(DB_SAVE);//.........这里部分代码省略.........
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:101,


示例11: sizeof

bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_message) {	*error_message = "ok";	hWnd = window;	GLuint PixelFormat;	// TODO: Change to use WGL_ARB_pixel_format instead	static const PIXELFORMATDESCRIPTOR pfd = {		sizeof(PIXELFORMATDESCRIPTOR),							// Size Of This Pixel Format Descriptor			1,														// Version Number			PFD_DRAW_TO_WINDOW |									// Format Must Support Window			PFD_SUPPORT_OPENGL |									// Format Must Support OpenGL			PFD_DOUBLEBUFFER,										// Must Support Double Buffering			PFD_TYPE_RGBA,											// Request An RGBA Format			24,														// Select Our Color Depth			0, 0, 0, 0, 0, 0,										// Color Bits Ignored			8,														// No Alpha Buffer			0,														// Shift Bit Ignored			0,														// No Accumulation Buffer			0, 0, 0, 0,										// Accumulation Bits Ignored			16,														// At least a 16Bit Z-Buffer (Depth Buffer)  			8,														// 8-bit Stencil Buffer			0,														// No Auxiliary Buffer			PFD_MAIN_PLANE,								// Main Drawing Layer			0,														// Reserved			0, 0, 0												// Layer Masks Ignored	};	hDC = GetDC(hWnd);	if (!hDC) {		*error_message = "Failed to get a device context.";		return false;											// Return FALSE	}	if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd)))	{		*error_message = "Can't find a suitable PixelFormat.";		return false;	}	if (!SetPixelFormat(hDC, PixelFormat, &pfd)) {		*error_message = "Can't set the PixelFormat.";		return false;	}	if (!(hRC = wglCreateContext(hDC)))	{		*error_message = "Can't create a GL rendering context.";		return false;	}	if (!wglMakeCurrent(hDC, hRC)) {		*error_message = "Can't activate the GL rendering context.";		return false;	}	// Check for really old OpenGL drivers and refuse to run really early in some cases.	// TODO: Also either tell the user to give up or point the user to the right websites. Here's some collected	// information about a system that will not work:	// GL_VERSION                        GL_VENDOR        GL_RENDERER	// "1.4.0 - Build 8.14.10.2364"      "intel"          intel Pineview Platform	I18NCategory *err = GetI18NCategory("Error");	std::string glVersion = (const char *)glGetString(GL_VERSION);	std::string glRenderer = (const char *)glGetString(GL_RENDERER);	const std::string openGL_1 = "1.";	if (glRenderer == "GDI Generic" || glVersion.substr(0, openGL_1.size()) == openGL_1) {		//The error may come from 16-bit colour mode		//Check Colour depth 		HDC dc = GetDC(NULL);		u32 colour_depth = GetDeviceCaps(dc, BITSPIXEL);		ReleaseDC(NULL, dc);		if (colour_depth != 32){			MessageBox(0, L"Please switch your display to 32-bit colour mode", L"OpenGL Error", MB_OK);			ExitProcess(1);		}		const char *defaultError = "Insufficient OpenGL driver support detected!/n/n"			"Your GPU reports that it does not support OpenGL 2.0. Would you like to try using DirectX 9 instead?/n/n"			"DirectX is currently compatible with less games, but on your GPU it may be the only choice./n/n"			"Visit the forums at http://forums.ppsspp.org for more information./n/n";		std::wstring versionDetected = ConvertUTF8ToWString(glVersion + "/n/n");		std::wstring error = ConvertUTF8ToWString(err->T("InsufficientOpenGLDriver", defaultError));		std::wstring title = ConvertUTF8ToWString(err->T("OpenGLDriverError", "OpenGL driver error"));		std::wstring combined = versionDetected + error;		bool yes = IDYES == MessageBox(hWnd, combined.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);		if (yes) {			// Change the config to D3D and restart.			g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9;			g_Config.Save();			W32Util::ExitAndRestart();		}		// Avoid further error messages. Let's just bail, it's safe, and we can't continue.		ExitProcess(1);	}//.........这里部分代码省略.........
开发者ID:Resharc,项目名称:ppsspp,代码行数:101,


示例12: Process

	void Process()	{#ifndef MOBILE_DEVICE		if (g_Config.iRewindFlipFrequency != 0 && gpuStats.numFlips != 0)			CheckRewindState();#endif		if (!needsProcess)			return;		needsProcess = false;		if (!__KernelIsRunning())		{			ERROR_LOG(COMMON, "Savestate failure: Unable to load without kernel, this should never happen.");			return;		}		std::vector<Operation> operations = Flush();		SaveStart state;		for (size_t i = 0, n = operations.size(); i < n; ++i)		{			Operation &op = operations[i];			CChunkFileReader::Error result;			bool callbackResult;			std::string callbackMessage;			std::string reason;			I18NCategory *sc = GetI18NCategory("Screen");			const char *i18nLoadFailure = sc->T("Load savestate failed", "");			const char *i18nSaveFailure = sc->T("Save State Failed", "");			if (strlen(i18nLoadFailure) == 0)				i18nLoadFailure = sc->T("Failed to load state");			if (strlen(i18nSaveFailure) == 0)				i18nSaveFailure = sc->T("Failed to save state");			switch (op.type)			{			case SAVESTATE_LOAD:				INFO_LOG(COMMON, "Loading state from %s", op.filename.c_str());				result = CChunkFileReader::Load(op.filename, PPSSPP_GIT_VERSION, state, &reason);				if (result == CChunkFileReader::ERROR_NONE) {					callbackMessage = sc->T("Loaded State");					callbackResult = true;					hasLoadedState = true;				} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {					HandleFailure();					callbackMessage = i18nLoadFailure;					ERROR_LOG(COMMON, "Load state failure: %s", reason.c_str());					callbackResult = false;				} else {					callbackMessage = sc->T(reason.c_str(), i18nLoadFailure);					callbackResult = false;				}				break;			case SAVESTATE_SAVE:				INFO_LOG(COMMON, "Saving state to %s", op.filename.c_str());				result = CChunkFileReader::Save(op.filename, g_paramSFO.GetValueString("TITLE"), PPSSPP_GIT_VERSION, state);				if (result == CChunkFileReader::ERROR_NONE) {					callbackMessage = sc->T("Saved State");					callbackResult = true;				} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {					HandleFailure();					callbackMessage = i18nSaveFailure;					ERROR_LOG(COMMON, "Save state failure: %s", reason.c_str());					callbackResult = false;				} else {					callbackMessage = i18nSaveFailure;					callbackResult = false;				}				break;			case SAVESTATE_VERIFY:				callbackResult = CChunkFileReader::Verify(state) == CChunkFileReader::ERROR_NONE;				if (callbackResult) {					INFO_LOG(COMMON, "Verified save state system");				} else {					ERROR_LOG(COMMON, "Save state system verification failed");				}				break;			case SAVESTATE_REWIND:				INFO_LOG(COMMON, "Rewinding to recent savestate snapshot");				result = rewindStates.Restore();				if (result == CChunkFileReader::ERROR_NONE) {					callbackMessage = sc->T("Loaded State");					callbackResult = true;					hasLoadedState = true;				} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {					// Cripes.  Good news is, we might have more.  Let's try those too, better than a reset.					if (HandleFailure()) {						// Well, we did rewind, even if too much...						callbackMessage = sc->T("Loaded State");						callbackResult = true;						hasLoadedState = true;					} else {						callbackMessage = i18nLoadFailure;						callbackResult = false;					}//.........这里部分代码省略.........
开发者ID:Ruin0x11,项目名称:ppsspp,代码行数:101,


示例13: Process

	void Process()	{		if (!needsProcess)			return;		needsProcess = false;		if (!__KernelIsRunning())		{			ERROR_LOG(COMMON, "Savestate failure: Unable to load without kernel, this should never happen.");			return;		}		std::vector<Operation> operations = Flush();		SaveStart state;		for (size_t i = 0, n = operations.size(); i < n; ++i)		{			Operation &op = operations[i];			bool result;			std::string reason;			I18NCategory *s = GetI18NCategory("Screen"); 			switch (op.type)			{			case SAVESTATE_LOAD:				if (MIPSComp::jit)					MIPSComp::jit->ClearCache();				INFO_LOG(COMMON, "Loading state from %s", op.filename.c_str());				result = CChunkFileReader::Load(op.filename, REVISION, state, &reason);				if(result)					osm.Show(s->T("Loaded State"), 2.0);				else {					osm.Show(s->T(reason.c_str(), "Load savestate failed"), 2.0);				}				break;			case SAVESTATE_SAVE:				if (MIPSComp::jit)					MIPSComp::jit->ClearCache();				INFO_LOG(COMMON, "Saving state to %s", op.filename.c_str());				result = CChunkFileReader::Save(op.filename, REVISION, state);				if(result)					osm.Show(s->T("Saved State"), 2.0);				else					osm.Show(s->T("Save State Failed"), 2.0);				break;			case SAVESTATE_VERIFY:				INFO_LOG(COMMON, "Verifying save state system");				result = CChunkFileReader::Verify(state);				break;			default:				ERROR_LOG(COMMON, "Savestate failure: unknown operation type %d", op.type);				result = false;				break;			}			if (op.callback != NULL)				op.callback(result, op.cbUserData);		}	}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:63,


示例14: DEBUG_LOG

bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, FileAccess access, u32 &error){	error = 0;#if HOST_IS_CASE_SENSITIVE	if (access & (FILEACCESS_APPEND|FILEACCESS_CREATE|FILEACCESS_WRITE))	{		DEBUG_LOG(FILESYS, "Checking case for path %s", fileName.c_str());		if ( ! FixPathCase(basePath, fileName, FPC_PATH_MUST_EXIST) )			return false;  // or go on and attempt (for a better error code than just 0?)	}	// else we try fopen first (in case we're lucky) before simulating case insensitivity#endif	std::string fullName = GetLocalPath(basePath,fileName);	DEBUG_LOG(FILESYS,"Actually opening %s", fullName.c_str());	// On the PSP, truncating doesn't lose data.  If you seek later, you'll recover it.	// This is abnormal, so we deviate from the PSP's behavior and truncate on write/close.	// This means it's incorrectly not truncated before the write.	if (access & FILEACCESS_TRUNCATE) {		needsTrunc_ = 0;	}	//TODO: tests, should append seek to end of file? seeking in a file opened for append?#ifdef _WIN32	// Convert parameters to Windows permissions and access	DWORD desired = 0;	DWORD sharemode = 0;	DWORD openmode = 0;	if (access & FILEACCESS_READ) {		desired   |= GENERIC_READ;		sharemode |= FILE_SHARE_READ;	}	if (access & FILEACCESS_WRITE) {		desired   |= GENERIC_WRITE;		sharemode |= FILE_SHARE_WRITE;	}	if (access & FILEACCESS_CREATE) {		openmode = OPEN_ALWAYS;	} else {		openmode = OPEN_EXISTING;	}	//Let's do it!	hFile = CreateFile(ConvertUTF8ToWString(fullName).c_str(), desired, sharemode, 0, openmode, 0, 0);	bool success = hFile != INVALID_HANDLE_VALUE;	if (!success) {		DWORD w32err = GetLastError();		if (w32err == ERROR_DISK_FULL || w32err == ERROR_NOT_ENOUGH_QUOTA) {			// This is returned when the disk is full.			I18NCategory *err = GetI18NCategory("Error");			osm.Show(err->T("Disk full while writing data"));			error = SCE_KERNEL_ERROR_ERRNO_NO_PERM;		}	}#else	int flags = 0;	if (access & FILEACCESS_APPEND) {		flags |= O_APPEND;	}	if ((access & FILEACCESS_READ) && (access & FILEACCESS_WRITE)) {		flags |= O_RDWR;	} else if (access & FILEACCESS_READ) {		flags |= O_RDONLY;	} else if (access & FILEACCESS_WRITE) {		flags |= O_WRONLY;	}	if (access & FILEACCESS_CREATE) {		flags |= O_CREAT;	}	hFile = open(fullName.c_str(), flags, 0666);	bool success = hFile != -1;#endif#if HOST_IS_CASE_SENSITIVE	if (!success && !(access & FILEACCESS_CREATE)) {		if ( ! FixPathCase(basePath,fileName, FPC_PATH_MUST_EXIST) )			return 0;  // or go on and attempt (for a better error code than just 0?)		fullName = GetLocalPath(basePath,fileName); 		const char *fullNameC = fullName.c_str();		DEBUG_LOG(FILESYS, "Case may have been incorrect, second try opening %s (%s)", fullNameC, fileName.c_str());		// And try again with the correct case this time#ifdef _WIN32		hFile = CreateFile(fullNameC, desired, sharemode, 0, openmode, 0, 0);		success = hFile != INVALID_HANDLE_VALUE;#else		hFile = open(fullNameC, flags, 0666);		success = hFile != -1;#endif	}#endif#ifndef _WIN32	if (success) {		struct stat st;		if (fstat(hFile, &st) == 0 && S_ISDIR(st.st_mode)) {			close(hFile);//.........这里部分代码省略.........
开发者ID:VOID001,项目名称:ppsspp,代码行数:101,


示例15: WndProc

	LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)	{		int wmId, wmEvent;		std::string fn;		I18NCategory *g = GetI18NCategory("Graphics");		switch (message) 		{		case WM_CREATE:			loadControlsFromFile();			break;		case WM_MOVE:			SavePosition();			ResizeDisplay();			break;		case WM_SIZE:			SavePosition();			ResizeDisplay();			break;		case WM_TIMER:			// Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode.			if (g_bFullScreen && globalUIState == UISTATE_INGAME) {				ShowCursor(FALSE);			} else {				ShowCursor(TRUE);				SetCursor(LoadCursor(NULL, IDC_ARROW));			}			SetTimer(hWnd, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);			return 0;		case WM_COMMAND:			wmId    = LOWORD(wParam); 			wmEvent = HIWORD(wParam); 			// Parse the menu selections:			switch (wmId)			{			case ID_FILE_LOAD:				BrowseAndBoot("");				break;			case ID_FILE_LOAD_MEMSTICK:				{					std::string memStickDir, flash0dir;					GetSysDirectories(memStickDir, flash0dir);					memStickDir += "PSP//GAME//";					BrowseAndBoot(memStickDir);				}				break;			case ID_FILE_REFRESHGAMELIST:				break;			case ID_FILE_MEMSTICK:				{					std::string memStickDir, flash0dir;					GetSysDirectories(memStickDir, flash0dir);					ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW);				}				break;			case ID_EMULATION_RUN:				if (Core_IsStepping()) {					Core_EnableStepping(false);				} else {					NativeMessageReceived("run", "");				}				if (disasmWindow[0])					SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);				break;			case ID_EMULATION_STOP:				if (memoryWindow[0]) {					SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);				}				if (disasmWindow[0]) {					SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);				}				if (Core_IsStepping()) {					Core_EnableStepping(false);				}				NativeMessageReceived("stop", "");				SetPlaying(0);				Update();				break;			case ID_EMULATION_PAUSE:				if (disasmWindow[0])				{					SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOP, 0);				} else if (globalUIState == UISTATE_INGAME) {					Core_EnableStepping(true);				}				break;			case ID_EMULATION_RESET:				NativeMessageReceived("reset", "");//.........这里部分代码省略.........
开发者ID:CPkmn,项目名称:ppsspp,代码行数:101,


示例16: UIShader_Prepare

void PauseScreen::render() {	UIShader_Prepare();	UIBegin(UIShader_Get());	DrawBackground(1.0f);	std::string title = game_title.c_str();	// Try to ignore (tm) etc.	//if (UTF8StringNonASCIICount(game_title.c_str()) > 2) {	//	title = "(can't display japanese title)";	//} else {	//}	UIContext *ctx = screenManager()->getUIContext();	// This might create a texture so we must flush first.	UIFlush();	GameInfo *ginfo = g_gameInfoCache.GetInfo(PSP_CoreParameter().fileToStart, true);	if (ginfo) {		title = ginfo->title;	}	if (ginfo && ginfo->pic1Texture) {		ginfo->pic1Texture->Bind(0);		uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0;		ui_draw2d.DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color);		ui_draw2d.Flush();		ctx->RebindTexture();	}	if (ginfo && ginfo->pic0Texture) {		ginfo->pic0Texture->Bind(0);		// Pic0 is drawn in the bottom right corner, overlaying pic1.		float sizeX = dp_xres / 480 * ginfo->pic0Texture->Width();		float sizeY = dp_yres / 272 * ginfo->pic0Texture->Height();		uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 2)) & 0xFFc0c0c0;		ui_draw2d.DrawTexRect(dp_xres - sizeX, dp_yres - sizeY, dp_xres, dp_yres, 0,0,1,1,color);		ui_draw2d.Flush();		ctx->RebindTexture();	}	if (ginfo && ginfo->iconTexture) {		uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timeIconWasLoaded) * 1.5));		ginfo->iconTexture->Bind(0);		ui_draw2d.DrawTexRect(10,10,10+144, 10+80, 0,0,1,1,0xFFFFFFFF);		ui_draw2d.Flush();		ctx->RebindTexture();	}	ui_draw2d.DrawText(UBUNTU24, title.c_str(), 10+144+10, 30, 0xFFFFFFFF, ALIGN_LEFT);	int x = 30;	int y = 50;	int stride = 40;	int columnw = 400;	// Shared with settings	I18NCategory *ss = GetI18NCategory("System");	I18NCategory *gs = GetI18NCategory("Graphics");	UICheckBox(GEN_ID, x, y += stride, ss->T("Show Debug Statistics"), ALIGN_TOPLEFT, &g_Config.bShowDebugStats);	UICheckBox(GEN_ID, x, y += stride, ss->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter);	// TODO: Maybe shouldn't show this if the screen ratios are very close...	UICheckBox(GEN_ID, x, y += stride, gs->T("Stretch to Display"), ALIGN_TOPLEFT, &g_Config.bStretchToDisplay);	UICheckBox(GEN_ID, x, y += stride, gs->T("Hardware Transform"), ALIGN_TOPLEFT, &g_Config.bHardwareTransform);	if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) {		if (gpu)			gpu->Resized();	}	bool fs = g_Config.iFrameSkip == 1;	UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &fs);	UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine);	g_Config.iFrameSkip = fs ? 1 : 0;	I18NCategory *i = GetI18NCategory("Pause");	// TODO: Add UI for more than one slot.	HLinear hlinear1(x, y + 80, 20);	if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, 0, i->T("Save State"), ALIGN_LEFT)) {		SaveState::SaveSlot(0, 0, 0);		screenManager()->finishDialog(this, DR_CANCEL);	}	if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, 0, i->T("Load State"), ALIGN_LEFT)) {		SaveState::LoadSlot(0, 0, 0);		screenManager()->finishDialog(this, DR_CANCEL);	}	VLinear vlinear(dp_xres - 10, 160, 20);	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Continue"), ALIGN_RIGHT)) {		screenManager()->finishDialog(this, DR_CANCEL);	}	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Settings"), ALIGN_RIGHT)) {		screenManager()->push(new SettingsScreen(), 0);	}	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Back to Menu"), ALIGN_RIGHT)) {		screenManager()->finishDialog(this, DR_OK);//.........这里部分代码省略.........
开发者ID:wargio,项目名称:ppsspp,代码行数:101,


示例17: LoadD3D11

bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {	hWnd_ = wnd;	LoadD3D11Error result = LoadD3D11();	HRESULT hr = E_FAIL;	std::vector<std::string> adapterNames;	std::string chosenAdapterName;	if (result == LoadD3D11Error::SUCCESS) {		std::vector<IDXGIAdapter *> adapters;		int chosenAdapter = 0;		IDXGIFactory * pFactory = nullptr;		ptr_CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&pFactory);		IDXGIAdapter *pAdapter;		for (UINT i = 0; pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND; i++) {			adapters.push_back(pAdapter);			DXGI_ADAPTER_DESC desc;			pAdapter->GetDesc(&desc);			std::string str = ConvertWStringToUTF8(desc.Description);			adapterNames.push_back(str);			if (str == g_Config.sD3D11Device) {				chosenAdapter = i;			}		}		chosenAdapterName = adapterNames[chosenAdapter];		hr = CreateTheDevice(adapters[chosenAdapter]);		for (int i = 0; i < (int)adapters.size(); i++) {			adapters[i]->Release();		}	}	if (FAILED(hr)) {		const char *defaultError = "Your GPU does not appear to support Direct3D 11./n/nWould you like to try again using Direct3D 9 instead?";		I18NCategory *err = GetI18NCategory("Error");		std::wstring error;		if (result == LoadD3D11Error::FAIL_NO_COMPILER) {			error = ConvertUTF8ToWString(err->T("D3D11CompilerMissing", "D3DCompiler_47.dll not found. Please install. Or press Yes to try again using Direct3D9 instead."));		} else if (result == LoadD3D11Error::FAIL_NO_D3D11) {			error = ConvertUTF8ToWString(err->T("D3D11Missing", "Your operating system version does not include D3D11. Please run Windows Update./n/nPress Yes to try again using Direct3D9 instead."));		}		error = ConvertUTF8ToWString(err->T("D3D11NotSupported", defaultError));		std::wstring title = ConvertUTF8ToWString(err->T("D3D11InitializationError", "Direct3D 11 initialization error"));		bool yes = IDYES == MessageBox(hWnd_, error.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);		if (yes) {			// Change the config to D3D9 and restart.			g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;			g_Config.sFailedGPUBackends.clear();			g_Config.Save("save_d3d9_fallback");			W32Util::ExitAndRestart();		}		return false;	}	if (FAILED(device_->QueryInterface(__uuidof (ID3D11Device1), (void **)&device1_))) {		device1_ = nullptr;	}	if (FAILED(context_->QueryInterface(__uuidof (ID3D11DeviceContext1), (void **)&context1_))) {		context1_ = nullptr;	}#ifdef _DEBUG	if (SUCCEEDED(device_->QueryInterface(__uuidof(ID3D11Debug), (void**)&d3dDebug_))) {		if (SUCCEEDED(d3dDebug_->QueryInterface(__uuidof(ID3D11InfoQueue), (void**)&d3dInfoQueue_))) {			d3dInfoQueue_->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);			d3dInfoQueue_->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true);			d3dInfoQueue_->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, true);		}	}#endif	draw_ = Draw::T3DCreateD3D11Context(device_, context_, device1_, context1_, featureLevel_, hWnd_, adapterNames);	SetGPUBackend(GPUBackend::DIRECT3D11, chosenAdapterName);	bool success = draw_->CreatePresets();  // If we can run D3D11, there's a compiler installed. I think.	_assert_msg_(G3D, success, "Failed to compile preset shaders");	int width;	int height;	GetRes(hWnd_, width, height);	// Obtain DXGI factory from device (since we used nullptr for pAdapter above)	IDXGIFactory1* dxgiFactory = nullptr;	IDXGIDevice* dxgiDevice = nullptr;	IDXGIAdapter* adapter = nullptr;	hr = device_->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgiDevice));	if (SUCCEEDED(hr)) {		hr = dxgiDevice->GetAdapter(&adapter);		if (SUCCEEDED(hr)) {			hr = adapter->GetParent(__uuidof(IDXGIFactory1), reinterpret_cast<void**>(&dxgiFactory));			DXGI_ADAPTER_DESC desc;			adapter->GetDesc(&desc);			adapter->Release();		}		dxgiDevice->Release();//.........这里部分代码省略.........
开发者ID:hrydgard,项目名称:ppsspp,代码行数:101,


示例18: WndProc

	LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)	{		int wmId, wmEvent;		std::string fn;		switch (message) 		{		case WM_CREATE:			break;		case WM_MOVE:			SavePosition();			ResizeDisplay();			break;		case WM_SIZE:			SavePosition();			ResizeDisplay();			break;		case WM_TIMER:			// Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode.			switch (wParam)			{			case TIMER_CURSORUPDATE:				CorrectCursor();				return 0;			case TIMER_CURSORMOVEUPDATE:				hideCursor = true;				KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);				return 0;			}			break;		// For some reason, need to catch this here rather than in DisplayProc.		case WM_MOUSEWHEEL:			{				int wheelDelta = (short)(wParam >> 16);				KeyInput key;				key.deviceId = DEVICE_ID_MOUSE;				if (wheelDelta < 0) {					key.keyCode = KEYCODE_EXT_MOUSEWHEEL_DOWN;					wheelDelta = -wheelDelta;				} else {					key.keyCode = KEYCODE_EXT_MOUSEWHEEL_UP;				}				// There's no separate keyup event for mousewheel events, let's pass them both together.				// This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something.				key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16);				NativeKey(key);				break;			}		case WM_COMMAND:			{			if (!EmuThread_Ready())				return DefWindowProc(hWnd, message, wParam, lParam);			I18NCategory *g = GetI18NCategory("Graphics");			wmId    = LOWORD(wParam); 			wmEvent = HIWORD(wParam); 			// Parse the menu selections:			switch (wmId)			{			case ID_FILE_LOAD:				BrowseAndBoot("");				break;			case ID_FILE_LOAD_MEMSTICK:				{					std::string memStickDir, flash0dir;					GetSysDirectories(memStickDir, flash0dir);					memStickDir += "PSP//GAME//";					BrowseAndBoot(memStickDir);				}				break;			case ID_FILE_REFRESHGAMELIST:				break;			case ID_FILE_MEMSTICK:				{					std::string memStickDir, flash0dir;					GetSysDirectories(memStickDir, flash0dir);					ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW);				}				break;			case ID_TOGGLE_PAUSE:				if (globalUIState == UISTATE_PAUSEMENU)				{					NativeMessageReceived("run", "");					if (disasmWindow[0])						SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);				}				else if (Core_IsStepping()) //It is paused, then continue to run				{					if (disasmWindow[0])						SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);//.........这里部分代码省略.........
开发者ID:Micket,项目名称:ppsspp,代码行数:101,


示例19: GetI18NCategory

void EmuScreen::onVKeyDown(int virtualKeyCode) {	I18NCategory *s = GetI18NCategory("Screen"); 	switch (virtualKeyCode) {	case VIRTKEY_UNTHROTTLE:		PSP_CoreParameter().unthrottle = true;		break;	case VIRTKEY_SPEED_TOGGLE:		if (PSP_CoreParameter().fpsLimit == 0) {			PSP_CoreParameter().fpsLimit = 1;			osm.Show(s->T("fixed", "Speed: alternate"), 1.0);		}		else if (PSP_CoreParameter().fpsLimit == 1) {			PSP_CoreParameter().fpsLimit = 0;			osm.Show(s->T("standard", "Speed: standard"), 1.0);		}		break;	case VIRTKEY_PAUSE:		pauseTrigger_ = true;		break;	case VIRTKEY_AXIS_X_MIN:	case VIRTKEY_AXIS_X_MAX:		setVKeyAnalogX(CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);		break;	case VIRTKEY_AXIS_Y_MIN:	case VIRTKEY_AXIS_Y_MAX:		setVKeyAnalogY(CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);		break;	case VIRTKEY_AXIS_RIGHT_X_MIN:	case VIRTKEY_AXIS_RIGHT_X_MAX:		setVKeyAnalogX(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);		break;	case VIRTKEY_AXIS_RIGHT_Y_MIN:	case VIRTKEY_AXIS_RIGHT_Y_MAX:		setVKeyAnalogY(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);		break;	case VIRTKEY_REWIND:		if (SaveState::CanRewind()) {			SaveState::Rewind();		} else {			osm.Show(s->T("norewind", "No rewind save states available"), 2.0);		}		break;	case VIRTKEY_SAVE_STATE:		SaveState::SaveSlot(g_Config.iCurrentStateSlot, 0);		break;	case VIRTKEY_LOAD_STATE:		if (SaveState::HasSaveInSlot(g_Config.iCurrentStateSlot)) {			SaveState::LoadSlot(g_Config.iCurrentStateSlot, 0);		}		break;	case VIRTKEY_NEXT_SLOT:		SaveState::NextSlot();		break;	case VIRTKEY_TOGGLE_FULLSCREEN:		System_SendMessage("toggle_fullscreen", "");		break;	}}
开发者ID:Alwayssnarky,项目名称:ppsspp,代码行数:64,


示例20: GetI18NCategory

void PSPSaveDialog::DisplaySaveDataInfo1(){	if (param.GetFileInfo(currentSelectedSave).size == 0) {		I18NCategory *d = GetI18NCategory("Dialog");		PPGeDrawText(d->T("NEW DATA"), 180, 136, PPGE_ALIGN_VCENTER, 0.6f, CalcFadedColor(0xFFFFFFFF));	} else {		char title[512];		char time[512];		char saveTitle[512];		char saveDetail[512];		char am_pm[] = "AM";		char hour_time[10] ;		int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour;		int min  = param.GetFileInfo(currentSelectedSave).modif_time.tm_min;		switch (g_Config.iTimeFormat) {		case 1:			if (hour > 12) {				strcpy(am_pm, "PM");				hour -= 12;			}			snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm);			break;		case 2:			snprintf(hour_time,10,"%02d:%02d", hour, min); 			break;		default:			if (hour > 12) {				strcpy(am_pm, "PM");				hour -= 12;			}			snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm);		}		snprintf(title, 512, "%s", param.GetFileInfo(currentSelectedSave).title);		int day   = param.GetFileInfo(currentSelectedSave).modif_time.tm_mday;		int month = param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1;		int year  = param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900;		s64 sizeK = param.GetFileInfo(currentSelectedSave).size / 1024;		switch (g_Config.iDateFormat) {		case 1:			snprintf(time, 512, "%d/%02d/%02d   %s  %lld KB", year, month, day, hour_time, sizeK);			break;		case 2:			snprintf(time, 512, "%02d/%02d/%d   %s  %lld KB", month, day, year, hour_time, sizeK);			break;		case 3:			snprintf(time, 512, "%02d/%02d/%d   %s  %lld KB", day, month, year, hour_time, sizeK);			break;		default:			snprintf(time, 512, "%d/%02d/%02d   %s  %lld KB", year, month, day, hour_time, sizeK);		}		snprintf(saveTitle, 512, "%s", param.GetFileInfo(currentSelectedSave).saveTitle);		snprintf(saveDetail, 512, "%s", param.GetFileInfo(currentSelectedSave).saveDetail);				PPGeDrawRect(180, 136, 980, 137, CalcFadedColor(0xFFFFFFFF));		std::string titleTxt = title;		std::string timeTxt = time;		std::string saveTitleTxt = saveTitle;		std::string saveDetailTxt = saveDetail;		PPGeDrawText(titleTxt.c_str(), 181, 138, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0x80000000));		PPGeDrawText(titleTxt.c_str(), 180, 136, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0xFFC0C0C0));		PPGeDrawText(timeTxt.c_str(), 181, 139, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000));		PPGeDrawText(timeTxt.c_str(), 180, 137, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));		PPGeDrawText(saveTitleTxt.c_str(), 176, 162, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0x80000000));		PPGeDrawText(saveTitleTxt.c_str(), 175, 159, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0xFFFFFFFF));		PPGeDrawText(saveDetailTxt.c_str(), 176, 183, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000));		PPGeDrawText(saveDetailTxt.c_str(), 175, 181, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));	}}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:71,


示例21: GL_Init

bool GL_Init(HWND window, std::string *error_message) {	*error_message = "ok";	hWnd = window;	GLuint PixelFormat;	// TODO: Change to use WGL_ARB_pixel_format instead	static const PIXELFORMATDESCRIPTOR pfd = {		sizeof(PIXELFORMATDESCRIPTOR),							// Size Of This Pixel Format Descriptor			1,														// Version Number			PFD_DRAW_TO_WINDOW |									// Format Must Support Window			PFD_SUPPORT_OPENGL |									// Format Must Support OpenGL			PFD_DOUBLEBUFFER,										// Must Support Double Buffering			PFD_TYPE_RGBA,											// Request An RGBA Format			24,														// Select Our Color Depth			0, 0, 0, 0, 0, 0,										// Color Bits Ignored			8,														// No Alpha Buffer			0,														// Shift Bit Ignored			0,														// No Accumulation Buffer			0, 0, 0, 0,										// Accumulation Bits Ignored			16,														// At least a 16Bit Z-Buffer (Depth Buffer)  			8,														// 8-bit Stencil Buffer			0,														// No Auxiliary Buffer			PFD_MAIN_PLANE,								// Main Drawing Layer			0,														// Reserved			0, 0, 0												// Layer Masks Ignored	};	hDC = GetDC(hWnd);	if (!hDC) {		*error_message = "Failed to get a device context.";		return false;											// Return FALSE	}	if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd)))	{		*error_message = "Can't find a suitable PixelFormat.";		return false;	}	if (!SetPixelFormat(hDC, PixelFormat, &pfd)) {		*error_message = "Can't set the PixelFormat.";		return false;	}	if (!(hRC = wglCreateContext(hDC)))	{		*error_message = "Can't create a GL rendering context.";		return false;	}	if (!wglMakeCurrent(hDC, hRC)) {		*error_message = "Can't activate the GL rendering context.";		return false;	}	// Check for really old OpenGL drivers and refuse to run really early in some cases.	// TODO: Also either tell the user to give up or point the user to the right websites. Here's some collected	// information about a system that will not work:	// GL_VERSION                        GL_VENDOR        GL_RENDERER	// "1.4.0 - Build 8.14.10.2364"      "intel"          intel Pineview Platform	I18NCategory *err = GetI18NCategory("Error");	std::string glVersion = (const char *)glGetString(GL_VERSION);	std::string glRenderer = (const char *)glGetString(GL_RENDERER);	const std::string openGL_1 = "1.";	if (glRenderer == "GDI Generic" || glVersion.substr(0, openGL_1.size()) == openGL_1) {		const char *defaultError = "Insufficient OpenGL driver support detected!/n/n"			"Your GPU reports that it does not support OpenGL 2.0, which is currently required for PPSSPP to run./n/n"			"Please check that your GPU is compatible with OpenGL 2.0.If it is, you need to find and install new graphics drivers from your GPU vendor's website./n/n"			"Visit the forums at http://forums.ppsspp.org for more information./n/n";		std::wstring versionDetected = ConvertUTF8ToWString(glVersion + "/n/n");		std::wstring error = ConvertUTF8ToWString(err->T("InsufficientOpenGLDriver", defaultError));		std::wstring title = ConvertUTF8ToWString(err->T("OpenGLDriverError", "OpenGL driver error"));		std::wstring combined = versionDetected + error;		MessageBox(hWnd, combined.c_str(), title.c_str(), MB_ICONERROR);		// Avoid further error messages. Let's just bail, it's safe, and we can't continue.		ExitProcess(0);	}	if (GLEW_OK != glewInit()) {		*error_message = "Failed to initialize GLEW.";		return false;	}	CheckGLExtensions();	int contextFlags = enableGLDebug ? WGL_CONTEXT_DEBUG_BIT_ARB : 0;	// Alright, now for the modernity. First try a 4.4, then 4.3, context, if that fails try 3.3.	// I can't seem to find a way that lets you simply request the newest version available.	const int attribs44[] = {		WGL_CONTEXT_MAJOR_VERSION_ARB, 4,		WGL_CONTEXT_MINOR_VERSION_ARB, 4,		WGL_CONTEXT_FLAGS_ARB, contextFlags,		WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,//.........这里部分代码省略.........
开发者ID:18859966862,项目名称:ppsspp,代码行数:101,


示例22: switch

int PSPSaveDialog::Update(){	switch (status) {	case SCE_UTILITY_STATUS_FINISHED:		status = SCE_UTILITY_STATUS_SHUTDOWN;		break;	default:		break;	}	if (status != SCE_UTILITY_STATUS_RUNNING)		return SCE_ERROR_UTILITY_INVALID_STATUS;	if (!param.GetPspParam()) {		status = SCE_UTILITY_STATUS_SHUTDOWN;		return 0;	}	// The struct may have been updated by the game.  This happens in "Where Is My Heart?"	// Check if it has changed, reload it.	// TODO: Cut down on preloading?  This rebuilds the list from scratch.	int size = Memory::Read_U32(requestAddr);	if (memcmp(Memory::GetPointer(requestAddr), &originalRequest, size) != 0) {		memset(&request, 0, sizeof(request));		Memory::Memcpy(&request, requestAddr, size);		Memory::Memcpy(&originalRequest, requestAddr, size);		param.SetPspParam(&request);	}	buttons = __CtrlPeekButtons();	UpdateFade();	okButtonImg = I_CIRCLE;	cancelButtonImg = I_CROSS;	okButtonFlag = CTRL_CIRCLE;	cancelButtonFlag = CTRL_CROSS;	if (param.GetPspParam()->common.buttonSwap == 1) {		okButtonImg = I_CROSS;		cancelButtonImg = I_CIRCLE;		okButtonFlag = CTRL_CROSS;		cancelButtonFlag = CTRL_CIRCLE;	}	I18NCategory *d = GetI18NCategory("Dialog");	switch (display)	{		case DS_SAVE_LIST_CHOICE:			StartDraw();			DisplaySaveList();			DisplaySaveDataInfo1();			DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL);			DisplayBanner(DB_SAVE);			if (IsButtonPressed(cancelButtonFlag)) {				param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL;				StartFade(false);			} else if (IsButtonPressed(okButtonFlag)) {				// Save exist, ask user confirm				if (param.GetFileInfo(currentSelectedSave).size > 0) {					yesnoChoice = 0;					display = DS_SAVE_CONFIRM_OVERWRITE;				} else {					display = DS_SAVE_SAVING;					if (param.Save(param.GetPspParam(), GetSelectedSaveDirName())) {						param.SetPspParam(param.GetPspParam()); // Optim : Just Update modified save						display = DS_SAVE_DONE;					} else						display = DS_SAVE_LIST_CHOICE; // This will probably need error message ?				}			}			EndDraw();		break;		case DS_SAVE_CONFIRM:			StartDraw();			DisplaySaveIcon();			DisplaySaveDataInfo2();			DisplayMessage(d->T("Confirm Save", "Do you want to save this data?"), true);			DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL);			DisplayBanner(DB_SAVE);			if (IsButtonPressed(cancelButtonFlag) || (IsButtonPressed(okButtonFlag) && yesnoChoice == 0)) {				param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL;				StartFade(false);			} else if (IsButtonPressed(okButtonFlag)) {				display = DS_SAVE_SAVING;				if (param.Save(param.GetPspParam(), GetSelectedSaveDirName())) {					param.SetPspParam(param.GetPspParam()); // Optim : Just Update modified save					display = DS_SAVE_DONE;				} else {					// TODO: This should probably show an error message?					StartFade(false);				}			}//.........这里部分代码省略.........
开发者ID:Bulkman,项目名称:ppsspp,代码行数:101,


示例23: 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);}
开发者ID:Kyhel,项目名称:ppsspp,代码行数:101,


示例24: Process

	void Process()	{#ifndef USING_GLES2		if (g_Config.iRewindFlipFrequency != 0 && gpuStats.numFlips != 0)			CheckRewindState();#endif		if (!needsProcess)			return;		needsProcess = false;		if (!__KernelIsRunning())		{			ERROR_LOG(COMMON, "Savestate failure: Unable to load without kernel, this should never happen.");			return;		}		std::vector<Operation> operations = Flush();		SaveStart state;		for (size_t i = 0, n = operations.size(); i < n; ++i)		{			Operation &op = operations[i];			CChunkFileReader::Error result;			bool callbackResult;			std::string reason;			I18NCategory *s = GetI18NCategory("Screen");			// I couldn't stand the inconsistency.  But trying not to break old lang files.			const char *i18nLoadFailure = s->T("Load savestate failed", "");			const char *i18nSaveFailure = s->T("Save State Failed", "");			if (strlen(i18nLoadFailure) == 0)				i18nLoadFailure = s->T("Failed to load state");			if (strlen(i18nSaveFailure) == 0)				i18nSaveFailure = s->T("Failed to save state");			switch (op.type)			{			case SAVESTATE_LOAD:				INFO_LOG(COMMON, "Loading state from %s", op.filename.c_str());				result = CChunkFileReader::Load(op.filename, REVISION, PPSSPP_GIT_VERSION, state, &reason);				if (result == CChunkFileReader::ERROR_NONE) {					osm.Show(s->T("Loaded State"), 2.0);					callbackResult = true;				} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {					HandleFailure();					osm.Show(i18nLoadFailure, 2.0);					ERROR_LOG(COMMON, "Load state failure: %s", reason.c_str());					callbackResult = false;				} else {					osm.Show(s->T(reason.c_str(), i18nLoadFailure), 2.0);					callbackResult = false;				}				break;			case SAVESTATE_SAVE:				INFO_LOG(COMMON, "Saving state to %s", op.filename.c_str());				result = CChunkFileReader::Save(op.filename, REVISION, PPSSPP_GIT_VERSION, state);				if (result == CChunkFileReader::ERROR_NONE) {					osm.Show(s->T("Saved State"), 2.0);					callbackResult = true;				} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {					HandleFailure();					osm.Show(i18nSaveFailure, 2.0);					ERROR_LOG(COMMON, "Save state failure: %s", reason.c_str());					callbackResult = false;				} else {					osm.Show(i18nSaveFailure, 2.0);					callbackResult = false;				}				break;			case SAVESTATE_VERIFY:				INFO_LOG(COMMON, "Verifying save state system");				callbackResult = CChunkFileReader::Verify(state) == CChunkFileReader::ERROR_NONE;				break;			case SAVESTATE_REWIND:				INFO_LOG(COMMON, "Rewinding to recent savestate snapshot");				result = rewindStates.Restore();				if (result == CChunkFileReader::ERROR_NONE) {					osm.Show(s->T("Loaded State"), 2.0);					callbackResult = true;				} else if (result == CChunkFileReader::ERROR_BROKEN_STATE) {					// Cripes.  Good news is, we might have more.  Let's try those too, better than a reset.					if (HandleFailure()) {						// Well, we did rewind, even if too much...						osm.Show(s->T("Loaded State"), 2.0);						callbackResult = true;					} else {						osm.Show(i18nLoadFailure, 2.0);						callbackResult = false;					}				} else {					osm.Show(i18nLoadFailure, 2.0);					callbackResult = false;				}				break;			default://.........这里部分代码省略.........
开发者ID:716Girl,项目名称:ppsspp,代码行数:101,


示例25: TheThread

unsigned int WINAPI TheThread(void *){	_InterlockedExchange(&emuThreadReady, THREAD_INIT);	setCurrentThreadName("Emu");  // And graphics...	host = new WindowsHost(MainWindow::GetHInstance(), MainWindow::GetHWND(), MainWindow::GetDisplayHWND());	host->SetWindowTitle(nullptr);	// Convert the command-line arguments to Unicode, then to proper UTF-8 	// (the benefit being that we don't have to pollute the UI project with win32 ifdefs and lots of Convert<whatever>To<whatever>).	// This avoids issues with PPSSPP inadvertently destroying paths with Unicode glyphs 	// (using the ANSI args resulted in Japanese/Chinese glyphs being turned into question marks, at least for me..).	// -TheDax	std::vector<std::wstring> wideArgs = GetWideCmdLine();	std::vector<std::string> argsUTF8;	for (auto& string : wideArgs) {		argsUTF8.push_back(ConvertWStringToUTF8(string));	}	std::vector<const char *> args;	for (auto& string : argsUTF8) {		args.push_back(string.c_str());	}	bool performingRestart = NativeIsRestarting();	NativeInit(static_cast<int>(args.size()), &args[0], "1234", "1234", nullptr);	host->UpdateUI();	GraphicsContext *graphicsContext = nullptr;	std::string error_string;	if (!host->InitGraphics(&error_string, &graphicsContext)) {		// Before anything: are we restarting right now?		if (performingRestart) {			// Okay, switching graphics didn't work out.  Probably a driver bug - fallback to restart.			// This happens on NVIDIA when switching OpenGL -> Vulkan.			g_Config.Save();			W32Util::ExitAndRestart();		}		I18NCategory *err = GetI18NCategory("Error");		Reporting::ReportMessage("Graphics init error: %s", error_string.c_str());		const char *defaultErrorVulkan = "Failed initializing graphics. Try upgrading your graphics drivers./n/nWould you like to try switching to OpenGL?/n/nError message:";		const char *defaultErrorOpenGL = "Failed initializing graphics. Try upgrading your graphics drivers./n/nWould you like to try switching to DirectX 9?/n/nError message:";		const char *defaultErrorDirect3D9 = "Failed initializing graphics. Try upgrading your graphics drivers and directx 9 runtime./n/nWould you like to try switching to OpenGL?/n/nError message:";		const char *genericError;		int nextBackend = GPU_BACKEND_DIRECT3D9;		switch (g_Config.iGPUBackend) {		case GPU_BACKEND_DIRECT3D9:			nextBackend = GPU_BACKEND_OPENGL;			genericError = err->T("GenericDirect3D9Error", defaultErrorDirect3D9);			break;		case GPU_BACKEND_VULKAN:			nextBackend = GPU_BACKEND_OPENGL;			genericError = err->T("GenericVulkanError", defaultErrorVulkan);			break;		case GPU_BACKEND_OPENGL:		default:			nextBackend = GPU_BACKEND_DIRECT3D9;			genericError = err->T("GenericOpenGLError", defaultErrorOpenGL);			break;		}		std::string full_error = StringFromFormat("%s/n/n%s", genericError, error_string.c_str());		std::wstring title = ConvertUTF8ToWString(err->T("GenericGraphicsError", "Graphics Error"));		bool yes = IDYES == MessageBox(0, ConvertUTF8ToWString(full_error).c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);		ERROR_LOG(BOOT, full_error.c_str());		if (yes) {			// Change the config to the alternative and restart.			g_Config.iGPUBackend = nextBackend;			g_Config.Save();			W32Util::ExitAndRestart();		}		// No safe way out without graphics.		ExitProcess(1);	}	NativeInitGraphics(graphicsContext);	NativeResized();	INFO_LOG(BOOT, "Done.");	_dbg_update_();	if (coreState == CORE_POWERDOWN) {		INFO_LOG(BOOT, "Exit before core loop.");		goto shutdown;	}	_InterlockedExchange(&emuThreadReady, THREAD_CORE_LOOP);	if (g_Config.bBrowse)		PostMessage(MainWindow::GetHWND(), WM_COMMAND, ID_FILE_LOAD, 0);	Core_EnableStepping(FALSE);//.........这里部分代码省略.........
开发者ID:thesourcehim,项目名称:ppsspp,代码行数:101,



注:本文中的GetI18NCategory函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetICustButton函数代码示例
C++ GetHwndOf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。