mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 22:09:19 -07:00
3f13dbe087
Some button names should be translated, for instance Up, Left and such.
At the same time, some other button names shouldn't be translated,
for reasons that might be less obvious. In 0146456af
, I removed the
_trans markers for button names that never need to be translated
(such as A and B), but that isn't actually enough to ensure that
DolphinWX won't try to translate them anyway. This commit adds a bool
that explicitly tells the GUI whether a button name should be translated.
Otherwise we'll have problems like the GUI treating the button name "B"
(which isn't supposed to be translated) as matching the translatable
string "B" (being an abbreviation of "bytes"), meaning that the button
"B" will be labeled "o" when running Dolphin in French (after
translations get pulled from Transifex the next time).
By the way, while it turned out that DolphinWX translated all button
names, it also turned out that DolphinQt2 translated *no* button names.
Go figure. This commit makes them consistent with each other.
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
// Copyright 2010 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Common/Common.h"
|
|
#include "Common/IniFile.h"
|
|
#include "InputCommon/ControllerInterface/Device.h"
|
|
|
|
class ControllerInterface;
|
|
|
|
#define sign(x) ((x) ? (x) < 0 ? -1 : 1 : 0)
|
|
|
|
const char* const named_directions[] = {_trans("Up"), _trans("Down"), _trans("Left"),
|
|
_trans("Right")};
|
|
|
|
namespace ControllerEmu
|
|
{
|
|
class ControlGroup;
|
|
|
|
class EmulatedController
|
|
{
|
|
public:
|
|
virtual ~EmulatedController();
|
|
virtual std::string GetName() const = 0;
|
|
|
|
virtual void LoadDefaults(const ControllerInterface& ciface);
|
|
|
|
virtual void LoadConfig(IniFile::Section* sec, const std::string& base = "");
|
|
virtual void SaveConfig(IniFile::Section* sec, const std::string& base = "");
|
|
|
|
bool IsDefaultDeviceConnected() const;
|
|
const ciface::Core::DeviceQualifier& GetDefaultDevice() const;
|
|
void SetDefaultDevice(const std::string& device);
|
|
void SetDefaultDevice(ciface::Core::DeviceQualifier devq);
|
|
|
|
void UpdateReferences(const ControllerInterface& devi);
|
|
|
|
// This returns a lock that should be held before calling State() on any control
|
|
// references and GetState(), by extension. This prevents a race condition
|
|
// which happens while handling a hotplug event because a control reference's State()
|
|
// could be called before we have finished updating the reference.
|
|
static std::unique_lock<std::recursive_mutex> GetStateLock();
|
|
|
|
std::vector<std::unique_ptr<ControlGroup>> groups;
|
|
|
|
private:
|
|
ciface::Core::DeviceQualifier m_default_device;
|
|
bool m_default_device_is_connected{false};
|
|
};
|
|
} // namespace ControllerEmu
|