Alternative to patching core library source and header files

I am following a maker guide that requires me to patch two arduino core library files: HID.cpp and USBAPI.h. This is not really practical for many reasons. I am not a native C programmer, but I am sure there are better ways to achieve the same without messing directly with the system files.

What is a standard way of overriding system library files without modifying the originals?

Try to put copy of both in your sketch directory, and use #include “USBAPI.h” instead of #include <USBAPI.h>. Not sure if will work and not tested, but you can give it a try!

Cheers, Ale.