summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.vscode/c_cpp_properties.json2
-rw-r--r--Private/KernelKit/PEF.hpp2
-rw-r--r--Private/NewBoot/Source/makefile8
-rw-r--r--Private/Servers/CoreDisplay/Headers/CDBitBlt.h10
-rw-r--r--Private/Servers/CoreDisplay/Headers/CDServerStartup.h10
-rw-r--r--Private/Servers/CoreDisplay/Headers/CoreDisplay.h0
-rw-r--r--Private/Servers/CoreDisplay/Sources/CDBitBlt.c11
-rw-r--r--Private/Servers/CoreDisplay/Sources/CDServerStartup.c (renamed from Private/Servers/CoreEvents/Sources/CoreEvents.c)12
-rw-r--r--Private/Servers/CoreDisplay/Sources/CoreDisplay.c33
-rw-r--r--Private/Servers/CoreEvents/Headers/.gitkeep0
-rw-r--r--Private/Servers/CoreEvents/Headers/CoreEvents.h0
-rw-r--r--Private/Servers/CoreEvents/README.txt1
-rw-r--r--Private/Source/PEFCodeManager.cxx18
-rw-r--r--Private/makefile8
-rw-r--r--Public/Developer/FragLib/Sources/ImageStart.c (renamed from Public/Developer/FragLib/Sources/RuntimeFrag.c)16
-rw-r--r--Public/Developer/SystemLib/AMD64/CoreAssembly.s10
-rw-r--r--Public/Developer/SystemLib/Headers/Defines.h2
-rw-r--r--Public/Developer/SystemLib/Headers/Dialog.h7
-rw-r--r--Public/Developer/SystemLib/Headers/Draw.h2
-rw-r--r--Public/Developer/SystemLib/Headers/File.h13
-rw-r--r--Public/Developer/SystemLib/Headers/Math.h11
-rw-r--r--Public/Developer/SystemLib/Headers/TrueType.h2
-rw-r--r--Public/Developer/SystemLib/Headers/Wm.h (renamed from Public/Developer/SystemLib/Headers/Window.h)61
-rw-r--r--Public/Developer/SystemLib/PowerPC/CoreAssembly.s5
-rw-r--r--Public/Developer/SystemLib/Sources/App.c (renamed from Public/Developer/SystemLib/Sources/Application.c)6
-rw-r--r--Public/Developer/SystemLib/Sources/File.c35
-rw-r--r--Public/Developer/SystemLib/Sources/Heap.c7
-rw-r--r--Public/Developer/SystemLib/Sources/Math.c7
-rw-r--r--Public/Developer/SystemLib/Sources/Wm.c (renamed from Public/Developer/SystemLib/Sources/Window.c)39
-rw-r--r--Public/Developer/SystemLib/compile_flags.txt2
30 files changed, 204 insertions, 136 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index fd85ea9f..ddd8839a 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -1,7 +1,7 @@
{
"configurations": [
{
- "name": "MicroKernel (Macintosh MinGW)",
+ "name": "MicroKernel (Macintosh)",
"includePath": [
"${workspaceFolder}/Private/**",
"${workspaceFolder}/Private/NewBoot/**",
diff --git a/Private/KernelKit/PEF.hpp b/Private/KernelKit/PEF.hpp
index 532382d2..bc2e0990 100644
--- a/Private/KernelKit/PEF.hpp
+++ b/Private/KernelKit/PEF.hpp
@@ -92,6 +92,6 @@ enum {
// NewOS System Binary Interface.
#define kPefAbi (0x5046)
-#define kPefStart "__start"
+#define kPefStart "__ImageStart"
#endif /* ifndef __PEF__ */
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index b6eb80b0..50259398 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -3,17 +3,17 @@
# This is the bootloader makefile.
##################################################
-CC_GNU=x86_64-w64-mingw32-g++.exe
-LD_GNU=x86_64-w64-mingw32-ld.exe
+CC_GNU=x86_64-w64-mingw32-g++
+LD_GNU=x86_64-w64-mingw32-ld
-WINDRES=x86_64-w64-mingw32-windres.exe
+WINDRES=x86_64-w64-mingw32-windres
ADD_FILE=touch
COPY=cp
HTTP_GET=wget
ifeq ($(shell uname), Windows_NT)
-EMU=qemu-system-x86_64w.exe
+EMU=qemu-system-x86_64w
else
EMU=qemu-system-x86_64
endif
diff --git a/Private/Servers/CoreDisplay/Headers/CDBitBlt.h b/Private/Servers/CoreDisplay/Headers/CDBitBlt.h
new file mode 100644
index 00000000..21823755
--- /dev/null
+++ b/Private/Servers/CoreDisplay/Headers/CDBitBlt.h
@@ -0,0 +1,10 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+ File: CDBitBlt.h
+ Purpose: Userbuffer to Framebuffer magic.
+
+------------------------------------------- */
+
+#pragma once \ No newline at end of file
diff --git a/Private/Servers/CoreDisplay/Headers/CDServerStartup.h b/Private/Servers/CoreDisplay/Headers/CDServerStartup.h
new file mode 100644
index 00000000..47f369ae
--- /dev/null
+++ b/Private/Servers/CoreDisplay/Headers/CDServerStartup.h
@@ -0,0 +1,10 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+ File: CDServerStartup.h
+ Purpose: Server entrypoint.
+
+------------------------------------------- */
+
+#pragma once \ No newline at end of file
diff --git a/Private/Servers/CoreDisplay/Headers/CoreDisplay.h b/Private/Servers/CoreDisplay/Headers/CoreDisplay.h
deleted file mode 100644
index e69de29b..00000000
--- a/Private/Servers/CoreDisplay/Headers/CoreDisplay.h
+++ /dev/null
diff --git a/Private/Servers/CoreDisplay/Sources/CDBitBlt.c b/Private/Servers/CoreDisplay/Sources/CDBitBlt.c
new file mode 100644
index 00000000..91e5342f
--- /dev/null
+++ b/Private/Servers/CoreDisplay/Sources/CDBitBlt.c
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+ File: CDBitBlt.c
+ Purpose: Userbuffer to Framebuffer magic.
+
+------------------------------------------- */
+
+#include <CDBitBlt.h>
+
diff --git a/Private/Servers/CoreEvents/Sources/CoreEvents.c b/Private/Servers/CoreDisplay/Sources/CDServerStartup.c
index e15bdebe..7293b720 100644
--- a/Private/Servers/CoreEvents/Sources/CoreEvents.c
+++ b/Private/Servers/CoreDisplay/Sources/CDServerStartup.c
@@ -2,25 +2,23 @@
Copyright Mahrouss Logic
- File: CoreEvents.c
- Purpose: Event server.
+ File: CDServerStartup.c
+ Purpose: Server entrypoint.
------------------------------------------- */
-#include <CoreEvents.h>
+#include <CDServerStartup.h>
#include <IPC.h>
/// @brief Called when the server starts.
-DWordType ServerStartup(VoidType)
+int ServerStartup(void)
{
- IPCSendMessage(kIPCBroadcastNew); /// broadcast our presence
return 0;
}
/// @brief Called when the server shuts down.
-DWordType ServerShutdown(VoidType)
+int ServerShutdown(void)
{
- IPCSendMessage(kIPCBroadcastDispose); /// broadcast our dispose.
return 0;
}
diff --git a/Private/Servers/CoreDisplay/Sources/CoreDisplay.c b/Private/Servers/CoreDisplay/Sources/CoreDisplay.c
deleted file mode 100644
index 2a3f31fe..00000000
--- a/Private/Servers/CoreDisplay/Sources/CoreDisplay.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
- File: CoreDisplay.c
- Purpose: Display server.
-
-------------------------------------------- */
-
-#include <CoreDisplay.h>
-#include <IPC.h>
-
-/// @brief Called when the server starts.
-DWordType ServerStartup(VoidType)
-{
- CDInitDisplay(kCDNoFlags); // init standard display. Need to notify other endpoits.
- // as well.
- //
-
- IPCSendMessage(kIPCBroadcastNew); /// broadcast our presence
-
- return 0;
-}
-
-/// @brief Called when the server shuts down.
-DWordType ServerShutdown(VoidType)
-{
- CDCloseDisplay(kCDShutdownAll); /// takes the close flag argument, which tells here to also close the child nodes.
- IPCSendMessage(kIPCBroadcastDispose); /// broadcast our presence
- return 0;
-}
-
-/// EOF.
diff --git a/Private/Servers/CoreEvents/Headers/.gitkeep b/Private/Servers/CoreEvents/Headers/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/Private/Servers/CoreEvents/Headers/.gitkeep
+++ /dev/null
diff --git a/Private/Servers/CoreEvents/Headers/CoreEvents.h b/Private/Servers/CoreEvents/Headers/CoreEvents.h
deleted file mode 100644
index e69de29b..00000000
--- a/Private/Servers/CoreEvents/Headers/CoreEvents.h
+++ /dev/null
diff --git a/Private/Servers/CoreEvents/README.txt b/Private/Servers/CoreEvents/README.txt
deleted file mode 100644
index 900e332a..00000000
--- a/Private/Servers/CoreEvents/README.txt
+++ /dev/null
@@ -1 +0,0 @@
-CoreEvents server. \ No newline at end of file
diff --git a/Private/Source/PEFCodeManager.cxx b/Private/Source/PEFCodeManager.cxx
index ed6b7bbc..f8616a8c 100644
--- a/Private/Source/PEFCodeManager.cxx
+++ b/Private/Source/PEFCodeManager.cxx
@@ -24,6 +24,8 @@ UInt32 rt_get_pef_platform(void) noexcept {
return kPefArch64x0;
#elif defined(__x86_64__)
return kPefArchAMD64;
+#elif defined(__powerpc64__)
+ return kPefArchPowerPC;
#else
return kPefArchInvalid;
#endif // __32x0__ || __64x0__ || __x86_64__
@@ -53,15 +55,6 @@ PEFLoader::PEFLoader(const char *path) : fCachedBlob(nullptr), fBad(false) {
PEFContainer *container = reinterpret_cast<PEFContainer *>(fCachedBlob);
- auto fFree = [&]() -> void {
- kcout << "CodeManager: Warning: Executable format error!\n";
- fBad = true;
-
- ke_delete_ke_heap(fCachedBlob);
-
- fCachedBlob = nullptr;
- };
-
if (container->Cpu == Detail::rt_get_pef_platform() &&
container->Magic[0] == kPefMagic[0] &&
container->Magic[1] == kPefMagic[1] &&
@@ -74,7 +67,12 @@ PEFLoader::PEFLoader(const char *path) : fCachedBlob(nullptr), fBad(false) {
}
}
- fFree();
+ kcout << "CodeManager: Warning: Executable format error!\n";
+ fBad = true;
+
+ ke_delete_ke_heap(fCachedBlob);
+
+ fCachedBlob = nullptr;
}
}
diff --git a/Private/makefile b/Private/makefile
index 781da4e8..412739ca 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -3,10 +3,10 @@
# This is the microkernel makefile.
##################################################
-CC = x86_64-w64-mingw32-gcc.exe
-LD = x86_64-w64-mingw32-ld.exe
+CC = x86_64-w64-mingw32-gcc
+LD = x86_64-w64-mingw32-ld
CCFLAGS = -c -ffreestanding -D__NEWOS_AMD64__ -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./
-ASM = nasm.exe
+ASM = nasm
ifneq ($(ATA_PIO_SUPPORT), )
DISKDRIVER = -D__ATA_PIO__
@@ -40,7 +40,7 @@ error:
@echo "Use a specific target."
MOVEALL=./MoveAll.sh
-WINDRES=x86_64-w64-mingw32-windres.exe
+WINDRES=x86_64-w64-mingw32-windres
.PHONY: newos-amd64-epm
newos-amd64-epm: clean
diff --git a/Public/Developer/FragLib/Sources/RuntimeFrag.c b/Public/Developer/FragLib/Sources/ImageStart.c
index f9e7c442..3fbac042 100644
--- a/Public/Developer/FragLib/Sources/RuntimeFrag.c
+++ b/Public/Developer/FragLib/Sources/ImageStart.c
@@ -6,16 +6,16 @@
#include <Headers/Defines.h>
-/// @brief Main application entrypoint.
-/// @param
-/// @return
+/// @brief Application entrypoint.
+/// @param void
+/// @return void
CA_EXTERN_C VoidType AppMain(VoidType);
-/// @brief Pre-entrypoint intiialization.
-/// @param
-/// @return
-CA_EXTERN_C VoidType __start(VoidType) {
- kSharedApplication = RtGetApp();
+/// @brief Process entrypoint.
+/// @param void
+/// @return void
+CA_EXTERN_C VoidType __ImageStart(VoidType) {
+ kSharedApplication = RtGetAppPointer();
CA_MUST_PASS(kSharedApplication);
AppMain();
diff --git a/Public/Developer/SystemLib/AMD64/CoreAssembly.s b/Public/Developer/SystemLib/AMD64/CoreAssembly.s
index 5c398e94..58fa3c28 100644
--- a/Public/Developer/SystemLib/AMD64/CoreAssembly.s
+++ b/Public/Developer/SystemLib/AMD64/CoreAssembly.s
@@ -6,23 +6,23 @@
------------------------------------------- */
-.section .text
+.text
-.globl RtGetApp
+.globl RtGetAppPointer
.globl RtAssertTriggerInterrupt
/* @brief Application getter */
/* @throws: ApptError: appartement error. */
-RtGetApp:
+RtGetAppPointer:
mov $0x10, %rcx /* sysGetProcessObject */
- int $0x21
+ int $0x32
/* rax gets saved and returned. */
ret
RtAssertTriggerInterrupt:
mov $0x11, %rcx /* sysTerminateCurrentProcess */
- int $0x21
+ int $0x32
ret
diff --git a/Public/Developer/SystemLib/Headers/Defines.h b/Public/Developer/SystemLib/Headers/Defines.h
index 7bd40c76..3be7552f 100644
--- a/Public/Developer/SystemLib/Headers/Defines.h
+++ b/Public/Developer/SystemLib/Headers/Defines.h
@@ -193,7 +193,7 @@ using StrType = CharacterTypeUTF8[N];
/// @brief Get app singleton.
/// @param
/// @return
-CA_EXTERN_C ApplicationRef RtGetApp(VoidType);
+CA_EXTERN_C ApplicationRef RtGetAppPointer(VoidType);
/// @brief Get argument count
/// @param
diff --git a/Public/Developer/SystemLib/Headers/Dialog.h b/Public/Developer/SystemLib/Headers/Dialog.h
index 872eae5d..800f56db 100644
--- a/Public/Developer/SystemLib/Headers/Dialog.h
+++ b/Public/Developer/SystemLib/Headers/Dialog.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
struct _DialogPort;
struct _DialogPoint;
@@ -22,10 +22,11 @@ typedef struct _DialogPoint {
typedef struct _DialogPort {
WordType dlgPort;
WordType dlgKind;
- BooleanType dlgVisible;
- BooleanType dlgMoving;
+ BooleanType dlgVisible : 1;
+ BooleanType dlgMoving : 1;
DialogPoint dlgPosition;
WmDialogFn dlgProc;
+ struct _WmGFX* dlgGfx;
struct _WindowPort* parentPort;
} DialogPort;
diff --git a/Public/Developer/SystemLib/Headers/Draw.h b/Public/Developer/SystemLib/Headers/Draw.h
index 3060db9d..38f99e7d 100644
--- a/Public/Developer/SystemLib/Headers/Draw.h
+++ b/Public/Developer/SystemLib/Headers/Draw.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
/*************************************************************
*
diff --git a/Public/Developer/SystemLib/Headers/File.h b/Public/Developer/SystemLib/Headers/File.h
index 5e58d104..234c33da 100644
--- a/Public/Developer/SystemLib/Headers/File.h
+++ b/Public/Developer/SystemLib/Headers/File.h
@@ -14,8 +14,8 @@ typedef QWordType FSRef;
/// @brief Opens a new file.
/// @param path where to find it.
-/// @param r the restrict (rw, rwe, r+, w+, r, w)
-/// @return
+/// @param rest the restrict (rw, rwe, r+, w+, r, w)
+/// @return FSRef the file.
CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r);
/// @brief Closes the file and flushes it to the said file.
@@ -23,13 +23,15 @@ CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeU
/// @return
CA_EXTERN_C VoidType FsCloseFile(FSRef refFs);
+#define kMaxForkNameLength 256 /* long fork names. */
+
/// @brief A fork information header.
typedef struct _Fork {
PtrVoidType forkData;
SizeType forkSize;
Int32Type forkFlags;
Int32Type forkKind;
- CharacterTypeUTF8 forkName[256];
+ CharacterTypeUTF8 forkName[kMaxForkNameLength];
} ForkType;
typedef ForkType* FSForkRef;
@@ -40,5 +42,10 @@ typedef ForkType* FSForkRef;
/// @return the fork data.
CA_EXTERN_C FSForkRef FsGetFork(FSRef refFs, const CharacterTypeUTF8* forkName);
+/// @brief Check if the filesystem path is valid.
+/// @return if not return false, or true.
+CA_EXTERN_C BooleanType FsIsValidPath(const CharacterTypeUTF8* path);
+
+/// @note not only limited to, there is code forks, icon forks...
#define FsGetDataFork(refFs) FsGetFork(refFs, "data")
#define FsGetRsrcFork(refFs) FsGetFork(refFs, "rsrc")
diff --git a/Public/Developer/SystemLib/Headers/Math.h b/Public/Developer/SystemLib/Headers/Math.h
new file mode 100644
index 00000000..f6c8f216
--- /dev/null
+++ b/Public/Developer/SystemLib/Headers/Math.h
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <Headers/Defines.h>
+
+CA_EXTERN_C SizeType MathRand(VoidType);
diff --git a/Public/Developer/SystemLib/Headers/TrueType.h b/Public/Developer/SystemLib/Headers/TrueType.h
index 7f1bed86..6387e58f 100644
--- a/Public/Developer/SystemLib/Headers/TrueType.h
+++ b/Public/Developer/SystemLib/Headers/TrueType.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
/*************************************************************
*
diff --git a/Public/Developer/SystemLib/Headers/Window.h b/Public/Developer/SystemLib/Headers/Wm.h
index ca0b942e..66ed96a3 100644
--- a/Public/Developer/SystemLib/Headers/Window.h
+++ b/Public/Developer/SystemLib/Headers/Wm.h
@@ -10,7 +10,7 @@
/*************************************************************
*
- * File: Window.h
+ * File: Wm.h
* Purpose: Window Manager API for NewOS.
* Date: 3/26/24
*
@@ -24,7 +24,13 @@ struct _WindowPort;
struct _ControlPort;
struct _WmPoint;
-typedef QWordType DCRef;
+/// @brief Window Graphics type.
+typedef struct _WmGFX {
+ UInt32Type Depth;
+ UInt32Type* DataFrame;
+ SizeType DataFrameWidth;
+ SizeType DataFrameHeight;
+} WmGFX, *WmGFXRef;
/// @brief Window procedure type.
typedef VoidType(*WmWindowFn)(struct _WindowPort* port, UInt32Type msg, UIntPtrType pParam, UIntPtrType iParam);
@@ -34,20 +40,21 @@ typedef struct _WmPoint {
PositionType X, Y;
} WmPoint;
+
/// @brief Window port type, can be used to control the window.
typedef struct _WindowPort {
WordType windowPort;
WordType windowKind;
- BooleanType windowVisible;
- BooleanType windowMaximized;
- BooleanType windowMinimized;
- BooleanType windowMoving;
- BooleanType windowDisableClose;
- BooleanType windowDisableMinimize;
+ BooleanType windowVisible : 1;
+ BooleanType windowMaximized : 1;
+ BooleanType windowMinimized : 1;
+ BooleanType windowMoving : 1;
+ BooleanType windowDisableClose : 1;
+ BooleanType windowDisableMinimize : 1;
+ BooleanType windowInvalidate : 1;
WmPoint windowPosition;
WmPoint windowSize;
- BooleanType windowInvalidate;
- DWordType windowClearColor;
+ WmGFXRef windowGfx;
WmWindowFn windowProc;
struct _WindowPort* windowMenuPort; ///! Attached menu to it.
struct _WindowPort* windowParentPort;
@@ -57,10 +64,11 @@ typedef struct _WindowPort {
typedef struct _ControlPort {
WordType controlPort;
WordType controlKind;
- BooleanType controlVisible;
- BooleanType controlMoving;
+ BooleanType controlVisible : 1;
+ BooleanType controlMoving : 1;
WmPoint controlPosition;
WmWindowFn controlProc;
+ WmGFXRef controlGfx;
WindowPort* parentPort;
} ControlPort;
@@ -107,37 +115,37 @@ CA_EXTERN_C const ColorRef kRgbWhite;
CA_EXTERN_C ControlPort* WmCreateControl(DWordType id);
/// @brief Releases the control
-/// @param id the control ref.
+/// @param ctrlPort the control ref.
/// @return
-CA_EXTERN_C VoidType WmReleaseControl(ControlPort* id);
+CA_EXTERN_C VoidType WmReleaseControl(ControlPort* ctrlPort);
/// @brief Moves a control inside a ControlPort.
-/// @param id the control ref.
+/// @param ctrlPort the control ref.
/// @param where where to move at.
/// @return
-CA_EXTERN_C Int32Type WmSetControlPosition(ControlPort* id, WmPoint where);
+CA_EXTERN_C Int32Type WmSetControlPosition(ControlPort* ctrlPort, WmPoint where);
/// @brief Enable control.
-/// @param id
+/// @param ctrlPort
/// @param enabled
/// @return
-CA_EXTERN_C Int32Type WmSetControlEnabled(ControlPort* id, BooleanType enabled);
+CA_EXTERN_C Int32Type WmSetControlEnabled(ControlPort* ctrlPort, BooleanType enabled);
/// @brief Make control visible.
-/// @param id
+/// @param ctrlPort
/// @param visible
/// @return
-CA_EXTERN_C Int32Type WmSetControlVisible(ControlPort* id, BooleanType visible);
+CA_EXTERN_C Int32Type WmSetControlVisible(ControlPort* ctrlPort, BooleanType visible);
/// @brief Creates a new window.
/// @param name the window name
-/// @param rsrcId the window fork rsrc id.
+/// @param rsrcId the window fork rsrc ctrlPort.
/// @return the window graphics port.
CA_EXTERN_C WindowPort* WmCreateWindow(const CharacterTypeUTF8* name, const DWordType rsrcId);
/// @brief Creates a new menu
/// @param name the menu's name
-/// @param rsrcId the menu fork rsrc id.
+/// @param rsrcId the menu fork rsrc ctrlPort.
/// @return the menu graphics port.
CA_EXTERN_C WindowPort* WmCreateMenu(const CharacterTypeUTF8* name, const DWordType rsrcId);
@@ -151,14 +159,17 @@ CA_EXTERN_C VoidType WmReleaseWindow(WindowPort* port);
/// @return void
CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* port);
-/// @brief Moves a window on the desktop. (menu arent movable, will return kErrIncompatible is menu is provided.)
-/// @param id the gfx port.
+/// @brief Moves a window on the desktop. (menu arent movable, will return kErrIncompatible if menu is provided.)
+/// @param wndPort the gfx port.
/// @param where to move.
/// @return error code.
-CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* id, WmPoint where);
+CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where);
/// @brief Get the NewOS about window.
/// @return The window port of it.
/// @note The reason that this is not a window is for it to run without blocking the UI.
CA_EXTERN_C WindowPort* WmGetOSDlg(void);
+/// @brief Draws a blur effect on the window.
+/// @param wndPort the window port.
+CA_EXTERN_C VoidType WmBlur(WindowPort* wndPort); \ No newline at end of file
diff --git a/Public/Developer/SystemLib/PowerPC/CoreAssembly.s b/Public/Developer/SystemLib/PowerPC/CoreAssembly.s
index 98fbcca9..7078774e 100644
--- a/Public/Developer/SystemLib/PowerPC/CoreAssembly.s
+++ b/Public/Developer/SystemLib/PowerPC/CoreAssembly.s
@@ -2,14 +2,13 @@
;
; Copyright Mahrouss Logic
;
-; Purpose: PowerPC low level I/O
+; Purpose: PowerPC Core assembly routines.
;
; ------------------------------------------- */
-
/* @brief Application getter */
/* @throws: ApptError: appartement error. */
-export .code64 RtGetApp:
+export .code64 RtGetAppPointer:
stw 0x10, 0(r3) /* sysGetProcessObject */
sc
diff --git a/Public/Developer/SystemLib/Sources/Application.c b/Public/Developer/SystemLib/Sources/App.c
index 69f178af..9d390795 100644
--- a/Public/Developer/SystemLib/Sources/Application.c
+++ b/Public/Developer/SystemLib/Sources/App.c
@@ -6,13 +6,15 @@
#include <Headers/Defines.h>
-/// @brief Main Application object, retrieved from the RtGetApp symbol.
+/// @brief Main Application object, retrieved from the RtGetAppPointer symbol.
ApplicationRef kSharedApplication = NullPtr;
/// @brief Gets the app arguments count.
/// @param void no arguments.
/// @return
CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType) {
+ CA_MUST_PASS(kSharedApplication);
+
return kSharedApplication->Invoke(kSharedApplication, kCallGetArgsCount);
}
@@ -20,6 +22,8 @@ CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType) {
/// @param void no arguments.
/// @return
CA_EXTERN_C CharacterTypeUTF8** RtGetAppArgumentsPtr(VoidType) {
+ CA_MUST_PASS(kSharedApplication);
+
return (CharacterTypeUTF8**)kSharedApplication->Invoke(kSharedApplication,
kCallGetArgsPtr);
}
diff --git a/Public/Developer/SystemLib/Sources/File.c b/Public/Developer/SystemLib/Sources/File.c
index ca23d9f7..39a4aff0 100644
--- a/Public/Developer/SystemLib/Sources/File.c
+++ b/Public/Developer/SystemLib/Sources/File.c
@@ -8,31 +8,32 @@
#include <Headers/File.h>
enum FileOp {
- kFlushFile,
- kReadFork,
- kWriteFork,
- kOpenFork,
- kCloseFork,
+ kFlushFile,
+ kReadFork,
+ kWriteFork,
+ kOpenFork,
+ kCloseFork,
};
/// @brief Opens a new file.
/// @param path where to find it.
-/// @param r the restrict (rw, rwe, r+, w+, r, w)
-/// @return
-CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r) {
- CA_MUST_PASS(kSharedApplication);
- CA_MUST_PASS(path);
- CA_MUST_PASS(r);
-
- return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path, r);
+/// @param rest the restrict (rw, rwe, r+, w+, r, w)
+/// @return FSRef the file.
+CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path,
+ const CharacterTypeUTF8* rest) {
+ CA_MUST_PASS(kSharedApplication);
+ CA_MUST_PASS(path && FsIsValidPath(path) == Yes);
+ CA_MUST_PASS(rest);
+
+ return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path, rest);
}
/// @brief Closes the file and flushes it to the said file.
/// @param refFs the filesystem reference.
-/// @return
+/// @return
CA_EXTERN_C VoidType FsCloseFile(FSRef refFs) {
- CA_MUST_PASS(kSharedApplication);
+ CA_MUST_PASS(kSharedApplication);
- kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile);
- kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs);
+ kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile);
+ kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs);
}
diff --git a/Public/Developer/SystemLib/Sources/Heap.c b/Public/Developer/SystemLib/Sources/Heap.c
index 041c5764..3db7a374 100644
--- a/Public/Developer/SystemLib/Sources/Heap.c
+++ b/Public/Developer/SystemLib/Sources/Heap.c
@@ -12,6 +12,7 @@
/// @param flags flags.
/// @return
CA_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz, DWordType flags) {
+ CA_MUST_PASS(kSharedApplication);
CA_MUST_PASS(sz);
CA_MUST_PASS(flags);
@@ -22,7 +23,9 @@ CA_EXTERN_C PtrVoidType RtTlsAllocate(QWordType sz, DWordType flags) {
/// @brief Free pointer from the user's heap.
/// @param ptr the pointer to free.
CA_EXTERN_C VoidType RtTlsFree(PtrVoidType ptr) {
+ CA_MUST_PASS(kSharedApplication);
CA_MUST_PASS(ptr);
+
CA_UNREFERENCED_PARAMETER(
kSharedApplication->Invoke(kSharedApplication, kCallFreePtr, ptr));
}
@@ -31,6 +34,8 @@ CA_EXTERN_C VoidType RtTlsFree(PtrVoidType ptr) {
/// @param ptr the pointer to find.
/// @return the size.
CA_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr) {
+ CA_MUST_PASS(kSharedApplication);
+
CA_MUST_PASS(ptr);
return kSharedApplication->Invoke(kSharedApplication, kCallSizePtr, ptr);
}
@@ -39,6 +44,8 @@ CA_EXTERN_C QWordType RtTlsGetSize(PtrVoidType ptr) {
/// @param ptr the pointer to check.
/// @return if it exists
CA_EXTERN_C BooleanType RtTlsPtrExists(PtrVoidType ptr) {
+ CA_MUST_PASS(kSharedApplication);
+
CA_MUST_PASS(ptr);
return kSharedApplication->Invoke(kSharedApplication, kCallCheckPtr, ptr);
}
diff --git a/Public/Developer/SystemLib/Sources/Math.c b/Public/Developer/SystemLib/Sources/Math.c
new file mode 100644
index 00000000..20919711
--- /dev/null
+++ b/Public/Developer/SystemLib/Sources/Math.c
@@ -0,0 +1,7 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <Headers/Math.h>
diff --git a/Public/Developer/SystemLib/Sources/Window.c b/Public/Developer/SystemLib/Sources/Wm.c
index 196ac537..79eda22a 100644
--- a/Public/Developer/SystemLib/Sources/Window.c
+++ b/Public/Developer/SystemLib/Sources/Wm.c
@@ -4,7 +4,8 @@
------------------------------------------- */
-#include <Headers/Window.h>
+#include <Headers/Wm.h>
+#include <Headers/Math.h>
/// invalid resource handle, they always start from 1.
#define kInvalidRsrc (0U)
@@ -65,12 +66,38 @@ CA_EXTERN_C VoidType WmReleaseMenu(WindowPort* winPort) {
/////////////////////////////////////////////////////////////////////////
-CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* id, WmPoint where) {
- if (!id) return kWmErrInvalidArg;
+CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* wndPort, WmPoint where) {
+ if (!wndPort) return kWmErrInvalidArg;
- id->windowPosition.X = where.X;
- id->windowPosition.Y = where.Y;
- id->windowMoving = True;
+ wndPort->windowPosition.X = where.X;
+ wndPort->windowPosition.Y = where.Y;
+ wndPort->windowMoving = True;
return 0;
}
+
+/// @brief Draws a blur effect on the window.
+/// @param wndPort the window port.
+CA_EXTERN_C VoidType WmBlur(WindowPort* wndPort) {
+ if (wndPort != NullPtr) {
+ WmGFXRef refGfx = wndPort->windowGfx;
+
+ UInt32Type lookupTbl[4] = {0.21336, 0.41336, 0.61336, 0.81336};
+
+ for (SizeType width = 0; width < refGfx->DataFrameWidth; ++width) {
+ for (SizeType height = 0; height < refGfx->DataFrameHeight; ++height) {
+ refGfx->DataFrame[width * height] =
+ refGfx->DataFrame[width * height] * lookupTbl[MathRand() % 4];
+ }
+ }
+ }
+}
+
+/// @brief Causes the window to invalidate and redraw.
+/// @param wndPort The Window port.
+/// @return nothing.
+CA_EXTERN_C VoidType WmInvalidateGfx(WindowPort* wndPort) {
+ if (wndPort) {
+ wndPort->windowInvalidate = Yes;
+ }
+} \ No newline at end of file
diff --git a/Public/Developer/SystemLib/compile_flags.txt b/Public/Developer/SystemLib/compile_flags.txt
index 6e721e73..3be985d1 100644
--- a/Public/Developer/SystemLib/compile_flags.txt
+++ b/Public/Developer/SystemLib/compile_flags.txt
@@ -1,4 +1,4 @@
-I./
-I../
-I../../../Private
--std=c++20
+-std=c17