Skip to content

Commit

Permalink
Merge pull request #66 from chihirobelmo/dx32-for-435
Browse files Browse the repository at this point in the history
The current version only supports 4.36 and later, now it both supports 4.35 DX32 and 4.36 DX128.
  • Loading branch information
chihirobelmo authored Jul 1, 2022
2 parents 538762e + daba2ab commit 704e32b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
11 changes: 6 additions & 5 deletions Falcon BMS Alternative Launcher/Input/JoyAssgn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ public string GetDeviceSortingLine()

/// <summary>
/// Get whole DX button assignment line to write a key file.
/// DXnumber: total DXnumber per device BMS can handle.
/// </summary>
public string GetKeyLineDX(int joynum, int numOfDevices)
public string GetKeyLineDX(int joynum, int numOfDevices, int DXnumber)
{
string assign = "";
assign += "\n#======== " + GetProductName() + " ========\n";
Expand All @@ -212,15 +213,15 @@ public string GetKeyLineDX(int joynum, int numOfDevices)
if (ii != 0)
continue;
assign += dx[i].assign[ii].GetCallback();
assign += " " + (joynum * CommonConstants.DX128 + i);
assign += " " + (joynum * DXnumber + i);
assign += " " + (int)Invoke.Default;
assign += " " + "-2";
assign += " " + "0";
assign += " " + "0x0";
assign += " " + dx[i].assign[ii].GetSoundID();
assign += "\n";
assign += dx[i].assign[ii].GetCallback();
assign += " " + (numOfDevices * CommonConstants.DX128 + joynum * CommonConstants.DX128 + i);
assign += " " + (numOfDevices * DXnumber + joynum * DXnumber + i);
assign += " " + (int)Invoke.Default;
assign += " " + "-2";
assign += " " + "0";
Expand All @@ -233,9 +234,9 @@ public string GetKeyLineDX(int joynum, int numOfDevices)
assign += dx[i].assign[ii].GetCallback();

if (ii == CommonConstants.DX_PRESS | ii == CommonConstants.DX_RELEASE)
assign += " " + (joynum * CommonConstants.DX128 + i);
assign += " " + (joynum * DXnumber + i);
if (ii == CommonConstants.DX_PRESS_SHIFT | ii == CommonConstants.DX_RELEASE_SHIFT)
assign += " " + (numOfDevices * CommonConstants.DX128 + joynum * CommonConstants.DX128 + i);
assign += " " + (numOfDevices * DXnumber + joynum * DXnumber + i);

assign += " " + (int)dx[i].assign[ii].GetInvoke();
assign += " " + "-2";
Expand Down
12 changes: 7 additions & 5 deletions Falcon BMS Alternative Launcher/Override/OverrideSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ protected void SaveDeviceSorting(DeviceControl deviceControl)
ds.Close();
}

/// <summary>
/// As the name implies...
/// </summary>
protected virtual void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile)
protected virtual void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile, int DXnumber)
{
string filename = appReg.GetInstallDir() + "/User/Config/" + appReg.getAutoKeyFileName();

Expand All @@ -218,14 +215,19 @@ protected virtual void SaveKeyMapping(Hashtable inGameAxis, DeviceControl device
sw.Write(keyFile.keyAssign[i].GetKeyLine());
for (int i = 0; i < deviceControl.joyAssign.Length; i++)
{
sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.joyAssign.Length));
sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.joyAssign.Length, DXnumber));
// PRIMARY DEVICE POV
if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == i)
sw.Write(deviceControl.joyAssign[i].GetKeyLinePOV());
}
sw.Close();
}

protected virtual void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile)
{
SaveKeyMapping(inGameAxis, deviceControl, keyFile, CommonConstants.DX32);
}

/// <summary>
/// Overwrite callsign.pop file.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected override void SaveConfigfile(Hashtable inGameAxis, DeviceControl devic
cfg.Close();
}

protected override void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile)
protected override void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile, int DXnumber)
{
string filename = appReg.GetInstallDir() + "/User/Config/" + appReg.getAutoKeyFileName();

Expand All @@ -72,7 +72,7 @@ protected override void SaveKeyMapping(Hashtable inGameAxis, DeviceControl devic
sw.Write(keyFile.keyAssign[i].GetKeyLine());
for (int i = 0; i < deviceControl.joyAssign.Length; i++)
{
sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.joyAssign.Length));
sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.joyAssign.Length, DXnumber));
// PRIMARY DEVICE POV
if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == i && ((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == ((InGameAxAssgn)inGameAxis["Throttle"]).GetDeviceNumber())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,10 @@ protected override void SaveConfigfile(Hashtable inGameAxis, DeviceControl devic
cfg.Write("set g_nPOV2ID 0 // SETUP OVERRIDE\r\n");
cfg.Close();
}

protected override void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile)
{
SaveKeyMapping(inGameAxis, deviceControl, keyFile, CommonConstants.DX128);
}
}
}

0 comments on commit 704e32b

Please sign in to comment.