From 4e7ea02ed492a1fc0b167392361673244f957cce Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 3 Nov 2024 19:58:43 +0100 Subject: IMP: Refactor btb rules of SysChk, NetBoot and MakeFramework/MakeApp. IMP: Rename tools directory to apps. Signed-off-by: Amlal El Mahrouss --- apps/Common.h | 14 ++++++++ apps/Framework.h | 16 +++++++++ apps/make_framework.json | 12 +++++++ apps/src/Framework.cc | 68 +++++++++++++++++++++++++++++++++++ dev/SCIKit/build.json | 1 - dev/ZBAKit/Modules/NetBoot/build.json | 7 ++-- dev/ZBAKit/Modules/SysChk/Module.cc | 8 ++--- dev/ZBAKit/Modules/SysChk/build.json | 7 ++-- tools/Common.h | 14 -------- tools/Framework.h | 16 --------- tools/make_framework.json | 13 ------- tools/src/Framework.cc | 68 ----------------------------------- 12 files changed, 120 insertions(+), 124 deletions(-) create mode 100644 apps/Common.h create mode 100644 apps/Framework.h create mode 100644 apps/make_framework.json create mode 100644 apps/src/Framework.cc delete mode 100644 tools/Common.h delete mode 100644 tools/Framework.h delete mode 100644 tools/make_framework.json delete mode 100644 tools/src/Framework.cc diff --git a/apps/Common.h b/apps/Common.h new file mode 100644 index 00000000..a9439bbf --- /dev/null +++ b/apps/Common.h @@ -0,0 +1,14 @@ +/** + Sat Oct 26 07:03:28 AM CEST 2024 + (C) EL Mahrouss Logic. +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include diff --git a/apps/Framework.h b/apps/Framework.h new file mode 100644 index 00000000..bc66658c --- /dev/null +++ b/apps/Framework.h @@ -0,0 +1,16 @@ +/** + Thu Oct 17 07:57:43 CEST 2024 + (C) EL Mahrouss Logic. +*/ + +#ifndef TOOLS_FRAMEWORK_H +#define TOOLS_FRAMEWORK_H + +#include + +#define kExecDirectory "ZKA/Exec/" +#define kRootDirectory "ZKA/" +#define kFKExtension ".fwrk" +#define kAppExtension ".app" + +#endif // !TOOLS_FRAMEWORK_H diff --git a/apps/make_framework.json b/apps/make_framework.json new file mode 100644 index 00000000..6071ebaa --- /dev/null +++ b/apps/make_framework.json @@ -0,0 +1,12 @@ +{ + "compiler_path": "g++", + "compiler_std": "c++20", + "headers_path": ["./"], + "sources_path": ["src/Framework.cc"], + "output_name": "make_framework.o", + "cpp_macros": [ + "kMKFVersion=0x0100", + "kMKFVersionHighest=0x0100", + "kMKFVersionLowest=0x0100" + ] +} diff --git a/apps/src/Framework.cc b/apps/src/Framework.cc new file mode 100644 index 00000000..1a678ec3 --- /dev/null +++ b/apps/src/Framework.cc @@ -0,0 +1,68 @@ +/* + * Created on Thu Oct 17 08:00:42 CEST 2024 + * + * Copyright (c) 2024 EL Mahrouss Logic + */ + +#include +#include +#include +#include + +/// @brief This program makes a framework directory for ZKA OS. + +int main(int argc, char* argv[]) +{ + std::vector files; + + auto ext = kFKExtension; + + for (size_t i = 2UL; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0) + { + std::cout << "make_framework: Framework Creation Tool.\n"; + std::cout << "make_framework: © EL Mahrouss Logic, all rights reserved.\n"; + + return EXIT_SUCCESS; + } + + if (strcmp(argv[i], "-a") == 0) + { + ext = kAppExtension; + continue; + } + + files.push_back(argv[i]); + } + + auto path = std::string(argv[1]); + + if (!path.ends_with(ext)) + return EXIT_FAILURE; + + std::filesystem::path path_arg = path; + + if (std::filesystem::create_directory(path_arg)) + { + std::filesystem::create_directory(path_arg / kRootDirectory); + std::filesystem::create_directory(path_arg / kExecDirectory); + + for (auto& file : files) + { + std::string file_cpy = file; + + while (file_cpy.find("/") != std::string::npos) + { + file_cpy.erase(0, file_cpy.find("/")); + file_cpy.erase(file_cpy.find("/"), 1); + } + + std::filesystem::copy(path, path_arg / kExecDirectory / file_cpy); + } + + return EXIT_SUCCESS; + } + + return EXIT_FAILURE; +} diff --git a/dev/SCIKit/build.json b/dev/SCIKit/build.json index cc5cf796..12390d73 100644 --- a/dev/SCIKit/build.json +++ b/dev/SCIKit/build.json @@ -13,7 +13,6 @@ "-Wl,--subsystem=17" ], "cpp_macros": [ - "__SCI_IMPL__", "kSCIVersion=0x0100", "kSCIVersionHighest=0x0100", "kSCIVersionLowest=0x0100" diff --git a/dev/ZBAKit/Modules/NetBoot/build.json b/dev/ZBAKit/Modules/NetBoot/build.json index 0f86ed86..df033057 100644 --- a/dev/ZBAKit/Modules/NetBoot/build.json +++ b/dev/ZBAKit/Modules/NetBoot/build.json @@ -17,9 +17,8 @@ "__NEWOSKRNL__", "__NEWOSLDR__", "__ZKA_AMD64__", - "__BOOTSCR__", - "cSCRVersionHighest=0x0100", - "cSCRVersionLowest=0x0100", - "cSCRVersion=0x0100" + "kNetBootVersionHighest=0x0100", + "kNetBootVersionLowest=0x0100", + "kNetBootVersion=0x0100" ] } diff --git a/dev/ZBAKit/Modules/SysChk/Module.cc b/dev/ZBAKit/Modules/SysChk/Module.cc index 2b82b2f1..c8a01050 100644 --- a/dev/ZBAKit/Modules/SysChk/Module.cc +++ b/dev/ZBAKit/Modules/SysChk/Module.cc @@ -11,12 +11,12 @@ EXTERN_C Int32 ModuleMain(Kernel::HEL::HANDOVER_INFO_HEADER* Handover) { - EfiSystemTable* cST = (EfiSystemTable*)Handover->f_FirmwareCustomTables[1]; + EfiSystemTable* system_table = (EfiSystemTable*)Handover->f_FirmwareCustomTables[1]; - cST->ConOut->ClearScreen(cST->ConOut); + system_table->ConOut->ClearScreen(system_table->ConOut); - cST->ConOut->OutputString(cST->ConOut, L"SYSCHK: CHECKING FOR VALID NEFS OR HPFS PARTITIONS...\r\n"); - cST->ConOut->OutputString(cST->ConOut, L"SYSCHK: GOOD TO GO!\r\n"); + system_table->ConOut->OutputString(system_table->ConOut, L"SYSCHK: CHECKING FOR VALID NEFS OR HPFS PARTITIONS...\r\n"); + system_table->ConOut->OutputString(system_table->ConOut, L"SYSCHK: GOOD TO GO!\r\n"); return kEfiOk; } diff --git a/dev/ZBAKit/Modules/SysChk/build.json b/dev/ZBAKit/Modules/SysChk/build.json index 524fc0ff..59edff16 100644 --- a/dev/ZBAKit/Modules/SysChk/build.json +++ b/dev/ZBAKit/Modules/SysChk/build.json @@ -17,9 +17,8 @@ "__NEWOSKRNL__", "__NEWOSLDR__", "__ZKA_AMD64__", - "__BOOTSCR__", - "cSCRVersionHighest=0x0100", - "cSCRVersionLowest=0x0100", - "cSCRVersion=0x0100" + "kChkVersionHighest=0x0100", + "kChkVersionLowest=0x0100", + "kChkVersion=0x0100" ] } diff --git a/tools/Common.h b/tools/Common.h deleted file mode 100644 index a9439bbf..00000000 --- a/tools/Common.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - Sat Oct 26 07:03:28 AM CEST 2024 - (C) EL Mahrouss Logic. -*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include diff --git a/tools/Framework.h b/tools/Framework.h deleted file mode 100644 index bc66658c..00000000 --- a/tools/Framework.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - Thu Oct 17 07:57:43 CEST 2024 - (C) EL Mahrouss Logic. -*/ - -#ifndef TOOLS_FRAMEWORK_H -#define TOOLS_FRAMEWORK_H - -#include - -#define kExecDirectory "ZKA/Exec/" -#define kRootDirectory "ZKA/" -#define kFKExtension ".fwrk" -#define kAppExtension ".app" - -#endif // !TOOLS_FRAMEWORK_H diff --git a/tools/make_framework.json b/tools/make_framework.json deleted file mode 100644 index 9709ff3a..00000000 --- a/tools/make_framework.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compiler_path": "g++", - "compiler_std": "c++20", - "headers_path": ["./"], - "sources_path": ["src/Framework.cc"], - "output_name": "make_framework.o", - "cpp_macros": [ - "__MKF_AMD64__", - "kMKFVersion=0x0100", - "kMKFVersionHighest=0x0100", - "kMKFVersionLowest=0x0100" - ] -} diff --git a/tools/src/Framework.cc b/tools/src/Framework.cc deleted file mode 100644 index 1a678ec3..00000000 --- a/tools/src/Framework.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Created on Thu Oct 17 08:00:42 CEST 2024 - * - * Copyright (c) 2024 EL Mahrouss Logic - */ - -#include -#include -#include -#include - -/// @brief This program makes a framework directory for ZKA OS. - -int main(int argc, char* argv[]) -{ - std::vector files; - - auto ext = kFKExtension; - - for (size_t i = 2UL; i < argc; ++i) - { - if (strcmp(argv[i], "-h") == 0) - { - std::cout << "make_framework: Framework Creation Tool.\n"; - std::cout << "make_framework: © EL Mahrouss Logic, all rights reserved.\n"; - - return EXIT_SUCCESS; - } - - if (strcmp(argv[i], "-a") == 0) - { - ext = kAppExtension; - continue; - } - - files.push_back(argv[i]); - } - - auto path = std::string(argv[1]); - - if (!path.ends_with(ext)) - return EXIT_FAILURE; - - std::filesystem::path path_arg = path; - - if (std::filesystem::create_directory(path_arg)) - { - std::filesystem::create_directory(path_arg / kRootDirectory); - std::filesystem::create_directory(path_arg / kExecDirectory); - - for (auto& file : files) - { - std::string file_cpy = file; - - while (file_cpy.find("/") != std::string::npos) - { - file_cpy.erase(0, file_cpy.find("/")); - file_cpy.erase(file_cpy.find("/"), 1); - } - - std::filesystem::copy(path, path_arg / kExecDirectory / file_cpy); - } - - return EXIT_SUCCESS; - } - - return EXIT_FAILURE; -} -- cgit v1.2.3