A working version.

Hi, I've made a patch and its now working (basically).
Would you kindly release this to Atmosphere, I have several packages depending on this, I can't release them until this is released.
Thanks very much!
I noticed this repo has not been touched since a month ago, so if you are too busy, maybe I can do it for you  :)