From 3ce4b68fc3f1ad9ead503bb3f69bff11b4a3183a Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 7 Jan 2025 08:33:01 +0100 Subject: FIX: KAN-12 (EPM GPF) ADD: Dylib object instead of DLL objects. ADD: Introduce CoreGfx instead of GfxMgr. Signed-off-by: Amlal El Mahrouss --- dev/Boot/BootKit/BootKit.h | 2 +- dev/Boot/Mod/SysChk/Module.cc | 6 +- dev/Boot/src/BootFileReader.cc | 2 +- dev/Boot/src/BootThread.cc | 2 +- dev/Boot/src/HEL/AMD64/EFIBootStartup.cc | 10 +- dev/Boot/src/HEL/ARM64/EFIBootStartup.cc | 8 +- dev/Kernel/FirmwareKit/EFI/API.h | 2 +- dev/Kernel/HALKit/AMD64/HalApplicationProcessor.cc | 2 +- dev/Kernel/HALKit/AMD64/HalKernelMain.cc | 2 +- dev/Kernel/HALKit/AMD64/HalKernelPanic.cc | 4 +- dev/Kernel/HALKit/ARM64/HalKernelMain.cc | 2 +- dev/Kernel/HALKit/ARM64/HalKernelPanic.cc | 4 +- dev/Kernel/KernelKit/CodeMgr.h | 2 +- dev/Kernel/KernelKit/DriveMgr.h | 5 + dev/Kernel/KernelKit/IDLLObject.h | 48 ------ dev/Kernel/KernelKit/IDylibObject.h | 48 ++++++ dev/Kernel/KernelKit/IPEFDLLObject.h | 106 ------------ dev/Kernel/KernelKit/IPEFDylibObject.h | 106 ++++++++++++ dev/Kernel/KernelKit/UserProcessScheduler.h | 4 +- dev/Kernel/src/DriveMgr.cc | 44 ++--- dev/Kernel/src/FS/NeFS.cc | 5 +- dev/Kernel/src/IDLLObject.cc | 15 -- dev/Kernel/src/IDylibObject.cc | 15 ++ dev/Kernel/src/IPEFDLLObject.cc | 103 ------------ dev/Kernel/src/IPEFDylibObject.cc | 103 ++++++++++++ dev/Kernel/src/UserProcessScheduler.cc | 4 +- dev/Mod/CoreGfx/AccessibilityMgr.h | 41 +++++ dev/Mod/CoreGfx/FBMgr.h | 150 +++++++++++++++++ dev/Mod/CoreGfx/MathMgr.h | 29 ++++ dev/Mod/CoreGfx/TextMgr.h | 178 +++++++++++++++++++++ dev/Mod/GfxMgr/AccessibilityMgr.h | 41 ----- dev/Mod/GfxMgr/FBMgr.h | 148 ----------------- dev/Mod/GfxMgr/MathMgr.h | 29 ---- dev/Mod/GfxMgr/TextMgr.h | 178 --------------------- 34 files changed, 726 insertions(+), 722 deletions(-) delete mode 100644 dev/Kernel/KernelKit/IDLLObject.h create mode 100644 dev/Kernel/KernelKit/IDylibObject.h delete mode 100644 dev/Kernel/KernelKit/IPEFDLLObject.h create mode 100644 dev/Kernel/KernelKit/IPEFDylibObject.h delete mode 100644 dev/Kernel/src/IDLLObject.cc create mode 100644 dev/Kernel/src/IDylibObject.cc delete mode 100644 dev/Kernel/src/IPEFDLLObject.cc create mode 100644 dev/Kernel/src/IPEFDylibObject.cc create mode 100644 dev/Mod/CoreGfx/AccessibilityMgr.h create mode 100644 dev/Mod/CoreGfx/FBMgr.h create mode 100644 dev/Mod/CoreGfx/MathMgr.h create mode 100644 dev/Mod/CoreGfx/TextMgr.h delete mode 100644 dev/Mod/GfxMgr/AccessibilityMgr.h delete mode 100644 dev/Mod/GfxMgr/FBMgr.h delete mode 100644 dev/Mod/GfxMgr/MathMgr.h delete mode 100644 dev/Mod/GfxMgr/TextMgr.h (limited to 'dev') diff --git a/dev/Boot/BootKit/BootKit.h b/dev/Boot/BootKit/BootKit.h index 003d3d9e..db21ba30 100644 --- a/dev/Boot/BootKit/BootKit.h +++ b/dev/Boot/BootKit/BootKit.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/dev/Boot/Mod/SysChk/Module.cc b/dev/Boot/Mod/SysChk/Module.cc index bd89982d..400198ee 100644 --- a/dev/Boot/Mod/SysChk/Module.cc +++ b/dev/Boot/Mod/SysChk/Module.cc @@ -8,8 +8,8 @@ */ #include -#include -#include +#include +#include #include #include #include @@ -19,7 +19,7 @@ #include #include #include -#include +#include EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover) { diff --git a/dev/Boot/src/BootFileReader.cc b/dev/Boot/src/BootFileReader.cc index e8f8772c..c0809e77 100644 --- a/dev/Boot/src/BootFileReader.cc +++ b/dev/Boot/src/BootFileReader.cc @@ -13,7 +13,7 @@ #include #include #include -#include +#include /// @file BootFileReader /// @brief Bootloader File reader. diff --git a/dev/Boot/src/BootThread.cc b/dev/Boot/src/BootThread.cc index 15773b9b..ffa43063 100644 --- a/dev/Boot/src/BootThread.cc +++ b/dev/Boot/src/BootThread.cc @@ -13,7 +13,7 @@ #include #include #include -#include +#include /// @brief External boot services symbol. EXTERN EfiBootServices* BS; diff --git a/dev/Boot/src/HEL/AMD64/EFIBootStartup.cc b/dev/Boot/src/HEL/AMD64/EFIBootStartup.cc index 000e5b40..81d57ea2 100644 --- a/dev/Boot/src/HEL/AMD64/EFIBootStartup.cc +++ b/dev/Boot/src/HEL/AMD64/EFIBootStartup.cc @@ -5,8 +5,8 @@ ------------------------------------------- */ #include -#include -#include +#include +#include #include #include #include @@ -16,7 +16,7 @@ #include #include #include -#include +#include // Makes the compiler shut up. #ifndef kMachineModel @@ -140,7 +140,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, fb_init(); - UI::fb_clear_video(); + FB::fb_clear_video(); FBDrawBitMapInRegion(zka_disk, ZKA_DISK_WIDTH, ZKA_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - ZKA_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - ZKA_DISK_HEIGHT) / 2); @@ -240,7 +240,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, fb_init(); - UI::fb_clear_video(); + FB::fb_clear_video(); FBDrawBitMapInRegion(zka_has_disk, ZKA_HAS_DISK_WIDTH, ZKA_HAS_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - ZKA_HAS_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - ZKA_HAS_DISK_HEIGHT) / 2); diff --git a/dev/Boot/src/HEL/ARM64/EFIBootStartup.cc b/dev/Boot/src/HEL/ARM64/EFIBootStartup.cc index bf940074..87b2dc34 100644 --- a/dev/Boot/src/HEL/ARM64/EFIBootStartup.cc +++ b/dev/Boot/src/HEL/ARM64/EFIBootStartup.cc @@ -5,8 +5,8 @@ ------------------------------------------- */ #include -#include -#include +#include +#include #include #include #include @@ -16,7 +16,7 @@ #include #include #include -#include +#include // Makes the compiler shut up. #ifndef kMachineModel @@ -140,7 +140,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, fb_init(); - UI::fb_clear_video(); + FB::fb_clear_video(); FBDrawBitMapInRegion(zka_disk, ZKA_DISK_WIDTH, ZKA_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - ZKA_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - ZKA_DISK_HEIGHT) / 2); diff --git a/dev/Kernel/FirmwareKit/EFI/API.h b/dev/Kernel/FirmwareKit/EFI/API.h index ee4fcebb..4cf60df4 100644 --- a/dev/Kernel/FirmwareKit/EFI/API.h +++ b/dev/Kernel/FirmwareKit/EFI/API.h @@ -21,7 +21,7 @@ class BTextWriter; #define __BOOTKIT_NO_INCLUDE__ 1 #include -#include +#include #endif // ifdef __ZBAOSLDR__ inline EfiSystemTable* ST = nullptr; diff --git a/dev/Kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/Kernel/HALKit/AMD64/HalApplicationProcessor.cc index 408826d0..6563f23c 100644 --- a/dev/Kernel/HALKit/AMD64/HalApplicationProcessor.cc +++ b/dev/Kernel/HALKit/AMD64/HalApplicationProcessor.cc @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/dev/Kernel/HALKit/AMD64/HalKernelMain.cc b/dev/Kernel/HALKit/AMD64/HalKernelMain.cc index 7b3e2345..e27e2efb 100644 --- a/dev/Kernel/HALKit/AMD64/HalKernelMain.cc +++ b/dev/Kernel/HALKit/AMD64/HalKernelMain.cc @@ -11,7 +11,7 @@ #include #include #include -#include +#include EXTERN_C Kernel::VoidPtr kInterruptVectorTable[]; EXTERN_C Kernel::VoidPtr mp_user_switch_proc; diff --git a/dev/Kernel/HALKit/AMD64/HalKernelPanic.cc b/dev/Kernel/HALKit/AMD64/HalKernelPanic.cc index 6f8b292a..18296d22 100644 --- a/dev/Kernel/HALKit/AMD64/HalKernelPanic.cc +++ b/dev/Kernel/HALKit/AMD64/HalKernelPanic.cc @@ -11,8 +11,8 @@ #include #include #include -#include -#include +#include +#include #include /* Each error code is attributed with an ID, which will prompt a string onto the diff --git a/dev/Kernel/HALKit/ARM64/HalKernelMain.cc b/dev/Kernel/HALKit/ARM64/HalKernelMain.cc index 1869d97b..1a520994 100644 --- a/dev/Kernel/HALKit/ARM64/HalKernelMain.cc +++ b/dev/Kernel/HALKit/ARM64/HalKernelMain.cc @@ -6,7 +6,7 @@ #include "HALKit/ARM64/ApplicationProcessor.h" #include -#include +#include #include #include #include diff --git a/dev/Kernel/HALKit/ARM64/HalKernelPanic.cc b/dev/Kernel/HALKit/ARM64/HalKernelPanic.cc index 4cd61aff..cca564f8 100644 --- a/dev/Kernel/HALKit/ARM64/HalKernelPanic.cc +++ b/dev/Kernel/HALKit/ARM64/HalKernelPanic.cc @@ -11,8 +11,8 @@ #include #include #include -#include -#include +#include +#include #include /* Each error code is attributed with an ID, which will prompt a string onto the diff --git a/dev/Kernel/KernelKit/CodeMgr.h b/dev/Kernel/KernelKit/CodeMgr.h index d3b9f39a..12a63dc0 100644 --- a/dev/Kernel/KernelKit/CodeMgr.h +++ b/dev/Kernel/KernelKit/CodeMgr.h @@ -16,7 +16,7 @@ #include #include -#include +#include namespace Kernel { diff --git a/dev/Kernel/KernelKit/DriveMgr.h b/dev/Kernel/KernelKit/DriveMgr.h index e907acf8..4c879ab5 100644 --- a/dev/Kernel/KernelKit/DriveMgr.h +++ b/dev/Kernel/KernelKit/DriveMgr.h @@ -164,6 +164,11 @@ namespace Kernel /// @brief Fetches the main drive. /// @return the new drive as a trait. DriveTrait io_construct_main_drive(Void) noexcept; + + namespace Detect + { + Void io_detect_drive(DriveTrait& trait); + } } // namespace Kernel #endif /* ifndef INC_DRIVE_MANAGER_H */ diff --git a/dev/Kernel/KernelKit/IDLLObject.h b/dev/Kernel/KernelKit/IDLLObject.h deleted file mode 100644 index 035f0013..00000000 --- a/dev/Kernel/KernelKit/IDLLObject.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ======================================================== - * - * Kernel - * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. - * - * ======================================================== - */ - -#pragma once - -#include -#include - -#define ZKA_DLL_OBJECT : public IDLLObject - -namespace Kernel -{ - /// @brief DLL class object. A handle to a shared library. - class IDLLObject - { - public: - explicit IDLLObject() = default; - virtual ~IDLLObject() = default; - - struct DLL_TRAITS final - { - VoidPtr ImageObject{nullptr}; - VoidPtr ImageEntrypointOffset{nullptr}; - - Bool IsValid() - { - return ImageObject && ImageEntrypointOffset; - } - }; - - ZKA_COPY_DEFAULT(IDLLObject); - - virtual DLL_TRAITS** GetAddressOf() = 0; - virtual DLL_TRAITS* Get() = 0; - - virtual Void Mount(DLL_TRAITS* to_mount) = 0; - virtual Void Unmount() = 0; - }; - - /// @brief Pure implementation, missing method/function handler. - EXTERN_C void __zka_pure_call(void); -} // namespace Kernel diff --git a/dev/Kernel/KernelKit/IDylibObject.h b/dev/Kernel/KernelKit/IDylibObject.h new file mode 100644 index 00000000..d4c93034 --- /dev/null +++ b/dev/Kernel/KernelKit/IDylibObject.h @@ -0,0 +1,48 @@ +/* + * ======================================================== + * + * Kernel + * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include +#include + +#define ZKA_DLL_OBJECT : public IDylibObject + +namespace Kernel +{ + /// @brief DLL class object. A handle to a shared library. + class IDylibObject + { + public: + explicit IDylibObject() = default; + virtual ~IDylibObject() = default; + + struct DLL_TRAITS final + { + VoidPtr ImageObject{nullptr}; + VoidPtr ImageEntrypointOffset{nullptr}; + + Bool IsValid() + { + return ImageObject && ImageEntrypointOffset; + } + }; + + ZKA_COPY_DEFAULT(IDylibObject); + + virtual DLL_TRAITS** GetAddressOf() = 0; + virtual DLL_TRAITS* Get() = 0; + + virtual Void Mount(DLL_TRAITS* to_mount) = 0; + virtual Void Unmount() = 0; + }; + + /// @brief Pure implementation, missing method/function handler. + EXTERN_C void __zka_pure_call(void); +} // namespace Kernel diff --git a/dev/Kernel/KernelKit/IPEFDLLObject.h b/dev/Kernel/KernelKit/IPEFDLLObject.h deleted file mode 100644 index 1781c589..00000000 --- a/dev/Kernel/KernelKit/IPEFDLLObject.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * ======================================================== - * - * Kernel - * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. - * - * ======================================================== - */ - -#ifndef __KERNELKIT_SHARED_OBJECT_H__ -#define __KERNELKIT_SHARED_OBJECT_H__ - -#include -#include -#include -#include -#include - -namespace Kernel -{ - /** - * @brief Shared Library class - * Load library from this class - */ - class IPEFDLLObject final ZKA_DLL_OBJECT - { - public: - explicit IPEFDLLObject() = default; - ~IPEFDLLObject() = default; - - public: - ZKA_COPY_DEFAULT(IPEFDLLObject); - - private: - DLL_TRAITS* fMounted{nullptr}; - - public: - DLL_TRAITS** GetAddressOf() - { - return &fMounted; - } - - DLL_TRAITS* Get() - { - return fMounted; - } - - public: - void Mount(DLL_TRAITS* to_mount) - { - if (!to_mount || !to_mount->ImageObject) - return; - - fMounted = to_mount; - - if (fLoader && to_mount) - { - delete fLoader; - fLoader = nullptr; - } - - if (!fLoader) - { - fLoader = new PEFLoader(fMounted->ImageObject); - } - } - - void Unmount() - { - if (fMounted) - fMounted = nullptr; - }; - - template - SymbolType Load(const Char* symbol_name, SizeT len, Int32 kind) - { - if (symbol_name == nullptr || *symbol_name == 0) - return nullptr; - if (len > kPathLen || len < 1) - return nullptr; - - auto ret = - reinterpret_cast(fLoader->FindSymbol(symbol_name, kind)); - - if (!ret) - { - if (kind == kPefCode) - return (VoidPtr)&__zka_pure_call; - - return nullptr; - } - - return ret; - } - - private: - PEFLoader* fLoader{nullptr}; - }; - - typedef IPEFDLLObject* IDLL; - - EXTERN_C IDLL rtl_init_dylib(UserThread& header); - EXTERN_C Void rtl_fini_dylib(UserThread& header, IDLL lib, Bool* successful); -} // namespace Kernel - -#endif /* ifndef __KERNELKIT_SHARED_OBJECT_H__ */ diff --git a/dev/Kernel/KernelKit/IPEFDylibObject.h b/dev/Kernel/KernelKit/IPEFDylibObject.h new file mode 100644 index 00000000..c8a69690 --- /dev/null +++ b/dev/Kernel/KernelKit/IPEFDylibObject.h @@ -0,0 +1,106 @@ +/* + * ======================================================== + * + * Kernel + * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. + * + * ======================================================== + */ + +#ifndef __KERNELKIT_SHARED_OBJECT_H__ +#define __KERNELKIT_SHARED_OBJECT_H__ + +#include +#include +#include +#include +#include + +namespace Kernel +{ + /** + * @brief Shared Library class + * Load library from this class + */ + class IPEFDylibObject final ZKA_DLL_OBJECT + { + public: + explicit IPEFDylibObject() = default; + ~IPEFDylibObject() = default; + + public: + ZKA_COPY_DEFAULT(IPEFDylibObject); + + private: + DLL_TRAITS* fMounted{nullptr}; + + public: + DLL_TRAITS** GetAddressOf() + { + return &fMounted; + } + + DLL_TRAITS* Get() + { + return fMounted; + } + + public: + void Mount(DLL_TRAITS* to_mount) + { + if (!to_mount || !to_mount->ImageObject) + return; + + fMounted = to_mount; + + if (fLoader && to_mount) + { + delete fLoader; + fLoader = nullptr; + } + + if (!fLoader) + { + fLoader = new PEFLoader(fMounted->ImageObject); + } + } + + void Unmount() + { + if (fMounted) + fMounted = nullptr; + }; + + template + SymbolType Load(const Char* symbol_name, SizeT len, Int32 kind) + { + if (symbol_name == nullptr || *symbol_name == 0) + return nullptr; + if (len > kPathLen || len < 1) + return nullptr; + + auto ret = + reinterpret_cast(fLoader->FindSymbol(symbol_name, kind)); + + if (!ret) + { + if (kind == kPefCode) + return (VoidPtr)&__zka_pure_call; + + return nullptr; + } + + return ret; + } + + private: + PEFLoader* fLoader{nullptr}; + }; + + typedef IPEFDylibObject* IDylib; + + EXTERN_C IDylib rtl_init_dylib(UserThread& header); + EXTERN_C Void rtl_fini_dylib(UserThread& header, IDylib lib, Bool* successful); +} // namespace Kernel + +#endif /* ifndef __KERNELKIT_SHARED_OBJECT_H__ */ diff --git a/dev/Kernel/KernelKit/UserProcessScheduler.h b/dev/Kernel/KernelKit/UserProcessScheduler.h index a08a5dc1..8212fdc2 100644 --- a/dev/Kernel/KernelKit/UserProcessScheduler.h +++ b/dev/Kernel/KernelKit/UserProcessScheduler.h @@ -30,7 +30,7 @@ namespace Kernel { //! @note Forward class declarations. - class IDLLObject; + class IDylibObject; class UserThread; class UserProcessTeam; class UserProcessScheduler; @@ -163,7 +163,7 @@ namespace Kernel UInt8* StackReserve{nullptr}; UserProcessImage Image{}; SizeT StackSize{kSchedMaxStackSz}; - IDLLObject* DylibDelegate{nullptr}; + IDylibObject* DylibDelegate{nullptr}; SizeT MemoryCursor{0UL}; SizeT MemoryLimit{kSchedMaxMemoryLimit}; SizeT UsedMemory{0UL}; diff --git a/dev/Kernel/src/DriveMgr.cc b/dev/Kernel/src/DriveMgr.cc index 8e8d5ab2..8ac5bdff 100644 --- a/dev/Kernel/src/DriveMgr.cc +++ b/dev/Kernel/src/DriveMgr.cc @@ -154,34 +154,34 @@ namespace Kernel return trait; } - namespace Detail + namespace Detect { - Void ioi_detect_drive(DriveTrait* trait) + Void io_detect_drive(DriveTrait& trait) { - static EPM_BOOT_BLOCK block_struct; + EPM_BOOT_BLOCK block_struct; - trait->fPacket.fPacketLba = kEPMBootBlockLba; - trait->fPacket.fPacketSize = sizeof(EPM_BOOT_BLOCK); - trait->fPacket.fPacketContent = &block_struct; + trait.fPacket.fPacketLba = kEPMBootBlockLba; + trait.fPacket.fPacketSize = sizeof(EPM_BOOT_BLOCK); + trait.fPacket.fPacketContent = &block_struct; - rt_copy_memory((VoidPtr) "fs/detect-packet", trait->fPacket.fPacketMime, + rt_copy_memory((VoidPtr) "fs/detect-packet", trait.fPacket.fPacketMime, rt_string_len("fs/detect-packet")); - trait->fInit(&trait->fPacket); + trait.fInit(&trait.fPacket); - trait->fInput(&trait->fPacket); + trait.fInput(&trait.fPacket); - if (rt_string_cmp(((BOOT_BLOCK_STRUCT*)trait->fPacket.fPacketContent)->Magic, kEPMMagic, kEPMMagicLength) == 0) + if (rt_string_cmp(((BOOT_BLOCK_STRUCT*)trait.fPacket.fPacketContent)->Magic, kEPMMagic, kEPMMagicLength) == 0) { - trait->fPacket.fPacketReadOnly = NO; - trait->fKind = kMassStorageDisc | kEPMDrive; + trait.fPacket.fPacketReadOnly = NO; + trait.fKind = kMassStorageDisc | kEPMDrive; kcout << "Formatted Disk is EPM (Mass Storage)\r"; } else { - trait->fPacket.fPacketReadOnly = YES; - trait->fKind = kMassStorageDisc | kUnformattedDrive | kReadOnlyDrive; + trait.fPacket.fPacketReadOnly = YES; + trait.fKind = kMassStorageDisc | kUnformattedDrive | kReadOnlyDrive; kcout << "Scheme Found: " << block_struct.Name << endl; @@ -189,12 +189,12 @@ namespace Kernel kcout << "Disk partition is unknown (Read Only)\r"; } - rt_copy_memory((VoidPtr) "*/*", trait->fPacket.fPacketMime, + rt_copy_memory((VoidPtr) "*/*", trait.fPacket.fPacketMime, rt_string_len("*/*")); - trait->fPacket.fPacketLba = 0; - trait->fPacket.fPacketSize = 0UL; - trait->fPacket.fPacketContent = nullptr; + trait.fPacket.fPacketLba = 0; + trait.fPacket.fPacketSize = 0UL; + trait.fPacket.fPacketContent = nullptr; } } // namespace Detail @@ -202,9 +202,9 @@ namespace Kernel /// @return the new drive. (returns kEPMDrive if EPM formatted) DriveTrait io_construct_main_drive() noexcept { - DriveTrait trait{}; + DriveTrait trait; - const auto kMainDrive = "/Mount/OS:"; + constexpr auto kMainDrive = "/Mount/OS:"; rt_copy_memory((VoidPtr)kMainDrive, trait.fName, rt_string_len(kMainDrive)); @@ -216,9 +216,9 @@ namespace Kernel trait.fInit = io_drv_init; trait.fDriveKind = io_drv_kind; - kcout << "Detecting partition scheme of: " << trait.fName << ".\r"; + Detect::io_detect_drive(trait); - Detail::ioi_detect_drive(&trait); + kcout << "Detecting partition scheme of: " << trait.fName << ".\r"; return trait; } diff --git a/dev/Kernel/src/FS/NeFS.cc b/dev/Kernel/src/FS/NeFS.cc index b0a7c6c6..902b57a8 100644 --- a/dev/Kernel/src/FS/NeFS.cc +++ b/dev/Kernel/src/FS/NeFS.cc @@ -1055,10 +1055,7 @@ namespace Kernel::Detail kcout << "Creating A:\r"; kDiskMountpoint.A() = io_construct_main_drive(); - kDiskMountpoint.B() = io_construct_blank_drive(); - kDiskMountpoint.C() = io_construct_blank_drive(); - kDiskMountpoint.D() = io_construct_blank_drive(); - + kcout << "Creating A: [ OK ]\r"; return true; diff --git a/dev/Kernel/src/IDLLObject.cc b/dev/Kernel/src/IDLLObject.cc deleted file mode 100644 index f0129eca..00000000 --- a/dev/Kernel/src/IDLLObject.cc +++ /dev/null @@ -1,15 +0,0 @@ -/* - * ======================================================== - * - * minoskrnl - * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. - * - * ======================================================== - */ - -#include -#include - -#include - -using namespace Kernel; diff --git a/dev/Kernel/src/IDylibObject.cc b/dev/Kernel/src/IDylibObject.cc new file mode 100644 index 00000000..27e2d14f --- /dev/null +++ b/dev/Kernel/src/IDylibObject.cc @@ -0,0 +1,15 @@ +/* + * ======================================================== + * + * minoskrnl + * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. + * + * ======================================================== + */ + +#include +#include + +#include + +using namespace Kernel; diff --git a/dev/Kernel/src/IPEFDLLObject.cc b/dev/Kernel/src/IPEFDLLObject.cc deleted file mode 100644 index 1b8d2451..00000000 --- a/dev/Kernel/src/IPEFDLLObject.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - * ======================================================== - * - * minoskrnl - * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. - * - * ======================================================== - */ - -#include -#include -#include -#include -#include -#include - -/* ------------------------------------------- - - Revision History: - - 01/02/24: Reworked dll ABI, expect a rtl_init_dylib and - rtl_fini_dylib (amlel) 15/02/24: Breaking changes, changed the name of the - routines. (amlel) - - 07/28/24: Replace rt_library_free with rtl_fini_dylib - - 10/8/24: FIX: Fix log comment. - - ------------------------------------------- */ - -using namespace Kernel; - -/***********************************************************************************/ -/// @file IPEFDLLObject.cc -/// @brief PEF's DLL runtime. -/***********************************************************************************/ - -/***********************************************************************************/ -/** @brief Library initializer. */ -/***********************************************************************************/ - -EXTERN_C IDLL rtl_init_dylib(UserThread& header) -{ - IDLL dll_obj = tls_new_class(); - - if (!dll_obj) - { - header.Crash(); - return nullptr; - } - - dll_obj->Mount(tls_new_class()); - - if (!dll_obj->Get()) - { - tls_delete_class(dll_obj); - header.Crash(); - - return nullptr; - } - - dll_obj->Get()->ImageObject = - header.Image.fBlob; - - if (!dll_obj->Get()->ImageObject) - { - tls_delete_class(dll_obj); - header.Crash(); - - return nullptr; - } - - dll_obj->Get()->ImageEntrypointOffset = - dll_obj->Load(kPefStart, rt_string_len(kPefStart, 0), kPefCode); - - return dll_obj; -} - -/***********************************************************************************/ -/** @brief Frees the dll_obj. */ -/** @note Please check if the dll_obj got freed! */ -/** @param dll_obj The dll_obj to free. */ -/** @param successful Reports if successful or not. */ -/***********************************************************************************/ - -EXTERN_C Void rtl_fini_dylib(UserThread& header, IDLL dll_obj, Bool* successful) -{ - MUST_PASS(successful); - - // sanity check (will also trigger a bug check if this fails) - if (dll_obj == nullptr) - { - *successful = false; - header.Crash(); - } - - delete dll_obj->Get(); - delete dll_obj; - - dll_obj = nullptr; - - *successful = true; -} diff --git a/dev/Kernel/src/IPEFDylibObject.cc b/dev/Kernel/src/IPEFDylibObject.cc new file mode 100644 index 00000000..1e2831ef --- /dev/null +++ b/dev/Kernel/src/IPEFDylibObject.cc @@ -0,0 +1,103 @@ +/* + * ======================================================== + * + * minoskrnl + * Copyright (C) 2024, Theater Quality Corp, all rights reserved., all rights reserved. + * + * ======================================================== + */ + +#include +#include +#include +#include +#include +#include + +/* ------------------------------------------- + + Revision History: + + 01/02/24: Reworked dll ABI, expect a rtl_init_dylib and + rtl_fini_dylib (amlel) 15/02/24: Breaking changes, changed the name of the + routines. (amlel) + + 07/28/24: Replace rt_library_free with rtl_fini_dylib + + 10/8/24: FIX: Fix log comment. + + ------------------------------------------- */ + +using namespace Kernel; + +/***********************************************************************************/ +/// @file IPEFDylibObject.cc +/// @brief PEF's Dylib runtime. +/***********************************************************************************/ + +/***********************************************************************************/ +/** @brief Library initializer. */ +/***********************************************************************************/ + +EXTERN_C IDylib rtl_init_dylib(UserThread& thread) +{ + IDylib dll_obj = tls_new_class(); + + if (!dll_obj) + { + thread.Crash(); + return nullptr; + } + + dll_obj->Mount(new IPEFDylibObject::DLL_TRAITS()); + + if (!dll_obj->Get()) + { + tls_delete_class(dll_obj); + thread.Crash(); + + return nullptr; + } + + dll_obj->Get()->ImageObject = + thread.Image.fBlob; + + if (!dll_obj->Get()->ImageObject) + { + tls_delete_class(dll_obj); + thread.Crash(); + + return nullptr; + } + + dll_obj->Get()->ImageEntrypointOffset = + dll_obj->Load(kPefStart, rt_string_len(kPefStart, 0), kPefCode); + + return dll_obj; +} + +/***********************************************************************************/ +/** @brief Frees the dll_obj. */ +/** @note Please check if the dll_obj got freed! */ +/** @param dll_obj The dll_obj to free. */ +/** @param successful Reports if successful or not. */ +/***********************************************************************************/ + +EXTERN_C Void rtl_fini_dylib(UserThread& thread, IDylib dll_obj, Bool* successful) +{ + MUST_PASS(successful); + + // sanity check (will also trigger a bug check if this fails) + if (dll_obj == nullptr) + { + *successful = false; + thread.Crash(); + } + + delete dll_obj->Get(); + delete dll_obj; + + dll_obj = nullptr; + + *successful = true; +} diff --git a/dev/Kernel/src/UserProcessScheduler.cc b/dev/Kernel/src/UserProcessScheduler.cc index 55d3474b..6cd7fb0b 100644 --- a/dev/Kernel/src/UserProcessScheduler.cc +++ b/dev/Kernel/src/UserProcessScheduler.cc @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include @@ -252,7 +252,7 @@ namespace Kernel { Bool success = false; - rtl_fini_dylib(*this, reinterpret_cast(this->DylibDelegate), &success); + rtl_fini_dylib(*this, reinterpret_cast(this->DylibDelegate), &success); if (!success) { diff --git a/dev/Mod/CoreGfx/AccessibilityMgr.h b/dev/Mod/CoreGfx/AccessibilityMgr.h new file mode 100644 index 00000000..f853afae --- /dev/null +++ b/dev/Mod/CoreGfx/AccessibilityMgr.h @@ -0,0 +1,41 @@ +/* ------------------------------------------- + + Copyright Theater Quality Corp. + +------------------------------------------- */ + +#ifndef GFX_MGR_ACCESSIBILITY_H +#define GFX_MGR_ACCESSIBILITY_H + +#include +#include +#include +#include +#include + +namespace FB +{ + using namespace Kernel; + + /// @brief common User interface class. + class UIAccessibilty final + { + explicit UIAccessibilty() = default; + ~UIAccessibilty() = default; + + public: + ZKA_COPY_DELETE(UIAccessibilty); + + static Int64 Width() noexcept + { + return kHandoverHeader->f_GOP.f_Width; + } + + static Int64 Height() noexcept + { + return kHandoverHeader->f_GOP.f_Height; + } + }; +} // namespace UI + +#endif // !GFX_MGR_ACCESSIBILITY_H_ diff --git a/dev/Mod/CoreGfx/FBMgr.h b/dev/Mod/CoreGfx/FBMgr.h new file mode 100644 index 00000000..fab08f60 --- /dev/null +++ b/dev/Mod/CoreGfx/FBMgr.h @@ -0,0 +1,150 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Theater Quality Corp, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include + +#define fb_init() Kernel::SizeT kCGCursor = 0 + +#define fb_color(R, G, B) RGB(R, G, B) + +#define fb_get_clear_clr() fb_color(0x20, 0x20, 0x20) + +#define fb_clear() kCGCursor = 0 + +#ifdef __ZKA_AMD64__ +/// @brief Performs Alpha drawing on the framebuffer. +#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) \ + for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ + { \ + for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ + { \ + *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) |= (reg_ptr)[kCGCursor]; \ + \ + ++kCGCursor; \ + } \ + } + +/// @brief Performs drawing on the framebuffer. +#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) \ + for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ + { \ + for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ + { \ + *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = (reg_ptr)[kCGCursor]; \ + \ + ++kCGCursor; \ + } \ + } + +#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) \ + for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ + { \ + for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ + { \ + *(((Kernel::UInt32*)(_Rgn + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = (reg_ptr)[kCGCursor]; \ + \ + ++kCGCursor; \ + } \ + } + +/// @brief Cleans a resource. +#define CGClearRegion(height, width, base_x, base_y) \ + for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ + { \ + for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = fb_get_clear_clr(); \ + } \ + } + +/// @brief Draws inside a zone. +#define FBDrawInRegion(_Clr, height, width, base_x, base_y) \ + for (Kernel::SizeT x_base = base_x; x_base < (width + base_x); ++x_base) \ + { \ + for (Kernel::SizeT y_base = base_y; y_base < (height + base_y); ++y_base) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + x_base + \ + 4 * y_base))) = _Clr; \ + } \ + } + +/// @brief Draws inside a zone. +#define FBDrawInRegionToRgn(_Rgn, _Clr, height, width, base_x, base_y) \ + for (Kernel::SizeT x_base = base_x; x_base < (width + base_x); ++x_base) \ + { \ + for (Kernel::SizeT y_base = base_y; y_base < (height + base_y); ++y_base) \ + { \ + *(((volatile Kernel::UInt32*)(_Rgn + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + x_base + \ + 4 * y_base))) = _Clr[kCGCursor]; \ + ++kCGCursor; \ + } \ + } + +#define FBDrawInRegionA(_Clr, height, width, base_x, base_y) \ + for (Kernel::SizeT x_base = base_x; x_base < (width + base_x); ++x_base) \ + { \ + for (Kernel::SizeT y_base = base_y; y_base < (height + base_y); ++y_base) \ + { \ + *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + x_base + \ + 4 * y_base))) |= _Clr; \ + } \ + } +#else +#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) +#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) +#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) +#define CGClearRegion(height, width, base_x, base_y) +#define FBDrawInRegion(_Clr, height, width, base_x, base_y) +#define FBDrawInRegionToRgn(_Rgn, _Clr, height, width, base_x, base_y) +#define FBDrawInRegionA(_Clr, height, width, base_x, base_y) +#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) +#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) +#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) +#define CGClearRegion(height, width, base_x, base_y) +#define FBDrawInRegion(_Clr, height, width, base_x, base_y) +#define FBDrawInRegionToRgn(_Rgn, _Clr, height, width, base_x, base_y) +#define FBDrawInRegionA(_Clr, height, width, base_x, base_y) +#endif // __ZKA_AMD64__ + +#ifndef GFX_MGR_ACCESSIBILITY_H +#include +#endif // ifndef GFX_MGR_ACCESSIBILITY_H + +namespace FB +{ + struct FB_CONTROL_BLOCK; + + inline void fb_clear_video() noexcept + { + fb_init(); + + FBDrawInRegion(fb_get_clear_clr(), FB::UIAccessibilty::Height(), FB::UIAccessibilty::Width(), + 0, 0); + + fb_clear(); + } + +} // namespace UI \ No newline at end of file diff --git a/dev/Mod/CoreGfx/MathMgr.h b/dev/Mod/CoreGfx/MathMgr.h new file mode 100644 index 00000000..2e31844c --- /dev/null +++ b/dev/Mod/CoreGfx/MathMgr.h @@ -0,0 +1,29 @@ +/* ------------------------------------------- + + Copyright Theater Quality Corp. + +------------------------------------------- */ + +#pragma once + +/// @file MathMgr.h +/// @brief Linear interpolation implementation. + +namespace UI +{ +#ifdef ZKA_GFX_MGR_USE_DOUBLE + typedef double fb_real_t; +#else + typedef float fb_real_t; +#endif + + /// @brief Linear interpolation equation solver. + /// @param from where to start + /// @param to to which value. + /// @param stat + /// @return Linear interop value. + inline fb_real_t fb_math_lerp(fb_real_t to, fb_real_t from, fb_real_t stat) + { + return (from) + (to - from) * stat; + } +} // namespace UI \ No newline at end of file diff --git a/dev/Mod/CoreGfx/TextMgr.h b/dev/Mod/CoreGfx/TextMgr.h new file mode 100644 index 00000000..c2f5c8a4 --- /dev/null +++ b/dev/Mod/CoreGfx/TextMgr.h @@ -0,0 +1,178 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Theater Quality Corp, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include +#include + +#define kFontSizeX 8 +#define kFontSizeY 8 +#define kFontNOFChars 128 + +inline const Kernel::UInt8 kFontBitmap[kFontNOFChars][kFontSizeX] = { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) + {0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) + {0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") + {0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) + {0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) + {0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) + {0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) + {0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') + {0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() + {0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) + {0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) + {0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) + {0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) + {0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) + {0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) + {0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) + {0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) + {0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) + {0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) + {0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) + {0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) + {0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) + {0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) + {0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) + {0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) + {0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) + {0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) + {0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;) + {0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) + {0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) + {0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) + {0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) + {0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) + {0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) + {0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) + {0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) + {0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) + {0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) + {0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) + {0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) + {0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) + {0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) + {0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) + {0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) + {0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) + {0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) + {0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) + {0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) + {0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) + {0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) + {0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) + {0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) + {0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) + {0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) + {0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) + {0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) + {0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) + {0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) + {0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) + {0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) + {0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) + {0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) + {0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) + {0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) + {0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) + {0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) + {0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) + {0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) + {0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) + {0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) + {0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) + {0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) + {0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) + {0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) + {0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) + {0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) + {0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) + {0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) + {0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) + {0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) + {0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) + {0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) + {0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) + {0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) + {0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) + {0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) + {0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) + {0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) + {0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) + {0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) + {0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) + {0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) + {0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) + {0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F + +}; + +inline Kernel::Void fb_render_string_for_bitmap(const Kernel::UInt8* bitmap, const Kernel::SizeT& x_sz, const Kernel::SizeT& y_sz, Kernel::Int32& x_dst, Kernel::Int32& y_dst, Kernel::Int32& color) +{ + Kernel::Int32 x, y; + Kernel::Int32 set; + + x = 0; + y = 0; + set = 0; + + for (; y < y_sz; ++y) + { + for (x = 0; x < x_sz; ++x) + { + set = bitmap[x] & (1 << y); + + if (set) + { + FBDrawInRegion(color, 1, 1, ((x_dst) + x), ((y_dst) + y)); + } + } + } +} + +inline Kernel::Void fb_render_string(const Kernel::Char* text, Kernel::Int32 x_dst, Kernel::Int32 y_dst, Kernel::Int32 color) +{ + for (Kernel::SizeT i = 0; text[i] != 0; ++i) + { + fb_render_string_for_bitmap(&kFontBitmap[text[i]][0], kFontSizeX, kFontSizeY, x_dst, y_dst, color); + y_dst += kFontSizeY; + } +} diff --git a/dev/Mod/GfxMgr/AccessibilityMgr.h b/dev/Mod/GfxMgr/AccessibilityMgr.h deleted file mode 100644 index 45e32529..00000000 --- a/dev/Mod/GfxMgr/AccessibilityMgr.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ------------------------------------------- - - Copyright Theater Quality Corp. - -------------------------------------------- */ - -#ifndef GFX_MGR_ACCESSIBILITY_H -#define GFX_MGR_ACCESSIBILITY_H - -#include -#include -#include -#include -#include - -namespace UI -{ - using namespace Kernel; - - /// @brief common User interface class. - class UIAccessibilty final - { - explicit UIAccessibilty() = default; - ~UIAccessibilty() = default; - - public: - ZKA_COPY_DELETE(UIAccessibilty); - - static Int64 Width() noexcept - { - return kHandoverHeader->f_GOP.f_Width; - } - - static Int64 Height() noexcept - { - return kHandoverHeader->f_GOP.f_Height; - } - }; -} // namespace UI - -#endif // !GFX_MGR_ACCESSIBILITY_H_ diff --git a/dev/Mod/GfxMgr/FBMgr.h b/dev/Mod/GfxMgr/FBMgr.h deleted file mode 100644 index 87abfeca..00000000 --- a/dev/Mod/GfxMgr/FBMgr.h +++ /dev/null @@ -1,148 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024, Theater Quality Corp, all rights reserved. - -------------------------------------------- */ - -#pragma once - -#include - -#define fb_init() Kernel::SizeT kCGCursor = 0 - -#define fb_color(R, G, B) RGB(R, G, B) - -#define fb_get_clear_clr() fb_color(0x20, 0x20, 0x20) - -#define fb_clear() kCGCursor = 0 - -#ifdef __ZKA_AMD64__ -/// @brief Performs Alpha drawing on the framebuffer. -#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) \ - for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ - { \ - for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ - { \ - *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) |= (reg_ptr)[kCGCursor]; \ - \ - ++kCGCursor; \ - } \ - } - -/// @brief Performs drawing on the framebuffer. -#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) \ - for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ - { \ - for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ - { \ - *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) = (reg_ptr)[kCGCursor]; \ - \ - ++kCGCursor; \ - } \ - } - -#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) \ - for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ - { \ - for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ - { \ - *(((Kernel::UInt32*)(_Rgn + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) = (reg_ptr)[kCGCursor]; \ - \ - ++kCGCursor; \ - } \ - } - -/// @brief Cleans a resource. -#define CGClearRegion(height, width, base_x, base_y) \ - for (Kernel::SizeT i = base_x; i < (width + base_x); ++i) \ - { \ - for (Kernel::SizeT u = base_y; u < (height + base_y); ++u) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - i + \ - 4 * u))) = fb_get_clear_clr(); \ - } \ - } - -/// @brief Draws inside a zone. -#define FBDrawInRegion(_Clr, height, width, base_x, base_y) \ - for (Kernel::SizeT x_base = base_x; x_base < (width + base_x); ++x_base) \ - { \ - for (Kernel::SizeT y_base = base_y; y_base < (height + base_y); ++y_base) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - x_base + \ - 4 * y_base))) = _Clr; \ - } \ - } - -/// @brief Draws inside a zone. -#define FBDrawInRegionToRgn(_Rgn, _Clr, height, width, base_x, base_y) \ - for (Kernel::SizeT x_base = base_x; x_base < (width + base_x); ++x_base) \ - { \ - for (Kernel::SizeT y_base = base_y; y_base < (height + base_y); ++y_base) \ - { \ - *(((volatile Kernel::UInt32*)(_Rgn + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - x_base + \ - 4 * y_base))) = _Clr[kCGCursor]; \ - ++kCGCursor; \ - } \ - } - -#define FBDrawInRegionA(_Clr, height, width, base_x, base_y) \ - for (Kernel::SizeT x_base = base_x; x_base < (width + base_x); ++x_base) \ - { \ - for (Kernel::SizeT y_base = base_y; y_base < (height + base_y); ++y_base) \ - { \ - *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \ - 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ - x_base + \ - 4 * y_base))) |= _Clr; \ - } \ - } -#else -#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) -#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) -#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) -#define CGClearRegion(height, width, base_x, base_y) -#define FBDrawInRegion(_Clr, height, width, base_x, base_y) -#define FBDrawInRegionToRgn(_Rgn, _Clr, height, width, base_x, base_y) -#define FBDrawInRegionA(_Clr, height, width, base_x, base_y) -#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) -#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) -#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) -#define CGClearRegion(height, width, base_x, base_y) -#define FBDrawInRegion(_Clr, height, width, base_x, base_y) -#define FBDrawInRegionToRgn(_Rgn, _Clr, height, width, base_x, base_y) -#define FBDrawInRegionA(_Clr, height, width, base_x, base_y) -#endif // __ZKA_AMD64__ - -#ifndef GFX_MGR_ACCESSIBILITY_H -#include -#endif // ifndef GFX_MGR_ACCESSIBILITY_H - -namespace UI -{ - inline void fb_clear_video() noexcept - { - fb_init(); - - FBDrawInRegion(fb_get_clear_clr(), UI::UIAccessibilty::Height(), UI::UIAccessibilty::Width(), - 0, 0); - - fb_clear(); - } - -} // namespace UI \ No newline at end of file diff --git a/dev/Mod/GfxMgr/MathMgr.h b/dev/Mod/GfxMgr/MathMgr.h deleted file mode 100644 index ea0beb4f..00000000 --- a/dev/Mod/GfxMgr/MathMgr.h +++ /dev/null @@ -1,29 +0,0 @@ -/* ------------------------------------------- - - Copyright Theater Quality Corp. - -------------------------------------------- */ - -#pragma once - -/// @file MathMgr.h -/// @brief Linear interpolation implementation. - -namespace UI -{ -#ifdef ZKA_GFX_MGR_USE_DOUBLE - typedef double fb_real_t; -#else - typedef float fb_real_t; -#endif - - /// @brief Linear interpolation equation solver. - /// @param from where? - /// @param to to? - /// @param at which state we're at **to**. - inline fb_real_t fb_math_lerp(fb_real_t to, fb_real_t from, fb_real_t stat) - { - fb_real_t difference = to - from; - return from + (difference * stat); - } -} // namespace UI \ No newline at end of file diff --git a/dev/Mod/GfxMgr/TextMgr.h b/dev/Mod/GfxMgr/TextMgr.h deleted file mode 100644 index 4aa3da0c..00000000 --- a/dev/Mod/GfxMgr/TextMgr.h +++ /dev/null @@ -1,178 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024, Theater Quality Corp, all rights reserved. - -------------------------------------------- */ - -#pragma once - -#include -#include - -#define FONT_SIZE_X 8 -#define FONT_SIZE_Y 8 -#define FONT_NOF_CHARS 128 - -inline const Kernel::UInt8 kFontBitmap[FONT_NOF_CHARS][FONT_SIZE_X] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space) - {0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!) - {0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (") - {0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#) - {0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($) - {0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%) - {0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&) - {0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (') - {0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (() - {0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ()) - {0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*) - {0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+) - {0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,) - {0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-) - {0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.) - {0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/) - {0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0) - {0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1) - {0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2) - {0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3) - {0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4) - {0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5) - {0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6) - {0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7) - {0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8) - {0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9) - {0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:) - {0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;) - {0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<) - {0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=) - {0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>) - {0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?) - {0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@) - {0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A) - {0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B) - {0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C) - {0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D) - {0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E) - {0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F) - {0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G) - {0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H) - {0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I) - {0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J) - {0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K) - {0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L) - {0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M) - {0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N) - {0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O) - {0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P) - {0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q) - {0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R) - {0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S) - {0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T) - {0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U) - {0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V) - {0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W) - {0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X) - {0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y) - {0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z) - {0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([) - {0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\) - {0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (]) - {0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^) - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_) - {0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`) - {0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a) - {0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b) - {0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c) - {0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d) - {0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e) - {0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f) - {0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g) - {0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h) - {0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i) - {0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j) - {0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k) - {0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l) - {0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m) - {0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n) - {0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o) - {0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p) - {0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q) - {0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r) - {0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s) - {0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t) - {0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u) - {0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v) - {0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w) - {0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x) - {0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y) - {0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z) - {0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({) - {0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|) - {0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (}) - {0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~) - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F - -}; - -inline Kernel::Void fb_render_string_for_bitmap(const Kernel::UInt8* bitmap, const Kernel::SizeT& x_sz, const Kernel::SizeT& y_sz, Kernel::Int32& x_dst, Kernel::Int32& y_dst, Kernel::Int32& color) -{ - Kernel::Int32 x, y; - Kernel::Int32 set; - - x = 0; - y = 0; - set = 0; - - for (; y < y_sz; ++y) - { - for (x = 0; x < x_sz; ++x) - { - set = bitmap[x] & (1 << y); - - if (set) - { - FBDrawInRegion(color, 1, 1, ((x_dst) + x), ((y_dst) + y)); - } - } - } -} - -inline Kernel::Void fb_render_string(const Kernel::Char* text, Kernel::Int32 x_dst, Kernel::Int32 y_dst, Kernel::Int32 color) -{ - for (Kernel::SizeT i = 0; text[i] != 0; ++i) - { - fb_render_string_for_bitmap(&kFontBitmap[text[i]][0], FONT_SIZE_X, FONT_SIZE_Y, x_dst, y_dst, color); - y_dst += FONT_SIZE_Y; - } -} -- cgit v1.2.3