mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Finally got the input common strings figured out. That pretty much finishes translations.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6843 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -27,7 +27,7 @@ ControllerEmu::~ControllerEmu()
|
||||
std::vector<ControlGroup*>::const_iterator
|
||||
i = groups.begin(),
|
||||
e = groups.end();
|
||||
for ( ; i!=e; ++i )
|
||||
for (; i!=e; ++i)
|
||||
delete *i;
|
||||
}
|
||||
|
||||
@ -37,14 +37,14 @@ ControllerEmu::ControlGroup::~ControlGroup()
|
||||
std::vector<Control*>::const_iterator
|
||||
ci = controls.begin(),
|
||||
ce = controls.end();
|
||||
for ( ; ci!=ce; ++ci )
|
||||
for (; ci!=ce; ++ci)
|
||||
delete *ci;
|
||||
|
||||
// settings
|
||||
std::vector<Setting*>::const_iterator
|
||||
si = settings.begin(),
|
||||
se = settings.end();
|
||||
for ( ; si!=se; ++si )
|
||||
for (; si!=se; ++si)
|
||||
delete *si;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ ControllerEmu::Extension::~Extension()
|
||||
std::vector<ControllerEmu*>::const_iterator
|
||||
ai = attachments.begin(),
|
||||
ae = attachments.end();
|
||||
for ( ; ai!=ae; ++ai )
|
||||
for (; ai!=ae; ++ai)
|
||||
delete *ai;
|
||||
}
|
||||
ControllerEmu::ControlGroup::Control::~Control()
|
||||
@ -67,21 +67,21 @@ void ControllerEmu::UpdateReferences(ControllerInterface& devi)
|
||||
std::vector<ControlGroup*>::const_iterator
|
||||
i = groups.begin(),
|
||||
e = groups.end();
|
||||
for ( ; i!=e; ++i )
|
||||
for (; i!=e; ++i)
|
||||
{
|
||||
std::vector<ControlGroup::Control*>::const_iterator
|
||||
ci = (*i)->controls.begin(),
|
||||
ce = (*i)->controls.end();
|
||||
for ( ; ci!=ce; ++ci )
|
||||
for (; ci!=ce; ++ci)
|
||||
devi.UpdateReference((*ci)->control_ref, default_device);
|
||||
|
||||
// extension
|
||||
if ( GROUP_TYPE_EXTENSION == (*i)->type )
|
||||
if (GROUP_TYPE_EXTENSION == (*i)->type)
|
||||
{
|
||||
std::vector<ControllerEmu*>::const_iterator
|
||||
ai = ((Extension*)*i)->attachments.begin(),
|
||||
ae = ((Extension*)*i)->attachments.end();
|
||||
for ( ; ai!=ae; ++ai )
|
||||
for (; ai!=ae; ++ai)
|
||||
(*ai)->UpdateReferences(devi);
|
||||
}
|
||||
}
|
||||
@ -92,21 +92,21 @@ void ControllerEmu::UpdateDefaultDevice()
|
||||
std::vector<ControlGroup*>::const_iterator
|
||||
i = groups.begin(),
|
||||
e = groups.end();
|
||||
for ( ; i!=e; ++i )
|
||||
for (; i!=e; ++i)
|
||||
{
|
||||
//std::vector<ControlGroup::Control*>::const_iterator
|
||||
//ci = (*i)->controls.begin(),
|
||||
//ce = (*i)->controls.end();
|
||||
//for ( ; ci!=ce; ++ci )
|
||||
//for (; ci!=ce; ++ci)
|
||||
//(*ci)->control_ref->device_qualifier = default_device;
|
||||
|
||||
// extension
|
||||
if ( GROUP_TYPE_EXTENSION == (*i)->type )
|
||||
if (GROUP_TYPE_EXTENSION == (*i)->type)
|
||||
{
|
||||
std::vector<ControllerEmu*>::const_iterator
|
||||
ai = ((Extension*)*i)->attachments.begin(),
|
||||
ae = ((Extension*)*i)->attachments.end();
|
||||
for ( ; ai!=ae; ++ai )
|
||||
for (; ai!=ae; ++ai)
|
||||
{
|
||||
(*ai)->default_device = default_device;
|
||||
(*ai)->UpdateDefaultDevice();
|
||||
@ -115,15 +115,15 @@ void ControllerEmu::UpdateDefaultDevice()
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerEmu::ControlGroup::LoadConfig(IniFile::Section *sec, const std::string& defdev, const std::string& base )
|
||||
void ControllerEmu::ControlGroup::LoadConfig(IniFile::Section *sec, const std::string& defdev, const std::string& base)
|
||||
{
|
||||
std::string group( base + name ); group += "/";
|
||||
std::string group(base + name); group += "/";
|
||||
|
||||
// settings
|
||||
std::vector<ControlGroup::Setting*>::const_iterator
|
||||
si = settings.begin(),
|
||||
se = settings.end();
|
||||
for ( ; si!=se; ++si )
|
||||
for (; si!=se; ++si)
|
||||
{
|
||||
sec->Get((group+(*si)->name).c_str(), &(*si)->value, (*si)->default_value*100);
|
||||
(*si)->value /= 100;
|
||||
@ -133,19 +133,19 @@ void ControllerEmu::ControlGroup::LoadConfig(IniFile::Section *sec, const std::s
|
||||
std::vector<ControlGroup::Control*>::const_iterator
|
||||
ci = controls.begin(),
|
||||
ce = controls.end();
|
||||
for ( ; ci!=ce; ++ci )
|
||||
for (; ci!=ce; ++ci)
|
||||
{
|
||||
// control expression
|
||||
sec->Get((group + (*ci)->name).c_str(), &(*ci)->control_ref->expression, "");
|
||||
|
||||
// range
|
||||
sec->Get( (group+(*ci)->name+"/Range").c_str(), &(*ci)->control_ref->range, 100.0f);
|
||||
sec->Get((group+(*ci)->name+"/Range").c_str(), &(*ci)->control_ref->range, 100.0f);
|
||||
(*ci)->control_ref->range /= 100;
|
||||
|
||||
}
|
||||
|
||||
// extensions
|
||||
if ( GROUP_TYPE_EXTENSION == type )
|
||||
if (GROUP_TYPE_EXTENSION == type)
|
||||
{
|
||||
Extension* const ex = ((Extension*)this);
|
||||
|
||||
@ -157,18 +157,18 @@ void ControllerEmu::ControlGroup::LoadConfig(IniFile::Section *sec, const std::s
|
||||
std::vector<ControllerEmu*>::const_iterator
|
||||
ai = ((Extension*)this)->attachments.begin(),
|
||||
ae = ((Extension*)this)->attachments.end();
|
||||
for ( ; ai!=ae; ++ai,++n )
|
||||
for (; ai!=ae; ++ai,++n)
|
||||
{
|
||||
(*ai)->default_device.FromString( defdev );
|
||||
(*ai)->LoadConfig( sec, base + (*ai)->GetName() + "/" );
|
||||
(*ai)->default_device.FromString(defdev);
|
||||
(*ai)->LoadConfig(sec, base + (*ai)->GetName() + "/");
|
||||
|
||||
if ( (*ai)->GetName() == extname )
|
||||
if ((*ai)->GetName() == extname)
|
||||
ex->switch_extension = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerEmu::LoadConfig( IniFile::Section *sec, const std::string& base )
|
||||
void ControllerEmu::LoadConfig(IniFile::Section *sec, const std::string& base)
|
||||
{
|
||||
std::string defdev = default_device.ToString();
|
||||
if (base.empty())
|
||||
@ -178,36 +178,36 @@ void ControllerEmu::LoadConfig( IniFile::Section *sec, const std::string& base )
|
||||
}
|
||||
std::vector<ControlGroup*>::const_iterator i = groups.begin(),
|
||||
e = groups.end();
|
||||
for ( ; i!=e; ++i )
|
||||
for (; i!=e; ++i)
|
||||
(*i)->LoadConfig(sec, defdev, base);
|
||||
}
|
||||
|
||||
void ControllerEmu::ControlGroup::SaveConfig( IniFile::Section *sec, const std::string& defdev, const std::string& base )
|
||||
void ControllerEmu::ControlGroup::SaveConfig(IniFile::Section *sec, const std::string& defdev, const std::string& base)
|
||||
{
|
||||
std::string group( base + name ); group += "/";
|
||||
std::string group(base + name); group += "/";
|
||||
|
||||
// settings
|
||||
std::vector<ControlGroup::Setting*>::const_iterator
|
||||
si = settings.begin(),
|
||||
se = settings.end();
|
||||
for ( ; si!=se; ++si )
|
||||
sec->Set( (group+(*si)->name).c_str(), (*si)->value*100.0f, (*si)->default_value*100.0f);
|
||||
for (; si!=se; ++si)
|
||||
sec->Set((group+(*si)->name).c_str(), (*si)->value*100.0f, (*si)->default_value*100.0f);
|
||||
|
||||
// controls
|
||||
std::vector<ControlGroup::Control*>::const_iterator
|
||||
ci = controls.begin(),
|
||||
ce = controls.end();
|
||||
for ( ; ci!=ce; ++ci )
|
||||
for (; ci!=ce; ++ci)
|
||||
{
|
||||
// control expression
|
||||
sec->Set( (group+(*ci)->name).c_str(), (*ci)->control_ref->expression, "");
|
||||
sec->Set((group+(*ci)->name).c_str(), (*ci)->control_ref->expression, "");
|
||||
|
||||
// range
|
||||
sec->Set( (group+(*ci)->name+"/Range").c_str(), (*ci)->control_ref->range*100.0f, 100.0f);
|
||||
sec->Set((group+(*ci)->name+"/Range").c_str(), (*ci)->control_ref->range*100.0f, 100.0f);
|
||||
}
|
||||
|
||||
// extensions
|
||||
if ( GROUP_TYPE_EXTENSION == type )
|
||||
if (GROUP_TYPE_EXTENSION == type)
|
||||
{
|
||||
Extension* const ext = ((Extension*)this);
|
||||
sec->Set((base + name).c_str(), ext->attachments[ext->switch_extension]->GetName(), "None");
|
||||
@ -215,48 +215,48 @@ void ControllerEmu::ControlGroup::SaveConfig( IniFile::Section *sec, const std::
|
||||
std::vector<ControllerEmu*>::const_iterator
|
||||
ai = ((Extension*)this)->attachments.begin(),
|
||||
ae = ((Extension*)this)->attachments.end();
|
||||
for ( ; ai!=ae; ++ai )
|
||||
(*ai)->SaveConfig( sec, base + (*ai)->GetName() + "/" );
|
||||
for (; ai!=ae; ++ai)
|
||||
(*ai)->SaveConfig(sec, base + (*ai)->GetName() + "/");
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerEmu::SaveConfig( IniFile::Section *sec, const std::string& base )
|
||||
void ControllerEmu::SaveConfig(IniFile::Section *sec, const std::string& base)
|
||||
{
|
||||
const std::string defdev = default_device.ToString();
|
||||
if ( base.empty() )
|
||||
sec->Set( (/*std::string(" ") +*/ base + "Device").c_str(), defdev, "");
|
||||
if (base.empty())
|
||||
sec->Set((/*std::string(" ") +*/ base + "Device").c_str(), defdev, "");
|
||||
|
||||
std::vector<ControlGroup*>::const_iterator i = groups.begin(),
|
||||
e = groups.end();
|
||||
for ( ; i!=e; ++i )
|
||||
(*i)->SaveConfig( sec, defdev, base );
|
||||
for (; i!=e; ++i)
|
||||
(*i)->SaveConfig(sec, defdev, base);
|
||||
}
|
||||
|
||||
ControllerEmu::AnalogStick::AnalogStick( const char* const _name ) : ControlGroup( _name, GROUP_TYPE_STICK )
|
||||
ControllerEmu::AnalogStick::AnalogStick(const char* const _name) : ControlGroup(_name, GROUP_TYPE_STICK)
|
||||
{
|
||||
for ( unsigned int i = 0; i < 4; ++i )
|
||||
controls.push_back( new Input( named_directions[i] ) );
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
controls.push_back(new Input(named_directions[i]));
|
||||
|
||||
controls.push_back( new Input( "Modifier" ) );
|
||||
controls.push_back(new Input(_trans("Modifier")));
|
||||
|
||||
settings.push_back( new Setting("Dead Zone", 0, 0, 50 ) );
|
||||
settings.push_back( new Setting("Square Stick", 0 ) );
|
||||
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.push_back(new Setting(_trans("Square Stick"), 0));
|
||||
|
||||
}
|
||||
|
||||
ControllerEmu::Buttons::Buttons( const char* const _name ) : ControlGroup( _name, GROUP_TYPE_BUTTONS )
|
||||
ControllerEmu::Buttons::Buttons(const char* const _name) : ControlGroup(_name, GROUP_TYPE_BUTTONS)
|
||||
{
|
||||
settings.push_back( new Setting("Threshold", 0.5f ) );
|
||||
settings.push_back(new Setting(_trans("Threshold"), 0.5f));
|
||||
}
|
||||
|
||||
ControllerEmu::MixedTriggers::MixedTriggers( const char* const _name ) : ControlGroup( _name, GROUP_TYPE_MIXED_TRIGGERS )
|
||||
ControllerEmu::MixedTriggers::MixedTriggers(const char* const _name) : ControlGroup(_name, GROUP_TYPE_MIXED_TRIGGERS)
|
||||
{
|
||||
settings.push_back( new Setting("Threshold", 0.9f ) );
|
||||
settings.push_back(new Setting(_trans("Threshold"), 0.9f));
|
||||
}
|
||||
|
||||
ControllerEmu::Triggers::Triggers( const char* const _name ) : ControlGroup( _name, GROUP_TYPE_TRIGGERS )
|
||||
ControllerEmu::Triggers::Triggers(const char* const _name) : ControlGroup(_name, GROUP_TYPE_TRIGGERS)
|
||||
{
|
||||
settings.push_back( new Setting("Dead Zone", 0, 0, 50 ) );
|
||||
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Slider::Slider(const char* const _name) : ControlGroup(_name, GROUP_TYPE_SLIDER)
|
||||
@ -264,53 +264,52 @@ ControllerEmu::Slider::Slider(const char* const _name) : ControlGroup(_name, GRO
|
||||
controls.push_back(new Input("Left"));
|
||||
controls.push_back(new Input("Right"));
|
||||
|
||||
settings.push_back(new Setting("Dead Zone", 0, 0, 50));
|
||||
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Force::Force( const char* const _name ) : ControlGroup( _name, GROUP_TYPE_FORCE )
|
||||
ControllerEmu::Force::Force(const char* const _name) : ControlGroup(_name, GROUP_TYPE_FORCE)
|
||||
{
|
||||
memset(m_swing, 0, sizeof(m_swing));
|
||||
|
||||
controls.push_back( new Input( "Up" ) );
|
||||
controls.push_back( new Input( "Down" ) );
|
||||
controls.push_back( new Input( "Left" ) );
|
||||
controls.push_back( new Input( "Right" ) );
|
||||
controls.push_back( new Input( "Forward" ) );
|
||||
controls.push_back( new Input( "Backward" ) );
|
||||
//controls.push_back( new Input( "Modifier" ) );
|
||||
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("Dead Zone", 0, 0, 50 ) );
|
||||
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Tilt::Tilt( const char* const _name )
|
||||
: ControlGroup( _name, GROUP_TYPE_TILT )
|
||||
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("Forward"));
|
||||
controls.push_back(new Input("Backward"));
|
||||
controls.push_back(new Input("Left"));
|
||||
controls.push_back(new Input("Right"));
|
||||
|
||||
controls.push_back( new Input( "Modifier" ) );
|
||||
controls.push_back(new Input(_trans("Modifier")));
|
||||
|
||||
settings.push_back( new Setting("Dead Zone", 0, 0, 50 ) );
|
||||
settings.push_back( new Setting("Circle Stick", 0 ) );
|
||||
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.push_back(new Setting(_trans("Circle Stick"), 0));
|
||||
}
|
||||
|
||||
ControllerEmu::Cursor::Cursor(const char* const _name)
|
||||
: ControlGroup(_name, GROUP_TYPE_CURSOR)
|
||||
, m_z(0)
|
||||
{
|
||||
for ( unsigned int i = 0; i < 4; ++i )
|
||||
controls.push_back( new Input( named_directions[i] ) );
|
||||
controls.push_back( new Input( "Forward" ) );
|
||||
controls.push_back( new Input( "Backward" ) );
|
||||
controls.push_back( new Input( "Hide" ) );
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
controls.push_back(new Input(named_directions[i]));
|
||||
controls.push_back(new Input("Forward"));
|
||||
controls.push_back(new Input("Backward"));
|
||||
controls.push_back(new Input(_trans("Hide")));
|
||||
|
||||
settings.push_back( new Setting("Center", 0.5f ) );
|
||||
settings.push_back( new Setting("Width", 0.5f ) );
|
||||
settings.push_back( new Setting("Height", 0.5f ) );
|
||||
settings.push_back(new Setting(_trans("Center"), 0.5f));
|
||||
settings.push_back(new Setting(_trans("Width"), 0.5f));
|
||||
settings.push_back(new Setting(_trans("Height"), 0.5f));
|
||||
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
class Control
|
||||
{
|
||||
protected:
|
||||
Control( ControllerInterface::ControlReference* const _ref, const char * const _name )
|
||||
Control(ControllerInterface::ControlReference* const _ref, const char * const _name)
|
||||
: control_ref(_ref), name(_name){}
|
||||
public:
|
||||
|
||||
@ -81,8 +81,8 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
Input( const char * const _name )
|
||||
: Control( new ControllerInterface::InputReference, _name ) {}
|
||||
Input(const char * const _name)
|
||||
: Control(new ControllerInterface::InputReference, _name) {}
|
||||
|
||||
};
|
||||
|
||||
@ -90,8 +90,8 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
Output( const char * const _name )
|
||||
: Control( new ControllerInterface::OutputReference, _name ) {}
|
||||
Output(const char * const _name)
|
||||
: Control(new ControllerInterface::OutputReference, _name) {}
|
||||
|
||||
};
|
||||
|
||||
@ -113,7 +113,7 @@ public:
|
||||
const unsigned int low, high;
|
||||
};
|
||||
|
||||
ControlGroup( const char* const _name, const unsigned int _type = GROUP_TYPE_OTHER ) : name(_name), type(_type) {}
|
||||
ControlGroup(const char* const _name, const unsigned int _type = GROUP_TYPE_OTHER) : name(_name), type(_type) {}
|
||||
virtual ~ControlGroup();
|
||||
|
||||
virtual void LoadConfig(IniFile::Section *sec, const std::string& defdev = "", const std::string& base = "" );
|
||||
@ -132,7 +132,7 @@ public:
|
||||
public:
|
||||
|
||||
template <typename C>
|
||||
void GetState( C* const x, C* const y, const unsigned int base, const unsigned int range )
|
||||
void GetState(C* const x, C* const y, const unsigned int base, const unsigned int range)
|
||||
{
|
||||
// this is all a mess
|
||||
|
||||
@ -144,62 +144,62 @@ public:
|
||||
ControlState m = controls[4]->control_ref->State();
|
||||
|
||||
// modifier code
|
||||
if ( m )
|
||||
if (m)
|
||||
{
|
||||
yy = (fabsf(yy)>deadzone) * sign(yy) * (m + deadzone/2);
|
||||
xx = (fabsf(xx)>deadzone) * sign(xx) * (m + deadzone/2);
|
||||
}
|
||||
|
||||
// deadzone / square stick code
|
||||
if ( deadzone || square )
|
||||
if (deadzone || square)
|
||||
{
|
||||
// this section might be all wrong, but its working good enough, i think
|
||||
|
||||
ControlState ang = atan2( yy, xx );
|
||||
ControlState ang = atan2(yy, xx);
|
||||
ControlState ang_sin = sin(ang);
|
||||
ControlState ang_cos = cos(ang);
|
||||
|
||||
// the amt a full square stick would have at current angle
|
||||
ControlState square_full = std::min( ang_sin ? 1/fabsf(ang_sin) : 2, ang_cos ? 1/fabsf(ang_cos) : 2 );
|
||||
ControlState square_full = std::min(ang_sin ? 1/fabsf(ang_sin) : 2, ang_cos ? 1/fabsf(ang_cos) : 2);
|
||||
|
||||
// the amt a full stick would have that was ( user setting squareness) at current angle
|
||||
// i think this is more like a pointed circle rather than a rounded square like it should be
|
||||
ControlState stick_full = ( 1 + ( square_full - 1 ) * square );
|
||||
ControlState stick_full = (1 + (square_full - 1) * square);
|
||||
|
||||
ControlState dist = sqrt(xx*xx + yy*yy);
|
||||
|
||||
// dead zone code
|
||||
dist = std::max( 0.0f, dist - deadzone * stick_full );
|
||||
dist /= ( 1 - deadzone );
|
||||
dist = std::max(0.0f, dist - deadzone * stick_full);
|
||||
dist /= (1 - deadzone);
|
||||
|
||||
// square stick code
|
||||
ControlState amt = dist / stick_full;
|
||||
dist -= ((square_full - 1) * amt * square);
|
||||
|
||||
yy = std::max( -1.0f, std::min( 1.0f, ang_sin * dist ) );
|
||||
xx = std::max( -1.0f, std::min( 1.0f, ang_cos * dist ) );
|
||||
yy = std::max(-1.0f, std::min(1.0f, ang_sin * dist));
|
||||
xx = std::max(-1.0f, std::min(1.0f, ang_cos * dist));
|
||||
}
|
||||
|
||||
*y = C( yy * range + base );
|
||||
*x = C( xx * range + base );
|
||||
*y = C(yy * range + base);
|
||||
*x = C(xx * range + base);
|
||||
}
|
||||
|
||||
AnalogStick( const char* const _name );
|
||||
AnalogStick(const char* const _name);
|
||||
|
||||
};
|
||||
|
||||
class Buttons : public ControlGroup
|
||||
{
|
||||
public:
|
||||
Buttons( const char* const _name );
|
||||
Buttons(const char* const _name);
|
||||
|
||||
template <typename C>
|
||||
void GetState( C* const buttons, const C* bitmasks )
|
||||
void GetState(C* const buttons, const C* bitmasks)
|
||||
{
|
||||
std::vector<Control*>::iterator i = controls.begin(),
|
||||
e = controls.end();
|
||||
for ( ; i!=e; ++i, ++bitmasks )
|
||||
if ( (*i)->control_ref->State() > settings[0]->value ) // threshold
|
||||
for (; i!=e; ++i, ++bitmasks)
|
||||
if ((*i)->control_ref->State() > settings[0]->value) // threshold
|
||||
*buttons |= *bitmasks;
|
||||
}
|
||||
|
||||
@ -210,12 +210,12 @@ public:
|
||||
public:
|
||||
|
||||
template <typename C, typename S>
|
||||
void GetState( C* const digital, const C* bitmasks, S* analog, const unsigned int range )
|
||||
void GetState(C* const digital, const C* bitmasks, S* analog, const unsigned int range)
|
||||
{
|
||||
const unsigned int trig_count = ((unsigned int) (controls.size() / 2));
|
||||
for ( unsigned int i=0; i<trig_count; ++i,++bitmasks,++analog )
|
||||
for (unsigned int i=0; i<trig_count; ++i,++bitmasks,++analog)
|
||||
{
|
||||
if ( controls[i]->control_ref->State() > settings[0]->value ) //threshold
|
||||
if (controls[i]->control_ref->State() > settings[0]->value) //threshold
|
||||
{
|
||||
*analog = range;
|
||||
*digital |= *bitmasks;
|
||||
@ -226,7 +226,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
MixedTriggers( const char* const _name );
|
||||
MixedTriggers(const char* const _name);
|
||||
|
||||
};
|
||||
|
||||
@ -235,15 +235,15 @@ public:
|
||||
public:
|
||||
|
||||
template <typename S>
|
||||
void GetState( S* analog, const unsigned int range )
|
||||
void GetState(S* analog, const unsigned int range)
|
||||
{
|
||||
const unsigned int trig_count = ((unsigned int) (controls.size()));
|
||||
const ControlState deadzone = settings[0]->value;
|
||||
for ( unsigned int i=0; i<trig_count; ++i,++analog )
|
||||
*analog = S( std::max(controls[i]->control_ref->State() - deadzone, 0.0f) / (1 - deadzone) * range );
|
||||
for (unsigned int i=0; i<trig_count; ++i,++analog)
|
||||
*analog = S(std::max(controls[i]->control_ref->State() - deadzone, 0.0f) / (1 - deadzone) * range);
|
||||
}
|
||||
|
||||
Triggers( const char* const _name );
|
||||
Triggers(const char* const _name);
|
||||
|
||||
};
|
||||
|
||||
@ -270,7 +270,7 @@ public:
|
||||
class Force : public ControlGroup
|
||||
{
|
||||
public:
|
||||
Force( const char* const _name );
|
||||
Force(const char* const _name);
|
||||
|
||||
template <typename C, typename R>
|
||||
void GetState(C* axis, const u8 base, const R range)
|
||||
@ -295,7 +295,7 @@ public:
|
||||
class Tilt : public ControlGroup
|
||||
{
|
||||
public:
|
||||
Tilt( const char* const _name );
|
||||
Tilt(const char* const _name);
|
||||
|
||||
template <typename C, typename R>
|
||||
void GetState(C* const x, C* const y, const unsigned int base, const R range, const bool step = true)
|
||||
@ -310,40 +310,40 @@ public:
|
||||
ControlState m = controls[4]->control_ref->State();
|
||||
|
||||
// modifier code
|
||||
if ( m )
|
||||
if (m)
|
||||
{
|
||||
yy = (fabsf(yy)>deadzone) * sign(yy) * (m + deadzone/2);
|
||||
xx = (fabsf(xx)>deadzone) * sign(xx) * (m + deadzone/2);
|
||||
}
|
||||
|
||||
// deadzone / circle stick code
|
||||
if ( deadzone || circle )
|
||||
if (deadzone || circle)
|
||||
{
|
||||
// this section might be all wrong, but its working good enough, i think
|
||||
|
||||
ControlState ang = atan2( yy, xx );
|
||||
ControlState ang = atan2(yy, xx);
|
||||
ControlState ang_sin = sin(ang);
|
||||
ControlState ang_cos = cos(ang);
|
||||
|
||||
// the amt a full square stick would have at current angle
|
||||
ControlState square_full = std::min( ang_sin ? 1/fabsf(ang_sin) : 2, ang_cos ? 1/fabsf(ang_cos) : 2 );
|
||||
ControlState square_full = std::min(ang_sin ? 1/fabsf(ang_sin) : 2, ang_cos ? 1/fabsf(ang_cos) : 2);
|
||||
|
||||
// the amt a full stick would have that was ( user setting circular ) at current angle
|
||||
// the amt a full stick would have that was (user setting circular) at current angle
|
||||
// i think this is more like a pointed circle rather than a rounded square like it should be
|
||||
ControlState stick_full = (square_full * (1 - circle)) + (circle);
|
||||
|
||||
ControlState dist = sqrt(xx*xx + yy*yy);
|
||||
|
||||
// dead zone code
|
||||
dist = std::max( 0.0f, dist - deadzone * stick_full );
|
||||
dist = std::max(0.0f, dist - deadzone * stick_full);
|
||||
dist /= (1 - deadzone);
|
||||
|
||||
// circle stick code
|
||||
ControlState amt = dist / stick_full;
|
||||
dist += (square_full - 1) * amt * circle;
|
||||
|
||||
yy = std::max( -1.0f, std::min( 1.0f, ang_sin * dist ) );
|
||||
xx = std::max( -1.0f, std::min( 1.0f, ang_cos * dist ) );
|
||||
yy = std::max(-1.0f, std::min(1.0f, ang_sin * dist));
|
||||
xx = std::max(-1.0f, std::min(1.0f, ang_cos * dist));
|
||||
}
|
||||
|
||||
// this is kinda silly here
|
||||
@ -363,8 +363,8 @@ public:
|
||||
m_tilt[1] = std::max(m_tilt[1] - 0.1f, yy);
|
||||
}
|
||||
|
||||
*y = C( m_tilt[1] * range + base );
|
||||
*x = C( m_tilt[0] * range + base );
|
||||
*y = C(m_tilt[1] * range + base);
|
||||
*x = C(m_tilt[0] * range + base);
|
||||
}
|
||||
private:
|
||||
float m_tilt[2];
|
||||
@ -376,7 +376,7 @@ public:
|
||||
Cursor(const char* const _name);
|
||||
|
||||
template <typename C>
|
||||
void GetState( C* const x, C* const y, C* const z, const bool adjusted = false )
|
||||
void GetState(C* const x, C* const y, C* const z, const bool adjusted = false)
|
||||
{
|
||||
const float zz = controls[4]->control_ref->State() - controls[5]->control_ref->State();
|
||||
|
||||
@ -401,9 +401,9 @@ public:
|
||||
// adjust cursor according to settings
|
||||
if (adjusted)
|
||||
{
|
||||
xx *= ( settings[1]->value * 2 );
|
||||
yy *= ( settings[2]->value * 2 );
|
||||
yy += ( settings[0]->value - 0.5f );
|
||||
xx *= (settings[1]->value * 2);
|
||||
yy *= (settings[2]->value * 2);
|
||||
yy += (settings[0]->value - 0.5f);
|
||||
}
|
||||
|
||||
*x = xx;
|
||||
@ -417,13 +417,13 @@ public:
|
||||
class Extension : public ControlGroup
|
||||
{
|
||||
public:
|
||||
Extension( const char* const _name )
|
||||
: ControlGroup( _name, GROUP_TYPE_EXTENSION )
|
||||
Extension(const char* const _name)
|
||||
: ControlGroup(_name, GROUP_TYPE_EXTENSION)
|
||||
, switch_extension(0)
|
||||
, active_extension(0) {}
|
||||
~Extension();
|
||||
|
||||
void GetState( u8* const data, const bool focus = true );
|
||||
void GetState(u8* const data, const bool focus = true);
|
||||
|
||||
std::vector<ControllerEmu*> attachments;
|
||||
|
||||
@ -441,7 +441,7 @@ public:
|
||||
virtual void SaveConfig(IniFile::Section *sec, const std::string& base = "");
|
||||
void UpdateDefaultDevice();
|
||||
|
||||
void UpdateReferences( ControllerInterface& devi );
|
||||
void UpdateReferences(ControllerInterface& devi);
|
||||
|
||||
std::vector< ControlGroup* > groups;
|
||||
|
||||
|
Reference in New Issue
Block a user