@@ -26,37 +26,45 @@ void OnyxBreeze0x248::Initialize(InputManager* p_inputManager)
2626 if (m_inputManager != NULL ) {
2727 Shutdown ();
2828 }
29+
2930 m_inputManager = p_inputManager;
3031 m_unk0x208.Allocate (32 );
32+
3133 KeyboardInputDevice* keyboard = m_inputManager->GetKeyboard ();
3234 if (keyboard != NULL ) {
3335 keyboard->SetCallback (&m_unk0x208);
3436 keyboard->SetRepeatDelays (250 , 500 );
3537 keyboard->Acquire ();
3638 }
37- m_mouse = m_inputManager->GetMouse ();
38- if (m_mouse != NULL ) {
39- m_mouse->SetCallback (&m_unk0x208);
40- m_mouse->SetRepeatDelays (250 , 500 );
41- m_mouse->SetExclusiveMode ();
42- m_mouse->Acquire ();
39+
40+ MouseInputDevice* mouse = m_inputManager->GetMouse ();
41+ m_mouse = mouse;
42+ if (mouse != NULL ) {
43+ mouse->SetCallback (&m_unk0x208);
44+ mouse->SetRepeatDelays (250 , 500 );
45+ mouse->SetExclusiveMode ();
46+ mouse->Acquire ();
4347 }
48+
4449 for (LegoS32 i = 0 ; i < m_inputManager->GetJoystickCount (); i++) {
4550 JoystickInputDevice* joystick = m_inputManager->GetJoystick (i);
46- joystick->SetCallback (&m_unk0x208);
47- joystick->SetAxisButtonEventsEnabled (TRUE );
48- joystick->Acquire ();
49- joystick->SetRepeatDelays (250 , 500 );
50- joystick->SetDeadZonePercent (60 );
51- LegoS32 sourceId = joystick->AddDirectionalTrigger (&m_unk0x224);
52- m_unk0x224.Configure (
53- sourceId,
54- InputDevice::c_sourceJoystick2 | 0x3 ,
55- InputDevice::c_sourceJoystick2 | 0x0 ,
56- InputDevice::c_sourceJoystick2 | 0x2 ,
57- InputDevice::c_sourceJoystick2 | 0x1
58- );
51+ if (joystick != NULL ) {
52+ joystick->SetCallback (&m_unk0x208);
53+ joystick->SetAxisButtonEventsEnabled (TRUE );
54+ joystick->Acquire ();
55+ joystick->SetRepeatDelays (250 , 500 );
56+ joystick->SetDeadZonePercent (60 );
57+ LegoS32 sourceId = joystick->AddDirectionalTrigger (&m_unk0x224);
58+ m_unk0x224.Configure (
59+ sourceId,
60+ InputDevice::c_sourceJoystick2 | 0x3 ,
61+ InputDevice::c_sourceJoystick2 | 0x0 ,
62+ InputDevice::c_sourceJoystick2 | 0x2 ,
63+ InputDevice::c_sourceJoystick2 | 0x1
64+ );
65+ }
5966 }
67+
6068 FUN_0041fac0 ();
6169}
6270
@@ -65,12 +73,14 @@ void OnyxBreeze0x248::Shutdown()
6573{
6674 if (m_inputManager != NULL ) {
6775 KeyboardInputDevice* keyboard = m_inputManager->GetKeyboard ();
76+
6877 if (keyboard != NULL ) {
6978 keyboard->SetCallback (NULL );
7079 keyboard->Unacquire ();
7180 keyboard->SetRepeatEnabled (FALSE );
7281 keyboard->SetEventMappings (NULL , NULL );
7382 }
83+
7484 MouseInputDevice* mouse = m_inputManager->GetMouse ();
7585 if (mouse != NULL ) {
7686 mouse->SetCallback (NULL );
@@ -79,8 +89,10 @@ void OnyxBreeze0x248::Shutdown()
7989 mouse->SetRepeatEnabled (FALSE );
8090 m_mouse = NULL ;
8191 }
92+
8293 for (LegoS32 i = 0 ; i < m_inputManager->GetJoystickCount (); i++) {
8394 JoystickInputDevice* joystick = m_inputManager->GetJoystick (i);
95+
8496 if (joystick != NULL ) {
8597 joystick->SetCallback (NULL );
8698 joystick->Unacquire ();
@@ -90,6 +102,7 @@ void OnyxBreeze0x248::Shutdown()
90102 joystick->RemoveDirectionalTrigger (&m_unk0x224);
91103 }
92104 }
105+
93106 m_unk0x208.Reset ();
94107 m_inputManager = NULL ;
95108 m_mouse = NULL ;
@@ -107,10 +120,12 @@ void OnyxBreeze0x248::FUN_0041fac0()
107120{
108121 for (LegoS32 i = 0 ; i < m_inputManager->GetJoystickCount (); i++) {
109122 JoystickInputDevice* joystick = m_inputManager->GetJoystick (i);
123+
110124 if (joystick != NULL ) {
111125 for (LegoS32 j = 0 ; j < joystick->GetButtonCountFast (); j++) {
112126 m_unk0x004[j] = 4 ;
113127 }
128+
114129 joystick->SetEventMappings (m_unk0x004, NULL );
115130 }
116131 }
0 commit comments