コード例 #1
0
ファイル: HotkeyManager.cpp プロジェクト: gamax92/Ishiiruka
HotkeyManager::HotkeyManager()
{
	for (int key = 0; key < NUM_HOTKEYS; key++)
	{
		int set = key / 32;

		if (key % 32 == 0)
			groups.emplace_back(m_keys[set] = new Buttons(_trans("Keys")));

		m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[key]));
	}

	groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
	m_options->settings.emplace_back(new ControlGroup::BackgroundInputSetting(_trans("Background Input")));
	m_options->settings.emplace_back(new ControlGroup::IterateUI(_trans("Iterative Input")));
}
コード例 #2
0
void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
{
	m_emu_config_diag = new InputConfigDialog(this, m_plugin, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
	m_emu_config_diag->ShowModal();
	m_emu_config_diag->Destroy();
	m_emu_config_diag = 0;
}
コード例 #3
0
ファイル: ControllerEmu.cpp プロジェクト: Zombiebest/Dolphin
ControllerEmu::Tilt::Tilt(const char* const _name)
	: ControlGroup(_name, GROUP_TYPE_TILT)
{
	memset(m_tilt, 0, sizeof(m_tilt));

	controls.push_back(new Input("Forward"));
	controls.push_back(new Input("Backward"));
	controls.push_back(new Input("Left"));
	controls.push_back(new Input("Right"));

	controls.push_back(new Input(_trans("Modifier")));

	settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
	settings.push_back(new Setting(_trans("Circle Stick"), 0));
	settings.push_back(new Setting(_trans("Angle"), 0.9f, 0, 180));
}
コード例 #4
0
ファイル: Nunchuk.cpp プロジェクト: Bigorneau/dolphin
Nunchuk::Nunchuk(UDPWrapper *wrp, WiimoteEmu::ExtensionReg& _reg)
	: Attachment(_trans("Nunchuk"), _reg) , m_udpWrap(wrp)
{
	// buttons
	groups.emplace_back(m_buttons = new Buttons("Buttons"));
	m_buttons->controls.emplace_back(new ControlGroup::Input("C"));
	m_buttons->controls.emplace_back(new ControlGroup::Input("Z"));

	// stick
	groups.emplace_back(m_stick = new AnalogStick("Stick"));

	// swing
	groups.emplace_back(m_swing = new Force("Swing"));

	// tilt
	groups.emplace_back(m_tilt = new Tilt("Tilt"));

	// shake
	groups.emplace_back(m_shake = new Buttons("Shake"));
	m_shake->controls.emplace_back(new ControlGroup::Input("X"));
	m_shake->controls.emplace_back(new ControlGroup::Input("Y"));
	m_shake->controls.emplace_back(new ControlGroup::Input("Z"));

	// set up register
	// calibration
	memcpy(&calibration, nunchuck_calibration, sizeof(nunchuck_calibration));
	// id
	memcpy(&id, nunchuck_id, sizeof(nunchuck_id));

	// this should get set to 0 on disconnect, but it isn't, o well
	memset(m_shake_step, 0, sizeof(m_shake_step));
}
コード例 #5
0
ファイル: ControllerEmu.cpp プロジェクト: CryZe/dolphin
ControllerEmu::Slider::Slider(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_SLIDER)
{
	controls.emplace_back(new Input("Left"));
	controls.emplace_back(new Input("Right"));

	settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #6
0
ファイル: ControllerEmu.cpp プロジェクト: spxtr/dolphin
ControllerEmu::Slider::Slider(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_SLIDER)
{
  controls.emplace_back(std::make_unique<Input>("Left"));
  controls.emplace_back(std::make_unique<Input>("Right"));

  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #7
0
ファイル: main.cpp プロジェクト: Jack-Walker/Ishiiruka
static void InitBackendInfo()
{
	g_Config.backend_info.APIType = API_OPENGL;
#ifdef _WIN32
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_BGRA32] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_RGBA32] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_I4_AS_I8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_IA4_AS_IA8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_I8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_IA8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_RGB565] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_DXT1] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_DXT3] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_DXT5] = true;
#endif
	g_Config.backend_info.bSupportsExclusiveFullscreen = false;
	g_Config.backend_info.bSupportsOversizedViewports = true;
	g_Config.backend_info.bSupportsGeometryShaders = true;
	g_Config.backend_info.bSupports3DVision = false;
	g_Config.backend_info.bSupportsPostProcessing = true;
	g_Config.backend_info.bSupportsSSAA = true;
	g_Config.backend_info.bSupportsPixelLighting = true;
	g_Config.backend_info.bSupportsNormalMaps = true;
	g_Config.backend_info.bSupportsTessellation = false;
	g_Config.backend_info.Adapters.clear();

	// aamodes
	g_Config.backend_info.AAModes = { _trans("None"), "2x MSAA", "4x MSAA", "8x MSAA" };

	// pp shaders
	g_Config.backend_info.PPShaders = GetShaders("");
	g_Config.backend_info.AnaglyphShaders = GetShaders(ANAGLYPH_DIR DIR_SEP);
}
コード例 #8
0
ファイル: ControllerEmu.cpp プロジェクト: Zombiebest/Dolphin
ControllerEmu::Slider::Slider(const char* const _name) : ControlGroup(_name, GROUP_TYPE_SLIDER)
{
	controls.push_back(new Input("Left"));
	controls.push_back(new Input("Right"));

	settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #9
0
ファイル: Slider.cpp プロジェクト: Anti-Ultimate/dolphin
Slider::Slider(const std::string& name, const std::string& ui_name)
    : ControlGroup(name, ui_name, GroupType::Slider)
{
  controls.emplace_back(std::make_unique<Input>("Left"));
  controls.emplace_back(std::make_unique<Input>("Right"));

  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #10
0
ファイル: main.cpp プロジェクト: braindx/dolphin
void VideoBackend::ShowConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
	InitBackendInfo();
	VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D"), "gfx_dx11");
	diag.ShowModal();
#endif
}
コード例 #11
0
GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index)
{
  // buttons
  groups.emplace_back(m_keys0x = new ControllerEmu::Buttons(_trans("Keys")));
  for (const char* key : named_keys0)
    m_keys0x->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, key));

  groups.emplace_back(m_keys1x = new ControllerEmu::Buttons(_trans("Keys")));
  for (const char* key : named_keys1)
    m_keys1x->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, key));

  groups.emplace_back(m_keys2x = new ControllerEmu::Buttons(_trans("Keys")));
  for (const char* key : named_keys2)
    m_keys2x->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, key));

  groups.emplace_back(m_keys3x = new ControllerEmu::Buttons(_trans("Keys")));
  for (const char* key : named_keys3)
    m_keys3x->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, key));

  groups.emplace_back(m_keys4x = new ControllerEmu::Buttons(_trans("Keys")));
  for (const char* key : named_keys4)
    m_keys4x->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, key));

  groups.emplace_back(m_keys5x = new ControllerEmu::Buttons(_trans("Keys")));
  for (const char* key : named_keys5)
    m_keys5x->controls.emplace_back(new ControllerEmu::Input(ControllerEmu::DoNotTranslate, key));

  // options
  groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
}
コード例 #12
0
static pgprot_t agp_convert_mmap_flags(int prot)
{
#define _trans(x,bit1,bit2) \
((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0)

	unsigned long prot_bits;
	pgprot_t temp;

	prot_bits = _trans(prot, PROT_READ, VM_READ) |
	    _trans(prot, PROT_WRITE, VM_WRITE) |
	    _trans(prot, PROT_EXEC, VM_EXEC);

	prot_bits |= VM_SHARED;

	temp = my_protect_map[prot_bits & 0x0000000f];

	return temp;
}
コード例 #13
0
HotkeyManager::HotkeyManager()
{
    for (int key = 0; key < NUM_HOTKEYS; key++)
    {
        int set = key / 32;

        if (key % 32 == 0)
            groups.emplace_back(m_keys[set] = new Buttons(_trans("Keys")));

        m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[key]));
    }

    groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
    m_options->boolean_settings.emplace_back(
        std::make_unique<ControlGroup::BackgroundInputSetting>(_trans("Background Input")));
    m_options->boolean_settings.emplace_back(std::make_unique<ControlGroup::BooleanSetting>(
                _trans("Iterative Input"), false, ControlGroup::SettingType::VIRTUAL));
}
コード例 #14
0
ファイル: main.cpp プロジェクト: Jack-Walker/Ishiiruka
void VideoBackend::ShowConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
	if (!s_BackendInitialized)
		InitBackendInfo();
	VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D11"), GetConfigName());
	diag.ShowModal();
#endif
}
コード例 #15
0
HotkeyManager::HotkeyManager()
{
	for (int group = 0; group < NUM_HOTKEY_GROUPS; group++)
	{
		m_hotkey_groups[group] = (m_keys[group] = new Buttons("Keys", groups_info[group].name));
		groups.emplace_back(m_hotkey_groups[group]);
		for (int key = groups_info[group].first; key <= groups_info[group].last; key++)
		{
			m_keys[group]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[key]));
		}
	}

	groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
	m_options->boolean_settings.emplace_back(
		std::make_unique<ControlGroup::BackgroundInputSetting>(_trans("Background Input")));
	m_options->boolean_settings.emplace_back(std::make_unique<ControlGroup::BooleanSetting>(
		_trans("Iterative Input"), false, ControlGroup::SettingType::VIRTUAL));
}
コード例 #16
0
ファイル: MsgHandler.cpp プロジェクト: NullNoname/dolphin
// This is the first stop for gui alerts where the log is updated and the
// correct window is shown
bool MsgAlert(bool yes_no, int Style, const char* format, ...)
{
	// Read message and write it to the log
	std::string caption;
	char buffer[2048];

	static std::string info_caption;
	static std::string warn_caption;
	static std::string ques_caption;

	if (!info_caption.length())
	{
		info_caption = str_translator(_trans("Information"));
		ques_caption = str_translator(_trans("Question"));
		warn_caption = str_translator(_trans("Warning"));
	}

	switch(Style)
	{
		case INFORMATION:
			caption = info_caption;
			break;
		case QUESTION:
			caption = ques_caption;
			break;
		case WARNING:
			caption = warn_caption;
			break;
	}

	va_list args;
	va_start(args, format);
	CharArrayFromFormatV(buffer, 2047, str_translator(format).c_str(), args);
	va_end(args);

	ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer);

	// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
	if (msg_handler && (AlertEnabled || Style == QUESTION))
		return msg_handler(caption.c_str(), buffer, yes_no, Style);

	return true;
}
コード例 #17
0
ファイル: Drums.cpp プロジェクト: BananaMuffinFrenzy/dolphin
Drums::Drums(WiimoteEmu::ExtensionReg& _reg) : Attachment(_trans("Drums"), _reg)
{
	// pads
	groups.emplace_back(m_pads = new Buttons(_trans("Pads")));
	for (auto& drum_pad_name : drum_pad_names)
		m_pads->controls.emplace_back(new ControlGroup::Input(drum_pad_name));

	// stick
	groups.emplace_back(m_stick = new AnalogStick("Stick", DEFAULT_ATTACHMENT_STICK_RADIUS));

	// buttons
	groups.emplace_back(m_buttons = new Buttons("Buttons"));
	m_buttons->controls.emplace_back(new ControlGroup::Input("-"));
	m_buttons->controls.emplace_back(new ControlGroup::Input("+"));

	// set up register
	// id
	memcpy(&id, drums_id, sizeof(drums_id));
}
コード例 #18
0
ファイル: Drums.cpp プロジェクト: Everscent/dolphin-emu
Drums::Drums() : Attachment(_trans("Drums"))
{
	// pads
	groups.push_back(m_pads = new Buttons(_trans("Pads")));
	for (unsigned int i = 0; i < sizeof(drum_pad_names)/sizeof(*drum_pad_names); ++i)
		m_pads->controls.push_back(new ControlGroup::Input(drum_pad_names[i]));

	// stick
	groups.push_back(m_stick = new AnalogStick("Stick"));

	// buttons
	groups.push_back(m_buttons = new Buttons("Buttons"));
	m_buttons->controls.push_back(new ControlGroup::Input("-"));
	m_buttons->controls.push_back(new ControlGroup::Input("+"));

	// set up register
	// id
	memcpy(&reg[0xfa], drums_id, sizeof(drums_id));
}
コード例 #19
0
ファイル: Tilt.cpp プロジェクト: MerryMage/dolphin
Tilt::Tilt(const std::string& name_) : ControlGroup(name_, GroupType::Tilt)
{
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Forward")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Backward")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));

  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Modifier")));

  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Circle Stick"), 0));
  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Angle"), 0.9, 0, 180));
}
コード例 #20
0
ファイル: HotkeyManager.cpp プロジェクト: Pnum/dolphin
HotkeyManager::HotkeyManager()
{
	for (int set = 0; set < 6; set++)
	{
		// buttons
		if ((set * 32) < num_hotkeys)
			groups.emplace_back(m_keys[set] = new Buttons(_trans("Keys")));

		for (int key = 0; key < 32; key++)
		{
			if ((set * 32 + key) < num_hotkeys)
			{
				m_keys[set]->controls.emplace_back(new ControlGroup::Input(hotkey_labels[set * 32 + key]));
			}
		}
	}

	groups.emplace_back(m_options = new ControlGroup(_trans("Options")));
	m_options->settings.emplace_back(new ControlGroup::BackgroundInputSetting(_trans("Background Input")));
	m_options->settings.emplace_back(new ControlGroup::IterateUI(_trans("Iterative Input")));
}
コード例 #21
0
ファイル: Guitar.cpp プロジェクト: Annovae/Dolphin-Core
Guitar::Guitar(WiimoteEmu::ExtensionReg& _reg) : Attachment(_trans("Guitar"), _reg)
{
	// frets
	groups.push_back(m_frets = new Buttons(_trans("Frets")));
	for (unsigned int i = 0; i < sizeof(guitar_fret_names)/sizeof(*guitar_fret_names); ++i)
		m_frets->controls.push_back(new ControlGroup::Input(guitar_fret_names[i]));

	// strum
	groups.push_back(m_strum = new Buttons(_trans("Strum")));
	m_strum->controls.push_back(new ControlGroup::Input("Up"));
	m_strum->controls.push_back(new ControlGroup::Input("Down"));

	// buttons
	groups.push_back(m_buttons = new Buttons("Buttons"));
	m_buttons->controls.push_back(new ControlGroup::Input("-"));
	m_buttons->controls.push_back(new ControlGroup::Input("+"));

	// stick
	groups.push_back(m_stick = new AnalogStick(_trans("Stick")));

	// whammy
	groups.push_back(m_whammy = new Triggers(_trans("Whammy")));
	m_whammy->controls.push_back(new ControlGroup::Input(_trans("Bar")));

	// set up register
	// id
	memcpy(&id, guitar_id, sizeof(guitar_id));
}
コード例 #22
0
Guitar::Guitar(WiimoteEmu::ExtensionReg& _reg) : Attachment(_trans("Guitar"), _reg)
{
	// frets
	groups.emplace_back(m_frets = new Buttons(_trans("Frets")));
	for (auto& guitar_fret_name : guitar_fret_names)
		m_frets->controls.emplace_back(new ControlGroup::Input(guitar_fret_name));

	// strum
	groups.emplace_back(m_strum = new Buttons(_trans("Strum")));
	m_strum->controls.emplace_back(new ControlGroup::Input("Up"));
	m_strum->controls.emplace_back(new ControlGroup::Input("Down"));

	// buttons
	groups.emplace_back(m_buttons = new Buttons("Buttons"));
	m_buttons->controls.emplace_back(new ControlGroup::Input("-"));
	m_buttons->controls.emplace_back(new ControlGroup::Input("+"));

	// stick
	groups.emplace_back(m_stick = new AnalogStick(_trans("Stick"), DEFAULT_ATTACHMENT_STICK_RADIUS));

	// whammy
	groups.emplace_back(m_whammy = new Triggers(_trans("Whammy")));
	m_whammy->controls.emplace_back(new ControlGroup::Input(_trans("Bar")));

	// set up register
	// id
	memcpy(&id, guitar_id, sizeof(guitar_id));
}
コード例 #23
0
ファイル: GCPad.cpp プロジェクト: delroth/dolphin
namespace Pad
{
static InputConfig s_config("GCPadNew", _trans("Pad"), "GCPad");
InputConfig* GetConfig()
{
  return &s_config;
}

void Shutdown()
{
  s_config.ClearControllers();
}

void Initialize()
{
  if (s_config.ControllersNeedToBeCreated())
  {
    for (unsigned int i = 0; i < 4; ++i)
      s_config.CreateController<GCPad>(i);
  }

  g_controller_interface.RegisterDevicesChangedCallback(LoadConfig);

  // Load the saved controller config
  s_config.LoadConfig(true);
}

void LoadConfig()
{
  s_config.LoadConfig(true);
}

GCPadStatus GetStatus(int pad_num)
{
  return static_cast<GCPad*>(s_config.GetController(pad_num))->GetInput();
}

ControllerEmu::ControlGroup* GetGroup(int pad_num, PadGroup group)
{
  return static_cast<GCPad*>(s_config.GetController(pad_num))->GetGroup(group);
}

void Rumble(const int pad_num, const ControlState strength)
{
  static_cast<GCPad*>(s_config.GetController(pad_num))->SetOutput(strength);
}

bool GetMicButton(const int pad_num)
{
  return static_cast<GCPad*>(s_config.GetController(pad_num))->GetMicButton();
}
}
コード例 #24
0
ファイル: Force.cpp プロジェクト: Mystro256/dolphin
Force::Force(const std::string& name_) : ControlGroup(name_, GroupType::Force)
{
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Up")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Down")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Forward")));
  controls.emplace_back(std::make_unique<Input>(Translate, _trans("Backward")));

  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #25
0
ファイル: GCKeyboard.cpp プロジェクト: Ahriman/dolphin
namespace Keyboard
{

static InputConfig s_config("GCKeyNew", _trans("Keyboard"), "GCKey");
InputConfig* GetConfig()
{
	return &s_config;
}

void Shutdown()
{
	std::vector<ControllerEmu*>::const_iterator
		i = s_config.controllers.begin(),
		e = s_config.controllers.end();
	for ( ; i!=e; ++i )
		delete *i;
	s_config.controllers.clear();

	g_controller_interface.Shutdown();
}

// if plugin isn't initialized, init and load config
void Initialize(void* const hwnd)
{
	if (s_config.controllers.empty())
		for (unsigned int i = 0; i < 4; ++i)
			s_config.controllers.push_back(new GCKeyboard(i));

	g_controller_interface.Initialize(hwnd);

	// load the saved controller config
	s_config.LoadConfig(true);
}

void LoadConfig()
{
	s_config.LoadConfig(true);
}

void GetStatus(u8 _port, KeyboardStatus* _pKeyboardStatus)
{
	memset(_pKeyboardStatus, 0, sizeof(*_pKeyboardStatus));
	_pKeyboardStatus->err = PAD_ERR_NONE;

	std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);

	// get input
	((GCKeyboard*)s_config.controllers[_port])->GetInput(_pKeyboardStatus);
}

}
コード例 #26
0
ControllerEmu::Force::Force(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_FORCE)
{
  memset(m_swing, 0, sizeof(m_swing));

  controls.emplace_back(std::make_unique<Input>(_trans("Up")));
  controls.emplace_back(std::make_unique<Input>(_trans("Down")));
  controls.emplace_back(std::make_unique<Input>(_trans("Left")));
  controls.emplace_back(std::make_unique<Input>(_trans("Right")));
  controls.emplace_back(std::make_unique<Input>(_trans("Forward")));
  controls.emplace_back(std::make_unique<Input>(_trans("Backward")));

  numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #27
0
ControllerEmu::Force::Force(const char* const _name) : ControlGroup(_name, GROUP_TYPE_FORCE)
{
	memset(m_swing, 0, sizeof(m_swing));

	controls.push_back(new Input(_trans("Up")));
	controls.push_back(new Input(_trans("Down")));
	controls.push_back(new Input(_trans("Left")));
	controls.push_back(new Input(_trans("Right")));
	controls.push_back(new Input(_trans("Forward")));
	controls.push_back(new Input(_trans("Backward")));

	settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
}
コード例 #28
0
ファイル: UICommon.cpp プロジェクト: delroth/dolphin
std::string FormatSize(u64 bytes)
{
  // i18n: The symbol for the unit "bytes"
  const char* const unit_symbols[] = {_trans("B"),   _trans("KiB"), _trans("MiB"), _trans("GiB"),
                                      _trans("TiB"), _trans("PiB"), _trans("EiB")};

  // Find largest power of 2 less than size.
  // div 10 to get largest named unit less than size
  // 10 == log2(1024) (number of B in a KiB, KiB in a MiB, etc)
  // Max value is 63 / 10 = 6
  const int unit = IntLog2(std::max<u64>(bytes, 1)) / 10;

  // Don't need exact values, only 5 most significant digits
  const double unit_size = std::pow(2, unit * 10);
  return StringFromFormat("%.2f %s", bytes / unit_size, GetStringT(unit_symbols[unit]).c_str());
}
コード例 #29
0
ファイル: GCKeyboard.cpp プロジェクト: badkarma12/dolphin
namespace Keyboard
{

static InputConfig s_config("GCKeyNew", _trans("Keyboard"), "GCKey");
InputConfig* GetConfig()
{
	return &s_config;
}

void Shutdown()
{
	s_config.ClearControllers();

	g_controller_interface.Shutdown();
}

void Initialize(void* const hwnd)
{
	if (s_config.ControllersNeedToBeCreated())
	{
		for (unsigned int i = 0; i < 4; ++i)
			s_config.CreateController<GCKeyboard>(i);
	}

	g_controller_interface.Initialize(hwnd);

	// Load the saved controller config
	s_config.LoadConfig(true);
}

void LoadConfig()
{
	s_config.LoadConfig(true);
}

void GetStatus(u8 port, KeyboardStatus* keyboard_status)
{
	memset(keyboard_status, 0, sizeof(*keyboard_status));
	keyboard_status->err = PAD_ERR_NONE;

	// Get input
	static_cast<GCKeyboard*>(s_config.GetController(port))->GetInput(keyboard_status);
}

}
コード例 #30
0
ファイル: main.cpp プロジェクト: Asmodean-/dolphin
static void InitBackendInfo()
{
	g_Config.backend_info.APIType = API_OPENGL;
	g_Config.backend_info.bUseMinimalMipCount = false;
	g_Config.backend_info.bSupportsExclusiveFullscreen = false;
	//g_Config.backend_info.bSupportsDualSourceBlend = true; // is gpu dependent and must be set in renderer
	//g_Config.backend_info.bSupportsEarlyZ = true; // is gpu dependent and must be set in renderer
	g_Config.backend_info.bSupportsOversizedViewports = true;

	g_Config.backend_info.Adapters.clear();

	// aamodes
	const char* caamodes[] = {_trans("None"), "2x", "4x", "8x", "4x SSAA"};
	g_Config.backend_info.AAModes.assign(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes));

	// pp shaders
	GetShaders(g_Config.backend_info.PPShaders);
}