diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-05 14:50:32 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-05 14:50:32 +0200 |
| commit | a974f2b8861bfd60613d1bf441f77a5aa0c6f76a (patch) | |
| tree | 19ef849b3d1bb785519a7998f13ceb0e30b0b079 /Kernel/Sources | |
| parent | cc03f40d9fb1d68bfd945284a3ff5067dfd8475a (diff) | |
[IMP] QR code on ke_stop screen instead of bootscreen.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources')
| -rw-r--r-- | Kernel/Sources/KernelCheck.cxx | 38 | ||||
| -rw-r--r-- | Kernel/Sources/Utils.cxx | 5 |
2 files changed, 33 insertions, 10 deletions
diff --git a/Kernel/Sources/KernelCheck.cxx b/Kernel/Sources/KernelCheck.cxx index 900bbf6e..0fcc742f 100644 --- a/Kernel/Sources/KernelCheck.cxx +++ b/Kernel/Sources/KernelCheck.cxx @@ -15,14 +15,17 @@ #include <Modules/CoreCG/FbRenderer.hxx> #include <Modules/CoreCG/TextRenderer.hxx> -EXTERN_C Kernel::Void ke_wait_for_debugger() -{ +#define SetMem(dst, byte, sz) Kernel::rt_set_memory((Kernel::VoidPtr)dst, byte, sz) +#define CopyMem(dst, src, sz) Kernel::rt_copy_memory((Kernel::VoidPtr)src, (Kernel::VoidPtr)dst, sz) +#define MoveMem(dst, src, sz) Kernel::rt_copy_memory((Kernel::VoidPtr)src, (Kernel::VoidPtr)dst, sz) -} +#include <BootKit/Vendor/Qr.hxx> /* Each error code is attributed with an ID, which will prompt a string onto the * screen. Wait for debugger... */ +#define cWebsiteMacro "https://zka-tech.nl/hulp" + namespace Kernel { void ke_stop(const Kernel::Int& id) @@ -37,10 +40,29 @@ namespace Kernel auto start_y = 10; auto x = 10; - cg_write_text("*** Kernel panic! ***\rnewoskrnl.dll stopped working properly so we had to shut it down.", start_y, x, panicTxt); + cg_write_text("*** Kernel panic! ***\rnewoskrnl.lib stopped working properly so we had to shut it down.", start_y, x, panicTxt); CGFini(); + // Show the QR code now. + + constexpr auto cVer = 4; + const auto cECC = qr::Ecc::H; + const auto cInput = cWebsiteMacro; + const auto cInputLen = rt_string_len(cWebsiteMacro); + + qr::Qr<cVer> encoder; + qr::QrDelegate encoderDelegate; + + encoder.encode(cInput, cInputLen, cECC, 0); // Manual mask 0 + + const auto cWhereStartX = (kHandoverHeader->f_GOP.f_Width - encoder.side_size()) - 20; + const auto cWhereStartY = (kHandoverHeader->f_GOP.f_Height - encoder.side_size()) / 2; + + // tell delegate to draw encoded QR now. + encoderDelegate.draw<cVer>(encoder, cWhereStartX, + cWhereStartY); + // ******* // // shows in debug only. // ******* // @@ -112,10 +134,6 @@ namespace Kernel Void RecoveryFactory::Recover() noexcept { -#ifdef __DEBUG__ - ke_wait_for_debugger(); -#endif // ifdef __DEBUG__ - PowerFactoryInterface powerInterface(kHandoverHeader->f_HardwareTables.f_VendorPtr); powerInterface.Shutdown(); } @@ -126,8 +144,8 @@ namespace Kernel if (!expr) { #ifdef __DEBUG__ - kcout << "newoskrnl: File: " << file << "\r"; - kcout << "newoskrnl: Line: " << line << "\r"; + kcout << "newoskrnl: FILE: " << file << "\r"; + kcout << "newoskrnl: LINE: " << line << "\r"; #endif // __DEBUG__ diff --git a/Kernel/Sources/Utils.cxx b/Kernel/Sources/Utils.cxx index 6eaa7757..a8b3f00a 100644 --- a/Kernel/Sources/Utils.cxx +++ b/Kernel/Sources/Utils.cxx @@ -66,6 +66,7 @@ namespace Kernel { if (!src || len < 1) return nullptr; + char* start = reinterpret_cast<Char*>(src); while (len) @@ -210,6 +211,8 @@ namespace Kernel } } // namespace Kernel +#ifdef __FREESTANDING__ + //////////////////////////////////////////////////////////////////////////////////////// /// Exported C functions //////////////////////////////////////////////////////////////////////////////////////// @@ -250,3 +253,5 @@ EXTERN_C Kernel::SizeT strcmp(char* dst, char* src, Kernel::SizeT len) { return Kernel::rt_string_cmp(src, dst, len); } + +#endif // __FREESTANDING__
\ No newline at end of file |
