Defaults for c64, and a dialog tweak

This commit is contained in:
adelikat 2013-07-27 17:59:40 +00:00
parent 54626e57d1
commit fcddc9f038
2 changed files with 129 additions and 30 deletions

View File

@ -120,14 +120,16 @@ namespace BizHawk.MultiClient.config
}
}
private ControllerDefinition the_definition;
public NewControllerConfig(ControllerDefinition def)
: this()
{
the_definition = def;
ControllerType = def.Name;
SuspendLayout();
LoadToPanel(tabPage1, def.Name, def.BoolButtons, Global.Config.AllTrollers, "", CreateNormalPanel);
LoadToPanel(tabPage2, def.Name, def.BoolButtons, Global.Config.AllTrollersAutoFire, "", CreateNormalPanel);
LoadToPanel(tabPage3, def.Name, def.FloatControls, Global.Config.AllTrollersAnalog, new Config.AnalogBind("", 1.0f), CreateAnalogPanel);
LoadPanels();
Text = def.Name + " Configuration";
checkBoxUDLR.Checked = Global.Config.AllowUD_LR;
@ -137,6 +139,13 @@ namespace BizHawk.MultiClient.config
ResumeLayout();
}
private void LoadPanels()
{
LoadToPanel(tabPage1, the_definition.Name, the_definition.BoolButtons, Global.Config.AllTrollers, "", CreateNormalPanel);
LoadToPanel(tabPage2, the_definition.Name, the_definition.BoolButtons, Global.Config.AllTrollersAutoFire, "", CreateNormalPanel);
LoadToPanel(tabPage3, the_definition.Name, the_definition.FloatControls, Global.Config.AllTrollersAnalog, new Config.AnalogBind("", 1.0f), CreateAnalogPanel);
}
void SetControllerPicture(string ControlName)
{
Bitmap bmp;
@ -215,41 +224,52 @@ namespace BizHawk.MultiClient.config
{
// this is not clever. i'm going to replace it with something more clever
var result = MessageBox.Show("OK to load control defaults for this controller?", "Bizhawk", MessageBoxButtons.YesNo);
if (result == System.Windows.Forms.DialogResult.Yes)
ControlDefaults cd = new ControlDefaults();
cd = ConfigService.Load(ControlDefaultPath, cd);
Dictionary<string, string> settings;
Dictionary<string, Config.AnalogBind> asettings;
if (cd.AllTrollers.TryGetValue(ControllerType, out settings))
{
ControlDefaults cd = new ControlDefaults();
cd = ConfigService.Load(ControlDefaultPath, cd);
Dictionary<string, string> settings;
Dictionary<string, Config.AnalogBind> asettings;
if (cd.AllTrollers.TryGetValue(ControllerType, out settings))
Global.Config.AllTrollers[ControllerType] = settings;
else
Global.Config.AllTrollers[ControllerType].Clear();
if (cd.AllTrollersAutoFire.TryGetValue(ControllerType, out settings))
Global.Config.AllTrollersAutoFire[ControllerType] = settings;
else
Global.Config.AllTrollersAutoFire[ControllerType].Clear();
if (cd.AllTrollersAnalog.TryGetValue(ControllerType, out asettings))
Global.Config.AllTrollersAnalog[ControllerType] = asettings;
else
Global.Config.AllTrollersAnalog[ControllerType].Clear();
Global.OSD.AddMessage("Default controls loaded");
DialogResult = System.Windows.Forms.DialogResult.OK;
Close();
Global.Config.AllTrollers[ControllerType] = settings;
}
else
{
Global.Config.AllTrollers[ControllerType].Clear();
}
if (cd.AllTrollersAutoFire.TryGetValue(ControllerType, out settings))
{
Global.Config.AllTrollersAutoFire[ControllerType] = settings;
}
else
{
Global.Config.AllTrollersAutoFire[ControllerType].Clear();
}
if (cd.AllTrollersAnalog.TryGetValue(ControllerType, out asettings))
{
Global.Config.AllTrollersAnalog[ControllerType] = asettings;
}
else
{
Global.Config.AllTrollersAnalog[ControllerType].Clear();
}
Close();
}
private void buttonSaveAllDefaults_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("OK to save defaults for ALL cores?", "Bizhawk", MessageBoxButtons.YesNo);
if (result == System.Windows.Forms.DialogResult.Yes)
if (result == DialogResult.Yes)
{
ControlDefaults cd = new ControlDefaults();
cd.AllTrollers = Global.Config.AllTrollers;
cd.AllTrollersAutoFire = Global.Config.AllTrollersAutoFire;
cd.AllTrollersAnalog = Global.Config.AllTrollersAnalog;
ControlDefaults cd = new ControlDefaults
{
AllTrollers = Global.Config.AllTrollers,
AllTrollersAutoFire = Global.Config.AllTrollersAutoFire,
AllTrollersAnalog = Global.Config.AllTrollersAnalog
};
ConfigService.Save(ControlDefaultPath, cd);
}
}

View File

@ -128,6 +128,85 @@
"R": "E, X1 RightTrigger",
"Power": "",
},
"Commodore 64 Controller": {
"P1 Up": "NumberPad8, X1 DpadUp, X1 LStickUp",
"P1 Down": "NumberPad2, X1 DpadDown, X1 LStickDown",
"P1 Left": "NumberPad4, X1 DpadLeft, X1 LStickLeft",
"P1 Right": "NumberPad6, X1 DpadRight, X1 LStickRight",
"P1 Button": "NumberPad8, X1 A",
"P2 Up": "",
"P2 Down": "",
"P2 Left": "",
"P2 Right": "",
"P2 Button": "",
"Key F1": "F1",
"Key F3": "F3",
"Key F5": "F5",
"Key F7": "F7",
"Key Left Arrow": "Grave",
"Key 1": "D1",
"Key 2": "D2",
"Key 3": "D3",
"Key 4": "D4",
"Key 5": "D5",
"Key 6": "D6",
"Key 7": "D7",
"Key 8": "D8",
"Key 9": "D9",
"Key 0": "D0",
"Key Plus": "Equals",
"Key Minus": "Minus",
"Key Pound": "Insert",
"Key Clear/Home": "Delete",
"Key Insert/Delete": "Backspace",
"Key Control": "Tab",
"Key Q": "Q",
"Key W": "W",
"Key E": "E",
"Key R": "R",
"Key T": "T",
"Key Y": "Y",
"Key U": "U",
"Key I": "I",
"Key O": "O",
"Key P": "P",
"Key At": "LeftBracket",
"Key Asterisk": "RightBracket",
"Key Up Arrow": "Backslash",
"Key Left Arrow": "",
"Key Restore": "",
"Key Run/Stop": "CapsLock",
"Key Lck": "",
"Key A": "A",
"Key S": "S",
"Key D": "D",
"Key F": "F",
"Key G": "G",
"Key H": "H",
"Key J": "J",
"Key K": "K",
"Key L": "L",
"Key Colon": "Semicolon",
"Key Semicolon": "Apostrophe",
"Key Equal": "RightControl",
"Key Return": "Return",
"Key Commodore": "LeftControl",
"Key Left Shift": "LeftShift",
"Key Z": "Z",
"Key X": "X",
"Key C": "C",
"Key V": "V",
"Key B": "B",
"Key N": "N",
"Key M": "M",
"Key Comma": "Comma",
"Key Period": "Period",
"Key Slash": "Slash",
"Key Right Shift": "RightShift",
"Key Cursor Up/Down": "DownArrow",
"Key Cursor Left/Right": "RightArrow",
"Key Space": "Space",
},
"Intellivision Controller": {
"P1 Up": "UpArrow, X1 DpadUp",
"P1 Down": "DownArrow, X1 DpadDown",