Fix auto-lighting not reactivating quickly.
This commit is contained in:
parent
331bdc5b56
commit
cc07e07649
@ -412,20 +412,20 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return lights for the given pad and pad state, using the loaded panel animations.
|
// Return lights for the given pad and pad state, using the loaded panel animations.
|
||||||
void GetCurrentLights(string &asLightsDataOut, int pad, int iPadState)
|
bool GetCurrentLights(string &asLightsDataOut, int pad, int iPadState)
|
||||||
{
|
{
|
||||||
m_Lock.AssertLockedByCurrentThread();
|
m_Lock.AssertLockedByCurrentThread();
|
||||||
|
|
||||||
// Get this pad's configuration.
|
// Get this pad's configuration.
|
||||||
SMXConfig config;
|
SMXConfig config;
|
||||||
if(!SMXManager::g_pSMX->GetDevice(pad)->GetConfig(config))
|
if(!SMXManager::g_pSMX->GetDevice(pad)->GetConfig(config))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
// If this controller handles animation itself, don't handle it here too. It can
|
// If this controller handles animation itself, don't handle it here too. It can
|
||||||
// lead to confusing situations if SMXConfig's animations don't match the ones stored
|
// lead to confusing situations if SMXConfig's animations don't match the ones stored
|
||||||
// on the pad.
|
// on the pad.
|
||||||
if(config.masterVersion >= 4)
|
if(config.masterVersion >= 4)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
AnimationStateForPad &pad_state = pad_states[pad];
|
AnimationStateForPad &pad_state = pad_states[pad];
|
||||||
|
|
||||||
@ -453,19 +453,23 @@ private:
|
|||||||
for(auto &animation_state: pad_state.animations[panel])
|
for(auto &animation_state: pad_state.animations[panel])
|
||||||
animation_state.Update();
|
animation_state.Update();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run a single light animation update.
|
// Run a single light animation update.
|
||||||
void UpdateLights()
|
void UpdateLights()
|
||||||
{
|
{
|
||||||
string asLightsData[2];
|
string asLightsData[2];
|
||||||
|
bool bHaveLights = false;
|
||||||
for(int pad = 0; pad < 2; pad++)
|
for(int pad = 0; pad < 2; pad++)
|
||||||
{
|
{
|
||||||
int iPadState = SMXManager::g_pSMX->GetDevice(pad)->GetInputState();
|
int iPadState = SMXManager::g_pSMX->GetDevice(pad)->GetInputState();
|
||||||
GetCurrentLights(asLightsData[pad], pad, iPadState);
|
if(GetCurrentLights(asLightsData[pad], pad, iPadState))
|
||||||
|
bHaveLights = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update lights.
|
// Update lights.
|
||||||
|
if(bHaveLights)
|
||||||
SMXManager::g_pSMX->SetLights(asLightsData);
|
SMXManager::g_pSMX->SetLights(asLightsData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -500,7 +500,12 @@ namespace smx_config
|
|||||||
{
|
{
|
||||||
LightsTimer.Stop();
|
LightsTimer.Stop();
|
||||||
|
|
||||||
// Turn lighting control back on.
|
// Reenable pad auto-lighting. If we're running animations in SMXPanelAnimation,
|
||||||
|
// this will be overridden by it once it sends lights.
|
||||||
|
SMX.SMX.ReenableAutoLights();
|
||||||
|
|
||||||
|
// Turn lighting control back on. This will only do anything on pads without
|
||||||
|
// support for animations.
|
||||||
SMX.SMX.LightsAnimation_SetAuto(true);
|
SMX.SMX.LightsAnimation_SetAuto(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +297,8 @@ namespace SMX
|
|||||||
private static extern bool SMX_GetTestData(int pad, out SMXSensorTestModeData data);
|
private static extern bool SMX_GetTestData(int pad, out SMXSensorTestModeData data);
|
||||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern bool SMX_SetLights2(byte[] buf, int lightDataSize);
|
private static extern bool SMX_SetLights2(byte[] buf, int lightDataSize);
|
||||||
|
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern bool SMX_ReenableAutoLights();
|
||||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
private static extern IntPtr SMX_Version();
|
private static extern IntPtr SMX_Version();
|
||||||
|
|
||||||
@ -471,6 +473,13 @@ namespace SMX
|
|||||||
SMX_SetLights2(buf, buf.Length);
|
SMX_SetLights2(buf, buf.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ReenableAutoLights()
|
||||||
|
{
|
||||||
|
if(!DLLAvailable()) return;
|
||||||
|
|
||||||
|
SMX_ReenableAutoLights();
|
||||||
|
}
|
||||||
|
|
||||||
// SMXPanelAnimation
|
// SMXPanelAnimation
|
||||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
[return:MarshalAs(UnmanagedType.I1)]
|
[return:MarshalAs(UnmanagedType.I1)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user