nxdk
nxdk copied to clipboard
Reimplementing Hal code
Currently most of the code in the lib/hal folder is licensed under the GPL license due to coming from OpenXDK. To allow for closed sourced programs to be created using the nxdk, all GPL'd code needs to be replaced. Since a replacement USB stack is being worked on, this leaves the hal code. At some point in the future, the hal code would need to be re-implemented and licensed under a different license.
There's barely any HAL code of interest left I think. Also most of it is known to have been stolen elsewhere (so GPL is probably not even the right license) or it's unused or largely rewritten.
So for the HAL code I suggest to slim it down first: deprecating and removing code. I don't think many people need it for compatibility, and if they do, it's probably possible to replace deprecated functions with wrappers around winapi.
Once it's smaller, review it with the authors who have reworked it and consider if it's legally and ethically acceptable to just slap another license on it. If relicensing is not an option: rewrite the affected parts.
I've gone through these alphabetically:
audio.c
For what it's worth, the algorithms in https://github.com/XboxDev/nxdk/blame/231336bfba1cbc66ae7259f8a27a81448ef5421d/lib/hal/audio.c are largely by me (see #364). The remaining code is probably factual (constants, memory addresses, variable names), so I don't think it can actually be copyrighted (Disclaimer: not-a-lawyer).
Therefore, consider my code in https://github.com/XboxDev/nxdk/blame/231336bfba1cbc66ae7259f8a27a81448ef5421d/lib/hal/audio.c as public domain; feel free to relicense my code under whatever license you choose, claim copyright or whatever else is necessary. More formally: I also license that code under CC0.
Also there are many known issues with the xaudio API. audio.h should probably deprecate those functions, and people should use audio through SDL2, so we can replace the underlying API.
debug.c
This can be rewritten in an hour or so; it's trivial and would likely end up being better than the existing code. There might also be existing libs which could be used for this, so we should potentially just deprecate this and remove it eventually.
The worst offender in this is probably debugPrint
which is cancerously spreading throughout the nxdk codebase.
Also see #172, to discuss a more permanent solution.
fileio.c
This had been deprecated for 2 years already: https://github.com/XboxDev/nxdk/commit/8e5a12fe49ef6c1f6ede6f26f8797b35c5940fd3 Replacements exist in winapi.
I think it can (and should be) removed.
fonts
(PD non-issue)
Exception: A deprecation #warning
should be added for "font_sasteroids2.h" asap.
I'm not sure what license it has, but I don't think it has any users either.
That file can be removed a couple of days after deprecation, because enough alternatives exist.
input.c
This is important and should be deprecated asap.
XboxDev has been recommending to use SDL_GameController
and SDL_Joystick
for.. probably 2-4 years.
It should be removed soon after the new USB stack has landed from https://github.com/XboxDev/nxdk-sdl/pull/38 It should stay deprecated for at least a couple of weeks though, for people who had no contact with XboxDev and used this API.
io.c
It should be deprecated asap.
I believe the kernel has the same kind of API. You can also just use inline assembly. Overall, this file probably doesn't qualify for copyright either.
So when this has been deprecated for a while (~3 months or so) it can be removed.
led.c
(CC0 non-issue)
video.c
Mostly factual, but needs a separate investigation.
I wrote XVideoSetGammaRamp
: https://github.com/XboxDev/nxdk/blame/231336bfba1cbc66ae7259f8a27a81448ef5421d/lib/hal/video.c#L404 . Consider that function as public domain; feel free to relicense my code under whatever license you choose, claim copyright or whatever else is necessary.
More formally: I also license that code under CC0.
xbox.c
Everything has been deprecated for about 1-2 years: https://github.com/XboxDev/nxdk/blame/231336bfba1cbc66ae7259f8a27a81448ef5421d/lib/hal/xbox.h Replacements exist in winapi.
I think the deprecated portion can (and should) be removed.
Exceptions:
- XReboot: This is a single line and probably not copyrightable
- XLaunchXBE: This should be rewritten