summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-08 16:42:01 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-08 16:43:43 +0100
commitb06f525d69e6adab8da0a5129bcd39fc592c6922 (patch)
tree8e8ba6dbae00081c6c9031be53bc9aa9f1d445b1
parentf546108501aed048b7719765c3f221015abfd835 (diff)
Add MPT API (newBoot)
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--newBoot/Source/FSKit/Files32.cxx10
-rw-r--r--newBoot/Source/MPT/.hgkeep (renamed from newBoot/Source/FSKit/.hgkeep)0
-rw-r--r--newBoot/Source/MPT/API.cxx (renamed from newBoot/Source/FSKit/Files32.hxx)37
-rw-r--r--newBoot/Source/MPT/API.hxx17
-rw-r--r--newBoot/Source/MPT/FileType.hxx (renamed from newBoot/Source/FSKit/FileType.hxx)0
-rw-r--r--newBoot/Source/MPT/MPT.hxx (renamed from newBoot/Source/FSKit/MPT.hxx)4
6 files changed, 55 insertions, 13 deletions
diff --git a/newBoot/Source/FSKit/Files32.cxx b/newBoot/Source/FSKit/Files32.cxx
deleted file mode 100644
index e7ba96f9..00000000
--- a/newBoot/Source/FSKit/Files32.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * ========================================================
- *
- * newBoot
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
-
-#include "Files32.hxx"
diff --git a/newBoot/Source/FSKit/.hgkeep b/newBoot/Source/MPT/.hgkeep
index e69de29b..e69de29b 100644
--- a/newBoot/Source/FSKit/.hgkeep
+++ b/newBoot/Source/MPT/.hgkeep
diff --git a/newBoot/Source/FSKit/Files32.hxx b/newBoot/Source/MPT/API.cxx
index 9e940f6d..2cedd73e 100644
--- a/newBoot/Source/FSKit/Files32.hxx
+++ b/newBoot/Source/MPT/API.cxx
@@ -7,7 +7,7 @@
* ========================================================
*/
-#pragma once
+#include "API.hxx"
struct Files32FileHdr
{
@@ -34,3 +34,38 @@ struct Files32FileHdr
// @brief Array of unused bits.
#define kFilesU { 0x40, 0x80 }
+
+struct Files32FileGroup {
+ Files32FileHdr* fHdr{ nullptr };
+
+ Files32FileGroup* fUpper{ nullptr };
+ Files32FileGroup* fLower{ nullptr };
+ Files32FileGroup* fPrev{ nullptr };
+ Files32FileGroup* fNext{ nullptr };
+} kRootGroup = nullptr;
+
+extern "C" Assert(bool expr);
+extern "C" void* AllocPtr(long sz);
+
+namespace detail
+{
+template <typename Cls>
+Cls* new_class()
+{
+ Cls* cls = (Cls*)AllocPtr(sizeof(Cls));
+ *cls = Cls();
+
+ return cls;
+}
+}
+
+namespace mpt
+{
+bool filesystem_init(void)
+{
+ kRootGroup = detail::new_class<Files32FileGroup>();
+ Assert(kRootGroup != nullptr);
+
+ return true;
+}
+} \ No newline at end of file
diff --git a/newBoot/Source/MPT/API.hxx b/newBoot/Source/MPT/API.hxx
new file mode 100644
index 00000000..42822371
--- /dev/null
+++ b/newBoot/Source/MPT/API.hxx
@@ -0,0 +1,17 @@
+/*
+ * ========================================================
+ *
+ * newBoot
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+namespace mpt
+{
+/// initializes the Master Partition Table Files32 filesystem.
+/// \return status, assert(fail) is also triggered, use filesystem_hook_error if you want to catch it.
+bool filesystem_init(void);
+} \ No newline at end of file
diff --git a/newBoot/Source/FSKit/FileType.hxx b/newBoot/Source/MPT/FileType.hxx
index 26beb114..26beb114 100644
--- a/newBoot/Source/FSKit/FileType.hxx
+++ b/newBoot/Source/MPT/FileType.hxx
diff --git a/newBoot/Source/FSKit/MPT.hxx b/newBoot/Source/MPT/MPT.hxx
index e2a548e4..d407a2f2 100644
--- a/newBoot/Source/FSKit/MPT.hxx
+++ b/newBoot/Source/MPT/MPT.hxx
@@ -9,7 +9,7 @@
#pragma once
-// @brief 255 size partiton header.
+// @brief 255 size partition header.
// we use that to gather information about this hard drive.
struct MasterPartitionTable final
@@ -24,6 +24,6 @@ struct MasterPartitionTable final
enum
{
kPartEfi = 'efi',
- kPartXpm = 'xpm',
+ kPartEpm = 'epm',
kPartEbr = 'ebr',
}; \ No newline at end of file