From 98f504c442b1a0f769e2f20e4fb251813dd5dd67 Mon Sep 17 00:00:00 2001 From: Amlal Date: Thu, 5 Sep 2024 22:52:05 +0200 Subject: Rename DLLMain to ExeMain. Signed-off-by: Amlal --- dev/ZKA/Sources/DLLMain.cxx | 159 -------------------------------------------- dev/ZKA/Sources/ExeMain.cxx | 159 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 159 deletions(-) delete mode 100644 dev/ZKA/Sources/DLLMain.cxx create mode 100644 dev/ZKA/Sources/ExeMain.cxx diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx deleted file mode 100644 index 2aed9bf7..00000000 --- a/dev/ZKA/Sources/DLLMain.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - - File: Main.cxx - Purpose: Main entrypoint of Kernel. - -------------------------------------------- */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/***********************************************************************************/ -/* Returns Kernel's version. */ -/***********************************************************************************/ - -EXTERN Kernel::Property cKernelVersion; - -/***********************************************************************************/ -/* This is an external C symbol, to draw the mouse. */ -/***********************************************************************************/ - -STATIC CG::UI_WINDOW_STRUCT* cKernelWnd = nullptr; - -namespace Kernel::Detail -{ - /// @brief Filesystem auto formatter, additional checks are also done by the class. - class FilesystemInstaller final - { - Kernel::NewFilesystemMgr* fNeFS{nullptr}; - - public: - /// @brief wizard constructor. - explicit FilesystemInstaller() - { - if (Kernel::FilesystemMgrInterface::GetMounted()) - { - CG::CGDrawStringToWnd(cKernelWnd, "NeFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0)); - fNeFS = reinterpret_cast(Kernel::FilesystemMgrInterface::GetMounted()); - } - else - { - // Mounts a NeFS from main drive. - fNeFS = new Kernel::NewFilesystemMgr(); - - Kernel::FilesystemMgrInterface::Mount(fNeFS); - - CG::CGDrawStringToWnd(cKernelWnd, "Mounted NeFS IFS (A:)", 10, 10, RGB(0, 0, 0)); - } - - const Kernel::SizeT cDirCount = 7UL; - - const Kernel::Char* cDirStr[cDirCount] = { - "\\Boot\\", "\\System\\", "\\Support\\", "\\Applications\\", - "\\Users\\", "\\Library\\", "\\Mount\\"}; - - if (fNeFS->GetParser()) - { - for (Kernel::SizeT dirIndx = 0UL; dirIndx < cDirCount; ++dirIndx) - { - auto catalogDir = fNeFS->GetParser()->GetCatalog(cDirStr[dirIndx]); - - if (catalogDir) - { - CG::CGDrawStringToWnd(cKernelWnd, "Directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory already exists: ")), RGB(0, 0, 0)); - - delete catalogDir; - continue; - } - - catalogDir = fNeFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0, - kNeFSCatalogKindDir); - - CG::CGDrawStringToWnd(cKernelWnd, "Directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory has been created: ")), RGB(0, 0, 0)); - - delete catalogDir; - } - } - } - - ~FilesystemInstaller() = default; - - ZKA_COPY_DEFAULT(FilesystemInstaller); - - /// @brief Grab the disk's NeFS reference. - /// @return NewFilesystemMgr the filesystem interface - Kernel::NewFilesystemMgr* Leak() - { - return fNeFS; - } - }; -} // namespace Kernel::Detail - -EXTERN_C ATTRIBUTE(naked) Kernel::Void HangCPU(Kernel::Void) -{ - while (Yes) - { - } -} - -/// @brief Application entrypoint. -/// @param Void -/// @return Void -EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) -{ - CG::CGDrawBackground(); - - cKernelWnd = nullptr; - cKernelWnd = CG::CGCreateWindow(CG::cWndFlagWindow, "ZKA Operating System Kernel Log", "Window", 20, 20, CG::UIAccessibilty::The().Height() - 20, CG::UIAccessibilty::The().Width() - 20); - - cKernelWnd->w_sub_type = 0; - cKernelWnd->w_x = 10; - cKernelWnd->w_y = 10; - - cKernelWnd->w_needs_repaint = Yes; - - CG::CGDrawWindowList(&cKernelWnd, 1); - - /// Now run Kernel loop, until no process are running. - Kernel::Detail::FilesystemInstaller(); // automatic filesystem creation. - - cKernelWnd->w_sub_type = CG::cWndFlagCloseControlSelect; - cKernelWnd->w_needs_repaint = Yes; - - CG::CGDrawWindowList(&cKernelWnd, 1); - - CG::CGDrawStringToWnd(cKernelWnd, "Running System Component: ", 10, 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, kSysDrv, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("Running System Component: ")), RGB(0, 0, 0)); - - CG::CGDrawStringToWnd(cKernelWnd, "Starting ZKA System...", 20, 10, RGB(0, 0, 0)); - - Kernel::UserProcessHelper::Init(); - - Kernel::sched_execute_thread(HangCPU, "HANG TEST"); - - while (Yes) - { - Kernel::UserProcessHelper::StartScheduling(); - } -} diff --git a/dev/ZKA/Sources/ExeMain.cxx b/dev/ZKA/Sources/ExeMain.cxx new file mode 100644 index 00000000..2aed9bf7 --- /dev/null +++ b/dev/ZKA/Sources/ExeMain.cxx @@ -0,0 +1,159 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies + + File: Main.cxx + Purpose: Main entrypoint of Kernel. + +------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/***********************************************************************************/ +/* Returns Kernel's version. */ +/***********************************************************************************/ + +EXTERN Kernel::Property cKernelVersion; + +/***********************************************************************************/ +/* This is an external C symbol, to draw the mouse. */ +/***********************************************************************************/ + +STATIC CG::UI_WINDOW_STRUCT* cKernelWnd = nullptr; + +namespace Kernel::Detail +{ + /// @brief Filesystem auto formatter, additional checks are also done by the class. + class FilesystemInstaller final + { + Kernel::NewFilesystemMgr* fNeFS{nullptr}; + + public: + /// @brief wizard constructor. + explicit FilesystemInstaller() + { + if (Kernel::FilesystemMgrInterface::GetMounted()) + { + CG::CGDrawStringToWnd(cKernelWnd, "NeFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0)); + fNeFS = reinterpret_cast(Kernel::FilesystemMgrInterface::GetMounted()); + } + else + { + // Mounts a NeFS from main drive. + fNeFS = new Kernel::NewFilesystemMgr(); + + Kernel::FilesystemMgrInterface::Mount(fNeFS); + + CG::CGDrawStringToWnd(cKernelWnd, "Mounted NeFS IFS (A:)", 10, 10, RGB(0, 0, 0)); + } + + const Kernel::SizeT cDirCount = 7UL; + + const Kernel::Char* cDirStr[cDirCount] = { + "\\Boot\\", "\\System\\", "\\Support\\", "\\Applications\\", + "\\Users\\", "\\Library\\", "\\Mount\\"}; + + if (fNeFS->GetParser()) + { + for (Kernel::SizeT dirIndx = 0UL; dirIndx < cDirCount; ++dirIndx) + { + auto catalogDir = fNeFS->GetParser()->GetCatalog(cDirStr[dirIndx]); + + if (catalogDir) + { + CG::CGDrawStringToWnd(cKernelWnd, "Directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory already exists: ")), RGB(0, 0, 0)); + + delete catalogDir; + continue; + } + + catalogDir = fNeFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0, + kNeFSCatalogKindDir); + + CG::CGDrawStringToWnd(cKernelWnd, "Directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory has been created: ")), RGB(0, 0, 0)); + + delete catalogDir; + } + } + } + + ~FilesystemInstaller() = default; + + ZKA_COPY_DEFAULT(FilesystemInstaller); + + /// @brief Grab the disk's NeFS reference. + /// @return NewFilesystemMgr the filesystem interface + Kernel::NewFilesystemMgr* Leak() + { + return fNeFS; + } + }; +} // namespace Kernel::Detail + +EXTERN_C ATTRIBUTE(naked) Kernel::Void HangCPU(Kernel::Void) +{ + while (Yes) + { + } +} + +/// @brief Application entrypoint. +/// @param Void +/// @return Void +EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) +{ + CG::CGDrawBackground(); + + cKernelWnd = nullptr; + cKernelWnd = CG::CGCreateWindow(CG::cWndFlagWindow, "ZKA Operating System Kernel Log", "Window", 20, 20, CG::UIAccessibilty::The().Height() - 20, CG::UIAccessibilty::The().Width() - 20); + + cKernelWnd->w_sub_type = 0; + cKernelWnd->w_x = 10; + cKernelWnd->w_y = 10; + + cKernelWnd->w_needs_repaint = Yes; + + CG::CGDrawWindowList(&cKernelWnd, 1); + + /// Now run Kernel loop, until no process are running. + Kernel::Detail::FilesystemInstaller(); // automatic filesystem creation. + + cKernelWnd->w_sub_type = CG::cWndFlagCloseControlSelect; + cKernelWnd->w_needs_repaint = Yes; + + CG::CGDrawWindowList(&cKernelWnd, 1); + + CG::CGDrawStringToWnd(cKernelWnd, "Running System Component: ", 10, 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, kSysDrv, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("Running System Component: ")), RGB(0, 0, 0)); + + CG::CGDrawStringToWnd(cKernelWnd, "Starting ZKA System...", 20, 10, RGB(0, 0, 0)); + + Kernel::UserProcessHelper::Init(); + + Kernel::sched_execute_thread(HangCPU, "HANG TEST"); + + while (Yes) + { + Kernel::UserProcessHelper::StartScheduling(); + } +} -- cgit v1.2.3