summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/SystemLib/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'Public/Developer/SystemLib/Sources')
-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
5 files changed, 70 insertions, 24 deletions
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