Skip to content

Commit

Permalink
Add HID_DONT_CREATE_INSTANCES flag (workaround for NicoHood#266 NicoH…
Browse files Browse the repository at this point in the history
  • Loading branch information
fermino committed Mar 21, 2024
1 parent b16be57 commit 1ea2c7c
Show file tree
Hide file tree
Showing 32 changed files with 81 additions and 44 deletions.
3 changes: 2 additions & 1 deletion src/MultiReport/AbsoluteMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ void AbsoluteMouse_::SendReport(void* data, int length)
HID().SendReport(HID_REPORTID_MOUSE_ABSOLUTE, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
AbsoluteMouse_ AbsoluteMouse;

#endif
4 changes: 3 additions & 1 deletion src/MultiReport/AbsoluteMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class AbsoluteMouse_ : public AbsoluteMouseAPI
protected:
virtual inline void SendReport(void* data, int length) override;
};
extern AbsoluteMouse_ AbsoluteMouse;

#ifndef HID_DONT_CREATE_INSTANCES
extern AbsoluteMouse_ AbsoluteMouse;
#endif
3 changes: 2 additions & 1 deletion src/MultiReport/Consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ void Consumer_::SendReport(void* data, int length)
HID().SendReport(HID_REPORTID_CONSUMERCONTROL, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
Consumer_ Consumer;

#endif
4 changes: 3 additions & 1 deletion src/MultiReport/Consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class Consumer_ : public ConsumerAPI
protected:
virtual inline void SendReport(void* data, int length) override;
};
extern Consumer_ Consumer;

#ifndef HID_DONT_CREATE_INSTANCES
extern Consumer_ Consumer;
#endif
3 changes: 2 additions & 1 deletion src/MultiReport/Gamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ void Gamepad_::SendReport(void* data, int length)
HID().SendReport(HID_REPORTID_GAMEPAD, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
Gamepad_ Gamepad;

#endif
4 changes: 3 additions & 1 deletion src/MultiReport/Gamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class Gamepad_ : public GamepadAPI
protected:
virtual inline void SendReport(void* data, int length) override;
};
extern Gamepad_ Gamepad;

#ifndef HID_DONT_CREATE_INSTANCES
extern Gamepad_ Gamepad;
#endif
3 changes: 2 additions & 1 deletion src/MultiReport/ImprovedKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@ void Keyboard_::wakeupHost(void){
#endif
}

#ifndef HID_DONT_CREATE_INSTANCES
Keyboard_ Keyboard;

#endif
4 changes: 3 additions & 1 deletion src/MultiReport/ImprovedKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class Keyboard_ : public DefaultKeyboardAPI

virtual inline int send(void) final;
};
extern Keyboard_ Keyboard;

#ifndef HID_DONT_CREATE_INSTANCES
extern Keyboard_ Keyboard;
#endif
3 changes: 2 additions & 1 deletion src/MultiReport/ImprovedMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ void Mouse_::SendReport(void* data, int length)
HID().SendReport(HID_REPORTID_MOUSE, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
Mouse_ Mouse;

#endif
4 changes: 3 additions & 1 deletion src/MultiReport/ImprovedMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class Mouse_ : public MouseAPI
protected:
virtual inline void SendReport(void* data, int length) override;
};
extern Mouse_ Mouse;

#ifndef HID_DONT_CREATE_INSTANCES
extern Mouse_ Mouse;
#endif
3 changes: 2 additions & 1 deletion src/MultiReport/NKROKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ int NKROKeyboard_::send(void)
return HID().SendReport(HID_REPORTID_NKRO_KEYBOARD, &_keyReport, sizeof(_keyReport));
}

#ifndef HID_DONT_CREATE_INSTANCES
NKROKeyboard_ NKROKeyboard;

#endif
4 changes: 3 additions & 1 deletion src/MultiReport/NKROKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ class NKROKeyboard_ : public NKROKeyboardAPI

virtual int send(void) final;
};
extern NKROKeyboard_ NKROKeyboard;

#ifndef HID_DONT_CREATE_INSTANCES
extern NKROKeyboard_ NKROKeyboard;
#endif
2 changes: 2 additions & 0 deletions src/MultiReport/SurfaceDial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@ void SurfaceDial_::SendReport(void *data, int length)
HID().SendReport(HID_REPORTID_SURFACEDIAL, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
SurfaceDial_ SurfaceDial;
#endif
4 changes: 3 additions & 1 deletion src/MultiReport/SurfaceDial.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class SurfaceDial_ : public SurfaceDialAPI
protected:
virtual inline void SendReport(void* data, int length) override;
};
extern SurfaceDial_ SurfaceDial;

#ifndef HID_DONT_CREATE_INSTANCES
extern SurfaceDial_ SurfaceDial;
#endif
4 changes: 3 additions & 1 deletion src/MultiReport/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ void System_::SendReport(void* data, int length)
HID().SendReport(HID_REPORTID_SYSTEMCONTROL, data, length);
}

System_ System;

#ifndef HID_DONT_CREATE_INSTANCES
System_ System;
#endif
4 changes: 3 additions & 1 deletion src/MultiReport/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ class System_ : public SystemAPI
protected:
virtual inline void SendReport(void* data, int length) override;
};
extern System_ System;

#ifndef HID_DONT_CREATE_INSTANCES
extern System_ System;
#endif
5 changes: 2 additions & 3 deletions src/SingleReport/BootKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ void BootKeyboard_::wakeupHost(void){
#endif
}


#ifndef HID_DONT_CREATE_INSTANCES
BootKeyboard_ BootKeyboard;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/BootKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class BootKeyboard_ : public PluggableUSBModule, public DefaultKeyboardAPI
uint8_t* featureReport;
int featureLength;
};
extern BootKeyboard_ BootKeyboard;


#ifndef HID_DONT_CREATE_INSTANCES
extern BootKeyboard_ BootKeyboard;
#endif
4 changes: 2 additions & 2 deletions src/SingleReport/BootMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@ void BootMouse_::SendReport(void* data, int length){
}
}

#ifndef HID_DONT_CREATE_INSTANCES
BootMouse_ BootMouse;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/BootMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class BootMouse_ : public PluggableUSBModule, public MouseAPI

virtual void SendReport(void* data, int length) override;
};
extern BootMouse_ BootMouse;


#ifndef HID_DONT_CREATE_INSTANCES
extern BootMouse_ BootMouse;
#endif
2 changes: 2 additions & 0 deletions src/SingleReport/RawHID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,6 @@ bool RawHID_::setup(USBSetup& setup)
return false;
}

#ifndef HID_DONT_CREATE_INSTANCES
RawHID_ RawHID;
#endif
3 changes: 3 additions & 0 deletions src/SingleReport/RawHID.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,7 @@ class RawHID_ : public PluggableUSBModule, public Stream
uint8_t* featureReport;
int featureLength;
};

#ifndef HID_DONT_CREATE_INSTANCES
extern RawHID_ RawHID;
#endif
4 changes: 2 additions & 2 deletions src/SingleReport/SingleAbsoluteMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ void SingleAbsoluteMouse_::SendReport(void* data, int length)
USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
SingleAbsoluteMouse_ SingleAbsoluteMouse;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/SingleAbsoluteMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class SingleAbsoluteMouse_ : public PluggableUSBModule, public AbsoluteMouseAPI

virtual inline void SendReport(void* data, int length) override;
};
extern SingleAbsoluteMouse_ SingleAbsoluteMouse;


#ifndef HID_DONT_CREATE_INSTANCES
extern SingleAbsoluteMouse_ SingleAbsoluteMouse;
#endif
4 changes: 2 additions & 2 deletions src/SingleReport/SingleConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ void SingleConsumer_::SendReport(void* data, int length)
USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
SingleConsumer_ SingleConsumer;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/SingleConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class SingleConsumer_ : public PluggableUSBModule, public ConsumerAPI

virtual inline void SendReport(void* data, int length) override;
};
extern SingleConsumer_ SingleConsumer;


#ifndef HID_DONT_CREATE_INSTANCES
extern SingleConsumer_ SingleConsumer;
#endif
4 changes: 2 additions & 2 deletions src/SingleReport/SingleGamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ void SingleGamepad_::SendReport(void* data, int length){
USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
SingleGamepad_ Gamepad1;
SingleGamepad_ Gamepad2;
SingleGamepad_ Gamepad3;
SingleGamepad_ Gamepad4;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/SingleGamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ class SingleGamepad_ : public PluggableUSBModule, public GamepadAPI

virtual void SendReport(void* data, int length) override;
};

#ifndef HID_DONT_CREATE_INSTANCES
extern SingleGamepad_ Gamepad1;
extern SingleGamepad_ Gamepad2;
extern SingleGamepad_ Gamepad3;
extern SingleGamepad_ Gamepad4;


#endif
4 changes: 2 additions & 2 deletions src/SingleReport/SingleNKROKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ int SingleNKROKeyboard_::send(void){
return USB_Send(pluggedEndpoint | TRANSFER_RELEASE, &_keyReport, sizeof(_keyReport));
}

#ifndef HID_DONT_CREATE_INSTANCES
SingleNKROKeyboard_ SingleNKROKeyboard;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/SingleNKROKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SingleNKROKeyboard_ : public PluggableUSBModule, public NKROKeyboardAPI

uint8_t leds;
};
extern SingleNKROKeyboard_ SingleNKROKeyboard;


#ifndef HID_DONT_CREATE_INSTANCES
extern SingleNKROKeyboard_ SingleNKROKeyboard;
#endif
4 changes: 2 additions & 2 deletions src/SingleReport/SingleSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ void SingleSystem_::SendReport(void* data, int length)
USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, length);
}

#ifndef HID_DONT_CREATE_INSTANCES
SingleSystem_ SingleSystem;


#endif
5 changes: 3 additions & 2 deletions src/SingleReport/SingleSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class SingleSystem_ : public PluggableUSBModule, public SystemAPI

virtual inline void SendReport(void* data, int length) override;
};
extern SingleSystem_ SingleSystem;


#ifndef HID_DONT_CREATE_INSTANCES
extern SingleSystem_ SingleSystem;
#endif

0 comments on commit 1ea2c7c

Please sign in to comment.