Пример #1
0
bool GameListItem::EmuStateChanged()
{
  IniFile ini = SConfig::LoadGameIni(m_game_id, m_revision);
  ini.GetIfExists("EmuState", "EmulationStateId", &m_pending.emu_state.rating, 0);
  ini.GetIfExists("EmuState", "EmulationIssues", &m_pending.emu_state.issues, std::string());
  return m_emu_state != m_pending.emu_state;
}
Пример #2
0
void TASInputDlg::CreateWiiLayout(int num)
{
	if (m_has_layout)
		return;

	CreateBaseLayout();

	m_buttons[6] = &m_one;
	m_buttons[7] = &m_two;
	m_buttons[8] = &m_plus;
	m_buttons[9] = &m_minus;
	m_buttons[10] = &m_home;

	m_controls[4] = &m_x_cont;
	m_controls[5] = &m_y_cont;
	m_controls[6] = &m_z_cont;

	m_main_stick = CreateStick(ID_MAIN_STICK, 1024, 768, 512, 384, true, false);
	m_main_stick_szr = CreateStickLayout(&m_main_stick, _("IR"));

	m_x_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_y_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_z_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 616);
	wxStaticBoxSizer* const axisBox = CreateAccelLayout(&m_x_cont, &m_y_cont, &m_z_cont, _("Orientation"));

	wxStaticBoxSizer* const m_buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons"));
	wxGridSizer* const m_buttons_grid = new wxGridSizer(4);

	m_plus = CreateButton("+");
	m_minus = CreateButton("-");
	m_one = CreateButton("1");
	m_two = CreateButton("2");
	m_home = CreateButton("Home");

	m_main_szr = new wxBoxSizer(wxVERTICAL);
	m_wiimote_szr = new wxBoxSizer(wxHORIZONTAL);
	m_ext_szr = new wxBoxSizer(wxHORIZONTAL);
	m_cc_szr = CreateCCLayout();

	if (Core::IsRunning())
	{
		m_ext = ((WiimoteEmu::Wiimote*)Wiimote::GetConfig()->controllers[num])->CurrentExtension();
	}
	else
	{
		IniFile ini;
		ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
		std::string extension;
		ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension);

		if (extension == "Nunchuk")
			m_ext = 1;
		if (extension == "Classic")
			m_ext = 2;
	}

	m_buttons[11] = &m_c;
	m_buttons[12] = &m_z;
	m_controls[2] = &m_c_stick.x_cont;
	m_controls[3] = &m_c_stick.y_cont;
	m_controls[7] = &m_nx_cont;
	m_controls[8] = &m_ny_cont;
	m_controls[9] = &m_nz_cont;

	m_c_stick = CreateStick(ID_C_STICK, 255, 255, 128, 128, false, true);
	m_c_stick_szr = CreateStickLayout(&m_c_stick, _("Nunchuk stick"));

	m_nx_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_ny_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	m_nz_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
	wxStaticBoxSizer* const nunchukaxisBox = CreateAccelLayout(&m_nx_cont, &m_ny_cont, &m_nz_cont, _("Nunchuk orientation"));

	m_c = CreateButton("C");
	m_z = CreateButton("Z");
	m_ext_szr->Add(m_c_stick_szr, 0, wxLEFT | wxBOTTOM | wxRIGHT, 5);
	m_ext_szr->Add(nunchukaxisBox);

	for (Control* const control : m_controls)
	{
		if (control != nullptr)
			control->slider->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnRightClickSlider, this);
	}

	for (unsigned int i = 4; i < ArraySize(m_buttons); ++i)
		if (m_buttons[i] != nullptr)
			m_buttons_grid->Add(m_buttons[i]->checkbox);
	m_buttons_grid->AddSpacer(5);

	m_buttons_box->Add(m_buttons_grid);
	m_buttons_box->Add(m_buttons_dpad);

	m_wiimote_szr->Add(m_main_stick_szr, 0, wxALL, 5);
	m_wiimote_szr->Add(axisBox, 0, wxTOP | wxRIGHT, 5);
	m_wiimote_szr->Add(m_buttons_box, 0, wxTOP | wxRIGHT, 5);
	m_main_szr->Add(m_wiimote_szr);
	m_main_szr->Add(m_ext_szr);
	m_main_szr->Add(m_cc_szr);

	HandleExtensionChange();
	m_has_layout = true;
}
Пример #3
0
void TASInputDlg::CreateWiiLayout(int num)
{
  if (m_has_layout)
    return;
  const int space5 = FromDIP(5);

  CreateBaseLayout();

  m_buttons[6] = &m_one;
  m_buttons[7] = &m_two;
  m_buttons[8] = &m_plus;
  m_buttons[9] = &m_minus;
  m_buttons[10] = &m_home;

  m_controls[4] = &m_x_cont;
  m_controls[5] = &m_y_cont;
  m_controls[6] = &m_z_cont;

  m_main_stick = CreateStick(ID_MAIN_STICK, 1024, 768, 512, 384, true, false);
  // i18n: IR stands for infrared and refers to the pointer functionality of Wii Remotes
  m_main_stick_szr = CreateStickLayout(&m_main_stick, _("IR"));

  m_x_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
  m_y_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
  m_z_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 616);
  wxStaticBoxSizer* const axisBox =
      CreateAccelLayout(&m_x_cont, &m_y_cont, &m_z_cont, _("Orientation"));

  m_plus = CreateButton("+");
  m_plus.checkbox->SetClientData(&m_plus);
  m_minus = CreateButton("-");
  m_minus.checkbox->SetClientData(&m_minus);
  m_one = CreateButton("1");
  m_one.checkbox->SetClientData(&m_one);
  m_two = CreateButton("2");
  m_two.checkbox->SetClientData(&m_two);
  m_home = CreateButton("HOME");
  m_home.checkbox->SetClientData(&m_home);

  m_cc_szr = CreateCCLayout();

  if (Core::IsRunning())
  {
    m_ext = static_cast<WiimoteEmu::Wiimote*>(Wiimote::GetConfig()->GetController(num))
                ->CurrentExtension();
  }
  else
  {
    IniFile ini;
    ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
    std::string extension;
    ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension);

    if (extension == "Nunchuk")
      m_ext = 1;
    if (extension == "Classic")
      m_ext = 2;
  }

  m_buttons[11] = &m_c;
  m_buttons[12] = &m_z;
  m_controls[2] = &m_c_stick.x_cont;
  m_controls[3] = &m_c_stick.y_cont;
  m_controls[7] = &m_nx_cont;
  m_controls[8] = &m_ny_cont;
  m_controls[9] = &m_nz_cont;

  m_c_stick = CreateStick(ID_C_STICK, 255, 255, 128, 128, false, true);
  m_c_stick_szr = CreateStickLayout(&m_c_stick, _("Nunchuk stick"));

  m_nx_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
  m_ny_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
  m_nz_cont = CreateControl(wxSL_VERTICAL, -1, 100, false, 1023, 512);
  wxStaticBoxSizer* const nunchukaxisBox =
      CreateAccelLayout(&m_nx_cont, &m_ny_cont, &m_nz_cont, _("Nunchuk orientation"));

  m_c = CreateButton("C");
  m_c.checkbox->SetClientData(&m_c);
  m_z = CreateButton("Z");
  m_z.checkbox->SetClientData(&m_z);

  for (Control* const control : m_controls)
  {
    if (control != nullptr)
      control->slider->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnRightClickSlider, this);
  }

  m_ext_szr = new wxBoxSizer(wxHORIZONTAL);
  m_ext_szr->Add(m_c_stick_szr, 0, wxBOTTOM, space5);
  m_ext_szr->AddSpacer(space5);
  m_ext_szr->Add(nunchukaxisBox, 0, wxBOTTOM, space5);

  // Add non-DPad related buttons first.
  auto* const buttons_grid = new wxGridSizer(4);
  for (size_t i = 4; i < m_buttons.size(); ++i)
  {
    if (m_buttons[i] != nullptr)
      buttons_grid->Add(m_buttons[i]->checkbox);
  }
  buttons_grid->Add(space5, space5);

  auto* const buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons"));
  buttons_box->Add(buttons_grid);
  buttons_box->Add(m_buttons_dpad, 0, wxTOP, space5);

  m_wiimote_szr = new wxBoxSizer(wxHORIZONTAL);
  m_wiimote_szr->AddSpacer(space5);
  m_wiimote_szr->Add(m_main_stick_szr);
  m_wiimote_szr->Add(axisBox, 0, wxLEFT, space5);
  m_wiimote_szr->Add(buttons_box, 0, wxLEFT, space5);
  m_wiimote_szr->AddSpacer(space5);

  // NOTE: Not all of these are visible at the same time.
  m_main_szr = new wxBoxSizer(wxVERTICAL);
  m_main_szr->Add(m_wiimote_szr, 0, wxTOP | wxBOTTOM, space5);
  m_main_szr->Add(m_ext_szr, 0, wxLEFT | wxRIGHT, space5);
  m_main_szr->Add(m_cc_szr, 0, wxLEFT | wxRIGHT, space5);

  SetSizer(m_main_szr);
  HandleExtensionChange();
  FinishLayout();
}
Пример #4
0
void VideoConfig::GameIniLoad(const char *ini_file)
{
	IniFile iniFile;
	iniFile.Load(ini_file);

	iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync);

	iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack);
	iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio);
	iniFile.GetIfExists("Video_Settings", "Crop", &bCrop);
	iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB);
	iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB);
	iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel);
	iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures);
	iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo);
	iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation);
	iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle);
	iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting);
	iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth);
	iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode);
	iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale); // integral
	iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass);
	iniFile.GetIfExists("Video_Settings", "DisableLighting", &bDisableLighting);
	iniFile.GetIfExists("Video_Settings", "DisableTexturing", &bDisableTexturing);
	iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog);
	iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL);
	iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder);

	iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering);
	iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy);  // NOTE - this is x in (1 << x)
	iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader);
	iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision);

	iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable);
	iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBCopyRAMEnable", &bEFBCopyRAMEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBCopyVirtualEnable", &bEFBCopyVirtualEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges);

	iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]);
	iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]);
	iniFile.GetIfExists("Video", "PH_SZFar", &iPhackvalue[2]);
	iniFile.GetIfExists("Video", "PH_ExtraParam", &iPhackvalue[3]);
	iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]);
	iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]);
	iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
}
Пример #5
0
void VideoConfig::GameIniLoad(const char *ini_file)
{
	IniFile iniFile;
	iniFile.Load(ini_file);

	iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync);

	iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack);
	iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio);
	iniFile.GetIfExists("Video_Settings", "Crop", &bCrop);
	iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB);
	iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB);
	iniFile.GetIfExists("Video_Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples);
	iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel);
	iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures);
	iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo);
	iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation);
	iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle);
	iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting);
	iniFile.GetIfExists("Video_Settings", "HackedBufferUpload", &bHackedBufferUpload);
	iniFile.GetIfExists("Video_Settings", "FastDepthCalc", &bFastDepthCalc);
	iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode);
	int tmp = -9000;
	iniFile.GetIfExists("Video_Settings", "EFBScale", &tmp); // integral
	if (tmp != -9000)
	{
		if (tmp != SCALE_FORCE_INTEGRAL)
		{
			iEFBScale = tmp;
		}
		else // Round down to multiple of native IR
		{
			switch (iEFBScale)
			{
			case SCALE_AUTO:
				iEFBScale = SCALE_AUTO_INTEGRAL;
				break;
			case SCALE_1_5X:
				iEFBScale = SCALE_1X;
				break;
			case SCALE_2_5X:
				iEFBScale = SCALE_2X;
				break;
			default:
				break;
			}
		}
	}

	iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass);
	iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog);
	iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL);
	iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder);

	iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering);
	iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy);  // NOTE - this is x in (1 << x)
	iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader);
	iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision);

	iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable);
	iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBToTextureEnable", &bCopyEFBToTexture);
	iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled);
	iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable);
	iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges);

	iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]);
	iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]);
	iniFile.GetIfExists("Video", "PH_SZFar", &iPhackvalue[2]);
	iniFile.GetIfExists("Video", "PH_ExtraParam", &iPhackvalue[3]);
	iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]);
	iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]);
	iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
	iniFile.GetIfExists("Video", "UseBBox", &bUseBBox);
}
Пример #6
0
void VideoConfig::GameIniLoad()
{
	bool gfx_override_exists = false;

	// XXX: Again, bad place to put OSD messages at (see delroth's comment above)
	// XXX: This will add an OSD message for each projection hack value... meh
#define CHECK_SETTING(section, key, var) do { \
		decltype(var) temp = var; \
		if (iniFile.GetIfExists(section, key, &var) && var != temp) { \
			std::string msg = StringFromFormat("Note: Option \"%s\" is overridden by game ini.", key); \
			OSD::AddMessage(msg, 7500); \
			gfx_override_exists = true; \
		} \
	} while (0)

	IniFile iniFile = SConfig::GetInstance().LoadGameIni();

	CHECK_SETTING("Video_Hardware", "VSync", bVSync);

	CHECK_SETTING("Video_Settings", "wideScreenHack", bWidescreenHack);
	CHECK_SETTING("Video_Settings", "AspectRatio", iAspectRatio);
	CHECK_SETTING("Video_Settings", "Crop", bCrop);
	CHECK_SETTING("Video_Settings", "UseXFB", bUseXFB);
	CHECK_SETTING("Video_Settings", "UseRealXFB", bUseRealXFB);
	CHECK_SETTING("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
	CHECK_SETTING("Video_Settings", "HiresTextures", bHiresTextures);
	CHECK_SETTING("Video_Settings", "ConvertHiresTextures", bConvertHiresTextures);
	CHECK_SETTING("Video_Settings", "CacheHiresTextures", bCacheHiresTextures);
	CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
	CHECK_SETTING("Video_Settings", "FastDepthCalc", bFastDepthCalc);
	CHECK_SETTING("Video_Settings", "MSAA", iMultisamples);
	CHECK_SETTING("Video_Settings", "SSAA", bSSAA);

	int tmp = -9000;
	CHECK_SETTING("Video_Settings", "EFBScale", tmp); // integral
	if (tmp != -9000)
	{
		if (tmp != SCALE_FORCE_INTEGRAL)
		{
			iEFBScale = tmp;
		}
		else // Round down to multiple of native IR
		{
			switch (iEFBScale)
			{
			case SCALE_AUTO:
				iEFBScale = SCALE_AUTO_INTEGRAL;
				break;
			case SCALE_1_5X:
				iEFBScale = SCALE_1X;
				break;
			case SCALE_2_5X:
				iEFBScale = SCALE_2X;
				break;
			default:
				break;
			}
		}
	}

	CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog);

	CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering);
	CHECK_SETTING("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy);  // NOTE - this is x in (1 << x)
	CHECK_SETTING("Video_Enhancements", "PostProcessingShader", sPostProcessingShader);

	// These are not overrides, they are per-game stereoscopy parameters, hence no warning
	iniFile.GetIfExists("Video_Stereoscopy", "StereoConvergence", &iStereoConvergence, 20);
	iniFile.GetIfExists("Video_Stereoscopy", "StereoEFBMonoDepth", &bStereoEFBMonoDepth, false);
	iniFile.GetIfExists("Video_Stereoscopy", "StereoDepthPercentage", &iStereoDepthPercentage, 100);

	CHECK_SETTING("Video_Stereoscopy", "StereoMode", iStereoMode);
	CHECK_SETTING("Video_Stereoscopy", "StereoDepth", iStereoDepth);
	CHECK_SETTING("Video_Stereoscopy", "StereoSwapEyes", bStereoSwapEyes);

	CHECK_SETTING("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable);
	CHECK_SETTING("Video_Hacks", "BBoxEnable", bBBoxEnable);
	CHECK_SETTING("Video_Hacks", "ForceProgressive", bForceProgressive);
	CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bSkipEFBCopyToRam);
	CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
	CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);

	CHECK_SETTING("Video", "ProjectionHack", iPhackvalue[0]);
	CHECK_SETTING("Video", "PH_SZNear", iPhackvalue[1]);
	CHECK_SETTING("Video", "PH_SZFar", iPhackvalue[2]);
	CHECK_SETTING("Video", "PH_ZNear", sPhackvalue[0]);
	CHECK_SETTING("Video", "PH_ZFar", sPhackvalue[1]);
	CHECK_SETTING("Video", "PerfQueriesEnable", bPerfQueriesEnable);

	if (gfx_override_exists)
		OSD::AddMessage("Warning: Opening the graphics configuration will reset settings and might cause issues!", 10000);
}
Пример #7
0
WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent), m_num(num)
{
  m_ir_box = new QGroupBox(tr("IR (ALT+F/G)"));

  auto* x_layout = new QHBoxLayout;
  m_ir_x_value = CreateSliderValuePair(this, x_layout, ir_max_x, Qt::Key_F, Qt::Horizontal,
                                       m_ir_box, true);

  auto* y_layout = new QVBoxLayout;
  m_ir_y_value = CreateSliderValuePair(this, y_layout, ir_max_y, Qt::Key_G, Qt::Vertical,
                                       m_ir_box, true);
  m_ir_y_value->setMaximumWidth(60);

  auto* visual = new IRWidget(this);
  connect(m_ir_x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
          &IRWidget::SetX);
  connect(m_ir_y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
          &IRWidget::SetY);
  connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue);
  connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue);

  m_ir_x_value->setValue(ir_max_x / 2);
  m_ir_y_value->setValue(ir_max_y / 2);

  auto* visual_ar = new AspectRatioWidget(visual, ir_max_x, ir_max_y);

  auto* visual_layout = new QHBoxLayout;
  visual_layout->addWidget(visual_ar);
  visual_layout->addLayout(y_layout);

  auto* ir_layout = new QVBoxLayout;
  ir_layout->addLayout(x_layout);
  ir_layout->addLayout(visual_layout);
  m_ir_box->setLayout(ir_layout);

  m_nunchuk_stick_box =
      CreateStickInputs(this, tr("Nunchuk Stick (ALT+X/Y)"), m_nunchuk_stick_x_value,
                        m_nunchuk_stick_y_value, 255, 255, Qt::Key_X, Qt::Key_Y);

  m_classic_left_stick_box =
      CreateStickInputs(this, tr("Left Stick (ALT+F/G)"), m_classic_left_stick_x_value,
                        m_classic_left_stick_y_value, 63, 63, Qt::Key_F, Qt::Key_G);

  m_classic_right_stick_box =
      CreateStickInputs(this, tr("Right Stick (ALT+Q/W)"), m_classic_right_stick_x_value,
                        m_classic_right_stick_y_value, 31, 31, Qt::Key_Q, Qt::Key_W);

  // Need to enforce the same minimum width because otherwise the different lengths in the labels
  // used on the QGroupBox will cause the StickWidgets to have different sizes.
  m_ir_box->setMinimumWidth(20);
  m_nunchuk_stick_box->setMinimumWidth(20);

  m_remote_orientation_box = new QGroupBox(tr("Remote Orientation"));

  auto* top_layout = new QHBoxLayout;
  top_layout->addWidget(m_ir_box);
  top_layout->addWidget(m_nunchuk_stick_box);
  top_layout->addWidget(m_classic_left_stick_box);
  top_layout->addWidget(m_classic_right_stick_box);

  auto* remote_orientation_x_layout =
      CreateSliderValuePairLayout(this, tr("X (ALT+Q)"), m_remote_orientation_x_value, 1023,
                                  Qt::Key_Q, m_remote_orientation_box);
  auto* remote_orientation_y_layout =
      CreateSliderValuePairLayout(this, tr("Y (ALT+W)"), m_remote_orientation_y_value, 1023,
                                  Qt::Key_W, m_remote_orientation_box);
  auto* remote_orientation_z_layout =
      CreateSliderValuePairLayout(this, tr("Z (ALT+E)"), m_remote_orientation_z_value, 1023,
                                  Qt::Key_E, m_remote_orientation_box);

  auto* remote_orientation_layout = new QVBoxLayout;
  remote_orientation_layout->addLayout(remote_orientation_x_layout);
  remote_orientation_layout->addLayout(remote_orientation_y_layout);
  remote_orientation_layout->addLayout(remote_orientation_z_layout);
  m_remote_orientation_box->setLayout(remote_orientation_layout);

  m_nunchuk_orientation_box = new QGroupBox(tr("Nunchuk Orientation"));

  auto* nunchuk_orientation_x_layout =
      CreateSliderValuePairLayout(this, tr("X (ALT+I)"), m_nunchuk_orientation_x_value, 1023,
                                  Qt::Key_I, m_nunchuk_orientation_box);
  auto* nunchuk_orientation_y_layout =
      CreateSliderValuePairLayout(this, tr("Y (ALT+O)"), m_nunchuk_orientation_y_value, 1023,
                                  Qt::Key_O, m_nunchuk_orientation_box);
  auto* nunchuk_orientation_z_layout =
      CreateSliderValuePairLayout(this, tr("Z (ALT+P)"), m_nunchuk_orientation_z_value, 1023,
                                  Qt::Key_P, m_nunchuk_orientation_box);

  auto* nunchuk_orientation_layout = new QVBoxLayout;
  nunchuk_orientation_layout->addLayout(nunchuk_orientation_x_layout);
  nunchuk_orientation_layout->addLayout(nunchuk_orientation_y_layout);
  nunchuk_orientation_layout->addLayout(nunchuk_orientation_z_layout);
  m_nunchuk_orientation_box->setLayout(nunchuk_orientation_layout);

  m_triggers_box = new QGroupBox(tr("Triggers"));
  auto* l_trigger_layout = CreateSliderValuePairLayout(
      this, tr("Left (ALT+N)"), m_left_trigger_value, 31, Qt::Key_N, m_triggers_box);
  auto* r_trigger_layout = CreateSliderValuePairLayout(
      this, tr("Right (ALT+M)"), m_right_trigger_value, 31, Qt::Key_M, m_triggers_box);

  auto* triggers_layout = new QVBoxLayout;
  triggers_layout->addLayout(l_trigger_layout);
  triggers_layout->addLayout(r_trigger_layout);
  m_triggers_box->setLayout(triggers_layout);

  m_a_button = new QCheckBox(QStringLiteral("&A"));
  m_b_button = new QCheckBox(QStringLiteral("&B"));
  m_1_button = new QCheckBox(QStringLiteral("&1"));
  m_2_button = new QCheckBox(QStringLiteral("&2"));
  m_plus_button = new QCheckBox(QStringLiteral("&+"));
  m_minus_button = new QCheckBox(QStringLiteral("&-"));
  m_home_button = new QCheckBox(QStringLiteral("&HOME"));
  m_left_button = new QCheckBox(QStringLiteral("&Left"));
  m_up_button = new QCheckBox(QStringLiteral("&Up"));
  m_down_button = new QCheckBox(QStringLiteral("&Down"));
  m_right_button = new QCheckBox(QStringLiteral("&Right"));
  m_c_button = new QCheckBox(QStringLiteral("&C"));
  m_z_button = new QCheckBox(QStringLiteral("&Z"));

  auto* buttons_layout1 = new QHBoxLayout;
  buttons_layout1->addWidget(m_a_button);
  buttons_layout1->addWidget(m_b_button);
  buttons_layout1->addWidget(m_1_button);
  buttons_layout1->addWidget(m_2_button);
  buttons_layout1->addWidget(m_plus_button);
  buttons_layout1->addWidget(m_minus_button);

  auto* buttons_layout2 = new QHBoxLayout;
  buttons_layout2->addWidget(m_home_button);
  buttons_layout2->addWidget(m_left_button);
  buttons_layout2->addWidget(m_up_button);
  buttons_layout2->addWidget(m_down_button);
  buttons_layout2->addWidget(m_right_button);

  auto* remote_buttons_layout = new QVBoxLayout;
  remote_buttons_layout->setSizeConstraint(QLayout::SetFixedSize);
  remote_buttons_layout->addLayout(buttons_layout1);
  remote_buttons_layout->addLayout(buttons_layout2);

  m_remote_buttons_box = new QGroupBox(tr("Remote Buttons"));
  m_remote_buttons_box->setLayout(remote_buttons_layout);

  auto* nunchuk_buttons_layout = new QHBoxLayout;
  nunchuk_buttons_layout->addWidget(m_c_button);
  nunchuk_buttons_layout->addWidget(m_z_button);

  m_nunchuk_buttons_box = new QGroupBox(tr("Nunchuk Buttons"));
  m_nunchuk_buttons_box->setLayout(nunchuk_buttons_layout);

  m_classic_a_button = new QCheckBox(QStringLiteral("&A"));
  m_classic_b_button = new QCheckBox(QStringLiteral("&B"));
  m_classic_x_button = new QCheckBox(QStringLiteral("&X"));
  m_classic_y_button = new QCheckBox(QStringLiteral("&Y"));
  m_classic_l_button = new QCheckBox(QStringLiteral("&L"));
  m_classic_r_button = new QCheckBox(QStringLiteral("&R"));
  m_classic_zl_button = new QCheckBox(QStringLiteral("&ZL"));
  m_classic_zr_button = new QCheckBox(QStringLiteral("ZR"));
  m_classic_plus_button = new QCheckBox(QStringLiteral("&+"));
  m_classic_minus_button = new QCheckBox(QStringLiteral("&-"));
  m_classic_home_button = new QCheckBox(QStringLiteral("&HOME"));
  m_classic_left_button = new QCheckBox(QStringLiteral("L&eft"));
  m_classic_up_button = new QCheckBox(QStringLiteral("&Up"));
  m_classic_down_button = new QCheckBox(QStringLiteral("&Down"));
  m_classic_right_button = new QCheckBox(QStringLiteral("R&ight"));

  auto* classic_buttons_layout1 = new QHBoxLayout;
  classic_buttons_layout1->addWidget(m_classic_a_button);
  classic_buttons_layout1->addWidget(m_classic_b_button);
  classic_buttons_layout1->addWidget(m_classic_x_button);
  classic_buttons_layout1->addWidget(m_classic_y_button);
  classic_buttons_layout1->addWidget(m_classic_l_button);
  classic_buttons_layout1->addWidget(m_classic_r_button);
  classic_buttons_layout1->addWidget(m_classic_zl_button);
  classic_buttons_layout1->addWidget(m_classic_zr_button);

  auto* classic_buttons_layout2 = new QHBoxLayout;
  classic_buttons_layout2->addWidget(m_classic_plus_button);
  classic_buttons_layout2->addWidget(m_classic_minus_button);
  classic_buttons_layout2->addWidget(m_classic_home_button);
  classic_buttons_layout2->addWidget(m_classic_left_button);
  classic_buttons_layout2->addWidget(m_classic_up_button);
  classic_buttons_layout2->addWidget(m_classic_down_button);
  classic_buttons_layout2->addWidget(m_classic_right_button);

  auto* classic_buttons_layout = new QVBoxLayout;
  classic_buttons_layout->setSizeConstraint(QLayout::SetFixedSize);
  classic_buttons_layout->addLayout(classic_buttons_layout1);
  classic_buttons_layout->addLayout(classic_buttons_layout2);

  m_classic_buttons_box = new QGroupBox(tr("Classic Buttons"));
  m_classic_buttons_box->setLayout(classic_buttons_layout);

  auto* layout = new QVBoxLayout;
  layout->addLayout(top_layout);
  layout->addWidget(m_remote_orientation_box);
  layout->addWidget(m_nunchuk_orientation_box);
  layout->addWidget(m_triggers_box);
  layout->addWidget(m_remote_buttons_box);
  layout->addWidget(m_nunchuk_buttons_box);
  layout->addWidget(m_classic_buttons_box);
  layout->setAlignment(m_nunchuk_buttons_box, Qt::AlignLeft);

  setLayout(layout);

  u8 ext = 0;
  if (Core::IsRunning())
  {
    ext = static_cast<WiimoteEmu::Wiimote*>(Wiimote::GetConfig()->GetController(num))
              ->CurrentExtension();
  }
  else
  {
    IniFile ini;
    ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
    std::string extension;
    ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension);

    if (extension == "Nunchuk")
      ext = 1;
    if (extension == "Classic")
      ext = 2;
  }
  UpdateExt(ext);
}
Пример #8
0
void CGameListCtrl::InsertItemInReportView(long _Index)
{
	// When using wxListCtrl, there is no hope of per-column text colors.
	// But for reference, here are the old colors that were used: (BGR)
	// title: 0xFF0000
	// company: 0x007030
	int ImageIndex = -1;

	GameListItem& rISOFile = *m_ISOFiles[_Index];

	// Insert a first row with nothing in it, that will be used as the Index
	long ItemIndex = InsertItem(_Index, wxEmptyString);

	// Insert the platform's image in the first (visible) column
	SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);

	if (rISOFile.GetBitmap().IsOk())
		ImageIndex = m_imageListSmall->Add(rISOFile.GetBitmap());

	// Set the game's banner in the second column
	SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);

	int SelectedLanguage = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;

	// Is this sane?
	if  (rISOFile.GetPlatform() == GameListItem::WII_WAD)
	{
		SelectedLanguage = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
	}

	std::string name = rISOFile.GetName(SelectedLanguage);

	std::ifstream titlestxt;
	OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "titles.txt", std::ios::in);

	if (titlestxt.is_open() && rISOFile.GetUniqueID().size() > 3)
	{
		while (!titlestxt.eof())
		{
			std::string line;

			if (!std::getline(titlestxt, line) && titlestxt.eof())
				break;

			if (line.substr(0,rISOFile.GetUniqueID().size()) == rISOFile.GetUniqueID())
			{
				name = line.substr(rISOFile.GetUniqueID().size() + 3);
				break;
			}
		}
		titlestxt.close();
	}

	std::string GameIni[3];
	GameIni[0] = File::GetUserPath(D_GAMESETTINGS_IDX) + rISOFile.GetUniqueID() + ".ini";
	GameIni[1] = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + rISOFile.GetUniqueID() + std::to_string(rISOFile.GetRevision()) + ".ini";
	GameIni[2] = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + rISOFile.GetUniqueID() + ".ini";
	std::string title;
	IniFile gameini;
	for (int i = 0; i < 3; ++i)
	{
		if (File::Exists(GameIni[i]))
		{
			gameini.Load(GameIni[i]);
			if (gameini.GetIfExists("EmuState", "Title", &title))
			{
				name = title;
				break;
			}
		}
	}

	SetItem(_Index, COLUMN_TITLE, StrToWxStr(name), -1);

	// We show the company string on GameCube only
	// On Wii we show the description instead as the company string is empty
	std::string const notes = (rISOFile.GetPlatform() == GameListItem::GAMECUBE_DISC) ?
		rISOFile.GetCompany() : rISOFile.GetDescription(SelectedLanguage);
	SetItem(_Index, COLUMN_NOTES, StrToWxStr(notes), -1);

	// Emulation state
	SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[rISOFile.GetEmuState()]);

	// Country
	SetItemColumnImage(_Index, COLUMN_COUNTRY, m_FlagImageIndex[rISOFile.GetCountry()]);

	// File size
	SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1);

	// Game ID
	SetItem(_Index, COLUMN_ID, rISOFile.GetUniqueID(), -1);

	// Background color
	SetBackgroundColor();

	// Item data
	SetItemData(_Index, ItemIndex);
}