devoptab: add workaround for dkp nullptr bug.

manually set the array at startup to avoid nullptr access.
This commit is contained in:
ITotalJustice
2025-09-13 13:28:55 +01:00
parent 8b2e541b1d
commit b476c54825
3 changed files with 22 additions and 0 deletions

View File

@@ -11,6 +11,11 @@
#include <minIni.h>
#include <curl/curl.h>
// see FixDkpBug();
extern "C" {
extern const devoptab_t dotab_stdnull;
}
namespace sphaira::devoptab::common {
namespace {
@@ -1544,4 +1549,15 @@ void UmountNeworkDevice(const fs::FsPath& mount) {
}
}
void FixDkpBug() {
const int max = 35;
for (int i = 0; i < max; i++) {
if (!devoptab_list[i]) {
devoptab_list[i] = &dotab_stdnull;
log_write("[DEVOPTAB] Fixing DKP bug at index: %d\n", i);
}
}
}
} // sphaira::devoptab