diff --git a/.editorconfig b/.editorconfig
index 7c203230be..843916258f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -9,7 +9,7 @@ root = true
# Use tabs as indentation
# Trim trailing whitespace
[*]
-insert_final_newline = true
+insert_final_newline = false
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
@@ -26,9 +26,9 @@ csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_throw_expression = true:suggestion
-csharp_style_var_elsewhere = true:none
-csharp_style_var_for_built_in_types = true:none
-csharp_style_var_when_type_is_apparent = true:warning
+csharp_style_var_elsewhere = false:none
+csharp_style_var_for_built_in_types = false:none
+csharp_style_var_when_type_is_apparent = false:warning
csharp_indent_block_contents = true:warning
csharp_indent_braces = false:warning
@@ -49,6 +49,15 @@ csharp_space_before_comma = false:warning
csharp_space_before_dot = false:error
csharp_space_before_open_square_brackets = true:warning
csharp_space_before_semicolon_in_for_statement = false:error
+csharp_using_directive_placement = outside_namespace:silent
+csharp_prefer_simple_using_statement = true:suggestion
+csharp_style_namespace_declarations = block_scoped:silent
+csharp_style_expression_bodied_lambdas = true:silent
+csharp_style_expression_bodied_local_functions = false:silent
+csharp_indent_labels = one_less_than_current
+csharp_style_prefer_null_check_over_type_check = true:suggestion
+csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
+csharp_style_prefer_not_pattern = true:suggestion
[*.{cs,vb}]
dotnet_sort_system_directives_first = true
@@ -59,18 +68,16 @@ dotnet_style_explicit_tuple_names = true:warning
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
-dotnet_style_predefined_type_for_member_access = false:warning
+dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_naming_style.pascal_case.capitalization = pascal_case
-dotnet_naming_style.parameters.capitalization = pascal_case
-dotnet_naming_style.parameters.required_prefix = a
+dotnet_naming_style.parameters.capitalization = camel_case
-dotnet_naming_style.private_fields.capitalization = pascal_case
-dotnet_naming_style.private_fields.required_prefix = _
+dotnet_naming_style.private_fields.capitalization = camel_case
dotnet_naming_style.interfaces.capitalization = pascal_case
dotnet_naming_style.interfaces.required_prefix = I
@@ -94,8 +101,13 @@ dotnet_naming_rule.pascal_case_definitions.style = pascal_case
dotnet_naming_rule.parameters.severity = suggestion
dotnet_naming_rule.parameters.symbols = parameters
-dotnet_naming_rule.parameters.style = parameters
+dotnet_naming_rule.parameters.style = private_fields
dotnet_naming_rule.private_fields.severity = suggestion
dotnet_naming_rule.private_fields.symbols = private_fields
dotnet_naming_rule.private_fields.style = private_fields
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+tab_width = 4
+end_of_line = crlf
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
diff --git a/.gitignore b/.gitignore
index 54fb845726..5ce42c8e8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,6 @@ Docs/~$RingsGen3.xlsx
*.map
/Resources/Dependencies/Dapper/DapperExtensions.StrongName.deps.json
/Resources/Dependencies/Dapper/ref/DapperExtensions.StrongName.dll
+
+
+.idea/
\ No newline at end of file
diff --git a/Artwork/liminewp.bmp b/Artwork/liminewp.bmp
index b2c7f54171..e3aeb7c372 100644
Binary files a/Artwork/liminewp.bmp and b/Artwork/liminewp.bmp differ
diff --git a/Build.sln b/Build.sln
index 23c92d3646..a2826a5433 100644
--- a/Build.sln
+++ b/Build.sln
@@ -83,8 +83,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Runner", "Test Runner"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.TestRunner.TestController", "Tests\Cosmos.TestRunner.TestController\Cosmos.TestRunner.TestController.csproj", "{2EEC1BF8-758F-4D9D-B063-8CF005468B24}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheRingMaster", "source\TheRingMaster\TheRingMaster.csproj", "{0EE3DF1C-44E6-4669-88AA-D8D2612DA817}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{3C4B0261-3B1D-4503-97F1-AC0252D500E6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NASM", "Tools\NASM\NASM.csproj", "{A7C295D2-8DEA-4CAE-A8CB-44CD0529EC65}"
@@ -99,6 +97,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DapperExtensions.StrongName
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.Debug.Symbols.Net48", "..\IL2CPU\source\IL2CPU.Debug.Symbols.Net48\IL2CPU.Debug.Symbols.Net48.csproj", "{440CE2D4-024F-45D3-A95C-9077CC0A51E3}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Plugs", "source\Cosmos.Plugs\Cosmos.Plugs.csproj", "{509FB0F8-6D0F-424F-9C6B-9E5818B06B21}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -364,16 +364,6 @@ Global
{2EEC1BF8-758F-4D9D-B063-8CF005468B24}.Release-CI|Any CPU.Build.0 = Release|Any CPU
{2EEC1BF8-758F-4D9D-B063-8CF005468B24}.TEST|Any CPU.ActiveCfg = TEST|Any CPU
{2EEC1BF8-758F-4D9D-B063-8CF005468B24}.TEST|Any CPU.Build.0 = TEST|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Debug-CI|Any CPU.ActiveCfg = Debug|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Debug-CI|Any CPU.Build.0 = Debug|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Release|Any CPU.Build.0 = Release|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Release-CI|Any CPU.ActiveCfg = Release|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.Release-CI|Any CPU.Build.0 = Release|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.TEST|Any CPU.ActiveCfg = TEST|Any CPU
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817}.TEST|Any CPU.Build.0 = TEST|Any CPU
{A7C295D2-8DEA-4CAE-A8CB-44CD0529EC65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7C295D2-8DEA-4CAE-A8CB-44CD0529EC65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7C295D2-8DEA-4CAE-A8CB-44CD0529EC65}.Debug-CI|Any CPU.ActiveCfg = Debug|Any CPU
@@ -440,6 +430,16 @@ Global
{440CE2D4-024F-45D3-A95C-9077CC0A51E3}.Release-CI|Any CPU.Build.0 = Release|Any CPU
{440CE2D4-024F-45D3-A95C-9077CC0A51E3}.TEST|Any CPU.ActiveCfg = TEST|Any CPU
{440CE2D4-024F-45D3-A95C-9077CC0A51E3}.TEST|Any CPU.Build.0 = TEST|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Debug-CI|Any CPU.ActiveCfg = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Debug-CI|Any CPU.Build.0 = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Release|Any CPU.Build.0 = Release|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Release-CI|Any CPU.ActiveCfg = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.Release-CI|Any CPU.Build.0 = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.TEST|Any CPU.ActiveCfg = Debug|Any CPU
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21}.TEST|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -476,13 +476,13 @@ Global
{366C2EC6-B9D8-4676-9C88-98F041B8FC93} = {CAF5EB57-6CAD-446D-8FC7-4C03D4B996A6}
{535A7E34-AC73-4781-B791-2C81A9066A2C} = {CD3F5E45-8B24-424F-ADF1-0211712F4CB7}
{2EEC1BF8-758F-4D9D-B063-8CF005468B24} = {D4833110-032D-40E3-ACB3-F11583727B08}
- {0EE3DF1C-44E6-4669-88AA-D8D2612DA817} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
{A7C295D2-8DEA-4CAE-A8CB-44CD0529EC65} = {3C4B0261-3B1D-4503-97F1-AC0252D500E6}
{C984AF76-66C2-4A5F-A3DC-9F8FE0CD4D2F} = {9C8A3E55-9045-44CA-BFD4-16D5B4343A90}
{0BA0EC69-F124-44C1-823D-C97FE3AEC59E} = {D95021E1-A2C9-4829-819E-ED433AF13162}
{9413B5A0-1120-43AD-8784-8A3726C1898C} = {FF5BAFDE-AE9D-438D-935A-86B33EE0A758}
{28F18214-DFF8-4A30-BA24-4F32C20CA910} = {FF5BAFDE-AE9D-438D-935A-86B33EE0A758}
{440CE2D4-024F-45D3-A95C-9077CC0A51E3} = {FF5BAFDE-AE9D-438D-935A-86B33EE0A758}
+ {509FB0F8-6D0F-424F-9C6B-9E5818B06B21} = {4D3F3613-E112-4013-AB81-B8CCED78A555}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E5429BF0-2CEE-45B0-BC73-2188A409E1D3}
diff --git a/build/Tools/Yasm/LICENSE.txt b/Build/Tools/Yasm/LICENSE.txt
similarity index 100%
rename from build/Tools/Yasm/LICENSE.txt
rename to Build/Tools/Yasm/LICENSE.txt
diff --git a/build/Tools/Yasm/yasm.exe b/Build/Tools/Yasm/yasm.exe
similarity index 100%
rename from build/Tools/Yasm/yasm.exe
rename to Build/Tools/Yasm/yasm.exe
diff --git a/Build/Tools/cygwin/cygiconv-2.dll b/Build/Tools/cygwin/cygiconv-2.dll
deleted file mode 100644
index 926464c7e2..0000000000
Binary files a/Build/Tools/cygwin/cygiconv-2.dll and /dev/null differ
diff --git a/Build/Tools/cygwin/cygintl-3.dll b/Build/Tools/cygwin/cygintl-3.dll
deleted file mode 100644
index bd6e3829ab..0000000000
Binary files a/Build/Tools/cygwin/cygintl-3.dll and /dev/null differ
diff --git a/Build/Tools/cygwin/cygwin1.dll b/Build/Tools/cygwin/cygwin1.dll
index 73c27fc1fb..00d8a72aad 100644
Binary files a/Build/Tools/cygwin/cygwin1.dll and b/Build/Tools/cygwin/cygwin1.dll differ
diff --git a/Build/Tools/cygwin/ld.exe b/Build/Tools/cygwin/ld.exe
index 963eeabd3c..52fc663fea 100644
Binary files a/Build/Tools/cygwin/ld.exe and b/Build/Tools/cygwin/ld.exe differ
diff --git a/Build/Tools/cygwin/objdump.bat b/Build/Tools/cygwin/objdump.bat
new file mode 100644
index 0000000000..63a2817c5b
--- /dev/null
+++ b/Build/Tools/cygwin/objdump.bat
@@ -0,0 +1,7 @@
+@ECHO OFF
+
+REM %1 == ToolPath
+REM %2 == ElfFile
+REM %3 == MapFile
+
+"%~1\objdump.exe" --wide --syms "%~2" > "%~3"
diff --git a/Build/Tools/cygwin/objdump.exe b/Build/Tools/cygwin/objdump.exe
index e709c327a5..fbd59f7f51 100644
Binary files a/Build/Tools/cygwin/objdump.exe and b/Build/Tools/cygwin/objdump.exe differ
diff --git a/Build/Tools/cygwin/objdump.sh b/Build/Tools/cygwin/objdump.sh
new file mode 100644
index 0000000000..4b16c3ae66
--- /dev/null
+++ b/Build/Tools/cygwin/objdump.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# %1 == ToolPath
+# %2 == ElfFile
+# %3 == MapFile
+objdump --wide --syms "$2" > "$3"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f074fdf5c9..de74adecce 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,15 +1,13 @@
CosmosOS is a volunteer effort. We encourage you to pitch in. Join the team!
-- Before you begin work, make sure to clear it with the project owners. It will save a lot of time down the road.
+- Before you begin work, make sure to discuss it with the maintainers here on github or on discord. It will save a lot of time down the road.
- Fork the project over to your account, do not request repository access.
- Please be sure to check out the FAQ to see if any questions you have are already answered. [FAQ on GoCosmos.org](https://www.gocosmos.org/faq/)
- Please don't "bump" your issue(s). If you've filed it, we have seen it.
-- Please be sure to install the [EditorConfig](https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328). This ensures your pull requests meet the required formatting and conventions. [See here](https://github.com/CosmosOS/Cosmos/wiki/FAQ#what-is-this-editorconfig-file-and-how-do-i-use-it) for more info.
-
-Want to get started contributing to Cosmos? Check out the open issues page:
-- [High priority](https://github.com/CosmosOS/Cosmos/labels/Priority%3A%20High)
-- [Medium priority](https://github.com/CosmosOS/Cosmos/labels/Priority%3A%20Medium)
+- If you have any questions or need a bit of help feel free to open a discussion post or ask on the discord.
+Want to get started contributing to Cosmos?
+Check out the open issues page for open [issues](https://github.com/CosmosOS/Cosmos/labels/Up%20for%20Grabs).
Thanks!
diff --git a/Docs/RingsGen3.vsdx b/Docs/RingsGen3.vsdx
deleted file mode 100644
index 5a6b67a15d..0000000000
Binary files a/Docs/RingsGen3.vsdx and /dev/null differ
diff --git a/Docs/RingsGen3.xlsx b/Docs/RingsGen3.xlsx
deleted file mode 100644
index 477e6dd0fe..0000000000
Binary files a/Docs/RingsGen3.xlsx and /dev/null differ
diff --git a/Docs/articles/Changelog.md b/Docs/articles/Changelog.md
new file mode 100644
index 0000000000..f1eacda920
--- /dev/null
+++ b/Docs/articles/Changelog.md
@@ -0,0 +1,12 @@
+# Devkit changelog
+
+## c5c087c697d106348adbcff86d5d43331500e648 (update then merged in)
+
+### Features
+
+* X# is now packaged as a nuget package
+* Plugs are now packaged as a nuget package rather then been hard coded in build scripts
+
+### Breaking changes
+
+Plugs are now included via a nuget package, to update cosmos past this commit you need to add the `Cosmos.Plugs` package to your kernel project. Don't forget to tick the `Include prerelease` checkbox and to set the package origin to `All`!
diff --git a/Docs/articles/GettingStarted.md b/Docs/articles/GettingStarted.md
index 0bf571a540..363fa8b503 100644
--- a/Docs/articles/GettingStarted.md
+++ b/Docs/articles/GettingStarted.md
@@ -38,9 +38,9 @@ console window, you will see the following:
![](images/SNAG-0003.png)
-This is your operating system running in VMWare Player! Cosmos can of course
-also be booted in VMWare Workstation, Hyper-V, Virtual PC, Bochs, or on real
-hardware. But by default Cosmos uses VMWare Player because it is both free,
+This is your operating system running in VMware Player! Cosmos can of course
+also be booted in VMware Workstation, Hyper-V, Virtual PC, Bochs, or on real
+hardware. But by default Cosmos uses VMware Player because it is both free,
and reliable. Cosmos can even debug in Visual Studio, even when running on
another machine.
@@ -70,7 +70,7 @@ over (F10) is not supported yet.
The debugger uses the serial port to communicate. Because of this, debugging
only works wtih virtualization environments that support serial ports such as
-VMWare. QEMU supports serial ports as well, but its serial port implementation
+VMware. QEMU supports serial ports as well, but its serial port implementation
is seriously broken on Windows and makes debugging impossible using QEMU. To
debug on real hardware, you must use a physical serial cable. In the future
Cosmos will also support debugging over Ethernet.
diff --git a/Docs/articles/Installation/DevKit.md b/Docs/articles/Installation/DevKit.md
index 026965fb7d..800c047387 100644
--- a/Docs/articles/Installation/DevKit.md
+++ b/Docs/articles/Installation/DevKit.md
@@ -1,43 +1,31 @@
+# Dev Kit Installation
### Prerequisites for Windows
-* (Free) source code of Devloppement Kit from [Cosmos on GitHub](https://github.com/CosmosOS/Cosmos)
+* (Free) source code of Development Kit from [Cosmos on GitHub](https://github.com/CosmosOS/Cosmos)
* You must clone the repository using Git. For a detailed walkthrough, [see here](https://help.github.com/articles/fork-a-repo/).
- * When following the tutorial, replace *OctoCat* with *CosmosOS* and *Spoon-Knife* with *Cosmos*.
* (Free) [Visual Studio 2022 Community](https://visualstudio.microsoft.com/vs/)
-* (Free) [InnoSetup QuickStart Kit](http://www.jrsoftware.org/isdl.php#qsp)
+* (Free) [InnoSetup](http://www.jrsoftware.org/isdl.php#qsp)
* This is required to build the setup kit which is used to build and install the Visual Studio integration libaries for Cosmos.
* During install it will ask you about optional components to install. Be sure you check "Install Inno Setup Preprocessor".
-* Visual Studio SDK: [download here](https://www.microsoft.com/en-us/download/details.aspx?id=40758).
### Prerequisites for Linux
-* .NET 6 SDK: [Download .NET SDK](https://learn.microsoft.com/en-us/dotnet/core/install/linux)
-* Make
+* .NET SDK (6+): [Download .NET SDK](https://learn.microsoft.com/en-us/dotnet/core/install/linux)
+* Make (`apt install make`)
* Yasm (`apt install yasm`)
* Xorriso (`apt install xorriso`)
-* QEMU or any other virtual machine
+* QEMU or any other virtual machine. See [Running](https://cosmosos.github.io/articles/Installation/Running.html) for more information.
### Installation on Windows
* Look in the downloaded sources and run **install-VS2022.bat** with admin privileges (UAC will ask for permission), needed for install in system directories.
* When the installation is complete, Visual Studio will automatically open and you may begin programming with your new, modified copy of Cosmos.
-## Arguments for the 'install-VS2022.bat' file
-The `install-VS2022.bat` accepts the following parameters :
-
-- `-USERKIT` Run installer for the User Kit only. By default installer build and install Dev Kit.
-- `-RESETHIVE` Reset Visual Studio Experimental Hive after installation.
-- `-NOTASK` When specified installer would be run directly instead of running as the task in the Task Scheduler
-- `-NOCLEAN` Don't clean solution before run installer.
-- `-NOVSLAUNCH` Don't launch VS after installation.
-- `-IGNOREVS` Ignore running VS during installation.
-- `-VSEXPHIVE` or `/VSEXPHIVE` Use Visual Studio Experimental Hive for installation.
-
### Installation on Linux
-Run `make all` to build Cosmos. Run `sudo make install`. Make sure to run `make nuget-install` under your user account, and not as sudo.
+Run `make` to build Cosmos. Cosmos will clone all the required repos, build itself, and install it and it's nuget packages to the system automatically.
### dotnet Project Templates
-If you are using linux or prefer not using Visual Studio for your projects, you can install the dotnet project template using `dotnet new --install .\source\templates\csharp\` assuming you are currently in the Cosmos base directory.
+If you are using linux or prefer not using Visual Studio for your projects, you can install the dotnet project template using `dotnet new --install ./source/templates/csharp/` assuming you are currently in the Cosmos base directory.
After installing the template use `dotnet new cosmosCSKernel -n {name}` to create a new Cosmos Kernel project.
-The dotnet template can be removed at a later time using `dotnet new --uninstall .\source\templates\csharp\`.
+The dotnet template can be removed at a later time using `dotnet new --uninstall ./source/templates/csharp/`.
diff --git a/Docs/articles/Installation/Running.md b/Docs/articles/Installation/Running.md
index e07f7bbf5d..cdfe347714 100644
--- a/Docs/articles/Installation/Running.md
+++ b/Docs/articles/Installation/Running.md
@@ -86,7 +86,7 @@ VMWare Workstation can be downloaded for free trial [here](https://www.vmware.co
Not officially supported at this time, but can be done. Just use the ISO option above with debugging turned off.
-QEMU can be downloaded [here](https://qemu.weilnetz.de/w64/)
+QEMU can be downloaded [here](https://www.qemu.org/download/)
## Bochs
diff --git a/Docs/articles/Internals/object.md b/Docs/articles/Internals/object.md
new file mode 100644
index 0000000000..c7dec15dd3
--- /dev/null
+++ b/Docs/articles/Internals/object.md
@@ -0,0 +1,12 @@
+# Object
+
+## Memory Layout
+
+Each object is allocated with a header of three uints. The first uint is the type of the object, the second uint is the instance type of object (normal, boxed, array etc) and the third is the size in memory.
+
+## Garbage Collector Information
+
+The garbage collector itself also alloctes its own header of 1 uint (2 ushort). The first ushort is the allocated size of the object (this includes the size of both headers) while the second tracks the GC information.
+The GC information is made up of a 1bit flag (the lowest bit) used to track if the GC has hit the object during the sweep phase already and the upper 7 bits count how many static references there are to the object.
+
+Combined in memory we have the format | ushort: memory size | ushort: gc info | uint: object type | uint: instance type | uint: object size | variable: object data |
diff --git a/Docs/articles/Kernel/Audio.md b/Docs/articles/Kernel/Audio.md
index 26def79d7b..255485636b 100644
--- a/Docs/articles/Kernel/Audio.md
+++ b/Docs/articles/Kernel/Audio.md
@@ -16,6 +16,8 @@ var audioManager = new AudioManager()
audioManager.Enable();
```
+The sampleAudioBytes are the bytes of a ttf audio file. You can read it from [VFS](https://cosmosos.github.io/articles/Kernel/VFS.html) or using [ManifestResourceStream](https://cosmosos.github.io/articles/Kernel/ManifestResouceStream.html)
+
## Audio Streams
An `AudioStream` is an object that can provide sample data to audio buffers. By design, the base `AudioStream` class does not have any length or position properties, as audio streams may be infinite - for example, an output stream from a microphone, or an audio mixer. All seekable streams inherit from the class `SeekableAudioStream`, which provides functionality for accessing the position/length properties and allows methods to determine whether they accept infinite and finite streams, or only finite streams.
diff --git a/Docs/articles/Kernel/CGS.md b/Docs/articles/Kernel/CGS.md
index dc9c475677..8fd293000f 100644
--- a/Docs/articles/Kernel/CGS.md
+++ b/Docs/articles/Kernel/CGS.md
@@ -1,6 +1,6 @@
# Introduction
-The Cosmos Graphic Subsystem (CGS from now on) is based on the abstraction of Canvas that is an empty space in which the user of CGS can draw its content. CGS is not a widget toolkit as Winforms or Gnome / GTK but is thought to be more lower level and it will be the basic in which widget toolkits will be implemented. CGS hides the graphics driver (so far VGA, VBE and SVGA II) used and it is thought to be the universal way to draw on the screen in Cosmos.
+The Cosmos Graphic Subsystem (CGS from now on) is based on the abstraction of Canvas that is an empty space in which the user of CGS can draw its content. CGS is not a widget toolkit as Winforms or Gnome / GTK but is thought to be more lower level and it will be the basic in which widget toolkits will be implemented. CGS hides the graphics driver (so far VGA, VBE and SVGAII) used and it is thought to be the universal way to draw on the screen in Cosmos.
# FullScreenCanvas
The `FullScreenCanvas` provides two methods to get a canvas instance for the screen. It automatically chooses the best available driver to use.
@@ -10,6 +10,7 @@ The `FullScreenCanvas` provides two methods to get a canvas instance for the scr
`public static Canvas GetFullScreenCanvas()`: gets the instance of Canvas representing the complete screen in the best driver available on your platform
# Canvas
+
## List of Properties of the Canvas class
`Mode`: get / set the mode of the video card to mode. It throws if the selected mode is not supported by the video card
@@ -20,11 +21,11 @@ The `FullScreenCanvas` provides two methods to get a canvas instance for the scr
`Clear(Color color)` clear the entire Canvas using the specified color as background
-`void DrawPoint(Pen pen, int x, int y)` draws a point at the coordinates specified by x and y with the specified pen
+`void DrawPoint(Color color, int x, int y)` draws a point at the coordinates specified by x and y with the specified pen
-`void DrawLine(Pen pen, int x_start, int y_start, int x_end, int y_end)` draws a line at the coordinates specified by x_start, y_start and x_end, y_end with the specified pen
+`void DrawLine(Color color, int x_start, int y_start, int x_end, int y_end)` draws a line at the coordinates specified by x_start, y_start and x_end, y_end with the specified pen
-`void DrawRectangle(Pen pen, int x_start, int y_start,int width, int height)` draws a rectangle specified by a coordinate pair, a width, and a height with the specified pen
+`void DrawRectangle(Color color, int x_start, int y_start,int width, int height)` draws a rectangle specified by a coordinate pair, a width, and a height with the specified pen
`void DrawImage(Image image, int x, int y)` draws an image at the x and y specified
@@ -34,7 +35,7 @@ The `FullScreenCanvas` provides two methods to get a canvas instance for the scr
Really simple right?
-# A working example
+# A working example (devkit only!)
```CSharp
using System;
using Sys = Cosmos.System;
@@ -69,8 +70,14 @@ namespace GraphicTest
// If all works correctly you should not really see this :-)
Console.WriteLine("Cosmos booted successfully. Let's go in Graphical Mode");
- // You don't have to specify the Mode, but here we do to show that you can.
+ /*
+ You don't have to specify the Mode, but here we do to show that you can.
+ To not specify the Mode and pick the best one, use:
+ canvas = FullScreenCanvas.GetFullScreenCanvas();
+ */
canvas = FullScreenCanvas.GetFullScreenCanvas(new Mode(640, 480, ColorDepth.ColorDepth32));
+
+ // This will clear the canvas with the specified color.
canvas.Clear(Color.Blue);
}
@@ -78,8 +85,6 @@ namespace GraphicTest
{
try
{
- Pen pen = new Pen();
-
// A red Point
canvas.DrawPoint(Color.Red, 69, 69);
@@ -108,7 +113,7 @@ namespace GraphicTest
}
catch (Exception e)
{
- mDebugger.Send("Exception occurred: " + e.Message);
+ Debugger.Send("Exception occurred: " + e.Message);
Sys.Power.Shutdown();
}
}
@@ -117,9 +122,14 @@ namespace GraphicTest
```
# Limitations of the current implementation
-1. Only 32 bit color depth is actually supported, the API provides methods to set a resolution with 24, 16, 8 and 4 bit but the low level Bochs driver has not yet implemented them.
+1. Only 32 bit color depth is actually supported, the API provides methods to set a resolution with 24, 16, 8 and 4 bit but the low level Bochs driver has not yet implemented them.
+If you use SVGAIICanvas, you can use 24 bit Color depth and if you use VGACanvas there are 3 modes: 320x200x8, 640x480x4 and 720x480x4.
2. In addition, some other nice things could be implemented:
- Plugging System.Drawing functions for easier manipulation of colors
3. CGS interacts badly with the uncaught exceptions and Kernel.Stop method: the screen will freeze without displaying any error message whatsoever. You must use the Sys.Power.Shutdown() function to properly shut down your computer.
+
+# Old examples
+
+In the web there are a lot of tutorials explaining how to use graphics in Cosmos, but most of them are outdated. Just remember that the new Mouse class is Sys.MouseManager and Pen has been replaced with Color.
\ No newline at end of file
diff --git a/Docs/articles/Kernel/Levels.md b/Docs/articles/Kernel/Levels.md
index a8c094bc6b..e1b65ca4ef 100644
--- a/Docs/articles/Kernel/Levels.md
+++ b/Docs/articles/Kernel/Levels.md
@@ -1,4 +1,7 @@
# Levels
+
+**Warning** This article is for a older version of Cosmos and it doesn't work for current version.
+
The security model of Cosmos will evolve and mature as
Cosmos does, however the base model is presented here.
diff --git a/Docs/articles/Kernel/ManifestResouceStream.md b/Docs/articles/Kernel/ManifestResouceStream.md
index eb539b3b25..4c30cd1c48 100644
--- a/Docs/articles/Kernel/ManifestResouceStream.md
+++ b/Docs/articles/Kernel/ManifestResouceStream.md
@@ -1,18 +1,15 @@
# Manifest Resource Streams
Manifest Resource Streams allow you to include data from the files as byte arrays in your code. An example of its use is in the [ZMachine Demo](https://github.com/CosmosOS/Cosmos/blob/5973a3fae95c989dc13505184aff9a15aae9f65f/Demos/ZMachine/ZKernel/Kernel.cs#L19)
-## Drawbacks
-Due to short comings in NASM there is a maximum size to any individual file which can be included this way. If the file is too large the error will be an `interminable macro recursion` from nasm.
-
## How to use
1. Set for the the file you want to use `Build As: Embedded Resource` using the File Properties window in VS.
![image](https://user-images.githubusercontent.com/8559822/132468001-256b92d1-0b29-4db3-9ef5-3383bfdef023.png)
2. In the code reference the file using the following format (a static byte array with the attribute):
```
-[ManifestResourceStream(ResourceName = “{project_name}.{path}.{to}.{filename_with_extension}”)]
+[ManifestResourceStream(ResourceName = "{project_name}.{path}.{to}.{filename_with_extension}")]
static byte[] file;
```
-The field _must_ be static but the name of the field can be changed. You will also need to add `using IL2CPU.API.Attribs;` to the code.
+The field _must_ be static but the name of the field (file) can be changed. You will also need to add `using IL2CPU.API.Attribs;` to the code.
For example, if the project is called Kernel and the file is `Data\Text.txt`, then `ResourceName = "Kernel.Data.Text.txt"`.
3. To access the data simply read from the byte array defined.
diff --git a/Docs/articles/Kernel/MemoryManagement.md b/Docs/articles/Kernel/MemoryManagement.md
index 186b8bc0a6..02de485985 100644
--- a/Docs/articles/Kernel/MemoryManagement.md
+++ b/Docs/articles/Kernel/MemoryManagement.md
@@ -43,6 +43,8 @@ Small Objects are managed using the SMT (Size Map Table), which is initalised us
The garbage collector has to be manually triggerd using the call `int Heap.Collect()` which returns the number of objects freed.
+Note that the GC does not track objects only pointed to by pointers. To ensure that the GC nevertheless does not incorrectly free objects, you can use `void GCImplementation.IncRootCount(ushort* aPtr)` to manually increase the references of your object by 1. Once you no longer need the object you can use `void GCImplementation.DecRootCount(ushort* aPtr)` to remove the manual reference, which allows the next `Heap.Collect` call to free the object.
+
### Internals
The garbage collector uses the tracing approach, which means that during collection a graph of all reachable objects is created and all non-discovered objects are freed. The garbage collector will only check objects on pages which have a type where the `GCManaged` bit is set. The graph is created by starting from "root" objects which are either stored in static variables or part of the current stack. Each of these objects is "marked" and all objects referenced by this object are recursivly also "marked" and "swept". This is done using the methods `void Heap.MarkAndSweepObject(void* aPtr)` for objects and `void Heap.SweepTypedObject(uint* obj, uint type)` for structures. For this to work each allocated object holds a 1bit flag if the object was discovered during the marking phase and a 7bit value counter for the number of static references it has. The number of static references an object has is updated using `void GCImplementation.IncRootCount(ushort* aPtr)` and similar methods, which are called from the Stsfld opcode.
diff --git a/Docs/articles/Kernel/Network.md b/Docs/articles/Kernel/Network.md
index 175198ccf9..ccc5558f67 100644
--- a/Docs/articles/Kernel/Network.md
+++ b/Docs/articles/Kernel/Network.md
@@ -146,4 +146,4 @@ using(var xClient = new DnsClient())
## Get local IP address
```csharp
Console.WriteLine(NetworkConfiguration.CurrentAddress.ToString());
-```
+```
\ No newline at end of file
diff --git a/Docs/articles/Kernel/OnBoot.md b/Docs/articles/Kernel/OnBoot.md
index 2e648d607e..daef4a76c5 100644
--- a/Docs/articles/Kernel/OnBoot.md
+++ b/Docs/articles/Kernel/OnBoot.md
@@ -1,15 +1,16 @@
# OnBoot
-If you need to disable drivers because you are developing your own you may do so by adding the OnBoot method to your kernel,
-right now you can disable 3 drivers and disable one part of a driver, an example would be
+If you need to disable drivers because you are developing your own, or in some cases just don't need them, you may do so by adding the OnBoot method to your kernel. For now, you can disable 3 drivers and disable a part of a driver, an example would be
```csharp
-public override void OnBoot() {
-Sys.Global.Init(GetTextScreen(),true,true,true,false);
+protected override void OnBoot()
+{
+ Sys.Global.Init(GetTextScreen(),true,true,true,false);
}
```
-in the above example we specify that the mousewheel is enabled, the ps2controller is loaded, network drivers are being loaded and the IDE controller is disabled.
+
+In that example, we specify that the mousewheel is enabled, the PS2controller is loaded, network drivers are being loaded and the IDE controller is disabled.
this is helpful if you intend on developing your own IDE controller, the order of the booleans is as stated above:
-Mousewheel,
-PS2Controller,
-Network Drivers,
-IDE Controller
\ No newline at end of file
+`Mousewheel`
+`PS2Controller`
+`Network Drivers`
+`IDE Controller`
diff --git a/Docs/articles/Kernel/Plugs.md b/Docs/articles/Kernel/Plugs.md
index ad726d4a62..f85454cfbe 100644
--- a/Docs/articles/Kernel/Plugs.md
+++ b/Docs/articles/Kernel/Plugs.md
@@ -6,6 +6,8 @@ Plugs are used to fill "holes" in .NET libraries and replace them with different
Cosmos replaces specific methods and property implementations that rely on
win32 API calls. Plugs can also be used to provide an alternate implementation
for a method, even if it does not rely on the Windows API.
+
+ > **Important: All plugs must go in a seperate project, which is included in your original project using the `PlugReference` attribute in your kernels csproj.**
## Types of plugs
@@ -54,5 +56,3 @@ https://github.com/CosmosOS/Cosmos/blob/8a8393353f1957890c5154650e29847fd22bf893
While plugs are usually used to overwrite existing methods in the .Net runtime, they can also be used to include assembly methods in your kernel.
This is for example done to implement the `void CPU.UpdateIDT(bool)` method in Cosmos.
To do this for your own classes and methods is not more difficult than plugging any other method. Simply set target of the plug class to your own class and write the assembly plug as usual. As a reference you can look at [Cosmos.Core/CPU.cs](https://github.com/CosmosOS/Cosmos/blob/master/source/Cosmos.Core/CPU.cs), [Cosmos.Core_Asm/CPUImpl.cs](https://github.com/CosmosOS/Cosmos/blob/master/source/Cosmos.Core_Asm/CPUImpl.cs) and [CPUUpdateIDTAsm.cs]( https://github.com/CosmosOS/Cosmos/blob/master/source/Cosmos.Core_Asm/CPU/CPUUpdateIDTAsm.cs).
-
-**Important:** All plugs must go in a seperate project, which is included in your original project using the `PlugReference` attribute in your kernels csproj.
diff --git a/Docs/articles/Kernel/Startup.md b/Docs/articles/Kernel/Startup.md
index 7b176cc377..d259e9e46a 100644
--- a/Docs/articles/Kernel/Startup.md
+++ b/Docs/articles/Kernel/Startup.md
@@ -1,7 +1,19 @@
# Startup
-On startup, there is some hand-coded assembly that runs before the Cosmos layer kicks in. From there, the C# entry point Cosmos.System.Kernel.Start(); or Sys.Kernel.Start(); is called.
+On startup, the first thing that happens is that the BIOS of your computer loads Limine, the bootloader that Cosmos uses. From there, there is some hand-coded assembly that runs before the "Cosmos layer" kicks in. From there, the IL2CPU-ed C# entry point `Cosmos.System.Kernel.Start()` or `Sys.Kernel.Start()` is called.
-Cosmos.System.Kernel is an abstract class that forms the Cosmos framework upon which your OS is built upon.
+> By the way, `Cosmos.System.Kernel` is an abstract class that forms the Cosmos framework. It provides a base that your OS is built on top of.
-You can override the Kernel.Start() method to suppress the standard Cosmos boot routines.
+## Sys.Kernel.Start()
+
+### What does it do?
+`Kernel.Start()` does quite a bit of stuff. First, it checks if `System.String.Empty` is null. If it is null, then it will just throw an exception. If it isn't, it just continues. After that check, `Kernel.Start()` initializes the hardware bootstrap, then calls `OnBoot()`.
+> We have an article explaining what `OnBoot()` is.
+
+Then, `Kernel.Start()` calls your `BeforeRun()` method, after it finishes, `Kernel.Start()` enables the hardware interrupts. Then it simply does a `while (!mStopped)` loop with your `Run()` method. After that, it calls an optional method called `AfterRun()`. By default, `AfterRun()` is just empty, so don't worry about nulls or something like that. Then it finishes. All of that is also try/catched too with the `A kernel exception has occurred` message.
+
+### Overriding it
+You can override the `Kernel.Start()` method in your Kernel to suppress the standard Cosmos boot routines and get deeper control of Cosmos.
+> You override it the same way you do with other methods. An extremely simple base override in your Kernel would be: `protected override void Start() {}`
+
+The default `Kernel.Start()` method is located in `Cosmos\source\Cosmos.System2\Kernel.cs`. You can copy it and make modifications with your Kernel override.
diff --git a/Docs/articles/Kernel/VFS.md b/Docs/articles/Kernel/VFS.md
index 159233b7c7..b0103a7684 100644
--- a/Docs/articles/Kernel/VFS.md
+++ b/Docs/articles/Kernel/VFS.md
@@ -12,7 +12,7 @@ This is essential for using the VFS.
We start with creating a global CosmosVFS, this line should appear outside of any function, and before the BeforeRun() function.
```C#
-Sys.FileSystem.CosmosVFS fs = new Sys.FileSystem.CosmosVFS();
+Sys.FileSystem.CosmosVFS fs = new Cosmos.FileSystem.CosmosVFS();
```
Next, we register our VFS at the VFS manager, this will initiate the VFS and make it usable, add this to your kernel's BeforeRun() function:
@@ -30,7 +30,6 @@ Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs);
You can get all available disks using `VFSManager.GetDisks()`. The methods to get information about the disk or format it can be found under the [Disk](https://cosmosos.github.io/api/Cosmos.System.FileSystem.Disk.html) class. To format a disk use the [`FormatDisk(int index, string format, bool quick = true)`](https://cosmosos.github.io/api/Cosmos.System.FileSystem.Disk.html#Cosmos_System_FileSystem_Disk_FormatPartition_System_Int32_System_String_System_Boolean_)
method.
-**TODO**: Extend documentation and add examples
## Get available free space
@@ -65,13 +64,13 @@ Console.WriteLine("File System Type: " + fs_type);
We start by getting a list of files, using:
```C#
-var directory_list = Directory.GetFiles(@"0:\");
+var files_list = Directory.GetFiles(@"0:\");
```
Once we have it, we can get the names of our files:
```C#
-foreach (var file in directory_list)
+foreach (var file in files_list)
{
Console.WriteLine(file);
}
@@ -79,6 +78,25 @@ foreach (var file in directory_list)
![Files List](https://raw.githubusercontent.com/CosmosOS/Cosmos/master/Docs/articles/Kernel/images/File%20System%20Files%20List.PNG)
+## Get directory listing (Files and directories)
+
+You can get files and directory listing by using this code:
+
+```C#
+var files_list = Directory.GetFiles(@"0:\");
+var directory_list = Directory.GetDirectories(@"0:\");
+
+foreach (var file in files_list);
+{
+ Console.WriteLine(file)
+}
+foreach (var directory in directory_list)
+{
+ Console.WriteLine(directory);
+}
+```
+
+
## Read all the files in a directory
This one is more tricky,
@@ -125,7 +143,35 @@ catch (Exception e)
}
```
-We can also [check our files list](https://github.com/CosmosOS/Cosmos/wiki/FAT-FileSystem#get-files-list) and see our new file in it.
+## Create a new Directory
+Here is a example of code of creating a new directory:
+
+```C#
+try
+{
+ Directory.Create(@"0:\testing\");
+}
+catch (Exception e)
+{
+ Console.WriteLine(e.ToString());
+}
+```
+
+## Deleting a file or a directory
+
+You can also delete files or directories using this code:
+
+```C#
+try
+{
+ File.Delete(@"0:\testing.txt");
+ Directory.Delete(@"0:\testing\");
+}
+catch (Exception e)
+{
+ Console.WriteLine(e.ToString());
+}
+```
## Write to file
@@ -144,7 +190,27 @@ catch (Exception e)
}
```
-## Read specific file
+## Move a file
+
+Actually, File.Move() is not plugged in Cosmos, so you need to Copy the file and then delete the old file.
+Here is an example Method:
+```C#
+public static void MoveFile(string file, string newpath)
+{
+ try
+ {
+ File.Copy(file, newpath);
+ File.Delete(file);
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine(ex);
+ }
+}
+```
+
+
+## Read all text from a specific file
Now we will read a specific file from a given path.
As usual, we'll do it in a try catch block.
@@ -161,3 +227,18 @@ catch (Exception e)
```
![Read Specific File](https://raw.githubusercontent.com/CosmosOS/Cosmos/master/Docs/articles/Kernel/images/File%20System%20Read%20Specified%20File.PNG)
+
+# Read All bytes from a specific file
+
+As like the ReadAllText Method, ReadAllBytes should return all bytes the bytes from a file.
+
+```C#
+try
+{
+ Console.WriteLine(File.ReadAllBytes(@"0:\testing.txt"));
+}
+catch (Exception e)
+{
+ Console.WriteLine(e.ToString());
+}
+```
diff --git a/Docs/articles/toc.md b/Docs/articles/toc.md
index ecfc22341e..29b0d623d8 100644
--- a/Docs/articles/toc.md
+++ b/Docs/articles/toc.md
@@ -2,6 +2,8 @@
# [Compiler](Compiler/il2cpu.md)
+# [Change Log](ChangeLog.md)
+
# Debugger
## [Debug Commands](Debugger/DebugCommands.md)
diff --git a/Docs/images/logo.png b/Docs/images/logo.png
index 67a2af0164..70445c7ff5 100644
Binary files a/Docs/images/logo.png and b/Docs/images/logo.png differ
diff --git a/Docs/install.md b/Docs/install.md
index 9b5cb6d244..d65bbdee3d 100644
--- a/Docs/install.md
+++ b/Docs/install.md
@@ -4,9 +4,10 @@
* **Visual Studio 2022** - [Download](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
-* **Visual Studio 2022 Workload: .NET Core Tools** - .NET Core cross-platform development
-* **.NET Framework 4.8 Developer Pack** - [Download](https://www.microsoft.com/en-us/download/details.aspx?id=53321)
-* **VMware Player OR Workstation** VMware Player is free, so that is recommended instead - [Download](https://www.vmware.com/uk/products/workstation-player/workstation-player-evaluation.html)
+* **Visual Studio 2022 Workload: .NET Desktop** - .NET Desktop development
+* **.NET 6.0** - [Download](https://www.microsoft.com/en-us/download/details.aspx?id=53321)
+* **VMware Player or Workstation** VMware Player is free, so that is recommended instead - [Download](https://www.vmware.com/uk/products/workstation-player/workstation-player-evaluation.html)
+* **Microsoft Visual C++ 2010 Redistributable** - [Download](https://www.microsoft.com/en-us/download/details.aspx?id=26999)
### Installing Cosmos
@@ -28,7 +29,7 @@ The User Kit is a snapshot stable version of Cosmos including a premade installe
##### **Additional Prerequisites**
* **Visual Studio 2022 Workload: Visual Studio Extension Development**
-* **Inno Quick Start Pack (Free)** – Install with defaults, keep Preprocessor option checked [Download](http://www.jrsoftware.org/isdl.php#qsp)
+* **Inno Setup (Free)** – Install with defaults - [Download](http://www.jrsoftware.org/isdl.php#qsp)
* **.NET 6 SDK** - [Download](https://dotnet.microsoft.com/en-us/download)
##### Get the Source
@@ -81,4 +82,6 @@ cd ..
3. Wait for the install to progress. (**Tip:** At the end the installer may look like it is stalling, it is still doing something, just in the background)
4. VS will open with Cosmos loaded. You can now make changes to core assemblies of Cosmos. If you don't want to, you can close this VS window and create a new Cosmos project as with the user kit.
+For more information about Dev Kit, see [here](https://cosmosos.github.io/articles/Installation/DevKit.html)
+
Happy Cosmos-ing!
diff --git a/Docs/templates/darkfx/styles/main.css b/Docs/templates/darkfx/styles/main.css
index 078adc776a..c332862695 100644
--- a/Docs/templates/darkfx/styles/main.css
+++ b/Docs/templates/darkfx/styles/main.css
@@ -75,6 +75,10 @@ article h4 {
border: none;
}
+.navbar #logo {
+ width: 50px;
+}
+
.subnav {
border-top: 1px solid var(--color-underline);
background-color: var(--color-background-subnav);
@@ -467,4 +471,4 @@ input:checked + .slider:before {
white-space: nowrap;
text-overflow: ellipsis;
}
-}
\ No newline at end of file
+}
diff --git a/Examples/Basic Terminal Shell/BasicTerminalShell.csproj b/Examples/Basic Terminal Shell/BasicTerminalShell.csproj
index 242f868162..5548636e91 100644
--- a/Examples/Basic Terminal Shell/BasicTerminalShell.csproj
+++ b/Examples/Basic Terminal Shell/BasicTerminalShell.csproj
@@ -23,6 +23,7 @@
+
diff --git a/Examples/Console Beep Demo/BeepDemo.csproj b/Examples/Console Beep Demo/BeepDemo.csproj
index 6bfddf5b92..13975abed6 100644
--- a/Examples/Console Beep Demo/BeepDemo.csproj
+++ b/Examples/Console Beep Demo/BeepDemo.csproj
@@ -20,6 +20,7 @@
+
diff --git a/Examples/Cosmos Graphic Subsystem/CosmosGraphicSubsystem.csproj b/Examples/Cosmos Graphic Subsystem/CosmosGraphicSubsystem.csproj
index 1617870692..354dee0708 100644
--- a/Examples/Cosmos Graphic Subsystem/CosmosGraphicSubsystem.csproj
+++ b/Examples/Cosmos Graphic Subsystem/CosmosGraphicSubsystem.csproj
@@ -71,6 +71,7 @@
+
diff --git a/Examples/Guess Number Game/GuessKernel.csproj b/Examples/Guess Number Game/GuessKernel.csproj
index dd3a74a172..829d94e22f 100644
--- a/Examples/Guess Number Game/GuessKernel.csproj
+++ b/Examples/Guess Number Game/GuessKernel.csproj
@@ -56,6 +56,7 @@
+
diff --git a/Examples/ZMachine Emulator/ZKernel/ZKernel.csproj b/Examples/ZMachine Emulator/ZKernel/ZKernel.csproj
index 07430a2677..429c59d0fc 100644
--- a/Examples/ZMachine Emulator/ZKernel/ZKernel.csproj
+++ b/Examples/ZMachine Emulator/ZKernel/ZKernel.csproj
@@ -73,6 +73,7 @@
+
diff --git a/Kernel.sln b/Kernel.sln
index 82101fbcb2..7d8ac65db3 100644
--- a/Kernel.sln
+++ b/Kernel.sln
@@ -1,353 +1,223 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27130.2036
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G2", "Kernel G2", "{9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0 Core", "0 Core", "{04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 HAL", "1 HAL", "{D651C346-95CF-4AE9-B309-DB2A1A512811}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 System", "2 System", "{0259702E-9575-4852-A641-5F9714A9C740}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G3", "Kernel G3", "{00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 CPU", "10 CPU", "{C5D22A6E-96F8-4F85-9EE4-C1EB8C5E0530}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20 Platform", "20 Platform", "{2C27BF1B-0AB0-4B68-83C4-991D43897B66}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30 HAL", "30 HAL", "{B369DAF1-94BC-4BD7-887C-80F76F8B5910}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "40 System", "40 System", "{2E1A72C6-5DD4-4AB9-92A1-6BB44D9B1009}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50 Application", "50 Application", "{2A22DC4C-E237-4D4B-A592-47D477F9ED5B}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TapRoot", "TapRoot", "{DB771C12-E60D-41C9-9A39-74CC95A661CD}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "91 Plug", "91 Plug", "{1B2F7229-B8F1-4F40-966A-AA8C2DC30A54}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "92 CpuPlug", "92 CpuPlug", "{AD495579-C209-48FA-8F0F-633D22438DDD}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.HAL2", "source\Cosmos.HAL2\Cosmos.HAL2.csproj", "{1425715D-1C93-44C7-8BB5-F124F195A41A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Common", "source\Cosmos.Common\Cosmos.Common.csproj", "{09099C80-8262-486A-94A5-492F51B08823}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core", "source\Cosmos.Core\Cosmos.Core.csproj", "{9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System2", "source\Cosmos.System2\Cosmos.System2.csproj", "{4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core_Plugs", "source\Cosmos.Core_Plugs\Cosmos.Core_Plugs.csproj", "{1132E689-18B0-4D87-94E8-934D4802C540}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core_Asm", "source\Cosmos.Core_Asm\Cosmos.Core_Asm.csproj", "{3C186D37-21C3-417C-95F1-19BE538AF88A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System2_Plugs", "source\Cosmos.System2_Plugs\Cosmos.System2_Plugs.csproj", "{9431FF1F-AD75-4A1E-B38A-46E0F109411D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Kernel", "source\Cosmos.Debug.Kernel\Cosmos.Debug.Kernel.csproj", "{94DBCFC7-B5D2-4148-BE18-D76654C379E2}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.API", "..\IL2CPU\source\IL2CPU.API\IL2CPU.API.csproj", "{31D48401-77B2-44AF-B6D3-27AB67C10759}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Kernel.Plugs.Asm", "source\Cosmos.Debug.Kernel.Plugs.Asm\Cosmos.Debug.Kernel.Plugs.Asm.csproj", "{6C770E55-8EED-444C-AD4E-017E823E5BA3}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core.DebugStub", "..\IL2CPU\source\Cosmos.Core.DebugStub\Cosmos.Core.DebugStub.csproj", "{9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU.x86", "source\Kernel-X86\10-CPU\Cosmos.CPU.x86\Cosmos.CPU.x86.csproj", "{FC65D765-990D-4F00-B240-8DD17FA91EA9}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Platform.PC", "source\Kernel-X86\20-Platform\Cosmos.Platform.PC\Cosmos.Platform.PC.csproj", "{63843265-D889-47D2-883E-595289C99F42}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System", "source\Kernel-X86\40-System\Cosmos.System\Cosmos.System.csproj", "{F8BF6943-B69D-4549-9C16-75146616E19C}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XSharp", "..\XSharp\source\XSharp\XSharp\XSharp.csproj", "{F785B091-7E4D-4D2E-A310-B18690623F74}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.HAL", "source\Kernel-X86\30-HAL\Cosmos.HAL\Cosmos.HAL.csproj", "{3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.IL2CPU", "..\IL2CPU\source\Cosmos.IL2CPU\Cosmos.IL2CPU.csproj", "{47F9D446-ACD4-489A-AD6D-A46A19247E2F}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.Common", "..\Common\source\Cosmos.Build.Common\Cosmos.Build.Common.csproj", "{67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.Debug.Symbols", "..\IL2CPU\source\IL2CPU.Debug.Symbols\IL2CPU.Debug.Symbols.csproj", "{4E9B8F31-AEA0-402D-9B3A-223100F2156D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Plugs.TapRoot", "source\Kernel-X86\91-Plugs\Cosmos.Plugs.TapRoot\Cosmos.Plugs.TapRoot.csproj", "{BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU_Plugs", "source\Kernel-X86\10-CPU\Cosmos.CPU_Plugs\Cosmos.CPU_Plugs.csproj", "{365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU_Asm", "source\Kernel-X86\10-CPU\Cosmos.CPU_Asm\Cosmos.CPU_Asm.csproj", "{08B5D5EF-45F5-45BC-B842-A413E8113A55}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GuessKernelGen3", "source\Kernel-X86\50-Application\GuessKernelGen3.csproj", "{9E58E949-7B71-45ED-9610-11DA287EE933}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TRKernel", "source\Kernel-TapRoot\Demo\TRKernel.csproj", "{F614D199-03E6-4CBD-836C-EDB769B025A3}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spruce", "..\XSharp\source\Spruce\Spruce.csproj", "{0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|x86.Build.0 = Debug|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|Any CPU.Build.0 = Release|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|x86.ActiveCfg = Release|Any CPU
- {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|x86.Build.0 = Release|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Debug|x86.ActiveCfg = Debug|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Debug|x86.Build.0 = Debug|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Release|Any CPU.Build.0 = Release|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Release|x86.ActiveCfg = Release|Any CPU
- {09099C80-8262-486A-94A5-492F51B08823}.Release|x86.Build.0 = Release|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|x86.Build.0 = Debug|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|Any CPU.Build.0 = Release|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|x86.ActiveCfg = Release|Any CPU
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|x86.Build.0 = Release|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|x86.ActiveCfg = Debug|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|x86.Build.0 = Debug|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|Any CPU.Build.0 = Release|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|x86.ActiveCfg = Release|Any CPU
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|x86.Build.0 = Release|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|x86.Build.0 = Debug|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Release|Any CPU.Build.0 = Release|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Release|x86.ActiveCfg = Release|Any CPU
- {1132E689-18B0-4D87-94E8-934D4802C540}.Release|x86.Build.0 = Release|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|x86.Build.0 = Debug|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|Any CPU.Build.0 = Release|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|x86.ActiveCfg = Release|Any CPU
- {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|x86.Build.0 = Release|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|x86.Build.0 = Debug|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|Any CPU.Build.0 = Release|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|x86.ActiveCfg = Release|Any CPU
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|x86.Build.0 = Release|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|x86.ActiveCfg = Debug|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|x86.Build.0 = Debug|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|Any CPU.Build.0 = Release|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|x86.ActiveCfg = Release|Any CPU
- {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|x86.Build.0 = Release|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|x86.ActiveCfg = Debug|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|x86.Build.0 = Debug|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|Any CPU.Build.0 = Release|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|x86.ActiveCfg = Release|Any CPU
- {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|x86.Build.0 = Release|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|x86.Build.0 = Debug|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|Any CPU.Build.0 = Release|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|x86.ActiveCfg = Release|Any CPU
- {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|x86.Build.0 = Release|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|x86.Build.0 = Debug|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|Any CPU.Build.0 = Release|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|x86.ActiveCfg = Release|Any CPU
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|x86.Build.0 = Release|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Debug|x86.ActiveCfg = Debug|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Debug|x86.Build.0 = Debug|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Release|Any CPU.Build.0 = Release|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Release|x86.ActiveCfg = Release|Any CPU
- {FC65D765-990D-4F00-B240-8DD17FA91EA9}.Release|x86.Build.0 = Release|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Debug|x86.ActiveCfg = Debug|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Debug|x86.Build.0 = Debug|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Release|Any CPU.Build.0 = Release|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Release|x86.ActiveCfg = Release|Any CPU
- {63843265-D889-47D2-883E-595289C99F42}.Release|x86.Build.0 = Release|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Debug|x86.Build.0 = Debug|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Release|Any CPU.Build.0 = Release|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Release|x86.ActiveCfg = Release|Any CPU
- {F8BF6943-B69D-4549-9C16-75146616E19C}.Release|x86.Build.0 = Release|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Debug|x86.Build.0 = Debug|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Release|Any CPU.Build.0 = Release|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Release|x86.ActiveCfg = Release|Any CPU
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3}.Release|x86.Build.0 = Release|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|x86.Build.0 = Debug|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|Any CPU.Build.0 = Release|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|x86.ActiveCfg = Release|Any CPU
- {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|x86.Build.0 = Release|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Debug|x86.Build.0 = Debug|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Release|Any CPU.Build.0 = Release|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Release|x86.ActiveCfg = Release|Any CPU
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E}.Release|x86.Build.0 = Release|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|x86.Build.0 = Debug|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|Any CPU.Build.0 = Release|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|x86.ActiveCfg = Release|Any CPU
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|x86.Build.0 = Release|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|x86.ActiveCfg = Debug|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|x86.Build.0 = Debug|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|Any CPU.Build.0 = Release|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|x86.ActiveCfg = Release|Any CPU
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|x86.Build.0 = Release|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|x86.ActiveCfg = Debug|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|x86.Build.0 = Debug|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|Any CPU.Build.0 = Release|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|x86.ActiveCfg = Release|Any CPU
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|x86.Build.0 = Release|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Debug|x86.ActiveCfg = Debug|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Debug|x86.Build.0 = Debug|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Release|Any CPU.Build.0 = Release|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Release|x86.ActiveCfg = Release|Any CPU
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C}.Release|x86.Build.0 = Release|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Debug|x86.ActiveCfg = Debug|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Debug|x86.Build.0 = Debug|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Release|Any CPU.Build.0 = Release|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Release|x86.ActiveCfg = Release|Any CPU
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6}.Release|x86.Build.0 = Release|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Debug|x86.ActiveCfg = Debug|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Debug|x86.Build.0 = Debug|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Release|Any CPU.Build.0 = Release|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Release|x86.ActiveCfg = Release|Any CPU
- {08B5D5EF-45F5-45BC-B842-A413E8113A55}.Release|x86.Build.0 = Release|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Debug|x86.Build.0 = Debug|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Release|Any CPU.Build.0 = Release|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Release|x86.ActiveCfg = Release|Any CPU
- {9E58E949-7B71-45ED-9610-11DA287EE933}.Release|x86.Build.0 = Release|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Debug|x86.Build.0 = Debug|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Release|Any CPU.Build.0 = Release|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Release|x86.ActiveCfg = Release|Any CPU
- {F614D199-03E6-4CBD-836C-EDB769B025A3}.Release|x86.Build.0 = Release|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|x86.ActiveCfg = Debug|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|x86.Build.0 = Debug|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|Any CPU.Build.0 = Release|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|x86.ActiveCfg = Release|Any CPU
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|x86.Build.0 = Release|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Debug|x86.Build.0 = Debug|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|Any CPU.Build.0 = Release|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|x86.ActiveCfg = Release|Any CPU
- {7370A62F-12DA-4181-BE3B-009D0926CA7E}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
- {D651C346-95CF-4AE9-B309-DB2A1A512811} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
- {0259702E-9575-4852-A641-5F9714A9C740} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
- {C5D22A6E-96F8-4F85-9EE4-C1EB8C5E0530} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {2C27BF1B-0AB0-4B68-83C4-991D43897B66} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {B369DAF1-94BC-4BD7-887C-80F76F8B5910} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {2E1A72C6-5DD4-4AB9-92A1-6BB44D9B1009} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {2A22DC4C-E237-4D4B-A592-47D477F9ED5B} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {DB771C12-E60D-41C9-9A39-74CC95A661CD} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {1B2F7229-B8F1-4F40-966A-AA8C2DC30A54} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {AD495579-C209-48FA-8F0F-633D22438DDD} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {1425715D-1C93-44C7-8BB5-F124F195A41A} = {D651C346-95CF-4AE9-B309-DB2A1A512811}
- {09099C80-8262-486A-94A5-492F51B08823} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
- {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
- {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF} = {0259702E-9575-4852-A641-5F9714A9C740}
- {1132E689-18B0-4D87-94E8-934D4802C540} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
- {3C186D37-21C3-417C-95F1-19BE538AF88A} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
- {9431FF1F-AD75-4A1E-B38A-46E0F109411D} = {0259702E-9575-4852-A641-5F9714A9C740}
- {31D48401-77B2-44AF-B6D3-27AB67C10759} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
- {FC65D765-990D-4F00-B240-8DD17FA91EA9} = {C5D22A6E-96F8-4F85-9EE4-C1EB8C5E0530}
- {63843265-D889-47D2-883E-595289C99F42} = {2C27BF1B-0AB0-4B68-83C4-991D43897B66}
- {F8BF6943-B69D-4549-9C16-75146616E19C} = {2E1A72C6-5DD4-4AB9-92A1-6BB44D9B1009}
- {F0860B7D-3FF7-4E2A-AC10-18E87ADD62A3} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {F785B091-7E4D-4D2E-A310-B18690623F74} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {3F8EDE0E-61BD-4D01-95F5-4A5A17F6221E} = {B369DAF1-94BC-4BD7-887C-80F76F8B5910}
- {47F9D446-ACD4-489A-AD6D-A46A19247E2F} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {4E9B8F31-AEA0-402D-9B3A-223100F2156D} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {BEEDA0BE-0105-40BF-BD8D-7F6A2BC3B05C} = {1B2F7229-B8F1-4F40-966A-AA8C2DC30A54}
- {365810FC-AFC2-4130-8A70-EF1F2C3FA5D6} = {AD495579-C209-48FA-8F0F-633D22438DDD}
- {08B5D5EF-45F5-45BC-B842-A413E8113A55} = {C5D22A6E-96F8-4F85-9EE4-C1EB8C5E0530}
- {9E58E949-7B71-45ED-9610-11DA287EE933} = {2A22DC4C-E237-4D4B-A592-47D477F9ED5B}
- {F614D199-03E6-4CBD-836C-EDB769B025A3} = {DB771C12-E60D-41C9-9A39-74CC95A661CD}
- {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- {7370A62F-12DA-4181-BE3B-009D0926CA7E} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {1A1E8F1D-82B3-471F-9B59-0350DEA9203D}
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33205.214
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G2", "Kernel G2", "{9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0 Core", "0 Core", "{04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 HAL", "1 HAL", "{D651C346-95CF-4AE9-B309-DB2A1A512811}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 System", "2 System", "{0259702E-9575-4852-A641-5F9714A9C740}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G3", "Kernel G3", "{00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.HAL2", "source\Cosmos.HAL2\Cosmos.HAL2.csproj", "{1425715D-1C93-44C7-8BB5-F124F195A41A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Common", "source\Cosmos.Common\Cosmos.Common.csproj", "{09099C80-8262-486A-94A5-492F51B08823}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core", "source\Cosmos.Core\Cosmos.Core.csproj", "{9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System2", "source\Cosmos.System2\Cosmos.System2.csproj", "{4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core_Plugs", "source\Cosmos.Core_Plugs\Cosmos.Core_Plugs.csproj", "{1132E689-18B0-4D87-94E8-934D4802C540}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core_Asm", "source\Cosmos.Core_Asm\Cosmos.Core_Asm.csproj", "{3C186D37-21C3-417C-95F1-19BE538AF88A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System2_Plugs", "source\Cosmos.System2_Plugs\Cosmos.System2_Plugs.csproj", "{9431FF1F-AD75-4A1E-B38A-46E0F109411D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Kernel", "source\Cosmos.Debug.Kernel\Cosmos.Debug.Kernel.csproj", "{94DBCFC7-B5D2-4148-BE18-D76654C379E2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.API", "..\IL2CPU\source\IL2CPU.API\IL2CPU.API.csproj", "{31D48401-77B2-44AF-B6D3-27AB67C10759}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Kernel.Plugs.Asm", "source\Cosmos.Debug.Kernel.Plugs.Asm\Cosmos.Debug.Kernel.Plugs.Asm.csproj", "{6C770E55-8EED-444C-AD4E-017E823E5BA3}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core.DebugStub", "..\IL2CPU\source\Cosmos.Core.DebugStub\Cosmos.Core.DebugStub.csproj", "{9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XSharp", "..\XSharp\source\XSharp\XSharp\XSharp.csproj", "{F785B091-7E4D-4D2E-A310-B18690623F74}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.IL2CPU", "..\IL2CPU\source\Cosmos.IL2CPU\Cosmos.IL2CPU.csproj", "{47F9D446-ACD4-489A-AD6D-A46A19247E2F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.Common", "..\Common\source\Cosmos.Build.Common\Cosmos.Build.Common.csproj", "{67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.Debug.Symbols", "..\IL2CPU\source\IL2CPU.Debug.Symbols\IL2CPU.Debug.Symbols.csproj", "{4E9B8F31-AEA0-402D-9B3A-223100F2156D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spruce", "..\XSharp\source\Spruce\Spruce.csproj", "{0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Plugs", "source\Cosmos.Plugs\Cosmos.Plugs.csproj", "{F2948368-61B6-4653-BAEC-C7152CE4980E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Debug|x86.Build.0 = Debug|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|x86.ActiveCfg = Release|Any CPU
+ {1425715D-1C93-44C7-8BB5-F124F195A41A}.Release|x86.Build.0 = Release|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Debug|x86.Build.0 = Debug|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Release|Any CPU.Build.0 = Release|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Release|x86.ActiveCfg = Release|Any CPU
+ {09099C80-8262-486A-94A5-492F51B08823}.Release|x86.Build.0 = Release|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Debug|x86.Build.0 = Debug|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|x86.ActiveCfg = Release|Any CPU
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4}.Release|x86.Build.0 = Release|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Debug|x86.Build.0 = Debug|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|x86.ActiveCfg = Release|Any CPU
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF}.Release|x86.Build.0 = Release|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Debug|x86.Build.0 = Debug|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Release|x86.ActiveCfg = Release|Any CPU
+ {1132E689-18B0-4D87-94E8-934D4802C540}.Release|x86.Build.0 = Release|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Debug|x86.Build.0 = Debug|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|x86.ActiveCfg = Release|Any CPU
+ {3C186D37-21C3-417C-95F1-19BE538AF88A}.Release|x86.Build.0 = Release|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Debug|x86.Build.0 = Debug|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|x86.ActiveCfg = Release|Any CPU
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D}.Release|x86.Build.0 = Release|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Debug|x86.Build.0 = Debug|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|x86.ActiveCfg = Release|Any CPU
+ {94DBCFC7-B5D2-4148-BE18-D76654C379E2}.Release|x86.Build.0 = Release|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Debug|x86.Build.0 = Debug|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|Any CPU.Build.0 = Release|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|x86.ActiveCfg = Release|Any CPU
+ {31D48401-77B2-44AF-B6D3-27AB67C10759}.Release|x86.Build.0 = Release|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Debug|x86.Build.0 = Debug|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|x86.ActiveCfg = Release|Any CPU
+ {6C770E55-8EED-444C-AD4E-017E823E5BA3}.Release|x86.Build.0 = Release|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Debug|x86.Build.0 = Debug|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|x86.ActiveCfg = Release|Any CPU
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82}.Release|x86.Build.0 = Release|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Debug|x86.Build.0 = Debug|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|x86.ActiveCfg = Release|Any CPU
+ {F785B091-7E4D-4D2E-A310-B18690623F74}.Release|x86.Build.0 = Release|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Debug|x86.Build.0 = Debug|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|x86.ActiveCfg = Release|Any CPU
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F}.Release|x86.Build.0 = Release|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Debug|x86.Build.0 = Debug|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|x86.ActiveCfg = Release|Any CPU
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA}.Release|x86.Build.0 = Release|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Debug|x86.Build.0 = Debug|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|x86.ActiveCfg = Release|Any CPU
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D}.Release|x86.Build.0 = Release|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Debug|x86.Build.0 = Debug|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|x86.ActiveCfg = Release|Any CPU
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2}.Release|x86.Build.0 = Release|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Debug|x86.Build.0 = Debug|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Release|x86.ActiveCfg = Release|Any CPU
+ {F2948368-61B6-4653-BAEC-C7152CE4980E}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
+ {D651C346-95CF-4AE9-B309-DB2A1A512811} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
+ {0259702E-9575-4852-A641-5F9714A9C740} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
+ {1425715D-1C93-44C7-8BB5-F124F195A41A} = {D651C346-95CF-4AE9-B309-DB2A1A512811}
+ {09099C80-8262-486A-94A5-492F51B08823} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
+ {9AF5BD03-8A49-49DC-A56E-3AE8DA6B0FF4} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
+ {4AC1AFCE-C8CE-484D-AE22-F9EE27008FAF} = {0259702E-9575-4852-A641-5F9714A9C740}
+ {1132E689-18B0-4D87-94E8-934D4802C540} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
+ {3C186D37-21C3-417C-95F1-19BE538AF88A} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
+ {9431FF1F-AD75-4A1E-B38A-46E0F109411D} = {0259702E-9575-4852-A641-5F9714A9C740}
+ {31D48401-77B2-44AF-B6D3-27AB67C10759} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
+ {9BDA0399-0CFD-42E8-8CF4-3DDE16122A82} = {00F0CA9C-51B2-4E99-B4D9-DD24D488D3FC}
+ {F785B091-7E4D-4D2E-A310-B18690623F74} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
+ {47F9D446-ACD4-489A-AD6D-A46A19247E2F} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
+ {67FD9912-CE63-4EB2-880C-F4F0D9AED7CA} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
+ {4E9B8F31-AEA0-402D-9B3A-223100F2156D} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
+ {0812DD0A-4CEE-4376-B78A-02EBCBAA14C2} = {3CD3D9A5-9BC5-4FEB-8D63-4D535C0ABB78}
+ {F2948368-61B6-4653-BAEC-C7152CE4980E} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1A1E8F1D-82B3-471F-9B59-0350DEA9203D}
+ EndGlobalSection
+EndGlobal
diff --git a/Makefile b/Makefile
index 1fdd6f6193..33436bee2c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ IL2CPU_URL = https://github.com/CosmosOS/IL2CPU
XSHARP_URL = https://github.com/CosmosOS/XSharp
COMMON_URL = https://github.com/CosmosOS/Common
-IL2CPU_BRANCH = crossplatform
+IL2CPU_BRANCH = master
XSHARP_BRANCH = master
COMMON_BRANCH = master
@@ -21,51 +21,66 @@ DOTNETFLAGS = -v:q -nologo
.PHONY: all
all: $(IL2CPU_DIR) $(XSHARP_DIR) $(COMMON_DIR)
- $(MAKE) build
- $(MAKE) publish
+ @$(MAKE) build
+ @$(MAKE) publish
+ @sudo $(MAKE) install
+ @$(MAKE) nuget-install
+ @echo "============================================"
+ @echo "| Cosmos has been installed successfully! |"
+ @echo "============================================"
$(IL2CPU_DIR):
@echo "Cloning Cosmos/IL2CPU"
- $(GIT) $(GITFLAGS) --branch=$(IL2CPU_BRANCH) $(IL2CPU_URL) $(THISDIR)/../IL2CPU
+ @$(GIT) $(GITFLAGS) --branch=$(IL2CPU_BRANCH) $(IL2CPU_URL) $(THISDIR)/../IL2CPU
$(XSHARP_DIR):
@echo "Cloning Cosmos/XSharp"
- $(GIT) $(GITFLAGS) --branch=$(XSHARP_BRANCH) $(XSHARP_URL) $(THISDIR)/../XSharp
+ @$(GIT) $(GITFLAGS) --branch=$(XSHARP_BRANCH) $(XSHARP_URL) $(THISDIR)/../XSharp
$(COMMON_DIR):
@echo "Cloning Cosmos/Common"
- $(GIT) $(GITFLAGS) --branch=$(COMMON_BRANCH) $(COMMON_URL) $(THISDIR)/../Common
+ @$(GIT) $(GITFLAGS) --branch=$(COMMON_BRANCH) $(COMMON_URL) $(THISDIR)/../Common
.PHONY: build
build:
@echo "Building IL2CPU"
- $(DOTNET) clean $(IL2CPU_DIR)
- $(DOTNET) build $(IL2CPU_DIR) $(DOTNETFLAGS)
- $(DOTNET) pack $(IL2CPU_DIR) $(DOTNETFLAGS)
+ @$(DOTNET) clean $(IL2CPU_DIR)
+ @$(DOTNET) build $(IL2CPU_DIR) $(DOTNETFLAGS)
+ @$(DOTNET) pack $(IL2CPU_DIR) $(DOTNETFLAGS)
@echo "Building Cosmos"
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Common
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Debug.Kernel
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Core
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Core_Asm
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Core_Plugs
- $(DOTNET) clean $(THISDIR)/source/Cosmos.HAL2
- $(DOTNET) clean $(THISDIR)/source/Cosmos.System2
- $(DOTNET) clean $(THISDIR)/source/Cosmos.System2_Plugs
- $(DOTNET) clean $(THISDIR)/source/Cosmos.Build.Tasks
-
-
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Common $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Debug.Kernel $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Core $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Core_Asm $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Core_Plugs $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.HAL2 $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.System2 $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.System2_Plugs $(DOTNETFLAGS)
- $(DOTNET) pack $(THISDIR)/source/Cosmos.Build.Tasks $(DOTNETFLAGS)
+
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Common
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Debug.Kernel
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Core
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Core_Asm
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Core_Plugs
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.HAL2
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.System2
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.System2_Plugs
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Build.Tasks
+ @$(DOTNET) clean $(THISDIR)/source/Cosmos.Plugs
+
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Common $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Debug.Kernel $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Core $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Core_Asm $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Core_Plugs $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.HAL2 $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.System2 $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.System2_Plugs $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Build.Tasks $(DOTNETFLAGS)
+ @$(DOTNET) pack $(THISDIR)/source/Cosmos.Plugs $(DOTNETFLAGS)
+
+ @echo "Building X#"
+ @$(DOTNET) clean $(XSHARP_DIR)/source/XSharp/XSharp
+ @$(DOTNET) clean $(XSHARP_DIR)/source/Spruce
+
+ $(DOTNET) pack $(XSHARP_DIR)/source/XSharp/XSharp $(DOTNETFLAGS)
+ $(DOTNET) pack $(XSHARP_DIR)/source/Spruce $(DOTNETFLAGS)
+
.PHONY: publish
publish:
@@ -73,10 +88,15 @@ publish:
$(DOTNET) publish $(IL2CPU_DIR)/source/IL2CPU -r linux-x64 --self-contained $(DOTNETFLAGS)
@echo "Publishing Cosmos"
- $(DOTNET) publish $(THISDIR)/source/Cosmos.Core_Plugs $(DOTNETFLAGS)
- $(DOTNET) publish $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm $(DOTNETFLAGS)
- $(DOTNET) publish $(THISDIR)/source/Cosmos.HAL2 $(DOTNETFLAGS)
- $(DOTNET) publish $(THISDIR)/source/Cosmos.System2_Plugs $(DOTNETFLAGS)
+ @$(DOTNET) publish $(THISDIR)/source/Cosmos.Core_Plugs $(DOTNETFLAGS)
+ @$(DOTNET) publish $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm $(DOTNETFLAGS)
+ @$(DOTNET) publish $(THISDIR)/source/Cosmos.HAL2 $(DOTNETFLAGS)
+ @$(DOTNET) publish $(THISDIR)/source/Cosmos.System2_Plugs $(DOTNETFLAGS)
+ @$(DOTNET) publish $(THISDIR)/source/Cosmos.Plugs $(DOTNETFLAGS)
+
+ @echo "Publishing X#"
+ @$(DOTNET) publish $(XSHARP_DIR)/source/XSharp/XSharp $(DOTNETFLAGS)
+ @$(DOTNET) publish $(XSHARP_DIR)/source/Spruce $(DOTNETFLAGS)
.PHONY: install
install:
@@ -91,6 +111,7 @@ install:
@mkdir -p $(DESTDIR)/Kernel
@cp -r $(IL2CPU_DIR)/artifacts/Debug/nupkg/*.nupkg $(DESTDIR)/Packages/
@cp -r $(THISDIR)/artifacts/Debug/nupkg/*.nupkg $(DESTDIR)/Packages/
+ @cp -r $(XSHARP_DIR)/artifacts/Debug/nupkg/*.nupkg $(DESTDIR)/Packages/
@cp -r $(IL2CPU_DIR)/source/Cosmos.Core.DebugStub/*.xs $(DESTDIR)/XSharp/DebugStub/
@cp -r $(THISDIR)/Artwork/XSharp/XSharp.ico $(DESTDIR)/XSharp/
@@ -110,5 +131,9 @@ install:
.PHONY: nuget-install
nuget-install:
@echo "Installing Nuget packages"
- $(DOTNET) nuget remove source "Cosmos Local Package Feed" || true
- $(DOTNET) nuget add source $(DESTDIR)/Packages/ -n "Cosmos Local Package Feed"
+
+ @rm -r -f ~/.nuget/packages/cosmos.*/
+ @rm -r -f ~/.nuget/packages/il2cpu.*/
+
+ @$(DOTNET) nuget remove source "Cosmos Local Package Feed" || true
+ @$(DOTNET) nuget add source $(DESTDIR)/Packages/ -n "Cosmos Local Package Feed"
\ No newline at end of file
diff --git a/README.md b/README.md
index 920efe4b40..e4cd9c28bd 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,66 @@
-# Cosmos
+
-[![Build status](https://ci.appveyor.com/api/projects/status/kust7g5dlnykhkaf/branch/master?svg=true)](https://ci.appveyor.com/project/CosmosOS/cosmos/branch/master)
-[![Join the chat at (https://discord.com/invite/kwtBwv6jhD](https://img.shields.io/discord/833970409337913344)](https://discord.com/invite/kwtBwv6jhD)
+
-Cosmos is an operating system "construction kit" made for Visual Studio 2022. Build your own OS using managed languages such as C#, VB.NET, and more!
+
-For instructions on how to install and use Cosmos, please visit the [Cosmos website](http://www.gocosmos.org).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Cosmos (C# Open Source Managed Operating System) is an operating system development kit which uses .NET, alongside the custom IL2CPU compiler to convert (most) C# code into a working bare-metal OS.
+Despite C# in the name, any .NET-based language can be used, which includes: VB.NET, IronPython, F# and more. Cosmos itself and its kernel routines are primarily written in C#, and thus the Cosmos name.
+
+In a project, Cosmos can be thought of as a compiler and a sort-of standard library for a project. It gives the user access to often hard to find or otherwise difficult to understand tools.
+
+
+## Features
+
+The following is a non-exhaustive list of features that Cosmos offers:
+
+- Low level assembly access and pointer memory control
+- A basic (and unstable at the moment) filesystem
+- Most features found in the .NET core library
+- A CPU/FPU accelerated math library
+- A basic graphics interface
+- A basic network interface
+- A basic audio interface
+
+> **Note**
+
+> Use [embeded resources](https://cosmosos.github.io/articles/Kernel/ManifestResouceStream.html) instead of the FS for now.
+
+
+
+## Documentation
+
+For instructions on how to install and use Cosmos, please visit the [Cosmos website](http://www.gocosmos.org).
For documentation and technical information, see the [Cosmos Documentation](https://cosmosos.github.io).
-If you have questions about how to use Cosmos, want to show off what you have made or have general questions, go check out [GitHub Discussions](https://github.com/CosmosOS/Cosmos/discussions). If you think you found a bug in Cosmos, please check existing [issues](https://github.com/CosmosOS/Cosmos/issues) first before opening a new one.
+If you have questions about how to use Cosmos, want to show off what you have made or have general questions, go check out [GitHub Discussions](https://github.com/CosmosOS/Cosmos/discussions). Alternatively, you can also join our [Discord server](https://discord.com/invite/kwtBwv6jhD)! If you think you found a bug in Cosmos, please check existing [issues](https://github.com/CosmosOS/Cosmos/issues) first before opening a new one.
+
+[DevKit Change Log](https://cosmosos.github.io/articles/ChangeLog.html)
-We also have a [Discord Server](https://discord.com/invite/kwtBwv6jhD)!
+
diff --git a/Setup/Cosmos.iss b/Setup/Cosmos.iss
index 9a3d8eac2a..915646f059 100644
--- a/Setup/Cosmos.iss
+++ b/Setup/Cosmos.iss
@@ -86,7 +86,7 @@ Type: filesandordirs; Name: "{app}"
Source: ".\Build\Tools\*.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\Tools\Yasm\*.exe"; DestDir: "{app}\Build\Tools\Yasm"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\Tools\Cygwin\*"; DestDir: "{app}\Build\Tools\cygwin"; Flags: ignoreversion uninsremovereadonly overwritereadonly
-Source: ".\Build\Tools\mkisofs\*"; DestDir: "{app}\Build\Tools\mkisofs"; Flags: ignoreversion uninsremovereadonly overwritereadonly
+Source: ".\source\Cosmos.Build.Tasks\tools\xorriso\win\*"; DestDir: "{app}\Build\Tools\xorriso"; Flags: ignoreversion uninsremovereadonly overwritereadonly
Source: ".\Build\VSIP\IL2CPU\*"; DestDir: "{app}\Build\IL2CPU"; Flags: ignoreversion uninsremovereadonly recursesubdirs
;Source: ".\Build\VSIP\XSharp\*"; DestDir: "{app}\Build\XSharp"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Deploy.USB.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
@@ -113,6 +113,7 @@ Source: ".\Build\HyperV\*"; DestDir: "{app}\Build\HyperV"; Flags: ignoreversion
Source: ".\Build\VMware\*"; DestDir: "{app}\Build\VMware"; Flags: ignoreversion uninsremovereadonly overwritereadonly recursesubdirs
; ISO
Source: ".\Build\limine\boot\limine.cfg"; DestDir: "{app}\Build\ISO\boot\limine\"
+Source: ".\source\Cosmos.Build.Tasks\tools\limine\boot\*"; DestDir: "{app}\Build\ISO\boot\limine\"
; USB
Source: ".\Build\limine\boot\limine.cfg"; DestDir: "{app}\Build\USB\boot\limine\"
; PXE
diff --git a/Setup/images/cosmos.bmp b/Setup/images/cosmos.bmp
index d0220e979f..4b3c2ddae9 100644
Binary files a/Setup/images/cosmos.bmp and b/Setup/images/cosmos.bmp differ
diff --git a/Setup/images/cosmos_small.bmp b/Setup/images/cosmos_small.bmp
index 3097d411c0..0c6a4158ec 100644
Binary files a/Setup/images/cosmos_small.bmp and b/Setup/images/cosmos_small.bmp differ
diff --git a/Test.sln b/Test.sln
index ea37746414..f76edee5ff 100644
--- a/Test.sln
+++ b/Test.sln
@@ -106,38 +106,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core.Memory.Test", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core_Asm", "source\Cosmos.Core_Asm\Cosmos.Core_Asm.csproj", "{B7077A34-D7F0-4422-BE7C-65DF26C65489}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kernel G3", "Kernel G3", "{99192440-2DD7-4E71-B730-D44A73F46533}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 CPU", "10 CPU", "{29B893F7-6C0F-4710-A60E-7FB3498BCA63}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20 Platform", "20 Platform", "{B4CB7BF5-CADF-4056-9C09-EAAC50BC76C0}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30 HAL", "30 HAL", "{E4299234-8323-43F6-B684-350A1232746B}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "40 System", "40 System", "{DE38917F-969B-486C-AF83-C59E5E52400A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50 Application", "50 Application", "{02FF94AF-6BA3-49ED-A027-A63F591C310D}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "91 Plug", "91 Plug", "{1FC213DE-5033-40E1-9C16-5F1A0CDC9693}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU.x86", "source\Kernel-X86\10-CPU\Cosmos.CPU.x86\Cosmos.CPU.x86.csproj", "{4D219A6D-4528-4622-AF29-96F830C4D076}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Platform.PC", "source\Kernel-X86\20-Platform\Cosmos.Platform.PC\Cosmos.Platform.PC.csproj", "{6CBABA8D-4207-4E1E-8122-63DB51D25F18}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.HAL", "source\Kernel-X86\30-HAL\Cosmos.HAL\Cosmos.HAL.csproj", "{16ECD6DE-6F65-4A5C-8B49-A29782D9D057}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.System", "source\Kernel-X86\40-System\Cosmos.System\Cosmos.System.csproj", "{F588033A-6B7D-4ABF-96C4-73D8B2271A6B}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Plugs.TapRoot", "source\Kernel-X86\91-Plugs\Cosmos.Plugs.TapRoot\Cosmos.Plugs.TapRoot.csproj", "{756ECECD-B213-42F0-BF58-4A91B4C47FAA}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU_Plugs", "source\Kernel-X86\10-CPU\Cosmos.CPU_Plugs\Cosmos.CPU_Plugs.csproj", "{C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.CPU_Asm", "source\Kernel-X86\10-CPU\Cosmos.CPU_Asm\Cosmos.CPU_Asm.csproj", "{0C7C9F9D-6498-45E8-B77B-FF4D381C3297}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheRingMaster", "source\TheRingMaster\TheRingMaster.csproj", "{3DD192AF-2D72-449F-936C-ED8734225B18}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "92 CpuPlug", "92 CpuPlug", "{929EE8ED-6AD3-4442-A0C1-EC70665F2DCF}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spruce", "..\XSharp\source\Spruce\Spruce.csproj", "{FF46829E-B612-4D36-80BE-ED04521AD91A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Compiler.Tests.TypeSystem", "Tests\Kernels\Cosmos.Compiler.Tests.TypeSystem\Cosmos.Compiler.Tests.TypeSystem.csproj", "{D21A7C6C-A696-4EC3-84EB-70700C1E3B34}"
@@ -174,6 +144,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Resources", "Resources", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AudioTests", "Tests\Kernels\AudioTests\AudioTests.csproj", "{8455DCAE-275E-47B3-B89B-2D9F3AB9977C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Plugs", "source\Cosmos.Plugs\Cosmos.Plugs.csproj", "{0C65F6CA-C897-40A3-A36E-0CCCAD01D567}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -617,76 +589,6 @@ Global
{B7077A34-D7F0-4422-BE7C-65DF26C65489}.TEST|Any CPU.Build.0 = TEST|Any CPU
{B7077A34-D7F0-4422-BE7C-65DF26C65489}.TEST|x86.ActiveCfg = TEST|Any CPU
{B7077A34-D7F0-4422-BE7C-65DF26C65489}.TEST|x86.Build.0 = TEST|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|x86.ActiveCfg = Debug|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Debug|x86.Build.0 = Debug|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Release|Any CPU.Build.0 = Release|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Release|x86.ActiveCfg = Release|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.Release|x86.Build.0 = Release|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {4D219A6D-4528-4622-AF29-96F830C4D076}.TEST|x86.ActiveCfg = Release|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Debug|x86.Build.0 = Debug|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|Any CPU.Build.0 = Release|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|x86.ActiveCfg = Release|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.Release|x86.Build.0 = Release|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18}.TEST|x86.ActiveCfg = Release|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|x86.ActiveCfg = Debug|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Debug|x86.Build.0 = Debug|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|Any CPU.Build.0 = Release|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|x86.ActiveCfg = Release|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.Release|x86.Build.0 = Release|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057}.TEST|x86.ActiveCfg = Release|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Debug|x86.Build.0 = Debug|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|Any CPU.Build.0 = Release|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|x86.ActiveCfg = Release|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.Release|x86.Build.0 = Release|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B}.TEST|x86.ActiveCfg = Release|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Debug|x86.ActiveCfg = Debug|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Debug|x86.Build.0 = Debug|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Release|Any CPU.Build.0 = Release|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Release|x86.ActiveCfg = Release|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.Release|x86.Build.0 = Release|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA}.TEST|x86.ActiveCfg = Release|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Debug|x86.Build.0 = Debug|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Release|Any CPU.Build.0 = Release|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Release|x86.ActiveCfg = Release|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.Release|x86.Build.0 = Release|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A}.TEST|x86.ActiveCfg = Release|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Debug|x86.ActiveCfg = Debug|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Debug|x86.Build.0 = Debug|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Release|Any CPU.Build.0 = Release|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Release|x86.ActiveCfg = Release|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.Release|x86.Build.0 = Release|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.TEST|Any CPU.ActiveCfg = Release|Any CPU
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297}.TEST|x86.ActiveCfg = Release|Any CPU
{3DD192AF-2D72-449F-936C-ED8734225B18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DD192AF-2D72-449F-936C-ED8734225B18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DD192AF-2D72-449F-936C-ED8734225B18}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -903,6 +805,18 @@ Global
{8455DCAE-275E-47B3-B89B-2D9F3AB9977C}.TEST|Any CPU.Build.0 = TEST|Any CPU
{8455DCAE-275E-47B3-B89B-2D9F3AB9977C}.TEST|x86.ActiveCfg = TEST|Any CPU
{8455DCAE-275E-47B3-B89B-2D9F3AB9977C}.TEST|x86.Build.0 = TEST|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Debug|x86.Build.0 = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Release|x86.ActiveCfg = Release|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.Release|x86.Build.0 = Release|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.TEST|Any CPU.ActiveCfg = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.TEST|Any CPU.Build.0 = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.TEST|x86.ActiveCfg = Debug|Any CPU
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567}.TEST|x86.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -953,21 +867,7 @@ Global
{FB23BD72-AEC3-485E-B86C-8E7DB0B3BB9B} = {29EEC029-6A2B-478A-B6E5-D63A91388ABA}
{408E5ACC-EA9A-41E8-AA95-514C5F47BD34} = {52D81759-C7CC-427F-8C96-89CA10C914B5}
{B7077A34-D7F0-4422-BE7C-65DF26C65489} = {04B18FFC-8EA0-4E9F-9E1B-478527B19AFA}
- {29B893F7-6C0F-4710-A60E-7FB3498BCA63} = {99192440-2DD7-4E71-B730-D44A73F46533}
- {B4CB7BF5-CADF-4056-9C09-EAAC50BC76C0} = {99192440-2DD7-4E71-B730-D44A73F46533}
- {E4299234-8323-43F6-B684-350A1232746B} = {99192440-2DD7-4E71-B730-D44A73F46533}
- {DE38917F-969B-486C-AF83-C59E5E52400A} = {99192440-2DD7-4E71-B730-D44A73F46533}
- {02FF94AF-6BA3-49ED-A027-A63F591C310D} = {99192440-2DD7-4E71-B730-D44A73F46533}
- {1FC213DE-5033-40E1-9C16-5F1A0CDC9693} = {99192440-2DD7-4E71-B730-D44A73F46533}
- {4D219A6D-4528-4622-AF29-96F830C4D076} = {29B893F7-6C0F-4710-A60E-7FB3498BCA63}
- {6CBABA8D-4207-4E1E-8122-63DB51D25F18} = {B4CB7BF5-CADF-4056-9C09-EAAC50BC76C0}
- {16ECD6DE-6F65-4A5C-8B49-A29782D9D057} = {E4299234-8323-43F6-B684-350A1232746B}
- {F588033A-6B7D-4ABF-96C4-73D8B2271A6B} = {DE38917F-969B-486C-AF83-C59E5E52400A}
- {756ECECD-B213-42F0-BF58-4A91B4C47FAA} = {1FC213DE-5033-40E1-9C16-5F1A0CDC9693}
- {C000BFB2-DFDE-4B1E-BDA6-988B30370C7A} = {929EE8ED-6AD3-4442-A0C1-EC70665F2DCF}
- {0C7C9F9D-6498-45E8-B77B-FF4D381C3297} = {29B893F7-6C0F-4710-A60E-7FB3498BCA63}
{3DD192AF-2D72-449F-936C-ED8734225B18} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
- {929EE8ED-6AD3-4442-A0C1-EC70665F2DCF} = {99192440-2DD7-4E71-B730-D44A73F46533}
{FF46829E-B612-4D36-80BE-ED04521AD91A} = {E9CD521E-C386-466D-B5F7-A5EB19A61625}
{D21A7C6C-A696-4EC3-84EB-70700C1E3B34} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
{0DF97CAC-220B-4DAD-B397-42E394255763} = {ECEA7778-E786-4317-90B9-A2D4427CB91C}
@@ -985,6 +885,7 @@ Global
{96855A39-A96B-4BDB-A6AE-29676DFEF637} = {29EEC029-6A2B-478A-B6E5-D63A91388ABA}
{AC45D5B2-0D02-49B8-A88E-EABF34AE62B5} = {A45F0D24-1AF3-42BC-91A6-0262AFB1234D}
{8455DCAE-275E-47B3-B89B-2D9F3AB9977C} = {29EEC029-6A2B-478A-B6E5-D63A91388ABA}
+ {0C65F6CA-C897-40A3-A36E-0CCCAD01D567} = {9A923E6F-FF63-4F02-A4EA-C2D44F9323FD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4418C803-277E-448F-A0A0-52788FA215AD}
diff --git a/Tests/.editorconfig b/Tests/.editorconfig
deleted file mode 100644
index bc94fcf6ba..0000000000
--- a/Tests/.editorconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-# top-most EditorConfig file
-root = true
-
-# Default settings:
-# A newline ending every file
-# Use tabs as indentation
-# Trim trailing whitespace
-[*]
-insert_final_newline = true
-indent_style = space
-indent_size = 4
-trim_trailing_whitespace = true
diff --git a/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs b/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs
index 065657b5d6..7221bd96f7 100644
--- a/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs
+++ b/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs
@@ -107,7 +107,7 @@ private void RunProcess(string aProcess, string aWorkingDirectory, string aArgum
}
else
{
- xErrorReceived($"Error invoking '{aProcess}'.");
+ xErrorReceived($"Error invoking '{aProcess}'.");
}
}
}
@@ -223,7 +223,8 @@ private void RunIL2CPU(string kernelFileName, string outputFile)
"OutputFilename:" + outputFile,
"EnableLogging:True",
"EmitDebugSymbols:True",
- "IgnoreDebugStubAttribute:False"
+ "IgnoreDebugStubAttribute:False",
+ "AllowComments:True"
};
xArgs.AddRange(xReferences.Select(r => "References:" + r));
@@ -250,6 +251,8 @@ private void RunIL2CPU(string kernelFileName, string outputFile)
throw new Exception("Cannot run multiple kernels with in-process compilation!");
}
+ //xArgs.Add("AllowComments:true"); // enable this line when debugging cosmos
+
RunIL2CPUInProc(xArgs.ToArray(), OutputHandler.LogMessage, OutputHandler.LogError);
}
else
@@ -310,7 +313,7 @@ private void RunLd(string inputFile, string outputFile)
var xArgsString = arguments.Aggregate("", (a, b) => a + " \"" + b + "\"");
- var xProcess = Process.Start(Path.Combine(GetCosmosUserkitFolder(), "build", "tools", "cygwin", "ld.exe"), xArgsString);
+ var xProcess = Process.Start(Path.Combine(GetCosmosUserkitFolder(), "Build", "tools", "cygwin", "ld.exe"), xArgsString);
xProcess.WaitForExit(10000);
diff --git a/Tests/Cosmos.TestRunner.Core/Engine.Run.cs b/Tests/Cosmos.TestRunner.Core/Engine.Run.cs
index 7a7cf21e93..f607d2aa51 100644
--- a/Tests/Cosmos.TestRunner.Core/Engine.Run.cs
+++ b/Tests/Cosmos.TestRunner.Core/Engine.Run.cs
@@ -85,6 +85,10 @@ private void RunTask(string aTaskName, Action aAction)
{
aAction();
}
+ catch(Exception e)
+ {
+ OutputHandler.LogError(e.ToString());
+ }
finally
{
OutputHandler.TaskEnd(aTaskName);
diff --git a/Tests/Cosmos.TestRunner.Full/TestKernelSets.cs b/Tests/Cosmos.TestRunner.Full/TestKernelSets.cs
index c1d3aca403..1137fdc734 100644
--- a/Tests/Cosmos.TestRunner.Full/TestKernelSets.cs
+++ b/Tests/Cosmos.TestRunner.Full/TestKernelSets.cs
@@ -34,7 +34,6 @@ public static IEnumerable GetStableKernelTypes()
yield return typeof(AudioTests.Kernel);
// Please see the notes on the kernel itself before enabling it
//yield return typeof(ConsoleTest.Kernel);
- // This is a bit slow and works only because ring check is disabled to decide if leave it enabled
yield return typeof(MemoryOperationsTest.Kernel);
yield return typeof(ProcessorTests.Kernel);
}
diff --git a/Tests/Cosmos.TestRunner.TestController/Assert.cs b/Tests/Cosmos.TestRunner.TestController/Assert.cs
index ccc514e1ea..e27e05f672 100644
--- a/Tests/Cosmos.TestRunner.TestController/Assert.cs
+++ b/Tests/Cosmos.TestRunner.TestController/Assert.cs
@@ -44,12 +44,14 @@ public static void AreEqual(int expected, int actual, string message, [CallerFil
if (!xResult)
{
TestController.Debugger.Send("Expected value");
- TestController.Debugger.SendNumber((uint) expected);
+ TestController.Debugger.SendNumber(expected);
TestController.Debugger.Send("Actual value");
- TestController.Debugger.SendNumber((uint)actual);
+ TestController.Debugger.SendNumber(actual);
- TestController.Debugger.SendNumber("TestAssertion", "Expected", (uint)expected, 32);
- TestController.Debugger.SendNumber("TestAssertion", "Actual", (uint)actual, 32);
+ TestController.Debugger.Send("Expected value");
+ TestController.Debugger.SendNumber(expected);
+ TestController.Debugger.Send("Actual value");
+ TestController.Debugger.SendNumber(actual);
TestController.Debugger.Send("Numbers sent!");
}
@@ -130,8 +132,10 @@ public static void AreNotEqual(uint expected, uint actual, string message, [Call
TestController.Debugger.Send("Actual value");
TestController.Debugger.SendNumber((uint)actual);
- TestController.Debugger.SendNumber("TestAssertion", "Expected", (uint)expected, 32);
- TestController.Debugger.SendNumber("TestAssertion", "Actual", (uint)actual, 32);
+ TestController.Debugger.Send("Expected value");
+ TestController.Debugger.SendNumber(expected);
+ TestController.Debugger.Send("Actual value");
+ TestController.Debugger.SendNumber(actual);
TestController.Debugger.Send("Numbers sent!");
}
diff --git a/Tests/Cosmos.TestRunner.TestController/TestController.cs b/Tests/Cosmos.TestRunner.TestController/TestController.cs
index 652c252c11..b363e42d7c 100644
--- a/Tests/Cosmos.TestRunner.TestController/TestController.cs
+++ b/Tests/Cosmos.TestRunner.TestController/TestController.cs
@@ -1,15 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
using Cosmos.Debug.Kernel;
+using System;
namespace Cosmos.TestRunner
{
public static class TestController
{
- static Debugger debugger = new("Tests", "TestController");
+ static readonly Debugger debugger = new("TestController");
+
internal static Debugger Debugger
{
get
@@ -25,8 +23,7 @@ public static void Completed()
Debugger.SendChannelCommand(TestChannel, (byte)TestChannelCommandEnum.TestCompleted);
Debugger.Send("Test completed");
Console.WriteLine("Test completed");
- while (true)
- ;
+ while (true) ;
}
public static void Failed()
@@ -34,8 +31,7 @@ public static void Failed()
Debugger.Send("Failed");
Debugger.SendChannelCommand(TestChannel, (byte)TestChannelCommandEnum.TestFailed);
Debugger.DoBochsBreak();
- while (true)
- ;
+ while (true) ;
}
internal static void AssertionSucceeded()
diff --git a/Tests/Kernels/AudioTests/AudioTests.csproj b/Tests/Kernels/AudioTests/AudioTests.csproj
index fc596955c2..ce6e5e6d1b 100644
--- a/Tests/Kernels/AudioTests/AudioTests.csproj
+++ b/Tests/Kernels/AudioTests/AudioTests.csproj
@@ -10,6 +10,7 @@
+
diff --git a/Tests/Kernels/BoxingTests/BoxingTests.csproj b/Tests/Kernels/BoxingTests/BoxingTests.csproj
index c06540861f..50fbe61be4 100644
--- a/Tests/Kernels/BoxingTests/BoxingTests.csproj
+++ b/Tests/Kernels/BoxingTests/BoxingTests.csproj
@@ -7,6 +7,7 @@
+
diff --git a/Tests/Kernels/ConsoleTest/ConsoleTest.csproj b/Tests/Kernels/ConsoleTest/ConsoleTest.csproj
index 06ce99de90..85c17d91ba 100644
--- a/Tests/Kernels/ConsoleTest/ConsoleTest.csproj
+++ b/Tests/Kernels/ConsoleTest/ConsoleTest.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Tests/Kernels/ConsoleTest/Kernel.cs b/Tests/Kernels/ConsoleTest/Kernel.cs
index 745c1b3675..da2200d10c 100644
--- a/Tests/Kernels/ConsoleTest/Kernel.cs
+++ b/Tests/Kernels/ConsoleTest/Kernel.cs
@@ -57,8 +57,8 @@ public void TestConsoleEncoding()
Console.WriteLine($"ConsoleOutputEncoding {Console.OutputEncoding.BodyName}");
/* Let's change it in the legacy IBM437 encoding */
- Console.InputEncoding = Encoding.GetEncoding(437);
- Console.OutputEncoding = Encoding.GetEncoding(437);
+ Console.InputEncoding = Cosmos.System.ExtendedASCII.CosmosEncodingProvider.Instance.GetEncoding(437);
+ Console.OutputEncoding = Cosmos.System.ExtendedASCII.CosmosEncodingProvider.Instance.GetEncoding(437);
Console.WriteLine($"ConsoleInputEncoding in now {Console.InputEncoding.BodyName}");
Console.WriteLine($"ConsoleOutputEncoding in now {Console.OutputEncoding.BodyName}");
@@ -66,7 +66,7 @@ public void TestConsoleEncoding()
Console.WriteLine("Let's write some accented characters: èòàùì");
Console.WriteLine("Let's print all the CP437 codepage");
- Sys.Global.mDebugger.SendInternal("");
+ Sys.Global.Debugger.SendInternal("");
Console.Write("Ç ü é â ä à å ç ê ë è ï î ì Ä Å\n" +
"É æ Æ ô ö ò û ù ÿ Ö Ü ¢ £ ¥ ₧ ƒ\n" +
@@ -121,7 +121,7 @@ public void TestConsoleEncoding()
//Console.WriteLine("Test Format (hex) {0:x}", 42);
Console.WriteLine("Layout switched to DE...");
- SetKeyboardScanMap(new DE_Standard());
+ Sys.KeyboardManager.SetKeyLayout(new DEStandardLayout());
Console.WriteLine("Write in german now I'll read it with Console.ReadLine()...");
var str = Console.ReadLine();
@@ -168,4 +168,4 @@ public void TestVariousConsoleFunctions()
Console.SetCursorPosition(cursor.Left, cursor.Top - 1);
}
}
-}
+}
\ No newline at end of file
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl.System/Cosmos.Compiler.Tests.BclSystem.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl.System/Cosmos.Compiler.Tests.BclSystem.csproj
index 9f244a41af..9213f5c32c 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl.System/Cosmos.Compiler.Tests.BclSystem.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl.System/Cosmos.Compiler.Tests.BclSystem.csproj
@@ -10,6 +10,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/Cosmos.Compiler.Tests.Bcl.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/Cosmos.Compiler.Tests.Bcl.csproj
index 9c7f178678..f352f28624 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/Cosmos.Compiler.Tests.Bcl.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/Cosmos.Compiler.Tests.Bcl.csproj
@@ -13,6 +13,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/DictionaryTest.cs b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/DictionaryTest.cs
index 45c476378f..38e08e20fe 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/DictionaryTest.cs
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/Generic/DictionaryTest.cs
@@ -64,6 +64,12 @@ public static void Execute()
dictionary.Add("b", "basds");
Assert.IsTrue(dictionary.Count == 1, "Dictionary().Clear prevents correctly adding values again");
Assert.IsTrue(dictionary["b"] == "basds", "Dictionary().Clear prevents correctly adding values again");
+
+ dictionary.Add("", "1234");
+
+ Assert.AreEqual("1234", (string)dictionary[""], "key of \"\" failed");
+
+
}
{
@@ -117,6 +123,7 @@ public static void Execute()
dictionary2.Add("b", 9);
Assert.IsTrue(dictionary2.Count == 1, "Dictionary().Clear prevents correctly adding values again");
Assert.IsTrue(dictionary2["b"] == 9, "Dictionary().Clear prevents correctly adding values again");
+
}
//#region "Dictionary Tests"
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/HashtableTest.cs b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/HashtableTest.cs
index eaed43eaa4..efc772006f 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/HashtableTest.cs
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Collections/HashtableTest.cs
@@ -8,7 +8,7 @@ namespace Cosmos.Compiler.Tests.Bcl.System.Collections
{
class HashtableTest
{
- private static Debugger myDebugger = new Debugger("System", "HashtableTest");
+ private static Debugger myDebugger = new("HashtableTest");
public static void Execute()
{
@@ -57,7 +57,7 @@ public static void Execute()
Assert.IsTrue((string)h2[43] == "FortyThree", "h2 indexer failed: existing value (II) not found");
- Assert.IsTrue(h2.Count == 2, "h2 Count failed: value != 2");
+ Assert.IsTrue(h2.Count == 2, "h2 Count failed: value != 2");
foreach (var k in h2.Keys)
{
@@ -97,7 +97,8 @@ public static void Execute()
Assert.IsTrue((int)k.Value == 41 || (int)k.Value == 42, "h3 enumeration returns invalid values");
}
-
+
+
}
}
}
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Text/EncodingTest.cs b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Text/EncodingTest.cs
index d1d7dce7de..4815912e82 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Text/EncodingTest.cs
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Bcl/System/Text/EncodingTest.cs
@@ -11,7 +11,7 @@ namespace Cosmos.Compiler.Tests.Bcl.System.Text
{
internal class EncodingTest
{
- private static Debugger mDebugger = new Debugger("System", "Enconding Test");
+ private static Debugger mDebugger = new("Enconding Test");
private static byte[] UTF8EnglishText = new byte[] { 0x43, 0x6F, 0x73, 0x6D, 0x6F, 0x73, 0x20, 0x69, 0x73, 0x20,
0x77, 0x6F, 0x6E, 0x64, 0x65, 0x72, 0x66, 0x75, 0x6C, 0x21 };
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Encryption/Cosmos.Compiler.Tests.Encryption.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.Encryption/Cosmos.Compiler.Tests.Encryption.csproj
index 0ff87e4f62..aa2682b187 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Encryption/Cosmos.Compiler.Tests.Encryption.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Encryption/Cosmos.Compiler.Tests.Encryption.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Exceptions/Cosmos.Compiler.Tests.Exceptions.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.Exceptions/Cosmos.Compiler.Tests.Exceptions.csproj
index c06540861f..50fbe61be4 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Exceptions/Cosmos.Compiler.Tests.Exceptions.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Exceptions/Cosmos.Compiler.Tests.Exceptions.csproj
@@ -7,6 +7,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.Interfaces/Cosmos.Compiler.Tests.Interfaces.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.Interfaces/Cosmos.Compiler.Tests.Interfaces.csproj
index 0ff87e4f62..aa2682b187 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.Interfaces/Cosmos.Compiler.Tests.Interfaces.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.Interfaces/Cosmos.Compiler.Tests.Interfaces.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Cosmos.Compiler.Tests.MethodTests.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Cosmos.Compiler.Tests.MethodTests.csproj
index c06540861f..50fbe61be4 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Cosmos.Compiler.Tests.MethodTests.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/Cosmos.Compiler.Tests.MethodTests.csproj
@@ -7,6 +7,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/DelegatesTest.cs b/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/DelegatesTest.cs
index c549cfe647..3510e8f11c 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/DelegatesTest.cs
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.MethodTests/DelegatesTest.cs
@@ -206,7 +206,7 @@ private static void TestDelegateWithoutArguments()
private static void TestMulticastDelegateWithoutArguments()
{
- var xDebugger = new Debugger("Test", "Delegates");
+ Debugger xDebugger = new("Delegates");
xDebugger.Send("Start MulticastDelegate test");
mCount = 0;
Action xDelegate = IncreaseCounterOnce;
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.SingleEchoTest/Cosmos.Compiler.Tests.SingleEchoTest.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.SingleEchoTest/Cosmos.Compiler.Tests.SingleEchoTest.csproj
index 0ff87e4f62..aa2682b187 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.SingleEchoTest/Cosmos.Compiler.Tests.SingleEchoTest.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.SingleEchoTest/Cosmos.Compiler.Tests.SingleEchoTest.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Cosmos.Compiler.Tests.TypeSystem.csproj b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Cosmos.Compiler.Tests.TypeSystem.csproj
index 875f608ea9..edd3d902b4 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Cosmos.Compiler.Tests.TypeSystem.csproj
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Cosmos.Compiler.Tests.TypeSystem.csproj
@@ -7,6 +7,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs
index 4b5650dcea..f85cfacf94 100644
--- a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs
+++ b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs
@@ -50,7 +50,6 @@ public class Kernel : Sys.Kernel
protected override void BeforeRun()
{
- Console.WriteLine("Cosmos booted successfully. Starting Type tests now please wait...");
}
private void TestVTablesImpl()
@@ -206,6 +205,18 @@ public void RealMethodsTest()
Heap.Collect();
int nowAllocated = HeapSmall.GetAllocatedObjectCount();
Assert.AreEqual(allocated, nowAllocated, "Concentating and writing strings does not leak objects");
+
+ allocated = HeapSmall.GetAllocatedObjectCount();
+ TestMethod7();
+ Heap.Collect();
+ nowAllocated = HeapSmall.GetAllocatedObjectCount();
+ Assert.AreEqual(allocated, nowAllocated, "TestMethod7 does not leak string objects");
+
+ allocated = HeapSmall.GetAllocatedObjectCount();
+ TestMethod8();
+ Heap.Collect();
+ nowAllocated = HeapSmall.GetAllocatedObjectCount();
+ Assert.AreEqual(allocated, nowAllocated, "TestMethod8 does not leak any objects");
}
void TestMethod6()
@@ -213,6 +224,23 @@ void TestMethod6()
Console.WriteLine("Test: " + 3 + " vs " + 5);
}
+ void TestMethod7()
+ {
+ string o = "";
+ for (int i = 0; i < 128; i++)
+ {
+ o += i + "|" + i * 2;
+ }
+ }
+
+ void TestMethod8()
+ {
+ for (int i = 0; i < 100000; i++)
+ {
+ new object();
+ }
+ }
+
#endregion
protected override void Run()
diff --git a/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/Cosmos.Kernel.Tests.DiskManager.csproj b/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/Cosmos.Kernel.Tests.DiskManager.csproj
index e5112d1494..fa2cfac6da 100644
--- a/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/Cosmos.Kernel.Tests.DiskManager.csproj
+++ b/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/Cosmos.Kernel.Tests.DiskManager.csproj
@@ -8,7 +8,9 @@
+
+
diff --git a/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs b/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs
index 2e5d09667c..41c228f477 100644
--- a/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs
+++ b/Tests/Kernels/Cosmos.Kernel.Tests.DiskManager/System.FileSystem/DiskManagerTest.cs
@@ -47,6 +47,14 @@ public static void Execute(Debugger mDebugger)
mDebugger.Send("START TEST: Format");
+ MBR mbr = new MBR(ourDisk.Host);
+
+ mbr.CreateMBR(ourDisk.Host);
+
+ mbr.WritePartitionInformation(new Partition(ourDisk.Host, 512, ourDisk.Host.BlockCount - 1024), 0);
+
+ ourDisk.Mount();
+
ourDisk.FormatPartition(0, "FAT32", true);
mDebugger.Send("Format done testing HDD is really empty");
diff --git a/Tests/Kernels/Cosmos.Kernel.Tests.Fat/Cosmos.Kernel.Tests.Fat.csproj b/Tests/Kernels/Cosmos.Kernel.Tests.Fat/Cosmos.Kernel.Tests.Fat.csproj
index e5112d1494..a7c7e01649 100644
--- a/Tests/Kernels/Cosmos.Kernel.Tests.Fat/Cosmos.Kernel.Tests.Fat.csproj
+++ b/Tests/Kernels/Cosmos.Kernel.Tests.Fat/Cosmos.Kernel.Tests.Fat.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Tests/Kernels/Cosmos.Kernel.Tests.IO/Cosmos.Kernel.Tests.IO.csproj b/Tests/Kernels/Cosmos.Kernel.Tests.IO/Cosmos.Kernel.Tests.IO.csproj
index e5112d1494..a7c7e01649 100644
--- a/Tests/Kernels/Cosmos.Kernel.Tests.IO/Cosmos.Kernel.Tests.IO.csproj
+++ b/Tests/Kernels/Cosmos.Kernel.Tests.IO/Cosmos.Kernel.Tests.IO.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Tests/Kernels/GraphicTest/GraphicTest.csproj b/Tests/Kernels/GraphicTest/GraphicTest.csproj
index 8ab8f818a1..62a3ac1b22 100644
--- a/Tests/Kernels/GraphicTest/GraphicTest.csproj
+++ b/Tests/Kernels/GraphicTest/GraphicTest.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Tests/Kernels/GraphicTest/Kernel.cs b/Tests/Kernels/GraphicTest/Kernel.cs
index e8c4d3fb74..26a806a758 100644
--- a/Tests/Kernels/GraphicTest/Kernel.cs
+++ b/Tests/Kernels/GraphicTest/Kernel.cs
@@ -36,8 +36,8 @@ public class Kernel : Sys.Kernel
0, 255, 243, 255, 0, 255, 243, 255, 0, 255, 243, 255, 0, 255, 243, 255, 0, 255, 243, 255, 0, 255, 243, 255, 0, 255, 243, 255, }, ColorDepth.ColorDepth32);
private static readonly byte[] letterData = Convert.FromBase64String("Qk12AgAAAAAAADYAAAAoAAAACQAAABAAAAABACAAAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP+/dP//////////////////////AHS//wAAAAAAAAAAAAAAAEgAAP+/4Jz/AAB0/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcSAD/nODg/wAASP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3QA/0ic4P8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCcSP8AdL//AAAAAAAAAAAAAAAAAAAAAP+/dP/////////////////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pWq4pWr4pWs/8O1/8O4/8O9/8O+/8Se/8Sf/8Sw/8Sx/8WS/8WT/8We/8Wf/8Wg/8Wh/8W4/8W9/8W+/8uG/8uc/+KUmOKUm+KUmuKUmeKVm+KVnOKVneKVr//ilIzilI/ilI7ilI3ilZLilZPilZTila3/4paI/+KAlOKAlf/igJj/4oCZ/+KAmv/igJz/w5//4oCd/8+A/+KAnv/igKD/wrXOvP/igKH/4oCm/+KAsP/igLn/4oC6/+KInv/igqz/4oSi/+KIqf/iiaH/wrH/4oml/+KJpP/iiaD/4oSW/8O3/+KJiP/CsP/igq7/wrf/4oiI/+KBv//Csv/ilqDilq7/4oiF/w==";
protected override void BeforeRun()
{
}
@@ -60,8 +60,8 @@ private void DoTest(Canvas aCanvas)
/* A Black Lines larger than the canvas */
color = Color.Black;
- aCanvas.DrawLine(color, -20, 100, aCanvas.Mode.Width + 20, 100);
- aCanvas.DrawLine(color, -20, -20, aCanvas.Mode.Width + 20, aCanvas.Mode.Height + 20);
+ aCanvas.DrawLine(color, -20, 100, (int)aCanvas.Mode.Width + 20, 100);
+ aCanvas.DrawLine(color, -20, -20, (int)aCanvas.Mode.Width + 20, (int)aCanvas.Mode.Height + 20);
/* An IndianRed vertical line */
color = Color.IndianRed;
@@ -138,6 +138,10 @@ private void DoTest(Canvas aCanvas)
color = Color.White;
Font font = PCScreenFont.Default;
+ /* Create a PC Screen 2 Font */
+ color = Color.White;
+ Font font2 = PCScreenFont.LoadFont(Convert.FromBase64String(psf2Font));
+
/* Draw text */
aCanvas.DrawString("Hello Cosmos World!", font, color, 0, 16 * 5);
aCanvas.DrawString("font data test=" + font.Width + "x" + font.Height, font, color, 0, 16 * 6);
@@ -145,6 +149,13 @@ private void DoTest(Canvas aCanvas)
/* Draw char */
aCanvas.DrawChar('A', font, color, 0, 16 * 7);
+ /* Draw text */
+ aCanvas.DrawString("Hello Cosmos World!", font2, color, 100, 16 * 5);
+ aCanvas.DrawString("font data test=" + font2.Width + "x" + font2.Height, font2, color, 100, 16 * 6);
+
+ /* Draw char */
+ aCanvas.DrawChar('A', font2, color, 100, 16 * 7);
+
aCanvas.Display();
aCanvas.Disable();
@@ -228,13 +239,13 @@ private void DoTest(VGACanvas vGACanvas)
private void TestBitmaps()
{
Assert.IsTrue(bitmap.Width == 10 && bitmap.Height == 10, "Bitmap width and height set correctly");
- Assert.IsTrue(bitmap.rawData.Length == 100, "Bitmap data size makes sense");
+ Assert.IsTrue(bitmap.RawData.Length == 100, "Bitmap data size makes sense");
MemoryStream savedBitmap = new MemoryStream();
- letter.Save(savedBitmap, ImageFormat.bmp);
+ letter.Save(savedBitmap, ImageFormat.BMP);
var bitmapData = savedBitmap.ToArray();
Assert.IsTrue(EqualityHelper.ByteArrayAreEquals(bitmapData, letterData), "Saving a bitmap creates the same data as used to create it");
Bitmap letter2 = new Bitmap(bitmapData);
- Assert.IsTrue(EqualityHelper.IntArrayAreEquals(letter2.rawData, letter.rawData), "Creating a new bitmap from saved bitmap creates same bitmap");
+ Assert.IsTrue(EqualityHelper.IntArrayAreEquals(letter2.RawData, letter.RawData), "Creating a new bitmap from saved bitmap creates same bitmap");
}
}
-}
+}
\ No newline at end of file
diff --git a/Tests/Kernels/MemoryOperationsTest/MemoryOperationsTest.csproj b/Tests/Kernels/MemoryOperationsTest/MemoryOperationsTest.csproj
index 276af2d203..7bfb5a92b5 100644
--- a/Tests/Kernels/MemoryOperationsTest/MemoryOperationsTest.csproj
+++ b/Tests/Kernels/MemoryOperationsTest/MemoryOperationsTest.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Tests/Kernels/NetworkTest/NetworkTest.csproj b/Tests/Kernels/NetworkTest/NetworkTest.csproj
index 3fe1d58cfb..a810220a94 100644
--- a/Tests/Kernels/NetworkTest/NetworkTest.csproj
+++ b/Tests/Kernels/NetworkTest/NetworkTest.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Tests/Kernels/ProcessorTests/Kernel.cs b/Tests/Kernels/ProcessorTests/Kernel.cs
index c2c7188bce..ff74b2c53b 100644
--- a/Tests/Kernels/ProcessorTests/Kernel.cs
+++ b/Tests/Kernels/ProcessorTests/Kernel.cs
@@ -5,6 +5,7 @@
using System.Text;
using Cosmos.System.ExtendedASCII;
using Cosmos.System.ScanMaps;
+using Cosmos.Core.Multiboot;
using Cosmos.Core;
using System.Runtime.InteropServices;
using Cosmos.HAL;
diff --git a/Tests/Kernels/ProcessorTests/ProcessorTests.csproj b/Tests/Kernels/ProcessorTests/ProcessorTests.csproj
index 0ff87e4f62..aa2682b187 100644
--- a/Tests/Kernels/ProcessorTests/ProcessorTests.csproj
+++ b/Tests/Kernels/ProcessorTests/ProcessorTests.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Tests/Kernels/SimpleStructsAndArraysTest/SimpleStructsAndArraysTest.csproj b/Tests/Kernels/SimpleStructsAndArraysTest/SimpleStructsAndArraysTest.csproj
index 0ff87e4f62..aa2682b187 100644
--- a/Tests/Kernels/SimpleStructsAndArraysTest/SimpleStructsAndArraysTest.csproj
+++ b/Tests/Kernels/SimpleStructsAndArraysTest/SimpleStructsAndArraysTest.csproj
@@ -8,6 +8,7 @@
+
diff --git a/appveyor.yml b/appveyor.yml
index 7b1b071499..1f2d4b37e4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 0.20150918.{build}
+version: 0.20221121.{build}
image: Visual Studio 2022
configuration: Debug-CI
platform: Any CPU
@@ -53,12 +53,12 @@ on_finish:
$wc.UploadFile("https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)", "c:\Cosmos\TestResult.xml")
}
-notifications:
-- provider: Webhook
- url: https://webhooks.gitter.im/e/d5c57ffb9a04b1b180be
- on_build_success: true
- on_build_failure: true
- on_build_status_changed: true
+#notifications:
+#- provider: Webhook
+# url: https://webhooks.gitter.im/e/d5c57ffb9a04b1b180be
+# on_build_success: true
+# on_build_failure: true
+# on_build_status_changed: true
matrix:
fast_finish: true
diff --git a/install-VS2022.bat b/install-VS2022.bat
index 5b65409f74..89e18e9707 100644
--- a/install-VS2022.bat
+++ b/install-VS2022.bat
@@ -29,6 +29,10 @@ if not exist "%MSBuild%" (
echo Building Builder.sln
"%MSBuild%" Builder.sln /nologo /maxcpucount /nodeReuse:false /verbosity:minimal /t:Restore;Build
+if %ERRORLEVEL% neq 0 (
+ echo Failed to build Cosmos Builder. Exiting...
+ exit /b %ERRORLEVEL%
+)
start "Cosmos Builder" "source\Cosmos.Build.Builder\bin\Debug\Cosmos.Build.Builder.exe" "-VSPATH=%InstallDir%" %*
exit
diff --git a/source/Cosmos.Build.Builder/CosmosBuildDefinition.cs b/source/Cosmos.Build.Builder/CosmosBuildDefinition.cs
index c38c6ca314..9579dee96e 100644
--- a/source/Cosmos.Build.Builder/CosmosBuildDefinition.cs
+++ b/source/Cosmos.Build.Builder/CosmosBuildDefinition.cs
@@ -72,8 +72,11 @@ void CleanPackage(string aPackage)
var il2cpuDir = Path.GetFullPath(Path.Combine(_cosmosDir, "..", "IL2CPU"));
+ var xSharpDir = Path.GetFullPath(Path.Combine(_cosmosDir, "..", "XSharp"));
+
var cosmosSourceDir = Path.Combine(_cosmosDir, "source");
var il2cpuSourceDir = Path.Combine(il2cpuDir, "source");
+ var xSharpSourceDir = Path.Combine(xSharpDir, "source");
var buildSlnPath = Path.Combine(_cosmosDir, "Build.sln");
@@ -107,7 +110,7 @@ void CleanPackage(string aPackage)
"Cosmos.Build.Tasks",
};
- foreach (var task in PackProject(cosmosPackageProjects, new List()))
+ foreach (var task in PackProject(cosmosPackageProjects, new List(), new List()))
{
yield return task;
}
@@ -127,7 +130,9 @@ void CleanPackage(string aPackage)
"Cosmos.System2_Plugs",
"Cosmos.Debug.Kernel",
- "Cosmos.Debug.Kernel.Plugs.Asm"
+ "Cosmos.Debug.Kernel.Plugs.Asm",
+
+ "Cosmos.Plugs"
};
var il2cpuPackageProjects = new List()
@@ -135,7 +140,14 @@ void CleanPackage(string aPackage)
"IL2CPU.API"
};
- foreach (var task in PackProject(cosmosPackageProjects, il2cpuPackageProjects))
+ var xSharpProjects = new List()
+ {
+ "Spruce",
+ "XSharp/XSharp"
+ };
+
+
+ foreach (var task in PackProject(cosmosPackageProjects, il2cpuPackageProjects, xSharpProjects))
{
yield return task;
}
@@ -169,11 +181,12 @@ void CleanPackage(string aPackage)
}
}
- IEnumerable PackProject(List cosmosProjects, List il2cpuProjects)
+ IEnumerable PackProject(List cosmosProjects, List il2cpuProjects, List xSharpProjects)
{
- var packageProjectPaths = cosmosProjects.Select(p => Path.Combine(cosmosSourceDir, p));
- packageProjectPaths = packageProjectPaths.Concat(il2cpuProjects.Select(p => Path.Combine(il2cpuSourceDir, p)));
-
+ var packageProjectPaths = cosmosProjects.Select(p => Path.Combine(cosmosSourceDir, p))
+ .Concat(il2cpuProjects.Select(p => Path.Combine(il2cpuSourceDir, p)))
+ .Concat(xSharpProjects.Select(p => Path.Combine(xSharpSourceDir, p)));
+
var packagesDir = Path.Combine(vsipDir, "packages");
var packageVersionLocalBuildSuffix = DateTime.Now.ToString("yyyyMMddhhmmss");
diff --git a/source/Cosmos.Build.Tasks/.editorconfig b/source/Cosmos.Build.Tasks/.editorconfig
deleted file mode 100644
index 930c4915ae..0000000000
--- a/source/Cosmos.Build.Tasks/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*]
-indent_size = 4
diff --git a/source/Cosmos.Build.Tasks/CreateLimineConfig.cs b/source/Cosmos.Build.Tasks/CreateLimineConfig.cs
index 2b74adcb67..e9ea15a8f8 100644
--- a/source/Cosmos.Build.Tasks/CreateLimineConfig.cs
+++ b/source/Cosmos.Build.Tasks/CreateLimineConfig.cs
@@ -41,8 +41,8 @@ public override bool Execute()
xWriter.WriteLineAsync("INTERFACE_RESOLUTION=800x600x32");
xWriter.WriteLineAsync();
- xWriter.WriteLineAsync($":Cosmos {xLabelName}");
- WriteIndentedLine(xWriter, $"COMMENT=Boot {xLabelName} Cosmos kernel using multiboot2");
+ xWriter.WriteLineAsync($":{xLabelName}");
+ WriteIndentedLine(xWriter, $"COMMENT=Boot {xLabelName} using multiboot2.");
xWriter.WriteLineAsync();
WriteIndentedLine(xWriter, "PROTOCOL=multiboot2");
WriteIndentedLine(xWriter,
diff --git a/source/Cosmos.Build.Tasks/MakeIso.cs b/source/Cosmos.Build.Tasks/MakeIso.cs
index cfa44f6e10..a6812eb267 100644
--- a/source/Cosmos.Build.Tasks/MakeIso.cs
+++ b/source/Cosmos.Build.Tasks/MakeIso.cs
@@ -64,6 +64,7 @@ protected override string GenerateCommandLineCommands()
xBuilder.AppendSwitch("-relaxed-filenames");
xBuilder.AppendSwitch("-J");
xBuilder.AppendSwitch("-R");
+ xBuilder.AppendSwitch("-l");
xBuilder.AppendSwitchIfNotNull("-o ", OutputFile);
xBuilder.AppendSwitch(" -b boot/limine-cd.bin");
xBuilder.AppendSwitch("-no-emul-boot");
diff --git a/source/Cosmos.Build.Tasks/ReadNasmMapToDebugInfo.cs b/source/Cosmos.Build.Tasks/ReadNasmMapToDebugInfo.cs
index 74dc94f4d5..1484975875 100644
--- a/source/Cosmos.Build.Tasks/ReadNasmMapToDebugInfo.cs
+++ b/source/Cosmos.Build.Tasks/ReadNasmMapToDebugInfo.cs
@@ -34,10 +34,8 @@ public override bool Execute()
using (var xDebugInfo = new DebugInfo(DebugInfoFile))
{
- var connection = xDebugInfo.GetNewConnection();
- xDebugInfo.AddLabels(connection, xSourceInfos);
- xDebugInfo.CreateIndexes(connection);
- connection.Close();
+ xDebugInfo.AddLabels(xSourceInfos);
+ xDebugInfo.CreateIndexes();
}
return true;
diff --git a/source/Cosmos.Build.Tasks/TheRingMaster.cs b/source/Cosmos.Build.Tasks/TheRingMaster.cs
deleted file mode 100644
index f4f6369f38..0000000000
--- a/source/Cosmos.Build.Tasks/TheRingMaster.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System;
-using System.IO;
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-using static Cosmos.Build.Tasks.OperatingSystem;
-
-namespace Cosmos.Build.Tasks
-{
- public class TheRingMaster : ToolTask
- {
- [Required]
- public string KernelAssemblyPath { get; set; }
-
- protected override string ToolName => IsWindows() ? "TheRingMaster.exe" : "TheRingMaster";
-
- protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High;
- protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
-
- protected override bool ValidateParameters()
- {
- if (!File.Exists(KernelAssemblyPath))
- {
- Log.LogError(nameof(KernelAssemblyPath) + " doesn't exist!");
- }
-
- return !Log.HasLoggedErrors;
- }
-
- protected override string GenerateFullPathToTool()
- {
- if (String.IsNullOrWhiteSpace(ToolExe))
- {
- return null;
- }
-
- if (String.IsNullOrWhiteSpace(ToolPath))
- {
- return Path.Combine(Directory.GetCurrentDirectory(), ToolExe);
- }
-
- return Path.Combine(Path.GetFullPath(ToolPath), ToolExe);
- }
-
- protected override string GenerateCommandLineCommands()
- {
- return KernelAssemblyPath;
- }
- }
-}
diff --git a/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets b/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets
index c2e0704a1f..25aa361646 100644
--- a/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets
+++ b/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets
@@ -106,22 +106,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
False
diff --git a/source/Cosmos.Build.Tasks/tools/cygwin/win/cygiconv-2.dll b/source/Cosmos.Build.Tasks/tools/cygwin/win/cygiconv-2.dll
deleted file mode 100644
index 926464c7e2..0000000000
Binary files a/source/Cosmos.Build.Tasks/tools/cygwin/win/cygiconv-2.dll and /dev/null differ
diff --git a/source/Cosmos.Build.Tasks/tools/cygwin/win/cygintl-3.dll b/source/Cosmos.Build.Tasks/tools/cygwin/win/cygintl-3.dll
deleted file mode 100644
index bd6e3829ab..0000000000
Binary files a/source/Cosmos.Build.Tasks/tools/cygwin/win/cygintl-3.dll and /dev/null differ
diff --git a/source/Cosmos.Build.Tasks/tools/cygwin/win/cygwin1.dll b/source/Cosmos.Build.Tasks/tools/cygwin/win/cygwin1.dll
index 73c27fc1fb..00d8a72aad 100644
Binary files a/source/Cosmos.Build.Tasks/tools/cygwin/win/cygwin1.dll and b/source/Cosmos.Build.Tasks/tools/cygwin/win/cygwin1.dll differ
diff --git a/source/Cosmos.Build.Tasks/tools/cygwin/win/ld.exe b/source/Cosmos.Build.Tasks/tools/cygwin/win/ld.exe
index 963eeabd3c..52fc663fea 100644
Binary files a/source/Cosmos.Build.Tasks/tools/cygwin/win/ld.exe and b/source/Cosmos.Build.Tasks/tools/cygwin/win/ld.exe differ
diff --git a/source/Cosmos.Build.Tasks/tools/cygwin/win/objdump.exe b/source/Cosmos.Build.Tasks/tools/cygwin/win/objdump.exe
index e709c327a5..fbd59f7f51 100644
Binary files a/source/Cosmos.Build.Tasks/tools/cygwin/win/objdump.exe and b/source/Cosmos.Build.Tasks/tools/cygwin/win/objdump.exe differ
diff --git a/source/Cosmos.Build.Tasks/tools/limine/boot/liminewp.bmp b/source/Cosmos.Build.Tasks/tools/limine/boot/liminewp.bmp
index b2c7f54171..e3aeb7c372 100644
Binary files a/source/Cosmos.Build.Tasks/tools/limine/boot/liminewp.bmp and b/source/Cosmos.Build.Tasks/tools/limine/boot/liminewp.bmp differ
diff --git a/source/Cosmos.Common/StringHelper.cs b/source/Cosmos.Common/StringHelper.cs
index bf42a6b9bf..5054d1c878 100644
--- a/source/Cosmos.Common/StringHelper.cs
+++ b/source/Cosmos.Common/StringHelper.cs
@@ -10,7 +10,7 @@ namespace Cosmos.Common
///
public static class StringHelper
{
- private static Debugger mDebugger = new Debugger("Common", "StringHelper");
+ private static Debugger debugger = new("StringHelper");
internal enum StringComparisonResultEnum
{
@@ -28,7 +28,7 @@ internal enum StringComparisonResultEnum
/// String value.
public static string GetNumberString(uint aValue)
{
- mDebugger.SendInternal("StringHelper.GetNumberString(uint)");
+ debugger.SendInternal("StringHelper.GetNumberString(uint)");
string[] xChars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
string xResult = string.Empty;
@@ -58,7 +58,7 @@ public static string GetNumberString(uint aValue)
/// String value.
public static string GetNumberString(int aValue)
{
- mDebugger.SendInternal("StringHelper.GetNumberString(int)");
+ debugger.SendInternal("StringHelper.GetNumberString(int)");
string[] xChars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
string xResult = string.Empty;
@@ -99,7 +99,7 @@ public static string GetNumberString(int aValue)
/// String value.
public static string GetNumberString(ulong aValue)
{
- mDebugger.SendInternal("StringHelper.GetNumberString(ulong)");
+ debugger.SendInternal("StringHelper.GetNumberString(ulong)");
string[] xChars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
string xResult = string.Empty;
@@ -107,30 +107,30 @@ public static string GetNumberString(ulong aValue)
if (aValue == 0)
{
xResult = "0";
- mDebugger.SendInternal("xResult =");
- mDebugger.SendInternal(xResult);
+ debugger.SendInternal("xResult =");
+ debugger.SendInternal(xResult);
}
else
{
ulong xValue = aValue;
- mDebugger.SendInternal("xValue =");
- mDebugger.SendInternal(xValue);
+ debugger.SendInternal("xValue =");
+ debugger.SendInternal(xValue);
while (xValue > 0)
{
ulong xValue2 = xValue % 10;
- mDebugger.SendInternal("xValue2 =");
- mDebugger.SendInternal(xValue2);
+ debugger.SendInternal("xValue2 =");
+ debugger.SendInternal(xValue2);
xResult = string.Concat(xChars[xValue2], xResult);
- mDebugger.SendInternal("xResult =");
- mDebugger.SendInternal(xResult);
+ debugger.SendInternal("xResult =");
+ debugger.SendInternal(xResult);
xValue /= 10;
- mDebugger.SendInternal("xValue =");
- mDebugger.SendInternal(xValue);
+ debugger.SendInternal("xValue =");
+ debugger.SendInternal(xValue);
}
}
- mDebugger.SendInternal("xResult =");
- mDebugger.SendInternal(xResult);
+ debugger.SendInternal("xResult =");
+ debugger.SendInternal(xResult);
return xResult;
}
@@ -141,7 +141,7 @@ public static string GetNumberString(ulong aValue)
/// String value.
public static string GetNumberString(long aValue)
{
- mDebugger.SendInternal("StringHelper.GetNumberString(long)");
+ debugger.SendInternal("StringHelper.GetNumberString(long)");
string[] xChars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
string xResult = string.Empty;
@@ -150,8 +150,8 @@ public static string GetNumberString(long aValue)
if (aValue == 0)
{
xResult = "0";
- mDebugger.SendInternal("xResult =");
- mDebugger.SendInternal(xResult);
+ debugger.SendInternal("xResult =");
+ debugger.SendInternal(xResult);
}
else
{
@@ -160,19 +160,19 @@ public static string GetNumberString(long aValue)
xValue *= -1;
}
- mDebugger.SendInternal("xValue =");
- mDebugger.SendInternal(xValue);
+ debugger.SendInternal("xValue =");
+ debugger.SendInternal(xValue);
while (xValue > 0)
{
long xValue2 = xValue % 10;
- mDebugger.SendInternal("xValue2 =");
- mDebugger.SendInternal(xValue2);
+ debugger.SendInternal("xValue2 =");
+ debugger.SendInternal(xValue2);
xResult = string.Concat(xChars[xValue2], xResult);
- mDebugger.SendInternal("xResult =");
- mDebugger.SendInternal(xResult);
+ debugger.SendInternal("xResult =");
+ debugger.SendInternal(xResult);
xValue /= 10;
- mDebugger.SendInternal("xValue =");
- mDebugger.SendInternal(xValue);
+ debugger.SendInternal("xValue =");
+ debugger.SendInternal(xValue);
}
}
@@ -181,8 +181,8 @@ public static string GetNumberString(long aValue)
xResult = string.Concat("-", xResult);
}
- mDebugger.SendInternal("xResult =");
- mDebugger.SendInternal(xResult);
+ debugger.SendInternal("xResult =");
+ debugger.SendInternal(xResult);
return xResult;
}
@@ -199,7 +199,7 @@ public static string GetNumberString(long aValue)
/// String value.
public static string GetNumberString(float aValue)
{
- mDebugger.SendInternal("StringHelper.GetNumberString(float)");
+ debugger.SendInternal("StringHelper.GetNumberString(float)");
var singleBytes = BitConverter.GetBytes(aValue);
int hexVal = BitConverter.ToInt32(singleBytes, 0);
@@ -220,22 +220,26 @@ public static string GetNumberString(float aValue)
case 0xFF:
if (mantissa == 0)
{
- if (isNeg)
- return "-∞";
- else
- return "∞";
+ return isNeg ? "-∞" : "∞";
}
else
+ {
/* It could exist -NaN but this is always printed as NaN */
return "NaN";
+ }
/* 0 or denormalized float? */
case 0x00:
if (mantissa == 0)
+ {
return "0";
+ }
/* Denormalized float have always exp -126 */
else
+ {
exp = -126;
+ }
+
break;
/* Normalized float the exponent is unbiased and the implicit leading one is placed in the mantissa */
@@ -289,7 +293,7 @@ public static string GetNumberString(float aValue)
}
fracPart = (fracPart << 3) + (fracPart << 1);
char remain = (char)((fracPart >> 24) + '0');
- if (remain > '5' && result[result.Length - 1] > '0')
+ if (remain > '5' && result[^1] > '0')
{
char[] answer = result.ToCharArray();
int digitPos = answer.Length - 1;
@@ -311,9 +315,9 @@ public static string GetNumberString(float aValue)
result = new string(answer);
}
- while (result[result.Length - 1] == '0')
+ while (result[^1] == '0')
{
- result = result.Substring(0, result.Length - 1);
+ result = result[0..^1];
}
return result;
@@ -332,24 +336,24 @@ public static string GetNumberString(float aValue)
/// String value.
public static string GetNumberString(double aValue)
{
- mDebugger.SendInternal("StringHelper.GetNumberString(double)");
- mDebugger.SendInternal("aValue = ");
- mDebugger.SendInternal(aValue);
+ debugger.SendInternal("StringHelper.GetNumberString(double)");
+ debugger.SendInternal("aValue = ");
+ debugger.SendInternal(aValue);
long hexVal = BitConverter.DoubleToInt64Bits(aValue);
- mDebugger.SendInternal("hexVal = ");
- mDebugger.SendInternal(hexVal);
+ debugger.SendInternal("hexVal = ");
+ debugger.SendInternal(hexVal);
/* Let's extract the parts that compose our double: sign, exponent and mantissa */
bool isNeg = hexVal >> 63 != 0;
int exp = (int)((hexVal >> 52) & 0x07FF);
ulong mantissa = (ulong)(hexVal & 0x0FFFFFFFFFFFFF);
- mDebugger.SendInternal("isNeg = ");
- mDebugger.SendInternal(isNeg.ToString());
- mDebugger.SendInternal("exp = ");
- mDebugger.SendInternal(exp);
- mDebugger.SendInternal("mantissa = ");
- mDebugger.SendInternal(mantissa);
+ debugger.SendInternal("isNeg = ");
+ debugger.SendInternal(isNeg.ToString());
+ debugger.SendInternal("exp = ");
+ debugger.SendInternal(exp);
+ debugger.SendInternal("mantissa = ");
+ debugger.SendInternal(mantissa);
ulong intPart = 0, fracPart = 0;
@@ -359,22 +363,26 @@ public static string GetNumberString(double aValue)
case 0x07ff:
if (mantissa == 0)
{
- if (isNeg)
- return "-∞";
- else
- return "∞";
+ return isNeg ? "-∞" : "∞";
}
else
+ {
/* It could exist -NaN but this is always printed as NaN */
return "NaN";
+ }
/* 0 or denormalized double? */
case 0x0000:
if (mantissa == 0)
+ {
return "0";
+ }
/* Denormalized float have always exp -1022 */
else
+ {
exp = -1022;
+ }
+
break;
/* Normalized double the exponent is unbiased and the implicit leading one is placed in the mantissa */
@@ -427,7 +435,7 @@ public static string GetNumberString(double aValue)
}
fracPart = (fracPart << 3) + (fracPart << 1);
char remain = (char)((fracPart >> 53) + '0');
- if (remain > '5' && result[result.Length - 1] > '0')
+ if (remain > '5' && result[^1] > '0')
{
char[] answer = result.ToCharArray();
int digitPos = answer.Length - 1;
@@ -449,9 +457,9 @@ public static string GetNumberString(double aValue)
result = new string(answer);
}
- while (result[result.Length - 1] == '0')
+ while (result[^1] == '0')
{
- result = result.Substring(0, result.Length - 1);
+ result = result[0..^1];
}
return result;
@@ -558,4 +566,4 @@ public static bool IsNumeric(string aString)
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/.editorconfig b/source/Cosmos.Core/.editorconfig
deleted file mode 100644
index 2788264c4a..0000000000
--- a/source/Cosmos.Core/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.cs]
-indent_size=4
diff --git a/source/Cosmos.Core/ACPI.cs b/source/Cosmos.Core/ACPI.cs
index 37153137a3..20e4ef9fd8 100644
--- a/source/Cosmos.Core/ACPI.cs
+++ b/source/Cosmos.Core/ACPI.cs
@@ -1,6 +1,4 @@
-using Cosmos.Core;
-using Cosmos.Debug.Kernel;
-using System;
+using System;
using System.Runtime.InteropServices;
namespace Cosmos.Core
@@ -10,12 +8,6 @@ namespace Cosmos.Core
///
public unsafe class ACPI
{
-
- ///
- /// Debugger instance at the System ring, of the Global section.
- ///
- public static readonly Debugger mDebugger = new Debugger("System", "Global");
-
///
/// RSD table struct.
///
@@ -489,4 +481,4 @@ private static byte facpbget(int number)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/Bootstrap.cs b/source/Cosmos.Core/Bootstrap.cs
index 8e8e2ae6d8..f2d3591fa0 100644
--- a/source/Cosmos.Core/Bootstrap.cs
+++ b/source/Cosmos.Core/Bootstrap.cs
@@ -1,4 +1,5 @@
-using Cosmos.Debug.Kernel;
+using Cosmos.Core.Multiboot;
+using Cosmos.Debug.Kernel;
namespace Cosmos.Core
{
diff --git a/source/Cosmos.Core/CPU.cs b/source/Cosmos.Core/CPU.cs
index 06fe10a7c0..a161d6b466 100644
--- a/source/Cosmos.Core/CPU.cs
+++ b/source/Cosmos.Core/CPU.cs
@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
-using Cosmos.Debug.Kernel;
+using Cosmos.Core.Multiboot;
using IL2CPU.API.Attribs;
namespace Cosmos.Core
@@ -13,10 +13,10 @@ namespace Cosmos.Core
///
public static class CPU
{
- // Amount of RAM in MB's.
+ // Amount of RAM in MBs.
// needs to be static, as Heap needs it before we can instantiate objects
///
- /// Get amount of RAM in MB's.
+ /// Get amount of RAM in MBs.
///
public static uint GetAmountOfRAM()
{
@@ -256,7 +256,7 @@ public static long EstimateCPUSpeedFromName(string s)
}
if (value == 0)
{
- if (Double.TryParse(word, out value) || Double.TryParse(word.Substring(0, word.Length - 3), out value))
+ if (double.TryParse(word, out value) || double.TryParse(word[0..^3], out value))
{
break;
}
@@ -265,7 +265,7 @@ public static long EstimateCPUSpeedFromName(string s)
value *= multiplier;
if ((long)value == 0)
{
- Global.mDebugger.Send("Unable to calculate cycle speed from " + s);
+ Global.debugger.Send("Unable to calculate cycle speed from " + s);
throw new NotSupportedException("Unable to calculate cycle speed from " + s);
}
return (long)value;
diff --git a/source/Cosmos.Core/GCImplementation.cs b/source/Cosmos.Core/GCImplementation.cs
index 78bc3938f0..1d462c214b 100644
--- a/source/Cosmos.Core/GCImplementation.cs
+++ b/source/Cosmos.Core/GCImplementation.cs
@@ -149,7 +149,7 @@ public static unsafe void DecRootCount(ushort* aPtr)
if (RAT.GetPageType(aPtr) != 0)
{
var rootCount = *(aPtr - 1) >> 1; // lowest bit is used to set if hit
- *(aPtr - 1) = (ushort)((rootCount - 1) << 1); // loest bit can be zero since we shouldnt be doing this while gc is collecting
+ *(aPtr - 1) = (ushort)((rootCount - 1) << 1); // lowest bit can be zero since we shouldnt be doing this while gc is collecting
}
}
diff --git a/source/Cosmos.Core/Global.cs b/source/Cosmos.Core/Global.cs
index c4e5168e0e..6a137c571d 100644
--- a/source/Cosmos.Core/Global.cs
+++ b/source/Cosmos.Core/Global.cs
@@ -1,5 +1,4 @@
-using Cosmos.Core;
-using Cosmos.Debug.Kernel;
+using Cosmos.Debug.Kernel;
namespace Cosmos.Core
{
@@ -8,7 +7,7 @@ public static class Global
///
/// Core ring debugger instance, with the Global tag.
///
- public static readonly Debugger mDebugger = new Debugger("Core", "Global");
+ public static readonly Debugger debugger = new("Global");
// These are used by Bootstrap.. but also called to signal end of interrupt etc...
// Need to chagne this.. I dont like how this is.. maybe isolate or split into to classes... one for boostrap one for
@@ -16,13 +15,7 @@ public static class Global
///
/// Get PIC.
///
- static public PIC PIC
- {
- get
- {
- return Bootstrap.PIC;
- }
- }
+ static public PIC PIC => Bootstrap.PIC;
///
/// Init instance.
@@ -34,4 +27,4 @@ static public void Init()
// DONT transform the properties in fields, as then they remain null somehow.
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/INTs.cs b/source/Cosmos.Core/INTs.cs
index 79e991ec04..662e970ff3 100644
--- a/source/Cosmos.Core/INTs.cs
+++ b/source/Cosmos.Core/INTs.cs
@@ -239,6 +239,7 @@ public struct IRQContext {
///
private static IRQDelegate[] mIRQ_Handlers = new IRQDelegate[256];
+ ///
/// Masks or Un-Masks an interupt address.
/// Source: https://wiki.osdev.org/8259_PIC
///
diff --git a/source/Cosmos.Core/IOGroup/ATA.cs b/source/Cosmos.Core/IOGroup/ATA.cs
index 7cfa15e4a6..a70fee6c2b 100644
--- a/source/Cosmos.Core/IOGroup/ATA.cs
+++ b/source/Cosmos.Core/IOGroup/ATA.cs
@@ -83,11 +83,11 @@ public ATA(bool aSecondary)
{
if (aSecondary)
{
- Global.mDebugger.Send("Creating Secondary ATA IOGroup");
+ Global.debugger.Send("Creating Secondary ATA IOGroup");
}
else
{
- Global.mDebugger.Send("Creating Primary ATA IOGroup");
+ Global.debugger.Send("Creating Primary ATA IOGroup");
}
var xBAR0 = GetBAR0(aSecondary);
diff --git a/source/Cosmos.Core/Memory/Heap.cs b/source/Cosmos.Core/Memory/Heap.cs
index 911d954fcd..5d86e4412b 100644
--- a/source/Cosmos.Core/Memory/Heap.cs
+++ b/source/Cosmos.Core/Memory/Heap.cs
@@ -26,6 +26,8 @@ public static unsafe class Heap
/// Thrown on fatal error, contact support.
public static unsafe void Init()
{
+ _StringType = GetStringTypeID();
+
StackStart = (uint*)CPU.GetStackStart();
HeapSmall.Init();
HeapMedium.Init();
@@ -152,8 +154,8 @@ public static void Free(void* aPtr)
/// Number of objects freed
public static int Collect()
{
- //Disable interrupts: Prevent CPU exception when allocation is called from interrupt code
- CPU.DisableInterrupts();
+ //Disable interrupts: Prevent CPU exception when allocation is called from interrupt code
+ CPU.DisableInterrupts();
// Mark and sweep objects from roots
// 1. Check if a page is in use if medium/large mark and sweep object
@@ -163,11 +165,11 @@ public static int Collect()
// Medium and large objects
for (int ratIndex = 0; ratIndex < RAT.TotalPageCount; ratIndex++)
{
- var pageType = *(RAT.mRAT + ratIndex);
+ byte pageType = *(RAT.mRAT + ratIndex);
if (pageType == (byte)RAT.PageType.HeapMedium || pageType == (byte)RAT.PageType.HeapLarge)
{
- var pagePtr = RAT.RamStart + ratIndex * RAT.PageSize;
- if (*(ushort*)(pagePtr + 3) != 0)
+ byte* pagePtr = RAT.RamStart + ratIndex * RAT.PageSize;
+ if (*(ushort*)(pagePtr + 3 * sizeof(int) + 2) != 0) // the math is kinda messy but we have 4 int space and the last ushort of that space is for the gc info
{
MarkAndSweepObject(pagePtr + HeapLarge.PrefixBytes);
}
@@ -176,31 +178,37 @@ public static int Collect()
// Small objects
// we go one size at a time
- var rootSMTPtr = HeapSmall.SMT->First;
- while (rootSMTPtr != null)
+ SMTPage* SMTPage = HeapSmall.SMT;
+ while (SMTPage != null)
{
- uint size = rootSMTPtr->Size;
- var objectSize = size + HeapSmall.PrefixItemBytes;
- uint objectsPerPage = RAT.PageSize / objectSize;
+ RootSMTBlock* rootSMTPtr = SMTPage->First;
+ while (rootSMTPtr != null)
+ {
+ uint size = rootSMTPtr->Size;
+ uint objectSize = size + HeapSmall.PrefixItemBytes;
+ uint objectsPerPage = RAT.PageSize / objectSize;
- var smtBlock = rootSMTPtr->First;
+ SMTBlock* smtBlock = rootSMTPtr->First;
- while (smtBlock != null)
- {
- var pagePtr = smtBlock->PagePtr;
- for (int i = 0; i < objectsPerPage; i++)
+ while (smtBlock != null)
{
-
- if (*(ushort*)(pagePtr + i * objectSize + 1) > 1) // 0 means not found and 1 means marked
+ byte* pagePtr = smtBlock->PagePtr;
+ for (int i = 0; i < objectsPerPage; i++)
{
- MarkAndSweepObject(pagePtr + i * objectSize + HeapSmall.PrefixItemBytes);
+
+ if (*(ushort*)(pagePtr + i * objectSize + sizeof(ushort)) > 1) // 0 means not found and 1 means marked
+ // after the start of the object we first have one ushort of object size and then the ushort of gc info so + 2 == sizeof(ushort)
+ {
+ MarkAndSweepObject(pagePtr + i * objectSize + HeapSmall.PrefixItemBytes);
+ }
}
+
+ smtBlock = smtBlock->NextBlock;
}
- smtBlock = smtBlock->NextBlock;
+ rootSMTPtr = rootSMTPtr->LargerSize;
}
-
- rootSMTPtr = rootSMTPtr->LargerSize;
+ SMTPage = SMTPage->Next;
}
// Mark and sweep objects from stack
@@ -227,52 +235,57 @@ public static int Collect()
var pageType = *(RAT.mRAT + ratIndex);
if (pageType == (byte)RAT.PageType.HeapMedium || pageType == (byte)RAT.PageType.HeapLarge)
{
- var pagePointer = RAT.RamStart + ratIndex * RAT.PageSize;
- if (*((ushort*)(pagePointer + HeapLarge.PrefixBytes) - 1) == 0)
+ byte* pagePointer = RAT.RamStart + ratIndex * RAT.PageSize;
+ if (*((ushort*)(pagePointer + HeapLarge.PrefixBytes - 2)) == 0)
{
Free(pagePointer + HeapLarge.PrefixBytes);
freed += 1;
}
else
{
- *((ushort*)(pagePointer + HeapLarge.PrefixBytes) - 1) &= (ushort)~ObjectGCStatus.Hit;
+ *((ushort*)(pagePointer + HeapLarge.PrefixBytes - 2)) &= (ushort)~ObjectGCStatus.Hit;
}
}
}
// Small objects
// we go one size at a time
- rootSMTPtr = HeapSmall.SMT->First;
- while (rootSMTPtr != null)
+ SMTPage = HeapSmall.SMT;
+ while (SMTPage != null)
{
- uint size = rootSMTPtr->Size;
- uint objectSize = size + HeapSmall.PrefixItemBytes;
- uint objectsPerPage = RAT.PageSize / objectSize;
+ RootSMTBlock* rootSMTPtr = SMTPage->First;
+ while (rootSMTPtr != null)
+ {
+ uint size = rootSMTPtr->Size;
+ uint objectSize = size + HeapSmall.PrefixItemBytes;
+ uint objectsPerPage = RAT.PageSize / objectSize;
- SMTBlock* smtBlock = rootSMTPtr->First;
+ SMTBlock* smtBlock = rootSMTPtr->First;
- while (smtBlock != null)
- {
- byte* pagePtr = smtBlock->PagePtr;
- for (int i = 0; i < objectsPerPage; i++)
+ while (smtBlock != null)
{
- if (*(ushort*)(pagePtr + i * objectSize) != 0)
+ byte* pagePtr = smtBlock->PagePtr;
+ for (int i = 0; i < objectsPerPage; i++)
{
- if (*((ushort*)(pagePtr + i * objectSize) + 1) == 0)
- {
- Free(pagePtr + i * objectSize + HeapSmall.PrefixItemBytes);
- freed += 1;
- }
- else
+ if (*(ushort*)(pagePtr + i * objectSize) != 0)
{
- *((ushort*)(pagePtr + i * objectSize) + 1) &= (ushort)~ObjectGCStatus.Hit;
+ if (*((ushort*)(pagePtr + i * objectSize) + 1) == 0)
+ {
+ Free(pagePtr + i * objectSize + HeapSmall.PrefixItemBytes);
+ freed += 1;
+ }
+ else
+ {
+ *((ushort*)(pagePtr + i * objectSize) + 1) &= (ushort)~ObjectGCStatus.Hit;
+ }
}
}
+ smtBlock = smtBlock->NextBlock;
}
- smtBlock = smtBlock->NextBlock;
- }
- rootSMTPtr = rootSMTPtr->LargerSize;
+ rootSMTPtr = rootSMTPtr->LargerSize;
+ }
+ SMTPage = SMTPage->Next;
}
//Enable interrupts back
@@ -303,10 +316,6 @@ public static void MarkAndSweepObject(void* aPtr)
// Check what we are dealing with
if (*(obj + 1) == (uint)ObjectUtils.InstanceTypeEnum.NormalObject)
{
- if (_StringType == 0)
- {
- _StringType = GetStringTypeID();
- }
var type = *obj;
// Deal with strings first
if (type == _StringType)
@@ -376,7 +385,7 @@ public static void SweepTypedObject(uint* obj, uint type)
if (*location != 0) // Check if its null
{
location = *(uint**)location;
- if (RAT.GetPageType(location) == RAT.PageType.HeapSmall)
+ if (RAT.GetPageType(location) != RAT.PageType.Empty)
{
MarkAndSweepObject(location);
}
diff --git a/source/Cosmos.Core/Memory/HeapSmall.cs b/source/Cosmos.Core/Memory/HeapSmall.cs
index 0654023fa7..52a301dbfc 100644
--- a/source/Cosmos.Core/Memory/HeapSmall.cs
+++ b/source/Cosmos.Core/Memory/HeapSmall.cs
@@ -36,6 +36,7 @@ public unsafe struct RootSMTBlock
///
public RootSMTBlock* LargerSize;
}
+ // Changing the ordering will break SMTBlock* NextFreeBlock(SMTPage* aPage)
public unsafe struct SMTBlock
{
///
@@ -75,31 +76,14 @@ unsafe static public class HeapSmall
#region SMT
- ///
- /// Find the next free block in the smt
- ///
- /// Pointer to the start of block in the SMT. null if all SMT pages are full
- private static SMTBlock* NextFreeBlock()
- {
- var page = SMT;
- SMTBlock* pos = null;
- while (page != null && pos == null)
- {
- pos = NextFreeBlock(page);
- page = page->Next;
- }
- return pos;
- }
-
-
///
/// Find the next free block in a page
///
/// Pointer to the start of block in the SMT. null if all SMT pages are full
private static SMTBlock* NextFreeBlock(SMTPage* aPage)
{
- var ptr = (SMTBlock*)aPage->First; // since both RootSMTBlock and SMTBlock have the same size (20) it doesnt matter if cast is wrong
- while (ptr->PagePtr != null) // this would check Size if its actually a RootSMTBlock
+ SMTBlock* ptr = (SMTBlock*)aPage->First; // since both RootSMTBlock and SMTBlock have the same size (20) it doesnt matter if cast is wrong
+ while (ptr->PagePtr != null) // this would check Size if its actually a RootSMTBlock, which is always non-zero
{
ptr += 1;
if (ptr >= (byte*)aPage + RAT.PageSize - 8)
@@ -133,17 +117,6 @@ unsafe static public class HeapSmall
return ptr;
}
- ///
- /// Gets the last block in the SMT for objects of this size
- ///
- ///
- ///
- private static SMTBlock* GetLastBlock(uint aSize)
- {
- var page = GetLastPage();
- return GetLastBlock(page, aSize);
- }
-
///
/// Gets the last block on a certain page for objects of this size
///
@@ -165,9 +138,14 @@ unsafe static public class HeapSmall
return ptr;
}
+ ///
+ /// Get the first block for this size on any SMT page, which has space left to allocate to
+ ///
+ ///
+ /// Null if no more space on any block of this size
private static SMTBlock* GetFirstWithSpace(uint aSize)
{
- var page = SMT;
+ SMTPage* page = SMT;
SMTBlock* block = null;
do
{
@@ -178,43 +156,41 @@ unsafe static public class HeapSmall
}
///
- /// Get the first block for this size, which has space left to allocate to
+ /// Get the first block for this size on this SMT page, which has space left to allocate to
///
///
- ///
+ /// Null if no more space on this page
private static SMTBlock* GetFirstWithSpace(SMTPage* aPage, uint aSize)
{
- return GetFirstWithSpace(aSize, GetFirstBlock(aPage, aSize));
+ return GetFirstWithSpace(GetFirstBlock(aPage, aSize), aSize);
}
///
- /// Get the first block for this size, which has space left to allocate to
+ /// Get the first block for this size in this SMT block chain, which has space left to allocate to
///
+ /// The root node to start the search at
///
- /// The root node to start the search at
///
- private static SMTBlock* GetFirstWithSpace(uint aSize, RootSMTBlock* root)
+ private static SMTBlock* GetFirstWithSpace(RootSMTBlock* aRoot, uint aSize)
{
- SMTBlock* ptr = root->First;
- if (ptr == null)
+ SMTBlock* ptr = aRoot->First;
+ if (ptr == null) // Can this ever happen?
{
return null;
}
- var lptr = ptr;
- while (ptr->SpacesLeft == 0 && ptr->NextBlock != null)
+ while (ptr->SpacesLeft == 0)
{
- lptr = ptr;
ptr = ptr->NextBlock;
- }
- if (ptr->SpacesLeft == 0 && ptr->NextBlock == null)
- {
- return null;
+ if (ptr == null)
+ {
+ return null;
+ }
}
return ptr;
}
///
- /// Add a new root block for a certain size
+ /// Add a new root block for a certain size to a certain SMT page
///
/// Size must be divisible by 2 otherwise Alloc breaks
private static void AddRootSMTBlock(SMTPage* aPage, uint aSize)
@@ -234,13 +210,13 @@ private static void AddRootSMTBlock(SMTPage* aPage, uint aSize)
while (true) { }
}
- if (ptr->Size == 0)
+ if (ptr->Size == 0) // This is the first block to be allocated on the page
{
ptr->Size = aSize;
}
else
{
- var block = (RootSMTBlock*)NextFreeBlock(aPage); // we should actually check that this is not null
+ RootSMTBlock* block = (RootSMTBlock*)NextFreeBlock(aPage); // we should actually check that this is not null
//but we should also only call this code right at the beginning so it should be fine
block->Size = aSize;
ptr->LargerSize = block;
@@ -252,7 +228,7 @@ private static void AddRootSMTBlock(SMTPage* aPage, uint aSize)
/// Get the Last Page of the SMT
///
///
- private static SMTPage* GetLastPage()
+ private static SMTPage* GetSMTLastPage()
{
var page = SMT;
while (page->Next != null)
@@ -283,19 +259,9 @@ static public void Init()
// 4 slots, ~1k ea
uint xMaxItemSize = RAT.PageSize / 4 - PrefixItemBytes;
// Word align it
- xMaxItemSize = xMaxItemSize / sizeof(uint) * sizeof(uint);
- InitSMT(xMaxItemSize);
- }
+ mMaxItemSize = xMaxItemSize / sizeof(uint) * sizeof(uint);
- ///
- /// Init SMT (Size Map Table).
- ///
- /// A max item size.
- static void InitSMT(uint aMaxItemSize)
- {
- mMaxItemSize = aMaxItemSize;
- var page = InitSMTPage();
- SMT = page;
+ SMT = InitSMTPage();
}
///
@@ -304,8 +270,8 @@ static void InitSMT(uint aMaxItemSize)
///
private static SMTPage* InitSMTPage()
{
- var page = (SMTPage*)RAT.AllocPages(RAT.PageType.SMT, 1);
- page->First = (RootSMTBlock*)(page + 1);
+ SMTPage* page = (SMTPage*)RAT.AllocPages(RAT.PageType.SMT, 1);
+ page->First = (RootSMTBlock*)page + 1;
// TODO Change these sizes after further study and also when page size changes.
// SMT can be grown as needed. Also can adjust and create new ones dynamicaly as it runs.
@@ -322,7 +288,8 @@ static void InitSMT(uint aMaxItemSize)
}
///
- /// Create a page with the size of an item and add it to the SMT at a certain page
+ /// Create a page with the size of an item and try add it to the SMT at a certain page
+ /// If the SMT page is full, it will be added to the first SMT page with space or a new SMT page is allocated
///
/// Object size in bytes
/// Thrown if:
@@ -335,11 +302,12 @@ static void InitSMT(uint aMaxItemSize)
///
static void CreatePage(SMTPage* aPage, uint aItemSize)
{
- var xPtr = (byte*)RAT.AllocPages(RAT.PageType.HeapSmall, 1);
+ byte* xPtr = (byte*)RAT.AllocPages(RAT.PageType.HeapSmall, 1);
if (xPtr == null)
{
return; // we failed to create the page, Alloc should still handle this case
}
+
uint xSlotSize = aItemSize + PrefixItemBytes;
uint xItemCount = RAT.PageSize / xSlotSize;
for (uint i = 0; i < xItemCount; i++)
@@ -351,24 +319,47 @@ static void CreatePage(SMTPage* aPage, uint aItemSize)
}
//now add it to the smt
- var parent = GetLastBlock(aPage, aItemSize);
- var smtBlock = NextFreeBlock(aPage); //get the next free block in the smt
+ SMTBlock* parent = GetLastBlock(aPage, aItemSize);
+ SMTBlock* smtBlock = NextFreeBlock(aPage); //get the next free block in the smt
- if (smtBlock == null) // we could not allocate a new block since the SMT table is all full
+ if (smtBlock == null) // we could not allocate a new block since the SMT table is all full on this page
{
- // we need to expand the SMT table by a page
- var last = SMT;
- while (last->Next != null)
+ // we now have two options:
+ // 1. there exists a later page in the chain, which has space
+ // 2. all SMT Pages are full and we need to allocate a new one
+
+ // first, check if we find a later page with space
+ SMTPage* currentSMTPage = aPage->Next;
+ while (currentSMTPage != null)
{
- last = last->Next;
+ smtBlock = NextFreeBlock(currentSMTPage);
+ if(smtBlock != null)
+ {
+ break;
+ }
+ currentSMTPage = currentSMTPage->Next;
}
- last->Next = InitSMTPage();
- parent = GetLastBlock(last->Next, aItemSize);
- smtBlock = NextFreeBlock();
+
if (smtBlock == null)
{
- Debugger.SendKernelPanic(0x93);
- while (true) { };
+ // we need to expand the SMT table by a page
+ SMTPage* last = GetSMTLastPage();
+ last->Next = InitSMTPage();
+ aPage = last->Next;
+ parent = GetLastBlock(aPage, aItemSize);
+ smtBlock = NextFreeBlock(aPage);
+
+ if (smtBlock == null)
+ {
+ Debugger.SendKernelPanic(0x93);
+ while (true) { };
+ }
+ }
+ else
+ {
+ aPage = currentSMTPage;
+ parent = GetLastBlock(aPage, aItemSize);
+ // we have already found the smt block above
}
}
@@ -376,12 +367,11 @@ static void CreatePage(SMTPage* aPage, uint aItemSize)
{
// there is already a block for the same size on the same page
parent->NextBlock = smtBlock;
-
}
else
{
// in this case this is the first block of the size, so we can link it to root
- var root = GetFirstBlock(aPage, aItemSize);
+ RootSMTBlock* root = GetFirstBlock(aPage, aItemSize);
root->First = smtBlock;
}
@@ -396,10 +386,10 @@ static void CreatePage(SMTPage* aPage, uint aItemSize)
/// Byte pointer to the start of the block.
public static byte* Alloc(ushort aSize)
{
- var pageBlock = GetFirstWithSpace(aSize);
+ SMTBlock* pageBlock = GetFirstWithSpace(aSize);
if (pageBlock == null) // This happens when the page is full and we need to allocate a new page for this size
{
- CreatePage(GetLastPage(), GetRoundedSize(aSize));
+ CreatePage(SMT, GetRoundedSize(aSize)); // CreatePage will try add this page to any page of the SMT until it finds one with space
pageBlock = GetFirstWithSpace(aSize);
if (pageBlock == null)
{
@@ -409,9 +399,9 @@ static void CreatePage(SMTPage* aPage, uint aItemSize)
}
//now find position in the block
- var page = (ushort*)pageBlock->PagePtr;
- var elementSize = GetRoundedSize(aSize) + PrefixItemBytes;
- var positions = RAT.PageSize / elementSize;
+ ushort* page = (ushort*)pageBlock->PagePtr;
+ uint elementSize = GetRoundedSize(aSize) + PrefixItemBytes;
+ uint positions = RAT.PageSize / elementSize;
for (int i = 0; i < positions; i++)
{
if (page[i * elementSize / 2] == 0)
@@ -422,7 +412,7 @@ static void CreatePage(SMTPage* aPage, uint aItemSize)
pageBlock->SpacesLeft--;
// set info in page
- var heapObject = &page[i * elementSize / 2];
+ ushort* heapObject = &page[i * elementSize / 2];
heapObject[0] = aSize; // size of actual object being allocated
heapObject[1] = 0; // gc status starts as 0
@@ -444,7 +434,7 @@ static void CreatePage(SMTPage* aPage, uint aItemSize)
/// A pointer to the start object.
public static void Free(void* aPtr)
{
- var heapObject = (ushort*)aPtr;
+ ushort* heapObject = (ushort*)aPtr;
ushort size = heapObject[-2];
if (size == 0)
{
@@ -454,7 +444,7 @@ public static void Free(void* aPtr)
Debugger.SendKernelPanic(0x99);
}
- var allocated = (uint*)aPtr;
+ uint* allocated = (uint*)aPtr;
allocated[-1] = 0; // zero both size and gc status at once
// now zero the object so its ready for next allocation
@@ -462,7 +452,7 @@ public static void Free(void* aPtr)
{
size = 4;
}
- var bytes = size / 4;
+ int bytes = size / 4;
if (size % 4 != 0)
{
bytes += 1;
@@ -473,32 +463,30 @@ public static void Free(void* aPtr)
}
// need to increase count in SMT again
- var allocatedOnPage = RAT.GetPagePtr(aPtr);
- var smtPage = SMT;
+ // todo: store this info somewhere so this can be done in constant time
+ byte* allocatedOnPage = RAT.GetPagePtr(aPtr);
+ SMTPage* smtPage = SMT;
SMTBlock* blockPtr = null;
while (smtPage != null)
{
blockPtr = GetFirstBlock(smtPage, size)->First;
- while (blockPtr != null && blockPtr->PagePtr != allocatedOnPage)
+ while (blockPtr != null)
{
+ if(blockPtr->PagePtr == allocatedOnPage)
+ {
+ blockPtr->SpacesLeft++;
+ return;
+ }
blockPtr = blockPtr->NextBlock;
}
- if(blockPtr->PagePtr == allocatedOnPage)
- {
- break;
- }
smtPage = smtPage->Next;
}
- if (blockPtr == null)
- {
- // this shouldnt happen
- Debugger.DoSendNumber((uint)aPtr);
- Debugger.DoSendNumber((uint)SMT);
- Debugger.SendKernelPanic(0x98);
- while (true) { }
- }
- blockPtr->SpacesLeft++;
+ // this shouldnt happen
+ Debugger.DoSendNumber((uint)aPtr);
+ Debugger.DoSendNumber((uint)SMT);
+ Debugger.SendKernelPanic(0x98);
+ while (true) { }
}
#region Statistics
@@ -542,8 +530,8 @@ private static int GetAllocatedObjectCount(SMTPage* aPage)
///
private static int GetAllocatedObjectCount(SMTPage* aPage, uint aSize)
{
- var root = GetFirstBlock(aPage, aSize);
- var ptr = root->First;
+ RootSMTBlock* root = GetFirstBlock(aPage, aSize);
+ SMTBlock* ptr = root->First;
uint size = root->Size;
int count = 0;
diff --git a/source/Cosmos.Core/Memory/RAT.cs b/source/Cosmos.Core/Memory/RAT.cs
index b62c8c3a8f..6ef9aa830c 100644
--- a/source/Cosmos.Core/Memory/RAT.cs
+++ b/source/Cosmos.Core/Memory/RAT.cs
@@ -21,7 +21,7 @@ unsafe static public class RAT
///
/// PageType enum. Used to define the type of the page.
///
- public enum PageType
+ public enum PageType : byte
{
///
/// Empty page.
@@ -171,7 +171,7 @@ public static uint GetPageCount(byte aType = 0)
}
else if (xCounting)
{
- if (*p == (byte)PageType.Extension)
+ if (*p == (byte)PageType.Extension || *p == aType)
{
xResult++;
}
diff --git a/source/Cosmos.Core/Multiboot.cs b/source/Cosmos.Core/Multiboot.cs
deleted file mode 100644
index f59fdd663d..0000000000
--- a/source/Cosmos.Core/Multiboot.cs
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
-* PROJECT: Cosmos Development
-* CONTENT: Multiboot2 class
-* PROGRAMMERS: Valentin Charbonnier
-* RESOURCES: https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html
-*/
-
-using IL2CPU.API.Attribs;
-using System;
-using System.Runtime.InteropServices;
-
-namespace Cosmos.Core
-{
- ///
- /// Multiboot2 class. Used for multiboot parsing.
- ///
- public unsafe class Multiboot2
- {
- ///
- /// Base Tag
- ///
- [StructLayout(LayoutKind.Explicit, Size = 8)]
- internal unsafe readonly struct Mb2Tag
- {
- [FieldOffset(0)]
- public readonly uint Type;
- [FieldOffset(4)]
- public readonly uint Size;
- }
-
- ///
- /// Tag BasicMemoryInformation
- ///
- [StructLayout(LayoutKind.Explicit, Size = 16)]
- internal unsafe readonly struct Mb2TagBasicMemoryInformation
- {
- [FieldOffset(0)]
- public readonly uint Type;
- [FieldOffset(4)]
- public readonly uint Size;
- [FieldOffset(8)]
- public readonly uint MemLower;
- [FieldOffset(12)]
- public readonly uint MemUpper;
- }
-
- ///
- /// Tag MemoryMap
- ///
- [StructLayout(LayoutKind.Explicit, Size = 40)]
- internal unsafe readonly struct Mb2TagMemoryMap
- {
- [FieldOffset(0)]
- public readonly uint Type;
- [FieldOffset(4)]
- public readonly uint Size;
- [FieldOffset(8)]
- public readonly uint EntrySize;
- [FieldOffset(12)]
- public readonly uint EntryVersion;
- [FieldOffset(16)]
- public readonly RawMemoryMapBlock MemoryMapEntries;
- }
-
- ///
- /// Tag Framebuffer
- ///
- [StructLayout(LayoutKind.Explicit, Size = 784)]
- internal unsafe readonly struct Mb2TagVbeInfo
- {
- [FieldOffset(0)]
- public readonly Mb2Tag Info;
- [FieldOffset(8)]
- public readonly ushort VbeMode;
- [FieldOffset(10)]
- public readonly ushort VbeInterfaceSeg;
- [FieldOffset(12)]
- public readonly ushort VbeInterfaceOff;
- [FieldOffset(14)]
- public readonly ushort VbeInterfaceLen;
- [FieldOffset(16)]
- public readonly VBE.ControllerInfo VbeControlInfo; //512
- [FieldOffset(528)]
- public readonly VBE.ModeInfo VbeModeInfo; //256
- }
-
- ///
- /// Tag Framebuffer
- ///
- [StructLayout(LayoutKind.Explicit, Size = 32)]
- internal unsafe readonly struct Mb2TagFramebuffer
- {
- [FieldOffset(0)]
- public readonly Mb2Tag Info;
- [FieldOffset(8)]
- public readonly ulong Address;
- [FieldOffset(16)]
- public readonly uint Pitch;
- [FieldOffset(20)]
- public readonly uint Width;
- [FieldOffset(24)]
- public readonly uint Height;
- [FieldOffset(28)]
- public readonly byte Bpp;
- [FieldOffset(29)]
- public readonly byte Type;
- [FieldOffset(30)]
- public readonly ushort Reserved;
- }
-
- ///
- /// Tag EFI64
- ///
- [StructLayout(LayoutKind.Explicit, Size = 16)]
- internal unsafe readonly struct Mb2TagEFI64
- {
- [FieldOffset(0)]
- public readonly Mb2Tag Info;
- [FieldOffset(8)]
- public readonly ulong Address;
- }
-
- internal static Mb2TagBasicMemoryInformation* BasicMemoryInformation { get; set; }
- internal static Mb2TagMemoryMap* MemoryMap { get; set; }
- internal static Mb2TagVbeInfo* VbeInfo { get; set; }
- internal static Mb2TagFramebuffer* Framebuffer { get; set; }
- internal static Mb2TagEFI64* EFI64 { get; set; }
-
- private static bool mInitialized = false;
-
- /// ///
- /// Parse multiboot2 structure
- ///
- public static void Init()
- {
- if (!mInitialized)
- {
- mInitialized = true;
-
- var MbAddress = (IntPtr)GetMBIAddress();
-
- Mb2Tag* tag;
-
- for (tag = (Mb2Tag*)(MbAddress + 8); tag->Type != 0; tag = (Mb2Tag*)((byte*)tag + ((tag->Size + 7) & ~7)))
- {
- switch (tag->Type)
- {
- case 4:
- BasicMemoryInformation = (Mb2TagBasicMemoryInformation*)tag;
- break;
- case 6:
- MemoryMap = (Mb2TagMemoryMap*)tag;
- break;
- case 7:
- VbeInfo = (Mb2TagVbeInfo*)tag;
- break;
- /*case 8:
- Framebuffer = (Mb2TagFramebuffer*)tag;
- break;
- case 12:
- EFI64 = (Mb2TagEFI64*)tag;
- break;*/
- default:
- break;
- }
- }
- }
- }
-
- ///
- /// Get MemLower
- ///
- /// MemLower
- public static uint GetMemLower()
- {
- return BasicMemoryInformation->MemLower;
- }
-
- ///
- /// Get MemUpper
- ///
- /// MemUpper
- public static uint GetMemUpper()
- {
- return BasicMemoryInformation->MemUpper;
- }
-
- ///
- /// Checks if Multiboot returned a memory map
- ///
- /// True if is available, false if not
- public static bool MemoryMapExists()
- {
- if (MemoryMap != null)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /// ///
- /// Get Multiboot address. Plugged.
- ///
- /// The Multiboot Address
- [PlugMethod(PlugRequired = true)]
- public static uint GetMBIAddress() => throw null;
- }
-
- ///
- /// VBE class.
- ///
- public unsafe static class VBE
- {
- /// ///
- /// Check in Multiboot if framebuffer is available
- ///
- /// True if is available, false if not
- public static bool IsAvailable()
- {
- if (Multiboot2.VbeInfo != null)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /// ///
- /// Get VBE Modeinfo structure
- ///
- public static ModeInfo getModeInfo()
- {
- return Multiboot2.VbeInfo->VbeModeInfo;
- }
-
- /// ///
- /// Get VBE Modeinfo structure
- ///
- public static ControllerInfo getControllerInfo()
- {
- return Multiboot2.VbeInfo->VbeControlInfo;
- }
-
- /// ///
- /// Get the linear frame buffer address from VBE ModeInfo structure
- ///
- /// the offset in an uint
- public static uint getLfbOffset()
- {
- return getModeInfo().framebuffer;
- }
-
- ///
- /// Controller info struct.
- ///
- [StructLayout(LayoutKind.Explicit, Size = 512)]
- public struct ControllerInfo
- {
- ///
- /// VBE signature.
- ///
- [FieldOffset(0)]
- public uint vbeSignature;
- ///
- /// VBE version.
- ///
- [FieldOffset(4)]
- public ushort vbeVersion;
- ///
- /// OEM string pointer.
- ///
- [FieldOffset(6)]
- public uint oemStringPtr;
- ///
- /// Capabilities.
- ///
- [FieldOffset(10)]
- public uint capabilities;
- ///
- /// Video mode pointer.
- ///
- [FieldOffset(14)]
- public uint videoModePtr;
- ///
- /// Total memory.
- ///
- [FieldOffset(18)]
- public ushort totalmemory;
- ///
- /// OEM software revision.
- ///
- [FieldOffset(20)]
- public ushort oemSoftwareRev;
- ///
- /// OEM vendor name pointer.
- ///
- [FieldOffset(24)]
- public uint oemVendorNamePtr;
- ///
- /// OEM product name pointer.
- ///
- [FieldOffset(28)]
- public uint oemProductNamePtr;
- ///
- /// OEM product revision pointer.
- ///
- [FieldOffset(32)]
- public uint oemProductRevPtr;
- }
-
- ///
- /// Mode info struct.
- ///
- [StructLayout(LayoutKind.Explicit, Size = 256)]
- public struct ModeInfo
- {
- ///
- /// Attributes.
- ///
- /// Deprecated.
- [FieldOffset(0)]
- public ushort attributes; // deprecated, only bit 7 should be of interest to you, and it indicates the mode supports a linear frame buffer.
- ///
- /// Window A.
- ///
- /// Deprecated.
- [FieldOffset(2)]
- public byte window_a; // deprecated
- ///
- /// Window B.
- ///
- /// Deprecated.
- [FieldOffset(3)]
- public byte window_b; // deprecated
- ///
- /// Granularity
- ///
- /// Deprecated.
- [FieldOffset(4)]
- public ushort granularity; // deprecated; used while calculating bank numbers
- ///
- /// Window size.
- ///
- [FieldOffset(6)]
- public ushort window_size;
- ///
- /// Segment A.
- ///
- [FieldOffset(8)]
- public ushort segment_a;
- ///
- /// Segment B.
- ///
- [FieldOffset(10)]
- public ushort segment_b;
- ///
- /// Window function pointer.
- ///
- /// Deprecated.
- [FieldOffset(12)]
- public uint win_func_ptr; // deprecated; used to switch banks from protected mode without returning to real mode
- ///
- /// Pitch - number of bytes per horizontal line.
- ///
- [FieldOffset(16)]
- public ushort pitch; // number of bytes per horizontal line
- ///
- /// Width. (in pixels)
- ///
- [FieldOffset(18)]
- public ushort width; // width in pixels
- ///
- /// Height. (in pixels)
- ///
- [FieldOffset(20)]
- public ushort height; // height in pixels
- ///
- /// W char.
- ///
- /// Unused.
- [FieldOffset(22)]
- public byte w_char; // unused...
- ///
- /// Y char.
- ///
- /// Unused.
- [FieldOffset(23)]
- public byte y_char; // ...
- ///
- /// Planes.
- ///
- [FieldOffset(24)]
- public byte planes;
- ///
- /// Bits per pixel.
- ///
- [FieldOffset(25)]
- public byte bpp; // bits per pixel in this mode
- ///
- /// Banks.
- ///
- /// Deprecated.
- [FieldOffset(26)]
- public byte banks; // deprecated; total number of banks in this mode
- ///
- /// Memory model.
- ///
- [FieldOffset(27)]
- public byte memory_model;
- ///
- /// Bank size.
- ///
- /// Deprecated.
- [FieldOffset(28)]
- public byte bank_size; // deprecated; size of a bank, almost always 64 KB but may be 16 KB...
- ///
- /// Image pages.
- ///
- [FieldOffset(29)]
- public byte image_pages;
- ///
- /// Reserved.
- ///
- [FieldOffset(30)]
- public byte reserved0;
- ///
- /// Red mask.
- ///
- [FieldOffset(31)]
- public byte red_mask;
- ///
- /// Red position.
- ///
- [FieldOffset(32)]
- public byte red_position;
- ///
- /// Green mask.
- ///
- [FieldOffset(33)]
- public byte green_mask;
- ///
- /// Green position.
- ///
- [FieldOffset(34)]
- public byte green_position;
- ///
- /// Blue mask.
- ///
- [FieldOffset(35)]
- public byte blue_mask;
- ///
- /// Blue position.
- ///
- [FieldOffset(36)]
- public byte blue_position;
- ///
- /// Reserved mask.
- ///
- [FieldOffset(37)]
- public byte reserved_mask;
- ///
- /// Reserved position.
- ///
- [FieldOffset(38)]
- public byte reserved_position;
- ///
- /// Direct color attributes.
- ///
- [FieldOffset(39)]
- public byte direct_color_attributes;
- ///
- /// Frame buffer.
- ///
- [FieldOffset(40)]
- public uint framebuffer; // physical address of the linear frame buffer; write here to draw to the screen
- ///
- /// Off screen memory offset.
- ///
- [FieldOffset(44)]
- public uint off_screen_mem_off;
- ///
- /// Off screen memory size.
- ///
- [FieldOffset(48)]
- public ushort off_screen_mem_size; // size of memory in the framebuffer but not being displayed on the screen
- ///
- /// Reserved.
- ///
- [FieldOffset(50)]
- public fixed byte reserved1[206];
- }
- }
-}
diff --git a/source/Cosmos.Core/Multiboot/Multiboot2.cs b/source/Cosmos.Core/Multiboot/Multiboot2.cs
new file mode 100644
index 0000000000..421ae5fd45
--- /dev/null
+++ b/source/Cosmos.Core/Multiboot/Multiboot2.cs
@@ -0,0 +1,109 @@
+/*
+* PROJECT: Cosmos Development
+* CONTENT: Multiboot2 class
+* PROGRAMMERS: Valentin Charbonnier
+* RESOURCES: https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html
+*/
+
+using Cosmos.Core.Multiboot.Tags;
+using IL2CPU.API.Attribs;
+
+namespace Cosmos.Core.Multiboot
+{
+ ///
+ /// Multiboot2 class. Used for multiboot parsing.
+ ///
+ public unsafe class Multiboot2
+ {
+ #region Properties
+
+ public static BasicMemoryInformation* BasicMemoryInformation { get; set; }
+ public static bool IsVBEAvailable => Framebuffer->Address != 753664; // Some kinda default number.
+ public static Framebuffer* Framebuffer { get; set; }
+ public static MemoryMap* MemoryMap { get; set; }
+ public static EFI64* EFI64 { get; set; }
+
+ #endregion
+
+ #region Methods
+
+ /// ///
+ /// Parse multiboot2 structure
+ ///
+ public static void Init()
+ {
+ if (!isInitialized)
+ {
+ isInitialized = true;
+
+ uint MbAddress = GetMBIAddress();
+
+ MB2Tag* Tag;
+
+ for (Tag = (MB2Tag*)(MbAddress + 8); Tag->Type != 0; Tag = (MB2Tag*)((byte*)Tag + (Tag->Size + 7 & ~7)))
+ {
+ switch (Tag->Type)
+ {
+ case 4:
+ BasicMemoryInformation = (BasicMemoryInformation*)Tag;
+ break;
+ case 6:
+ MemoryMap = (MemoryMap*)Tag;
+ break;
+ case 7:
+ // Ignore because we use Framebuffer tags now :)
+ //VBEInfo = (VBEInfo*)Tag;
+ break;
+ case 8:
+ Framebuffer = (Framebuffer*)Tag;
+ break;
+ case 12:
+ EFI64 = (EFI64*)Tag;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ ///
+ /// Get MemLower
+ ///
+ /// MemLower
+ public static uint GetMemLower()
+ {
+ return BasicMemoryInformation->MemLower;
+ }
+
+ ///
+ /// Get MemUpper
+ ///
+ /// MemUpper
+ public static uint GetMemUpper()
+ {
+ return BasicMemoryInformation->MemUpper;
+ }
+
+ ///
+ /// Checks if Multiboot returned a memory map
+ ///
+ /// True if is available, false if not
+ public static bool MemoryMapExists() => MemoryMap != null;
+
+ /// ///
+ /// Get Multiboot address. Plugged.
+ ///
+ /// The Multiboot Address
+ [PlugMethod(PlugRequired = true)]
+ public static uint GetMBIAddress() => throw null;
+
+ #endregion
+
+ #region Fields
+
+ private static bool isInitialized = false;
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/Multiboot/Tags/BasicMemoryInformation.cs b/source/Cosmos.Core/Multiboot/Tags/BasicMemoryInformation.cs
new file mode 100644
index 0000000000..3ea8c5515f
--- /dev/null
+++ b/source/Cosmos.Core/Multiboot/Tags/BasicMemoryInformation.cs
@@ -0,0 +1,20 @@
+using System.Runtime.InteropServices;
+
+namespace Cosmos.Core.Multiboot.Tags
+{
+ ///
+ /// Tag BasicMemoryInformation
+ ///
+ [StructLayout(LayoutKind.Explicit, Size = 16)]
+ public unsafe readonly struct BasicMemoryInformation
+ {
+ [FieldOffset(0)]
+ public readonly uint Type;
+ [FieldOffset(4)]
+ public readonly uint Size;
+ [FieldOffset(8)]
+ public readonly uint MemLower;
+ [FieldOffset(12)]
+ public readonly uint MemUpper;
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/Multiboot/Tags/EFI64.cs b/source/Cosmos.Core/Multiboot/Tags/EFI64.cs
new file mode 100644
index 0000000000..b7650ac21c
--- /dev/null
+++ b/source/Cosmos.Core/Multiboot/Tags/EFI64.cs
@@ -0,0 +1,16 @@
+using System.Runtime.InteropServices;
+
+namespace Cosmos.Core.Multiboot.Tags
+{
+ ///
+ /// Tag EFI64
+ ///
+ [StructLayout(LayoutKind.Explicit, Size = 16)]
+ public unsafe readonly struct EFI64
+ {
+ [FieldOffset(0)]
+ public readonly MB2Tag Info;
+ [FieldOffset(8)]
+ public readonly ulong Address;
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/Multiboot/Tags/Framebuffer.cs b/source/Cosmos.Core/Multiboot/Tags/Framebuffer.cs
new file mode 100644
index 0000000000..182c0fd10c
--- /dev/null
+++ b/source/Cosmos.Core/Multiboot/Tags/Framebuffer.cs
@@ -0,0 +1,59 @@
+using System.Runtime.InteropServices;
+
+namespace Cosmos.Core.Multiboot.Tags
+{
+ ///
+ /// Tag Framebuffer
+ ///
+ [StructLayout(LayoutKind.Explicit, Size = 32)]
+ public unsafe readonly struct Framebuffer
+ {
+ ///
+ /// Information about the tag.
+ ///
+ [FieldOffset(0)]
+ public readonly MB2Tag Info;
+
+ ///
+ /// The video address for the frame buffer.
+ ///
+ [FieldOffset(8)]
+ public readonly ulong Address;
+
+ ///
+ /// The pitch value of the frame buffer.
+ ///
+ [FieldOffset(16)]
+ public readonly uint Pitch;
+
+ ///
+ /// The width value (in pixels) of the frame buffer
+ ///
+ [FieldOffset(20)]
+ public readonly uint Width;
+
+ ///
+ /// The height value (in pixels) of the frame buffer
+ ///
+ [FieldOffset(24)]
+ public readonly uint Height;
+
+ ///
+ /// The BPP (bits per pixel) of the frame buffer. E.g. 32-bit colors are 4 BPP.
+ ///
+ [FieldOffset(28)]
+ public readonly byte Bpp;
+
+ ///
+ /// The type of frame buffer.
+ ///
+ [FieldOffset(29)]
+ public readonly byte Type;
+
+ ///
+ /// Reserved.
+ ///
+ [FieldOffset(30)]
+ public readonly ushort Reserved;
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/Multiboot/Tags/MB2Tag.cs b/source/Cosmos.Core/Multiboot/Tags/MB2Tag.cs
new file mode 100644
index 0000000000..cca2fa89d5
--- /dev/null
+++ b/source/Cosmos.Core/Multiboot/Tags/MB2Tag.cs
@@ -0,0 +1,16 @@
+using System.Runtime.InteropServices;
+
+namespace Cosmos.Core.Multiboot.Tags
+{
+ ///
+ /// Base Tag
+ ///
+ [StructLayout(LayoutKind.Explicit, Size = 8)]
+ public unsafe readonly struct MB2Tag
+ {
+ [FieldOffset(0)]
+ public readonly uint Type;
+ [FieldOffset(4)]
+ public readonly uint Size;
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/Multiboot/Tags/MemoryMap.cs b/source/Cosmos.Core/Multiboot/Tags/MemoryMap.cs
new file mode 100644
index 0000000000..63159046db
--- /dev/null
+++ b/source/Cosmos.Core/Multiboot/Tags/MemoryMap.cs
@@ -0,0 +1,22 @@
+using System.Runtime.InteropServices;
+
+namespace Cosmos.Core.Multiboot.Tags
+{
+ ///
+ /// Tag MemoryMap
+ ///
+ [StructLayout(LayoutKind.Explicit, Size = 40)]
+ public unsafe readonly struct MemoryMap
+ {
+ [FieldOffset(0)]
+ public readonly uint Type;
+ [FieldOffset(4)]
+ public readonly uint Size;
+ [FieldOffset(8)]
+ public readonly uint EntrySize;
+ [FieldOffset(12)]
+ public readonly uint EntryVersion;
+ [FieldOffset(16)]
+ public readonly RawMemoryMapBlock MemoryMapEntries;
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/VTablesImpl.Debug.cs b/source/Cosmos.Core/VTablesImpl.Debug.cs
index 0161497c19..fbd3a28f7c 100644
--- a/source/Cosmos.Core/VTablesImpl.Debug.cs
+++ b/source/Cosmos.Core/VTablesImpl.Debug.cs
@@ -1,16 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Cosmos.Debug.Kernel;
+using Cosmos.Debug.Kernel;
namespace Cosmos.Core
{
partial class VTablesImpl
{
+ private static Debugger debugger = new("VTablesImpl");
public static bool EnableDebug = false;
- private static Debugger mDebugger = new Debugger("IL2CPU", "VTablesImpl");
private static void Debug(string message)
{
@@ -18,7 +13,7 @@ private static void Debug(string message)
{
return;
}
- mDebugger.Send(message);
+ debugger.Send(message);
}
private static void DebugHex(string message, uint value)
@@ -27,17 +22,17 @@ private static void DebugHex(string message, uint value)
{
return;
}
- mDebugger.Send(message);
- mDebugger.SendNumber(value);
+
+ debugger.Send(message);
+ debugger.SendNumber(value);
}
private static void DebugAndHalt(string message)
{
Debug(message);
- while (true)
- ;
+ while (true) ;
//Debugger.DoRealHalt();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core/VTablesImpl.cs b/source/Cosmos.Core/VTablesImpl.cs
index 6bb6fae503..e18833f923 100644
--- a/source/Cosmos.Core/VTablesImpl.cs
+++ b/source/Cosmos.Core/VTablesImpl.cs
@@ -298,6 +298,7 @@ public static uint GetMethodAddressForInterfaceType(uint aType, uint aInterfaceM
EnableDebug = true;
DebugHex("Type", aType);
+ Debug("TypeName: " + xTypeInfo.AssemblyQualifiedName);
DebugHex("InterfaceMethodId", aInterfaceMethodId);
Debug("Not FOUND!");
diff --git a/source/Cosmos.Core_Asm/MultibootImpl.cs b/source/Cosmos.Core_Asm/MultibootImpl.cs
index 8252c000a4..f2d191d191 100644
--- a/source/Cosmos.Core_Asm/MultibootImpl.cs
+++ b/source/Cosmos.Core_Asm/MultibootImpl.cs
@@ -1,4 +1,4 @@
-using Cosmos.Core;
+using Cosmos.Core.Multiboot;
using IL2CPU.API.Attribs;
using XSharp;
using XSharp.Assembler;
diff --git a/source/Cosmos.Core_Plugs/.editorconfig b/source/Cosmos.Core_Plugs/.editorconfig
deleted file mode 100644
index 03f2482ae5..0000000000
--- a/source/Cosmos.Core_Plugs/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.cs]
-indent_size = 4
diff --git a/source/Cosmos.Core_Plugs/MemoryOperations/MemoryOperationsImpl.cs b/source/Cosmos.Core_Plugs/MemoryOperationsImpl.cs
similarity index 96%
rename from source/Cosmos.Core_Plugs/MemoryOperations/MemoryOperationsImpl.cs
rename to source/Cosmos.Core_Plugs/MemoryOperationsImpl.cs
index d3e49594b5..5a547ed200 100644
--- a/source/Cosmos.Core_Plugs/MemoryOperations/MemoryOperationsImpl.cs
+++ b/source/Cosmos.Core_Plugs/MemoryOperationsImpl.cs
@@ -1,4 +1,3 @@
-//#define COSMOSDEBUG
using System;
using Cosmos.Core;
@@ -6,9 +5,9 @@
using IL2CPU.API.Attribs;
-namespace Cosmos.Core_Plugs.MemoryOperations
+namespace Cosmos.Core_Plugs
{
- [Plug(Target = typeof(Cosmos.Core.MemoryOperations))]
+ [Plug(Target = typeof(MemoryOperations))]
public static unsafe class MemoryOperationsImpl
{
[PlugMethod(Assembler = typeof(MemoryOperationsFill16BlocksAsm))]
@@ -187,7 +186,7 @@ unsafe private static void CopyTiny(byte* dest, byte* src, int size)
{
/* We do copy in reverse */
byte* dd = dest + size;
- byte* ss = src + size;
+ byte* ss = src + size;
switch (size)
{
@@ -741,26 +740,21 @@ unsafe private static void CopyTiny(byte* dest, byte* src, int size)
unsafe public static void Copy(byte* dest, byte* src, int size)
{
- Global.mDebugger.SendInternal("Copying array of size " + size + " ...");
+ Global.debugger.SendInternal("Copying array of size " + size + " ...");
if (size < 129)
{
- Global.mDebugger.SendInternal("Size less than 129 bytes Calling CopyTiny...");
+ Global.debugger.SendInternal("Size less than 129 bytes Calling CopyTiny...");
CopyTiny(dest, src, size);
- Global.mDebugger.SendInternal("CopyTiny returned");
+ Global.debugger.SendInternal("CopyTiny returned");
return;
}
- int xByteRemaining;
const int xBlockSize = 128;
-#if NETSTANDARD1_5
- xBlocksNum = size / xBlockSize;
- xByteRemaining = size % xBlockSize;
-#else
- var xBlocksNum = Math.DivRem(size, xBlockSize, out xByteRemaining);
-#endif
- Global.mDebugger.SendInternal($"size {size} is composed of {xBlocksNum} blocks of {xBlockSize} bytes with {xByteRemaining} remainder");
+ var xBlocksNum = Math.DivRem(size, xBlockSize, out int xByteRemaining);
+
+ Global.debugger.SendInternal($"size {size} is composed of {xBlocksNum} blocks of {xBlockSize} bytes with {xByteRemaining} remainder");
// TODO call Copy128Blocks()
for (int i = 0; i < xByteRemaining; i++)
@@ -768,10 +762,10 @@ unsafe public static void Copy(byte* dest, byte* src, int size)
*(dest + i) = *(src + i);
}
- Global.mDebugger.SendInternal("Calling Copy128Blocks...");
+ Global.debugger.SendInternal("Calling Copy128Blocks...");
/* Let's call the assembler version now to do the 128 byte block copies */
Copy128Blocks(dest + xByteRemaining, src + xByteRemaining, xBlocksNum);
- Global.mDebugger.SendInternal("Copy128Blocks returned");
+ Global.debugger.SendInternal("Copy128Blocks returned");
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/ReadMe.html b/source/Cosmos.Core_Plugs/ReadMe.html
deleted file mode 100644
index 2ba4460a4a..0000000000
--- a/source/Cosmos.Core_Plugs/ReadMe.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
- Contains assembly code. Maybe this later can be merged directly into the main
- asm since it only exists to fill in assembly code?
-
-
-
diff --git a/source/Cosmos.Core_Plugs/System/ArrayImpl.cs b/source/Cosmos.Core_Plugs/System/ArrayImpl.cs
index 846bba9d31..290fa494d2 100644
--- a/source/Cosmos.Core_Plugs/System/ArrayImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/ArrayImpl.cs
@@ -1,6 +1,5 @@
using System;
using Cosmos.Core;
-using Cosmos.Debug.Kernel;
using IL2CPU.API;
using IL2CPU.API.Attribs;
@@ -154,4 +153,4 @@ public static Array CreateInstance(Type type, int size)
return GCImpl.CreateNewArray((int)VTablesImpl.GetSize(((CosmosRuntimeType)type).mTypeId), size);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/BufferImpl.cs b/source/Cosmos.Core_Plugs/System/BufferImpl.cs
index db2252ede0..4fe5d2922b 100644
--- a/source/Cosmos.Core_Plugs/System/BufferImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/BufferImpl.cs
@@ -1,4 +1,3 @@
-//#define COSMOSDEBUG
using System;
using Cosmos.Core;
using Cosmos.Debug.Kernel;
@@ -9,7 +8,7 @@ namespace Cosmos.Core_Plugs.System
[Plug(Target = typeof(Buffer))]
public class BufferImpl
{
- static Debugger mDebugger = new Debugger("Plug", "Buffer");
+ static Debugger mDebugger = new (nameof(Buffer));
///
/// The memmove() function copies n bytes from memory area src to memory area dest.
/// The memory areas may overlap: copying takes place as though the bytes in src
@@ -22,7 +21,7 @@ public class BufferImpl
[PlugMethod(IsOptional = true, Signature = "System_Void__System_Buffer___Memmove_System_Byte___System_Byte___System_UIntPtr_")]
public static unsafe void __Memmove(byte* aDest, byte* aSrc, uint aCount)
{
- MemoryOperations.MemoryOperationsImpl.Copy(aDest, aSrc, (int)aCount);
+ MemoryOperationsImpl.Copy(aDest, aSrc, (int)aCount);
}
///
@@ -61,4 +60,4 @@ public static unsafe void __ZeroMemory(void* aPtr, UIntPtr aLength)
CPU.ZeroFill((uint)aPtr, *(uint*)aLength.ToPointer());
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/CharUnicodeInfoImpl.cs b/source/Cosmos.Core_Plugs/System/CharUnicodeInfoImpl.cs
index f20e162508..342f970242 100644
--- a/source/Cosmos.Core_Plugs/System/CharUnicodeInfoImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/CharUnicodeInfoImpl.cs
@@ -1,8 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System
@@ -15,4 +10,4 @@ public static void Cctor()
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/Collections/Generic/ComparerHelpersImpl.cs b/source/Cosmos.Core_Plugs/System/Collections/Generic/ComparerHelpersImpl.cs
index e1107ba8dd..b6edbc8195 100644
--- a/source/Cosmos.Core_Plugs/System/Collections/Generic/ComparerHelpersImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/Collections/Generic/ComparerHelpersImpl.cs
@@ -8,7 +8,7 @@ namespace Cosmos.Core_Plugs.System.Collections.Generic
[Plug("System.Collections.Generic.ComparerHelpers, System.Private.CoreLib")]
public static class ComparerHelpersImpl
{
- private static readonly Debugger mDebugger = new Debugger("Core", "ComparerHelpersImpl");
+ private static readonly Debugger mDebugger = new("ComparerHelpersImpl");
public static object CreateDefaultComparer(Type aType)
{
diff --git a/source/Cosmos.Core_Plugs/System/DelegateImpl.cs b/source/Cosmos.Core_Plugs/System/DelegateImpl.cs
index 3ae3732285..bb4e48e2af 100644
--- a/source/Cosmos.Core_Plugs/System/DelegateImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/DelegateImpl.cs
@@ -61,4 +61,4 @@ public static bool Equals(Delegate aThis, object aThat)
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/EnvironmentImpl.cs b/source/Cosmos.Core_Plugs/System/EnvironmentImpl.cs
index 4e0c1825f0..3cb42eeef6 100644
--- a/source/Cosmos.Core_Plugs/System/EnvironmentImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/EnvironmentImpl.cs
@@ -1,6 +1,5 @@
-using System;
-
using IL2CPU.API.Attribs;
+using System;
namespace Cosmos.Core_Plugs.System
{
@@ -54,4 +53,4 @@ public static void CCtor()
{
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/EventHandlerImpl.cs b/source/Cosmos.Core_Plugs/System/EventHandlerImpl.cs
index cafeed5d34..07b2610093 100644
--- a/source/Cosmos.Core_Plugs/System/EventHandlerImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/EventHandlerImpl.cs
@@ -1,5 +1,4 @@
using System;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System {
@@ -16,4 +15,4 @@ public static bool Equals(EventHandler aThis, object aThat) {
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/ExceptionImpl.cs b/source/Cosmos.Core_Plugs/System/ExceptionImpl.cs
index 64662a6102..cb84800d4d 100644
--- a/source/Cosmos.Core_Plugs/System/ExceptionImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/ExceptionImpl.cs
@@ -61,4 +61,4 @@ public static void GetStackTracesDeepCopy(Exception aException, ref byte[] aByte
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/GCImpl.cs b/source/Cosmos.Core_Plugs/System/GCImpl.cs
index e24152e5e1..f33f30a0c3 100644
--- a/source/Cosmos.Core_Plugs/System/GCImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/GCImpl.cs
@@ -19,7 +19,7 @@ public static unsafe Array AllocateNewArray(int* aTypeHandle, int aLength, uint
{
if (aGCFlags != 0 && aGCFlags != 16) // 16 means that zeroing is optional
{
- var debugger = new Debugger("Plug", "GC");
+ Debugger debugger = new("GC");
debugger.Send($"-- AllocateNewArray -- Invalid aGCFlags: {aGCFlags}");
Debugger.DoBochsBreak();
throw new NotImplementedException();
@@ -39,4 +39,4 @@ public static void _ReRegisterForFinalize(object aObject)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/MarvinImpl.cs b/source/Cosmos.Core_Plugs/System/MarvinImpl.cs
index 9e7fa38dd8..4d64343e79 100644
--- a/source/Cosmos.Core_Plugs/System/MarvinImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/MarvinImpl.cs
@@ -1,6 +1,5 @@
-using System;
-
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
+using System;
namespace Cosmos.Core_Plugs.System
{
@@ -18,4 +17,4 @@ public static ulong GenerateSeed()
return BitConverter.ToUInt64(buffer, 0);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/MathFImpl.cs b/source/Cosmos.Core_Plugs/System/MathFImpl.cs
new file mode 100644
index 0000000000..2c89bf8f55
--- /dev/null
+++ b/source/Cosmos.Core_Plugs/System/MathFImpl.cs
@@ -0,0 +1,19 @@
+using IL2CPU.API.Attribs;
+using System;
+
+namespace Cosmos.Core_Plugs
+{
+ // Temporary implementations, inneficent. Should use proper methods eventually.
+ // See: https://linasm.sourceforge.net/docs/instructions/fpu.php
+ [Plug(Target = typeof(MathF))]
+ public static class MathFImpl
+ {
+ public static float Sqrt(float d) => (float)Math.Sqrt(d);
+
+ public static float Tan(float x) => (float)Math.Tan(x);
+
+ public static float Sin(float a) => (float)Math.Sin(a);
+
+ public static float Cos(float d) => (float)Math.Cos(d);
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/MathImpl.cs b/source/Cosmos.Core_Plugs/System/MathImpl.cs
similarity index 97%
rename from source/Cosmos.Core_Plugs/MathImpl.cs
rename to source/Cosmos.Core_Plugs/System/MathImpl.cs
index 74e38969ff..d7710ea864 100644
--- a/source/Cosmos.Core_Plugs/MathImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/MathImpl.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using IL2CPU.API.Attribs;
using XSharp;
using XSharp.Assembler;
diff --git a/source/Cosmos.Core_Plugs/System/MulticastDelegateImpl.cs b/source/Cosmos.Core_Plugs/System/MulticastDelegateImpl.cs
index f191d079e6..f10bcca42d 100644
--- a/source/Cosmos.Core_Plugs/System/MulticastDelegateImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/MulticastDelegateImpl.cs
@@ -12,4 +12,4 @@ public static bool Equals(MulticastDelegate aThis, object aThat)
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/ObjectImpl.cs b/source/Cosmos.Core_Plugs/System/ObjectImpl.cs
index a533d1f62c..80d4847728 100644
--- a/source/Cosmos.Core_Plugs/System/ObjectImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/ObjectImpl.cs
@@ -9,12 +9,11 @@ namespace Cosmos.Core_Plugs.System
[Plug(Target = typeof(object))]
public static class ObjectImpl
{
- private static Debugger mDebugger = new Debugger("IL2CPU", "ObjectImpl");
+ private static Debugger mDebugger = new("ObjectImpl");
public static string ToString(object aThis)
{
- mDebugger.Send("");
- return "";
+ return aThis.GetType().Name;
}
public static void Ctor(object aThis)
diff --git a/source/Cosmos.Core_Plugs/System/OutOfMemoryExceptionImpl.cs b/source/Cosmos.Core_Plugs/System/OutOfMemoryExceptionImpl.cs
index 6d60f25dfa..284fac56f9 100644
--- a/source/Cosmos.Core_Plugs/System/OutOfMemoryExceptionImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/OutOfMemoryExceptionImpl.cs
@@ -1,5 +1,4 @@
using System;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System {
@@ -9,4 +8,4 @@ public static void Ctor(OutOfMemoryException aThis) {
//
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/Runtime/InteropServices/NativeMemoryImpl.cs b/source/Cosmos.Core_Plugs/System/Runtime/InteropServices/NativeMemoryImpl.cs
index 2ea6eeb419..a66b6c72b6 100644
--- a/source/Cosmos.Core_Plugs/System/Runtime/InteropServices/NativeMemoryImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/Runtime/InteropServices/NativeMemoryImpl.cs
@@ -2,10 +2,10 @@
using Cosmos.Core.Memory;
using Cosmos.Core;
-namespace System.Runtime.InteropServices
+namespace Cosmos.Core_Plugs.System.Runtime.InteropServices
{
[Plug("System.Runtime.InteropServices.NativeMemory, System.Private.CoreLib")]
- public static unsafe class NativeMemory
+ public static unsafe class NativeMemoryImpl
{
public static void* Realloc(void* ptr, nuint byteCount)
{
diff --git a/source/Cosmos.Core_Plugs/System/RuntimeMethodHandleImpl.cs b/source/Cosmos.Core_Plugs/System/RuntimeMethodHandleImpl.cs
index ec39e1f756..4feb7b024a 100644
--- a/source/Cosmos.Core_Plugs/System/RuntimeMethodHandleImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/RuntimeMethodHandleImpl.cs
@@ -1,10 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using IL2CPU.API.Attribs;
using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using System;
namespace Cosmos.Core_Plugs.System
{
@@ -89,4 +85,4 @@ public static bool IsCAVisibleFromDecoratedType(object aQCallTypeHandle, object
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/RuntimeType.RuntimeTypeCache.cs b/source/Cosmos.Core_Plugs/System/RuntimeType.RuntimeTypeCache.cs
index 32a2e35d65..c25125fc15 100644
--- a/source/Cosmos.Core_Plugs/System/RuntimeType.RuntimeTypeCache.cs
+++ b/source/Cosmos.Core_Plugs/System/RuntimeType.RuntimeTypeCache.cs
@@ -7,4 +7,4 @@ public static class RuntimeType_RuntimeTypeCache {
// return "**Reflection is not yet supported**";
//}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/RuntimeTypeHandle.cs b/source/Cosmos.Core_Plugs/System/RuntimeTypeHandle.cs
index a2075bd8e7..8fde7fe6f9 100644
--- a/source/Cosmos.Core_Plugs/System/RuntimeTypeHandle.cs
+++ b/source/Cosmos.Core_Plugs/System/RuntimeTypeHandle.cs
@@ -153,4 +153,4 @@ public static void MakeSZArray(object aQCallTypeHandle, object aObjectHandleOnSt
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/RuntimeTypeImpl.cs b/source/Cosmos.Core_Plugs/System/RuntimeTypeImpl.cs
index 43b6379355..37dd99590a 100644
--- a/source/Cosmos.Core_Plugs/System/RuntimeTypeImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/RuntimeTypeImpl.cs
@@ -34,4 +34,4 @@ public static FieldInfo[] GetFields(object aThis, BindingFlags aBindingFlags)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/SRImpl.cs b/source/Cosmos.Core_Plugs/System/SRImpl.cs
index 1c472ace91..c8dc7b52e0 100644
--- a/source/Cosmos.Core_Plugs/System/SRImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/SRImpl.cs
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System
@@ -119,4 +115,4 @@ public static string InternalGetResourceString(string aKey)
return aKey;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/StringImpl.cs b/source/Cosmos.Core_Plugs/System/StringImpl.cs
index 1f659ffdb8..763ad2bc97 100644
--- a/source/Cosmos.Core_Plugs/System/StringImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/StringImpl.cs
@@ -1,6 +1,7 @@
//#define COSMOSDEBUG
using System;
using System.Globalization;
+using System.Text;
using Cosmos.Common;
using IL2CPU.API;
using IL2CPU.API.Attribs;
@@ -11,7 +12,7 @@ namespace Cosmos.Core_Plugs.System
[Plug(Target = typeof(string))]
public static class StringImpl
{
- internal static Debugger mDebugger = new Debugger("Core", "String Plugs");
+ internal static Debugger mDebugger = new("String Plug");
public static unsafe void Ctor(string aThis, char* aChars,
[FieldAccess(Name = "System.String System.String.Empty")] ref string aStringEmpty,
@@ -35,6 +36,11 @@ public static unsafe void Ctor(string aThis, char* aChars, int start, int length
[FieldAccess(Name = "System.Int32 System.String._stringLength")] ref int aStringLength,
[FieldAccess(Name = "System.Char System.String._firstChar")] char* aFirstChar)
{
+ if (length < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(length), "Cannot initialize a string with a negative length");
+ }
+
aStringEmpty = "";
aStringLength = length;
for (int i = 0; i < length; i++)
@@ -61,6 +67,11 @@ public static unsafe void Ctor(string aThis, char[] aChars, int start, int lengt
[FieldAccess(Name = "System.Int32 System.String._stringLength")] ref int aStringLength,
[FieldAccess(Name = "System.Char System.String._firstChar")] char* aFirstChar)
{
+ if (length < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(length), "Cannot initialize a string with a negative length");
+ }
+
aStringEmpty = "";
aStringLength = length;
for (int i = 0; i < length; i++)
@@ -74,6 +85,11 @@ public static unsafe void Ctor(string aThis, char aChar, int aLength,
[FieldAccess(Name = "System.Int32 System.String._stringLength")] ref int aStringLength,
[FieldAccess(Name = "System.Char System.String._firstChar")] char* aFirstChar)
{
+ if (aLength < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(aLength), "Cannot initialize a string with a negative length");
+ }
+
aStringEmpty = "";
aStringLength = aLength;
for (int i = 0; i < aLength; i++)
@@ -123,8 +139,6 @@ public static unsafe char get_Chars(
return *(aFirstChar + aIndex);
}
-
-
public static bool IsAscii(string aThis)
{
for (int i = 0; i < aThis.Length; i++)
@@ -409,13 +423,13 @@ public static int IndexOf(string aThis, char value, int startIndex, int count)
// HACK: TODO - improve efficiency of this.
//How do we access the raw memory to copy it into a char array?
- public static char[] ToCharArray(string aThis)
+ public static unsafe char[] ToCharArray(string aThis)
{
- var result = new char[aThis.Length];
+ char[] result = new char[aThis.Length];
- for (int i = 0; i < aThis.Length; i++)
+ fixed (char* P1 = aThis, P2 = result)
{
- result[i] = aThis[i];
+ MemoryOperationsImpl.Copy((byte*)P2, (byte*)P1, aThis.Length * sizeof(char));
}
return result;
@@ -475,7 +489,7 @@ private static int boyerMooreHorsepool(string pattern, string text)
public static int IndexOf(string aThis, string aSubstring, int aIdx, int aLength, StringComparison aComparison)
{
- if (aSubstring == String.Empty)
+ if (aSubstring == string.Empty)
{
return aIdx;
}
@@ -638,7 +652,7 @@ public static int LastIndexOf(string aThis, string aString, int aIndex)
public static int LastIndexOf(string aThis, string aString, int aIndex, int aCount)
{
- if (aString == String.Empty)
+ if (aString == string.Empty)
{
if (aIndex > aThis.Length)
{
@@ -762,7 +776,7 @@ public static string TrimStart(string aThis, string aSubStr)
throw new ArgumentNullException();
}
- internal static unsafe char *GetFirstChar(string aThis, [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar)
+ internal static unsafe char* GetFirstChar(string aThis, [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar)
{
return aFirstChar;
}
@@ -882,16 +896,23 @@ private static unsafe int FastCompareStringHelper(uint* strAChars, int countA, u
char* ptr1 = (char*)((byte*)strBChars + diff);
char* ptr2 = (char*)strBChars;
if (*ptr1 != *ptr2)
- return (int)*ptr1 - (int)*ptr2;
- return (int)*(ptr1 + 1) - (int)*(ptr2 + 1);
+ {
+ return *ptr1 - *ptr2;
+ }
+
+ return *(ptr1 + 1) - *(ptr2 + 1);
}
++strBChars;
}
int c;
if (count == -1)
+ {
if ((c = *(char*)((byte*)strBChars + diff) - *(char*)strBChars) != 0)
+ {
return c;
+ }
+ }
}
return countA - countB;
@@ -962,25 +983,30 @@ public static int Compare(string strA, int indexA, string strB, int indexB, int
int lengthA = Math.Min(length, strA.Length - indexA);
int lengthB = Math.Min(length, strB.Length - indexB);
- switch (comparisonType)
+ return comparisonType switch
{
- case StringComparison.Ordinal:
- return CompareOrdinalHelper(strA, indexA, lengthA, strB, indexB, lengthB);
-
- case StringComparison.OrdinalIgnoreCase:
- return CompareOrdinalHelperIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB);
-
- default:
- throw new ArgumentException("Not Supported StringComparison");
- }
+ StringComparison.Ordinal => CompareOrdinalHelper(strA, indexA, lengthA, strB, indexB, lengthB),
+ StringComparison.OrdinalIgnoreCase => CompareOrdinalHelperIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB),
+ _ => throw new ArgumentException("String comparison not supported!"),
+ };
}
public static unsafe int GetNonRandomizedHashCode(string aString)
{
+
// the code is the same as the one used in .net except for the explicit == 2 and == 1 cases
// we need this since a new object can start directly behind the string in memory, so the standard
// implementation would read the allocated size of the next object and use it for the hash
- fixed (char* ptr = &aString.AsSpan()[0])
+ var asSpan = aString.AsSpan();
+ if (asSpan.Length == 0)
+ {
+ unchecked
+ {
+ return (int)(352654597u + 352654597u * 1566083941);
+ }
+ }
+
+ fixed (char* ptr = &asSpan[0])
{
uint num = 352654597u;
uint num2 = num;
@@ -1006,8 +1032,12 @@ public static unsafe int GetNonRandomizedHashCode(string aString)
{
num2 = (global::System.Numerics.BitOperations.RotateLeft(num2, 5) + num2) ^ *(char*)ptr2;
}
- return (int)(num + num2 * 1566083941);
+
+ unchecked
+ {
+ return (int)(num + num2 * 1566083941);
+ }
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/TimeZoneInfoImpl.cs b/source/Cosmos.Core_Plugs/System/TimeZoneInfoImpl.cs
index da40eb4ef9..08680682a7 100644
--- a/source/Cosmos.Core_Plugs/System/TimeZoneInfoImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/TimeZoneInfoImpl.cs
@@ -1,9 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
+using System;
namespace Cosmos.Core_Plugs.System
{
@@ -13,8 +9,7 @@ public enum TimeZoneInfoOptions
NoThrowOnInvalidTime = 0x2
}
-
- [Plug(typeof(global::System.TimeZoneInfo))]
+ [Plug(typeof(TimeZoneInfo))]
class TimeZoneInfoImpl
{
public static TimeZoneInfo get_Local()
@@ -33,4 +28,4 @@ public static TimeSpan GetLocalUtcOffset(DateTime aDateTime, TimeZoneInfoOptions
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Core_Plugs/System/TypeImpl.cs b/source/Cosmos.Core_Plugs/System/TypeImpl.cs
index 90a5b2f336..51507c9ce6 100644
--- a/source/Cosmos.Core_Plugs/System/TypeImpl.cs
+++ b/source/Cosmos.Core_Plugs/System/TypeImpl.cs
@@ -83,4 +83,4 @@ public static CosmosRuntimeType GetType(string aName)
return new CosmosRuntimeType((uint)typeId);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Debug.DebugConnectors/.editorconfig b/source/Cosmos.Debug.DebugConnectors/.editorconfig
deleted file mode 100644
index fffc1dcc08..0000000000
--- a/source/Cosmos.Debug.DebugConnectors/.editorconfig
+++ /dev/null
@@ -1,8 +0,0 @@
-[DebugConnector.cs]
-indent_size = 4
-
-[DebugConnectorEdison.cs]
-indent_size = 4
-
-[DebugConnectorStream.cs]
-indent_size = 4
diff --git a/source/Cosmos.Debug.GDB/Docs/index.html b/source/Cosmos.Debug.GDB/Docs/index.html
deleted file mode 100644
index fbc0d18c96..0000000000
--- a/source/Cosmos.Debug.GDB/Docs/index.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
- Design Goals
-
- - Assembly only debugger.
- - Extensible via C# (ie source)
- - Customizable for Cosmos
-
-
- - Run on Windows
-
-
- Why SDI?
-
- No readily usable docking system, but then realized SDI is better anyways.
- Allows user to move just the interesting pieces to surround VMWare etc.
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.Debug.GDB/ReadMe.html b/source/Cosmos.Debug.GDB/ReadMe.html
deleted file mode 100644
index 35cbebcd6b..0000000000
--- a/source/Cosmos.Debug.GDB/ReadMe.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
- Cosmos.Debug.GDB
-
- Is a standalone GDB client that can be used for any GDB need, not just Cosmos.
- It is however geared towards remote assembly level debugging.
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.Debug.GDB/ToDo.html b/source/Cosmos.Debug.GDB/ToDo.html
deleted file mode 100644
index 5410223e76..0000000000
--- a/source/Cosmos.Debug.GDB/ToDo.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
- - Reenable auto connect
- - warn on close
- - tracing and logging
- - Run to and set bp from disassembly window
- - Ctrl-c support
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.Debug.Hosts/.editorconfig b/source/Cosmos.Debug.Hosts/.editorconfig
deleted file mode 100644
index a27a42aff8..0000000000
--- a/source/Cosmos.Debug.Hosts/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.cs]
-indent_size=2
diff --git a/source/Cosmos.Debug.HyperVServer/Cosmos.Debug.HyperVServer.csproj b/source/Cosmos.Debug.HyperVServer/Cosmos.Debug.HyperVServer.csproj
index 401c074478..8ef5c0359d 100644
--- a/source/Cosmos.Debug.HyperVServer/Cosmos.Debug.HyperVServer.csproj
+++ b/source/Cosmos.Debug.HyperVServer/Cosmos.Debug.HyperVServer.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
WinExe
app.manifest
Latest
diff --git a/source/Cosmos.Debug.Kernel.Plugs.Asm/.editorconfig b/source/Cosmos.Debug.Kernel.Plugs.Asm/.editorconfig
deleted file mode 100644
index d79adc04ac..0000000000
--- a/source/Cosmos.Debug.Kernel.Plugs.Asm/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.cs]
-indent_size = 2
diff --git a/source/Cosmos.Debug.Kernel/.editorconfig b/source/Cosmos.Debug.Kernel/.editorconfig
deleted file mode 100644
index 055accdfc3..0000000000
--- a/source/Cosmos.Debug.Kernel/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.cs]
-indent_size = 4
diff --git a/source/Cosmos.Debug.Kernel/ConsoleDebugger.cs b/source/Cosmos.Debug.Kernel/ConsoleDebugger.cs
index 6f864c9a3a..465ccbd7c2 100644
--- a/source/Cosmos.Debug.Kernel/ConsoleDebugger.cs
+++ b/source/Cosmos.Debug.Kernel/ConsoleDebugger.cs
@@ -1,47 +1,63 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.Debug.Kernel
-{
- class ConsoleDebugger : Debugger
- {
- public ConsoleDebugger(string aRing, string aSection) : base(aRing, aSection)
- {
-
- }
-
- void WriteText(string message)
- {
- Console.WriteLine($"[{Ring}][{Section}]: {message}");
- }
- public override void SendInternal(double aNumber)
- {
- WriteText(aNumber.ToString());
- }
- public override void SendInternal(float aNumber)
- {
- WriteText(aNumber.ToString());
- }
- public override void SendInternal(int aNumber)
- {
- WriteText(aNumber.ToString());
- }
- public override void SendInternal(long aNumber)
- {
- WriteText(aNumber.ToString());
- }
- public override void SendInternal(string aText)
- {
- WriteText(aText);
- }
- public override void SendInternal(uint aNumber)
- {
- WriteText(aNumber.ToString());
- }
- public override void SendInternal(ulong aNumber)
- {
- WriteText(aNumber.ToString());
- }
- }
-}
+using System;
+
+namespace Cosmos.Debug.Kernel
+{
+ ///
+ /// Represents a debugger that outputs all given inputs to the console in addition
+ /// to its regular debugging host targets.
+ ///
+ class ConsoleDebugger : Debugger
+ {
+ public ConsoleDebugger(string section) : base(section)
+ {
+
+ }
+
+ void WriteText(string message)
+ {
+ Console.WriteLine($"[{Section}]: {message}");
+ }
+
+ public override void SendInternal(double aNumber)
+ {
+ WriteText(aNumber.ToString());
+ }
+
+ public override void SendInternal(float aNumber)
+ {
+ WriteText(aNumber.ToString());
+ }
+
+ public override void SendInternal(int aNumber)
+ {
+ WriteText(aNumber.ToString());
+ }
+
+ public override void SendInternal(long aNumber)
+ {
+ WriteText(aNumber.ToString());
+ }
+
+ public override void SendInternal(string aText)
+ {
+ WriteText(aText);
+ }
+
+ public override void SendInternal(string[] aStringArray)
+ {
+ for(int i = 0; i < aStringArray.Length; ++i)
+ {
+ WriteText(aStringArray[i]);
+ }
+ }
+ public override void SendInternal(uint aNumber)
+ {
+ WriteText(aNumber.ToString());
+ }
+
+ public override void SendInternal(ulong aNumber)
+ {
+ WriteText(aNumber.ToString());
+ }
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Debug.Kernel/Debugger.cs b/source/Cosmos.Debug.Kernel/Debugger.cs
index 3f135e48a2..c94095ece2 100644
--- a/source/Cosmos.Debug.Kernel/Debugger.cs
+++ b/source/Cosmos.Debug.Kernel/Debugger.cs
@@ -1,334 +1,278 @@
-using System.Diagnostics;
-
-namespace Cosmos.Debug.Kernel
-{
- public class DebuggerFactory
- {
- public static bool WriteToConsole = false;
-
- public static Debugger CreateDebugger(string aRing = "", string aSection = "")
- {
- if (WriteToConsole)
- {
- return new ConsoleDebugger(aRing, aSection);
- }
- else
- {
- return new Debugger(aRing, aSection);
- }
- }
- }
-
- public class Debugger
- {
- public Debugger(string aRing, string aSection)
- {
- Ring = aRing;
- Section = aSection;
- }
-
- public string Ring { get; }
-
- public string Section { get; }
-
- public void Break() { }
-
- public static void DoBochsBreak() { }
-
- internal static void DoRealHalt() { }
-
- private static unsafe void ActualSend(int aLength, char* aText) { }
-
- public void SendPtr(object aObject) { }
-
- public static void DoSendNumber(uint aNumber) { }
-
- public static void DoSendNumber(int aNumber) { }
-
- public static void DoSendNumber(ulong aNumber) { }
-
- public static void DoSendNumber(long aNumber) { }
-
- public static void DoSendNumber(float aNumber) { }
-
- public static void DoSendNumber(double aNumber) { }
-
- internal static void DoSendCoreDump() { }
-
- public void SendNumber(uint aNumber) => DoSendNumber(aNumber);
-
- public void SendNumber(int aNumber) => DoSendNumber(aNumber);
-
- public void SendNumber(ulong aNumber) => DoSendNumber(aNumber);
-
- public void SendNumber(long aNumber) => DoSendNumber(aNumber);
-
- public void SendNumber(float aNumber) => DoSendNumber(aNumber);
-
- public void SendNumber(double aNumber) => DoSendNumber(aNumber);
-
- public unsafe void SendChannelCommand(byte aChannel, byte aCommand, byte[] aData) {
- fixed (byte* xPtr = &aData[0]) {
- SendChannelCommand(aChannel, aCommand, aData.Length, xPtr);
- }
- }
-
- public static unsafe void SendChannelCommand(byte aChannel, byte aCommand, int aByteCount, byte* aData) { }
-
- public static void SendChannelCommand(byte aChannel, byte aCommand) { }
-
- internal static void DoSend(string aText) { }
-
- public static void SendKernelPanic(uint id) { }
- public void Send(string aText) => DoSend(aText);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(string aText) => DoSend(aText);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(uint aNumber) => DoSendNumber(aNumber);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(int aNumber) => DoSendNumber(aNumber);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(ulong aNumber) => DoSendNumber(aNumber);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(long aNumber) => DoSendNumber(aNumber);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(float aNumber) => DoSendNumber(aNumber);
-
- [Conditional("COSMOSDEBUG")]
- public virtual void SendInternal(double aNumber) => DoSendNumber(aNumber);
-
- //public void OldSend(string aText) {
- // // TODO: Need to fix this so it can send empty strings.
- // // Sending empty strings locks it up right now
- // if (aText.Length == 0)
- // {
- // return;
- // }
-
- // var xChars = aText.ToCharArray();
- // fixed (char* xPtr = &xChars[0])
- // {
- // ActualSend(xChars.Length, xPtr);
- // }
- //}
-
- public unsafe void SendMessageBox(int aLength, char* aText) { } // Plugged
-
- public unsafe void SendMessageBox(string aText) {
- // TODO: Need to fix this so it can send empty strings.
- // Sending empty strings locks it up right now
- if (aText.Length == 0) {
- return;
- }
-
- var xChars = aText.ToCharArray();
- fixed (char* xPtr = &xChars[0]) {
- SendMessageBox(xChars.Length, xPtr);
- }
- }
-
- // TODO: Kudzu replacement methods for Cosmos.HAL.DebugUtil
- public unsafe void SendMessage(string aModule, string aData) {
- //string xSingleString;
- //xSingleString = "Message Module: \"" + aModule + "\"";
- //xSingleString += " Data: \"" + aData + "\"";
- //Send(xSingleString);
-
- DoSend("Message Module:");
- DoSend(aModule);
- DoSend("Data:");
- DoSend(aData);
- }
-
- public unsafe void SendError(string aModule, string aData) {
- //string xSingleString;
- //xSingleString = "Error Module: \"" + aModule + "\"";
- //xSingleString += " Data: \"" + aData + "\"";
- //Send(xSingleString);
- }
-
- public unsafe void SendNumber(string aModule, string aDescription, uint aNumber, byte aBits) {
- //string xSingleString;
- //xSingleString = "Number Module: \"" + aModule + "\"";
- //xSingleString += " Description: \"" + aDescription + "\"";
- //xSingleString += " Number: \"" + CreateNumber(aNumber, aBits) + "\"";
- }
-
- public unsafe void WriteNumber(uint aNumber, byte aBits) {
- WriteNumber(aNumber, aBits, true);
- }
-
- public unsafe void WriteNumber(uint aNumber, byte aBits, bool aWritePrefix) {
- Send(CreateNumber(aNumber, aBits, aWritePrefix));
- }
-
- public unsafe string CreateNumber(uint aNumber, byte aBits) {
- return CreateNumber(aNumber, aBits, true);
- }
-
- public unsafe string CreateNumber(uint aNumber, byte aBits, bool aWritePrefix) {
- return "Cosmos.Debug.Debugger.CreateNumber(aNumber, aBits, aWritePrefix) not implemented";
- //string xNumberString = null;
- //uint xValue = aNumber;
- //byte xCurrentBits = aBits;
- //if (aWritePrefix)
- //{
- // xNumberString += "0x";
- //}
- //while (xCurrentBits >= 4)
- //{
- // xCurrentBits -= 4;
- // byte xCurrentDigit = (byte)((xValue >> xCurrentBits) & 0xF);
- // string xDigitString = null;
- // switch (xCurrentDigit)
- // {
- // case 0:
- // xDigitString = "0";
- // goto default;
- // case 1:
- // xDigitString = "1";
- // goto default;
- // case 2:
- // xDigitString = "2";
- // goto default;
- // case 3:
- // xDigitString = "3";
- // goto default;
- // case 4:
- // xDigitString = "4";
- // goto default;
- // case 5:
- // xDigitString = "5";
- // goto default;
- // case 6:
- // xDigitString = "6";
- // goto default;
- // case 7:
- // xDigitString = "7";
- // goto default;
- // case 8:
- // xDigitString = "8";
- // goto default;
- // case 9:
- // xDigitString = "9";
- // goto default;
- // case 10:
- // xDigitString = "A";
- // goto default;
- // case 11:
- // xDigitString = "B";
- // goto default;
- // case 12:
- // xDigitString = "C";
- // goto default;
- // case 13:
- // xDigitString = "D";
- // goto default;
- // case 14:
- // xDigitString = "E";
- // goto default;
- // case 15:
- // xDigitString = "F";
- // goto default;
- // default:
- // xNumberString += xDigitString;
- // break;
- // }
- //}
- //return xNumberString;
- }
-
- public unsafe void WriteBinary(string aModule, string aMessage, byte[] aValue) {
- WriteBinary(aModule, aMessage, aValue, 0, aValue.Length);
- }
-
- public unsafe void WriteBinary(string aModule, string aMessage, byte[] aValue, int aIndex, int aLength) {
- //string xSingleString;
- //xSingleString = "Binary Module = \"" + aModule + "\"";
- //xSingleString += " Message = " + aMessage + "\"";
- //xSingleString += " Value = \"";
- //for (int i = 0; i < aLength; i++)
- //{
- // xSingleString += CreateNumber(aValue[aIndex + i], 8, false);
- //}
- //xSingleString += "\"";
- //Send(xSingleString);
- }
-
- public unsafe void WriteBinary(string aModule, string aMessage, byte* aValue, int aIndex, int aLength) {
- //string xSingleString;
- //xSingleString = "Binary Module = \"" + aModule + "\"";
- //xSingleString += " Message = " + aMessage + "\"";
- //xSingleString += " Value = \"";
- //for (int i = 0; i < aLength; i++)
- //{
- // xSingleString += CreateNumber(aValue[aIndex + i], 8, false);
- //}
- //xSingleString += "\"";
- //Send(xSingleString);
- }
-
- public unsafe void ViewMemory() {
- ViewMemory(0);
- }
-
- public unsafe void ViewMemory(int addr) {
- //while (true) {
- // Console.Clear();
- // Console.WriteLine();
-
- // for (int j = 0; j < 20; j++) {
- // int line = addr + j * 16;
- // Console.Write(line.ToHex(8));
- // Console.Write(": ");
-
- // for (int i = 0; i < 16; i++) {
- // if (i == 8) Console.Write(" ");
- // Console.Write((*(byte*)(line + i)).ToHex(2) + " ");
- // }
- // Console.Write(" ");
-
- // for (int i = 0; i < 16; i++) {
- // byte b = (*(byte*)(line + i));
- // if (i == 8) Console.Write(" ");
- // if (b < 32 || b > 127)
- // Console.Write(".");
- // else
- // Console.Write((char)b);
- // }
-
- // Console.WriteLine();
- // }
-
- // Console.WriteLine();
-
- // Console.Write("Enter Hex Address (q to quit): ");
- // string s = Console.ReadLine();
- // if (s == "q")
- // break;
-
- // addr = FromHex(s);
- //}
- }
-
- public void SendCoreDump() => DoSendCoreDump();
-
- private int FromHex(string p) {
- p = p.ToLower();
- string hex = "0123456789abcdef";
-
- int ret = 0;
-
- for (int i = 0; i < p.Length; i++) {
- ret = ret * 16 + hex.IndexOf(p[i]);
- }
- return ret;
- }
- }
-}
+using System.Diagnostics;
+
+namespace Cosmos.Debug.Kernel
+{
+ ///
+ /// Provides a simplified interface for creating new instances of the
+ /// class.
+ ///
+ public static class DebuggerFactory
+ {
+ ///
+ /// Whether the created instances should output
+ /// the given log inputs to the display console.
+ ///
+ public static bool WriteToConsole = false;
+
+ ///
+ /// Creates a new instance.
+ ///
+ /// The virtual compile-time ring the debugger is operating in.
+ /// The section the debugger refers to.
+ public static Debugger CreateDebugger(string section = "")
+ {
+ if (WriteToConsole)
+ {
+ return new ConsoleDebugger(section);
+ }
+ else
+ {
+ return new Debugger(section);
+ }
+ }
+ }
+
+ ///
+ /// Represents a categorized remote debugger, capable of communicating
+ /// with an external host machine, including virtualizers.
+ ///
+ public class Debugger
+ {
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The virtual compile-time ring the debugger is operating in.
+ /// The section the debugger refers to.
+ public Debugger(string section)
+ {
+ Section = section;
+ }
+
+ ///
+ /// The section the debugger refers to.
+ ///
+ public string Section { get; }
+
+ ///
+ /// Triggers a software breakpoint.
+ ///
+ public void Break() { }
+
+ ///
+ /// Triggers a Bochs breakpoint.
+ ///
+ public static void DoBochsBreak() { }
+
+ internal static void DoRealHalt() { }
+
+ private static unsafe void ActualSend(int aLength, char* aText) { }
+
+ ///
+ /// Sends the pointer of the given object to any connected debugging hosts.
+ ///
+ public void SendPtr(object obj) { }
+
+ ///
+ /// Sends a 32-bit unsigned integer to connected debugging hosts.
+ ///
+ public static void DoSendNumber(uint number) { }
+
+ ///
+ /// Sends a 32-bit signed integer to connected debugging hosts.
+ ///
+ public static void DoSendNumber(int number) { }
+
+ ///
+ /// Sends a 64-bit unsigned integer to connected debugging hosts.
+ ///
+ public static void DoSendNumber(ulong number) { }
+
+ ///
+ /// Sends a 64-bit signed integer to connected debugging hosts.
+ ///
+ public static void DoSendNumber(long number) { }
+
+ ///
+ /// Sends a 32-bit floating-point number to connected debugging hosts.
+ ///
+ public static void DoSendNumber(float number) { }
+
+ ///
+ /// Sends a 64-bit floating-point number to connected debugging hosts.
+ ///
+ public static void DoSendNumber(double number) { }
+
+ ///
+ public void SendNumber(uint number) => DoSendNumber(number);
+
+ ///
+ public void SendNumber(int number) => DoSendNumber(number);
+
+ ///
+ public void SendNumber(ulong number) => DoSendNumber(number);
+
+ ///
+ public void SendNumber(long number) => DoSendNumber(number);
+
+ ///
+ public void SendNumber(float number) => DoSendNumber(number);
+
+ ///
+ public void SendNumber(double number) => DoSendNumber(number);
+
+ public unsafe void SendChannelCommand(byte aChannel, byte aCommand, byte[] aData)
+ {
+ fixed (byte* xPtr = &aData[0])
+ {
+ SendChannelCommand(aChannel, aCommand, aData.Length, xPtr);
+ }
+ }
+
+ ///
+ /// Sends a command and its associated data to the given debug channel.
+ ///
+ /// The channel to send the data to.
+ /// The numeric command.
+ /// The amount of bytes in the data associated with the command.
+ /// The data associated with the command
+ public static unsafe void SendChannelCommand(byte channel, byte command, int byteCount, byte* data) { }
+
+ ///
+ /// Sends a command to the given debug channel.
+ ///
+ /// The channel to send the data to.
+ /// The numeric command.
+ public static void SendChannelCommand(byte channel, byte command) { }
+
+ internal static void DoSend(string aText) { }
+
+ internal static void DoSend(string[] aStringArray)
+ {
+ for (int i = 0; i < aStringArray.Length; ++i)
+ {
+ DoSend(aStringArray[i]);
+ }
+ }
+
+ ///
+ /// Sends a kernel panic error code to connected debugging hosts.
+ ///
+ public static void SendKernelPanic(uint id) { }
+
+ ///
+ /// Sends the given string to connected debugging hosts.
+ ///
+ /// The text/message to send.
+ public void Send(string text) => DoSend(text);
+
+ ///
+ /// Sends multiple strings to connected debugging hosts.
+ ///
+ /// The strings to send.
+ public void Send(string[] stringArray) => DoSend(stringArray);
+
+ ///
+ /// Sends the given message to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(string text) => DoSend(text);
+
+ ///
+ /// Sends the given strings to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(string[] stringArray) => DoSend(stringArray);
+
+ ///
+ /// Sends the given 32-bit unsigned integer to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(uint number) => DoSendNumber(number);
+
+ ///
+ /// Sends the given 32-bit signed integer to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(int number) => DoSendNumber(number);
+
+ ///
+ /// Sends the given 64-bit unsigned integer to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(ulong number) => DoSendNumber(number);
+
+ ///
+ /// Sends the given 64-bit signed integer to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(long number) => DoSendNumber(number);
+
+ ///
+ /// Sends the given 32-bit floating-point number to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(float number) => DoSendNumber(number);
+
+ ///
+ /// Sends the given 64-bit floating-point number to all connected debugging hosts.
+ ///
+ [Conditional("COSMOSDEBUG")]
+ public virtual void SendInternal(double number) => DoSendNumber(number);
+
+ //public void OldSend(string aText) {
+ // // TODO: Need to fix this so it can send empty strings.
+ // // Sending empty strings locks it up right now
+ // if (aText.Length == 0)
+ // {
+ // return;
+ // }
+
+ // var xChars = aText.ToCharArray();
+ // fixed (char* xPtr = &xChars[0])
+ // {
+ // ActualSend(xChars.Length, xPtr);
+ // }
+ //}
+
+ ///
+ /// Displays a message box on connected debugging hosts.
+ ///
+ /// The length of the C-string.
+ /// The text to display in the message box, as a C-string.
+ public unsafe void SendMessageBox(int length, char* text) { } // Plugged
+
+ ///
+ /// Displays a message box on connected debugging hosts.
+ ///
+ /// The text to display.
+ public unsafe void SendMessageBox(string text)
+ {
+ // TODO: Need to fix this so it can send empty strings.
+ // Sending empty strings locks it up right now
+ if (text.Length == 0)
+ {
+ return;
+ }
+
+ var xChars = text.ToCharArray();
+ fixed (char* xPtr = &xChars[0])
+ {
+ SendMessageBox(xChars.Length, xPtr);
+ }
+ }
+
+ private int FromHex(string p)
+ {
+ p = p.ToLower();
+ string hex = "0123456789abcdef";
+
+ int ret = 0;
+
+ for (int i = 0; i < p.Length; i++)
+ {
+ ret = ret * 16 + hex.IndexOf(p[i]);
+ }
+ return ret;
+ }
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.Debug.Kernel/ReadMe.html b/source/Cosmos.Debug.Kernel/ReadMe.html
deleted file mode 100644
index 841f86e797..0000000000
--- a/source/Cosmos.Debug.Kernel/ReadMe.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
- Cosmos.Debug.Kernel is a special assembly and is not in any ring. It can also be
- accessed from any ring. Special care must be kept to keep only debugging
- functions in this assembly, and not to allow such ringless behaviour to be
- implemented in other assemblies.
-
- Cosmos.Debug.Kernel must not contain any references to any kernel units. All
- references from kernel units must be incoming only.
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.Deploy.Pixie/Resources.html b/source/Cosmos.Deploy.Pixie/Resources.html
deleted file mode 100644
index e342fe390f..0000000000
--- a/source/Cosmos.Deploy.Pixie/Resources.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
- TFTP
-
-
- PXE
-
-
- DHCP
-
-
- BOOTP
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/BaudRate.cs b/source/Cosmos.HAL2/BaudRate.cs
new file mode 100644
index 0000000000..920b3be92b
--- /dev/null
+++ b/source/Cosmos.HAL2/BaudRate.cs
@@ -0,0 +1,60 @@
+using System;
+
+namespace Cosmos.HAL
+{
+ ///
+ /// Represents the baud rates for serial ports.
+ ///
+ public enum BaudRate : byte
+ {
+ ///
+ /// 115200 bits per second.
+ ///
+ BaudRate115200 = 0x01,
+
+ ///
+ /// 57600 bits per second.
+ ///
+ BaudRate57600 = 0x02,
+
+ ///
+ /// 38400 bits per second.
+ ///
+ BaudRate38400 = 0x03,
+
+ ///
+ /// 19200 bits per second.
+ ///
+ BaudRate19200 = 0x06,
+
+ ///
+ /// 9600 bits per second.
+ ///
+ BaudRate9600 = 0x12,
+
+ ///
+ /// 7200 bits per second.
+ ///
+ BaudRate7200 = 0x10,
+
+ ///
+ /// 4800 bits per second.
+ ///
+ BaudRate4800 = 0x18,
+
+ ///
+ /// 2400 bits per second.
+ ///
+ BaudRate2400 = 0x30,
+
+ ///
+ /// 1200 bits per second.
+ ///
+ BaudRate1200 = 0x60,
+
+ ///
+ /// 600 bits per second.
+ ///
+ BaudRate600 = 0xC0,
+ }
+}
diff --git a/source/Cosmos.HAL2/BlockDevice/AHCI.cs b/source/Cosmos.HAL2/BlockDevice/AHCI.cs
index ad1013dbc2..fa75b167a1 100644
--- a/source/Cosmos.HAL2/BlockDevice/AHCI.cs
+++ b/source/Cosmos.HAL2/BlockDevice/AHCI.cs
@@ -11,13 +11,13 @@ namespace Cosmos.HAL.BlockDevice
{
public class AHCI
{
- internal static Debugger mAHCIDebugger = new Debugger("HAL", "AHCI");
- internal static PCIDevice xDevice = HAL.PCI.GetDeviceClass(HAL.ClassID.MassStorageController,
- HAL.SubclassID.SATAController,
- HAL.ProgramIF.SATA_AHCI);
+ internal static Debugger ahciDebugger = new Debugger("AHCI");
+ internal static PCIDevice device = PCI.GetDeviceClass(ClassID.MassStorageController,
+ SubclassID.SATAController,
+ ProgramIF.SATA_AHCI);
- private static List mPorts = new List();
- private static GenericRegisters mGeneric;
+ private static List ports = new List();
+ private static GenericRegisters generic;
private static ulong mABAR;
// Capabilities
@@ -49,21 +49,18 @@ public class AHCI
// Informations
public string SerialNo;
- public string Version
- {
- get => ((byte)mGeneric.AHCIVersion >> 24) + (byte)(mGeneric.AHCIVersion >> 16) + "." + (byte)(mGeneric.AHCIVersion >> 8) + ((byte)mGeneric.AHCIVersion > 0 ? "." + (byte)mGeneric.AHCIVersion : "");
- }
+ public string Version => ((byte)generic.AHCIVersion >> 24) + (byte)(generic.AHCIVersion >> 16) + "." + (byte)(generic.AHCIVersion >> 8) + ((byte)generic.AHCIVersion > 0 ? "." + (byte)generic.AHCIVersion : "");
internal static void InitDriver()
{
- if (xDevice != null)
+ if (device != null)
{
- AHCI Driver = new AHCI(xDevice);
+ AHCI Driver = new(device);
}
}
- internal PCIDevice GetDevice() => xDevice;
+ internal PCIDevice GetDevice() => device;
public AHCI(PCIDevice aAHCIDevice)
{
@@ -71,24 +68,24 @@ public AHCI(PCIDevice aAHCIDevice)
aAHCIDevice.EnableMemory(true);
mABAR = aAHCIDevice.BaseAddressBar[5].BaseAddress;
- mGeneric = new GenericRegisters(aAHCIDevice.BaseAddressBar[5].BaseAddress);
- mGeneric.GlobalHostControl |= 1U << 31; // Enable AHCI
+ generic = new GenericRegisters(aAHCIDevice.BaseAddressBar[5].BaseAddress);
+ generic.GlobalHostControl |= 1U << 31; // Enable AHCI
GetCapabilities();
- mPorts.Capacity = (int)NumOfPorts;
+ ports.Capacity = (int)NumOfPorts;
GetPorts();
- foreach (StoragePort xPort in mPorts)
+ foreach (StoragePort xPort in ports)
{
if (xPort.mPortType == PortType.SATA)
{
- mAHCIDebugger.Send($"{xPort.mPortName} Port 0:{xPort.mPortNumber}");
+ ahciDebugger.Send($"{xPort.mPortName} Port 0:{xPort.mPortNumber}");
IDE.ScanAndInitPartitions(xPort);
}
else if (xPort.mPortType == PortType.SATAPI)
{
- mAHCIDebugger.Send($"{xPort.mPortName} Port 0:{xPort.mPortNumber}");
+ ahciDebugger.Send($"{xPort.mPortName} Port 0:{xPort.mPortNumber}");
// Just to test Read Sector!
@@ -118,12 +115,12 @@ public AHCI(PCIDevice aAHCIDevice)
public static void HBAReset()
{
- mGeneric.GlobalHostControl = 1;
+ generic.GlobalHostControl = 1;
uint HR = 0;
do
{
Wait(1);
- HR = mGeneric.GlobalHostControl & 1;
+ HR = generic.GlobalHostControl & 1;
} while (HR != 0);
}
@@ -146,32 +143,32 @@ public static void Wait(int microsecondsTimeout)
private void GetCapabilities()
{
- NumOfPorts = mGeneric.Capabilities & 0x1F;
- SupportsExternalSATA = (mGeneric.Capabilities >> 5 & 1) == 1;
- EnclosureManagementSupported = (mGeneric.Capabilities >> 6 & 1) == 1;
- CommandCompletionCoalsecingSupported = (mGeneric.Capabilities >> 7 & 1) == 1;
- NumOfCommandSlots = mGeneric.Capabilities >> 8 & 0x1F;
- PartialStateCapable = (mGeneric.Capabilities >> 13 & 1) == 1;
- SlumberStateCapable = (mGeneric.Capabilities >> 14 & 1) == 1;
- PIOMultipleDRQBlock = (mGeneric.Capabilities >> 15 & 1) == 1;
- FISBasedSwitchingSupported = (mGeneric.Capabilities >> 16 & 1) == 1;
- SupportsPortMutliplier = (mGeneric.Capabilities >> 17 & 1) == 1;
- SupportsAHCIModeOnly = (mGeneric.Capabilities >> 18 & 1) == 1;
- InterfaceSpeedSupport = mGeneric.Capabilities >> 20 & 0x0F;
- SupportsCommandListOverride = (mGeneric.Capabilities >> 24 & 1) == 1;
- SupportsActivityLED = (mGeneric.Capabilities >> 25 & 1) == 1;
- SupportsAggressiveLinkPowerManagement = (mGeneric.Capabilities >> 26 & 1) == 1;
- SupportsStaggeredSpinup = (mGeneric.Capabilities >> 27 & 1) == 1;
- SupportsMechanicalPresenceSwitch = (mGeneric.Capabilities >> 28 & 1) == 1;
- SupportsSNotificationRegister = (mGeneric.Capabilities >> 29 & 1) == 1;
- SupportsNativeCommandQueuing = (mGeneric.Capabilities >> 30 & 1) == 1;
- Supports64bitAddressing = (mGeneric.Capabilities >> 31 & 1) == 1;
+ NumOfPorts = generic.Capabilities & 0x1F;
+ SupportsExternalSATA = (generic.Capabilities >> 5 & 1) == 1;
+ EnclosureManagementSupported = (generic.Capabilities >> 6 & 1) == 1;
+ CommandCompletionCoalsecingSupported = (generic.Capabilities >> 7 & 1) == 1;
+ NumOfCommandSlots = generic.Capabilities >> 8 & 0x1F;
+ PartialStateCapable = (generic.Capabilities >> 13 & 1) == 1;
+ SlumberStateCapable = (generic.Capabilities >> 14 & 1) == 1;
+ PIOMultipleDRQBlock = (generic.Capabilities >> 15 & 1) == 1;
+ FISBasedSwitchingSupported = (generic.Capabilities >> 16 & 1) == 1;
+ SupportsPortMutliplier = (generic.Capabilities >> 17 & 1) == 1;
+ SupportsAHCIModeOnly = (generic.Capabilities >> 18 & 1) == 1;
+ InterfaceSpeedSupport = generic.Capabilities >> 20 & 0x0F;
+ SupportsCommandListOverride = (generic.Capabilities >> 24 & 1) == 1;
+ SupportsActivityLED = (generic.Capabilities >> 25 & 1) == 1;
+ SupportsAggressiveLinkPowerManagement = (generic.Capabilities >> 26 & 1) == 1;
+ SupportsStaggeredSpinup = (generic.Capabilities >> 27 & 1) == 1;
+ SupportsMechanicalPresenceSwitch = (generic.Capabilities >> 28 & 1) == 1;
+ SupportsSNotificationRegister = (generic.Capabilities >> 29 & 1) == 1;
+ SupportsNativeCommandQueuing = (generic.Capabilities >> 30 & 1) == 1;
+ Supports64bitAddressing = (generic.Capabilities >> 31 & 1) == 1;
}
private void GetPorts()
{
// Search for disks
- var xImplementedPort = mGeneric.ImplementedPorts;
+ var xImplementedPort = generic.ImplementedPorts;
var xPort = 0;
for (; xPort < 32; xPort++)
{
@@ -183,28 +180,30 @@ private void GetPorts()
var xPortString = "0:" + (xPort.ToString().Length <= 1 ? xPort.ToString().PadLeft(1, '0') : xPort.ToString());
if (PortType == PortType.SATA) // If Port type was SATA.
{
- mAHCIDebugger.Send("Initializing Port " + xPortString + " with type SATA");
+ ahciDebugger.Send("Initializing Port " + xPortString + " with type SATA");
PortRebase(xPortReg, (uint)xPort);
- var xSATAPort = new SATA(xPortReg);
- mPorts.Add(xSATAPort);
+ SATA xSATAPort = new(xPortReg);
+ ports.Add(xSATAPort);
}
else if (PortType == PortType.SATAPI) // If Port type was SATAPI.
{
- mAHCIDebugger.Send("Initializing Port " + xPortString + " with type Serial ATAPI");
+ ahciDebugger.Send("Initializing Port " + xPortString + " with type Serial ATAPI");
//PortRebase(xPortReg, (uint)xPort);
//var xSATAPIPort = new SATAPI(xPortReg);
//mPorts.Add(xSATAPIPort);
}
else if (PortType == PortType.SEMB) // If Port type was SEMB.
{
- mAHCIDebugger.Send("SEMB Drive at port " + xPortString + " found, which is not supported yet!");
+ ahciDebugger.Send("SEMB Drive at port " + xPortString + " found, which is not supported yet!");
}
else if (PortType == PortType.PM) // If Port type was Port Mulitplier.
{
- mAHCIDebugger.Send("Port Multiplier Drive at port " + xPortString + " found, which is not supported yet!");
+ ahciDebugger.Send("Port Multiplier Drive at port " + xPortString + " found, which is not supported yet!");
}
else if (PortType != PortType.Nothing)
+ {
throw new Exception("SATA Error");
+ }
}
xImplementedPort >>= 1;
}
@@ -238,7 +237,7 @@ private PortType CheckPortType(PortRegisters aPort)
private void PortRebase(PortRegisters aPort, uint aPortNumber)
{
- mAHCIDebugger.Send("Stop");
+ ahciDebugger.Send("Stop");
if (!StopCMD(aPort)) SATA.PortReset(aPort);
aPort.CLB = (uint)Base.AHCI + 0x400 * aPortNumber;
@@ -258,7 +257,7 @@ private void PortRebase(PortRegisters aPort, uint aPortNumber)
aPort.IS = 0;
aPort.IE = 0xFFFFFFFF;
- mAHCIDebugger.Send("Finished!");
+ ahciDebugger.Send("Finished!");
}
private static HBACommandHeader[] GetCommandHeader(PortRegisters aPort)
diff --git a/source/Cosmos.HAL2/BlockDevice/ATA.html b/source/Cosmos.HAL2/BlockDevice/ATA.html
deleted file mode 100644
index eb9dc558cb..0000000000
--- a/source/Cosmos.HAL2/BlockDevice/ATA.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
- Intro -
- http://wiki.osdev.org/ATA
- How to use PIO mode -
- http://wiki.osdev.org/ATA_PIO_Mode
-
- Deep docs -
-
- http://www.t13.org/Documents/UploadedDocuments/project/d1410r3b-ATA-ATAPI-6.pdf
-
- http://suif.stanford.edu/~csapuntz/ide.html
- http://www.t13.org/
- http://www.ata-atapi.com/
-
- http://www.repairfaq.org/filipg/LINK/F_IDE-tech.html
-
- http://www.seagate.com/support/disc/manuals/ata/1621pma.pdf
-
- http://www.scsita.org/aboutscsi/sas/tutorials/SAS_ATA_upper_layers_public.pdf
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/BlockDevice/ATAPI.cs b/source/Cosmos.HAL2/BlockDevice/ATAPI.cs
index ebcd318e55..fc45ff3b9a 100644
--- a/source/Cosmos.HAL2/BlockDevice/ATAPI.cs
+++ b/source/Cosmos.HAL2/BlockDevice/ATAPI.cs
@@ -43,8 +43,8 @@ public class ATAPI : BlockDevice
///
public class PacketCommands
{
- public static byte[] ReadSector = { (byte)ATA_PIO.Cmd.Read, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 };
- public static byte[] Unload = { (byte)ATA_PIO.Cmd.Eject, 0, 0, 0, 0x02, 0, 0, 0, 0, 0, 0, 0 };
+ public static byte[] ReadSector = { (byte)Cmd.Read, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 };
+ public static byte[] Unload = { (byte)Cmd.Eject, 0, 0, 0, 0x02, 0, 0, 0, 0, 0, 0, 0 };
public static byte[] GetMaxLBA = { 0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
}
@@ -61,7 +61,7 @@ public ATAPI(ATA_PIO parentDevice)
mBlockSize = SectorSize;
IO = new Core.IOGroup.ATA(!Primary);
var p = BusPosition == BusPositionEnum.Master;
- Ata.AtaDebugger.Send("ATAPI: Primary controller: " + this.Primary + " Bus postion: IsMaster: " + p);
+ ataDebugger.Send("ATAPI: Primary controller: " + Primary + " Bus postion: IsMaster: " + p);
MaxLBA = GetMaxLBA();
Init();
@@ -91,7 +91,7 @@ public void Init()
///
private void HandleIRQ(ref INTs.IRQContext aContext)
{
- Ata.AtaDebugger.Send("ATAPI IRQ");
+ ataDebugger.Send("ATAPI IRQ");
}
///
@@ -107,7 +107,7 @@ public override void ReadBlock(ulong SectorNum, ulong SectorCount, ref byte[] aD
throw new NotImplementedException("Reading more than one sectors is not supported. SectorCount: " + SectorCount);
}
- Ata.AtaDebugger.Send("ATAPI: Reading block. Sector: " + SectorNum + " SectorCount: " + SectorCount);
+ ataDebugger.Send("ATAPI: Reading block. Sector: " + SectorNum + " SectorCount: " + SectorCount);
byte[] packet = new byte[12];
@@ -182,10 +182,10 @@ private void SendCmd(byte[] AtapiPacket, int size, ref ushort[] outputData)
//Send ATAPI packet command
device.SendCmd(Cmd.Packet);
- Ata.AtaDebugger.Send("ATAPI: Polling");
+ ataDebugger.Send("ATAPI: Polling");
Poll(true);
- Ata.AtaDebugger.Send("ATAPI: Polling complete");
+ ataDebugger.Send("ATAPI: Polling complete");
//Send the command as words
for (int i = 0; i < AtapiPacket.Length; i++)
@@ -221,7 +221,7 @@ private void SendCmd(byte[] AtapiPacket, int size, ref ushort[] outputData)
public void Eject()
{
ushort[] output = new ushort[12];
- SendCmd(ATAPI.PacketCommands.Unload, SectorSize, ref output);
+ SendCmd(PacketCommands.Unload, SectorSize, ref output);
}
///
@@ -273,7 +273,7 @@ private void CheckForErrors()
}
}
///
- /// The function returns the max LBA value of the ATAPI device. Code is based on https://forum.osdev.org/viewtopic.php?f=1&t=14604"
+ /// The function returns the max LBA value of the ATAPI device. Code is based on this
///
/// The maximum LBA
private ulong GetMaxLBA()
@@ -312,4 +312,4 @@ private ulong GetMaxLBA()
return Max_LBA;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/BlockDevice/ATA_PIO.cs b/source/Cosmos.HAL2/BlockDevice/ATA_PIO.cs
index 99f9322992..cd68a40723 100644
--- a/source/Cosmos.HAL2/BlockDevice/ATA_PIO.cs
+++ b/source/Cosmos.HAL2/BlockDevice/ATA_PIO.cs
@@ -33,28 +33,16 @@ public override BlockDeviceType Type
protected Core.IOGroup.ATA IO;
protected SpecLevel mDriveType = SpecLevel.Null;
- public SpecLevel DriveType
- {
- get { return mDriveType; }
- }
+ public SpecLevel DriveType => mDriveType;
- protected string mSerialNo;
- public string SerialNo
- {
- get { return mSerialNo; }
- }
+ protected string mSerialNo;
+ public string SerialNo => mSerialNo;
- protected string mFirmwareRev;
- public string FirmwareRev
- {
- get { return mFirmwareRev; }
- }
+ protected string mFirmwareRev;
+ public string FirmwareRev => mFirmwareRev;
- protected string mModelNo;
- public string ModelNo
- {
- get { return mModelNo; }
- }
+ protected string mModelNo;
+ public string ModelNo => mModelNo;
#endregion
#region Enums
[Flags]
@@ -142,7 +130,7 @@ public enum SpecLevel
}
#endregion
- internal static Debugger mDebugger = new Debugger("HAL", "AtaPio");
+ internal static Debugger mDebugger = new("AtaPIO");
///
/// Internal Debugger method
diff --git a/source/Cosmos.HAL2/BlockDevice/Ata.cs b/source/Cosmos.HAL2/BlockDevice/Ata.cs
index e052af8014..f43165f969 100644
--- a/source/Cosmos.HAL2/BlockDevice/Ata.cs
+++ b/source/Cosmos.HAL2/BlockDevice/Ata.cs
@@ -5,7 +5,7 @@ namespace Cosmos.HAL.BlockDevice
public abstract class Ata : BlockDevice
{
- internal static Debugger AtaDebugger = new Debugger("HAL", "Ata");
+ internal static Debugger ataDebugger = new("Ata");
protected Ata()
{
@@ -27,4 +27,4 @@ public override string ToString()
return "Ata (Abstract)";
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/BlockDevice/IDE.cs b/source/Cosmos.HAL2/BlockDevice/IDE.cs
index 631707d7aa..2552a6daed 100644
--- a/source/Cosmos.HAL2/BlockDevice/IDE.cs
+++ b/source/Cosmos.HAL2/BlockDevice/IDE.cs
@@ -1,16 +1,15 @@
using System;
using System.Collections.Generic;
using Cosmos.Core.IOGroup;
-using Cosmos.HAL.BlockDevice;
namespace Cosmos.HAL.BlockDevice
{
public class IDE
{
- private static readonly PCIDevice xDevice = HAL.PCI.GetDeviceClass(HAL.ClassID.MassStorageController,
- HAL.SubclassID.IDEInterface);
- private static readonly List ATAPIDevices = new List();
- private static readonly List ATAPIPartitions = new List();
+ private static readonly PCIDevice xDevice = PCI.GetDeviceClass(ClassID.MassStorageController,
+ SubclassID.IDEInterface);
+ private static readonly List ATAPIDevices = new();
+ private static readonly List ATAPIPartitions = new();
// These are common/fixed pieces of hardware. PCI, USB etc should be self discovering
// and not hardcoded like this.
@@ -60,16 +59,16 @@ private static void Initialize(Ata.ControllerIdEnum aControllerID, Ata.BusPositi
else if (xATA.DriveType == ATA_PIO.SpecLevel.ATA)
{
BlockDevice.Devices.Add(xATA);
- Ata.AtaDebugger.Send("ATA device with speclevel ATA found.");
+ Ata.ataDebugger.Send("ATA device with speclevel ATA found.");
}
else if (xATA.DriveType == ATA_PIO.SpecLevel.ATAPI)
{
- var atapi = new ATAPI(xATA);
+ ATAPI atapi = new(xATA);
//TODO: Replace 1000000 with proper size once ATAPI driver implements it
//Add the atapi device to an array so we reorder them to be last
ATAPIDevices.Add(atapi);
ATAPIPartitions.Add(new Partition(atapi, 0, 1000000));
- Ata.AtaDebugger.Send("ATA device with speclevel ATAPI found");
+ Ata.ataDebugger.Send("ATA device with speclevel ATAPI found");
return;
}
@@ -80,10 +79,10 @@ internal static void ScanAndInitPartitions(BlockDevice device)
{
if (GPT.IsGPTPartition(device))
{
- var xGPT = new GPT(device);
+ GPT xGPT = new(device);
- Ata.AtaDebugger.Send("Number of GPT partitions found:");
- Ata.AtaDebugger.SendNumber(xGPT.Partitions.Count);
+ Ata.ataDebugger.Send("Number of GPT partitions found:");
+ Ata.ataDebugger.SendNumber(xGPT.Partitions.Count);
int i = 0;
foreach (var part in xGPT.Partitions)
{
@@ -93,14 +92,14 @@ internal static void ScanAndInitPartitions(BlockDevice device)
}
else
{
- var mbr = new MBR(device);
+ MBR mbr = new(device);
if (mbr.EBRLocation != 0)
{
//EBR Detected
var xEbrData = new byte[512];
device.ReadBlock(mbr.EBRLocation, 1U, ref xEbrData);
- var xEBR = new EBR(xEbrData);
+ EBR xEBR = new(xEbrData);
for (int i = 0; i < xEBR.Partitions.Count; i++)
{
@@ -118,4 +117,4 @@ internal static void ScanAndInitPartitions(BlockDevice device)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/BlockDevice/MBR.cs b/source/Cosmos.HAL2/BlockDevice/MBR.cs
index bb0e46968c..548a2a4296 100644
--- a/source/Cosmos.HAL2/BlockDevice/MBR.cs
+++ b/source/Cosmos.HAL2/BlockDevice/MBR.cs
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Cosmos.Common.Extensions;
+using Cosmos.Core;
namespace Cosmos.HAL.BlockDevice
{
- // Its not a BlockDevice, but its related to "fixed" devices
+ // It's not a BlockDevice, but its related to "fixed" devices
// and necessary to create partition block devices
- // Im not comfortable with MBR and Partition being in Hardware ring and would prefer
+ // I'm not comfortable with MBR and Partition being in Hardware ring and would prefer
// them in the system ring, but there are issues relating to moving it there.
public class MBR
{
@@ -65,5 +63,76 @@ protected void ParsePartition(byte[] aMBR, uint aLoc)
Partitions.Add(xPartInfo);
}
}
+
+ ///
+ /// Creates a MBR partition table on a disk
+ ///
+ /// The device to be written a partition table.
+ ///
+ ///
+ /// - Thrown when aDevice is null.
+ ///
+ public void CreateMBR(BlockDevice aDevice)
+ {
+ if (aDevice == null)
+ {
+ throw new ArgumentNullException();
+ }
+
+ ManagedMemoryBlock mb = new ManagedMemoryBlock(512);
+ mb.Fill(0);
+ //Boot code
+ mb.Write32(0, 0x1000B8FA);
+ mb.Write32(4, 0x00BCD08E);
+ mb.Write32(8, 0x0000B8B0);
+ mb.Write32(12, 0xC08ED88E);
+ mb.Write32(16, 0x7C00BEFB);
+ mb.Write32(20, 0xB90600BF);
+ mb.Write32(24, 0xA4F30200);
+ mb.Write32(28, 0x000621EA);
+ mb.Write32(32, 0x07BEBE07);
+ mb.Write32(36, 0x0B750438);
+ mb.Write32(40, 0x8110C683);
+ mb.Write32(44, 0x7507FEFE);
+ mb.Write32(48, 0xB416EBF3);
+ mb.Write32(52, 0xBB01B002);
+ mb.Write32(56, 0x80B27C00);
+ mb.Write32(60, 0x8B01748A);
+ mb.Write32(64, 0x13CD024C);
+ mb.Write32(68, 0x007C00EA);
+ mb.Write32(72, 0x00FEEB00);
+ //Unique disk ID, is used to seperate different drives
+ mb.Write32(440, (uint)aDevice.GetHashCode() * 0x5A5A);
+ //Signature
+ mb.Write16(510, 0xAA55);
+ aDevice.WriteBlock(0, 1, ref mb.memory);
+ }
+
+ ///
+ /// Writes the selected partitions information on the MBR
+ ///
+ /// The partition whose information will be written.
+ /// The partition number.
+ ///
+ ///
+ /// - Thrown when the partition number is larger or smaller than allowed partition number count.
+ ///
+ public void WritePartitionInformation(Partition partition, byte PartitionNo)
+ {
+ if (PartitionNo < 0 || PartitionNo > 3)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ ManagedMemoryBlock mb = new ManagedMemoryBlock(512);
+ partition.Host.ReadBlock(0, 1, ref mb.memory);
+ //TO DO: Implement the CHS starting / ending sector adresses and partition type
+ mb.Write8((uint)(446 + (PartitionNo * 16) + 4), 0x0B);
+ mb.Write32((uint)(446 + (PartitionNo * 16) + 8), (uint) partition.StartingSector);
+ mb.Write32((uint)(446 + (PartitionNo * 16) + 12), (uint) partition.BlockCount);
+ partition.Host.WriteBlock(0, 1, ref mb.memory);
+ ParsePartition(mb.memory, 446 + (uint)(PartitionNo * 16));
+
+ }
}
}
diff --git a/source/Cosmos.HAL2/BlockDevice/Partition.cs b/source/Cosmos.HAL2/BlockDevice/Partition.cs
index 053ee51b75..0c407af520 100644
--- a/source/Cosmos.HAL2/BlockDevice/Partition.cs
+++ b/source/Cosmos.HAL2/BlockDevice/Partition.cs
@@ -1,5 +1,4 @@
-//#define COSMOSDEBUG
-using System;
+using System;
using System.Collections.Generic;
namespace Cosmos.HAL.BlockDevice
@@ -17,8 +16,8 @@ public class Partition : BlockDevice
/// Starting sector.
///
public readonly ulong StartingSector;
- public static List Partitions = new List();
- public override BlockDeviceType Type { get { return Host.Type; } }
+ public static List Partitions = new();
+ public override BlockDeviceType Type => Host.Type;
///
/// Create new instance of the class.
///
@@ -43,14 +42,14 @@ public Partition(BlockDevice aHost, ulong StartingSector, ulong SectorCount)
/// Thrown when data size invalid.
public override void ReadBlock(ulong aBlockNo, ulong aBlockCount, ref byte[] aData)
{
- Global.mDebugger.SendInternal("-- Partition.ReadBlock --");
- Global.mDebugger.SendInternal($"aBlockNo = {aBlockNo}");
- Global.mDebugger.SendInternal($"aBlockCount = {aBlockCount}");
+ Global.debugger.SendInternal("-- Partition.ReadBlock --");
+ Global.debugger.SendInternal($"aBlockNo = {aBlockNo}");
+ Global.debugger.SendInternal($"aBlockCount = {aBlockCount}");
CheckDataSize(aData, aBlockCount);
ulong xHostBlockNo = StartingSector + aBlockNo;
CheckBlockNo(xHostBlockNo, aBlockCount);
Host.ReadBlock(xHostBlockNo, aBlockCount, ref aData);
- Global.mDebugger.SendInternal("Returning -- Partition.ReadBlock --");
+ Global.debugger.SendInternal("Returning -- Partition.ReadBlock --");
}
///
@@ -78,4 +77,4 @@ public override string ToString()
return "Partition";
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/BlockDevice/Ports/Sata.cs b/source/Cosmos.HAL2/BlockDevice/Ports/Sata.cs
index 962b788d37..686c307263 100644
--- a/source/Cosmos.HAL2/BlockDevice/Ports/Sata.cs
+++ b/source/Cosmos.HAL2/BlockDevice/Ports/Sata.cs
@@ -8,7 +8,7 @@ namespace Cosmos.HAL.BlockDevice.Ports
{
public class SATA : StoragePort
{
- internal static Debugger mSATADebugger = new Debugger("HAL", "SATA");
+ internal static Debugger mSATADebugger = new("SATA");
public override BlockDeviceType Type
{
get
diff --git a/source/Cosmos.HAL2/BlockDevice/Ports/Satapi.cs b/source/Cosmos.HAL2/BlockDevice/Ports/Satapi.cs
index 4953600871..345d1d5b2f 100644
--- a/source/Cosmos.HAL2/BlockDevice/Ports/Satapi.cs
+++ b/source/Cosmos.HAL2/BlockDevice/Ports/Satapi.cs
@@ -10,7 +10,7 @@ namespace Cosmos.HAL.BlockDevice.Ports
{
public class SATAPI : StoragePort
{
- internal static Debugger mSATAPIDebugger = new Debugger("HAL", "SATAPI");
+ internal static Debugger mSATAPIDebugger = new("SATAPI");
public PortRegisters mPortReg;
public override PortType mPortType => PortType.SATAPI;
diff --git a/source/Cosmos.HAL2/COMPort.cs b/source/Cosmos.HAL2/COMPort.cs
new file mode 100644
index 0000000000..37ecd85b32
--- /dev/null
+++ b/source/Cosmos.HAL2/COMPort.cs
@@ -0,0 +1,39 @@
+namespace Cosmos.HAL
+{
+ public enum COMPort : ushort
+ {
+ // com1 is used by qemu by default
+ ///
+ /// IO port for COM1 port
+ ///
+ COM1 = 0x3F8,
+ ///
+ /// IO port for COM2 port
+ ///
+ COM2 = 0x2F8,
+ ///
+ /// IO port for COM3 port
+ ///
+ COM3 = 0x3E8,
+ ///
+ /// IO port for COM4 port
+ ///
+ COM4 = 0x2E8,
+ ///
+ /// IO port for COM5 port
+ ///
+ COM5 = 0x5F8,
+ ///
+ /// IO port for COM6 port
+ ///
+ COM6 = 0x4F8,
+ ///
+ /// IO port for COM7 port
+ ///
+ COM7 = 0x5E8,
+ ///
+ /// IO port for COM8 port
+ ///
+ COM8 = 0x4E8
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Audio/AC97.cs b/source/Cosmos.HAL2/Drivers/Audio/AC97.cs
similarity index 98%
rename from source/Cosmos.HAL2/Drivers/PCI/Audio/AC97.cs
rename to source/Cosmos.HAL2/Drivers/Audio/AC97.cs
index ca8315a402..24ac943cf2 100644
--- a/source/Cosmos.HAL2/Drivers/PCI/Audio/AC97.cs
+++ b/source/Cosmos.HAL2/Drivers/Audio/AC97.cs
@@ -1,9 +1,8 @@
-using Cosmos.HAL;
-using System;
+using System;
using Cosmos.Core;
using Cosmos.HAL.Audio;
-namespace Cosmos.HAL.Drivers.PCI.Audio
+namespace Cosmos.HAL.Drivers.Audio
{
///
/// Handles AC97-compatible sound cards at a low-level.
@@ -88,7 +87,7 @@ private unsafe struct BufferDescriptorListEntry
/// The left chanel volume. Must be between 0 and 63.
/// Whether to mute all output of the channel.
private static ushort CreateMixerVolumeValue(byte right, byte left, bool mute)
- => (ushort)((right & 0x3f) | ((left & 0x3f) << 8) | ((mute ? 1 : 0) & 1 << 15));
+ => (ushort)(right & 0x3f | (left & 0x3f) << 8 | (mute ? 1 : 0) & 1 << 15);
///
/// Creates a new instance of the class, with the
@@ -104,7 +103,7 @@ private AC97(ushort bufferSize)
// (1.2.4.2 PCM Buffer Restrictions, Intel document 302349-003)
throw new ArgumentException("The buffer size must be an even number.", nameof(bufferSize));
- PCIDevice pci = Cosmos.HAL.PCI.GetDeviceClass(
+ PCIDevice pci = HAL.PCI.GetDeviceClass(
ClassID.MultimediaDevice, // 0x04
(SubclassID)0x01 // 0x01
);
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Audio/AudioDriver.cs b/source/Cosmos.HAL2/Drivers/Audio/AudioDriver.cs
similarity index 95%
rename from source/Cosmos.HAL2/Drivers/PCI/Audio/AudioDriver.cs
rename to source/Cosmos.HAL2/Drivers/Audio/AudioDriver.cs
index 370fc0fcd9..5e1c5394be 100644
--- a/source/Cosmos.HAL2/Drivers/PCI/Audio/AudioDriver.cs
+++ b/source/Cosmos.HAL2/Drivers/Audio/AudioDriver.cs
@@ -1,12 +1,13 @@
using System;
using Cosmos.HAL.Audio;
-namespace Cosmos.HAL.Audio
+namespace Cosmos.HAL.Drivers.Audio
{
///
/// Represents an audio driver.
///
- public abstract class AudioDriver {
+ public abstract class AudioDriver
+ {
///
/// The buffer provider to use.
///
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Network/AMDPCNetII.cs b/source/Cosmos.HAL2/Drivers/Network/AMDPCNetII.cs
similarity index 94%
rename from source/Cosmos.HAL2/Drivers/PCI/Network/AMDPCNetII.cs
rename to source/Cosmos.HAL2/Drivers/Network/AMDPCNetII.cs
index 7caddabd03..caaf1c4b6a 100644
--- a/source/Cosmos.HAL2/Drivers/PCI/Network/AMDPCNetII.cs
+++ b/source/Cosmos.HAL2/Drivers/Network/AMDPCNetII.cs
@@ -4,7 +4,7 @@
using Cosmos.Core;
using Cosmos.HAL.Network;
-namespace Cosmos.HAL.Drivers.PCI.Network
+namespace Cosmos.HAL.Drivers.Network
{
public class AMDPCNetII : NetworkDevice
{
@@ -50,11 +50,11 @@ public AMDPCNetII(PCIDevice device)
throw new ArgumentException("PCI Device is null. Unable to get AMD PCNet card");
}
- this.pciCard = device;
- this.pciCard.Claimed = true;
- this.pciCard.EnableDevice();
+ pciCard = device;
+ pciCard.Claimed = true;
+ pciCard.EnableDevice();
- int baseAddress = (int)this.pciCard.BaseAddressBar[0].BaseAddress;
+ int baseAddress = (int)pciCard.BaseAddressBar[0].BaseAddress;
RegisterAddress = baseAddress + 0x14;
RegisterData = baseAddress + 0x10;
BusData = baseAddress + 0x1C;
@@ -80,10 +80,10 @@ public AMDPCNetII(PCIDevice device)
mRxDescriptor = new ManagedMemoryBlock(256, 16);
mTxDescriptor = new ManagedMemoryBlock(256, 16);
- mInitBlock.Write32(0x00, (0x4 << 28) | (0x4 << 20));
+ mInitBlock.Write32(0x00, 0x4 << 28 | 0x4 << 20);
mInitBlock.Write32(0x04,
- (uint)(eeprom_mac[0] | (eeprom_mac[1] << 8) | (eeprom_mac[2] << 16) | (eeprom_mac[3] << 24)));
- mInitBlock.Write32(0x08, (uint)(eeprom_mac[4] | (eeprom_mac[5] << 8)));
+ (uint)(eeprom_mac[0] | eeprom_mac[1] << 8 | eeprom_mac[2] << 16 | eeprom_mac[3] << 24));
+ mInitBlock.Write32(0x08, (uint)(eeprom_mac[4] | eeprom_mac[5] << 8));
mInitBlock.Write32(0x0C, 0x0);
mInitBlock.Write32(0x10, 0x0);
mInitBlock.Write32(0x14, (uint)mRxDescriptor.Offset);
@@ -149,7 +149,7 @@ protected void HandleNetworkInterrupt(ref INTs.IRQContext aContext)
}
StatusRegister = cur_status;
- Cosmos.Core.Global.PIC.EoiSlave();
+ Core.Global.PIC.EoiSlave();
}
///
@@ -158,10 +158,10 @@ protected void HandleNetworkInterrupt(ref INTs.IRQContext aContext)
public static void FindAll()
{
Console.WriteLine("Scanning for AMD PCNetII cards...");
- PCIDevice device = Cosmos.HAL.PCI.GetDevice(VendorID.AMD, DeviceID.PCNETII);
+ PCIDevice device = HAL.PCI.GetDevice(VendorID.AMD, DeviceID.PCNETII);
if (device != null)
{
- AMDPCNetII nic = new AMDPCNetII((PCIDevice)device);
+ AMDPCNetII nic = new AMDPCNetII(device);
Console.WriteLine("Found AMD PCNetII NIC on PCI " + device.bus + ":" + device.slot + ":" +
device.function);
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Network/E1000.cs b/source/Cosmos.HAL2/Drivers/Network/E1000.cs
similarity index 91%
rename from source/Cosmos.HAL2/Drivers/PCI/Network/E1000.cs
rename to source/Cosmos.HAL2/Drivers/Network/E1000.cs
index 46668f39b5..9a2151aff7 100644
--- a/source/Cosmos.HAL2/Drivers/PCI/Network/E1000.cs
+++ b/source/Cosmos.HAL2/Drivers/Network/E1000.cs
@@ -5,10 +5,10 @@
using System.Text;
using System.Threading.Tasks;
using Cosmos.Core;
-using Cosmos.Core.Memory;
+using Cosmos.Core.Memory;
using Cosmos.HAL.Network;
-namespace Cosmos.HAL.Drivers.PCI.Network
+namespace Cosmos.HAL.Drivers.Network
{
public unsafe class E1000 : NetworkDevice
{
@@ -22,8 +22,8 @@ public unsafe class E1000 : NetworkDevice
public override CardType CardType => CardType.Ethernet;
public override MACAddress MACAddress => address;
public override string Name => "Intel Gigabit Ethernet";
- public override bool Ready => true;
-
+ public override bool Ready => true;
+
#region Constants
private const ushort REG_CTRL = 0x0000;
private const ushort REG_STATUS = 0x0008;
@@ -46,13 +46,13 @@ public unsafe class E1000 : NetworkDevice
private const ushort REG_RXDESCHEAD = 0x2810;
private const ushort REG_RXDESCTAIL = 0x2818;
- private const ushort REG_TIPG = 0x0410;
+ private const ushort REG_TIPG = 0x0410;
#endregion
public E1000(PCIDevice device)
{
dev = device;
device.EnableDevice();
- BAR0 = (uint)(device.BAR0 & (~3));
+ BAR0 = (uint)(device.BAR0 & ~3);
INTs.SetIrqHandler(device.InterruptLine, HandleIRQ);
var HasEEPROM = DetectEEPROM();
@@ -133,7 +133,7 @@ private void HandleIRQ(ref INTs.IRQContext aContext)
if ((Status & 0x80) != 0)
{
uint _RXCurr = RXCurr;
- var desc = (RXDesc*)(RXDescs + (RXCurr * 16));
+ var desc = (RXDesc*)(RXDescs + RXCurr * 16);
while ((desc->status & 0x1) != 0)
{
byte[] data = new byte[desc->length];
@@ -153,11 +153,11 @@ private void HandleIRQ(ref INTs.IRQContext aContext)
private void RXInitialize()
{
var tmp = Heap.SafeAlloc(32 * 16 + 16);
- RXDescs = (tmp % 16 != 0) ? (tmp + 16 - (tmp % 16)) : tmp;
+ RXDescs = tmp % 16 != 0 ? tmp + 16 - tmp % 16 : tmp;
for (uint i = 0; i < 32; i++)
{
- var desc = (RXDesc*)(RXDescs + (i * 16));
+ var desc = (RXDesc*)(RXDescs + i * 16);
desc->addr = Heap.SafeAlloc(2048 + 16);
desc->status = 0;
}
@@ -172,25 +172,25 @@ private void RXInitialize()
WriteRegister(REG_RXDESCTAIL, 32 - 1);
WriteRegister(REG_RCTRL,
- (1 << 1) | // Receiver Enable
- (1 << 2) | // Store Bad Packets
- (1 << 3) | // Unicast Promiscuous Enabled
- (1 << 4) | // Multicast Promiscuous Enabled
- (0 << 6) | // No Loopback
- (0 << 8) | // Free Buffer Threshold is 1/2 of RDLEN
- (1 << 15) | // Broadcast Accept Mode
- (1 << 26) | // Strip Ethernet CRC
- (0 << 16) //Buffer size of 2048 bytes
+ 1 << 1 | // Receiver Enable
+ 1 << 2 | // Store Bad Packets
+ 1 << 3 | // Unicast Promiscuous Enabled
+ 1 << 4 | // Multicast Promiscuous Enabled
+ 0 << 6 | // No Loopback
+ 0 << 8 | // Free Buffer Threshold is 1/2 of RDLEN
+ 1 << 15 | // Broadcast Accept Mode
+ 1 << 26 | // Strip Ethernet CRC
+ 0 << 16 //Buffer size of 2048 bytes
);
}
private void TXInitialize()
{
var tmp = Heap.SafeAlloc(8 * 16 + 16);
- TXDescs = (tmp % 16 != 0) ? (tmp + 16 - (tmp % 16)) : tmp;
+ TXDescs = tmp % 16 != 0 ? tmp + 16 - tmp % 16 : tmp;
for (int i = 0; i < 8; i++)
{
- var desc = (TXDesc*)(TXDescs + (i * 16));
+ var desc = (TXDesc*)(TXDescs + i * 16);
desc->addr = 0;
desc->cmd = 0;
}
@@ -248,12 +248,12 @@ public uint ReadRegister(ushort reg)
public ushort ReadROM(uint Addr)
{
uint Temp;
- WriteRegister(REG_EEPROM, 1 | (Addr << 8));
+ WriteRegister(REG_EEPROM, 1 | Addr << 8);
while (((Temp = ReadRegister(REG_EEPROM)) & 0x10) == 0)
{
}
- return ((ushort)((Temp >> 16) & 0xFFFF));
+ return (ushort)(Temp >> 16 & 0xFFFF);
}
public override bool QueueBytes(byte[] buffer, int offset, int length)
@@ -269,10 +269,10 @@ public override bool QueueBytes(byte[] buffer, int offset, int length)
a++;
}
- var desc = (TXDesc*)(TXDescs + (TXCurr * 16));
+ var desc = (TXDesc*)(TXDescs + TXCurr * 16);
desc->addr = (ulong)ptr;
desc->length = (ushort)length;
- desc->cmd = (1 << 0) | (1 << 1) | (1 << 3);
+ desc->cmd = 1 << 0 | 1 << 1 | 1 << 3;
desc->status = 0;
byte _TXCurr = (byte)TXCurr;
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Network/RTL8139.cs b/source/Cosmos.HAL2/Drivers/Network/RTL8139.cs
similarity index 97%
rename from source/Cosmos.HAL2/Drivers/PCI/Network/RTL8139.cs
rename to source/Cosmos.HAL2/Drivers/Network/RTL8139.cs
index f0315fc006..89d4520f07 100644
--- a/source/Cosmos.HAL2/Drivers/PCI/Network/RTL8139.cs
+++ b/source/Cosmos.HAL2/Drivers/Network/RTL8139.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using static Cosmos.Core.INTs;
-namespace Cosmos.HAL.Drivers.PCI.Network
+namespace Cosmos.HAL.Drivers.Network
{
public class RTL8139 : NetworkDevice
{
@@ -31,7 +31,7 @@ public RTL8139(PCIDevice device)
// We are handling this device
pciCard.Claimed = true;
// Setup interrupt handling
- INTs.SetIrqHandler(device.InterruptLine, HandleNetworkInterrupt);
+ SetIrqHandler(device.InterruptLine, HandleNetworkInterrupt);
// Get IO Address from PCI Bus
// Enable the card
pciCard.EnableDevice();
@@ -45,7 +45,7 @@ public RTL8139(PCIDevice device)
{
eeprom_mac[b] = IOPort.Read8((ushort)(Base + b));
}
- this.mac = new MACAddress(eeprom_mac);
+ mac = new MACAddress(eeprom_mac);
// Get a receive buffer and assign it to the card
rxBuffer = new ManagedMemoryBlock(RxBufferSize + 2048 + 16, 4);
RBStartRegister = (uint)rxBuffer.Offset;
@@ -65,7 +65,7 @@ public static List FindAll()
//Console.WriteLine("Scanning for Realtek 8139 cards...");
List cards = new List();
- foreach (var xDevice in HAL.PCI.Devices)
+ foreach (var xDevice in PCI.Devices)
{
if (xDevice.VendorID == 0x10EC && xDevice.DeviceID == 0x8139 && xDevice.Claimed == false)
{
@@ -205,13 +205,13 @@ protected bool CmdBufferEmpty
#region Network Device Implementation
public override MACAddress MACAddress
{
- get { return this.mac; }
+ get { return mac; }
}
public override bool Enable()
{
// Enable Receiving and Transmitting of data
CommandRegister = 0x0C;
- while (this.Ready == false)
+ while (Ready == false)
{ }
return true;
}
@@ -291,7 +291,7 @@ private void ReadRawData(ushort packetLen)
}
mRecvBuffer.Enqueue(recv_data);
}
- capr += (ushort)((packetLen + 4 + 3) & 0xFFFFFFFC);
+ capr += (ushort)(packetLen + 4 + 3 & 0xFFFFFFFC);
if (capr > RxBufferSize)
{
capr -= RxBufferSize;
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Network/VT6102.cs b/source/Cosmos.HAL2/Drivers/Network/VT6102.cs
similarity index 100%
rename from source/Cosmos.HAL2/Drivers/PCI/Network/VT6102.cs
rename to source/Cosmos.HAL2/Drivers/Network/VT6102.cs
diff --git a/source/Cosmos.HAL2/Drivers/PCI/Video/VMWareSVGAII.cs b/source/Cosmos.HAL2/Drivers/PCI/Video/VMWareSVGAII.cs
deleted file mode 100644
index 624babb302..0000000000
--- a/source/Cosmos.HAL2/Drivers/PCI/Video/VMWareSVGAII.cs
+++ /dev/null
@@ -1,838 +0,0 @@
-using System;
-using Cosmos.Core;
-
-namespace Cosmos.HAL.Drivers.PCI.Video
-{
- ///
- /// VMWareSVGAII class.
- ///
- public class VMWareSVGAII
- {
- ///
- /// Register values.
- ///
- public enum Register : ushort
- {
- ///
- /// ID.
- ///
- ID = 0,
- ///
- /// Enabled.
- ///
- Enable = 1,
- ///
- /// Width.
- ///
- Width = 2,
- ///
- /// Height.
- ///
- Height = 3,
- ///
- /// Max width.
- ///
- MaxWidth = 4,
- ///
- /// Max height.
- ///
- MaxHeight = 5,
- ///
- /// Depth.
- ///
- Depth = 6,
- ///
- /// Bits per pixel.
- ///
- BitsPerPixel = 7,
- ///
- /// Pseudo color.
- ///
- PseudoColor = 8,
- ///
- /// Red mask.
- ///
- RedMask = 9,
- ///
- /// Green mask.
- ///
- GreenMask = 10,
- ///
- /// Blue mask.
- ///
- BlueMask = 11,
- ///
- /// Bytes per line.
- ///
- BytesPerLine = 12,
- ///
- /// Frame buffer start.
- ///
- FrameBufferStart = 13,
- ///
- /// Frame buffer offset.
- ///
- FrameBufferOffset = 14,
- ///
- /// VRAM size.
- ///
- VRamSize = 15,
- ///
- /// Frame buffer size.
- ///
- FrameBufferSize = 16,
- ///
- /// Capabilities.
- ///
- Capabilities = 17,
- ///
- /// Memory start.
- ///
- MemStart = 18,
- ///
- /// Memory size.
- ///
- MemSize = 19,
- ///
- /// Config done.
- ///
- ConfigDone = 20,
- ///
- /// Sync.
- ///
- Sync = 21,
- ///
- /// Busy.
- ///
- Busy = 22,
- ///
- /// Guest ID.
- ///
- GuestID = 23,
- ///
- /// Cursor ID.
- ///
- CursorID = 24,
- ///
- /// Cursor X.
- ///
- CursorX = 25,
- ///
- /// Cursor Y.
- ///
- CursorY = 26,
- ///
- /// Cursor on.
- ///
- CursorOn = 27,
- ///
- /// Cursor count.
- ///
- CursorCount = 0x0C,
- ///
- /// Host bits per pixel.
- ///
- HostBitsPerPixel = 28,
- ///
- /// Scratch size.
- ///
- ScratchSize = 29,
- ///
- /// Memory registers.
- ///
- MemRegs = 30,
- ///
- /// Number of displays.
- ///
- NumDisplays = 31,
- ///
- /// Pitch lock.
- ///
- PitchLock = 32,
- ///
- /// Indicates maximum size of FIFO Registers.
- ///
- FifoNumRegisters = 293
- }
-
- ///
- /// ID values.
- ///
- private enum ID : uint
- {
- ///
- /// Magic starting point.
- ///
- Magic = 0x900000,
- ///
- /// V0.
- ///
- V0 = Magic << 8,
- ///
- /// V1.
- ///
- V1 = (Magic << 8) | 1,
- ///
- /// V2.
- ///
- V2 = (Magic << 8) | 2,
- ///
- /// Invalid
- ///
- Invalid = 0xFFFFFFFF
- }
-
- ///
- /// FIFO values.
- ///
- public enum FIFO : uint
- { // values are multiplied by 4 to access the array by byte index
- ///
- /// Min.
- ///
- Min = 0,
- ///
- /// Max.
- ///
- Max = 4,
- ///
- /// Next command.
- ///
- NextCmd = 8,
- ///
- /// Stop.
- ///
- Stop = 12
- }
-
- ///
- /// FIFO command values.
- ///
- private enum FIFOCommand
- {
- ///
- /// Update.
- ///
- Update = 1,
- ///
- /// Rectange fill.
- ///
- RECT_FILL = 2,
- ///
- /// Rectange copy.
- ///
- RECT_COPY = 3,
- ///
- /// Define bitmap.
- ///
- DEFINE_BITMAP = 4,
- ///
- /// Define bitmap scanline.
- ///
- DEFINE_BITMAP_SCANLINE = 5,
- ///
- /// Define pixmap.
- ///
- DEFINE_PIXMAP = 6,
- ///
- /// Define pixmap scanline.
- ///
- DEFINE_PIXMAP_SCANLINE = 7,
- ///
- /// Rectange bitmap fill.
- ///
- RECT_BITMAP_FILL = 8,
- ///
- /// Rectange pixmap fill.
- ///
- RECT_PIXMAP_FILL = 9,
- ///
- /// Rectange bitmap copy.
- ///
- RECT_BITMAP_COPY = 10,
- ///
- /// Rectange pixmap fill.
- ///
- RECT_PIXMAP_COPY = 11,
- ///
- /// Free object.
- ///
- FREE_OBJECT = 12,
- ///
- /// Rectangle raster operation fill.
- ///
- RECT_ROP_FILL = 13,
- ///
- /// Rectangle raster operation copy.
- ///
- RECT_ROP_COPY = 14,
- ///
- /// Rectangle raster operation bitmap fill.
- ///
- RECT_ROP_BITMAP_FILL = 15,
- ///
- /// Rectangle raster operation pixmap fill.
- ///
- RECT_ROP_PIXMAP_FILL = 16,
- ///
- /// Rectangle raster operation bitmap copy.
- ///
- RECT_ROP_BITMAP_COPY = 17,
- ///
- /// Rectangle raster operation pixmap copy.
- ///
- RECT_ROP_PIXMAP_COPY = 18,
- ///
- /// Define cursor.
- ///
- DEFINE_CURSOR = 19,
- ///
- /// Display cursor.
- ///
- DISPLAY_CURSOR = 20,
- ///
- /// Move cursor.
- ///
- MOVE_CURSOR = 21,
- ///
- /// Define alpha cursor.
- ///
- DEFINE_ALPHA_CURSOR = 22
- }
-
- ///
- /// IO port offset.
- ///
- private enum IOPortOffset : byte
- {
- ///
- /// Index.
- ///
- Index = 0,
- ///
- /// Value.
- ///
- Value = 1,
- ///
- /// BIOS.
- ///
- Bios = 2,
- ///
- /// IRQ.
- ///
- IRQ = 3
- }
-
- ///
- /// Capability values.
- ///
- [Flags]
- private enum Capability
- {
- ///
- /// None.
- ///
- None = 0,
- ///
- /// Rectangle fill.
- ///
- RectFill = 1,
- ///
- /// Rectangle copy.
- ///
- RectCopy = 2,
- ///
- /// Rectangle pattern fill.
- ///
- RectPatFill = 4,
- ///
- /// Lecacy off screen.
- ///
- LecacyOffscreen = 8,
- ///
- /// Raster operation.
- ///
- RasterOp = 16,
- ///
- /// Cruser.
- ///
- Cursor = 32,
- ///
- /// Cursor bypass.
- ///
- CursorByPass = 64,
- ///
- /// Cursor bypass2.
- ///
- CursorByPass2 = 128,
- ///
- /// Eigth bit emulation.
- ///
- EigthBitEmulation = 256,
- ///
- /// Alpha cursor.
- ///
- AlphaCursor = 512,
- ///
- /// Glyph.
- ///
- Glyph = 1024,
- ///
- /// Glyph clipping.
- ///
- GlyphClipping = 0x00000800,
- ///
- /// Offscreen.
- ///
- Offscreen1 = 0x00001000,
- ///
- /// Alpha blend.
- ///
- AlphaBlend = 0x00002000,
- ///
- /// Three D.
- ///
- ThreeD = 0x00004000,
- ///
- /// Extended FIFO.
- ///
- ExtendedFifo = 0x00008000,
- ///
- /// Multi monitors.
- ///
- MultiMon = 0x00010000,
- ///
- /// Pitch lock.
- ///
- PitchLock = 0x00020000,
- ///
- /// IRQ mask.
- ///
- IrqMask = 0x00040000,
- ///
- /// Display topology.
- ///
- DisplayTopology = 0x00080000,
- ///
- /// GMR.
- ///
- Gmr = 0x00100000,
- ///
- /// Traces.
- ///
- Traces = 0x00200000,
- ///
- /// GMR2.
- ///
- Gmr2 = 0x00400000,
- ///
- /// Screen objects.
- ///
- ScreenObject2 = 0x00800000
- }
-
- ///
- /// Index port.
- ///
- private readonly ushort IndexPort;
- ///
- /// Value port.
- ///
- private readonly ushort ValuePort;
- ///
- /// BIOS port.
- ///
- private ushort BiosPort;
- ///
- /// IRQ port.
- ///
- private ushort IRQPort;
-
- ///
- /// Video memory block.
- ///
- public readonly MemoryBlock VideoMemory;
- ///
- /// FIFO memory block.
- ///
- private MemoryBlock FIFO_Memory;
-
- ///
- /// PCI device.
- ///
- private PCIDevice device;
- ///
- /// Height.
- ///
- private uint height;
- ///
- /// Width.
- ///
- private uint width;
- ///
- /// Depth.
- ///
- private uint depth;
- ///
- /// Capabilities.
- ///
- private uint capabilities;
-
- public uint FrameSize;
- public uint FrameOffset;
-
- ///
- /// Create new instance of the class.
- ///
- public VMWareSVGAII()
- {
- device = HAL.PCI.GetDevice(HAL.VendorID.VMWare, HAL.DeviceID.SVGAIIAdapter);
- device.EnableMemory(true);
- uint basePort = device.BaseAddressBar[0].BaseAddress;
- IndexPort = (ushort)(basePort + (uint)IOPortOffset.Index);
- ValuePort = (ushort)(basePort + (uint)IOPortOffset.Value);
- BiosPort = (ushort)(basePort + (uint)IOPortOffset.Bios);
- IRQPort = (ushort)(basePort + (uint)IOPortOffset.IRQ);
-
- WriteRegister(Register.ID, (uint)ID.V2);
- if (ReadRegister(Register.ID) != (uint)ID.V2)
- return;
-
- VideoMemory = new MemoryBlock(ReadRegister(Register.FrameBufferStart), ReadRegister(Register.VRamSize));
- capabilities = ReadRegister(Register.Capabilities);
- InitializeFIFO();
- }
-
- ///
- /// Initialize FIFO.
- ///
- protected void InitializeFIFO()
- {
- FIFO_Memory = new MemoryBlock(ReadRegister(Register.MemStart), ReadRegister(Register.MemSize));
- FIFO_Memory[(uint)FIFO.Min] = (uint)Register.FifoNumRegisters * sizeof(uint);
- FIFO_Memory[(uint)FIFO.Max] = FIFO_Memory.Size;
- FIFO_Memory[(uint)FIFO.NextCmd] = FIFO_Memory[(uint)FIFO.Min];
- FIFO_Memory[(uint)FIFO.Stop] = FIFO_Memory[(uint)FIFO.Min];
- WriteRegister(Register.ConfigDone, 1);
- }
-
- ///
- /// Set video mode.
- ///
- /// Width.
- /// Height.
- /// Depth.
- public void SetMode(uint width, uint height, uint depth = 32)
- {
- //Disable the Driver before writing new values and initiating it again to avoid a memory exception
- //Disable();
-
- // Depth is color depth in bytes.
- this.depth = depth / 8;
- this.width = width;
- this.height = height;
- WriteRegister(Register.Width, width);
- WriteRegister(Register.Height, height);
- WriteRegister(Register.BitsPerPixel, depth);
- Enable();
- InitializeFIFO();
-
- FrameSize = ReadRegister(Register.FrameBufferSize);
- FrameOffset = ReadRegister(Register.FrameBufferOffset);
- }
-
- ///
- /// Write register.
- ///
- /// A register.
- /// A value.
- protected void WriteRegister(Register register, uint value)
- {
- IOPort.Write32(IndexPort, (uint)register);
- IOPort.Write32(ValuePort, value);
- }
-
- ///
- /// Read register.
- ///
- /// A register.
- /// uint value.
- protected uint ReadRegister(Register register)
- {
- IOPort.Write32(IndexPort, (uint)register);
- return IOPort.Read32(ValuePort);
- }
-
- ///
- /// Get FIFO.
- ///
- /// FIFO command.
- /// uint value.
- protected uint GetFIFO(FIFO cmd)
- {
- return FIFO_Memory[(uint)cmd];
- }
-
- ///
- /// Set FIFO.
- ///
- /// Command.
- /// Value.
- ///
- protected uint SetFIFO(FIFO cmd, uint value)
- {
- return FIFO_Memory[(uint)cmd] = value;
- }
-
- ///
- /// Wait for FIFO.
- ///
- protected void WaitForFifo()
- {
- WriteRegister(Register.Sync, 1);
- while (ReadRegister(Register.Busy) != 0) { }
- }
-
- ///
- /// Write to FIFO.
- ///
- /// Value to write.
- protected void WriteToFifo(uint value)
- {
- if ((GetFIFO(FIFO.NextCmd) == GetFIFO(FIFO.Max) - 4 && GetFIFO(FIFO.Stop) == GetFIFO(FIFO.Min)) ||
- GetFIFO(FIFO.NextCmd) + 4 == GetFIFO(FIFO.Stop))
- WaitForFifo();
-
- SetFIFO((FIFO)GetFIFO(FIFO.NextCmd), value);
- SetFIFO(FIFO.NextCmd, GetFIFO(FIFO.NextCmd) + 4);
-
- if (GetFIFO(FIFO.NextCmd) == GetFIFO(FIFO.Max))
- SetFIFO(FIFO.NextCmd, GetFIFO(FIFO.Min));
- }
-
- ///
- /// Update FIFO.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// Height.
- public void Update(uint x, uint y, uint width, uint height)
- {
- WriteToFifo((uint)FIFOCommand.Update);
- WriteToFifo(x);
- WriteToFifo(y);
- WriteToFifo(width);
- WriteToFifo(height);
- WaitForFifo();
- }
-
- ///
- /// Update video memory.
- ///
- public void DoubleBufferUpdate()
- {
- VideoMemory.MoveDown(FrameOffset, FrameSize, FrameSize);
- Update(0, 0, width, height);
- }
-
- ///
- /// Set pixel.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// Color.
- /// Thrown on memory access violation.
- public void SetPixel(uint x, uint y, uint color)
- {
- VideoMemory[(y * width + x) * depth + FrameSize] = color;
- }
-
- ///
- /// Get pixel.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// uint value.
- /// Thrown on memory access violation.
- public uint GetPixel(uint x, uint y)
- {
- return VideoMemory[(y * width + x) * depth + FrameSize];
- }
-
- ///
- /// Clear screen to specified color.
- ///
- /// Color.
- /// Thrown on memory access violation.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- public void Clear(uint color)
- {
- VideoMemory.Fill(FrameSize, FrameSize, color);
- }
-
- ///
- /// Copy rectangle.
- ///
- /// Source X coordinate.
- /// Source Y coordinate.
- /// Destination X coordinate.
- /// Destination Y coordinate.
- /// Width.
- /// Height.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- public void Copy(uint x, uint y, uint newX, uint newY, uint width, uint height)
- {
- if ((capabilities & (uint)Capability.RectCopy) != 0)
- {
- WriteToFifo((uint)FIFOCommand.RECT_COPY);
- WriteToFifo(x);
- WriteToFifo(y);
- WriteToFifo(newX);
- WriteToFifo(newY);
- WriteToFifo(width);
- WriteToFifo(height);
- WaitForFifo();
- }
- else
- throw new NotImplementedException("VMWareSVGAII Copy()");
- }
-
- ///
- /// Fill rectangle.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// Height.
- /// Color.
- /// Thrown on memory access violation.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- public void Fill(uint x, uint y, uint width, uint height, uint color)
- {
- if ((capabilities & (uint)Capability.RectFill) != 0)
- {
- WriteToFifo((uint)FIFOCommand.RECT_FILL);
- WriteToFifo(color);
- WriteToFifo(x);
- WriteToFifo(y);
- WriteToFifo(width);
- WriteToFifo(height);
- WaitForFifo();
- }
- else
- {
- if ((capabilities & (uint)Capability.RectCopy) != 0)
- {
- // fill first line and copy it to all other
- uint xTarget = x + width;
- uint yTarget = y + height;
-
- for (uint xTmp = x; xTmp < xTarget; xTmp++)
- {
- SetPixel(xTmp, y, color);
- }
- // refresh first line for copy process
- Update(x, y, width, 1);
- for (uint yTmp = y + 1; yTmp < yTarget; yTmp++)
- {
- Copy(x, y, x, yTmp, width, 1);
- }
- }
- else
- {
- uint xTarget = x + width;
- uint yTarget = y + height;
- for (uint xTmp = x; xTmp < xTarget; xTmp++)
- {
- for (uint yTmp = y; yTmp < yTarget; yTmp++)
- {
- SetPixel(xTmp, yTmp, color);
- }
- }
- Update(x, y, width, height);
- }
- }
- }
-
- ///
- /// Define cursor.
- ///
- public void DefineCursor()
- {
- WaitForFifo();
- WriteToFifo((uint)FIFOCommand.DEFINE_CURSOR);
- WriteToFifo(0); // ID
- WriteToFifo(0); // Hotspot X
- WriteToFifo(0); // Hotspot Y
- WriteToFifo(2);
- WriteToFifo(2);
- WriteToFifo(1);
- WriteToFifo(1);
-
- for (int i = 0; i < 4; i++)
- {
- WriteToFifo(0);
- }
-
- for (int i = 0; i < 4; i++)
- {
- WriteToFifo(0xFFFFFF);
- }
-
- WaitForFifo();
- }
-
- ///
- /// Define alpha cursor.
- ///
- public void DefineAlphaCursor(uint width, uint height, int[] data)
- {
- WaitForFifo();
- WriteToFifo((uint)FIFOCommand.DEFINE_ALPHA_CURSOR);
- WriteToFifo(0); // ID
- WriteToFifo(0); // Hotspot X
- WriteToFifo(0); // Hotspot Y
- WriteToFifo(width); // Width
- WriteToFifo(height); // Height
-
- for (int i = 0; i < data.Length; i++)
- {
- WriteToFifo((uint)data[i]);
- }
-
- WaitForFifo();
- }
-
- //Allow to enable the Driver again after it has been disabled (switch between text and graphics mode currently this is SVGA only)
- ///
- /// Enable the SVGA Driver , only needed after Disable() has been called
- ///
- public void Enable()
- {
- WriteRegister(Register.Enable, 1);
- }
-
- ///
- /// Disable the SVGA Driver , return to text mode
- ///
- public void Disable()
- {
- WriteRegister(Register.Enable, 0);
- }
-
- ///
- /// Set cursor.
- ///
- /// Visible.
- /// X coordinate.
- /// Y coordinate.
- public void SetCursor(bool visible, uint x, uint y)
- {
- WriteRegister(Register.CursorOn, (uint)(visible ? 1 : 0));
- WriteRegister(Register.CursorX, x);
- WriteRegister(Register.CursorY, y);
- WriteRegister(Register.CursorCount, ReadRegister(Register.CursorCount) + 1);
- }
- }
-}
diff --git a/source/Cosmos.HAL2/Drivers/ReadMe.html b/source/Cosmos.HAL2/Drivers/ReadMe.html
deleted file mode 100644
index 195ce98e6a..0000000000
--- a/source/Cosmos.HAL2/Drivers/ReadMe.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
- Dynamically loaded drivers are contained in this folder. In the future they may
- be in different assemblies which are loaded on demand. The drivers in the root
- folder are not dynamic, and are drivers that are required for all systems, or
- are common bases used by dynamic drivers. For example, ATA exists in the root,
- but actual ATA chipsets should exist in this directory.
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/Capability.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/Capability.cs
new file mode 100644
index 0000000000..4bdc4acc7e
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/Capability.cs
@@ -0,0 +1,112 @@
+using System;
+
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// Capability values.
+ ///
+ [Flags]
+ public enum Capability
+ {
+ ///
+ /// None.
+ ///
+ None = 0,
+ ///
+ /// Rectangle fill.
+ ///
+ RectFill = 1,
+ ///
+ /// Rectangle copy.
+ ///
+ RectCopy = 2,
+ ///
+ /// Rectangle pattern fill.
+ ///
+ RectPatFill = 4,
+ ///
+ /// Lecacy off screen.
+ ///
+ LecacyOffscreen = 8,
+ ///
+ /// Raster operation.
+ ///
+ RasterOp = 16,
+ ///
+ /// Cruser.
+ ///
+ Cursor = 32,
+ ///
+ /// Cursor bypass.
+ ///
+ CursorByPass = 64,
+ ///
+ /// Cursor bypass2.
+ ///
+ CursorByPass2 = 128,
+ ///
+ /// Eigth bit emulation.
+ ///
+ EigthBitEmulation = 256,
+ ///
+ /// Alpha cursor.
+ ///
+ AlphaCursor = 512,
+ ///
+ /// Glyph.
+ ///
+ Glyph = 1024,
+ ///
+ /// Glyph clipping.
+ ///
+ GlyphClipping = 0x00000800,
+ ///
+ /// Offscreen.
+ ///
+ Offscreen1 = 0x00001000,
+ ///
+ /// Alpha blend.
+ ///
+ AlphaBlend = 0x00002000,
+ ///
+ /// Three D.
+ ///
+ ThreeD = 0x00004000,
+ ///
+ /// Extended FIFO.
+ ///
+ ExtendedFifo = 0x00008000,
+ ///
+ /// Multi monitors.
+ ///
+ MultiMon = 0x00010000,
+ ///
+ /// Pitch lock.
+ ///
+ PitchLock = 0x00020000,
+ ///
+ /// IRQ mask.
+ ///
+ IrqMask = 0x00040000,
+ ///
+ /// Display topology.
+ ///
+ DisplayTopology = 0x00080000,
+ ///
+ /// GMR.
+ ///
+ Gmr = 0x00100000,
+ ///
+ /// Traces.
+ ///
+ Traces = 0x00200000,
+ ///
+ /// GMR2.
+ ///
+ Gmr2 = 0x00400000,
+ ///
+ /// Screen objects.
+ ///
+ ScreenObject2 = 0x00800000
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/FIFO.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/FIFO.cs
new file mode 100644
index 0000000000..b00d4b6894
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/FIFO.cs
@@ -0,0 +1,25 @@
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// FIFO values.
+ ///
+ public enum FIFO : uint
+ { // values are multiplied by 4 to access the array by byte index
+ ///
+ /// Min.
+ ///
+ Min = 0,
+ ///
+ /// Max.
+ ///
+ Max = 4,
+ ///
+ /// Next command.
+ ///
+ NextCmd = 8,
+ ///
+ /// Stop.
+ ///
+ Stop = 12
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/FIFOCommand.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/FIFOCommand.cs
new file mode 100644
index 0000000000..990553a621
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/FIFOCommand.cs
@@ -0,0 +1,97 @@
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// FIFO command values.
+ ///
+ public enum FIFOCommand
+ {
+ ///
+ /// Update.
+ ///
+ Update = 1,
+ ///
+ /// Rectange fill.
+ ///
+ RECT_FILL = 2,
+ ///
+ /// Rectange copy.
+ ///
+ RECT_COPY = 3,
+ ///
+ /// Define bitmap.
+ ///
+ DEFINE_BITMAP = 4,
+ ///
+ /// Define bitmap scanline.
+ ///
+ DEFINE_BITMAP_SCANLINE = 5,
+ ///
+ /// Define pixmap.
+ ///
+ DEFINE_PIXMAP = 6,
+ ///
+ /// Define pixmap scanline.
+ ///
+ DEFINE_PIXMAP_SCANLINE = 7,
+ ///
+ /// Rectange bitmap fill.
+ ///
+ RECT_BITMAP_FILL = 8,
+ ///
+ /// Rectange pixmap fill.
+ ///
+ RECT_PIXMAP_FILL = 9,
+ ///
+ /// Rectange bitmap copy.
+ ///
+ RECT_BITMAP_COPY = 10,
+ ///
+ /// Rectange pixmap fill.
+ ///
+ RECT_PIXMAP_COPY = 11,
+ ///
+ /// Free object.
+ ///
+ FREE_OBJECT = 12,
+ ///
+ /// Rectangle raster operation fill.
+ ///
+ RECT_ROP_FILL = 13,
+ ///
+ /// Rectangle raster operation copy.
+ ///
+ RECT_ROP_COPY = 14,
+ ///
+ /// Rectangle raster operation bitmap fill.
+ ///
+ RECT_ROP_BITMAP_FILL = 15,
+ ///
+ /// Rectangle raster operation pixmap fill.
+ ///
+ RECT_ROP_PIXMAP_FILL = 16,
+ ///
+ /// Rectangle raster operation bitmap copy.
+ ///
+ RECT_ROP_BITMAP_COPY = 17,
+ ///
+ /// Rectangle raster operation pixmap copy.
+ ///
+ RECT_ROP_PIXMAP_COPY = 18,
+ ///
+ /// Define cursor.
+ ///
+ DEFINE_CURSOR = 19,
+ ///
+ /// Display cursor.
+ ///
+ DISPLAY_CURSOR = 20,
+ ///
+ /// Move cursor.
+ ///
+ MOVE_CURSOR = 21,
+ ///
+ /// Define alpha cursor.
+ ///
+ DEFINE_ALPHA_CURSOR = 22
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/ID.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/ID.cs
new file mode 100644
index 0000000000..75c3fb61db
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/ID.cs
@@ -0,0 +1,29 @@
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// ID values.
+ ///
+ public enum ID : uint
+ {
+ ///
+ /// Magic starting point.
+ ///
+ Magic = 0x900000,
+ ///
+ /// V0.
+ ///
+ V0 = Magic << 8,
+ ///
+ /// V1.
+ ///
+ V1 = Magic << 8 | 1,
+ ///
+ /// V2.
+ ///
+ V2 = Magic << 8 | 2,
+ ///
+ /// Invalid
+ ///
+ Invalid = 0xFFFFFFFF
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/IOPortOffset.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/IOPortOffset.cs
new file mode 100644
index 0000000000..0a4c19962b
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/IOPortOffset.cs
@@ -0,0 +1,25 @@
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// IO port offset.
+ ///
+ public enum IOPortOffset : byte
+ {
+ ///
+ /// Index.
+ ///
+ Index = 0,
+ ///
+ /// Value.
+ ///
+ Value = 1,
+ ///
+ /// BIOS.
+ ///
+ Bios = 2,
+ ///
+ /// IRQ.
+ ///
+ IRQ = 3
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/Register.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/Register.cs
new file mode 100644
index 0000000000..37b6c7b9ac
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/Register.cs
@@ -0,0 +1,149 @@
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// Register values.
+ ///
+ public enum Register : ushort
+ {
+ ///
+ /// ID.
+ ///
+ ID = 0,
+ ///
+ /// Enabled.
+ ///
+ Enable = 1,
+ ///
+ /// Width.
+ ///
+ Width = 2,
+ ///
+ /// Height.
+ ///
+ Height = 3,
+ ///
+ /// Max width.
+ ///
+ MaxWidth = 4,
+ ///
+ /// Max height.
+ ///
+ MaxHeight = 5,
+ ///
+ /// Depth.
+ ///
+ Depth = 6,
+ ///
+ /// Bits per pixel.
+ ///
+ BitsPerPixel = 7,
+ ///
+ /// Pseudo color.
+ ///
+ PseudoColor = 8,
+ ///
+ /// Red mask.
+ ///
+ RedMask = 9,
+ ///
+ /// Green mask.
+ ///
+ GreenMask = 10,
+ ///
+ /// Blue mask.
+ ///
+ BlueMask = 11,
+ ///
+ /// Bytes per line.
+ ///
+ BytesPerLine = 12,
+ ///
+ /// Frame buffer start.
+ ///
+ FrameBufferStart = 13,
+ ///
+ /// Frame buffer offset.
+ ///
+ FrameBufferOffset = 14,
+ ///
+ /// VRAM size.
+ ///
+ VRamSize = 15,
+ ///
+ /// Frame buffer size.
+ ///
+ FrameBufferSize = 16,
+ ///
+ /// Capabilities.
+ ///
+ Capabilities = 17,
+ ///
+ /// Memory start.
+ ///
+ MemStart = 18,
+ ///
+ /// Memory size.
+ ///
+ MemSize = 19,
+ ///
+ /// Config done.
+ ///
+ ConfigDone = 20,
+ ///
+ /// Sync.
+ ///
+ Sync = 21,
+ ///
+ /// Busy.
+ ///
+ Busy = 22,
+ ///
+ /// Guest ID.
+ ///
+ GuestID = 23,
+ ///
+ /// Cursor ID.
+ ///
+ CursorID = 24,
+ ///
+ /// Cursor X.
+ ///
+ CursorX = 25,
+ ///
+ /// Cursor Y.
+ ///
+ CursorY = 26,
+ ///
+ /// Cursor on.
+ ///
+ CursorOn = 27,
+ ///
+ /// Cursor count.
+ ///
+ CursorCount = 0x0C,
+ ///
+ /// Host bits per pixel.
+ ///
+ HostBitsPerPixel = 28,
+ ///
+ /// Scratch size.
+ ///
+ ScratchSize = 29,
+ ///
+ /// Memory registers.
+ ///
+ MemRegs = 30,
+ ///
+ /// Number of displays.
+ ///
+ NumDisplays = 31,
+ ///
+ /// Pitch lock.
+ ///
+ PitchLock = 32,
+ ///
+ /// Indicates maximum size of FIFO Registers.
+ ///
+ FifoNumRegisters = 293
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/SVGAII/VMWareSVGAII.cs b/source/Cosmos.HAL2/Drivers/Video/SVGAII/VMWareSVGAII.cs
new file mode 100644
index 0000000000..aa83af57fc
--- /dev/null
+++ b/source/Cosmos.HAL2/Drivers/Video/SVGAII/VMWareSVGAII.cs
@@ -0,0 +1,421 @@
+using System;
+using Cosmos.Core;
+
+namespace Cosmos.HAL.Drivers.Video.SVGAII
+{
+ ///
+ /// VMWareSVGAII class.
+ ///
+ public class VMWareSVGAII
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VMWareSVGAII()
+ {
+ device = HAL.PCI.GetDevice(VendorID.VMWare, DeviceID.SVGAIIAdapter);
+ device.EnableMemory(true);
+ uint basePort = device.BaseAddressBar[0].BaseAddress;
+ indexPort = (ushort)(basePort + (uint)IOPortOffset.Index);
+ valuePort = (ushort)(basePort + (uint)IOPortOffset.Value);
+
+ WriteRegister(Register.ID, (uint)ID.V2);
+ if (ReadRegister(Register.ID) != (uint)ID.V2)
+ {
+ return;
+ }
+
+ videoMemory = new MemoryBlock(ReadRegister(Register.FrameBufferStart), ReadRegister(Register.VRamSize));
+ capabilities = ReadRegister(Register.Capabilities);
+ InitializeFIFO();
+ }
+
+ #region Methods
+
+ ///
+ /// Initialize FIFO.
+ ///
+ public void InitializeFIFO()
+ {
+ fifoMemory = new MemoryBlock(ReadRegister(Register.MemStart), ReadRegister(Register.MemSize));
+ fifoMemory[(uint)FIFO.Min] = (uint)Register.FifoNumRegisters * sizeof(uint);
+ fifoMemory[(uint)FIFO.Max] = fifoMemory.Size;
+ fifoMemory[(uint)FIFO.NextCmd] = fifoMemory[(uint)FIFO.Min];
+ fifoMemory[(uint)FIFO.Stop] = fifoMemory[(uint)FIFO.Min];
+ WriteRegister(Register.ConfigDone, 1);
+ }
+
+ ///
+ /// Set video mode.
+ ///
+ /// Width.
+ /// Height.
+ /// Depth.
+ public void SetMode(uint width, uint height, uint depth = 32)
+ {
+ //Disable the Driver before writing new values and initiating it again to avoid a memory exception
+ //Disable();
+
+ // Depth is color depth in bytes.
+ this.depth = depth / 8;
+ this.width = width;
+ this.height = height;
+ WriteRegister(Register.Width, width);
+ WriteRegister(Register.Height, height);
+ WriteRegister(Register.BitsPerPixel, depth);
+ Enable();
+ InitializeFIFO();
+
+ FrameSize = ReadRegister(Register.FrameBufferSize);
+ FrameOffset = ReadRegister(Register.FrameBufferOffset);
+ }
+
+ ///
+ /// Write register.
+ ///
+ /// A register.
+ /// A value.
+ public void WriteRegister(Register register, uint value)
+ {
+ IOPort.Write32(indexPort, (uint)register);
+ IOPort.Write32(valuePort, value);
+ }
+
+ ///
+ /// Read register.
+ ///
+ /// A register.
+ /// uint value.
+ public uint ReadRegister(Register register)
+ {
+ IOPort.Write32(indexPort, (uint)register);
+ return IOPort.Read32(valuePort);
+ }
+
+ ///
+ /// Get FIFO.
+ ///
+ /// FIFO command.
+ /// uint value.
+ public uint GetFIFO(FIFO cmd) => fifoMemory[(uint)cmd];
+
+ ///
+ /// Set FIFO.
+ ///
+ /// Command.
+ /// Value.
+ ///
+ public uint SetFIFO(FIFO cmd, uint value) => fifoMemory[(uint)cmd] = value;
+
+ ///
+ /// Wait for FIFO.
+ ///
+ public void WaitForFifo()
+ {
+ WriteRegister(Register.Sync, 1);
+ while (ReadRegister(Register.Busy) != 0) { }
+ }
+
+ ///
+ /// Write to FIFO.
+ ///
+ /// Value to write.
+ public void WriteToFifo(uint value)
+ {
+ if (GetFIFO(FIFO.NextCmd) == GetFIFO(FIFO.Max) - 4 && GetFIFO(FIFO.Stop) == GetFIFO(FIFO.Min) ||
+ GetFIFO(FIFO.NextCmd) + 4 == GetFIFO(FIFO.Stop))
+ {
+ WaitForFifo();
+ }
+
+ SetFIFO((FIFO)GetFIFO(FIFO.NextCmd), value);
+ SetFIFO(FIFO.NextCmd, GetFIFO(FIFO.NextCmd) + 4);
+
+ if (GetFIFO(FIFO.NextCmd) == GetFIFO(FIFO.Max))
+ {
+ SetFIFO(FIFO.NextCmd, GetFIFO(FIFO.Min));
+ }
+ }
+
+ ///
+ /// Update FIFO.
+ ///
+ /// X coordinate.
+ /// Y coordinate.
+ /// Width.
+ /// Height.
+ public void Update(uint x, uint y, uint width, uint height)
+ {
+ WriteToFifo((uint)FIFOCommand.Update);
+ WriteToFifo(x);
+ WriteToFifo(y);
+ WriteToFifo(width);
+ WriteToFifo(height);
+ WaitForFifo();
+ }
+
+ ///
+ /// Update video memory.
+ ///
+ public void DoubleBufferUpdate()
+ {
+ videoMemory.MoveDown(FrameOffset, FrameSize, FrameSize);
+ Update(0, 0, width, height);
+ }
+
+ ///
+ /// Set pixel.
+ ///
+ /// X coordinate.
+ /// Y coordinate.
+ /// Color.
+ /// Thrown on memory access violation.
+ public void SetPixel(uint x, uint y, uint color)
+ {
+ videoMemory[(y * width + x) * depth + FrameSize] = color;
+ }
+
+ ///
+ /// Get pixel.
+ ///
+ /// X coordinate.
+ /// Y coordinate.
+ /// uint value.
+ /// Thrown on memory access violation.
+ public uint GetPixel(uint x, uint y)
+ {
+ return videoMemory[(y * width + x) * depth + FrameSize];
+ }
+
+ ///
+ /// Clear screen to specified color.
+ ///
+ /// Color.
+ /// Thrown on memory access violation.
+ /// Thrown if VMWare SVGA 2 has no rectange copy capability
+ public void Clear(uint color)
+ {
+ videoMemory.Fill(FrameSize, FrameSize, color);
+ }
+
+ ///
+ /// Copy rectangle.
+ ///
+ /// Source X coordinate.
+ /// Source Y coordinate.
+ /// Destination X coordinate.
+ /// Destination Y coordinate.
+ /// Width.
+ /// Height.
+ /// Thrown if VMWare SVGA 2 has no rectange copy capability
+ public void Copy(uint x, uint y, uint newX, uint newY, uint width, uint height)
+ {
+ if ((capabilities & (uint)Capability.RectCopy) != 0)
+ {
+ WriteToFifo((uint)FIFOCommand.RECT_COPY);
+ WriteToFifo(x);
+ WriteToFifo(y);
+ WriteToFifo(newX);
+ WriteToFifo(newY);
+ WriteToFifo(width);
+ WriteToFifo(height);
+ WaitForFifo();
+ }
+ else
+ {
+ throw new NotImplementedException("VMWareSVGAII Copy()");
+ }
+ }
+
+ ///
+ /// Fill rectangle.
+ ///
+ /// X coordinate.
+ /// Y coordinate.
+ /// Width.
+ /// Height.
+ /// Color.
+ /// Thrown on memory access violation.
+ /// Thrown if VMWare SVGA 2 has no rectange copy capability
+ public void Fill(uint x, uint y, uint width, uint height, uint color)
+ {
+ if ((capabilities & (uint)Capability.RectFill) != 0)
+ {
+ WriteToFifo((uint)FIFOCommand.RECT_FILL);
+ WriteToFifo(color);
+ WriteToFifo(x);
+ WriteToFifo(y);
+ WriteToFifo(width);
+ WriteToFifo(height);
+ WaitForFifo();
+ }
+ else
+ {
+ if ((capabilities & (uint)Capability.RectCopy) != 0)
+ {
+ // fill first line and copy it to all other
+ uint xTarget = x + width;
+ uint yTarget = y + height;
+
+ for (uint xTmp = x; xTmp < xTarget; xTmp++)
+ {
+ SetPixel(xTmp, y, color);
+ }
+ // refresh first line for copy process
+ Update(x, y, width, 1);
+ for (uint yTmp = y + 1; yTmp < yTarget; yTmp++)
+ {
+ Copy(x, y, x, yTmp, width, 1);
+ }
+ }
+ else
+ {
+ uint xTarget = x + width;
+ uint yTarget = y + height;
+ for (uint xTmp = x; xTmp < xTarget; xTmp++)
+ {
+ for (uint yTmp = y; yTmp < yTarget; yTmp++)
+ {
+ SetPixel(xTmp, yTmp, color);
+ }
+ }
+ Update(x, y, width, height);
+ }
+ }
+ }
+
+ ///
+ /// Define cursor.
+ ///
+ public void DefineCursor()
+ {
+ WaitForFifo();
+ WriteToFifo((uint)FIFOCommand.DEFINE_CURSOR);
+ WriteToFifo(0); // ID
+ WriteToFifo(0); // Hotspot X
+ WriteToFifo(0); // Hotspot Y
+ WriteToFifo(2);
+ WriteToFifo(2);
+ WriteToFifo(1);
+ WriteToFifo(1);
+
+ for (int i = 0; i < 4; i++)
+ {
+ WriteToFifo(0);
+ }
+
+ for (int i = 0; i < 4; i++)
+ {
+ WriteToFifo(0xFFFFFF);
+ }
+
+ WaitForFifo();
+ }
+
+ ///
+ /// Define alpha cursor.
+ ///
+ public void DefineAlphaCursor(uint width, uint height, int[] data)
+ {
+ WaitForFifo();
+ WriteToFifo((uint)FIFOCommand.DEFINE_ALPHA_CURSOR);
+ WriteToFifo(0); // ID
+ WriteToFifo(0); // Hotspot X
+ WriteToFifo(0); // Hotspot Y
+ WriteToFifo(width); // Width
+ WriteToFifo(height); // Height
+
+ for (int i = 0; i < data.Length; i++)
+ {
+ WriteToFifo((uint)data[i]);
+ }
+
+ WaitForFifo();
+ }
+
+ ///
+ /// Enable the SVGA Driver, only needed after Disable() has been called.
+ ///
+ public void Enable()
+ {
+ WriteRegister(Register.Enable, 1);
+ }
+
+ ///
+ /// Disable the SVGA Driver, returns to text mode.
+ ///
+ public void Disable()
+ {
+ WriteRegister(Register.Enable, 0);
+ }
+
+ ///
+ /// Sets the cursor position and draws it.
+ ///
+ /// Visible.
+ /// X coordinate.
+ /// Y coordinate.
+ public void SetCursor(bool visible, uint x, uint y)
+ {
+ WriteRegister(Register.CursorOn, (uint)(visible ? 1 : 0));
+ WriteRegister(Register.CursorX, x);
+ WriteRegister(Register.CursorY, y);
+ WriteRegister(Register.CursorCount, ReadRegister(Register.CursorCount) + 1);
+ }
+
+ #endregion
+
+ #region Fields
+
+ ///
+ /// Index port.
+ ///
+ private readonly ushort indexPort;
+ ///
+ /// Value port.
+ ///
+ private readonly ushort valuePort;
+
+ ///
+ /// Video memory block.
+ ///
+ public readonly MemoryBlock videoMemory;
+
+ ///
+ /// FIFO memory block.
+ ///
+ private MemoryBlock fifoMemory;
+
+ ///
+ /// PCI device.
+ ///
+ private readonly PCIDevice device;
+
+ ///
+ /// Height.
+ ///
+ private uint height;
+
+ ///
+ /// Width.
+ ///
+ private uint width;
+
+ ///
+ /// Depth.
+ ///
+ private uint depth;
+
+ ///
+ /// Capabilities.
+ ///
+ private readonly uint capabilities;
+
+ public uint FrameSize;
+ public uint FrameOffset;
+
+ #endregion
+
+
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/VBEDriver.cs b/source/Cosmos.HAL2/Drivers/Video/VBEDriver.cs
index 4bddbe97d0..5182cd263a 100644
--- a/source/Cosmos.HAL2/Drivers/Video/VBEDriver.cs
+++ b/source/Cosmos.HAL2/Drivers/Video/VBEDriver.cs
@@ -1,10 +1,8 @@
-//#define COSMOSDEBUG
-
-using System;
+using Cosmos.Core.Multiboot;
using Cosmos.Core;
-using Cosmos.Core.IOGroup;
+using System;
-namespace Cosmos.HAL.Drivers
+namespace Cosmos.HAL.Drivers.Video
{
///
/// VBEDriver class. Used to directly write registers values to the port.
@@ -14,11 +12,11 @@ public class VBEDriver
///
/// Index IOPort.
///
- public const int VbeIndex = 0x01CE;
+ public const int VBEIndex = 0x01CE;
///
/// Data IOPort.
///
- public const int VbeData = 0x01CF;
+ public const int VBEData = 0x01CF;
/*
* This not a lot optimal as we are taking a lot of memory and then maybe the driver is configured to go at 320*240!
@@ -85,24 +83,24 @@ private enum EnableValues
};
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// X resolution.
/// Y resolution.
/// BPP (color depth).
- public VBEDriver(ushort xres, ushort yres, ushort bpp)
+ public unsafe VBEDriver(ushort xres, ushort yres, ushort bpp)
{
PCIDevice videocard;
- if (VBE.IsAvailable()) //VBE VESA Enabled Mulitboot Parsing
+ if (Multiboot2.IsVBEAvailable) //VBE VESA Enabled Mulitboot Parsing
{
- Global.mDebugger.SendInternal($"Creating VBE VESA driver with Mode {xres}*{yres}@{bpp}");
- LinearFrameBuffer = new MemoryBlock(VBE.getLfbOffset(), (uint)xres * yres * (uint)(bpp / 8));
+ Global.debugger.SendInternal($"Creating VBE VESA driver with Mode {xres}*{yres}@{bpp}");
+ LinearFrameBuffer = new MemoryBlock((uint)Multiboot2.Framebuffer->Address, (uint)xres * yres * (uint)(bpp / 8));
lastbuffer = new ManagedMemoryBlock((uint)xres * yres * (uint)(bpp / 8));
}
else if (ISAModeAvailable()) //Bochs Graphics Adaptor ISA Mode
{
- Global.mDebugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}.");
+ Global.debugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}.");
LinearFrameBuffer = new MemoryBlock(0xE0000000, 1920 * 1200 * 4);
lastbuffer = new ManagedMemoryBlock(1920 * 1200 * 4);
@@ -111,7 +109,7 @@ public VBEDriver(ushort xres, ushort yres, ushort bpp)
else if ((videocard = HAL.PCI.GetDevice(VendorID.VirtualBox, DeviceID.VBVGA)) != null || //VirtualBox Video Adapter PCI Mode
(videocard = HAL.PCI.GetDevice(VendorID.Bochs, DeviceID.BGA)) != null) // Bochs Graphics Adaptor PCI Mode
{
- Global.mDebugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}. Framebuffer address=" + videocard.BAR0);
+ Global.debugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}. Framebuffer address=" + videocard.BAR0);
LinearFrameBuffer = new MemoryBlock(videocard.BAR0, 1920 * 1200 * 4);
lastbuffer = new ManagedMemoryBlock(1920 * 1200 * 4);
@@ -130,21 +128,19 @@ public VBEDriver(ushort xres, ushort yres, ushort bpp)
/// Value.
private static void VBEWrite(RegisterIndex index, ushort value)
{
- IOPort.Write16(VbeIndex, (ushort)index);
- IOPort.Write16(VbeData, value);
+ IOPort.Write16(VBEIndex, (ushort)index);
+ IOPort.Write16(VBEData, value);
}
private static ushort VBERead(RegisterIndex index)
{
- IOPort.Write16(VbeIndex, (ushort)index);
- return IOPort.Read16(VbeData);
+ IOPort.Write16(VBEIndex, (ushort)index);
+ return IOPort.Read16(VBEData);
}
public static bool ISAModeAvailable()
{
//This code wont work as long as Bochs uses BGA ISA, since it wont discover it in PCI
-#if false
- return HAL.PCI.GetDevice(VendorID.Bochs, DeviceID.BGA) != null;
-#endif
+ // return HAL.PCI.GetDevice(VendorID.Bochs, DeviceID.BGA) != null;
return VBERead(RegisterIndex.DisplayID) == 0xB0C5;
}
@@ -153,7 +149,7 @@ public static bool ISAModeAvailable()
///
public void DisableDisplay()
{
- Global.mDebugger.SendInternal($"Disabling VBE display");
+ Global.debugger.SendInternal($"Disabling VBE display");
VBEWrite(RegisterIndex.DisplayEnable, (ushort)EnableValues.Disabled);
}
@@ -163,7 +159,7 @@ public void DisableDisplay()
/// X resolution.
private void SetXResolution(ushort xres)
{
- Global.mDebugger.SendInternal($"VBE Setting X resolution to {xres}");
+ Global.debugger.SendInternal($"VBE Setting X resolution to {xres}");
VBEWrite(RegisterIndex.DisplayXResolution, xres);
}
@@ -173,7 +169,7 @@ private void SetXResolution(ushort xres)
/// Y resolution.
private void SetYResolution(ushort yres)
{
- Global.mDebugger.SendInternal($"VBE Setting Y resolution to {yres}");
+ Global.debugger.SendInternal($"VBE Setting Y resolution to {yres}");
VBEWrite(RegisterIndex.DisplayYResolution, yres);
}
@@ -183,7 +179,7 @@ private void SetYResolution(ushort yres)
/// BPP (color depth).
private void SetDisplayBPP(ushort bpp)
{
- Global.mDebugger.SendInternal($"VBE Setting BPP to {bpp}");
+ Global.debugger.SendInternal($"VBE Setting BPP to {bpp}");
VBEWrite(RegisterIndex.DisplayBPP, bpp);
}
@@ -321,4 +317,4 @@ public void Swap()
LinearFrameBuffer.Copy(lastbuffer);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Drivers/Video/VGADriver.cs b/source/Cosmos.HAL2/Drivers/Video/VGADriver.cs
index d052f13aca..833fba2d63 100644
--- a/source/Cosmos.HAL2/Drivers/Video/VGADriver.cs
+++ b/source/Cosmos.HAL2/Drivers/Video/VGADriver.cs
@@ -1,4 +1,3 @@
-//#define COSMOSDEBUG
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -13,91 +12,110 @@
* by Stephen Remde
//*/
-namespace Cosmos.HAL
+namespace Cosmos.HAL.Drivers.Video
{
public class VGADriver
{
- internal Debugger mDebugger = new Debugger("HAL", "VGA");
- private const byte _NumSeqRegs = 5;
- private const byte _NumCRTCRegs = 25;
- private const byte _NumGCRegs = 9;
- private const byte _NumACRegs = 21;
+ #region Properties
- Mode _Mode;
- ScreenSize _ScreenSize;
- ColorDepth _ColorDepth;
+ public enum TextSize
+ {
+ Size40x25,
+ Size40x50,
+ Size80x25,
+ Size80x50,
+ Size90x30,
+ Size90x60
+ };
+
+ public enum ScreenSize
+ {
+ ///
+ /// 640x480 graphics mode - 2 and 4 bit color depth available
+ ///
+ Size640x480,
+
+ ///
+ /// 720x480 graphics mode - 16 bit color depth available
+ ///
+ Size720x480,
+
+ ///
+ /// 320x200 graphics mode - 4 and 8 bit color depth available
+ ///
+ Size320x200
+ };
+
+ public enum ColorDepth
+ {
+ BitDepth2 = 2,
+ BitDepth4 = 4,
+ BitDepth8 = 8,
+ BitDepth16 = 16
+ };
///
- /// Attribute controller index port.
- ///
- public const int AttributeController_Index = 0x3C0;
- ///
- /// Attribute controller write port.
- ///
- public const int AttributeController_Write = 0x3C0;
- ///
- /// Attribute controller read port.
- ///
- public const int AttributeController_Read = 0x3C1;
- ///
- /// Miscellaneous output write port.
- ///
- public const int MiscellaneousOutput_Write = 0x3C2;
- ///
- /// Sequencer index port.
- ///
- public const int Sequencer_Index = 0x3C4;
- ///
- /// Sequencer data port.
- ///
- public const int Sequencer_Data = 0x3C5;
- ///
- /// DAC index read port.
- ///
- public const int DACIndex_Read = 0x3C7;
- ///
- /// DAC index write port.
- ///
- public const int DACIndex_Write = 0x3C8;
- ///
- /// DAC data port.
- ///
- public const int DAC_Data = 0x3C9;
- ///
- /// Graphics controller index port.
- ///
- public const int GraphicsController_Index = 0x3CE;
- ///
- /// Graphics controller data port.
- ///
- public const int GraphicsController_Data = 0x3CF;
- ///
- /// CRT controller index port.
- ///
- public const int CRTController_Index = 0x3D4;
- ///
- /// CRT controller data port.
- ///
- public const int CRTController_Data = 0x3D5;
- ///
- /// Instant read port.
+ /// Get and set pixel width.
///
- public const int Instat_Read = 0x3DA;
+ public int PixelWidth { private set; get; }
///
- /// 128KB at 0xA0000
+ /// Get and set pixel height.
///
- public readonly MemoryBlock VGAMemoryBlock = new MemoryBlock(0xA0000, 1024 * 128);
+ public int PixelHeight { private set; get; }
///
- /// 32KB at 0xB0000
+ /// Get and set colors.
///
- public readonly MemoryBlock MonochromeTextMemoryBlock = new MemoryBlock(0xB0000, 1024 * 32);
+ public int Colors { private set; get; }
+
+ private enum Mode { Text, Graphical }
+
+ #endregion
+
+ #region Methods
+
+ //Get all the colors from the palette
+ public void ReadPalette()
+ {
+ debugger.Send("Reading set palette");
+ IOPort.Write16(DACIndex_Read, 0);
+ for (int i = 0; i < 256; i++)
+ {
+ int red = IOPort.Read8(DAC_Data) << 2;
+ int green = IOPort.Read8(DAC_Data) << 2;
+ int blue = IOPort.Read8(DAC_Data) << 2;
+ var argb = (red << 16) | (green << 8) | blue;
+ palette[i] = Color.FromArgb(argb);
+ }
+ }
+
+ public Color GetPaletteEntry(int aIndex)
+ {
+ return palette[aIndex];
+ }
+
+ public void SetPaletteEntry(int aIndex, Color aColor)
+ {
+ palette[aIndex] = aColor;
+ SetPaletteEntry(aIndex, aColor.R, aColor.G, aColor.B);
+ }
///
- /// 32KB at 0xB8000
+ /// Set palette entry.
///
- public readonly MemoryBlock CGATextMemoryBlock = new MemoryBlock(0xB8000, 1024 * 32);
+ /// Index.
+ /// Red.
+ /// Green.
+ /// Blue.
+ public void SetPaletteEntry(int aIndex, byte aR, byte aG, byte aB)
+ {
+ palette[aIndex] = Color.FromArgb(aR, aG, aB);
+ IOPort.Write8(DACIndex_Write, (byte)aIndex);
+ IOPort.Write8(DAC_Data, (byte)(aR >> 2));
+ IOPort.Write8(DAC_Data, (byte)(aG >> 2));
+ IOPort.Write8(DAC_Data, (byte)(aB >> 2));
+ }
private void WriteVGARegisters(byte[] aRegisters)
{
@@ -107,7 +125,7 @@ private void WriteVGARegisters(byte[] aRegisters)
/* write MISCELLANEOUS reg */
IOPort.Write8(MiscellaneousOutput_Write, aRegisters[xIdx++]);
/* write SEQUENCER regs */
- for (i = 0; i < _NumSeqRegs; i++)
+ for (i = 0; i < numSeqRegs; i++)
{
IOPort.Write8(Sequencer_Index, i);
IOPort.Write8(Sequencer_Data, aRegisters[xIdx++]);
@@ -123,19 +141,19 @@ private void WriteVGARegisters(byte[] aRegisters)
aRegisters[0x11] &= 0x7f;
/* write CRTC regs */
- for (i = 0; i < _NumCRTCRegs; i++)
+ for (i = 0; i < numCRTCRegs; i++)
{
IOPort.Write8(CRTController_Index, i);
IOPort.Write8(CRTController_Data, aRegisters[xIdx++]);
}
/* write GRAPHICS CONTROLLER regs */
- for (i = 0; i < _NumGCRegs; i++)
+ for (i = 0; i < numGCRegs; i++)
{
IOPort.Write8(GraphicsController_Index, i);
IOPort.Write8(GraphicsController_Data, aRegisters[xIdx++]);
}
/* write ATTRIBUTE CONTROLLER regs */
- for (i = 0; i < _NumACRegs; i++)
+ for (i = 0; i < numACRegs; i++)
{
var _ = IOPort.Read8(Instat_Read);
IOPort.Write8(AttributeController_Index, i);
@@ -144,7 +162,7 @@ private void WriteVGARegisters(byte[] aRegisters)
/* lock 16-color palette and unblank display */
_ = IOPort.Read8(Instat_Read);
IOPort.Write8(AttributeController_Index, 0x20);
- mDebugger.Send("Finished writing VGA registers");
+ debugger.Send("Finished writing VGA registers");
}
///
@@ -173,21 +191,17 @@ private MemoryBlock GetFramebufferSegment()
{
IOPort.Write8(GraphicsController_Index, 6);
int seg = IOPort.Read8(GraphicsController_Data);
- mDebugger.Send($"VGA: raw seg value: {seg}");
+ debugger.Send($"VGA: raw seg value: {seg}");
seg >>= 2;
seg &= 3;
- switch (seg)
+ return seg switch
{
- case 0:
- case 1:
- return VGAMemoryBlock;
- case 2:
- return MonochromeTextMemoryBlock;
- case 3:
- return CGATextMemoryBlock;
- }
- throw new Exception("Unable to determine memory segment!");
+ 0 or 1 => VGAMemoryBlock,
+ 2 => MonochromeTextMemoryBlock,
+ 3 => CGATextMemoryBlock,
+ _ => throw new Exception("Unable to determine memory segment!"),
+ };
}
///
@@ -253,11 +267,6 @@ public void WriteFont(byte[] aFont, byte aFontHeight)
IOPort.Write8(GraphicsController_Data, gc6);
}
- public VGADriver()
- {
-
- }
-
///
/// The closest color in the palette will be found to be drawn
/// This is quite slow, so whenever possible use the index of the color
@@ -284,9 +293,9 @@ public uint GetClosestColorInPalette(Color aColor)
uint index = 0;
double diff = 1000000;
- for (uint i = 0; i < 2 << ((int)_ColorDepth - 1); i++) //iterate over the total palette
+ for (uint i = 0; i < 2 << ((int)colorDepth - 1); i++) //iterate over the total palette
{
- var paletteColor = _Palette[i];
+ var paletteColor = palette[i];
var colorDiff = (aColor.R - paletteColor.R) * (aColor.R - paletteColor.R) * 0.3 + //Taken from https://stackoverflow.com/questions/1847092/given-an-rgb-value-what-would-be-the-best-way-to-find-the-closest-match-in-the-d
(aColor.G - paletteColor.G) * (aColor.G - paletteColor.G) * 0.59 + (aColor.B - paletteColor.B) * (aColor.B - paletteColor.B) * 0.11;
//mDebugger.Send($"Standard Color: {aColor.R} {aColor.G} {aColor.B} Comparing to: {paletteColor.R} {paletteColor.G} {paletteColor.B} Diff: {colorDiff}");
@@ -315,14 +324,14 @@ public uint GetClosestColorInPalette(Color aColor)
public void SetPixel(uint aX, uint aY, uint aColor)
{
//Global.mDebugger.Send($"Setting pixel: ({x}, {y}) to {color}");
- if(_Mode == Mode.Text)
+ if (mode == Mode.Text)
{
throw new Exception("Cannot set pixel in text mode");
}
- switch (_ScreenSize)
+ switch (screenSize)
{
case ScreenSize.Size640x480:
- switch (_ColorDepth)
+ switch (colorDepth)
{
case ColorDepth.BitDepth2:
throw new NotImplementedException();
@@ -338,7 +347,7 @@ public void SetPixel(uint aX, uint aY, uint aColor)
}
break;
case ScreenSize.Size720x480:
- switch (_ColorDepth)
+ switch (colorDepth)
{
case ColorDepth.BitDepth2:
throw new NotImplementedException();
@@ -354,7 +363,7 @@ public void SetPixel(uint aX, uint aY, uint aColor)
}
break;
case ScreenSize.Size320x200:
- switch (_ColorDepth)
+ switch (colorDepth)
{
case ColorDepth.BitDepth2:
throw new NotImplementedException();
@@ -376,14 +385,13 @@ public void SetPixel(uint aX, uint aY, uint aColor)
public uint GetPixel(uint aX, uint aY)
{
- Global.mDebugger.Send($"GetPixel: ({aX},{aY})");
- if (_Mode == Mode.Text)
+ if (mode == Mode.Text)
{
throw new Exception("Cannot get pixel in text mode");
}
- return _ScreenSize switch
+ return screenSize switch
{
- ScreenSize.Size640x480 => _ColorDepth switch
+ ScreenSize.Size640x480 => colorDepth switch
{
ColorDepth.BitDepth2 => throw new NotImplementedException(),
ColorDepth.BitDepth4 => GetPixel640x480x4(aX, aY),
@@ -391,7 +399,7 @@ public uint GetPixel(uint aX, uint aY)
ColorDepth.BitDepth16 => throw new NotImplementedException(),
_ => throw new NotImplementedException(),
},
- ScreenSize.Size720x480 => _ColorDepth switch
+ ScreenSize.Size720x480 => colorDepth switch
{
ColorDepth.BitDepth2 => throw new NotImplementedException(),
ColorDepth.BitDepth4 => GetPixel720x480x4(aX, aY),
@@ -399,7 +407,7 @@ public uint GetPixel(uint aX, uint aY)
ColorDepth.BitDepth16 => throw new NotImplementedException(),
_ => throw new NotImplementedException(),
},
- ScreenSize.Size320x200 => _ColorDepth switch
+ ScreenSize.Size320x200 => colorDepth switch
{
ColorDepth.BitDepth2 => throw new NotImplementedException(),
ColorDepth.BitDepth4 => throw new NotImplementedException(),
@@ -411,42 +419,6 @@ public uint GetPixel(uint aX, uint aY)
};
}
- public enum TextSize
- {
- Size40x25,
- Size40x50,
- Size80x25,
- Size80x50,
- Size90x30,
- Size90x60
- };
-
- public enum ScreenSize
- {
- ///
- /// 640x480 graphics mode - 2 and 4 bit color depth available
- ///
- Size640x480,
-
- ///
- /// 720x480 graphics mode - 16 bit color depth available
- ///
- Size720x480,
-
- ///
- /// 320x200 graphics mode - 4 and 8 bit color depth available
- ///
- Size320x200
- };
-
- public enum ColorDepth
- {
- BitDepth2=2,
- BitDepth4=4,
- BitDepth8=8,
- BitDepth16=16
- };
-
///
/// Set text size.
///
@@ -454,8 +426,8 @@ public enum ColorDepth
/// Thrown when text size invalid / unable to determine memory segment.
public void SetTextMode(TextSize aSize)
{
- mDebugger.Send("Setting TextMode:" + aSize.ToString());
- _Mode = Mode.Text;
+ debugger.Send("Setting TextMode:" + aSize.ToString());
+ mode = Mode.Text;
switch (aSize)
{
case TextSize.Size40x25:
@@ -508,16 +480,16 @@ public void SetTextMode(TextSize aSize)
/// Thrown when aDepth not supported for the aSize / unknown screen size.
public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
{
- mDebugger.Send("Setting GraphicsMode:" + ((int)aSize).ToString() + " - " + ((int)aDepth).ToString());
- _ScreenSize = aSize;
- _ColorDepth = aDepth;
- _Mode = Mode.Graphical;
+ debugger.Send("Setting GraphicsMode:" + ((int)aSize).ToString() + " - " + ((int)aDepth).ToString());
+ screenSize = aSize;
+ colorDepth = aDepth;
+ mode = Mode.Graphical;
switch (aSize)
{
case ScreenSize.Size320x200:
if (aDepth == ColorDepth.BitDepth8)
{
- mDebugger.Send("Setting graphic mode to 320x200@256");
+ debugger.Send("Setting graphic mode to 320x200@256");
WriteVGARegisters(_G_320x200x8);
PixelWidth = 320;
@@ -526,7 +498,7 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
}
else if (aDepth == ColorDepth.BitDepth4)
{
- mDebugger.Send("Setting graphic mode to 320x200@16");
+ debugger.Send("Setting graphic mode to 320x200@16");
WriteVGARegisters(_G_320x200x4);
PixelWidth = 320;
@@ -541,7 +513,7 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
case ScreenSize.Size640x480:
if (aDepth == ColorDepth.BitDepth2)
{
- mDebugger.Send("Setting graphic mode to 640x480@4");
+ debugger.Send("Setting graphic mode to 640x480@4");
WriteVGARegisters(_G_640x480x2);
PixelWidth = 640;
@@ -550,7 +522,7 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
}
else if (aDepth == ColorDepth.BitDepth4)
{
- mDebugger.Send("Setting graphic mode to 640x480@16");
+ debugger.Send("Setting graphic mode to 640x480@16");
WriteVGARegisters(_G_640x480x4);
@@ -566,7 +538,7 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
case ScreenSize.Size720x480:
if (aDepth == ColorDepth.BitDepth4)
{
- mDebugger.Send("Setting graphic mode to 720x480@16");
+ debugger.Send("Setting graphic mode to 720x480@16");
WriteVGARegisters(_G_720x480x4);
PixelWidth = 720;
@@ -585,34 +557,34 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
// Clear the cached results as the palette will change
colorToPalette = new Dictionary();
// Initialize the palette
- _Palette[0] = Color.Black;
+ palette[0] = Color.Black;
switch (aDepth)
{
case ColorDepth.BitDepth2:
//There are two different color modes available, Assume we are using palette 0
- _Palette[1] = Color.Green;
- _Palette[2] = Color.Red;
- _Palette[3] = Color.Brown;
+ palette[1] = Color.Green;
+ palette[2] = Color.Red;
+ palette[3] = Color.Brown;
//_Palette[1] = Color.Cyan;
//_Palette[2] = Color.Magenta;
//_Palette[3] = Color.Gray;
break;
case ColorDepth.BitDepth4:
- _Palette[1] = Color.Blue;
- _Palette[2] = Color.Green;
- _Palette[3] = Color.Cyan;
- _Palette[4] = Color.Red;
- _Palette[5] = Color.DarkMagenta;
- _Palette[6] = Color.Brown;
- _Palette[7] = Color.LightGray;
- _Palette[8] = Color.DarkGray;
- _Palette[9] = Color.LightBlue;
- _Palette[10] = Color.LightGreen;
- _Palette[11] = Color.LightCyan;
- _Palette[12] = Color.Pink;
- _Palette[13] = Color.Magenta;
- _Palette[14] = Color.Yellow;
- _Palette[15] = Color.White;
+ palette[1] = Color.Blue;
+ palette[2] = Color.Green;
+ palette[3] = Color.Cyan;
+ palette[4] = Color.Red;
+ palette[5] = Color.DarkMagenta;
+ palette[6] = Color.Brown;
+ palette[7] = Color.LightGray;
+ palette[8] = Color.DarkGray;
+ palette[9] = Color.LightBlue;
+ palette[10] = Color.LightGreen;
+ palette[11] = Color.LightCyan;
+ palette[12] = Color.Pink;
+ palette[13] = Color.Magenta;
+ palette[14] = Color.Yellow;
+ palette[15] = Color.White;
break;
case ColorDepth.BitDepth8:
int[] colors = new int[256] // Credits to https://commons.wikimedia.org/w/index.php?title=User:Psychonaut/ipalette.sh&oldid=8607095
@@ -646,7 +618,7 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
};
for (int i = 0; i < 256; i++)
{
- _Palette[i] = Color.FromArgb(colors[i]);
+ palette[i] = Color.FromArgb(colors[i]);
}
break;
case ColorDepth.BitDepth16:
@@ -657,7 +629,7 @@ public void SetGraphicsMode(ScreenSize aSize, ColorDepth aDepth)
for (int i = 0; i < 2 << ((int)aDepth - 1); i++)
{
- SetPaletteEntry(i, _Palette[i]);
+ SetPaletteEntry(i, palette[i]);
}
}
@@ -671,11 +643,9 @@ public void SetPixel320x200x8(uint aX, uint aY, uint aC)
public uint GetPixel320x200x8(uint aX, uint aY)
{
- mDebugger.Send($"GetPixel320x200x8({aX},{aY})");
return VGAMemoryBlock.Bytes[aY * 320 + aX];
}
-
public void SetPixel640x480x4(uint aX, uint aY, uint aC)
{
uint offset = (uint)(aX / 8 + PixelWidth / 8 * aY);
@@ -705,7 +675,6 @@ public void SetPixel640x480x4(uint aX, uint aY, uint aC)
public uint GetPixel640x480x4(uint aX, uint aY)
{
- mDebugger.Send($"GetPixel640x480x4({aX},{aY})");
uint offset = (uint)(aX / 8 + PixelWidth / 8 * aY);
uint pmask = 1;
@@ -756,8 +725,6 @@ public void SetPixel720x480x4(uint aX, uint aY, uint aC)
public uint GetPixel720x480x4(uint aX, uint aY)
{
- mDebugger.Send($"GetPixel720x480x4({aX},{aY})");
-
uint offset = (uint)(aX / 8 + PixelWidth / 8 * aY);
int pixelOffset = (int)(7 - aX % 8);
uint pmask = 1;
@@ -777,24 +744,9 @@ public uint GetPixel720x480x4(uint aX, uint aY)
pmask <<= 1;
}
- return (uint)_Palette[color].ToArgb();
+ return (uint)palette[color].ToArgb();
}
- ///
- /// Get and set pixel width.
- ///
- public int PixelWidth { private set; get; }
-
- ///
- /// Get and set pixel height.
- ///
- public int PixelHeight { private set; get; }
-
- ///
- /// Get and set colors.
- ///
- public int Colors { private set; get; }
-
///
/// Draw Filled Rectangle
///
@@ -806,14 +758,14 @@ public uint GetPixel720x480x4(uint aX, uint aY)
/// Thrown when Textmode enabled.
public void DrawFilledRectangle(int aX, int aY, int aW, int aH, uint aColor)
{
- if (_Mode == Mode.Text)
+ if (mode == Mode.Text)
{
throw new Exception("Cannot draw filled rectangle in text mode");
}
- switch (_ScreenSize)
+ switch (screenSize)
{
case ScreenSize.Size640x480:
- switch (_ColorDepth)
+ switch (colorDepth)
{
case ColorDepth.BitDepth2:
throw new NotImplementedException();
@@ -835,7 +787,7 @@ public void DrawFilledRectangle(int aX, int aY, int aW, int aH, uint aColor)
}
break;
case ScreenSize.Size720x480:
- switch (_ColorDepth)
+ switch (colorDepth)
{
case ColorDepth.BitDepth2:
throw new NotImplementedException();
@@ -857,7 +809,7 @@ public void DrawFilledRectangle(int aX, int aY, int aW, int aH, uint aColor)
}
break;
case ScreenSize.Size320x200:
- switch (_ColorDepth)
+ switch (colorDepth)
{
case ColorDepth.BitDepth2:
throw new NotImplementedException();
@@ -883,49 +835,94 @@ public void DrawFilledRectangle(int aX, int aY, int aW, int aH, uint aColor)
}
}
- private readonly Color[] _Palette = new Color[256];
+ #endregion
- //Get all the colors from the palette
- public void ReadPalette()
- {
- mDebugger.Send("Reading set palette");
- IOPort.Write16(DACIndex_Read, 0);
- for (int i = 0; i < 256; i++)
- {
- int red = IOPort.Read8(DAC_Data) << 2;
- int green = IOPort.Read8(DAC_Data) << 2;
- int blue = IOPort.Read8(DAC_Data) << 2;
- var argb = (red << 16) | (green << 8) | blue;
- _Palette[i] = Color.FromArgb(argb);
- }
- }
+ #region Fields
- public Color GetPaletteEntry(int aIndex)
- {
- return _Palette[aIndex];
- }
+ private readonly Color[] palette = new Color[256];
+ internal Debugger debugger = new("VGA");
+ private const byte numSeqRegs = 5;
+ private const byte numCRTCRegs = 25;
+ private const byte numGCRegs = 9;
+ private const byte numACRegs = 21;
- public void SetPaletteEntry(int aIndex, Color aColor)
- {
- _Palette[aIndex] = aColor;
- SetPaletteEntry(aIndex, aColor.R, aColor.G, aColor.B);
- }
+ ScreenSize screenSize;
+ ColorDepth colorDepth;
+ Mode mode;
///
- /// Set palette entry.
+ /// Attribute controller index port.
///
- /// Index.
- /// Red.
- /// Green.
- /// Blue.
- public void SetPaletteEntry(int aIndex, byte aR, byte aG, byte aB)
- {
- _Palette[aIndex] = Color.FromArgb(aR, aG, aB);
- IOPort.Write8(DACIndex_Write, (byte)aIndex);
- IOPort.Write8(DAC_Data, (byte)(aR >> 2));
- IOPort.Write8(DAC_Data, (byte)(aG >> 2));
- IOPort.Write8(DAC_Data, (byte)(aB >> 2));
- }
+ public const int AttributeController_Index = 0x3C0;
+ ///
+ /// Attribute controller write port.
+ ///
+ public const int AttributeController_Write = 0x3C0;
+ ///
+ /// Attribute controller read port.
+ ///
+ public const int AttributeController_Read = 0x3C1;
+ ///
+ /// Miscellaneous output write port.
+ ///
+ public const int MiscellaneousOutput_Write = 0x3C2;
+ ///
+ /// Sequencer index port.
+ ///
+ public const int Sequencer_Index = 0x3C4;
+ ///
+ /// Sequencer data port.
+ ///
+ public const int Sequencer_Data = 0x3C5;
+ ///
+ /// DAC index read port.
+ ///
+ public const int DACIndex_Read = 0x3C7;
+ ///
+ /// DAC index write port.
+ ///
+ public const int DACIndex_Write = 0x3C8;
+ ///
+ /// DAC data port.
+ ///
+ public const int DAC_Data = 0x3C9;
+ ///
+ /// Graphics controller index port.
+ ///
+ public const int GraphicsController_Index = 0x3CE;
+ ///
+ /// Graphics controller data port.
+ ///
+ public const int GraphicsController_Data = 0x3CF;
+ ///
+ /// CRT controller index port.
+ ///
+ public const int CRTController_Index = 0x3D4;
+ ///
+ /// CRT controller data port.
+ ///
+ public const int CRTController_Data = 0x3D5;
+ ///
+ /// Instant read port.
+ ///
+ public const int Instat_Read = 0x3DA;
+
+ ///
+ /// 128KB at 0xA0000
+ ///
+ public readonly MemoryBlock VGAMemoryBlock = new MemoryBlock(0xA0000, 1024 * 128);
+
+ ///
+ /// 32KB at 0xB0000
+ ///
+ public readonly MemoryBlock MonochromeTextMemoryBlock = new MemoryBlock(0xB0000, 1024 * 32);
+
+ ///
+ /// 32KB at 0xB8000
+ ///
+ public readonly MemoryBlock CGATextMemoryBlock = new MemoryBlock(0xB8000, 1024 * 32);
+
+ #endregion
#region FONTS
@@ -1734,7 +1731,5 @@ public void SetPaletteEntry(int aIndex, byte aR, byte aG, byte aB)
};
#endregion
-
- private enum Mode { Text, Graphical}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Global.cs b/source/Cosmos.HAL2/Global.cs
index 0aad9d342d..c088298b5b 100644
--- a/source/Cosmos.HAL2/Global.cs
+++ b/source/Cosmos.HAL2/Global.cs
@@ -10,15 +10,15 @@ namespace Cosmos.HAL
{
public static class Global
{
- public static readonly Debugger mDebugger = new Debugger("HAL", "Global");
+ public static readonly Debugger debugger = new("Global");
- public static PIT PIT = new PIT();
+ public static PIT PIT = new();
// Must be static init, other static inits rely on it not being null
public static TextScreenBase TextScreen = new TextScreen();
public static PCI Pci;
- public static readonly PS2Controller PS2Controller = new PS2Controller();
+ public static readonly PS2Controller PS2Controller = new();
// TODO: continue adding exceptions to the list, as HAL and Core would be documented.
///
@@ -33,7 +33,7 @@ static public void Init(TextScreenBase textScreen, bool InitScrollWheel, bool In
TextScreen = textScreen;
}
- mDebugger.Send("Before Core.Global.Init");
+ debugger.Send("Before Core.Global.Init");
Core.Global.Init();
//TODO Redo this - Global init should be other.
@@ -47,24 +47,24 @@ static public void Init(TextScreenBase textScreen, bool InitScrollWheel, bool In
// for the future.
Console.Clear();
Console.WriteLine("Finding PCI Devices");
- mDebugger.Send("PCI Devices");
+ debugger.Send("PCI Devices");
PCI.Setup();
Console.WriteLine("Starting ACPI");
- mDebugger.Send("ACPI Init");
+ debugger.Send("ACPI Init");
ACPI.Start();
// http://wiki.osdev.org/%228042%22_PS/2_Controller#Initialising_the_PS.2F2_Controller
// TODO: USB should be initialized before the PS/2 controller
// TODO: ACPI should be used to check if a PS/2 controller exists
- mDebugger.Send("PS/2 Controller Init");
+ debugger.Send("PS/2 Controller Init");
if (InitPS2)
{
PS2Controller.Initialize(InitScrollWheel);
}
else
{
- mDebugger.Send("PS/2 Controller disabled in User Kernel");
+ debugger.Send("PS/2 Controller disabled in User Kernel");
}
if (IDEInit)
{
@@ -72,22 +72,22 @@ static public void Init(TextScreenBase textScreen, bool InitScrollWheel, bool In
}
else
{
- mDebugger.Send("IDE Driver disabled in User Kernel");
+ debugger.Send("IDE Driver disabled in User Kernel");
}
AHCI.InitDriver();
//EHCI.InitDriver();
if (InitNetwork)
{
- mDebugger.Send("Network Devices Init");
+ debugger.Send("Network Devices Init");
NetworkInit.Init();
}
else
{
- mDebugger.Send("Network Driver disabled in User Kernel");
+ debugger.Send("Network Driver disabled in User Kernel");
}
Console.WriteLine("Enabling Serial Output on COM1");
- SerialPort.Enable(SerialPort.COM1);
- mDebugger.Send("Done initializing Cosmos.HAL.Global");
+ SerialPort.Enable(COMPort.COM1, BaudRate.BaudRate38400);
+ debugger.Send("Done initializing Cosmos.HAL.Global");
}
diff --git a/source/Cosmos.HAL2/Keyboard.html b/source/Cosmos.HAL2/Keyboard.html
deleted file mode 100644
index 9b73aa3445..0000000000
--- a/source/Cosmos.HAL2/Keyboard.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
- http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html#ss1.1
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Network/NetworkInit.cs b/source/Cosmos.HAL2/Network/NetworkInit.cs
index 607bfd6566..5fad2b9dbc 100644
--- a/source/Cosmos.HAL2/Network/NetworkInit.cs
+++ b/source/Cosmos.HAL2/Network/NetworkInit.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Text;
-using Cosmos.HAL.Drivers.PCI.Network;
+using Cosmos.HAL.Drivers.Network;
namespace Cosmos.HAL.Network
{
@@ -179,4 +177,4 @@ public static void Init()
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/PCI.cs b/source/Cosmos.HAL2/PCI.cs
index f684642a76..acb3a0a11d 100644
--- a/source/Cosmos.HAL2/PCI.cs
+++ b/source/Cosmos.HAL2/PCI.cs
@@ -1,8 +1,4 @@
-using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Cosmos.Debug.Kernel;
namespace Cosmos.HAL
{
@@ -80,10 +76,7 @@ public class PCI
{
public static List Devices;
- public static uint Count
- {
- get { return (uint)Devices.Count; }
- }
+ public static uint Count => (uint)Devices.Count;
public static void Setup()
{
@@ -97,7 +90,9 @@ public static void Setup()
for (ushort fn = 0; fn < 8; fn++)
{
if (PCIDevice.GetVendorID(0x0, 0x0, fn) != 0xFFFF)
+ {
break;
+ }
CheckBus(fn);
}
@@ -212,4 +207,4 @@ public static PCIDevice GetDeviceClass(ClassID aClass, SubclassID aSubClass, Pro
return null;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/PCI.html b/source/Cosmos.HAL2/PCI.html
deleted file mode 100644
index 29fd451877..0000000000
--- a/source/Cosmos.HAL2/PCI.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
- http://wiki.osdev.org/PCI
-
- http://en.wikipedia.org/wiki/Conventional_PCI
-
- http://www.waste.org/~winkles/hardware/pci.htm
-
- http://tldp.org/LDP/tlk/dd/pci.html
-
- PCI Database
-
-
- VMWare Worksation
- Intel: 8086
-7190: 440BX/ZX AGPset Host Bridge
-7191: 440BX/ZX AGPset PCI-to-PCI bridge
-7110: PIIX4/4E/4M ISBridgeA
-7111: PIIX4/4E/4M IDE Controller 82371AB/EB/MB
-7113: PIIX4/4E/4M Power Management Controller
-7112: PIIX4/4E/4M USB Interface
- Mylex / Buslogic: 104B
-1040: BT958 SCSI Host Adaptor
- Advanced Micro Devices: 1022
-2000: PCnet LANCE PCI Ethernet Controller Am79C970/1/2/3/5/6
- Ensoniq: 1274
-1371: AudioPCI ES 1371
- VMWare: 15AD
-0740: VMWare VMCI Bus Device
-0405: NVIDIA 9500MGS Graphics
-0790: PCI bridge
-07A0: (32 instances) EHCI USB Controller
-0770: Standard Enhanced PCI to USB Host Controller
-
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/PCSpeaker.cs b/source/Cosmos.HAL2/PCSpeaker.cs
index 0e80526830..5d4cde1f3e 100644
--- a/source/Cosmos.HAL2/PCSpeaker.cs
+++ b/source/Cosmos.HAL2/PCSpeaker.cs
@@ -61,7 +61,7 @@ public static void Beep(uint frequency)
{
if (frequency < 37 || frequency > 32767)
{
- throw new ArgumentOutOfRangeException("Frequency must be between 37 and 32767Hz");
+ throw new ArgumentOutOfRangeException(nameof(frequency), "Value must be between 37 and 32767Hz!");
}
uint divisor = 1193180 / frequency;
@@ -85,9 +85,13 @@ public static void Beep(uint frequency)
/// Thrown if duration or frequency invalid.
public static void Beep(uint frequency, uint duration)
{
+ if (frequency < 37 || frequency > 32767)
+ {
+ throw new ArgumentOutOfRangeException(nameof(frequency), "Value must be between 37 and 32767Hz!");
+ }
if (duration <= 0)
{
- throw new ArgumentOutOfRangeException("Duration must be more than 0");
+ throw new ArgumentOutOfRangeException(nameof(duration), "Value must be more than 0!");
}
Beep(frequency);
diff --git a/source/Cosmos.HAL2/PIT.cs b/source/Cosmos.HAL2/PIT.cs
index 376dceafb3..adb002a88c 100644
--- a/source/Cosmos.HAL2/PIT.cs
+++ b/source/Cosmos.HAL2/PIT.cs
@@ -59,7 +59,7 @@ public PITTimer(OnTrigger callback, ulong nanosecondsTimeout, bool recurring)
Recurring = recurring;
}
- ///
+ ///
public PITTimer(Action callback, ulong nanosecondsTimeout, bool recurring)
: this(_ => callback(), nanosecondsTimeout, recurring)
{ }
@@ -79,7 +79,7 @@ public PITTimer(OnTrigger callback, ulong nanosecondsTimeout, ulong nanosecondsL
Recurring = true;
}
- ///
+ ///
public PITTimer(Action callback, ulong nanosecondsTimeout, ulong nanosecondsLeft)
: this(_ => callback(), nanosecondsTimeout, nanosecondsLeft)
{ }
@@ -96,13 +96,6 @@ public void Dispose()
Global.PIT.UnregisterTimer(ID);
}
}
-
- #region (deprecated)
-
- [Obsolete($"Use the {nameof(Recurring)} property instead.")]
- public bool Recuring => Recurring;
-
- #endregion
}
public const uint PITFrequency = 1193180;
@@ -111,8 +104,8 @@ public void Dispose()
public bool T0RateGen = false;
private readonly List activeHandlers = new();
- private ushort _T0Countdown = 65535;
- private ushort _T2Countdown = 65535;
+ private ushort t0Countdown = 65535;
+ private ushort t2Countdown = 65535;
private int timerCounter;
private bool waitSignaled;
@@ -141,9 +134,9 @@ public PIT()
public ushort T0Countdown
{
- get => _T0Countdown;
+ get => t0Countdown;
set {
- _T0Countdown = value;
+ t0Countdown = value;
IOPort.Write8(Command, (byte)(T0RateGen ? 0x34 : 0x30));
IOPort.Write8(Data0, (byte)(value & 0xFF));
@@ -153,7 +146,7 @@ public ushort T0Countdown
public uint T0Frequency
{
- get => PITFrequency / (uint)_T0Countdown;
+ get => PITFrequency / t0Countdown;
set {
if (value < 19 || value > 1193180) {
throw new ArgumentException("Frequency must be between 19 and 1193180!");
@@ -165,7 +158,7 @@ public uint T0Frequency
public uint T0DelayNS
{
- get => PITDelayNS * _T0Countdown;
+ get => PITDelayNS * t0Countdown;
set {
if (value > 54918330) {
throw new ArgumentException("Delay must be no greater that 54918330");
@@ -177,10 +170,10 @@ public uint T0DelayNS
public ushort T2Countdown
{
- get => _T2Countdown;
+ get => t2Countdown;
set
{
- _T2Countdown = value;
+ t2Countdown = value;
IOPort.Write8(Command, 0xB6);
IOPort.Write8(Data0, (byte)(value & 0xFF));
@@ -190,7 +183,7 @@ public ushort T2Countdown
public uint T2Frequency
{
- get => PITFrequency / (uint)_T2Countdown;
+ get => PITFrequency / t2Countdown;
set
{
if (value < 19 || value > 1193180)
@@ -204,7 +197,7 @@ public uint T2Frequency
public uint T2DelayNS
{
- get => PITDelayNS * _T2Countdown;
+ get => PITDelayNS * t2Countdown;
set
{
if (value > 54918330) {
@@ -215,30 +208,6 @@ public uint T2DelayNS
}
}
- [Obsolete("This method has been deprecated and is equivalent to a no-op.")]
- public void EnableSound()
- {
- //IO.Port61.Byte = (byte)(IO.Port61.Byte | 0x03);
- }
-
- [Obsolete("This method has been deprecated and is equivalent to a no-op.")]
- public void DisableSound()
- {
- //IO.Port61.Byte = (byte)(IO.Port61.Byte | 0xFC);
- }
-
- public void PlaySound(int aFreq)
- {
- EnableSound();
- T2Frequency = (uint)aFreq;
- }
-
- [Obsolete("This method has been deprecated and is equivalent to a no-op.")]
- public void MuteSound()
- {
- DisableSound();
- }
-
private void SignalWait(INTs.IRQContext irqContext)
{
waitSignaled = true;
@@ -346,15 +315,5 @@ public void UnregisterTimer(int timerId)
}
}
}
-
- #region (deprecated)
-
- [Obsolete($"Use the {nameof(T0DelayNS)} property instead.")]
- public uint T0DelyNS => T0DelayNS;
-
- [Obsolete($"Use the {nameof(T2DelayNS)} property instead.")]
- public uint T2DelyNS => T2DelayNS;
-
- #endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/PIT.html b/source/Cosmos.HAL2/PIT.html
deleted file mode 100644
index 24a9aeefc5..0000000000
--- a/source/Cosmos.HAL2/PIT.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
- http://wiki.osdev.org/PIT
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/PS2Controller.cs b/source/Cosmos.HAL2/PS2Controller.cs
index c7f6652cf9..a9b53a111f 100644
--- a/source/Cosmos.HAL2/PS2Controller.cs
+++ b/source/Cosmos.HAL2/PS2Controller.cs
@@ -53,7 +53,7 @@ private enum OutputLines
public Device FirstDevice;
public Device SecondDevice;
- private Debugger mDebugger = new Debugger("HAL", "PS2Controller");
+ private Debugger mDebugger = new("PS2Controller");
///
/// Initializes the PS/2 controller.
diff --git a/source/Cosmos.HAL2/PS2Keyboard.cs b/source/Cosmos.HAL2/PS2Keyboard.cs
index 55b7aaf495..c0020d890c 100644
--- a/source/Cosmos.HAL2/PS2Keyboard.cs
+++ b/source/Cosmos.HAL2/PS2Keyboard.cs
@@ -24,7 +24,7 @@ enum Command : byte
public byte PS2Port { get; }
private PS2Controller mPS2Controller = Global.PS2Controller;
- private Debugger mDebugger = new Debugger("HAL", "PS2Keyboard");
+ private Debugger mDebugger = new("PS2Keyboard");
internal PS2Keyboard(byte aPort)
{
@@ -45,10 +45,10 @@ public override void Initialize()
SendCommand(Command.EnableScanning);
- Global.mDebugger.SendInternal("(PS/2 Keyboard) Initialized");
+ Global.debugger.SendInternal("(PS/2 Keyboard) Initialized");
UpdateLeds();
- Global.mDebugger.SendInternal("(PS/2 Keyboard) Leds updated");
+ Global.debugger.SendInternal("(PS/2 Keyboard) Leds updated");
}
private void HandleIRQ(ref INTs.IRQContext aContext)
@@ -147,4 +147,4 @@ private void SendCommand(Command aCommand, byte? aByte = null)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/PS2Mouse.cs b/source/Cosmos.HAL2/PS2Mouse.cs
index c81d5689b4..8ff18518b8 100644
--- a/source/Cosmos.HAL2/PS2Mouse.cs
+++ b/source/Cosmos.HAL2/PS2Mouse.cs
@@ -1,7 +1,5 @@
-//#define COSMOSDEBUG
-
+using Cosmos.Debug.Kernel;
using Cosmos.Core;
-using Cosmos.Debug.Kernel;
namespace Cosmos.HAL
{
@@ -10,6 +8,12 @@ namespace Cosmos.HAL
///
public class PS2Mouse : MouseBase
{
+ internal PS2Mouse(byte aPort, byte aMouseID)
+ {
+ PS2Port = aPort;
+ mouseID = aMouseID;
+ }
+
enum Command : byte
{
SetScaling1_1 = 0xE6,
@@ -30,26 +34,15 @@ enum Command : byte
Reset = 0xFF
}
- public byte PS2Port { get; }
+ #region Properties
- private bool HasScrollWheel
- {
- get
- {
- return mMouseID == 3 || mMouseID == 4;
- }
- }
+ private bool HasScrollWheel => mouseID == 3 || mouseID == 4;
- private PS2Controller mPS2Controller = Global.PS2Controller;
- private Debugger mDebugger = new Debugger("HAL", "PS2Mouse");
+ public byte PS2Port { get; }
- private byte mMouseID = 0;
+ #endregion
- internal PS2Mouse(byte aPort, byte aMouseID)
- {
- PS2Port = aPort;
- mMouseID = aMouseID;
- }
+ #region Methods
///
/// This is the required call to start
@@ -58,20 +51,20 @@ internal PS2Mouse(byte aPort, byte aMouseID)
public override void Initialize()
{
SendCommand(Command.Reset);
- mPS2Controller.WaitForDeviceReset();
+ ps2Controller.WaitForDeviceReset();
- if (mMouseID == 0)
+ if (mouseID == 0)
{
- mMouseID = TryToEnableScrollWheel();
+ mouseID = TryToEnableScrollWheel();
- mDebugger.SendInternal("(PS/2 Mouse) Mouse ID: " + mMouseID);
+ debugger.SendInternal("(PS/2 Mouse) Mouse ID: " + mouseID);
- if (mMouseID == 3)
+ if (mouseID == 3)
{
- mMouseID = TryToEnableAdditionalButtons();
+ mouseID = TryToEnableAdditionalButtons();
}
- mDebugger.SendInternal("(PS/2 Mouse) Mouse ID: " + mMouseID);
+ debugger.SendInternal("(PS/2 Mouse) Mouse ID: " + mouseID);
}
//SendCommand(Command.SetDefaults);
@@ -80,7 +73,7 @@ public override void Initialize()
INTs.SetIrqHandler(12, HandleMouse);
SendCommand(Command.EnablePacketStreaming);
- mPS2Controller.WaitForAck();
+ ps2Controller.WaitForAck();
}
///
@@ -95,7 +88,7 @@ private byte TryToEnableScrollWheel()
SendCommand(Command.GetMouseID);
- return mPS2Controller.ReadByteAfterAck();
+ return ps2Controller.ReadByteAfterAck();
}
///
@@ -110,43 +103,40 @@ private byte TryToEnableAdditionalButtons()
SendCommand(Command.GetMouseID);
- return mPS2Controller.ReadByteAfterAck();
+ return ps2Controller.ReadByteAfterAck();
}
- private byte[] mMouseByte = new byte[4];
- private static byte mMouseCycle = 0;
-
public void HandleMouse(ref INTs.IRQContext context)
{
- if (mMouseCycle == 0)
+ if (mouseCycle == 0)
{
- mMouseByte[0] = IOPort.Read8(Cosmos.Core.IOGroup.PS2Controller.Data);
+ mouseByte[0] = IOPort.Read8(Core.IOGroup.PS2Controller.Data);
//Bit 3 of byte 0 is 1, then we have a good package
- if ((mMouseByte[0] & (1 << 3)) == 1 << 3)
+ if ((mouseByte[0] & (1 << 3)) == 1 << 3)
{
- mMouseCycle++;
+ mouseCycle++;
}
}
- else if (mMouseCycle == 1)
+ else if (mouseCycle == 1)
{
- mMouseByte[1] = IOPort.Read8(Cosmos.Core.IOGroup.PS2Controller.Data);
- mMouseCycle++;
+ mouseByte[1] = IOPort.Read8(Core.IOGroup.PS2Controller.Data);
+ mouseCycle++;
}
- else if (mMouseCycle == 2)
+ else if (mouseCycle == 2)
{
- mMouseByte[2] = IOPort.Read8(Cosmos.Core.IOGroup.PS2Controller.Data);
+ mouseByte[2] = IOPort.Read8(Core.IOGroup.PS2Controller.Data);
if (HasScrollWheel)
{
- mMouseCycle++;
+ mouseCycle++;
}
}
// TODO: move conditions to the if statement when stack corruption detection
// works better for complex conditions
- var xTest1 = mMouseCycle == 2 && !HasScrollWheel;
- var xTest2 = mMouseCycle == 3 && HasScrollWheel;
+ var xTest1 = mouseCycle == 2 && !HasScrollWheel;
+ var xTest2 = mouseCycle == 3 && HasScrollWheel;
if (xTest1 || xTest2)
{
@@ -154,81 +144,91 @@ public void HandleMouse(ref INTs.IRQContext context)
int xDeltaY = 0;
int xScrollWheel = 0;
- if ((mMouseByte[0] & (1 << 4)) == 1 << 4)
+ if ((mouseByte[0] & (1 << 4)) == 1 << 4)
{
- xDeltaX = mMouseByte[1] | ~0xFF;
+ xDeltaX = mouseByte[1] | ~0xFF;
}
else
{
- xDeltaX = mMouseByte[1];
+ xDeltaX = mouseByte[1];
}
- if ((mMouseByte[0] & (1 << 5)) == 1 << 5)
+ if ((mouseByte[0] & (1 << 5)) == 1 << 5)
{
- xDeltaY = -(mMouseByte[2] | ~0xFF);
+ xDeltaY = -(mouseByte[2] | ~0xFF);
}
else
{
- xDeltaY = -mMouseByte[2];
+ xDeltaY = -mouseByte[2];
}
- var xMouseState = mMouseByte[0] & 0b0000_0111;
+ var xMouseState = mouseByte[0] & 0b0000_0111;
if (HasScrollWheel)
{
- var xScrollWheelByte = mMouseByte[3] & 0x0F;
+ var xScrollWheelByte = mouseByte[3] & 0x0F;
xScrollWheel = (xScrollWheelByte & 0b1000) == 0 ? xScrollWheelByte : xScrollWheelByte | ~0x0F;
- if (mMouseID == 4)
+ if (mouseID == 4)
{
- var xAdditionalButtonsByte = mMouseByte[3] & 0b0011_0000;
+ var xAdditionalButtonsByte = mouseByte[3] & 0b0011_0000;
xMouseState |= xAdditionalButtonsByte >> 1;
}
}
-
- mDebugger.SendInternal($"(PS/2 Mouse) IRQ 12: Mouse State: ({xDeltaX}, {xDeltaY}, {xMouseState})");
-
OnMouseChanged?.Invoke(xDeltaX, xDeltaY, xMouseState, xScrollWheel);
- mMouseCycle = 0;
+ mouseCycle = 0;
}
}
private void SendCommand(Command aCommand, byte? aByte = null)
{
- mDebugger.SendInternal("(PS/2 Mouse) Sending command:");
- mDebugger.SendInternal("Command:");
- mDebugger.SendInternal((byte)aCommand);
+ debugger.SendInternal("(PS/2 Mouse) Sending command:");
+ debugger.SendInternal("Command:");
+ debugger.SendInternal((byte)aCommand);
if (PS2Port == 2)
{
- mPS2Controller.PrepareSecondPortWrite();
+ ps2Controller.PrepareSecondPortWrite();
}
- mPS2Controller.WaitToWrite();
- IOPort.Write8(Cosmos.Core.IOGroup.PS2Controller.Data, (byte)aCommand);
+ ps2Controller.WaitToWrite();
+ IOPort.Write8(Core.IOGroup.PS2Controller.Data, (byte)aCommand);
- mPS2Controller.WaitForAck();
+ ps2Controller.WaitForAck();
- mDebugger.SendInternal("Command sent.");
+ debugger.SendInternal("Command sent.");
if (aByte.HasValue)
{
- mDebugger.SendInternal("(PS/2 Mouse) Sending byte after command:");
- mDebugger.SendInternal("Byte value:");
- mDebugger.SendInternal(aByte.Value);
+ debugger.SendInternal("(PS/2 Mouse) Sending byte after command:");
+ debugger.SendInternal("Byte value:");
+ debugger.SendInternal(aByte.Value);
if (PS2Port == 2)
{
- mPS2Controller.PrepareSecondPortWrite();
+ ps2Controller.PrepareSecondPortWrite();
}
- mPS2Controller.WaitToWrite();
- IOPort.Write8(Cosmos.Core.IOGroup.PS2Controller.Data, aByte.Value);
+ ps2Controller.WaitToWrite();
+ IOPort.Write8(Core.IOGroup.PS2Controller.Data, aByte.Value);
- mPS2Controller.WaitForAck();
+ ps2Controller.WaitForAck();
}
}
+
+ #endregion
+
+ #region Fields
+
+ private readonly PS2Controller ps2Controller = Global.PS2Controller;
+ private readonly Debugger debugger = new("PS2Mouse");
+
+ private readonly byte[] mouseByte = new byte[4];
+ private static byte mouseCycle = 0;
+ private byte mouseID = 0;
+
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/Power.cs b/source/Cosmos.HAL2/Power.cs
index 068ddd15ea..e054259023 100644
--- a/source/Cosmos.HAL2/Power.cs
+++ b/source/Cosmos.HAL2/Power.cs
@@ -1,34 +1,34 @@
+using System;
using Cosmos.Core;
namespace Cosmos.HAL
{
///
- /// Power class. Used to reboot and shutdown the PC.
+ /// Manages the power state of the system by directly manipulating
+ /// hardware devices.
///
public class Power
{
- //Reboot with CPU
///
- /// Reboot the CPU.
+ /// Triggers a direct, raw CPU reboot.
///
public static void CPUReboot()
{
- Core.CPU.Reboot();
+ CPU.Reboot();
}
- //Reboot with ACPI
///
- /// Reboot using ACPI.
+ /// Reboot the system using ACPI. Currently not implemented.
///
/// Thrown always.
+ [Obsolete("This method is not yet implemented.", error: true)]
public static void ACPIReboot()
{
- ACPI.Reboot(); //TODO
+ ACPI.Reboot();
}
- //Shutdown with ACPI
///
- /// Shutdown the ACPI.
+ /// Shutdown the system using ACPI.
///
/// Thrown on IO error.
public static void ACPIShutdown()
diff --git a/source/Cosmos.HAL2/RTC.html b/source/Cosmos.HAL2/RTC.html
deleted file mode 100644
index 9ba02315ec..0000000000
--- a/source/Cosmos.HAL2/RTC.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
- http://wiki.osdev.org/RTC
-
- http://www.compuphase.com/int70.txt
-
- http://www.nondot.org/sabre/os/files/MiscHW/CMOSTimer.html
-
- http://www.nondot.org/sabre/os/files/MiscHW/RealtimeClockFAQ.txt
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/SerialPort.cs b/source/Cosmos.HAL2/SerialPort.cs
index b05231fb1d..1592b578c3 100644
--- a/source/Cosmos.HAL2/SerialPort.cs
+++ b/source/Cosmos.HAL2/SerialPort.cs
@@ -7,49 +7,15 @@ namespace Cosmos.HAL
///
public static class SerialPort
{
- // com1 is used by qemu by default
- ///
- /// IO port for COM1 port
- ///
- public const ushort COM1 = 0x3F8;
- ///
- /// IO port for COM2 port
- ///
- public const ushort COM2 = 0x2F8;
- ///
- /// IO port for COM3 port
- ///
- public const ushort COM3 = 0x3E8;
- ///
- /// IO port for COM4 port
- ///
- public const ushort COM4 = 0x2E8;
- ///
- /// IO port for COM5 port
- ///
- public const ushort COM5 = 0x5F8;
- ///
- /// IO port for COM6 port
- ///
- public const ushort COM6 = 0x4F8;
- ///
- /// IO port for COM7 port
- ///
- public const ushort COM7 = 0x5E8;
- ///
- /// IO port for COM8 port
- ///
- public const ushort COM8 = 0x4E8;
-
///
/// Enables certain COM port
///
/// COM port
- public static void Enable(ushort aPort)
+ public static void Enable(COMPort aPort, BaudRate aBaudRate)
{
IOPort.Write8((ushort)(aPort + 1), 0x00);
IOPort.Write8((ushort)(aPort + 3), 0x80);
- IOPort.Write8(aPort, 0x03);
+ IOPort.Write8((ushort)aPort, (byte)aBaudRate);
IOPort.Write8((ushort)(aPort + 1), 0x00);
IOPort.Write8((ushort)(aPort + 3), 0x03);
IOPort.Write8((ushort)(aPort + 2), 0xC7);
@@ -61,10 +27,10 @@ public static void Enable(ushort aPort)
///
/// COM port
/// ASCII character as byte
- public static byte Receive(ushort aPort)
+ public static byte Receive(COMPort aPort)
{
while ((IOPort.Read8((ushort)(aPort + 5)) & 1) == 0) { };
- return IOPort.Read8(aPort);
+ return IOPort.Read8((ushort)aPort);
}
///
@@ -73,7 +39,7 @@ public static byte Receive(ushort aPort)
///
public static byte Receive()
{
- return Receive(COM1);
+ return Receive(COMPort.COM1);
}
///
@@ -81,10 +47,10 @@ public static byte Receive()
///
/// Character to send
/// COM port
- public static void Send(char aText, ushort aPort)
+ public static void Send(char aText, COMPort aPort)
{
while ((IOPort.Read8((ushort)(aPort + 5)) & 0x20) == 0) { };
- IOPort.Write8(aPort, (byte)aText);
+ IOPort.Write8((ushort)aPort, (byte)aText);
}
///
@@ -93,7 +59,7 @@ public static void Send(char aText, ushort aPort)
/// Character to send
public static void Send(char aText)
{
- Send(aText, COM1);
+ Send(aText, COMPort.COM1);
}
///
@@ -101,7 +67,7 @@ public static void Send(char aText)
///
/// String to send
/// COM port
- public static void SendString(string aText, ushort aPort)
+ public static void SendString(string aText, COMPort aPort)
{
for (int i = 0; i < aText.Length; ++i)
{
@@ -114,7 +80,7 @@ public static void SendString(string aText, ushort aPort)
/// String to send
public static void SendString(string aText)
{
- SendString(aText, COM1);
+ SendString(aText, COMPort.COM1);
}
}
}
diff --git a/source/Cosmos.HAL2/TextScreen.html b/source/Cosmos.HAL2/TextScreen.html
deleted file mode 100644
index 6af3edf288..0000000000
--- a/source/Cosmos.HAL2/TextScreen.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
- TextScreenBase provides a base interface. TextScreen implements this using a the normal 0xB8000 region
-
-
- http://wiki.osdev.org/Text_UI
-
- http://wiki.osdev.org/Text_Mode_Cursor
-
-
- TextScreen is the raw access to the screen. It should not handle virtualization
- or buffering. That can be handled in System ring and using absracted memory
- copies for the virtualization.
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.HAL2/TextScreenHelpers.cs b/source/Cosmos.HAL2/TextScreenHelpers.cs
index 694eb3b0bd..da8c35473b 100644
--- a/source/Cosmos.HAL2/TextScreenHelpers.cs
+++ b/source/Cosmos.HAL2/TextScreenHelpers.cs
@@ -1,18 +1,11 @@
-using System;
+using Debugger = Cosmos.Debug.Kernel.Debugger;
using System.Diagnostics;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-using Debugger = Cosmos.Debug.Kernel.Debugger;
-using Cosmos.Common.Extensions;
namespace Cosmos.HAL
{
public static class TextScreenHelpers
{
- private static Debugger mDebugger = new Debugger("TextScreen", "Debug");
+ private static Debugger debugger = new("Debug");
[Conditional("COSMOSDEBUG")]
public static void Debug(string aMessage, params object[] aParams)
@@ -21,7 +14,6 @@ public static void Debug(string aMessage, params object[] aParams)
if (aParams != null)
{
- aMessage = aMessage + " : ";
for (int i = 0; i < aParams.Length; i++)
{
if (aParams[i] != null)
@@ -35,31 +27,31 @@ public static void Debug(string aMessage, params object[] aParams)
}
}
- mDebugger.Send("TextScreen Debug: " + xMessage);
+ debugger.Send("TextScreen Debug: " + xMessage);
}
[Conditional("COSMOSDEBUG")]
public static void Debug(string aMessage)
{
- mDebugger.Send("TextScreen Debug: " + aMessage);
+ debugger.Send("TextScreen Debug: " + aMessage);
}
[Conditional("COSMOSDEBUG")]
public static void DebugNumber(uint aValue)
{
- mDebugger.SendNumber(aValue);
+ debugger.SendNumber(aValue);
}
[Conditional("COSMOSDEBUG")]
public static void DebugNumber(ulong aValue)
{
- mDebugger.Send(((uint)aValue).ToString() + ((uint)aValue >> 32).ToString());
+ debugger.Send(((uint)aValue).ToString() + ((uint)aValue >> 32).ToString());
}
[Conditional("COSMOSDEBUG")]
public static void DevDebug(string message)
{
- mDebugger.Send("TextScreen DevDebug: " + message);
+ debugger.Send("TextScreen DevDebug: " + message);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.Plugs/Cosmos.Plugs.csproj b/source/Cosmos.Plugs/Cosmos.Plugs.csproj
new file mode 100644
index 0000000000..a1bbfb9403
--- /dev/null
+++ b/source/Cosmos.Plugs/Cosmos.Plugs.csproj
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+ net6.0
+ enable
+ enable
+ $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage
+
+
+
+
+
+
+ true
+ Cosmos.Core_Asm.dll
+
+
+ true
+ Cosmos.Core_Plugs.dll
+
+
+ true
+ Cosmos.Debug.Kernel.Plugs.Asm.dll
+
+
+ true
+ Cosmos.System2_Plugs.dll
+
+
+
+
diff --git a/source/Cosmos.Plugs/build/Cosmos.Plugs.targets b/source/Cosmos.Plugs/build/Cosmos.Plugs.targets
new file mode 100644
index 0000000000..582b6ae214
--- /dev/null
+++ b/source/Cosmos.Plugs/build/Cosmos.Plugs.targets
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/source/Cosmos.System2/.editorconfig b/source/Cosmos.System2/.editorconfig
deleted file mode 100644
index 2788264c4a..0000000000
--- a/source/Cosmos.System2/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*.cs]
-indent_size=4
diff --git a/source/Cosmos.System2/Audio/AudioMixer.cs b/source/Cosmos.System2/Audio/AudioMixer.cs
index b16bf0a2e8..a9c2b8d9ae 100644
--- a/source/Cosmos.System2/Audio/AudioMixer.cs
+++ b/source/Cosmos.System2/Audio/AudioMixer.cs
@@ -1,9 +1,9 @@
using Cosmos.HAL.Audio;
using Cosmos.System.Audio.IO;
-using System;
using System.Collections.Generic;
-namespace Cosmos.System.Audio {
+namespace Cosmos.System.Audio
+{
///
/// An audio mixer is responsible for mixing several streams of audio together.
///
@@ -11,7 +11,8 @@ namespace Cosmos.System.Audio {
/// The class does not implement any kind of compressor or
/// limiter, and as such, the resulting audio may introduce hard-clipping.
///
- public class AudioMixer : AudioStream {
+ public class AudioMixer : AudioStream
+ {
AudioBuffer mixBuffer;
///
@@ -56,12 +57,13 @@ public AudioMixer()
public unsafe override void Read(AudioBuffer buffer)
{
// Ensure our mixing buffer is the same format and size as the output buffer
- if(mixBuffer == null || mixBuffer.Size != buffer.Size || mixBuffer.Format != buffer.Format) {
+ if (mixBuffer == null || mixBuffer.Size != buffer.Size || mixBuffer.Format != buffer.Format)
+ {
mixBuffer = new AudioBuffer(buffer.Size, buffer.Format);
streamReader = new AudioBufferReader(mixBuffer);
}
- if(cachedBuffer != buffer)
+ if (cachedBuffer != buffer)
{
cachedBuffer = buffer;
cachedOutputWriter = new(buffer, new SampleFormat(AudioBitDepth.Bits16, 1, true));
@@ -129,7 +131,8 @@ public unsafe override void Read(AudioBuffer buffer)
private static short SaturationAdd(short a, short b)
{
- if(a > 0) {
+ if (a > 0)
+ {
if (b > short.MaxValue - a)
{
return short.MaxValue;
diff --git a/source/Cosmos.System2/Audio/Device/AudioManager.cs b/source/Cosmos.System2/Audio/Device/AudioManager.cs
index 2c6945fa1c..28f98d062b 100644
--- a/source/Cosmos.System2/Audio/Device/AudioManager.cs
+++ b/source/Cosmos.System2/Audio/Device/AudioManager.cs
@@ -1,5 +1,6 @@
using Cosmos.HAL;
using Cosmos.HAL.Audio;
+using Cosmos.HAL.Drivers.Audio;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/source/Cosmos.System2/Audio/IO/MemoryAudioStream.cs b/source/Cosmos.System2/Audio/IO/MemoryAudioStream.cs
index f10b628751..10ac15e4d1 100644
--- a/source/Cosmos.System2/Audio/IO/MemoryAudioStream.cs
+++ b/source/Cosmos.System2/Audio/IO/MemoryAudioStream.cs
@@ -1,16 +1,14 @@
-using Cosmos.Core;
-using Cosmos.HAL.Audio;
+using Cosmos.HAL.Audio;
+using Cosmos.Core;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-namespace Cosmos.System.Audio.IO {
+namespace Cosmos.System.Audio.IO
+{
///
/// Represents an audio stream that reads from a byte array in memory.
///
- public class MemoryAudioStream : SeekableAudioStream {
+ public class MemoryAudioStream : SeekableAudioStream
+ {
readonly SampleFormat format;
readonly uint sampleRate;
readonly int sampleCount;
@@ -39,7 +37,8 @@ public SampleFormat Format
}
}
- public override uint SampleRate {
+ public override uint SampleRate
+ {
get => sampleRate;
set => throw new InvalidOperationException("Cannot change the sample rate of a MemoryAudioStream.");
}
@@ -49,6 +48,7 @@ public override uint SampleRate {
public override uint Length => (uint)sampleCount;
public override bool Depleted => sampleCount <= Position;
+
#endregion
///
@@ -58,17 +58,20 @@ public override uint SampleRate {
/// The target wave file.
public unsafe static MemoryAudioStream FromWave(byte[] waveFile)
{
- if(!ValidateValues(waveFile, 0, 0x52, 0x49, 0x46, 0x46)) {
+ if (!ValidateValues(waveFile, 0, 0x52, 0x49, 0x46, 0x46))
+ {
throw new ArgumentException("Invalid WAVE file - expected a RIFF header.", nameof(waveFile));
}
// chunkSize at offset 4 of size 4
-
- if (!ValidateValues(waveFile, 8, 0x57, 0x41, 0x56, 0x45)) {
+
+ if (!ValidateValues(waveFile, 8, 0x57, 0x41, 0x56, 0x45))
+ {
throw new ArgumentException("Invalid WAVE file - expected a WAVE format in the RIFF header.", nameof(waveFile));
}
- if (!ValidateValues(waveFile, 12, 0x66, 0x6D, 0x74, 0x20)) {
+ if (!ValidateValues(waveFile, 12, 0x66, 0x6D, 0x74, 0x20))
+ {
throw new ArgumentException("The first subchunk is expected to be the sample format.", nameof(waveFile));
}
@@ -77,13 +80,15 @@ public unsafe static MemoryAudioStream FromWave(byte[] waveFile)
// Normally, this is fine, if the metadata is at the end of the chunk and we can safely ignore it.
int metadataSize = BitConverter.ToInt32(waveFile, 16);
- if (!ValidateValues(waveFile, 20, 0x01, 0x00)) {
+ if (!ValidateValues(waveFile, 20, 0x01, 0x00))
+ {
throw new ArgumentException("WAVE compression is not supported.", nameof(waveFile));
}
ushort numChannels = BitConverter.ToUInt16(waveFile, 22);
- if (numChannels > byte.MaxValue) {
+ if (numChannels > byte.MaxValue)
+ {
throw new ArgumentException($"The maximum amount of channels for an AudioStream is 255 - the input contains {numChannels}.", nameof(waveFile));
}
@@ -92,7 +97,8 @@ public unsafe static MemoryAudioStream FromWave(byte[] waveFile)
// blockAlign at offset 32 of size 2
ushort bitsPerSample = BitConverter.ToUInt16(waveFile, 34);
- var bitDepth = bitsPerSample switch {
+ var bitDepth = bitsPerSample switch
+ {
8 => AudioBitDepth.Bits8,
16 => AudioBitDepth.Bits16,
24 => AudioBitDepth.Bits24,
@@ -103,14 +109,16 @@ public unsafe static MemoryAudioStream FromWave(byte[] waveFile)
// ExtraParamSize and ExtraParams would be here for encodings different than PCM
int dataStart = 20 + metadataSize;
- if (!ValidateValues(waveFile, dataStart, 0x64, 0x61, 0x74, 0x61)) {
+ if (!ValidateValues(waveFile, dataStart, 0x64, 0x61, 0x74, 0x61))
+ {
throw new ArgumentException("Expected a 'data' block");
}
uint dataSize = BitConverter.ToUInt32(waveFile, dataStart + 4);
byte[] data = new byte[dataSize];
- fixed (byte* inputPtr = waveFile, outputPtr = data) {
+ fixed (byte* inputPtr = waveFile, outputPtr = data)
+ {
MemoryOperations.Copy(outputPtr, inputPtr + dataStart + 8, data.Length);
}
@@ -125,8 +133,10 @@ public unsafe static MemoryAudioStream FromWave(byte[] waveFile)
private static bool ValidateValues(byte[] target, int offset, params byte[] values)
{
- for (int i = 0; i < values.Length; i++) {
- if(target[i + offset] != values[i]) {
+ for (int i = 0; i < values.Length; i++)
+ {
+ if (target[i + offset] != values[i])
+ {
return false;
}
}
@@ -143,14 +153,16 @@ public unsafe override void Read(AudioBuffer buffer)
int samplesLeft = sampleCount - (int)Position;
int actualCopySize = Math.Min(samplesLeft, buffer.Size);
- if(cachedBuffer != buffer)
+ if (cachedBuffer != buffer)
{
cachedWriter = new(buffer, format);
cachedBuffer = buffer;
}
- fixed (byte* dataPtr = data) {
- for (int i = 0; i < actualCopySize; i++) {
+ fixed (byte* dataPtr = data)
+ {
+ for (int i = 0; i < actualCopySize; i++)
+ {
cachedWriter.Write(dataPtr + i * format.Size + Position * format.Size, i);
}
}
@@ -170,7 +182,8 @@ public unsafe override void Read(AudioBuffer buffer)
Position = Math.Min(Position + delta, Length);
}
- else {
+ else
+ {
Position += delta;
}
diff --git a/source/Cosmos.System2/Audio/IO/SeekableAudioStream.cs b/source/Cosmos.System2/Audio/IO/SeekableAudioStream.cs
index 9d85e7bb56..c5c5dffbf6 100644
--- a/source/Cosmos.System2/Audio/IO/SeekableAudioStream.cs
+++ b/source/Cosmos.System2/Audio/IO/SeekableAudioStream.cs
@@ -1,6 +1,5 @@
namespace Cosmos.System.Audio.IO
{
-
///
/// Represents a finite audio stream that supports seeking operations.
///
@@ -16,4 +15,4 @@ public abstract class SeekableAudioStream : AudioStream
///
public abstract uint Length { get; }
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Console.cs b/source/Cosmos.System2/Console.cs
index 2c3fd668de..0bfbb62dbb 100644
--- a/source/Cosmos.System2/Console.cs
+++ b/source/Cosmos.System2/Console.cs
@@ -1,246 +1,251 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using Cosmos.HAL;
-
-namespace Cosmos.System {
- ///
- /// Standard output stream.
- ///
- public class Console {
- ///
- /// Line feed.
- ///
- private const byte LineFeed = (byte)'\n';
- ///
- /// Carriage return.
- ///
- private const byte CarriageReturn = (byte)'\r';
- ///
- /// Tab.
- ///
- private const byte Tab = (byte)'\t';
- ///
- /// Space.
- ///
- private const byte Space = (byte)' ';
-
- ///
- /// Cursor location on X axis.
- ///
- protected int mX = 0;
-
- ///
- /// Get and set cursor location on X axis.
- ///
- public int X {
- get { return mX; }
- set {
- mX = value;
- UpdateCursor();
- }
- }
-
- ///
- /// Cursor location on Y axis.
- ///
- protected int mY = 0;
-
- ///
- /// Get and set cursor location on Y axis.
- ///
- public int Y {
- get { return mY; }
- set {
- mY = value;
- UpdateCursor();
- }
- }
-
- ///
- /// Get window width.
- ///
- public int Cols {
- set { }
- get { return mText.Cols; }
- }
-
- ///
- /// Get window height.
- ///
- public int Rows {
- set { }
- get { return mText.Rows; }
- }
-
- ///
- /// Text screen.
- ///
- public HAL.TextScreenBase mText;
-
- ///
- /// Console object constructor.
- ///
- /// Output device.
- public Console(TextScreenBase textScreen)
- {
- if (textScreen == null)
- {
- mText = new TextScreen();
- }
- else
- {
- mText = textScreen;
- }
- }
-
- ///
- /// Clear console and return cursor to (0,0).
- ///
- public void Clear() {
- mText.Clear();
- mX = 0;
- mY = 0;
- UpdateCursor();
- }
-
- //TODO: This is slow, batch it and only do it at end of updates
- ///
- /// Update cursor position.
- ///
- protected void UpdateCursor() {
- mText.SetCursorPos(mX, mY);
- }
-
- ///
- /// Scroll the console up and move crusor to the start of the line.
- ///
- private void DoLineFeed() {
- mY++;
- mX = 0;
- if (mY == mText.Rows) {
- mText.ScrollUp();
- mY--;
- }
- UpdateCursor();
- }
-
- ///
- /// Move cursor to the start of the line.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private void DoCarriageReturn() {
- mX = 0;
- UpdateCursor();
- }
-
- ///
- /// Print tab to the console.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private void DoTab()
- {
- Write(Space);
- Write(Space);
- Write(Space);
- Write(Space);
- }
-
- ///
- /// Write char to the console.
- ///
- /// A char to write
- public void Write(byte aChar)
- {
- mText[mX, mY] = aChar;
- mX++;
- if (mX == mText.Cols)
- {
- DoLineFeed();
- }
- UpdateCursor();
- }
-
- //TODO: Optimize this
- ///
- /// Write byte array to the console.
- ///
- /// A byte array to write to the console.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Write(byte[] aText)
- {
- if (aText == null)
- {
- return;
- }
-
- for (int i = 0; i < aText.Length; i++)
- {
- switch (aText[i])
- {
- case LineFeed:
- DoLineFeed();
- break;
-
- case CarriageReturn:
- DoCarriageReturn();
- break;
-
- case Tab:
- DoTab();
- break;
-
- /* Normal characters, simply write them */
- default:
- Write(aText[i]);
- break;
- }
- }
- }
-
- ///
- /// Get and set console foreground color.
- ///
- public ConsoleColor Foreground
- {
- get { return (ConsoleColor)(mText.GetColor() ^ (byte)((byte)Background << 4)); }
- set { mText.SetColors(value, Background); }
- }
-
- ///
- /// Get and set console background color.
- ///
- public ConsoleColor Background
- {
- get { return (ConsoleColor)(mText.GetColor() >> 4); }
- set { mText.SetColors(Foreground, value); }
- }
-
- ///
- /// Get and set cursor size.
- /// The value is percentage in the range 1-100.
- ///
- /// Thrown when trying to set value out of range.
- public int CursorSize
- {
- get { return mText.GetCursorSize(); }
- set {
- // Value should be a percentage from [1, 100].
- if (value < 1 || value > 100)
- throw new ArgumentOutOfRangeException("value", value, "CursorSize value " + value + " out of range (1 - 100)");
-
- mText.SetCursorSize(value);
- }
- }
-
- ///
- /// Get and set cursor visiblty.
- ///
- public bool CursorVisible {
- get { return mText.GetCursorVisible(); }
- set { mText.SetCursorVisible(value); }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using Cosmos.HAL;
+
+namespace Cosmos.System
+{
+ ///
+ /// Represents the standard console output stream.
+ ///
+ public class Console
+ {
+ private const byte LineFeed = (byte)'\n';
+ private const byte CarriageReturn = (byte)'\r';
+ private const byte Tab = (byte)'\t';
+ private const byte Space = (byte)' ';
+
+ ///
+ /// The underlying X cursor location field.
+ ///
+ protected int mX = 0;
+
+ ///
+ /// The text cursor location in the X (horizontal) axis.
+ ///
+ public int X
+ {
+ get => mX;
+ set
+ {
+ mX = value;
+ UpdateCursor();
+ }
+ }
+
+ ///
+ /// The underlying Y cursor location field.
+ ///
+ protected int mY = 0;
+
+ ///
+ /// Get and set cursor location on Y axis.
+ ///
+ public int Y
+ {
+ get => mY;
+ set
+ {
+ mY = value;
+ UpdateCursor();
+ }
+ }
+
+ ///
+ /// Get window width.
+ ///
+ public int Cols
+ {
+ get => mText.Cols;
+ set { }
+ }
+
+ ///
+ /// Get window height.
+ ///
+ public int Rows
+ {
+ set { }
+ get => mText.Rows;
+ }
+
+ ///
+ /// Text screen.
+ ///
+ public HAL.TextScreenBase mText;
+
+ ///
+ /// Constructs a new instance of the class.
+ ///
+ /// The device to direct text output to.
+ public Console(TextScreenBase textScreen)
+ {
+ if (textScreen == null)
+ {
+ mText = new TextScreen();
+ }
+ else
+ {
+ mText = textScreen;
+ }
+ }
+
+ ///
+ /// Clears the console, and changes the cursor location to (0, 0).
+ ///
+ public void Clear()
+ {
+ mText.Clear();
+ mX = 0;
+ mY = 0;
+ UpdateCursor();
+ }
+
+ //TODO: This is slow, batch it and only do it at end of updates
+ ///
+ /// Update cursor position.
+ ///
+ protected void UpdateCursor()
+ {
+ mText.SetCursorPos(mX, mY);
+ }
+
+ ///
+ /// Scrolls the console up and moves the cursor to the start of the line.
+ ///
+ private void DoLineFeed()
+ {
+ mY++;
+ mX = 0;
+ if (mY == mText.Rows)
+ {
+ mText.ScrollUp();
+ mY--;
+ }
+ UpdateCursor();
+ }
+
+ ///
+ /// Moves the cursor to the start of the line.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private void DoCarriageReturn()
+ {
+ mX = 0;
+ UpdateCursor();
+ }
+
+ ///
+ /// Print a tab character to the console.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private void DoTab()
+ {
+ Write(Space);
+ Write(Space);
+ Write(Space);
+ Write(Space);
+ }
+
+ ///
+ /// Write char to the console.
+ ///
+ /// A char to write
+ public void Write(byte aChar)
+ {
+ mText[mX, mY] = aChar;
+ mX++;
+ if (mX == mText.Cols)
+ {
+ DoLineFeed();
+ }
+ UpdateCursor();
+ }
+
+ //TODO: Optimize this
+ ///
+ /// Writes the given sequence of ASCII characters in the form of a byte
+ /// array to the console.
+ ///
+ /// The byte array to write to the console.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Write(byte[] aText)
+ {
+ if (aText == null)
+ {
+ return;
+ }
+
+ for (int i = 0; i < aText.Length; i++)
+ {
+ switch (aText[i])
+ {
+ case LineFeed:
+ DoLineFeed();
+ break;
+
+ case CarriageReturn:
+ DoCarriageReturn();
+ break;
+
+ case Tab:
+ DoTab();
+ break;
+
+ /* Normal characters, simply write them */
+ default:
+ Write(aText[i]);
+ break;
+ }
+ }
+ }
+
+ ///
+ /// The foreground color of the displayed text.
+ ///
+ public ConsoleColor Foreground
+ {
+ get => (ConsoleColor)(mText.GetColor() ^ (byte)((byte)Background << 4));
+ set => mText.SetColors(value, Background);
+ }
+
+ ///
+ /// The background color of the displayed text.
+ ///
+ public ConsoleColor Background
+ {
+ get => (ConsoleColor)(mText.GetColor() >> 4);
+ set => mText.SetColors(Foreground, value);
+ }
+
+ ///
+ /// The size of the cursor, in the range of 1 to 100.
+ ///
+ /// Thrown when trying to set value out of range.
+ public int CursorSize
+ {
+ get => mText.GetCursorSize();
+ set
+ {
+ // Value should be a percentage from [1, 100].
+ if (value is < 1 or > 100)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value, "The given CursorSize value " + value + " is out of range (1 - 100).");
+ }
+
+ mText.SetCursorSize(value);
+ }
+ }
+
+ ///
+ /// Get or sets the visibility of the cursor.
+ ///
+ public bool CursorVisible
+ {
+ get => mText.GetCursorVisible();
+ set => mText.SetCursorVisible(value);
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Console.html b/source/Cosmos.System2/Console.html
deleted file mode 100644
index 34764f6e5f..0000000000
--- a/source/Cosmos.System2/Console.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
- TextScreen is stateless and "raw on hardware". This Console class can track
- state and eventually may handle virtual screens etc. Because of this it is not
- static, but the default one is created in System.Global. This is separate from
- the plugged Console as it cannot hold any state. The plugged Console writes to
- the default, but later a global var can be changed to allow it output to
- differnet virtual ones based on process ID, etc.
-
- This is a writing / scrolling class // A different class will be created for
- fixed positioning (can use TextScreen for now). // Mixing writing with fixed
- position just creates a mess, and would interefere with scroll // back
- capabilities etc.
-
-
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.System2/Cosmos.System2.csproj b/source/Cosmos.System2/Cosmos.System2.csproj
index c025cd531f..e41644cfeb 100644
--- a/source/Cosmos.System2/Cosmos.System2.csproj
+++ b/source/Cosmos.System2/Cosmos.System2.csproj
@@ -19,4 +19,6 @@
+
+
diff --git a/source/Cosmos.System2/FileSystem/CosmosVFS.cs b/source/Cosmos.System2/FileSystem/CosmosVFS.cs
index 2a33ee2af0..6510880bae 100644
--- a/source/Cosmos.System2/FileSystem/CosmosVFS.cs
+++ b/source/Cosmos.System2/FileSystem/CosmosVFS.cs
@@ -5,8 +5,6 @@
using System.IO;
using Cosmos.HAL.BlockDevice;
-using Cosmos.System.FileSystem.FAT;
-using Cosmos.System.FileSystem.ISO9660;
using Cosmos.System.FileSystem.Listing;
using Cosmos.System.FileSystem.VFS;
@@ -97,13 +95,13 @@ protected virtual void InitializePartitions()
///
///
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
/// Thrown when The aPath is longer than the system defined maximum length.
public override DirectoryEntry CreateFile(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.CreateFile ---");
+ Global.Debugger.SendInternal("--- CosmosVFS.CreateFile ---");
if (aPath == null)
{
@@ -115,30 +113,30 @@ public override DirectoryEntry CreateFile(string aPath)
throw new ArgumentException("aPath is empty");
}
- Global.mFileSystemDebugger.SendInternal("aPath =" + aPath);
+ Global.Debugger.SendInternal("aPath =" + aPath);
if (File.Exists(aPath))
{
- Global.mFileSystemDebugger.SendInternal("File already exists.");
+ Global.Debugger.SendInternal("File already exists.");
return GetFile(aPath);
}
- Global.mFileSystemDebugger.SendInternal("File doesn't exist.");
+ Global.Debugger.SendInternal("File doesn't exist.");
string xFileToCreate = Path.GetFileName(aPath);
- Global.mFileSystemDebugger.SendInternal("After GetFileName");
- Global.mFileSystemDebugger.SendInternal("xFileToCreate =" + xFileToCreate);
+ Global.Debugger.SendInternal("After GetFileName");
+ Global.Debugger.SendInternal("xFileToCreate =" + xFileToCreate);
string xParentDirectory = Path.GetDirectoryName(aPath);
- Global.mFileSystemDebugger.SendInternal("After removing last path part");
- Global.mFileSystemDebugger.SendInternal("xParentDirectory =" + xParentDirectory);
+ Global.Debugger.SendInternal("After removing last path part");
+ Global.Debugger.SendInternal("xParentDirectory =" + xParentDirectory);
DirectoryEntry xParentEntry = GetDirectory(xParentDirectory);
if (xParentEntry == null)
{
- Global.mFileSystemDebugger.SendInternal("Parent directory doesn't exist.");
+ Global.Debugger.SendInternal("Parent directory doesn't exist.");
xParentEntry = CreateDirectory(xParentDirectory);
}
- Global.mFileSystemDebugger.SendInternal("Parent directory exists.");
+ Global.Debugger.SendInternal("Parent directory exists.");
var xFS = GetFileSystemFromPath(xParentDirectory);
return xFS.CreateFile(xParentEntry, xFileToCreate);
@@ -174,13 +172,13 @@ public override DirectoryEntry CreateFile(string aPath)
///
///
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
/// Thrown when The aPath is longer than the system defined maximum length.
public override DirectoryEntry CreateDirectory(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- CosmosVFS.CreateDirectory ---");
+ Global.Debugger.SendInternal("-- CosmosVFS.CreateDirectory ---");
if (aPath == null)
{
@@ -192,31 +190,31 @@ public override DirectoryEntry CreateDirectory(string aPath)
throw new ArgumentException("aPath length is zero");
}
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
if (Directory.Exists(aPath))
{
- Global.mFileSystemDebugger.SendInternal("Path already exists.");
+ Global.Debugger.SendInternal("Path already exists.");
return GetDirectory(aPath);
}
aPath = aPath.TrimEnd(DirectorySeparatorChar, AltDirectorySeparatorChar);
string xDirectoryToCreate = Path.GetFileName(aPath);
- Global.mFileSystemDebugger.SendInternal("xDirectoryToCreate = " + xDirectoryToCreate);
+ Global.Debugger.SendInternal("xDirectoryToCreate = " + xDirectoryToCreate);
string xParentDirectory = Path.GetDirectoryName(aPath);
- Global.mFileSystemDebugger.SendInternal("xParentDirectory = " + xParentDirectory);
+ Global.Debugger.SendInternal("xParentDirectory = " + xParentDirectory);
DirectoryEntry xParentEntry = GetDirectory(xParentDirectory);
if (xParentEntry == null)
{
- Global.mFileSystemDebugger.SendInternal("Parent directory doesn't exist.");
+ Global.Debugger.SendInternal("Parent directory doesn't exist.");
xParentEntry = CreateDirectory(xParentDirectory);
}
- Global.mFileSystemDebugger.SendInternal("Parent directory exists.");
+ Global.Debugger.SendInternal("Parent directory exists.");
var xFS = GetFileSystemFromPath(xParentDirectory);
return xFS.CreateDirectory(xParentEntry, xDirectoryToCreate);
@@ -308,8 +306,8 @@ public override bool DeleteDirectory(DirectoryEntry aPath)
/// Thrown on memory error.
public override List GetDirectoryListing(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- CosmosVFS.GetDirectoryListing(string) --");
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("-- CosmosVFS.GetDirectoryListing(string) --");
+ Global.Debugger.SendInternal("aPath = " + aPath);
var xFS = GetFileSystemFromPath(aPath);
var xDirectory = DoGetDirectoryEntry(aPath, xFS);
return xFS.GetDirectoryListing(xDirectory);
@@ -358,14 +356,14 @@ public override List GetDirectoryListing(string aPath)
/// Thrown on memory error.
public override List GetDirectoryListing(DirectoryEntry aDirectory)
{
- Global.mFileSystemDebugger.SendInternal("-- CosmosVFS.GetDirectoryListing --");
+ Global.Debugger.SendInternal("-- CosmosVFS.GetDirectoryListing --");
if (aDirectory == null || String.IsNullOrEmpty(aDirectory.mFullPath))
{
throw new ArgumentException("Argument is null or empty", nameof(aDirectory));
}
- Global.mFileSystemDebugger.SendInternal("Path = " + aDirectory.mFullPath);
+ Global.Debugger.SendInternal("Path = " + aDirectory.mFullPath);
return GetDirectoryListing(aDirectory.mFullPath);
}
@@ -378,8 +376,8 @@ public override List GetDirectoryListing(DirectoryEntry aDirecto
/// Thrown when the entry at aPath is not a directory.
public override DirectoryEntry GetDirectory(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- CosmosVFS.GetDirectory --");
- Global.mFileSystemDebugger.SendInternal("aPath =" + aPath);
+ Global.Debugger.SendInternal("-- CosmosVFS.GetDirectory --");
+ Global.Debugger.SendInternal("aPath =" + aPath);
try
{
var xFileSystem = GetFileSystemFromPath(aPath);
@@ -391,7 +389,7 @@ public override DirectoryEntry GetDirectory(string aPath)
}
catch (Exception)
{
- Global.mFileSystemDebugger.SendInternal("CosmosVFS.GetDirectory - DoGetDirectoryEntry failed, returning null. aPath = " + aPath);
+ Global.Debugger.SendInternal("CosmosVFS.GetDirectory - DoGetDirectoryEntry failed, returning null. aPath = " + aPath);
return null;
}
throw new Exception(aPath + " was found, but is not a directory.");
@@ -416,7 +414,7 @@ public override DirectoryEntry GetFile(string aPath)
}
catch (Exception)
{
- Global.mFileSystemDebugger.SendInternal("CosmosVFS.GetFile - DoGetDirectoryEntry failed, returning null. aPath = " + aPath);
+ Global.Debugger.SendInternal("CosmosVFS.GetFile - DoGetDirectoryEntry failed, returning null. aPath = " + aPath);
return null;
}
throw new Exception(aPath + " was found, but is not a file.");
@@ -519,7 +517,7 @@ public override FileAttributes GetFileAttributes(string aPath)
* We are limiting ourselves to the simpler attributes File and Directory for now.
* I think that in the end FAT does not support anything else
*/
- Global.mFileSystemDebugger.SendInternal($"CosmosVFS.GetFileAttributes() for path {aPath}");
+ Global.Debugger.SendInternal($"CosmosVFS.GetFileAttributes() for path {aPath}");
var xFileSystem = GetFileSystemFromPath(aPath);
var xEntry = DoGetDirectoryEntry(aPath, xFileSystem);
@@ -532,11 +530,11 @@ public override FileAttributes GetFileAttributes(string aPath)
switch (xEntry.mEntryType)
{
case DirectoryEntryTypeEnum.File:
- Global.mFileSystemDebugger.SendInternal($"It is a File");
+ Global.Debugger.SendInternal($"It is a File");
return FileAttributes.Normal;
case DirectoryEntryTypeEnum.Directory:
- Global.mFileSystemDebugger.SendInternal($"It is a Directory");
+ Global.Debugger.SendInternal($"It is a Directory");
return FileAttributes.Directory;
case DirectoryEntryTypeEnum.Unknown:
@@ -566,17 +564,17 @@ public override void SetFileAttributes(string aPath, FileAttributes fileAttribut
/// Unable to determine filesystem for path: + aPath
private FileSystem GetFileSystemFromPath(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.GetFileSystemFromPath ---");
+ Global.Debugger.SendInternal("--- CosmosVFS.GetFileSystemFromPath ---");
if (String.IsNullOrEmpty(aPath))
{
throw new ArgumentException("Argument is null or empty", nameof(aPath));
}
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
string xPath = Path.GetPathRoot(aPath);
- Global.mFileSystemDebugger.SendInternal("xPath after GetPathRoot = " + xPath);
+ Global.Debugger.SendInternal("xPath after GetPathRoot = " + xPath);
var xFS = GetPartitionFromPath(aPath).MountedFS;
if (xFS == null)
@@ -629,7 +627,7 @@ private FileSystem GetFileSystemFromPath(string aPath)
/// Thrown on memory error.
private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
{
- Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.DoGetDirectoryEntry ---");
+ Global.Debugger.SendInternal("--- CosmosVFS.DoGetDirectoryEntry ---");
if (String.IsNullOrEmpty(aPath))
{
@@ -641,7 +639,7 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
throw new ArgumentNullException(nameof(aFS));
}
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
string[] xPathParts = VFSManager.SplitPath(aPath);
@@ -649,7 +647,7 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
if (xPathParts.Length == 1)
{
- Global.mFileSystemDebugger.SendInternal("Returning the volume.");
+ Global.Debugger.SendInternal("Returning the volume.");
return xBaseDirectory;
}
@@ -661,7 +659,7 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
var xPartFound = false;
var xListing = aFS.GetDirectoryListing(xBaseDirectory);
- Global.mFileSystemDebugger.SendInternal("xPathPart = " + xPathPart);
+ Global.Debugger.SendInternal("xPathPart = " + xPathPart);
for (int j = 0; j < xListing.Count; j++)
{
@@ -669,12 +667,12 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
string xListingItemName = xListingItem.mName.ToLower();
xPathPart = xPathPart.ToLower();
- Global.mFileSystemDebugger.SendInternal(xListingItemName);
+ Global.Debugger.SendInternal(xListingItemName);
if (xListingItemName == xPathPart)
{
xBaseDirectory = xListingItem;
- Global.mFileSystemDebugger.SendInternal("Now checking: " + xBaseDirectory.mFullPath);
+ Global.Debugger.SendInternal("Now checking: " + xBaseDirectory.mFullPath);
xPartFound = true;
break;
}
@@ -686,7 +684,7 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
}
}
- Global.mFileSystemDebugger.SendInternal("Returning: " + xBaseDirectory.mFullPath);
+ Global.Debugger.SendInternal("Returning: " + xBaseDirectory.mFullPath);
return xBaseDirectory;
}
@@ -700,11 +698,11 @@ private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
/// Thrown when root path is null or empty.
private DirectoryEntry GetVolume(FileSystem aFS)
{
- Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.GetVolume ---");
+ Global.Debugger.SendInternal("--- CosmosVFS.GetVolume ---");
if (aFS == null)
{
- Global.mFileSystemDebugger.SendInternal("File system is null.");
+ Global.Debugger.SendInternal("File system is null.");
throw new ArgumentNullException(nameof(aFS));
}
@@ -722,11 +720,11 @@ public override bool IsValidDriveId(string driveId)
#if TEST
return true;
#else
- Global.mFileSystemDebugger.SendInternal($"driveId is {driveId} after normalization");
+ Global.Debugger.SendInternal($"driveId is {driveId} after normalization");
/* We need to remove ':\' to get only the numeric value */
driveId = driveId.Remove(driveId.Length - 2);
- Global.mFileSystemDebugger.SendInternal($"driveId is now {driveId}");
+ Global.Debugger.SendInternal($"driveId is now {driveId}");
/*
*Cosmos Drive name is really similar to DOS / Windows but a number instead of a letter is used, it is not limited
@@ -734,7 +732,7 @@ public override bool IsValidDriveId(string driveId)
*/
bool isOK = Int32.TryParse(driveId, out int val);
- Global.mFileSystemDebugger.SendInternal($"isOK is {isOK}");
+ Global.Debugger.SendInternal($"isOK is {isOK}");
return isOK;
#endif
@@ -820,8 +818,8 @@ public override string GetFileSystemLabel(string aDriveId)
/// Unable to determine filesystem for path: + aDriveId
public override void SetFileSystemLabel(string aDriveId, string aLabel)
{
- Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.SetFileSystemLabel ---");
- Global.mFileSystemDebugger.SendInternal($"aDriveId {aDriveId} aLabel {aLabel}");
+ Global.Debugger.SendInternal("--- CosmosVFS.SetFileSystemLabel ---");
+ Global.Debugger.SendInternal($"aDriveId {aDriveId} aLabel {aLabel}");
var xFs = GetFileSystemFromPath(aDriveId);
diff --git a/source/Cosmos.System2/FileSystem/Disk.cs b/source/Cosmos.System2/FileSystem/Disk.cs
index 6bc5f8324a..29d9476b08 100644
--- a/source/Cosmos.System2/FileSystem/Disk.cs
+++ b/source/Cosmos.System2/FileSystem/Disk.cs
@@ -10,8 +10,9 @@ namespace Cosmos.System.FileSystem
{
public class Disk
{
- private List parts = new List();
- public bool IsMBR { get { return !GPT.IsGPTPartition(Host); } }
+ private readonly List parts = new();
+
+ public bool IsMBR => !GPT.IsGPTPartition(Host);
///
/// The size of the disk in bytes.
///
@@ -23,17 +24,32 @@ public List Partitions
{
get
{
- var converted = new List();
+ List converted = new();
+
+ if(Host.Type == BlockDeviceType.RemovableCD) {
+ // we dont actually have a partition table in CDs
+ ManagedPartition part = new(new Partition(Host, 0, Host.BlockCount / 4)); // BlockSize is 512, SectorSize of ISO9660 usually is 2 2048
+
+ if (mountedPartitions[0] != null) {
+ var data = mountedPartitions[0];
+ part.RootPath = data.RootPath;
+ part.MountedFS = data;
+ }
+
+ converted.Add(part);
+ return converted;
+ }
+
if (GPT.IsGPTPartition(Host))
{
- var gpt = new GPT(Host);
+ GPT gpt = new(Host);
int i = 0;
foreach (var item in gpt.Partitions)
{
- var part = new ManagedPartition(new Partition(Host, item.StartSector, item.SectorCount));
- if (MountedPartitions[i] != null)
+ ManagedPartition part = new(new Partition(Host, item.StartSector, item.SectorCount));
+ if (mountedPartitions[i] != null)
{
- var data = MountedPartitions[i];
+ var data = mountedPartitions[i];
part.RootPath = data.RootPath;
part.MountedFS = data;
}
@@ -43,14 +59,14 @@ public List Partitions
}
else
{
- var mbr = new MBR(Host);
+ MBR mbr = new(Host);
int i = 0;
foreach (var item in mbr.Partitions)
{
- var part = new ManagedPartition(new Partition(Host, item.StartSector, item.SectorCount));
- if (MountedPartitions[i] != null)
+ ManagedPartition part = new(new Partition(Host, item.StartSector, item.SectorCount));
+ if (mountedPartitions[i] != null)
{
- var data = MountedPartitions[i];
+ var data = mountedPartitions[i];
part.RootPath = data.RootPath;
part.MountedFS = data;
}
@@ -62,17 +78,12 @@ public List Partitions
return converted;
}
}
-
- ///
- /// List of file systems.
- ///
- [Obsolete("use FileSystemManager.RegisteredFileSystems")]
- public static List RegisteredFileSystemsTypes { get { return FileSystemManager.RegisteredFileSystems; } }
+
///
/// Main blockdevice that has all of the partitions.
///
public BlockDevice Host;
- public BlockDeviceType Type { get { return Host.Type; } }
+ public BlockDeviceType Type => Host.Type;
public Disk(BlockDevice mainBlockDevice)
{
Host = mainBlockDevice;
@@ -104,17 +115,17 @@ public void DisplayInformation()
{
for (int i = 0; i < Partitions.Count; i++)
{
- Global.mFileSystemDebugger.SendInternal("Partition #: ");
- Global.mFileSystemDebugger.SendInternal(i + 1);
+ Global.Debugger.SendInternal("Partition #: ");
+ Global.Debugger.SendInternal(i + 1);
global::System.Console.WriteLine("Partition #: " + (i + 1));
- Global.mFileSystemDebugger.SendInternal("Block Size:");
- Global.mFileSystemDebugger.SendInternal(Partitions[i].Host.BlockSize);
+ Global.Debugger.SendInternal("Block Size:");
+ Global.Debugger.SendInternal(Partitions[i].Host.BlockSize);
global::System.Console.WriteLine("Block Size: " + Partitions[i].Host.BlockSize + " bytes");
- Global.mFileSystemDebugger.SendInternal("Block Count:");
- Global.mFileSystemDebugger.SendInternal(Partitions[i].Host.BlockCount);
+ Global.Debugger.SendInternal("Block Count:");
+ Global.Debugger.SendInternal(Partitions[i].Host.BlockCount);
global::System.Console.WriteLine("Block Partitions: " + Partitions[i].Host.BlockCount);
- Global.mFileSystemDebugger.SendInternal("Size:");
- Global.mFileSystemDebugger.SendInternal(Partitions[i].Host.BlockCount * Partitions[i].Host.BlockSize / 1024 / 1024);
+ Global.Debugger.SendInternal("Size:");
+ Global.Debugger.SendInternal(Partitions[i].Host.BlockCount * Partitions[i].Host.BlockSize / 1024 / 1024);
global::System.Console.WriteLine("Size: " + Partitions[i].Host.BlockCount * Partitions[i].Host.BlockSize / 1024 / 1024 + " MB");
}
}
@@ -201,7 +212,7 @@ public void CreatePartition(int size)
mbrData[510] = boot[0];
mbrData[511] = boot[1];
- var partion = new Partition(Host, (ulong)startingSector, amountOfSectors);
+ Partition partion = new(Host, (ulong)startingSector, amountOfSectors);
Partition.Partitions.Add(partion);
parts.Add(new ManagedPartition(partion));
@@ -265,7 +276,8 @@ public void FormatPartition(int index, string format, bool quick = true)
}
}
- private FileSystem[] MountedPartitions = new FileSystem[4];
+ private readonly FileSystem[] mountedPartitions = new FileSystem[4];
+
///
/// Mounts a partition
///
@@ -274,12 +286,12 @@ public void MountPartition(int index)
{
var part = Partitions[index];
//Don't remount
- if (MountedPartitions[index] != null)
+ if (mountedPartitions[index] != null)
{
//We already mounted this partiton
return;
}
- string xRootPath = String.Concat(VFSManager.GetNextFilesystemLetter(), VFSBase.VolumeSeparatorChar, VFSBase.DirectorySeparatorChar);
+ string xRootPath = string.Concat(VFSManager.GetNextFilesystemLetter(), VFSBase.VolumeSeparatorChar, VFSBase.DirectorySeparatorChar);
var xSize = (long)(Host.BlockCount * Host.BlockSize / 1024 / 1024);
foreach (var item in FileSystemManager.RegisteredFileSystems)
@@ -289,7 +301,7 @@ public void MountPartition(int index)
Kernel.PrintDebug("Mounted partition.");
//We would have done Partitions[i].MountedFS = item.Create(...), but since the array is not cached, we need to store the mounted partitions in a list
- MountedPartitions[index] = item.Create(part.Host, xRootPath, xSize);
+ mountedPartitions[index] = item.Create(part.Host, xRootPath, xSize);
return;
}
}
diff --git a/source/Cosmos.System2/FileSystem/FAT/FatFileSystem.cs b/source/Cosmos.System2/FileSystem/FAT/FatFileSystem.cs
index a0190b3b9a..e895611a0d 100644
--- a/source/Cosmos.System2/FileSystem/FAT/FatFileSystem.cs
+++ b/source/Cosmos.System2/FileSystem/FAT/FatFileSystem.cs
@@ -84,15 +84,15 @@ private uint GetFatEntrySizeInBytes()
///
///
/// Thrown when bad aFirstEntry passed.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown when FAT type is unknown.
public uint[] GetFatChain(uint aFirstEntry, long aDataSize = 0)
{
- Global.mFileSystemDebugger.SendInternal("-- Fat.GetFatChain --");
- Global.mFileSystemDebugger.SendInternal("aFirstEntry =");
- Global.mFileSystemDebugger.SendInternal(aFirstEntry);
- Global.mFileSystemDebugger.SendInternal("aDataSize =");
- Global.mFileSystemDebugger.SendInternal(aDataSize);
+ Global.Debugger.SendInternal("-- Fat.GetFatChain --");
+ Global.Debugger.SendInternal("aFirstEntry =");
+ Global.Debugger.SendInternal(aFirstEntry);
+ Global.Debugger.SendInternal("aDataSize =");
+ Global.Debugger.SendInternal(aDataSize);
var xReturn = new uint[0];
uint xCurrentEntry = aFirstEntry;
@@ -108,12 +108,12 @@ public uint[] GetFatChain(uint aFirstEntry, long aDataSize = 0)
Array.Resize(ref xReturn, xReturn.Length + 1);
xReturn[xReturn.Length - 1] = xCurrentEntry;
- Global.mFileSystemDebugger.SendInternal("xEntriesRequired =");
- Global.mFileSystemDebugger.SendInternal(xEntriesRequired);
- Global.mFileSystemDebugger.SendInternal("xCurrentEntry =");
- Global.mFileSystemDebugger.SendInternal(xCurrentEntry);
- Global.mFileSystemDebugger.SendInternal("xReturn.Length =");
- Global.mFileSystemDebugger.SendInternal(xReturn.Length);
+ Global.Debugger.SendInternal("xEntriesRequired =");
+ Global.Debugger.SendInternal(xEntriesRequired);
+ Global.Debugger.SendInternal("xCurrentEntry =");
+ Global.Debugger.SendInternal(xCurrentEntry);
+ Global.Debugger.SendInternal("xReturn.Length =");
+ Global.Debugger.SendInternal(xReturn.Length);
if (xEntriesRequired > 0)
{
@@ -123,10 +123,10 @@ public uint[] GetFatChain(uint aFirstEntry, long aDataSize = 0)
GetFatEntry(xCurrentEntry, out xValue);
Array.Resize(ref xReturn, xReturn.Length + 1);
xReturn[xReturn.Length - 1] = xCurrentEntry;
- Global.mFileSystemDebugger.SendInternal("xCurrentEntry =");
- Global.mFileSystemDebugger.SendInternal(xCurrentEntry);
- Global.mFileSystemDebugger.SendInternal("xReturn.Length =");
- Global.mFileSystemDebugger.SendInternal(xReturn.Length);
+ Global.Debugger.SendInternal("xCurrentEntry =");
+ Global.Debugger.SendInternal(xCurrentEntry);
+ Global.Debugger.SendInternal("xReturn.Length =");
+ Global.Debugger.SendInternal(xReturn.Length);
}
if (xEntriesRequired > xReturn.Length)
@@ -154,8 +154,8 @@ public uint[] GetFatChain(uint aFirstEntry, long aDataSize = 0)
xChain += "->";
}
}
- Global.mFileSystemDebugger.SendInternal("Fat xChain:");
- Global.mFileSystemDebugger.SendInternal(xChain);
+ Global.Debugger.SendInternal("Fat xChain:");
+ Global.Debugger.SendInternal(xChain);
SetFatEntry(xCurrentEntry, FatEntryEofValue());
@@ -168,13 +168,13 @@ public uint[] GetFatChain(uint aFirstEntry, long aDataSize = 0)
/// The index of the next unallocated FAT entry.
/// Thrown when data lenght is greater then Int32.MaxValue.
/// Thrown when data size invalid / Failed to find an unallocated FAT entry.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when FAT type is unknown.
public uint GetNextUnallocatedFatEntry()
{
- Global.mFileSystemDebugger.SendInternal("-- Fat.GetNextUnallocatedFatEntry --");
+ Global.Debugger.SendInternal("-- Fat.GetNextUnallocatedFatEntry --");
uint xTotalEntries = mFileSystem.FatSectorCount * mFileSystem.BytesPerSector / GetFatEntrySizeInBytes();
for (uint i = mFileSystem.RootCluster + 1; i < xTotalEntries; i++)
@@ -182,8 +182,8 @@ public uint GetNextUnallocatedFatEntry()
GetFatEntry(i, out uint xEntryValue);
if (xEntryValue == 0) // check if fat entry is free
{
- Global.mFileSystemDebugger.SendInternal("i =" + i);
- Global.mFileSystemDebugger.SendInternal("-- ------------------------------ --");
+ Global.Debugger.SendInternal("i =" + i);
+ Global.Debugger.SendInternal("-- ------------------------------ --");
return i;
}
}
@@ -244,8 +244,8 @@ private void SetValueInFat(ulong aEntryNumber, ulong aValue, byte[] aData)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -264,9 +264,9 @@ public void ClearAllFat()
byte[] xFatTable = mFileSystem.NewBlockArray();
//var xFatTableSize = mFileSystem.FatSectorCount * mFileSystem.BytesPerSector / GetFatEntrySizeInBytes();
- Global.mFileSystemDebugger.SendInternal($"FatSector is {mFatSector}");
- Global.mFileSystemDebugger.SendInternal($"RootCluster is {mFileSystem.RootCluster}");
- Global.mFileSystemDebugger.SendInternal("Clearing all Fat Table");
+ Global.Debugger.SendInternal($"FatSector is {mFatSector}");
+ Global.Debugger.SendInternal($"RootCluster is {mFileSystem.RootCluster}");
+ Global.Debugger.SendInternal("Clearing all Fat Table");
byte[] xFatTableFirstSector;
ReadFatSector(0, out xFatTableFirstSector);
@@ -277,10 +277,10 @@ public void ClearAllFat()
/* Copy first three elements on xFatTable */
Array.Copy(xFatTableFirstSector, xFatTable, 12);
- Global.mFileSystemDebugger.SendInternal($"Clearing First sector...");
+ Global.Debugger.SendInternal($"Clearing First sector...");
/* The rest of 'xFatTable' should be all 0s as new does this internally */
WriteFatSector(0, xFatTable);
- Global.mFileSystemDebugger.SendInternal($"First sector cleared");
+ Global.Debugger.SendInternal($"First sector cleared");
/* Restore the Array will all 0s as it is this we have to write in the other sectors */
//Array.Clear(xFatTable, 0, 12);
@@ -295,7 +295,7 @@ public void ClearAllFat()
{
if (sector % 100 == 0)
{
- Global.mFileSystemDebugger.SendInternal($"Clearing sector {sector}");
+ Global.Debugger.SendInternal($"Clearing sector {sector}");
}
WriteFatSector(sector, xFatTable);
}
@@ -310,12 +310,12 @@ public void ClearAllFat()
/// Thrown when data size invalid.
private void ReadFatSector(ulong aSector, out byte[] aData)
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.ReadFatSector --");
+ Global.Debugger.SendInternal("-- FatFileSystem.ReadFatSector --");
aData = mFileSystem.NewBlockArray();
ulong xSector = mFatSector + aSector;
- Global.mFileSystemDebugger.SendInternal("xSector =" + xSector);
+ Global.Debugger.SendInternal("xSector =" + xSector);
mFileSystem.Device.ReadBlock(xSector, mFileSystem.SectorsPerCluster, ref aData);
- Global.mFileSystemDebugger.SendInternal("-- --------------------------- --");
+ Global.Debugger.SendInternal("-- --------------------------- --");
}
///
@@ -345,21 +345,21 @@ private void WriteFatSector(ulong aSector, byte[] aData)
/// Thrown when data lenght is greater then Int32.MaxValue.
/// Thrown when data size invalid.
/// Thrown when bad aEntryNumber passed.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown when bad aEntryNumber passed.
/// Thrown when FAT type is unknown.
internal void GetFatEntry(uint aEntryNumber, out uint aValue)
{
- Global.mFileSystemDebugger.SendInternal("-- Fat.GetFatEntry --");
- Global.mFileSystemDebugger.SendInternal("aEntryNumber = " + aEntryNumber);
+ Global.Debugger.SendInternal("-- Fat.GetFatEntry --");
+ Global.Debugger.SendInternal("aEntryNumber = " + aEntryNumber);
uint xEntrySize = GetFatEntrySizeInBytes();
ulong xEntryOffset = aEntryNumber * xEntrySize;
- Global.mFileSystemDebugger.SendInternal("xEntrySize = " + xEntrySize);
- Global.mFileSystemDebugger.SendInternal("xEntryOffset = " + xEntryOffset);
+ Global.Debugger.SendInternal("xEntrySize = " + xEntrySize);
+ Global.Debugger.SendInternal("xEntryOffset = " + xEntryOffset);
ulong xSector = xEntryOffset / mFileSystem.BytesPerSector;
- Global.mFileSystemDebugger.SendInternal("xSector = " + xSector);
+ Global.Debugger.SendInternal("xSector = " + xSector);
ReadFatSector(xSector, out byte[] xData);
@@ -391,8 +391,8 @@ internal void GetFatEntry(uint aEntryNumber, out uint aValue)
default:
throw new NotSupportedException("Unknown FAT type.");
}
- Global.mFileSystemDebugger.SendInternal("aValue =" + aValue);
- Global.mFileSystemDebugger.SendInternal("-- --------------- --");
+ Global.Debugger.SendInternal("aValue =" + aValue);
+ Global.Debugger.SendInternal("-- --------------- --");
}
///
@@ -406,9 +406,9 @@ internal void GetFatEntry(uint aEntryNumber, out uint aValue)
/// Thrown when FAT sector data is null.
internal void SetFatEntry(ulong aEntryNumber, ulong aValue)
{
- Global.mFileSystemDebugger.SendInternal("--- Fat.SetFatEntry ---");
- Global.mFileSystemDebugger.SendInternal("aEntryNumber =");
- Global.mFileSystemDebugger.SendInternal(aEntryNumber);
+ Global.Debugger.SendInternal("--- Fat.SetFatEntry ---");
+ Global.Debugger.SendInternal("aEntryNumber =");
+ Global.Debugger.SendInternal(aEntryNumber);
uint xEntrySize = GetFatEntrySizeInBytes();
ulong xEntryOffset = aEntryNumber * xEntrySize;
@@ -438,7 +438,7 @@ internal void SetFatEntry(ulong aEntryNumber, ulong aValue)
}
WriteFatSector(xSector, xData);
- Global.mFileSystemDebugger.SendInternal("Returning from --- Fat.SetFatEntry ---");
+ Global.Debugger.SendInternal("Returning from --- Fat.SetFatEntry ---");
}
///
@@ -454,9 +454,9 @@ internal void SetFatEntry(ulong aEntryNumber, ulong aValue)
/// Thrown when FAT sector data is null.
internal void SetFatEntry(ulong aEntryNumber, byte[] aData, uint aOffset, uint aLength)
{
- Global.mFileSystemDebugger.SendInternal("--- Fat.SetFatEntry ---");
- Global.mFileSystemDebugger.SendInternal("aEntryNumber =");
- Global.mFileSystemDebugger.SendInternal(aEntryNumber);
+ Global.Debugger.SendInternal("--- Fat.SetFatEntry ---");
+ Global.Debugger.SendInternal("aEntryNumber =");
+ Global.Debugger.SendInternal(aEntryNumber);
uint xEntrySize = GetFatEntrySizeInBytes();
ulong xEntryOffset = aEntryNumber * xEntrySize;
@@ -688,23 +688,23 @@ public override string Type
///
/// - Thrown when aDevice is null.
/// - Thrown when FatFileSystem is null.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
///
///
/// - Thrown when aRootPath is null.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - >FAT signature not found.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
public FatFileSystem(Partition aDevice, string aRootPath, long aSize, bool fileSystemExists = true)
: base(aDevice, aRootPath, aSize)
{
@@ -738,23 +738,23 @@ public FatFileSystem(Partition aDevice, string aRootPath, long aSize, bool fileS
///
/// - Thrown when aDevice is null.
/// - Thrown when FatFileSystem is null.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
///
///
/// - Thrown when aRootPath is null.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - >FAT signature not found.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
public static FatFileSystem CreateFatFileSystem(Partition aDevice, string aRootPath, long aSize, string aDriveFormat)
{
if (aDevice == null)
@@ -767,7 +767,7 @@ public static FatFileSystem CreateFatFileSystem(Partition aDevice, string aRootP
throw new ArgumentException("Argument is null or empty", nameof(aRootPath));
}
- Global.mFileSystemDebugger.SendInternal("Creating a new " + aDriveFormat + " FileSystem.");
+ Global.Debugger.SendInternal("Creating a new " + aDriveFormat + " FileSystem.");
var fs = new FatFileSystem(aDevice, aRootPath, aSize, false);
fs.Format(aDriveFormat, true);
@@ -777,14 +777,14 @@ public static FatFileSystem CreateFatFileSystem(Partition aDevice, string aRootP
///
/// Parse BPB
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - >FAT signature not found.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
internal void ReadBootSector()
{
var xBPB = Device.NewBlockArray(1);
@@ -891,24 +891,24 @@ internal byte[] NewBlockArray()
/// Thrown when data size invalid.
internal void Read(long aCluster, out byte[] aData)
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.Read --");
- Global.mFileSystemDebugger.SendInternal($"aCluster = {aCluster}");
+ Global.Debugger.SendInternal("-- FatFileSystem.Read --");
+ Global.Debugger.SendInternal($"aCluster = {aCluster}");
if (mFatType == FatTypeEnum.Fat32)
{
aData = NewBlockArray();
long xSector = DataSector + (aCluster - RootCluster) * SectorsPerCluster;
- Global.mFileSystemDebugger.SendInternal($"xSector = {xSector}");
+ Global.Debugger.SendInternal($"xSector = {xSector}");
Device.ReadBlock((ulong)xSector, SectorsPerCluster, ref aData);
}
else
{
- Global.mFileSystemDebugger.SendInternal("aCluster: " + aCluster);
+ Global.Debugger.SendInternal("aCluster: " + aCluster);
aData = Device.NewBlockArray(1);
Device.ReadBlock((ulong)aCluster, RootSectorCount, ref aData);
}
- Global.mFileSystemDebugger.SendInternal($"aData.Length = {aData.Length}");
- Global.mFileSystemDebugger.SendInternal("-- ------------------ --");
+ Global.Debugger.SendInternal($"aData.Length = {aData.Length}");
+ Global.Debugger.SendInternal("-- ------------------ --");
}
///
@@ -926,8 +926,8 @@ internal void Read(long aCluster, out byte[] aData)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -942,7 +942,7 @@ internal void Read(long aCluster, out byte[] aData)
///
internal void Write(long aCluster, byte[] aData, long aSize = 0, long aOffset = 0)
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.Write --");
+ Global.Debugger.SendInternal("-- FatFileSystem.Write --");
if (aData == null)
{
@@ -994,36 +994,36 @@ public override void DisplayFileSystemInfo()
global::System.Console.WriteLine("Sectors per Cluster = " + SectorsPerCluster);
global::System.Console.WriteLine("Total Sector Count = " + TotalSectorCount);
- Global.mFileSystemDebugger.SendInternal("Bytes per Cluster =");
- Global.mFileSystemDebugger.SendInternal(BytesPerCluster);
- Global.mFileSystemDebugger.SendInternal("Bytes per Sector =");
- Global.mFileSystemDebugger.SendInternal(BytesPerSector);
- Global.mFileSystemDebugger.SendInternal("Cluster Count =");
- Global.mFileSystemDebugger.SendInternal(ClusterCount);
- Global.mFileSystemDebugger.SendInternal("Data Sector =");
- Global.mFileSystemDebugger.SendInternal(DataSector);
- Global.mFileSystemDebugger.SendInternal("Data Sector Count =");
- Global.mFileSystemDebugger.SendInternal(DataSectorCount);
- Global.mFileSystemDebugger.SendInternal("FAT Sector Count =");
- Global.mFileSystemDebugger.SendInternal(FatSectorCount);
- Global.mFileSystemDebugger.SendInternal("FAT Type =");
- Global.mFileSystemDebugger.SendInternal((uint)mFatType);
- Global.mFileSystemDebugger.SendInternal("Number of FATS =");
- Global.mFileSystemDebugger.SendInternal(NumberOfFATs);
- Global.mFileSystemDebugger.SendInternal("Reserved Sector Count =");
- Global.mFileSystemDebugger.SendInternal(ReservedSectorCount);
- Global.mFileSystemDebugger.SendInternal("Root Cluster =");
- Global.mFileSystemDebugger.SendInternal(RootCluster);
- Global.mFileSystemDebugger.SendInternal("Root Entry Count =");
- Global.mFileSystemDebugger.SendInternal(RootEntryCount);
- Global.mFileSystemDebugger.SendInternal("Root Sector =");
- Global.mFileSystemDebugger.SendInternal(RootSector);
- Global.mFileSystemDebugger.SendInternal("Root Sector Count =");
- Global.mFileSystemDebugger.SendInternal(RootSectorCount);
- Global.mFileSystemDebugger.SendInternal("Sectors per Cluster =");
- Global.mFileSystemDebugger.SendInternal(SectorsPerCluster);
- Global.mFileSystemDebugger.SendInternal("Total Sector Count =");
- Global.mFileSystemDebugger.SendInternal(TotalSectorCount);
+ Global.Debugger.SendInternal("Bytes per Cluster =");
+ Global.Debugger.SendInternal(BytesPerCluster);
+ Global.Debugger.SendInternal("Bytes per Sector =");
+ Global.Debugger.SendInternal(BytesPerSector);
+ Global.Debugger.SendInternal("Cluster Count =");
+ Global.Debugger.SendInternal(ClusterCount);
+ Global.Debugger.SendInternal("Data Sector =");
+ Global.Debugger.SendInternal(DataSector);
+ Global.Debugger.SendInternal("Data Sector Count =");
+ Global.Debugger.SendInternal(DataSectorCount);
+ Global.Debugger.SendInternal("FAT Sector Count =");
+ Global.Debugger.SendInternal(FatSectorCount);
+ Global.Debugger.SendInternal("FAT Type =");
+ Global.Debugger.SendInternal((uint)mFatType);
+ Global.Debugger.SendInternal("Number of FATS =");
+ Global.Debugger.SendInternal(NumberOfFATs);
+ Global.Debugger.SendInternal("Reserved Sector Count =");
+ Global.Debugger.SendInternal(ReservedSectorCount);
+ Global.Debugger.SendInternal("Root Cluster =");
+ Global.Debugger.SendInternal(RootCluster);
+ Global.Debugger.SendInternal("Root Entry Count =");
+ Global.Debugger.SendInternal(RootEntryCount);
+ Global.Debugger.SendInternal("Root Sector =");
+ Global.Debugger.SendInternal(RootSector);
+ Global.Debugger.SendInternal("Root Sector Count =");
+ Global.Debugger.SendInternal(RootSectorCount);
+ Global.Debugger.SendInternal("Sectors per Cluster =");
+ Global.Debugger.SendInternal(SectorsPerCluster);
+ Global.Debugger.SendInternal("Total Sector Count =");
+ Global.Debugger.SendInternal(TotalSectorCount);
}
///
@@ -1039,8 +1039,8 @@ public override void DisplayFileSystemInfo()
/// Thrown on memory error.
public override List GetDirectoryListing(DirectoryEntry aBaseDirectory)
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.GetDirectoryListing --");
- Global.mFileSystemDebugger.SendInternal("aBaseDirectory: " + aBaseDirectory.mFullPath);
+ Global.Debugger.SendInternal("-- FatFileSystem.GetDirectoryListing --");
+ Global.Debugger.SendInternal("aBaseDirectory: " + aBaseDirectory.mFullPath);
if (aBaseDirectory == null)
{
@@ -1055,7 +1055,7 @@ public override List GetDirectoryListing(DirectoryEntry aBaseDir
{
result.Add(fatListing[i]);
}
- Global.mFileSystemDebugger.SendInternal("-- --------------------------------- --");
+ Global.Debugger.SendInternal("-- --------------------------------- --");
return result;
}
@@ -1068,7 +1068,7 @@ public override List GetDirectoryListing(DirectoryEntry aBaseDir
/// Thrown when root path is null or empty.
public override DirectoryEntry GetRootDirectory()
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.GetRootDirectory --");
+ Global.Debugger.SendInternal("-- FatFileSystem.GetRootDirectory --");
var xRootEntry = new FatDirectoryEntry(this, null, RootPath, RootPath, Size, RootCluster);
return xRootEntry;
@@ -1092,14 +1092,14 @@ public override DirectoryEntry GetRootDirectory()
/// Thrown when data size invalid / invalid directory entry type / memory error.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
public override DirectoryEntry CreateDirectory(DirectoryEntry aParentDirectory, string aNewDirectory)
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.CreateDirectory --");
- Global.mFileSystemDebugger.SendInternal("aParentDirectory.Name = " + aParentDirectory?.mName);
- Global.mFileSystemDebugger.SendInternal("aNewDirectory = " + aNewDirectory);
+ Global.Debugger.SendInternal("-- FatFileSystem.CreateDirectory --");
+ Global.Debugger.SendInternal("aParentDirectory.Name = " + aParentDirectory?.mName);
+ Global.Debugger.SendInternal("aNewDirectory = " + aNewDirectory);
if (aParentDirectory == null)
{
@@ -1113,7 +1113,7 @@ public override DirectoryEntry CreateDirectory(DirectoryEntry aParentDirectory,
var xParentDirectory = (FatDirectoryEntry)aParentDirectory;
var xDirectoryEntryToAdd = xParentDirectory.AddDirectoryEntry(aNewDirectory, DirectoryEntryTypeEnum.Directory);
- Global.mFileSystemDebugger.SendInternal("-- ----------------------------- --");
+ Global.Debugger.SendInternal("-- ----------------------------- --");
return xDirectoryEntryToAdd;
}
@@ -1135,14 +1135,14 @@ public override DirectoryEntry CreateDirectory(DirectoryEntry aParentDirectory,
/// Thrown when data size invalid / invalid directory entry type / memory error.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
public override DirectoryEntry CreateFile(DirectoryEntry aParentDirectory, string aNewFile)
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.CreateFile --");
- Global.mFileSystemDebugger.SendInternal("aParentDirectory.Name = " + aParentDirectory?.mName);
- Global.mFileSystemDebugger.SendInternal("aNewFile =" + aNewFile);
+ Global.Debugger.SendInternal("-- FatFileSystem.CreateFile --");
+ Global.Debugger.SendInternal("aParentDirectory.Name = " + aParentDirectory?.mName);
+ Global.Debugger.SendInternal("aNewFile =" + aNewFile);
if (aParentDirectory == null)
{
@@ -1182,8 +1182,8 @@ public override DirectoryEntry CreateFile(DirectoryEntry aParentDirectory, strin
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -1236,8 +1236,8 @@ public override void DeleteDirectory(DirectoryEntry aDirectoryEntry)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -1302,8 +1302,8 @@ public override void DeleteFile(DirectoryEntry aDirectoryEntry)
///
///
/// Thrown when encoder fallback operation on aValue fails / memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -1320,22 +1320,22 @@ public override string Label
*/
get
{
- Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.mLabel --");
+ Global.Debugger.SendInternal("-- FatFileSystem.mLabel --");
var RootDirectory = (FatDirectoryEntry)GetRootDirectory();
var VolumeId = RootDirectory.FindVolumeId();
if (VolumeId == null)
{
- Global.mFileSystemDebugger.SendInternal("No VolumeID, returning drive name");
+ Global.Debugger.SendInternal("No VolumeID, returning drive name");
return RootDirectory.mName;
}
- Global.mFileSystemDebugger.SendInternal($"Volume label is |{VolumeId.mName.TrimEnd()}|");
+ Global.Debugger.SendInternal($"Volume label is |{VolumeId.mName.TrimEnd()}|");
return VolumeId.mName.TrimEnd();
}
set
{
- Global.mFileSystemDebugger.SendInternal($"FatFileSystem - Setting Volume label to |{value}|");
+ Global.Debugger.SendInternal($"FatFileSystem - Setting Volume label to |{value}|");
var RootDirectory = (FatDirectoryEntry)GetRootDirectory();
@@ -1346,7 +1346,7 @@ public override string Label
return;
}
- Global.mFileSystemDebugger.SendInternal("No VolumeID found, let's create it!");
+ Global.Debugger.SendInternal("No VolumeID found, let's create it!");
VolumeId = RootDirectory.CreateVolumeId(value);
}
@@ -1355,7 +1355,7 @@ public override string Label
///
/// Get size of free space available.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown when filesystem is null.
///
///
@@ -1376,7 +1376,7 @@ public override long AvailableFreeSpace
var TotalSizeInBytes = Size * 1024 * 1024;
var UsedSpace = RootDirectory.GetUsedSpace();
- Global.mFileSystemDebugger.SendInternal($"TotalSizeInBytes {TotalSizeInBytes} UsedSpace {UsedSpace}");
+ Global.Debugger.SendInternal($"TotalSizeInBytes {TotalSizeInBytes} UsedSpace {UsedSpace}");
return TotalSizeInBytes - UsedSpace;
//return (mSize * 1024 * 1024) - RootDirectory.GetUsedSpace();
@@ -1386,7 +1386,7 @@ public override long AvailableFreeSpace
///
/// Get total free space.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown when filesystem is null.
///
///
@@ -1406,7 +1406,7 @@ public override long TotalFreeSpace
var TotalSizeInBytes = Size * 1024 * 1024;
var UsedSpace = RootDirectory.GetUsedSpace();
- Global.mFileSystemDebugger.SendInternal($"TotalSizeInBytes {TotalSizeInBytes} UsedSpace {UsedSpace}");
+ Global.Debugger.SendInternal($"TotalSizeInBytes {TotalSizeInBytes} UsedSpace {UsedSpace}");
return TotalSizeInBytes - UsedSpace;
//return (mSize * 1024 * 1024) - RootDirectory.GetUsedSpace();
@@ -1436,7 +1436,7 @@ internal enum FatTypeEnum
///
/// - Thrown when the data length is 0 or greater then Int32.MaxValue.
/// - Entrys matadata offset value is invalid.
- /// - Fatal error (contact support).
+ /// - Fatal error.
///
///
/// Thrown when filesystem is null / memory error.
@@ -1451,14 +1451,14 @@ internal enum FatTypeEnum
///
/// - Thrown when data size invalid.
/// - Thrown on unknown file system type.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
/// Thrown when data lenght is greater then Int32.MaxValue.
/// Thrown on memory error.
/// Thrown when FAT type is unknown.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
/// Thrown when FAT type is unknown.
public override void Format(string aDriveFormat, bool aQuick)
diff --git a/source/Cosmos.System2/FileSystem/FAT/FatFileSystemFactory.cs b/source/Cosmos.System2/FileSystem/FAT/FatFileSystemFactory.cs
index 90d81719c8..a4c449f52e 100644
--- a/source/Cosmos.System2/FileSystem/FAT/FatFileSystemFactory.cs
+++ b/source/Cosmos.System2/FileSystem/FAT/FatFileSystemFactory.cs
@@ -1,7 +1,6 @@
using System;
using Cosmos.HAL.BlockDevice;
-using Cosmos.System.FileSystem.FAT;
namespace Cosmos.System.FileSystem.FAT
{
@@ -42,23 +41,23 @@ public override bool IsType(Partition aDevice)
///
/// - Thrown when aDevice is null.
/// - Thrown when FatFileSystem is null.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
///
///
/// - Thrown when aRootPath is null.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - >FAT signature not found.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
public override FileSystem Create(Partition aDevice, string aRootPath, long aSize) => new FatFileSystem(aDevice, aRootPath, aSize);
}
}
diff --git a/source/Cosmos.System2/FileSystem/FAT/FatStream.cs b/source/Cosmos.System2/FileSystem/FAT/FatStream.cs
index a9bd1ecc82..e864ed625e 100644
--- a/source/Cosmos.System2/FileSystem/FAT/FatStream.cs
+++ b/source/Cosmos.System2/FileSystem/FAT/FatStream.cs
@@ -80,9 +80,9 @@ public sealed override long Length
{
get
{
- Global.mFileSystemDebugger.SendInternal("-- FatStream.get_Length --");
- Global.mFileSystemDebugger.SendInternal("Length =");
- Global.mFileSystemDebugger.SendInternal(mSize);
+ Global.Debugger.SendInternal("-- FatStream.get_Length --");
+ Global.Debugger.SendInternal("Length =");
+ Global.Debugger.SendInternal(mSize);
return mSize;
}
}
@@ -95,9 +95,9 @@ public override long Position
{
get
{
- Global.mFileSystemDebugger.SendInternal("-- FatStream.get_Position --");
- Global.mFileSystemDebugger.SendInternal("Position =");
- Global.mFileSystemDebugger.SendInternal(mPosition);
+ Global.Debugger.SendInternal("-- FatStream.get_Position --");
+ Global.Debugger.SendInternal("Position =");
+ Global.Debugger.SendInternal(mPosition);
return mPosition;
}
set
@@ -107,9 +107,9 @@ public override long Position
throw new ArgumentOutOfRangeException(nameof(value));
}
- Global.mFileSystemDebugger.SendInternal("-- FatStream.set_Position --");
- Global.mFileSystemDebugger.SendInternal("Position =");
- Global.mFileSystemDebugger.SendInternal(mPosition);
+ Global.Debugger.SendInternal("-- FatStream.set_Position --");
+ Global.Debugger.SendInternal("Position =");
+ Global.Debugger.SendInternal(mPosition);
mPosition = value;
}
}
@@ -183,8 +183,8 @@ public override long Seek(long offset, SeekOrigin origin)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -203,11 +203,11 @@ public override long Seek(long offset, SeekOrigin origin)
/// Thrown when FAT type is unknown.
public override void SetLength(long value)
{
- Global.mFileSystemDebugger.SendInternal("-- FatStream.SetLength --");
- Global.mFileSystemDebugger.SendInternal("value =");
- Global.mFileSystemDebugger.SendInternal(value);
- Global.mFileSystemDebugger.SendInternal("mFatTable.Length =");
- Global.mFileSystemDebugger.SendInternal(mFatTable.Length);
+ Global.Debugger.SendInternal("-- FatStream.SetLength --");
+ Global.Debugger.SendInternal("value =");
+ Global.Debugger.SendInternal(value);
+ Global.Debugger.SendInternal("mFatTable.Length =");
+ Global.Debugger.SendInternal(mFatTable.Length);
mDirectoryEntry.SetSize(value);
mSize = value;
@@ -231,18 +231,18 @@ public override void SetLength(long value)
/// Thrown on memory error.
public override int Read(byte[] aBuffer, int aOffset, int aCount)
{
- Global.mFileSystemDebugger.SendInternal("-- FatStream.Read --");
- Global.mFileSystemDebugger.SendInternal("aBuffer.Length = " + aBuffer.Length);
- Global.mFileSystemDebugger.SendInternal("aOffset = " + aOffset);
- Global.mFileSystemDebugger.SendInternal("aCount = " + aCount);
- Global.mFileSystemDebugger.SendInternal("Current State");
- Global.mFileSystemDebugger.SendInternal("mPosition = " + mPosition);
- Global.mFileSystemDebugger.SendInternal("mDirectoryEntry.mSize = " + mDirectoryEntry.mSize);
- Global.mFileSystemDebugger.SendInternal("xClusterSize = " + mFS.BytesPerCluster);
- Global.mFileSystemDebugger.SendInternal("mFatTable = ");
+ Global.Debugger.SendInternal("-- FatStream.Read --");
+ Global.Debugger.SendInternal("aBuffer.Length = " + aBuffer.Length);
+ Global.Debugger.SendInternal("aOffset = " + aOffset);
+ Global.Debugger.SendInternal("aCount = " + aCount);
+ Global.Debugger.SendInternal("Current State");
+ Global.Debugger.SendInternal("mPosition = " + mPosition);
+ Global.Debugger.SendInternal("mDirectoryEntry.mSize = " + mDirectoryEntry.mSize);
+ Global.Debugger.SendInternal("xClusterSize = " + mFS.BytesPerCluster);
+ Global.Debugger.SendInternal("mFatTable = ");
for (int i = 0; i < mFatTable.Length; i++)
{
- Global.mFileSystemDebugger.SendInternal(mFatTable[i]);
+ Global.Debugger.SendInternal(mFatTable[i]);
}
if (aCount < 0)
@@ -296,9 +296,9 @@ public override int Read(byte[] aBuffer, int aOffset, int aCount)
xReadSize = xCount;
}
- Global.mFileSystemDebugger.SendInternal("xClusterIdx = " + xClusterIdx);
- Global.mFileSystemDebugger.SendInternal("xPosInCluster = " + xPosInCluster);
- Global.mFileSystemDebugger.SendInternal("xReadSize = " + xReadSize);
+ Global.Debugger.SendInternal("xClusterIdx = " + xClusterIdx);
+ Global.Debugger.SendInternal("xPosInCluster = " + xPosInCluster);
+ Global.Debugger.SendInternal("xReadSize = " + xReadSize);
Array.Copy(xCluster, xPosInCluster, aBuffer, xOffset, xReadSize);
@@ -307,8 +307,8 @@ public override int Read(byte[] aBuffer, int aOffset, int aCount)
mPosition += xReadSize;
}
- Global.mFileSystemDebugger.SendInternal("aBuffer =" + BitConverter.ToString(aBuffer));
- Global.mFileSystemDebugger.SendInternal("xOffset =" + xOffset);
+ Global.Debugger.SendInternal("aBuffer =" + BitConverter.ToString(aBuffer));
+ Global.Debugger.SendInternal("xOffset =" + xOffset);
return (int)xOffset;
}
@@ -338,8 +338,8 @@ public override int Read(byte[] aBuffer, int aOffset, int aCount)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -360,13 +360,13 @@ public override int Read(byte[] aBuffer, int aOffset, int aCount)
/// Thrown when FAT type is unknown.
public override void Write(byte[] aBuffer, int aOffset, int aCount)
{
- Global.mFileSystemDebugger.SendInternal("-- FatStream.Write --");
- Global.mFileSystemDebugger.SendInternal("aBuffer.Length =");
- Global.mFileSystemDebugger.SendInternal(aBuffer.Length);
- Global.mFileSystemDebugger.SendInternal("aOffset =");
- Global.mFileSystemDebugger.SendInternal(aOffset);
- Global.mFileSystemDebugger.SendInternal("aCount =");
- Global.mFileSystemDebugger.SendInternal(aCount);
+ Global.Debugger.SendInternal("-- FatStream.Write --");
+ Global.Debugger.SendInternal("aBuffer.Length =");
+ Global.Debugger.SendInternal(aBuffer.Length);
+ Global.Debugger.SendInternal("aOffset =");
+ Global.Debugger.SendInternal(aOffset);
+ Global.Debugger.SendInternal("aCount =");
+ Global.Debugger.SendInternal(aCount);
if (aCount < 0)
{
@@ -412,12 +412,12 @@ public override void Write(byte[] aBuffer, int aOffset, int aCount)
Array.Copy(aBuffer, aOffset, xCluster, (int)xPosInCluster, (int)xWriteSize);
mFS.Write(mFatTable[xClusterIdx], xCluster);
- Global.mFileSystemDebugger.SendInternal("xClusterIdx =");
- Global.mFileSystemDebugger.SendInternal(xClusterIdx);
- Global.mFileSystemDebugger.SendInternal("xPosInCluster =");
- Global.mFileSystemDebugger.SendInternal(xPosInCluster);
- Global.mFileSystemDebugger.SendInternal("xWriteSize =");
- Global.mFileSystemDebugger.SendInternal(xWriteSize);
+ Global.Debugger.SendInternal("xClusterIdx =");
+ Global.Debugger.SendInternal(xClusterIdx);
+ Global.Debugger.SendInternal("xPosInCluster =");
+ Global.Debugger.SendInternal(xPosInCluster);
+ Global.Debugger.SendInternal("xWriteSize =");
+ Global.Debugger.SendInternal(xWriteSize);
xOffset += xWriteSize;
xCount -= xWriteSize;
diff --git a/source/Cosmos.System2/FileSystem/FAT/Listing/FatDiretoryEntry.cs b/source/Cosmos.System2/FileSystem/FAT/Listing/FatDiretoryEntry.cs
index 2d6ad32c03..881f4b187b 100644
--- a/source/Cosmos.System2/FileSystem/FAT/Listing/FatDiretoryEntry.cs
+++ b/source/Cosmos.System2/FileSystem/FAT/Listing/FatDiretoryEntry.cs
@@ -37,20 +37,20 @@ public FatDirectoryEntry(FatFileSystem aFileSystem, FatDirectoryEntry aParent, s
{
if (aFirstCluster < aFileSystem.RootCluster)
{
- Global.mFileSystemDebugger.SendInternal($"aFirstCluster {aFirstCluster} < aFileSystem.RootCluster {aFileSystem.RootCluster}");
+ Global.Debugger.SendInternal($"aFirstCluster {aFirstCluster} < aFileSystem.RootCluster {aFileSystem.RootCluster}");
throw new ArgumentOutOfRangeException(nameof(aFirstCluster));
}
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.ctor --");
- Global.mFileSystemDebugger.SendInternal("aFullPath: " + aFullPath);
- Global.mFileSystemDebugger.SendInternal("aFirstCluster: " + aFirstCluster);
- Global.mFileSystemDebugger.SendInternal("aEntryHeaderDataOffset: " + aEntryHeaderDataOffset);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.ctor --");
+ Global.Debugger.SendInternal("aFullPath: " + aFullPath);
+ Global.Debugger.SendInternal("aFirstCluster: " + aFirstCluster);
+ Global.Debugger.SendInternal("aEntryHeaderDataOffset: " + aEntryHeaderDataOffset);
mFirstClusterNum = aFirstCluster;
mEntryHeaderDataOffset = aEntryHeaderDataOffset;
if(aNew && aEntryType == DirectoryEntryTypeEnum.Directory && mEntryHeaderDataOffset == 0)
{
InitialiseNewDirectory(aFileSystem);
}
- Global.mFileSystemDebugger.SendInternal("-- ---------------------- --");
+ Global.Debugger.SendInternal("-- ---------------------- --");
}
///
@@ -72,17 +72,17 @@ public FatDirectoryEntry(FatFileSystem aFileSystem, FatDirectoryEntry aParent, s
{
throw new ArgumentOutOfRangeException(nameof(aFirstCluster));
}
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.ctor --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.ctor --");
mFirstClusterNum = aFirstCluster;
- Global.mFileSystemDebugger.SendInternal("mFirstClusterNum = " + mFirstClusterNum);
+ Global.Debugger.SendInternal("mFirstClusterNum = " + mFirstClusterNum);
mEntryHeaderDataOffset = 0;
if (aNew)
{
InitialiseNewDirectory(aFileSystem);
}
- Global.mFileSystemDebugger.SendInternal("-- ---------------------- --");
+ Global.Debugger.SendInternal("-- ---------------------- --");
}
private void InitialiseNewDirectory(FatFileSystem aFileSystem)
@@ -107,11 +107,11 @@ private void InitialiseNewDirectory(FatFileSystem aFileSystem)
/// Thrown when aData is null.
public uint[] GetFatTable()
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.GetFatTable --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.GetFatTable --");
var xFat = ((FatFileSystem)mFileSystem).GetFat(0);
var vs = xFat?.GetFatChain(mFirstClusterNum, mSize);
- Global.mFileSystemDebugger.SendInternal("-- ----------------------------- --");
+ Global.Debugger.SendInternal("-- ----------------------------- --");
return vs;
}
@@ -121,7 +121,7 @@ public uint[] GetFatTable()
/// File system.
public FatFileSystem GetFileSystem()
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.GetFileSystem --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.GetFileSystem --");
return (FatFileSystem)mFileSystem;
}
@@ -136,7 +136,7 @@ public FatFileSystem GetFileSystem()
/// Thrown when the number of clusters in the FAT entry is greater than Int32.MaxValue
public override Stream GetFileStream()
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.GetFileStream --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.GetFileStream --");
if (mEntryType == DirectoryEntryTypeEnum.File)
{
@@ -172,8 +172,8 @@ public override Stream GetFileStream()
///
///
/// Thrown when encoder fallback operation on aValue fails.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -183,8 +183,8 @@ public override Stream GetFileStream()
///
public override void SetName(string aName)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetName --");
- Global.mFileSystemDebugger.SendInternal($"aName = {aName}");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.SetName --");
+ Global.Debugger.SendInternal($"aName = {aName}");
if (string.IsNullOrEmpty(aName))
{
@@ -214,8 +214,8 @@ public override void SetName(string aName)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -232,9 +232,9 @@ public override void SetName(string aName)
///
public override void SetSize(long aSize)
{
- Global.mFileSystemDebugger.SendInternal("FatDirectoryEntry.SetSize:");
- Global.mFileSystemDebugger.SendInternal("aSize =");
- Global.mFileSystemDebugger.SendInternal(aSize);
+ Global.Debugger.SendInternal("FatDirectoryEntry.SetSize:");
+ Global.Debugger.SendInternal("aSize =");
+ Global.Debugger.SendInternal(aSize);
if (aSize < 0)
{
@@ -266,8 +266,8 @@ public override void SetSize(long aSize)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -284,8 +284,8 @@ public override void SetSize(long aSize)
/// Thrown when FAT type is unknown.
private void AllocateDirectoryEntry(string aShortName, bool special)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.AllocateDirectoryEntry --");
- Global.mFileSystemDebugger.SendInternal("aShortName = " + aShortName);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.AllocateDirectoryEntry --");
+ Global.Debugger.SendInternal("aShortName = " + aShortName);
string xNameString = aShortName;
if (!special)
{
@@ -329,14 +329,14 @@ private void AllocateDirectoryEntry(string aShortName, bool special)
/// Thrown when data size invalid / invalid directory entry type / memory error.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
public FatDirectoryEntry AddDirectoryEntry(string aName, DirectoryEntryTypeEnum aEntryType)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.AddDirectoryEntry --");
- Global.mFileSystemDebugger.SendInternal("aName = " + aName);
- Global.mFileSystemDebugger.SendInternal($"aEntryType = {(uint)aEntryType}");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.AddDirectoryEntry --");
+ Global.Debugger.SendInternal("aName = " + aName);
+ Global.Debugger.SendInternal($"aEntryType = {(uint)aEntryType}");
if (aEntryType == DirectoryEntryTypeEnum.Directory || aEntryType == DirectoryEntryTypeEnum.File)
{
@@ -456,10 +456,10 @@ public FatDirectoryEntry AddDirectoryEntry(string aName, DirectoryEntryTypeEnum
uint xFirstCluster = ((FatFileSystem)mFileSystem).GetFat(0).GetNextUnallocatedFatEntry();
uint xEntryHeaderDataOffset = xDirectoryEntriesToAllocate == null ? GetNextUnallocatedDirectoryEntry() : xDirectoryEntriesToAllocate[xDirectoryEntriesToAllocate.Length - 1];
- Global.mFileSystemDebugger.SendInternal("xFullPath = " + xFullPath);
- Global.mFileSystemDebugger.SendInternal("xFirstCluster = " + xFirstCluster);
- Global.mFileSystemDebugger.SendInternal("xEntryHeaderDataOffset = " + xEntryHeaderDataOffset);
- Global.mFileSystemDebugger.SendInternal("xShortName = " + xShortName);
+ Global.Debugger.SendInternal("xFullPath = " + xFullPath);
+ Global.Debugger.SendInternal("xFirstCluster = " + xFirstCluster);
+ Global.Debugger.SendInternal("xEntryHeaderDataOffset = " + xEntryHeaderDataOffset);
+ Global.Debugger.SendInternal("xShortName = " + xShortName);
((FatFileSystem)mFileSystem).Write(xFirstCluster, new byte[((FatFileSystem)mFileSystem).BytesPerCluster]); // clear the cluster where directory info will be stored
@@ -499,8 +499,8 @@ public FatDirectoryEntry AddDirectoryEntry(string aName, DirectoryEntryTypeEnum
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -516,7 +516,7 @@ public FatDirectoryEntry AddDirectoryEntry(string aName, DirectoryEntryTypeEnum
/// Thrown when FAT type is unknown.
public void DeleteDirectoryEntry()
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.DeleteDirectoryEntry --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.DeleteDirectoryEntry --");
if (mEntryType == DirectoryEntryTypeEnum.Unknown)
{
@@ -534,7 +534,7 @@ public void DeleteDirectoryEntry()
{
var xEntryOffset = mEntryHeaderDataOffset - 32;
- Global.mFileSystemDebugger.SendInternal("xEntryOffset: " + xEntryOffset);
+ Global.Debugger.SendInternal("xEntryOffset: " + xEntryOffset);
while (xData[xEntryOffset + 11] == FatDirectoryEntryAttributeConsts.LongName)
{
@@ -563,7 +563,7 @@ public void DeleteDirectoryEntry()
/// Thrown on memory error.
public List ReadDirectoryContents(bool aReturnShortFilenames = false)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.ReadDirectoryContents --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.ReadDirectoryContents --");
var xData = GetDirectoryEntryData();
var xResult = new List();
@@ -589,7 +589,7 @@ public List ReadDirectoryContents(bool aReturnShortFilenames
if (xStatus == FatDirectoryEntryAttributeConsts.UnusedOrDeletedEntry)
{
- Global.mFileSystemDebugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
+ Global.Debugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
continue;
}
@@ -629,7 +629,7 @@ public List ReadDirectoryContents(bool aReturnShortFilenames
if (xStatus == 0x00)
{
- Global.mFileSystemDebugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
+ Global.Debugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
break;
}
@@ -711,29 +711,29 @@ public List ReadDirectoryContents(bool aReturnShortFilenames
string xFullPath = Path.Combine(mFullPath, xName);
var xEntry = new FatDirectoryEntry((FatFileSystem)mFileSystem, xParent, xFullPath, xName, xSize, xFirstCluster, i, DirectoryEntryTypeEnum.File);
xResult.Add(xEntry);
- Global.mFileSystemDebugger.SendInternal(xEntry.mName + " - " + xEntry.mSize + " bytes");
+ Global.Debugger.SendInternal(xEntry.mName + " - " + xEntry.mSize + " bytes");
}
else if (xTest == FatDirectoryEntryAttributeConsts.Directory)
{
string xFullPath = Path.Combine(mFullPath, xName);
uint xSize = BitConverter.ToUInt32(xData, (int)i + 28);
var xEntry = new FatDirectoryEntry((FatFileSystem)mFileSystem, xParent, xFullPath, xName, xSize, xFirstCluster, i, DirectoryEntryTypeEnum.Directory);
- Global.mFileSystemDebugger.SendInternal(xEntry.mName + " " + xEntry.mSize + " bytes : Attrib = " + xAttrib + ", Status = " + xStatus);
+ Global.Debugger.SendInternal(xEntry.mName + " " + xEntry.mSize + " bytes : Attrib = " + xAttrib + ", Status = " + xStatus);
xResult.Add(xEntry);
}
else if (xTest == FatDirectoryEntryAttributeConsts.VolumeID)
{
- Global.mFileSystemDebugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
+ Global.Debugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
}
else
{
- Global.mFileSystemDebugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
+ Global.Debugger.SendInternal(" : Attrib = " + xAttrib + ", Status = " + xStatus);
}
break;
}
}
}
- Global.mFileSystemDebugger.SendInternal("-- --------------------------------------- --");
+ Global.Debugger.SendInternal("-- --------------------------------------- --");
return xResult;
}
@@ -755,7 +755,7 @@ public FatDirectoryEntry FindVolumeId()
throw new Exception("VolumeId can be found only in Root Directory");
}
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.FindVolumeId --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.FindVolumeId --");
var xData = GetDirectoryEntryData();
FatDirectoryEntry xParent = this;
@@ -769,7 +769,7 @@ public FatDirectoryEntry FindVolumeId()
if (xAttrib != FatDirectoryEntryAttributeConsts.VolumeID)
continue;
- Global.mFileSystemDebugger.SendInternal("VolumeID Found");
+ Global.Debugger.SendInternal("VolumeID Found");
/* The Label in FAT could be only a shortName (limited to 11 characters) so it is more easy */
string xName = Encoding.ASCII.GetString(xData, (int)i, 11);
xName = xName.TrimEnd();
@@ -780,14 +780,14 @@ public FatDirectoryEntry FindVolumeId()
//uint xFirstCluster = (uint)(xData.ToUInt16(i + 20) << 16 | xData.ToUInt16(i + 26));
uint xFirstCluster = xParent.mFirstClusterNum;
- Global.mFileSystemDebugger.SendInternal($"VolumeID Found xName {xName} xFullPath {xFullPath} xSize {xSize} xFirstCluster {xFirstCluster}");
+ Global.Debugger.SendInternal($"VolumeID Found xName {xName} xFullPath {xFullPath} xSize {xSize} xFirstCluster {xFirstCluster}");
xResult = new FatDirectoryEntry((FatFileSystem)mFileSystem, xParent, xFullPath, xName, xSize, xFirstCluster, i, DirectoryEntryTypeEnum.File);
break;
}
if (xResult == null)
- Global.mFileSystemDebugger.SendInternal($"VolumeID not found, returning null");
+ Global.Debugger.SendInternal($"VolumeID not found, returning null");
return xResult;
}
@@ -803,8 +803,8 @@ public FatDirectoryEntry FindVolumeId()
/// Thrown when called on a directory other then root / data size invalid / invalid directory entry type / memory error.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
public FatDirectoryEntry CreateVolumeId(string name)
{
@@ -828,7 +828,7 @@ public FatDirectoryEntry CreateVolumeId(string name)
/// Thrown when unallocated memory block not found / invalid directory entry type.
private uint GetNextUnallocatedDirectoryEntry()
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.GetNextUnallocatedDirectoryEntry --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.GetNextUnallocatedDirectoryEntry --");
var xData = GetDirectoryEntryData();
for (uint i = 0; i < xData.Length; i += 32)
@@ -839,8 +839,8 @@ private uint GetNextUnallocatedDirectoryEntry()
uint x4 = BitConverter.ToUInt32(xData, (int)i + 24);
if (x1 == 0 && x2 == 0 && x3 == 0 && x4 == 0)
{
- Global.mFileSystemDebugger.SendInternal("Returning i =" + i);
- Global.mFileSystemDebugger.SendInternal("-- -------------------------------------------------- --");
+ Global.Debugger.SendInternal("Returning i =" + i);
+ Global.Debugger.SendInternal("-- -------------------------------------------------- --");
return i;
}
}
@@ -858,7 +858,7 @@ private uint GetNextUnallocatedDirectoryEntry()
/// Thrown when requested memory block of the size of aEntryCount not found / invalid directory entry type.
private uint[] GetNextUnallocatedDirectoryEntries(int aEntryCount)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.GetNextUnallocatedDirectoryEntry --");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.GetNextUnallocatedDirectoryEntry --");
var xData = GetDirectoryEntryData();
int xCount = 0;
@@ -898,14 +898,14 @@ private uint[] GetNextUnallocatedDirectoryEntries(int aEntryCount)
/// Thrown when data size invalid / invalid directory entry type.
private byte[] GetDirectoryEntryData()
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.GetDirectoryEntryData --");
- Global.mFileSystemDebugger.SendInternal("mFirstClusterNum:" + mFirstClusterNum);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.GetDirectoryEntryData --");
+ Global.Debugger.SendInternal("mFirstClusterNum:" + mFirstClusterNum);
if (mEntryType != DirectoryEntryTypeEnum.Unknown)
{
byte[] xData;
((FatFileSystem)mFileSystem).Read(mFirstClusterNum, out xData);
- Global.mFileSystemDebugger.SendInternal("-- --------------------------------------- --");
+ Global.Debugger.SendInternal("-- --------------------------------------- --");
return xData;
}
@@ -924,8 +924,8 @@ private byte[] GetDirectoryEntryData()
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -940,8 +940,8 @@ private byte[] GetDirectoryEntryData()
///
private void SetDirectoryEntryData(byte[] aData)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryData(byte) --");
- Global.mFileSystemDebugger.SendInternal("aData.Length = " + aData.Length);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryData(byte) --");
+ Global.Debugger.SendInternal("aData.Length = " + aData.Length);
if (aData == null)
{
@@ -983,8 +983,8 @@ private void SetDirectoryEntryData(byte[] aData)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -1000,9 +1000,9 @@ private void SetDirectoryEntryData(byte[] aData)
///
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, byte aValue)
{
- Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --");
- Global.mFileSystemDebugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
- Global.mFileSystemDebugger.SendInternal("aValue = " + aValue);
+ Global.Debugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --");
+ Global.Debugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
+ Global.Debugger.SendInternal("aValue = " + aValue);
if (IsRootDirectory())
{
@@ -1039,8 +1039,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -1056,9 +1056,9 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
///
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, ushort aValue)
{
- Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --");
- Global.mFileSystemDebugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
- Global.mFileSystemDebugger.SendInternal("aValue = " + aValue);
+ Global.Debugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --");
+ Global.Debugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
+ Global.Debugger.SendInternal("aValue = " + aValue);
if (IsRootDirectory())
{
@@ -1069,14 +1069,14 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
if (xData.Length > 0)
{
- Global.mFileSystemDebugger.SendInternal("mEntryHeaderDataOffset = " + mEntryHeaderDataOffset);
+ Global.Debugger.SendInternal("mEntryHeaderDataOffset = " + mEntryHeaderDataOffset);
var xValue = new byte[aEntryMetadata.DataLength];
xValue.SetUInt16(0, aValue);
uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset;
Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength);
((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData);
}
- Global.mFileSystemDebugger.SendInternal(" -- ------------------------------------------------------ --");
+ Global.Debugger.SendInternal(" -- ------------------------------------------------------ --");
}
///
@@ -1099,8 +1099,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -1116,9 +1116,9 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
///
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, uint aValue)
{
- Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --");
- Global.mFileSystemDebugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
- Global.mFileSystemDebugger.SendInternal("aValue = " + aValue);
+ Global.Debugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --");
+ Global.Debugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
+ Global.Debugger.SendInternal("aValue = " + aValue);
if (IsRootDirectory())
{
@@ -1157,8 +1157,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -1174,10 +1174,10 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
///
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, long aValue)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(long) --");
- Global.mFileSystemDebugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
- Global.mFileSystemDebugger.SendInternal("aValue =");
- Global.mFileSystemDebugger.SendInternal(aValue);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(long) --");
+ Global.Debugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
+ Global.Debugger.SendInternal("aValue =");
+ Global.Debugger.SendInternal(aValue);
if (IsRootDirectory())
{
@@ -1191,8 +1191,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
var xValue = new byte[aEntryMetadata.DataLength];
xValue.SetUInt32(0, (uint)aValue);
uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset;
- Global.mFileSystemDebugger.SendInternal("offset =");
- Global.mFileSystemDebugger.SendInternal(offset);
+ Global.Debugger.SendInternal("offset =");
+ Global.Debugger.SendInternal(offset);
Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength);
((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData);
}
@@ -1219,8 +1219,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aValue is corrupted.
///
///
@@ -1236,9 +1236,9 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
///
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, string aValue)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(string) --");
- Global.mFileSystemDebugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
- Global.mFileSystemDebugger.SendInternal($"aValue = {aValue}");
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(string) --");
+ Global.Debugger.SendInternal("aEntryMetadata = " + aEntryMetadata.DataOffset);
+ Global.Debugger.SendInternal($"aValue = {aValue}");
if (IsRootDirectory())
{
@@ -1279,8 +1279,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -1295,8 +1295,8 @@ internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMet
///
internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, FatDirectoryEntryMetadata aEntryMetadata, uint aValue)
{
- Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(uint) --");
- Global.mFileSystemDebugger.SendInternal("aValue = " + aValue);
+ Global.Debugger.SendInternal(" -- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(uint) --");
+ Global.Debugger.SendInternal("aValue = " + aValue);
var xData = GetDirectoryEntryData();
@@ -1324,8 +1324,8 @@ internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, Fat
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -1340,18 +1340,18 @@ internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, Fat
///
internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, FatDirectoryEntryMetadata aEntryMetadata, long aValue)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(long) --");
- Global.mFileSystemDebugger.SendInternal("aValue = " + aValue);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(long) --");
+ Global.Debugger.SendInternal("aValue = " + aValue);
var xData = GetDirectoryEntryData();
if (xData.Length > 0)
{
- Global.mFileSystemDebugger.SendInternal("length = " + aEntryMetadata.DataLength);
+ Global.Debugger.SendInternal("length = " + aEntryMetadata.DataLength);
var xValue = new byte[aEntryMetadata.DataLength * 4];
xValue.SetUInt32(0, (uint)aValue);
uint offset = aEntryHeaderDataOffset + aEntryMetadata.DataOffset;
- Global.mFileSystemDebugger.SendInternal("offset = " + offset);
+ Global.Debugger.SendInternal("offset = " + offset);
Array.Copy(xValue, 0, xData, (int)offset, (int)aEntryMetadata.DataLength * 4);
SetDirectoryEntryData(xData);
}
@@ -1372,8 +1372,8 @@ internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, Fat
///
///
/// Thrown when encoder fallback operation on aValue fails.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -1388,8 +1388,8 @@ internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, Fat
///
internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, FatDirectoryEntryMetadata aEntryMetadata, string aValue)
{
- Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(string) --");
- Global.mFileSystemDebugger.SendInternal("aValue = " + aValue);
+ Global.Debugger.SendInternal("-- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(string) --");
+ Global.Debugger.SendInternal("aValue = " + aValue);
var xData = GetDirectoryEntryData();
@@ -1409,7 +1409,7 @@ internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, Fat
///
/// The short filename.
/// Returns the short filename to be written to the FAT directory entry.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
internal static string GetShortName(string aShortName)
{
char[] xName = new char[11];
@@ -1466,7 +1466,7 @@ internal static uint CalculateChecksum(string aShortName)
/// long value.
/// Thrown when DirectoryEntryData array is too short.
/// Thrown when DirectoryEntryData array is null.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown when data lenght is greater then Int32.MaxValue.
/// Thrown when data size invalid.
private long GetDirectoryEntrySize(byte[] DirectoryEntryData)
@@ -1557,12 +1557,12 @@ private long GetDirectoryEntrySize(byte[] DirectoryEntryData)
/// long value, space used (bytes)
/// Thrown when directory entry data corrupted.
/// Thrown when directory entry data is null.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown when data lenght is greater then Int32.MaxValue.
/// Thrown when data size invalid.
public override long GetUsedSpace()
{
- Global.mFileSystemDebugger.SendInternal($"-- FatDirectoryEntry.GetUsedSpace() on Directory {mName} ---");
+ Global.Debugger.SendInternal($"-- FatDirectoryEntry.GetUsedSpace() on Directory {mName} ---");
long xResult = 0;
@@ -1570,8 +1570,8 @@ public override long GetUsedSpace()
xResult += GetDirectoryEntrySize(xData);
- Global.mFileSystemDebugger.SendInternal($"-- FatDirectoryEntry.GetUsedSpace() is {xResult} bytes");
+ Global.Debugger.SendInternal($"-- FatDirectoryEntry.GetUsedSpace() is {xResult} bytes");
return xResult;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/FileSystem/FileSystem.cs b/source/Cosmos.System2/FileSystem/FileSystem.cs
index ac75f9e483..64c0db0593 100644
--- a/source/Cosmos.System2/FileSystem/FileSystem.cs
+++ b/source/Cosmos.System2/FileSystem/FileSystem.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using Cosmos.HAL.BlockDevice;
-using Cosmos.System.FileSystem.FAT;
using Cosmos.System.FileSystem.Listing;
namespace Cosmos.System.FileSystem
@@ -71,8 +70,8 @@ protected FileSystem(Partition aDevice, string aRootPath, long aSize)
/// Thrown when data size invalid / invalid directory entry type / memory error.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
public abstract DirectoryEntry CreateDirectory(DirectoryEntry aParentDirectory, string aNewDirectory);
@@ -94,8 +93,8 @@ protected FileSystem(Partition aDevice, string aRootPath, long aSize)
/// Thrown when data size invalid / invalid directory entry type / memory error.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
public abstract DirectoryEntry CreateFile(DirectoryEntry aParentDirectory, string aNewFile);
@@ -121,8 +120,8 @@ protected FileSystem(Partition aDevice, string aRootPath, long aSize)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -165,8 +164,8 @@ protected FileSystem(Partition aDevice, string aRootPath, long aSize)
/// - Out of memory.
///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
///
///
@@ -228,7 +227,7 @@ protected FileSystem(Partition aDevice, string aRootPath, long aSize)
///
/// - Thrown when the data length is 0 or greater then Int32.MaxValue.
/// - Entrys matadata offset value is invalid.
- /// - Fatal error (contact support).
+ /// - Fatal error.
///
///
/// Thrown when filesystem is null / memory error.
@@ -243,14 +242,14 @@ protected FileSystem(Partition aDevice, string aRootPath, long aSize)
///
/// - Thrown when data size invalid.
/// - Thrown on unknown file system type.
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
///
///
/// Thrown when data lenght is greater then Int32.MaxValue.
/// Thrown on memory error.
/// Thrown when FAT type is unknown.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown when the data in aData is corrupted.
/// Thrown when FAT type is unknown.
public abstract void Format(string aDriveFormat, bool aQuick);
diff --git a/source/Cosmos.System2/FileSystem/ISO9660/ISO9660FileSystem.cs b/source/Cosmos.System2/FileSystem/ISO9660/ISO9660FileSystem.cs
index 909812d333..96ed44c18b 100644
--- a/source/Cosmos.System2/FileSystem/ISO9660/ISO9660FileSystem.cs
+++ b/source/Cosmos.System2/FileSystem/ISO9660/ISO9660FileSystem.cs
@@ -204,16 +204,18 @@ public override List GetDirectoryListing(DirectoryEntry baseDire
foreach (var item in dirEntries)
{
DirectoryEntryTypeEnum type;
+ var fName = item.FileID;
+
if ((item.FileFlags & (1 << 1)) != 0)
{
type = DirectoryEntryTypeEnum.Directory;
}
else
{
- type = DirectoryEntryTypeEnum.File;
+ type = DirectoryEntryTypeEnum.File; //remove the ;1 part from the file name
+ fName = fName.Remove(fName.Length - 2);
}
- var properID = item.FileID.Remove(item.FileID.Length - 2); //remove the ;1 part from the file name
- entries.Add(new ISO9660DirectoryEntry(item, this, parent, Path.Combine(parent.mFullPath, properID), properID, 0, type));
+ entries.Add(new ISO9660DirectoryEntry(item, this, parent, Path.Combine(parent.mFullPath, fName), fName, 0, type));
}
return entries;
}
diff --git a/source/Cosmos.System2/FileSystem/ManagedPartition.cs b/source/Cosmos.System2/FileSystem/ManagedPartition.cs
index ba55c43bd1..d576e8a93a 100644
--- a/source/Cosmos.System2/FileSystem/ManagedPartition.cs
+++ b/source/Cosmos.System2/FileSystem/ManagedPartition.cs
@@ -1,17 +1,12 @@
#define COSMOS_DEBUG
-using System;
-using System.Collections.Generic;
-using System.Text;
using Cosmos.Debug.Kernel;
using Cosmos.HAL.BlockDevice;
-using Cosmos.System.FileSystem.FAT;
-using Cosmos.System.FileSystem.VFS;
namespace Cosmos.System.FileSystem
{
public class ManagedPartition
{
- internal static Debugger PartitonDebugger = new Debugger("System", "Partiton");
+ internal static Debugger PartitonDebugger = new Debugger("Partiton");
public readonly Partition Host;
///
/// The root path of the file system. Example: 0:\
@@ -24,18 +19,13 @@ public class ManagedPartition
///
/// Does the partition have a known file system?
///
- public bool HasFileSystem
- {
- get
- {
- return MountedFS != null;
- }
- }
+ public bool HasFileSystem => MountedFS != null;
public ManagedPartition(Partition host)
{
Host = host;
}
+
///
/// Zeros out the entire partition
///
@@ -50,4 +40,4 @@ public void Clear()
RootPath = "";
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/FileSystem/VFS/VFSManager.cs b/source/Cosmos.System2/FileSystem/VFS/VFSManager.cs
index ac917f4a77..7fbb7a4a71 100644
--- a/source/Cosmos.System2/FileSystem/VFS/VFSManager.cs
+++ b/source/Cosmos.System2/FileSystem/VFS/VFSManager.cs
@@ -32,7 +32,7 @@ public static class VFSManager
/// Thrown on fatal error.
public static void RegisterVFS(VFSBase aVFS, bool aShowInfo = true, bool aAllowReinitialise = false)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.RegisterVFS ---");
+ Global.Debugger.SendInternal("--- VFSManager.RegisterVFS ---");
if (!aAllowReinitialise && mVFS != null)
{
throw new Exception("Virtual File System Manager already initialized!");
@@ -58,14 +58,14 @@ public static void RegisterVFS(VFSBase aVFS, bool aShowInfo = true, bool aAllowR
/// Thrown when aPath is longer than the system defined max lenght.
public static DirectoryEntry CreateFile(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.CreateFile ---");
+ Global.Debugger.SendInternal("--- VFSManager.CreateFile ---");
if (string.IsNullOrEmpty(aPath))
{
throw new ArgumentNullException(nameof(aPath));
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aPath =" + aPath);
+ Global.Debugger.SendInternal("aPath =" + aPath);
return mVFS.CreateFile(aPath);
}
@@ -136,7 +136,7 @@ public static void DeleteFile(string aPath)
/// Thrown on memory error.
public static DirectoryEntry GetFile(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- VFSManager.GetFile --");
+ Global.Debugger.SendInternal("-- VFSManager.GetFile --");
ThrowIfNotRegistered();
if (string.IsNullOrEmpty(aPath))
@@ -144,13 +144,13 @@ public static DirectoryEntry GetFile(string aPath)
throw new ArgumentNullException(nameof(aPath));
}
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
string xFileName = Path.GetFileName(aPath);
- Global.mFileSystemDebugger.SendInternal("xFileName = " + xFileName);
+ Global.Debugger.SendInternal("xFileName = " + xFileName);
string xDirectory = aPath.Remove(aPath.Length - xFileName.Length);
- Global.mFileSystemDebugger.SendInternal("xDirectory = " + xDirectory);
+ Global.Debugger.SendInternal("xDirectory = " + xDirectory);
char xLastChar = xDirectory[xDirectory.Length - 1];
if (xLastChar != Path.DirectorySeparatorChar)
@@ -201,14 +201,14 @@ public static DirectoryEntry GetFile(string aPath)
///
///
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
/// Thrown when The aPath is longer than the system defined maximum length.
public static DirectoryEntry CreateDirectory(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- VFSManager.CreateDirectory -- " + aPath);
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("-- VFSManager.CreateDirectory -- " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
if (String.IsNullOrEmpty(aPath))
{
@@ -217,7 +217,7 @@ public static DirectoryEntry CreateDirectory(string aPath)
ThrowIfNotRegistered();
var directoryEntry = mVFS.CreateDirectory(aPath);
- Global.mFileSystemDebugger.SendInternal("-- -------------------------- -- " + aPath);
+ Global.Debugger.SendInternal("-- -------------------------- -- " + aPath);
return directoryEntry;
}
@@ -346,7 +346,7 @@ public static void DeleteDirectory(string aPath, bool recursive)
/// Thrown on memory error.
public static DirectoryEntry GetDirectory(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetDirectory ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetDirectory ---");
if (string.IsNullOrEmpty(aPath))
{
@@ -354,7 +354,7 @@ public static DirectoryEntry GetDirectory(string aPath)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
return mVFS.GetDirectory(aPath);
}
@@ -403,7 +403,7 @@ public static DirectoryEntry GetDirectory(string aPath)
/// Thrown on memory error.
public static List GetDirectoryListing(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetDirectoryListing ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetDirectoryListing ---");
if (string.IsNullOrEmpty(aPath))
{
@@ -411,8 +411,8 @@ public static List GetDirectoryListing(string aPath)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aPath =");
- Global.mFileSystemDebugger.SendInternal(aPath);
+ Global.Debugger.SendInternal("aPath =");
+ Global.Debugger.SendInternal(aPath);
return mVFS.GetDirectoryListing(aPath);
}
@@ -428,7 +428,7 @@ public static List GetDirectoryListing(string aPath)
/// Thrown when root directory address is smaller then root directory address.
public static DirectoryEntry GetVolume(string aVolume)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetVolume ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetVolume ---");
if (string.IsNullOrEmpty(aVolume))
{
@@ -436,8 +436,8 @@ public static DirectoryEntry GetVolume(string aVolume)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aVolume =");
- Global.mFileSystemDebugger.SendInternal(aVolume);
+ Global.Debugger.SendInternal("aVolume =");
+ Global.Debugger.SendInternal(aVolume);
return mVFS.GetVolume(aVolume);
}
@@ -451,7 +451,7 @@ public static DirectoryEntry GetVolume(string aVolume)
/// Thrown when root path is null or empty.
public static List GetVolumes()
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetVolumes ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetVolumes ---");
ThrowIfNotRegistered();
return mVFS.GetVolumes();
@@ -466,7 +466,7 @@ public static List GetVolumes()
/// Thrown when root path is null or empty.
public static List GetLogicalDrives()
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetLogicalDrives ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetLogicalDrives ---");
List xDrives = new List();
foreach (DirectoryEntry entry in GetVolumes())
@@ -482,7 +482,7 @@ public static List GetLogicalDrives()
/// bool value.
public static bool FileExists(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- VFSManager.FileExists --");
+ Global.Debugger.SendInternal("-- VFSManager.FileExists --");
ThrowIfNotRegistered();
if (aPath == null)
@@ -490,10 +490,10 @@ public static bool FileExists(string aPath)
return false;
}
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("aPath = " + aPath);
string xPath = Path.GetFullPath(aPath);
- Global.mFileSystemDebugger.SendInternal("xPath = " + xPath);
+ Global.Debugger.SendInternal("xPath = " + xPath);
return GetFile(xPath) != null;
}
@@ -505,7 +505,7 @@ public static bool FileExists(string aPath)
/// bool value.
public static bool FileExists(DirectoryEntry aEntry)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.FileExists ---");
+ Global.Debugger.SendInternal("--- VFSManager.FileExists ---");
if (aEntry == null)
{
@@ -514,13 +514,13 @@ public static bool FileExists(DirectoryEntry aEntry)
try
{
- Global.mFileSystemDebugger.SendInternal("aEntry.mName =");
- Global.mFileSystemDebugger.SendInternal(aEntry.mName);
+ Global.Debugger.SendInternal("aEntry.mName =");
+ Global.Debugger.SendInternal(aEntry.mName);
string xPath = GetFullPath(aEntry);
- Global.mFileSystemDebugger.SendInternal("After GetFullPath");
- Global.mFileSystemDebugger.SendInternal("xPath =");
- Global.mFileSystemDebugger.SendInternal(xPath);
+ Global.Debugger.SendInternal("After GetFullPath");
+ Global.Debugger.SendInternal("xPath =");
+ Global.Debugger.SendInternal(xPath);
return GetFile(xPath) != null;
}
@@ -545,18 +545,18 @@ public static bool DirectoryExists(string aPath)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.DirectoryExists ---");
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("--- VFSManager.DirectoryExists ---");
+ Global.Debugger.SendInternal("aPath = " + aPath);
try
{
string xPath = Path.GetFullPath(aPath);
- Global.mFileSystemDebugger.SendInternal("After GetFullPath");
- Global.mFileSystemDebugger.SendInternal("xPath = " + xPath);
+ Global.Debugger.SendInternal("After GetFullPath");
+ Global.Debugger.SendInternal("xPath = " + xPath);
var result = GetDirectory(xPath) != null;
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.DirectoryExists --- Returns: " + result);
+ Global.Debugger.SendInternal("--- VFSManager.DirectoryExists --- Returns: " + result);
return result;
}
catch
@@ -574,7 +574,7 @@ public static bool DirectoryExists(string aPath)
/// Thrown when aEntry is null.
public static bool DirectoryExists(DirectoryEntry aEntry)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.DirectoryExists ---");
+ Global.Debugger.SendInternal("--- VFSManager.DirectoryExists ---");
if (aEntry == null)
{
@@ -584,13 +584,13 @@ public static bool DirectoryExists(DirectoryEntry aEntry)
try
{
- Global.mFileSystemDebugger.SendInternal("aEntry.mName =");
- Global.mFileSystemDebugger.SendInternal(aEntry.mName);
+ Global.Debugger.SendInternal("aEntry.mName =");
+ Global.Debugger.SendInternal(aEntry.mName);
string xPath = GetFullPath(aEntry);
- Global.mFileSystemDebugger.SendInternal("After GetFullPath");
- Global.mFileSystemDebugger.SendInternal("xPath =");
- Global.mFileSystemDebugger.SendInternal(xPath);
+ Global.Debugger.SendInternal("After GetFullPath");
+ Global.Debugger.SendInternal("xPath =");
+ Global.Debugger.SendInternal(xPath);
return GetDirectory(xPath) != null;
}
@@ -610,7 +610,7 @@ public static bool DirectoryExists(DirectoryEntry aEntry)
/// Thrown when aEntry is null.
public static string GetFullPath(DirectoryEntry aEntry)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFullPath ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFullPath ---");
if (aEntry == null)
{
@@ -618,8 +618,8 @@ public static string GetFullPath(DirectoryEntry aEntry)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aEntry.mName =");
- Global.mFileSystemDebugger.SendInternal(aEntry.mName);
+ Global.Debugger.SendInternal("aEntry.mName =");
+ Global.Debugger.SendInternal(aEntry.mName);
var xParent = aEntry.mParent;
string xPath = aEntry.mName;
@@ -627,16 +627,16 @@ public static string GetFullPath(DirectoryEntry aEntry)
while (xParent != null)
{
xPath = xParent.mName + xPath;
- Global.mFileSystemDebugger.SendInternal("xPath =");
- Global.mFileSystemDebugger.SendInternal(xPath);
+ Global.Debugger.SendInternal("xPath =");
+ Global.Debugger.SendInternal(xPath);
xParent = xParent.mParent;
- Global.mFileSystemDebugger.SendInternal("xParent.mName =");
- Global.mFileSystemDebugger.SendInternal(xParent.mName);
+ Global.Debugger.SendInternal("xParent.mName =");
+ Global.Debugger.SendInternal(xParent.mName);
}
- Global.mFileSystemDebugger.SendInternal("xPath =");
- Global.mFileSystemDebugger.SendInternal(xPath);
+ Global.Debugger.SendInternal("xPath =");
+ Global.Debugger.SendInternal(xPath);
return xPath;
}
@@ -688,7 +688,7 @@ public static string GetFullPath(DirectoryEntry aEntry)
/// Thrown on memory error.
public static Stream GetFileStream(string aPathname)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFileStream ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFileStream ---");
if (string.IsNullOrEmpty(aPathname))
{
@@ -696,8 +696,8 @@ public static Stream GetFileStream(string aPathname)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aPathName =");
- Global.mFileSystemDebugger.SendInternal(aPathname);
+ Global.Debugger.SendInternal("aPathName =");
+ Global.Debugger.SendInternal(aPathname);
var xFileInfo = GetFile(aPathname);
if (xFileInfo == null)
@@ -752,7 +752,7 @@ public static Stream GetFileStream(string aPathname)
/// Thrown on memory error.
public static FileAttributes GetFileAttributes(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFileAttributes ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFileAttributes ---");
ThrowIfNotRegistered();
return mVFS.GetFileAttributes(aPath);
}
@@ -766,7 +766,7 @@ public static FileAttributes GetFileAttributes(string aPath)
/// Thrown always
public static void SetFileAttributes(string aPath, FileAttributes fileAttributes)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFileAttributes ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFileAttributes ---");
ThrowIfNotRegistered();
mVFS.SetFileAttributes(aPath, fileAttributes);
}
@@ -779,7 +779,7 @@ public static void SetFileAttributes(string aPath, FileAttributes fileAttributes
/// Thrown if aPath length is smaller then 2, or greater than Int32.MaxValue.
public static bool IsValidDriveId(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFileAttributes ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFileAttributes ---");
ThrowIfNotRegistered();
return mVFS.IsValidDriveId(aPath);
}
@@ -793,7 +793,7 @@ public static bool IsValidDriveId(string aPath)
/// Unable to determine filesystem for path: + aDriveId
public static long GetTotalSize(string aDriveId)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetTotalSize ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetTotalSize ---");
ThrowIfNotRegistered();
return mVFS.GetTotalSize(aDriveId);
}
@@ -807,7 +807,7 @@ public static long GetTotalSize(string aDriveId)
/// Unable to determine filesystem for path: + aDriveId
public static long GetAvailableFreeSpace(string aDriveId)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetAvailableFreeSpace ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetAvailableFreeSpace ---");
ThrowIfNotRegistered();
return mVFS.GetAvailableFreeSpace(aDriveId);
}
@@ -821,7 +821,7 @@ public static long GetAvailableFreeSpace(string aDriveId)
/// Unable to determine filesystem for path: + aDriveId
public static long GetTotalFreeSpace(string aDriveId)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetTotalFreeSpace ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetTotalFreeSpace ---");
ThrowIfNotRegistered();
return mVFS.GetTotalFreeSpace(aDriveId);
}
@@ -835,7 +835,7 @@ public static long GetTotalFreeSpace(string aDriveId)
/// Unable to determine filesystem for path: + aDriveId
public static string GetFileSystemType(string aDriveId)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFileSystemType ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFileSystemType ---");
ThrowIfNotRegistered();
return mVFS.GetFileSystemType(aDriveId);
}
@@ -849,7 +849,7 @@ public static string GetFileSystemType(string aDriveId)
/// Unable to determine filesystem for path: + aDriveId
public static string GetFileSystemLabel(string aDriveId)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetFileSystemLabel ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetFileSystemLabel ---");
ThrowIfNotRegistered();
return mVFS.GetFileSystemLabel(aDriveId);
}
@@ -863,7 +863,7 @@ public static string GetFileSystemLabel(string aDriveId)
/// Unable to determine filesystem for path: + aDriveId
public static void SetFileSystemLabel(string aDriveId, string aLabel)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.SetFileSystemLabel ---");
+ Global.Debugger.SendInternal("--- VFSManager.SetFileSystemLabel ---");
ThrowIfNotRegistered();
mVFS.SetFileSystemLabel(aDriveId, aLabel);
}
@@ -1084,7 +1084,7 @@ private static char[] GetDirectorySeparators()
/// Thrown on memory error.
public static DirectoryEntry GetParent(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("--- VFSManager.GetParent ---");
+ Global.Debugger.SendInternal("--- VFSManager.GetParent ---");
if (string.IsNullOrEmpty(aPath))
{
@@ -1092,8 +1092,8 @@ public static DirectoryEntry GetParent(string aPath)
}
ThrowIfNotRegistered();
- Global.mFileSystemDebugger.SendInternal("aPath =");
- Global.mFileSystemDebugger.SendInternal(aPath);
+ Global.Debugger.SendInternal("aPath =");
+ Global.Debugger.SendInternal(aPath);
if (aPath == Path.GetPathRoot(aPath))
{
diff --git a/source/Cosmos.System2/Global.cs b/source/Cosmos.System2/Global.cs
index 11ee7e1e8f..feb86129df 100644
--- a/source/Cosmos.System2/Global.cs
+++ b/source/Cosmos.System2/Global.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-
+using System.Diagnostics.CodeAnalysis;
using Cosmos.Debug.Kernel;
using Cosmos.HAL;
@@ -12,106 +8,77 @@
namespace Cosmos.System
{
///
- /// Cosmos global class.
- /// Used to init the console, screen and debugger and get/set keyboard keys.
+ /// Contains commonly used globals. Used to initialize the console, screen
+ /// and debugger and get/set keyboard scan-maps.
///
public static class Global
{
///
- /// Create new instance of the class.
- ///
- static Global()
- {
-
- }
-
- ///
- /// System ring debugger instance, with the tag "Global".
- ///
- public static readonly Debugger mDebugger = DebuggerFactory.CreateDebugger("System", "Global");
-
- ///
- /// System ring debugger instance, with the tag "FileSystem".
+ /// The global system ring debugger instance, with the tag "Global".
///
- public static readonly Debugger mFileSystemDebugger = DebuggerFactory.CreateDebugger("System", "FileSystem");
+ public static readonly Debugger Debugger = DebuggerFactory.CreateDebugger("Global");
///
- /// Console instance.
+ /// The main global console instance.
///
public static Console Console;
///
- /// Get and set keyboard NumLock value.
+ /// Gets and sets the keyboards num-lock state.
///
public static bool NumLock
{
- get { return KeyboardManager.NumLock; }
- set { KeyboardManager.NumLock = value; }
+ get => KeyboardManager.NumLock;
+ set => KeyboardManager.NumLock = value;
}
///
- /// Get and set keyboard CapsLock value.
+ /// Gets and sets the keyboards caps-lock state.
///
public static bool CapsLock
{
- get { return KeyboardManager.CapsLock; }
- set { KeyboardManager.CapsLock = value; }
+ get => KeyboardManager.CapsLock;
+ set => KeyboardManager.CapsLock = value;
}
///
- /// Get and set keyboard ScrollLock value.
+ /// Gets and sets the keyboards scroll-lock state.
///
public static bool ScrollLock
{
- get { return KeyboardManager.ScrollLock; }
- set { KeyboardManager.ScrollLock = value; }
+ get => KeyboardManager.ScrollLock;
+ set => KeyboardManager.ScrollLock = value;
}
// TODO: continue adding exceptions to the list, as HAL and Core would be documented.
///
- /// Init console, screen and keyboard.
+ /// Initializes the console, screen and keyboard.
///
/// A screen device.
- public static void Init(TextScreenBase textScreen, bool InitScroolWheel = true, bool InitPS2 = true, bool InitNetwork = true, bool IDEInit = true)
+ public static void Init(TextScreenBase textScreen, bool initScrollWheel = true, bool initPS2 = true, bool initNetwork = true, bool ideInit = true)
{
// We must init Console before calling Inits.
// This is part of the "minimal" boot to allow output.
- mDebugger.Send("Creating Console");
+ Debugger.Send("Creating the global console...");
if (textScreen != null)
{
Console = new Console(textScreen);
}
- mDebugger.Send("Creating Keyboard");
+ Debugger.Send("Initializing the Hardware Abstraction Layer (HAL)...");
+ HAL.Global.Init(textScreen, initScrollWheel, initPS2, initNetwork, ideInit);
- mDebugger.Send("HW Init");
- HAL.Global.Init(textScreen, InitScroolWheel, InitPS2, InitNetwork, IDEInit);
-
- Network.NetworkStack.Init();
- mDebugger.Send("Network Stack Init");
+ // TODO: @ascpixi: The end-user should have an option to exclude parts of
+ // Cosmos, such as the network stack, when they are not needed. As of
+ // now, these modules will *always* be included, as they're referenced
+ // by the initialization code.
+ Debugger.Send("Initializing the network stack...");
+ Network.NetworkStack.Initialize();
NumLock = false;
CapsLock = false;
ScrollLock = false;
}
-
- ///
- /// Change keyboard layout. Initially set to US_Standard.
- ///
- /// Currently available:
- ///
- /// - US_Standard.
- /// - FR_Standard.
- /// - DE_Standard.
- /// - TR_StandardQ.
- ///
- ///
- ///
- /// A key mapping.
- public static void ChangeKeyLayout(ScanMapBase scanMap)
- {
- KeyboardManager.SetKeyLayout(scanMap);
- }
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Graphics/Bitmap.cs b/source/Cosmos.System2/Graphics/Bitmap.cs
index 4c6691ba1b..9fe7a9f828 100644
--- a/source/Cosmos.System2/Graphics/Bitmap.cs
+++ b/source/Cosmos.System2/Graphics/Bitmap.cs
@@ -6,57 +6,69 @@
namespace Cosmos.System.Graphics
{
///
- /// Bitmap class, used to represent image of the type of Bitmap. See also: .
+ /// Represents a bitmap image.
///
public class Bitmap : Image
{
///
- /// Create new instance of class.
+ /// Initializes a new instance of class.
///
- /// Image width (greater then 0).
- /// Image height (greater then 0).
- /// Color depth.
- public Bitmap(uint Width, uint Height, ColorDepth colorDepth) : base(Width, Height, colorDepth)
+ /// The width of the image.
+ /// The height of the image.
+ /// The color depth.
+ /// Thrown when either the width or height is lower than 0.
+ public Bitmap(uint width, uint height, ColorDepth colorDepth) : base(width, height, colorDepth)
{
- rawData = new int[Width * Height];
+ if(width < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(width));
+ }
+
+ if(height < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(height));
+ }
+
+ RawData = new int[width * height];
}
///
- /// Create a bitmap from a byte array representing the pixels.
+ /// Initializes a new instance of class from a byte array
+ /// representing the pixels.
///
- /// Width of the bitmap.
- /// Height of the bitmap.
- /// Byte array which includes the values for each pixel.
- /// Format of pixel data.
- /// Thrwon if color depth is not 32.
+ /// The width of the bitmap.
+ /// The height of the bitmap.
+ /// A byte array which includes the values for each pixel.
+ /// The format of the pixel data.
+ /// Thrown if color depth is not 32.
/// Thrown if bitmap size is bigger than Int32.MaxValue.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- public Bitmap(uint Width, uint Height, byte[] pixelData, ColorDepth colorDepth) : base(Width, Height, colorDepth)
+ /// Thrown on fatal error.
+ public Bitmap(uint width, uint height, byte[] pixelData, ColorDepth colorDepth) : base(width, height, colorDepth)
{
- rawData = new int[Width * Height];
+ RawData = new int[width * height];
if (colorDepth != ColorDepth.ColorDepth32 && colorDepth != ColorDepth.ColorDepth24)
{
- Global.mDebugger.Send("Only color depths 24 and 32 are supported!");
+ Global.Debugger.Send("Only color depths 24 and 32 are supported!");
throw new NotImplementedException("Only color depths 24 and 32 are supported!");
}
- for (int i = 0; i < rawData.Length; i++)
+ for (int i = 0; i < RawData.Length; i++)
{
if (colorDepth == ColorDepth.ColorDepth32)
{
- rawData[i] = BitConverter.ToInt32(new byte[] { pixelData[i * 4], pixelData[i * 4 + 1], pixelData[i * 4 + 2], pixelData[i * 4 + 3] }, 0);
+ RawData[i] = BitConverter.ToInt32(new byte[] { pixelData[i * 4], pixelData[i * 4 + 1], pixelData[i * 4 + 2], pixelData[i * 4 + 3] }, 0);
}
else
{
- rawData[i] = BitConverter.ToInt32(new byte[] { 0, pixelData[i * 3], pixelData[i * 3 + 1], pixelData[i * 3 + 2] }, 0);
+ RawData[i] = BitConverter.ToInt32(new byte[] { 0, pixelData[i * 3], pixelData[i * 3 + 1], pixelData[i * 3 + 2] }, 0);
}
}
}
///
- /// Create new instance of the class, with a specified path to a BMP file.
+ /// Initializes a new instance of the class, using the specified path to a BMP file.
///
/// Path to file.
///
@@ -71,11 +83,11 @@ public Bitmap(uint Width, uint Height, byte[] pixelData, ColorDepth colorDepth)
/// - Memory error.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on IO error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - The path refers to non-file.
///
///
@@ -98,7 +110,7 @@ public Bitmap(string path) : this(path, ColorOrder.BGR)
}
///
- /// Create new instance of the class, with a specified path to a BMP file.
+ /// Initializes a new instance of the class, with a specified path to a BMP file.
///
/// Path to file.
/// Order of colors in each pixel.
@@ -114,11 +126,11 @@ public Bitmap(string path) : this(path, ColorOrder.BGR)
/// - Memory error.
///
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on IO error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - The path refers to non-file.
///
///
@@ -138,22 +150,20 @@ public Bitmap(string path) : this(path, ColorOrder.BGR)
/// Thrown if the specified path is exceed the system-defined max length.
public Bitmap(string path, ColorOrder colorOrder = ColorOrder.BGR) : base(0, 0, ColorDepth.ColorDepth32) //Call the image constructor with wrong values
{
- using (var fs = new FileStream(path, FileMode.Open))
- {
- CreateBitmap(fs, colorOrder);
- }
+ using var fs = new FileStream(path, FileMode.Open);
+ CreateBitmap(fs, colorOrder);
}
///
- /// Create new instance of the class, with a specified image data byte array.
+ /// Initializes a new instance of the class, with the specified image data byte array.
///
/// byte array.
/// Thrown if imageData is null / memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on IO error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
///
///
/// - Thrown if header is not from a BMP.
@@ -168,16 +178,16 @@ public Bitmap(byte[] imageData) : this(imageData, ColorOrder.BGR) //Call the ima
}
///
- /// Create new instance of the class, with a specified image data byte array.
+ /// Initializes a new instance of the class, with the specified image data byte array.
///
/// byte array.
/// Order of colors in each pixel.
/// Thrown if imageData is null / memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on IO error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
///
///
/// - Thrown if header is not from a BMP.
@@ -189,26 +199,24 @@ public Bitmap(byte[] imageData) : this(imageData, ColorOrder.BGR) //Call the ima
/// Thrown if pixelsize is other then 32 / 24 or the file compressed.
public Bitmap(byte[] imageData, ColorOrder colorOrder = ColorOrder.BGR) : base(0, 0, ColorDepth.ColorDepth32) //Call the image constructor with wrong values
{
- using (var ms = new MemoryStream(imageData))
- {
- CreateBitmap(ms, colorOrder);
- }
+ using var ms = new MemoryStream(imageData);
+ CreateBitmap(ms, colorOrder);
}
// For more information about the format: https://docs.microsoft.com/en-us/previous-versions/ms969901(v=msdn.10)?redirectedfrom=MSDN
///
- /// Create bitmap from stream.
+ /// Creates a bitmap from the given I/O stream.
///
/// Stream.
/// Order of colors in each pixel.
/// Thrown on memory error.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on IO error.
///
///
- /// - Thrown on fatal error (contact support).
+ /// - Thrown on fatal error.
/// - The stream does not support seeking.
///
///
@@ -226,73 +234,76 @@ private void CreateBitmap(Stream stream, ColorOrder colorOrder)
{
#region BMP Header
- byte[] _int = new byte[4];
- byte[] _short = new byte[2];
- //Assume that we are using the BMP (Windows) V3 header format
+ byte[] buffer32 = new byte[4];
+ byte[] buffer16 = new byte[2];
- //reading magic number to identify if BMP file (BM as string - 42 4D as Hex) - bytes 0 -> 2
- stream.Read(_short, 0, 2);
- if ("42-4D" != BitConverter.ToString(_short))
+ // Assume that we are using the BMP (Windows) V3 header format
+ // reading magic number to identify if BMP file (BM as string - 42 4D as Hex) - bytes 0 -> 2
+ stream.Read(buffer16, 0, 2);
+ if ("42-4D" != BitConverter.ToString(buffer16))
{
throw new Exception("Header is not from a BMP");
}
- //read size of BMP file - byte 2 -> 6
- stream.Read(_int, 0, 4);
- uint fileSize = BitConverter.ToUInt32(_int, 0);
+ // read size of BMP file - byte 2 -> 6
+ stream.Read(buffer32, 0, 4);
stream.Position = 10;
- //read header - bytes 10 -> 14 is the offset of the bitmap image data
- stream.Read(_int, 0, 4);
- uint pixelTableOffset = BitConverter.ToUInt32(_int, 0);
-
- //now reading size of BITMAPINFOHEADER should be 40 - bytes 14 -> 18
- stream.Read(_int, 0, 4);
- uint infoHeaderSize = BitConverter.ToUInt32(_int, 0);
- if (infoHeaderSize != 40 && infoHeaderSize != 56 && infoHeaderSize != 124) // 124 - is BITMAPV5INFOHEADER, 56 - is BITMAPV3INFOHEADER, where we ignore the additional values see https://web.archive.org/web/20150127132443/https://forums.adobe.com/message/3272950
+ // read header - bytes 10 -> 14 is the offset of the bitmap image data
+ stream.Read(buffer32, 0, 4);
+ uint pixelTableOffset = BitConverter.ToUInt32(buffer32, 0);
+
+ // now reading size of BITMAPINFOHEADER should be 40 - bytes 14 -> 18
+ stream.Read(buffer32, 0, 4);
+ uint infoHeaderSize = BitConverter.ToUInt32(buffer32, 0);
+ if (infoHeaderSize is not 40 and not 56 and not 124) // 124 - is BITMAPV5INFOHEADER, 56 - is BITMAPV3INFOHEADER, where we ignore the additional values see https://web.archive.org/web/20150127132443/https://forums.adobe.com/message/3272950
{
- throw new Exception("Info header size has the wrong value!");
+ throw new Exception("The information header size is incorrect.");
}
- //now reading width of image in pixels - bytes 18 -> 22
- stream.Read(_int, 0, 4);
- uint imageWidth = BitConverter.ToUInt32(_int, 0);
- //now reading height of image in pixels - byte 22 -> 26
- stream.Read(_int, 0, 4);
- uint imageHeight = BitConverter.ToUInt32(_int, 0);
+ // Now reading width of image in pixels - bytes 18 -> 22
+ stream.Read(buffer32, 0, 4);
+ uint imageWidth = BitConverter.ToUInt32(buffer32, 0);
+
+ // Now reading height of image in pixels - byte 22 -> 26
+ stream.Read(buffer32, 0, 4);
+ uint imageHeight = BitConverter.ToUInt32(buffer32, 0);
- //now reading number of planes should be 1 - byte 26 -> 28
- stream.Read(_short, 0, 2);
- ushort planes = BitConverter.ToUInt16(_short, 0);
+ // Now reading number of planes should be 1 - byte 26 -> 28
+ stream.Read(buffer16, 0, 2);
+ ushort planes = BitConverter.ToUInt16(buffer16, 0);
if (planes != 1)
{
- throw new Exception("Number of planes is not 1! Can not read file!");
+ throw new Exception("The number of planes is not 1.");
}
- //now reading size of bits per pixel (1, 4, 8, 24, 32) - bytes 28 - 30
- stream.Read(_short, 0, 2);
- ushort pixelSize = BitConverter.ToUInt16(_short, 0);
+ // Now reading size of bits per pixel (1, 4, 8, 24, 32) - bytes 28 - 30
+ stream.Read(buffer16, 0, 2);
+ ushort pixelSize = BitConverter.ToUInt16(buffer16, 0);
+
//TODO: Be able to handle other pixel sizes
- if (!(pixelSize == 32 || pixelSize == 24))
+ if (pixelSize is not (32 or 24))
{
- throw new NotImplementedException("Can only handle 32bit or 24bit bitmaps!");
+ throw new NotImplementedException("The current implementation can only handle 32-bit or 24-bit bitmaps.");
}
+
//now reading compression type - bytes 30 -> 34
- stream.Read(_int, 0, 4);
- uint compression = BitConverter.ToUInt32(_int, 0);
- //TODO: Be able to handle compressed files
- if (compression != 0 && compression != 3) //3 is BI_BITFIELDS again ignore for now is for Adobe Images
+ stream.Read(buffer32, 0, 4);
+ uint compression = BitConverter.ToUInt32(buffer32, 0);
+
+ // TODO: Be able to handle compressed files
+ if (compression is not 0 and not 3) //3 is BI_BITFIELDS again ignore for now is for Adobe Images
{
//Global.mDebugger.Send("Can only handle uncompressed files!");
- throw new NotImplementedException("Can only handle uncompressed files!");
+ throw new NotImplementedException("Bitmap compression is not supported.");
}
- //now reading total image data size(including padding) - bytes 34 -> 38
- stream.Read(_int, 0, 4);
- uint totalImageSize = BitConverter.ToUInt32(_int, 0);
+
+ // Now reading total image data size(including padding) - bytes 34 -> 38
+ stream.Read(buffer32, 0, 4);
+ uint totalImageSize = BitConverter.ToUInt32(buffer32, 0);
if (totalImageSize == 0)
{
- totalImageSize = (uint)(((imageWidth * pixelSize + 31) & ~31) >> 3) * imageHeight; // Look at the link above for the explanation
- Global.mDebugger.SendInternal("Calcualted image size: " + totalImageSize);
+ totalImageSize = (uint)((((imageWidth * pixelSize) + 31) & ~31) >> 3) * imageHeight; // Look at the link above for the explanation
}
#endregion BMP Header
@@ -301,15 +312,12 @@ private void CreateBitmap(Stream stream, ColorOrder colorOrder)
Width = imageWidth;
Height = imageHeight;
Depth = (ColorDepth)pixelSize;
- Global.mDebugger.SendInternal("Width: " + Width);
- Global.mDebugger.SendInternal("Height: " + Height);
- Global.mDebugger.SendInternal("Depth: " + pixelSize);
- rawData = new int[Width * Height];
+ RawData = new int[Width * Height];
#region Pixel Table
- //Calculate padding
+ // Calculate padding
int paddingPerRow;
int pureImageSize = (int)(imageWidth * imageHeight * pixelSize / 8);
if (totalImageSize != 0)
@@ -317,22 +325,24 @@ private void CreateBitmap(Stream stream, ColorOrder colorOrder)
int remainder = (int)totalImageSize - pureImageSize;
if (remainder < 0)
{
- throw new Exception("Total Image Size is smaller than pure image size");
+ throw new Exception("The total image size is smaller than the pure image size.");
}
+
paddingPerRow = remainder / (int)imageHeight;
pureImageSize = (int)totalImageSize;
}
else
{
- //total image size is 0 if it is not compressed
+ // total image size is 0 if it is not compressed
paddingPerRow = 0;
}
- //Read data
+
+ // Read data
stream.Position = (int)pixelTableOffset;
int position = 0;
byte[] pixelData = new byte[pureImageSize];
stream.Read(pixelData, 0, pureImageSize);
- byte[] pixel = new byte[4]; //All must have the same size
+ byte[] pixel = new byte[4]; // All must have the same size
for (int y = 0; y < imageHeight; y++)
{
@@ -362,7 +372,7 @@ private void CreateBitmap(Stream stream, ColorOrder colorOrder)
pixel[3] = 0;
}
}
- rawData[x + (imageHeight - (y + 1)) * imageWidth] = BitConverter.ToInt32(pixel, 0); //This bits should be A, R, G, B but order is switched
+ RawData[x + (imageHeight - (y + 1)) * imageWidth] = BitConverter.ToInt32(pixel, 0); //This bits should be A, R, G, B but order is switched
}
position += paddingPerRow;
}
@@ -371,143 +381,141 @@ private void CreateBitmap(Stream stream, ColorOrder colorOrder)
}
///
- /// Save image as bmp file.
+ /// Saves the given image as a BMP file.
///
- /// Path to the file.
+ /// The path to the file.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
/// Thrown on memory error.
/// Thrown on memory error.
/// Thrown on IO error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
public void Save(string path)
{
- using (FileStream fs = File.Open(path, FileMode.Create))
- {
- Save(fs, ImageFormat.bmp);
- }
+ using FileStream fs = File.Open(path, FileMode.Create);
+ Save(fs, ImageFormat.BMP);
}
///
- /// Save image to stream.
+ /// Saves the image to the given stream.
///
- /// Stream.
- /// Image format.
+ /// The target stream.
+ /// The format to save the image with.
/// Thrown on memory error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
/// Thrown on memory error.
/// Thrown on memory error.
/// Thrown on memory error.
/// Thrown on IO error.
/// Thrown if the stream does not support writing.
/// Thrown if the stream is closed.
- public void Save(Stream stream, ImageFormat imageFormat)
+ public void Save(Stream stream, ImageFormat imageFormat = ImageFormat.BMP)
{
//Calculate padding
- int padding = 4 - (int)Width * (int)Depth % 32 / 8;
+ int padding = 4 - ((int)Width * (int)Depth % 32 / 8);
if (padding == 4)
{
padding = 0;
}
- byte[] file = new byte[54 /*header*/ + Width * Height * (uint)Depth / 8 + padding * Height];
- //Writes all bytes at the end into the stream, rather than a few every time
+
+ byte[] file = new byte[54 /*header*/ + (Width * Height * (uint)Depth / 8) + padding * Height];
+ // Writes all bytes at the end into the stream, rather than a few every time
int position = 0;
- //Set signature
+ // Set signature
byte[] data = BitConverter.GetBytes(0x4D42);
Array.Copy(data, 0, file, position, 2);
position += 2;
- //Write apporiximate file size
- data = BitConverter.GetBytes(54 /*header*/ + Width * Height * (uint)Depth / 8 /*assume that it is full bytes */);
+ // Write apporiximate file size
+ data = BitConverter.GetBytes(54 /*header*/ + (Width * Height * (uint)Depth / 8) /*assume that it is full bytes */);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Leave bytes 6 -> 10 empty
+ // Leave bytes 6 -> 10 empty
data = new byte[] { 0, 0, 0, 0 };
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Offset to start of image data
+ // Offset to start of image data
uint offset = 54;
data = BitConverter.GetBytes(offset);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Write size of bitmapinfoheader
+ // Write size of bitmapinfoheader
data = BitConverter.GetBytes(40);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Width in pixels
+ // Width in pixels
data = BitConverter.GetBytes(Width);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Height in pixels
+ // Height in pixels
data = BitConverter.GetBytes(Height);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Number of planes(1)
+ // Number of planes(1)
data = BitConverter.GetBytes(1);
Array.Copy(data, 0, file, position, 2);
position += 2;
- //Bits per pixel
+ // Bits per pixel
data = BitConverter.GetBytes((int)Depth);
Array.Copy(data, 0, file, position, 2);
position += 2;
- //Compression type
+ // Compression type
data = BitConverter.GetBytes(0);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Size of image data in bytes
+ // Size of image data in bytes
data = BitConverter.GetBytes(Width * Height * (uint)Depth / 8);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Horizontal resolution in meters (is not accurate)
+ // Horizontal resolution in meters (is not accurate)
data = BitConverter.GetBytes(Width / 40);
Array.Copy(data, 0, file, position, 4);
position += 4;
- //Vertical resolution in meters (is not accurate)
+ // Vertical resolution in meters (is not accurate)
data = BitConverter.GetBytes(Height / 40);
Array.Copy(data, 0, file, position, 0);
position += 4;
- //Number of colors in image /zero
+ // Number of colors in image /zero
data = BitConverter.GetBytes(0);
Array.Copy(data, 0, file, position, 0);
position += 4;
- //number of important colors in image / zero
+ // number of important colors in image / zero
data = BitConverter.GetBytes(0);
Array.Copy(data, 0, file, position, 4);
- position += 4;
- //Finished header
+ // Finished header
- //Copy image data
+ // Copy image data
position = (int)offset;
int byteNum = (int)Depth / 8;
- byte[] imageData = new byte[Width * Height * byteNum + padding * Height];
+ byte[] imageData = new byte[(Width * Height * byteNum) + padding * Height];
int imageDataPoint = 0;
- int cOffset = 4 - (int)Depth / 8;
+ int cOffset = 4 - ((int)Depth / 8);
for (int y = 0; y < Height; y++)
{
for (int x = 0; x < Width; x++)
{
- data = BitConverter.GetBytes(rawData[x + (Height - (y + 1)) * Width]);
+ data = BitConverter.GetBytes(RawData[x + (Height - (y + 1)) * Width]);
for (int i = 0; i < byteNum; i++)
{
imageData[imageDataPoint++] = data[i + cOffset];
diff --git a/source/Cosmos.System2/Graphics/Canvas.cs b/source/Cosmos.System2/Graphics/Canvas.cs
index edd16ca363..6e6f8e7ba1 100644
--- a/source/Cosmos.System2/Graphics/Canvas.cs
+++ b/source/Cosmos.System2/Graphics/Canvas.cs
@@ -7,66 +7,45 @@
namespace Cosmos.System.Graphics
{
///
- /// Canvas abstract class.
+ /// Represents a drawing surface.
///
public abstract class Canvas
{
- /*
- * IReadOnlyList is not working, the Modes inside it become corrupted and then you get Stack Overflow
- */
- //public abstract IReadOnlyList AvailableModes { get; }
-
///
- /// Available graphics modes.
+ /// The available graphics modes.
///
public abstract List AvailableModes { get; }
///
- /// Get default graphics mode.
+ /// The default graphics mode.
///
- public abstract Mode DefaultGraphicMode { get; }
+ public abstract Mode DefaultGraphicsMode { get; }
///
- /// Get and set graphics mode.
+ /// The currently used display mode.
///
public abstract Mode Mode { get; set; }
///
- /// Clear all the Canvas with the Black color.
+ /// Clears the canvas with the default color.
///
- /// Thrown on fatal error.
- /// Thrown on memory access violation.
public void Clear()
{
Clear(Color.Black);
}
- /*
- * Clear all the Canvas with the specified color. Please note that it is a very naïve implementation and any
- * driver should replace it (or with an hardware command or if not possible with a block copy on the IoMemoryBlock)
- */
///
- /// Clear all the Canvas with the specified color.
+ /// Clears the entire canvas with the specified color.
///
- /// Color in ARGB.
- /// Thrown on fatal error.
- /// Thrown on memory access violation.
+ /// The ARGB color to clear the screen with.
public abstract void Clear(int color);
- /*
- * Clear all the Canvas with the specified color. Please note that it is a very naïve implementation and any
- * driver should replace it (or with an hardware command or if not possible with a block copy on the IoMemoryBlock)
- */
///
- /// Clear all the Canvas with the specified color.
+ /// Clears the entire canvas with the specified color.
///
- /// Color.
- /// Thrown on fatal error.
- /// Thrown on memory access violation.
+ /// The color to clear the screen with.
public virtual void Clear(Color color)
{
- Global.mDebugger.SendInternal($"Clearing the Screen with Color {color}");
-
for (int x = 0; x < Mode.Width; x++)
{
for (int y = 0; y < Mode.Height; y++)
@@ -77,83 +56,77 @@ public virtual void Clear(Color color)
}
///
- /// Display graphic mode
+ /// Disables the canvas.
///
public abstract void Disable();
///
- /// Draw point.
+ /// Sets the pixel at the given coordinates to the specified .
///
- /// Color to draw with.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown on memory access violation.
+ /// The color to draw with.
+ /// The X coordinate.
+ /// The Y coordinate.
public abstract void DrawPoint(Color color, int x, int y);
///
- /// Draw point to the screen.
- /// Not implemented.
- ///
- /// Color to draw the point with.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown always (only int coordinats supported).
- public abstract void DrawPoint(Color color, float x, float y);
-
- ///
- /// Name of the backend
+ /// The name of the Canvas implementation.
///
public abstract string Name();
///
- /// Display screen
+ /// Updates the screen to display the underlying frame-buffer.
+ /// Call this method in order to synchronize the screen with the canvas.
///
public abstract void Display();
///
- /// Get point color.
+ /// Gets the color of the pixel at the given coordinates.
///
- /// X coordinate.
- /// Y coordinate.
- /// Color value.
- /// Thrown on memory access violation.
+ /// The X coordinate.
+ /// The Y coordinate.
public abstract Color GetPointColor(int x, int y);
///
- /// Get point offset.
+ /// Gets the index of the pixel at the given coordinates.
///
- /// X coordinate.
- /// Y coordinate.
- /// int value.
- internal int GetPointOffset(int aX, int aY)
+ /// The X coordinate.
+ /// The Y coordinate.
+ internal int GetPointOffset(int x, int y)
{
int xBytePerPixel = (int)Mode.ColorDepth / 8;
int stride = (int)Mode.ColorDepth / 8;
- int pitch = Mode.Width * xBytePerPixel;
+ int pitch = (int)Mode.Width * xBytePerPixel;
- return aX * stride + aY * pitch;
+ return (x * stride) + (y * pitch);
}
///
- /// Draw array of colors.
+ /// Draws an array of pixels to the canvas, starting at the given coordinates,
+ /// using the given width.
///
- /// Colors array.
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// unused.
- /// Thrown if coordinates are invalid, or width is less than 0.
- /// Thrown if color depth is not supported.
- public abstract void DrawArray(Color[] colors, int x, int y, int width, int height);
+ /// The pixels to draw.
+ /// The X coordinate.
+ /// The Y coordinate.
+ /// The width of the drawn bitmap.
+ /// This parameter is unused.
+ public virtual void DrawArray(Color[] colors, int x, int y, int width, int height)
+ {
+ for (int X = 0; X < width; X++)
+ {
+ for (int Y = 0; Y < height; Y++)
+ {
+ DrawPoint(colors[Y * width + X], x + X, y + Y);
+ }
+ }
+ }
///
- /// Draw horizontal line.
+ /// Draws a horizontal line.
///
- /// Color to draw with.
- /// Line lenght.
- /// Staring point X coordinate.
- /// Staring point Y coordinate.
- /// Thrown on memory access violation.
+ /// The color to draw with.
+ /// The length of the line.
+ /// The starting point X coordinate.
+ /// The starting point Y coordinate.
internal void DrawHorizontalLine(Color color, int dx, int x1, int y1)
{
int i;
@@ -165,13 +138,12 @@ internal void DrawHorizontalLine(Color color, int dx, int x1, int y1)
}
///
- /// Draw vertical line.
+ /// Draw a vertical line.
///
- /// Color to draw with.
- /// Line lenght.
- /// Staring point X coordinate.
- /// Staring point Y coordinate.
- /// Thrown on memory access violation.
+ /// The color to draw with.
+ /// The line of the line.
+ /// The starting point X coordinate.
+ /// The starting point Y coordinate.
internal void DrawVerticalLine(Color color, int dy, int x1, int y1)
{
int i;
@@ -187,15 +159,13 @@ internal void DrawVerticalLine(Color color, int dy, int x1, int y1)
* See http://www.brackeen.com/vga/shapes.html#4 for more informations.
*/
///
- /// Draw diagonal line.
+ /// Draws a diagonal line.
///
- /// Color to draw with.
- /// Line lenght on X axis.
- /// Line lenght on Y axis.
- /// Staring point X coordinate.
- /// Staring point Y coordinate.
- /// Thrown if dx or dy equal to Int32.MinValue.
- /// Thrown on memory access violation.
+ /// The color to draw with.
+ /// The line length on the X axis.
+ /// The line length on the Y axis.
+ /// The starting point X coordinate.
+ /// The starting point Y coordinate.
internal void DrawDiagonalLine(Color color, int dx, int dy, int x1, int y1)
{
int i;
@@ -209,7 +179,7 @@ internal void DrawDiagonalLine(Color color, int dx, int dy, int x1, int y1)
var px = x1;
var py = y1;
- if (dxabs >= dyabs) /* the line is more horizontal than vertical */
+ if (dxabs >= dyabs) // the line is more horizontal than vertical
{
for (i = 0; i < dxabs; i++)
{
@@ -223,7 +193,7 @@ internal void DrawDiagonalLine(Color color, int dx, int dy, int x1, int y1)
DrawPoint(color, px, py);
}
}
- else /* the line is more vertical than horizontal */
+ else // the line is more vertical than horizontal
{
for (i = 0; i < dyabs; i++)
{
@@ -240,117 +210,88 @@ internal void DrawDiagonalLine(Color color, int dx, int dy, int x1, int y1)
}
///
- /// Draw line.
- ///
- /// color to draw with.
- /// Staring point X coordinate.
- /// Staring point Y coordinate.
- /// End point X coordinate.
- /// End point Y coordinate.
- ///
- ///
- /// - Thrown if color is null.
- /// - Coordinates invalid.
- ///
- ///
- /// Thrown on memory access violation.
- /// Thrown if x1-x2 or y1-y2 equal to Int32.MinValue.
+ /// Draws a line between the given points.
+ ///
+ /// The color to draw the line with.
+ /// The starting point X coordinate.
+ /// The starting point Y coordinate.
+ /// The end point X coordinate.
+ /// The end point Y coordinate.
public virtual void DrawLine(Color color, int x1, int y1, int x2, int y2)
{
- // trim the given line to fit inside the canvas boundries
+ // Trim the given line to fit inside the canvas boundaries
TrimLine(ref x1, ref y1, ref x2, ref y2);
- var dx = x2 - x1 /* the horizontal distance of the line */;
- var dy = y2 - y1 /* the vertical distance of the line */;
+ var dx = x2 - x1; // The horizontal distance of the line
+ var dy = y2 - y1; // The vertical distance of the line
- if (dy == 0) /* The line is horizontal */
+ if (dy == 0) // The line is horizontal
{
DrawHorizontalLine(color, dx, x1, y1);
return;
}
- if (dx == 0) /* the line is vertical */
+ if (dx == 0) // The line is vertical
{
DrawVerticalLine(color, dy, x1, y1);
return;
}
- /* the line is neither horizontal neither vertical, is diagonal then! */
+ // The line is neither horizontal neither vertical - it's diagonal.
DrawDiagonalLine(color, dx, dy, x1, y1);
}
- ///
- /// Draw line.
- /// Not implemented.
- ///
- /// Color to draw with.
- /// Staring point X coordinate.
- /// Staring point Y coordinate.
- /// End point X coordinate.
- /// End point Y coordinate.
- /// Thrown always.
- public void DrawLine(Color color, float x1, float y1, float x2, float y2)
- {
- throw new NotImplementedException();
- }
-
//https://en.wikipedia.org/wiki/Midpoint_circle_algorithm
///
- /// Draw Circle.
+ /// Draws a circle at the given coordinates with the given radius.
///
- /// Color to draw with.
- /// X center coordinate.
- /// Y center coordinate.
- /// Radius.
- /// Thrown if coorinates invalid.
- /// Thrown on memory access violation.
- public virtual void DrawCircle(Color color, int x_center, int y_center, int radius)
+ /// The color to draw with.
+ /// The X center coordinate.
+ /// The Y center coordinate.
+ /// The radius of the circle to draw.
+ public virtual void DrawCircle(Color color, int xCenter, int yCenter, int radius)
{
- ThrowIfCoordNotValid(x_center + radius, y_center);
- ThrowIfCoordNotValid(x_center - radius, y_center);
- ThrowIfCoordNotValid(x_center, y_center + radius);
- ThrowIfCoordNotValid(x_center, y_center - radius);
+ ThrowIfCoordNotValid(xCenter + radius, yCenter);
+ ThrowIfCoordNotValid(xCenter - radius, yCenter);
+ ThrowIfCoordNotValid(xCenter, yCenter + radius);
+ ThrowIfCoordNotValid(xCenter, yCenter - radius);
int x = radius;
int y = 0;
int e = 0;
while (x >= y)
{
- DrawPoint(color, x_center + x, y_center + y);
- DrawPoint(color, x_center + y, y_center + x);
- DrawPoint(color, x_center - y, y_center + x);
- DrawPoint(color, x_center - x, y_center + y);
- DrawPoint(color, x_center - x, y_center - y);
- DrawPoint(color, x_center - y, y_center - x);
- DrawPoint(color, x_center + y, y_center - x);
- DrawPoint(color, x_center + x, y_center - y);
+ DrawPoint(color, xCenter + x, yCenter + y);
+ DrawPoint(color, xCenter + y, yCenter + x);
+ DrawPoint(color, xCenter - y, yCenter + x);
+ DrawPoint(color, xCenter - x, yCenter + y);
+ DrawPoint(color, xCenter - x, yCenter - y);
+ DrawPoint(color, xCenter - y, yCenter - x);
+ DrawPoint(color, xCenter + y, yCenter - x);
+ DrawPoint(color, xCenter + x, yCenter - y);
y++;
if (e <= 0)
{
- e += 2 * y + 1;
+ e += (2 * y) + 1;
}
if (e > 0)
{
x--;
- e -= 2 * x + 1;
+ e -= (2 * x) + 1;
}
}
}
///
- /// Draw Filled Circle.
+ /// Draws a filled circle at the given coordinates with the given radius.
///
- /// Color to draw with.
- /// X center coordinate.
- /// Y center coordinate.
- /// Radius.
- /// Thrown if color is null.
- /// Thrown if coorinates invalid.
- /// Thrown on memory access violation.
+ /// The color to draw with.
+ /// The X center coordinate.
+ /// The Y center coordinate.
+ /// The radius of the circle to draw.
public virtual void DrawFilledCircle(Color color, int x0, int y0, int radius)
{
-
int x = radius;
int y = 0;
int xChange = 1 - (radius << 1);
@@ -381,74 +322,41 @@ public virtual void DrawFilledCircle(Color color, int x0, int y0, int radius)
xChange += 2;
}
}
-
- /*
- for (int y = -radius; y <= radius; y++)
- for (int x = -radius; x <= radius; x++)
- if (x * x + y * y <= radius * radius)
- (origin.x + x, origin.y + y);
-
-
- ThrowIfCoordNotValid(x_center + radius, y_center);
- ThrowIfCoordNotValid(x_center - radius, y_center);
- ThrowIfCoordNotValid(x_center, y_center + radius);
- ThrowIfCoordNotValid(x_center, y_center - radius);
- int x = radius;
- int y = 0;
- int e = 0;
-
- while (x >= y)
- {
- DrawLine(color, x_center - x, y_center + y, x_center + x, y_center + y);
- y++;
- if (e <= 0)
- {
- e += 2 * y + 1;
- }
- if (e > 0)
- {
- x--;
- e -= 2 * x + 1;
- }
- }*/
}
//http://members.chello.at/~easyfilter/bresenham.html
///
- /// Draw ellipse.
- ///
- /// color to draw with.
- /// X center coordinate.
- /// Y center coordinate.
- /// X radius.
- /// Y radius.
- /// Thrown if color is null.
- /// Thrown if coorinates invalid.
- /// Thrown on memory access violation.
- public virtual void DrawEllipse(Color color, int x_center, int y_center, int x_radius, int y_radius)
+ /// Draws an ellipse.
+ ///
+ /// The color to draw with.
+ /// The X center coordinate.
+ /// The Y center coordinate.
+ /// The X radius.
+ /// The Y radius.
+ public virtual void DrawEllipse(Color color, int xCenter, int yCenter, int xR, int yR)
{
- ThrowIfCoordNotValid(x_center + x_radius, y_center);
- ThrowIfCoordNotValid(x_center - x_radius, y_center);
- ThrowIfCoordNotValid(x_center, y_center + y_radius);
- ThrowIfCoordNotValid(x_center, y_center - y_radius);
- int a = 2 * x_radius;
- int b = 2 * y_radius;
+ ThrowIfCoordNotValid(xCenter + xR, yCenter);
+ ThrowIfCoordNotValid(xCenter - xR, yCenter);
+ ThrowIfCoordNotValid(xCenter, yCenter + yR);
+ ThrowIfCoordNotValid(xCenter, yCenter - yR);
+ int a = 2 * xR;
+ int b = 2 * yR;
int b1 = b & 1;
int dx = 4 * (1 - a) * b * b;
int dy = 4 * (b1 + 1) * a * a;
- int err = dx + dy + b1 * a * a;
+ int err = dx + dy + (b1 * a * a);
int e2;
int y = 0;
- int x = x_radius;
+ int x = xR;
a *= 8 * a;
b1 = 8 * b * b;
while (x >= 0)
{
- DrawPoint(color, x_center + x, y_center + y);
- DrawPoint(color, x_center - x, y_center + y);
- DrawPoint(color, x_center - x, y_center - y);
- DrawPoint(color, x_center + x, y_center - y);
+ DrawPoint(color, xCenter + x, yCenter + y);
+ DrawPoint(color, xCenter - x, yCenter + y);
+ DrawPoint(color, xCenter - x, yCenter - y);
+ DrawPoint(color, xCenter + x, yCenter - y);
e2 = 2 * err;
if (e2 <= dy) { y++; err += dy += a; }
if (e2 >= dx || 2 * err > dy) { x--; err += dx += b1; }
@@ -456,24 +364,22 @@ public virtual void DrawEllipse(Color color, int x_center, int y_center, int x_r
}
///
- /// Draw Filled Ellipse.
+ /// Draws a filled ellipse.
///
- /// color to draw with.
- /// Center point.
- /// Height.
- /// Width.
- /// Thrown if color is null.
- /// Thrown if coorinates invalid.
- /// Thrown on memory access violation.
- public virtual void DrawFilledEllipse(Color color, int xx, int yy, int height, int width)
+ /// The color to draw with.
+ /// The X center coordinate.
+ /// The Y center coordinate.
+ /// The X radius.
+ /// The Y radius.
+ public virtual void DrawFilledEllipse(Color color, int xCenter, int yCenter, int yR, int xR)
{
- for (int y = -height; y <= height; y++)
+ for (int y = -yR; y <= yR; y++)
{
- for (int x = -width; x <= width; x++)
+ for (int x = -xR; x <= xR; x++)
{
- if (x * x * height * height + y * y * width * width <= height * height * width * width)
+ if ((x * x * yR * yR) + (y * y * xR * xR) <= yR * yR * xR * xR)
{
- DrawPoint(color, xx + x, yy + y);
+ DrawPoint(color, xCenter + x, yCenter + y);
}
}
}
@@ -482,44 +388,34 @@ public virtual void DrawFilledEllipse(Color color, int xx, int yy, int height, i
///
/// Draws an arc.
///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public virtual void DrawArc(int x, int y, int width, int height, Color color, int StartAngle = 0, int EndAngle = 360)
+ /// The starting X coordinate.
+ /// The ending X coordinate.
+ /// The width of the arc.
+ /// The height of the arc.
+ /// The color of the arc.
+ /// The starting angle of the arc, in degrees.
+ /// The ending angle of the arc, in degrees.
+ public virtual void DrawArc(int x, int y, int width, int height, Color color, int startAngle = 0, int endAngle = 360)
{
if (width == 0 || height == 0)
{
return;
}
- for (double Angle = StartAngle; Angle < EndAngle; Angle += 0.5)
+ for (double angle = startAngle; angle < endAngle; angle += 0.5)
{
- double Angle1 = Math.PI * Angle / 180;
- int IX = (int)(width * Math.Cos(Angle1));
- int IY = (int)(height * Math.Sin(Angle1));
+ double angleRadians = Math.PI * angle / 180;
+ int IX = (int)(width * Math.Cos(angleRadians));
+ int IY = (int)(height * Math.Sin(angleRadians));
DrawPoint(color, x + IX, y + IY);
}
}
///
- /// Draw polygon.
- ///
- /// color to draw with.
- /// Points array.
- /// Thrown if point array is smaller then 3.
- /// Thrown if color is null.
- ///
- ///
- /// - Thrown if color is null.
- /// - Coordinates invalid.
- ///
- ///
- /// Thrown on memory access violation.
- /// Thrown if lines length are invalid.
+ /// Draws a polygon.
+ ///
+ /// The color to draw with.
+ /// The vertices of the polygon.
public virtual void DrawPolygon(Color color, params Point[] points)
{
// Using an array of points here is better than using something like a Dictionary of ints.
@@ -527,55 +423,39 @@ public virtual void DrawPolygon(Color color, params Point[] points)
{
throw new ArgumentException("A polygon requires more than 3 points.");
}
+
for (int i = 0; i < points.Length - 1; i++)
{
var pointA = points[i];
var pointB = points[i + 1];
DrawLine(color, pointA.X, pointA.Y, pointB.X, pointB.Y);
}
+
var firstPoint = points[0];
var lastPoint = points[^1];
DrawLine(color, firstPoint.X, firstPoint.Y, lastPoint.X, lastPoint.Y);
}
///
- /// Draw square.
- ///
- /// color to draw with.
- /// X coordinate.
- /// Y coordinate.
- /// size.
- /// Thrown if color is null.
- ///
- ///
- /// - Thrown if color is null.
- /// - Coordinates invalid.
- ///
- ///
- /// Thrown on memory access violation.
- /// Thrown if lines length are invalid.
+ /// Draws a square.
+ ///
+ /// The color to draw with.
+ /// The X coordinate.
+ /// The Y coordinate.
+ /// The size of the square.
public virtual void DrawSquare(Color color, int x, int y, int size)
{
DrawRectangle(color, x, y, size, size);
}
///
- /// Draw rectangle.
- ///
- /// color to draw with.
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// Height.
- /// Thrown if color is null.
- ///
- ///
- /// - Thrown if color is null.
- /// - Coordinates invalid.
- ///
- ///
- /// Thrown on memory access violation.
- /// Thrown if lines length are invalid.
+ /// Draws a rectangle.
+ ///
+ /// The color to draw with.
+ /// The X coordinate.
+ /// The Y coordinate.
+ /// The width of the rectangle.
+ /// The height of the rectangle.
public virtual void DrawRectangle(Color color, int x, int y, int width, int height)
{
/*
@@ -615,52 +495,36 @@ public virtual void DrawRectangle(Color color, int x, int y, int width, int heig
}
///
- /// Draw filled rectangle.
- ///
- /// color to draw with.
- /// Starting point X coordinate.
- /// Starting point Y coordinate.
- /// Width.
- /// Height.
- ///
- ///
- /// - Thrown if color is null.
- /// - Coordinates invalid.
- ///
- ///
- /// Thrown on memory access violation.
- /// Thrown if lines length are invalid.
- public virtual void DrawFilledRectangle(Color color, int x_start, int y_start, int width, int height)
+ /// Draws a filled rectangle.
+ ///
+ /// The color to draw the rectangle with.
+ /// The starting point X coordinate.
+ /// The starting point Y coordinate.
+ /// The width of the rectangle.
+ /// The height of the rectangle.
+ public virtual void DrawFilledRectangle(Color color, int xStart, int yStart, int width, int height)
{
if (height == -1)
{
height = width;
}
- for (int y = y_start; y < y_start + height; y++)
+ for (int y = yStart; y < yStart + height; y++)
{
- DrawLine(color, x_start, y, x_start + width - 1, y);
+ DrawLine(color, xStart, y, xStart + width - 1, y);
}
}
///
- /// Draw triangle.
- ///
- /// color to draw with.
- /// First point X coordinate.
- /// First point Y coordinate.
- /// Second point X coordinate.
- /// Second point Y coordinate.
- /// Third point X coordinate.
- /// Third point Y coordinate.
- ///
- ///
- /// - Thrown if color is null.
- /// - Coordinates invalid.
- ///
- ///
- /// Thrown on memory access violation.
- /// Thrown if lines lengths are invalid.
+ /// Draws a triangle.
+ ///
+ /// The color to draw with.
+ /// The first points X coordinate.
+ /// The first points Y coordinate.
+ /// The second points X coordinate.
+ /// The second points Y coordinate.
+ /// The third points X coordinate.
+ /// The third points Y coordinate.
public virtual void DrawTriangle(Color color, int v1x, int v1y, int v2x, int v2y, int v3x, int v3y)
{
DrawLine(color, v1x, v1y, v2x, v2y);
@@ -669,196 +533,157 @@ public virtual void DrawTriangle(Color color, int v1x, int v1y, int v2x, int v2y
}
///
- /// Draw rectangle.
- /// Not implemented.
- ///
- /// color to draw with.
- /// starting X coordinate.
- /// starting Y coordinate.
- /// Width.
- /// Height.
- /// Thrown always.
- public virtual void DrawRectangle(Color color, float x_start, float y_start, float width, float height)
- {
- throw new NotImplementedException();
- }
-
- //Image and Font will be available in .NET Core 2.1
- // dot net core does not have Image
- //We are using a short term solution for bitmap
- ///
- /// Draw image.
+ /// Draws the given image at the specified coordinates.
///
- /// Image to draw.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown on memory access violation.
- /// Thrown on fatal error.
+ /// The image to draw.
+ /// The origin X coordinate.
+ /// The origin Y coordinate.
public virtual void DrawImage(Image image, int x, int y)
{
- Color _color;
+ Color color;
- for (int _x = 0; _x < image.Width; _x++)
+ for (int xi = 0; xi < image.Width; xi++)
{
- for (int _y = 0; _y < image.Height; _y++)
+ for (int yi = 0; yi < image.Height; yi++)
{
- Global.mDebugger.SendInternal(image.rawData[_x + _y * image.Width]);
- _color = Color.FromArgb(image.rawData[_x + _y * image.Width]);
- DrawPoint(_color, x + _x, y + _y);
+ color = Color.FromArgb(image.RawData[xi + (yi * image.Width)]);
+ DrawPoint(color, x + xi, y + yi);
}
}
}
- private int[] scaleImage(Image image, int newWidth, int newHeight)
+ static int[] ScaleImage(Image image, int newWidth, int newHeight)
{
- int[] pixels = image.rawData;
+ int[] pixels = image.RawData;
int w1 = (int)image.Width;
int h1 = (int)image.Height;
int[] temp = new int[newWidth * newHeight];
- int x_ratio = (int)((w1 << 16) / newWidth) + 1;
- int y_ratio = (int)((h1 << 16) / newHeight) + 1;
+ int xRatio = (int)((w1 << 16) / newWidth) + 1;
+ int yRatio = (int)((h1 << 16) / newHeight) + 1;
int x2, y2;
+
for (int i = 0; i < newHeight; i++)
{
for (int j = 0; j < newWidth; j++)
{
- x2 = (j * x_ratio) >> 16;
- y2 = (i * y_ratio) >> 16;
- temp[i * newWidth + j] = pixels[y2 * w1 + x2];
+ x2 = (j * xRatio) >> 16;
+ y2 = (i * yRatio) >> 16;
+ temp[(i * newWidth) + j] = pixels[(y2 * w1) + x2];
}
}
+
return temp;
}
+
///
- /// Draw a Scaled Bitmap.
+ /// Draws a bitmap, applying scaling to the given image.
///
- /// Image to Scale.
- /// X coordinate.
- /// Y coordinate.
- /// Desired Width.
- /// Desired Height.
+ /// The image to draw.
+ /// The X coordinate.
+ /// The Y coordinate.
+ /// The desired width to scale the image to before drawing.
+ /// The desired height to scale the image to before drawing
public virtual void DrawImage(Image image, int x, int y, int w, int h)
{
- Color _color = Color.White;
+ Color color;
- int[] pixels = scaleImage(image, w, h);
- for (int _x = 0; _x < w; _x++)
+ int[] pixels = ScaleImage(image, w, h);
+ for (int xi = 0; xi < w; xi++)
{
- for (int _y = 0; _y < h; _y++)
+ for (int yi = 0; yi < h; yi++)
{
- Global.mDebugger.SendInternal(pixels[_x + _y * w]);
- _color = Color.FromArgb(pixels[_x + _y * w]);
- DrawPoint(_color, x + _x, y + _y);
+ color = Color.FromArgb(pixels[xi + (yi * w)]);
+ DrawPoint(color, x + xi, y + yi);
}
}
}
///
- /// Draw image with alpha channel.
+ /// Draws an image with alpha blending.
///
- /// Image to draw.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown on memory access violation.
- /// Thrown on fatal error.
+ /// The image to draw.
+ /// The X coordinate.
+ /// The Y coordinate.
public void DrawImageAlpha(Image image, int x, int y)
{
- Color _color;
+ Color color;
- for (int _x = 0; _x < image.Width; _x++)
+ for (int xi = 0; xi < image.Width; xi++)
{
- for (int _y = 0; _y < image.Height; _y++)
+ for (int yi = 0; yi < image.Height; yi++)
{
- Global.mDebugger.SendInternal(image.rawData[_x + _y * image.Width]);
- _color = Color.FromArgb(image.rawData[_x + _y * image.Width]);
- DrawPoint(_color, x + _x, y + _y);
+ color = Color.FromArgb(image.RawData[xi + (yi * image.Width)]);
+ DrawPoint(color, x + xi, y + yi);
}
}
}
///
- /// Draw string.
+ /// Draws a string using the given bitmap font.
///
- /// string to draw.
- /// Font used.
- /// Color.
- /// X coordinate.
- /// Y coordinate.
- public virtual void DrawString(string str, Font aFont, Color color, int x, int y)
+ /// The string to draw.
+ /// The bitmap font to use.
+ /// The color to write the string with.
+ /// The origin X coordinate.
+ /// The origin Y coordinate.
+ public virtual void DrawString(string str, Font font, Color color, int x, int y)
{
- for (int i = 0; i < str.Length; i++)
+ var len = str.Length;
+ var width = font.Width;
+
+ for (int i = 0; i < len; i++)
{
- DrawChar(str[i], aFont, color, x, y);
- x += aFont.Width;
+ DrawChar(str[i], font, color, x, y);
+ x += width;
}
}
///
- /// Draw char.
+ /// Draws a single character using the given bitmap font.
///
- /// char to draw.
- /// Font used.
- /// Color.
- /// X coordinate.
- /// Y coordinate.
- public virtual void DrawChar(char c, Font aFont, Color color, int x, int y)
+ /// The character to draw.
+ ///
+ public virtual void DrawChar(char c, Font font, Color color, int x, int y)
{
- int p = aFont.Height * (byte)c;
+ var height = font.Height;
+ var width = font.Width;
+ var data = font.Data;
+ int p = height * (byte)c;
- for (int cy = 0; cy < aFont.Height; cy++)
+ for (int cy = 0; cy < height; cy++)
{
- for (byte cx = 0; cx < aFont.Width; cx++)
+ for (byte cx = 0; cx < width; cx++)
{
- if (aFont.ConvertByteToBitAddres(aFont.Data[p + cy], cx + 1))
+ if (font.ConvertByteToBitAddress(data[p + cy], cx + 1))
{
- DrawPoint(color, (ushort)(x + (aFont.Width - cx)), (ushort)(y + cy));
+ DrawPoint(color, (ushort)(x + cx), (ushort)(y + cy));
}
}
}
}
///
- /// Check if video mode is valid.
+ /// Checks if the given video mode is valid.
///
- /// Video mode.
- /// bool value.
+ /// The target video mode.
protected bool CheckIfModeIsValid(Mode mode)
{
- Global.mDebugger.SendInternal($"CheckIfModeIsValid");
-
- /* To keep or not to keep, that is the question~
- if (mode == null)
- {
- return false;
- }
- */
-
- /* This would have been the more "modern" version but LINQ is not working
-
- if (!availableModes.Exists(element => element == mode))
- return true;
-
- */
-
foreach (var elem in AvailableModes)
{
- Global.mDebugger.SendInternal($"elem is {elem} mode is {mode}");
if (elem == mode)
{
- Global.mDebugger.SendInternal($"Mode {mode} found");
return true; // All OK mode does exists in availableModes
}
}
- Global.mDebugger.SendInternal($"Mode {mode} found");
return false;
}
///
- /// Check if video mode is valid. Throw exception if not.
+ /// Validates the given video mode, and throws an exception if the
+ /// given value is invalid.
///
- /// Video mode.
- /// Thrown if mode is not suppoted.
+ /// Thrown if the mode is not supported.
protected void ThrowIfModeIsNotValid(Mode mode)
{
if (CheckIfModeIsValid(mode))
@@ -866,136 +691,129 @@ protected void ThrowIfModeIsNotValid(Mode mode)
return;
}
- Global.mDebugger.SendInternal($"Mode {mode} is not found! Raising exception...");
- /* 'mode' was not in the 'availableModes' List ==> 'mode' in NOT Valid */
- throw new ArgumentOutOfRangeException(nameof(mode), $"Mode {mode} is not supported by this Driver");
+ throw new ArgumentOutOfRangeException(nameof(mode), $"Mode {mode} is not supported by this driver");
}
///
- /// Check if coordinats are valid. Throw exception if not.
+ /// Validates that the given coordinates are in-range of the canvas, and
+ /// throws an exception if the coordinates are out-of-bounds.
///
- /// X coordinate.
- /// Y coordinate.
- /// Thrown if coordinates are invalid.
+ /// The X coordinate.
+ /// The Y coordinate.
+ /// Thrown if the coordinates are invalid.
protected void ThrowIfCoordNotValid(int x, int y)
{
if (x < 0 || x >= Mode.Width)
{
- throw new ArgumentOutOfRangeException(nameof(x), $"x ({x}) is not between 0 and {Mode.Width}");
+ throw new ArgumentOutOfRangeException(nameof(x), $"X coordinate ({x}) is not between 0 and {Mode.Width}");
}
if (y < 0 || y >= Mode.Height)
{
- throw new ArgumentOutOfRangeException(nameof(y), $"y ({y}) is not between 0 and {Mode.Height}");
+ throw new ArgumentOutOfRangeException(nameof(y), $"Y coordinate ({y}) is not between 0 and {Mode.Height}");
}
}
- ///
- /// TrimLine
- ///
- /// X coordinate.
- /// Y coordinate.
- /// X coordinate.
- /// Y coordinate.
protected void TrimLine(ref int x1, ref int y1, ref int x2, ref int y2)
{
// in case of vertical lines, no need to perform complex operations
if (x1 == x2)
{
- x1 = Math.Min(Mode.Width - 1, Math.Max(0, x1));
+ x1 = Math.Min((int)Mode.Width - 1, Math.Max(0, x1));
x2 = x1;
- y1 = Math.Min(Mode.Height - 1, Math.Max(0, y1));
- y2 = Math.Min(Mode.Height - 1, Math.Max(0, y2));
+ y1 = Math.Min((int)Mode.Height - 1, Math.Max(0, y1));
+ y2 = Math.Min((int)Mode.Height - 1, Math.Max(0, y2));
return;
}
// never attempt to remove this part,
// if we didn't calculate our new values as floats, we would end up with inaccurate output
- float x1_out = x1, y1_out = y1;
- float x2_out = x2, y2_out = y2;
+ float x1Out = x1, y1Out = y1;
+ float x2Out = x2, y2Out = y2;
// calculate the line slope, and the entercepted part of the y axis
- float m = (y2_out - y1_out) / (x2_out - x1_out);
- float c = y1_out - m * x1_out;
+ float m = (y2Out - y1Out) / (x2Out - x1Out);
+ float c = y1Out - (m * x1Out);
// handle x1
- if (x1_out < 0)
+ if (x1Out < 0)
{
- x1_out = 0;
- y1_out = c;
+ x1Out = 0;
+ y1Out = c;
}
- else if (x1_out >= Mode.Width)
+ else if (x1Out >= Mode.Width)
{
- x1_out = Mode.Width - 1;
- y1_out = (Mode.Width - 1) * m + c;
+ x1Out = Mode.Width - 1;
+ y1Out = ((Mode.Width - 1) * m) + c;
}
// handle x2
- if (x2_out < 0)
+ if (x2Out < 0)
{
- x2_out = 0;
- y2_out = c;
+ x2Out = 0;
+ y2Out = c;
}
- else if (x2_out >= Mode.Width)
+ else if (x2Out >= Mode.Width)
{
- x2_out = Mode.Width - 1;
- y2_out = (Mode.Width - 1) * m + c;
+ x2Out = Mode.Width - 1;
+ y2Out = ((Mode.Width - 1) * m) + c;
}
// handle y1
- if (y1_out < 0)
+ if (y1Out < 0)
{
- x1_out = -c / m;
- y1_out = 0;
+ x1Out = -c / m;
+ y1Out = 0;
}
- else if (y1_out >= Mode.Height)
+ else if (y1Out >= Mode.Height)
{
- x1_out = (Mode.Height - 1 - c) / m;
- y1_out = Mode.Height - 1;
+ x1Out = (Mode.Height - 1 - c) / m;
+ y1Out = Mode.Height - 1;
}
// handle y2
- if (y2_out < 0)
+ if (y2Out < 0)
{
- x2_out = -c / m;
- y2_out = 0;
+ x2Out = -c / m;
+ y2Out = 0;
}
- else if (y2_out >= Mode.Height)
+ else if (y2Out >= Mode.Height)
{
- x2_out = (Mode.Height - 1 - c) / m;
- y2_out = Mode.Height - 1;
+ x2Out = (Mode.Height - 1 - c) / m;
+ y2Out = Mode.Height - 1;
}
// final check, to avoid lines that are totally outside bounds
- if (x1_out < 0 || x1_out >= Mode.Width || y1_out < 0 || y1_out >= Mode.Height)
+ if (x1Out < 0 || x1Out >= Mode.Width || y1Out < 0 || y1Out >= Mode.Height)
{
- x1_out = 0; x2_out = 0;
- y1_out = 0; y2_out = 0;
+ x1Out = 0; x2Out = 0;
+ y1Out = 0; y2Out = 0;
}
- if (x2_out < 0 || x2_out >= Mode.Width || y2_out < 0 || y2_out >= Mode.Height)
+ if (x2Out < 0 || x2Out >= Mode.Width || y2Out < 0 || y2Out >= Mode.Height)
{
- x1_out = 0; x2_out = 0;
- y1_out = 0; y2_out = 0;
+ x1Out = 0; x2Out = 0;
+ y1Out = 0; y2Out = 0;
}
// replace inputs with new values
- x1 = (int)x1_out; y1 = (int)y1_out;
- x2 = (int)x2_out; y2 = (int)y2_out;
+ x1 = (int)x1Out; y1 = (int)y1Out;
+ x2 = (int)x2Out; y2 = (int)y2Out;
}
///
- /// Calculate new Color from back Color with alpha
+ /// Blends between color and ,
+ /// using the given value.
///
- /// Color to calculate.
- /// Color used to calculate.
- /// Alpha amount.
- public Color AlphaBlend(Color to, Color from, byte alpha)
+ /// The background color.
+ /// The foreground color.
+ /// The alpha value.
+ public static Color AlphaBlend(Color to, Color from, byte alpha)
{
- byte R = (byte)((to.R * alpha + from.R * (255 - alpha)) >> 8);
- byte G = (byte)((to.G * alpha + from.G * (255 - alpha)) >> 8);
- byte B = (byte)((to.B * alpha + from.B * (255 - alpha)) >> 8);
+ byte R = (byte)(((to.R * alpha) + (from.R * (255 - alpha))) >> 8);
+ byte G = (byte)(((to.G * alpha) + (from.G * (255 - alpha))) >> 8);
+ byte B = (byte)(((to.B * alpha) + (from.B * (255 - alpha))) >> 8);
return Color.FromArgb(R, G, B);
}
}
diff --git a/source/Cosmos.System2/Graphics/ColorDepth.cs b/source/Cosmos.System2/Graphics/ColorDepth.cs
index 0ff341ccf9..31bd17acac 100644
--- a/source/Cosmos.System2/Graphics/ColorDepth.cs
+++ b/source/Cosmos.System2/Graphics/ColorDepth.cs
@@ -7,40 +7,33 @@
namespace Cosmos.System.Graphics
{
///
- /// Color depth. Available:
- ///
- /// - ColorDepth4 - EGA 16 colors
- /// - ColorDepth8 - VGA 256 colors
- /// - ColorDepth16 - 65535 colors
- /// - ColorDepth24 - 16,777,216 of colors
- /// - ColorDepth32 - 16,777,216 of colors (with transparency)
- ///
+ /// Represents the color depth of the pixels of a graphics surface.
///
public enum ColorDepth
{
///
- /// EGA 16 colors.
+ /// 4 bits per pixel; 16 colors.
///
- ColorDepth4 = 4, /* EGA 16 colors */
+ ColorDepth4 = 4,
///
- /// VGA 256 colors.
+ /// 8 bits per pixel; 256 colors.
///
ColorDepth8 = 8, /* VGA 256 colors */
///
- /// 65535 colors.
+ /// 16 bits per pixel; 65535 colors.
///
- ColorDepth16 = 16, /* 65535 colors */
+ ColorDepth16 = 16,
///
- /// 16,777,216 of colors.
+ /// 24 bits per pixel; 16,777,216 colors.
///
- ColorDepth24 = 24, /* 16,777,216 of colors */
+ ColorDepth24 = 24,
///
- /// 16,777,216 of colors (with transparency).
+ /// 32 bits per pixel; 16,777,216 of colors with transparency (alpha values).
///
- ColorDepth32 = 32 /* 16,777,216 of colors (with transparency). Use this when in doubt :-) */
+ ColorDepth32 = 32
}
}
diff --git a/source/Cosmos.System2/Graphics/ColorOrder.cs b/source/Cosmos.System2/Graphics/ColorOrder.cs
index c42593728e..b00874a0fb 100644
--- a/source/Cosmos.System2/Graphics/ColorOrder.cs
+++ b/source/Cosmos.System2/Graphics/ColorOrder.cs
@@ -1,10 +1,18 @@
namespace Cosmos.System.Graphics
{
///
- /// Describes the order in which the colors are stored in each pixel of an image
+ /// Describes the order in which the colors are stored in each pixel of an image.
///
public enum ColorOrder
{
- RGB, BGR
+ ///
+ /// The color order is as follows: Red, Green, Blue.
+ ///
+ RGB,
+
+ ///
+ /// The color order is as follows: Blue, Green, Red.
+ ///
+ BGR
}
}
diff --git a/source/Cosmos.System2/Graphics/Fonts/Font.cs b/source/Cosmos.System2/Graphics/Fonts/Font.cs
index fb57da31c0..40c6d7eac7 100644
--- a/source/Cosmos.System2/Graphics/Fonts/Font.cs
+++ b/source/Cosmos.System2/Graphics/Fonts/Font.cs
@@ -1,45 +1,51 @@
using System;
using System.Collections.Generic;
+using System.Runtime.CompilerServices;
using System.Text;
namespace Cosmos.System.Graphics.Fonts
{
///
- /// Base class for fonts.
+ /// Represents a bitmap font.
///
public abstract class Font
{
///
- /// Get font pure data.
+ /// Gets the raw pixel data of the bitmap font.
///
public byte[] Data { get; }
///
- /// Get font height.
+ /// The height of a single character in pixels.
///
public byte Height { get; }
///
- /// Get font Width.
+ /// The width of a single character in pixels.
///
public byte Width { get; }
///
- /// Used to draw font.
+ /// Converts a byte to its byte address.
///
- /// byteToConvert
- /// bitToReturn
- public bool ConvertByteToBitAddres(byte byteToConvert, int bitToReturn)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public bool ConvertByteToBitAddress(byte byteToConvert, int bitToReturn)
{
- int mask = 1 << (bitToReturn - 1);
+ int mask = 1 << (8 - bitToReturn);
return (byteToConvert & mask) != 0;
}
- public Font(byte aWidth, byte aHeight, byte[] aData)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The width of a single character in pixels
+ /// The height of a single character in pixels
+ /// The raw pixel data.
+ public Font(byte width, byte height, byte[] data)
{
- Width = aWidth;
- Height = aHeight;
- Data = aData;
+ Width = width;
+ Height = height;
+ Data = data;
}
}
}
diff --git a/source/Cosmos.System2/Graphics/Fonts/PCScreenFont.cs b/source/Cosmos.System2/Graphics/Fonts/PCScreenFont.cs
index 069ea4bc34..9e4a782b4d 100644
--- a/source/Cosmos.System2/Graphics/Fonts/PCScreenFont.cs
+++ b/source/Cosmos.System2/Graphics/Fonts/PCScreenFont.cs
@@ -4,17 +4,21 @@
namespace Cosmos.System.Graphics.Fonts
{
+ ///
+ /// Represents a font in the PC Screen Font (PCF) format.
+ ///
public class PCScreenFont : Font
{
+ readonly List unicodeMappings; // Maps the fonts to the corresponding unicode characters
#region DefaultFontData
- //Credit to fcambus https://github.com/fcambus/spleen under BSD-2 License
+ // Credit to fcambus https://github.com/fcambus/spleen under BSD-2 License
//
- //Copyright (c) 2018-2020, Frederic Cambus
- //All rights reserved.
+ // Copyright (c) 2018-2020, Frederic Cambus
+ // All rights reserved.
- //Redistribution and use in source and binary forms, with or without
- //modification, are permitted provided that the following conditions are met:
+ // Redistribution and use in source and binary forms, with or without
+ // modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
@@ -23,44 +27,45 @@ public class PCScreenFont : Font
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
- //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- //AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- //IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- //ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
- //BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- //CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- //SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- //INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- //CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- //ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- //POSSIBILITY OF SUCH DAMAGE.
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ // POSSIBILITY OF SUCH DAMAGE.
static PCScreenFont _Default = null;
-
- public static PCScreenFont Default { get {
-
- if(_Default == null)
+ public static PCScreenFont Default
+ {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oUC4V5xbd0EeW6QUoxHAA4JKDrVExtBgSIlJDpYx7qR72dAEZIDQZZps1KN34cVXb5BIy/5aRJ5s2BJiYsqbJvUPIkvcQtRP16XRzFGYR0KQQoM4cWIcmOIi/DAWoxENsFExx9cMrfVqZjNGOQpzGuU/gMyNxQQoXC1tjwTAM" +
- "KRSshOrdJLg1yKrhAauURGUsfdrBcOEwHiUQwTSOAiniMZiJsldA/eLHbQlXhnhhod3xINcXu2Ny0rahC55PLsvF2yrtim9vsNaqDI00XCJOl0WgT5lWaBLVM6WVftM1nyJlhDiG6hu8q+sxomTAnOUmIn7FM4pYIvgEMHjzKuB2Eh5oJG/U2UwAD+L0xSGSZaM0v1yOA9J18W2szttu2ESjcalC104DzkVeKUjiSCVtuYX5ws+UQXtzjn2d2u5mEGlQCxi14BgMHYXIe/6/X7IJxs4m0ebagyG1giOo8W6NeZagr5W8br84fNR1dvSdEJ7FmaStMsw6kocGEkHopjjSNqL9KGcJmapAD//6YA//+oAP//qQD//64A//+vAMkC//+zAP//IiDPJf//tAD//7gA//+5AP//vgD//8AA///BAP//wgD//8MA///IAP//ygD//8sAAQT//8wA//+2AP//pwD//80A///OAP//zwAHBP//0AAQAf//0gD//9MA///UAP//1QD//9cA///YAP//IACgAAAgASACIAMgBCAFIAYgByAIIAkgCiAvIP//IQD//yIA//8jAP//JAD//yUAlSL//yYA//8nAP//KAD//ykA//8qAJsi//8rAP//LAD//y0AEiATIBIirQAQIBEgliL//y4AmSL//y8AmCL//zAA6iT//zEAYCT//zIAYST//zMAYiT//zQAYyT//zUAZCT//zYAZST//zcAZiT//zgAZyT//zkAaCT//zoA//87AP//PAD//z0AnCL//z4A//8/AP//QAD//0EAEASRA7Yk//9CABIEkgO3JP//QwAhBLgk//9EALkk//9FABUElQO6JP//RgC7JP//RwC8JP//SAAdBJcDvST//0kABgSZA74k//9KAAgEvyT//0sAGgSaAyohwCT//0wAwST//00AHAScA8Ik//9OAJ0DwyT//0" +
- "8AHgSfA8Qk//9QACAEoQPFJP//UQDGJP//UgDHJP//UwAFBMgk//9UACIEpAPJJP//VQDKJP//VgDLJP//VwDMJP//WAAlBKcDzST//1kArgTOJP//WgCWA88k//9bAP//XAD//10A//9eAP//XwD//2AA//9hADAE0CT//2IA0ST//2MAQQTSJP//ZADTJP//ZQA1BNQk//9mANUk//9nANYk//9oANck//9pAFYE2CT//2oAWATZJP//awDaJP//bADbJP//bQDcJP//bgDdJP//bwA+BN4k//9wAEAE3yT//3EA4CT//3IA4ST//3MAVQRzAOIk//90AOMk//91AOQk//92AOUk//93AOYk//94AEUE5yT//3kAQwToJP//egDpJP//ewD//3wA//99AP//fgD//9kA///HAP///AD//+kA///iAP//5AD//+AA///lAP//5wD//+oA///rAFEE///oAP//7wBXBP//7gD//+wA///EAP//xQArIf//yQD//+YA///GAP//9AD///YA///yAP//+wD///kA////AP//1gD//9wA//+iAP//owD//6UA///aAP//2wD//+EA///tAP//8wD///oA///xAP//0QD//6oA//+6AP//vwD//90A//+sAP//vQD//7wA//+hAP//qwBqIv//uwBrIv//kSX//5Il//+TJf//AiUDJX8lfSV7JXcleSV1Jf//JCUrJSolKSUoJSclJiUlJf//YSX//2Il//9WJf//VSX//2Ml//9RJf//VyX//10l//9cJf//WyX//xAlEyUSJREl//8UJRclFiUVJf//NCU7JTolOSU4JTclNiU1Jf//LCUzJTIlMSUwJS8lLiUtJf//HCUjJSIlISUgJR8lHiUdJf//ACUBJX4lfCV6JXYleCV0Jf//PCVLJUolSSVIJUclRiVFJUQlQyVCJUElQCU/JT4" +
- "lPSX//14l//9fJf//WiX//1Ql//9pJf//ZiX//2Al//9QJf//bCX//2cl//9oJf//ZCX//2Ul//9ZJf//WCX//1Il//9TJf//ayX//2ol//8YJRslGiUZJf//DCUPJQ4lDSX//4gl//+EJf//jCX//5Al//+AJf//3gD//98A///jAP//8AD///UA///4AP//tQC8A////QD///4A//8AAf//AQH//wIB0AT//wMB0QT//wQB//8FAf//BgH//wcB//+xAP//CAH//wkB//8KAf//CwH///cA//8MAf//sAD//w0B//+3AP//DgH//w8B//+yAP//EQH//xIB//8TAf//FgH//xcB//8YAf//GQH//xoB//8bAf//HAH//x0B//8eAf//HwH//yAB//8hAf//IgH//yMB//8kAf//JQH//yYB//8nAf//KAH//ykB//8qAf//KwH//y4B//8vAf//MAH//zEB//80Af//NQH//zYB//83Af//OAH//zkB//86Af//OwH//zwB//89Af//PgH//0EB//9CAf//QwH//0QB//9FAf//RgH//0cB//9IAf//SgH//0sB//9MAf//TQH//1AB//9RAf//UgH//1MB//9UAf//VQH//1YB//9XAf//WAH//1kB//9aAf//WwH//1wB//9dAf//XgH//18B//9gAf//YQH//2IB//9jAf//ZAH//2UB//9mAf//ZwH//2gB//9pAf//agH//2sB//9sAf//bQH//24B//9vAf//cAH//3EB//9yAf//cwH//3gB//95Af//egH//3sB//98Af//fQH//34B//8YIP//GSD//xwg//8dIP//rCD//yYg/////////////////////////////////////////////////////////////////////////////////////////////////////////" +
- "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////w=="));
- }
-
- return _Default;
+ if(_Default == null)
+ {
+ _Default = LoadFont(Convert.FromBase64String("NgQDEAAAAAAAZjxmZmY8ZgAAAAAAABgYGBgYAAAYGBgYGAAAAABsbAAAAAAAAAAAAAAAAAAAAHyCmqKiopqCfAAAAAAAAAB8grqqsqqqgnwAAAAAAHwAAAAAAAAAAAAAAAAAAAAcJgwGJhwAAAAAAAAAAAAAAAAAAAAYPDwYAAAAAAAAAAwYMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYMAAAGDgYGBg8AAAAAAAAAAAAAGCQIBKWbBgwcNSUHgQEADAYAHzGxsb+xsbGxgAAAAAYMAB8xsbG/sbGxsYAAAAAOGwAfMbGxv7GxsbGAAAAADJMAHzGxsb+xsbGxgAAAAAwGAB+wMDA+MDAwH4AAAAAOGwAfsDAwPjAwMB+AAAAAGxsAH7AwMD4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xi14BgMHYXIe/6/X7IJxs4m0ebagyG1giOo8W6NeZagr5W8br84fNR1dvSdEJ7FmaStMsw6kocGEkHopjjSNqL9KGcJmapAD//6YA//+oAP//qQD//64A//+vAMkC//+zAP//IiDPJf//tAD//7gA//+5AP//vgD//8AA///BAP//wgD//8MA///IAP//ygD//8sAAQT//8wA//+2AP//pwD//80A///OAP//zwAHBP//0AAQAf//0gD//9MA///UAP//1QD//9cA///YAP//IACgAAAgASACIAMgBCAFIAYgByAIIAkgCiAvIP//IQD//yIA//8jAP//JAD//yUAlSL//yYA//8nAP//KAD//ykA//8qAJsi//8rAP//LAD//y0AEiATIBIirQAQIBEgliL//y4AmSL//y8AmCL//zAA6iT//zEAYCT//zIAYST//zMAYiT//zQAYyT//zUAZCT//zYAZST//zcAZiT//zgAZyT//zkAaCT//zoA//87AP//PAD//z0AnCL//z4A//8/AP//QAD//0EAEASRA7Yk//9CABIEkgO3JP//QwAhBLgk//9EALkk//9FABUElQO6JP//RgC7JP//RwC8JP//SAAdBJcDvST//0kABgSZA74k//9KAAgEvyT//0sAGgSaAyohwCT//0wAwST//00AHAScA8Ik//9OAJ0DwyT//0" +
+ "8AHgSfA8Qk//9QACAEoQPFJP//UQDGJP//UgDHJP//UwAFBMgk//9UACIEpAPJJP//VQDKJP//VgDLJP//VwDMJP//WAAlBKcDzST//1kArgTOJP//WgCWA88k//9bAP//XAD//10A//9eAP//XwD//2AA//9hADAE0CT//2IA0ST//2MAQQTSJP//ZADTJP//ZQA1BNQk//9mANUk//9nANYk//9oANck//9pAFYE2CT//2oAWATZJP//awDaJP//bADbJP//bQDcJP//bgDdJP//bwA+BN4k//9wAEAE3yT//3EA4CT//3IA4ST//3MAVQRzAOIk//90AOMk//91AOQk//92AOUk//93AOYk//94AEUE5yT//3kAQwToJP//egDpJP//ewD//3wA//99AP//fgD//9kA///HAP///AD//+kA///iAP//5AD//+AA///lAP//5wD//+oA///rAFEE///oAP//7wBXBP//7gD//+wA///EAP//xQArIf//yQD//+YA///GAP//9AD///YA///yAP//+wD///kA////AP//1gD//9wA//+iAP//owD//6UA///aAP//2wD//+EA///tAP//8wD///oA///xAP//0QD//6oA//+6AP//vwD//90A//+sAP//vQD//7wA//+hAP//qwBqIv//uwBrIv//kSX//5Il//+TJf//AiUDJX8lfSV7JXcleSV1Jf//JCUrJSolKSUoJSclJiUlJf//YSX//2Il//9WJf//VSX//2Ml//9RJf//VyX//10l//9cJf//WyX//xAlEyUSJREl//8UJRclFiUVJf//NCU7JTolOSU4JTclNiU1Jf//LCUzJTIlMSUwJS8lLiUtJf//HCUjJSIlISUgJR8lHiUdJf//ACUBJX4lfCV6JXYleCV0Jf//PCVLJUolSSVIJUclRiVFJUQlQyVCJUElQCU/JT4" +
+ "lPSX//14l//9fJf//WiX//1Ql//9pJf//ZiX//2Al//9QJf//bCX//2cl//9oJf//ZCX//2Ul//9ZJf//WCX//1Il//9TJf//ayX//2ol//8YJRslGiUZJf//DCUPJQ4lDSX//4gl//+EJf//jCX//5Al//+AJf//3gD//98A///jAP//8AD///UA///4AP//tQC8A////QD///4A//8AAf//AQH//wIB0AT//wMB0QT//wQB//8FAf//BgH//wcB//+xAP//CAH//wkB//8KAf//CwH///cA//8MAf//sAD//w0B//+3AP//DgH//w8B//+yAP//EQH//xIB//8TAf//FgH//xcB//8YAf//GQH//xoB//8bAf//HAH//x0B//8eAf//HwH//yAB//8hAf//IgH//yMB//8kAf//JQH//yYB//8nAf//KAH//ykB//8qAf//KwH//y4B//8vAf//MAH//zEB//80Af//NQH//zYB//83Af//OAH//zkB//86Af//OwH//zwB//89Af//PgH//0EB//9CAf//QwH//0QB//9FAf//RgH//0cB//9IAf//SgH//0sB//9MAf//TQH//1AB//9RAf//UgH//1MB//9UAf//VQH//1YB//9XAf//WAH//1kB//9aAf//WwH//1wB//9dAf//XgH//18B//9gAf//YQH//2IB//9jAf//ZAH//2UB//9mAf//ZwH//2gB//9pAf//agH//2sB//9sAf//bQH//24B//9vAf//cAH//3EB//9yAf//cwH//3gB//95Af//egH//3sB//98Af//fQH//34B//8YIP//GSD//xwg//8dIP//rCD//yYg/////////////////////////////////////////////////////////////////////////////////////////////////////////" +
+ "////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////w=="));
+ }
- } }
+ return _Default;
+ }
+ }
#endregion
enum PSFVersion1Mode
@@ -71,57 +76,74 @@ enum PSFVersion1Mode
MAXMODE = 5
}
- private readonly List _UnicodeMappings; // Maps the fonts to the corresponding unicode characters
-
- public PCScreenFont(byte aWidth, byte aHeight, byte[] aData, List aUnicodeMappings) : base(aWidth, aHeight, aData)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The width of a single character in pixels
+ /// The height of a single character in pixels
+ /// The PCF data.
+ /// The mappings of Unicode characters to font indexes.
+ public PCScreenFont(byte width, byte height, byte[] data, List unicodeMappings) : base(width, height, data)
{
- _UnicodeMappings = aUnicodeMappings;
+ this.unicodeMappings = unicodeMappings;
}
- public static PCScreenFont LoadFont(byte[] aFontData)
+ ///
+ /// Loads the given PC Screen Font using the given raw data array.
+ ///
+ /// The raw PCF data.
+ ///
+ /// Thrown when a PCF version 2 file is provided.
+ /// Thrown when the provided font data is incorrect.
+ /// Thrown when is .
+ public static PCScreenFont LoadFont(byte[] fontData)
{
- byte CharHeight;
- byte CharWidth;
- byte[] FontData;
- var UnicodeMappings = new List();
-
- bool version1 = aFontData[0] == 0x36 && aFontData[1] == 0x04;
- bool version2 = BitConverter.ToUInt32(aFontData, 0) == 0x864ab572;
- //Check the header
+ byte charHeight;
+ byte charWidth;
+ byte[] parsedFontData;
+ var mappings = new List();
+
+ bool version1 = fontData[0] == 0x36 && fontData[1] == 0x04;
+ bool version2 = BitConverter.ToUInt32(fontData, 0) == 0x864ab572;
+
+ // Check the header
if (!version1 && !version2)
{
- Global.mDebugger.Send($"Invalid magic {aFontData[0]} {aFontData[1]} {aFontData[2]} {aFontData[3]}");
- throw new Exception($"Invalid magic {aFontData[0]} {aFontData[1]} {aFontData[2]} {aFontData[3]}");
+ Global.Debugger.Send($"PCF load error: Invalid magic {fontData[0]} {fontData[1]} {fontData[2]} {fontData[3]}");
+ throw new Exception($"Invalid magic value {fontData[0]} {fontData[1]} {fontData[2]} {fontData[3]}.");
}
+
if (version1)
{
- byte mode = aFontData[2];
- CharHeight = aFontData[3];
- CharWidth = 8; //Always 8 in this case
+ byte mode = fontData[2];
+ charHeight = fontData[3];
+ charWidth = 8; //Always 8 in this case
int length = (mode & (int)PSFVersion1Mode.MODE512) == 1 ? 512 : 256;
bool hasUnicodeTable = (mode & (int)PSFVersion1Mode.HASTAB) > 0;
ushort seperator = 0xFFFF;
ushort sequenceStart = 0xFFFE;
- FontData = new byte[length * CharHeight]; //Every row is one byte
+ parsedFontData = new byte[length * charHeight]; //Every row is one byte
+
for (int i = 0; i < length; i++)
{
- for (int k = 0; k < CharHeight; k++)
+ for (int k = 0; k < charHeight; k++)
{
- FontData[i * CharHeight + k] = aFontData[4 + i * CharHeight + k];
+ parsedFontData[(i * charHeight) + k] = fontData[4 + (i * charHeight) + k];
}
}
- int position = 4 + length * CharHeight;
+
+ int position = 4 + (length * charHeight);
if (hasUnicodeTable)
{
- UnicodeMappings = new List();
+ mappings = new List();
var currentEntry = new List();
- while (position < aFontData.Length)
+ while (position < fontData.Length)
{
- if (BitConverter.ToUInt16(aFontData, position) == seperator)
+ if (BitConverter.ToUInt16(fontData, position) == seperator)
{
var mapping = new UnicodeMapping
{
- FontPosition = UnicodeMappings.Count,
+ FontPosition = mappings.Count,
UnicodeCharacters = new List(),
UnicodeCharactersWithModifiers = new List(),
ASCIICharacters = new List()
@@ -130,7 +152,8 @@ public static PCScreenFont LoadFont(byte[] aFontData)
{
mapping.UnicodeCharacters.Add(BitConverter.ToUInt16(currentEntry.ToArray(), i * 2));
}
- //At this point we filter combined unicode letters out of the unicode charactesr
+
+ // At this point we filter combined unicode letters out of the unicode charactesr
bool reachedFirstSeperator = false;
var unicodeCombination = new List();
int index = 0;
@@ -139,106 +162,124 @@ public static PCScreenFont LoadFont(byte[] aFontData)
if (mapping.UnicodeCharacters[index] == sequenceStart)
{
mapping.UnicodeCharacters.RemoveAt(index);
- if (!reachedFirstSeperator)
- {
+ if (!reachedFirstSeperator) {
reachedFirstSeperator = true;
}
- else
- {
+ else {
mapping.UnicodeCharactersWithModifiers.Add(unicodeCombination.ToArray());
}
}
else
{
- if (reachedFirstSeperator)
- {
+ if (reachedFirstSeperator) {
unicodeCombination.Add(mapping.UnicodeCharacters[index]);
mapping.UnicodeCharacters.RemoveAt(index);
}
- else
- {
+ else {
index++;
}
}
}
+
// Now convert all the unicode characters we can to ASCII
foreach (var uc in mapping.UnicodeCharacters)
{
byte ac = Encoding.ASCII.GetBytes(Encoding.Unicode.GetString(BitConverter.GetBytes(uc)))[0];
- if (ac == 63 && uc != 0x003F)
- {
- //ignore
- }
- else
+ if (!(ac == 63 && uc != 0x003F))
{
- if (!mapping.ASCIICharacters.Contains(ac))
- {
+ if (!mapping.ASCIICharacters.Contains(ac)) {
mapping.ASCIICharacters.Add(ac);
}
}
}
- UnicodeMappings.Add(mapping);
+ mappings.Add(mapping);
currentEntry.Clear();
- position++; //Skip the second seperator character as well
+ position++; // Skip the second seperator character as well
}
else
{
- currentEntry.Add(aFontData[position]);
+ currentEntry.Add(fontData[position]);
}
+
position++;
}
}
- return new PCScreenFont(CharWidth, CharHeight, FontData, UnicodeMappings);
+
+ return new PCScreenFont(charWidth, charHeight, parsedFontData, mappings);
}
if (version2)
{
- throw new NotImplementedException();
+ uint length = BitConverter.ToUInt32(fontData, 16);
+ uint height = BitConverter.ToUInt32(fontData, 24);
+ uint width = BitConverter.ToUInt32(fontData, 28);
+ charHeight = (byte)height;
+ charWidth = (byte)width;
+
+ uint bytesPerRow = (width + 7) / 8;
+ uint charDataSize = charHeight * bytesPerRow;
+ parsedFontData = new byte[length * charDataSize];
+
+ for (int i = 0; i < length; i++)
+ {
+ for (int k = 0; k < charHeight; k++)
+ {
+ int dataIndex = 32 + (i * (byte)charDataSize) + (k * (byte)bytesPerRow);
+ for (int j = 0; j < bytesPerRow; j++)
+ {
+ parsedFontData[(i * charDataSize) + (k * bytesPerRow) + j] = fontData[dataIndex + j];
+ }
+ }
+ }
+
+
+ return new PCScreenFont(charWidth, charHeight, parsedFontData, mappings);
}
- throw new ArgumentException(nameof(aFontData));
+
+ throw new ArgumentException("The font data is incorrect.", nameof(fontData));
}
///
- /// Convert the font so that it can be loaded into VGA
+ /// Converts the PC screen font to a VGA font.
///
- ///
public byte[] CreateVGAFont()
{
byte[] font = new byte[256 * Height * Width / 8];
- //Find ' ' and ? char to use index if nothing is found
+
+ // Find ' ' and ? char to use index if nothing is found
int emptyOffset = FindASCIIOffset((byte)' ');
int questionMarkOffset = FindASCIIOffset((byte)'?');
for (int i = 0; i < 256; i++)
{
- //Find font offset
+ // Find font offset
int offset = FindASCIIOffset((byte)i);
- if (offset >= 256) //If nothing was found
+ if (offset >= 256) // If nothing was found
{
- if (i < 32)
- {
+ if (i < 32) {
offset = emptyOffset;
}
- else
- {
+ else {
offset = questionMarkOffset;
}
}
+
for (int k = 0; k < Height; k++)
{
- font[i * Height + k] = Data[offset * Height + k];
+ font[(i * Height) + k] = Data[(offset * Height) + k];
}
}
+
return font;
}
- private int FindASCIIOffset(byte aI)
+ private int FindASCIIOffset(byte i)
{
int offset;
- for (offset = 0; offset < _UnicodeMappings.Count; offset++)
+ for (offset = 0; offset < unicodeMappings.Count; offset++)
{
- UnicodeMapping mapping = _UnicodeMappings[offset];
- if (mapping.ASCIICharacters.Contains(aI))
+ UnicodeMapping mapping = unicodeMappings[offset];
+ if (mapping.ASCIICharacters.Contains(i))
{
break;
}
@@ -248,6 +289,9 @@ private int FindASCIIOffset(byte aI)
}
}
+ ///
+ /// Represents a Unicode to font position mapping.
+ ///
public struct UnicodeMapping
{
public int FontPosition;
diff --git a/source/Cosmos.System2/Graphics/FullScreenCanvas.cs b/source/Cosmos.System2/Graphics/FullScreenCanvas.cs
index ca68b3fdff..1733e970d2 100644
--- a/source/Cosmos.System2/Graphics/FullScreenCanvas.cs
+++ b/source/Cosmos.System2/Graphics/FullScreenCanvas.cs
@@ -1,37 +1,33 @@
-//#define COSMOSDEBUG
-using System;
-using Cosmos.Core;
+using Cosmos.HAL.Drivers.Video;
+using Cosmos.Core.Multiboot;
using Cosmos.HAL;
-using Cosmos.HAL.Drivers;
namespace Cosmos.System.Graphics
{
///
- /// FullScreenCanvas class. Used to set and get full screen canvas.
+ /// Provides functionality to fetch canvases that write directly to the
+ /// underlying display device.
///
public static class FullScreenCanvas
{
///
- /// Boolean value whether CGS is in use or not
+ /// Whether the CGS (Cosmos Graphics Subsystem) is currently in use.
///
- public static bool IsInUse = false;
+ public static bool IsInUse { get; private set; } = false;
///
- /// Disables the specified Graphics Driver used and returns to VGA text mode 80x25
+ /// Disables the specified graphics driver used, and returns to VGA text mode 80x25.
///
public static void Disable()
{
if (IsInUse)
{
- _VideoDriver.Disable();
+ videoDriver.Disable();
VGAScreen.SetTextMode(VGADriver.TextSize.Size80x25);
IsInUse = false;
}
}
- ///
- /// List of all video drivers (BGA/VBE, VGA, VMware SVGA II)
- ///
private enum VideoDriver
{
VMWareSVGAIIDriver,
@@ -39,37 +35,28 @@ private enum VideoDriver
VGADriver
}
- ///
- /// SVGA 2 device.
- ///
- private static PCIDevice _SVGAIIDevice = PCI.GetDevice(VendorID.VMWare, DeviceID.SVGAIIAdapter);
+ static Canvas videoDriver = null;
+ static readonly PCIDevice svgaIIDevice = PCI.GetDevice(VendorID.VMWare, DeviceID.SVGAIIAdapter);
///
- /// Checks whether the Bochs Graphics Adapter exists (not limited to Bochs)
+ /// Checks whether the Bochs Graphics Adapter exists.
///
- ///
public static bool BGAExists()
{
return VBEDriver.ISAModeAvailable();
}
///
- /// Video driver.
+ /// Gets a instance, using an implementation based on
+ /// the currently used video driver.
///
- private static Canvas _VideoDriver = null;
-
- ///
- /// Get video driver.
- ///
- /// Canvas value.
- /// Thrown if default graphics mode is not suppoted.
private static Canvas GetVideoDriver()
{
- if (_SVGAIIDevice != null && PCI.Exists(_SVGAIIDevice))
+ if (svgaIIDevice != null && PCI.Exists(svgaIIDevice))
{
return new SVGAIICanvas();
}
- else if (VBEAvailable())
+ else if (IsVBEAvailable())
{
return new VBECanvas();
}
@@ -80,18 +67,17 @@ private static Canvas GetVideoDriver()
}
///
- /// Get video driver.
+ /// Gets a instance, using an implementation based on
+ /// the currently used video driver, constructing the canvas with the given
+ /// .
///
- /// Mode.
- /// Canvas value.
- /// Thrown if graphics mode is not suppoted.
private static Canvas GetVideoDriver(Mode mode)
{
- if (_SVGAIIDevice != null && PCI.Exists(_SVGAIIDevice))
+ if (svgaIIDevice != null && PCI.Exists(svgaIIDevice))
{
return new SVGAIICanvas(mode);
}
- else if (VBEAvailable())
+ else if (IsVBEAvailable())
{
return new VBECanvas(mode);
}
@@ -102,61 +88,47 @@ private static Canvas GetVideoDriver(Mode mode)
}
///
- /// Get full screen canvas.
- /// Changes current Mode to default.
+ /// Gets a screen display canvas, and changes the display mode to the default.
///
- /// Canvas value.
- /// Thrown if default graphics mode is not suppoted.
public static Canvas GetFullScreenCanvas()
{
- Global.mDebugger.SendInternal($"GetFullScreenCanvas() with default mode");
- if (_VideoDriver == null)
+ if (videoDriver == null)
{
- Global.mDebugger.SendInternal($"_VideoDriver is null creating new object");
- _VideoDriver = GetVideoDriver();
+ videoDriver = GetVideoDriver();
}
else
{
- Global.mDebugger.SendInternal($"_VideoDriver is NOT null using the old one changing mode to DefaultMode");
- _VideoDriver.Mode = _VideoDriver.DefaultGraphicMode;
+ videoDriver.Mode = videoDriver.DefaultGraphicsMode;
}
+
IsInUse = true;
- return _VideoDriver;
+ return videoDriver;
}
///
- /// Get full screen canvas.
- /// Changes the current Mode.
+ /// Gets a screen display canvas, and changes the display mode to the given .
///
- /// Mode.
- /// Canvas value.
- /// Thrown if graphics mode is not suppoted.
public static Canvas GetFullScreenCanvas(Mode mode)
{
- Global.mDebugger.SendInternal($"GetFullScreenCanvas() with mode" + mode);
-
- if (_VideoDriver == null)
+ if (videoDriver == null)
{
- _VideoDriver = GetVideoDriver(mode);
+ videoDriver = GetVideoDriver(mode);
}
else
{
- _VideoDriver.Mode = mode;
+ videoDriver.Mode = mode;
}
+
IsInUse = true;
- return _VideoDriver;
+ return videoDriver;
}
///
- /// Trys to get full screen canvas.
+ /// Attempts to get a screen display canvas, and changes the display mode to the default.
///
- /// Mode.
- /// true if successfully; otherwise, false.
- /// Thrown if graphics mode is not suppoted.
+ /// if the operation was successful; otherwise, .
public static bool TryGetFullScreenCanvas(Mode mode, out Canvas canvas)
{
- Global.mDebugger.SendInternal($"TryGetFullScreenCanvas() with mode" + mode);
-
try
{
canvas = GetFullScreenCanvas(mode);
@@ -166,26 +138,20 @@ public static bool TryGetFullScreenCanvas(Mode mode, out Canvas canvas)
catch
{
}
+
canvas = null;
return false;
}
+
///
- /// Gets current full screen canvas
- /// with out setting Mode.
+ /// Gets the currently used screen display canvas.
///
- /// Canvas value.
public static Canvas GetCurrentFullScreenCanvas()
{
- Global.mDebugger.SendInternal($"GetCurrentFullScreenCanvas()");
-
- return _VideoDriver;
+ return videoDriver;
}
- ///
- /// Checks is VBE is supported exists
- ///
- ///
- private static bool VBEAvailable()
+ private static bool IsVBEAvailable()
{
if (BGAExists())
{
@@ -199,7 +165,7 @@ private static bool VBEAvailable()
{
return true;
}
- else if (VBE.IsAvailable())
+ else if (Multiboot2.IsVBEAvailable)
{
return true;
}
@@ -209,4 +175,4 @@ private static bool VBEAvailable()
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Graphics/Image.cs b/source/Cosmos.System2/Graphics/Image.cs
index d2c426c9c7..7c2eae1a76 100644
--- a/source/Cosmos.System2/Graphics/Image.cs
+++ b/source/Cosmos.System2/Graphics/Image.cs
@@ -5,36 +5,38 @@
namespace Cosmos.System.Graphics
{
///
- /// Image class.
+ /// Represents a raster image.
///
public abstract class Image
{
///
- /// Get and set raw data (pixels array).
+ /// The raw data of the image. This array holds all of the pixel
+ /// values of the raster image.
///
- public int[] rawData;
+ public int[] RawData;
///
- /// Get and set image width.
+ /// The width of the image.
///
public uint Width { get; protected set; }
///
- /// Get and set image height.
+ /// The height of the image.
///
public uint Height { get; protected set; }
///
- /// Get and set image color depth.
+ /// The color depth of each pixel of the image - i.e, the amount
+ /// of bits per each pixel.
///
public ColorDepth Depth { get; protected set; }
///
- /// Create new instance of class.
+ /// Initializes a new instance of class.
///
- /// Image width.
- /// Image height.
- /// Color depth.
+ /// The width of the image.
+ /// The height of the image.
+ /// The color depth of each pixel.
protected Image(uint width, uint height, ColorDepth color)
{
Width = width;
@@ -48,6 +50,6 @@ protected Image(uint width, uint height, ColorDepth color)
///
public enum ImageFormat
{
- bmp
- } //Add more as more are supported
+ BMP
+ }
}
diff --git a/source/Cosmos.System2/Graphics/Mode.cs b/source/Cosmos.System2/Graphics/Mode.cs
index 8f5c8f07a3..695e8f0439 100644
--- a/source/Cosmos.System2/Graphics/Mode.cs
+++ b/source/Cosmos.System2/Graphics/Mode.cs
@@ -8,46 +8,45 @@ namespace Cosmos.System.Graphics
*/
///
- /// Mode struct. Represents a video mode in term of its number of columns, rows and color depth.
+ /// Represents a video mode, definining its width (rows), height (columns) and color depth.
///
- public struct Mode
+ public readonly struct Mode
{
- /* Constuctor of our struct */
///
- /// Create new instance of the struct.
+ /// The width, or rows, of the display mode.
///
- /// Number of columns.
- /// Number of rows.
- /// Color depth.
- public Mode(int columns, int rows, ColorDepth color_depth)
- {
- this.Width = columns;
- this.Height = rows;
- this.ColorDepth = color_depth;
- }
+ public uint Width { get; }
+
+ ///
+ /// The height, or columns, of the display mode.
+ ///
+ public uint Height { get; }
///
- /// Check if modes equal.
+ /// The color depth of the display mode, i.e. the amount of bits per a single pixel.
///
- /// Other mode.
- /// bool value.
+ public ColorDepth ColorDepth { get; }
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The number of columns.
+ /// The number of rows.
+ /// The color depth, i.e. the amount of bits per a single pixel.
+ public Mode(uint columns, uint rows, ColorDepth colorDepth)
+ {
+ Width = columns;
+ Height = rows;
+ ColorDepth = colorDepth;
+ }
+
public bool Equals(Mode other)
{
return Width == other.Width && Height == other.Height && ColorDepth == other.ColorDepth;
}
- ///
- /// Check if modes equal.
- ///
- /// Object to compare to.
- /// bool value.
public override bool Equals(object obj) => obj is Mode mode && Equals(mode);
- /* If you ovveride Equals you should ovveride GetHashCode too! */
- ///
- /// Get hash code.
- ///
- /// int value.
public override int GetHashCode()
{
// overflow is acceptable in this case
@@ -60,11 +59,6 @@ public override int GetHashCode()
}
}
- ///
- /// Compare modes.
- ///
- /// Other mode to compare to.
- /// -1 if this smaller, +1 if this bigger, 0 otherwise.
public int CompareTo(Mode other)
{
// color_depth has no effect on the orderiring
@@ -82,89 +76,13 @@ public int CompareTo(Mode other)
return 0;
}
- ///
- /// Check if modes are equal.
- ///
- /// lhs mode.
- /// rhs mode.
- /// bool value.
- public static bool operator ==(Mode mode_a, Mode mode_b) => mode_a.Equals(mode_b);
-
- ///
- /// Check if modes are not equal.
- ///
- /// lhs mode.
- /// rhs mode.
- /// bool value.
- public static bool operator !=(Mode mode_a, Mode mode_b) => !(mode_a == mode_b);
-
- ///
- /// Compare modes.
- ///
- /// lhs mode.
- /// rhs mode.
- /// bool value.
- public static bool operator >(Mode mode_a, Mode mode_b)
- {
- var result = mode_a.CompareTo(mode_b);
-
- return result > 0;
- }
+ public static bool operator ==(Mode a, Mode b) => a.Equals(b);
+ public static bool operator !=(Mode a, Mode b) => !(a == b);
+ public static bool operator >(Mode a, Mode b) => a.CompareTo(b) > 0;
+ public static bool operator <(Mode a, Mode b) => a.CompareTo(b) < 0;
+ public static bool operator >=(Mode a, Mode b) => a.CompareTo(b) >= 0;
+ public static bool operator <=(Mode a, Mode b) => a.CompareTo(b) <= 0;
- ///
- /// Compare modes.
- ///
- /// lhs mode.
- /// rhs mode.
- /// bool value.
- public static bool operator <(Mode mode_a, Mode mode_b)
- {
- var result = mode_a.CompareTo(mode_b);
-
- return result < 0;
- }
-
- ///
- /// Compare modes.
- ///
- /// lhs mode.
- /// rhs mode.
- /// bool value.
- public static bool operator >=(Mode mode_a, Mode mode_b)
- {
- return mode_a.CompareTo(mode_b) >= 0;
- }
-
- ///
- /// Compare modes.
- ///
- /// lhs mode.
- /// rhs mode.
- /// bool value.
- public static bool operator <=(Mode mode_a, Mode mode_b)
- {
- return mode_a.CompareTo(mode_b) <= 0;
- }
-
- ///
- /// Get columns.
- ///
- public int Width { get; }
-
- ///
- /// Get rows.
- ///
- public int Height { get; }
-
- ///
- /// Get color depth
- ///
- public ColorDepth ColorDepth { get; }
-
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return $"{Width}x{Height}@{(int)ColorDepth}";
diff --git a/source/Cosmos.System2/Graphics/SVGAIICanvas.cs b/source/Cosmos.System2/Graphics/SVGAIICanvas.cs
index a4caf665d0..a67408779d 100644
--- a/source/Cosmos.System2/Graphics/SVGAIICanvas.cs
+++ b/source/Cosmos.System2/Graphics/SVGAIICanvas.cs
@@ -1,61 +1,46 @@
-//#define COSMOSDEBUG
using System;
using System.Collections.Generic;
using System.Drawing;
using Cosmos.Debug.Kernel;
-using Cosmos.HAL.Drivers.PCI.Video;
+using Cosmos.HAL.Drivers.Video.SVGAII;
using Cosmos.System.Graphics.Fonts;
namespace Cosmos.System.Graphics
{
///
- /// SVGAIIScreen class. Used to draw ractengales to the screen. See also: .
+ /// Defines a VMWare SVGAII canvas implementation. Please note that this implementation
+ /// of can only be used with virtualizers that do implement
+ /// SVGAII, meaning that this class will not work on regular hardware.
///
public class SVGAIICanvas : Canvas
{
- ///
- /// Debugger.
- ///
- internal Debugger mSVGAIIDebugger = new Debugger("System", "SVGAIIScreen");
-
- private static readonly Mode _DefaultMode = new Mode(1024, 768, ColorDepth.ColorDepth32);
-
- ///
- /// Graphics mode.
- ///
- private Mode _Mode;
+ internal Debugger debugger = new("SVGAIIScreen");
+ static readonly Mode defaultMode = new(1024, 768, ColorDepth.ColorDepth32);
- ///
- /// VMWare SVGA 2 driver.
- ///
- private readonly VMWareSVGAII _xSVGADriver;
+ private Mode mode;
+ private readonly VMWareSVGAII driver;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Thrown if default graphics mode is not suppoted.
public SVGAIICanvas()
- : this(_DefaultMode)
+ : this(defaultMode)
{
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// A graphics mode.
- /// Thrown if mode is not suppoted.
+ /// The graphics mode.
public SVGAIICanvas(Mode aMode)
{
- mSVGAIIDebugger.SendInternal($"Called ctor with mode {aMode}");
+ debugger.SendInternal($"Called ctor with mode {aMode}");
ThrowIfModeIsNotValid(aMode);
- _xSVGADriver = new VMWareSVGAII();
+ driver = new VMWareSVGAII();
Mode = aMode;
}
- ///
- /// Name of the backend
- ///
public override string Name() => "VMWareSVGAII";
///
@@ -64,98 +49,45 @@ public SVGAIICanvas(Mode aMode)
/// (set) Thrown if mode is not suppoted.
public override Mode Mode
{
- get => _Mode;
+ get => mode;
set
{
- _Mode = value;
- mSVGAIIDebugger.SendInternal($"Called Mode set property with mode {_Mode}");
- SetGraphicsMode(_Mode);
+ mode = value;
+ debugger.SendInternal($"Called Mode set property with mode {mode}");
+ SetGraphicsMode(mode);
}
}
- ///
- /// Override canvas dufault graphics mode.
- ///
- public override Mode DefaultGraphicMode => _DefaultMode;
+ public override Mode DefaultGraphicsMode => defaultMode;
- ///
- /// Disables the SVGA driver, parent method returns to VGA text mode
- ///
public override void Disable()
{
- _xSVGADriver.Disable();
+ driver.Disable();
}
- ///
- /// Draw point.
- ///
- /// Color to draw with.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown on memory access violation.
- public override void DrawPoint(Color aColor, int aX, int aY)
+ public override void DrawPoint(Color color, int x, int y)
{
- if (aColor.A < 255)
+ if (color.A < 255)
{
- if (aColor.A == 0)
+ if (color.A == 0)
{
return;
}
- aColor = AlphaBlend(aColor, GetPointColor(aX, aY), aColor.A);
+ color = AlphaBlend(color, GetPointColor(x, y), color.A);
}
- _xSVGADriver.SetPixel((uint)aX, (uint)aY, (uint)aColor.ToArgb());
- }
-
- ///
- /// Draw array of colors.
- /// Not implemented.
- ///
- /// Array of colors.
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// Height.
- /// Thrown always.
- public override void DrawArray(Color[] aColors, int aX, int aY, int aWidth, int aHeight)
- {
- throw new NotImplementedException();
- //xSVGAIIDriver.
- }
-
- ///
- /// Draw point.
- /// Not implemented.
- ///
- /// Color to draw with.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown always (only int coordinates supported).
- public override void DrawPoint(Color aColor, float aX, float aY)
- {
- //xSVGAIIDriver.
- throw new NotImplementedException();
+ driver.SetPixel((uint)x, (uint)y, (uint)color.ToArgb());
}
- ///
- /// Draw filled rectangle.
- ///
- /// color to draw with.
- /// starting X coordinate.
- /// starting Y coordinate.
- /// Width.
- /// Height.
- /// Thrown on memory access violation.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- public override void DrawFilledRectangle(Color aColor, int aX_start, int aY_start, int aWidth, int aHeight)
+ public override void DrawFilledRectangle(Color color, int xStart, int yStart, int width, int height)
{
- var color = aColor.ToArgb();
+ var argb = color.ToArgb();
// For now write directly into video memory, once _xSVGADriver.Fill will be faster it will have to be changed
- for (int i = aY_start; i < aY_start + aHeight; i++)
+ for (int i = yStart; i < yStart + height; i++)
{
- _xSVGADriver.VideoMemory.Fill(GetPointOffset(aX_start, i) + (int)_xSVGADriver.FrameSize, aWidth, color);
+ driver.videoMemory.Fill(GetPointOffset(xStart, i) + (int)driver.FrameSize, width, argb);
}
}
@@ -295,180 +227,131 @@ public override void DrawFilledRectangle(Color aColor, int aX_start, int aY_star
};
///
- /// Set graphics mode.
+ /// Sets the graphics mode to the specified value.
///
- /// A mode.
- /// Thrown if mode is not suppoted.
- private void SetGraphicsMode(Mode aMode)
+ private void SetGraphicsMode(Mode mode)
{
- ThrowIfModeIsNotValid(aMode);
+ ThrowIfModeIsNotValid(mode);
- var xWidth = (uint)aMode.Width;
- var xHeight = (uint)aMode.Height;
- var xColorDepth = (uint)aMode.ColorDepth;
+ var width = (uint)mode.Width;
+ var height = (uint)mode.Height;
+ var colorDepth = (uint)mode.ColorDepth;
- _xSVGADriver.SetMode(xWidth, xHeight, xColorDepth);
+ driver.SetMode(width, height, colorDepth);
}
- ///
- /// Clear screen to specified color.
- ///
- /// Color in ARGB.
- /// Thrown on memory access violation.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- public override void Clear(int aColor)
+ public override void Clear(int color)
{
- _xSVGADriver.Clear((uint)aColor);
+ driver.Clear((uint)color);
}
- ///
- /// Clear screen to specified color.
- ///
- /// Color.
- /// Thrown on memory access violation.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- public override void Clear(Color aColor)
+ public override void Clear(Color color)
{
- _xSVGADriver.Clear((uint)aColor.ToArgb());
+ driver.Clear((uint)color.ToArgb());
}
- ///
- /// Get pixel color.
- ///
- /// A X coordinate.
- /// A Y coordinate.
- /// Color value.
- /// Thrown on memory access violation.
- public Color GetPixel(int aX, int aY)
+ public Color GetPixel(int x, int y)
{
- var xColorARGB = _xSVGADriver.GetPixel((uint)aX, (uint)aY);
- return Color.FromArgb((int)xColorARGB);
+ var argb = driver.GetPixel((uint)x, (uint)y);
+ return Color.FromArgb((int)argb);
}
///
- /// Set cursor.
+ /// Sets the state of the cursor.
///
- /// Visible.
- /// A X coordinate.
- /// A Y coordinate.
- public void SetCursor(bool aVisible, int aX, int aY)
+ /// Whether the cursor should be visible.
+ /// The X coordinate of the cursor.
+ /// The Y coordinate of the cursor.
+ public void SetCursor(bool visible, int x, int y)
{
- _xSVGADriver.SetCursor(aVisible, (uint)aX, (uint)aY);
+ driver.SetCursor(visible, (uint)x, (uint)y);
}
///
- /// Create cursor.
+ /// Creates the hardware cursor.
///
public void CreateCursor()
{
- _xSVGADriver.DefineCursor();
+ driver.DefineCursor();
}
///
- /// Copy pixel
+ /// Performs a bit blit operation, copying pixels from one region
+ /// to another.
///
- /// A source X coordinate.
- /// A source Y coordinate.
- /// A destination X coordinate.
- /// A destination Y coordinate.
- /// A width.
- /// A height.
+ /// The source X coordinate.
+ /// The source Y coordinate.
+ /// The destination X coordinate.
+ /// The destination Y coordinate.
+ /// The width of the region.
+ /// The height of the region.
/// Thrown if VMWare SVGA 2 has no rectangle copy capability
- public void CopyPixel(int aX, int aY, int aNewX, int aNewY, int aWidth = 1, int aHeight = 1)
+ public void CopyPixels(int srcX, int srcY, int dstX, int dstY, int width = 1, int height = 1)
{
- _xSVGADriver.Copy((uint)aX, (uint)aY, (uint)aNewX, (uint)aNewY, (uint)aWidth, (uint)aHeight);
+ driver.Copy((uint)srcX, (uint)srcY, (uint)dstX, (uint)dstY, (uint)width, (uint)height);
}
///
- /// Move pixel
+ /// Moves a single pixel.
///
- /// A X coordinate.
- /// A Y coordinate.
- /// A new X coordinate.
- /// A new Y coordinate.
- /// Thrown if VMWare SVGA 2 has no rectange copy capability
- /// Thrown on memory access violation.
- public void MovePixel(int aX, int aY, int aNewX, int aNewY)
+ /// The X coordinate.
+ /// The Y coordinate.
+ /// The new X coordinate.
+ /// The new Y coordinate.
+ public void MovePixel(int x, int y, int newX, int newY)
{
- _xSVGADriver.Copy((uint)aX, (uint)aY, (uint)aNewX, (uint)aNewY, 1, 1);
- _xSVGADriver.SetPixel((uint)aX, (uint)aY, 0);
+ driver.Copy((uint)x, (uint)y, (uint)newX, (uint)newY, 1, 1);
+ driver.SetPixel((uint)x, (uint)y, 0);
}
- ///
- /// Get point color.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// Color value.
- /// Thrown on memory access violation.
- public override Color GetPointColor(int aX, int aY)
+ public override Color GetPointColor(int x, int y)
{
- return Color.FromArgb((int)_xSVGADriver.GetPixel((uint)aX, (uint)aY));
+ return Color.FromArgb((int)driver.GetPixel((uint)x, (uint)y));
}
- ///
- /// Display screen
- ///
public override void Display()
{
- _xSVGADriver.DoubleBufferUpdate();
+ driver.DoubleBufferUpdate();
}
- ///
- /// Draw string.
- ///
- /// string to draw.
- /// Font used.
- /// Color.
- /// X coordinate.
- /// Y coordinate.
- public override void DrawString(string str, Font aFont, Color color, int x, int y)
+ public override void DrawString(string str, Font font, Color color, int x, int y)
{
- for (int i = 0; i < str.Length; i++)
+ var len = str.Length;
+ var width = font.Width;
+
+ for (int i = 0; i < len; i++)
{
- DrawChar(str[i], aFont, color, x, y);
- x += aFont.Width;
+ DrawChar(str[i], font, color, x, y);
+ x += width;
}
}
- ///
- /// Draw char.
- ///
- /// char to draw.
- /// Font used.
- /// Color.
- /// X coordinate.
- /// Y coordinate.
- public override void DrawChar(char c, Font aFont, Color color, int x, int y)
+ public override void DrawChar(char c, Font font, Color color, int x, int y)
{
- int p = aFont.Height * (byte)c;
+ var height = font.Height;
+ var width = font.Width;
+ int p = height * (byte)c;
- for (int cy = 0; cy < aFont.Height; cy++)
+ for (int cy = 0; cy < height; cy++)
{
- for (byte cx = 0; cx < aFont.Width; cx++)
+ for (byte cx = 0; cx < width; cx++)
{
- if (aFont.ConvertByteToBitAddres(aFont.Data[p + cy], cx + 1))
+ if (font.ConvertByteToBitAddress(font.Data[p + cy], cx + 1))
{
- DrawPoint(color, (ushort)(x + (aFont.Width - cx)), (ushort)(y + cy));
+ DrawPoint(color, (ushort)(x + cx), (ushort)(y + cy));
}
}
}
}
- ///
- /// Draw image.
- ///
- /// Image.
- /// X coordinate.
- /// Y coordinate.
- public override void DrawImage(Image aImage, int aX, int aY)
+ public override void DrawImage(Image image, int x, int y)
{
- var xWidth = (int)aImage.Width;
- var xHeight = (int)aImage.Height;
+ var width = (int)image.Width;
+ var height = (int)image.Height;
- for (int i = 0; i < xHeight; i++)
+ for (int i = 0; i < height; i++)
{
- _xSVGADriver.VideoMemory.Copy(GetPointOffset(aX, aY + i) + (int)_xSVGADriver.FrameSize, aImage.rawData, i * xWidth, xWidth);
+ driver.videoMemory.Copy(GetPointOffset(x, y + i) + (int)driver.FrameSize, image.RawData, i * width, width);
}
}
}
diff --git a/source/Cosmos.System2/Graphics/VBECanvas.cs b/source/Cosmos.System2/Graphics/VBECanvas.cs
index 006a097b89..6c9a72ea90 100644
--- a/source/Cosmos.System2/Graphics/VBECanvas.cs
+++ b/source/Cosmos.System2/Graphics/VBECanvas.cs
@@ -1,98 +1,64 @@
-//#define COSMOSDEBUG
-using System;
using System.Collections.Generic;
+using Cosmos.HAL.Drivers.Video;
+using Cosmos.Core.Multiboot;
using System.Drawing;
-
-using Cosmos.HAL.Drivers;
+using System;
namespace Cosmos.System.Graphics
{
///
- /// VBECanvas class. Used to control screen, by VBE (VESA BIOS Extensions) standard. See also: .
+ /// Defines a VBE (VESA Bios Extensions) canvas implementation. Please note
+ /// that this implementation of only works on BIOS
+ /// implementations, meaning that it is not available on UEFI systems.
///
public class VBECanvas : Canvas
{
- ///
- /// Default video mode. 1024x768x32.
- ///
- private static readonly Mode _DefaultMode = new Mode(1024, 768, ColorDepth.ColorDepth32);
+ static readonly Mode defaultMode = new(1024, 768, ColorDepth.ColorDepth32);
+ readonly VBEDriver driver;
+ Mode mode;
///
- /// Driver for Setting vbe modes and ploting/getting pixels
+ /// Initializes a new instance of the class.
///
- private readonly VBEDriver _VBEDriver;
-
- ///
- /// Video mode.
- ///
- private Mode _Mode;
-
- ///
- /// Create new instance of the class.
- ///
- /// Thrown if default mode (1024x768x32) is not suppoted.
- public VBECanvas() : this(_DefaultMode)
+ public VBECanvas() : this(defaultMode)
{
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// VBE mode.
- /// Thrown if mode is not suppoted.
- public VBECanvas(Mode aMode)
+ /// The display mode to use.
+ public unsafe VBECanvas(Mode mode)
{
- Global.mDebugger.SendInternal($"Creating new VBEScreen() with mode {aMode.Width}x{aMode.Height}x{(uint)aMode.ColorDepth}");
-
- if (Core.VBE.IsAvailable())
+ if (Multiboot2.IsVBEAvailable)
{
- Core.VBE.ModeInfo ModeInfo = Core.VBE.getModeInfo();
- aMode = new Mode(ModeInfo.width, ModeInfo.height, (ColorDepth)ModeInfo.bpp);
- Global.mDebugger.SendInternal($"Detected VBE VESA with {aMode.Width}x{aMode.Height}x{(uint)aMode.ColorDepth}");
+ mode = new(Multiboot2.Framebuffer->Width, Multiboot2.Framebuffer->Height, (ColorDepth)Multiboot2.Framebuffer->Bpp);
}
- ThrowIfModeIsNotValid(aMode);
+ ThrowIfModeIsNotValid(mode);
- _VBEDriver = new VBEDriver((ushort)aMode.Width, (ushort)aMode.Height, (ushort)aMode.ColorDepth);
- Mode = aMode;
+ driver = new VBEDriver((ushort)mode.Width, (ushort)mode.Height, (ushort)mode.ColorDepth);
+ Mode = mode;
}
- ///
- /// Disables VBE Graphics mode, parent method returns to VGA text mode (80x25)
- ///
public override void Disable()
{
- _VBEDriver.DisableDisplay();
+ driver.DisableDisplay();
}
- ///
- /// Name of the backend
- ///
public override string Name() => "VBECanvas";
- ///
- /// Get and set video mode.
- ///
- /// (set) Thrown if mode is not suppoted.
public override Mode Mode
{
- get => _Mode;
+ get => mode;
set
{
- _Mode = value;
- SetMode(_Mode);
+ mode = value;
+ SetMode(mode);
}
}
#region Display
-
- /////
- ///// All the available screen modes VBE supports, I would like to query the hardware and obtain from it the list but I have
- ///// not yet find how to do it! For now I hardcode the most used VESA modes, VBE seems to support until HDTV resolution
- ///// without problems that is well... excellent :-)
- /////
- //public override IReadOnlyList AvailableModes { get; } = new List
-
///
/// Available VBE supported video modes.
///
@@ -126,7 +92,7 @@ public override Mode Mode
///
///
///
- public override List AvailableModes { get; } = new List
+ public override List AvailableModes { get; } = new()
{
new Mode(320, 240, ColorDepth.ColorDepth32),
new Mode(640, 480, ColorDepth.ColorDepth32),
@@ -145,48 +111,34 @@ public override Mode Mode
new Mode(1920, 1200, ColorDepth.ColorDepth32),
};
- ///
- /// Override Canvas default graphics mode.
- ///
- public override Mode DefaultGraphicMode => _DefaultMode;
+ public override Mode DefaultGraphicsMode => defaultMode;
///
- /// Use this to setup the screen, this will disable the console.
+ /// Sets the used display mode, disabling text mode if it is active.
///
- /// The desired Mode resolution
- /// Thrown if mode is not suppoted.
- private void SetMode(Mode aMode)
+ private void SetMode(Mode mode)
{
- ThrowIfModeIsNotValid(aMode);
+ ThrowIfModeIsNotValid(mode);
ushort xres = (ushort)Mode.Width;
ushort yres = (ushort)Mode.Height;
ushort bpp = (ushort)Mode.ColorDepth;
- //set the screen
- _VBEDriver.VBESet(xres, yres, bpp);
+ driver.VBESet(xres, yres, bpp);
}
#endregion
#region Drawing
- ///
- /// Clear screen to specified color.
- ///
- /// Color.
public override void Clear(int aColor)
{
- Global.mDebugger.SendInternal($"Clearing the Screen with Color {aColor}");
- //if (color == null)
- // throw new ArgumentNullException(nameof(color));
-
/*
* TODO this version of Clear() works only when mode.ColorDepth == ColorDepth.ColorDepth32
* in the other cases you should before convert color and then call the opportune ClearVRAM() overload
* (the one that takes ushort for ColorDepth.ColorDepth16 and the one that takes byte for ColorDepth.ColorDepth8)
* For ColorDepth.ColorDepth24 you should mask the Alpha byte.
*/
- switch (_Mode.ColorDepth)
+ switch (mode.ColorDepth)
{
case ColorDepth.ColorDepth4:
throw new NotImplementedException();
@@ -197,30 +149,22 @@ public override void Clear(int aColor)
case ColorDepth.ColorDepth24:
throw new NotImplementedException();
case ColorDepth.ColorDepth32:
- _VBEDriver.ClearVRAM((uint)aColor);
+ driver.ClearVRAM((uint)aColor);
break;
default:
throw new NotImplementedException();
}
}
- ///
- /// Clear screen to specified color.
- ///
- /// Color.
public override void Clear(Color aColor)
{
- Global.mDebugger.SendInternal($"Clearing the Screen with Color {aColor}");
- //if (color == null)
- // throw new ArgumentNullException(nameof(color));
-
/*
* TODO this version of Clear() works only when mode.ColorDepth == ColorDepth.ColorDepth32
* in the other cases you should before convert color and then call the opportune ClearVRAM() overload
* (the one that takes ushort for ColorDepth.ColorDepth16 and the one that takes byte for ColorDepth.ColorDepth8)
* For ColorDepth.ColorDepth24 you should mask the Alpha byte.
*/
- switch (_Mode.ColorDepth)
+ switch (mode.ColorDepth)
{
case ColorDepth.ColorDepth4:
throw new NotImplementedException();
@@ -231,7 +175,7 @@ public override void Clear(Color aColor)
case ColorDepth.ColorDepth24:
throw new NotImplementedException();
case ColorDepth.ColorDepth32:
- _VBEDriver.ClearVRAM((uint)aColor.ToArgb());
+ driver.ClearVRAM((uint)aColor.ToArgb());
break;
default:
throw new NotImplementedException();
@@ -243,13 +187,6 @@ public override void Clear(Color aColor)
* be implemented is better to not check the validity of the arguments here or it will repeat the check for any point
* to be drawn slowing down all.
*/
- ///
- /// Draw point to the screen.
- ///
- /// Color to draw the point with.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown if color depth is not supported (currently only 32 is supported).
public override void DrawPoint(Color aColor, int aX, int aY)
{
uint offset;
@@ -277,136 +214,82 @@ public override void DrawPoint(Color aColor, int aX, int aY)
aColor = AlphaBlend(aColor, GetPointColor(aX, aY), aColor.A);
}
- _VBEDriver.SetVRAM(offset, aColor.B);
- _VBEDriver.SetVRAM(offset + 1, aColor.G);
- _VBEDriver.SetVRAM(offset + 2, aColor.R);
- _VBEDriver.SetVRAM(offset + 3, aColor.A);
+ driver.SetVRAM(offset, aColor.B);
+ driver.SetVRAM(offset + 1, aColor.G);
+ driver.SetVRAM(offset + 2, aColor.R);
+ driver.SetVRAM(offset + 3, aColor.A);
break;
case ColorDepth.ColorDepth24:
offset = (uint)GetPointOffset(aX, aY);
- _VBEDriver.SetVRAM(offset, aColor.B);
- _VBEDriver.SetVRAM(offset + 1, aColor.G);
- _VBEDriver.SetVRAM(offset + 2, aColor.R);
+ driver.SetVRAM(offset, aColor.B);
+ driver.SetVRAM(offset + 1, aColor.G);
+ driver.SetVRAM(offset + 2, aColor.R);
break;
default:
- string errorMsg = "DrawPoint() with ColorDepth " + (int)Mode.ColorDepth + " not yet supported";
- throw new NotImplementedException(errorMsg);
+ throw new NotImplementedException("Drawing pixels with color depth " + (int)Mode.ColorDepth + "is not yet supported.");
}
}
- ///
- /// Draw point to the screen.
- /// Not implemented.
- ///
- /// Color to draw the point with.
- /// X coordinate.
- /// Y coordinate.
- /// Thrown always (only int coordinats supported).
- public override void DrawPoint(Color aColor, float aX, float aY)
- {
- throw new NotImplementedException();
- }
-
- /* This is just temp */
- ///
- /// Draw array of colors.
- ///
- /// Colors array.
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// unused.
- /// Thrown if coordinates are invalid, or width is less than 0.
- /// Thrown if color depth is not supported.
public override void DrawArray(Color[] aColors, int aX, int aY, int aWidth, int aHeight)
{
ThrowIfCoordNotValid(aX, aY);
-
ThrowIfCoordNotValid(aX + aWidth, aY + aHeight);
for (int i = 0; i < aX; i++)
{
-
for (int ii = 0; ii < aY; ii++)
{
-
- DrawPoint(aColors[i + ii * aWidth], i, ii);
-
+ DrawPoint(aColors[i + (ii * aWidth)], i, ii);
}
}
}
- ///
- /// Draw filled rectangle.
- ///
- /// Color to draw with.
- /// X coordinate.
- /// Y coordinate.
- /// Width.
- /// Height.
public override void DrawFilledRectangle(Color aColor, int aX, int aY, int aWidth, int aHeight)
{
- //ClearVRAM clears one uint at a time. So we clear pixelwise not byte wise. That's why we divide by 32 and not 8.
- aWidth = Math.Min(aWidth, Mode.Width - aX) * (int)Mode.ColorDepth / 32;
+ // ClearVRAM clears one uint at a time. So we clear pixelwise not byte wise. That's why we divide by 32 and not 8.
+ aWidth = (int)(Math.Min(aWidth, Mode.Width - aX) * (int)Mode.ColorDepth / 32);
var color = aColor.ToArgb();
for (int i = aY; i < aY + aHeight; i++)
{
- _VBEDriver.ClearVRAM(GetPointOffset(aX, i), aWidth, color);
+ driver.ClearVRAM(GetPointOffset(aX, i), aWidth, color);
}
}
- ///
- /// Draw image.
- ///
- /// Image.
- /// X coordinate.
- /// Y coordinate.
public override void DrawImage(Image aImage, int aX, int aY)
{
- var xBitmap = aImage.rawData;
+ var xBitmap = aImage.RawData;
var xWidth = (int)aImage.Width;
var xHeight = (int)aImage.Height;
int xOffset = GetPointOffset(aX, aY);
- int xScreenWidthInPixel = Mode.Width;
for (int i = 0; i < xHeight; i++)
{
- _VBEDriver.CopyVRAM(i * xScreenWidthInPixel + xOffset, xBitmap, i * xWidth, xWidth);
+ driver.CopyVRAM((i * (int)Mode.Width) + xOffset, xBitmap, i * xWidth, xWidth);
}
}
#endregion
- ///
- /// Display screen
- ///
public override void Display()
{
- _VBEDriver.Swap();
+ driver.Swap();
}
#region Reading
- ///
- /// Get point color.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// Color value.
public override Color GetPointColor(int aX, int aY)
{
uint offset = (uint)GetPointOffset(aX, aY);
-
- return Color.FromArgb((int)_VBEDriver.GetVRAM(offset));
+ return Color.FromArgb((int)driver.GetVRAM(offset));
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Graphics/VGACanvas.cs b/source/Cosmos.System2/Graphics/VGACanvas.cs
index 8b80bf4a03..e0e819f797 100644
--- a/source/Cosmos.System2/Graphics/VGACanvas.cs
+++ b/source/Cosmos.System2/Graphics/VGACanvas.cs
@@ -1,84 +1,68 @@
-using System;
+using static Cosmos.HAL.Drivers.Video.VGADriver;
+using Cosmos.HAL.Drivers.Video;
using System.Collections.Generic;
-using System.Text;
-using Cosmos.HAL;
using System.Drawing;
-using static Cosmos.HAL.VGADriver;
+using System;
namespace Cosmos.System.Graphics
{
///
- /// VGACanvas class. Used to control screen.
+ /// Defines a VGA canvas implementation.
///
public class VGACanvas : Canvas
{
- ///
- /// Private boolean whether VGA graphics mode is enabled or not
- ///
- bool _Enabled;
+ bool enabled;
+ readonly VGADriver driver;
///
- /// The HAL VGA driver
+ /// The list of available resolutions under VGA.
///
- private readonly VGADriver _VGADriver;
+ static readonly List availableModes = new()
+ {
+ new Mode(640, 480, ColorDepth.ColorDepth4),
+ new Mode(720, 480, ColorDepth.ColorDepth4),
+ new Mode(320, 200, ColorDepth.ColorDepth8)
+ };
///
- /// VGA graphics mode Canvas constructor - see Canvas.cs
+ /// Initializes a new instance of the class
+ /// with the given display mode.
///
- ///
- public VGACanvas(Mode aMode) : base()
+ public VGACanvas(Mode mode) : base()
{
- Global.mDebugger.Send("Creating VGACanvas with mode");
- _VGADriver = new VGADriver();
- _VGADriver.SetGraphicsMode(ModeToScreenSize(aMode), (VGADriver.ColorDepth)(int)aMode.ColorDepth);
- Mode = aMode;
+ driver = new VGADriver();
+ driver.SetGraphicsMode(ModeToScreenSize(mode), (VGADriver.ColorDepth)(int)mode.ColorDepth);
+ Mode = mode;
Enabled = true;
}
///
- /// Creates a VGA graphics mode with the default mode
+ /// Initializes a new instance of the class
+ /// with the default display mode.
///
public VGACanvas() : base()
{
Enabled = true;
- Mode = DefaultGraphicMode;
- Global.mDebugger.Send("Creating VGACanvas with standard mode");
- _VGADriver = new VGADriver();
- _VGADriver.SetGraphicsMode(ModeToScreenSize(DefaultGraphicMode), (VGADriver.ColorDepth)(int)DefaultGraphicMode.ColorDepth);
+ Mode = DefaultGraphicsMode;
+ driver = new VGADriver();
+ driver.SetGraphicsMode(ModeToScreenSize(DefaultGraphicsMode), (VGADriver.ColorDepth)(int)DefaultGraphicsMode.ColorDepth);
}
- ///
- /// Name of the backend
- ///
public override string Name() => "VGACanvas";
- ///
- /// Gets or sets the VGA graphics mode
- ///
public override Mode Mode { get; set; }
- ///
- /// Clears the screen of all pixels
- ///
- ///
public override void Clear(int aColor)
{
- _VGADriver.DrawFilledRectangle(0, 0, _VGADriver.PixelWidth, _VGADriver.PixelHeight, (uint)aColor);
+ driver.DrawFilledRectangle(0, 0, driver.PixelWidth, driver.PixelHeight, (uint)aColor);
}
- ///
- /// Clears the screen of all pixels
- ///
- ///
public override void Clear(Color aColor)
{
- var paletteIndex = _VGADriver.GetClosestColorInPalette(aColor);
- _VGADriver.DrawFilledRectangle(0, 0, _VGADriver.PixelWidth, _VGADriver.PixelHeight, paletteIndex);
+ var paletteIndex = driver.GetClosestColorInPalette(aColor);
+ driver.DrawFilledRectangle(0, 0, driver.PixelWidth, driver.PixelHeight, paletteIndex);
}
- ///
- /// Disables VGA graphics mode, parent method returns to 80x25 text mode
- ///
public override void Disable()
{
if (Enabled)
@@ -87,105 +71,37 @@ public override void Disable()
}
}
- ///
- /// Draws an array of colors, specifiying X and Y coords
- ///
- ///
- ///
- ///
- ///
- ///
- public override void DrawArray(Color[] aColors, int aX, int aY, int aWidth, int aHeight)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Draws a filled rectangle
- ///
- ///
- ///
- ///
- ///
- ///
public override void DrawFilledRectangle(Color aColor, int aXStart, int aYStart, int aWidth, int aHeight)
{
- _VGADriver.DrawFilledRectangle(aXStart, aYStart, aWidth, aHeight, _VGADriver.GetClosestColorInPalette(aColor));
+ driver.DrawFilledRectangle(aXStart, aYStart, aWidth, aHeight, driver.GetClosestColorInPalette(aColor));
}
- ///
- /// Draws a point
- ///
- ///
- ///
- ///
public override void DrawPoint(Color aColor, int aX, int aY)
{
- _VGADriver.SetPixel((uint)aX, (uint)aY, aColor);
+ driver.SetPixel((uint)aX, (uint)aY, aColor);
}
- ///
- /// Draws a point
- ///
- ///
- ///
- ///
public void DrawPoint(uint aColor, int aX, int aY)
{
- _VGADriver.SetPixel((uint)aX, (uint)aY, aColor);
- }
-
- ///
- /// Draws a point
- ///
- ///
- ///
- ///
- public override void DrawPoint(Color aColor, float aX, float aY)
- {
- throw new NotImplementedException();
+ driver.SetPixel((uint)aX, (uint)aY, aColor);
}
- ///
- /// List of available resolutions
- ///
- private static readonly List _AvailableModes = new List
- {
- new Mode(640, 480, ColorDepth.ColorDepth4),
- new Mode(720, 480, ColorDepth.ColorDepth4),
- new Mode(320, 200, ColorDepth.ColorDepth8)
- };
-
- public override List AvailableModes
- {
- get
- {
- return _AvailableModes;
- }
- }
+ public override List AvailableModes => availableModes;
- ///
- /// Retrieves the RGB value of a specified pixel
- ///
- ///
- ///
- ///
public override Color GetPointColor(int aX, int aY)
{
- return Color.FromArgb((int)_VGADriver.GetPixel((uint)aX, (uint)aY));
+ return Color.FromArgb((int)driver.GetPixel((uint)aX, (uint)aY));
}
- ///
- /// The default graphics mode
- ///
- public override Mode DefaultGraphicMode => new Mode(640, 480, ColorDepth.ColorDepth4);
+ public override Mode DefaultGraphicsMode => new Mode(640, 480, ColorDepth.ColorDepth4);
///
- /// Boolean value whether VGA is in graphics mode or not
+ /// Whether the canvas is active, and the display is currently in VGA
+ /// graphics mode.
///
- public bool Enabled { get => _Enabled; private set => _Enabled = value; }
+ public bool Enabled { get => enabled; private set => enabled = value; }
- private ScreenSize ModeToScreenSize(Mode aMode)
+ private static ScreenSize ModeToScreenSize(Mode aMode)
{
if (aMode.Width == 320 && aMode.Height == 200)
{
@@ -210,4 +126,4 @@ public override void Display()
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Graphics/VGAScreen.cs b/source/Cosmos.System2/Graphics/VGAScreen.cs
new file mode 100644
index 0000000000..8702099f54
--- /dev/null
+++ b/source/Cosmos.System2/Graphics/VGAScreen.cs
@@ -0,0 +1,75 @@
+using static Cosmos.HAL.Drivers.Video.VGADriver;
+using Cosmos.HAL.Drivers.Video;
+using System;
+
+namespace Cosmos.System.Graphics
+{
+ ///
+ /// Controls VGA text-mode.
+ ///
+ public class VGAScreen
+ {
+ static readonly VGADriver screen = new();
+
+ ///
+ /// Sets the currently used graphics mode.
+ ///
+ /// The size of the screen.
+ /// The color depth of each pixel.
+ /// Thrown if screen size or color depth not supported.
+ public static void SetGraphicsMode(ScreenSize screenSize, ColorDepth colorDepth)
+ {
+ var vgaColorDepth = colorDepth switch
+ {
+ ColorDepth.ColorDepth4 => VGADriver.ColorDepth.BitDepth4,
+ ColorDepth.ColorDepth8 => VGADriver.ColorDepth.BitDepth8,
+ ColorDepth.ColorDepth16 => VGADriver.ColorDepth.BitDepth16,
+ ColorDepth.ColorDepth24 => throw new NotImplementedException(),
+ ColorDepth.ColorDepth32 => throw new NotImplementedException(),
+ _ => throw new NotImplementedException(),
+ };
+
+ screen.SetGraphicsMode(screenSize, vgaColorDepth);
+ }
+
+ ///
+ /// Sets the currently used text mode.
+ ///
+ /// The text mode size.
+ public static void SetTextMode(TextSize size)
+ {
+ screen.SetTextMode(size);
+ }
+
+ ///
+ /// The width of each pixel.
+ ///
+ public static int PixelWidth = screen.PixelWidth;
+
+ ///
+ /// The height of each pixel.
+ ///
+ public static int PixelHeight = screen.PixelHeight;
+
+ ///
+ /// The text-mode colors used by the display.
+ ///
+ public static int Colors = screen.Colors;
+
+ ///
+ /// Sets the used text-mode font.
+ ///
+ /// The data of the font.
+ /// The height of each character in the font.
+ /// Thrown when font height > 32.
+ public static void SetFont(byte[] fontData, int fontHeight)
+ {
+ if(fontHeight > 32)
+ {
+ throw new ArgumentOutOfRangeException(nameof(fontHeight));
+ }
+
+ screen.WriteFont(fontData, (byte)fontHeight);
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Graphics/VGATextMode.cs b/source/Cosmos.System2/Graphics/VGATextMode.cs
deleted file mode 100644
index ee67faa9fa..0000000000
--- a/source/Cosmos.System2/Graphics/VGATextMode.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System;
-using Cosmos.HAL;
-using static Cosmos.HAL.VGADriver;
-
-namespace Cosmos.System.Graphics
-{
- ///
- /// VGAScreen class. Used to control VGA textmode.
- ///
- public class VGAScreen
- {
- private static readonly VGADriver _Screen = new VGADriver();
-
- ///
- /// Set graphics mode.
- ///
- /// Screen size.
- /// Color depth.
- /// Thrown if screen size / color depth not supported.
- public static void SetGraphicsMode(ScreenSize aScreenSize, ColorDepth aColorDepth)
- {
- var vgaColorDepth = aColorDepth switch
- {
- ColorDepth.ColorDepth4 => VGADriver.ColorDepth.BitDepth4,
- ColorDepth.ColorDepth8 => VGADriver.ColorDepth.BitDepth8,
- ColorDepth.ColorDepth16 => VGADriver.ColorDepth.BitDepth16,
- ColorDepth.ColorDepth24 => throw new NotImplementedException(),
- ColorDepth.ColorDepth32 => throw new NotImplementedException(),
- _ => throw new NotImplementedException(),
- };
- _Screen.SetGraphicsMode(aScreenSize, vgaColorDepth);
- }
-
- ///
- /// Set text mode.
- ///
- /// Text size.
- public static void SetTextMode(TextSize aSize)
- {
- _Screen.SetTextMode(aSize);
- }
-
- ///
- /// Get Height
- ///
- public static int PixelHeight = _Screen.PixelHeight;
-
- ///
- /// Get Width
- ///
- public static int PixelWidth = _Screen.PixelWidth;
-
- ///
- /// Get Colors
- ///
- public static int Colors = _Screen.Colors;
-
- ///
- /// Set a textmode font.
- ///
- /// Font file.
- /// /// Font Height.
- /// Thrown when font height > 32.
- public static void SetFont(byte[] fontData, int fontHeight)
- {
- if(fontHeight > 32)
- {
- throw new ArgumentOutOfRangeException("fontHeight");
- }
- _Screen.WriteFont(fontData, (byte)fontHeight);
- }
- }
-}
diff --git a/source/Cosmos.System2/Helpers/ArrayHelper.cs b/source/Cosmos.System2/Helpers/ArrayHelper.cs
index 9d42c749e1..5da2ca1edd 100644
--- a/source/Cosmos.System2/Helpers/ArrayHelper.cs
+++ b/source/Cosmos.System2/Helpers/ArrayHelper.cs
@@ -1,19 +1,17 @@
using System;
-using System.Collections.Generic;
-using System.Text;
namespace Cosmos.System.Helpers
{
///
- /// Array Helper class (contains useful functions about array manipulation).
+ /// Contains utility methods related to array manipulation.
///
public class ArrayHelper
{
///
- /// Contatenate two byte arrays. https://stackoverflow.com/a/45531730
+ /// Contatenates two byte arrays.
///
- /// First byte array.
- /// Byte array to concatenate.
+ /// The first byte array.
+ /// The byte array to concatenate.
public static byte[] Concat(byte[] first, byte[] second)
{
byte[] output;
@@ -32,21 +30,22 @@ public static byte[] Concat(byte[] first, byte[] second)
output[i] = first[i];
}
}
+
for (int j = 0; j < second.Length; j++)
{
output[alen + j] = second[j];
}
+
return output;
}
///
- /// Split byte array into chunks of a specified size.
+ /// Splits the specified byte array into chunks of a specified size.
///
- /// Byte array to split.
- /// Chunk size.
+ /// The byte array to split.
+ /// The size of each chunk.
public static byte[][] ArraySplit(byte[] buffer, int chunksize = 1000)
{
- var size = buffer.Length;
var chunkCount = (buffer.Length + chunksize - 1) / chunksize;
var bufferArray = new byte[chunkCount][];
int index = 0;
@@ -55,6 +54,7 @@ public static byte[][] ArraySplit(byte[] buffer, int chunksize = 1000)
{
bufferArray[i] = new byte[Math.Min(chunksize, buffer.Length - i * chunksize)];
}
+
for (var i = 0; i < chunkCount; i++)
{
for (var j = 0; j < bufferArray[i].Length; j++)
@@ -63,6 +63,7 @@ public static byte[][] ArraySplit(byte[] buffer, int chunksize = 1000)
index++;
}
}
+
return bufferArray;
}
}
diff --git a/source/Cosmos.System2/Kernel.cs b/source/Cosmos.System2/Kernel.cs
index a31e3028ba..27016ba170 100644
--- a/source/Cosmos.System2/Kernel.cs
+++ b/source/Cosmos.System2/Kernel.cs
@@ -1,5 +1,4 @@
using System;
-using sysIO = System.IO;
using Cosmos.Debug.Kernel;
using Cosmos.HAL;
@@ -14,163 +13,117 @@ public abstract class Kernel
///
/// User ring debugger instance, with the tag "Kernel".
///
- public readonly Debugger mDebugger = new("User", "Kernel");
-
- ///
- /// Clear screen.
- ///
- public bool ClearScreen = true;
+ public readonly Debugger mDebugger = new("Kernel");
// Set after initial start. Can be started and stopped at same time
- ///
- /// Kernel started.
- ///
protected bool mStarted;
// Set to signal stopped
- ///
- /// Kernel stopped.
- ///
protected bool mStopped;
///
- /// Get text screen device.
- ///
- /// null
- protected virtual TextScreenBase GetTextScreen() =>
- // null means use default
- null;
-
- ///
- /// Get keyboard key layout.
+ /// Gets the text screen device to initialize the system with. If not
+ /// overriden, the default text screen device will be used.
///
- /// Keyboard key layout.
- protected ScanMapBase GetKeyboardScanMap() => KeyboardManager.GetKeyLayout();
-
- ///
- /// Set keyboard key layout.
- ///
- /// Keyboard key layout.
- protected void SetKeyboardScanMap(ScanMapBase ScanMap) => KeyboardManager.SetKeyLayout(ScanMap);
+ // If this method returns "null", that means that the default device should be used.
+ protected virtual TextScreenBase GetTextScreen() => null;
///
/// Start the system up using the properties for configuration.
///
- /// Thrown on IO error.
public virtual void Start()
{
- try
- {
- Global.mDebugger.Send("Starting kernel");
+ try {
+ Global.Debugger.Send("Starting the kernel...");
if (mStarted)
{
- Global.mDebugger.Send("ERROR: Kernel Already Started");
+ Global.Debugger.Send("ERROR: The kernel has already been started.");
throw new Exception("Kernel has already been started. A kernel cannot be started twice.");
}
mStarted = true;
- if (String.Empty == null)
- {
- throw new Exception("Compiler didn't initialize System.String.Empty!");
- }
-
- Global.mDebugger.Send("HW Bootstrap Init");
+ Global.Debugger.Send("Initializing hardware bootstrap...");
Bootstrap.Init();
OnBoot();
- // Provide the user with a clear screen if they requested it
- if (ClearScreen)
- {
- Global.mDebugger.Send("Cls");
- //Global.Console.Clear();
- }
- Global.mDebugger.Send("Before Run");
BeforeRun();
// now enable interrupts:
HAL.Global.EnableInterrupts();
- Global.mDebugger.Send("Run");
- Global.mDebugger.Send(mStopped ? "Already stopped" : "Not yet stopped");
-
while (!mStopped)
{
- //Network.NetworkStack.Update();
Run();
}
- Global.mDebugger.Send("AfterRun");
+ Global.Debugger.Send("The main kernel loop has stopped.");
AfterRun();
}
catch (Exception e)
{
// todo: better ways to handle?
- Global.mDebugger.Send($"Kernel Exception {e}");
+ Global.Debugger.Send($"Kernel Exception {e}");
global::System.Console.ForegroundColor = ConsoleColor.Red;
- global::System.Console.WriteLine("A Kernel exception occured:");
+ global::System.Console.WriteLine("A kernel exception has occured:");
global::System.Console.ForegroundColor = ConsoleColor.White;
global::System.Console.WriteLine(e.ToString());
}
}
///
- /// This Method controls the Driver initialisation process and is intended for
- /// Advanced users developing their drivers and takes 4 additional booleans.
- /// 1. Mousewheel, if you experience your mouse cursors being stuck in the lower left corner set this to "false", default: true
- /// 2. PS2 Driver initialisation, true/false , default: true
- /// 3. Network Driver initialisation, true/false, default: true
- /// 4. IDE initialisation, true/false, default: true
- /// If you need anything else to be initialised really early on, place it here.
+ /// This method controls the driver initialisation process.
///
+ // 1. Mousewheel, if you experience your mouse cursors being stuck in the lower left corner set this to "false", default: true
+ // 2. PS2 Driver initialisation, true/false , default: true
+ // 3. Network Driver initialisation, true/false, default: true
+ // 4. IDE initialisation, true/false, default: true
+ // If you need anything else to be initialised early on, place it here.
protected virtual void OnBoot() => Global.Init(GetTextScreen());
///
- /// Pre-run events
+ /// Called before the main kernel loop begins.
///
protected virtual void BeforeRun()
{
}
///
- /// Main kernel loop
+ /// The main kernel loop method; this method is called on a infinite
+ /// loop, until is called.
///
protected abstract void Run();
///
- /// After the Run() method is exited (?)
+ /// Called after the main kernel loop method finishes. The main kernel
+ /// loop can stop after e.g. a call to the method.
///
protected virtual void AfterRun()
{
}
///
- /// Shut down the system and power off
+ /// Stops the main kernel loop.
///
public void Stop() => mStopped = true;
///
- /// Kernal object constructor.
+ /// The kernel object construtor. Overriding this constructor is not
+ /// recommended and may result in undesirable behavior.
///
public Kernel()
{
- Global.mDebugger.Send("In Cosmos.System.Kernel..ctor");
+ Global.Debugger.Send("Constructing a new Cosmos.System.Kernel instance.");
}
- // Shutdown and restart
- ///
- /// Shutdown and restart. Implemented.
- ///
- public void Restart() => Power.Reboot();
-
///
- /// Print message to the debbuger at system ring with "Global"-tag.
+ /// Prints a message to the debugger with the "Global" tag.
///
- /// A message to print.
- public static void PrintDebug(string message) => Global.mDebugger.Send(message);
+ /// The message to print.
+ public static void PrintDebug(string message) => Global.Debugger.Send(message);
///
- /// Get interrupts status.
+ /// Whether system interrupts are currently enabled.
///
public static bool InterruptsEnabled => HAL.Global.InterruptsEnabled;
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Kernel.html b/source/Cosmos.System2/Kernel.html
deleted file mode 100644
index 41f1089f02..0000000000
--- a/source/Cosmos.System2/Kernel.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
- Despite it being named kernel, it is not the Cosmos kernel. It is instead an
- interface to control the state of the kernel regarding booting, restarting,
- shutting down etc. Despite an exhaustive search, we could not determine a more
- appropriate name and settled on Kernel, since it is a system level interface to
- the kernel.
-
-
-
\ No newline at end of file
diff --git a/source/Cosmos.System2/Keyboard/ConsoleKeyEx.cs b/source/Cosmos.System2/Keyboard/ConsoleKeyEx.cs
index bf0ae38cdb..064542c823 100644
--- a/source/Cosmos.System2/Keyboard/ConsoleKeyEx.cs
+++ b/source/Cosmos.System2/Keyboard/ConsoleKeyEx.cs
@@ -1,10 +1,14 @@
namespace Cosmos.System
{
///
- /// ConsoleKeyEx enum.
+ /// Specifies the recognized virtual console keys, that are independent
+ /// from physical keyboard scan-codes.
///
public enum ConsoleKeyEx
{
+ ///
+ /// An unknown, undefined, or otherwise unrecognized key.
+ ///
NoName,
Escape,
@@ -79,6 +83,7 @@ public enum ConsoleKeyEx
LShift,
RShift,
OEM102, // <<=== This key does not exist on a US keyboard, but on the german one. It contains the characters `|`, `<` and `>`
+ OEM5, // This one is registered as \ and | on a British keyboard. however US use the one registered as # and ~ to us.
Z,
X,
C,
diff --git a/source/Cosmos.System2/Keyboard/ConsoleKeyExExtensions.cs b/source/Cosmos.System2/Keyboard/ConsoleKeyExExtensions.cs
index f661fd6efb..48d73bf5b3 100644
--- a/source/Cosmos.System2/Keyboard/ConsoleKeyExExtensions.cs
+++ b/source/Cosmos.System2/Keyboard/ConsoleKeyExExtensions.cs
@@ -3,219 +3,118 @@
namespace Cosmos.System
{
///
- /// ConsoleKeyEx extensions class.
+ /// Provides extension methods to the enumeration type.
///
public static class ConsoleKeyExExtensions
{
///
- /// Convert ConsoleKeyEx to ConsoleKey.
+ /// Converts the enumeration value to a
+ /// standard .NET value.
///
- /// KeyEx to convert.
- /// ConsoleKey value.
- /// Thorwn if KeyEx not implemented.
+ /// The key value to convert.
+ /// The translated enumeration value..
+ /// Thrown if the given enumeration value is unrecognized.
public static ConsoleKey ToConsoleKey(this ConsoleKeyEx keyEx)
{
- switch (keyEx)
- {
- case ConsoleKeyEx.NoName:
- return ConsoleKey.NoName;
- case ConsoleKeyEx.Escape:
- return ConsoleKey.Escape;
- case ConsoleKeyEx.F1:
- return ConsoleKey.F1;
- case ConsoleKeyEx.F2:
- return ConsoleKey.F2;
- case ConsoleKeyEx.F3:
- return ConsoleKey.F3;
- case ConsoleKeyEx.F4:
- return ConsoleKey.F4;
- case ConsoleKeyEx.F5:
- return ConsoleKey.F5;
- case ConsoleKeyEx.F6:
- return ConsoleKey.F6;
- case ConsoleKeyEx.F7:
- return ConsoleKey.F7;
- case ConsoleKeyEx.F8:
- return ConsoleKey.F8;
- case ConsoleKeyEx.F9:
- return ConsoleKey.F9;
- case ConsoleKeyEx.F10:
- return ConsoleKey.F10;
- case ConsoleKeyEx.F11:
- return ConsoleKey.F11;
- case ConsoleKeyEx.F12:
- return ConsoleKey.F12;
- case ConsoleKeyEx.PrintScreen:
- return ConsoleKey.PrintScreen;
- case ConsoleKeyEx.D1:
- return ConsoleKey.D1;
- case ConsoleKeyEx.D2:
- return ConsoleKey.D2;
- case ConsoleKeyEx.D3:
- return ConsoleKey.D3;
- case ConsoleKeyEx.D4:
- return ConsoleKey.D4;
- case ConsoleKeyEx.D5:
- return ConsoleKey.D5;
- case ConsoleKeyEx.D6:
- return ConsoleKey.D6;
- case ConsoleKeyEx.D7:
- return ConsoleKey.D7;
- case ConsoleKeyEx.D8:
- return ConsoleKey.D8;
- case ConsoleKeyEx.D9:
- return ConsoleKey.D9;
- case ConsoleKeyEx.D0:
- return ConsoleKey.D0;
- case ConsoleKeyEx.Backspace:
- return ConsoleKey.Backspace;
- case ConsoleKeyEx.Tab:
- return ConsoleKey.Tab;
- case ConsoleKeyEx.Q:
- return ConsoleKey.Q;
- case ConsoleKeyEx.W:
- return ConsoleKey.W;
- case ConsoleKeyEx.E:
- return ConsoleKey.E;
- case ConsoleKeyEx.R:
- return ConsoleKey.R;
- case ConsoleKeyEx.T:
- return ConsoleKey.T;
- case ConsoleKeyEx.Y:
- return ConsoleKey.Y;
- case ConsoleKeyEx.U:
- return ConsoleKey.U;
- case ConsoleKeyEx.I:
- return ConsoleKey.I;
- case ConsoleKeyEx.O:
- return ConsoleKey.O;
- case ConsoleKeyEx.P:
- return ConsoleKey.P;
- case ConsoleKeyEx.Enter:
- return ConsoleKey.Enter;
- case ConsoleKeyEx.A:
- return ConsoleKey.A;
- case ConsoleKeyEx.S:
- return ConsoleKey.S;
- case ConsoleKeyEx.D:
- return ConsoleKey.D;
- case ConsoleKeyEx.F:
- return ConsoleKey.F;
- case ConsoleKeyEx.G:
- return ConsoleKey.G;
- case ConsoleKeyEx.H:
- return ConsoleKey.H;
- case ConsoleKeyEx.J:
- return ConsoleKey.J;
- case ConsoleKeyEx.K:
- return ConsoleKey.K;
- case ConsoleKeyEx.L:
- return ConsoleKey.L;
- case ConsoleKeyEx.Z:
- return ConsoleKey.Z;
- case ConsoleKeyEx.X:
- return ConsoleKey.X;
- case ConsoleKeyEx.C:
- return ConsoleKey.C;
- case ConsoleKeyEx.V:
- return ConsoleKey.V;
- case ConsoleKeyEx.B:
- return ConsoleKey.B;
- case ConsoleKeyEx.N:
- return ConsoleKey.N;
- case ConsoleKeyEx.M:
- return ConsoleKey.M;
- case ConsoleKeyEx.Spacebar:
- return ConsoleKey.Spacebar;
- case ConsoleKeyEx.Insert:
- return ConsoleKey.Insert;
- case ConsoleKeyEx.Home:
- return ConsoleKey.Home;
- case ConsoleKeyEx.PageUp:
- return ConsoleKey.PageUp;
- case ConsoleKeyEx.Delete:
- return ConsoleKey.Delete;
- case ConsoleKeyEx.End:
- return ConsoleKey.End;
- case ConsoleKeyEx.PageDown:
- return ConsoleKey.PageDown;
- case ConsoleKeyEx.UpArrow:
- return ConsoleKey.UpArrow;
- case ConsoleKeyEx.DownArrow:
- return ConsoleKey.DownArrow;
- case ConsoleKeyEx.LeftArrow:
- return ConsoleKey.LeftArrow;
- case ConsoleKeyEx.RightArrow:
- return ConsoleKey.RightArrow;
- case ConsoleKeyEx.Sleep:
- return ConsoleKey.Sleep;
- case ConsoleKeyEx.BiggerThan:
- case ConsoleKeyEx.ExclamationPoint:
- case ConsoleKeyEx.Period:
- return ConsoleKey.OemPeriod;
- case ConsoleKeyEx.LowerThan:
- case ConsoleKeyEx.Comma:
- return ConsoleKey.OemComma;
- case ConsoleKeyEx.NumPeriod:
- return ConsoleKey.Decimal;
- case ConsoleKeyEx.NumEnter:
- return ConsoleKey.Enter;
- case ConsoleKeyEx.Num0:
- return ConsoleKey.D0;
- case ConsoleKeyEx.Num1:
- return ConsoleKey.D1;
- case ConsoleKeyEx.Num2:
- return ConsoleKey.D2;
- case ConsoleKeyEx.Num3:
- return ConsoleKey.D3;
- case ConsoleKeyEx.Num4:
- return ConsoleKey.D4;
- case ConsoleKeyEx.Num5:
- return ConsoleKey.D5;
- case ConsoleKeyEx.Num6:
- return ConsoleKey.D6;
- case ConsoleKeyEx.Num7:
- return ConsoleKey.D7;
- case ConsoleKeyEx.Num8:
- return ConsoleKey.D8;
- case ConsoleKeyEx.Num9:
- return ConsoleKey.D9;
- case ConsoleKeyEx.NumDivide:
- return ConsoleKey.Divide;
- case ConsoleKeyEx.NumMultiply:
- return ConsoleKey.Multiply;
- case ConsoleKeyEx.NumMinus:
- return ConsoleKey.OemMinus;
- case ConsoleKeyEx.NumPlus:
- return ConsoleKey.OemPlus;
- case ConsoleKeyEx.Backslash:
- return ConsoleKey.Oem5;
- case ConsoleKeyEx.LBracket:
- return ConsoleKey.Oem4;
- case ConsoleKeyEx.RBracket:
- return ConsoleKey.Oem6;
- case ConsoleKeyEx.Minus:
- return ConsoleKey.OemMinus;
- case ConsoleKeyEx.Apostrophe:
- return ConsoleKey.Oem7;
- case ConsoleKeyEx.Slash:
- return ConsoleKey.Oem2;
- case ConsoleKeyEx.Equal:
- return ConsoleKey.OemPlus;
- case ConsoleKeyEx.Backquote:
- return ConsoleKey.Oem3;
- case ConsoleKeyEx.Semicolon:
- case ConsoleKeyEx.Colon:
- return ConsoleKey.Oem1;
- case ConsoleKeyEx.OEM102:
- return ConsoleKey.Oem102;
- case ConsoleKeyEx.LWin:
- return ConsoleKey.LeftWindows;
- case ConsoleKeyEx.RWin:
- return ConsoleKey.RightWindows;
- default:
- throw new Exception("KeyEx not implemented!");
- }
+ return keyEx switch {
+ ConsoleKeyEx.NoName => ConsoleKey.NoName,
+ ConsoleKeyEx.Escape => ConsoleKey.Escape,
+ ConsoleKeyEx.F1 => ConsoleKey.F1,
+ ConsoleKeyEx.F2 => ConsoleKey.F2,
+ ConsoleKeyEx.F3 => ConsoleKey.F3,
+ ConsoleKeyEx.F4 => ConsoleKey.F4,
+ ConsoleKeyEx.F5 => ConsoleKey.F5,
+ ConsoleKeyEx.F6 => ConsoleKey.F6,
+ ConsoleKeyEx.F7 => ConsoleKey.F7,
+ ConsoleKeyEx.F8 => ConsoleKey.F8,
+ ConsoleKeyEx.F9 => ConsoleKey.F9,
+ ConsoleKeyEx.F10 => ConsoleKey.F10,
+ ConsoleKeyEx.F11 => ConsoleKey.F11,
+ ConsoleKeyEx.F12 => ConsoleKey.F12,
+ ConsoleKeyEx.PrintScreen => ConsoleKey.PrintScreen,
+ ConsoleKeyEx.D1 => ConsoleKey.D1,
+ ConsoleKeyEx.D2 => ConsoleKey.D2,
+ ConsoleKeyEx.D3 => ConsoleKey.D3,
+ ConsoleKeyEx.D4 => ConsoleKey.D4,
+ ConsoleKeyEx.D5 => ConsoleKey.D5,
+ ConsoleKeyEx.D6 => ConsoleKey.D6,
+ ConsoleKeyEx.D7 => ConsoleKey.D7,
+ ConsoleKeyEx.D8 => ConsoleKey.D8,
+ ConsoleKeyEx.D9 => ConsoleKey.D9,
+ ConsoleKeyEx.D0 => ConsoleKey.D0,
+ ConsoleKeyEx.Backspace => ConsoleKey.Backspace,
+ ConsoleKeyEx.Tab => ConsoleKey.Tab,
+ ConsoleKeyEx.Q => ConsoleKey.Q,
+ ConsoleKeyEx.W => ConsoleKey.W,
+ ConsoleKeyEx.E => ConsoleKey.E,
+ ConsoleKeyEx.R => ConsoleKey.R,
+ ConsoleKeyEx.T => ConsoleKey.T,
+ ConsoleKeyEx.Y => ConsoleKey.Y,
+ ConsoleKeyEx.U => ConsoleKey.U,
+ ConsoleKeyEx.I => ConsoleKey.I,
+ ConsoleKeyEx.O => ConsoleKey.O,
+ ConsoleKeyEx.P => ConsoleKey.P,
+ ConsoleKeyEx.Enter => ConsoleKey.Enter,
+ ConsoleKeyEx.A => ConsoleKey.A,
+ ConsoleKeyEx.S => ConsoleKey.S,
+ ConsoleKeyEx.D => ConsoleKey.D,
+ ConsoleKeyEx.F => ConsoleKey.F,
+ ConsoleKeyEx.G => ConsoleKey.G,
+ ConsoleKeyEx.H => ConsoleKey.H,
+ ConsoleKeyEx.J => ConsoleKey.J,
+ ConsoleKeyEx.K => ConsoleKey.K,
+ ConsoleKeyEx.L => ConsoleKey.L,
+ ConsoleKeyEx.Z => ConsoleKey.Z,
+ ConsoleKeyEx.X => ConsoleKey.X,
+ ConsoleKeyEx.C => ConsoleKey.C,
+ ConsoleKeyEx.V => ConsoleKey.V,
+ ConsoleKeyEx.B => ConsoleKey.B,
+ ConsoleKeyEx.N => ConsoleKey.N,
+ ConsoleKeyEx.M => ConsoleKey.M,
+ ConsoleKeyEx.Spacebar => ConsoleKey.Spacebar,
+ ConsoleKeyEx.Insert => ConsoleKey.Insert,
+ ConsoleKeyEx.Home => ConsoleKey.Home,
+ ConsoleKeyEx.PageUp => ConsoleKey.PageUp,
+ ConsoleKeyEx.Delete => ConsoleKey.Delete,
+ ConsoleKeyEx.End => ConsoleKey.End,
+ ConsoleKeyEx.PageDown => ConsoleKey.PageDown,
+ ConsoleKeyEx.UpArrow => ConsoleKey.UpArrow,
+ ConsoleKeyEx.DownArrow => ConsoleKey.DownArrow,
+ ConsoleKeyEx.LeftArrow => ConsoleKey.LeftArrow,
+ ConsoleKeyEx.RightArrow => ConsoleKey.RightArrow,
+ ConsoleKeyEx.Sleep => ConsoleKey.Sleep,
+ ConsoleKeyEx.BiggerThan or ConsoleKeyEx.ExclamationPoint or ConsoleKeyEx.Period => ConsoleKey.OemPeriod,
+ ConsoleKeyEx.LowerThan or ConsoleKeyEx.Comma => ConsoleKey.OemComma,
+ ConsoleKeyEx.NumPeriod => ConsoleKey.Decimal,
+ ConsoleKeyEx.NumEnter => ConsoleKey.Enter,
+ ConsoleKeyEx.Num0 => ConsoleKey.D0,
+ ConsoleKeyEx.Num1 => ConsoleKey.D1,
+ ConsoleKeyEx.Num2 => ConsoleKey.D2,
+ ConsoleKeyEx.Num3 => ConsoleKey.D3,
+ ConsoleKeyEx.Num4 => ConsoleKey.D4,
+ ConsoleKeyEx.Num5 => ConsoleKey.D5,
+ ConsoleKeyEx.Num6 => ConsoleKey.D6,
+ ConsoleKeyEx.Num7 => ConsoleKey.D7,
+ ConsoleKeyEx.Num8 => ConsoleKey.D8,
+ ConsoleKeyEx.Num9 => ConsoleKey.D9,
+ ConsoleKeyEx.NumDivide => ConsoleKey.Divide,
+ ConsoleKeyEx.NumMultiply => ConsoleKey.Multiply,
+ ConsoleKeyEx.NumMinus => ConsoleKey.OemMinus,
+ ConsoleKeyEx.NumPlus => ConsoleKey.OemPlus,
+ ConsoleKeyEx.Backslash => ConsoleKey.Oem5,
+ ConsoleKeyEx.LBracket => ConsoleKey.Oem4,
+ ConsoleKeyEx.RBracket => ConsoleKey.Oem6,
+ ConsoleKeyEx.Minus => ConsoleKey.OemMinus,
+ ConsoleKeyEx.Apostrophe => ConsoleKey.Oem7,
+ ConsoleKeyEx.Slash => ConsoleKey.Oem2,
+ ConsoleKeyEx.Equal => ConsoleKey.OemPlus,
+ ConsoleKeyEx.Backquote => ConsoleKey.Oem3,
+ ConsoleKeyEx.Semicolon or ConsoleKeyEx.Colon => ConsoleKey.Oem1,
+ ConsoleKeyEx.OEM102 => ConsoleKey.Oem102,
+ ConsoleKeyEx.LWin => ConsoleKey.LeftWindows,
+ ConsoleKeyEx.RWin => ConsoleKey.RightWindows,
+ _ => throw new Exception($"The given key enumeration value '{keyEx}' is unrecognized or cannot be converted to a ConsoleKey."),
+ };
}
}
}
diff --git a/source/Cosmos.System2/Keyboard/KeyEvent.cs b/source/Cosmos.System2/Keyboard/KeyEvent.cs
index d81d498785..12293d9e40 100644
--- a/source/Cosmos.System2/Keyboard/KeyEvent.cs
+++ b/source/Cosmos.System2/Keyboard/KeyEvent.cs
@@ -3,12 +3,12 @@
namespace Cosmos.System
{
///
- /// KeyEvent class. Represent key event.
+ /// Represents a key-press event.
///
public class KeyEvent
{
///
- /// Key event type.
+ /// Represents the type of the a .
///
public enum KeyEventType
{
@@ -16,79 +16,70 @@ public enum KeyEventType
Break
}
- // todo: once Github issue #137 is fixed, replace this class with ConsoleKeyInfo struct.
- // Well, this one has more features
+ // TODO: As GitHub issue #137 is fixed, this can be replaced with the ConsoleKeyInfo struct.
///
- /// Get and set key char.
+ /// The text character of the key-press event.
///
- public char KeyChar
- {
- get;
- set;
- }
+ public char KeyChar { get; set; }
///
- /// Get and set key.
+ /// The virtual key of the key-press event.
///
- public ConsoleKeyEx Key
- {
- get;
- set;
- }
+ public ConsoleKeyEx Key { get; set; }
///
- /// Get and set console modifiers.
+ /// The modifiers of the key-press event.
///
- public ConsoleModifiers Modifiers
- {
- get;
- set;
- }
+ public ConsoleModifiers Modifiers { get; set;}
///
- /// Get and set key event type.
+ /// The type of the key-press event.
///
public KeyEventType Type { get; set; }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
public KeyEvent()
{
KeyChar = '\0';
Key = ConsoleKeyEx.NoName;
- this.Modifiers = (ConsoleModifiers)0;
+ Modifiers = 0;
Type = KeyEventType.Make;
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Key char.
- /// Key.
- /// Shift.
- /// Alt.
- /// Ctrl.
- /// Type.
+ /// The text character.
+ /// The virtual key.
+ /// Whether the Shift key was pressed.
+ /// Whether the Alt key was pressed.
+ /// Whether the Control (Ctrl) key was pressed.
+ /// The type of the .
public KeyEvent(char keyChar, ConsoleKeyEx key, bool shift, bool alt, bool control, KeyEventType type)
{
- this.KeyChar = keyChar;
- this.Key = key;
- this.Modifiers = (ConsoleModifiers)0;
+ KeyChar = keyChar;
+ Key = key;
+ Modifiers = (ConsoleModifiers)0;
+
if (shift)
{
- this.Modifiers |= ConsoleModifiers.Shift;
+ Modifiers |= ConsoleModifiers.Shift;
}
+
if (alt)
{
- this.Modifiers |= ConsoleModifiers.Alt;
+ Modifiers |= ConsoleModifiers.Alt;
}
+
if (control)
{
- this.Modifiers |= ConsoleModifiers.Control;
+ Modifiers |= ConsoleModifiers.Control;
}
- this.Type = type;
+
+ Type = type;
}
}
}
diff --git a/source/Cosmos.System2/Keyboard/KeyMapping.cs b/source/Cosmos.System2/Keyboard/KeyMapping.cs
index 606d295a97..5895a03d03 100644
--- a/source/Cosmos.System2/Keyboard/KeyMapping.cs
+++ b/source/Cosmos.System2/Keyboard/KeyMapping.cs
@@ -1,280 +1,180 @@
+#pragma warning disable IDE0049 // Use framework type
+
namespace Cosmos.System
{
///
- /// KeyMapping class. Used to map keyboard.
+ /// Represents a physical to virtual key mapping.
///
public class KeyMapping
{
///
- /// Scan code.
+ /// The physical scan-code that the mapping refers to.
///
- public byte Scancode;
+ public byte ScanCode;
///
- /// Value.
+ /// The text character value of the key with no modifiers active.
///
public char Value;
///
- /// Shift.
+ /// The text character value of the key with the Control
+ /// (Ctrl) key modifier being active.
///
- public char Shift;
+ public char Control;
///
- /// Num.
+ /// The text character value of the key with the Shift
+ /// key modifier being active.
///
- public char Num;
+ public char Shift;
///
- /// Caps.
+ /// The text character value of the key with the Num Lock
+ /// key modifier being active.
///
- public char Caps;
+ public char NumLock;
///
- /// Shift and Caps.
+ /// The text character value of the key with the Caps Lock
+ /// key modifier being active.
///
- public char ShiftCaps;
+ public char CapsLock;
///
- /// Shift and Num.
+ /// The text character value of the key with both the Caps Lock
+ /// and Num Lock key modifiers being active.
///
- public char ShiftNum;
+ public char ShiftCapsLock;
///
- /// Ctrl.
+ /// The text character value of the key with both the Shift
+ /// and Num Lock key modifiers being active.
///
- public char Control;
+ public char ShiftNumLock;
///
- /// Ctrl and Alt.
+ /// The text character value of the key with both the Control
+ /// and Alt key modifiers being active.
///
public char ControlAlt;
///
- /// Ctrl and Shift.
+ /// The text character value of the key with both the Control
+ /// and Shift key modifiers being active.
///
public char ControlShift;
///
- /// Ctrl, Alt and Shift.
+ /// The text character value of the key with both the Control,
+ /// Alt, and Shift key modifiers being active.
///
public char ControlAltShift;
///
- /// Key.
+ /// The virtual key that the physical key-press maps to.
///
public ConsoleKeyEx Key;
///
- /// NumLock key.
+ /// The virtual key that the physical key-press maps to when
+ /// the Num Lock modifier is active.
///
public ConsoleKeyEx NumLockKey;
///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// Ctrl and Alt.
- /// Ctrl, Alt and Shift.
- /// Ctrl.
- /// Shift and Ctrl.
- /// A key.
- /// NumLock key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, char altgr, char shiftaltgr, char ctrl, char shiftctrl, ConsoleKeyEx aKey, ConsoleKeyEx numKey)
+ /// Initializes a new instance of the class.
+ ///
+ /// The physical scan code of the key.
+ /// The text character value of the key with no modifiers being active.
+ /// The text character value of the key with the Shift modifier being active.
+ /// The text character value of the key with the Num Lock modifier being active.
+ /// The text character value of the key with the Caps Lock modifier being active.
+ /// The text character value of the key with the Shift and Caps Lock modifiers being active.
+ /// The text character value of the key with the Shift and Num Lock modifiers being active
+ /// The text character value of the key with the Control and Alt modifiers being active.
+ /// The text character value of the key with the Control, Alt, and Shift modifiers being active
+ /// The text character value of the key with the Control modifier being active.
+ /// The text character value of the key with the Shift and Control modifiers being active.
+ /// The virtual key that the physical key-press maps to.
+ /// The virtual key that the physical key-press maps to when the Num Lock modifier is active..
+ public KeyMapping(byte scanCode, char normal, char shift, char num, char caps, char shiftCapsLock, char shiftNumLock, char ctrlAlt, char ctrlAltShift, char ctrl, char shiftCtrl, ConsoleKeyEx key, ConsoleKeyEx numKey)
{
- Scancode = aScanCode;
- Value = norm;
+ ScanCode = scanCode;
+ Value = normal;
Shift = shift;
- Num = num;
- Caps = caps;
- ShiftCaps = shiftcaps;
- ShiftNum = shiftnum;
- Key = aKey;
- NumLockKey = aKey;
- ControlAlt = altgr;
+ NumLock = num;
+ CapsLock = caps;
+ ShiftCapsLock = shiftCapsLock;
+ ShiftNumLock = shiftNumLock;
+ Key = key;
+ NumLockKey = key;
+ ControlAlt = ctrlAlt;
Control = ctrl;
- ControlAltShift = shiftaltgr;
- ControlShift = shiftctrl;
+ ControlAltShift = ctrlAltShift;
+ ControlShift = shiftCtrl;
NumLockKey = numKey;
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// Ctrl and Alt.
- /// Ctrl, Alt and Shift.
- /// A key.
- /// NumLock key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, char altgr, char shiftaltgr, ConsoleKeyEx aKey, ConsoleKeyEx numKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, altgr, shiftaltgr, '\0', '\0', aKey, numKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char numLock, char capsLock, char shiftCapsLock, char shiftNumLock, char ctrlAlt, char ctrlAltShift, ConsoleKeyEx key, ConsoleKeyEx numKey)
+ : this(scanCode, normal, shift, numLock, capsLock, shiftCapsLock, shiftNumLock, ctrlAlt, ctrlAltShift, '\0', '\0', key, numKey)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// Ctrl and Alt.
- /// A key.
- /// NumLock key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, char altgr, ConsoleKeyEx aKey, ConsoleKeyEx numKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, altgr, '\0', '\0', '\0', aKey, numKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char numLock, char capsLock, char shiftCapsLock, char shiftNumLock, char ctrlAlt, ConsoleKeyEx key, ConsoleKeyEx numKey)
+ : this(scanCode, normal, shift, numLock, capsLock, shiftCapsLock, shiftNumLock, ctrlAlt, '\0', '\0', '\0', key, numKey)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// Ctrl and Alt.
- /// Ctrl, Alt and Shift.
- /// Ctrl.
- /// Shift and Ctrl.
- /// A key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, char altgr, char shiftaltgr, char ctrl, char shiftctrl, ConsoleKeyEx aKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, altgr, shiftaltgr, ctrl, shiftctrl, aKey, aKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char numLock, char capsLock, char shiftCapsLock, char shiftNumLock, char ctrlAlt, char ctrlAltShift, char ctrl, char shiftCtrl, ConsoleKeyEx key)
+ : this(scanCode, normal, shift, numLock, capsLock, shiftCapsLock, shiftNumLock, ctrlAlt, ctrlAltShift, ctrl, shiftCtrl, key, key)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// Ctrl and Alt.
- /// Ctrl, Alt and Shift.
- /// A key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, char altgr, char shiftaltgr, ConsoleKeyEx aKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, altgr, shiftaltgr, '\0', '\0', aKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char numLock, char capsLock, char shiftCapsLock, char shiftNumLock, char ctrlAlt, char ctrlAltShift, ConsoleKeyEx aKey)
+ : this(scanCode, normal, shift, numLock, capsLock, shiftCapsLock, shiftNumLock, ctrlAlt, ctrlAltShift, '\0', '\0', aKey)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// Ctrl and Alt.
- /// A key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, char altgr, ConsoleKeyEx aKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, altgr, '\0', '\0', '\0', aKey)
- {
- }
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// A key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, ConsoleKeyEx aKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, '\0', '\0', '\0', '\0', aKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char num, char capsLock, char shiftCapsLock, char shiftNumLock, char ctrlAlt, ConsoleKeyEx key)
+ : this(scanCode, normal, shift, num, capsLock, shiftCapsLock, shiftNumLock, ctrlAlt, '\0', '\0', '\0', key)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// A key.
- /// NumLock key.
- public KeyMapping(byte aScanCode, char norm, char shift, char num, char caps, char shiftcaps, char shiftnum, ConsoleKeyEx aKey, ConsoleKeyEx numKey)
- : this(aScanCode, norm, shift, num, caps, shiftcaps, shiftnum, '\0', aKey, numKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char numLock, char capsLock, char shiftCapsLock, char shiftNumLock, ConsoleKeyEx key)
+ : this(scanCode, normal, shift, numLock, capsLock, shiftCapsLock, shiftNumLock, '\0', '\0', '\0', '\0', key)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Norm.
- /// Shift.
- /// Num.
- /// Caps.
- /// Shift and Caps.
- /// Shift and Num
- /// A key.
- public KeyMapping(byte aScanCode, int norm, int shift, int num, int caps, int shiftcaps, int shiftnum, ConsoleKeyEx aKey)
- : this(aScanCode, (char)norm, (char)shift, (char)num, (char)caps, (char)shiftcaps, (char)shiftnum, aKey)
+ ///
+ public KeyMapping(byte scanCode, char normal, char shift, char numLock, char capsLock, char shiftCapsLock, char shiftNumLock, ConsoleKeyEx key, ConsoleKeyEx numKey)
+ : this(scanCode, normal, shift, numLock, capsLock, shiftCapsLock, shiftNumLock, '\0', key, numKey)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// Num.
- /// A key.
- /// NumLock key.
- public KeyMapping(byte aScanCode, char num, ConsoleKeyEx aKey, ConsoleKeyEx numKey)
- : this(aScanCode, '\0', '\0', num, '\0', '\0', '\0', aKey, numKey)
+ ///
+ public KeyMapping(byte scanCode, char numLock, ConsoleKeyEx key, ConsoleKeyEx numKey)
+ : this(scanCode, '\0', '\0', numLock, '\0', '\0', '\0', key, numKey)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// All control keys char.
- /// A key.
- public KeyMapping(byte aScanCode, char n, ConsoleKeyEx aKey)
- : this(aScanCode, n, n, n, n, n, n, aKey)
+ ///
+ /// The character to use for all of the text character fields.
+ public KeyMapping(byte scanCode, char n, ConsoleKeyEx key)
+ : this(scanCode, n, n, n, n, n, n, key)
{
}
- ///
- /// Create new instance of the class.
- ///
- /// A scan code.
- /// A key.
- public KeyMapping(byte aScanCode, ConsoleKeyEx aKey)
- : this(aScanCode, '\0', '\0', '\0', '\0', '\0', '\0', aKey)
+ ///
+ public KeyMapping(byte scanCode, ConsoleKeyEx key)
+ : this(scanCode, '\0', '\0', '\0', '\0', '\0', '\0', key)
{
}
}
diff --git a/source/Cosmos.System2/Keyboard/KeyboardManager.cs b/source/Cosmos.System2/Keyboard/KeyboardManager.cs
index 59d8751a5f..1e9c10541e 100644
--- a/source/Cosmos.System2/Keyboard/KeyboardManager.cs
+++ b/source/Cosmos.System2/Keyboard/KeyboardManager.cs
@@ -1,57 +1,55 @@
using System.Collections.Generic;
using Cosmos.HAL;
using Cosmos.System.ScanMaps;
+using System;
namespace Cosmos.System
{
///
- /// Keyboard manager class. Used to manage keyboard.
+ /// Manages the physical keyboard.
///
public static class KeyboardManager
{
+ readonly static List keyboardList = new();
+ readonly static Queue queuedKeys = new();
+ static ScanMapBase scanMap = new USStandardLayout();
+
///
- /// Get and set NumLock.
+ /// The num-lock state.
///
public static bool NumLock { get; set; }
///
- /// Get and set CapsLock.
+ /// The caps-lock state.
///
public static bool CapsLock { get; set; }
///
- /// Get and set ScrollLock.
+ /// The scroll-lock state.
///
public static bool ScrollLock { get; set; }
///
- /// Get and set Ctrl pressed.
+ /// Whether the Control (Ctrl) key is currently pressed.
///
public static bool ControlPressed { get; set; }
///
- /// Get and set Shift pressed.
+ /// Whether the Shift key is currently pressed.
///
public static bool ShiftPressed { get; set; }
///
- /// Get and set Alt pressed.
+ /// Whether the Alt key is currently pressed.
///
public static bool AltPressed { get; set; }
///
- /// Get if queued keys exists.
+ /// Whether a keyboard input is pending to be processed; i.e, whether the queued
+ /// key-press buffer is not empty.
///
- public static bool KeyAvailable => mQueuedKeys.Count > 0;
-
- private static List mKeyboardList = new List();
- private static ScanMapBase mScanMap = new US_Standard();
- private static Queue mQueuedKeys = new Queue();
+ public static bool KeyAvailable => queuedKeys.Count > 0;
- ///
- /// Create new instance of the class.
- ///
- /// An I/O error occurred.
static KeyboardManager()
{
foreach (var keyboard in HAL.Global.GetKeyboardDevices())
@@ -61,63 +59,61 @@ static KeyboardManager()
}
///
- /// Enqueue keyEvent.
+ /// Enqueues the given key-press event to the internal keyboard buffer.
///
- /// KeyEvent to enqueue.
+ /// The to enqueue.
private static void Enqueue(KeyEvent keyEvent)
{
- mQueuedKeys.Enqueue(keyEvent);
+ queuedKeys.Enqueue(keyEvent);
}
///
- /// Allow faking scancodes. Used for test kernels
+ /// Handles an emulated key-press by its scan-code. Used for test kernels
///
- /// A scan code.
- /// Key released.
- /// An I/O error occurred.
- internal static void HandleFakeScanCode(byte aScancode, bool aReleased)
+ /// The scan code of the virtual key-press.
+ /// Whether the key has been pressed or released.
+ /// An I/O error has occurred.
+ internal static void HandleFakeScanCode(byte scanCode, bool released)
{
- HandleScanCode(aScancode, aReleased);
+ HandleScanCode(scanCode, released);
}
///
- /// Handle scan code. Used to update LEDs,
+ /// Handles a key-press by its physical key scan-code.
///
- /// A scan code.
- /// Key released.
- /// An I/O error occurred.
+ /// The physical scan code of the key-press.
+ /// Whether the key has been pressed or released.
+ /// An I/O error occurred.
private static void HandleScanCode(byte aScanCode, bool aReleased)
{
- Global.mDebugger.Send("KeyboardManager.HandleScanCode");
-
byte key = aScanCode;
- if (mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.CapsLock) && !aReleased)
+ if (scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.CapsLock) && !aReleased)
{
// caps lock
CapsLock = !CapsLock;
UpdateLeds();
}
- else if (mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.NumLock) && !aReleased)
+ else if (scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.NumLock) && !aReleased)
{
// num lock
NumLock = !NumLock;
UpdateLeds();
}
- else if (mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.ScrollLock) && !aReleased)
+ else if (scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.ScrollLock) && !aReleased)
{
// scroll lock
ScrollLock = !ScrollLock;
UpdateLeds();
}
- else if (mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.LCtrl) || mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.RCtrl))
+ else if (scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.LCtrl) || scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.RCtrl))
{
ControlPressed = !aReleased;
}
- else if (mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.LShift) || mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.RShift))
+ else if (scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.LShift) || scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.RShift))
{
ShiftPressed = !aReleased;
}
- else if (mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.LAlt) || mScanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.RAlt))
+ else if (scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.LAlt) || scanMap.ScanCodeMatchesKey(key, ConsoleKeyEx.RAlt))
{
AltPressed = !aReleased;
}
@@ -125,9 +121,7 @@ private static void HandleScanCode(byte aScanCode, bool aReleased)
{
if (!aReleased)
{
- KeyEvent keyInfo;
-
- if (GetKey(key, out keyInfo))
+ if (GetKey(key, out var keyInfo))
{
Enqueue(keyInfo);
}
@@ -136,100 +130,92 @@ private static void HandleScanCode(byte aScanCode, bool aReleased)
}
///
- /// Update keyboard LEDs.
+ /// Updates the keyboard's LEDs.
///
private static void UpdateLeds()
{
- foreach (KeyboardBase keyboard in mKeyboardList)
+ foreach (KeyboardBase keyboard in keyboardList)
{
keyboard.UpdateLeds();
}
}
///
- /// Get key pressed.
+ /// Attempts to convert the given physical key scan-code to a
+ /// instance.
///
- /// A scan code.
- /// KeyEvent output.
- /// bool value.
- public static bool GetKey(byte aScancode, out KeyEvent keyInfo)
+ /// The scan-code of the physical key.
+ /// The resulting .
+ /// if the operation succeded and holds a non-null value; otherwise, .
+ public static bool GetKey(byte scanCode, out KeyEvent keyInfo)
{
- if (mScanMap == null)
- {
- Global.mDebugger.Send("No KeyLayout");
- }
-
- keyInfo = mScanMap.ConvertScanCode(aScancode, ControlPressed, ShiftPressed, AltPressed, NumLock, CapsLock, ScrollLock);
-
+ keyInfo = scanMap.ConvertScanCode(scanCode, ControlPressed, ShiftPressed, AltPressed, NumLock, CapsLock, ScrollLock);
return keyInfo != null;
}
///
- /// Try read key.
+ /// If available, reads the next key from the pending key-press keyboard buffer,
+ /// and removes it from said buffer.
///
- /// Output KeyEvent.
- /// bool value.
- /// Thrown when queue is empty.
- public static bool TryReadKey(out KeyEvent oKey)
+ /// The pending key-press.
+ /// if a key-press was pending and has been dequeued to ; otherwise, .
+ public static bool TryReadKey(out KeyEvent key)
{
- if (mQueuedKeys.Count > 0)
+ if (queuedKeys.Count > 0)
{
- oKey = mQueuedKeys.Dequeue();
+ key = queuedKeys.Dequeue();
return true;
}
- oKey = default(KeyEvent);
-
+ key = default;
return false;
}
///
- /// Read key.
+ /// Reads the next key from the pending key-press keyboard buffer, and
+ /// removes it from said buffer.
///
- /// KeyEvent value.
- /// Thrown when queue is empty.
+ /// The pending key-press.
+ /// Thrown when the queue is empty.
public static KeyEvent ReadKey()
{
- while (mQueuedKeys.Count == 0)
+ while (queuedKeys.Count == 0)
{
KeyboardBase.WaitForKey();
}
- return mQueuedKeys.Dequeue();
+ return queuedKeys.Dequeue();
}
///
- /// Get key layout.
+ /// Gets the currently used keyboard layout.
///
- /// ScanMapBase value.
public static ScanMapBase GetKeyLayout()
{
- return mScanMap;
+ return scanMap;
}
///
- /// Set key layout.
+ /// Sets the currently used keyboard layout.
///
- /// A scan map
- public static void SetKeyLayout(ScanMapBase aScanMap)
+ /// The keyboard scan map to use.
+ public static void SetKeyLayout(ScanMapBase scanMap)
{
- if (aScanMap != null)
+ if (scanMap != null)
{
- mScanMap = aScanMap;
+ KeyboardManager.scanMap = scanMap;
}
}
///
- /// Add keyboard
+ /// Registers the given physical keyboard device.
///
- /// A keyboard to add.
- /// An I/O error occurred.
- private static void AddKeyboard(KeyboardBase aKeyboard)
+ /// The keyboard device to add.
+ private static void AddKeyboard(KeyboardBase keyboard)
{
- Global.mDebugger.Send("KeyboardManager.AddKeyboard");
-
- aKeyboard.OnKeyPressed = HandleScanCode;
- mKeyboardList.Add(aKeyboard);
+ Global.Debugger.Send($"Registering physical keyboard device #{keyboardList.Count + 1}.");
+ keyboard.OnKeyPressed = HandleScanCode;
+ keyboardList.Add(keyboard);
}
}
}
diff --git a/source/Cosmos.System2/Keyboard/ScanMapBase.cs b/source/Cosmos.System2/Keyboard/ScanMapBase.cs
index c18995f1f9..ece6e247dd 100644
--- a/source/Cosmos.System2/Keyboard/ScanMapBase.cs
+++ b/source/Cosmos.System2/Keyboard/ScanMapBase.cs
@@ -1,28 +1,25 @@
using System;
using System.Collections.Generic;
-using Cosmos.Debug.Kernel;
-using Cosmos.HAL;
-
namespace Cosmos.System
{
///
- /// ScanMapBase abstract class.
+ /// Represents the base class for keyboard layout scan-maps.
///
public abstract class ScanMapBase
{
///
- /// Keys list.
+ /// The available key mappings.
///
- protected List _keys;
+ protected List Keys;
///
- /// Init keys list.
+ /// Initializes the key list.
///
protected abstract void InitKeys();
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
protected ScanMapBase()
{
@@ -30,93 +27,99 @@ protected ScanMapBase()
}
///
- /// Convert scan code to KeyEvent.
+ /// Converts the given scan code to a instance.
///
- /// Scaned key.
- /// Ctrl pressed.
- /// Shift pressed.
- /// Alt pressed.
- /// Num pressed.
- /// Caps pressed.
- /// Scroll pressed.
- /// KeyEvent value.
- public KeyEvent ConvertScanCode(byte scan2, bool ctrl, bool shift, bool alt, bool num, bool caps, bool scroll)
+ /// The scanned (pressed) key.
+ /// Whether the Control (Ctrl) key is pressed.
+ /// Whether the Shift key is pressed.
+ /// Whether the Alt key is pressed.
+ /// Whether num-lock is active.
+ /// Whether caps-lock is active.
+ /// Whether scroll-lock is active.
+ /// The translated .
+ public KeyEvent ConvertScanCode(byte scanKey, bool ctrl, bool shift, bool alt, bool numLock, bool capsLock, bool scrollLock)
{
- KeyEvent keyev = new KeyEvent();
+ var keyEvent = new KeyEvent();
bool found = false;
- if (scan2 == 0)
+ if (scanKey == 0)
{
- found = true;
- return keyev;
+ return keyEvent;
}
- byte scan = scan2;
+ byte scan = scanKey;
- if (alt) keyev.Modifiers |= ConsoleModifiers.Alt;
- if (ctrl) keyev.Modifiers |= ConsoleModifiers.Control;
- if (shift) keyev.Modifiers |= ConsoleModifiers.Shift;
+ if (alt) keyEvent.Modifiers |= ConsoleModifiers.Alt;
+ if (ctrl) keyEvent.Modifiers |= ConsoleModifiers.Control;
+ if (shift) keyEvent.Modifiers |= ConsoleModifiers.Shift;
- keyev.Type = (scan & 0x80) != 0 ? KeyEvent.KeyEventType.Break : KeyEvent.KeyEventType.Make;
+ keyEvent.Type = (scan & 0x80) != 0 ? KeyEvent.KeyEventType.Break : KeyEvent.KeyEventType.Make;
if ((scan & 0x80) != 0)
+ {
scan = (byte)(scan ^ 0x80);
+ }
- Global.mDebugger.Send("Number of keys: ");
- Global.mDebugger.SendNumber((uint) _keys.Count);
-
- for (int index = 0; index < _keys.Count; index++)
+ for (int index = 0; index < Keys.Count; index++)
{
- KeyMapping t = _keys[index];
+ KeyMapping t = Keys[index];
if (t == null)
{
- Global.mDebugger.Send("Key received but item is NULL");
+ Global.Debugger.Send("An unmapped key input has been received; ignoring.");
continue;
}
- else if (t.Scancode == scan)
+ else if (t.ScanCode == scan)
{
found = true;
KeyMapping map = t;
- char key = '\0';
+ char key;
if (ctrl)
+ {
if (alt)
- key = shift ^ caps ? map.ControlAltShift : map.ControlAlt;
+ {
+ key = shift ^ capsLock ? map.ControlAltShift : map.ControlAlt;
+ }
else
- key = shift ^ caps ? map.ControlShift : map.Control;
+ {
+ key = shift ^ capsLock ? map.ControlShift : map.Control;
+ }
+ }
else if (shift)
- key = caps ? map.ShiftCaps
- : num ? map.ShiftNum
+ {
+ key = capsLock ? map.ShiftCapsLock
+ : numLock ? map.ShiftNumLock
: map.Shift;
- else if (caps)
- key = map.Caps;
- else if (num)
- key = map.Num;
+ }
+ else if (capsLock)
+ {
+ key = map.CapsLock;
+ }
else
- key = map.Value;
-
- keyev.KeyChar = key;
- keyev.Key = num ? t.NumLockKey : t.Key;
+ {
+ key = numLock ? map.NumLock : map.Value;
+ }
+ keyEvent.KeyChar = key;
+ keyEvent.Key = numLock ? t.NumLockKey : t.Key;
break;
}
}
- return found ? keyev : null;
+ return found ? keyEvent : null;
}
///
- /// Check if scan code matches key.
+ /// Checks if the given scan code matches the specified key.
///
- /// Scan code.
- /// Key.
- /// bool value.
- public bool ScanCodeMatchesKey(byte ScanCode, ConsoleKeyEx Key)
+ /// The physical keyboard scan-code.
+ /// The virtual mapping key.
+ public bool ScanCodeMatchesKey(byte scanCode, ConsoleKeyEx key)
{
- for (int i = 0; i < _keys.Count; i++)
+ for (int i = 0; i < Keys.Count; i++)
{
- if (_keys[i].Scancode == ScanCode && _keys[i].Key == Key)
+ if (Keys[i].ScanCode == scanCode && Keys[i].Key == key)
{
return true;
}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/DEStandardLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/DEStandardLayout.cs
new file mode 100644
index 0000000000..2d3784849a
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/DEStandardLayout.cs
@@ -0,0 +1,134 @@
+using System.Collections.Generic;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// Represents the standard German (DE) keyboard layout.
+ ///
+ public class DEStandardLayout : ScanMapBase
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DEStandardLayout()
+ {
+ }
+
+ protected override void InitKeys()
+ {
+ Keys = new List(101);
+
+ #region Keys
+
+ /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ /* ^1234567890ß´ °!"§$%&/()=?` __²³£__{[]}\_ */
+ Keys.Add(new KeyMapping(0x29, '^', '°', '^', '^', '°', '^', ConsoleKeyEx.Backquote));
+ Keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, '2', '"', '2', '2', '"', '2', '²', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '3', '§', '3', '3', '§', '3', '³', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', '£', '£', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '6', '&', '6', '6', '&', '6', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, '7', '/', '7', '7', '/', '7', '{', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '8', '(', '8', '8', '(', '8', '[', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, '9', ')', '9', '9', ')', '9', ']', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, '0', '=', '0', '0', '=', '0', '}', ConsoleKeyEx.D0));
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, 'ß', '?', 'ß', 'ß', '?', 'ß', '\\', ConsoleKeyEx.Minus));
+ Keys.Add(new KeyMapping(0x0D, '´', '`', '´', '´', '`', '´', ConsoleKeyEx.Equal));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ /* qwertzuiopü+ QWERTZUIOPÜ* @_€________~ */
+ Keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', '@', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', '€', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, 'ü', 'Ü', 'ü', 'Ü', 'ü', 'Ü', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, '+', '*', '+', '*', '+', '*', '~', ConsoleKeyEx.RBracket));
+ /* ENTER, CTRL */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* asdfghjklöä# ASDFGHJKLÖÄ' ____________ */
+ Keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, 'ö', 'Ö', 'ö', 'Ö', 'ö', 'Ö', ConsoleKeyEx.Semicolon));
+ Keys.Add(new KeyMapping(0x28, 'ä', 'Ä', 'ä', 'Ä', 'ä', 'Ä', ConsoleKeyEx.Apostrophe));
+ Keys.Add(new KeyMapping(0x29, '#', '\'', '#', '\'', '#', '\'', ConsoleKeyEx.Backslash));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ /* YXCVBNM;:_ |______µ___ */
+ Keys.Add(new KeyMapping(0x2B, '<', '>', '<', '>', '<', '>', '|', '|', ConsoleKeyEx.OEM102));
+ Keys.Add(new KeyMapping(0x2C, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', 'µ', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x33, ',', ';', ',', ';', ',', ';', ConsoleKeyEx.Comma));
+ Keys.Add(new KeyMapping(0x34, '.', ':', '.', ':', '.', ':', ConsoleKeyEx.Period));
+ Keys.Add(new KeyMapping(0x35, '-', '_', '-', '_', '-', '_', ConsoleKeyEx.Slash));
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
+ // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\b', '\b', ',', '\b', '\b', '\b', ConsoleKeyEx.Delete, ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/DE_Standard.cs b/source/Cosmos.System2/Keyboard/ScanMaps/DE_Standard.cs
deleted file mode 100644
index 21c63eab9c..0000000000
--- a/source/Cosmos.System2/Keyboard/ScanMaps/DE_Standard.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Cosmos.HAL;
-
-namespace Cosmos.System.ScanMaps
-{
- ///
- /// DE_Standard class. Represent DE_Standard keyboard layout.
- ///
- public class DE_Standard
- : ScanMapBase
- {
- ///
- /// Create new instance of the class.
- ///
- public DE_Standard()
- {
- }
-
- ///
- /// Init key list.
- ///
- protected override void InitKeys()
- {
- _keys = new List(101);
-
- #region Keys
-
- /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
- _keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
- /* ^1234567890ß´ °!"§$%&/()=?` __²³£__{[]}\_ */
- _keys.Add(new KeyMapping(0x29, '^', '°', '^', '^', '°', '^', ConsoleKeyEx.Backquote));
- _keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
- _keys.Add(new KeyMapping(0x03, '2', '"', '2', '2', '"', '2', '²', ConsoleKeyEx.D2));
- _keys.Add(new KeyMapping(0x04, '3', '§', '3', '3', '§', '3', '³', ConsoleKeyEx.D3));
- _keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', '£', '£', ConsoleKeyEx.D4));
- _keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
- _keys.Add(new KeyMapping(0x07, '6', '&', '6', '6', '&', '6', ConsoleKeyEx.D6));
- _keys.Add(new KeyMapping(0x08, '7', '/', '7', '7', '/', '7', '{', ConsoleKeyEx.D7));
- _keys.Add(new KeyMapping(0x09, '8', '(', '8', '8', '(', '8', '[', ConsoleKeyEx.D8));
- _keys.Add(new KeyMapping(0x0A, '9', ')', '9', '9', ')', '9', ']', ConsoleKeyEx.D9));
- _keys.Add(new KeyMapping(0x0B, '0', '=', '0', '0', '=', '0', '}', ConsoleKeyEx.D0));
- /* -, =, Bksp, Tab */
- _keys.Add(new KeyMapping(0x0C, 'ß', '?', 'ß', 'ß', '?', 'ß', '\\', ConsoleKeyEx.Minus));
- _keys.Add(new KeyMapping(0x0D, '´', '`', '´', '´', '`', '´', ConsoleKeyEx.Equal));
- _keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
- _keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
- /* qwertzuiopü+ QWERTZUIOPÜ* @_€________~ */
- _keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', '@', ConsoleKeyEx.Q));
- _keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
- _keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', '€', ConsoleKeyEx.E));
- _keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
- _keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
- _keys.Add(new KeyMapping(0x15, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Y));
- _keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
- _keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
- _keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
- _keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
- _keys.Add(new KeyMapping(0x1A, 'ü', 'Ü', 'ü', 'Ü', 'ü', 'Ü', ConsoleKeyEx.LBracket));
- _keys.Add(new KeyMapping(0x1B, '+', '*', '+', '*', '+', '*', '~', ConsoleKeyEx.RBracket));
- /* ENTER, CTRL */
- _keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
- _keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
- /* asdfghjklöä# ASDFGHJKLÖÄ' ____________ */
- _keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
- _keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
- _keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
- _keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
- _keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
- _keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
- _keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
- _keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
- _keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
- _keys.Add(new KeyMapping(0x27, 'ö', 'Ö', 'ö', 'Ö', 'ö', 'Ö', ConsoleKeyEx.Semicolon));
- _keys.Add(new KeyMapping(0x28, 'ä', 'Ä', 'ä', 'Ä', 'ä', 'Ä', ConsoleKeyEx.Apostrophe));
- _keys.Add(new KeyMapping(0x29, '#', '\'', '#', '\'', '#', '\'', ConsoleKeyEx.Backslash));
- /* Left Shift*/
- _keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
- /* YXCVBNM;:_ |______µ___ */
- _keys.Add(new KeyMapping(0x2B, '<', '>', '<', '>', '<', '>', '|', '|', ConsoleKeyEx.OEM102));
- _keys.Add(new KeyMapping(0x2C, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Z));
- _keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
- _keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
- _keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
- _keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
- _keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
- _keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', 'µ', ConsoleKeyEx.M));
- _keys.Add(new KeyMapping(0x33, ',', ';', ',', ';', ',', ';', ConsoleKeyEx.Comma));
- _keys.Add(new KeyMapping(0x34, '.', ':', '.', ':', '.', ':', ConsoleKeyEx.Period));
- _keys.Add(new KeyMapping(0x35, '-', '_', '-', '_', '-', '_', ConsoleKeyEx.Slash));
- /* Right Shift */
- _keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
- /* Print Screen */
- _keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
- // also numpad multiply
- /* Alt */
- _keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
- /* Space */
- _keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
- /* Caps */
- _keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
- /* F1-F12 */
- _keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
- _keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
- _keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
- _keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
- _keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
- _keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
- _keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
- _keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
- _keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
- _keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
- _keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
- _keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
- /* Num Lock, Scrl Lock */
- _keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
- _keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
- /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
- _keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
- _keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
- _keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
- _keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
- _keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
- _keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
- _keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
- _keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
- _keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
- _keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
- _keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
- _keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
- _keys.Add(new KeyMapping(0x53, '\b', '\b', ',', '\b', '\b', '\b', ConsoleKeyEx.Delete, ConsoleKeyEx.NumPeriod));
-
- _keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
- _keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
-
- #endregion
- }
- }
-}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/ESStandardLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/ESStandardLayout.cs
new file mode 100644
index 0000000000..ac850d096c
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/ESStandardLayout.cs
@@ -0,0 +1,134 @@
+using System.Collections.Generic;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// Represents the standard Spanish (ES) keyboard layout.
+ ///
+ public class ESStandardLayout : ScanMapBase
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ESStandardLayout()
+ {
+ }
+
+ protected override void InitKeys()
+ {
+ Keys = new List(105);
+
+ #region Keys
+
+ /* Scan Norm Shift Num Caps SCaps SNum AltGr ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ /* 1 -> 9 */
+ Keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '!', '|', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, '2', '"', '2', '2', '"', '"', '@', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '3', '·', '3', '3', '·', '3', '#', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', '~', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', '€', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '6', '&', '6', '6', '&', '6', '¬', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, '7', '/', '7', '7', '/', '7', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '8', '(', '8', '8', '(', '8', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, '9', ')', '9', '9', ')', '9', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, '0', '=', '0', '0', '=', '0', ConsoleKeyEx.D0));
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, '\'', '?', '\'', '-', '?', '?', ConsoleKeyEx.Minus));
+ Keys.Add(new KeyMapping(0x0D, '¡', '¿', '¡', '¡', '¿', '¿', ConsoleKeyEx.Equal));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ /* QWERTYUIOP[] */
+ Keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, '`', '^', '`', '`', '^', '^', '[', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, '+', '*', '+', '+', '*', '*', ']', ConsoleKeyEx.RBracket));
+ /* ENTER, CTRL */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* ASDFGHJKL;'` */
+ Keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, 'ñ', 'Ñ', 'ñ', 'Ñ', 'ñ', 'Ñ', ConsoleKeyEx.Semicolon));
+ Keys.Add(new KeyMapping(0x28, '´', '¨', '´', '´', '¨', '¨', '{', ConsoleKeyEx.Apostrophe));
+ Keys.Add(new KeyMapping(0x29, 'º', 'ª', 'º', 'º', 'ª', 'ª', '\\', ConsoleKeyEx.Backquote));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ /* \ZXCVBNM,./ */
+ Keys.Add(new KeyMapping(0x2B, 'ç', 'Ç', 'ç', 'Ç', 'ç', 'Ç', '}', ConsoleKeyEx.Backslash));
+ Keys.Add(new KeyMapping(0x2C, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x33, ',', ';', ',', ',', ';', ';', ConsoleKeyEx.Comma));
+ Keys.Add(new KeyMapping(0x34, '.', ':', '.', '.', ':', ':', ConsoleKeyEx.Period));
+ Keys.Add(new KeyMapping(0x35, '-', '_', '-', '-', '_', '_', ConsoleKeyEx.Slash)); //
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
+ // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete,
+ ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/FRStandardLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/FRStandardLayout.cs
new file mode 100644
index 0000000000..603be915cc
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/FRStandardLayout.cs
@@ -0,0 +1,127 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Cosmos.HAL;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// Represents the standard French (FR) keyboard layout.
+ ///
+ public class FRStandardLayout : ScanMapBase
+ {
+ protected override void InitKeys()
+ {
+ Keys = new List();
+
+ #region Keys
+ /* Scan Norm Shift Num Caps ShCaps ShNum ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ /* 1 -> 9 */
+ Keys.Add(new KeyMapping(0x02, '&', '1', '&', '1', '&', '1', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, 'é', '2', 'é', '2', 'é', '2', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '"', '3', '"', '3', '"', '3', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '\'', '4', '\'', '4', '\'', '4', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '(', '5', '(', '5', '(', '5', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '-', '6', '-', '6', '-', '6', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, 'è', '7', 'è', '7', 'è', '7', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '_', '8', '_', '8', '_', '8', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, 'ç', '9', 'ç', '9', 'ç', '9', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, 'à', '0', 'à', '0', 'à', '0', ConsoleKeyEx.D0));
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, ')', '°', ')', '°', ')', '°', ConsoleKeyEx.Minus));
+ Keys.Add(new KeyMapping(0x0D, '=', '+', '=', '+', '=', '+', ConsoleKeyEx.Equal));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ /* QWERTYUIOP[] */
+ Keys.Add(new KeyMapping(0x10, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x11, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, '^', '¨', '^', '¨', '^', '¨', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, '$', '£', '$', '£', '$', '£', ConsoleKeyEx.RBracket));
+ /* ENTER, CTRL */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* ASDFGHJKL;'` */
+ Keys.Add(new KeyMapping(0x1E, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x28, 'ù', '%', 'ù', '%', 'ù', '%', ConsoleKeyEx.Apostrophe));
+ Keys.Add(new KeyMapping(0x29, '²', '\0', '²', '²', '\0', '\0', ConsoleKeyEx.Backquote));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ /* \ZXCVBNM,./ */
+ Keys.Add(new KeyMapping(0x2B, '*', 'µ', '*', 'µ', '*', 'µ', ConsoleKeyEx.Backslash));
+ Keys.Add(new KeyMapping(0x2C, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, ',', '?', ',', '?', ',', '?', ConsoleKeyEx.Comma));
+ Keys.Add(new KeyMapping(0x33, ';', '.', ';', '.', ';', '.', ConsoleKeyEx.Semicolon));
+ Keys.Add(new KeyMapping(0x34, ':', '/', ':', '/', ':', '/', ConsoleKeyEx.Colon));
+ Keys.Add(new KeyMapping(0x35, '!', '§', '!', '§', '!', '§', ConsoleKeyEx.ExclamationPoint)); // also numpad divide
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply)); // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete, ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/FR_Standard.cs b/source/Cosmos.System2/Keyboard/ScanMaps/FR_Standard.cs
deleted file mode 100644
index 883d520371..0000000000
--- a/source/Cosmos.System2/Keyboard/ScanMaps/FR_Standard.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Cosmos.HAL;
-
-namespace Cosmos.System.ScanMaps
-{
- ///
- /// FR_Standard class. Represent FR_Standard keyboard layout.
- ///
- public class FR_Standard : ScanMapBase
- {
- ///
- /// Init key list.
- ///
- protected override void InitKeys()
- {
- _keys = new List();
-
- #region Keys
- /* Scan Norm Shift Num Caps ShCaps ShNum ConsoleKeyEx */
- _keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
- /* 1 -> 9 */
- _keys.Add(new KeyMapping(0x02, '&', '1', '&', '1', '&', '1', ConsoleKeyEx.D1));
- _keys.Add(new KeyMapping(0x03, 'é', '2', 'é', '2', 'é', '2', ConsoleKeyEx.D2));
- _keys.Add(new KeyMapping(0x04, '"', '3', '"', '3', '"', '3', ConsoleKeyEx.D3));
- _keys.Add(new KeyMapping(0x05, '\'', '4', '\'', '4', '\'', '4', ConsoleKeyEx.D4));
- _keys.Add(new KeyMapping(0x06, '(', '5', '(', '5', '(', '5', ConsoleKeyEx.D5));
- _keys.Add(new KeyMapping(0x07, '-', '6', '-', '6', '-', '6', ConsoleKeyEx.D6));
- _keys.Add(new KeyMapping(0x08, 'è', '7', 'è', '7', 'è', '7', ConsoleKeyEx.D7));
- _keys.Add(new KeyMapping(0x09, '_', '8', '_', '8', '_', '8', ConsoleKeyEx.D8));
- _keys.Add(new KeyMapping(0x0A, 'ç', '9', 'ç', '9', 'ç', '9', ConsoleKeyEx.D9));
- _keys.Add(new KeyMapping(0x0B, 'à', '0', 'à', '0', 'à', '0', ConsoleKeyEx.D0));
- /* -, =, Bksp, Tab */
- _keys.Add(new KeyMapping(0x0C, ')', '°', ')', '°', ')', '°', ConsoleKeyEx.Minus));
- _keys.Add(new KeyMapping(0x0D, '=', '+', '=', '+', '=', '+', ConsoleKeyEx.Equal));
- _keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
- _keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
- /* QWERTYUIOP[] */
- _keys.Add(new KeyMapping(0x10, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
- _keys.Add(new KeyMapping(0x11, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
- _keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
- _keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
- _keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
- _keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
- _keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
- _keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
- _keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
- _keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
- _keys.Add(new KeyMapping(0x1A, '^', '¨', '^', '¨', '^', '¨', ConsoleKeyEx.LBracket));
- _keys.Add(new KeyMapping(0x1B, '$', '£', '$', '£', '$', '£', ConsoleKeyEx.RBracket));
- /* ENTER, CTRL */
- _keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
- _keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
- /* ASDFGHJKL;'` */
- _keys.Add(new KeyMapping(0x1E, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
- _keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
- _keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
- _keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
- _keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
- _keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
- _keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
- _keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
- _keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
- _keys.Add(new KeyMapping(0x27, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
- _keys.Add(new KeyMapping(0x28, 'ù', '%', 'ù', '%', 'ù', '%', ConsoleKeyEx.Apostrophe));
- _keys.Add(new KeyMapping(0x29, '²', '\0', '²', '²', '\0', '\0', ConsoleKeyEx.Backquote));
- /* Left Shift*/
- _keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
- /* \ZXCVBNM,./ */
- _keys.Add(new KeyMapping(0x2B, '*', 'µ', '*', 'µ', '*', 'µ', ConsoleKeyEx.Backslash));
- _keys.Add(new KeyMapping(0x2C, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
- _keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
- _keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
- _keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
- _keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
- _keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
- _keys.Add(new KeyMapping(0x32, ',', '?', ',', '?', ',', '?', ConsoleKeyEx.Comma));
- _keys.Add(new KeyMapping(0x33, ';', '.', ';', '.', ';', '.', ConsoleKeyEx.Semicolon));
- _keys.Add(new KeyMapping(0x34, ':', '/', ':', '/', ':', '/', ConsoleKeyEx.Colon));
- _keys.Add(new KeyMapping(0x35, '!', '§', '!', '§', '!', '§', ConsoleKeyEx.ExclamationPoint)); // also numpad divide
- /* Right Shift */
- _keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
- /* Print Screen */
- _keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply)); // also numpad multiply
- /* Alt */
- _keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
- /* Space */
- _keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
- /* Caps */
- _keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
- /* F1-F12 */
- _keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
- _keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
- _keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
- _keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
- _keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
- _keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
- _keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
- _keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
- _keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
- _keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
- _keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
- _keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
- /* Num Lock, Scrl Lock */
- _keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
- _keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
- /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
- _keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
- _keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
- _keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
- _keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
- _keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
- _keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
- _keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
- _keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
- _keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
- _keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
- _keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
- _keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
- _keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete, ConsoleKeyEx.NumPeriod));
-
- _keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
- _keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
- #endregion
- }
- }
-}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/GBStandardLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/GBStandardLayout.cs
new file mode 100644
index 0000000000..09d12969c6
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/GBStandardLayout.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Cosmos.HAL;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// Represents the standard English, Great Britain (GB) keyboard layout.
+ ///
+ public class GBStandardLayout : ScanMapBase
+ {
+ ///
+ /// Create new instance of the class.
+ ///
+ public GBStandardLayout()
+ {
+ }
+
+ ///
+ /// Init key list.
+ ///
+ protected override void InitKeys()
+ {
+ Keys = new List(105);
+
+ #region Keys
+
+ /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ /* 1 -> 9 */
+ Keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, '2', '"', '2', '2', '"', '2', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '3', '£', '3', '3', '£', '3', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '6', '^', '6', '6', '^', '6', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, '7', '&', '7', '7', '&', '7', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '8', '*', '8', '8', '*', '8', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, '9', '(', '9', '9', '(', '9', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, '0', ')', '0', '0', ')', '0', ConsoleKeyEx.D0));
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus));
+ Keys.Add(new KeyMapping(0x0D, '=', '+', '=', '=', '+', '=', ConsoleKeyEx.Equal));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ /* QWERTYUIOP[] */
+ Keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, '[', '{', '[', '{', '[', '{', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, ']', '}', ']', '}', ']', '}', ConsoleKeyEx.RBracket));
+ /* ENTER, CTRL */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* ASDFGHJKL;'` */
+ Keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, ';', ':', ';', ';', ':', ':', ConsoleKeyEx.Semicolon));
+ Keys.Add(new KeyMapping(0x28, '\'', '@', '\'', '\'', '@', '@', ConsoleKeyEx.Apostrophe));
+ Keys.Add(new KeyMapping(0x29, '`', '¬', '`', '`', '¬', '¬', ConsoleKeyEx.Backquote));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ /* \ZXCVBNM,./ */
+ Keys.Add(new KeyMapping(0x2B, '#', '~', '#', '#', '~', '~', ConsoleKeyEx.Backslash));
+ Keys.Add(new KeyMapping(0x56, '\\', '|', '\\', '\\', '|', '|', ConsoleKeyEx.OEM5));
+ Keys.Add(new KeyMapping(0x2C, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x33, ',', '<', ',', ',', '<', '<', ConsoleKeyEx.Comma));
+ Keys.Add(new KeyMapping(0x34, '.', '>', '.', '.', '>', '>', ConsoleKeyEx.Period));
+ Keys.Add(new KeyMapping(0x35, '/', '?', '/', '/', '?', '/', ConsoleKeyEx.Slash)); // also numpad divide
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
+ // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete,
+ ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/TRStandardLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/TRStandardLayout.cs
new file mode 100644
index 0000000000..61cd59a78c
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/TRStandardLayout.cs
@@ -0,0 +1,133 @@
+using System.Collections.Generic;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// Represents the standard Turkish (TR) keyboard layout.
+ ///
+ public class TRStandardLayout : ScanMapBase
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public TRStandardLayout()
+ {
+ }
+
+ protected override void InitKeys()
+ {
+ Keys = new List(100);
+
+ #region Keys
+
+ /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* 1 -> 9 */
+ Keys.Add(new KeyMapping(0x29, '"', 'é', '"', '"', 'é', '"', ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, '2', '@', '2', '2', '@', '2', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '3', '#', '3', '3', '#', '3', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '6', '&', '6', '6', '&', '6', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, '7', '/', '7', '7', '/', '7', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '8', '(', '8', '8', '(', '8', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, '9', ')', '9', '9', ')', '9', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, '0', '=', '0', '0', '=', '0', ConsoleKeyEx.D0)); //Hata
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, '*', '?', '*', '*', '?', '*', ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x0D, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ /* QWERTYUIOP[] */
+ Keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, 'ğ', 'Ğ', 'ğ', 'Ğ', 'ğ', 'Ğ', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, 'ü', 'Ü', 'ü', 'Ü', 'ü', 'Ü', ConsoleKeyEx.RBracket));
+ /* ASDFGHJKL;'` */
+ Keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, 'ş', 'Ş', 'ş', 'Ş', 'ş', 'Ş', ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x28, 'i', 'İ', 'i', 'İ', 'i', 'İ', ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x2B, ',', ';', ',', ',', ';', ';', ConsoleKeyEx.Comma));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ Keys.Add(new KeyMapping(0x56, '<', '>', '<', '<', '>', '>', ConsoleKeyEx.NoName));
+ /* \ZXCVBNM,./ */
+ Keys.Add(new KeyMapping(0x2C, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x33, 'ö', 'Ö', 'ö', 'Ö', 'ö', 'Ö', ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x34, 'ç', 'Ç', 'ç', 'ç', 'Ç', 'ç', ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x35, '.', ':', '.', '.', ':', '.', ConsoleKeyEx.NoName)); // also numpad divide
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
+ // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete, ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/TR_StandardQ.cs b/source/Cosmos.System2/Keyboard/ScanMaps/TR_StandardQ.cs
deleted file mode 100644
index 2026f2ee18..0000000000
--- a/source/Cosmos.System2/Keyboard/ScanMaps/TR_StandardQ.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Cosmos.HAL;
-using Cosmos.System;
-
-// Coded By Ali Can GÖNÜLLÜ
-// alicangonullu.biz | alicangonullu@yahoo.com
-// Thanks Support by Berke Kırbaş @iSnowBoy7
-
-namespace Cosmos.System.ScanMaps
-{
- ///
- /// TR_StandardQ class. Represent TR_StandardQ keyboard layout.
- ///
- public class TR_StandardQ : ScanMapBase
- {
- ///
- /// Create new instance of the class.
- ///
- public TR_StandardQ()
- {
- }
-
- ///
- /// Init key list.
- ///
- protected override void InitKeys()
- {
- _keys = new List(100);
-
- #region Keys
-
- /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
- _keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
- /* F1-F12 */
- _keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
- _keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
- _keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
- _keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
- _keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
- _keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
- _keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
- _keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
- _keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
- _keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
- _keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
- _keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
- _keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
- /* 1 -> 9 */
- _keys.Add(new KeyMapping(0x29, '"', 'é', '"', '"', 'é', '"', ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
- _keys.Add(new KeyMapping(0x03, '2', '@', '2', '2', '@', '2', ConsoleKeyEx.D2));
- _keys.Add(new KeyMapping(0x04, '3', '#', '3', '3', '#', '3', ConsoleKeyEx.D3));
- _keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', ConsoleKeyEx.D4));
- _keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
- _keys.Add(new KeyMapping(0x07, '6', '&', '6', '6', '&', '6', ConsoleKeyEx.D6));
- _keys.Add(new KeyMapping(0x08, '7', '/', '7', '7', '/', '7', ConsoleKeyEx.D7));
- _keys.Add(new KeyMapping(0x09, '8', '(', '8', '8', '(', '8', ConsoleKeyEx.D8));
- _keys.Add(new KeyMapping(0x0A, '9', ')', '9', '9', ')', '9', ConsoleKeyEx.D9));
- _keys.Add(new KeyMapping(0x0B, '0', '=', '0', '0', '=', '0', ConsoleKeyEx.D0)); //Hata
- /* -, =, Bksp, Tab */
- _keys.Add(new KeyMapping(0x0C, '*', '?', '*', '*', '?', '*', ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x0D, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus));
- _keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
- _keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
- /* QWERTYUIOP[] */
- _keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
- _keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
- _keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
- _keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
- _keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
- _keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
- _keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
- _keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
- _keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
- _keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
- _keys.Add(new KeyMapping(0x1A, 'ğ', 'Ğ', 'ğ', 'Ğ', 'ğ', 'Ğ', ConsoleKeyEx.LBracket));
- _keys.Add(new KeyMapping(0x1B, 'ü', 'Ü', 'ü', 'Ü', 'ü', 'Ü', ConsoleKeyEx.RBracket));
- /* ASDFGHJKL;'` */
- _keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
- _keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
- _keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
- _keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
- _keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
- _keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
- _keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
- _keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
- _keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
- _keys.Add(new KeyMapping(0x27, 'ş', 'Ş', 'ş', 'Ş', 'ş', 'Ş', ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x28, 'i', 'İ', 'i', 'İ', 'i', 'İ', ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x2B, ',', ';', ',', ',', ';', ';', ConsoleKeyEx.Comma));
- /* Left Shift*/
- _keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
- _keys.Add(new KeyMapping(0x56, '<', '>', '<', '<', '>', '>', ConsoleKeyEx.NoName));
- /* \ZXCVBNM,./ */
- _keys.Add(new KeyMapping(0x2C, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
- _keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
- _keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
- _keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
- _keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
- _keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
- _keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
- _keys.Add(new KeyMapping(0x33, 'ö', 'Ö', 'ö', 'Ö', 'ö', 'Ö', ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x34, 'ç', 'Ç', 'ç', 'ç', 'Ç', 'ç', ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x35, '.', ':', '.', '.', ':', '.', ConsoleKeyEx.NoName)); // also numpad divide
- /* Right Shift */
- _keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
- _keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
- _keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
- /* Print Screen */
- _keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
- // also numpad multiply
- /* Alt */
- _keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
- /* Space */
- _keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
- /* Caps */
- _keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
- /* Num Lock, Scrl Lock */
- _keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
- _keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
- /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
- _keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
- _keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
- _keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
- _keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
- _keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
- _keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
- _keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
- _keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
- _keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
- _keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
- _keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
- _keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
- _keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete,
- ConsoleKeyEx.NumPeriod));
-
- _keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
- _keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
-
- #endregion
- }
- }
-}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/USDvorakLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/USDvorakLayout.cs
new file mode 100644
index 0000000000..1296e031e4
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/USDvorakLayout.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Cosmos.HAL;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// US_Dvorak class. Represent US_Dvorak keyboard layout.
+ ///
+ public class US_Dvorak : ScanMapBase
+ {
+ ///
+ /// Create new instance of the class.
+ ///
+ public US_Dvorak()
+ {
+ }
+
+ ///
+ /// Init key list.
+ ///
+ protected override void InitKeys()
+ {
+ Keys = new List();
+
+ #region Keys
+
+ /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ /* 1 -> 9 */
+ Keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, '2', '@', '2', '2', '@', '2', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '3', '#', '3', '3', '#', '3', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '6', '^', '6', '6', '^', '6', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, '7', '&', '7', '7', '&', '7', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '8', '*', '8', '8', '*', '8', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, '9', '(', '9', '9', '(', '9', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, '0', ')', '0', '0', ')', '0', ConsoleKeyEx.D0));
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, '[', '{', '[', '{', '[', '{', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x0D, ']', '}', ']', '}', ']', '}', ConsoleKeyEx.RBracket));
+ //Keys.Add(new KeyMapping(0x0C, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus));
+ //Keys.Add(new KeyMapping(0x0D, '=', '+', '=', '=', '+', '=', ConsoleKeyEx.Equal));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ Keys.Add(new KeyMapping(0x10, '\'', '"', '\'', '\'', '"', '"', ConsoleKeyEx.Apostrophe)); //'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x11, ',', '<', ',', ',', '<', '<', ConsoleKeyEx.Comma)); //'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x12, '.', '>', '.', '.', '>', '>', ConsoleKeyEx.Period)); //'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P)); //'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y)); //'t', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F)); //'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G)); //'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C)); //'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R)); //'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L)); //'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, '/', '?', '/', '/', '?', '/', ConsoleKeyEx.Slash)); //'[', '{', '[', '{', '[', '{', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, '=', '+', '=', '=', '+', '=', ConsoleKeyEx.Equal)); //']', '}', ']', '}', ']', '}', ConsoleKeyEx.RBracket));
+ /* ENTER, CTRL */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* ASDFGHJKL;'` */
+ Keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x1F, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O)); //'s', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E)); //'d', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U)); //'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I)); //'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D)); //'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H)); //'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T)); //'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N)); //'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S)); //';', ':', ';', ';', ':', ':', ConsoleKeyEx.Semicolon));
+ Keys.Add(new KeyMapping(0x28, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus)); //'\'', '"', '\'', '\'', '"', '"', ConsoleKeyEx.Apostrophe));
+ Keys.Add(new KeyMapping(0x29, '`', '~', '`', '`', '~', '~', ConsoleKeyEx.Backquote));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ /* \ZXCVBNM,./ */
+ Keys.Add(new KeyMapping(0x2B, '\\', '|', '\\', '\\', '|', '|', ConsoleKeyEx.Backslash));
+ Keys.Add(new KeyMapping(0x2C, ';', ':', ';', ';', ':', ':', ConsoleKeyEx.Semicolon)); //'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x2D, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q)); //'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J)); //'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K)); //'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X)); //'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B)); //'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x33, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W)); //',', '<', ',', ',', '<', '<', ConsoleKeyEx.Comma));
+ Keys.Add(new KeyMapping(0x34, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V)); //'.', '>', '.', '.', '>', '>', ConsoleKeyEx.Period));
+ Keys.Add(new KeyMapping(0x35, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z)); //'/', '?', '/', '/', '?', '/', ConsoleKeyEx.Slash)); // also numpad divide
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
+ // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete,
+ ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/USStandardLayout.cs b/source/Cosmos.System2/Keyboard/ScanMaps/USStandardLayout.cs
new file mode 100644
index 0000000000..556674d7dc
--- /dev/null
+++ b/source/Cosmos.System2/Keyboard/ScanMaps/USStandardLayout.cs
@@ -0,0 +1,134 @@
+using System.Collections.Generic;
+
+namespace Cosmos.System.ScanMaps
+{
+ ///
+ /// Represents the standard English (US) keyboard layout.
+ ///
+ public class USStandardLayout : ScanMapBase
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public USStandardLayout()
+ {
+ }
+
+ protected override void InitKeys()
+ {
+ Keys = new List(100);
+
+ #region Keys
+
+ /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
+ Keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
+ Keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
+ /* 1 -> 9 */
+ Keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
+ Keys.Add(new KeyMapping(0x03, '2', '@', '2', '2', '@', '2', ConsoleKeyEx.D2));
+ Keys.Add(new KeyMapping(0x04, '3', '#', '3', '3', '#', '3', ConsoleKeyEx.D3));
+ Keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', ConsoleKeyEx.D4));
+ Keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
+ Keys.Add(new KeyMapping(0x07, '6', '^', '6', '6', '^', '6', ConsoleKeyEx.D6));
+ Keys.Add(new KeyMapping(0x08, '7', '&', '7', '7', '&', '7', ConsoleKeyEx.D7));
+ Keys.Add(new KeyMapping(0x09, '8', '*', '8', '8', '*', '8', ConsoleKeyEx.D8));
+ Keys.Add(new KeyMapping(0x0A, '9', '(', '9', '9', '(', '9', ConsoleKeyEx.D9));
+ Keys.Add(new KeyMapping(0x0B, '0', ')', '0', '0', ')', '0', ConsoleKeyEx.D0));
+ /* -, =, Bksp, Tab */
+ Keys.Add(new KeyMapping(0x0C, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus));
+ Keys.Add(new KeyMapping(0x0D, '=', '+', '=', '=', '+', '=', ConsoleKeyEx.Equal));
+ Keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
+ Keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
+ /* QWERTYUIOP[] */
+ Keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
+ Keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
+ Keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
+ Keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
+ Keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
+ Keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
+ Keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
+ Keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
+ Keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
+ Keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
+ Keys.Add(new KeyMapping(0x1A, '[', '{', '[', '{', '[', '{', ConsoleKeyEx.LBracket));
+ Keys.Add(new KeyMapping(0x1B, ']', '}', ']', '}', ']', '}', ConsoleKeyEx.RBracket));
+ /* ENTER, CTRL */
+ Keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
+ Keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
+ /* ASDFGHJKL;'` */
+ Keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
+ Keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
+ Keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
+ Keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
+ Keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
+ Keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
+ Keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
+ Keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
+ Keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
+ Keys.Add(new KeyMapping(0x27, ';', ':', ';', ';', ':', ':', ConsoleKeyEx.Semicolon));
+ Keys.Add(new KeyMapping(0x28, '\'', '"', '\'', '\'', '"', '"', ConsoleKeyEx.Apostrophe));
+ Keys.Add(new KeyMapping(0x29, '`', '~', '`', '`', '~', '~', ConsoleKeyEx.Backquote));
+ /* Left Shift*/
+ Keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
+ /* \ZXCVBNM,./ */
+ Keys.Add(new KeyMapping(0x2B, '\\', '|', '\\', '\\', '|', '|', ConsoleKeyEx.Backslash));
+ Keys.Add(new KeyMapping(0x2C, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
+ Keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
+ Keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
+ Keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
+ Keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
+ Keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
+ Keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
+ Keys.Add(new KeyMapping(0x33, ',', '<', ',', ',', '<', '<', ConsoleKeyEx.Comma));
+ Keys.Add(new KeyMapping(0x34, '.', '>', '.', '.', '>', '>', ConsoleKeyEx.Period));
+ Keys.Add(new KeyMapping(0x35, '/', '?', '/', '/', '?', '/', ConsoleKeyEx.Slash)); // also numpad divide
+ /* Right Shift */
+ Keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
+ /* Print Screen */
+ Keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
+ // also numpad multiply
+ /* Alt */
+ Keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
+ /* Space */
+ Keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
+ /* Caps */
+ Keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
+ /* F1-F12 */
+ Keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
+ Keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
+ Keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
+ Keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
+ Keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
+ Keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
+ Keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
+ Keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
+ Keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
+ Keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
+ Keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
+ Keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
+ /* Num Lock, Scrl Lock */
+ Keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
+ Keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
+ /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
+ Keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
+ Keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
+ Keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
+ Keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
+ Keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
+ Keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
+ Keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
+ Keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
+ Keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
+ Keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
+ Keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
+ Keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
+ Keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete,
+ ConsoleKeyEx.NumPeriod));
+
+ Keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
+ Keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
+
+ #endregion
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Keyboard/ScanMaps/US_Standard.cs b/source/Cosmos.System2/Keyboard/ScanMaps/US_Standard.cs
deleted file mode 100644
index 103913de37..0000000000
--- a/source/Cosmos.System2/Keyboard/ScanMaps/US_Standard.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Cosmos.HAL;
-
-namespace Cosmos.System.ScanMaps
-{
- ///
- /// US_Standard class. Represent US_Standard keyboard layout.
- ///
- public class US_Standard : ScanMapBase
- {
- ///
- /// Create new instance of the class.
- ///
- public US_Standard()
- {
- }
-
- ///
- /// Init key list.
- ///
- protected override void InitKeys()
- {
- _keys = new List(100);
-
- #region Keys
-
- /* Scan Norm Shift Ctrl Alt Num Caps ShCaps ShNum ConsoleKeyEx */
- _keys.Add(new KeyMapping(0x00, ConsoleKeyEx.NoName));
- _keys.Add(new KeyMapping(0x01, ConsoleKeyEx.Escape));
- /* 1 -> 9 */
- _keys.Add(new KeyMapping(0x02, '1', '!', '1', '1', '!', '1', ConsoleKeyEx.D1));
- _keys.Add(new KeyMapping(0x03, '2', '@', '2', '2', '@', '2', ConsoleKeyEx.D2));
- _keys.Add(new KeyMapping(0x04, '3', '#', '3', '3', '#', '3', ConsoleKeyEx.D3));
- _keys.Add(new KeyMapping(0x05, '4', '$', '4', '4', '$', '4', ConsoleKeyEx.D4));
- _keys.Add(new KeyMapping(0x06, '5', '%', '5', '5', '%', '5', ConsoleKeyEx.D5));
- _keys.Add(new KeyMapping(0x07, '6', '^', '6', '6', '^', '6', ConsoleKeyEx.D6));
- _keys.Add(new KeyMapping(0x08, '7', '&', '7', '7', '&', '7', ConsoleKeyEx.D7));
- _keys.Add(new KeyMapping(0x09, '8', '*', '8', '8', '*', '8', ConsoleKeyEx.D8));
- _keys.Add(new KeyMapping(0x0A, '9', '(', '9', '9', '(', '9', ConsoleKeyEx.D9));
- _keys.Add(new KeyMapping(0x0B, '0', ')', '0', '0', ')', '0', ConsoleKeyEx.D0));
- /* -, =, Bksp, Tab */
- _keys.Add(new KeyMapping(0x0C, '-', '_', '-', '-', '_', '-', ConsoleKeyEx.Minus));
- _keys.Add(new KeyMapping(0x0D, '=', '+', '=', '=', '+', '=', ConsoleKeyEx.Equal));
- _keys.Add(new KeyMapping(0x0E, ConsoleKeyEx.Backspace));
- _keys.Add(new KeyMapping(0x0F, ConsoleKeyEx.Tab));
- /* QWERTYUIOP[] */
- _keys.Add(new KeyMapping(0x10, 'q', 'Q', 'q', 'Q', 'q', 'Q', ConsoleKeyEx.Q));
- _keys.Add(new KeyMapping(0x11, 'w', 'W', 'w', 'W', 'w', 'W', ConsoleKeyEx.W));
- _keys.Add(new KeyMapping(0x12, 'e', 'E', 'e', 'E', 'e', 'E', ConsoleKeyEx.E));
- _keys.Add(new KeyMapping(0x13, 'r', 'R', 'r', 'R', 'r', 'R', ConsoleKeyEx.R));
- _keys.Add(new KeyMapping(0x14, 't', 'T', 't', 'T', 't', 'T', ConsoleKeyEx.T));
- _keys.Add(new KeyMapping(0x15, 'y', 'Y', 'y', 'Y', 'y', 'Y', ConsoleKeyEx.Y));
- _keys.Add(new KeyMapping(0x16, 'u', 'U', 'u', 'U', 'u', 'U', ConsoleKeyEx.U));
- _keys.Add(new KeyMapping(0x17, 'i', 'I', 'i', 'I', 'i', 'I', ConsoleKeyEx.I));
- _keys.Add(new KeyMapping(0x18, 'o', 'O', 'o', 'O', 'o', 'O', ConsoleKeyEx.O));
- _keys.Add(new KeyMapping(0x19, 'p', 'P', 'p', 'P', 'p', 'P', ConsoleKeyEx.P));
- _keys.Add(new KeyMapping(0x1A, '[', '{', '[', '{', '[', '{', ConsoleKeyEx.LBracket));
- _keys.Add(new KeyMapping(0x1B, ']', '}', ']', '}', ']', '}', ConsoleKeyEx.RBracket));
- /* ENTER, CTRL */
- _keys.Add(new KeyMapping(0x1C, ConsoleKeyEx.Enter));
- _keys.Add(new KeyMapping(0x1D, ConsoleKeyEx.LCtrl));
- /* ASDFGHJKL;'` */
- _keys.Add(new KeyMapping(0x1E, 'a', 'A', 'a', 'A', 'a', 'A', ConsoleKeyEx.A));
- _keys.Add(new KeyMapping(0x1F, 's', 'S', 's', 'S', 's', 'S', ConsoleKeyEx.S));
- _keys.Add(new KeyMapping(0x20, 'd', 'D', 'd', 'D', 'd', 'D', ConsoleKeyEx.D));
- _keys.Add(new KeyMapping(0x21, 'f', 'F', 'f', 'F', 'f', 'F', ConsoleKeyEx.F));
- _keys.Add(new KeyMapping(0x22, 'g', 'G', 'g', 'G', 'g', 'G', ConsoleKeyEx.G));
- _keys.Add(new KeyMapping(0x23, 'h', 'H', 'h', 'H', 'h', 'H', ConsoleKeyEx.H));
- _keys.Add(new KeyMapping(0x24, 'j', 'J', 'j', 'J', 'j', 'J', ConsoleKeyEx.J));
- _keys.Add(new KeyMapping(0x25, 'k', 'K', 'k', 'K', 'k', 'K', ConsoleKeyEx.K));
- _keys.Add(new KeyMapping(0x26, 'l', 'L', 'l', 'L', 'l', 'L', ConsoleKeyEx.L));
- _keys.Add(new KeyMapping(0x27, ';', ':', ';', ';', ':', ':', ConsoleKeyEx.Semicolon));
- _keys.Add(new KeyMapping(0x28, '\'', '"', '\'', '\'', '"', '"', ConsoleKeyEx.Apostrophe));
- _keys.Add(new KeyMapping(0x29, '`', '~', '`', '`', '~', '~', ConsoleKeyEx.Backquote));
- /* Left Shift*/
- _keys.Add(new KeyMapping(0x2A, ConsoleKeyEx.LShift));
- /* \ZXCVBNM,./ */
- _keys.Add(new KeyMapping(0x2B, '\\', '|', '\\', '\\', '|', '|', ConsoleKeyEx.Backslash));
- _keys.Add(new KeyMapping(0x2C, 'z', 'Z', 'z', 'Z', 'z', 'Z', ConsoleKeyEx.Z));
- _keys.Add(new KeyMapping(0x2D, 'x', 'X', 'x', 'X', 'x', 'X', ConsoleKeyEx.X));
- _keys.Add(new KeyMapping(0x2E, 'c', 'C', 'c', 'C', 'c', 'C', ConsoleKeyEx.C));
- _keys.Add(new KeyMapping(0x2F, 'v', 'V', 'v', 'V', 'v', 'V', ConsoleKeyEx.V));
- _keys.Add(new KeyMapping(0x30, 'b', 'B', 'b', 'B', 'b', 'B', ConsoleKeyEx.B));
- _keys.Add(new KeyMapping(0x31, 'n', 'N', 'n', 'N', 'n', 'N', ConsoleKeyEx.N));
- _keys.Add(new KeyMapping(0x32, 'm', 'M', 'm', 'M', 'm', 'M', ConsoleKeyEx.M));
- _keys.Add(new KeyMapping(0x33, ',', '<', ',', ',', '<', '<', ConsoleKeyEx.Comma));
- _keys.Add(new KeyMapping(0x34, '.', '>', '.', '.', '>', '>', ConsoleKeyEx.Period));
- _keys.Add(new KeyMapping(0x35, '/', '?', '/', '/', '?', '/', ConsoleKeyEx.Slash)); // also numpad divide
- /* Right Shift */
- _keys.Add(new KeyMapping(0x36, ConsoleKeyEx.RShift));
- /* Print Screen */
- _keys.Add(new KeyMapping(0x37, '*', '*', '*', '*', '*', '*', ConsoleKeyEx.NumMultiply));
- // also numpad multiply
- /* Alt */
- _keys.Add(new KeyMapping(0x38, ConsoleKeyEx.LAlt));
- /* Space */
- _keys.Add(new KeyMapping(0x39, ' ', ConsoleKeyEx.Spacebar));
- /* Caps */
- _keys.Add(new KeyMapping(0x3A, ConsoleKeyEx.CapsLock));
- /* F1-F12 */
- _keys.Add(new KeyMapping(0x3B, ConsoleKeyEx.F1));
- _keys.Add(new KeyMapping(0x3C, ConsoleKeyEx.F2));
- _keys.Add(new KeyMapping(0x3D, ConsoleKeyEx.F3));
- _keys.Add(new KeyMapping(0x3E, ConsoleKeyEx.F4));
- _keys.Add(new KeyMapping(0x3F, ConsoleKeyEx.F5));
- _keys.Add(new KeyMapping(0x40, ConsoleKeyEx.F6));
- _keys.Add(new KeyMapping(0x41, ConsoleKeyEx.F7));
- _keys.Add(new KeyMapping(0x42, ConsoleKeyEx.F8));
- _keys.Add(new KeyMapping(0x43, ConsoleKeyEx.F9));
- _keys.Add(new KeyMapping(0x44, ConsoleKeyEx.F10));
- _keys.Add(new KeyMapping(0x57, ConsoleKeyEx.F11));
- _keys.Add(new KeyMapping(0x58, ConsoleKeyEx.F12));
- /* Num Lock, Scrl Lock */
- _keys.Add(new KeyMapping(0x45, ConsoleKeyEx.NumLock));
- _keys.Add(new KeyMapping(0x46, ConsoleKeyEx.ScrollLock));
- /* HOME, Up, Pgup, -kpad, left, center, right, +keypad, end, down, pgdn, ins, del */
- _keys.Add(new KeyMapping(0x47, '\0', '\0', '7', '\0', '\0', '\0', ConsoleKeyEx.Home, ConsoleKeyEx.Num7));
- _keys.Add(new KeyMapping(0x48, '\0', '\0', '8', '\0', '\0', '\0', ConsoleKeyEx.UpArrow, ConsoleKeyEx.Num8));
- _keys.Add(new KeyMapping(0x49, '\0', '\0', '9', '\0', '\0', '\0', ConsoleKeyEx.PageUp, ConsoleKeyEx.Num9));
- _keys.Add(new KeyMapping(0x4A, '-', '-', '-', '-', '-', '-', ConsoleKeyEx.NumMinus));
- _keys.Add(new KeyMapping(0x4B, '\0', '\0', '4', '\0', '\0', '\0', ConsoleKeyEx.LeftArrow, ConsoleKeyEx.Num4));
- _keys.Add(new KeyMapping(0x4C, '\0', '\0', '5', '\0', '\0', '\0', ConsoleKeyEx.Num5));
- _keys.Add(new KeyMapping(0x4D, '\0', '\0', '6', '\0', '\0', '\0', ConsoleKeyEx.RightArrow, ConsoleKeyEx.Num6));
- _keys.Add(new KeyMapping(0x4E, '+', '+', '+', '+', '+', '+', ConsoleKeyEx.NumPlus));
- _keys.Add(new KeyMapping(0x4F, '\0', '\0', '1', '\0', '\0', '\0', ConsoleKeyEx.End, ConsoleKeyEx.Num1));
- _keys.Add(new KeyMapping(0x50, '\0', '\0', '2', '\0', '\0', '\0', ConsoleKeyEx.DownArrow, ConsoleKeyEx.Num2));
- _keys.Add(new KeyMapping(0x51, '\0', '\0', '3', '\0', '\0', '\0', ConsoleKeyEx.PageDown, ConsoleKeyEx.Num3));
- _keys.Add(new KeyMapping(0x52, '\0', '\0', '0', '\0', '\0', '\0', ConsoleKeyEx.Insert, ConsoleKeyEx.Num0));
- _keys.Add(new KeyMapping(0x53, '\0', '\0', '.', '\0', '\0', '\0', ConsoleKeyEx.Delete,
- ConsoleKeyEx.NumPeriod));
-
- _keys.Add(new KeyMapping(0x5b, ConsoleKeyEx.LWin));
- _keys.Add(new KeyMapping(0x5c, ConsoleKeyEx.RWin));
-
- #endregion
- }
- }
-}
diff --git a/source/Cosmos.System2/MathEx.cs b/source/Cosmos.System2/MathEx.cs
deleted file mode 100644
index 0308255c41..0000000000
--- a/source/Cosmos.System2/MathEx.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-
-namespace Cosmos.System
-{
- ///
- /// MathEx class. Provides additional math methods.
- ///
- public static class MathEx
- {
- ///
- /// Get the remainder on division of a in b.
- ///
- /// Divided number.
- /// Divider.
- /// long value.
- public static long Rem(long a, long b)
- {
- long result = a;
- while (result - b > 0)
- {
- result = result - b;
- }
- return result;
- }
- }
-}
diff --git a/source/Cosmos.System2/MouseManager.cs b/source/Cosmos.System2/MouseManager.cs
index 8d8ef66eea..765e7bd5f7 100644
--- a/source/Cosmos.System2/MouseManager.cs
+++ b/source/Cosmos.System2/MouseManager.cs
@@ -1,48 +1,42 @@
-using System;
-using System.Collections.Generic;
-
+using System.Collections.Generic;
using Cosmos.HAL;
+using System;
namespace Cosmos.System
{
///
- /// The possible states of a mouse.
+ /// Manages the mouse.
///
- [Flags]
- public enum MouseState
+ public static class MouseManager
{
+ #region Fields
+ private static List mouseList = new();
+
///
- /// No button is pressed.
- ///
- None = 0b0000_0000,
- ///
- /// The left mouse button is pressed.
- ///
- Left = 0b0000_0001,
- ///
- /// The right mouse button is pressed.
- ///
- Right = 0b0000_0010,
- ///
- /// The middle mouse button is pressed.
+ /// The state the mouse was in the last frame.
///
- Middle = 0b0000_0100,
+ public static MouseState LastMouseState;
+
///
- /// The fourth mouse button is pressed.
+ /// The state the mouse is currently in.
///
- FourthButton = 0b0000_1000,
+ public static MouseState MouseState;
+
///
- /// The fifth mouse button is pressed.
+ /// The sensitivity of the mouse, 1.0f is the default.
///
- FifthButton = 0b0001_0000
- }
+ public static float MouseSensitivity;
- ///
- /// Mouse manager class.
- ///
- public static class MouseManager
- {
- private static List mMouseList = new();
+ private static uint screenWidth;
+ private static uint screenHeight;
+
+ // These values are used as flags for the Delta X and Y properties, explained more there.
+ private static bool hasReadDeltaX;
+ private static bool hasReadDeltaY;
+
+ // Temporary 'cache' delta values.
+ private static int deltaX;
+ private static int deltaY;
///
/// The X location of the mouse.
@@ -54,42 +48,33 @@ public static class MouseManager
///
public static uint Y;
- // ///
- // /// The Point of the mouse.
- // ///
- // public static Point GetPoint() {return new Point((int)MouseManager.X, (int)MouseManager.Y);}
+ #endregion
- ///
- /// The state the mouse is currently in.
- ///
- public static MouseState MouseState;
-
- ///
- /// The state the mouse was in the last frame.
- ///
- public static MouseState LastMouseState;
+ static MouseManager()
+ {
+ MouseSensitivity = 1f;
- ///
- /// The sensitivity of the mouse, 1.0f is the default.
- ///
- public static float MouseSensitivity = 1.0f;
+ foreach (var mouse in HAL.Global.GetMouseDevices())
+ {
+ AddMouse(mouse);
+ }
+ }
- private static uint mScreenWidth;
- private static uint mScreenHeight;
+ #region Properties
///
- /// The screen width (i.e. max value of X).
+ /// The width of the mouse screen area (i.e. max value of X).
///
public static uint ScreenWidth
{
- get => mScreenWidth;
+ get => screenWidth;
set
{
- mScreenWidth = value;
+ screenWidth = value;
- if (X >= mScreenWidth)
+ if (X >= screenWidth)
{
- X = mScreenWidth - 1;
+ X = screenWidth - 1;
}
}
}
@@ -99,71 +84,94 @@ public static uint ScreenWidth
///
public static uint ScreenHeight
{
- get => mScreenHeight;
+ get => screenHeight;
set
{
- mScreenHeight = value;
+ screenHeight = value;
- if (Y >= mScreenHeight)
+ if (Y >= screenHeight)
{
- Y = mScreenHeight - 1;
+ Y = screenHeight - 1;
}
}
}
///
- /// Mouse manager constructor.
+ /// The 'delta' mouse movement for X.
///
- static MouseManager()
+ public static int DeltaX
{
- foreach (var mouse in HAL.Global.GetMouseDevices())
+ get
{
- AddMouse(mouse);
+ // If the delta has been read already, return 0.
+ // This is a workaround for the PS/2 mouse not updating it's delta values when movement has stopped.
+ if (hasReadDeltaX)
+ {
+ return 0;
+ }
+
+ hasReadDeltaX = true;
+ return deltaX;
+ }
+ internal set
+ {
+ hasReadDeltaX = false;
+ deltaX = value;
}
}
///
- /// Mouse handler.
+ /// The 'delta' mouse movement for Y.
///
- /// Mouse location change on X axis.
- /// Mouse location change on Y axis.
- /// Mouse pressed button state
- /// unused
- public static void HandleMouse(int aDeltaX, int aDeltaY, int aMouseState, int aScrollWheel)
+ public static int DeltaY
{
- int x = (int)(X + MouseSensitivity * aDeltaX);
- int y = (int)(Y + MouseSensitivity * aDeltaY);
- LastMouseState = MouseState;
- MouseState = (MouseState)aMouseState;
-
- if (x <= 0)
+ get
{
- X = 0;
- }
- else if (x >= ScreenWidth)
- {
- X = ScreenWidth - 1;
- }
- else
- {
- X = (uint)x;
- }
+ // If the delta has been read already, return 0.
+ // This is a workaround for the PS/2 mouse not updating it's delta values when movement has stopped.
+ if (hasReadDeltaY)
+ {
+ return 0;
+ }
- if (y <= 0)
- {
- Y = 0;
+ hasReadDeltaY = true;
+ return deltaY;
}
- else if (y >= ScreenHeight)
+ internal set
{
- Y = ScreenHeight - 1;
- }
- else
- {
- Y = (uint)y;
+ hasReadDeltaY = false;
+ deltaY = value;
}
}
+ #endregion
+
+ #region Methods
+ ///
+ /// Handles mouse input.
+ ///
+ /// Mouse location change on X axis.
+ /// Mouse location change on Y axis.
+ /// Mouse pressed button state
+ /// Unused in this implementation.
+ public static void HandleMouse(int deltaX, int deltaY, int mouseState, int scrollWheel)
+ {
+ // Mouse should be disabled if nothing has been set.
+ if (ScreenHeight == 0 || ScreenWidth == 0)
+ {
+ return;
+ }
+
+ // Assign new delta values.
+ DeltaX = deltaX;
+ DeltaY = deltaY;
+
+ X = (uint)Math.Clamp(X + (MouseSensitivity * deltaX), 0, ScreenWidth - 1);
+ Y = (uint)Math.Clamp(Y + (MouseSensitivity * deltaY), 0, ScreenHeight - 1);
+ LastMouseState = MouseState;
+ MouseState = (MouseState)mouseState;
+ }
///
/// Add mouse to the mouse list.
@@ -172,7 +180,9 @@ public static void HandleMouse(int aDeltaX, int aDeltaY, int aMouseState, int aS
private static void AddMouse(MouseBase aMouse)
{
aMouse.OnMouseChanged = HandleMouse;
- mMouseList.Add(aMouse);
+ mouseList.Add(aMouse);
}
+
+ #endregion
}
}
diff --git a/source/Cosmos.System2/MouseState.cs b/source/Cosmos.System2/MouseState.cs
new file mode 100644
index 0000000000..40a874c967
--- /dev/null
+++ b/source/Cosmos.System2/MouseState.cs
@@ -0,0 +1,41 @@
+using System;
+
+namespace Cosmos.System
+{
+ ///
+ /// The possible states of a mouse.
+ ///
+ [Flags]
+ public enum MouseState
+ {
+ ///
+ /// No button is pressed.
+ ///
+ None = 0b0000_0000,
+
+ ///
+ /// The left mouse button is pressed.
+ ///
+ Left = 0b0000_0001,
+
+ ///
+ /// The right mouse button is pressed.
+ ///
+ Right = 0b0000_0010,
+
+ ///
+ /// The middle mouse button is pressed.
+ ///
+ Middle = 0b0000_0100,
+
+ ///
+ /// The fourth mouse button is pressed.
+ ///
+ FourthButton = 0b0000_1000,
+
+ ///
+ /// The fifth mouse button is pressed.
+ ///
+ FifthButton = 0b0001_0000
+ }
+}
diff --git a/source/Cosmos.System2/Network/.editorconfig b/source/Cosmos.System2/Network/.editorconfig
deleted file mode 100644
index 6ebe0b6d14..0000000000
--- a/source/Cosmos.System2/Network/.editorconfig
+++ /dev/null
@@ -1,3 +0,0 @@
-; 4-column space indentation
-[*.cs]
-indent_size = 4
\ No newline at end of file
diff --git a/source/Cosmos.System2/Network/ARP/ARPCache.cs b/source/Cosmos.System2/Network/ARP/ARPCache.cs
index 1d09564f6d..62417733ad 100644
--- a/source/Cosmos.System2/Network/ARP/ARPCache.cs
+++ b/source/Cosmos.System2/Network/ARP/ARPCache.cs
@@ -1,90 +1,78 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: ARP Cache (Contains MAC/IP)
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
+using System;
using System.Collections.Generic;
using Cosmos.HAL.Network;
namespace Cosmos.System.Network.ARP
{
///
- /// ARPCache class.
+ /// Manages the ARP (Address Resolution Protocol) cache.
///
internal static class ARPCache
{
///
- /// Cache.
+ /// The cache map.
///
- public static Dictionary cache;
+ public static Dictionary Cache;
///
- /// Ensure cache exists.
+ /// Ensures the cache map exists.
///
- /// Thrown on fatal error (contact support).
- private static void ensureCacheExists()
+ private static void EnsureCacheExists()
{
- if (cache == null)
- {
- cache = new Dictionary();
- }
+ Cache ??= new Dictionary();
}
///
- /// Check if ARP cache contains the given IP.
+ /// Checks whether the ARP cache contains the given IP.
///
- /// IP address to check.
- /// bool value.
+ /// The IP address to check.
internal static bool Contains(IPv4.Address ipAddress)
{
- ensureCacheExists();
- return cache.ContainsKey(ipAddress.Hash);
+ EnsureCacheExists();
+ return Cache.ContainsKey(ipAddress.Hash);
}
///
- /// Update ARP cache.
+ /// Updates the ARP cache.
///
- /// IP address.
- /// MAC address.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
- /// Thrown on fatal error (contact support).
+ /// The IP address.
+ /// The MAC address.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
+ /// Thrown on fatal error.
internal static void Update(IPv4.Address ipAddress, MACAddress macAddress)
{
- ensureCacheExists();
- uint ip_hash = ipAddress.Hash;
- if (ip_hash == 0)
+ EnsureCacheExists();
+ uint ipHash = ipAddress.Hash;
+ if (ipHash == 0)
{
return;
}
- if (cache.ContainsKey(ip_hash) == false)
+ if (Cache.ContainsKey(ipHash) == false)
{
- cache.Add(ip_hash, macAddress);
+ Cache.Add(ipHash, macAddress);
}
else
{
- cache[ip_hash] = macAddress;
+ Cache[ipHash] = macAddress;
}
}
///
- /// Resolve ARP cache.
+ /// Resolve an IP address to a MAC address using the ARP cache.
///
/// IP address.
- /// MAC address.
+ /// The resolved MAC address, or if no cache entry for the given IP address exists.
internal static MACAddress Resolve(IPv4.Address ipAddress)
{
- ensureCacheExists();
- if (cache.ContainsKey(ipAddress.Hash) == false)
+ EnsureCacheExists();
+ if (Cache.ContainsKey(ipAddress.Hash) == false)
{
return null;
}
- return cache[ipAddress.Hash];
+ return Cache[ipAddress.Hash];
}
}
}
diff --git a/source/Cosmos.System2/Network/ARP/ARPPacket.cs b/source/Cosmos.System2/Network/ARP/ARPPacket.cs
index 86ba5aa687..7b6ca95303 100644
--- a/source/Cosmos.System2/Network/ARP/ARPPacket.cs
+++ b/source/Cosmos.System2/Network/ARP/ARPPacket.cs
@@ -1,11 +1,4 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: ARP Packet
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
+using System;
using Cosmos.HAL;
using Cosmos.HAL.Network;
using Cosmos.System.Network.IPv4;
@@ -13,114 +6,104 @@
namespace Cosmos.System.Network.ARP
{
///
- /// ARPPacket class. See also: .
+ /// Represents an ARP (Address Resolution Protocol) packet.
///
+ ///
+ /// See also: .
+ ///
public class ARPPacket : EthernetPacket
{
- ///
- /// Hardware type.
- ///
- protected ushort aHardwareType;
- ///
- /// Protocol type.
- ///
- protected ushort aProtocolType;
- ///
- /// Hardware address length.
- ///
- protected byte aHardwareLen;
- ///
- /// Protocol address length.
- ///
- protected byte aProtocolLen;
- ///
- /// Operation code.
- ///
- protected ushort aOperation;
+ protected ushort hardwareType;
+ protected ushort protocolType;
+ protected byte hardwareAddrLength;
+ protected byte protocolAddrLength;
+ protected ushort opCode;
///
- /// ARP handler.
+ /// Handles ARP packets.
///
/// Packet data.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
internal static void ARPHandler(byte[] packetData)
{
- ARPPacket arp_packet = new ARPPacket(packetData);
+ var arpPacket = new ARPPacket(packetData);
//Sys.Console.WriteLine("Received ARP Packet");
//Sys.Console.WriteLine(arp_packet.ToString());
- if (arp_packet.Operation == 0x01)
+ if (arpPacket.Operation == 0x01)
{
- if (arp_packet.HardwareType == 1 && arp_packet.ProtocolType == 0x0800)
+ if (arpPacket.HardwareType == 1 && arpPacket.ProtocolType == 0x0800)
{
- ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(packetData);
- if (arp_request.SenderIP == null)
+ var arpRequest = new ARPRequestEthernet(packetData);
+ if (arpRequest.SenderIP == null)
{
- Global.mDebugger.Send("SenderIP null in ARPHandler!");
+ NetworkStack.Debugger.Send("SenderIP null in ARPHandler!");
}
- arp_request = new ARPRequest_Ethernet(packetData);
- ARPCache.Update(arp_request.SenderIP, arp_request.SenderMAC);
+ arpRequest = new ARPRequestEthernet(packetData);
+
+ ARPCache.Update(arpRequest.SenderIP, arpRequest.SenderMAC);
- if (NetworkStack.AddressMap.ContainsKey(arp_request.TargetIP.Hash) == true)
+ if (NetworkStack.AddressMap.ContainsKey(arpRequest.TargetIP.Hash) == true)
{
- Global.mDebugger.Send("ARP Request Recvd from " + arp_request.SenderIP.ToString());
- NetworkDevice nic = NetworkStack.AddressMap[arp_request.TargetIP.Hash];
+ NetworkStack.Debugger.Send("ARP request received from " + arpRequest.SenderIP.ToString());
+ NetworkDevice nic = NetworkStack.AddressMap[arpRequest.TargetIP.Hash];
- ARPReply_Ethernet reply =
- new ARPReply_Ethernet(nic.MACAddress, arp_request.TargetIP, arp_request.SenderMAC, arp_request.SenderIP);
+ var reply = new ARPReplyEthernet(
+ nic.MACAddress,
+ arpRequest.TargetIP,
+ arpRequest.SenderMAC,
+ arpRequest.SenderIP
+ );
nic.QueueBytes(reply.RawData);
}
}
}
- else if (arp_packet.Operation == 0x02)
+ else if (arpPacket.Operation == 0x02)
{
- if (arp_packet.HardwareType == 1 && arp_packet.ProtocolType == 0x0800)
+ if (arpPacket.HardwareType == 1 && arpPacket.ProtocolType == 0x0800)
{
- ARPReply_Ethernet arp_reply = new ARPReply_Ethernet(packetData);
- Global.mDebugger.Send("Received ARP Reply");
- Global.mDebugger.Send(arp_reply.ToString());
- Global.mDebugger.Send("ARP Reply Recvd from " + arp_reply.SenderIP.ToString());
- ARPCache.Update(arp_reply.SenderIP, arp_reply.SenderMAC);
+ var arpReply = new ARPReplyEthernet(packetData);
+ NetworkStack.Debugger.Send("Received ARP reply:");
+ NetworkStack.Debugger.Send(arpReply.ToString());
+ NetworkStack.Debugger.Send("ARP reply received from " + arpReply.SenderIP.ToString());
+ ARPCache.Update(arpReply.SenderIP, arpReply.SenderMAC);
- OutgoingBuffer.ARPCache_Update(arp_reply);
+ OutgoingBuffer.UpdateARPCache(arpReply);
}
}
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal ARPPacket()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
public ARPPacket(byte[] rawData)
: base(rawData)
{ }
- ///
- /// Init ARPPacket fields.
- ///
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
- aHardwareType = (ushort)((RawData[14] << 8) | RawData[15]);
- aProtocolType = (ushort)((RawData[16] << 8) | RawData[17]);
- aHardwareLen = RawData[18];
- aProtocolLen = RawData[19];
- aOperation = (ushort)((RawData[20] << 8) | RawData[21]);
+ base.InitializeFields();
+ hardwareType = (ushort)((RawData[14] << 8) | RawData[15]);
+ protocolType = (ushort)((RawData[16] << 8) | RawData[17]);
+ hardwareAddrLength = RawData[18];
+ protocolAddrLength = RawData[19];
+ opCode = (ushort)((RawData[20] << 8) | RawData[21]);
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Destination MAC address.
/// Source MAC address.
@@ -143,29 +126,27 @@ protected ARPPacket(MACAddress dest, MACAddress src, ushort hwType, ushort proto
RawData[20] = (byte)(operation >> 8);
RawData[21] = (byte)(operation >> 0);
- InitFields();
+ InitializeFields();
}
///
- /// Get operation.
+ /// Gets the operation code.
///
- internal ushort Operation => aOperation;
- ///
- /// Get hardware type.
- ///
- internal ushort HardwareType => aHardwareType;
+ internal ushort Operation => opCode;
+
///
- /// Get protocol type.
+ /// Get the hardware type.
///
- internal ushort ProtocolType => aProtocolType;
+ internal ushort HardwareType => hardwareType;
///
- /// To string.
+ /// Gets the protocol type.
///
- /// string value.
+ internal ushort ProtocolType => protocolType;
+
public override string ToString()
{
- return "ARP Packet Src=" + srcMAC + ", Dest=" + destMAC + ", HWType=" + aHardwareType + ", Protocol=" + aProtocolType +
+ return "ARP Packet Src=" + srcMAC + ", Dest=" + destMAC + ", HWType=" + hardwareType + ", Protocol=" + protocolType +
", Operation=" + Operation;
}
}
diff --git a/source/Cosmos.System2/Network/ARP/ARPPacketEthernet.cs b/source/Cosmos.System2/Network/ARP/ARPPacketEthernet.cs
new file mode 100644
index 0000000000..dd0c717503
--- /dev/null
+++ b/source/Cosmos.System2/Network/ARP/ARPPacketEthernet.cs
@@ -0,0 +1,202 @@
+using System;
+using Cosmos.HAL.Network;
+using Cosmos.System.Network.IPv4;
+
+namespace Cosmos.System.Network.ARP
+{
+ ///
+ /// Represents an ARP Ethernet packet.
+ ///
+ ///
+ /// See also: .
+ ///
+ internal abstract class ARPPacketEthernet : ARPPacket
+ {
+ ///
+ /// The sender MAC address.
+ ///
+ protected MACAddress senderMAC;
+
+ ///
+ /// The target MAC address.
+ ///
+ protected MACAddress targetMAC;
+
+ ///
+ /// The sender IP address.
+ ///
+ protected Address senderIP;
+
+ ///
+ /// The target IP address.
+ ///
+ protected Address targetIP;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ internal ARPPacketEthernet()
+ : base()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Raw data.
+ internal ARPPacketEthernet(byte[] rawData)
+ : base(rawData)
+ { }
+
+ protected override void InitializeFields()
+ {
+ base.InitializeFields();
+ senderMAC = new MACAddress(RawData, 22);
+ senderIP = new Address(RawData, 28);
+ targetMAC = new MACAddress(RawData, 32);
+ targetIP = new Address(RawData, 38);
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The operation.
+ /// The source MAC address.
+ /// The source IP address.
+ /// The destination MAC address.
+ /// The destination IP address.
+ /// The packet size.
+ /// The ARP destination MAC address.
+ /// Thrown if RawData is invalid or null.
+ protected ARPPacketEthernet(ushort operation, MACAddress senderMAC, Address senderIP,
+ MACAddress targetMAC, Address targetIP, int packetSize, MACAddress arpTargetMAC)
+ : base(targetMAC, senderMAC, 1, 0x0800, 6, 4, operation, packetSize)
+ {
+ for (int i = 0; i < 6; i++)
+ {
+ RawData[22 + i] = senderMAC.bytes[i];
+ RawData[32 + i] = arpTargetMAC.bytes[i];
+ }
+ for (int i = 0; i < 4; i++)
+ {
+ RawData[28 + i] = senderIP.Parts[i];
+ RawData[38 + i] = targetIP.Parts[i];
+ }
+
+ InitializeFields();
+ }
+
+ ///
+ /// Gets the senders MAC address.
+ ///
+ internal MACAddress SenderMAC => senderMAC;
+
+ ///
+ /// Gets the targets MAC address.
+ ///
+ internal MACAddress TargetMAC => targetMAC;
+
+ ///
+ /// Gets the senders IP address.
+ ///
+ internal Address SenderIP => senderIP;
+
+ ///
+ /// Gets the targets IP address.
+ ///
+ internal Address TargetIP => targetIP;
+
+ public override string ToString()
+ {
+ return "IPv4 Ethernet ARP Packet SenderMAC=" + senderMAC + ", TargetMAC=" + targetMAC + ", SenderIP=" + senderIP +
+ ", TargetIP=" + targetIP + ", Operation=" + opCode;
+ }
+ }
+
+ ///
+ /// Represents an ARP reply Ethernet packet.
+ ///
+ ///
+ /// See also: .
+ ///
+ internal class ARPReplyEthernet : ARPPacketEthernet
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ internal ARPReplyEthernet()
+ : base()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Raw data.
+ internal ARPReplyEthernet(byte[] rawData)
+ : base(rawData)
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The source MAC address.
+ /// The source IP address.
+ /// The destination MAC address.
+ /// The destination IP address.
+ /// Thrown if RawData is invalid or null.
+ internal ARPReplyEthernet(MACAddress ourMAC, Address ourIP, MACAddress targetMAC, Address targetIP)
+ : base(2, ourMAC, ourIP, targetMAC, targetIP, 42, MACAddress.None)
+ { }
+
+ public override string ToString()
+ {
+ return "ARP Reply Src=" + srcMAC + ", Dest=" + destMAC + ", Sender=" + senderIP + ", Target=" + targetIP;
+ }
+ }
+
+ ///
+ /// Represents an ARP request Ethernet packet.
+ ///
+ ///
+ /// See also: .
+ ///
+ internal class ARPRequestEthernet : ARPPacketEthernet
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ internal ARPRequestEthernet()
+ : base()
+ { }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Raw data.
+ internal ARPRequestEthernet(byte[] rawData)
+ : base(rawData)
+ {
+ if (SenderIP == null)
+ {
+ Global.Debugger.Send("In ARPRequest_Ethernet, SenderIP is null!");
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The source MAC address.
+ /// The source IP address.
+ /// The destination MAC address.
+ /// The destination IP address.
+ /// The ARP destination MAC address.
+ /// Thrown if RawData is invalid or null.
+ internal ARPRequestEthernet(MACAddress ourMAC, Address ourIP, MACAddress targetMAC, Address targetIP, MACAddress arpTargetMAC)
+ : base(1, ourMAC, ourIP, targetMAC, targetIP, 42, arpTargetMAC)
+ { }
+
+ public override string ToString()
+ {
+ return "ARP Request Src=" + srcMAC + ", Dest=" + destMAC + ", Sender=" + senderIP + ", Target=" + targetIP;
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Network/ARP/ARPPacket_Ethernet.cs b/source/Cosmos.System2/Network/ARP/ARPPacket_Ethernet.cs
deleted file mode 100644
index 759c8b21a1..0000000000
--- a/source/Cosmos.System2/Network/ARP/ARPPacket_Ethernet.cs
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: ARP Packet ethernet
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
-using Cosmos.HAL;
-using Cosmos.HAL.Network;
-using Cosmos.System.Network.ARP;
-using Cosmos.System.Network.IPv4;
-using Sys = System;
-
-namespace Cosmos.System.Network.ARP
-{
- ///
- /// ARPPacket_Ethernet abstract class. See also:
- ///
- internal abstract class ARPPacket_Ethernet : ARPPacket
- {
- ///
- /// Sender MAC address.
- ///
- protected MACAddress mSenderMAC;
- ///
- /// Target MAC address.
- ///
- protected MACAddress mTargetMAC;
- ///
- /// Sender IP address.
- ///
- protected Address mSenderIP;
- ///
- /// Target IP address.
- ///
- protected Address mTargetIP;
-
- ///
- /// Create new instance of the class.
- ///
- internal ARPPacket_Ethernet()
- : base()
- { }
-
- ///
- /// Create new instance of the class.
- ///
- /// Raw data.
- internal ARPPacket_Ethernet(byte[] rawData)
- : base(rawData)
- { }
-
- ///
- /// Init ARPPacket_Ethernet fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
- {
- base.InitFields();
- mSenderMAC = new MACAddress(RawData, 22);
- mSenderIP = new Address(RawData, 28);
- if (SenderIP == null)
- {
- Global.mDebugger.Send("But its already null again");
- }
- mTargetMAC = new MACAddress(RawData, 32);
- mTargetIP = new Address(RawData, 38);
- }
-
- ///
- /// Create new instance of the class.
- ///
- /// Operation.
- /// Source MAC address.
- /// Source IP address.
- /// Destination MAC address.
- /// Destination IP address.
- /// Packet size.
- /// ARP destination MAC address.
- /// Thrown if RawData is invalid or null.
- protected ARPPacket_Ethernet(ushort operation, MACAddress senderMAC, Address senderIP,
- MACAddress targetMAC, Address targetIP, int packet_size, MACAddress arpTargetMAC)
- : base(targetMAC, senderMAC, 1, 0x0800, 6, 4, operation, packet_size)
- {
- for (int i = 0; i < 6; i++)
- {
- RawData[22 + i] = senderMAC.bytes[i];
- RawData[32 + i] = arpTargetMAC.bytes[i];
- }
- for (int i = 0; i < 4; i++)
- {
- RawData[28 + i] = senderIP.address[i];
- RawData[38 + i] = targetIP.address[i];
- }
-
- InitFields();
- }
-
- ///
- /// Get sender MAC.
- ///
- internal MACAddress SenderMAC
- {
- get { return this.mSenderMAC; }
- }
-
- ///
- /// Get target MAC.
- ///
- internal MACAddress TargetMAC
- {
- get { return this.mTargetMAC; }
- }
-
- ///
- /// Get sender IP.
- ///
- internal Address SenderIP
- {
- get { return this.mSenderIP; }
- }
-
- ///
- /// Get target IP.
- ///
- internal Address TargetIP
- {
- get { return this.mTargetIP; }
- }
-
- ///
- /// To string.
- ///
- /// string value.
- public override string ToString()
- {
- return "IPv4 Ethernet ARP Packet SenderMAC=" + mSenderMAC + ", TargetMAC=" + mTargetMAC + ", SenderIP=" + mSenderIP +
- ", TargetIP=" + mTargetIP + ", Operation=" + aOperation;
- }
- }
-
- ///
- /// ARPRequest_Ethernet class. See also: .
- ///
- internal class ARPReply_Ethernet : ARPPacket_Ethernet
- {
- ///
- /// Create new instance of the class.
- ///
- internal ARPReply_Ethernet()
- : base()
- { }
-
- ///
- /// Create new instance of the class.
- ///
- /// Raw data.
- internal ARPReply_Ethernet(byte[] rawData)
- : base(rawData)
- { }
-
- ///
- /// Create new instance of the class.
- ///
- /// Source MAC address.
- /// Source IP address.
- /// Destination MAC address.
- /// Destination IP address.
- /// Thrown if RawData is invalid or null.
- internal ARPReply_Ethernet(MACAddress ourMAC, Address ourIP, MACAddress targetMAC, Address targetIP)
- : base(2, ourMAC, ourIP, targetMAC, targetIP, 42, MACAddress.None)
- { }
-
- ///
- /// To string.
- ///
- /// string value.
- public override string ToString()
- {
- return "ARP Reply Src=" + srcMAC + ", Dest=" + destMAC + ", Sender=" + mSenderIP + ", Target=" + mTargetIP;
- }
- }
-
- ///
- /// ARPRequest_Ethernet class. See also: .
- ///
- internal class ARPRequest_Ethernet : ARPPacket_Ethernet
- {
- ///
- /// Create new instance of the class.
- ///
- internal ARPRequest_Ethernet()
- : base()
- { }
-
- ///
- /// Create new instance of the class.
- ///
- /// Raw data.
- internal ARPRequest_Ethernet(byte[] rawData)
- : base(rawData)
- {
- if (SenderIP == null)
- {
- Global.mDebugger.Send("In ARPRequest_Ethernet, SenderIP is null!");
- }
- }
-
- ///
- /// Create new instance of the class.
- ///
- /// Source MAC address.
- /// Source IP address.
- /// Destination MAC address.
- /// Destination IP address.
- /// ARP destination MAC address.
- /// Thrown if RawData is invalid or null.
- internal ARPRequest_Ethernet(MACAddress ourMAC, Address ourIP, MACAddress targetMAC, Address targetIP, MACAddress arpTargetMAC)
- : base(1, ourMAC, ourIP, targetMAC, targetIP, 42, arpTargetMAC)
- { }
-
- ///
- /// To string.
- ///
- /// string value.
- public override string ToString()
- {
- return "ARP Request Src=" + srcMAC + ", Dest=" + destMAC + ", Sender=" + mSenderIP + ", Target=" + mTargetIP;
- }
- }
-}
diff --git a/source/Cosmos.System2/Network/Config/DNSConfig.cs b/source/Cosmos.System2/Network/Config/DNSConfig.cs
index 7967b580f5..fb27adcd00 100644
--- a/source/Cosmos.System2/Network/Config/DNSConfig.cs
+++ b/source/Cosmos.System2/Network/Config/DNSConfig.cs
@@ -6,24 +6,24 @@
namespace Cosmos.System.Network.Config
{
///
- /// Contains DNS configuration
+ /// Represents DNS configuration.
///
public class DNSConfig
{
///
- /// DNS Addresses list.
+ /// The list of known DNS nameserver addresses.
///
- public static List DNSNameservers = new List();
+ public readonly static List DNSNameservers = new();
///
- /// Add IPv4 configuration.
+ /// Registers a given DNS server.
///
- ///
+ /// The IP address of the target DNS server.
public static void Add(Address nameserver)
{
for (int i = 0; i < DNSNameservers.Count; i++)
{
- if (DNSNameservers[i].address.Equals(nameserver))
+ if (DNSNameservers[i].Parts.Equals(nameserver))
{
return;
}
@@ -32,29 +32,19 @@ public static void Add(Address nameserver)
}
///
- /// Remove IPv4 configuration.
+ /// Removes the given DNS server from the list of registered nameservers.
///
- ///
+ /// The IP address of the target DNS server.
public static void Remove(Address nameserver)
{
for (int i = 0; i < DNSNameservers.Count; i++)
{
- if (DNSNameservers[i].address.Equals(nameserver))
+ if (DNSNameservers[i].Parts.Equals(nameserver))
{
DNSNameservers.RemoveAt(i);
return;
}
}
}
-
- ///
- /// Call this to get your adress to request your DNS server
- ///
- /// Which server you want to get
- /// DNS Server
- public static Address Server(int index)
- {
- return DNSNameservers[index];
- }
}
}
diff --git a/source/Cosmos.System2/Network/Config/IPConfig.cs b/source/Cosmos.System2/Network/Config/IPConfig.cs
index 7efba9b5e1..c2f5ca4eef 100644
--- a/source/Cosmos.System2/Network/Config/IPConfig.cs
+++ b/source/Cosmos.System2/Network/Config/IPConfig.cs
@@ -1,12 +1,4 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: List of all IPs / Utils
-* PROGRAMMERS: Valentin Charbonnier
-* Alexy DA CRUZ
-* Port of Cosmos Code.
-*/
-
-using System.Collections.Generic;
+using System.Collections.Generic;
using System;
using Cosmos.System.Network.IPv4;
using Cosmos.HAL;
@@ -14,28 +6,23 @@
namespace Cosmos.System.Network.Config
{
///
- /// Contains a IPv4 configuration
+ /// Represents IPv4 configuration.
///
public class IPConfig
{
- ///
- /// IPv4 configurations list.
- ///
- private static readonly List ipConfigs = new List();
+ private static readonly List ipConfigs = new();
///
- /// Add IPv4 configuration.
+ /// Add the given IPv4 configuration.
///
- ///
internal static void Add(IPConfig config)
{
ipConfigs.Add(config);
}
///
- /// Remove IPv4 configuration.
+ /// Removes the given IPv4 configuration.
///
- ///
internal static void Remove(IPConfig config)
{
int counter = 0;
@@ -52,7 +39,7 @@ internal static void Remove(IPConfig config)
}
///
- /// Remove All IPv4 configuration.
+ /// Remove all IPv4 configurations.
///
internal static void RemoveAll()
{
@@ -60,14 +47,13 @@ internal static void RemoveAll()
}
///
- /// Find network.
+ /// Finds the network address for the specified destination IP address.
///
- /// Destination IP address.
- /// Address value.
- /// Thrown on fatal error (contact support).
+ /// The destination IP address.
+ /// Thrown on fatal error.
public static Address FindNetwork(Address destIP)
{
- Address default_gw = null;
+ Address defaultGw = null;
foreach (IPConfig ipConfig in ipConfigs)
{
@@ -76,9 +62,9 @@ public static Address FindNetwork(Address destIP)
{
return ipConfig.IPAddress;
}
- if (default_gw == null && ipConfig.DefaultGateway.CompareTo(Address.Zero) != 0)
+ if (defaultGw == null && ipConfig.DefaultGateway.CompareTo(Address.Zero) != 0)
{
- default_gw = ipConfig.IPAddress;
+ defaultGw = ipConfig.IPAddress;
}
if (!IsLocalAddress(destIP))
@@ -87,26 +73,33 @@ public static Address FindNetwork(Address destIP)
}
}
- return default_gw;
+ return defaultGw;
}
+ ///
+ /// Enables a network device with the specified IP configuration.
+ ///
+ /// The network device to enable.
+ /// The IP address to assign to the device.
+ /// The subnet mask to use for the device.
+ /// The default gateway address to use for the device.
+ /// if the device was successfully enabled, otherwise.
public static bool Enable(NetworkDevice device, Address ip, Address subnet, Address gw)
{
if (device != null)
{
var config = new IPConfig(ip, subnet, gw);
NetworkStack.ConfigIP(device, config);
- Global.mDebugger.Send("Config OK.");
+ NetworkStack.Debugger.Send("Config OK.");
return true;
}
return false;
}
///
- /// Check if address is local address.
+ /// Check if the given address is a local address.
///
- /// Address to check.
- /// bool value.
+ /// The address to check.
internal static bool IsLocalAddress(Address destIP)
{
for (int c = 0; c < ipConfigs.Count; c++)
@@ -122,10 +115,9 @@ internal static bool IsLocalAddress(Address destIP)
}
///
- /// Find interface.
+ /// Find the interface by the given IP address.
///
/// Source IP.
- /// NetworkDevice value.
internal static NetworkDevice FindInterface(Address sourceIP)
{
return NetworkStack.AddressMap[sourceIP.Hash];
@@ -136,7 +128,7 @@ internal static NetworkDevice FindInterface(Address sourceIP)
///
/// Destination IP.
/// Address value.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
internal static Address FindRoute(Address destIP)
{
for (int c = 0; c < ipConfigs.Count; c++)
@@ -151,7 +143,7 @@ internal static Address FindRoute(Address destIP)
}
///
- /// Create a IPv4 Configuration with no default gateway
+ /// Creates a IPv4 Configuration with no default gateway.
///
/// IP Address
/// Subnet Mask
@@ -161,7 +153,7 @@ public IPConfig(Address ip, Address subnet)
}
///
- /// Create a IPv4 Configuration
+ /// Creates a IPv4 Configuration.
///
/// IP Address
/// Subnet Mask
@@ -174,15 +166,17 @@ public IPConfig(Address ip, Address subnet, Address gw)
}
///
- /// Get IP address.
+ /// The IP address.
///
public Address IPAddress { get; }
+
///
- /// Get subnet mask.
+ /// The subnet mask.
///
public Address SubnetMask { get; }
+
///
- /// Get default gateway.
+ /// The default gateway address.
///
public Address DefaultGateway { get; }
}
diff --git a/source/Cosmos.System2/Network/Config/NetworkConfig.cs b/source/Cosmos.System2/Network/Config/NetworkConfig.cs
index f50bbebe54..f3db9d9b81 100644
--- a/source/Cosmos.System2/Network/Config/NetworkConfig.cs
+++ b/source/Cosmos.System2/Network/Config/NetworkConfig.cs
@@ -1,160 +1,27 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: Network dictionary
-* PROGRAMMERS: Valentin Charbonnier
-*/
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using Cosmos.HAL;
-using Cosmos.System.Network.IPv4;
+using Cosmos.HAL;
namespace Cosmos.System.Network.Config
{
///
- /// Network Configuration (link network device to an ip address)
+ /// Represents network configuration, linking a network device
+ /// to an IP address.
///
public class NetworkConfig
{
///
- /// Network device
+ /// The network device associated with this instance.
///
public NetworkDevice Device;
///
- /// IPv4 Configuration
+ /// The IPv4 configuration.
///
public IPConfig IPConfig;
- ///
- /// NetworkConfig ctor
- ///
- /// Network device.
- /// IP Config
internal NetworkConfig(NetworkDevice device, IPConfig config)
{
Device = device;
IPConfig = config;
}
}
-
- ///
- /// Network stack configuration
- ///
- public static class NetworkConfiguration
- {
- ///
- /// Current network configuration used by the network stack
- ///
- public static NetworkConfig CurrentNetworkConfig { get; set; }
-
- ///
- /// Current network configuration used by the network stack
- ///
- public static List NetworkConfigs = new List();
-
- ///
- /// Network congiruations count
- ///
- public static int Count
- {
- get { return NetworkConfigs.Count; }
- }
-
- ///
- /// Current IPv4 address
- ///
- public static Address CurrentAddress
- {
- get { return CurrentNetworkConfig.IPConfig.IPAddress; }
- }
-
- ///
- /// Set current network config
- ///
- /// Network device.
- /// IP Config
- public static void SetCurrentConfig(NetworkDevice device, IPConfig config)
- {
- CurrentNetworkConfig = new NetworkConfig(device, config);
- }
-
- ///
- /// Add new network config
- ///
- /// Network device.
- /// IP Config
- public static void AddConfig(NetworkDevice device, IPConfig config)
- {
- NetworkConfigs.Add(new NetworkConfig(device, config));
- }
-
- ///
- /// Network stack contains device
- ///
- /// Network device.
- public static bool ConfigsContainsDevice(NetworkDevice k)
- {
- if (NetworkConfigs == null)
- {
- return false;
- }
- else
- {
- foreach (var device in NetworkConfigs)
- {
- if (k == device.Device)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- ///
- /// Clear network configurations
- ///
- public static void ClearConfigs()
- {
- NetworkConfigs.Clear();
- }
-
- ///
- /// Get ip config for network device
- ///
- /// Network device.
- public static IPConfig Get(NetworkDevice device)
- {
- foreach (var networkConfig in NetworkConfigs)
- {
- if (device == networkConfig.Device)
- {
- return networkConfig.IPConfig;
- }
- }
-
- return null;
- }
-
- ///
- /// Remove Config for network device
- ///
- /// Network device.
- public static void Remove(NetworkDevice key)
- {
- int index = 0;
-
- foreach (var networkConfig in NetworkConfigs)
- {
- if (key == networkConfig.Device)
- {
- break;
- }
- index++;
- }
- NetworkConfigs.RemoveAt(index);
- }
- }
}
diff --git a/source/Cosmos.System2/Network/Config/NetworkConfiguration.cs b/source/Cosmos.System2/Network/Config/NetworkConfiguration.cs
new file mode 100644
index 0000000000..6b61df539a
--- /dev/null
+++ b/source/Cosmos.System2/Network/Config/NetworkConfiguration.cs
@@ -0,0 +1,119 @@
+using System.Collections.Generic;
+using Cosmos.HAL;
+using Cosmos.System.Network.IPv4;
+
+namespace Cosmos.System.Network.Config
+{
+ ///
+ /// Represents the global network stack configuration.
+ ///
+ public static class NetworkConfiguration
+ {
+ ///
+ /// The current network configuration used by the network stack.
+ ///
+ public static NetworkConfig CurrentNetworkConfig { get; set; }
+
+ ///
+ /// The current network configuration list used by the network stack.
+ ///
+ public readonly static List NetworkConfigs = new();
+
+ ///
+ /// Gets the amount of available network configurations.
+ ///
+ public static int Count => NetworkConfigs.Count;
+
+ ///
+ /// Gets the current IPv4 address.
+ ///
+ public static Address CurrentAddress => CurrentNetworkConfig.IPConfig.IPAddress;
+
+ ///
+ /// Sets the configuration of the current network.
+ ///
+ /// The network device to use.
+ /// The IPv4 configuration associated with the device to use.
+ public static void SetCurrentConfig(NetworkDevice device, IPConfig config)
+ {
+ CurrentNetworkConfig = new NetworkConfig(device, config);
+ }
+
+ ///
+ /// Adds a new network configuration.
+ ///
+ /// The network device to use.
+ /// The IPv4 configuration associated with the device to use.
+ public static void AddConfig(NetworkDevice device, IPConfig config)
+ {
+ NetworkConfigs.Add(new NetworkConfig(device, config));
+ }
+
+ ///
+ /// Returns whether the network stack contains the given network device.
+ ///
+ public static bool ConfigsContainsDevice(NetworkDevice targetDevice)
+ {
+ if (NetworkConfigs == null)
+ {
+ return false;
+ }
+ else
+ {
+ foreach (var device in NetworkConfigs)
+ {
+ if (targetDevice == device.Device)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ ///
+ /// Clears network configurations, removing each configuration.
+ ///
+ public static void ClearConfigs()
+ {
+ NetworkConfigs.Clear();
+ }
+
+ ///
+ /// Get the IPv4 configuration for the given network device.
+ ///
+ /// Network device.
+ public static IPConfig Get(NetworkDevice device)
+ {
+ foreach (var networkConfig in NetworkConfigs)
+ {
+ if (device == networkConfig.Device)
+ {
+ return networkConfig.IPConfig;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Remove the configuration for the given network device.
+ ///
+ /// The target network device.
+ public static void Remove(NetworkDevice key)
+ {
+ int index = 0;
+
+ foreach (var networkConfig in NetworkConfigs)
+ {
+ if (key == networkConfig.Device)
+ {
+ break;
+ }
+ index++;
+ }
+
+ NetworkConfigs.RemoveAt(index);
+ }
+ }
+}
diff --git a/source/Cosmos.System2/Network/EthernetPacket.cs b/source/Cosmos.System2/Network/EthernetPacket.cs
index f81f828d65..221e5a0ab0 100644
--- a/source/Cosmos.System2/Network/EthernetPacket.cs
+++ b/source/Cosmos.System2/Network/EthernetPacket.cs
@@ -1,51 +1,37 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: Ethernet frame
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
-using Cosmos.HAL.Network;
+using Cosmos.HAL.Network;
namespace Cosmos.System.Network
{
- // for more info, http://standards.ieee.org/about/get/802/802.3.html
///
- /// EthernetPacket class.
+ /// Represents an Ethernet packet.
///
+ // For more info, refer to http://standards.ieee.org/about/get/802/802.3.html
public class EthernetPacket
{
- ///
- /// Source MAC address.
- ///
protected MACAddress srcMAC;
- ///
- /// Destination MAC address.
- ///
protected MACAddress destMAC;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
protected EthernetPacket()
{
}
///
- /// Create new instance of the class, with specified raw data.
+ /// Initializes a new instance of the class, with specified raw data.
///
- /// Raw data.
+ /// The raw data of the packet.
public EthernetPacket(byte[] rawData)
{
RawData = rawData;
- InitFields();
+ InitializeFields();
}
///
- /// Init EthernetPacket fields.
+ /// Initializes all internal fields.
///
- protected virtual void InitFields()
+ protected virtual void InitializeFields()
{
destMAC = new MACAddress(RawData, 0);
srcMAC = new MACAddress(RawData, 6);
@@ -53,25 +39,19 @@ protected virtual void InitFields()
}
///
- /// Create new instance of the class, with specified type and size.
+ /// Initializes a new instance of the class, with specified type and size.
///
- /// Type.
- /// Size.
- protected EthernetPacket(ushort type, int packet_size)
- : this(MACAddress.None, MACAddress.None, type, packet_size)
+ protected EthernetPacket(ushort type, int packetSize)
+ : this(MACAddress.None, MACAddress.None, type, packetSize)
{
}
///
- /// Create new instance of the class, with specified dsetination, source, type and size.
+ /// Initializes a new instance of the class, with specified dsetination, source, type and size.
///
- /// Destination.
- /// Source.
- /// Type.
- /// Size.
- protected EthernetPacket(MACAddress dest, MACAddress src, ushort type, int packet_size)
+ protected EthernetPacket(MACAddress dest, MACAddress src, ushort type, int packetSize)
{
- RawData = new byte[packet_size];
+ RawData = new byte[packetSize];
for (int i = 0; i < 6; i++)
{
RawData[i] = dest.bytes[i];
@@ -80,16 +60,16 @@ protected EthernetPacket(MACAddress dest, MACAddress src, ushort type, int packe
RawData[12] = (byte)(type >> 8);
RawData[13] = (byte)(type >> 0);
- InitFields();
+ InitializeFields();
}
///
- /// Get raw data byte array.
+ /// Gets the raw data of the packet in the form of a byte array.
///
public byte[] RawData { get; }
///
- /// Get and set source MAC address.
+ /// The source MAC address.
///
internal MACAddress SourceMAC
{
@@ -100,12 +80,12 @@ internal MACAddress SourceMAC
{
RawData[6 + i] = value.bytes[i];
}
- InitFields();
+ InitializeFields();
}
}
///
- /// Get and set destination MAC address.
+ /// The destination MAC address.
///
internal MACAddress DestinationMAC
{
@@ -116,25 +96,21 @@ internal MACAddress DestinationMAC
{
RawData[i] = value.bytes[i];
}
- InitFields();
+
+ InitializeFields();
}
}
///
- /// Get packet type.
+ /// The type of the packet.
///
internal ushort EthernetType { get; private set; }
///
- /// Prepare packet for sending.
- /// Not implemented.
+ /// Prepares the packet for sending. Not implemented.
///
internal virtual void PrepareForSending() { }
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "Ethernet Packet : Src=" + srcMAC + ", Dest=" + destMAC + ", Type=" + EthernetType;
diff --git a/source/Cosmos.System2/Network/IPv4/Address.cs b/source/Cosmos.System2/Network/IPv4/Address.cs
index ef33d0cf4c..82939b8da1 100644
--- a/source/Cosmos.System2/Network/IPv4/Address.cs
+++ b/source/Cosmos.System2/Network/IPv4/Address.cs
@@ -10,25 +10,27 @@
namespace Cosmos.System.Network.IPv4
{
///
- /// Address class, used to define a IPv4 address.
- /// Should actually be using System.Net.IPAddress, but gives problems.
+ /// Represents a IPv4 address.
///
+ // Should actually be using System.Net.IPAddress, but gives problems.
public class Address : IComparable
{
+ private uint hash;
+
///
- /// Predefined 0.0.0.0 address.
+ /// The parts of the address.
///
- public static Address Zero = new Address(0, 0, 0, 0);
+ internal byte[] Parts = new byte[4];
///
- /// Broadcast address (255.255.255.255).
+ /// The 0.0.0.0 IP address.
///
- public static Address Broadcast = new Address(255, 255, 255, 255);
+ public static readonly Address Zero = new(0, 0, 0, 0);
///
- /// address as byte array.
+ /// The broadcast address (255.255.255.255).
///
- internal byte[] address = new byte[4];
+ public static readonly Address Broadcast = new(255, 255, 255, 255);
///
/// Create new instance of the class, with specified IP address.
@@ -39,10 +41,10 @@ public class Address : IComparable
/// Fourth block of the address.
public Address(byte aFirst, byte aSecond, byte aThird, byte aFourth)
{
- address[0] = aFirst;
- address[1] = aSecond;
- address[2] = aThird;
- address[3] = aFourth;
+ Parts[0] = aFirst;
+ Parts[1] = aSecond;
+ Parts[2] = aThird;
+ Parts[3] = aFourth;
}
///
@@ -53,27 +55,28 @@ public Address(byte aFirst, byte aSecond, byte aThird, byte aFourth)
/// Thrown if buffer is invalid or null.
public Address(byte[] buffer, int offset)
{
- if (buffer == null || buffer.Length < offset + 4)
- throw new ArgumentException("buffer does not contain enough data starting at offset", "buffer");
+ if (buffer == null || buffer.Length < offset + 4) {
+ throw new ArgumentException("The buffer does not contain enough data starting at 'offset'.", nameof(buffer));
+ }
- address[0] = buffer[offset];
- address[1] = buffer[offset + 1];
- address[2] = buffer[offset + 2];
- address[3] = buffer[offset + 3];
+ Parts[0] = buffer[offset];
+ Parts[1] = buffer[offset + 1];
+ Parts[2] = buffer[offset + 2];
+ Parts[3] = buffer[offset + 3];
}
///
- /// Parse a IP address in string representation.
+ /// Parses a IP address in its string representation.
///
- /// IP address as string.
- /// Address value.
- /// Thrown if adr is longer than Int32.MaxValue.
- /// Thrown if adr is null.
- /// Thrown if adr is not in the right format.
- /// Thrown if adr represents a number less than Byte.MinValue or greater than Byte.MaxValue.
- public static Address Parse(string adr)
+ /// The IP address as string.
+ /// The parsed address value.
+ /// Thrown if addr is longer than .
+ /// Thrown if addr is null.
+ /// Thrown if addr is not in the right format.
+ /// Thrown if addr represents a number less than Byte.MinValue or greater than .
+ public static Address Parse(string addr)
{
- string[] fragments = adr.Split('.');
+ string[] fragments = addr.Split('.');
if (fragments.Length == 4)
{
try
@@ -96,10 +99,9 @@ public static Address Parse(string adr)
}
///
- /// Convert CIDR number to IPv4 Address
+ /// Convert a CIDR number to an IPv4 address.
///
- /// CIDR number.
- ///
+ /// The CIDR number.
public static Address CIDRToAddress(int cidr)
{
try
@@ -114,110 +116,74 @@ public static Address CIDRToAddress(int cidr)
}
///
- /// Check if address is a loopback address.
+ /// Check if this address is a loopback address.
///
- ///
- public bool IsLoopbackAddress()
- {
- if (address[0] == 127)
- return true;
- else
- return false;
- }
+ public bool IsLoopbackAddress() => Parts[0] == 127;
///
- /// Check if address is a broadcast address.
+ /// Check if this address is a broadcast address.
///
- ///
public bool IsBroadcastAddress() =>
- address[0] == 0xFF
- && address[1] == 0xFF
- && address[2] == 0xFF
- && address[3] == 0xFF;
+ Parts[0] == 0xFF
+ && Parts[1] == 0xFF
+ && Parts[2] == 0xFF
+ && Parts[3] == 0xFF;
///
- /// Check if address is a APIPA address.
+ /// Check if this address is an APIPA address.
///
- ///
- public bool IsAPIPA()
- {
- if (address[0] == 169 && address[1] == 254)
- {
- return true;
- }
+ public bool IsAPIPA() => Parts[0] == 169 && Parts[1] == 254;
- return false;
- }
-
- ///
- /// Converts IP Address to String.
- ///
- /// String with IP Address in dotted notation
public override string ToString()
{
return
- address[0] +
+ Parts[0] +
"." +
- address[1] +
+ Parts[1] +
"." +
- address[2] +
+ Parts[2] +
"." +
- address[3];
+ Parts[3];
}
///
- /// Convert address to byte array.
+ /// Returns the underlying parts array. Modifying the returned
+ /// array will also modify the address.
///
- ///
public byte[] ToByteArray()
{
- return address;
+ return Parts;
}
///
- /// Convert address to 32 bit number.
+ /// Convert this address to a 32-bit number.
///
- /// UInt32 value.
- private UInt32 to32BitNumber()
+ private uint ToUInt32()
{
- return (UInt32)((address[0] << 24) | (address[1] << 16) | (address[2] << 8) | (address[3] << 0));
+ return (uint)((Parts[0] << 24) | (Parts[1] << 16) | (Parts[2] << 8) | (Parts[3] << 0));
}
///
- /// Hashed value for the IP.
+ /// The hash value for this IP. Used to uniquely identify each IP.
///
- private UInt32 hash;
-
- ///
- /// Hash value for this IP. Used to uniquely identify each IP
- ///
- public UInt32 Hash
+ public uint Hash
{
get
{
if (hash == 0)
{
- hash = to32BitNumber();
+ hash = ToUInt32();
}
return hash;
}
}
- #region IComparable Members
-
- ///
- /// Compare 2 IP Address objects for equality
- ///
- /// Other IP to compare with.
- /// 0 if equal, or non-zero otherwise
- /// Thrown if obj is not a IPv4Address.
public int CompareTo(object obj)
{
- if (obj is Address)
+ if (obj is Address other)
{
- Address other = (Address)obj;
- if (other.hash != this.hash)
+ if (other.hash != hash)
{
return -1;
}
@@ -225,9 +191,9 @@ public int CompareTo(object obj)
return 0;
}
else
- throw new ArgumentException("obj is not a IPv4Address", "obj");
+ {
+ throw new ArgumentException("obj is not a IPv4Address", nameof(obj));
+ }
}
-
- #endregion
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/EndPoint.cs b/source/Cosmos.System2/Network/IPv4/EndPoint.cs
index 72ab58c614..34f11411dd 100644
--- a/source/Cosmos.System2/Network/IPv4/EndPoint.cs
+++ b/source/Cosmos.System2/Network/IPv4/EndPoint.cs
@@ -1,60 +1,42 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: End point
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
+using System;
namespace Cosmos.System.Network.IPv4
{
///
- /// EndPoint class.
+ /// Represents an IPv4 end-point.
///
public class EndPoint : IComparable
{
///
- /// Address.
+ /// The address of the end-point.
///
public Address Address;
+
///
- /// Port.
+ /// The port of the end-point.
///
public ushort Port;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Adress.
- /// Port.
+ /// The IPv4 address.
+ /// The port.
public EndPoint(Address addr, ushort port)
{
Address = addr;
Port = port;
}
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return Address.ToString() + ":" + Port.ToString();
}
- ///
- /// Compare end points.
- ///
- /// Other end point to compare to.
- /// -1 if end points are diffrent, 0 if equal.
- /// Thrown if obj is not a EndPoint.
public int CompareTo(object obj)
{
- if (obj is EndPoint)
+ if (obj is EndPoint other)
{
- var other = (EndPoint)obj;
-
if (other.Address.CompareTo(Address) != 0 || other.Port != Port)
{
return -1;
@@ -64,7 +46,7 @@ public int CompareTo(object obj)
}
else
{
- throw new ArgumentException("obj is not a IPv4EndPoint", "obj");
+ throw new ArgumentException("'obj' is not an EndPoint instance", nameof(obj));
}
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/ICMPClient.cs b/source/Cosmos.System2/Network/IPv4/ICMPClient.cs
index f2d3645116..571f49b344 100644
--- a/source/Cosmos.System2/Network/IPv4/ICMPClient.cs
+++ b/source/Cosmos.System2/Network/IPv4/ICMPClient.cs
@@ -1,57 +1,39 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: ICMP Client
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using Cosmos.System.Network.Config;
+using Cosmos.System.Network.Config;
using Cosmos.HAL;
using System;
using System.Collections.Generic;
-using System.Text;
namespace Cosmos.System.Network.IPv4
{
///
- /// ICMPClient class. Used to manage the ICMP connection to a client.
+ /// Used to manage the ICMP connection to a client.
///
public class ICMPClient : IDisposable
{
- ///
- /// Clients dictionary.
- ///
- private static Dictionary clients;
+ private readonly static Dictionary clients;
///
- /// Destination address.
+ /// The destination address.
///
protected Address destination;
///
- /// RX buffer queue.
+ /// The RX buffer queue.
///
protected Queue rxBuffer;
- ///
- /// Assign clients dictionary.
- ///
- /// Thrown on fatal error (contact support).
static ICMPClient()
{
clients = new Dictionary();
}
///
- /// Get client.
+ /// Gets a client by its IP address hash.
///
/// IP Hash.
- /// ICMPClient
internal static ICMPClient GetClient(uint iphash)
{
- ICMPClient client;
-
- if (clients.TryGetValue(iphash, out client))
+ if (clients.TryGetValue(iphash, out var client))
{
return client;
}
@@ -62,7 +44,7 @@ internal static ICMPClient GetClient(uint iphash)
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
public ICMPClient()
{
@@ -70,9 +52,9 @@ public ICMPClient()
}
///
- /// Connect to client.
+ /// Connects to the given client.
///
- /// Destination address.
+ /// The destination address.
public void Connect(Address dest)
{
destination = dest;
@@ -80,9 +62,9 @@ public void Connect(Address dest)
}
///
- /// Close connection.
+ /// Closes the active connection.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
public void Close()
{
if (clients.ContainsKey(destination.Hash) == true)
@@ -92,7 +74,7 @@ public void Close()
}
///
- /// Send ICMP Echo
+ /// Sends an ICMP echo.
///
public void SendEcho()
{
@@ -103,16 +85,16 @@ public void SendEcho()
}
///
- /// Receive data
+ /// Receives data from the remote host.
///
- /// Source end point.
- /// timeout value, default 5000ms
- /// Address from Domain Name
- /// Thrown on fatal error (contact support).
+ /// The source end point.
+ /// The timeout value; by default, 5000ms.
+ /// The address from the domain name.
+ /// Thrown on fatal error.
public int Receive(ref EndPoint source, int timeout = 5000)
{
int second = 0;
- int _deltaT = 0;
+ int deltaT = 0;
while (rxBuffer.Count < 1)
{
@@ -120,10 +102,11 @@ public int Receive(ref EndPoint source, int timeout = 5000)
{
return -1;
}
- if (_deltaT != RTC.Second)
+
+ if (deltaT != RTC.Second)
{
second++;
- _deltaT = RTC.Second;
+ deltaT = RTC.Second;
}
}
@@ -134,19 +117,16 @@ public int Receive(ref EndPoint source, int timeout = 5000)
}
///
- /// Receive data from packet.
+ /// Receives data from the given packet.
///
- /// Packet to receive.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
+ /// The packet to receive.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
public void ReceiveData(ICMPPacket packet)
{
rxBuffer.Enqueue(packet);
}
- ///
- /// Close Client
- ///
public void Dispose()
{
Close();
diff --git a/source/Cosmos.System2/Network/IPv4/ICMPPacket.cs b/source/Cosmos.System2/Network/IPv4/ICMPPacket.cs
index d3868b8965..c53fd42efb 100644
--- a/source/Cosmos.System2/Network/IPv4/ICMPPacket.cs
+++ b/source/Cosmos.System2/Network/IPv4/ICMPPacket.cs
@@ -1,58 +1,38 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: ICMP Packet (to ping for exemple)
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
+using System;
namespace Cosmos.System.Network.IPv4
{
///
- /// ICMPPacket class. See also: .
+ /// Represents an ICMP packet.
///
+ ///
+ /// See also: .
+ ///
public class ICMPPacket : IPPacket
{
- ///
- /// Packet type.
- ///
protected byte icmpType;
- ///
- /// Packet code.
- ///
protected byte icmpCode;
- ///
- /// Packet CRC.
- ///
protected ushort icmpCRC;
- ///
- /// Received reply.
- ///
///
- /// Create new instance of the class.
+ /// Handles an ICMP packet.
///
- /// Packet data.
+ /// The data of the packet.
/// Thrown if packetData is invalid.
internal static void ICMPHandler(byte[] packetData)
{
- Global.mDebugger.Send("ICMP Handler called");
- var icmp_packet = new ICMPPacket(packetData);
- switch (icmp_packet.ICMPType)
+ var icmpPacket = new ICMPPacket(packetData);
+ switch (icmpPacket.ICMPType)
{
case 0:
- var receiver = ICMPClient.GetClient(icmp_packet.SourceIP.Hash);
- if (receiver != null)
- {
- receiver.ReceiveData(icmp_packet);
- }
- Global.mDebugger.Send("Received ICMP Echo reply from " + icmp_packet.SourceIP.ToString());
+ var receiver = ICMPClient.GetClient(icmpPacket.SourceIP.Hash);
+ receiver?.ReceiveData(icmpPacket);
+ NetworkStack.Debugger.Send("Received ICMP Echo reply from " + icmpPacket.SourceIP.ToString());
break;
case 8:
var request = new ICMPEchoRequest(packetData);
var reply = new ICMPEchoReply(request);
- Global.mDebugger.Send("Sending ICMP Echo reply to " + reply.DestinationIP.ToString());
+ NetworkStack.Debugger.Send("Sending ICMP Echo reply to " + reply.DestinationIP.ToString());
OutgoingBuffer.AddPacket(reply);
NetworkStack.Update();
break;
@@ -60,14 +40,14 @@ internal static void ICMPHandler(byte[] packetData)
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal ICMPPacket()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal ICMPPacket(byte[] rawData)
@@ -75,21 +55,16 @@ internal ICMPPacket(byte[] rawData)
{
}
- ///
- /// Init ICMPPacket fields.1
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- //Sys.Console.WriteLine("ICMPPacket.InitFields() called;");
- base.InitFields();
+ base.InitializeFields();
icmpType = RawData[DataOffset];
icmpCode = RawData[DataOffset + 1];
icmpCRC = (ushort)((RawData[DataOffset + 2] << 8) | RawData[DataOffset + 3]);
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Source address.
/// Destination address.
@@ -115,43 +90,41 @@ internal ICMPPacket(Address source, Address dest, byte type, byte code, ushort i
RawData[DataOffset + 2] = (byte)((icmpCRC >> 8) & 0xFF);
RawData[DataOffset + 3] = (byte)((icmpCRC >> 0) & 0xFF);
- InitFields();
+ InitializeFields();
}
///
- /// Calculate ICMP CRC3.
+ /// Calculates the ICMP CRC3.
///
- /// Lenght.
- ///
+ /// The length of the packet.
protected ushort CalcICMPCRC(ushort length)
{
return CalcOcCRC(DataOffset, length);
}
///
- /// Get ICMP type.
+ /// The ICMP packet type.
///
internal byte ICMPType => icmpType;
///
- /// Get ICMP code.
+ /// The ICMP packet code.
///
internal byte ICMPCode => icmpCode;
///
- /// Get ICMP CRC.
+ /// The ICMP packet CRC.
///
internal ushort ICMPCRC => icmpCRC;
///
- /// Get ICMP data length.
+ /// The ICMP packet data length.
///
internal ushort ICMPDataLength => (ushort)(DataLength - 8);
///
- /// Get ICMP data.
+ /// Returns the ICMP packet data.
///
- /// byte array value.
internal byte[] GetICMPData()
{
byte[] data = new byte[ICMPDataLength];
@@ -164,10 +137,6 @@ internal byte[] GetICMPData()
return data;
}
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "ICMP Packet Src=" + SourceIP + ", Dest=" + DestinationIP + ", Type=" + icmpType + ", Code=" + icmpCode;
@@ -175,22 +144,25 @@ public override string ToString()
}
///
- /// ICMPEchoRequest class. See also: .
+ /// Represents an ICMP echo request packet.
///
+ ///
+ /// See also: .
+ ///
internal class ICMPEchoRequest : ICMPPacket
{
protected ushort icmpID;
protected ushort icmpSequence;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal ICMPEchoRequest()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal ICMPEchoRequest(byte[] rawData)
@@ -199,7 +171,7 @@ internal ICMPEchoRequest(byte[] rawData)
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Source address.
/// Destination address.
@@ -221,31 +193,23 @@ internal ICMPEchoRequest(Address source, Address dest, ushort id, ushort sequenc
RawData[DataOffset + 3] = (byte)((icmpCRC >> 0) & 0xFF);
}
- ///
- /// Init ICMPPacket fields.1
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
icmpID = (ushort)((RawData[DataOffset + 4] << 8) | RawData[DataOffset + 5]);
icmpSequence = (ushort)((RawData[DataOffset + 6] << 8) | RawData[DataOffset + 7]);
}
///
- /// Get ICMP ID.
+ /// The ICMP packet ID.
///
internal ushort ICMPID => icmpID;
///
- /// Get ICMP Sequence.
+ /// The ICMP packet Sequence.
///
internal ushort ICMPSequence => icmpSequence;
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "ICMP Echo Request Src=" + SourceIP + ", Dest=" + DestinationIP + ", ID=" + icmpID + ", Sequence=" + icmpSequence;
@@ -253,22 +217,25 @@ public override string ToString()
}
///
- /// ICMPEchoReply class. See also: .
+ /// Represents an ICMP echo reply packet.
///
+ ///
+ /// See also: .
+ ///
internal class ICMPEchoReply : ICMPPacket
{
protected ushort icmpID;
protected ushort icmpSequence;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal ICMPEchoReply()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal ICMPEchoReply(byte[] rawData)
@@ -276,20 +243,16 @@ internal ICMPEchoReply(byte[] rawData)
{
}
- ///
- /// Init ICMPEchoReply fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
//Sys.Console.WriteLine("ICMPEchoReply.InitFields() called;");
- base.InitFields();
+ base.InitializeFields();
icmpID = (ushort)((RawData[DataOffset + 4] << 8) | RawData[DataOffset + 5]);
icmpSequence = (ushort)((RawData[DataOffset + 6] << 8) | RawData[DataOffset + 7]);
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// ICMP echo request.
/// Thrown if RawData is invalid or null.
@@ -309,19 +272,15 @@ internal ICMPEchoReply(ICMPEchoRequest request)
}
///
- /// Get ICMP ID.
+ /// The ICMP packet ID.
///
internal ushort ICMPID => icmpID;
///
- /// Get ICMP sequence.
+ /// The ICMP packet sequence.
///
internal ushort ICMPSequence => icmpSequence;
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "ICMP Echo Reply Src=" + SourceIP + ", Dest=" + DestinationIP + ", ID=" + icmpID + ", Sequence=" + icmpSequence;
diff --git a/source/Cosmos.System2/Network/IPv4/IPPacket.cs b/source/Cosmos.System2/Network/IPv4/IPPacket.cs
index 16aaa35991..2be0923398 100644
--- a/source/Cosmos.System2/Network/IPv4/IPPacket.cs
+++ b/source/Cosmos.System2/Network/IPv4/IPPacket.cs
@@ -1,12 +1,4 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: IPv4 Packet
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
-using Cosmos.HAL;
+using System;
using Cosmos.HAL.Network;
using Cosmos.System.Network.ARP;
using Cosmos.System.Network.IPv4.TCP;
@@ -16,36 +8,39 @@
namespace Cosmos.System.Network.IPv4
{
///
- /// IPPacket class. See also: .
+ /// Represents an IP (Internet Protocol) packet.
///
+ ///
+ /// See also: .
+ ///
public class IPPacket : EthernetPacket
{
protected byte ipHeaderLength;
-
private static ushort sNextFragmentID;
///
- /// IPv4 handler.
+ /// Handles a single IPv4 packet.
///
- /// Packet data.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
- /// Thrown on fatal error (contact support).
- /// Thrown if packetData array length is greater than Int32.MaxValue.
+ /// The raw data of the packet.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
+ /// Thrown on fatal error.
+ /// Thrown if packetData array length is greater than Int32.MaxValue.
internal static void IPv4Handler(byte[] packetData)
{
- var ip_packet = new IPPacket(packetData);
+ var ipPacket = new IPPacket(packetData);
- if (ip_packet.SourceIP == null)
+ if (ipPacket.SourceIP == null)
{
- Global.mDebugger.Send("SourceIP null in IPv4Handler!");
+ NetworkStack.Debugger.Send("SourceIP null in IPv4Handler!");
}
- ARPCache.Update(ip_packet.SourceIP, ip_packet.SourceMAC);
- if (NetworkStack.AddressMap.ContainsKey(ip_packet.DestinationIP.Hash) == true ||
- ip_packet.DestinationIP.address[3] == 255)
+ ARPCache.Update(ipPacket.SourceIP, ipPacket.SourceMAC);
+
+ if (NetworkStack.AddressMap.ContainsKey(ipPacket.DestinationIP.Hash) == true ||
+ ipPacket.DestinationIP.Parts[3] == 255)
{
- switch (ip_packet.Protocol)
+ switch (ipPacket.Protocol)
{
case 1:
ICMPPacket.ICMPHandler(packetData);
@@ -58,14 +53,14 @@ internal static void IPv4Handler(byte[] packetData)
break;
}
}
- else if (NetworkStack.MACMap.ContainsKey(ip_packet.DestinationMAC.Hash))
+ else if (NetworkStack.MACMap.ContainsKey(ipPacket.DestinationMAC.Hash))
{
DHCPPacket.DHCPHandler(packetData);
}
}
///
- /// Get next IP fragment ID.
+ /// Gets the next IP fragment ID.
///
public static ushort NextIPFragmentID => sNextFragmentID++;
@@ -86,12 +81,12 @@ public IPPacket(byte[] rawData)
}
///
- /// Init IPPacket fields.
+ /// Initializes all internal fields.
///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ /// Thrown if RawData is invalid or null.
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
IPVersion = (byte)((RawData[14] & 0xF0) >> 4);
ipHeaderLength = (byte)(RawData[14] & 0x0F);
TypeOfService = RawData[15];
@@ -108,7 +103,7 @@ protected override void InitFields()
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Data length.
/// Protocol.
@@ -120,7 +115,7 @@ protected IPPacket(ushort dataLength, byte protocol, Address source, Address des
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Data length.
/// Protocol.
@@ -133,7 +128,7 @@ protected IPPacket(ushort dataLength, byte protocol, Address source, Address des
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Source MAC address.
/// Destination MAC address.
@@ -165,31 +160,29 @@ public IPPacket(MACAddress srcMAC, MACAddress destMAC, ushort dataLength, byte p
RawData[25] = 0x00;
for (int b = 0; b < 4; b++)
{
- RawData[26 + b] = source.address[b];
- RawData[30 + b] = dest.address[b];
+ RawData[26 + b] = source.Parts[b];
+ RawData[30 + b] = dest.Parts[b];
}
IPCRC = CalcIPCRC(20);
RawData[24] = (byte)((IPCRC >> 8) & 0xFF);
RawData[25] = (byte)((IPCRC >> 0) & 0xFF);
- InitFields();
+ InitializeFields();
}
///
- /// Calcutale CRC.
+ /// Calculates the CRC of the packet.
///
- /// Offset.
- /// Length.
- ///
+ /// The offset, in bytes.
+ /// The length, in bytes.
protected ushort CalcOcCRC(ushort offset, ushort length) => CalcOcCRC(RawData, offset, length);
///
- /// Calcutale CRC.
+ /// Calculates the CRC of the packet.
///
- /// Buffer.
- /// Offset.
- /// Length.
- /// ushort value.
+ /// The buffer to use.
+ /// The offset, in bytes.
+ /// The length, in bytes.
protected static ushort CalcOcCRC(byte[] buffer, ushort offset, int length)
{
return (ushort)~SumShortValues(buffer, offset, length);
@@ -215,82 +208,84 @@ protected static ushort SumShortValues(byte[] buffer, int offset, int length)
}
///
- /// Calcutale CRC.
+ /// Calculates the CRC of the packet.
///
- /// Header length.
- /// ushort value.
+ /// The length of the header, in bytes.
protected ushort CalcIPCRC(ushort headerLength)
{
return CalcOcCRC(14, headerLength);
}
///
- /// Get IP version.
+ /// Gets the IP version of the packet.
///
internal byte IPVersion { get; private set; }
+
///
- /// Get header length.
+ /// Gets the length of the header, in bytes.
///
internal ushort HeaderLength => (ushort)(ipHeaderLength * 4);
///
- /// Get type of service.
+ /// Gets the type of service.
///
internal byte TypeOfService { get; private set; }
///
- /// Get IP length.
+ /// Gets the IP length of the packet.
///
internal ushort IPLength { get; private set; }
+
///
- /// Get fragment ID.
+ /// Gets the fragment ID.
///
internal ushort FragmentID { get; private set; }
+
///
- /// Get flags.
+ /// Gets the flags of the packet.
///
internal byte IPFlags { get; private set; }
+
///
- /// Get fragment offset.
+ /// Gets the fragment offset.
///
internal ushort FragmentOffset { get; private set; }
+
///
- /// Get TTL.
+ /// Gets the TTL (Time-To-Live) of the packet.
///
internal byte TTL { get; private set; }
+
///
- /// Get protocol.
+ /// Gets the protocol.
///
internal byte Protocol { get; private set; }
+
///
- /// Get IPCRC.
+ /// Gets the IPCRC.
///
internal ushort IPCRC { get; private set; }
///
- /// Get source IP.
+ /// Gets the source IP address.
///
internal Address SourceIP { get; private set; }
///
- /// Get destination IP.
+ /// Gets the destination IP address.
///
internal Address DestinationIP { get; private set; }
///
- /// Get data offset.
+ /// Gets the offset of the data.
///
internal ushort DataOffset { get; private set; }
///
- /// Get data length.
+ /// Gets the length of the data.
///
internal ushort DataLength => (ushort)(IPLength - HeaderLength);
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "IP Packet Src=" + SourceIP + ", Dest=" + DestinationIP + ", Protocol=" + Protocol + ", TTL=" + TTL + ", DataLen=" + DataLength;
diff --git a/source/Cosmos.System2/Network/IPv4/OutgoingBuffer.cs b/source/Cosmos.System2/Network/IPv4/OutgoingBuffer.cs
index 8eaa97982e..a31551433a 100644
--- a/source/Cosmos.System2/Network/IPv4/OutgoingBuffer.cs
+++ b/source/Cosmos.System2/Network/IPv4/OutgoingBuffer.cs
@@ -1,84 +1,39 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: To send packets
-* PROGRAMMERS: Valentin Charbonnier
-* Alexy Da Cruz
-* Port of Cosmos Code.
-*/
-
-using System.Collections.Generic;
+using System.Collections.Generic;
using Cosmos.HAL;
using Cosmos.System.Network.ARP;
using System;
-using Cosmos.Debug.Kernel;
using Cosmos.System.Network.Config;
using Cosmos.HAL.Network;
namespace Cosmos.System.Network.IPv4
{
///
- /// OutgoingBuffer class.
+ /// Represents an outgoing IPv4 buffer.
///
internal static class OutgoingBuffer
{
- ///
- /// BufferEntry class.
- ///
private class BufferEntry
{
- ///
- /// Entry status.
- ///
public enum EntryStatus
{
- ///
- /// Added.
- ///
ADDED,
- ///
- /// ARP sent.
- ///
ARP_SENT,
- ///
- /// Route ARP sent.
- ///
ROUTE_ARP_SENT,
- ///
- /// Just send.
- ///
JUST_SEND,
- ///
- /// Done.
- ///
DONE,
- ///
- /// DHCP request.
- ///
DHCP_REQUEST
};
- ///
- /// Network Interface Controller.
- ///
public NetworkDevice NIC;
- ///
- /// IP packet.
- ///
public IPPacket Packet;
- ///
- /// Entry status
- ///
public EntryStatus Status;
- ///
- /// Next hop.
- ///
- public Address nextHop;
+ public Address NextHop;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Network device.
- /// IP packet.
+ /// The network device.
+ /// The IP packet.
public BufferEntry(NetworkDevice nic, IPPacket packet)
{
this.NIC = nic;
@@ -96,12 +51,12 @@ public BufferEntry(NetworkDevice nic, IPPacket packet)
}
///
- /// Buffer queue.
+ /// The buffer queue.
///
private static List queue;
///
- /// Ensure queue exists.
+ /// Ensures the queue exists and is initialized.
///
private static void EnsureQueueExists()
{
@@ -112,9 +67,9 @@ private static void EnsureQueueExists()
}
///
- /// Add packet.
+ /// Adds a packet to the buffer.
///
- /// IP packet.
+ /// The IP packet.
internal static void AddPacket(IPPacket packet)
{
EnsureQueueExists();
@@ -124,10 +79,10 @@ internal static void AddPacket(IPPacket packet)
}
///
- /// Add packet.
+ /// Adds a packet to the buffer.
///
- /// IP packet.
- /// Network Interface Controller.
+ /// The IP packet.
+ /// The Network Interface Controller.
internal static void AddPacket(IPPacket packet, NetworkDevice device)
{
EnsureQueueExists();
@@ -136,32 +91,31 @@ internal static void AddPacket(IPPacket packet, NetworkDevice device)
}
///
- /// Send packet.
+ /// Sends a packet.
///
- /// Thrown on fatal error (contact support).
- /// Thrown on memory error.
- /// Thrown if RawData length is bigger than Int32.MaxValue.
+ /// Thrown on fatal error.
+ /// Thrown on memory error.
+ /// Thrown if RawData length is bigger than Int32.MaxValue.
internal static void Send()
{
EnsureQueueExists();
- int _deltaT = 0;
+ int deltaT = 0;
int second = 0;
while (queue.Count > 0)
{
- if (_deltaT != Cosmos.HAL.RTC.Second)
+ if (deltaT != RTC.Second)
{
second++;
- _deltaT = Cosmos.HAL.RTC.Second;
+ deltaT = RTC.Second;
}
if (second >= 4)
{
- Global.mDebugger.Send("No response in 4 secondes...");
+ NetworkStack.Debugger.Send("No response in 4 secondes...");
break;
}
- //foreach (BufferEntry entry in queue)
for (int e = 0; e < queue.Count; e++)
{
BufferEntry entry = queue[e];
@@ -169,61 +123,64 @@ internal static void Send()
{
if (IPConfig.IsLocalAddress(entry.Packet.DestinationIP) == false)
{
- entry.nextHop = IPConfig.FindRoute(entry.Packet.DestinationIP);
- if (entry.nextHop == null)
+ entry.NextHop = IPConfig.FindRoute(entry.Packet.DestinationIP);
+ if (entry.NextHop == null)
{
entry.Status = BufferEntry.EntryStatus.DONE;
continue;
}
- if (ARPCache.Contains(entry.nextHop) == true)
+ if (ARPCache.Contains(entry.NextHop) == true)
{
- entry.Packet.DestinationMAC = ARPCache.Resolve(entry.nextHop);
-
+ entry.Packet.DestinationMAC = ARPCache.Resolve(entry.NextHop);
entry.NIC.QueueBytes(entry.Packet.RawData);
-
entry.Status = BufferEntry.EntryStatus.DONE;
}
else
{
- ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(entry.NIC.MACAddress, entry.Packet.SourceIP,
- MACAddress.Broadcast, entry.nextHop, MACAddress.None);
-
- entry.NIC.QueueBytes(arp_request.RawData);
-
+ var arpRequest = new ARPRequestEthernet(
+ entry.NIC.MACAddress,
+ entry.Packet.SourceIP,
+ MACAddress.Broadcast,
+ entry.NextHop,
+ MACAddress.None
+ );
+
+ entry.NIC.QueueBytes(arpRequest.RawData);
entry.Status = BufferEntry.EntryStatus.ROUTE_ARP_SENT;
}
+
continue;
}
+
if (ARPCache.Contains(entry.Packet.DestinationIP) == true)
{
entry.Packet.DestinationMAC = ARPCache.Resolve(entry.Packet.DestinationIP);
-
entry.NIC.QueueBytes(entry.Packet.RawData);
-
entry.Status = BufferEntry.EntryStatus.DONE;
}
else
{
- ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(entry.NIC.MACAddress, entry.Packet.SourceIP,
- MACAddress.Broadcast, entry.Packet.DestinationIP, MACAddress.None);
-
- entry.NIC.QueueBytes(arp_request.RawData);
-
+ var arpRequest = new ARPRequestEthernet(
+ entry.NIC.MACAddress,
+ entry.Packet.SourceIP,
+ MACAddress.Broadcast,
+ entry.Packet.DestinationIP,
+ MACAddress.None
+ );
+
+ entry.NIC.QueueBytes(arpRequest.RawData);
entry.Status = BufferEntry.EntryStatus.ARP_SENT;
}
}
else if (entry.Status == BufferEntry.EntryStatus.DHCP_REQUEST)
{
entry.NIC.QueueBytes(entry.Packet.RawData);
-
entry.Status = BufferEntry.EntryStatus.DONE;
-
}
else if (entry.Status == BufferEntry.EntryStatus.JUST_SEND)
{
entry.NIC.QueueBytes(entry.Packet.RawData);
-
entry.Status = BufferEntry.EntryStatus.DONE;
}
}
@@ -243,11 +200,11 @@ internal static void Send()
}
///
- /// ARP cache update.
+ /// Updates the ARP cache with the given ARP reply.
///
- /// ARP reply.
- /// Thrown if arp_reply.SenderIP is not a IPv4Address.
- internal static void ARPCache_Update(ARPReply_Ethernet arp_reply)
+ /// The ARP reply.
+ /// Thrown if arpReply.SenderIP is not a IPv4Address.
+ internal static void UpdateARPCache(ARPReplyEthernet arpReply)
{
EnsureQueueExists();
//foreach (BufferEntry entry in queue)
@@ -256,21 +213,17 @@ internal static void ARPCache_Update(ARPReply_Ethernet arp_reply)
BufferEntry entry = queue[e];
if (entry.Status == BufferEntry.EntryStatus.ARP_SENT)
{
- var xDestIP = entry.Packet.DestinationIP.Hash;
- var xSenderIP = arp_reply.SenderIP.Hash;
- if (entry.Packet.DestinationIP.CompareTo(arp_reply.SenderIP) == 0)
+ if (entry.Packet.DestinationIP.CompareTo(arpReply.SenderIP) == 0)
{
- entry.Packet.DestinationMAC = arp_reply.SenderMAC;
-
+ entry.Packet.DestinationMAC = arpReply.SenderMAC;
entry.Status = BufferEntry.EntryStatus.JUST_SEND;
}
}
else if (entry.Status == BufferEntry.EntryStatus.ROUTE_ARP_SENT)
{
- if (entry.nextHop.CompareTo(arp_reply.SenderIP) == 0)
+ if (entry.NextHop.CompareTo(arpReply.SenderIP) == 0)
{
- entry.Packet.DestinationMAC = arp_reply.SenderMAC;
-
+ entry.Packet.DestinationMAC = arpReply.SenderMAC;
entry.Status = BufferEntry.EntryStatus.JUST_SEND;
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/TCP/TCPClient.cs b/source/Cosmos.System2/Network/IPv4/TCP/TCPClient.cs
index 530de04a4a..af2dacd3f0 100644
--- a/source/Cosmos.System2/Network/IPv4/TCP/TCPClient.cs
+++ b/source/Cosmos.System2/Network/IPv4/TCP/TCPClient.cs
@@ -1,35 +1,25 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: TCP Client
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using System;
+using System;
using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using Cosmos.HAL;
using Cosmos.System.Helpers;
using Cosmos.System.Network.Config;
namespace Cosmos.System.Network.IPv4.TCP
{
///
- /// TcpClient class. Used to manage the TCP connection to a server.
+ /// Represents a TCP client. Used to manage the TCP connection to a server.
///
public class TcpClient : IDisposable
{
///
- /// Tcp State machine.
+ /// The TCP state machine.
///
public Tcp StateMachine;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Tcp state machine.
- /// Thrown on fatal error (contact support).
+ /// The TCP state machine.
+ /// Thrown on fatal error.
/// Thrown if localPort already exists.
internal TcpClient(Tcp stateMachine)
{
@@ -37,26 +27,24 @@ internal TcpClient(Tcp stateMachine)
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Local port.
- /// Thrown on fatal error (contact support).
+ /// The local port.
+ /// Thrown on fatal error.
/// Thrown if localPort already exists.
public TcpClient(int localPort)
{
- StateMachine = new Tcp((ushort)localPort, 0, Address.Zero, Address.Zero);
-
- StateMachine.rxBuffer = new Queue(8);
-
+ StateMachine = new((ushort)localPort, 0, Address.Zero, Address.Zero);
+ StateMachine.RxBuffer = new Queue(8);
StateMachine.Status = Status.CLOSED;
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Destination address.
/// Destination port.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if TcpClient with localPort 0 exists.
public TcpClient(Address dest, int destPort)
: this(0)
@@ -66,7 +54,7 @@ public TcpClient(Address dest, int destPort)
}
///
- /// Connect to client.
+ /// Connects the client to the given server.
///
/// Destination address.
/// Destination port.
@@ -113,9 +101,9 @@ public void Connect(Address dest, int destPort, int timeout = 5000)
}
///
- /// Close connection.
+ /// Closes the connection.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if TCP Status is CLOSED.
public void Close()
{
@@ -137,13 +125,13 @@ public void Close()
}
///
- /// Send data to client.
+ /// Sends data to the connected server.
///
/// Data array to send.
/// Thrown if destination is null or destinationPort is 0.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if data array length is greater than Int32.MaxValue.
- /// Thrown on IO error.
+ /// Thrown on IO error.
/// Thrown if TCP Status is not ESTABLISHED.
public void Send(byte[] data)
{
@@ -179,11 +167,10 @@ public void Send(byte[] data)
}
///
- /// Receive data from end point.
+ /// Receives data from the end-point.
///
/// Source end point.
- /// byte array value.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if TCP Status is not ESTABLISHED.
public byte[] NonBlockingReceive(ref EndPoint source)
{
@@ -191,12 +178,13 @@ public byte[] NonBlockingReceive(ref EndPoint source)
{
throw new Exception("Client must be connected before receiving data.");
}
- if (StateMachine.rxBuffer.Count < 1)
+
+ if (StateMachine.RxBuffer.Count < 1)
{
return null;
}
- var packet = StateMachine.rxBuffer.Dequeue();
+ var packet = StateMachine.RxBuffer.Dequeue();
source.Address = packet.SourceIP;
source.Port = packet.SourcePort;
@@ -206,15 +194,14 @@ public byte[] NonBlockingReceive(ref EndPoint source)
}
///
- /// Receive data from end point.
+ /// Receives data from the end-point.
///
/// Source end point.
- /// byte array value.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if TCP Status is not ESTABLISHED.
public byte[] Receive(ref EndPoint source)
{
- while (StateMachine.rxBuffer.Count < 1)
+ while (StateMachine.RxBuffer.Count < 1)
{
if (StateMachine.Status != Status.ESTABLISHED)
{
@@ -222,7 +209,7 @@ public byte[] Receive(ref EndPoint source)
}
}
- var packet = StateMachine.rxBuffer.Dequeue();
+ var packet = StateMachine.RxBuffer.Dequeue();
source.Address = packet.SourceIP;
source.Port = packet.SourcePort;
@@ -232,41 +219,23 @@ public byte[] Receive(ref EndPoint source)
}
///
- /// Get distant computer EndPoint (IP adress and port).
+ /// Gets the remote hosts end-point (IP address and port).
///
- /// Remote EndPoint.
- public EndPoint RemoteEndPoint
- {
- get
- {
- return StateMachine.RemoteEndPoint;
- }
- }
+ public EndPoint RemoteEndPoint => StateMachine.RemoteEndPoint;
///
- /// Get local computer EndPoint (IP adress and port).
+ /// Gets the remote hosts end-point (IP address and port).
///
- /// Remote EndPoint.
- public EndPoint LocalEndPoint
- {
- get
- {
- return StateMachine.LocalEndPoint;
- }
- }
+ public EndPoint LocalEndPoint => StateMachine.LocalEndPoint;
///
- /// Is TCP Connected.
+ /// Returns a value whether the TCP client is connected to a remote host.
///
- /// Boolean value.
public bool IsConnected()
{
return StateMachine.Status == Status.ESTABLISHED;
}
- ///
- /// Close Client
- ///
public void Dispose()
{
Close();
diff --git a/source/Cosmos.System2/Network/IPv4/TCP/TCPPacket.cs b/source/Cosmos.System2/Network/IPv4/TCP/TCPPacket.cs
index 5776c1b4a2..c9df3b1238 100644
--- a/source/Cosmos.System2/Network/IPv4/TCP/TCPPacket.cs
+++ b/source/Cosmos.System2/Network/IPv4/TCP/TCPPacket.cs
@@ -1,14 +1,5 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: TCP Packet
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using Cosmos.HAL;
-using System;
+using System;
using System.Collections.Generic;
-using System.Text;
namespace Cosmos.System.Network.IPv4.TCP
{
@@ -67,9 +58,9 @@ public class TCPPacket : IPPacket
/// TCP handler.
///
/// Packet data.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on IO error.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if packetData array length is greater than Int32.MaxValue.
internal static void TCPHandler(byte[] packetData)
{
@@ -86,7 +77,7 @@ internal static void TCPHandler(byte[] packetData)
}
else
{
- Global.mDebugger.Send("Checksum incorrect! Packet passed.");
+ Global.Debugger.Send("Checksum incorrect! Packet passed.");
}
}
@@ -211,7 +202,7 @@ private void MakePacket(Address source, Address dest, ushort srcPort, ushort des
RawData[DataOffset + 18] = (byte)((UrgentPointer >> 8) & 0xFF);
RawData[DataOffset + 19] = (byte)((UrgentPointer >> 0) & 0xFF);
- InitFields();
+ InitializeFields();
//Checksum computation
byte[] header = MakeHeader();
@@ -226,9 +217,9 @@ private void MakePacket(Address source, Address dest, ushort srcPort, ushort des
/// Init TCPPacket fields.
///
/// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
SourcePort = (ushort)((RawData[DataOffset] << 8) | RawData[DataOffset + 1]);
DestinationPort = (ushort)((RawData[DataOffset + 2] << 8) | RawData[DataOffset + 3]);
SequenceNumber = (uint)((RawData[DataOffset + 4] << 24) | (RawData[DataOffset + 5] << 16) | (RawData[DataOffset + 6] << 8) | RawData[DataOffset + 7]);
@@ -311,8 +302,8 @@ internal byte[] MakeHeader()
//Addresses
for (int b = 0; b < 4; b++)
{
- header[0 + b] = SourceIP.address[b];
- header[4 + b] = DestinationIP.address[b];
+ header[0 + b] = SourceIP.Parts[b];
+ header[4 + b] = DestinationIP.Parts[b];
}
//Reserved
header[8] = 0x00;
@@ -420,7 +411,7 @@ private bool CheckCRC()
///
/// Get TCP data.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
internal byte[] TCP_Data
{
get
diff --git a/source/Cosmos.System2/Network/IPv4/TCP/Tcp.cs b/source/Cosmos.System2/Network/IPv4/TCP/Tcp.cs
index 3a7891c5ff..f616c0cb71 100644
--- a/source/Cosmos.System2/Network/IPv4/TCP/Tcp.cs
+++ b/source/Cosmos.System2/Network/IPv4/TCP/Tcp.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using Cosmos.HAL;
using Cosmos.System.Helpers;
using Cosmos.System.Network.Config;
@@ -8,7 +7,7 @@
namespace Cosmos.System.Network.IPv4.TCP
{
///
- /// TCP Connection status
+ /// Represents a TCP connection status.
///
public enum Status
{
@@ -63,13 +62,13 @@ public enum Status
TIME_WAIT,
///
- /// represents no connection state at all.
+ /// Represents no connection state.
///
CLOSED
}
///
- /// Transmission Control Block (TCB).
+ /// Represents a Transmission Control Block (TCB).
///
public class TransmissionControlBlock
{
@@ -134,59 +133,61 @@ public class TransmissionControlBlock
}
///
- /// Tcp class. Used to manage the TCP state machine.
+ /// Used to manage the TCP state machine.
/// Handle received packets according to current TCP connection Status. Also contains TCB (Transmission Control Block) information.
- /// See RFC 793 for more information.
///
+ ///
+ /// See RFC 793 for more information.
+ ///
public class Tcp
{
///
- /// TCP Window Size.
+ /// The TCP window size.
///
public const ushort TcpWindowSize = 8192;
#region Static
-
///
- /// Connection list.
+ /// A list of currently active connections.
///
internal static List Connections;
///
/// String / enum correspondance (used for debugging)
///
- internal static string[] table;
+ internal static string[] Table;
- ///
- /// Assign connection list.
- ///
- /// Thrown on fatal error (contact support).
static Tcp()
{
Connections = new List();
- table = new string[11];
- table[0] = "LISTEN";
- table[1] = "SYN_SENT";
- table[2] = "SYN_RECEIVED";
- table[3] = "ESTABLISHED";
- table[4] = "FIN_WAIT1";
- table[5] = "FIN_WAIT2";
- table[6] = "CLOSE_WAIT";
- table[7] = "CLOSING";
- table[8] = "LAST_ACK";
- table[9] = "TIME_WAIT";
- table[10] = "CLOSED";
+ Table = new string[11];
+ Table[0] = "LISTEN";
+ Table[1] = "SYN_SENT";
+ Table[2] = "SYN_RECEIVED";
+ Table[3] = "ESTABLISHED";
+ Table[4] = "FIN_WAIT1";
+ Table[5] = "FIN_WAIT2";
+ Table[6] = "CLOSE_WAIT";
+ Table[7] = "CLOSING";
+ Table[8] = "LAST_ACK";
+ Table[9] = "TIME_WAIT";
+ Table[10] = "CLOSED";
}
///
- /// Get TCP Connection.
+ /// Gets a TCP connection object that matches the specified local and remote ports and addresses.
///
- /// Local port.
- /// Destination port.
- /// Local IPv4 Address.
- /// Remote IPv4 Address.
- /// Tcp
+ /// The local port number of the connection.
+ /// The remote port number of the connection.
+ /// The local IP address of the connection.
+ /// The remote IP address of the connection.
+ /// A TCP connection object if a match is found, otherwise.
+ ///
+ /// If a connection is found that matches the local and remote ports and addresses, it will be returned.
+ /// If no exact match is found, a connection that is listening on the specified local port will be returned.
+ /// If no matching connection is found, is returned.
+ ///
internal static Tcp GetConnection(ushort localPort, ushort remotePort, Address localIp, Address remoteIp)
{
foreach (var con in Connections)
@@ -204,12 +205,15 @@ internal static Tcp GetConnection(ushort localPort, ushort remotePort, Address l
}
///
- /// Remove TCP Connection.
+ /// Removes a TCP connection object that matches the specified local and remote ports and addresses.
///
- /// Local port.
- /// Destination port.
- /// Local IPv4 Address.
- /// Remote IPv4 Address.
+ /// The local port number of the connection.
+ /// The remote port number of the connection.
+ /// The local IP address of the connection.
+ /// The remote IP address of the connection.
+ ///
+ /// If a connection is found that matches the local and remote ports and addresses, it will be removed from the list of connections.
+ ///
internal static void RemoveConnection(ushort localPort, ushort remotePort, Address localIp, Address remoteIp)
{
for (int i = 0; i < Connections.Count; i++)
@@ -218,7 +222,7 @@ internal static void RemoveConnection(ushort localPort, ushort remotePort, Addre
{
Connections.RemoveAt(i);
- Global.mDebugger.Send("Connection removed!");
+ NetworkStack.Debugger.Send("Connection removed!");
return;
}
@@ -230,34 +234,34 @@ internal static void RemoveConnection(ushort localPort, ushort remotePort, Addre
#region TCB
///
- /// Local EndPoint.
+ /// The local end-point.
///
public EndPoint LocalEndPoint;
///
- /// Remote EndPoint.
+ /// The remote end-point.
///
public EndPoint RemoteEndPoint;
///
- /// Connection Transmission Control Block.
+ /// The connection Transmission Control Block.
///
internal TransmissionControlBlock TCB { get; set; }
#endregion
///
- /// RX buffer queue.
+ /// The RX buffer queue.
///
- internal Queue rxBuffer;
+ internal Queue RxBuffer;
///
- /// Connection status.
+ /// The connection status.
///
public Status Status;
///
- /// TCP Received Data.
+ /// The received data buffer.
///
internal byte[] Data { get; set; }
@@ -269,20 +273,20 @@ public Tcp(ushort localPort, ushort remotePort, Address localIp, Address remoteI
}
///
- /// Handle incoming TCP packets according to current connection status.
+ /// Handles incoming TCP packets according to the current connection status.
///
- /// Packet to receive.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
+ /// The packet to receive.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
internal void ReceiveData(TCPPacket packet)
{
- Global.mDebugger.Send("[" + table[(int)Status] + "] " + packet.ToString());
+ NetworkStack.Debugger.Send("[" + Table[(int)Status] + "] " + packet.ToString());
- if (Status == Status.CLOSED)
+ /*if (Status == Status.CLOSED)
{
//DO NOTHING
}
- else if (Status == Status.LISTEN)
+ else*/ if (Status == Status.LISTEN)
{
ProcessListen(packet);
}
@@ -321,7 +325,7 @@ internal void ReceiveData(TCPPacket packet)
case Status.TIME_WAIT:
break;
default:
- Global.mDebugger.Send("Unknown TCP connection state.");
+ NetworkStack.Debugger.Send("Unknown TCP connection state.");
break;
}
}
@@ -332,7 +336,7 @@ internal void ReceiveData(TCPPacket packet)
SendEmptyPacket(Flags.ACK);
}
- Global.mDebugger.Send("Sequence number or segment data invalid, packet passed.");
+ NetworkStack.Debugger.Send("Sequence number or segment data invalid, packet passed.");
}
}
}
@@ -340,14 +344,21 @@ internal void ReceiveData(TCPPacket packet)
#region Process Status
///
- /// Process LISTEN Status.
+ /// Processes a TCP LISTEN state packet and updates the connection status accordingly.
///
- /// Packet to receive.
+ /// The incoming TCP packet.
+ ///
+ /// This method handles various types of incoming TCP packets during the LISTEN state and updates the status of the connection accordingly.
+ /// If an RST packet is received, the packet is passed and no action is taken.
+ /// If a FIN packet is received, the TCP connection is closed.
+ /// If an ACK packet is received, the TCP connection is established.
+ /// If a SYN packet is received, the TCP connection is moved to the SYN_RECEIVED state and an empty packet with the SYN and ACK flags set is sent back.
+ ///
public void ProcessListen(TCPPacket packet)
{
if (packet.RST)
{
- Global.mDebugger.Send("RST received at LISTEN state, packet passed.");
+ NetworkStack.Debugger.Send("RST received at LISTEN state, packet passed.");
return;
}
@@ -355,7 +366,7 @@ public void ProcessListen(TCPPacket packet)
{
Status = Status.CLOSED;
- Global.mDebugger.Send("TCP connection closed! (FIN received on LISTEN state)");
+ NetworkStack.Debugger.Send("TCP connection closed! (FIN received on LISTEN state)");
}
else if (packet.ACK)
{
@@ -394,9 +405,14 @@ public void ProcessListen(TCPPacket packet)
}
///
- /// Process SYN_RECEIVED Status.
+ /// Processes a TCP SYN_RECEIVED state packet and updates the connection status accordingly.
///
- /// Packet to receive.
+ /// The incoming TCP packet.
+ ///
+ /// This method handles an incoming TCP packet during the SYN_RECEIVED state and updates the status of the connection accordingly.
+ /// If an ACK packet is received with a valid AckNumber, the TCP connection is established.
+ /// If the AckNumber is invalid, a reset packet is sent back with the AckNumber set to the invalid value.
+ ///
public void ProcessSynReceived(TCPPacket packet)
{
if (packet.ACK)
@@ -417,9 +433,16 @@ public void ProcessSynReceived(TCPPacket packet)
}
///
- /// Process SYN_SENT Status.
+ /// Processes a SYN_SENT state TCP packet and updates the connection state accordingly.
///
- /// Packet to receive.
+ /// The TCP packet to process.
+ ///
+ /// If the packet has the SYN flag set, the method sets the initial receive sequence number and responds with an ACK packet
+ /// if the ACK flag is also set. If the SYN flag is set but not the ACK flag, the method closes the connection and sends an
+ /// error message. If the packet has only the ACK flag set, the method checks whether the acknowledgment number is within the
+ /// valid range and updates the send and receive sequence numbers. If the packet has the FIN flag set, the method closes the
+ /// connection. If the packet has the RST flag set, the method also closes the connection and sends an error message.
+ ///
public void ProcessSynSent(TCPPacket packet)
{
if (packet.SYN)
@@ -442,13 +465,13 @@ public void ProcessSynSent(TCPPacket packet)
{
Status = Status.CLOSED;
- Global.mDebugger.Send("Simultaneous open not supported.");
+ NetworkStack.Debugger.Send("Simultaneous open not supported.");
}
else
{
Status = Status.CLOSED;
- Global.mDebugger.Send("TCP connection closed! (" + packet.getFlags() + " received on SYN_SENT state)");
+ NetworkStack.Debugger.Send("TCP connection closed! (" + packet.getFlags() + " received on SYN_SENT state)");
}
}
else if (packet.ACK)
@@ -458,7 +481,7 @@ public void ProcessSynSent(TCPPacket packet)
{
SendEmptyPacket(Flags.RST, packet.AckNumber);
- Global.mDebugger.Send("Bad ACK received at SYN_SENT.");
+ NetworkStack.Debugger.Send("Bad ACK received at SYN_SENT.");
}
else
{
@@ -472,20 +495,20 @@ public void ProcessSynSent(TCPPacket packet)
{
Status = Status.CLOSED;
- Global.mDebugger.Send("TCP connection closed! (FIN received on SYN_SENT state).");
+ NetworkStack.Debugger.Send("TCP connection closed! (FIN received on SYN_SENT state).");
}
else if (packet.RST)
{
Status = Status.CLOSED;
- Global.mDebugger.Send("Connection refused by remote computer.");
+ NetworkStack.Debugger.Send("Connection refused by remote computer.");
}
}
///
- /// Process ESTABLISHED Status.
+ /// Processes a ESTABLISHED state TCP packet.
///
- /// Packet to receive.
+ /// The received packet.
public void ProcessEstablished(TCPPacket packet)
{
if (packet.ACK)
@@ -522,7 +545,7 @@ public void ProcessEstablished(TCPPacket packet)
Data = ArrayHelper.Concat(Data, packet.TCP_Data);
- rxBuffer.Enqueue(packet);
+ RxBuffer.Enqueue(packet);
SendEmptyPacket(Flags.ACK);
return;
@@ -549,7 +572,7 @@ public void ProcessEstablished(TCPPacket packet)
{
Status = Status.CLOSED;
- Global.mDebugger.Send("TCP Connection resetted!");
+ NetworkStack.Debugger.Send("TCP Connection resetted!");
}
else if (packet.FIN)
{
@@ -643,7 +666,7 @@ public void ProcessCloseWait(TCPPacket packet)
#region Utils
///
- /// Wait until remote receive ACK of its connection termination request.
+ /// Waits until remote receives an ACKnowledge of its connection termination request.
///
private void WaitAndClose()
{
@@ -655,7 +678,7 @@ private void WaitAndClose()
}
///
- /// Wait for new TCP connection status.
+ /// Waits for a new TCP connection status.
///
internal bool WaitStatus(Status status, int timeout)
{
@@ -678,7 +701,7 @@ internal bool WaitStatus(Status status, int timeout)
}
///
- /// Wait for new TCP connection status (blocking).
+ /// Waits for a new TCP connection status (blocking).
///
internal bool WaitStatus(Status status)
{
@@ -688,7 +711,7 @@ internal bool WaitStatus(Status status)
}
///
- /// Send empty packet.
+ /// Sends an empty packet.
///
internal void SendEmptyPacket(Flags flag)
{
@@ -696,7 +719,7 @@ internal void SendEmptyPacket(Flags flag)
}
///
- /// Send empty packet.
+ /// Sends an empty packet.
///
internal void SendEmptyPacket(Flags flag, uint sequenceNumber)
{
@@ -704,7 +727,7 @@ internal void SendEmptyPacket(Flags flag, uint sequenceNumber)
}
///
- /// Send TCP packet.
+ /// Sends a TCP packet.
///
private void SendPacket(TCPPacket packet)
{
@@ -717,9 +740,6 @@ private void SendPacket(TCPPacket packet)
}
}
- ///
- /// Equals connection.
- ///
internal bool Equals(ushort localPort, ushort remotePort, Address localIp, Address remoteIp)
{
return LocalEndPoint.Port.Equals(localPort) && RemoteEndPoint.Port.Equals(remotePort) && LocalEndPoint.Address.Hash.Equals(localIp.Hash) && RemoteEndPoint.Address.Hash.Equals(remoteIp.Hash);
diff --git a/source/Cosmos.System2/Network/IPv4/TCP/TcpListener.cs b/source/Cosmos.System2/Network/IPv4/TCP/TcpListener.cs
index 9e8b212a5b..dc483ac267 100644
--- a/source/Cosmos.System2/Network/IPv4/TCP/TcpListener.cs
+++ b/source/Cosmos.System2/Network/IPv4/TCP/TcpListener.cs
@@ -1,53 +1,47 @@
using System;
using System.Collections.Generic;
-using System.Text;
-using Cosmos.System.Network.Config;
namespace Cosmos.System.Network.IPv4.TCP
{
///
- /// TcpListener class. Used to manage the TCP connection to a client.
+ /// Used to manage a TCP connection to a client.
///
public class TcpListener : IDisposable
{
- ///
- /// Tcp State machine.
- ///
- internal Tcp StateMachine;
+ private readonly ushort localPort;
///
- /// Tcp State machine.
+ /// The TCP state machine.
///
- private ushort LocalPort;
+ internal Tcp StateMachine;
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Local address.
/// Local port.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if localPort already exists.
public TcpListener(ushort localPort)
{
- LocalPort = localPort;
+ this.localPort = localPort;
}
///
- /// Receive TcpClient from remote computer.
+ /// Receives a instance from the remote host.
///
- /// Accepted TcpClient
+ /// The accepted .
/// Thrown if TcpListener not started.
public TcpClient AcceptTcpClient(int timeout = -1)
{
if (StateMachine == null)
{
- new Exception("TcpListener is not started.");
+ throw new Exception("The TcpListener is not started.");
}
if (StateMachine.Status == Status.CLOSED) // if TcpListener already accepted client, remove old one.
{
Tcp.RemoveConnection(StateMachine.LocalEndPoint.Port, StateMachine.RemoteEndPoint.Port, StateMachine.LocalEndPoint.Address, StateMachine.RemoteEndPoint.Address);
-
Start();
}
@@ -64,47 +58,40 @@ public TcpClient AcceptTcpClient(int timeout = -1)
}
///
- /// Start listening for new TCP connections.
+ /// Starts listening for new TCP connections.
///
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
public void Start()
{
- StateMachine = new Tcp(LocalPort, 0, Address.Zero, Address.Zero);
-
- StateMachine.rxBuffer = new Queue(8);
-
- StateMachine.LocalEndPoint.Port = LocalPort;
-
+ StateMachine = new(localPort, 0, Address.Zero, Address.Zero);
+ StateMachine.RxBuffer = new Queue(8);
+ StateMachine.LocalEndPoint.Port = localPort;
StateMachine.Status = Status.LISTEN;
Tcp.Connections.Add(StateMachine);
}
///
- /// Stop listening for new TCP connections.
+ /// Stops listening for new TCP connections.
///
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
/// Thrown if TcpListener not started.
public void Stop()
{
if (StateMachine == null)
{
- new Exception("TcpListener is not started.");
+ throw new Exception("The TcpListener is not started.");
}
if (StateMachine.Status == Status.LISTEN)
{
Tcp.RemoveConnection(StateMachine.LocalEndPoint.Port, StateMachine.RemoteEndPoint.Port, StateMachine.LocalEndPoint.Address, StateMachine.RemoteEndPoint.Address);
-
StateMachine = null;
}
}
- ///
- /// Close listener
- ///
public void Dispose()
{
Stop();
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPAck.cs b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPAck.cs
index d64acdf388..d8741e61a6 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPAck.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPAck.cs
@@ -1,46 +1,38 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.System.Network.IPv4.UDP.DHCP
+namespace Cosmos.System.Network.IPv4.UDP.DHCP
{
///
- /// DHCPAck class.
+ /// Represents a DHCP acknowledge (ACK) packet.
///
internal class DHCPAck : DHCPPacket
{
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DHCPAck() : base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal DHCPAck(byte[] rawData) : base(rawData)
{ }
- ///
- /// Init DHCPAck fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
foreach (var option in Options)
{
- if (option.Type == 1) //Mask
+ if (option.Type == 1) // Mask
{
Subnet = new Address(option.Data, 0);
}
- else if (option.Type == 3) //Router
+ else if (option.Type == 3) // Router
{
Server = new Address(option.Data, 0);
}
- else if (option.Type == 6) //DNS
+ else if (option.Type == 6) // DNS
{
DNS = new Address(option.Data, 0);
}
@@ -48,17 +40,17 @@ protected override void InitFields()
}
///
- /// Get Subnet IPv4 Address
+ /// Gets the subnet IPv4 address.
///
internal Address Subnet { get; private set; }
///
- /// Get DNS IPv4 Address
+ /// Gets the DNS IPv4 address.
///
internal Address DNS { get; private set; }
///
- /// Get DHCP Server IPv4 Address
+ /// Gets the DHCP server IPv4 address.
///
internal Address Server { get; private set; }
}
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPClient.cs b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPClient.cs
index da96292880..9a9fd9d523 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPClient.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPClient.cs
@@ -1,56 +1,37 @@
-using Cosmos.System.Network.IPv4;
-using System;
-using Cosmos.System.Network.IPv4.UDP.DNS;
+using System;
using Cosmos.System.Network.Config;
-using System.Collections.Generic;
using Cosmos.HAL;
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: DHCP - DHCP Core
-* PROGRAMMER(S): Alexy DA CRUZ
-*/
-
namespace Cosmos.System.Network.IPv4.UDP.DHCP
{
///
- /// DHCPClient class. Used to manage the DHCP connection to a server.
+ /// Used to manage the DHCP connection to a server.
///
public class DHCPClient : UdpClient
{
- ///
- /// Is DHCP ascked check variable
- ///
private bool asked = false;
///
- /// Get the IP address of the DHCP server
+ /// Gets the IP address of the DHCP server.
///
- ///
public static Address DHCPServerAddress(NetworkDevice networkDevice)
{
return NetworkConfiguration.Get(networkDevice).DefaultGateway;
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if UdpClient with localPort 53 exists.
public DHCPClient() : base(68)
{
}
- ///
- /// Receive data
- ///
- /// timeout value, default 5000ms
- /// time value (-1 = timeout)
- /// Thrown on fatal error (contact support).
private int Receive(int timeout = 5000)
{
int second = 0;
- int _deltaT = 0;
+ int deltaT = 0;
while (rxBuffer.Count < 1)
{
@@ -58,23 +39,23 @@ private int Receive(int timeout = 5000)
{
return -1;
}
- if (_deltaT != RTC.Second)
+ if (deltaT != RTC.Second)
{
second++;
- _deltaT = RTC.Second;
+ deltaT = RTC.Second;
}
}
var packet = new DHCPPacket(rxBuffer.Dequeue().RawData);
- if (packet.MessageType == 2) //Boot Reply
+ if (packet.MessageType == 2) // Boot Reply
{
- if (packet.RawData[284] == 0x02) //Offer packet received
+ if (packet.RawData[284] == 0x02) // Offer packet received
{
- Global.mDebugger.Send("Offer received.");
+ NetworkStack.Debugger.Send("Offer received.");
return SendRequestPacket(packet.Client);
}
- else if (packet.RawData[284] == 0x05 || packet.RawData[284] == 0x06) //ACK or NAK DHCP packet received
+ else if (packet.RawData[284] is 0x05 or 0x06) // ACK or NAK DHCP packet received
{
var ack = new DHCPAck(packet.RawData);
if (asked)
@@ -92,29 +73,31 @@ private int Receive(int timeout = 5000)
}
///
- /// Send a packet to the DHCP server to make the address available again
+ /// Sends a packet to the DHCP server in order to make the address available again.
///
public void SendReleasePacket()
{
foreach (NetworkDevice networkDevice in NetworkDevice.Devices)
{
Address source = IPConfig.FindNetwork(DHCPServerAddress(networkDevice));
- var dhcp_release = new DHCPRelease(source, DHCPServerAddress(networkDevice), networkDevice.MACAddress);
+ var dhcpRelease = new DHCPRelease(source, DHCPServerAddress(networkDevice), networkDevice.MACAddress);
- OutgoingBuffer.AddPacket(dhcp_release);
+ OutgoingBuffer.AddPacket(dhcpRelease);
NetworkStack.Update();
NetworkStack.RemoveAllConfigIP();
IPConfig.Enable(networkDevice, new Address(0, 0, 0, 0), new Address(0, 0, 0, 0), new Address(0, 0, 0, 0));
}
+
Close();
}
///
- /// Send a packet to find the DHCP server and tell that we want a new IP address
+ /// Send a packet to find the DHCP server and inform the host that we
+ /// are requesting a new IP address.
///
- /// time value (-1 = timeout)
+ /// The amount of time elapsed, or -1 if a timeout has been reached.
public int SendDiscoverPacket()
{
NetworkStack.RemoveAllConfigIP();
@@ -123,8 +106,8 @@ public int SendDiscoverPacket()
{
IPConfig.Enable(networkDevice, new Address(0, 0, 0, 0), new Address(0, 0, 0, 0), new Address(0, 0, 0, 0));
- var dhcp_discover = new DHCPDiscover(networkDevice.MACAddress);
- OutgoingBuffer.AddPacket(dhcp_discover);
+ var dhcpDiscover = new DHCPDiscover(networkDevice.MACAddress);
+ OutgoingBuffer.AddPacket(dhcpDiscover);
NetworkStack.Update();
asked = true;
@@ -134,15 +117,15 @@ public int SendDiscoverPacket()
}
///
- /// Send a request to apply the new IP configuration
+ /// Sends a request to apply the new IP configuration.
///
- /// time value (-1 = timeout)
- private int SendRequestPacket(Address RequestedAddress)
+ /// The amount of time elapsed, or -1 if a timeout has been reached.
+ private int SendRequestPacket(Address requestedAddress)
{
foreach (NetworkDevice networkDevice in NetworkDevice.Devices)
{
- var dhcp_request = new DHCPRequest(networkDevice.MACAddress, RequestedAddress);
- OutgoingBuffer.AddPacket(dhcp_request);
+ var dhcpRequest = new DHCPRequest(networkDevice.MACAddress, requestedAddress);
+ OutgoingBuffer.AddPacket(dhcpRequest);
NetworkStack.Update();
}
return Receive();
@@ -152,9 +135,8 @@ private int SendRequestPacket(Address RequestedAddress)
* Method called to applied the differents options received in the DHCP packet ACK
**/
///
- /// Apply the new IP configuration received.
+ /// Applies the newly received IP configuration.
///
- /// DHCPOption class using the packetData from the received dhcp packet.
/// Enable/Disable the displaying of messages about DHCP applying and conf. Disabled by default.
///
private void Apply(DHCPAck packet, bool message = false)
@@ -164,6 +146,8 @@ private void Apply(DHCPAck packet, bool message = false)
//cf. Roadmap. (have to change this, because some network interfaces are not configured in dhcp mode) [have to be done in 0.5.x]
foreach (NetworkDevice networkDevice in NetworkDevice.Devices)
{
+ // NOTE: @ascpixi: Why are we checking if ToString() returns null
+ // *four* times...? Can this be removed?
if (packet.Client.ToString() == null ||
packet.Client.ToString() == null ||
packet.Client.ToString() == null ||
@@ -175,11 +159,11 @@ private void Apply(DHCPAck packet, bool message = false)
{
if (message)
{
- Global.mDebugger.Send("[DHCP ACK][" + networkDevice.Name + "] Packet received, applying IP configuration...");
- Global.mDebugger.Send(" IP Address : " + packet.Client.ToString());
- Global.mDebugger.Send(" Subnet mask : " + packet.Subnet.ToString());
- Global.mDebugger.Send(" Gateway : " + packet.Server.ToString());
- Global.mDebugger.Send(" DNS server : " + packet.DNS.ToString());
+ NetworkStack.Debugger.Send("[DHCP ACK][" + networkDevice.Name + "] Packet received, applying IP configuration...");
+ NetworkStack.Debugger.Send(" IP Address : " + packet.Client.ToString());
+ NetworkStack.Debugger.Send(" Subnet mask : " + packet.Subnet.ToString());
+ NetworkStack.Debugger.Send(" Gateway : " + packet.Server.ToString());
+ NetworkStack.Debugger.Send(" DNS server : " + packet.DNS.ToString());
}
IPConfig.Enable(networkDevice, packet.Client, packet.Subnet, packet.Server);
@@ -187,7 +171,7 @@ private void Apply(DHCPAck packet, bool message = false)
if (message)
{
- Global.mDebugger.Send("[DHCP CONFIG][" + networkDevice.Name + "] IP configuration applied.");
+ NetworkStack.Debugger.Send("[DHCP CONFIG][" + networkDevice.Name + "] IP configuration applied.");
asked = false;
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPDiscover.cs b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPDiscover.cs
index e4cf7b82d7..1e27276707 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPDiscover.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPDiscover.cs
@@ -1,33 +1,32 @@
using System;
using Cosmos.HAL.Network;
-using Cosmos.System.Network.IPv4.UDP.DHCP;
namespace Cosmos.System.Network.IPv4.UDP.DHCP
{
///
- /// DHCPDiscover class.
+ /// Represents a DHCP discovery packet.
///
internal class DHCPDiscover : DHCPPacket
{
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DHCPDiscover() : base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal DHCPDiscover(byte[] rawData) : base(rawData)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Source MAC Address.
+ /// Source MAC Address.
/// Thrown if RawData is invalid or null.
- internal DHCPDiscover(MACAddress mac_src) : base(mac_src, 10) //discover packet size
+ internal DHCPDiscover(MACAddress sourceMAC) : base(sourceMAC, 10) //discover packet size
{
//Discover
RawData[282] = 0x35;
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPPacket.cs b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPPacket.cs
index 0c563a8d12..c54d57e572 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPPacket.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPPacket.cs
@@ -1,73 +1,58 @@
-using Cosmos.HAL;
-using Cosmos.HAL.Network;
-using Cosmos.System.Network.IPv4;
-using Cosmos.System.Network.IPv4.UDP;
+using Cosmos.HAL.Network;
using System;
using System.Collections.Generic;
-using System.Text;
-
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: DHCP Packet
-* PROGRAMMERS: Alexy DA CRUZ
-*/
namespace Cosmos.System.Network.IPv4.UDP.DHCP
{
-
///
- /// DHCP Option
+ /// Represents a DHCP option.
///
public class DHCPOption
{
///
- /// DHCP Option Type
+ /// The type of the .
///
public byte Type { get; set; }
///
- /// DHCP Option Length
+ /// The length of the .
///
public byte Length { get; set; }
///
- /// DHCP Option Data
+ /// The raw data of the .
///
public byte[] Data { get; set; }
}
///
- /// DHCPPacket class.
+ /// Represents a DHCP packet.
///
public class DHCPPacket : UDPPacket
{
- int xID;
+ readonly int id;
///
- /// DHCP handler.
+ /// Handles a single DHCP packet.
///
- /// Packet data.
+ /// The packet data.
/// Thrown if UDP_Data array length is greater than Int32.MaxValue.
- /// Thrown on IO error.
+ /// Thrown on IO error.
public static void DHCPHandler(byte[] packetData)
{
- var dhcp_packet = new DHCPPacket(packetData);
-
- var receiver = UdpClient.GetClient(dhcp_packet.DestinationPort);
- if (receiver != null)
- {
- receiver.ReceiveData(dhcp_packet);
- }
+ var dhcpPacket = new DHCPPacket(packetData);
+ var receiver = UdpClient.GetClient(dhcpPacket.DestinationPort);
+ receiver?.ReceiveData(dhcpPacket);
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DHCPPacket() : base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
public DHCPPacket(byte[] rawData)
@@ -75,7 +60,7 @@ public DHCPPacket(byte[] rawData)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Source MAC Address.
/// DHCP Data size
@@ -84,85 +69,74 @@ internal DHCPPacket(MACAddress mac_src, ushort dhcpDataSize)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Client IPv4 Address.
/// Server IPv4 Address.
- /// Source MAC Address.
+ /// Source MAC Address.
/// DHCP Data size
/// Thrown if data array length is greater than Int32.MaxValue.
/// Thrown if RawData is invalid or null.
- internal DHCPPacket(Address client, Address server, MACAddress mac_src, ushort dhcpDataSize)
+ internal DHCPPacket(Address client, Address server, MACAddress sourceMAC, ushort dhcpDataSize)
: base(client, server, 68, 67, (ushort)(dhcpDataSize + 240), MACAddress.Broadcast)
{
- //Request
- RawData[42] = 0x01;
-
- //ethernet
- RawData[43] = 0x01;
-
- //Length mac
- RawData[44] = 0x06;
-
- //hops
- RawData[45] = 0x00;
-
- Random rnd = new Random();
- xID = rnd.Next(0, Int32.MaxValue);
- RawData[46] = (byte)((xID >> 24) & 0xFF);
- RawData[47] = (byte)((xID >> 16) & 0xFF);
- RawData[48] = (byte)((xID >> 8) & 0xFF);
- RawData[49] = (byte)((xID >> 0) & 0xFF);
-
- //second elapsed
+ RawData[42] = 0x01; // Request
+ RawData[43] = 0x01; // ethernet
+ RawData[44] = 0x06; // Length mac
+ RawData[45] = 0x00; // hops
+
+ var rnd = new Random();
+ id = rnd.Next(0, Int32.MaxValue);
+ RawData[46] = (byte)((id >> 24) & 0xFF);
+ RawData[47] = (byte)((id >> 16) & 0xFF);
+ RawData[48] = (byte)((id >> 8) & 0xFF);
+ RawData[49] = (byte)((id >> 0) & 0xFF);
+
+ // second elapsed
RawData[50] = 0x00;
RawData[51] = 0x00;
- //option bootp
+ // option bootp
RawData[52] = 0x00;
RawData[53] = 0x00;
- //client ip address
- RawData[54] = client.address[0];
- RawData[55] = client.address[1];
- RawData[56] = client.address[2];
- RawData[57] = client.address[3];
+ // client ip address
+ RawData[54] = client.Parts[0];
+ RawData[55] = client.Parts[1];
+ RawData[56] = client.Parts[2];
+ RawData[57] = client.Parts[3];
for (int i = 0; i < 13; i++)
{
RawData[58 + i] = 0x00;
}
- //Src mac
- RawData[70] = mac_src.bytes[0];
- RawData[71] = mac_src.bytes[1];
- RawData[72] = mac_src.bytes[2];
- RawData[73] = mac_src.bytes[3];
- RawData[74] = mac_src.bytes[4];
- RawData[75] = mac_src.bytes[5];
+ // Source MAC
+ RawData[70] = sourceMAC.bytes[0];
+ RawData[71] = sourceMAC.bytes[1];
+ RawData[72] = sourceMAC.bytes[2];
+ RawData[73] = sourceMAC.bytes[3];
+ RawData[74] = sourceMAC.bytes[4];
+ RawData[75] = sourceMAC.bytes[5];
- //Fill 0
+ // Fill w/ 0s
for (int i = 0; i < 202; i++)
{
RawData[76 + i] = 0x00;
}
- //DHCP Magic cookie
+ // DHCP Magic cookie
RawData[278] = 0x63;
RawData[279] = 0x82;
RawData[280] = 0x53;
RawData[281] = 0x63;
- InitFields();
+ InitializeFields();
}
- ///
- /// Init DHCPPacket fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
MessageType = RawData[42];
Client = new Address(RawData, 58);
@@ -188,19 +162,18 @@ protected override void InitFields()
}
///
- /// Get DHCP message type
+ /// Gets the DHCP message type.
///
internal byte MessageType { get; private set; }
///
- /// Get Client IPv4 Address
+ /// Gets the client IPv4 address.
///
internal Address Client { get; private set; }
///
- /// Get DHCP Options
+ /// Gets the DHCP options.
///
internal List Options { get; private set; }
-
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRelease.cs b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRelease.cs
index ef1d2b9bc2..b7972df33b 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRelease.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRelease.cs
@@ -1,30 +1,28 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using Cosmos.HAL.Network;
namespace Cosmos.System.Network.IPv4.UDP.DHCP
{
///
- /// DHCPRelease class.
+ /// Represents a DHCP release packet.
///
internal class DHCPRelease : DHCPPacket
{
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DHCPRelease() : base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal DHCPRelease(byte[] rawData) : base(rawData)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Client IPv4 Address.
/// DHCP Server IPv4 Address.
@@ -42,10 +40,10 @@ internal DHCPRelease(Address client, Address server, MACAddress source) : base(c
RawData[285] = 0x36;
RawData[286] = 0x04;
- RawData[287] = server.address[0];
- RawData[288] = server.address[1];
- RawData[289] = server.address[2];
- RawData[290] = server.address[3];
+ RawData[287] = server.Parts[0];
+ RawData[288] = server.Parts[1];
+ RawData[289] = server.Parts[2];
+ RawData[290] = server.Parts[3];
//Client ID
RawData[291] = 0x3d;
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRequest.cs b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRequest.cs
index 3059a7c808..c8b429fd65 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRequest.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DHCP/DHCPRequest.cs
@@ -1,66 +1,60 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using Cosmos.HAL.Network;
-using Cosmos.System.Network.IPv4;
-using Cosmos.System.Network.IPv4.UDP.DHCP;
namespace Cosmos.System.Network.IPv4.UDP.DHCP
{
///
- /// DHCPRequest class.
+ /// Represents a DHCP request packet.
///
internal class DHCPRequest : DHCPPacket
{
-
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DHCPRequest() : base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
internal DHCPRequest(byte[] rawData) : base(rawData)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Source MAC Address.
- /// Requested Address.
- /// DHCP server IPv4 Address.
+ /// Source MAC Address.
+ /// Requested Address.
/// Thrown if data array length is greater than Int32.MaxValue.
/// Thrown if RawData is invalid or null.
- internal DHCPRequest(MACAddress mac_src, Address RequestedAddress) : base(mac_src, 16)
+ internal DHCPRequest(MACAddress sourceMAC, Address requestedAddress) : base(sourceMAC, 16)
{
- //Request
+ // Request
RawData[282] = 53;
RawData[283] = 1;
RawData[284] = 3;
- //Requested Address
+ // Requested Address
RawData[285] = 50;
RawData[286] = 4;
- RawData[287] = RequestedAddress.address[0];
- RawData[288] = RequestedAddress.address[1];
- RawData[289] = RequestedAddress.address[2];
- RawData[290] = RequestedAddress.address[3];
+ RawData[287] = requestedAddress.Parts[0];
+ RawData[288] = requestedAddress.Parts[1];
+ RawData[289] = requestedAddress.Parts[2];
+ RawData[290] = requestedAddress.Parts[3];
- //Parameters start here
+ // Parameters start here
RawData[291] = 0x37;
RawData[292] = 4;
- //Parameters
+ // Parameters
RawData[293] = 0x01;
RawData[294] = 0x03;
RawData[295] = 0x0f;
RawData[296] = 0x06;
- RawData[297] = 0xff; //ENDMARK
+ RawData[297] = 0xff; // ENDMARK
}
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSClient.cs b/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSClient.cs
index 6ab022c221..619b7e3ca0 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSClient.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSClient.cs
@@ -1,72 +1,58 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: DNS Client
-* PROGRAMMERS: Valentin Charbonnier
-*/
-
-using Cosmos.System.Network.Config;
+using Cosmos.System.Network.Config;
using Cosmos.HAL;
using System;
-using System.Collections.Generic;
-using System.Text;
namespace Cosmos.System.Network.IPv4.UDP.DNS
{
///
- /// DnsClient class. Used to manage the DNS connection to a server.
+ /// Used to manage a DNS connection to a server.
///
public class DnsClient : UdpClient
{
- ///
- /// Domain Name query string
- ///
- private string queryurl;
+ private string queryUrl;
///
/// Create new instance of the class.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if UdpClient with localPort 53 exists.
public DnsClient() : base(53)
{
}
///
- /// Connect to client.
+ /// Connects to a client.
///
- /// Destination address.
+ /// The destination address.
public void Connect(Address address)
{
Connect(address, 53);
}
///
- /// Send DNS Ask for Domain Name string
+ /// Sends a DNS query for the given domain name string.
///
- /// Domain Name string.
+ /// The domain name string to query the DNS for.
public void SendAsk(string url)
{
Address source = IPConfig.FindNetwork(destination);
-
- queryurl = url;
-
+ queryUrl = url;
var askpacket = new DNSPacketAsk(source, destination, url);
OutgoingBuffer.AddPacket(askpacket);
-
NetworkStack.Update();
}
///
- /// Receive data
+ /// Receives data from the DNS remote host.
///
- /// timeout value, default 5000ms
- /// Address from Domain Name
- /// Thrown on fatal error (contact support).
+ /// The timeout value - by default 5000ms.
+ /// The address corresponding to the previously specified domain name.
+ /// Thrown on fatal error.
public Address Receive(int timeout = 5000)
{
int second = 0;
- int _deltaT = 0;
+ int deltaT = 0;
while (rxBuffer.Count < 1)
{
@@ -74,10 +60,10 @@ public Address Receive(int timeout = 5000)
{
return null;
}
- if (_deltaT != RTC.Second)
+ if (deltaT != RTC.Second)
{
second++;
- _deltaT = RTC.Second;
+ deltaT = RTC.Second;
}
}
@@ -85,7 +71,7 @@ public Address Receive(int timeout = 5000)
if ((ushort)(packet.DNSFlags & 0x0F) == (ushort)ReplyCode.OK)
{
- if (packet.Queries.Count > 0 && packet.Queries[0].Name == queryurl)
+ if (packet.Queries.Count > 0 && packet.Queries[0].Name == queryUrl)
{
if (packet.Answers.Count > 0 && packet.Answers[0].Address.Length == 4)
{
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSPacket.cs b/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSPacket.cs
index 90daa4700c..f2f27b83c6 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSPacket.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/DNS/DNSPacket.cs
@@ -1,10 +1,4 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: DNS Packet
-* PROGRAMMERS: Valentin Charbonnier
-*/
-
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -25,7 +19,7 @@ public enum ReplyCode
}
///
- /// DNS Query
+ /// Represents a DNS query.
///
public class DNSQuery
{
@@ -35,7 +29,7 @@ public class DNSQuery
}
///
- /// DNS Answer
+ /// Represents a DNS answer (response).
///
public class DNSAnswer
{
@@ -43,40 +37,36 @@ public class DNSAnswer
public ushort Type { get; set; }
public ushort Class { get; set; }
public int TimeToLive { get; set; }
- public ushort DataLenght { get; set; }
+ public ushort DataLength { get; set; }
public byte[] Address { get; set; }
}
///
- /// DNSPacket class.
+ /// Represents a DNS packet.
///
public class DNSPacket : UDPPacket
{
///
- /// DNS handler.
+ /// Handles DNS packets.
///
- /// Packet data.
- /// Thrown on IO error.
+ /// The raw packet data.
+ /// Thrown on IO error.
internal static void DNSHandler(byte[] packetData)
{
- DNSPacket dns_packet = new DNSPacket(packetData);
-
- DnsClient receiver = (DnsClient)UdpClient.GetClient(dns_packet.DestinationPort);
- if (receiver != null)
- {
- receiver.ReceiveData(dns_packet);
- }
+ var dnsPacket = new DNSPacket(packetData);
+ var receiver = (DnsClient)UdpClient.GetClient(dnsPacket.DestinationPort);
+ receiver?.ReceiveData(dnsPacket);
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DNSPacket()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
public DNSPacket(byte[] rawData)
@@ -84,7 +74,7 @@ public DNSPacket(byte[] rawData)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Source address.
/// Destination address.
@@ -115,16 +105,12 @@ public DNSPacket(Address source, Address dest, ushort urlnb, ushort len)
RawData[this.DataOffset + 18] = (byte)((0 >> 8) & 0xFF);
RawData[this.DataOffset + 19] = (byte)((0 >> 0) & 0xFF);
- InitFields();
+ InitializeFields();
}
- ///
- /// Init DNSPacket fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
TransactionID = (ushort)((RawData[this.DataOffset + 8] << 8) | RawData[this.DataOffset + 9]);
DNSFlags = (ushort)((RawData[this.DataOffset + 10] << 8) | RawData[this.DataOffset + 11]);
Questions = (ushort)((RawData[this.DataOffset + 12] << 8) | RawData[this.DataOffset + 13]);
@@ -134,73 +120,70 @@ protected override void InitFields()
}
///
- /// Get name from data and offset
+ /// Gets the domain name from the given data and offset.
///
- /// Data
- /// Data offset
- public string ParseName(byte[] RawData, ref int index)
+ /// The raw data of the packet.
+ /// The offset in the array.
+ public string ParseName(byte[] rawData, ref int index)
{
- StringBuilder url = new StringBuilder();
+ var url = new StringBuilder();
- while (RawData[index] != 0x00 && index < RawData.Length)
+ while (rawData[index] != 0x00 && index < rawData.Length)
{
- byte wordlength = RawData[index];
+ byte wordlength = rawData[index];
index++;
for (int j = 0; j < wordlength; j++)
{
- url.Append((char)RawData[index]);
+ url.Append((char)rawData[index]);
index++;
}
url.Append('.');
}
+
index++; //End 0x00
return url.ToString().Remove(url.Length - 1, 1);
}
///
- /// Get AnswerRRs
+ /// The amount of answer Resource Records.
///
internal ushort AnswerRRs { get; private set; }
///
- /// Get AuthorityRRs
+ /// The amount of authority Resource Records.
///
internal ushort AuthorityRRs { get; private set; }
///
- /// Get AdditionalRRs
+ /// The amount of additional Resource Records.
///
internal ushort AdditionalRRs { get; private set; }
///
- /// Get Transaction ID
+ /// The DNS transaction ID.
///
internal ushort TransactionID { get; private set; }
///
- /// Get DNS Flags
+ /// The flags of the packet.
///
internal ushort DNSFlags { get; private set; }
///
- /// Get DNS Queries Number
+ /// The number of DNS queries.
///
internal ushort Questions { get; private set; }
///
- /// Get DNS Queries
+ /// The DNS queries.
///
internal List Queries { get; set; }
///
- /// Get DNS Answers
+ /// The DNS answers (responses).
///
internal List Answers { get; set; }
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "DNS Packet Src=" + SourceIP + ":" + SourcePort + ", Dest=" + DestinationIP + ":" + DestinationPort;
@@ -209,19 +192,19 @@ public override string ToString()
}
///
- /// DNSPacketAsk class.
+ /// Represents a DNS translation request packet.
///
public class DNSPacketAsk : DNSPacket
{
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DNSPacketAsk()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
public DNSPacketAsk(byte[] rawData)
@@ -229,7 +212,7 @@ public DNSPacketAsk(byte[] rawData)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Source address.
/// DNS Server address.
@@ -267,36 +250,32 @@ public DNSPacketAsk(Address source, Address dest, string url)
}
///
- /// DNSPacketAnswer class.
+ /// Represents a DNS translation result packet.
///
public class DNSPacketAnswer : DNSPacket
{
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal DNSPacketAnswer()
: base()
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Raw data.
public DNSPacketAnswer(byte[] rawData)
: base(rawData)
{ }
- ///
- /// Init DNSPacketAnswer fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
if ((ushort)(DNSFlags & 0x0F) != (ushort)ReplyCode.OK)
{
- Global.mDebugger.Send("DNS Packet response not OK. Passing packet.");
+ NetworkStack.Debugger.Send("DNS Packet response not OK. Passing packet.");
return;
}
@@ -307,7 +286,7 @@ protected override void InitFields()
for (int i = 0; i < Questions; i++)
{
- DNSQuery query = new DNSQuery();
+ var query = new DNSQuery();
query.Name = ParseName(RawData, ref index);
query.Type = (ushort)((RawData[index + 0] << 8) | RawData[index + 1]);
query.Class = (ushort)((RawData[index + 2] << 8) | RawData[index + 3]);
@@ -321,18 +300,19 @@ protected override void InitFields()
for (int i = 0; i < AnswerRRs; i++)
{
- DNSAnswer answer = new DNSAnswer();
+ var answer = new DNSAnswer();
answer.Name = (ushort)((RawData[index + 0] << 8) | RawData[index + 1]);
answer.Type = (ushort)((RawData[index + 2] << 8) | RawData[index + 3]);
answer.Class = (ushort)((RawData[index + 4] << 8) | RawData[index + 5]);
answer.TimeToLive = (RawData[index + 6] << 24) | (RawData[index + 7] << 16) | (RawData[index + 8] << 8) | RawData[index + 9];
- answer.DataLenght = (ushort)((RawData[index + 10] << 8) | RawData[index + 11]);
+ answer.DataLength = (ushort)((RawData[index + 10] << 8) | RawData[index + 11]);
index += 12;
- answer.Address = new byte[answer.DataLenght];
- for (int j = 0; j < answer.DataLenght; j++, index++)
+ answer.Address = new byte[answer.DataLength];
+ for (int j = 0; j < answer.DataLength; j++, index++)
{
answer.Address[j] = RawData[index];
}
+
Answers.Add(answer);
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/UDPPacket.cs b/source/Cosmos.System2/Network/IPv4/UDP/UDPPacket.cs
index 4818d645ac..3cc3c597f4 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/UDPPacket.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/UDPPacket.cs
@@ -1,69 +1,54 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: UDP Packet
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using Cosmos.HAL;
-using Cosmos.HAL.Network;
+using Cosmos.HAL.Network;
using System;
-using System.Text;
namespace Cosmos.System.Network.IPv4.UDP
{
///
- /// UDPPacket class.
+ /// Represents a UDP packet.
///
public class UDPPacket : IPPacket
{
- ///
- /// UDP CRC.
- ///
private ushort udpCRC;
///
- /// UDP handler.
+ /// Handles UDP packets.
///
- /// Packet data.
+ /// The raw packet data.
/// Thrown if UDP_Data array length is greater than Int32.MaxValue.
- /// Thrown on IO error.
+ /// Thrown on IO error.
internal static void UDPHandler(byte[] packetData)
{
- UDPPacket udp_packet = new UDPPacket(packetData);
+ var udpPacket = new UDPPacket(packetData);
- Global.mDebugger.Send("[Received] UDP packet from " + udp_packet.SourceIP.ToString() + ":" + udp_packet.SourcePort.ToString());
+ NetworkStack.Debugger.Send("[Received] UDP packet from " + udpPacket.SourceIP.ToString() + ":" + udpPacket.SourcePort.ToString());
- if (udp_packet.SourcePort == 67)
+ if (udpPacket.SourcePort == 67)
{
DHCP.DHCPPacket.DHCPHandler(packetData);
return;
}
- else if (udp_packet.SourcePort == 53)
+ else if (udpPacket.SourcePort == 53)
{
DNS.DNSPacket.DNSHandler(packetData);
return;
}
- UdpClient receiver = UdpClient.GetClient(udp_packet.DestinationPort);
- if (receiver != null)
- {
- receiver.ReceiveData(udp_packet);
- }
+ var receiver = UdpClient.GetClient(udpPacket.DestinationPort);
+ receiver?.ReceiveData(udpPacket);
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal UDPPacket()
{
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Raw data.
+ /// The raw data.
public UDPPacket(byte[] rawData)
: base(rawData)
{
@@ -73,24 +58,24 @@ public UDPPacket(Address source, Address dest, ushort srcport, ushort destport,
: base((ushort)(datalength + 8), 17, source, dest, 0x00)
{
MakePacket(srcport, destport, datalength);
- InitFields();
+ InitializeFields();
}
public UDPPacket(Address source, Address dest, ushort srcport, ushort destport, ushort datalength, MACAddress destmac)
: base((ushort)(datalength + 8), 17, source, dest, 0x00, destmac)
{
MakePacket(srcport, destport, datalength);
- InitFields();
+ InitializeFields();
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Source address.
- /// Destination address.
- /// Source port.
- /// Destination port.
- /// Data array.
+ /// The source address.
+ /// The destination address.
+ /// The source port.
+ /// The destination port.
+ /// The data array.
/// Thrown if data array length is greater than Int32.MaxValue.
/// Thrown if RawData is invalid or null.
public UDPPacket(Address source, Address dest, ushort srcPort, ushort destPort, byte[] data)
@@ -103,7 +88,7 @@ public UDPPacket(Address source, Address dest, ushort srcPort, ushort destPort,
RawData[this.DataOffset + 8 + b] = data[b];
}
- InitFields();
+ InitializeFields();
}
private void MakePacket(ushort srcport, ushort destport, ushort length)
@@ -112,54 +97,53 @@ private void MakePacket(ushort srcport, ushort destport, ushort length)
RawData[this.DataOffset + 1] = (byte)((srcport >> 0) & 0xFF);
RawData[this.DataOffset + 2] = (byte)((destport >> 8) & 0xFF);
RawData[this.DataOffset + 3] = (byte)((destport >> 0) & 0xFF);
- UDP_Length = (ushort)(length + 8);
+ UDPLength = (ushort)(length + 8);
- RawData[this.DataOffset + 4] = (byte)((UDP_Length >> 8) & 0xFF);
- RawData[this.DataOffset + 5] = (byte)((UDP_Length >> 0) & 0xFF);
+ RawData[this.DataOffset + 4] = (byte)((UDPLength >> 8) & 0xFF);
+ RawData[this.DataOffset + 5] = (byte)((UDPLength >> 0) & 0xFF);
RawData[this.DataOffset + 6] = (byte)((0 >> 8) & 0xFF);
RawData[this.DataOffset + 7] = (byte)((0 >> 0) & 0xFF);
}
- ///
- /// Init UDPPacket fields.
- ///
- /// Thrown if RawData is invalid or null.
- protected override void InitFields()
+ protected override void InitializeFields()
{
- base.InitFields();
+ base.InitializeFields();
SourcePort = (ushort)((RawData[DataOffset] << 8) | RawData[DataOffset + 1]);
DestinationPort = (ushort)((RawData[DataOffset + 2] << 8) | RawData[DataOffset + 3]);
- UDP_Length = (ushort)((RawData[DataOffset + 4] << 8) | RawData[DataOffset + 5]);
+ UDPLength = (ushort)((RawData[DataOffset + 4] << 8) | RawData[DataOffset + 5]);
udpCRC = (ushort)((RawData[DataOffset + 6] << 8) | RawData[DataOffset + 7]);
}
///
- /// Get destination port.
+ /// Gets the destination port.
///
public ushort DestinationPort { get; private set; }
+
///
- /// Get source port.
+ /// Gets the source port.
///
public ushort SourcePort { get; private set; }
+
///
- /// Get UDP length.
+ /// Gets the UDP length of the packet.
///
- public ushort UDP_Length { get; private set; }
+ public ushort UDPLength { get; private set; }
+
///
- /// Get UDP data lenght.
+ /// Get UDP data length of the packet.
///
- public ushort UDP_DataLength => (ushort)(UDP_Length - 8);
+ public ushort UDPDataLength => (ushort)(UDPLength - 8);
///
- /// Get UDP data.
+ /// Gets the UDP data of the packet.
///
- /// Thrown on fatal error (contact support).
- internal byte[] UDP_Data
+ /// Thrown on fatal error.
+ internal byte[] UDPData
{
get
{
- byte[] data = new byte[UDP_DataLength];
+ byte[] data = new byte[UDPDataLength];
for (int b = 0; b < data.Length; b++)
{
@@ -170,14 +154,10 @@ internal byte[] UDP_Data
}
}
- ///
- /// To string.
- ///
- /// string value.
public override string ToString()
{
return "UDP Packet Src=" + SourceIP + ":" + SourcePort + "," +
- "Dest=" + DestinationIP + ":" + DestinationPort + ", DataLen=" + UDP_DataLength;
+ "Dest=" + DestinationIP + ":" + DestinationPort + ", DataLen=" + UDPDataLength;
}
}
}
diff --git a/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs b/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs
index 194ddcbbb1..0eeb95304c 100644
--- a/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs
+++ b/source/Cosmos.System2/Network/IPv4/UDP/UdpClient.cs
@@ -1,64 +1,41 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: UDP Client
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-using Cosmos.System.Network.Config;
+using Cosmos.System.Network.Config;
using System;
using System.Collections.Generic;
-using System.Text;
namespace Cosmos.System.Network.IPv4.UDP
{
///
- /// UdpClient class. Used to manage the UDP connection to a client.
+ /// Used to manage the UDP connection to a client.
///
public class UdpClient : IDisposable
{
- ///
- /// Clients dictionary.
- ///
- private static Dictionary clients;
+ private readonly static Dictionary clients;
+ private readonly int localPort;
+ private int destinationPort;
///
- /// Local port.
- ///
- private int localPort;
- ///
- /// Destination address.
+ /// The destination address.
///
internal Address destination;
- ///
- /// Destination port.
- ///
- private int destinationPort;
///
- /// RX buffer queue.
+ /// The RX buffer queue.
///
internal Queue rxBuffer;
- ///
- /// Assign clients dictionary.
- ///
- /// Thrown on fatal error (contact support).
static UdpClient()
{
clients = new Dictionary();
}
///
- /// Get client.
+ /// Gets a UDP client running on the given port.
///
- /// Destination port.
- /// UdpClient
+ /// The destination port.
+ /// If a client is running on the given port, the ; otherwise, .
internal static UdpClient GetClient(ushort destPort)
{
- UdpClient client;
-
- if (clients.TryGetValue(destPort, out client))
+ if (clients.TryGetValue(destPort, out var client))
{
return client;
}
@@ -69,19 +46,19 @@ internal static UdpClient GetClient(ushort destPort)
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if UdpClient with localPort 0 exists.
public UdpClient()
: this(0)
{ }
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Local port.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if localPort already exists.
public UdpClient(int localPort)
{
@@ -95,11 +72,11 @@ public UdpClient(int localPort)
}
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Destination address.
/// Destination port.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if UdpClient with localPort 0 exists.
public UdpClient(Address dest, int destPort)
: this(0)
@@ -109,10 +86,10 @@ public UdpClient(Address dest, int destPort)
}
///
- /// Connect to client.
+ /// Connects to the given client.
///
- /// Destination address.
- /// Destination port.
+ /// The destination address.
+ /// The destination port.
public void Connect(Address dest, int destPort)
{
destination = dest;
@@ -120,9 +97,9 @@ public void Connect(Address dest, int destPort)
}
///
- /// Close connection.
+ /// Closes the active connection.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
public void Close()
{
if (clients.ContainsKey((uint)localPort) == true)
@@ -132,13 +109,13 @@ public void Close()
}
///
- /// Send data to client.
+ /// Sends data to the client.
///
- /// Data array to send.
+ /// The data to send.
/// Thrown if destination is null or destinationPort is 0.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown if data array length is greater than Int32.MaxValue.
- /// Thrown on IO error.
+ /// Thrown on IO error.
public void Send(byte[] data)
{
if (destination == null || destinationPort == 0)
@@ -151,14 +128,14 @@ public void Send(byte[] data)
}
///
- /// Send data.
+ /// Sends data to a remote host.
///
- /// Data array.
- /// Destination address.
- /// Destination port.
- /// Thrown on fatal error (contact support).
+ /// The data to send.
+ /// The destination address.
+ /// The destination port.
+ /// Thrown on fatal error.
/// Thrown if data array length is greater than Int32.MaxValue.
- /// Thrown on IO error.
+ /// Thrown on IO error.
public void Send(byte[] data, Address dest, int destPort)
{
Address source = IPConfig.FindNetwork(dest);
@@ -167,11 +144,10 @@ public void Send(byte[] data, Address dest, int destPort)
}
///
- /// Receive data from end point.
+ /// Receives data from the given end-point.
///
- /// Source end point.
- /// byte array value.
- /// Thrown on fatal error (contact support).
+ /// The source end point.
+ /// Thrown on fatal error.
public byte[] NonBlockingReceive(ref EndPoint source)
{
if (rxBuffer.Count < 1)
@@ -183,40 +159,39 @@ public byte[] NonBlockingReceive(ref EndPoint source)
source.Address = packet.SourceIP;
source.Port = packet.SourcePort;
- return packet.UDP_Data;
+ return packet.UDPData;
}
///
- /// Receive data from end point.
+ /// Receives data from the given end-point.
///
- /// Source end point.
- /// byte array value.
- /// Thrown on fatal error (contact support).
+ /// The source end point.
+ /// Thrown on fatal error.
public byte[] Receive(ref EndPoint source)
{
- while (rxBuffer.Count < 1) ;
+ while (rxBuffer.Count < 1)
+ {
+ ;
+ }
var packet = new UDPPacket(rxBuffer.Dequeue().RawData);
source.Address = packet.SourceIP;
source.Port = packet.SourcePort;
- return packet.UDP_Data;
+ return packet.UDPData;
}
///
- /// Receive data from packet.
+ /// Receives data from the given packet.
///
/// Packet to receive.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
internal void ReceiveData(UDPPacket packet)
{
rxBuffer.Enqueue(packet);
}
- ///
- /// Close Client
- ///
public void Dispose()
{
Close();
diff --git a/source/Cosmos.System2/Network/NetworkDebugger.cs b/source/Cosmos.System2/Network/NetworkDebugger.cs
index e1a0e799ed..564e1f1666 100644
--- a/source/Cosmos.System2/Network/NetworkDebugger.cs
+++ b/source/Cosmos.System2/Network/NetworkDebugger.cs
@@ -7,40 +7,36 @@
namespace Cosmos.System.Network
{
+ ///
+ /// Facilitates kernel debugging over IP.
+ ///
public class NetworkDebugger
{
- ///
- /// TCP Server.
- ///
- private TcpListener xListener = null;
-
- ///
- /// TCP Client.
- ///
- private TcpClient xClient = null;
+ private readonly TcpListener listener;
+ private TcpClient client;
///
- /// Remote IP Address
+ /// The remote host IP address.
///
public Address Ip { get; set; }
///
- /// Port used
+ /// The port to use.
///
public int Port { get; set; }
///
- /// Create NetworkDebugger class (used to listen for a debugger connection)
+ /// Initializes a new instance of the class.
///
/// Port used for TCP connection.
public NetworkDebugger(int port)
{
Port = port;
- xListener = new TcpListener((ushort)port);
+ listener = new TcpListener((ushort)port);
}
///
- /// Create NetworkDebugger class (used to connect to a remote debugger)
+ /// Initializes a new instance of the class.
///
/// IP Address of the remote debugger.
/// Port used for TCP connection.
@@ -48,47 +44,47 @@ public NetworkDebugger(Address ip, int port)
{
Ip = ip;
Port = port;
- xClient = new TcpClient(port);
+ client = new TcpClient(port);
}
///
- /// Start debugger
+ /// Starts the debugger.
///
public void Start()
{
- if (xClient == null)
+ if (client == null)
{
- xListener.Start();
+ listener.Start();
Con.WriteLine("Waiting for remote debugger connection at " + NetworkConfiguration.CurrentAddress.ToString() + ":" + Port);
- xClient = xListener.AcceptTcpClient(); //blocking
+ client = listener.AcceptTcpClient(); //blocking
}
- else if (xListener == null)
+ else if (listener == null)
{
- xClient.Connect(Ip, Port);
+ client.Connect(Ip, Port);
}
Send("--- Cosmos Network Debugger ---");
- Send("Debugger Connected!");
+ Send("Debugger connected!");
}
///
- /// Send text to the debugger
+ /// Send text to the debugger.
///
/// Text to send to the debugger.
public void Send(string message)
{
- xClient.Send(Encoding.ASCII.GetBytes("[" + DateTime.Now.ToString("HH:mm:ss") + "] - " + message + "\r\n"));
+ client.Send(Encoding.ASCII.GetBytes("[" + DateTime.Now.ToString("HH:mm:ss") + "] - " + message + "\r\n"));
}
///
- /// Stop the debugger by closing TCP Connection
+ /// Stops the debugger by closing the TCP connection.
///
public void Stop()
{
Con.WriteLine("Closing Debugger connection");
Send("Closing...");
- xClient.Close();
+ client.Close();
}
}
}
diff --git a/source/Cosmos.System2/Network/NetworkStack.cs b/source/Cosmos.System2/Network/NetworkStack.cs
index 4fdb3146d1..ab307e79e0 100644
--- a/source/Cosmos.System2/Network/NetworkStack.cs
+++ b/source/Cosmos.System2/Network/NetworkStack.cs
@@ -1,58 +1,47 @@
-/*
-* PROJECT: Aura Operating System Development
-* CONTENT: Network Intialization + Packet Handler
-* PROGRAMMERS: Valentin Charbonnier
-* Port of Cosmos Code.
-*/
-
-//#define COSMOSDEBUG
-
-using System;
+using System;
using System.Collections.Generic;
using Cosmos.Debug.Kernel;
using Cosmos.HAL;
using Cosmos.System.Network.ARP;
using Cosmos.System.Network.Config;
using Cosmos.System.Network.IPv4;
-using Cosmos.System.Network.IPv4.UDP;
namespace Cosmos.System.Network
{
///
- /// Implement a Network Stack for all network devices and protocols
+ /// Manages the Cosmos networking stack.
///
public static class NetworkStack
{
///
/// Debugger instance of the "System" ring, with the "NetworkStack" tag.
///
- public static Debugger debugger = new Debugger("System", "NetworkStack");
+ public static readonly Debugger Debugger = new("Network Stack");
///
- /// Get address dictionary.
+ /// Maps IP (Internet Protocol) addresses to network devices.
///
internal static Dictionary AddressMap { get; private set; }
///
- /// Get address dictionary.
+ /// Maps MAC addresses to network devices.
///
internal static Dictionary MACMap { get; private set; }
///
- /// Initialize the Network Stack to prepare it for operation.
+ /// Initializes the network stack.
///
- /// Thrown on fatal error (contact support).
- public static void Init()
+ public static void Initialize()
{
AddressMap = new Dictionary();
MACMap = new Dictionary();
}
///
- /// Set ConfigIP for NetworkDevice
+ /// Sets the IP configuration for the given network device.
///
- /// Network device.
- /// IP Config
+ /// The target network device.
+ /// The IP configuration to assign to the device.
private static void SetConfigIP(NetworkDevice nic, IPConfig config)
{
NetworkConfiguration.AddConfig(nic, config);
@@ -63,21 +52,23 @@ private static void SetConfigIP(NetworkDevice nic, IPConfig config)
}
///
- /// Configure a IP configuration on the given network device.
- /// Multiple IP Configurations can be made, like *nix environments
+ /// Configures an IP configuration on the given network device.
///
- /// that will have the assigned configuration
- /// instance that defines the IP Address, Subnet
- /// Mask and Default Gateway for the device
+ ///
+ /// Multiple IP configurations can be made, similar to *nix environments.
+ ///
+ ///
+ /// The that will have the assigned configuration.
+ /// The instance that defines the IP Address, Subnet Mask and Default Gateway for the device
+ ///
///
- ///
- /// - Thrown if configuration with the given config.IPAddress.Hash already exists.
- /// - Thrown on fatal error (contact support).
- ///
+ ///
+ /// - Thrown if configuration with the given config.IPAddress.Hash already exists.
+ ///
///
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
+ /// Thrown on fatal error.
public static void ConfigIP(NetworkDevice nic, IPConfig config)
{
if (NetworkConfiguration.ConfigsContainsDevice(nic))
@@ -94,8 +85,7 @@ public static void ConfigIP(NetworkDevice nic, IPConfig config)
}
///
- /// Check if Config is empty
- /// bool value.
+ /// Check if the current network configuration is empty.
///
public static bool ConfigEmpty()
{
@@ -110,7 +100,7 @@ public static bool ConfigEmpty()
}
///
- /// Remove All IPConfig
+ /// Remove all IP configurations.
///
public static void RemoveAllConfigIP()
{
@@ -121,9 +111,9 @@ public static void RemoveAllConfigIP()
}
///
- /// Remove IPConfig
+ /// Removes the IP configuration of a specific network device.
///
- /// Network device.
+ /// The target device.
public static void RemoveIPConfig(NetworkDevice nic)
{
IPConfig config = NetworkConfiguration.Get(nic);
@@ -134,18 +124,18 @@ public static void RemoveIPConfig(NetworkDevice nic)
}
///
- /// Handle packet.
+ /// Handle a network packet.
///
/// Packet data array.
- /// Thrown on fatal error (contact support).
- /// Thrown on IO error.
- /// Thrown on fatal error (contact support).
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
+ /// Thrown on IO error.
+ /// Thrown on fatal error.
+ /// Thrown on fatal error.
internal static void HandlePacket(byte[] packetData)
{
if (packetData == null)
{
- Global.mDebugger.Send("Error packet data null");
+ Debugger.Send("Error packet data null");
return;
}
@@ -162,14 +152,15 @@ internal static void HandlePacket(byte[] packetData)
}
///
- /// Called continously to keep the Network Stack going.
+ /// Updates the network stack. This method should be called continously by
+ /// other parts of the network stack.
///
- /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error.
/// Thrown on memory error.
- /// Thrown if data length of any packet in the queue is bigger than Int32.MaxValue.
+ /// Thrown if data length of any packet in the queue is bigger than .
public static void Update()
{
OutgoingBuffer.Send();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/PCSpeaker.cs b/source/Cosmos.System2/PCSpeaker.cs
index 29323f3430..1f06cd5dfb 100644
--- a/source/Cosmos.System2/PCSpeaker.cs
+++ b/source/Cosmos.System2/PCSpeaker.cs
@@ -7,7 +7,8 @@
namespace Cosmos.System
{
///
- /// PC speaker helper class.
+ /// Serves as an extension class, with methods relating to the
+ /// PC speaker (beeper).
///
public static class PCSExtensions
{
@@ -15,17 +16,17 @@ public static class PCSExtensions
/// Convert milliseconds (ms) to hertz (Hz).
///
/// A milliseconds value, must be > 0.
- /// integer value.
+ /// The given value, in hertz (Hz).
public static uint MsToHz(this int ms)
{
- return (uint)(1000 / ms); //TODO: maybe throw exception on <= 0 ms value
+ return (uint)(1000 / ms); // TODO: maybe throw exception on <= 0 ms value
}
///
/// Convert milliseconds (ms) to hertz (Hz).
///
/// A milliseconds value, must be > 0.
- /// integer value.
+ /// The given value, in hertz (Hz).
public static uint MsToHz(this uint ms)
{
return (uint)(1000 / ms);
@@ -34,8 +35,10 @@ public static uint MsToHz(this uint ms)
///
/// Possible duration types.
- ///
///
+ ///
+ ///
+ ///
public enum Durations
{
Whole = 1600,
@@ -49,9 +52,11 @@ public enum Durations
///
/// Possible note types.
+ ///
+ ///
///
///
- ///
+ ///
public enum Notes
{
A0 = 28, // Exactly 27.500
@@ -141,13 +146,13 @@ public enum Notes
// TODO: continue exception list, once HAL is documented.
///
- /// PC speaker class.
+ /// Represents the internal PC speaker/beeper.
///
public class PCSpeaker
{
// TODO: continue exception list, once HAL is documented.
///
- /// Play beep sound, at 800hz for one eighth.
+ /// Plays a beep sound, at 800hz for one eighth.
///
public static void Beep()
{
@@ -156,7 +161,7 @@ public static void Beep()
// TODO: continue exception list, once HAL is documented.
///
- /// Play beep sound, at a specified frequency for one eighth.
+ /// Plays a beep sound, at a specified frequency for one eighth.
///
/// Audio frequency in Hz, must be between 37 and 32767Hz.
public static void Beep(uint frequency)
@@ -166,7 +171,7 @@ public static void Beep(uint frequency)
// TODO: continue exception list, once HAL is documented.
///
- /// Play beep sound, at a specified frequency for a specified duration.
+ /// Plays a beep sound, at a specified frequency for a specified duration.
///
/// Audio frequency in Hz, must be between 37 and 32767Hz.
/// Beep duration, must be > 0.
@@ -177,7 +182,7 @@ public static void Beep(uint frequency, uint duration)
// TODO: continue exception list, once HAL is documented.
///
- /// Play beep sound, at a specified note for a specified duration.
+ /// Plays a beep sound, at a specified note for a specified duration.
///
/// A note to play.
/// Beep duration, must be > 0.
@@ -188,7 +193,7 @@ public static void Beep(Notes note, Durations duration)
// TODO: continue exception list, once HAL is documented.
///
- /// Play beep sound, at a specified frequency for one eighth.
+ /// Plays a beep sound, at a specified frequency for one eighth.
///
/// A note to play.
public static void Beep(Notes note)
diff --git a/source/Cosmos.System2/Power.cs b/source/Cosmos.System2/Power.cs
index 6d71b2bc84..034750af93 100644
--- a/source/Cosmos.System2/Power.cs
+++ b/source/Cosmos.System2/Power.cs
@@ -1,20 +1,22 @@
using Cosmos.Core;
-using System;
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
namespace Cosmos.System
{
///
- /// Power class.
+ /// Manages the power state of the system.
///
public static class Power
{
///
- /// Reboot with CPU.
+ /// Reboots the system using the CPU.
///
+ [DoesNotReturn]
public static void Reboot()
{
/*
- * Qemu does not support ACPI at the current moment due to multiboot2 and SeaBios being to old.
+ * Qemu does not support ACPI at the current moment due to multiboot2 and SeaBios being too old.
* This Provides a Reboot functionality.
*/
if (VMTools.IsQEMU)
@@ -29,6 +31,7 @@ public static void Reboot()
/// Shutdown the ACPI.
///
/// Thrown on IO error.
+ [DoesNotReturn]
public static void Shutdown()
{
/*
@@ -39,6 +42,7 @@ public static void Shutdown()
{
IOPort.Write32(0x4004, 0x3400);
}
+
/*
* Qemu does not support ACPI at the current moment due to multiboot2 and SeaBios being to old.
* This Provides a shutdown functionality.
@@ -52,4 +56,4 @@ public static void Shutdown()
HAL.Power.ACPIShutdown();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/TestingHelpers.cs b/source/Cosmos.System2/TestingHelpers.cs
index 17c7748b0c..ed3b270337 100644
--- a/source/Cosmos.System2/TestingHelpers.cs
+++ b/source/Cosmos.System2/TestingHelpers.cs
@@ -1,7 +1,4 @@
-using sysIO = System.IO;
-using Cosmos.Debug.Kernel;
-
-namespace Cosmos.System
+namespace Cosmos.System
{
// This class exists purely for testing purposes.
///
@@ -11,16 +8,16 @@ internal static class TestingHelpers
{
///
/// Add fake scan codes to the keyboard, fake pressing keys.
- /// Used to test kernals.
+ /// Used to test kernels.
///
- /// A key code.
- /// Is key pressed.
- /// An I/O error occurred.
- internal static void KeyboardAddFakeScanCode(byte aScanCode, bool aReleased)
+ /// A key code.
+ /// Is key pressed.
+ /// An I/O error occurred.
+ internal static void KeyboardAddFakeScanCode(byte scanCode, bool released)
{
- Global.mDebugger.Send("Before HandleFakeScanCode");
- KeyboardManager.HandleFakeScanCode(aScanCode, aReleased);
- Global.mDebugger.Send("After HandleFakeScanCode");
+ Global.Debugger.Send("Before HandleFakeScanCode");
+ KeyboardManager.HandleFakeScanCode(scanCode, released);
+ Global.Debugger.Send("After HandleFakeScanCode");
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Text/CP437Encoding.cs b/source/Cosmos.System2/Text/CP437Encoding.cs
index c0901bca9e..38851d7f89 100644
--- a/source/Cosmos.System2/Text/CP437Encoding.cs
+++ b/source/Cosmos.System2/Text/CP437Encoding.cs
@@ -4,22 +4,18 @@
namespace Cosmos.System.ExtendedASCII
{
///
- /// CP437Enconding class, represent CP437 encoding. See also: .
+ /// Represents the CP437 encoding.
///
- internal class CP437Enconding : SingleByteEncoding
+ ///
+ /// See also: .
+ ///
+ internal class CP437Encoding : SingleByteEncoding
{
///
- /// Debugger instance of the "System" ring with the "CP437 Encoding" tag.
+ /// Create new instance of the class.
///
- private static Debugger myDebugger = new Debugger("System", "CP437 Encoding");
-
- ///
- /// Create new instance of the class.
- ///
- internal CP437Enconding()
+ internal CP437Encoding()
{
- myDebugger.SendInternal("CP437Enconding Setting CodePageTable only one time...");
-
CodePageTable = new char[] {
'Ç' , 'ü' , 'é' , 'â' , 'ä' , 'à' , 'å' , 'ç' , 'ê' , 'ë' , 'è' , 'ï' , 'î' , 'ì' , 'Ä' , 'Å' ,
'É' , 'æ' , 'Æ' , 'ô' , 'ö' , 'ò' , 'û' , 'ù' , 'ÿ' , 'Ö' , 'Ü' , '¢' , '£' , '¥' , '₧' , 'ƒ' ,
@@ -32,14 +28,8 @@ internal CP437Enconding()
};
}
- ///
- /// Get encoding body name.
- ///
public override string BodyName => "IBM437";
- ///
- /// Get encoding codepage.
- ///
public override int CodePage => 437;
}
}
diff --git a/source/Cosmos.System2/Text/CP858Encoding.cs b/source/Cosmos.System2/Text/CP858Encoding.cs
index 1e7c7ae6aa..6cccf27fab 100644
--- a/source/Cosmos.System2/Text/CP858Encoding.cs
+++ b/source/Cosmos.System2/Text/CP858Encoding.cs
@@ -4,22 +4,18 @@
namespace Cosmos.System.ExtendedASCII
{
///
- /// CP858Enconding class, represent CP858 encoding. See also: .
+ /// Represents the CP858 encoding.
///
+ ///
+ /// See also: .
+ ///
internal class CP858Enconding : SingleByteEncoding
{
- ///
- /// Debugger instance of the "System" ring with the "CP858 Encoding" tag.
- ///
- private static Debugger myDebugger = new Debugger("System", "CP858 Encoding");
-
///
/// Create new instance of the class.
///
internal CP858Enconding()
{
- myDebugger.SendInternal($"CP858Enconding Setting CodePageTable only one time...");
-
CodePageTable = new char[]
{
'Ç', 'ü', 'é', 'â', 'ä', 'à', 'å', 'ç', 'ê', 'ë', 'è', 'ï', 'î', 'ì', 'Ä', 'Å',
@@ -33,14 +29,7 @@ internal CP858Enconding()
};
}
- ///
- /// Get encoding body name.
- ///
public override string BodyName => "IBM00858";
-
- ///
- /// Get encoding codepage.
- ///
public override int CodePage => 858;
}
}
diff --git a/source/Cosmos.System2/Text/CosmosEncodingProvider.cs b/source/Cosmos.System2/Text/CosmosEncodingProvider.cs
index 7cb0b4c887..2354a44051 100644
--- a/source/Cosmos.System2/Text/CosmosEncodingProvider.cs
+++ b/source/Cosmos.System2/Text/CosmosEncodingProvider.cs
@@ -1,64 +1,55 @@
-//#define COSMOSDEBUG
-using System.Text;
+using System.Text;
using Cosmos.Debug.Kernel;
namespace Cosmos.System.ExtendedASCII
{
///
- /// CosmosEncodingProvider class. Used to provide , by using its name or codepage. See also: .
+ /// Used to provide an by using its name or codepage.
///
+ ///
+ /// See also: .
+ ///
public class CosmosEncodingProvider : EncodingProvider
{
- ///
- /// Encoding provider.
- ///
- private static readonly EncodingProvider s_singleton = new CosmosEncodingProvider();
- ///
- /// Debugger instance of the "System" ring with the "CosmosEncodingProvider" tag.
- ///
- private static Debugger myDebugger = new Debugger("System", "CosmosEncodingProvider");
+ static readonly EncodingProvider singleton = new CosmosEncodingProvider();
+ static readonly Debugger debugger = new("CosmosEncodingProvider");
///
- /// Create new instance of the class.
+ /// Initializes a new instance of the class.
///
internal CosmosEncodingProvider() { }
///
- /// Get CosmosEncodingProvider instance. Returns EncodingProvider.
+ /// Gets the main instance.
+ /// Returns an .
///
- public static EncodingProvider Instance
- {
- get { return s_singleton; }
- }
+ public static EncodingProvider Instance => singleton;
///
- /// Get encoding, using its codepage.
+ /// Gets an encoding by its codepage.
///
- /// Codepage.
- /// Encoding value.
+ /// The codepage.
public override Encoding GetEncoding(int codepage)
{
- myDebugger.SendInternal($"Getting Encoding for codepage {codepage}");
- if (codepage < 0 || codepage > 65535)
+ debugger.SendInternal($"Getting Encoding for codepage {codepage}");
+ if (codepage is < 0 or > 65535)
+ {
return null;
+ }
- /* Let's check on our EncodingTable, if codepage is not found null is returned */
+ // Let's check on our EncodingTable, if codepage is not found null is returned
return EncodingTable.GetEncoding(codepage);
}
///
- /// Get encoding, using its name.
+ /// Gets an encoding by using its name.
///
- /// Name.
- /// Encoding value.
+ /// The name of the target encoding.
public override Encoding GetEncoding(string name)
{
- myDebugger.SendInternal($"Getting Encoding for codepage with name {name}");
+ debugger.SendInternal($"Getting Encoding for codepage with name {name}");
int codepage = EncodingTable.GetCodePageFromDesc(name);
- if (codepage == -1)
- return null;
-
- return GetEncoding(codepage);
+ return codepage == -1 ? null : GetEncoding(codepage);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Text/EncodingTable.cs b/source/Cosmos.System2/Text/EncodingTable.cs
index 21796c4f30..1ec1f05667 100644
--- a/source/Cosmos.System2/Text/EncodingTable.cs
+++ b/source/Cosmos.System2/Text/EncodingTable.cs
@@ -1,5 +1,4 @@
-//#define COSMOSDEBUG
-using System.Text;
+using System.Text;
using Cosmos.Debug.Kernel;
namespace Cosmos.System.ExtendedASCII
@@ -8,61 +7,41 @@ namespace Cosmos.System.ExtendedASCII
* Ideally we should use Dictionary or HashTable here but are yet not working in Cosmos so I have done
* this replacement class for now...
*/
+
///
- /// EncodingTable class. Used to manage codepage list.
+ /// Used to manage the codepage list.
///
internal static class EncodingTable
{
- ///
- /// Debugger instance of the "System" ring with the "EncodingTable" tag.
- ///
- private static Debugger mDebugger = new Debugger("System", "EncodingTable");
+ static readonly Debugger mDebugger = new("EncodingTable");
///
/// Create new instance of the class.
///
static EncodingTable()
{
- mDebugger.SendInternal("Inizializing Encoding Table");
-
- Add(437, "IBM437", new CP437Enconding());
+ mDebugger.SendInternal("Initializing the encoding table...");
+ Add(437, "IBM437", new CP437Encoding());
Add(858, "IBM0858", new CP858Enconding());
}
///
- /// Struct which used to hold description and encoding.
+ /// Used to hold the description and encoding.
///
- private struct values
+ private struct DescriptionEncodingPair
{
- ///
- /// Description.
- ///
- public string desc;
- ///
- /// Encoding.
- ///
- public Encoding encoding;
+ public string Description;
+ public Encoding Encoding;
- ///
- /// Create new instance of the struct.
- ///
- /// Description.
- /// Encoding.
- public values(string desc, Encoding encoding)
+ public DescriptionEncodingPair(string desc, Encoding encoding)
{
- this.desc = desc;
- this.encoding = encoding;
+ Description = desc;
+ Encoding = encoding;
}
};
- ///
- /// Max codepage cache size.
- ///
const int MaxCodepageChacheSize = 2048;
- ///
- /// Codepage cache.
- ///
- static values[] CodepageCache = new values[MaxCodepageChacheSize];
+ static readonly DescriptionEncodingPair[] CodepageCache = new DescriptionEncodingPair[MaxCodepageChacheSize];
///
/// Add encoding to the encoding table.
@@ -72,39 +51,37 @@ public values(string desc, Encoding encoding)
/// Encoding.
public static void Add(int codepage, string desc, Encoding encoding)
{
- mDebugger.SendInternal($"Adding codepage {codepage} desc {desc}");
- CodepageCache[codepage] = new values(desc, encoding);
+ mDebugger.SendInternal($"Adding codepage {codepage} w/ description {desc}");
+ CodepageCache[codepage] = new DescriptionEncodingPair(desc, encoding);
}
///
- /// Get description, using codepage.
+ /// Gets the description of the given codepage.
///
- /// Codepage.
- /// string value.
- public static string GetDescription(int codepage) => CodepageCache[codepage].desc;
+ /// The codepage.
+ public static string GetDescription(int codepage) => CodepageCache[codepage].Description;
///
- /// Get encoding, using codepage.
+ /// Gets the encoding of the given codepage.
///
- /// Codepage.
- /// Encoding value.
- public static Encoding GetEncoding(int codepage) => CodepageCache[codepage].encoding;
+ /// The codepage.
+ public static Encoding GetEncoding(int codepage) => CodepageCache[codepage].Encoding;
///
- /// Get code page from description.
+ /// Get a code page by its description.
///
- /// Description.
- /// int value, -1 if not found.
+ /// The description.
+ /// The codepage, or -1 if not found.
public static int GetCodePageFromDesc(string desc)
{
for (int idx = 0; idx < MaxCodepageChacheSize; idx++)
{
- if (CodepageCache[idx].desc == desc)
+ if (CodepageCache[idx].Description == desc) {
return idx;
+ }
}
- /* Not found! */
return -1;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2/Text/SingleByteEncoding.cs b/source/Cosmos.System2/Text/SingleByteEncoding.cs
index 5227138a1d..34dbc0d2b6 100644
--- a/source/Cosmos.System2/Text/SingleByteEncoding.cs
+++ b/source/Cosmos.System2/Text/SingleByteEncoding.cs
@@ -6,58 +6,50 @@
namespace Cosmos.System.ExtendedASCII
{
///
- /// SingleByteEncoding class. Used to represent a single byte encoding.
+ /// Represents a single byte encoding.
///
internal class SingleByteEncoding : Encoding
{
- ///
- /// Debugger instance of the "System" ring with the "SingleByteEncoding" tag.
- ///
- private static Debugger mDebugger = new Debugger("System", "SingleByteEncoding");
+ static readonly Debugger mDebugger = new("SingleByteEncoding");
///
- /// Get and set codepage table.
+ /// The code page table.
///
internal char[] CodePageTable { get; set; }
- ///
- /// Replacement char.
- ///
+
private const byte ReplacementChar = (byte)'?';
- ///
- /// Check if this is single byte.
- ///
public override bool IsSingleByte => true;
- ///
- /// Get count of bytes in chars array.
- ///
- /// Chars array.
- /// Starting index in chars array.
- /// Number of chars to check.
- /// int value.
- /// Thrown if chars is null.
- /// Thrown if index or count are invalid.
public override int GetByteCount(char[] chars, int index, int count)
{
- mDebugger.SendInternal($"GetByteCount of chars {new string(chars)} index {index} count {count}");
// Validate input parameters
if (chars == null)
- throw new ArgumentNullException("chars", "Null Array");
+ {
+ throw new ArgumentNullException(nameof(chars));
+ }
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException(index < 0 ? "index" : "count", "negative number");
+ {
+ throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), "negative number");
+ }
if (chars.Length - index < count)
- throw new ArgumentOutOfRangeException("chars", "count more that what is in array");
+ {
+ throw new ArgumentOutOfRangeException(nameof(count), "The 'count' parameter is greater than the length of the 'chars' array.");
+ }
// If no input, return 0, avoid fixed empty array problem
if (count == 0)
+ {
return 0;
+ }
// If no input just return 0, fixed doesn't like 0 length arrays
if (count == 0)
+ {
return 0;
+ }
//return chars.Length - index - count;
return count - index;
@@ -78,15 +70,13 @@ private int GetCodePageIdxFromChr(char ch)
for (idx = 0; idx < CodePageTable.Length; idx++)
{
- if (CodePageTable[idx] == ch)
+ if (CodePageTable[idx] == ch) {
break;
+ }
}
// All CodePageTable searched, nothing found!
- if (idx == CodePageTable.Length)
- return -1;
-
- return idx + 128;
+ return idx == CodePageTable.Length ? -1 : idx + 128;
}
///
@@ -100,85 +90,65 @@ private byte GetByte(char ch)
/* ch is in reality an ASCII character? */
if (ch < 127)
{
- mDebugger.SendInternal($"ch {ch} is ASCII");
return (byte)ch;
}
int idx = GetCodePageIdxFromChr(ch);
if (idx == -1)
{
- mDebugger.SendInternal($"ch {ch} not in CodePageTable replaced with {(char)ReplacementChar}");
return ReplacementChar;
}
- mDebugger.SendInternal($"ch {ch} is CodePageTable {idx}");
return (byte)idx;
}
- ///
- /// Get bytes array out of chars array, and bytes count.
- ///
- /// Chars array.
- /// Stating index in chars array.
- /// Number of chars to convert.
- /// Output bytes array.
- /// Starting index in bytes array.
- /// int value.
- /// Thrown if chars or bytes is null.
- /// Thrown if charIndex or charCount are invalid.
- /// Thrown if bytes array length or codepage table length is greater than Int32.MaxValue.
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
{
mDebugger.SendInternal($"GetBytes of chars {new string(chars)} index {charIndex} count {charCount}");
// Validate input parameters
if (chars == null)
- throw new ArgumentNullException("chars", "Null Array");
+ {
+ throw new ArgumentNullException(nameof(chars));
+ }
if (charIndex < 0 || charCount < 0)
- throw new ArgumentOutOfRangeException(charIndex < 0 ? "charIndex" : "charCount", "negative number");
+ {
+ throw new ArgumentOutOfRangeException(charIndex < 0 ? nameof(charIndex) : nameof(charCount), "A negative number was given.");
+ }
if (chars.Length - charIndex < charCount)
- throw new ArgumentOutOfRangeException("chars", "count more that what is in array");
-
- mDebugger.SendInternal($"Converting to CodePageTable: {new string(chars)}");
+ {
+ throw new ArgumentOutOfRangeException(nameof(chars), "'count' is greater than the length of the array.");
+ }
for (int i = charIndex; i < charCount; i++)
{
bytes[byteIndex + i] = GetByte(chars[i]);
}
- mDebugger.SendInternal($"So as bytes we have {BitConverter.ToString(bytes)}");
return bytes.Length;
}
- ///
- /// Get char count in bytes array.
- ///
- /// Bytes array to count the chars in.
- /// Starting index.
- /// Number of bytes to check.
- /// int value.
- /// Thrown if bytes is null.
- /// Thrown if index or count are invalid.
- /// Thrown if bytes array length is greater than Int32.MaxValue.
public override int GetCharCount(byte[] bytes, int index, int count)
{
- mDebugger.SendInternal($"GetCharCount of bytes {BitConverter.ToString(bytes)} index {index} count {count}");
// Validate Parameters
if (bytes == null)
- throw new ArgumentNullException("bytes", "Null Array");
+ {
+ throw new ArgumentNullException(nameof(bytes));
+ }
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException(index < 0 ? "index" : "count", "negative number");
+ {
+ throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), "The given number was negative.");
+ }
if (bytes.Length - index < count)
- throw new ArgumentOutOfRangeException("bytes", "count more that what is in array");
+ {
+ throw new ArgumentOutOfRangeException(nameof(bytes), "count more that what is in array");
+ }
// If no input just return 0, fixed doesn't like 0 length arrays
- if (count == 0)
- return 0;
-
- return count - index;
+ return count == 0 ? 0 : count - index;
}
///
@@ -188,78 +158,58 @@ public override int GetCharCount(byte[] bytes, int index, int count)
/// char value.
private char GetChar(byte b)
{
- mDebugger.SendInternal($"Converting to UTF16: {b}...");
/* Ascii? Simply cast it then... */
if (b < 127)
{
- mDebugger.SendInternal($"b {b} is ASCII");
return (char)b;
}
- mDebugger.SendInternal($"b in Extended ASCII");
return CodePageTable[b - 128];
}
- ///
- /// Convert bytes array to chars array, and get number of chars in bytes array.
- ///
- /// Bytes array to count chars in.
- /// Starting index in bytes array.
- /// Number of bytes to convert.
- /// Output array, in which the bytes that are char would be stored in.
- /// Starting index in chars array
- /// int value.
- /// Thrown if bytes is null.
- /// Thrown if byteCount or byteIndex are invalid
- /// Thrown if number of chars is greater than Int32.MaxValue.
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
{
- mDebugger.SendInternal($"Converting to UTF16: {BitConverter.ToString(bytes)}...");
// Validate Parameters
if (bytes == null)
- throw new ArgumentNullException("bytes", "Null Array");
+ {
+ throw new ArgumentNullException(nameof(bytes));
+ }
if (byteIndex < 0 || byteCount < 0)
- throw new ArgumentOutOfRangeException(byteIndex < 0 ? "byteIndex" : "byteCount", "negative number");
+ {
+ throw new ArgumentOutOfRangeException(byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount), "The given number was negative.");
+ }
if (bytes.Length - byteIndex < byteCount)
- throw new ArgumentOutOfRangeException("bytes", "count more that what is in array");
+ {
+ throw new ArgumentOutOfRangeException(nameof(bytes), "'count' is greater than the length of the array.");
+ }
// If no input just return 0, fixed doesn't like 0 length arrays
if (byteCount == 0)
+ {
return 0;
+ }
for (int i = byteIndex; i < byteCount; i++)
{
chars[charIndex + i] = GetChar(bytes[i]);
}
- mDebugger.SendInternal($"So as chars we have {new string(chars)}");
-
return chars.Length;
}
- ///
- /// Get max char count.
- ///
- /// char count.
- /// int value.
- /// Thrown if charCount is less than 0.
public override int GetMaxByteCount(int charCount)
{
if (charCount < 0)
- throw new ArgumentOutOfRangeException(nameof(charCount), "negative number");
+ {
+ throw new ArgumentOutOfRangeException(nameof(charCount), "The given number was negative.");
+ }
// Characters would be # of characters + 1 in case high surrogate is ? * max fallback
return charCount + 1;
}
- ///
- /// Get max char count.
- ///
- /// returns byteCount.
- /// byte count
- /// int value.
public override int GetMaxCharCount(int byteCount)
{
// Just return length, SBCS stay the same length because they don't map to surrogate
diff --git a/source/Cosmos.System2/VMTools.cs b/source/Cosmos.System2/VMTools.cs
index 9f2fb72b45..694cd5bcad 100644
--- a/source/Cosmos.System2/VMTools.cs
+++ b/source/Cosmos.System2/VMTools.cs
@@ -3,24 +3,36 @@
namespace Cosmos.System
{
///
- /// A class used to detect if cosmos is being ran in a virtual machine.
- /// Usefull for VM specific tasks.
+ /// Used to get the virtualization state of the CPU.
///
public static class VMTools
{
+ #region Properties
+
///
- /// A boolean describing whether or not virtualbox has been detected.
- ///
+ /// Whether or not the VirtualBox virtualizer has been detected.
+ ///
public static bool IsVirtualBox => GetIsVirtualBox();
+
///
- /// A boolean describing whether or not VMware has been detected.
+ /// Whether or not the VMware virtualizer has been detected.
///
public static bool IsVMWare => GetIsVMWare();
+
///
- /// A boolean describing whether or not QEMU has been detected.
+ /// Whether or not the QEMU virtualizer has been detected.
///
public static bool IsQEMU => GetIsQEMU();
+ #endregion
+
+ #region Methods
+
+ // NOTE: @ascpixi: A better way to scan for virtualizers would be
+ // to read the CPUID leaf 0x40000000. This leaf is dedicated
+ // for hypervisors to provide information about the virtualization
+ // state of the CPU.
+
private static bool GetIsVirtualBox()
{
for (int I = 0; I < PCI.Count; I++)
@@ -54,5 +66,7 @@ private static bool GetIsQEMU()
}
return false;
}
+
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/Interop/Kernel32Impl.cs b/source/Cosmos.System2_Plugs/Interop/Kernel32Impl.cs
index e4687a7970..480897b46d 100644
--- a/source/Cosmos.System2_Plugs/Interop/Kernel32Impl.cs
+++ b/source/Cosmos.System2_Plugs/Interop/Kernel32Impl.cs
@@ -1,6 +1,4 @@
using IL2CPU.API.Attribs;
-using System;
-using System.IO;
namespace Cosmos.System_Plugs.Interop
{
@@ -31,4 +29,4 @@ public static unsafe int FormatMessage(int aInt, IntPtr aIntPtr, uint aUint, int
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/Interop/User32Impl.cs b/source/Cosmos.System2_Plugs/Interop/User32Impl.cs
index 83082002aa..75d797aea8 100644
--- a/source/Cosmos.System2_Plugs/Interop/User32Impl.cs
+++ b/source/Cosmos.System2_Plugs/Interop/User32Impl.cs
@@ -1,5 +1,4 @@
using IL2CPU.API.Attribs;
-using System;
using System.Drawing;
namespace Cosmos.System_Plugs.Interop
@@ -58,4 +57,4 @@ public static uint GetSysColor(int aIndex)
return colorTable[aIndex];
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/ByteImpl.cs b/source/Cosmos.System2_Plugs/System/ByteImpl.cs
index b232d4d382..5540ca2472 100644
--- a/source/Cosmos.System2_Plugs/System/ByteImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/ByteImpl.cs
@@ -1,8 +1,5 @@
-using System;
-
-using Cosmos.Common;
-
using IL2CPU.API.Attribs;
+using Cosmos.Common;
namespace Cosmos.System_Plugs.System
{
@@ -13,4 +10,4 @@ public static class ByteImpl
public static string ToString(ref byte aThis, string format, IFormatProvider provider) => aThis.ToString();
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Collections/Generic/RandomizedStringEqualityComparerImpl.cs b/source/Cosmos.System2_Plugs/System/Collections/Generic/RandomizedStringEqualityComparerImpl.cs
index bb013153da..979cb6b342 100644
--- a/source/Cosmos.System2_Plugs/System/Collections/Generic/RandomizedStringEqualityComparerImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Collections/Generic/RandomizedStringEqualityComparerImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Collections.Generic
{
@@ -15,4 +10,4 @@ public static void ctor(object aThis, IEqualityComparer aComparer)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs b/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs
index 8686aeb2c9..9cffd83bd0 100644
--- a/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/ConsoleImpl.cs
@@ -1,422 +1,323 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Cosmos.System;
using IL2CPU.API.Attribs;
+using Cosmos.HAL.Drivers.Video;
+using Cosmos.System.Graphics;
+using Cosmos.System;
+using System.Text;
namespace Cosmos.System_Plugs.System
{
[Plug(Target = typeof (global::System.Console))]
public static class ConsoleImpl
{
- private static ConsoleColor mForeground = ConsoleColor.White;
- private static ConsoleColor mBackground = ConsoleColor.Black;
- private static Encoding ConsoleInputEncoding = Encoding.ASCII;
- private static Encoding ConsoleOutputEncoding = Encoding.ASCII;
+ #region Properties
- private static Cosmos.System.Console mFallbackConsole = new Cosmos.System.Console(null);
+ public static bool TreatControlCAsInput => throw new NotImplementedException("Not implemented: TreatControlCAsInput");
- private static Cosmos.System.Console GetConsole()
- {
- return mFallbackConsole;
- }
+ public static int LargestWindowHeight => throw new NotImplementedException("Not implemented: LargestWindowHeight");
- public static ConsoleColor get_BackgroundColor()
- {
- return mBackground;
- }
+ public static int LargestWindowWidth => throw new NotImplementedException("Not implemented: LargestWindowWidth");
- public static void set_BackgroundColor(ConsoleColor value)
- {
- mBackground = value;
- //Cosmos.HAL.Global.TextScreen.SetColors(mForeground, mBackground);
- if (GetConsole() != null)
- {
- GetConsole().Background = value;
- }
- }
+ public static string Title => throw new NotImplementedException("Not implemented: Title");
- public static int get_BufferHeight()
- {
- throw new NotImplementedException("Not implemented: get_BufferHeight");
- }
-
- public static void set_BufferHeight(int aHeight)
- {
- throw new NotImplementedException("Not implemented: set_BufferHeight");
- }
+ public static int BufferHeight => throw new NotImplementedException("Not implemented: BufferHeight");
- public static int get_BufferWidth()
- {
- throw new NotImplementedException("Not implemented: get_BufferWidth");
- }
+ public static int BufferWidth => throw new NotImplementedException("Not implemented: BufferWidth");
- public static void set_BufferWidth(int aWidth)
- {
- throw new NotImplementedException("Not implemented: set_BufferWidth");
- }
+ public static int WindowLeft => throw new NotImplementedException("Not implemented: WindowLeft");
- public static bool get_CapsLock()
- {
- return Global.CapsLock;
- }
+ public static int WindowTop => throw new NotImplementedException("Not implemented: WindowTop");
- public static int get_CursorLeft()
+ public static Encoding OutputEncoding
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get => consoleOutputEncoding;
+ set
{
- // for now:
- return 0;
+ consoleOutputEncoding = value;
}
- return GetConsole().X;
}
-
- public static void set_CursorLeft(int x)
+
+ public static Encoding InputEncoding
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get => consoleInputEncoding;
+ set
{
- // for now:
- return;
+ consoleInputEncoding = value;
}
+ }
- if (x < 0)
- {
- throw new ArgumentException("The value x must be at least 0!");
- }
+ public static bool KeyAvailable => KeyboardManager.KeyAvailable;
- if (x < get_WindowWidth())
- {
- xConsole.X = x;
- }
- else
- {
- throw new ArgumentException("The value x must be lower than the console width!");
- }
- }
+ public static bool NumberLock => Global.NumLock;
- public static int get_CursorSize()
- {
- var xConsole = GetConsole();
- if (xConsole == null)
- {
- // for now:
- return 0;
- }
- return xConsole.CursorSize;
- }
+ public static bool CapsLock => Global.CapsLock;
- public static void set_CursorSize(int aSize)
+ public static ConsoleColor ForegroundColor
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get => foreGround;
+ set
{
- // for now:
- return;
+ foreGround = value;
+
+ if (GetConsole() != null)
+ {
+ GetConsole().Foreground = value;
+ }
}
- xConsole.CursorSize = aSize;
}
- public static int get_CursorTop()
+ public static ConsoleColor BackgroundColor
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get => backGround;
+ set
{
- // for now:
- return 0;
+ backGround = value;
+
+ if (GetConsole() != null)
+ {
+ GetConsole().Background = value;
+ }
}
- return GetConsole().Y;
}
- public static void set_CursorTop(int y)
+ public static bool CursorVisible
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get
{
- // for now:
- return;
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ return false;
+ }
+ return GetConsole().CursorVisible;
}
-
- if (y < 0)
+ set
{
- throw new ArgumentException("The value y must be at least 0!");
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return;
+ }
+ xConsole.CursorVisible = value;
}
+ }
- if (y < get_WindowHeight())
+ public static int CursorSize
+ {
+ get
{
- xConsole.Y = y;
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return 0;
+ }
+ return xConsole.CursorSize;
}
- else
+ set
{
- throw new ArgumentException("The value y must be lower than the console height!");
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return;
+ }
+ xConsole.CursorSize = value;
}
}
- public static bool get_CursorVisible()
+ public static int CursorLeft
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get
{
- return false;
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return 0;
+ }
+ return GetConsole().X;
}
- return GetConsole().CursorVisible;
- }
-
- public static void set_CursorVisible(bool value)
- {
- var xConsole = GetConsole();
- if (xConsole == null)
+ set
{
- // for now:
- return;
- }
- xConsole.CursorVisible = value;
- }
-
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return;
+ }
- //public static TextWriter get_Error() {
- // WriteLine("Not implemented: get_Error");
- // return null;
- //}
+ if (value < 0)
+ {
+ throw new ArgumentException("The value must be at least 0!", nameof(value));
+ }
- public static ConsoleColor get_ForegroundColor()
- {
- return mForeground;
+ if (value < WindowWidth)
+ {
+ xConsole.X = value;
+ }
+ else
+ {
+ throw new ArgumentException("The value must be lower than the console width!", nameof(value));
+ }
+ }
}
- public static void set_ForegroundColor(ConsoleColor value)
+ public static int CursorTop
{
- mForeground = value;
- //Cosmos.HAL.Global.TextScreen.SetColors(mForeground, mBackground);
- if (GetConsole() != null)
+ get
{
- GetConsole().Foreground = value;
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return 0;
+ }
+ return GetConsole().Y;
}
- }
-
- //public static TextReader get_In()
- //{
- // WriteLine("Not implemented: get_In");
- // return null;
- //}
-
- public static Encoding get_InputEncoding()
- {
- return ConsoleInputEncoding;
- }
-
- public static void set_InputEncoding(Encoding value)
- {
- ConsoleInputEncoding = value;
- }
-
- public static Encoding get_OutputEncoding()
- {
- return ConsoleOutputEncoding;
- }
-
-
- public static void set_OutputEncoding(Encoding value)
- {
- ConsoleOutputEncoding = value;
- }
-
- public static bool get_KeyAvailable()
- {
- return KeyboardManager.KeyAvailable;
- }
-
- public static int get_LargestWindowHeight()
- {
- throw new NotImplementedException("Not implemented: get_LargestWindowHeight");
- }
-
- public static int get_LargestWindowWidth()
- {
- throw new NotImplementedException("Not implemented: get_LargestWindowWidth");
- }
-
- public static bool get_NumberLock()
- {
- return Global.NumLock;
- }
-
- //public static TextWriter get_Out() {
- // WriteLine("Not implemented: get_Out");
- // return null;
- //}
-
- public static string get_Title()
- {
- throw new NotImplementedException("Not implemented: get_Title");
- }
+ set
+ {
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return;
+ }
- public static void set_Title(string value)
- {
- throw new NotImplementedException("Not implemented: set_Title");
- }
+ if (value < 0)
+ {
+ throw new ArgumentException("The value must be at least 0!", nameof(value));
+ }
- public static bool get_TreatControlCAsInput()
- {
- throw new NotImplementedException("Not implemented: get_TreatControlCAsInput");
+ if (value < WindowHeight)
+ {
+ xConsole.Y = value;
+ }
+ else
+ {
+ throw new ArgumentException("The value must be lower than the console height!", nameof(value));
+ }
+ }
}
- public static void set_TreatControlCAsInput(bool value)
+ public static int WindowHeight
{
- throw new NotImplementedException("Not implemented: set_TreatControlCAsInput");
+ get
+ {
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return 25;
+ }
+ return GetConsole().Rows;
+ }
+ set => throw new NotImplementedException("Not implemented: set_WindowHeight");
}
- public static int get_WindowHeight()
+ public static int WindowWidth
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ get
{
- // for now:
- return 25;
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return 85;
+ }
+ return GetConsole().Cols;
}
- return GetConsole().Rows;
+ set => throw new NotImplementedException("Not implemented: set_WindowWidth");
}
- public static void set_WindowHeight(int value)
- {
- throw new NotImplementedException("Not implemented: set_WindowHeight");
- }
+ #endregion
- public static int get_WindowLeft()
- {
- throw new NotImplementedException("Not implemented: get_WindowLeft");
- }
+ #region Methods
- public static void set_WindowLeft(int value)
+ public static void SetBufferSize(int width, int height)
{
- throw new NotImplementedException("Not implemented: set_WindowLeft");
+ throw new NotImplementedException("Not implemented: SetBufferSize");
}
- public static int get_WindowTop()
+ public static void SetCursorPosition(int left, int top)
{
- throw new NotImplementedException("Not implemented: get_WindowTop");
+ CursorLeft = left;
+ CursorTop = top;
}
- public static void set_WindowTop(int value)
+ public static void SetWindowPosition(int left, int top)
{
- throw new NotImplementedException("Not implemented: set_WindowTop");
+ throw new NotImplementedException("Not implemented: SetWindowPosition");
}
- public static int get_WindowWidth()
+ public static void SetWindowSize(int width, int height)
{
- var xConsole = GetConsole();
- if (xConsole == null)
+ if (width == 40 && height == 25)
{
- // for now:
- return 85;
+ fallBackConsole.mText.Cols = 40;
+ fallBackConsole.mText.Rows = 25;
+ VGAScreen.SetTextMode(VGADriver.TextSize.Size40x25);
}
- return GetConsole().Cols;
- }
-
- public static void set_WindowWidth(int value)
- {
- throw new NotImplementedException("Not implemented: set_WindowWidth");
- }
-
- ///
- /// The ArgumentOutOfRangeException check is now done at driver level in PCSpeaker - is it still needed here?
- ///
- ///
- ///
- public static void Beep(int aFrequency, int aDuration)
- {
- if (aFrequency < 37 || aFrequency > 32767)
+ else if (width == 40 && height == 50)
{
- throw new ArgumentOutOfRangeException("Frequency must be between 37 and 32767Hz");
+ fallBackConsole.mText.Cols = 40;
+ fallBackConsole.mText.Rows = 50;
+ VGAScreen.SetTextMode(VGADriver.TextSize.Size40x50);
}
-
- if (aDuration <= 0)
+ else if (width == 80 && height == 25)
+ {
+ fallBackConsole.mText.Cols = 80;
+ fallBackConsole.mText.Rows = 25;
+ VGAScreen.SetTextMode(VGADriver.TextSize.Size80x25);
+ }
+ else if (width == 80 && height == 50)
+ {
+ fallBackConsole.mText.Cols = 80;
+ fallBackConsole.mText.Rows = 50;
+ VGAScreen.SetTextMode(VGADriver.TextSize.Size80x50);
+ }
+ else if (width == 90 && height == 30)
{
- throw new ArgumentOutOfRangeException("Duration must be more than 0");
+ fallBackConsole.mText.Cols = 90;
+ fallBackConsole.mText.Rows = 30;
+ VGAScreen.SetTextMode(VGADriver.TextSize.Size90x30);
+ }
+ else if (width == 90 && height == 60)
+ {
+ fallBackConsole.mText.Cols = 90;
+ fallBackConsole.mText.Rows = 60;
+ VGAScreen.SetTextMode(VGADriver.TextSize.Size90x60);
+ }
+ else
+ {
+ throw new Exception("Invalid text size.");
}
- PCSpeaker.Beep((uint) aFrequency, (uint) aDuration);
- }
+ fallBackConsole.Cols = fallBackConsole.mText.Cols;
+ fallBackConsole.Rows = fallBackConsole.mText.Rows;
- ///
- /// Beep() is pure CIL
- /// Default implementation beeps for 200 milliseconds at 800 hertz
- /// In Cosmos, these are Cosmos.System.Duration.Default and Cosmos.System.Notes.Default respectively,
- /// and are used when there are no params
- /// https://docs.microsoft.com/en-us/dotnet/api/system.console.beep?view=netcore-2.0
- ///
- public static void Beep()
- {
- PCSpeaker.Beep();
+ ((HAL.TextScreen)fallBackConsole.mText).UpdateWindowSize();
+
+ Clear();
}
- //TODO: Console uses TextWriter - intercept and plug it instead
- public static void Clear()
+ public static (int Left, int Top) GetCursorPosition()
{
- var xConsole = GetConsole();
- if (xConsole == null)
- {
- // for now:
- return;
- }
- GetConsole().Clear();
+ return (CursorLeft, CursorTop);
}
// MoveBufferArea(int, int, int, int, int, int) is pure CIL
-
- public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight,
- int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
+ public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
{
throw new NotImplementedException("Not implemented: MoveBufferArea");
}
- //public static Stream OpenStandardError() {
- // WriteLine("Not implemented: OpenStandardError");
- //}
-
- //public static Stream OpenStandardError(int bufferSize) {
- // WriteLine("Not implemented: OpenStandardError");
- //}
-
- //public static Stream OpenStandardInput(int bufferSize) {
- // WriteLine("Not implemented: OpenStandardInput");
- //}
-
- //public static Stream OpenStandardInput() {
- // WriteLine("Not implemented: OpenStandardInput");
- //}
-
- //public static Stream OpenStandardOutput(int bufferSize) {
- // WriteLine("Not implemented: OpenStandardOutput");
- //}
-
- //public static Stream OpenStandardOutput() {
- // WriteLine("Not implemented: OpenStandardOutput");
- //}
-
- public static int Read()
- {
- // TODO special cases, if needed, that returns -1
- KeyEvent xResult;
-
- if (KeyboardManager.TryReadKey(out xResult))
- {
- return xResult.KeyChar;
- }
- else
- {
- return -1;
- }
- }
-
- public static ConsoleKeyInfo ReadKey()
+ private static Cosmos.System.Console GetConsole()
{
- return ReadKey(false);
+ return fallBackConsole;
}
// ReadKey() pure CIL
-
public static ConsoleKeyInfo ReadKey(bool intercept)
{
var key = KeyboardManager.ReadKey();
@@ -438,6 +339,11 @@ public static ConsoleKeyInfo ReadKey(bool intercept)
return new ConsoleKeyInfo(key.KeyChar, key.Key.ToConsoleKey(), xShift, xAlt, xControl);
}
+ public static ConsoleKeyInfo ReadKey()
+ {
+ return ReadKey(false);
+ }
+
public static string ReadLine()
{
var xConsole = GetConsole();
@@ -446,7 +352,7 @@ public static string ReadLine()
// for now:
return null;
}
- var chars = new List(32);
+ List chars = new(32);
KeyEvent current;
int currentCount = 0;
@@ -515,7 +421,7 @@ public static string ReadLine()
//Insert the new character in the correct location
//For some reason, List.Insert() doesn't work properly
//so the character has to be inserted manually
- var temp = new List();
+ List temp = new();
for (int x = 0; x < chars.Count; x++)
{
@@ -547,96 +453,97 @@ public static string ReadLine()
public static void ResetColor()
{
- set_BackgroundColor(ConsoleColor.Black);
- set_ForegroundColor(ConsoleColor.White);
+ BackgroundColor = ConsoleColor.Black;
+ ForegroundColor = ConsoleColor.White;
}
- public static void SetBufferSize(int width, int height)
+ public static int Read()
{
- throw new NotImplementedException("Not implemented: SetBufferSize");
+ if (KeyboardManager.TryReadKey(out KeyEvent result))
+ {
+ return result.KeyChar;
+ }
+ else
+ {
+ return -1;
+ }
}
- public static void SetCursorPosition(int left, int top)
+ public static void Beep(int frequency, int duration)
{
- set_CursorLeft(left);
- set_CursorTop(top);
+ PCSpeaker.Beep((uint)frequency, (uint)duration);
}
- public static (int Left, int Top) GetCursorPosition()
+ ///
+ /// Beep() is pure CIL
+ /// Default implementation beeps for 200 milliseconds at 800 hertz
+ /// In Cosmos, these are Cosmos.System.Duration.Default and Cosmos.System.Notes.Default respectively,
+ /// and are used when there are no params
+ /// https://docs.microsoft.com/en-us/dotnet/api/system.console.beep?view=netcore-2.0
+ ///
+ public static void Beep()
{
- int Left = get_CursorLeft();
- int Top = get_CursorTop();
+ PCSpeaker.Beep();
+ }
- return (Left, Top);
+ //TODO: Console uses TextWriter - intercept and plug it instead
+ public static void Clear()
+ {
+ var xConsole = GetConsole();
+ if (xConsole == null)
+ {
+ // for now:
+ return;
+ }
+ GetConsole().Clear();
}
- //public static void SetError(TextWriter newError) {
- // WriteLine("Not implemented: SetError");
- //}
+ #region WriteLine
- //public static void SetIn(TextReader newIn) {
- // WriteLine("Not implemented: SetIn");
- //}
+ public static void WriteLine() => Write(Environment.NewLine);
- //public static void SetOut(TextWriter newOut) {
- // WriteLine("Not implemented: SetOut");
- //}
+ public static void WriteLine(bool aBool) => WriteLine(aBool.ToString());
- public static void SetWindowPosition(int left, int top)
- {
- throw new NotImplementedException("Not implemented: SetWindowPosition");
- }
+ public static void WriteLine(char aChar) => WriteLine(aChar.ToString());
- public static void SetWindowSize(int width, int height)
- {
- if (width == 40 && height == 25)
- {
- mFallbackConsole.mText.Cols = 40;
- mFallbackConsole.mText.Rows = 25;
- Cosmos.System.Graphics.VGAScreen.SetTextMode(Cosmos.HAL.VGADriver.TextSize.Size40x25);
- }
- else if (width == 40 && height == 50)
- {
- mFallbackConsole.mText.Cols = 40;
- mFallbackConsole.mText.Rows = 50;
- Cosmos.System.Graphics.VGAScreen.SetTextMode(Cosmos.HAL.VGADriver.TextSize.Size40x50);
- }
- else if (width == 80 && height == 25)
- {
- mFallbackConsole.mText.Cols = 80;
- mFallbackConsole.mText.Rows = 25;
- Cosmos.System.Graphics.VGAScreen.SetTextMode(Cosmos.HAL.VGADriver.TextSize.Size80x25);
- }
- else if (width == 80 && height == 50)
- {
- mFallbackConsole.mText.Cols = 80;
- mFallbackConsole.mText.Rows = 50;
- Cosmos.System.Graphics.VGAScreen.SetTextMode(Cosmos.HAL.VGADriver.TextSize.Size80x50);
- }
- else if (width == 90 && height == 30)
- {
- mFallbackConsole.mText.Cols = 90;
- mFallbackConsole.mText.Rows = 30;
- Cosmos.System.Graphics.VGAScreen.SetTextMode(Cosmos.HAL.VGADriver.TextSize.Size90x30);
- }
- else if (width == 90 && height == 60)
- {
- mFallbackConsole.mText.Cols = 90;
- mFallbackConsole.mText.Rows = 60;
- Cosmos.System.Graphics.VGAScreen.SetTextMode(Cosmos.HAL.VGADriver.TextSize.Size90x60);
- }
- else
- {
- throw new Exception("Invalid text size.");
- }
- mFallbackConsole.Cols = mFallbackConsole.mText.Cols;
- mFallbackConsole.Rows = mFallbackConsole.mText.Rows;
+ public static void WriteLine(char[] aBuffer) => WriteLine(new string(aBuffer));
+
+ /* Decimal type is not working yet... */
+ //public static void WriteLine(decimal aDecimal) => WriteLine(aDecimal.ToString());
- ((Cosmos.HAL.TextScreen)mFallbackConsole.mText).UpdateWindowSize();
+ public static void WriteLine(double aDouble) => WriteLine(aDouble.ToString());
- Clear();
+ public static void WriteLine(float aFloat) => WriteLine(aFloat.ToString());
+
+ public static void WriteLine(int aInt) => WriteLine(aInt.ToString());
+
+ public static void WriteLine(long aLong) => WriteLine(aLong.ToString());
+
+ /* Correct behaviour printing null should not throw NRE or do nothing but should print an empty line */
+ public static void WriteLine(object value) => Write((value ?? string.Empty).ToString() + Environment.NewLine);
+
+ public static void WriteLine(string aText) => Write(aText + Environment.NewLine);
+
+ public static void WriteLine(uint aInt) => WriteLine(aInt.ToString());
+
+ public static void WriteLine(ulong aLong) => WriteLine(aLong.ToString());
+
+ public static void WriteLine(string format, object arg0) => WriteLine(string.Format(format, arg0));
+
+ public static void WriteLine(string format, object arg0, object arg1) => WriteLine(string.Format(format, arg0, arg1));
+
+ public static void WriteLine(string format, object arg0, object arg1, object arg2) => WriteLine(string.Format(format, arg0, arg1, arg2));
+
+ public static void WriteLine(string format, params object[] arg) => WriteLine(string.Format(format, arg));
+
+ public static void WriteLine(char[] aBuffer, int aIndex, int aCount)
+ {
+ Write(aBuffer, aIndex, aCount);
+ WriteLine();
}
+ #endregion
+
#region Write
public static void Write(bool aBool)
@@ -665,7 +572,7 @@ public static void Write(bool aBool)
public static void Write(long aLong) => Write(aLong.ToString());
/* Correct behaviour printing null should not throw NRE or do nothing but should print an empty string */
- public static void Write(object value) => Write(value ?? String.Empty);
+ public static void Write(object value) => Write((value ?? string.Empty).ToString());
public static void Write(string aText)
{
@@ -676,7 +583,7 @@ public static void Write(string aText)
return;
}
- byte[] aTextEncoded = ConsoleOutputEncoding.GetBytes(aText);
+ byte[] aTextEncoded = consoleOutputEncoding.GetBytes(aText);
GetConsole().Write(aTextEncoded);
}
@@ -684,35 +591,35 @@ public static void Write(string aText)
public static void Write(ulong aLong) => Write(aLong.ToString());
- public static void Write(string format, object arg0) => Write(String.Format(format, arg0));
+ public static void Write(string format, object arg0) => Write(string.Format(format, arg0));
- public static void Write(string format, object arg0, object arg1) => Write(String.Format(format, arg0, arg1));
+ public static void Write(string format, object arg0, object arg1) => Write(string.Format(format, arg0, arg1));
- public static void Write(string format, object arg0, object arg1, object arg2) => Write(String.Format(format, arg0, arg1, arg2));
+ public static void Write(string format, object arg0, object arg1, object arg2) => Write(string.Format(format, arg0, arg1, arg2));
- public static void Write(string format, params object[] arg) => Write(String.Format(format, arg));
+ public static void Write(string format, params object[] arg) => Write(string.Format(format, arg));
- public static void Write(char[] aBuffer, int aIndex, int aCount)
+ public static void Write(char[] buffer, int index, int count)
{
- if (aBuffer == null)
+ if (buffer == null)
{
- throw new ArgumentNullException("aBuffer");
+ throw new ArgumentNullException(nameof(buffer));
}
- if (aIndex < 0)
+ if (index < 0)
{
- throw new ArgumentOutOfRangeException("aIndex");
+ throw new ArgumentOutOfRangeException(nameof(index));
}
- if (aCount < 0)
+ if (count < 0)
{
- throw new ArgumentOutOfRangeException("aCount");
+ throw new ArgumentOutOfRangeException(nameof(count));
}
- if (aBuffer.Length - aIndex < aCount)
+ if (buffer.Length - index < count)
{
throw new ArgumentException();
}
- for (int i = 0; i < aCount; i++)
+ for (int i = 0; i < count; i++)
{
- Write(aBuffer[aIndex + i]);
+ Write(buffer[index + i]);
}
}
@@ -721,53 +628,18 @@ public static void Write(char[] aBuffer, int aIndex, int aCount)
// Write(aByte.ToString());
//}
-#endregion
-
- #region WriteLine
-
- public static void WriteLine() => Write(Environment.NewLine);
-
- public static void WriteLine(bool aBool) => WriteLine(aBool.ToString());
-
- public static void WriteLine(char aChar) => WriteLine(aChar.ToString());
-
- public static void WriteLine(char[] aBuffer) => WriteLine(new string(aBuffer));
-
- /* Decimal type is not working yet... */
- //public static void WriteLine(decimal aDecimal) => WriteLine(aDecimal.ToString());
-
- public static void WriteLine(double aDouble) => WriteLine(aDouble.ToString());
-
- public static void WriteLine(float aFloat) => WriteLine(aFloat.ToString());
-
- public static void WriteLine(int aInt) => WriteLine(aInt.ToString());
-
- public static void WriteLine(long aLong) => WriteLine(aLong.ToString());
-
- /* Correct behaviour printing null should not throw NRE or do nothing but should print an empty line */
- public static void WriteLine(object value) => Write((value ?? String.Empty) + Environment.NewLine);
-
- public static void WriteLine(string aText) => Write(aText + Environment.NewLine);
-
- public static void WriteLine(uint aInt) => WriteLine(aInt.ToString());
-
- public static void WriteLine(ulong aLong) => WriteLine(aLong.ToString());
-
- public static void WriteLine(string format, object arg0) => WriteLine(String.Format(format, arg0));
-
- public static void WriteLine(string format, object arg0, object arg1) => WriteLine(String.Format(format, arg0, arg1));
+ #endregion
- public static void WriteLine(string format, object arg0, object arg1, object arg2) => WriteLine(String.Format(format, arg0, arg1, arg2));
+ #endregion
- public static void WriteLine(string format, params object[] arg) => WriteLine(String.Format(format, arg));
-
- public static void WriteLine(char[] aBuffer, int aIndex, int aCount)
- {
- Write(aBuffer, aIndex, aCount);
- WriteLine();
- }
+ #region Fields
-#endregion
+ private static readonly Cosmos.System.Console fallBackConsole = new(null);
+ private static Encoding consoleOutputEncoding = Encoding.ASCII;
+ private static Encoding consoleInputEncoding = Encoding.ASCII;
+ private static ConsoleColor foreGround = ConsoleColor.White;
+ private static ConsoleColor backGround = ConsoleColor.Black;
+ #endregion
}
}
diff --git a/source/Cosmos.System2_Plugs/System/ConvertImpl.cs b/source/Cosmos.System2_Plugs/System/ConvertImpl.cs
index ce0031ca2c..c88495102b 100644
--- a/source/Cosmos.System2_Plugs/System/ConvertImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/ConvertImpl.cs
@@ -1,6 +1,4 @@
-using System;
-
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
@@ -74,4 +72,4 @@ public static string ToString(long value, int toBase)
return str;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/DateTimeImpl.cs b/source/Cosmos.System2_Plugs/System/DateTimeImpl.cs
index 8ae4f4d3c2..d585ac2962 100644
--- a/source/Cosmos.System2_Plugs/System/DateTimeImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/DateTimeImpl.cs
@@ -92,11 +92,11 @@ public static bool TryFormat(DateTime aThis, Span aCharSpan, ref int aInt,
public static IntPtr GetGetSystemTimeAsFileTimeFnPtr()
{
- return new IntPtr();
+ return new();
}
public static void ValidateLeapSecond(DateTime aThis)
{
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/DecimalImpl.cs b/source/Cosmos.System2_Plugs/System/DecimalImpl.cs
index 98d4002ced..afe5a4c208 100644
--- a/source/Cosmos.System2_Plugs/System/DecimalImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/DecimalImpl.cs
@@ -15,4 +15,4 @@ public static class DecimalImpl
public static string ToString(ref decimal aThis, string format, IFormatProvider provider) => aThis.ToString();
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Diagnostics/Tracing/EventPipeInternalImpl.cs b/source/Cosmos.System2_Plugs/System/Diagnostics/Tracing/EventPipeInternalImpl.cs
index fd394a8a15..65b511e0cd 100644
--- a/source/Cosmos.System2_Plugs/System/Diagnostics/Tracing/EventPipeInternalImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Diagnostics/Tracing/EventPipeInternalImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Diagnostics.Tracing
{
@@ -39,4 +34,4 @@ public static void DeleteProvider(IntPtr aIntrPtr)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/DoubleImpl.cs b/source/Cosmos.System2_Plugs/System/DoubleImpl.cs
index 00c94badea..35d15f59c8 100644
--- a/source/Cosmos.System2_Plugs/System/DoubleImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/DoubleImpl.cs
@@ -1,6 +1,4 @@
-using System;
using Cosmos.Common;
-using System.Collections.Generic;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -20,33 +18,45 @@ public static double Parse(string s)
//Format of Double string: [whitespace][sign][integral-digits[,]]integral-digits[.[fractional-digits]][E[sign]exponential-digits][whitespace]
//Validate input
- if (s is null) throw new ArgumentNullException("s can not be null");
+ if (s is null)
+ {
+ throw new ArgumentNullException(nameof(s), "Value can not be null");
+ }
//Remove leading whitespaces
while (s.Length != 0 && (s[0] == ' ' || s[0] == '\n' || s[0] == '\t'))
{
- s = s.Substring(1);
+ s = s[1..];
}
//Check that string is not finished too early
- if (s.Length == 0) throw new FormatException();
+ if (s.Length == 0)
+ {
+ throw new FormatException();
+ }
//Check for sign
short sign = 1;
if (s[0] == '-')
{
- s = s.Substring(1);
+ s = s[1..];
sign = -1;
}
- else if (s[0] == '+') s = s.Substring(1);
+ else if (s[0] == '+')
+ {
+ s = s[1..];
+ }
//Check that string is not finished too early
- if (s.Length == 0) throw new FormatException();
+ if (s.Length == 0)
+ {
+ throw new FormatException();
+ }
//Read in number
- List internalDigits = new List();
- List fractionalDigits = new List();
+ List internalDigits = new();
+ List fractionalDigits = new();
bool foundDecimal = false;
@@ -55,15 +65,30 @@ public static double Parse(string s)
while (s.Length != 0)
{
char active = s[0];
- if (active == 'E' || active == 'e' || active == ' ' || active == '\n' || active == '\t') break;
+ if (active == 'E' || active == 'e' || active == ' ' || active == '\n' || active == '\t')
+ {
+ break;
+ }
- s = s.Substring(1);
- if (active == '.') foundDecimal = true;
- else if (active == ',') continue;
+ s = s[1..];
+ if (active == '.')
+ {
+ foundDecimal = true;
+ }
+ else if (active == ',')
+ {
+ continue;
+ }
else if (active >= '0' && active <= '9')
{
- if (foundDecimal) fractionalDigits.Add(int.Parse(active.ToString()));
- else internalDigits.Add(int.Parse(active.ToString()));
+ if (foundDecimal)
+ {
+ fractionalDigits.Add(int.Parse(active.ToString()));
+ }
+ else
+ {
+ internalDigits.Add(int.Parse(active.ToString()));
+ }
}
else
{
@@ -79,11 +104,17 @@ public static double Parse(string s)
//E can only be followed by integers
if (s[0] == 'E' || s[0] == 'e')
{
- multiplier = double.Parse(s.Substring(1));
+ multiplier = double.Parse(s[1..]);
break;
}
- else if (s[0] == ' ' || s[0] == '\n' || s[0] == '\t') s = s.Substring(1);
- else throw new FormatException();
+ else if (s[0] == ' ' || s[0] == '\n' || s[0] == '\t')
+ {
+ s = s[1..];
+ }
+ else
+ {
+ throw new FormatException();
+ }
}
//Create double
@@ -117,4 +148,4 @@ public static bool TryParse(string s, out double result)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Drawing/ColorImpl.cs b/source/Cosmos.System2_Plugs/System/Drawing/ColorImpl.cs
index e932ca91fe..5617ab79fc 100644
--- a/source/Cosmos.System2_Plugs/System/Drawing/ColorImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Drawing/ColorImpl.cs
@@ -1,440 +1,158 @@
-//#define COSMOSDEBUG
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Text;
using IL2CPU.API.Attribs;
+using System.Drawing;
namespace Cosmos.System_Plugs.System.Drawing
{
- [Plug(Target = typeof(global::System.Drawing.Color))]
+ [Plug(Target = typeof(Color))]
class ColorImpl
{
/// Implements System.Drawing.Color.FromName
- /// See https://learn.microsoft.com/en-us/dotnet/api/system.drawing.color.fromname?view=net-6.0&viewFallbackFrom=netcore-3.1 for usage explanation
+ /// See also
///
public static Color FromName(string name)
{
- switch(name)
+ return name switch
{
- case "AliceBlue":
- return Color.AliceBlue;
-
- case "AntiqueWhite":
- return Color.AntiqueWhite;
-
- case "Aqua":
- return Color.Aqua;
-
- case "Aquamarine":
- return Color.Aquamarine;
-
- case "Azure":
- return Color.Azure;
-
- case "Beige":
- return Color.Beige;
-
- case "Bisque":
- return Color.Bisque;
-
- case "Black":
- return Color.Black;
-
- case "BlueViolet":
- return Color.BlueViolet;
-
- case "Brown":
- return Color.Brown;
-
- case "BurlyWood":
- return Color.BurlyWood;
-
- case "CadetBlue":
- return Color.CadetBlue;
-
- case "Chartreuse":
- return Color.Chartreuse;
-
- case "Chocolate":
- return Color.Chocolate;
-
- case "Coral":
- return Color.Coral;
-
- case "CornflowerBlue":
- return Color.CornflowerBlue;
-
- case "Cornsilk":
- return Color.Cornsilk;
-
- case "Crimson":
- return Color.Crimson;
-
- case "Cyan":
- return Color.Cyan;
-
- case "DarkBlue":
- return Color.DarkBlue;
-
- case "DarkCyan":
- return Color.DarkCyan;
-
- case "DarkGoldenrod":
- return Color.DarkGoldenrod;
-
- case "DarkGray":
- return Color.DarkGray;
-
- case "DarkGreen":
- return Color.DarkGreen;
-
- case "DarkKhaki":
- return Color.DarkKhaki;
-
- case "DarkMagenta":
- return Color.DarkMagenta;
-
- case "DarkOliveGreen":
- return Color.DarkOliveGreen;
-
- case "AliceOrange":
- return Color.DarkOrange;
-
- case "DarkOrchid":
- return Color.DarkOrchid;
-
- case "DarkRed":
- return Color.DarkRed;
-
- case "DarkSalmon":
- return Color.DarkSalmon;
-
- case "DarkSeaGreen":
- return Color.DarkSeaGreen;
-
- case "DarkSlateBlue":
- return Color.DarkSlateBlue;
-
- case "DarkSlateGray":
- return Color.DarkSlateGray;
-
- case "DarkTurquoise":
- return Color.DarkTurquoise;
-
- case "DarkViolet":
- return Color.DarkViolet;
-
- case "DeepPink":
- return Color.DeepPink;
-
- case "DeepSkyBlue":
- return Color.DeepSkyBlue;
-
- case "DimGray":
- return Color.DimGray;
-
- case "DodgerBlue":
- return Color.DodgerBlue;
-
- case "Firebrick":
- return Color.Firebrick;
-
- case "FloralWhite":
- return Color.FloralWhite;
-
- case "ForestGreen":
- return Color.ForestGreen;
-
- case "Fuchsia":
- return Color.Fuchsia;
-
- case "Gainsboro":
- return Color.Gainsboro;
-
- case "GhostWhite":
- return Color.GhostWhite;
-
- case "Gold":
- return Color.Gold;
-
- case "Goldenrod":
- return Color.Goldenrod;
-
- case "Gray":
- return Color.Gray;
-
- case "Green":
- return Color.Green;
-
- case "GreenYellow":
- return Color.GreenYellow;
-
- case "Honeydew":
- return Color.Honeydew;
-
- case "HotPink":
- return Color.HotPink;
-
- case "IndianRed":
- return Color.IndianRed;
-
- case "Indigo":
- return Color.Indigo;
-
- case "Ivory":
- return Color.Ivory;
-
- case "Khaki":
- return Color.Khaki;
-
- case "Lavender":
- return Color.Lavender;
-
- case "LavenderBlush":
- return Color.LavenderBlush;
-
- case "LawnGreen":
- return Color.LawnGreen;
-
- case "LemonChiffon":
- return Color.LemonChiffon;
-
- case "LightBlue":
- return Color.LightBlue;
-
- case "LightCoral":
- return Color.LightCoral;
-
- case "LightCyan":
- return Color.LightCyan;
-
- case "LightGoldenrodYellow":
- return Color.LightGoldenrodYellow;
-
- case "LightGreen":
- return Color.LightGreen;
-
- case "LightGray":
- return Color.LightGray;
-
- case "LightPink":
- return Color.LightPink;
-
- case "LightSalmon":
- return Color.LightSalmon;
-
- case "LightSeaGreen":
- return Color.LightSeaGreen;
-
- case "LightSkyBlue":
- return Color.LightSkyBlue;
-
- case "LightSlateGray":
- return Color.LightSlateGray;
-
- case "LightSteelBlue":
- return Color.LightSteelBlue;
-
- case "LightYellow":
- return Color.LightYellow;
-
- case "Lime":
- return Color.Lime;
-
- case "LimeGreen":
- return Color.LimeGreen;
-
- case "Linen":
- return Color.Linen;
-
- case "Magenta":
- return Color.Magenta;
-
- case "Maroon":
- return Color.Maroon;
-
- case "MediumAquamarine":
- return Color.MediumAquamarine ;
-
- case "MediumBlue":
- return Color.MediumBlue;
-
- case "MediumOrchid":
- return Color.MediumOrchid;
-
- case "MediumPurple":
- return Color.MediumPurple;
-
- case "MediumSeaGreen":
- return Color.MediumSeaGreen;
-
- case "MediumSlateBlue":
- return Color.MediumSlateBlue;
-
- case "MediumSpringGreen":
- return Color.MediumSpringGreen;
-
- case "MediumTurquoise":
- return Color.MediumTurquoise;
-
- case "MediumVioletRed":
- return Color.MediumVioletRed;
-
- case "MidnightBlue":
- return Color.MidnightBlue;
-
- case "MintCream":
- return Color.MintCream;
-
- case "MistyRose":
- return Color.MistyRose;
-
- case "Moccasin":
- return Color.Moccasin;
-
- case "NavajoWhite":
- return Color.NavajoWhite;
-
- case "Navy":
- return Color.Navy;
-
- case "OldLace":
- return Color.OldLace;
-
- case "Olive":
- return Color.Olive;
-
- case "OliveDrab":
- return Color.OliveDrab;
-
- case "Orange":
- return Color.Orange;
-
- case "OrangeRed":
- return Color.OrangeRed;
-
- case "Orchid":
- return Color.Orchid;
-
- case "PaleGoldenrod":
- return Color.PaleGoldenrod;
-
- case "PaleGreen":
- return Color.PaleGreen;
-
- case "PaleTurquoise":
- return Color.PaleTurquoise;
-
- case "PaleVioletRed":
- return Color.PaleVioletRed;
-
- case "PapayaWhip":
- return Color.PapayaWhip;
-
- case "PeachPuff":
- return Color.PeachPuff;
-
- case "Peru":
- return Color.Peru;
-
- case "Pink":
- return Color.Pink;
-
- case "Plum":
- return Color.Plum;
-
- case "PowderBlue":
- return Color.PowderBlue;
-
- case "Purple":
- return Color.Purple;
-
- case "Red":
- return Color.Red;
-
- case "RosyBrown":
- return Color.RosyBrown;
-
- case "RoyalBlue":
- return Color.RoyalBlue;
-
- case "SaddleBrown":
- return Color.SaddleBrown;
-
- case "Salmon":
- return Color.Salmon;
-
- case "SandyBrown":
- return Color.SandyBrown;
-
- case "SeaGreen":
- return Color.SeaGreen;
-
- case "Sienna":
- return Color.Sienna;
-
- case "Silver":
- return Color.Silver;
-
- case "SkyBlue":
- return Color.SkyBlue;
-
- case "SlateBlue":
- return Color.SlateBlue;
-
- case "SlateGray":
- return Color.SlateGray;
-
- case "Snow":
- return Color.Snow;
-
- case "SpringGreen":
- return Color.SpringGreen;
-
- case "SteelBlue":
- return Color.SteelBlue;
-
- case "Tan":
- return Color.Tan;
-
- case "Thistle":
- return Color.Thistle;
-
- case "Tomato":
- return Color.Tomato;
-
- case "Transparent":
- return Color.Transparent;
-
- case "Turquoise":
- return Color.Turquoise;
-
- case "Violet":
- return Color.Violet;
-
- case "Wheat":
- return Color.Wheat;
-
- case "White":
- return Color.White;
-
- case "WhiteSmoke":
- return Color.WhiteSmoke;
-
- case "Yellow":
- return Color.Yellow;
-
- case "YellowGreen":
- return Color.YellowGreen;
-
- case "":
- throw new ArgumentException("Color Name must be passed to the 'System.Drawing.Color.FromName' method.");
-
- default:
- throw new ArgumentException("{0} is not a valid color Name", name);
-
- }
+ "AliceBlue" => Color.AliceBlue,
+ "AntiqueWhite" => Color.AntiqueWhite,
+ "Aqua" => Color.Aqua,
+ "Aquamarine" => Color.Aquamarine,
+ "Azure" => Color.Azure,
+ "Beige" => Color.Beige,
+ "Bisque" => Color.Bisque,
+ "Black" => Color.Black,
+ "BlueViolet" => Color.BlueViolet,
+ "Brown" => Color.Brown,
+ "BurlyWood" => Color.BurlyWood,
+ "CadetBlue" => Color.CadetBlue,
+ "Chartreuse" => Color.Chartreuse,
+ "Chocolate" => Color.Chocolate,
+ "Coral" => Color.Coral,
+ "CornflowerBlue" => Color.CornflowerBlue,
+ "Cornsilk" => Color.Cornsilk,
+ "Crimson" => Color.Crimson,
+ "Cyan" => Color.Cyan,
+ "DarkBlue" => Color.DarkBlue,
+ "DarkCyan" => Color.DarkCyan,
+ "DarkGoldenrod" => Color.DarkGoldenrod,
+ "DarkGray" => Color.DarkGray,
+ "DarkGreen" => Color.DarkGreen,
+ "DarkKhaki" => Color.DarkKhaki,
+ "DarkMagenta" => Color.DarkMagenta,
+ "DarkOliveGreen" => Color.DarkOliveGreen,
+ "AliceOrange" => Color.DarkOrange,
+ "DarkOrchid" => Color.DarkOrchid,
+ "DarkRed" => Color.DarkRed,
+ "DarkSalmon" => Color.DarkSalmon,
+ "DarkSeaGreen" => Color.DarkSeaGreen,
+ "DarkSlateBlue" => Color.DarkSlateBlue,
+ "DarkSlateGray" => Color.DarkSlateGray,
+ "DarkTurquoise" => Color.DarkTurquoise,
+ "DarkViolet" => Color.DarkViolet,
+ "DeepPink" => Color.DeepPink,
+ "DeepSkyBlue" => Color.DeepSkyBlue,
+ "DimGray" => Color.DimGray,
+ "DodgerBlue" => Color.DodgerBlue,
+ "Firebrick" => Color.Firebrick,
+ "FloralWhite" => Color.FloralWhite,
+ "ForestGreen" => Color.ForestGreen,
+ "Fuchsia" => Color.Fuchsia,
+ "Gainsboro" => Color.Gainsboro,
+ "GhostWhite" => Color.GhostWhite,
+ "Gold" => Color.Gold,
+ "Goldenrod" => Color.Goldenrod,
+ "Gray" => Color.Gray,
+ "Green" => Color.Green,
+ "GreenYellow" => Color.GreenYellow,
+ "Honeydew" => Color.Honeydew,
+ "HotPink" => Color.HotPink,
+ "IndianRed" => Color.IndianRed,
+ "Indigo" => Color.Indigo,
+ "Ivory" => Color.Ivory,
+ "Khaki" => Color.Khaki,
+ "Lavender" => Color.Lavender,
+ "LavenderBlush" => Color.LavenderBlush,
+ "LawnGreen" => Color.LawnGreen,
+ "LemonChiffon" => Color.LemonChiffon,
+ "LightBlue" => Color.LightBlue,
+ "LightCoral" => Color.LightCoral,
+ "LightCyan" => Color.LightCyan,
+ "LightGoldenrodYellow" => Color.LightGoldenrodYellow,
+ "LightGreen" => Color.LightGreen,
+ "LightGray" => Color.LightGray,
+ "LightPink" => Color.LightPink,
+ "LightSalmon" => Color.LightSalmon,
+ "LightSeaGreen" => Color.LightSeaGreen,
+ "LightSkyBlue" => Color.LightSkyBlue,
+ "LightSlateGray" => Color.LightSlateGray,
+ "LightSteelBlue" => Color.LightSteelBlue,
+ "LightYellow" => Color.LightYellow,
+ "Lime" => Color.Lime,
+ "LimeGreen" => Color.LimeGreen,
+ "Linen" => Color.Linen,
+ "Magenta" => Color.Magenta,
+ "Maroon" => Color.Maroon,
+ "MediumAquamarine" => Color.MediumAquamarine,
+ "MediumBlue" => Color.MediumBlue,
+ "MediumOrchid" => Color.MediumOrchid,
+ "MediumPurple" => Color.MediumPurple,
+ "MediumSeaGreen" => Color.MediumSeaGreen,
+ "MediumSlateBlue" => Color.MediumSlateBlue,
+ "MediumSpringGreen" => Color.MediumSpringGreen,
+ "MediumTurquoise" => Color.MediumTurquoise,
+ "MediumVioletRed" => Color.MediumVioletRed,
+ "MidnightBlue" => Color.MidnightBlue,
+ "MintCream" => Color.MintCream,
+ "MistyRose" => Color.MistyRose,
+ "Moccasin" => Color.Moccasin,
+ "NavajoWhite" => Color.NavajoWhite,
+ "Navy" => Color.Navy,
+ "OldLace" => Color.OldLace,
+ "Olive" => Color.Olive,
+ "OliveDrab" => Color.OliveDrab,
+ "Orange" => Color.Orange,
+ "OrangeRed" => Color.OrangeRed,
+ "Orchid" => Color.Orchid,
+ "PaleGoldenrod" => Color.PaleGoldenrod,
+ "PaleGreen" => Color.PaleGreen,
+ "PaleTurquoise" => Color.PaleTurquoise,
+ "PaleVioletRed" => Color.PaleVioletRed,
+ "PapayaWhip" => Color.PapayaWhip,
+ "PeachPuff" => Color.PeachPuff,
+ "Peru" => Color.Peru,
+ "Pink" => Color.Pink,
+ "Plum" => Color.Plum,
+ "PowderBlue" => Color.PowderBlue,
+ "Purple" => Color.Purple,
+ "Red" => Color.Red,
+ "RosyBrown" => Color.RosyBrown,
+ "RoyalBlue" => Color.RoyalBlue,
+ "SaddleBrown" => Color.SaddleBrown,
+ "Salmon" => Color.Salmon,
+ "SandyBrown" => Color.SandyBrown,
+ "SeaGreen" => Color.SeaGreen,
+ "Sienna" => Color.Sienna,
+ "Silver" => Color.Silver,
+ "SkyBlue" => Color.SkyBlue,
+ "SlateBlue" => Color.SlateBlue,
+ "SlateGray" => Color.SlateGray,
+ "Snow" => Color.Snow,
+ "SpringGreen" => Color.SpringGreen,
+ "SteelBlue" => Color.SteelBlue,
+ "Tan" => Color.Tan,
+ "Thistle" => Color.Thistle,
+ "Tomato" => Color.Tomato,
+ "Transparent" => Color.Transparent,
+ "Turquoise" => Color.Turquoise,
+ "Violet" => Color.Violet,
+ "Wheat" => Color.Wheat,
+ "White" => Color.White,
+ "WhiteSmoke" => Color.WhiteSmoke,
+ "Yellow" => Color.Yellow,
+ "YellowGreen" => Color.YellowGreen,
+ "" => throw new ArgumentException("Color Name must be passed to the 'System.Drawing.Color.FromName' method."),
+ _ => throw new ArgumentException("{0} is not a valid color Name", name),
+ };
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/EnumImpl.cs b/source/Cosmos.System2_Plugs/System/EnumImpl.cs
index 3c2128f287..61657974c1 100644
--- a/source/Cosmos.System2_Plugs/System/EnumImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/EnumImpl.cs
@@ -1,5 +1,3 @@
-using System;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -49,4 +47,4 @@ public static void GetEnumValuesAndNames(object aQCallTypeHandle, object aObject
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/EnvironmentImpl.cs b/source/Cosmos.System2_Plugs/System/EnvironmentImpl.cs
index 8bc7571883..e7be875396 100644
--- a/source/Cosmos.System2_Plugs/System/EnvironmentImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/EnvironmentImpl.cs
@@ -1,15 +1,29 @@
-using System;
-using Cosmos.System;
using IL2CPU.API.Attribs;
+using Cosmos.System;
namespace Cosmos.System_Plugs.System
{
[Plug(Target = typeof(Environment))]
public class EnvironmentImpl
{
- public static void Exit(int aExitCode)
+ #region Properties
+
+ // We still need to add support for ".." and "." here, best method when ".." is detected is just remove last directory from current instead of adding the literal "..".
+ public static string CurrentDirectory
+ {
+ get => Directory.GetCurrentDirectory();
+ set => Directory.SetCurrentDirectory(value);
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static void Exit(int exitCode)
{
Power.Shutdown();
}
+
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Globalization/CalendarDataImpl.cs b/source/Cosmos.System2_Plugs/System/Globalization/CalendarDataImpl.cs
index 9aff88eacb..4d151d9192 100644
--- a/source/Cosmos.System2_Plugs/System/Globalization/CalendarDataImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Globalization/CalendarDataImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Cosmos.Debug.Kernel;
+using Cosmos.Debug.Kernel;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Globalization
@@ -72,4 +67,4 @@ public unsafe static bool GetCalendarInfo(string localeName, object calendarId,
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Globalization/CompareInfoImpl.cs b/source/Cosmos.System2_Plugs/System/Globalization/CompareInfoImpl.cs
index c03153c560..f0139cbfca 100644
--- a/source/Cosmos.System2_Plugs/System/Globalization/CompareInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Globalization/CompareInfoImpl.cs
@@ -1,6 +1,4 @@
-using System;
using System.Globalization;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Globalization
@@ -8,7 +6,7 @@ namespace Cosmos.System_Plugs.System.Globalization
[Plug(Target = typeof(CompareInfo))]
public static class CompareInfoImpl
{
- public static void Ctor(CompareInfo aThis, CultureInfo aCulture)
+ public static void Ctor(CompareInfo context, CultureInfo culture)
{
}
@@ -69,4 +67,4 @@ public static void Ctor(CompareInfo aThis, CultureInfo aCulture)
// return true;
//}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Globalization/CultureDataImpl.cs b/source/Cosmos.System2_Plugs/System/Globalization/CultureDataImpl.cs
index ea54f285c8..bad45756d3 100644
--- a/source/Cosmos.System2_Plugs/System/Globalization/CultureDataImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Globalization/CultureDataImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Globalization;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Globalization
@@ -122,4 +117,4 @@ public static Calendar get_DefaultCalendar(object aThis)
return new GregorianCalendar();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Globalization/JapaneseCalendarImpl.cs b/source/Cosmos.System2_Plugs/System/Globalization/JapaneseCalendarImpl.cs
index f4216b7a67..1551581a8a 100644
--- a/source/Cosmos.System2_Plugs/System/Globalization/JapaneseCalendarImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Globalization/JapaneseCalendarImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Globalization
{
@@ -15,4 +10,4 @@ public static object[] NlsGetJapaneseEras()
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/GuidImpl.cs b/source/Cosmos.System2_Plugs/System/GuidImpl.cs
index 552ad8c245..006b6b0421 100644
--- a/source/Cosmos.System2_Plugs/System/GuidImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/GuidImpl.cs
@@ -1,6 +1,5 @@
-using System;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
+using IL2CPU.API;
namespace Cosmos.System_Plugs.System
{
@@ -9,13 +8,13 @@ public class GuidImpl
{
public static Guid NewGuid()
{
- Random rnd = new Random();
+ Random rnd = new();
var guid = new byte[16];
rnd.NextBytes(guid);
- guid[6] = (byte) (0x40 | ((int) guid[6] & 0xf));
- guid[8] = (byte) (0x80 | ((int) guid[8] & 0x3f));
+ guid[6] = (byte)(0x40 | (guid[6] & 0xf));
+ guid[8] = (byte)(0x80 | (guid[8] & 0x3f));
return new Guid(guid);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/HashCodeImpl.cs b/source/Cosmos.System2_Plugs/System/HashCodeImpl.cs
index bd7dab5f4c..7f6e59f506 100644
--- a/source/Cosmos.System2_Plugs/System/HashCodeImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/HashCodeImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
@@ -15,4 +10,4 @@ public static uint GenerateGlobalSeed()
return 0;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/CosmosFileSystem.cs b/source/Cosmos.System2_Plugs/System/IO/CosmosFileSystem.cs
deleted file mode 100644
index 84d62e490c..0000000000
--- a/source/Cosmos.System2_Plugs/System/IO/CosmosFileSystem.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-//#define COSMOSDEBUG
-using System;
-using System.IO;
-using System.Collections.Generic;
-using Cosmos.Debug.Kernel;
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-using Cosmos.System;
-using Cosmos.System.FileSystem;
-using Cosmos.System.FileSystem.Listing;
-using Cosmos.System.FileSystem.VFS;
-
-/*
- * This plug is a little different from usual because in future while now is plugging Win32FileSystem
- * when we will compile Cosmos on Linux / MacOS this will have to plug UnixFileSystem, using the attibute
- * Inheritable we should accomplish this without problems.
- * It is for this that the name is different too the usual plugs and does not ends in "Impl"
- */
-namespace Cosmos.System_Plugs.System.IO
-{
- //[Plug(TargetName = "System.IO.FileSystem, System.IO.FileSystem")]
- public static class CosmosFileSystem
- {
- private static void CreateDirectory(string fullPath)
- {
- Global.mFileSystemDebugger.SendInternal("-- CosmosFileSystem.CreateDirectory -- fullPath = " + fullPath);
- // If 'fullPath' exists already we return already without dealing with VFSManager
- if (DirectoryExists(fullPath))
- return;
-
- var xEntry = VFSManager.CreateDirectory(fullPath);
-
- if (xEntry == null)
- {
- throw new IOException("VFSManager.CreateDirectory() returns null");
- }
- }
-
- public static void CreateDirectory(string aPath, byte[] securityDescriptor = null)
- {
- Global.mFileSystemDebugger.SendInternal("-- CosmosFileSystem.CreateDirectory(string, byte[]) -- ");
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
- CreateDirectory(aPath);
- }
-
- // Never called? Cosmos goes in StackOverflow... ILCPU gets lost and do not find this native method
- public static bool DirectoryExists(string fullPath)
- {
- if (fullPath == null)
- {
- return false;
- }
-
- Global.mFileSystemDebugger.SendInternal($"DirectoryExists : fullPath = {fullPath}");
- return VFSManager.DirectoryExists(fullPath);
- }
-
- public static bool FileExists(string fullPath)
- {
- if (fullPath == null)
- {
- return false;
- }
-
- Global.mFileSystemDebugger.SendInternal($"-- CosmosFileSystem.FileExists -- : fullPath = {fullPath}");
- return VFSManager.FileExists(fullPath);
- }
-
- public static void RemoveDirectory(string fullPath, bool recursive)
- {
- Global.mFileSystemDebugger.SendInternal($"RemoveDirectory : fullPath = {fullPath}");
- VFSManager.DeleteDirectory(fullPath, recursive);
- }
-
- public static void MoveDirectory(string sourceFullPath, string destFullPath)
- {
- throw new NotImplementedException("MoveDirectory not implemented");
- }
-
- public static void DeleteFile(string fullPath)
- {
- Global.mFileSystemDebugger.SendInternal($"DeleteFile : fullPath = {fullPath}");
- VFSManager.DeleteFile(fullPath);
- }
-
- public static void CopyFile(string sourceFullPath, string destFullPath, bool overwrite)
- {
- Global.mFileSystemDebugger.SendInternal($"CopyFile {sourceFullPath} into {destFullPath} with overwrite {overwrite}");
-
- // The destination path may just be a directory into which the file should be copied.
- // If it is, append the filename from the source onto the destination directory
- if (Directory.Exists(destFullPath))
- {
- destFullPath = Path.Combine(destFullPath, Path.GetFileName(sourceFullPath));
- }
-
- // Copy the contents of the file from the source to the destination, creating the destination in the process
- using (var src = new FileStream(sourceFullPath, FileMode.Open))
- using (var dst = new FileStream(destFullPath, overwrite ? FileMode.Create : FileMode.CreateNew))
- {
- int xSize = (int)src.Length;
- Global.mFileSystemDebugger.SendInternal($"size of {sourceFullPath} is {xSize} bytes");
- byte[] content = new byte[xSize];
- Global.mFileSystemDebugger.SendInternal($"content byte buffer allocated");
- src.Read(content, 0, xSize);
- Global.mFileSystemDebugger.SendInternal($"content byte buffer read");
- dst.Write(content, 0, xSize);
- Global.mFileSystemDebugger.SendInternal($"content byte buffer written");
- }
- }
- }
-}
diff --git a/source/Cosmos.System2_Plugs/System/IO/DirectoryImpl.cs b/source/Cosmos.System2_Plugs/System/IO/DirectoryImpl.cs
index 05d0db1107..65db668146 100644
--- a/source/Cosmos.System2_Plugs/System/IO/DirectoryImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/DirectoryImpl.cs
@@ -1,68 +1,62 @@
-//#define COSMOSDEBUG
-using System;
-using System.IO;
-using System.Collections.Generic;
-using Cosmos.Debug.Kernel;
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-using Cosmos.System;
-using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.Listing;
using Cosmos.System.FileSystem.VFS;
+using Cosmos.System;
+using IL2CPU.API.Attribs;
+using IL2CPU.API;
namespace Cosmos.System_Plugs.System.IO
{
[Plug(Target = typeof(Directory))]
public static class DirectoryImpl
{
- private static string mCurrentDirectory = string.Empty;
+ #region Methods
public static string GetCurrentDirectory()
{
- Global.mFileSystemDebugger.SendInternal($"Directory.GetCurrentDirectory : mCurrentDirectory = {mCurrentDirectory}");
- return mCurrentDirectory;
+ Global.Debugger.SendInternal($"Directory.GetCurrentDirectory : currentDirectory = {currentDirectory}");
+ return currentDirectory;
}
- public static void SetCurrentDirectory(string aPath)
+ public static void SetCurrentDirectory(string path)
{
- Global.mFileSystemDebugger.SendInternal($"Directory.SetCurrentDirectory : aPath = {aPath}");
- mCurrentDirectory = aPath;
+ Global.Debugger.SendInternal($"Directory.SetCurrentDirectory : path = {path}");
+ currentDirectory = path;
}
- public static bool Exists(string aPath)
+ public static bool Exists(string path)
{
- if (aPath == null)
+ if (path == null)
{
return false;
}
- Global.mFileSystemDebugger.SendInternal($"Directory.Exists : aPath = {aPath}");
- return VFSManager.DirectoryExists(aPath);
+ Global.Debugger.SendInternal($"Directory.Exists : aPath = {path}");
+ return VFSManager.DirectoryExists(path);
}
- public static DirectoryInfo CreateDirectory(string aPath)
+ public static DirectoryInfo CreateDirectory(string path)
{
- Global.mFileSystemDebugger.SendInternal($"-- Directory.CreateDirectory --");
- Global.mFileSystemDebugger.SendInternal($"aPath = {aPath}");
+ Global.Debugger.SendInternal($"-- Directory.CreateDirectory --");
+ Global.Debugger.SendInternal($"path = {path}");
- if (aPath == null)
+ if (path == null)
{
- throw new ArgumentNullException("aPath");
+ throw new ArgumentNullException(nameof(path));
}
- if (aPath.Length == 0)
+ if (path.Length == 0)
{
- throw new ArgumentException("Path must not be empty.", "aPath");
+ throw new ArgumentException("Path must not be empty.", nameof(path));
}
- var xEntry = VFSManager.CreateDirectory(aPath);
+ DirectoryEntry entry = VFSManager.CreateDirectory(path);
- if (xEntry == null)
+ if (entry == null)
{
return null;
}
- return new DirectoryInfo(aPath);
+ return new DirectoryInfo(path);
}
public static void Delete(string aPath)
@@ -70,83 +64,92 @@ public static void Delete(string aPath)
Delete(aPath, false);
}
- public static void Delete(string aPath, bool recursive)
+ public static void Delete(string path, bool recursive)
{
- String xFullPath = Path.GetFullPath(aPath);
+ string fullPath = Path.GetFullPath(path);
- VFSManager.DeleteDirectory(xFullPath, recursive);
+ VFSManager.DeleteDirectory(fullPath, recursive);
}
- public static DirectoryInfo GetParent(string aPath)
+ public static DirectoryInfo GetParent(string path)
{
- Global.mFileSystemDebugger.SendInternal("Directory.GetParent:");
+ Global.Debugger.SendInternal("Directory.GetParent:");
- if (aPath == null)
+ if (path == null)
{
- Global.mFileSystemDebugger.SendInternal("Directory.GetParent : aPath is null");
- throw new ArgumentNullException("aPath");
+ Global.Debugger.SendInternal("Directory.GetParent : path is null");
+ throw new ArgumentNullException(nameof(path));
}
- if (aPath.Length == 0)
+ if (string.IsNullOrEmpty(path))
{
- Global.mFileSystemDebugger.SendInternal("Directory.GetParent : aPath is empty");
- throw new ArgumentException("Path must not be empty.", "aPath");
+ Global.Debugger.SendInternal("Directory.GetParent : path is empty");
+ throw new ArgumentException("Path must not be empty.", nameof(path));
}
- Global.mFileSystemDebugger.SendInternal("aPath =");
- Global.mFileSystemDebugger.SendInternal(aPath);
+ Global.Debugger.SendInternal($"path = {path}");
- string xFullPath = Path.GetFullPath(aPath);
- string xParentDirectory = Path.GetDirectoryName(xFullPath);
- if (xParentDirectory == null)
+ string fullPath = Path.GetFullPath(path);
+ string parentDirectory = Path.GetDirectoryName(fullPath);
+ if (parentDirectory == null)
{
- Global.mFileSystemDebugger.SendInternal("Directory.GetParent : xParentDirectory is null");
+ Global.Debugger.SendInternal("Directory.GetParent : Parent Directory is null");
return null;
}
- return new DirectoryInfo(xParentDirectory);
+ return new DirectoryInfo(parentDirectory);
}
- public static string[] GetDirectories(string aPath)
+ public static string[] GetDirectories(string path)
{
- Global.mFileSystemDebugger.SendInternal("Directory.GetDirectories");
- if (aPath == null)
+ Global.Debugger.SendInternal("Directory.GetDirectories");
+ if (path == null)
{
- throw new ArgumentNullException(aPath);
+ throw new ArgumentNullException(path);
}
- var xDirectories = new List();
- var xEntries = VFSManager.GetDirectoryListing(aPath);
- for (int i = 0; i < xEntries.Count; i++)
+ List directories = new();
+ List entries = VFSManager.GetDirectoryListing(path);
+
+ for (int i = 0; i < entries.Count; i++)
{
- if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.Directory)
+ if (entries[i].mEntryType == DirectoryEntryTypeEnum.Directory)
{
- xDirectories.Add(xEntries[i].mName);
+ directories.Add(entries[i].mName);
}
}
- return xDirectories.ToArray();
+ return directories.ToArray();
}
- public static string[] GetFiles(string aPath)
+ public static string[] GetFiles(string path)
{
- Global.mFileSystemDebugger.SendInternal("Directory.GetFiles");
- if (aPath == null)
+ Global.Debugger.SendInternal("Directory.GetFiles");
+ if (path == null)
{
- throw new ArgumentNullException(aPath);
+ throw new ArgumentNullException(path);
}
- var xFiles = new List();
- var xEntries = VFSManager.GetDirectoryListing(aPath);
- for (int i = 0; i < xEntries.Count; i++)
+ List files = new();
+ List entries = VFSManager.GetDirectoryListing(path);
+
+ for (int i = 0; i < entries.Count; i++)
{
- if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.File)
+ if (entries[i].mEntryType == DirectoryEntryTypeEnum.File)
{
- xFiles.Add(xEntries[i].mName);
+ files.Add(entries[i].mName);
}
}
- return xFiles.ToArray();
+ return files.ToArray();
}
+
+ #endregion
+
+ #region Fields
+
+ private static string currentDirectory = string.Empty;
+
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/DirectoryInfoImpl.cs b/source/Cosmos.System2_Plugs/System/IO/DirectoryInfoImpl.cs
index b719c67af3..7b06909135 100644
--- a/source/Cosmos.System2_Plugs/System/IO/DirectoryInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/DirectoryInfoImpl.cs
@@ -1,10 +1,7 @@
-//#define COSMOSDEBUG
-using System.IO;
-using IL2CPU.API.Attribs;
-using Cosmos.System;
-using Cosmos.System.FileSystem.Listing;
+using Cosmos.System.FileSystem.Listing;
using Cosmos.System.FileSystem.VFS;
-using System.Collections.Generic;
+using Cosmos.System;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
{
@@ -16,13 +13,13 @@ namespace Cosmos.System_Plugs.System.IO
public static class DirectoryInfoImpl
{
/* The real implementation uses IEnumerable and do a conversion ToArray that crashes IL2CPU */
- public static DirectoryInfo[] GetDirectories(DirectoryInfo aThis)
+ public static DirectoryInfo[] GetDirectories(DirectoryInfo directory)
{
- Global.mFileSystemDebugger.SendInternal($"DirectoryInfo.GetDirectories() on path {aThis.FullName}");
- var xEntries = VFSManager.GetDirectoryListing(aThis.FullName);
+ Global.Debugger.SendInternal($"DirectoryInfo.GetDirectories() on path '{directory.FullName}'.");
+ var xEntries = VFSManager.GetDirectoryListing(directory.FullName);
//var result = new DirectoryInfo[xEntries.Count];
- var result = new List();
+ List result = new();
for (int i = 0; i < xEntries.Count; i++)
{
@@ -36,16 +33,16 @@ public static DirectoryInfo[] GetDirectories(DirectoryInfo aThis)
}
/* The real implementation uses IEnumerable and do a conversion ToArray that crashes IL2CPU */
- public static FileInfo[] GetFiles(DirectoryInfo aThis)
+ public static FileInfo[] GetFiles(DirectoryInfo directory)
{
- Global.mFileSystemDebugger.SendInternal($"DirectoryInfo.GetFiles() on path {aThis.FullName}");
- var xEntries = VFSManager.GetDirectoryListing(aThis.FullName);
+ Global.Debugger.SendInternal($"DirectoryInfo.GetFiles() on path '{directory.FullName}'.");
+ var xEntries = VFSManager.GetDirectoryListing(directory.FullName);
- var result = new List();
+ List result = new();
for (int i = 0; i < xEntries.Count; i++)
{
- Global.mFileSystemDebugger.SendInternal($"Found entry of type {(int)xEntries[i].mEntryType} and name {xEntries[i].mFullPath}");
+ Global.Debugger.SendInternal($"Found entry of type {(int)xEntries[i].mEntryType} and name {xEntries[i].mFullPath}");
if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.File)
{
//result[i] = new FileInfo(xEntries[i].mFullPath);
@@ -56,16 +53,16 @@ public static FileInfo[] GetFiles(DirectoryInfo aThis)
return result.ToArray();
}
- public static FileSystemInfo[] GetFileSystemInfos(DirectoryInfo aThis)
+ public static FileSystemInfo[] GetFileSystemInfos(DirectoryInfo directory)
{
- Global.mFileSystemDebugger.SendInternal($"DirectoryInfo.GetFiles() on path {aThis.FullName}");
- var xEntries = VFSManager.GetDirectoryListing(aThis.FullName);
+ Global.Debugger.SendInternal($"DirectoryInfo.GetFiles() on path '{directory.FullName}'.");
+ var xEntries = VFSManager.GetDirectoryListing(directory.FullName);
- var result = new List();
+ List result = new();
for (int i = 0; i < xEntries.Count; i++)
{
- Global.mFileSystemDebugger.SendInternal($"Found entry of type {(int)xEntries[i].mEntryType} and name {xEntries[i].mFullPath}");
+ Global.Debugger.SendInternal($"Found entry of type {(int)xEntries[i].mEntryType} and name {xEntries[i].mFullPath}");
if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.Directory)
{
result.Add(new DirectoryInfo(xEntries[i].mFullPath));
@@ -79,4 +76,4 @@ public static FileSystemInfo[] GetFileSystemInfos(DirectoryInfo aThis)
return result.ToArray();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/CosmosDriveInfo.cs b/source/Cosmos.System2_Plugs/System/IO/DriveInfoImpl.cs
similarity index 65%
rename from source/Cosmos.System2_Plugs/System/IO/CosmosDriveInfo.cs
rename to source/Cosmos.System2_Plugs/System/IO/DriveInfoImpl.cs
index a20f25c981..8219297d97 100644
--- a/source/Cosmos.System2_Plugs/System/IO/CosmosDriveInfo.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/DriveInfoImpl.cs
@@ -1,12 +1,6 @@
-// #define COSMOSDEBUG
-using Cosmos.System;
-using Cosmos.System.FileSystem;
-using Cosmos.System.FileSystem.VFS;
+using Cosmos.System.FileSystem.VFS;
using IL2CPU.API.Attribs;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
+using Cosmos.System;
namespace Cosmos.System_Plugs.System.IO
{
@@ -15,70 +9,75 @@ public static class DriveInfoImpl
{
public static string NormalizeDriveName(string driveName)
{
- string name;
+ string Name;
if (driveName.Length == 1)
- name = driveName + ":\\";
+ {
+ Name = driveName + ":\\";
+ }
else
{
- name = Path.GetPathRoot(driveName);
+ Name = Path.GetPathRoot(driveName);
+
// Disallow null or empty drive letters and UNC paths
- if (name == null || name.Length == 0 || name.StartsWith("\\\\", StringComparison.Ordinal))
+ if (Name == null || Name.Length == 0 || Name.StartsWith("\\\\", StringComparison.Ordinal))
+ {
throw new ArgumentException("Argument must be drive identifier or root dir");
+ }
}
// We want to normalize to have a trailing backslash so we don't have two equivalent forms and
// because some Win32 API don't work without it.
- if (name.Length == 2 && name[1] == ':')
+ if (Name.Length == 2 && Name[1] == ':')
{
- name = name + "\\";
+ Name += '\\';
}
- if (!VFSManager.IsValidDriveId(name))
+ if (!VFSManager.IsValidDriveId(Name))
{
throw new ArgumentException("Argument must be drive identifier or root dir");
}
- return name;
+ return Name;
}
public static long get_AvailableFreeSpace(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting Available Free Space of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting Available Free Space of {aThis.Name}");
return VFSManager.GetAvailableFreeSpace(aThis.Name);
}
public static long get_TotalFreeSpace(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting Total Free Space of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting Total Free Space of {aThis.Name}");
return VFSManager.GetTotalFreeSpace(aThis.Name);
}
public static long get_TotalSize(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting size of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting size of {aThis.Name}");
return VFSManager.GetTotalSize(aThis.Name);
}
public static string get_DriveFormat(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting format of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting format of {aThis.Name}");
return VFSManager.GetFileSystemType(aThis.Name);
}
public static string get_VolumeLabel(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting label of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting label of {aThis.Name}");
return VFSManager.GetFileSystemLabel(aThis.Name);
}
public static void set_VolumeLabel(DriveInfo aThis, string aLabel)
{
- Global.mFileSystemDebugger.SendInternal($"Setting label of {aThis.Name} with {aLabel}");
+ Global.Debugger.SendInternal($"Setting label of {aThis.Name} with {aLabel}");
VFSManager.SetFileSystemLabel(aThis.Name, aLabel);
}
@@ -86,20 +85,20 @@ public static void set_VolumeLabel(DriveInfo aThis, string aLabel)
/* For now I'm forcing IsReady to be always true as only fixed drives are supported in Cosmos for now */
public static bool get_IsReady(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting isReady status of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting isReady status of {aThis.Name}");
return true;
}
/* For now I'm forcing DriveType to always be 'Fixed' as only fixed drives are supported in Cosmos for now */
public static DriveType get_DriveType(DriveInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"Getting DriveType of {aThis.Name}");
+ Global.Debugger.SendInternal($"Getting DriveType of {aThis.Name}");
return DriveType.Fixed;
}
public static DriveInfo[] GetDrives()
{
- Global.mFileSystemDebugger.SendInternal("GetDrives called");
+ Global.Debugger.SendInternal("GetDrives called");
List drives = VFSManager.GetLogicalDrives();
diff --git a/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs
index 878549f8ef..7fd237d0bd 100644
--- a/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs
@@ -1,14 +1,6 @@
-//#define COSMOSDEBUG
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Cosmos.System;
-using Cosmos.Common.Extensions;
-using Cosmos.Debug.Kernel;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
-using Cosmos.System.FileSystem;
-using Cosmos.System.FileSystem.VFS;
+using IL2CPU.API;
+using Cosmos.System;
namespace Cosmos.System_Plugs.System.IO
{
@@ -20,38 +12,40 @@ public static class FileImpl
* Plug needed for the usual issue that Array can not be converted in IEnumerable... it is starting
* to become annoying :-(
*/
- public static void WriteAllLines(string aFile, string[] contents)
+ public static void WriteAllLines(string path, string[] contents)
{
- if (aFile == null)
+ if (path == null)
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (contents == null)
{
- throw new ArgumentNullException("contents");
+ throw new ArgumentNullException(nameof(contents));
}
- if (aFile.Length == 0)
+ if (path.Length == 0)
{
- throw new ArgumentException("Empty", "aFile");
+ throw new ArgumentException("Empty", nameof(path));
}
- Global.mFileSystemDebugger.SendInternal("Writing contents");
+ Global.Debugger.SendInternal("Writing contents");
+
+ StreamWriter Writer = new(path);
- using (var xSW = new StreamWriter(aFile))
+ foreach (var current in contents)
{
- foreach (var current in contents)
- {
- xSW.WriteLine(current);
- }
+ Writer.WriteLine(current);
}
+
+ Writer.Dispose();
}
- public static void WriteAllBytes(string aFile, byte[] aData)
+ public static void WriteAllBytes(string path, byte[] aData)
{
- using (var xSW = new BinaryWriter(new FileStream(aFile, FileMode.OpenOrCreate)))
- {
- xSW.Write(aData);
- }
+ BinaryWriter Writer = new(new FileStream(path, FileMode.OpenOrCreate));
+
+ Writer.Write(aData);
+
+ Writer.Dispose();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/FileInfoImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileInfoImpl.cs
index 2d14aa5ad5..34312d979e 100644
--- a/source/Cosmos.System2_Plugs/System/IO/FileInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileInfoImpl.cs
@@ -16,4 +16,4 @@ public static long get_Length(FileInfo aThis)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/FileLoadExceptionImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileLoadExceptionImpl.cs
index 6e1e00015e..6b099d4f74 100644
--- a/source/Cosmos.System2_Plugs/System/IO/FileLoadExceptionImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileLoadExceptionImpl.cs
@@ -1,7 +1,4 @@
-using System;
-using System.IO;
-
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
{
@@ -18,4 +15,4 @@ public static string ToString(FileLoadException aThis)
throw new NotImplementedException("FileLoadException.ToString()");
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/FileNotFoundExceptionImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileNotFoundExceptionImpl.cs
index 33b303b876..0d76ec7d36 100644
--- a/source/Cosmos.System2_Plugs/System/IO/FileNotFoundExceptionImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileNotFoundExceptionImpl.cs
@@ -1,6 +1,4 @@
-using System.IO;
-
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
{
@@ -12,4 +10,4 @@ public static string ToString(FileNotFoundException aThis)
return "FileNotFoundException";
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/FileStreamImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileStreamImpl.cs
index e86f837b13..3b4943c80b 100644
--- a/source/Cosmos.System2_Plugs/System/IO/FileStreamImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileStreamImpl.cs
@@ -18,8 +18,8 @@ public class FileStreamImpl
private static void Init(string aPathname, FileMode aMode, ref Stream innerStream)
{
- Global.mFileSystemDebugger.SendInternal("-- FileStream.Init --");
- Global.mFileSystemDebugger.SendInternal("aPathname = " + aPathname);
+ Global.Debugger.SendInternal("-- FileStream.Init --");
+ Global.Debugger.SendInternal("aPathname = " + aPathname);
innerStream = InitializeStream(aPathname, aMode);
}
@@ -49,7 +49,7 @@ public static int Read(FileStream aThis, byte[] aBuffer, int aOffset, int aCount
public static int Read(FileStream aThis, Span aBuffer,
[FieldAccess(Name = InnerStreamFieldId)] ref Stream innerStream)
{
- Global.mFileSystemDebugger.SendInternal("FileStream.Read:");
+ Global.Debugger.SendInternal("FileStream.Read:");
return innerStream.Read(aBuffer);
}
@@ -66,7 +66,7 @@ public static void Write(FileStream aThis, byte[] aBuffer, int aOffset, int aCou
public static void Write(FileStream aThis, ReadOnlySpan aBuffer,
[FieldAccess(Name = InnerStreamFieldId)] ref Stream innerStream)
{
- Global.mFileSystemDebugger.SendInternal($"FileStream.Write:");
+ Global.Debugger.SendInternal($"FileStream.Write:");
innerStream.Write(aBuffer);
}
@@ -104,7 +104,7 @@ public static void Flush(FileStream aThis,
/*
* It gives NRE and kills the OS, commented it for now... we will "de-plug" FileStream soon
*/
- Global.mFileSystemDebugger.SendInternal($"In FileStream.InitializeStream Flush()");
+ Global.Debugger.SendInternal($"In FileStream.InitializeStream Flush()");
//innerStream.Flush();
}
@@ -122,11 +122,11 @@ public static void set_Position(FileStream aThis,
private static Stream CreateNewFile(string aPath, bool aPathExists)
{
- Global.mFileSystemDebugger.SendInternal($"-- FileStream.CreateNewFile -- aPath = {aPath} existing = {aPathExists}");
+ Global.Debugger.SendInternal($"-- FileStream.CreateNewFile -- aPath = {aPath} existing = {aPathExists}");
if (aPathExists)
{
- Global.mFileSystemDebugger.SendInternal("CreateNew Mode with aPath already existing");
+ Global.Debugger.SendInternal("CreateNew Mode with aPath already existing");
throw new IOException("File already existing but CreateNew Requested");
}
@@ -141,15 +141,15 @@ private static Stream CreateNewFile(string aPath, bool aPathExists)
private static Stream TruncateFile(string aPath, bool aPathExists)
{
- Global.mFileSystemDebugger.SendInternal($"-- FileStream.TruncateFile -- aPath = {aPath} existing = {aPathExists}");
+ Global.Debugger.SendInternal($"-- FileStream.TruncateFile -- aPath = {aPath} existing = {aPathExists}");
if (!aPathExists)
{
- Global.mFileSystemDebugger.SendInternal("Truncate Mode with aPath not existing");
+ Global.Debugger.SendInternal("Truncate Mode with aPath not existing");
throw new IOException("File not existing but Truncate Requested");
}
- Global.mFileSystemDebugger.SendInternal("Truncate Mode: change file lenght to 0 bytes");
+ Global.Debugger.SendInternal("Truncate Mode: change file lenght to 0 bytes");
var aStream = VFSManager.GetFileStream(aPath);
aStream.SetLength(0);
@@ -159,50 +159,50 @@ private static Stream TruncateFile(string aPath, bool aPathExists)
private static Stream CreateFile(string aPath, bool aPathExists)
{
- Global.mFileSystemDebugger.SendInternal($"-- FileStream.CreateFile -- aPath = {aPath} existing = {aPathExists}");
+ Global.Debugger.SendInternal($"-- FileStream.CreateFile -- aPath = {aPath} existing = {aPathExists}");
if (aPathExists == false)
{
- Global.mFileSystemDebugger.SendInternal($"File does not exist let's call CreateNew() to create it");
+ Global.Debugger.SendInternal($"File does not exist let's call CreateNew() to create it");
return CreateNewFile(aPath, aPathExists);
}
else
{
- Global.mFileSystemDebugger.SendInternal($"File does exist let's call TruncateFile() to truncate it");
+ Global.Debugger.SendInternal($"File does exist let's call TruncateFile() to truncate it");
return TruncateFile(aPath, aPathExists);
}
}
private static Stream AppendToFile(string aPath, bool aPathExists)
{
- Global.mFileSystemDebugger.SendInternal($"In FileStream.AppendToFile aPath {aPath} existing? {aPathExists}");
+ Global.Debugger.SendInternal($"In FileStream.AppendToFile aPath {aPath} existing? {aPathExists}");
if (aPathExists)
{
- Global.mFileSystemDebugger.SendInternal("Append mode with aPath already existing let's seek to end of the file");
+ Global.Debugger.SendInternal("Append mode with aPath already existing let's seek to end of the file");
var aStream = VFSManager.GetFileStream(aPath);
- Global.mFileSystemDebugger.SendInternal("Actual aStream Lenght: " + aStream.Length);
+ Global.Debugger.SendInternal("Actual aStream Lenght: " + aStream.Length);
aStream.Seek(0, SeekOrigin.End);
return aStream;
}
else
{
- Global.mFileSystemDebugger.SendInternal("Append mode with aPath not existing let's create a new the file");
+ Global.Debugger.SendInternal("Append mode with aPath not existing let's create a new the file");
return CreateNewFile(aPath, aPathExists);
}
}
private static Stream OpenFile(string aPath, bool aPathExists)
{
- Global.mFileSystemDebugger.SendInternal($"In FileStream.OpenFile aPath {aPath} existing? {aPathExists}");
+ Global.Debugger.SendInternal($"In FileStream.OpenFile aPath {aPath} existing? {aPathExists}");
if (!aPathExists)
{
throw new IOException("File not existing but Open Requested");
}
- Global.mFileSystemDebugger.SendInternal("Open Mode with aPath already existing opening file");
+ Global.Debugger.SendInternal("Open Mode with aPath already existing opening file");
var aStream = VFSManager.GetFileStream(aPath);
aStream.Position = 0;
@@ -211,32 +211,32 @@ private static Stream OpenFile(string aPath, bool aPathExists)
private static Stream OpenOrCreateFile(string aPath, bool aPathExists)
{
- Global.mFileSystemDebugger.SendInternal($"In FileStream.OpenOrCreateFile aPath {aPath} existing? {aPathExists}");
+ Global.Debugger.SendInternal($"In FileStream.OpenOrCreateFile aPath {aPath} existing? {aPathExists}");
if (aPathExists)
{
- Global.mFileSystemDebugger.SendInternal("OpenOrCreateFile Mode with aPath already existing, let's Open it!");
+ Global.Debugger.SendInternal("OpenOrCreateFile Mode with aPath already existing, let's Open it!");
return OpenFile(aPath, aPathExists);
}
else
{
- Global.mFileSystemDebugger.SendInternal("OpenOrCreateFile Mode with aPath not existing, let's Create it!");
+ Global.Debugger.SendInternal("OpenOrCreateFile Mode with aPath not existing, let's Create it!");
return CreateNewFile(aPath, aPathExists);
}
}
private static Stream InitializeStream(string aPath, FileMode aMode)
{
- Global.mFileSystemDebugger.SendInternal($"-- FileStream.InitializeStream --");
- Global.mFileSystemDebugger.SendInternal($"aPath = {aPath}");
+ Global.Debugger.SendInternal($"-- FileStream.InitializeStream --");
+ Global.Debugger.SendInternal($"aPath = {aPath}");
if (aPath == null)
{
- Global.mFileSystemDebugger.SendInternal("In FileStream.Ctor: Path == null is true");
+ Global.Debugger.SendInternal("In FileStream.Ctor: Path == null is true");
throw new ArgumentNullException("The file path cannot be null.");
}
if (aPath.Length == 0)
{
- Global.mFileSystemDebugger.SendInternal("In FileStream.Ctor: Path.Length == 0 is true");
+ Global.Debugger.SendInternal("In FileStream.Ctor: Path.Length == 0 is true");
throw new ArgumentException("The file path cannot be empty.");
}
@@ -264,7 +264,7 @@ private static Stream InitializeStream(string aPath, FileMode aMode)
return TruncateFile(aPath, aPathExists);
default:
- Global.mFileSystemDebugger.SendInternal("The mode " + aMode + "is out of range");
+ Global.Debugger.SendInternal("The mode " + aMode + "is out of range");
throw new ArgumentOutOfRangeException("The file mode is invalid");
}
}
diff --git a/source/Cosmos.System2_Plugs/System/IO/FileSystemImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileSystemImpl.cs
index 6729bf3085..f7b8a393a0 100644
--- a/source/Cosmos.System2_Plugs/System/IO/FileSystemImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileSystemImpl.cs
@@ -1,5 +1,5 @@
-using System;
-using System.IO;
+using Cosmos.System.FileSystem.VFS;
+using Cosmos.System;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
@@ -28,19 +28,47 @@ public static void RemoveDirectory(string aDir, bool aRecursive)
Directory.Delete(aDir, aRecursive);
}
- public static void DeleteFile(string aFile)
+ public static void DeleteFile(string fullPath)
{
- CosmosFileSystem.DeleteFile(aFile);
+ Global.Debugger.SendInternal($"DeleteFile : fullPath = {fullPath}");
+ VFSManager.DeleteFile(fullPath);
}
- public static void CopyFile(string aSource, string aDesintation, bool aOverwrite)
+ public static void CopyFile(string sourceFullPath, string destFullPath, bool overwrite)
{
- CosmosFileSystem.CopyFile(aSource, aDesintation, aOverwrite);
+ Global.Debugger.SendInternal($"CopyFile {sourceFullPath} into {destFullPath} with overwrite {overwrite}");
+
+ // The destination path may just be a directory into which the file should be copied.
+ // If it is, append the filename from the source onto the destination directory
+ if (Directory.Exists(destFullPath))
+ {
+ destFullPath = Path.Combine(destFullPath, Path.GetFileName(sourceFullPath));
+ }
+
+ // Copy the contents of the file from the source to the destination, creating the destination in the process
+ using (var src = new FileStream(sourceFullPath, FileMode.Open))
+ using (var dst = new FileStream(destFullPath, overwrite ? FileMode.Create : FileMode.CreateNew))
+ {
+ int xSize = (int)src.Length;
+ Global.Debugger.SendInternal($"size of {sourceFullPath} is {xSize} bytes");
+ byte[] content = new byte[xSize];
+ Global.Debugger.SendInternal($"content byte buffer allocated");
+ src.Read(content, 0, xSize);
+ Global.Debugger.SendInternal($"content byte buffer read");
+ dst.Write(content, 0, xSize);
+ Global.Debugger.SendInternal($"content byte buffer written");
+ }
}
- public static bool FileExists(string aFile)
+ public static bool FileExists(string fullPath)
{
- return CosmosFileSystem.FileExists(aFile);
+ if (fullPath == null)
+ {
+ return false;
+ }
+
+ Global.Debugger.SendInternal($"-- CosmosFileSystem.FileExists -- : fullPath = {fullPath}");
+ return VFSManager.FileExists(fullPath);
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/CosmosFileSystemInfo.cs b/source/Cosmos.System2_Plugs/System/IO/FileSystemInfoImpl.cs
similarity index 79%
rename from source/Cosmos.System2_Plugs/System/IO/CosmosFileSystemInfo.cs
rename to source/Cosmos.System2_Plugs/System/IO/FileSystemInfoImpl.cs
index 4ee3b6135f..4f5cb8b903 100644
--- a/source/Cosmos.System2_Plugs/System/IO/CosmosFileSystemInfo.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/FileSystemInfoImpl.cs
@@ -14,12 +14,12 @@
namespace Cosmos.System_Plugs.System.IO
{
[Plug(Target = typeof(FileSystemInfo))]
- public static class CosmosFileSystemInfo
+ public static class FileSystemInfoImpl
{
[PlugMethod(Signature = "System_Boolean__System_IO_FileSystemInfo_System_IO_IFileSystemObject_get_Exists__")]
public static bool get_Exists(FileSystemInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"FileSystemInfo.get_Exists : fullPath = {aThis.FullName}");
+ Global.Debugger.SendInternal($"FileSystemInfo.get_Exists : fullPath = {aThis.FullName}");
// TODO we have to find if 'aThis' is a DirectoryInfo or a FileInfo to decide what method to call
if (aThis is DirectoryInfo)
{
@@ -33,13 +33,13 @@ public static bool get_Exists(FileSystemInfo aThis)
public static FileAttributes get_Attributes(FileSystemInfo aThis)
{
- Global.mFileSystemDebugger.SendInternal($"FileSystemInfo.get_Attributes : fullPath = {aThis.FullName}");
+ Global.Debugger.SendInternal($"FileSystemInfo.get_Attributes : fullPath = {aThis.FullName}");
return VFSManager.GetFileAttributes(aThis.FullName);
}
public static void set_Attributes(FileSystemInfo aThis, FileAttributes value)
{
- Global.mFileSystemDebugger.SendInternal($"FileSystemInfo.set_Attributes : fullPath = {aThis.FullName} value {(int) value}");
+ Global.Debugger.SendInternal($"FileSystemInfo.set_Attributes : fullPath = {aThis.FullName} value {(int) value}");
VFSManager.SetFileAttributes(aThis.FullName, value);
}
}
diff --git a/source/Cosmos.System2_Plugs/System/IO/PathImpl.cs b/source/Cosmos.System2_Plugs/System/IO/PathImpl.cs
index e39aa9e6ab..bb7c19fb4b 100644
--- a/source/Cosmos.System2_Plugs/System/IO/PathImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/PathImpl.cs
@@ -1,14 +1,7 @@
-//#define COSMOSDEBUG
-using System;
-using System.IO;
+using Cosmos.System.FileSystem.VFS;
using Cosmos.System;
-using Cosmos.Common;
-using Cosmos.Debug.Kernel;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
-using Cosmos.System.FileSystem;
-using Cosmos.System.FileSystem.VFS;
-using System.Text;
+using IL2CPU.API;
namespace Cosmos.System_Plugs.System.IO
{
@@ -37,7 +30,7 @@ public static string ChangeExtension(string aPath, string aExtension)
char xC = aPath[xNum];
if (xC == '.')
{
- xText = aPath.Substring(0, xNum);
+ xText = aPath[..xNum];
break;
}
if (xC == Path.DirectorySeparatorChar || xC == Path.AltDirectorySeparatorChar
@@ -54,7 +47,7 @@ public static string ChangeExtension(string aPath, string aExtension)
}
xText += aExtension;
}
- Global.mFileSystemDebugger.SendInternal($"Path.ChangeExtension : aPath = {aPath}, aExtension = {aExtension}, returning {xText}");
+ Global.Debugger.SendInternal($"Path.ChangeExtension : aPath = {aPath}, aExtension = {aExtension}, returning {xText}");
return xText;
}
return null;
@@ -62,7 +55,7 @@ public static string ChangeExtension(string aPath, string aExtension)
public static string Combine(string aPath1, string aPath2)
{
- if (aPath1 == null || aPath2 == null)
+ if (string.IsNullOrEmpty(aPath1) || string.IsNullOrEmpty(aPath2))
{
throw new ArgumentNullException(aPath1 == null ? "path1" : "path2");
}
@@ -70,7 +63,7 @@ public static string Combine(string aPath1, string aPath2)
CheckInvalidPathChars(aPath1);
CheckInvalidPathChars(aPath2);
string result = CombineNoChecks(aPath1, aPath2);
- Global.mFileSystemDebugger.SendInternal($"Path.Combine : aPath1 = {aPath1}, aPath2 = {aPath2}, returning {result}");
+ Global.Debugger.SendInternal($"Path.Combine : aPath1 = {aPath1}, aPath2 = {aPath2}, returning {result}");
return result;
}
@@ -78,39 +71,38 @@ private static string CombineNoChecks(string aPath1, string aPath2)
{
if (aPath2.Length == 0)
{
- Global.mFileSystemDebugger.SendInternal($"Path.CombineNoChecks : aPath2 has 0 length, returning {aPath1}");
+ Global.Debugger.SendInternal($"Path.CombineNoChecks : aPath2 has 0 length, returning {aPath1}");
return aPath1;
}
-
if (aPath1.Length == 0)
{
- Global.mFileSystemDebugger.SendInternal($"Path.CombineNoChecks : aPath1 has 0 length, returning {aPath2}");
+ Global.Debugger.SendInternal($"Path.CombineNoChecks : aPath1 has 0 length, returning {aPath2}");
return aPath2;
}
-
if (IsPathRooted(aPath2))
{
- Global.mFileSystemDebugger.SendInternal($"Path.CombineNoChecks : aPath2 is root, returning {aPath2}");
+ Global.Debugger.SendInternal($"Path.CombineNoChecks : aPath2 is root, returning {aPath2}");
return aPath2;
}
- string xResult = string.Empty;
- char xC = aPath1[aPath1.Length - 1];
+ char xC = aPath1[^1];
+ string result;
+
if (xC != Path.DirectorySeparatorChar && xC != Path.AltDirectorySeparatorChar && xC != Path.VolumeSeparatorChar)
{
- xResult = string.Concat(aPath1, "\\", aPath2);
- Global.mFileSystemDebugger.SendInternal($"Path.CombineNoChecks : aPath1 = {aPath1}, aPath2 = {aPath2}, returning {xResult}");
- return xResult;
+ result = string.Concat(aPath1, "\\", aPath2);
+ Global.Debugger.SendInternal($"Path.CombineNoChecks : aPath1 = {aPath1}, aPath2 = {aPath2}, returning {result}");
+ return result;
}
- xResult = string.Concat(aPath1, aPath2);
- Global.mFileSystemDebugger.SendInternal($"Path.CombineNoChecks : aPath1 = {aPath1}, aPath2 = {aPath2}, returning {xResult}");
- return xResult;
+ result = string.Concat(aPath1, aPath2);
+ Global.Debugger.SendInternal($"Path.CombineNoChecks : aPath1 = {aPath1}, aPath2 = {aPath2}, returning {result}");
+ return result;
}
public static string GetExtension(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("Path.GetExtension");
+ Global.Debugger.SendInternal("Path.GetExtension");
if (aPath == null)
{
@@ -144,7 +136,7 @@ public static string GetExtension(string aPath)
public static string GetFileName(string aPath)
{
- Global.mFileSystemDebugger.SendInternal($"Path.GetFileName : aPath = {aPath}");
+ Global.Debugger.SendInternal($"Path.GetFileName : aPath = {aPath}");
if (aPath != null)
{
CheckInvalidPathChars(aPath);
@@ -161,29 +153,29 @@ public static string GetFileName(string aPath)
}
}
- Global.mFileSystemDebugger.SendInternal($"Path.GetFileName : returning {aPath}");
+ Global.Debugger.SendInternal($"Path.GetFileName : returning {aPath}");
return aPath;
}
public static string GetFileNameWithoutExtension(string aPath)
{
- Global.mFileSystemDebugger.SendInternal($"Path.GetFileNameWithoutExtension : aPath = {aPath}");
+ Global.Debugger.SendInternal($"Path.GetFileNameWithoutExtension : aPath = {aPath}");
aPath = GetFileName(aPath);
if (aPath == null)
{
- Global.mFileSystemDebugger.SendInternal($"Path.GetFileNameWithoutExtension : returning null");
+ Global.Debugger.SendInternal($"Path.GetFileNameWithoutExtension : returning null");
return null;
}
int xLength;
if ((xLength = aPath.LastIndexOf('.')) == -1)
{
- Global.mFileSystemDebugger.SendInternal($"Path.GetFileNameWithoutExtension : returning {aPath}");
+ Global.Debugger.SendInternal($"Path.GetFileNameWithoutExtension : returning {aPath}");
return aPath;
}
string xResult = aPath.Substring(0, xLength);
- Global.mFileSystemDebugger.SendInternal($"Path.GetFileNameWithoutExtension : returning {xResult}");
+ Global.Debugger.SendInternal($"Path.GetFileNameWithoutExtension : returning {xResult}");
return xResult;
}
@@ -192,12 +184,12 @@ public static string GetFullPath(string aPath)
{
if (aPath == null)
{
- Global.mFileSystemDebugger.SendInternal($"Path.GetFullPath : aPath is null");
+ Global.Debugger.SendInternal($"Path.GetFullPath : aPath is null");
throw new ArgumentNullException("aPath");
}
string result = NormalizePath(aPath, true);
- Global.mFileSystemDebugger.SendInternal($"Path.GetFullPath : aPath = {aPath}, returning {result}");
+ Global.Debugger.SendInternal($"Path.GetFullPath : aPath = {aPath}, returning {result}");
return result;
}
@@ -215,7 +207,7 @@ public static string GetPathRoot(string aPath)
{
if (aPath == null)
{
- Global.mFileSystemDebugger.SendInternal($"Path.GetPathRoot : aPath is null");
+ Global.Debugger.SendInternal($"Path.GetPathRoot : aPath is null");
throw new ArgumentNullException(nameof(aPath));
}
@@ -227,7 +219,7 @@ public static string GetPathRoot(string aPath)
xResult = string.Concat(xResult, Path.DirectorySeparatorChar);
}
- Global.mFileSystemDebugger.SendInternal($"Path.GetPathRoot : aPath = {aPath}, xResult = {xResult}");
+ Global.Debugger.SendInternal($"Path.GetPathRoot : aPath = {aPath}, xResult = {xResult}");
return xResult;
}
@@ -321,7 +313,7 @@ static bool IsDirectorySeparator(char aC)
public static bool IsPathRooted(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("Path.IsPathRooted");
+ Global.Debugger.SendInternal("Path.IsPathRooted");
if (aPath != null)
{
@@ -338,7 +330,7 @@ public static bool IsPathRooted(string aPath)
private static bool IsRelative(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("-- Path.IsRelative -- aPath = " + aPath);
+ Global.Debugger.SendInternal("-- Path.IsRelative -- aPath = " + aPath);
if (aPath == null)
{
throw new ArgumentNullException("aPath");
@@ -369,15 +361,15 @@ private static bool IsRelative(string aPath)
internal static void CheckInvalidPathChars(string aPath, bool aCheckAdditional = false)
{
- Global.mFileSystemDebugger.SendInternal("Path.CheckInvalidPathChars");
+ Global.Debugger.SendInternal("Path.CheckInvalidPathChars");
if (aPath == null)
{
throw new ArgumentNullException("aPath");
}
- Global.mFileSystemDebugger.SendInternal("aPath =");
- Global.mFileSystemDebugger.SendInternal(aPath);
+ Global.Debugger.SendInternal("aPath =");
+ Global.Debugger.SendInternal(aPath);
var xChars = VFSManager.GetRealInvalidPathChars();
@@ -392,12 +384,12 @@ internal static void CheckInvalidPathChars(string aPath, bool aCheckAdditional =
public static string GetDirectoryName(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("Path.GetDirectoryName");
+ Global.Debugger.SendInternal("Path.GetDirectoryName");
if (aPath != null)
{
- Global.mFileSystemDebugger.SendInternal("aPath =");
- Global.mFileSystemDebugger.SendInternal(aPath);
+ Global.Debugger.SendInternal("aPath =");
+ Global.Debugger.SendInternal(aPath);
CheckInvalidPathChars(aPath);
string xText = NormalizePath(aPath, false);
@@ -447,8 +439,8 @@ public static string GetDirectoryName(string aPath)
internal static int GetRootLength(string aPath)
{
- Global.mFileSystemDebugger.SendInternal("Path.GetRootLength");
- Global.mFileSystemDebugger.SendInternal("aPath =" + aPath);
+ Global.Debugger.SendInternal("Path.GetRootLength");
+ Global.Debugger.SendInternal("aPath =" + aPath);
int i = 0;
int xLength = aPath.Length;
@@ -482,11 +474,11 @@ internal static int GetRootLength(string aPath)
static string NormalizePath(string aPath, bool aFullCheck)
{
- Global.mFileSystemDebugger.SendInternal("-- Path.NormalizePath -- aPath = " + aPath);
+ Global.Debugger.SendInternal("-- Path.NormalizePath -- aPath = " + aPath);
if (aPath == null)
{
- Global.mFileSystemDebugger.SendInternal("aPath is null");
+ Global.Debugger.SendInternal("aPath is null");
throw new ArgumentNullException("aPath");
}
@@ -494,23 +486,23 @@ static string NormalizePath(string aPath, bool aFullCheck)
if (IsRelative(result))
{
result = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + result;
- Global.mFileSystemDebugger.SendInternal("aPath is relative");
- Global.mFileSystemDebugger.SendInternal("aPath =" + aPath);
- Global.mFileSystemDebugger.SendInternal("result = " + result);
+ Global.Debugger.SendInternal("aPath is relative");
+ Global.Debugger.SendInternal("aPath =" + aPath);
+ Global.Debugger.SendInternal("result = " + result);
}
if (IsDirectorySeparator(result[result.Length - 1]))
{
- Global.mFileSystemDebugger.SendInternal("Found directory seprator");
+ Global.Debugger.SendInternal("Found directory seprator");
if (result.Length > 3)
{
result = result.Remove(result.Length - 1);
}
}
- Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
- Global.mFileSystemDebugger.SendInternal("result = " + result);
+ Global.Debugger.SendInternal("aPath = " + aPath);
+ Global.Debugger.SendInternal("result = " + result);
return result;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/PathInternalImpl.cs b/source/Cosmos.System2_Plugs/System/IO/PathInternalImpl.cs
index 56a060fbfd..bf406c87bc 100644
--- a/source/Cosmos.System2_Plugs/System/IO/PathInternalImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/PathInternalImpl.cs
@@ -1,10 +1,4 @@
-//#define COSMOSDEBUG
-
-using System;
-using System.IO;
-
-using IL2CPU.API.Attribs;
-
+using IL2CPU.API.Attribs;
using Cosmos.System;
namespace Cosmos.System_Plugs.System.IO
@@ -19,7 +13,7 @@ public static class PathInternalImpl
*/
public static bool GetIsCaseSensitive()
{
- Global.mFileSystemDebugger.SendInternal($"GetIsCaseSensitive() called false always returned");
+ Global.Debugger.SendInternal($"GetIsCaseSensitive() called false always returned");
return false;
}
@@ -29,4 +23,4 @@ public static bool IsRoot(ReadOnlySpan path) =>
|| (path.Length == 3 && path[1] == Path.VolumeSeparatorChar
&& (path[2] == Path.DirectorySeparatorChar || path[2] == Path.AltDirectorySeparatorChar));
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/StreamReaderImpl.cs b/source/Cosmos.System2_Plugs/System/IO/StreamReaderImpl.cs
index d5e285d773..e2410652c1 100644
--- a/source/Cosmos.System2_Plugs/System/IO/StreamReaderImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/StreamReaderImpl.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
{
@@ -15,4 +9,4 @@ public static void CheckAsyncTaskInProgress(StreamReader aThis)
{
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/StreamWriterImpl.cs b/source/Cosmos.System2_Plugs/System/IO/StreamWriterImpl.cs
index a5c5d55383..2fbd8dd1bc 100644
--- a/source/Cosmos.System2_Plugs/System/IO/StreamWriterImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/StreamWriterImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using Cosmos.Debug.Kernel;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
{
@@ -11,6 +6,5 @@ namespace Cosmos.System_Plugs.System.IO
public static class StreamWriterImpl
{
public static void CheckAsyncTaskInProgress(StreamWriter aThis) { }
-
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/TextWriterImpl.cs b/source/Cosmos.System2_Plugs/System/IO/TextWriterImpl.cs
index 87204c1692..ce8e039426 100644
--- a/source/Cosmos.System2_Plugs/System/IO/TextWriterImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/TextWriterImpl.cs
@@ -1,7 +1,4 @@
-//#define COSMOSDEBUG
-using System;
-using System.IO;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.IO
{
@@ -13,4 +10,4 @@ public static void Ctor(TextWriter aThis, [FieldAccess(Name = "System.Char[] Sys
CoreNewLine = Environment.NewLine.ToCharArray();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IO/UnmanagedMemoryStreamImpl.cs b/source/Cosmos.System2_Plugs/System/IO/UnmanagedMemoryStreamImpl.cs
index 7dc45063dd..858957b8fd 100644
--- a/source/Cosmos.System2_Plugs/System/IO/UnmanagedMemoryStreamImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IO/UnmanagedMemoryStreamImpl.cs
@@ -63,4 +63,4 @@ public static int ReadByte(this UnmanagedMemoryStream aStream)
return aStream.PositionPointer[aStream.Position++];
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Int16Impl.cs b/source/Cosmos.System2_Plugs/System/Int16Impl.cs
index 090c6038e9..1904c84ed8 100644
--- a/source/Cosmos.System2_Plugs/System/Int16Impl.cs
+++ b/source/Cosmos.System2_Plugs/System/Int16Impl.cs
@@ -1,8 +1,5 @@
-using System;
using System.Globalization;
-
using Cosmos.Common;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -62,4 +59,4 @@ public static short Parse(string s)
return result;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Int32Impl.cs b/source/Cosmos.System2_Plugs/System/Int32Impl.cs
index 27ca54ca6e..312521355b 100644
--- a/source/Cosmos.System2_Plugs/System/Int32Impl.cs
+++ b/source/Cosmos.System2_Plugs/System/Int32Impl.cs
@@ -1,7 +1,4 @@
-using System;
-
using Cosmos.Common;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -108,7 +105,7 @@ public static bool TryParse(string s, out int result)
{
try
{
- result = Int32.Parse(s);
+ result = int.Parse(s);
return true;
}
catch
@@ -118,4 +115,4 @@ public static bool TryParse(string s, out int result)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Int64Impl.cs b/source/Cosmos.System2_Plugs/System/Int64Impl.cs
index cca60842b1..aa334ec455 100644
--- a/source/Cosmos.System2_Plugs/System/Int64Impl.cs
+++ b/source/Cosmos.System2_Plugs/System/Int64Impl.cs
@@ -1,7 +1,4 @@
-using System;
-
using Cosmos.Common;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -53,4 +50,4 @@ public static long Parse(string s)
return result;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/IntPtrImpl.cs b/source/Cosmos.System2_Plugs/System/IntPtrImpl.cs
index b5a3aad156..e1e0853da3 100644
--- a/source/Cosmos.System2_Plugs/System/IntPtrImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/IntPtrImpl.cs
@@ -1,6 +1,5 @@
-using System;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
+using IL2CPU.API;
namespace Cosmos.System_Plugs.System
{
@@ -10,13 +9,12 @@ public static class IntPtrImpl
// //[PlugMethod(Signature="System_String___System_IntPtr_ToString____")]
public static string ToString(IntPtr aThis)
{
- return "";
+ return aThis.ToInt64().ToString();
}
- //}
public static int GetHashCode(ref IntPtr aThis)
{
return (int)aThis;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/MathImpl.cs b/source/Cosmos.System2_Plugs/System/MathImpl.cs
index f0ef730963..70943c5a24 100644
--- a/source/Cosmos.System2_Plugs/System/MathImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/MathImpl.cs
@@ -1,7 +1,6 @@
-using System;
using Cosmos.Debug.Kernel;
-using IL2CPU.API;
using IL2CPU.API.Attribs;
+using IL2CPU.API;
namespace Cosmos.System_Plugs.System
{
@@ -21,7 +20,7 @@ public static class MathImpl
//Following functions which have been implemented in this file are functions taken from http://www.netlib.org/fdlibm/ and have then be changed to work in C#
//Acos, Asin, Cos, _cos, __ieee754_rem_pio2, __kernel_rem_pio2, Scalbn, Log base e, Sin, _sin, exp, atan
- internal static Debugger mDebugger = new Debugger("System", "Math Plugs");
+ internal static Debugger mDebugger = new("Math");
#region Internal Constants
@@ -1692,4 +1691,4 @@ private static int LowWord(double x) //Opposite of high word
#endregion Internaly used functions
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/ParseNumbersImpl.cs b/source/Cosmos.System2_Plugs/System/ParseNumbersImpl.cs
index 1b712789f3..d5546cfb59 100644
--- a/source/Cosmos.System2_Plugs/System/ParseNumbersImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/ParseNumbersImpl.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Cosmos.Common.Extensions;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
@@ -65,4 +61,4 @@ public static string IntToString(int value, int radix, int width, char paddingCh
return valueString;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/RandomImpl.cs b/source/Cosmos.System2_Plugs/System/RandomImpl.cs
index 78f9d5f03c..368d989531 100644
--- a/source/Cosmos.System2_Plugs/System/RandomImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/RandomImpl.cs
@@ -1,6 +1,4 @@
-using System;
using IL2CPU.API.Attribs;
-using Cosmos.HAL;
namespace Cosmos.System_Plugs.System
{
@@ -14,9 +12,9 @@ public static class RandomImpl
//
// Private Constants
//
- private const int MBIG = Int32.MaxValue;
- private const int MSEED = 161803398;
- private const int MZ = 0;
+ private const int mBIG = int.MaxValue;
+ private const int mSEED = 161803398;
+ private const int mZ = 0;
private static int counter = 0;
//
@@ -24,7 +22,7 @@ public static class RandomImpl
//
private static int inext;
private static int inextp;
- private static int[] SeedArray = new int[56];
+ private static readonly int[] seedArray = new int[56];
public static void Ctor(Random aThis)
@@ -39,42 +37,41 @@ public static void Ctor(Random aThis, int seed)
//Initialize our Seed array.
//This algorithm comes from Numerical Recipes in C (2nd Ed.)
- int subtraction = seed == Int32.MinValue ? Int32.MaxValue : Math.Abs(seed);
- var mj = MSEED - subtraction;
- SeedArray[55] = mj;
+ int subtraction = seed == int.MinValue ? int.MaxValue : Math.Abs(seed);
+ var mj = mSEED - subtraction;
+ seedArray[55] = mj;
var mk = 1;
for (int i = 1; i < 55; i++)
{ //Apparently the range [1..55] is special (Knuth) and so we're wasting the 0'th position.
ii = 21 * i % 55;
- SeedArray[ii] = mk;
+ seedArray[ii] = mk;
mk = mj - mk;
if (mk < 0)
{
- mk += MBIG;
+ mk += mBIG;
}
- mj = SeedArray[ii];
+ mj = seedArray[ii];
}
for (int k = 1; k < 5; k++)
{
for (int i = 1; i < 56; i++)
{
- SeedArray[i] -= SeedArray[1 + (i + 30) % 55];
- if (SeedArray[i] < 0)
+ seedArray[i] -= seedArray[1 + (i + 30) % 55];
+ if (seedArray[i] < 0)
{
- SeedArray[i] += MBIG;
+ seedArray[i] += mBIG;
}
}
}
inext = 0;
inextp = 21;
- seed = 1;
}
private static double Sample()
{
//Including this division at the end gives us significantly improved
//random number distribution.
- return InternalSample() * (1.0 / MBIG);
+ return InternalSample() * (1.0 / mBIG);
}
private static int InternalSample()
@@ -91,18 +88,18 @@ private static int InternalSample()
locINextp = 1;
}
- var retVal = SeedArray[locINext] - SeedArray[locINextp];
+ var retVal = seedArray[locINext] - seedArray[locINextp];
- if (retVal == MBIG)
+ if (retVal == mBIG)
{
retVal--;
}
if (retVal < 0)
{
- retVal += MBIG;
+ retVal += mBIG;
}
- SeedArray[locINext] = retVal;
+ seedArray[locINext] = retVal;
inext = locINext;
inextp = locINextp;
@@ -139,8 +136,8 @@ private static double GetSampleForLargeRange()
result = -result;
}
double d = result;
- d += Int32.MaxValue - 1; // get a number in range [0 .. 2 * Int32MaxValue - 1)
- d /= 2 * (uint)Int32.MaxValue - 1;
+ d += int.MaxValue - 1; // get a number in range [0 .. 2 * Int32MaxValue - 1)
+ d /= 2 * (uint)int.MaxValue - 1;
return d;
}
@@ -152,7 +149,7 @@ public static int Next(Random aThis, int minValue, int maxValue)
}
long range = (long)maxValue - minValue;
- if (range <= (long)Int32.MaxValue)
+ if (range <= int.MaxValue)
{
return (int)(Sample() * range) + minValue;
}
@@ -171,7 +168,7 @@ public static void NextBytes(Random aThis, byte[] buffer)
for (int i = 0; i < buffer.Length; i++)
{
- buffer[i] = (byte)(InternalSample() % (Byte.MaxValue + 1));
+ buffer[i] = (byte)(InternalSample() % (byte.MaxValue + 1));
}
}
@@ -184,12 +181,12 @@ private static int GenerateSeed()
{
counter++;
- if (counter == Int32.MaxValue - 1)
+ if (counter == int.MaxValue - 1)
{
counter = 0;
}
- return counter + (int)(Cosmos.Core.CPU.GetCPUUptime() / 50) * 1000;
+ return counter + (int)(Core.CPU.GetCPUUptime() / 50) * 1000;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Reflection/AssemblyImpl.cs b/source/Cosmos.System2_Plugs/System/Reflection/AssemblyImpl.cs
index 13898210f5..df9a86c783 100644
--- a/source/Cosmos.System2_Plugs/System/Reflection/AssemblyImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Reflection/AssemblyImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
+using System.Reflection;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Reflection
@@ -16,4 +11,4 @@ public static object[] GetCustomAttributes(Assembly aThis, Type aType, bool aBoo
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Reflection/RuntimeConstructorInfoImpl.cs b/source/Cosmos.System2_Plugs/System/Reflection/RuntimeConstructorInfoImpl.cs
index 0ba150dcd6..3bdcaed09d 100644
--- a/source/Cosmos.System2_Plugs/System/Reflection/RuntimeConstructorInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Reflection/RuntimeConstructorInfoImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
+using System.Reflection;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Reflection
@@ -26,4 +21,4 @@ public static ParameterInfo[] GetParametersNoCopy(object aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Reflection/RuntimeMethodInfoImpl.cs b/source/Cosmos.System2_Plugs/System/Reflection/RuntimeMethodInfoImpl.cs
index dd7910f115..8189be6f60 100644
--- a/source/Cosmos.System2_Plugs/System/Reflection/RuntimeMethodInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Reflection/RuntimeMethodInfoImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
+using System.Reflection;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Reflection
@@ -41,4 +36,4 @@ public static ParameterInfo[] GetParameters(object aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Reflection/RuntimePropertyInfoImpl.cs b/source/Cosmos.System2_Plugs/System/Reflection/RuntimePropertyInfoImpl.cs
index 5b5ab0f9f2..785013ff2f 100644
--- a/source/Cosmos.System2_Plugs/System/Reflection/RuntimePropertyInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Reflection/RuntimePropertyInfoImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Reflection
{
@@ -15,4 +10,4 @@ public static string ToString(object aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Resources/ManifestBasedResourceGrovelerImpl.cs b/source/Cosmos.System2_Plugs/System/Resources/ManifestBasedResourceGrovelerImpl.cs
index a94953c779..22c1d45548 100644
--- a/source/Cosmos.System2_Plugs/System/Resources/ManifestBasedResourceGrovelerImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Resources/ManifestBasedResourceGrovelerImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Resources
{
@@ -21,4 +16,4 @@ public static void HandleSatelliteMissing(object aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Runtime/CompilerServicesImpl.cs b/source/Cosmos.System2_Plugs/System/Runtime/CompilerServicesImpl.cs
index 8fef80ec89..16ee30f766 100644
--- a/source/Cosmos.System2_Plugs/System/Runtime/CompilerServicesImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Runtime/CompilerServicesImpl.cs
@@ -13,4 +13,4 @@ public static int get_OffsetToStringData()
return 16;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Runtime/InteropServices/SafeHandleImpl.cs b/source/Cosmos.System2_Plugs/System/Runtime/InteropServices/SafeHandleImpl.cs
index fbf6adbc47..3e65f2ce65 100644
--- a/source/Cosmos.System2_Plugs/System/Runtime/InteropServices/SafeHandleImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Runtime/InteropServices/SafeHandleImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
+using System.Runtime.InteropServices;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Runtime.InteropServices
@@ -21,4 +16,4 @@ public static void Dispose(SafeHandle aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/SByteImpl.cs b/source/Cosmos.System2_Plugs/System/SByteImpl.cs
index 4f43b0bd89..7356b9128b 100644
--- a/source/Cosmos.System2_Plugs/System/SByteImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/SByteImpl.cs
@@ -1,7 +1,4 @@
-using System;
-
using Cosmos.Common;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -13,4 +10,4 @@ public static class SByteImpl
public static string ToString(ref sbyte aThis, string format, IFormatProvider provider) => aThis.ToString();
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/SingleImpl.cs b/source/Cosmos.System2_Plugs/System/SingleImpl.cs
index 2099defbdc..eb30eea84a 100644
--- a/source/Cosmos.System2_Plugs/System/SingleImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/SingleImpl.cs
@@ -1,6 +1,4 @@
-using System;
using Cosmos.Common;
-using System.Collections.Generic;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -116,4 +114,4 @@ public static bool TryParse(string s, out float result)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Text/CodePage.cs b/source/Cosmos.System2_Plugs/System/Text/CodePage.cs
new file mode 100644
index 0000000000..81a4ab3250
--- /dev/null
+++ b/source/Cosmos.System2_Plugs/System/Text/CodePage.cs
@@ -0,0 +1,13 @@
+namespace Cosmos.System_Plugs.System.Text
+{
+ public enum CodePage
+ {
+ CodePageASCII = 20127,
+ CodePageUTF7 = 65000,
+ CodePageUTF8 = 65001,
+ CodePageUnicode = 1200,
+ CodePageBigEndian = 1201,
+ CodePageUTF32 = 12000,
+ CodePageUTF32BE = 12001
+ };
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Text/DecoderReplacementFallbackBufferImpl.cs b/source/Cosmos.System2_Plugs/System/Text/DecoderReplacementFallbackBufferImpl.cs
index 375dee74c2..1660425b15 100644
--- a/source/Cosmos.System2_Plugs/System/Text/DecoderReplacementFallbackBufferImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Text/DecoderReplacementFallbackBufferImpl.cs
@@ -1,7 +1,6 @@
-using System;
-using System.Text;
-using Cosmos.Debug.Kernel;
+using Cosmos.Debug.Kernel;
using IL2CPU.API.Attribs;
+using System.Text;
namespace Cosmos.System_Plugs.System.Text
{
@@ -10,11 +9,10 @@ public static class DecoderReplacementFallbackBufferImpl
{
public static bool Fallback(DecoderReplacementFallbackBuffer aThis, byte[] bytesUnknown, int index)
{
- Debugger debugger = new Debugger("SystemPlugs", "Decoder");
- debugger.Send("Fallback NotImplemented!!!");
+ Debugger debugger = new("Decoder");
debugger.Send("Fallback NotImplemented!!!");
Debugger.DoBochsBreak();
throw new NotImplementedException("DecoderExceptionFallbackBuffer Fallback()");
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Text/EncodingImpl.cs b/source/Cosmos.System2_Plugs/System/Text/EncodingImpl.cs
index f9eb25ca82..223a0fe16b 100644
--- a/source/Cosmos.System2_Plugs/System/Text/EncodingImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Text/EncodingImpl.cs
@@ -1,10 +1,6 @@
-//#define COSMOSDEBUG
-
-using System.Text;
-
-using Cosmos.Debug.Kernel;
-
+using Cosmos.Debug.Kernel;
using IL2CPU.API.Attribs;
+using System.Text;
/* This plug is needed only because Cosmos does not support Hashtable :-( */
namespace Cosmos.System_Plugs.System.Text
@@ -12,50 +8,31 @@ namespace Cosmos.System_Plugs.System.Text
[Plug(Target = typeof(Encoding))]
public static class EncodingImpl
{
- private static Debugger mDebugger = new Debugger("System", "Encoding");
-
- enum cp {
- CodePageASCII = 20127,
- CodePageUTF7 = 65000,
- CodePageUTF8 = 65001,
- CodePageUnicode = 1200,
- CodePageBigEndian = 1201,
- CodePageUTF32 = 12000,
- CodePageUTF32BE = 12001
- };
+ #region Methods
public static string get_BodyName(Encoding aThis)
{
- mDebugger.SendInternal($"Get Body name for {aThis.CodePage}");
+ debugger.SendInternal($"Get Body name for {aThis.CodePage}");
- cp cp = (cp) aThis.CodePage;
- switch (cp)
+ return (CodePage)aThis.CodePage switch
{
- case cp.CodePageASCII:
- return "us-ascii";
-
- case cp.CodePageUTF7:
- return "UTF-7";
-
- case cp.CodePageUTF8:
- return "UTF-8";
-
- case cp.CodePageUnicode:
- return "utf-16";
+ CodePage.CodePageASCII => "us-ascii",
+ CodePage.CodePageUTF7 => "UTF-7",
+ CodePage.CodePageUTF8 => "UTF-8",
+ CodePage.CodePageUnicode => "utf-16",
+ CodePage.CodePageBigEndian => "utf-16BE",
+ CodePage.CodePageUTF32 => "utf-32",
+ CodePage.CodePageUTF32BE => "utf-32BE",
+ _ => "null",
+ };
+ }
- case cp.CodePageBigEndian:
- return "utf-16BE";
+ #endregion
- case cp.CodePageUTF32:
- return "utf-32";
+ #region Fields
- case cp.CodePageUTF32BE:
- return "utf-32BE";
+ private static readonly Debugger debugger = new("Encoding");
- default:
- return "null";
- }
- }
+ #endregion
}
-}
-
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Text/EncodingTableImpl.cs b/source/Cosmos.System2_Plugs/System/Text/EncodingTableImpl.cs
index 163f47fa06..f9e0426b8d 100644
--- a/source/Cosmos.System2_Plugs/System/Text/EncodingTableImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Text/EncodingTableImpl.cs
@@ -1,9 +1,4 @@
-//#define COSMOSDEBUG
-
-using System;
-
-using Cosmos.Debug.Kernel;
-
+using Cosmos.Debug.Kernel;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Globalization
@@ -12,7 +7,7 @@ namespace Cosmos.System_Plugs.System.Globalization
[Plug("System.Text.EncodingTable, System.Private.CoreLib")]
public static class EncodingTableImpl
{
- private static Debugger mDebugger = new Debugger("System", "SingleByteEncoding");
+ #region Methods
/*
* This is Table is pratically empty in Net Core, but instatiate a Dictionary that Cosmos yet does not
@@ -24,14 +19,22 @@ public static void Cctor()
public static object GetCodePageDataItem(int codepage)
{
- mDebugger.SendInternal($"GetCodePageDataItem for codepage {codepage}");
+ debugger.SendInternal($"GetCodePageDataItem for codepage {codepage}");
return null;
}
public static int GetCodePageFromName(string name)
{
- mDebugger.SendInternal($"GetCodePageFromName for name {name}");
+ debugger.SendInternal($"GetCodePageFromName for name {name}");
return -1;
}
+
+ #endregion
+
+ #region Fields
+
+ private static readonly Debugger debugger = new("SingleByteEncoding");
+
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Threading/CancellationTokenSourceImpl.cs b/source/Cosmos.System2_Plugs/System/Threading/CancellationTokenSourceImpl.cs
index 03db5efabc..4a0f4afa5e 100644
--- a/source/Cosmos.System2_Plugs/System/Threading/CancellationTokenSourceImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Threading/CancellationTokenSourceImpl.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Threading
{
@@ -20,4 +14,4 @@ public static void Dispose(CancellationTokenSource aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Threading/SpinWaitImpl.cs b/source/Cosmos.System2_Plugs/System/Threading/SpinWaitImpl.cs
index f0e952ed46..e56500a49d 100644
--- a/source/Cosmos.System2_Plugs/System/Threading/SpinWaitImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Threading/SpinWaitImpl.cs
@@ -1,10 +1,7 @@
-using System;
-using System.Threading;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Threading
{
- //[Plug(Target = typeof(global::System.Threading.SpinWait))]
[Plug(Target = typeof(SpinWait))]
public static class SpinWaitImpl
{
@@ -13,4 +10,4 @@ public static void SpinOnce(ref SpinWait aThis)
throw new NotImplementedException("SpinWait.SpinOnce()");
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Threading/ThreadImpl.cs b/source/Cosmos.System2_Plugs/System/Threading/ThreadImpl.cs
index 50fa47f75f..a5bafdb869 100644
--- a/source/Cosmos.System2_Plugs/System/Threading/ThreadImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Threading/ThreadImpl.cs
@@ -1,11 +1,9 @@
-using System;
-using System.Threading;
-using Cosmos.HAL;
using IL2CPU.API.Attribs;
+using Cosmos.HAL;
namespace Cosmos.System_Plugs.System.Threading
{
- [Plug(Target = typeof(global::System.Threading.Thread))]
+ [Plug(Target = typeof(Thread))]
public static class ThreadImpl
{
public static void Sleep(TimeSpan timeout)
@@ -53,4 +51,4 @@ public static void SpinWait(int aInt)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Threading/TimerImpl.cs b/source/Cosmos.System2_Plugs/System/Threading/TimerImpl.cs
new file mode 100644
index 0000000000..fdec5dd47d
--- /dev/null
+++ b/source/Cosmos.System2_Plugs/System/Threading/TimerImpl.cs
@@ -0,0 +1,97 @@
+#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
+#pragma warning disable IDE0060 // Remove unused parameter
+
+using static Cosmos.HAL.Global;
+using static Cosmos.HAL.PIT;
+using IL2CPU.API.Attribs;
+
+namespace Cosmos.System2_Plugs.System.Threading
+{
+ [Plug(Target = typeof(Timer))]
+ public static class TimerImpl
+ {
+ public static void Ctor(Timer context, TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
+ {
+ Ctor(context, callback, state, (long)dueTime.TotalMilliseconds, (long)period.TotalMilliseconds);
+ }
+
+ public static void Ctor(Timer context, TimerCallback callback, object? state, long dueTime, long period)
+ {
+ _CoreTimer = new(() => { callback.Invoke(state); }, (ulong)(dueTime * 1000000), true);
+
+ // Run time config.
+ Change(dueTime, period);
+ }
+
+ public static void Ctor(Timer context, TimerCallback callback, object? state, uint dueTime, uint period)
+ {
+ Ctor(context, callback, state, (long)dueTime, period);
+ }
+
+ public static void Ctor(Timer context, TimerCallback callback, object? state, int dueTime, int period)
+ {
+ Ctor(context, callback, state, (long)dueTime, period);
+ }
+
+ public static void Ctor(Timer context, TimerCallback callback)
+ {
+ Ctor(context, callback, null, (long)Timeout.Infinite, Timeout.Infinite);
+ }
+
+ #region Methods
+
+ public static void Change(TimeSpan dueTime, TimeSpan period)
+ {
+ Change((long)dueTime.TotalMilliseconds, (long)period.TotalMilliseconds);
+ }
+
+ public static void Change(long dueTime, long period)
+ {
+ // Check for issues.
+ if (_CoreTimer == null)
+ {
+ throw new NotImplementedException($"An implementation issue has occurred with {typeof(Timer).FullName}!");
+ }
+
+ if (dueTime != Timeout.Infinite && period != Timeout.Infinite && _CoreTimer.TimerID == -1)
+ {
+ PIT.RegisterTimer(_CoreTimer);
+ }
+ if ((dueTime == Timeout.Infinite || period == Timeout.Infinite) && _CoreTimer.TimerID != -1)
+ {
+ PIT.UnregisterTimer(_CoreTimer.TimerID);
+ }
+
+ _CoreTimer.NanosecondsTimeout = (ulong)(dueTime * 1000000);
+ }
+
+ public static void Change(uint dueTime, uint period)
+ {
+ Change((long)dueTime, period);
+ }
+
+ public static void Change(int dueTime, int period)
+ {
+ Change((long)dueTime, period);
+ }
+
+ public static void Dispose()
+ {
+ // Check for issues.
+ if (_CoreTimer == null)
+ {
+ throw new NotImplementedException($"An implementation issue has occurred with {typeof(Timer).FullName}!");
+ }
+
+ _CoreTimer.Dispose();
+ }
+
+ #endregion
+
+ #region Fields
+
+ private static PITTimer? _CoreTimer;
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/Threading/TimerQueueImpl.cs b/source/Cosmos.System2_Plugs/System/Threading/TimerQueueImpl.cs
index 72c26e22e3..1e091c6b9c 100644
--- a/source/Cosmos.System2_Plugs/System/Threading/TimerQueueImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/Threading/TimerQueueImpl.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Threading
{
@@ -18,4 +13,4 @@ public static bool ReleaseHandle(object aThis)
throw new NotImplementedException();
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/TimeSpanImpl.cs b/source/Cosmos.System2_Plugs/System/TimeSpanImpl.cs
index 1a155edd59..2b2825a63f 100644
--- a/source/Cosmos.System2_Plugs/System/TimeSpanImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/TimeSpanImpl.cs
@@ -1,6 +1,4 @@
-using System;
-
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
@@ -35,4 +33,4 @@ public static string ToString(ref TimeSpan aThis)
public static string ToString(ref TimeSpan aThis, string format, IFormatProvider provider) => aThis.ToString();
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/TimeZoneInfoImpl.cs b/source/Cosmos.System2_Plugs/System/TimeZoneInfoImpl.cs
index 5dc80791a4..e75e7ec21d 100644
--- a/source/Cosmos.System2_Plugs/System/TimeZoneInfoImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/TimeZoneInfoImpl.cs
@@ -1,5 +1,4 @@
-using System;
-using IL2CPU.API.Attribs;
+using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
@@ -17,4 +16,4 @@ public static string GetUtcStandardDisplayName()
return "Coordinated Universal Time";
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/UInt16Impl.cs b/source/Cosmos.System2_Plugs/System/UInt16Impl.cs
index 3e3acda19c..5e2ab3c8ce 100644
--- a/source/Cosmos.System2_Plugs/System/UInt16Impl.cs
+++ b/source/Cosmos.System2_Plugs/System/UInt16Impl.cs
@@ -1,7 +1,4 @@
-using System;
-
using Cosmos.Common;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -13,4 +10,4 @@ public static class UInt16Impl
public static string ToString(ref ushort aThis, string format, IFormatProvider provider) => aThis.ToString();
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/UInt32Impl.cs b/source/Cosmos.System2_Plugs/System/UInt32Impl.cs
index c6991f6455..f6f9e3cf78 100644
--- a/source/Cosmos.System2_Plugs/System/UInt32Impl.cs
+++ b/source/Cosmos.System2_Plugs/System/UInt32Impl.cs
@@ -1,7 +1,4 @@
-using System;
-
using Cosmos.Common;
-
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -13,4 +10,4 @@ public static class UInt32Impl
public static string ToString(ref uint aThis, string format, IFormatProvider provider) => aThis.ToString();
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/UInt64Impl.cs b/source/Cosmos.System2_Plugs/System/UInt64Impl.cs
index 0b3f9c2961..f9b017d523 100644
--- a/source/Cosmos.System2_Plugs/System/UInt64Impl.cs
+++ b/source/Cosmos.System2_Plugs/System/UInt64Impl.cs
@@ -1,9 +1,7 @@
-using System;
-
-using Cosmos.Common;
using Cosmos.Common.Extensions;
-using IL2CPU.API;
+using Cosmos.Common;
using IL2CPU.API.Attribs;
+using IL2CPU.API;
namespace Cosmos.System_Plugs.System
{
@@ -17,18 +15,12 @@ public static string ToString(ref ulong aThis)
public static string ToString(ref ulong aThis, string formating)
{
- if(formating == "X")
- {
- return ToHexString.ToHex(aThis, false);
- }
- else if(formating == "G")
- {
- return ToString(ref aThis);
- }
- else
+ return formating switch
{
- throw new NotImplementedException();
- }
+ "X" => ToHexString.ToHex(aThis, false),
+ "G" => ToString(ref aThis),
+ _ => throw new NotImplementedException(),
+ };
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/UIntPtrImpl.cs b/source/Cosmos.System2_Plugs/System/UIntPtrImpl.cs
index cae484450a..6291182dbd 100644
--- a/source/Cosmos.System2_Plugs/System/UIntPtrImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/UIntPtrImpl.cs
@@ -1,4 +1,3 @@
-using System;
using IL2CPU.API;
using IL2CPU.API.Attribs;
@@ -12,11 +11,10 @@ public static string ToString(UIntPtr aThis)
{
return "";
}
- //}
public static int GetHashCode(ref UIntPtr aThis)
{
return (int)aThis;
}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.System2_Plugs/System/ValueTypeImpl.cs b/source/Cosmos.System2_Plugs/System/ValueTypeImpl.cs
index 79ea2787b0..b68a6932d3 100644
--- a/source/Cosmos.System2_Plugs/System/ValueTypeImpl.cs
+++ b/source/Cosmos.System2_Plugs/System/ValueTypeImpl.cs
@@ -1,5 +1,3 @@
-using System;
-using Cosmos.Debug.Kernel;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
@@ -41,4 +39,4 @@ public static unsafe bool Equals(ValueType aThis, object obj) // value type is j
// return "";
//}
}
-}
+}
\ No newline at end of file
diff --git a/source/Cosmos.VS.DebugEngine/.editorconfig b/source/Cosmos.VS.DebugEngine/.editorconfig
deleted file mode 100644
index 2ea76fbf35..0000000000
--- a/source/Cosmos.VS.DebugEngine/.editorconfig
+++ /dev/null
@@ -1,6 +0,0 @@
-[*.cs]
-indent_size=4
-indent_style=space
-
-[AD7.Impl/AD7StackFrame.cs]
-indent_size=2
diff --git a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Enums.cs b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Enums.cs
index 3f7d80a9e7..8c34b1a61d 100644
--- a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Enums.cs
+++ b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Enums.cs
@@ -4,145 +4,181 @@
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Debugger.Interop;
-namespace Cosmos.VS.DebugEngine.AD7.Impl {
- #region Base Class
- class AD7Enum where I : class {
- readonly T[] m_data;
- uint m_position;
-
- public AD7Enum(T[] data) {
- m_data = data;
- m_position = 0;
- }
-
- public int Clone(out I ppEnum) {
- ppEnum = null;
- return VSConstants.E_NOTIMPL;
- }
-
- public int GetCount(out uint pcelt) {
- pcelt = (uint)m_data.Length;
- return VSConstants.S_OK;
- }
-
- public int Next(uint celt, T[] rgelt, out uint celtFetched) {
- return Move(celt, rgelt, out celtFetched);
- }
-
- public int Reset() {
- lock (this) {
- m_position = 0;
+namespace Cosmos.VS.DebugEngine.AD7.Impl
+{
+ #region Base Class
+ class AD7Enum where I : class
+ {
+ readonly T[] m_data;
+ uint m_position;
+
+ public AD7Enum(T[] data)
+ {
+ m_data = data;
+ m_position = 0;
+ }
- return VSConstants.S_OK;
- }
- }
+ public int Clone(out I ppEnum)
+ {
+ ppEnum = null;
+ return VSConstants.E_NOTIMPL;
+ }
- public int Skip(uint celt) {
- uint celtFetched;
+ public int GetCount(out uint pcelt)
+ {
+ pcelt = (uint)m_data.Length;
+ return VSConstants.S_OK;
+ }
- return Move(celt, null, out celtFetched);
- }
+ public int Next(uint celt, T[] rgelt, out uint celtFetched)
+ {
+ return Move(celt, rgelt, out celtFetched);
+ }
- private int Move(uint celt, T[] rgelt, out uint celtFetched) {
- lock (this) {
- int hr = VSConstants.S_OK;
- celtFetched = (uint)m_data.Length - m_position;
+ public int Reset()
+ {
+ lock (this)
+ {
+ m_position = 0;
- if (celt > celtFetched) {
- hr = VSConstants.S_FALSE;
- } else if (celt < celtFetched) {
- celtFetched = celt;
+ return VSConstants.S_OK;
+ }
}
- if (rgelt != null) {
- for (int c = 0; c < celtFetched; c++) {
- rgelt[c] = m_data[m_position + c];
- }
+ public int Skip(uint celt)
+ {
+ return Move(celt, null, out uint celtFetched);
}
- m_position += celtFetched;
-
- return hr;
- }
+ private int Move(uint celt, T[] rgelt, out uint celtFetched)
+ {
+ lock (this)
+ {
+ int hr = VSConstants.S_OK;
+ celtFetched = (uint)m_data.Length - m_position;
+
+ if (celt > celtFetched)
+ {
+ hr = VSConstants.S_FALSE;
+ }
+ else if (celt < celtFetched)
+ {
+ celtFetched = celt;
+ }
+
+ if (rgelt != null)
+ {
+ for (int c = 0; c < celtFetched; c++)
+ {
+ rgelt[c] = m_data[m_position + c];
+ }
+ }
+
+ m_position += celtFetched;
+
+ return hr;
+ }
+ }
}
- }
- #endregion Base Class
+ #endregion Base Class
- class AD7ProgramEnum : AD7Enum, IEnumDebugPrograms2 {
- public AD7ProgramEnum(IDebugProgram2[] data)
- : base(data) {
- }
+ class AD7ProgramEnum : AD7Enum, IEnumDebugPrograms2
+ {
+ public AD7ProgramEnum(IDebugProgram2[] data)
+ : base(data)
+ {
+ }
- public int Next(uint celt, IDebugProgram2[] rgelt, ref uint celtFetched) {
- return Next(celt, rgelt, out celtFetched);
+ public int Next(uint celt, IDebugProgram2[] rgelt, ref uint celtFetched)
+ {
+ return Next(celt, rgelt, out celtFetched);
+ }
}
- }
- class AD7FrameInfoEnum : AD7Enum, IEnumDebugFrameInfo2 {
- public AD7FrameInfoEnum(FRAMEINFO[] data)
- : base(data) {
- }
+ class AD7FrameInfoEnum : AD7Enum, IEnumDebugFrameInfo2
+ {
+ public AD7FrameInfoEnum(FRAMEINFO[] data)
+ : base(data)
+ {
+ }
- public int Next(uint celt, FRAMEINFO[] rgelt, ref uint celtFetched) {
- return Next(celt, rgelt, out celtFetched);
+ public int Next(uint celt, FRAMEINFO[] rgelt, ref uint celtFetched)
+ {
+ return Next(celt, rgelt, out celtFetched);
+ }
}
- }
- class AD7PropertyInfoEnum : AD7Enum, IEnumDebugPropertyInfo2 {
- public AD7PropertyInfoEnum(DEBUG_PROPERTY_INFO[] data)
- : base(data) {
+ class AD7PropertyInfoEnum : AD7Enum, IEnumDebugPropertyInfo2
+ {
+ public AD7PropertyInfoEnum(DEBUG_PROPERTY_INFO[] data)
+ : base(data)
+ {
+ }
}
- }
- class AD7ThreadEnum : AD7Enum, IEnumDebugThreads2 {
- public AD7ThreadEnum(IDebugThread2[] threads)
- : base(threads) {
+ class AD7ThreadEnum : AD7Enum, IEnumDebugThreads2
+ {
+ public AD7ThreadEnum(IDebugThread2[] threads)
+ : base(threads)
+ {
- }
+ }
- public int Next(uint celt, IDebugThread2[] rgelt, ref uint celtFetched) {
- return Next(celt, rgelt, out celtFetched);
+ public int Next(uint celt, IDebugThread2[] rgelt, ref uint celtFetched)
+ {
+ return Next(celt, rgelt, out celtFetched);
+ }
}
- }
- class AD7ModuleEnum : AD7Enum, IEnumDebugModules2 {
- public AD7ModuleEnum(IDebugModule2[] modules)
- : base(modules) {
+ class AD7ModuleEnum : AD7Enum, IEnumDebugModules2
+ {
+ public AD7ModuleEnum(IDebugModule2[] modules)
+ : base(modules)
+ {
- }
+ }
- public int Next(uint celt, IDebugModule2[] rgelt, ref uint celtFetched) {
- return Next(celt, rgelt, out celtFetched);
+ public int Next(uint celt, IDebugModule2[] rgelt, ref uint celtFetched)
+ {
+ return Next(celt, rgelt, out celtFetched);
+ }
}
- }
- class AD7PropertyEnum : AD7Enum, IEnumDebugPropertyInfo2 {
- public AD7PropertyEnum(DEBUG_PROPERTY_INFO[] properties)
- : base(properties) {
+ class AD7PropertyEnum : AD7Enum, IEnumDebugPropertyInfo2
+ {
+ public AD7PropertyEnum(DEBUG_PROPERTY_INFO[] properties)
+ : base(properties)
+ {
+ }
}
- }
- class AD7CodeContextEnum : AD7Enum, IEnumDebugCodeContexts2 {
- public AD7CodeContextEnum(IDebugCodeContext2[] codeContexts)
- : base(codeContexts) {
+ class AD7CodeContextEnum : AD7Enum, IEnumDebugCodeContexts2
+ {
+ public AD7CodeContextEnum(IDebugCodeContext2[] codeContexts)
+ : base(codeContexts)
+ {
- }
+ }
- public int Next(uint celt, IDebugCodeContext2[] rgelt, ref uint celtFetched) {
- return Next(celt, rgelt, out celtFetched);
+ public int Next(uint celt, IDebugCodeContext2[] rgelt, ref uint celtFetched)
+ {
+ return Next(celt, rgelt, out celtFetched);
+ }
}
- }
- class AD7BoundBreakpointsEnum : AD7Enum, IEnumDebugBoundBreakpoints2 {
- public AD7BoundBreakpointsEnum(IDebugBoundBreakpoint2[] breakpoints)
- : base(breakpoints) {
+ class AD7BoundBreakpointsEnum : AD7Enum, IEnumDebugBoundBreakpoints2
+ {
+ public AD7BoundBreakpointsEnum(IDebugBoundBreakpoint2[] breakpoints)
+ : base(breakpoints)
+ {
- }
+ }
- public int Next(uint celt, IDebugBoundBreakpoint2[] rgelt, ref uint celtFetched) {
- return Next(celt, rgelt, out celtFetched);
+ public int Next(uint celt, IDebugBoundBreakpoint2[] rgelt, ref uint celtFetched)
+ {
+ return Next(celt, rgelt, out celtFetched);
+ }
}
- }
}
diff --git a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs
index 77c5079e60..2a24468e46 100644
--- a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs
+++ b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs
@@ -56,8 +56,7 @@ private bool CanBind()
public AD7DocumentContext GetDocumentContext(uint address)
{
IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(mBpRequestInfo.bpLocation.unionmember2));
- string documentName;
- EngineUtils.CheckOk(docPosition.GetFileName(out documentName));
+ EngineUtils.CheckOk(docPosition.GetFileName(out string documentName));
// Get the location in the document that the breakpoint is in.
TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
@@ -97,16 +96,15 @@ int IDebugPendingBreakpoint2.Bind()
{
if (CanBind())
{
- var xDocPos = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(mBpRequestInfo.bpLocation.unionmember2));
+ IDebugDocumentPosition2 xDocPos = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(mBpRequestInfo.bpLocation.unionmember2);
// Get the name of the document that the breakpoint was put in
- string xDocName;
- EngineUtils.CheckOk(xDocPos.GetFileName(out xDocName));
+ EngineUtils.CheckOk(xDocPos.GetFileName(out string xDocName));
xDocName = xDocName.ToLower(); //Bug: Some filenames were returned with the drive letter as lower case but in DocumentGUIDs it was captialised so file-not-found!
// Get the location in the document that the breakpoint is in.
- var xStartPos = new TEXT_POSITION[1];
- var xEndPos = new TEXT_POSITION[1];
+ TEXT_POSITION[] xStartPos = new TEXT_POSITION[1];
+ TEXT_POSITION[] xEndPos = new TEXT_POSITION[1];
EngineUtils.CheckOk(xDocPos.GetRange(xStartPos, xEndPos));
uint xAddress = 0;
@@ -116,8 +114,7 @@ int IDebugPendingBreakpoint2.Bind()
// VS will send us BPs from other Cosmos projects (and possibly non Cosmos ones, didnt look that deep)
// but we wont have them in our doc list because it contains only ones from the currently project
// to run.
- long xDocID;
- if (xDebugInfo.DocumentGUIDs.TryGetValue(xDocName, out xDocID))
+ if (xDebugInfo.DocumentGUIDs.TryGetValue(xDocName, out long xDocID))
{
// Find which Method the Doc, Line, Col are in.
// Must add +1 for both Line and Col. They are 0 based, while SP ones are 1 based.
@@ -126,9 +123,7 @@ int IDebugPendingBreakpoint2.Bind()
try
{
- var connection = xDebugInfo.GetNewConnection();
-
- var xMethod = xDebugInfo.GetMethodByDocumentIDAndLinePosition(connection, xDocID, xPos, xPos);
+ var xMethod = xDebugInfo.GetMethodByDocumentIDAndLinePosition(xDocID, xPos, xPos);
var asm = xDebugInfo.GetAssemblyFileById(xMethod.AssemblyFileID);
// We have the method. Now find out what Sequence Point it belongs to.
@@ -136,9 +131,7 @@ int IDebugPendingBreakpoint2.Bind()
var xSP = xSPs.Single(q => q.LineColStart <= xPos && q.LineColEnd >= xPos);
// We have the Sequence Point, find the MethodILOp
- var xOp = xDebugInfo.GetFirstMethodIlOpByMethodIdAndILOffset(connection, xMethod.ID, xSP.Offset);
-
- connection.Close();
+ var xOp = xDebugInfo.GetFirstMethodIlOpByMethodIdAndILOffset(xMethod.ID, xSP.Offset);
// Get the address of the Label
xAddress = xDebugInfo.GetAddressOfLabel(xOp.LabelName);
@@ -146,8 +139,8 @@ int IDebugPendingBreakpoint2.Bind()
if (xAddress > 0)
{
- var xBPR = new AD7BreakpointResolution(mEngine, xAddress, GetDocumentContext(xAddress));
- var xBBP = new AD7BoundBreakpoint(mEngine, xAddress, this, xBPR);
+ AD7BreakpointResolution xBPR = new(mEngine, xAddress, GetDocumentContext(xAddress));
+ AD7BoundBreakpoint xBBP = new(mEngine, xAddress, this, xBPR);
mBoundBPs.Add(xBBP);
}
diff --git a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Process.cs b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Process.cs
index 4a263172b5..ad5f17c39d 100644
--- a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Process.cs
+++ b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7Process.cs
@@ -383,14 +383,14 @@ private void DbgCmdNullReferenceOccurred(uint lastEIPAddress)
try
{
var connection = mDebugInfoDb.GetNewConnection();
- var xMethod = mDebugInfoDb.GetMethod(connection, lastEIPAddress);
+ var xMethod = mDebugInfoDb.GetMethod(lastEIPAddress);
var xLabel = mDebugInfoDb.GetLabels(lastEIPAddress)[0];
var xMethodIlOp = mDebugInfoDb.TryGetFirstMethodIlOpByLabelName(xLabel.Remove(xLabel.LastIndexOf('.'))).IlOffset;
var xSequencePoints = mDebugInfoDb.GetSequencePoints(mDebugInfoDb.GetAssemblyFileById(xMethod.AssemblyFileID).Pathname, xMethod.MethodToken);
var xLine = xSequencePoints.Where(q => q.Offset <= xMethodIlOp).Last().LineStart;
- AD7Util.ShowError($"NullReferenceException occurred in '{xMethod.LabelCall}'{Environment.NewLine}Document: {mDebugInfoDb.GetDocumentById(connection, xMethod.DocumentID).Pathname}{Environment.NewLine}Line: {xLine}{Environment.NewLine}Address: 0x{lastEIPAddress.ToString("X8")}");
+ AD7Util.ShowError($"NullReferenceException occurred in '{xMethod.LabelCall}'{Environment.NewLine}Document: {mDebugInfoDb.GetDocumentById(xMethod.DocumentID).Pathname}{Environment.NewLine}Line: {xLine}{Environment.NewLine}Address: 0x{lastEIPAddress.ToString("X8")}");
connection.Close();
return;
@@ -456,9 +456,9 @@ string GetStackTraceEntry(uint address)
var connection = mDebugInfoDb.GetNewConnection();
try
{
- var xMethod = mDebugInfoDb.GetMethod(connection, address);
+ var xMethod = mDebugInfoDb.GetMethod(address);
var xLabels = mDebugInfoDb.GetLabels(address);
- var xDocument = mDebugInfoDb.GetDocumentById(connection, xMethod.DocumentID);
+ var xDocument = mDebugInfoDb.GetDocumentById(xMethod.DocumentID);
int? xLine = null;
if (xLabels != null && xLabels.Length > 0)
{
@@ -466,7 +466,7 @@ string GetStackTraceEntry(uint address)
}
else
{
- var xLabel = mDebugInfoDb.GetMethodLabels(connection, address)
+ var xLabel = mDebugInfoDb.GetMethodLabels(address)
.OrderBy(x => Math.Abs(address - x.Address)).First(); // Get closest address
xLabel.Name = xLabel.Name.Remove(xLabel.Name.LastIndexOf('.')) == xMethod.LabelCall ? xLabel.Name + ".AfterCall" : xLabel.Name; // Verify label name
xLine = GetLabelLine(xMethod, xLabel.Name);
@@ -1126,11 +1126,11 @@ internal void ChangeINT3sOnCurrentMethod(bool clear)
if (mCurrentAddress.HasValue)
{
var connection = mDebugInfoDb.GetNewConnection();
- var currMethod = mDebugInfoDb.GetMethod(connection, mCurrentAddress.Value);
+ var currMethod = mDebugInfoDb.GetMethod(mCurrentAddress.Value);
//Clear out the full list so we don't accidentally accumulate INT3s all over the place
//Or set INT3s for all places in current method
- var tpAdresses = clear ? new List>(INT3sSet.Count) : mDebugInfoDb.GetAllINT3AddressesForMethod(connection, currMethod, true);
+ var tpAdresses = clear ? new List>(INT3sSet.Count) : mDebugInfoDb.GetAllINT3AddressesForMethod(currMethod, true);
connection.Close();
//If we just do a stright assigment then we get a collection modified exception in foreach loop below
@@ -1237,7 +1237,7 @@ public void SendAssembly(bool noDisplay = false)
// - We use the method header label as a start point and find all asm labels till the method footer label
// - We then find all the asm for these labels and display it.
var connection = mDebugInfoDb.GetNewConnection();
- Label[] xLabels = mDebugInfoDb.GetMethodLabels(connection, xAddress);
+ Label[] xLabels = mDebugInfoDb.GetMethodLabels(xAddress);
connection.Close();
AD7Util.Log("SendAssembly - MethodLabels retrieved");
// get the label of our current position, or the closest one before
diff --git a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7StackFrame.cs b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7StackFrame.cs
index 639c94a1b2..c80ee29dac 100644
--- a/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7StackFrame.cs
+++ b/source/Cosmos.VS.DebugEngine/AD7.Impl/AD7StackFrame.cs
@@ -43,9 +43,7 @@ public AD7StackFrame(AD7Engine aEngine, AD7Thread aThread, AD7Process aProcess)
if (mHasSource = xProcess.mCurrentAddress.HasValue)
{
var xAddress = xProcess.mCurrentAddress.Value;
- var connection = xProcess.mDebugInfoDb.GetNewConnection();
- var label = xProcess.mDebugInfoDb.GetMethod(connection, xAddress);
- connection.Close();
+ var label = xProcess.mDebugInfoDb.GetMethod(xAddress);
var xSourceInfos = xProcess.mDebugInfoDb.GetSourceInfos(xAddress);
if (!xSourceInfos.ContainsKey(xAddress))
{
diff --git a/source/Cosmos.VS.ProjectSystem/.editorconfig b/source/Cosmos.VS.ProjectSystem/.editorconfig
deleted file mode 100644
index 930c4915ae..0000000000
--- a/source/Cosmos.VS.ProjectSystem/.editorconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-[*]
-indent_size = 4
diff --git a/source/Cosmos.VS.ProjectSystem/BuildSystem/Rules/CosmosPropertyPage.xaml b/source/Cosmos.VS.ProjectSystem/BuildSystem/Rules/CosmosPropertyPage.xaml
index a2199e8984..d3e0e69dbe 100644
--- a/source/Cosmos.VS.ProjectSystem/BuildSystem/Rules/CosmosPropertyPage.xaml
+++ b/source/Cosmos.VS.ProjectSystem/BuildSystem/Rules/CosmosPropertyPage.xaml
@@ -85,8 +85,8 @@
diff --git a/source/Cosmos.VS.ProjectSystem/ProjectTemplates/CSharp/Cosmos/Cosmos Kernel/CSharpProject.csproj b/source/Cosmos.VS.ProjectSystem/ProjectTemplates/CSharp/Cosmos/Cosmos Kernel/CSharpProject.csproj
index 242f868162..5548636e91 100644
--- a/source/Cosmos.VS.ProjectSystem/ProjectTemplates/CSharp/Cosmos/Cosmos Kernel/CSharpProject.csproj
+++ b/source/Cosmos.VS.ProjectSystem/ProjectTemplates/CSharp/Cosmos/Cosmos Kernel/CSharpProject.csproj
@@ -23,6 +23,7 @@
+
diff --git a/source/Cosmos.VS.ProjectSystem/ProjectTemplates/FSharp/Cosmos/Cosmos Kernel/FSharpProject.fsproj b/source/Cosmos.VS.ProjectSystem/ProjectTemplates/FSharp/Cosmos/Cosmos Kernel/FSharpProject.fsproj
index f954b441be..d05b9c8f74 100644
--- a/source/Cosmos.VS.ProjectSystem/ProjectTemplates/FSharp/Cosmos/Cosmos Kernel/FSharpProject.fsproj
+++ b/source/Cosmos.VS.ProjectSystem/ProjectTemplates/FSharp/Cosmos/Cosmos Kernel/FSharpProject.fsproj
@@ -27,6 +27,7 @@
+
diff --git a/source/Cosmos.VS.ProjectSystem/ProjectTemplates/VisualBasic/Cosmos/Cosmos Kernel/VisualBasicProject.vbproj b/source/Cosmos.VS.ProjectSystem/ProjectTemplates/VisualBasic/Cosmos/Cosmos Kernel/VisualBasicProject.vbproj
index 242f868162..5548636e91 100644
--- a/source/Cosmos.VS.ProjectSystem/ProjectTemplates/VisualBasic/Cosmos/Cosmos Kernel/VisualBasicProject.vbproj
+++ b/source/Cosmos.VS.ProjectSystem/ProjectTemplates/VisualBasic/Cosmos/Cosmos Kernel/VisualBasicProject.vbproj
@@ -23,6 +23,7 @@
+
diff --git a/source/Cosmos.VS.ReadMe.html b/source/Cosmos.VS.ReadMe.html
deleted file mode 100644
index 2b9cbec2ca..0000000000
--- a/source/Cosmos.VS.ReadMe.html
+++ /dev/null
@@ -1,147 +0,0 @@
-
- Projects that provide Visual Studio IDE support.
-
- Debugging
-
- Debugging VS packages can be a royal PITA. The hive can be used but install.bat
- often requires it to be reset each time.
-
- Hive:
-
- Cosmos.VS.ProjectSystem is setup for debugging via a second (non hive) instance but
- the path is set for the default directory on x64.
-
- Hive:
- C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
-
- D:\source\Cosmos\source\Cosmos.sln /ranu /rootsuffix Exp
-
- Non hive:
- C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
- D:\source\Cosmos\source\Cosmos.sln
-
- Resources
-
- VSIX
-
-
- MEF
-
-
- Projects
-
- Note that some VS parts, the custom VS debugger for example is in \Debug.
-
- Cosmos.VS.ProjectSystem
-
- MPF project.
- Does not appear to be a VS Package. So what is it? This was our first package
- from very old VS, might be old crapp COM model?
-
- Provides:
-
- - Support for the .Cosmos project type
- - Project configuration dialogs
- - X# custom tool generator - Move to XSharp.VS probably
-
-
- Cosmos.VS.Windows
-
- Provides UI for Cosmos debug windows in VS.
- Contains windows, toolbars and menu options.
-
- Separate from other pacakges
- because:
-
- - Threading and hosting issues
- - It is a different project
- type.
- - Allows external testing by Cosmos.VS.Windows.Test
-
-
- Cosmos.VS.Windows.Test
-
- Testing project for Cosmos.VS.Windows. Not used by VS itself.
-
- Cosmos.VS.Wizards
-
- Not VSIX, not MEF, not MPF. Why is this a separate assembly?
-
- Provides:
-
- - Support for creating new Cosmos projects from within Visual Studio.
-
-
- Cosmos.VS.XSharp
-
- MPF project and VS Package.
-
- XSharp Language Service
-
- Provides:
-
- - Syntax coloring for X#.
-
- - Code completion / intellisense (future)
-
-
-
- X# custom tool generator is in Cosmos.VS.ProjectSystem.
-
- Comos.Launch.VMware
-
- VS debugger requires a process that starts paused, and is then later started. To
- do this and to unify the process that is used, we use a proxy process which then
- controls the actual execution environment (VMWare, QEMU, etc).
-
- Comos.Debug.VSDebugEngine
-
- This provides a custom debug engine to Visual Studio to handle tracing,
- breakpoints, stepping, watches, etc.
-
- - AD7.Impl \ AD7Process.cs
- - Launches DebugHost, which then launches
- VMWare etc
- - Contains pipes for communicating to VMWare's serial port to DebugStub
-
-
- - BreakpointManager.cs
- - contains notes on breakpoints
-
-
-
-
-
- References
-
- - http://archive.msdn.microsoft.com/debugenginesample/Release/ProjectReleases.aspx?ReleaseId=4149
-
-
-
-
-
diff --git a/source/Cosmos.VS.Windows/.editorconfig b/source/Cosmos.VS.Windows/.editorconfig
deleted file mode 100644
index 5c974e5e79..0000000000
--- a/source/Cosmos.VS.Windows/.editorconfig
+++ /dev/null
@@ -1,3 +0,0 @@
-[*.cs]
-indent_size=4
-indent_style=space
diff --git a/source/Cosmos.VS.Windows/Cosmos.VS.Windows.html b/source/Cosmos.VS.Windows/Cosmos.VS.Windows.html
deleted file mode 100644
index df01c04b82..0000000000
--- a/source/Cosmos.VS.Windows/Cosmos.VS.Windows.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
- http://dotneteers.net/blogs/divedeeper/archive/2010/05/23/vs-2010-package-development-chapter-2-commands-menus-and-toolbars.aspx
-
-
-
\ No newline at end of file
diff --git a/source/Kernel-TapRoot/Demo/Boot.cs b/source/Kernel-TapRoot/Demo/Boot.cs
deleted file mode 100644
index 383da1c7f6..0000000000
--- a/source/Kernel-TapRoot/Demo/Boot.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
- // Beware Demo Kernels are not recompiled when its dependencies changes!
- // To force recompilation right click on on the Cosmos icon of the demo solution and do "Build".
-namespace TRKernel {
- public class Boot {
- }
-}
diff --git a/source/Kernel-TapRoot/Demo/TRKernel.csproj b/source/Kernel-TapRoot/Demo/TRKernel.csproj
deleted file mode 100644
index e481687b25..0000000000
--- a/source/Kernel-TapRoot/Demo/TRKernel.csproj
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
- net6.0
- true
-
-
-
- X86-TapRoot
- elf
- False
- Source
- User
- False
- False
- ISO
- Pipe: Cosmos\Serial
- True
- MethodFooters
- False
- Serial: COM1
- VMware
- VMware
- Use VMware Player or Workstation to deploy and debug.
- 192.168.0.8
- True
- MethodFooters
- Use VMware Player or Workstation to deploy and debug.
- ISO
- VMware
- False
- Source
- False
- Serial: COM1
- Pipe: Cosmos\Serial
- 192.168.0.8
- bin\Debug\net462\
- False
- False
- True
- MethodFooters
- Use Bochs emulator to deploy and debug.
- ISO
- Bochs
- True
- Source
- False
- Serial: COM1
- Pipe: Cosmos\Serial
- 192.168.0.8
- bin\Debug\net462\
- False
- False
- BootGen3
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/BaseIOGroups.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/BaseIOGroups.cs
deleted file mode 100644
index e285b181e4..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/BaseIOGroups.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using global::System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Cosmos.CPU.x86 {
- public class BaseIOGroups {
- // These are common/fixed pieces of hardware. PCI, USB etc should be self discovering
- // and not hardcoded like this.
- // Further more some kind of security needs to be applied to these, but even now
- // at least we have isolation between the consumers that use these.
-
- //public readonly IOGroup.Keyboard Keyboard = new IOGroup.Keyboard();
- //public static readonly IOGroup.Mouse Mouse = new IOGroup.Mouse();
- //public static readonly IOGroup.PCSpeaker PCSpeaker = new IOGroup.PCSpeaker();
- //public readonly IOGroup.PIT PIT = new IOGroup.PIT();
- //public readonly IOGroup.TextScreen TextScreen = new IOGroup.TextScreen();
- //public readonly IOGroup.ATA ATA1 = new IOGroup.ATA(false);
- //public readonly IOGroup.ATA ATA2 = new IOGroup.ATA(true);
- //public readonly IOGroup.RTC RTC = new IOGroup.RTC();
- //public readonly IOGroup.VBE VBE = new IOGroup.VBE();
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Boot.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Boot.cs
deleted file mode 100644
index bc01e295ae..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Boot.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU.x86 {
- static public class Boot {
-
- // OLD CODE pasted.. .still cleaning/porting
-
-
- // See note in Global - these are a "hack" for now so
- // we dont force static init of Global, and it "pulls" these later till
- // we eventually eliminate them
- static public PIC PIC;
- // Has to be static for now, ZeroFill gets called before the Init.
- static public readonly Processor Processor = new Processor();
-
- // Bootstrap is a class designed only to get the essentials done.
- // ie the stuff needed to "pre boot". Do only the very minimal here.
- // IDT, PIC, and Float
- // Note: This is changing a bit GDT (already) and IDT are moving to a real preboot area.
-
- [BootEntry(10)]
- static private void Init() {
- PIC = new PIC();
- Processor.UpdateIDT(true);
-
- /* TODO check using CPUID that SSE2 is supported */
- Processor.InitSSE();
-
- /*
- * We liked to use SSE for all floating point operation and end to mix SSE / x87 in Cosmos code
- * but sadly in x86 this resulte impossible as Intel not implemented some needed instruction (for example conversion
- * for long to double) so - in some rare cases - x87 continue to be used. I hope passing to the x32 or x64 IA will solve
- * definively this problem.
- */
- Processor.InitFloat();
-
- // Managed_Memory_System.ManagedMemory.Initialize();
- // Managed_Memory_System.ManagedMemory.SetUpMemoryArea();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Cosmos.CPU.x86.csproj b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Cosmos.CPU.x86.csproj
deleted file mode 100644
index 817080a1ff..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Cosmos.CPU.x86.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net6.0
- true
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Cosmos.cfg b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Cosmos.cfg
deleted file mode 100644
index 9c7a967f2e..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: CPU
\ No newline at end of file
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/GcHook.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/GcHook.cs
deleted file mode 100644
index 1a1f68aec5..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/GcHook.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Diagnostics;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU.x86 {
- [DebuggerStepThrough]
- public static class GCImplementation {
- private static void AcquireLock() {
- }
-
- private static void ReleaseLock() {
- }
-
- [PlugMethod(PlugRequired = true)]
- public static uint AllocNewObject(uint aSize) {
- return 0;
- }
-
- ///
- /// This function gets the pointer to the memory location of where it's stored.
- ///
- ///
- public static unsafe void IncRefCount(uint aObject) {
- }
-
- ///
- /// This function gets the pointer to the memory location of where it's stored.
- ///
- ///
- public static unsafe void DecRefCount(uint aObject) {
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Global.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Global.cs
deleted file mode 100644
index 188a429155..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Global.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Cosmos.Debug.Kernel;
-
-namespace Cosmos.CPU.x86 {
- public static class Global {
- public static readonly Debugger mDebugger = new Debugger("Processor", "Global");
-
- public static BaseIOGroups BaseIOGroups = new BaseIOGroups();
-
- // These are used by Bootstrap.. but also called to signal end of interrupt etc...
- // Need to chagne this.. I dont like how this is.. maybe isolate or split into to classes... one for boostrap one for
- // later user
- static public PIC PIC {
- get {
- return Boot.PIC;
- }
- }
-
- static public Processor Processor {
- get {
- return Boot.Processor;
- }
- }
-
- static public void Init() {
- // See note in Bootstrap about these
-
- // DONT transform the properties in fields, as then they remain null somehow.
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/GlobalSystemInfo.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/GlobalSystemInfo.cs
deleted file mode 100644
index 5bd0ef01f8..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/GlobalSystemInfo.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Cosmos.CPU.x86 {
- internal static unsafe class GlobalSystemInfo {
- //private static volatile GlobalInformationTable* mGlobalInformationTable;
- //public static GlobalInformationTable* GlobalInformationTable {
- // get {
- // EnsureInitialized();
- // return mGlobalInformationTable;
- // }
- //}
-
- internal static unsafe void EnsureInitialized() {
- //if (mGlobalInformationTable == null) {
- //var xEndOfKernel = Processor.GetEndOfKernel();
- //xEndOfKernel = xEndOfKernel + (1024 * 1024); // for now, skip 1 MB
- //Processor.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + TotalDataLookupTableSize) * 4);
- //mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
- //uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
- //mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)xFirstDataLookupLocation;
- //}
- }
-
- //public static uint TotalDataLookupTableSize {
- // get {
- //return (uint)(sizeof(DataLookupTable) + (DataLookupTable.EntriesPerTable * sizeof(DataLookupEntry)));
- //}
- //}
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/INTs.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/INTs.cs
deleted file mode 100644
index 336826f2b5..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/INTs.cs
+++ /dev/null
@@ -1,489 +0,0 @@
-using System.Runtime.InteropServices;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU.x86 {
-
- [ForceInclude]
- public class INTs {
- #region Enums
- // TODO: Protect IRQs like memory and ports are
- // TODO: Make IRQs so they are not hookable, and instead release high priority threads like FreeBSD (When we get threading)
- public enum EFlagsEnum : uint {
- Carry = 1,
- Parity = 1 << 2,
- AuxilliaryCarry = 1 << 4,
- Zero = 1 << 6,
- Sign = 1 << 7,
- Trap = 1 << 8,
- InterruptEnable = 1 << 9,
- Direction = 1 << 10,
- Overflow = 1 << 11,
- NestedTag = 1 << 14,
- Resume = 1 << 16,
- Virtual8086Mode = 1 << 17,
- AlignmentCheck = 1 << 18,
- VirtualInterrupt = 1 << 19,
- VirtualInterruptPending = 1 << 20,
- ID = 1 << 21
- }
-
- [StructLayout(LayoutKind.Explicit, Size = 0x68)]
- public struct TSS {
- [FieldOffset(0)]
- public ushort Link;
- [FieldOffset(4)]
- public uint ESP0;
- [FieldOffset(8)]
- public ushort SS0;
- [FieldOffset(12)]
- public uint ESP1;
- [FieldOffset(16)]
- public ushort SS1;
- [FieldOffset(20)]
- public uint ESP2;
- [FieldOffset(24)]
- public ushort SS2;
- [FieldOffset(28)]
- public uint CR3;
- [FieldOffset(32)]
- public uint EIP;
- [FieldOffset(36)]
- public EFlagsEnum EFlags;
- [FieldOffset(40)]
- public uint EAX;
- [FieldOffset(44)]
- public uint ECX;
- [FieldOffset(48)]
- public uint EDX;
- [FieldOffset(52)]
- public uint EBX;
- [FieldOffset(56)]
- public uint ESP;
- [FieldOffset(60)]
- public uint EBP;
- [FieldOffset(64)]
- public uint ESI;
- [FieldOffset(68)]
- public uint EDI;
- [FieldOffset(72)]
- public ushort ES;
- [FieldOffset(76)]
- public ushort CS;
- [FieldOffset(80)]
- public ushort SS;
- [FieldOffset(84)]
- public ushort DS;
- [FieldOffset(88)]
- public ushort FS;
- [FieldOffset(92)]
- public ushort GS;
- [FieldOffset(96)]
- public ushort LDTR;
- [FieldOffset(102)]
- public ushort IOPBOffset;
- }
-
- [StructLayout(LayoutKind.Explicit, Size = 512)]
- public struct MMXContext {
- }
-
- [StructLayout(LayoutKind.Explicit, Size = 80)]
- public struct IRQContext {
- [FieldOffset(0)]
- public unsafe MMXContext* MMXContext;
-
- [FieldOffset(4)]
- public uint EDI;
-
- [FieldOffset(8)]
- public uint ESI;
-
- [FieldOffset(12)]
- public uint EBP;
-
- [FieldOffset(16)]
- public uint ESP;
-
- [FieldOffset(20)]
- public uint EBX;
-
- [FieldOffset(24)]
- public uint EDX;
-
- [FieldOffset(28)]
- public uint ECX;
-
- [FieldOffset(32)]
- public uint EAX;
-
- [FieldOffset(36)]
- public uint Interrupt;
-
- [FieldOffset(40)]
- public uint Param;
-
- [FieldOffset(44)]
- public uint EIP;
-
- [FieldOffset(48)]
- public uint CS;
-
- [FieldOffset(52)]
- public EFlagsEnum EFlags;
-
- [FieldOffset(56)]
- public uint UserESP;
- }
- #endregion
-
- [AsmMarker(AsmMarker.Type.Int_LastKnownAddress)]
- private static uint mLastKnownAddress = 0;
-
- private static IRQDelegate[] mIRQ_Handlers = new IRQDelegate[256];
-
- // We used to use:
- //Interrupts.IRQ01 += HandleKeyboardInterrupt;
- // But at one point we had issues with multi cast delegates, so we changed to this single cast option.
- // [1:48:37 PM] Matthijs ter Woord: the issues were: "they didn't work, would crash kernel". not sure if we still have them..
- public static void SetIntHandler(byte aIntNo, IRQDelegate aHandler) {
- mIRQ_Handlers[aIntNo] = aHandler;
- }
- public static void SetIrqHandler(byte aIrqNo, IRQDelegate aHandler) {
- SetIntHandler((byte)(0x20 + aIrqNo), aHandler);
- }
-
- private static void IRQ(uint irq, ref IRQContext aContext) {
- var xCallback = mIRQ_Handlers[irq];
- if (xCallback != null) {
- xCallback(ref aContext);
- }
- }
-
- public static void HandleInterrupt_Default(ref IRQContext aContext) {
- if (aContext.Interrupt >= 0x20 && aContext.Interrupt <= 0x2F) {
- if (aContext.Interrupt >= 0x28) {
- Global.PIC.EoiSlave();
- } else {
- Global.PIC.EoiMaster();
- }
- }
- }
-
- public delegate void IRQDelegate(ref IRQContext aContext);
- public delegate void ExceptionInterruptDelegate(ref IRQContext aContext, ref bool aHandled);
-
- #region Default Interrupt Handlers
-
- //IRQ 0 - System timer. Reserved for the system. Cannot be changed by a user.
- public static void HandleInterrupt_20(ref IRQContext aContext) {
- IRQ(0x20, ref aContext);
- Global.PIC.EoiMaster();
- }
-
- //public static IRQDelegate IRQ01;
- //IRQ 1 - Keyboard. Reserved for the system. Cannot be altered even if no keyboard is present or needed.
- public static void HandleInterrupt_21(ref IRQContext aContext) {
-
- IRQ(0x21, ref aContext);
- Global.PIC.EoiMaster();
- }
- public static void HandleInterrupt_22(ref IRQContext aContext) {
-
- IRQ(0x22, ref aContext);
- Global.PIC.EoiMaster();
- }
- public static void HandleInterrupt_23(ref IRQContext aContext) {
-
- IRQ(0x23, ref aContext);
- Global.PIC.EoiMaster();
- }
- public static void HandleInterrupt_24(ref IRQContext aContext) {
-
- IRQ(0x24, ref aContext);
- Global.PIC.EoiMaster();
- }
- public static void HandleInterrupt_25(ref IRQContext aContext) {
- IRQ(0x25, ref aContext);
- Global.PIC.EoiMaster();
- }
- public static void HandleInterrupt_26(ref IRQContext aContext) {
-
- IRQ(0x26, ref aContext);
- Global.PIC.EoiMaster();
- }
- public static void HandleInterrupt_27(ref IRQContext aContext) {
-
- IRQ(0x27, ref aContext);
- Global.PIC.EoiMaster();
- }
-
- public static void HandleInterrupt_28(ref IRQContext aContext) {
-
- IRQ(0x28, ref aContext);
- Global.PIC.EoiSlave();
- }
- //IRQ 09 - (Added for AMD PCNet network card)
- //public static IRQDelegate IRQ09;
-
- public static void HandleInterrupt_29(ref IRQContext aContext) {
- IRQ(0x29, ref aContext);
- Global.PIC.EoiSlave();
- }
-
- //IRQ 10 - (Added for VIA Rhine network card)
- //public static IRQDelegate IRQ10;
-
- public static void HandleInterrupt_2A(ref IRQContext aContext) {
- IRQ(0x2A, ref aContext);
- Global.PIC.EoiSlave();
- }
-
- //IRQ 11 - (Added for RTL8139 network card)
- //public static IRQDelegate IRQ11;
-
- public static void HandleInterrupt_2B(ref IRQContext aContext) {
- IRQ(0x2B, ref aContext);
- Global.PIC.EoiSlave();
- }
-
- public static void HandleInterrupt_2C(ref IRQContext aContext) {
- IRQ(0x2C, ref aContext);
- Global.PIC.EoiSlave();
- }
-
-
- public static void HandleInterrupt_2D(ref IRQContext aContext) {
- IRQ(0x2D, ref aContext);
- Global.PIC.EoiSlave();
- }
- //IRQ 14 - Primary IDE. If no Primary IDE this can be changed
- public static void HandleInterrupt_2E(ref IRQContext aContext) {
- IRQ(0x2E, ref aContext);
- Global.PIC.EoiSlave();
- }
- //IRQ 15 - Secondary IDE
- public static void HandleInterrupt_2F(ref IRQContext aContext) {
- IRQ(0x2F, ref aContext);
- Global.PIC.EoiSlave();
- }
-
- public static event IRQDelegate Interrupt30;
- // Interrupt 0x30, enter VMM
- public static void HandleInterrupt_30(ref IRQContext aContext) {
- if (Interrupt30 != null) {
- Interrupt30(ref aContext);
- }
- }
-
- public static void HandleInterrupt_35(ref IRQContext aContext) {
- aContext.EAX *= 2;
- aContext.EBX *= 2;
- aContext.ECX *= 2;
- aContext.EDX *= 2;
- }
-
- public static void HandleInterrupt_40(ref IRQContext aContext) {
- IRQ(0x40, ref aContext);
- }
- public static void HandleInterrupt_41(ref IRQContext aContext) {
- IRQ(0x41, ref aContext);
- }
- public static void HandleInterrupt_42(ref IRQContext aContext) {
- IRQ(0x42, ref aContext);
- }
- public static void HandleInterrupt_43(ref IRQContext aContext) {
- IRQ(0x43, ref aContext);
- }
- public static void HandleInterrupt_44(ref IRQContext aContext) {
- IRQ(0x44, ref aContext);
- }
- public static void HandleInterrupt_45(ref IRQContext aContext) {
- IRQ(0x45, ref aContext);
- }
- public static void HandleInterrupt_46(ref IRQContext aContext) {
- IRQ(0x46, ref aContext);
- }
- public static void HandleInterrupt_47(ref IRQContext aContext) {
- IRQ(0x47, ref aContext);
- }
- public static void HandleInterrupt_48(ref IRQContext aContext) {
- IRQ(0x48, ref aContext);
- }
- public static void HandleInterrupt_49(ref IRQContext aContext) {
- IRQ(0x49, ref aContext);
- }
-
- #endregion
-
- #region Processor Exceptions
-
- public static IRQDelegate GeneralProtectionFault;
-
- public static void HandleInterrupt_00(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Divide by zero", "EDivideByZero", ref aContext, aContext.EIP);
- }
-
- public static void HandleInterrupt_01(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Debug Exception", "Debug Exception", ref aContext);
- }
-
- public static void HandleInterrupt_02(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Non Maskable Interrupt Exception", "Non Maskable Interrupt Exception", ref aContext);
- }
-
- public static void HandleInterrupt_03(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Breakpoint Exception", "Breakpoint Exception", ref aContext);
- }
-
- public static void HandleInterrupt_04(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Into Detected Overflow Exception", "Into Detected Overflow Exception", ref aContext);
- }
-
- public static void HandleInterrupt_05(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Out of Bounds Exception", "Out of Bounds Exception", ref aContext);
- }
-
- public static void HandleInterrupt_06(ref IRQContext aContext) {
- // although mLastKnownAddress is a static, we need to get it here, any subsequent calls will change the value!!!
- var xLastKnownAddress = mLastKnownAddress;
- HandleException(aContext.EIP, "Invalid Opcode", "EInvalidOpcode", ref aContext, xLastKnownAddress);
- }
-
- public static void HandleInterrupt_07(ref IRQContext aContext) {
- HandleException(aContext.EIP, "No Coprocessor Exception", "No Coprocessor Exception", ref aContext);
- }
-
- public static void HandleInterrupt_08(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Double Fault Exception", "Double Fault Exception", ref aContext);
- }
-
- public static void HandleInterrupt_09(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Coprocessor Segment Overrun Exception", "Coprocessor Segment Overrun Exception", ref aContext);
- }
-
- public static void HandleInterrupt_0A(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Bad TSS Exception", "Bad TSS Exception", ref aContext);
- }
-
- public static void HandleInterrupt_0B(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Segment Not Present", "Segment Not Present", ref aContext);
- }
-
- public static void HandleInterrupt_0C(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Stack Fault Exception", "Stack Fault Exception", ref aContext);
- }
- public static void HandleInterrupt_0D(ref IRQContext aContext) {
- if (GeneralProtectionFault != null) {
- GeneralProtectionFault(ref aContext);
- } else {
- HandleException(aContext.EIP, "General Protection Fault", "GPF", ref aContext);
- }
- }
-
- public static void HandleInterrupt_0E(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Page Fault Exception", "Page Fault Exception", ref aContext);
- }
-
- public static void HandleInterrupt_0F(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Unknown Interrupt Exception", "Unknown Interrupt Exception", ref aContext);
- }
-
- public static void HandleInterrupt_10(ref IRQContext aContext) {
- HandleException(aContext.EIP, "x87 Floating Point Exception", "Coprocessor Fault Exception", ref aContext);
- }
-
- public static void HandleInterrupt_11(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Alignment Exception", "Alignment Exception", ref aContext);
- }
-
- public static void HandleInterrupt_12(ref IRQContext aContext) {
- HandleException(aContext.EIP, "Machine Check Exception", "Machine Check Exception", ref aContext);
- }
- public static void HandleInterrupt_13(ref IRQContext aContext) {
- HandleException(aContext.EIP, "SIMD Floating Point Exception", "SIMD Floating Point Exception", ref aContext);
- }
-
-
- #endregion
-
- private static void HandleException(uint aEIP, string aDescription, string aName, ref IRQContext ctx, uint lastKnownAddressValue = 0) {
- // At this point we are in a very unstable state.
- // Try not to use any Cosmos routines, just
- // report a crash dump.
- const string xHex = "0123456789ABCDEF";
- uint xPtr = ctx.EIP;
-
- // we're printing exception info to the screen now:
- // 0/0: x
- // 1/0: exception number in hex
- unsafe
- {
- byte* xAddress = (byte*)0xB8000;
- PutErrorChar(0, 00, ' ');
- PutErrorChar(0, 01, '*');
- PutErrorChar(0, 02, '*');
- PutErrorChar(0, 03, '*');
- PutErrorChar(0, 04, ' ');
- PutErrorChar(0, 05, 'C');
- PutErrorChar(0, 06, 'P');
- PutErrorChar(0, 07, 'U');
- PutErrorChar(0, 08, ' ');
- PutErrorChar(0, 09, 'E');
- PutErrorChar(0, 10, 'x');
- PutErrorChar(0, 11, 'c');
- PutErrorChar(0, 12, 'e');
- PutErrorChar(0, 13, 'p');
- PutErrorChar(0, 14, 't');
- PutErrorChar(0, 15, 'i');
- PutErrorChar(0, 16, 'o');
- PutErrorChar(0, 17, 'n');
- PutErrorChar(0, 18, ' ');
- PutErrorChar(0, 19, 'x');
- PutErrorChar(0, 20, xHex[(int)((ctx.Interrupt >> 4) & 0xF)]);
- PutErrorChar(0, 21, xHex[(int)(ctx.Interrupt & 0xF)]);
- PutErrorChar(0, 22, ' ');
- PutErrorChar(0, 23, '*');
- PutErrorChar(0, 24, '*');
- PutErrorChar(0, 25, '*');
- PutErrorChar(0, 26, ' ');
-
- if (lastKnownAddressValue != 0) {
- PutErrorString(1, 0, "Last known address: 0x");
-
- PutErrorChar(1, 22, xHex[(int)((lastKnownAddressValue >> 28) & 0xF)]);
- PutErrorChar(1, 23, xHex[(int)((lastKnownAddressValue >> 24) & 0xF)]);
- PutErrorChar(1, 24, xHex[(int)((lastKnownAddressValue >> 20) & 0xF)]);
- PutErrorChar(1, 25, xHex[(int)((lastKnownAddressValue >> 16) & 0xF)]);
- PutErrorChar(1, 26, xHex[(int)((lastKnownAddressValue >> 12) & 0xF)]);
- PutErrorChar(1, 27, xHex[(int)((lastKnownAddressValue >> 8) & 0xF)]);
- PutErrorChar(1, 28, xHex[(int)((lastKnownAddressValue >> 4) & 0xF)]);
- PutErrorChar(1, 29, xHex[(int)(lastKnownAddressValue & 0xF)]);
- }
-
- }
-
- // lock up
- while (true) {
- }
- }
-
- private static void PutErrorChar(int line, int col, char c) {
- unsafe
- {
- byte* xAddress = (byte*)0xB8000;
-
- xAddress += (line * 80 + col) * 2;
-
- xAddress[0] = (byte)c;
- xAddress[1] = 0x0C;
- }
- }
-
- private static void PutErrorString(int line, int startCol, string error) {
- for (int i = 0; i < error.Length; i++) {
- PutErrorChar(line, startCol + i, error[i]);
- }
- }
-
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/INTs.html b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/INTs.html
deleted file mode 100644
index 49c5db9f22..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/INTs.html
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
-
-
- - IRQs can interrupt each other. But of same level?
- - IRQs can stack up - if same IRQ they can get "lost" (Link).
- If of different level, will queue up.. lower priority queues up, higher
- intterupts unless masked.
-
-
- IRQs are handled by priority and are queued.
- Questions
-
- Higher priority IRQs can happen while lower ones are in progress
-
- Can a signle IRQ happen while one is already in progress? ie Int 2 happen while
- Int 2 is already in progress? If so does it call again, queue it? or lose it?
-
- MtW: This depends on us: we can do this, but can have issues with debugger etc.
- Right now, we dont allow it.
-
-
-
- One thing to keep in mind: the Hardware IRQ's are mapped to interrupts 0x20-0x2F
-
- Links
-
-
- http://en.wikipedia.org/wiki/Interrupt
-
- http://en.wikipedia.org/wiki/Interrupt_request
-
- http://en.wikipedia.org/wiki/IF_%28x86_flag%29\
- http://wiki.osdev.org/IRQ
-
- http://www.xml.com/ldd/chapter/book/ch09.html
-
-
- Interrupt Descriptor Table -
-
- http://en.wikipedia.org/wiki/Interrupt_descriptor_table
- Interrupt Threads -
- http://en.wikipedia.org/wiki/Interrupt_handler
- Efficiency
- http://lwn.net/Articles/395783/
-
- Master PIC
-
-
- Slave PIC
-
-
-
-
-
-
\ No newline at end of file
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOGroup/IOGroup.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOGroup/IOGroup.cs
deleted file mode 100644
index a072e87c2d..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOGroup/IOGroup.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-namespace Cosmos.CPU.x86.IOGroup {
- public abstract class IOGroup {
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOGroup/PIC.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOGroup/PIC.cs
deleted file mode 100644
index 4156132f2b..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOGroup/PIC.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Cosmos.CPU.x86.IOGroup {
- public class PIC : IOGroup {
- public readonly IOPort Cmd = new IOPort(0x20);
- public readonly IOPort Data = new IOPort(0x21);
-
- internal PIC(bool aSlave) {
- byte aBase = (byte)(aSlave ? 0xA0 : 0x20);
- Cmd = new IOPort(aBase);
- Data = new IOPort((byte)(aBase + 1));
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOPort.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOPort.cs
deleted file mode 100644
index 90704433e9..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/IOPort.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-using System;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU.x86 {
- public abstract class IOPortBase {
- //TODO Make it that IO port classes are exclusive to each port. For example
- // only one IOPort class can be created per port number. This will prevent
- // two instances of an IOPort from using the same port.
- // A locking mechanism is not necessary as the creator can control access
- // to the instance.
- // We are not threaded yet anyways, but when we are will assume the caller
- // or owner handles any concurrency issues so as to minimize overhead in this
- // class. Or maybe some base support can be added to this class, but its functionality
- // is optional and only used by classes that need concurrency control like ATA.
-
- public readonly UInt16 Port;
-
- // all ctors are internal - Only Core ring can create it.. but hardware ring can use it.
- protected IOPortBase(UInt16 aPort) {
- Port = aPort;
- }
-
- protected IOPortBase(UInt16 aBase, UInt16 aOffset) {
- // C# math promotes things to integers, so we have this constructor
- // to relieve the use from having to do so many casts
- Port = (UInt16)(aBase + aOffset);
- }
-
- //TODO: Reads and writes can use this to get port instead of argument
- [PlugMethod(PlugRequired = true)]
- static protected void Write8(UInt16 aPort, byte aData) {
- } // Plugged
-
- [PlugMethod(PlugRequired = true)]
- static protected void Write16(UInt16 aPort, UInt16 aData) {
- } // Plugged
-
- [PlugMethod(PlugRequired = true)]
- static protected void Write32(UInt16 aPort, UInt32 aData) {
- } // Plugged
-
- [PlugMethod(PlugRequired = true)]
- static protected byte Read8(UInt16 aPort) {
- return 0;
- } // Plugged
-
- [PlugMethod(PlugRequired = true)]
- static protected UInt16 Read16(UInt16 aPort) {
- return 0;
- } // Plugged
-
- [PlugMethod(PlugRequired = true)]
- static protected UInt32 Read32(UInt16 aPort) {
- return 0;
- } // Plugged
-
- //TODO: Plug these Reads with asm to read directly to RAM
- // REP INSW
- public void Read8(byte[] aData) {
- UInt16 xValue;
- for (int i = 0; i < aData.Length / 2; i++) {
- xValue = Read16(Port);
- aData[i * 2] = (byte)xValue;
- aData[i * 2 + 1] = (byte)(xValue >> 8);
- }
- }
-
- public void Read16(UInt16[] aData) {
- for (int i = 0; i < aData.Length; i++) {
- aData[i] = Read16(Port);
- }
- }
-
- public void Read32(UInt32[] aData) {
- for (int i = 0; i < aData.Length; i++) {
- aData[i] = Read32(Port);
- }
- }
- }
-
- public class IOPort : IOPortBase {
- public IOPort(UInt16 aPort) : base(aPort) {
- }
-
- public IOPort(UInt16 aBase, UInt16 aOffset) : base(aBase, aOffset) {
- }
-
- static public void Wait() {
- // Write to an unused port. This assures whatever we were waiting on for a previous
- // IO read/write has completed.
- // Port 0x80 is unused after BIOS POST.
- // 0x22 is just a random byte.
- // Since IO is slow - its just a dummy sleep to wait long enough for the previous operation
- // to have effect on the target.
- Write8(0x80, 0x22);
- }
-
- public byte Byte {
- get {
- return Read8(Port);
- }
- set {
- Write8(Port, value);
- }
- }
-
- public UInt16 Word {
- get {
- return Read16(Port);
- }
- set {
- Write16(Port, value);
- }
- }
-
- public UInt32 DWord {
- get {
- return Read32(Port);
- }
- set {
- Write32(Port, value);
- }
- }
- }
-
- // I split these instead of adding CanRead/CanWrite because this enforces
- // at build time, and its also faster at runtime. Finally it allows future optimizations better
- // than checking at runtime.
- public class IOPortRead : IOPortBase {
- public IOPortRead(UInt16 aPort) : base(aPort) {
- }
-
- public IOPortRead(UInt16 aBase, UInt16 aOffset) : base(aBase, aOffset) {
- }
-
- public byte Byte {
- get {
- return Read8(Port);
- }
- }
-
- public UInt16 Word {
- get {
- return Read16(Port);
- }
- }
-
- public UInt32 DWord {
- get {
- return Read32(Port);
- }
- }
- }
-
- public class IOPortWrite : IOPortBase {
- public IOPortWrite(UInt16 aPort) : base(aPort) {
- }
-
- public IOPortWrite(UInt16 aBase, UInt16 aOffset) : base(aBase, aOffset) {
- }
-
- public byte Byte {
- set {
- Write8(Port, value);
- }
- }
-
- public UInt16 Word {
- set {
- Write16(Port, value);
- }
- }
-
- public UInt32 DWord {
- set {
- Write32(Port, value);
- }
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory.cs
deleted file mode 100644
index 5908c286a5..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace Cosmos.CPU.x86 {
- public class Memory2 {
- int mPtr;
- public Memory2(int aPtr) {
- mPtr = aPtr;
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/DataLookupEntry.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/DataLookupEntry.cs
deleted file mode 100644
index 3c1e83f5f0..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/DataLookupEntry.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace Cosmos.CPU.x86.Memory.Old {
- [StructLayout(LayoutKind.Explicit)]
- public unsafe struct DataLookupEntry {
- [FieldOffset(0)]
- public void* DataBlock;
- [FieldOffset(4)]
- public uint Size;
- // Refcount will be UInt32.MaxValue (0xFFFFFFFF) in case the block has been freed, but the memory hasn't been compacted yet
- [FieldOffset(8)]
- public uint Refcount;
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/DataLookupTable.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/DataLookupTable.cs
deleted file mode 100644
index 824fd6d6b1..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/DataLookupTable.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace Cosmos.CPU.x86.Memory.Old {
- // The DataLookupTable (DLT) basically is a double linked list.
- [StructLayout(LayoutKind.Explicit)]
- public unsafe struct DataLookupTable {
- public const int EntriesPerTable = 170;
-
- [FieldOffset(0)]
- public DataLookupTable* Previous;
- [FieldOffset(4)]
- public DataLookupTable* Next;
-
- [FieldOffset(8)]
- public DataLookupEntry FirstEntry;
-
- public unsafe DataLookupEntry* GetEntry(uint index) {
- fixed (DataLookupEntry* xFirstEntryPtr = &FirstEntry) {
- if (index == 0) {
- return xFirstEntryPtr;
- } else {
- return &xFirstEntryPtr[index];
- }
- }
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/GlobalInformationTable.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/GlobalInformationTable.cs
deleted file mode 100644
index bf79ec5b68..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/GlobalInformationTable.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace Cosmos.CPU.x86.Memory.Old {
- [StructLayout(LayoutKind.Explicit)]
- public unsafe struct GlobalInformationTable {
- [FieldOffset(0)]
- public DataLookupTable* FirstDataLookupTable;
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/GlobalSystemInfo.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/GlobalSystemInfo.cs
deleted file mode 100644
index fb1e95ca7e..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/GlobalSystemInfo.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using Cosmos.CPU.x86;
-using Cosmos.Debug.Kernel;
-
-namespace Cosmos.CPU.x86.Memory.Old {
- public static unsafe class GlobalSystemInfo {
- private static volatile GlobalInformationTable* mGlobalInformationTable;
- public static GlobalInformationTable* GlobalInformationTable {
- get {
- EnsureInitialized();
- return mGlobalInformationTable;
- }
- }
-
- public static unsafe void EnsureInitialized() {
- if (mGlobalInformationTable == null) {
- // todo: should we align this structure somehow?
-
- var xEndOfKernel = Processor.GetEndOfKernel();
- xEndOfKernel = xEndOfKernel + 1024 * 1024; // for now, skip 1 MB
- Processor.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + TotalDataLookupTableSize) * 4);
- mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
- uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
- //Debugger.DoSend("Setting FirstDataLookupTable to ");
- //Debugger.DoSendNumber(xFirstDataLookupLocation);
- mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)xFirstDataLookupLocation;
- //Debugger.DoSend("FirstDataLookupTable was set to ");
- //Debugger.DoSendNumber((uint)mGlobalInformationTable->FirstDataLookupTable);
- }
- }
-
- public static uint TotalDataLookupTableSize {
- get {
- return (uint)(sizeof(DataLookupTable) + DataLookupTable.EntriesPerTable * sizeof(DataLookupEntry));
- }
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/Old_Heap.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/Old_Heap.cs
deleted file mode 100644
index 72ca188057..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Memory/Old/Old_Heap.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading.Tasks;
-using Cosmos.Debug.Kernel;
-
-namespace Cosmos.CPU.x86.Memory.Old
-{
- // This class must be static, as for creating objects, we need the heap
- // this heap implementation it the very most basic one: no reentrancy, etc.
- // Interrupts are disabled when trying to allocate a new block of memory.
- public static unsafe class Heap
- {
- private static Debugger mDebugger = new Debugger("Core", "Memory");
-
- private static uint mEndOfRam;
-
- private static uint mLastTableIndex = 0u;
-
- private static uint mLastEntryIndex = 0u;
-
- private static void DoInitialize(uint aEndOfRam)
- {
- mLastTableIndex = 0u;
- mLastEntryIndex = 0u;
- mEndOfRam = aEndOfRam;
- //
- }
-
- private static bool mInitialized = false;
- internal static void EnsureIsInitialized()
- {
- if (!mInitialized)
- {
- mInitialized = true;
- DoInitialize((Processor.GetAmountOfRAM() - 1) * 1024 * 1024);
- //DoInitialize(4 * 1024 * 1024, 16 * 1024 * 1024);
- }
- }
-
- private static void ClearMemory(void* aStartAddress, uint aLength)
- {
- //TODO: Move to memory. Internal access only...
- Processor.ZeroFill((uint)aStartAddress, aLength);
- }
-
- public static uint MemAlloc(uint aLength)
- {
- if (aLength == 0)
- {
- mDebugger.Send(" Request to retrieve block with size = 0 was halted!");
- while (true)
- {
- }
- }
- var xInterruptsWereEnabled = Processor.DisableInterrupts();
- try
- {
- EnsureIsInitialized();
-
- var xCurrentTableIdx = mLastTableIndex;
- DataLookupTable* xCurrentTable = GlobalSystemInfo.GlobalInformationTable->FirstDataLookupTable;
- DataLookupTable* xPreviousTable = null;
- uint xResult;
- #region Loop through existing tables and see if we find a free spot
- while (xCurrentTable != null)
- {
- //mDebugger.Trace($"At address {(uint)xCurrentTable}");
- if (ScanDataLookupTable(xCurrentTableIdx, xCurrentTable, aLength, out xResult))
- {
- if (xResult < Processor.GetEndOfKernel())
- {
- mDebugger.Send("Wrong handle returned!");
- while (true)
- {
- }
- }
- return xResult;
- }
- xCurrentTableIdx++;
- xPreviousTable = xCurrentTable;
- xCurrentTable = xCurrentTable->Next;
- mLastTableIndex = xCurrentTableIdx;
- mLastEntryIndex = 0;
- }
- #endregion Loop through existing tables and see if we find a free spot
-
- // no tables found, lets create a new one, and use that
- if (xPreviousTable == null)
- {
- // this check should theoretically be unnecessary, but lets keep it, to do some double-checking.
- mDebugger.Send("No PreviousTable found!");
- while (true)
- {
- }
- }
- var xLastItem = xPreviousTable->GetEntry(DataLookupTable.EntriesPerTable - 1);
- var xNextTablePointer = (DataLookupTable*)((uint)xLastItem->DataBlock + xLastItem->Size);
- // the memory hasn't been cleared yet, so lets do that now.
- ClearMemory(xNextTablePointer, GlobalSystemInfo.TotalDataLookupTableSize);
- xPreviousTable->Next = xNextTablePointer;
- xNextTablePointer->Previous = xPreviousTable;
-
- if (!ScanDataLookupTable(xCurrentTableIdx, xNextTablePointer, aLength, out xResult))
- {
- // Something seriously weird happened: we could create a new DataLookupTable (with new entries)
- // but couldn't allocate a new handle from it.
- mDebugger.Send(" Something seriously weird happened: we could create a new DataLookupTable (with new entries), but couldn't allocate a new handle from it.");
- while (true)
- {
- }
- }
- mLastTableIndex = xCurrentTableIdx;
- mLastEntryIndex = 0;
- return xResult;
- }
- finally
- {
- if (xInterruptsWereEnabled)
- {
- Processor.EnableInterrupts();
- }
- else
- {
- //mDebugger.Trace(" Not enabling interrupts, because they weren't enabled yet!");
- }
- }
- }
-
- private static bool ScanDataLookupTable(uint aTableIdx, DataLookupTable* aTable, uint aSize, out uint aHandle)
- {
- DataLookupEntry* xPreviousEntry = null;
- for (uint i = mLastEntryIndex; i < DataLookupTable.EntriesPerTable; i++)
- {
- var xCurrentEntry = aTable->GetEntry(i);
-
- //mDebugger.Trace($"Item.Size", xCurrentEntry->Size);
- //mDebugger.Trace($"Item.Refcount", xCurrentEntry->Refcount);
- if (xCurrentEntry->Size == 0)
- {
- #region Found an uninitialized entry
- // found an entry now. Let's set it
- if (aTable->Next != null)
- {
- // once a handle is used, the size should be set. But at this point, it somehow got unset again.
- // This should never occur.
- mDebugger.Send("Found an entry which has no size, but there is a followup DataLookupTable");
- while (true)
- {
- }
- }
-
- void* xDataBlock;
- //mDebugger.Trace("Now calculate datablock pointer");
- // now we found ourself a free handle
- if (i == 0)
- {
- //mDebugger.Trace("Using table end");
- // we don't have a previous handle yet, so we take the FirstByteAfterTable field of the DataLookupTable
- // note: we're explicitly initializing all blocks, as memory hasn't been cleared yet.
- var xTableAddr = (uint)aTable;
- //mDebugger.Trace($"aTableAddr", xTableAddr);
- var xTotalTableSize = GlobalSystemInfo.TotalDataLookupTableSize;
- //mDebugger.Trace($"TotalTableSize", xTotalTableSize);
- xDataBlock = (void*)((uint)aTable + GlobalSystemInfo.TotalDataLookupTableSize);
- }
- else
- {
- //mDebugger.Trace("Using previous entry");
- // We're not the very first handle being assigned, so calculate the start address using the previous block
- xDataBlock = (void*)((uint)xPreviousEntry->DataBlock + xPreviousEntry->Size);
- }
-
- // make sure the memory is empty
- ClearMemory(xDataBlock, aSize);
- //mDebugger.Trace("Cleared memory");
- xCurrentEntry->Size = aSize;
- xCurrentEntry->DataBlock = xDataBlock;
- xCurrentEntry->Refcount = 1;
-
- aHandle = (uint)xCurrentEntry->DataBlock;
- //mDebugger.Trace($"Returning handle ", aHandle);
- mLastEntryIndex = i;
- #endregion Found an uninitialized entry
- return true;
- }
-
- // Refcount == UInt32.MaxValue, it means that the block has been reclaimed, and can be reused now.
- if (xCurrentEntry->Refcount == UInt32.MaxValue)
- {
- // we can reuse this entry if its Size >= aLength
- if (xCurrentEntry->Size >= aSize)
- {
- // we can reuse this entry
- xCurrentEntry->Refcount = 1;
- aHandle = (uint)xCurrentEntry->DataBlock;
- mLastEntryIndex = i;
- return true;
- }
- }
- xPreviousEntry = xCurrentEntry;
- }
- aHandle = 0;
- return false;
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/PIC.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/PIC.cs
deleted file mode 100644
index 5ab467fd3f..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/PIC.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-namespace Cosmos.CPU.x86 {
- // PIC is not in hardware becuase its a special core piece like Processor that is not interacted with by anything except Core.
- //
- // Remaps the IRQ's to INT20-INT2F
- public class PIC {
- // This is here and not in BaseGroups for 2 reasons.
- // 1) Its needed before the other Basegroups are created.
- // 2) Its only used by this class, and it also exists in Core.
- protected IOGroup.PIC Master = new IOGroup.PIC(false);
- protected IOGroup.PIC Slave = new IOGroup.PIC(true);
-
- protected enum Cmd {
- Init = 0x10,
- EOI = 0x20
- }
-
- public void EoiMaster() {
- Master.Cmd.Byte = (byte)Cmd.EOI;
- }
-
- public void EoiSlave() {
- Master.Cmd.Byte = (byte)Cmd.EOI;
- Slave.Cmd.Byte = (byte)Cmd.EOI;
- }
-
- public PIC() {
- // MTW: to disable PIT, send 0x01 to Master mask
- // Right now we mask all IRQs. We enable them as we add
- // support for them. The 0x08 on master MUST remain. IRQ7
- // has a problem of "spurious requests" and is therefore unreliable.
- // It used for LPT2 (and sometimes old 8 bit sound blasters). We likely
- // won't need either of those for a very long time, so we just mask it
- // completely. For more info:
- // http://en.wikipedia.org/wiki/Intel_8259#Spurious_Interrupts
-
- //Init(Master, 0x20, 4, 0xFD | 0x08);
- //Init(Slave, 0x28, 2, 0xFF);
- //for now enable keyboard, mouse(ps2)
- Remap(0x20, 0xF9 | 0x08, 0x28, 0xEF);
-
- }
-
- private void Remap(byte masterStart, byte masterMask, byte slaveStart, byte slaveMask) {
- #region consts
-
- // source: osdev.org
-
-#pragma warning disable
- const byte ICW1_ICW4 = 0x01; // ICW4 (not) needed
- const byte ICW1_SINGLE = 0x02; // Single (cascade) mode
- const byte ICW1_INTERVAL4 = 0x04; // Call address interval 4 (8)
- const byte ICW1_LEVEL = 0x08; // Level triggered (edge) mode
- const byte ICW1_INIT = 0x10;
-
- const byte ICW4_8086 = 0x01; // 8086/88 mode
- const byte ICW4_AUTO = 0x02; // auto (normal) EOI
- const byte ICW4_BUF_SLAVE = 0x08; // buffered mode/slave
- const byte ICW4_BUF_MASTER = 0x0C; // buffered mode/master
- const byte ICW4_SFNM = 0x10; // special fully nested (not)
-#pragma warning restore
-
- #endregion
-
- var xOldMasterMask = Master.Data.Byte;
- var xOldSlaveMask = Slave.Data.Byte;
- Master.Cmd.Byte = ICW1_INIT + ICW1_ICW4;
- IOPort.Wait();
- Slave.Cmd.Byte = ICW1_INIT + ICW1_ICW4;
- IOPort.Wait();
- Master.Data.Byte = masterStart;
- IOPort.Wait();
- Slave.Data.Byte = slaveStart;
- IOPort.Wait();
-
- // magic:
- Master.Data.Byte = 4;
- IOPort.Wait();
- Slave.Data.Byte = 2;
- IOPort.Wait();
-
- // set modes:
- Master.Data.Byte = ICW4_8086;
- IOPort.Wait();
- Slave.Data.Byte = ICW4_8086;
- IOPort.Wait();
-
- // set masks:
- Master.Data.Byte = masterMask;
- IOPort.Wait();
- Slave.Data.Byte = slaveMask;
- IOPort.Wait();
- }
-
- protected void Init(IOGroup.PIC aPIC, byte aBase, byte aIDunno, byte aMask) {
- // We need to remap the PIC interrupt lines to the Processor. The BIOS sets
- // them in a way compatible for 16 bit mode, but in a way that causes problems
- // for 32 bit mode.
- // The only way to remap them however is to completely reinitialize the PICs.
-
- byte xOldMask = aPIC.Data.Byte;
-
- //#define ICW1_ICW4 0x01 /* ICW4 (not) needed */
- //#define ICW1_SINGLE 0x02 /* Single (cascade) mode */
- //#define ICW1_INTERVAL4 0x04 /* Call address interval 4 (8) */
- //#define ICW1_LEVEL 0x08 /* Level triggered (edge) mode */
- Master.Cmd.Byte = (byte)Cmd.Init | 0x01;
- IOPort.Wait();
-
- // ICW2
- Master.Data.Byte = aBase;
- IOPort.Wait();
-
- // ICW3
- // Somehow tells them about master/slave relationship
- Master.Data.Byte = aIDunno;
- IOPort.Wait();
-
- //#define ICW4_AUTO 0x02 /C:\Data\Cosmos\source2\Kernel\System\Hardware\Core\Cosmos.Core\Processor.cs* Auto (normal) EOI */
- //#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
- //#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
- //#define ICW4_SFNM 0x10 /* Special fully nested (not) */
- //0x01 8086/88 (MCS-80/85) mode
- Master.Data.Byte = 0x01;
- IOPort.Wait();
-
- // Set mask
- Master.Data.Byte = aMask;
- IOPort.Wait();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/PIC.html b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/PIC.html
deleted file mode 100644
index 55687a707b..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/PIC.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
- http://wiki.osdev.org/PIC
-
- http://wiki.osdev.org/I_Cant_Get_Interrupts_Working
-
-
- APIC
- http://wiki.osdev.org/APIC
-
- http://www.intel.com/design/chipsets/datashts/290566.htm
-
- http://en.wikipedia.org/wiki/Intel_APIC_Architecture
-
-
-
-
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Processor.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Processor.cs
deleted file mode 100644
index 52043edd0e..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/Processor.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU.x86 {
- // Non hardware class, only used by core and hardware drivers for ports etc.
- public class Processor {
- // Amount of RAM in MB's.
- // needs to be static, as Heap needs it before we can instantiate objects
- [PlugMethod(PlugRequired = true)]
- public static uint GetAmountOfRAM() {
- throw new NotImplementedException();
- }
-
- // needs to be static, as Heap needs it before we can instantiate objects
- [PlugMethod(PlugRequired = true)]
- public static uint GetEndOfKernel() {
- throw new NotImplementedException();
- }
-
- [PlugMethod(PlugRequired = true)]
- public void UpdateIDT(bool aEnableInterruptsImmediately) {
- throw new NotImplementedException();
- }
-
- [PlugMethod(PlugRequired = true)]
- public void InitFloat() {
- throw new NotImplementedException();
- }
-
- [PlugMethod(PlugRequired = true)]
- public void InitSSE() {
- throw new NotImplementedException();
- }
-
- [PlugMethod(PlugRequired = true)]
- public static void ZeroFill(uint aStartAddress, uint aLength) {
- throw new NotImplementedException();
- }
-
- [PlugMethod(PlugRequired = true)]
- public void Halt() {
- throw new NotImplementedException();
- }
-
- public void Reboot() {
- // Disable all interrupts
- DisableInterrupts();
-
- var myPort = new IOPort(0x64);
- while ((myPort.Byte & 0x02) != 0) {
- }
- myPort.Byte = 0xFE;
- Halt(); // If it didn't work, Halt the Processor
- }
-
- private static void DoEnableInterrupts() {
- throw new NotImplementedException();
- }
-
- private static void DoDisableInterrupts() {
- throw new NotImplementedException();
- }
-
- [AsmMarker(AsmMarker.Type.Processor_IntsEnabled)]
- public static bool mInterruptsEnabled;
-
- public static void EnableInterrupts() {
- mInterruptsEnabled = true;
- DoEnableInterrupts();
- }
-
- ///
- /// Returns if the interrupts were actually enabled
- ///
- ///
- public static bool DisableInterrupts() {
- DoDisableInterrupts();
- var xResult = mInterruptsEnabled;
- mInterruptsEnabled = false;
- return xResult;
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs
deleted file mode 100644
index 38a4404a34..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU.x86/TempDebug.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-namespace Cosmos.CPU.x86 {
- static public class TempDebug {
- unsafe static byte* mPtr = (byte*)(0xB8000 - 1);
- static public void ShowText(char aChar) {
- unsafe {
- mPtr++;
- *mPtr = (byte)aChar;
-
- mPtr++;
- *mPtr = 0x0A;
- }
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Array/ArrayGetLengthAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Array/ArrayGetLengthAsm.cs
deleted file mode 100644
index 0f563b7d15..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Array/ArrayGetLengthAsm.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm
-{
- public class ArrayGetLengthAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- // $this ebp+8
- XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 8);
- XS.Set(XSRegisters.EAX, XSRegisters.EAX, sourceDisplacement: 8, sourceIsIndirect: true); // element count
- XS.Push(XSRegisters.EAX);
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Array/ArrayInternalCopyAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Array/ArrayInternalCopyAsm.cs
deleted file mode 100644
index 03a8e9fafe..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Array/ArrayInternalCopyAsm.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-using IL2CPU.API;
-using XSharp;
-using XSharp.Assembler;
-using XSharp.Assembler.x86;
-using static XSharp.XSRegisters;
-
-namespace Cosmos.CPU_Asm
-{
- public class ArrayInternalCopyAsm : AssemblerMethod
- {
- private const int SourceArrayDisplacement = 36;
- private const int SourceIndexDisplacement = 28;
- private const int DestinationArrayDisplacement = 24;
- private const int DestinationIndexDisplacement = 16;
- private const int LengthDisplacement = 12;
-
- /* void Copy(
- * Array sourceArray, ebp + 36
- * int sourceIndex, ebp + 28
- * Array destinationArray, ebp + 24
- * int destinationIndex, ebp + 16
- * int length, ebp + 12
- * bool reliable); ebp + 8
- */
-
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- var xArrayCopyReverseLabel = "ArrayCopy_Reverse";
- var xArrayCopyReverseLoopLabel = "ArrayCopy_Reverse_Loop";
- var xArrayCopyEndLabel = "ArrayCopy_End";
-
- XS.Comment("Source");
- XS.Comment("Element size");
- XS.Set(EAX, EBP, sourceDisplacement: SourceArrayDisplacement);
- XS.Add(EAX, ObjectUtils.FieldDataOffset);
- XS.Set(EAX, EAX, sourceIsIndirect: true); // element size
- XS.Comment("Source ptr");
- XS.Set(EBX, EBP, sourceDisplacement: SourceIndexDisplacement);
- XS.Multiply(EBX);
- XS.Add(EAX, ObjectUtils.FieldDataOffset + 4); // first element
- XS.Set(ESI, EBP, sourceDisplacement: SourceArrayDisplacement);
- XS.Add(ESI, EAX); // source ptr
-
- XS.Comment("Destination");
- XS.Comment("Element size");
- XS.Set(EAX, EBP, sourceDisplacement: DestinationArrayDisplacement);
- XS.Add(EAX, ObjectUtils.FieldDataOffset);
- XS.Set(EAX, EAX, sourceIsIndirect: true); // element size
- XS.Comment("Destination ptr");
- XS.Set(ECX, EBP, sourceDisplacement: DestinationIndexDisplacement);
- XS.Multiply(ECX);
- XS.Add(EAX, ObjectUtils.FieldDataOffset + 4); // first element
- XS.Set(EDI, EBP, sourceDisplacement: DestinationArrayDisplacement);
- XS.Add(EDI, EAX); // destination ptr
-
- XS.Compare(EDI, ESI);
- XS.Jump(ConditionalTestEnum.Equal, xArrayCopyEndLabel);
-
- XS.Comment("Copy byte count");
- XS.Comment("Element size");
- XS.Set(EAX, EBP, sourceDisplacement: DestinationArrayDisplacement);
- XS.Add(EAX, ObjectUtils.FieldDataOffset);
- XS.Set(EAX, EAX, sourceIsIndirect: true); // element size
- XS.Comment("Count");
- XS.Set(EDX, EBP, sourceDisplacement: LengthDisplacement);
-
- // if length is 0, jump to end
- XS.Compare(EDX, 0);
- XS.Jump(ConditionalTestEnum.Equal, xArrayCopyEndLabel);
-
- XS.Multiply(EDX);
- XS.Set(ECX, EAX);
-
- XS.Compare(EDI, ESI);
- XS.Jump(ConditionalTestEnum.GreaterThan, xArrayCopyReverseLabel);
-
- new Movs { Size = 8, Prefixes = InstructionPrefixes.Repeat };
-
- XS.Jump(xArrayCopyEndLabel);
-
- XS.Label(xArrayCopyReverseLabel);
-
- XS.Add(ESI, ECX);
- XS.Add(EDI, ECX);
-
- XS.Label(xArrayCopyReverseLoopLabel);
-
- XS.Decrement(ESI);
- XS.Decrement(EDI);
- XS.Decrement(ECX);
-
- XS.Set(AL, ESI, sourceIsIndirect: true);
- XS.Set(EDI, AL, destinationIsIndirect: true);
-
- XS.Compare(ECX, 0);
- XS.Jump(ConditionalTestEnum.NotEqual, xArrayCopyReverseLoopLabel);
-
- XS.Label(xArrayCopyEndLabel);
- }
- }
-}
-
-// Old implementation
-// (it's a good memcpy implementation, as it doesn't check for array overlapping, so it can't be used for Array.Copy)
-
-//using Cosmos.Assembler;
-//using Cosmos.Assembler.x86;
-//using IL2CPU.API;
-//using XSharp.Common;
-//using static XSharp.Common.XSRegisters;
-
-//namespace Cosmos.Core_Asm
-//{
-// public class ArrayInternalCopyAsm : AssemblerMethod
-// {
-// private const int SourceArrayDisplacement = 36;
-// private const int SourceIndexDisplacement = 28;
-// private const int DestinationArrayDisplacement = 24;
-// private const int DestinationIndexDisplacement = 16;
-// private const int LengthDisplacement = 12;
-
-// /* void Copy(
-// * Array sourceArray, ebp + 36
-// * int sourceIndex, ebp + 28
-// * Array destinationArray, ebp + 24
-// * int destinationIndex, ebp + 16
-// * int length, ebp + 12
-// * bool reliable); ebp + 8
-// */
-
-// public override void AssembleNew(Assembler.Assembler aAssembler, object aMethodInfo)
-// {
-// XS.Comment("Source");
-// XS.Comment("Element size");
-// XS.Set(EAX, EBP, sourceDisplacement: SourceArrayDisplacement);
-// XS.Add(EAX, ObjectUtils.FieldDataOffset);
-// XS.Set(EAX, EAX, sourceIsIndirect: true); // element size
-// XS.Comment("Source ptr");
-// XS.Set(EBX, EBP, sourceDisplacement: SourceIndexDisplacement);
-// XS.Multiply(EBX);
-// XS.Add(EAX, ObjectUtils.FieldDataOffset + 4); // first element
-// XS.Set(ESI, EBP, sourceDisplacement: SourceArrayDisplacement);
-// XS.Add(ESI, EAX); // source ptr
-
-// XS.Comment("Destination");
-// XS.Comment("Element size");
-// XS.Set(EAX, EBP, sourceDisplacement: DestinationArrayDisplacement);
-// XS.Add(EAX, ObjectUtils.FieldDataOffset);
-// XS.Set(EAX, EAX, sourceIsIndirect: true); // element size
-// XS.Comment("Destination ptr");
-// XS.Set(ECX, EBP, sourceDisplacement: DestinationIndexDisplacement);
-// XS.Multiply(ECX);
-// XS.Add(EAX, ObjectUtils.FieldDataOffset + 4); // first element
-// XS.Set(EDI, EBP, sourceDisplacement: DestinationArrayDisplacement);
-// XS.Add(EDI, EAX); // destination ptr
-
-// XS.Comment("Copy byte count");
-// XS.Comment("Element size");
-// XS.Set(EAX, EBP, sourceDisplacement: DestinationArrayDisplacement);
-// XS.Add(EAX, ObjectUtils.FieldDataOffset);
-// XS.Set(EAX, EAX, sourceIsIndirect: true); // element size
-// XS.Comment("Count");
-// XS.Set(EDX, EBP, sourceDisplacement: LengthDisplacement);
-// XS.Multiply(EDX);
-// XS.Set(ECX, EAX);
-// new Movs { Size = 8, Prefixes = InstructionPrefixes.Repeat };
-// }
-// }
-//}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/ArrayImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/ArrayImpl.cs
deleted file mode 100644
index c7b9d6218c..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/ArrayImpl.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU_Asm
-{
- [Plug(Target = typeof(Array))]
- public class ArrayImpl
- {
- [PlugMethod(Assembler = typeof(ArrayGetLengthAsm))]
- public static int get_Length(Array aThis)
- {
- throw new NotImplementedException();
- }
-
- [PlugMethod(Assembler = typeof(ArrayInternalCopyAsm))]
- public static void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length, bool reliable)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUDisableINTsAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUDisableINTsAsm.cs
deleted file mode 100644
index 29b0096372..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUDisableINTsAsm.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUDisableINTsAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.ClearInterruptFlag();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUEnableINTsAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUEnableINTsAsm.cs
deleted file mode 100644
index c3c0c1c8a8..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUEnableINTsAsm.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUEnableINTsAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.EnableInterrupts();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUGetAmountOfRAMAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUGetAmountOfRAMAsm.cs
deleted file mode 100644
index 76e8e62900..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUGetAmountOfRAMAsm.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUGetAmountOfRAMAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Set(XSRegisters.EAX, "MultiBootInfo_Memory_High", sourceIsIndirect: true);
- XS.Xor(XSRegisters.EDX, XSRegisters.EDX);
- XS.Set(XSRegisters.ECX, 1024);
- XS.Divide(XSRegisters.ECX);
- XS.Add(XSRegisters.EAX, 1);
- XS.Push(XSRegisters.EAX);
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUGetEndOfKernelAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUGetEndOfKernelAsm.cs
deleted file mode 100644
index 5bf667cd27..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUGetEndOfKernelAsm.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUGetEndOfKernelAsm : AssemblerMethod {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo) {
- XS.Push("_end_code");
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUHaltAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUHaltAsm.cs
deleted file mode 100644
index 8efdbf7735..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUHaltAsm.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUHaltAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Halt();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUInitFloatAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUInitFloatAsm.cs
deleted file mode 100644
index 21c40131e0..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUInitFloatAsm.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUInitFloatAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.FPU.FloatInit();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUInitSSEAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUInitSSEAsm.cs
deleted file mode 100644
index 0a2acf12af..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUInitSSEAsm.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class CPUInitSSEAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.SSE.SSEInit();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUUpdateIDTAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUUpdateIDTAsm.cs
deleted file mode 100644
index d95949a38f..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUUpdateIDTAsm.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using System;
-using System.Reflection;
-
-using Cosmos.CPU.x86;
-
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-
-using XSharp;
-using XSharp.Assembler;
-using XSharp.Assembler.x86;
-using static XSharp.XSRegisters;
-
-namespace Cosmos.CPU_Asm
-{
- //TODO: This asm refs Hardware.. should not.. its a higher ring
- public class CPUUpdateIDTAsm : AssemblerMethod
- {
- private static MethodBase GetMethodDef(Assembly aAssembly, string aType, string aMethodName, bool aErrorWhenNotFound)
- {
- Type xType = aAssembly.GetType(aType, false);
- if (xType != null)
- {
- MethodBase xMethod = xType.GetMethod(aMethodName);
- if (xMethod != null)
- {
- return xMethod;
- }
- }
- if (aErrorWhenNotFound)
- {
- throw new Exception("Method '" + aType + "::" + aMethodName + "' not found!");
- }
- return null;
- }
-
- private static MethodBase GetInterruptHandler(byte aInterrupt)
- {
- return GetMethodDef(typeof(INTs).Assembly, typeof(INTs).FullName
- , "HandleInterrupt_" + aInterrupt.ToString("X2"), false);
- }
-
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- // IDT is already initialized but just for base hooks, and asm only.
- // ie Int 1, 3 and GPF
- // This routine updates the IDT now that we have C# running to allow C# hooks to handle
- // the other INTs
-
- // We are updating the IDT, disable interrupts
- XS.ClearInterruptFlag();
-
- for (int i = 0; i < 256; i++)
- {
- // These are already mapped, don't remap them.
- // Maybe in the future we can look at ones that are present
- // and skip them, but some we may want to overwrite anyways.
- if (i == 1 || i == 3)
- {
- continue;
- }
-
- XS.Set(EAX, "__ISR_Handler_" + i.ToString("X2"));
- XS.Set("_NATIVE_IDT_Contents", AL, destinationDisplacement: i * 8 + 0);
- XS.Set("_NATIVE_IDT_Contents", AH, destinationDisplacement: i * 8 + 1);
- XS.Set("_NATIVE_IDT_Contents", 0x8, destinationDisplacement: i * 8 + 2, size: RegisterSize.Byte8);
- XS.Set("_NATIVE_IDT_Contents", 0x8E, destinationDisplacement: i * 8 + 5, size: RegisterSize.Byte8);
- XS.ShiftRight(EAX, 16);
- XS.Set("_NATIVE_IDT_Contents", AL, destinationDisplacement: i * 8 + 6);
- XS.Set("_NATIVE_IDT_Contents", AH, destinationDisplacement: i * 8 + 7);
- }
-
- XS.Jump("__AFTER__ALL__ISR__HANDLER__STUBS__");
- var xInterruptsWithParam = new[] { 8, 10, 11, 12, 13, 14 };
- for (int j = 0; j < 256; j++)
- {
- XS.Label("__ISR_Handler_" + j.ToString("X2"));
- XS.Call("__INTERRUPT_OCCURRED__");
-
- if (Array.IndexOf(xInterruptsWithParam, j) == -1)
- {
- XS.Push(0);
- }
- XS.Push((uint)j);
- XS.PushAllRegisters();
-
- XS.Sub(ESP, 4);
- XS.Set(EAX, ESP); // preserve old stack address for passing to interrupt handler
-
- // store floating point data
- XS.And(ESP, 0xfffffff0); // fxsave needs to be 16-byte alligned
- XS.Sub(ESP, 512); // fxsave needs 512 bytes
- XS.SSE.FXSave(ESP, isIndirect: true); // save the registers
- XS.Set(EAX, ESP, destinationIsIndirect: true);
-
- XS.Push(EAX); //
- XS.Push(EAX); // pass old stack address (pointer to InterruptContext struct) to the interrupt handler
-
- XS.JumpToSegment(8, "__ISR_Handler_" + j.ToString("X2") + "_SetCS");
- XS.Label("__ISR_Handler_" + j.ToString("X2") + "_SetCS");
- MethodBase xHandler = GetInterruptHandler((byte)j);
- if (xHandler == null)
- {
- xHandler = GetMethodDef(typeof(INTs).Assembly, typeof(INTs).FullName, "HandleInterrupt_Default", true);
- }
- XS.Call(LabelName.Get(xHandler));
- XS.Pop(EAX);
- XS.SSE.FXRestore(ESP, isIndirect: true);
-
- XS.Set(ESP, EAX); // this restores the stack for the FX stuff, except the pointer to the FX data
- XS.Add(ESP, 4); // "pop" the pointer
-
- XS.PopAllRegisters();
-
- XS.Add(ESP, 8);
- XS.Label("__ISR_Handler_" + j.ToString("X2") + "_END");
- XS.InterruptReturn();
- }
- XS.Label("__INTERRUPT_OCCURRED__");
- XS.Return();
- XS.Label("__AFTER__ALL__ISR__HANDLER__STUBS__");
- XS.Noop();
- XS.Set(EAX, EBP, sourceDisplacement: 8);
- XS.Compare(EAX, 0);
- XS.Jump(ConditionalTestEnum.Zero, ".__AFTER_ENABLE_INTERRUPTS");
-
- // reload interrupt list
- XS.Set(EAX, "_NATIVE_IDT_Pointer");
- XS.Set(AsmMarker.Labels[AsmMarker.Type.Processor_IntsEnabled], 1, destinationIsIndirect: true, size: RegisterSize.Byte8);
- XS.LoadIdt(EAX, isIndirect: true);
- // Reenable interrupts
- XS.EnableInterrupts();
-
- XS.Label(".__AFTER_ENABLE_INTERRUPTS");
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUZeroFillAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUZeroFillAsm.cs
deleted file mode 100644
index 7030bb3fd0..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPU/CPUZeroFillAsm.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using XSharp.Assembler;
-using XSharp;
-using x86 = XSharp.Assembler.x86;
-
-namespace Cosmos.CPU_Asm
-{
- public class CPUZeroFillAsm : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.ClearDirectionFlag();
- XS.Set(XSRegisters.EDI, XSRegisters.EBP, sourceDisplacement: 0xC); //address
- XS.Set(XSRegisters.ECX, XSRegisters.EBP, sourceDisplacement: 0x8); //length
- // set EAX to value of fill (zero)
- XS.Xor(XSRegisters.EAX, XSRegisters.EAX);
- XS.ShiftRight(XSRegisters.ECX, 1);
- XS.Jump(x86.ConditionalTestEnum.NotBelow, ".step2");
- XS.StoreByteInString();
- XS.Label(".step2");
- XS.ShiftRight(XSRegisters.ECX, 1);
- XS.Jump(x86.ConditionalTestEnum.NotBelow, ".step3");
- XS.StoreWordInString();
- XS.Label(".step3");
- new x86.Stos { Size = 32, Prefixes = x86.InstructionPrefixes.Repeat };
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPUImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPUImpl.cs
deleted file mode 100644
index ccc05cb4ae..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/CPUImpl.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using IL2CPU.API.Attribs;
-using Cosmos.CPU.x86;
-
-namespace Cosmos.CPU_Asm {
- [Plug(Target = typeof(Processor))]
- public class CPUImpl {
- [PlugMethod(Assembler = typeof(CPUUpdateIDTAsm))]
- public static void UpdateIDT(Processor aThis, bool aEnableInterruptsImmediately) {
- }
-
- [PlugMethod(Assembler = typeof(CPUGetAmountOfRAMAsm))]
- public static uint GetAmountOfRAM() {
- return 0;
- }
-
- [PlugMethod(Assembler = typeof(CPUGetEndOfKernelAsm))]
- public static uint GetEndOfKernel() {
- return 0;
- }
-
- [PlugMethod(Assembler = typeof(CPUZeroFillAsm))]
- // TODO: implement this using REP STOSB and REPO STOSD
- public static void ZeroFill(uint aStartAddress, uint aLength) {
- }
-
- [PlugMethod(Assembler = typeof(CPUInitFloatAsm))]
- public static void InitFloat(Processor aThis) {
- }
-
- [PlugMethod(Assembler = typeof(CPUInitSSEAsm))]
- public static void InitSSE(Processor aThis) {
- }
-
- [PlugMethod(Assembler = typeof(CPUHaltAsm))]
- public static void Halt(Processor aThis) {
- }
-
- [PlugMethod(Assembler = typeof(CPUDisableINTsAsm))]
- public static void DoDisableInterrupts() {
- }
-
- [PlugMethod(Assembler = typeof(CPUEnableINTsAsm))]
- public static void DoEnableInterrupts() {
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Cosmos.CPU_Asm.csproj b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Cosmos.CPU_Asm.csproj
deleted file mode 100644
index fd7a67d10f..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Cosmos.CPU_Asm.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- net6.0
- true
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Cosmos.cfg b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Cosmos.cfg
deleted file mode 100644
index dcb76c5045..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: Debug
\ No newline at end of file
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateCtorAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateCtorAsm.cs
deleted file mode 100644
index bf48eb6f61..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateCtorAsm.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System.Reflection;
-using XSharp.Assembler;
-using Cosmos.IL2CPU;
-using Cosmos.IL2CPU.X86.IL;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class DelegateCtorAsm : AssemblerMethod {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo) {
- // method signature: $this, object @object, IntPtr method
- var xAssembler = aAssembler;
- var xMethodInfo = (Il2cpuMethodInfo)aMethodInfo;
- XS.Comment("Save target ($this) to field");
- XS.Comment("-- ldarg 0");
- Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
- XS.Comment("-- ldarg 1");
- Ldarg.DoExecute(xAssembler, xMethodInfo, 1);
- XS.Comment("-- stfld _target");
- Stfld.DoExecute(xAssembler, xMethodInfo, "System.Object System.Delegate._target", xMethodInfo.MethodBase.DeclaringType, true, false);
- XS.Comment("Save method pointer to field");
- XS.Comment("-- ldarg 0");
- Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
- XS.Comment("-- ldarg 2");
- Ldarg.DoExecute(xAssembler, xMethodInfo, 2);
- XS.Comment("-- stfld _methodPtr");
- Stfld.DoExecute(xAssembler, xMethodInfo, "System.IntPtr System.Delegate._methodPtr", xMethodInfo.MethodBase.DeclaringType, true, false);
- XS.Comment("Saving ArgSize to field");
- uint xSize = 0;
- foreach (var xArg in xMethodInfo.MethodBase.DeclaringType.GetMethod("Invoke").GetParameters()) {
- xSize += ILOp.Align(ILOp.SizeOfType(xArg.ParameterType), 4);
- }
-
- XS.Comment("-- ldarg 0");
- Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
- XS.Comment("-- push argsize");
- XS.Push(xSize);
- XS.Comment("-- stfld ArgSize");
- Stfld.DoExecute(xAssembler, xMethodInfo, "$$ArgSize$$", xMethodInfo.MethodBase.DeclaringType, true, false);
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateGetMulticastInvokeAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateGetMulticastInvokeAsm.cs
deleted file mode 100644
index 0b5d852800..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateGetMulticastInvokeAsm.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Reflection;
-using XSharp.Assembler;
-using Cosmos.IL2CPU;
-using XSharp;
-
-namespace Cosmos.CPU_Asm {
- public class DelegateGetMulticastInvokeAsm : AssemblerMethod {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo) {
- var xAssembler = aAssembler;
- var xMethodInfo = (MethodInfo)aMethodInfo;
- var xDelegate = typeof(global::System.Delegate);
- var xMethod = xDelegate.GetMethod("GetInvokeMethod", BindingFlags.NonPublic | BindingFlags.Instance);
- XS.Push(ILOp.GetLabel(xMethod));
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateInvokeAsm.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateInvokeAsm.cs
deleted file mode 100644
index b7f00f21ba..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Delegate/DelegateInvokeAsm.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using System;
-
-using IL2CPU.API;
-using Cosmos.IL2CPU;
-using Cosmos.IL2CPU.X86.IL;
-
-using XSharp;
-using XSharp.Assembler;
-using x86 = XSharp.Assembler.x86;
-
-// ReSharper disable once CheckNamespace
-namespace Cosmos.CPU_Asm {
- public class DelegateInvokeAsm : AssemblerMethod {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo) {
- var xAssembler = aAssembler;
- var xMethodInfo = (Il2cpuMethodInfo)aMethodInfo;
- var xMethodBaseAsInfo = xMethodInfo.MethodBase as global::System.Reflection.MethodInfo;
- if (xMethodBaseAsInfo.ReturnType != typeof(void)) {
- throw new Exception("Events with return type not yet supported!");
- }
-
- /*
- * EAX contains the GetInvocationList() array at the index at which it was last used
- * EDX contains the index at which the EAX is
- * EBX contains the number of items in the array
- * ECX contains the argument size
- */
-
- XS.ClearInterruptFlag();
-
- XS.Comment("Get Invoke list count");
- var xGetInvocationListMethod = typeof(MulticastDelegate).GetMethod("GetInvocationList");
- Ldarg.DoExecute(aAssembler, xMethodInfo, 0);
- XS.Call(LabelName.Get(xGetInvocationListMethod));
- XS.Add(XSRegisters.ESP, 4);
- XS.Pop(XSRegisters.EAX);
- XS.Add(XSRegisters.EAX, 8);
- XS.Set(XSRegisters.EBX, XSRegisters.EAX, sourceIsIndirect: true);
-
- XS.Comment("Get invoke method");
- XS.Add(XSRegisters.EAX, 8);
- XS.Set(XSRegisters.EDI, XSRegisters.EAX, sourceIsIndirect: true, sourceDisplacement: 4);
-
- XS.Comment("Get ArgSize");
- int xArgSizeOffset = Ldfld.GetFieldOffset(typeof(global::System.Delegate), "$$ArgSize$$");
- Ldarg.DoExecute(aAssembler, xMethodInfo, 0);
- XS.Add(XSRegisters.ESP, 4);
- XS.Pop(XSRegisters.ECX);
- XS.Add(XSRegisters.ECX, (uint)xArgSizeOffset);
- XS.Set(XSRegisters.ECX, XSRegisters.ECX, sourceIsIndirect: true);
-
- XS.Comment("Set current invoke list index");
- XS.Set(XSRegisters.EDX, 0);
-
- XS.Label(".BEGIN_OF_LOOP");
- {
- XS.Compare(XSRegisters.EDX, XSRegisters.EBX);
- XS.Jump(x86.ConditionalTestEnum.GreaterThanOrEqualTo, ".END_OF_INVOKE");
-
- XS.PushAllRegisters();
-
- XS.Comment("Check if delegate has $this");
- XS.Set(XSRegisters.EDI, XSRegisters.EBP, sourceDisplacement: Ldarg.GetArgumentDisplacement(xMethodInfo, 0));
- XS.Add(XSRegisters.EDI, 4);
- XS.Set(XSRegisters.EDI, XSRegisters.EDI, sourceDisplacement: Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "System.Object System.Delegate._target"));
- XS.Compare(XSRegisters.EDI, 0);
- XS.Jump(x86.ConditionalTestEnum.Zero, ".NO_THIS");
- XS.Label(".HAS_THIS");
- XS.Push(XSRegisters.EDI);
- XS.Push(0);
- XS.Label(".NO_THIS");
- XS.Set(XSRegisters.EDI, XSRegisters.EAX, sourceIsIndirect: true, sourceDisplacement: 4);
- XS.Set(XSRegisters.EDI, XSRegisters.EDI, sourceDisplacement: Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "System.IntPtr System.Delegate._methodPtr"));
-
- XS.Comment("Check if delegate has args");
- XS.Compare(XSRegisters.ECX, 0);
- XS.Jump(x86.ConditionalTestEnum.Zero, ".NO_ARGS");
- XS.Label(".HAS_ARGS");
- XS.Sub(XSRegisters.ESP, XSRegisters.ECX);
- XS.Push(XSRegisters.EDI);
- XS.Set(XSRegisters.EDI, XSRegisters.ESP);
- XS.Add(XSRegisters.EDI, 4);
- XS.Set(XSRegisters.ESI, XSRegisters.EBP);
- XS.Add(XSRegisters.ESI, 8);
- new x86.Movs { Size = 8, Prefixes = x86.InstructionPrefixes.Repeat };
- XS.Pop(XSRegisters.EDI);
- XS.Label(".NO_ARGS");
- XS.Call(XSRegisters.EDI);
-
- XS.PopAllRegisters();
- XS.Increment(XSRegisters.EDX);
- XS.Jump(".BEGIN_OF_LOOP");
- }
-
- XS.Label(".END_OF_INVOKE");
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: Ldarg.GetArgumentDisplacement(xMethodInfo, 0));
- XS.Set(XSRegisters.EDX, XSRegisters.EDX, sourceDisplacement: Ldfld.GetFieldOffset(xMethodInfo.MethodBase.DeclaringType, "$$ReturnsValue$$"));
- XS.Compare(XSRegisters.EDX, 0);
- XS.Jump(x86.ConditionalTestEnum.Equal, ".NO_RETURN");
-
- XS.Label(".HAS_RETURN");
- XS.Exchange(XSRegisters.EBP, XSRegisters.EDX, destinationDisplacement: 8);
- XS.Exchange(XSRegisters.EBP, XSRegisters.EDX, destinationDisplacement: 4);
- XS.Exchange(XSRegisters.EBP, XSRegisters.EDX, destinationIsIndirect: true);
- XS.Push(XSRegisters.EDX);
- XS.Set(XSRegisters.ESP, XSRegisters.EDI, destinationDisplacement: 12);
-
- XS.Label(".NO_RETURN");
- XS.EnableInterrupts();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/DelegateImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/DelegateImpl.cs
deleted file mode 100644
index 68abceb282..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/DelegateImpl.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU_Asm {
- [Plug(Target = typeof(Delegate), Inheritable = true)]
- public static class DelegateImpl {
- [PlugMethod(Assembler = typeof(DelegateCtorAsm), IsWildcard = true, WildcardMatchParameters = true)]
- public static void Ctor(Delegate aThis, object aTarget, IntPtr aMethod) {
- throw new NotImplementedException();
- }
-
- [PlugMethod(IsWildcard = true, Assembler = typeof(DelegateInvokeAsm))]
- public static void Invoke() {
- throw new NotImplementedException();
- }
-
- [PlugMethod(Assembler = typeof(DelegateGetMulticastInvokeAsm))]
- public static IntPtr GetMulticastInvoke(Delegate aThis) {
- throw new NotImplementedException();
- }
-
- public static bool Equals(Delegate aThis, object aThat) {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/IOPortImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/IOPortImpl.cs
deleted file mode 100644
index dea5745396..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/IOPortImpl.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using System;
-using XSharp.Assembler;
-using Cosmos.CPU.x86;
-using IL2CPU.API.Attribs;
-using XSharp;
-
-namespace Cosmos.CPU_Asm
-{
- [Plug(Target = typeof(IOPortBase))]
- public class IOPortImpl
- {
-
- #region Write8
-
- private class Write8Assembler : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- //TODO: This is a lot of work to write to a single port.
- // We need to have some kind of inline ASM option that can
- // emit a single out instruction
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x0C);
- XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x08);
- XS.WriteToPortDX(XSRegisters.AL);
- }
- }
-
- [PlugMethod(Assembler = typeof(Write8Assembler))]
- public static void Write8(UInt16 aPort, byte aData)
- {
- }
-
- #endregion
-
- #region Write16
-
- private class Write16Assembler : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x0C);
- XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x08);
- XS.WriteToPortDX(XSRegisters.AX);
- }
- }
-
- [PlugMethod(Assembler = typeof(Write16Assembler))]
- public static void Write16(UInt16 aPort, UInt16 aData)
- {
- }
-
- #endregion
-
- #region Write32
-
- private class Write32Assembler : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x0C);
- XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x08);
- XS.WriteToPortDX(XSRegisters.EAX);
- }
- }
-
- [PlugMethod(Assembler = typeof(Write32Assembler))]
- public static void Write32(UInt16 aPort, UInt32 aData)
- {
- }
-
- #endregion
-
- #region Read8
-
- private class Read8Assembler : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x08);
- //TODO: Do we need to clear rest of EAX first?
- // MTW: technically not, as in other places, it _should_ be working with AL too..
- XS.Set(XSRegisters.EAX, 0);
- XS.ReadFromPortDX(XSRegisters.AL);
- XS.Push(XSRegisters.EAX);
- }
- }
-
- [PlugMethod(Assembler = typeof(Read8Assembler))]
- public static byte Read8(UInt16 aPort)
- {
- return 0;
- }
-
- #endregion
-
- #region Read16
-
- private class Read16Assembler : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x08);
- XS.Set(XSRegisters.EAX, 0);
- XS.ReadFromPortDX(XSRegisters.AX);
- XS.Push(XSRegisters.EAX);
- }
- }
-
- [PlugMethod(Assembler = typeof(Read16Assembler))]
- public static UInt16 Read16(UInt16 aPort)
- {
- return 0;
- }
-
- #endregion
-
- #region Read32
-
- private class Read32Assembler : AssemblerMethod
- {
- public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
- {
- XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x08);
- XS.ReadFromPortDX(XSRegisters.EAX);
- XS.Push(XSRegisters.EAX);
- }
- }
-
- [PlugMethod(Assembler = typeof(Read32Assembler))]
- public static UInt32 Read32(UInt16 aPort)
- {
- return 0;
- }
-
- #endregion
-
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Properties/AssemblyInfo.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Properties/AssemblyInfo.cs
deleted file mode 100644
index 96abbd8baa..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-using IL2CPU.API;
-
-//[assembly: Ring(Ring.Core)]
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/RuntimeHelpers/RuntimeHelpersImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/RuntimeHelpers/RuntimeHelpersImpl.cs
deleted file mode 100644
index 8715c2cc2a..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Asm/RuntimeHelpers/RuntimeHelpersImpl.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-
-using XSharp;
-using CPUx86 = XSharp.Assembler.x86;
-
-namespace Cosmos.CPU_Asm
-{
- [Plug(typeof(RuntimeHelpers))]
- public static class RuntimeHelpersImpl
- {
- [Inline(TargetPlatform = TargetPlatform.x86)]
- [PlugMethod]
- public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle)
- {
- // Arguments:
- // Array aArray, RuntimeFieldHandle aFieldHandle
- XS.Set(XSRegisters.EDI, XSRegisters.EBP, sourceDisplacement: 20); // array
- XS.Set(XSRegisters.ESI, XSRegisters.EBP, sourceDisplacement: 12); // aFieldHandle
- XS.Add(XSRegisters.EDI, 8);
- XS.Push(XSRegisters.EDI, isIndirect: true); // element size
- XS.Add(XSRegisters.EDI, 4);
- XS.Set(XSRegisters.EAX, XSRegisters.EDI, sourceIsIndirect: true);
- XS.Multiply(XSRegisters.ESP, isIndirect: true, size: XSRegisters.RegisterSize.Int32);
- XS.Pop(XSRegisters.ECX);
- XS.Set(XSRegisters.ECX, XSRegisters.EAX);
- XS.Set(XSRegisters.EAX, 0);
- XS.Add(XSRegisters.EDI, 4);
-
- XS.Label(".StartLoop");
- XS.Set(XSRegisters.DL, XSRegisters.ESI, sourceIsIndirect: true);
- XS.Set(XSRegisters.EDI, XSRegisters.DL, destinationIsIndirect: true);
- XS.Add(XSRegisters.EAX, 1);
- XS.Add(XSRegisters.ESI, 1);
- XS.Add(XSRegisters.EDI, 1);
- XS.Compare(XSRegisters.EAX, XSRegisters.ECX);
- XS.Jump(CPUx86.ConditionalTestEnum.Equal, ".EndLoop");
- XS.Jump(".StartLoop");
-
- XS.Label(".EndLoop");
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Cosmos.CPU_Plugs.csproj b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Cosmos.CPU_Plugs.csproj
deleted file mode 100644
index 5d7f0fc810..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Cosmos.CPU_Plugs.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- net6.0
- true
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Cosmos.cfg b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Cosmos.cfg
deleted file mode 100644
index dcb76c5045..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: Debug
\ No newline at end of file
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/GCImplementationImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/GCImplementationImpl.cs
deleted file mode 100644
index dcceb488f6..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/GCImplementationImpl.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Cosmos.CPU.x86;
-using Cosmos.CPU.x86.Memory.Old;
-
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU_Plugs {
- [Plug(typeof(GCImplementation))]
- public static class GCImplementationImpl {
- public static uint AllocNewObject(uint aSize) {
- GlobalSystemInfo.EnsureInitialized();
- return Heap.MemAlloc(aSize);
- }
-
- public static void IncRefCount(uint aObject) {
- // Do nothing right now
- }
-
- public static void DecRefCount(uint aObject) {
- // Do nothing right now
- }
-
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Properties/AssemblyInfo.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Properties/AssemblyInfo.cs
deleted file mode 100644
index aafeb100b1..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1 +0,0 @@
-using IL2CPU.API;
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/ArrayImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/ArrayImpl.cs
deleted file mode 100644
index 3e53b4da81..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/ArrayImpl.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using System;
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU_Plugs.System
-{
- [Plug(Target = typeof(Array))]
- public class ArrayImpl
- {
- [PlugMethod(Signature = "System_Void__System_Array_Clear_System_Array__System_Int32__System_Int32_")]
- public static unsafe void Clear([ObjectPointerAccess] uint* aArray, uint aIndex, uint aLength)
- {
- aArray = (uint*) aArray[0];
- aArray += 3;
- uint xElementSize = *aArray;
- aArray += 1;
- byte* xBytes = (byte*) aArray;
- for (uint i = aIndex * xElementSize; i < (aIndex + aLength) * xElementSize; i++)
- {
- xBytes[i] = 0;
- }
- }
-
- public static int GetUpperBound(Array aThis, int aDimension)
- {
- return GetLength(aThis, aDimension) - 1;
- }
-
- public static int GetLength(Array aThis, int aDimension)
- {
- if (aDimension != 0)
- {
- throw new NotSupportedException("Multidimensional array's are not yet supported!");
- }
- return aThis.Length;
- }
-
- [PlugMethod(Signature = "System_Boolean__System_Array_TrySZBinarySearch_System_Array__System_Int32__System_Int32__System_Object___System_Int32_")]
- public static unsafe bool TrySZBinarySearch(uint* aArray, uint sourceIndex, uint count, uint value, out uint retVal)
- {
- aArray = (uint*) aArray[0];
- return TrySZIndexOf(aArray, sourceIndex, count, value, out retVal);
- }
-
- [PlugMethod(Signature = "System_Boolean__System_Array_TrySZLastIndexOf_System_Array__System_Int32__System_Int32__System_Object___System_Int32_")]
- public static unsafe bool TrySZLastIndexOf(uint* aArray, uint sourceIndex, uint count, uint value, out uint retVal)
- {
- aArray = (uint*) aArray[0];
- aArray += 4;
- for (uint i = sourceIndex + count; i > sourceIndex; i--)
- {
- if (aArray[i - 1] == value)
- {
- retVal = i - 1;
- return true;
- }
- }
- retVal = 0;
- return false;
- }
-
- //[PlugMethod(Signature = "System_Boolean__System_Array_TrySZIndexOf_System_Array__System_Int32__System_Int32__System_Object__System_Int32__")]
- private static unsafe bool TrySZIndexOf(uint* aArray, uint sourceIndex, uint count, uint value, out uint retVal)
- {
- aArray = (uint*) aArray[0];
- aArray += 4;
- for (uint i = sourceIndex; i < sourceIndex + count; i++)
- {
- if (aArray[i] == value)
- {
- retVal = i;
- return true;
- }
- }
- retVal = 0;
- return false;
- }
-
- public static unsafe int get_Rank([ObjectPointerAccess]int* aThis)
- {
- return 1;
- }
-
- public static unsafe int GetLowerBound([ObjectPointerAccess]int* aThis, int aDimension)
- {
- aThis = (int*) aThis[0];
- if (aDimension != 0)
- {
- //throw new NotSupportedException("Multidimensional arrays not supported yet!");
- }
- return 0;
- }
-
- [PlugMethod(Signature = "System_Object__System_Array_GetValue_System_Int32_")]
- public static unsafe uint GetValue(uint* aThis, int aIndex)
- {
- aThis = (uint*) aThis[0];
- aThis += 3;
- uint xElementSize = *aThis;
- aThis += 1;
- aThis = (uint*) ((byte*) aThis + aIndex * xElementSize);
- switch (xElementSize)
- {
- case 1:
- return *(byte*) aThis;
- case 2:
- return *(ushort*) aThis;
- case 3:
- return *aThis & 0x0FFFFFFF;
- case 4:
- return *aThis;
- }
- throw new NotSupportedException("GetValue not supported in this situation!");
- }
-
- public static unsafe object GetValue(Array aThis, params int[] aIndices)
- {
- throw new NotImplementedException("Multidimensional arrays not supported yet!");
- }
-
- [PlugMethod(Signature = "System_Void__System_Array_SetValue_System_Object__System_Int32_")]
- public static unsafe void SetValue(uint* aThis, uint aValue, int aIndex)
- {
- aThis = (uint*) aThis[0];
- aThis += 3;
- uint xElementSize = *aThis;
- aThis += 1;
- aThis = (uint*) ((byte*) aThis + aIndex * xElementSize);
- switch (xElementSize)
- {
- case 1:
- *(byte*) aThis = (byte) aValue;
- return;
- case 2:
- *(ushort*) aThis = (ushort) aValue;
- return;
- case 3:
- *(uint*) aThis = (uint) aValue;
- return;
- case 4:
- *(uint*) aThis = (uint) aValue;
- return;
- }
- throw new NotSupportedException("SetValue not supported in this situation!");
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/CharUnicodeInfoImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/CharUnicodeInfoImpl.cs
deleted file mode 100644
index f1471d13f5..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/CharUnicodeInfoImpl.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Globalization;
-
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU_Plugs.System {
- [Plug(typeof(CharUnicodeInfo))]
- public static class CharUnicodeInfoImpl {
- public static void Cctor() {
-
- }
-
- public static bool InitTable() {
- return false;
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/DelegateImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/DelegateImpl.cs
deleted file mode 100644
index df31a812fa..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/DelegateImpl.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.CPU_Plugs.System {
- [Plug(Target = typeof(Delegate), Inheritable = true)]
- [PlugField(FieldType = typeof(int), FieldId = "$$ArgSize$$")]
- [PlugField(FieldType = typeof(int), FieldId = "$$ReturnsValue$$")]
- public static class DelegateImpl {
- public static bool Equals(Delegate aThis, object aThat) {
- // todo: implement proper Delegate.Equals(object)
- return false;
- }
-
- public static unsafe bool InternalEqualTypes([ObjectPointerAccess] uint** a, [ObjectPointerAccess] uint** b) {
- var xTypeA = a[0][0];
- var xTypeB = b[0][0];
-
- return xTypeA == xTypeB;
- }
-
- [PlugMethod(Signature = "System_MulticastDelegate__System_Delegate_InternalAllocLike_System_Delegate_")]
- public static unsafe uint InternalAllocLike(uint* aDelegate) {
- uint xNeededSize = 1024; // 24 is needed fields for Multicast Delegate
- xNeededSize += 12;
- uint xResultAddr = GCImplementationImpl.AllocNewObject(xNeededSize);
- byte* xResult = (byte*)xResultAddr;
- byte* xDelegateAsByte = (byte*)aDelegate;
- for (int i = 0; i < 1024; i++) {
- xResult[i] = xDelegateAsByte[i];
- }
- return xResultAddr;
- }
- }
-}
diff --git a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/StringImpl.cs b/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/StringImpl.cs
deleted file mode 100644
index 76089f6580..0000000000
--- a/source/Kernel-X86/10-CPU/Cosmos.CPU_Plugs/System/StringImpl.cs
+++ /dev/null
@@ -1,740 +0,0 @@
-//#define COSMOSDEBUG
-using System;
-using System.Globalization;
-using IL2CPU.API;
-using IL2CPU.API.Attribs;
-using Debugger = Cosmos.Debug.Kernel.Debugger;
-
-namespace Cosmos.CPU_Plugs.System {
- [Plug(Target = typeof(string))]
- public static class StringImpl {
- internal static Debugger mDebugger = new Debugger("CPU", "String Plugs");
-
- public static unsafe void Ctor(
- string aThis,
- char* aChars,
- [FieldAccess(Name = "System.String System.String.Empty")] ref string aStringEmpty,
- [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
- [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar) {
- mDebugger.SendInternal("String.Ctor(string, char*)");
-
- aStringEmpty = "";
- while (*aChars != '\0') {
- aChars++;
- aStringLength++;
- }
- for (int i = 0; i < aStringLength; i++) {
- aFirstChar[i] = aChars[i];
- }
- }
-
- public static unsafe void Ctor(
- string aThis,
- char* aChars,
- int start,
- int length,
- [FieldAccess(Name = "System.String System.String.Empty")] ref string aStringEmpty,
- [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
- [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar) {
- aStringEmpty = "";
- aStringLength = length;
- for (int i = 0; i < length; i++) {
- aFirstChar[i] = aChars[start + i];
- }
- }
-
- public static unsafe void Ctor(
- string aThis,
- char[] aChars,
- [FieldAccess(Name = "System.String System.String.Empty")] ref string aStringEmpty,
- [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
- [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar) {
- aStringEmpty = "";
- aStringLength = aChars.Length;
- for (int i = 0; i < aChars.Length; i++) {
- aFirstChar[i] = aChars[i];
- }
- }
-
- public static unsafe void Ctor(
- string aThis,
- char[] aChars,
- int start,
- int length,
- [FieldAccess(Name = "System.String System.String.Empty")] ref string aStringEmpty,
- [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
- [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar) {
- aStringEmpty = "";
- aStringLength = length;
- for (int i = 0; i < length; i++) {
- aFirstChar[i] = aChars[start + i];
- }
- }
-
-
- public static unsafe void Ctor(
- string aThis,
- char aChar,
- int aLength,
- [FieldAccess(Name = "System.String System.String.Empty")] ref string aStringEmpty,
- [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
- [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar) {
- aStringEmpty = "";
- aStringLength = aLength;
- for (int i = 0; i < aLength; i++) {
- aFirstChar[i] = aChar;
- }
- }
-
-
- public static unsafe int get_Length(
- [ObjectPointerAccess] uint* aThis,
- [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aLength) {
- return aLength;
- }
-
- public static unsafe char get_Chars(
- [ObjectPointerAccess] uint* aThis,
- int aIndex,
- [FieldAccess(Name = "System.Char System.String.m_firstChar")] char* aFirstChar) {
- return *(aFirstChar + aIndex);
- }
-
- public static bool IsAscii(string aThis) {
- for (int i = 0; i < aThis.Length; i++) {
- if (aThis[i] >= 0x80) {
- return false;
- }
- }
- return true;
- }
-
- public static string Format(string aFormat, object aArg0) {
- if (aArg0 == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(null, aFormat, aArg0);
- }
-
- public static string Format(string aFormat, object aArg0, object aArg1) {
- if (aFormat == null) {
- throw new ArgumentNullException(nameof(aFormat));
- }
- if (aArg0 == null) {
- throw new ArgumentNullException(nameof(aArg0));
- }
- if (aArg1 == null) {
- throw new ArgumentNullException(nameof(aArg1));
- }
-
- return FormatHelper(null, aFormat, aArg0, aArg1);
- }
-
- public static string Format(string aFormat, object aArg0, object aArg1, object aArg2) {
- if (aArg0 == null || aArg1 == null || aArg2 == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(null, aFormat, aArg0, aArg1, aArg2);
- }
-
- public static string Format(string aFormat, params object[] aArgs) {
- if (aArgs == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(null, aFormat, aArgs);
- }
-
- public static string Format(IFormatProvider aProvider, string aFormat, object aArg0) {
- if (aArg0 == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(aProvider, aFormat, aArg0);
- }
-
- public static string Format(IFormatProvider aProvider, string aFormat, object aArg0, object aArg1) {
- if (aArg0 == null | aArg1 == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(aProvider, aFormat, aArg0, aArg1);
- }
-
- public static string Format(IFormatProvider aProvider, string aFormat, object aArg0, object aArg1, object aArg2) {
- if (aArg0 == null | aArg1 == null || aArg2 == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(aProvider, aFormat, aArg0, aArg1, aArg2);
- }
-
- public static string Format(IFormatProvider aProvider, string aFormat, params object[] aArgs) {
- if (aArgs == null) {
- throw new ArgumentNullException(aFormat == null ? "aFormat" : "aArgs");
- }
-
- return FormatHelper(aProvider, aFormat, aArgs);
- }
-
- public static int GetStringToNumber(string aString) {
- bool xIsNegative = false;
- int xNumber = 0;
- if (!string.IsNullOrWhiteSpace(aString)) {
- char[] xCharArray = aString.ToCharArray();
- for (int i = 0; i < xCharArray.Length; i++) {
- if (char.IsDigit(xCharArray[i])) {
- int xValue = xCharArray[i] - '0';
- int xMax = xCharArray.Length - 1;
- for (int j = 0; j < xMax - i; i++) {
- xValue *= 10;
- }
-
- xNumber += xValue;
- } else if (xCharArray[i] == '-') {
- xIsNegative = true;
- } else if (xCharArray[i] == '.') {
- break;
- } else {
- throw new FormatException("The string parameter is not a number and is invalid.");
- }
- }
- }
-
- if (xIsNegative) {
- xNumber *= -1;
- }
-
- return xNumber;
- }
-
- internal static string FormatHelper(IFormatProvider aFormatProvider, string aFormat, params object[] aArgs) {
- char[] xCharArray = aFormat.ToCharArray();
- string xFormattedString = string.Empty, xStaticString;
- bool xFoundPlaceholder = false, xParamNumberDone = true;
- int xStartParamNumber = -1, xEndParamNumber = -1, xLastPlaceHolder = 0;
-
- for (int i = 0; i < xCharArray.Length; i++) {
- if (xFoundPlaceholder) {
- if (xCharArray[i] == '{') {
- throw new FormatException("The format string provided is invalid.");
- }
- if (xCharArray[i] == '}') {
- mDebugger.SendInternal("Found closing placeholder.");
- if (xEndParamNumber < 0) {
- xEndParamNumber = i;
- }
- string xParamNumber = aFormat.Substring(xStartParamNumber, xEndParamNumber - xStartParamNumber);
- mDebugger.SendInternal("Calling StringHelper.GetStringToNumber");
- mDebugger.SendInternal(xParamNumber);
- int xParamIndex = GetStringToNumber(xParamNumber);
- mDebugger.SendInternal("Converted paramindex to a number.");
- if (xParamIndex < aArgs.Length && aArgs[xParamIndex] != null) {
- string xParamValue = aArgs[xParamIndex].ToString();
- xFormattedString = string.Concat(xFormattedString, xParamValue);
- mDebugger.SendInternal("xParamValue =");
- mDebugger.SendInternal(xParamValue);
- mDebugger.SendInternal("xFormattedString =");
- mDebugger.SendInternal(xFormattedString);
-
- }
- xFoundPlaceholder = false;
- xParamNumberDone = true;
- xStartParamNumber = -1;
- xEndParamNumber = -1;
- xLastPlaceHolder = i + 1;
- } else if (xCharArray[i] == ':') {
- xParamNumberDone = true;
- xEndParamNumber = i;
- // TODO: Need to handle different formats. (X, N, etc)
- } else if (char.IsDigit(xCharArray[i]) && !xParamNumberDone) {
- mDebugger.SendInternal("Getting param number.");
- if (xStartParamNumber < 0) {
- xStartParamNumber = i;
- }
- }
- } else if (xCharArray[i] == '{') {
- mDebugger.SendInternal("Found opening placeholder");
- xStaticString = aFormat.Substring(xLastPlaceHolder, i - xLastPlaceHolder);
- xFormattedString = string.Concat(xFormattedString, xStaticString);
- xFoundPlaceholder = true;
- xParamNumberDone = false;
- }
- }
-
- xStaticString = aFormat.Substring(xLastPlaceHolder, aFormat.Length - xLastPlaceHolder);
- xFormattedString = string.Concat(xFormattedString, xStaticString);
-
- return xFormattedString;
- }
-
- public static bool StartsWith(string aThis, string aSubstring, StringComparison aComparison) {
- Char[] di = aThis.ToCharArray();
- Char[] ci = aSubstring.ToCharArray();
- if (aSubstring.Length > aThis.Length) {
- return false;
- }
- for (int i = 0; i < ci.Length; i++) {
- if (di[i] != ci[i]) {
- return false;
-
- }
- }
- return true;
- }
-
- public static string PadHelper(string aThis, int totalWidth, char paddingChar, bool isRightPadded) {
- var cs = new char[totalWidth];
-
- int pos = aThis.Length;
-
- if (isRightPadded) {
- for (int i = 0; i < aThis.Length; i++) {
- cs[i] = aThis[i];
- }
-
- for (int i = aThis.Length; i < totalWidth; i++) {
- cs[i] = paddingChar;
- }
- } else {
- int offset = totalWidth - aThis.Length;
- for (int i = 0; i < aThis.Length; i++) {
- cs[i + offset] = aThis[i];
- }
-
- for (int i = 0; i < offset; i++) {
- cs[i] = paddingChar;
- }
- }
-
- return new string(cs);
- }
-
- public static string Replace(string aThis, char oldValue, char newValue) {
- var cs = new char[aThis.Length];
-
- for (int i = 0; i < aThis.Length; i++) {
- if (aThis[i] != oldValue) {
- cs[i] = aThis[i];
- } else {
- cs[i] = newValue;
- }
- }
-
- return new string(cs);
- }
-
- // HACK: We need to redo this once char support is complete (only returns 0, -1).
- public static int CompareTo(string aThis, string other) {
- if (aThis.Length != other.Length) {
- return -1;
- }
- for (int i = 0; i < aThis.Length; i++) {
- if (aThis[i] != other[i]) {
- return -1;
- }
- }
- return 0;
- }
-
- public static int IndexOf(string aThis, char value, int startIndex, int count) {
- int xEndIndex = aThis.Length;
- if (startIndex + count < xEndIndex) {
- xEndIndex = startIndex + count;
- }
- for (int i = startIndex; i < xEndIndex; i++) {
- if (aThis[i] == value) {
- return i;
- }
- }
-
- return -1;
- }
-
- // HACK: TODO - improve efficiency of this.
- //How do we access the raw memory to copy it into a char array?
- public static char[] ToCharArray(string aThis) {
- var result = new char[aThis.Length];
-
- for (int i = 0; i < aThis.Length; i++) {
- result[i] = aThis[i];
- }
-
- return result;
- }
-
- [PlugMethod(Enabled = false)]
- public static uint GetStorage(string aString) {
- return 0;
- }
-
- //[PlugMethod(Enabled = false)]
- //public static char[] GetStorageArray(string aString) {
- // return null;
- //}
-
- private static int[] BuildBadCharTable(char[] needle) {
- var badShift = new int[256];
- for (int i = 0; i < 256; i++) {
- badShift[i] = needle.Length;
- }
- int last = needle.Length - 1;
- for (int i = 0; i < last; i++) {
- badShift[needle[i]] = last - i;
- }
- return badShift;
- }
-
- private static int boyerMooreHorsepool(string pattern, string text) {
- var needle = pattern.ToCharArray();
- var haystack = text.ToCharArray();
-
- if (needle.Length > haystack.Length) {
- return -1;
- }
- var badShift = BuildBadCharTable(needle);
- int offset = 0;
- int scan = 0;
- int last = needle.Length - 1;
- int maxoffset = haystack.Length - needle.Length;
- while (offset <= maxoffset) {
- for (scan = last; needle[scan] == haystack[scan + offset]; scan--) {
- if (scan == 0) {
- //Match found
- return offset;
- }
- }
- offset += badShift[haystack[offset + last]];
- }
- return -1;
- }
-
- public static int IndexOf(string aThis, string aSubstring, int aIdx, int aLength, StringComparison aComparison) {
- return boyerMooreHorsepool(aSubstring, aThis.Substring(aIdx, aLength));
- }
-
- //private static void WriteNumber(uint aValue,
- // byte aBitCount)
- //{
- // uint xValue = aValue;
- // byte xCurrentBits = aBitCount;
- // Console.Write("0x");
- // while (xCurrentBits >= 4)
- // {
- // xCurrentBits -= 4;
- // byte xCurrentDigit = (byte)((xValue >> xCurrentBits) & 0xF);
- // string xDigitString = null;
- // switch (xCurrentDigit)
- // {
- // case 0:
- // xDigitString = "0";
- // goto default;
- // case 1:
- // xDigitString = "1";
- // goto default;
- // case 2:
- // xDigitString = "2";
- // goto default;
- // case 3:
- // xDigitString = "3";
- // goto default;
- // case 4:
- // xDigitString = "4";
- // goto default;
- // case 5:
- // xDigitString = "5";
- // goto default;
- // case 6:
- // xDigitString = "6";
- // goto default;
- // case 7:
- // xDigitString = "7";
- // goto default;
- // case 8:
- // xDigitString = "8";
- // goto default;
- // case 9:
- // xDigitString = "9";
- // goto default;
- // case 10:
- // xDigitString = "A";
- // goto default;
- // case 11:
- // xDigitString = "B";
- // goto default;
- // case 12:
- // xDigitString = "C";
- // goto default;
- // case 13:
- // xDigitString = "D";
- // goto default;
- // case 14:
- // xDigitString = "E";
- // goto default;
- // case 15:
- // xDigitString = "F";
- // goto default;
- // default:
- // Console.Write(xDigitString);
- // break;
- // }
- // }
- //}
-
- public static bool Contains(string aThis, string value) {
- Char[] di = aThis.ToCharArray();
- Char[] ci = value.ToCharArray();
- if (value.Length == aThis.Length) {
- if (value == aThis) {
- return true;
- } else {
- return false;
- }
- } else if (!(value.Length > aThis.Length) && value.Length != aThis.Length) {
- for (int i = 0; i < aThis.Length; i++) {
- if (di[i] == ci[0]) {
- for (int j = 1; j < value.Length; j++) {
- if (di[i + j] != ci[j]) {
- return false;
- }
- }
- return true;
- }
- }
- }
- return false;
- }
-
- public static bool EndsWith(string aThis, string aSubStr, bool aIgnoreCase, CultureInfo aCulture) {
- return EndsWith(aThis, aSubStr, StringComparison.CurrentCulture);
- }
-
- public static bool EndsWith(string aThis, string aSubStr, StringComparison aComparison) {
- Char[] di = aThis.ToCharArray();
- Char[] ci = aSubStr.ToCharArray();
- if (aThis.Length == aSubStr.Length) {
- if (aThis == aSubStr) {
- return true;
- }
- return false;
- } else if (aThis.Length < aSubStr.Length) {
- return false;
- } else {
- for (int i = 0; i < ci.Length; i++) {
- if (di[aThis.Length - aSubStr.Length + i] != ci[i]) {
- return false;
- }
- }
- return true;
- }
- }
-
- // System.Int32 System.String.IndexOf(System.String, System.Int32, System.Int32, System.StringComparison)
-
- public static bool Equals(string aThis, string aThat, StringComparison aComparison) {
-#warning TODO: implement
- if (aComparison == StringComparison.OrdinalIgnoreCase) {
- string xLowerThis = aThis.ToLower();
- string xLowerThat = aThat.ToLower();
- return EqualsHelper(xLowerThis, xLowerThat);
- }
- return EqualsHelper(aThis, aThat);
- }
-
- public static bool EqualsHelper(string aStrA, string aStrB) {
- return aStrA.CompareTo(aStrB) == 0;
- }
-
- private static bool CharArrayContainsChar(char[] aArray, char aChar) {
- for (int i = 0; i < aArray.Length; i++) {
- if (aArray[i] == aChar) {
- return true;
- }
- }
- return false;
- }
-
- public static int IndexOf(string aThis, string aValue) {
- return aThis.IndexOf(aValue, 0, aThis.Length, StringComparison.CurrentCulture);
- }
-
- public static int IndexOfAny(string aThis, char[] aSeparators, int aStartIndex, int aLength) {
- if (aSeparators == null) {
- throw new ArgumentNullException("aSeparators");
- }
-
- int xResult = -1;
- for (int i = 0; i < aSeparators.Length; i++) {
- int xValue = IndexOf(aThis, aSeparators[i], aStartIndex, aLength);
- if (xValue < xResult || xResult == -1) {
- xResult = xValue;
- }
- }
- return xResult;
- }
-
- public static string Insert(string aThis, int aStartPos, string aValue) {
- return aThis.Substring(0, aStartPos) + aValue + aThis.Substring(aStartPos);
- }
-
- public static int LastIndexOf(string aThis, char aChar, int aStartIndex, int aCount) {
- return LastIndexOfAny(aThis, new[] { aChar }, aStartIndex, aCount);
- }
-
- public static int LastIndexOfAny(string aThis, char[] aChars, int aStartIndex, int aCount) {
- for (int i = 0; i < aCount; i++) {
- if (CharArrayContainsChar(aChars, aThis[aStartIndex - i])) {
- return aStartIndex - i;
- }
- }
- return -1;
- }
-
- public static int nativeCompareOrdinalEx(string aStrA, int aIndexA, string aStrB, int aIndexB, int aCount) {
- //mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrA|aIndexA = {aStrA}|{aIndexA}, aStrB|aIndexB = {aStrB}|{aIndexB}, aCount = {aCount}");
- if (aCount < 0) {
- throw new ArgumentOutOfRangeException("aCount");
- }
-
- if (aIndexA < 0 || aIndexA > aStrA.Length) {
- throw new ArgumentOutOfRangeException("aIndexA");
- }
-
- if (aIndexB < 0 || aIndexB > aStrB.Length) {
- throw new ArgumentOutOfRangeException("aIndexB");
- }
-
- if (aStrA == null) {
- mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA is null");
- if (aStrB == null) {
- mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is null");
- mDebugger.SendInternal($"nativeCompareOrdinalEx : returning 0");
- return 0;
- }
- mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is not null");
- mDebugger.SendInternal($"nativeCompareOrdinalEx : returning -1");
- return -1;
- }
- if (aStrB == null) {
- mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA is not null");
- mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is null");
- mDebugger.SendInternal($"nativeCompareOrdinalEx : returning 1");
- return 1;
- }
- int xLengthA = Math.Min(aStrA.Length, aCount - aIndexA);
- int xLengthB = Math.Min(aStrB.Length, aCount - aIndexB);
- //mDebugger.SendInternal($"nativeCompareOrdinalEx : xLengthA = {xLengthA}");
- //mDebugger.SendInternal($"nativeCompareOrdinalEx : xLengthB = {xLengthB}");
-
- if (xLengthA == xLengthB && aIndexA == aIndexB && ReferenceEquals(aStrA, aStrB)) {
- mDebugger.SendInternal("nativeCompareOrdinalEx : xLengthA == xLengthB && aIndexA == aIndexB && aStrA is the same object asaStrB, returning 0");
- return 0;
- }
-
- int xResult = 0;
- if (xLengthA != xLengthB) {
- xResult = xLengthA - xLengthB;
- mDebugger.SendInternal("nativeCompareOrdinalEx : xLengthA != xLengthB, returning " + xResult);
- }
-
- for (int i = 0; i < xLengthA; i++) {
- if (aStrA != aStrB) {
- xResult = (byte)aStrA[i] - (byte)aStrB[i];
- mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA[i] != aStrB[i], returning " + xResult);
- return xResult;
- }
- }
- return xResult;
- }
-
- public static bool StartsWith(string aThis, string aSubStr, bool aIgnoreCase, CultureInfo aCulture) {
- Char[] di = aThis.ToCharArray();
- Char[] ci = aSubStr.ToCharArray();
- if (aSubStr.Length > aThis.Length) {
- return false;
- }
- for (int i = 0; i < ci.Length; i++) {
- if (di[i] != ci[i]) {
- return false;
-
- }
- }
- return true;
- }
-
- //public static string Remove(string aThis, int aStart, int aCount)
- //{
- // return aThis.Substring(0, aStart) + aThis.Substring(aStart + aCount, aThis.Length - (aStart + aCount));
- //}
-
- public static string Replace(string aThis, string oldValue, string newValue) {
- while (aThis.IndexOf(oldValue) != -1) {
- int xIndex = aThis.IndexOf(oldValue);
- aThis = aThis.Remove(xIndex, oldValue.Length);
- aThis = aThis.Insert(xIndex, newValue);
- }
- return aThis;
- }
-
- public static string ToLower(string aThis, CultureInfo aCulture) {
- return ChangeCasing(aThis, 65, 90, 32);
- }
-
- public static string ToUpper(string aThis, CultureInfo aCulture) {
- return ChangeCasing(aThis, 97, 122, -32);
- }
-
- public static string ToUpper(string aThis) {
- return ChangeCasing(aThis, 97, 122, -32);
- }
-
- private static string ChangeCasing(string aValue, int lowerAscii, int upperAscii, int offset) {
- var xChars = new char[aValue.Length];
-
- for (int i = 0; i < aValue.Length; i++) {
- int xAsciiCode = aValue[i];
- if (xAsciiCode <= upperAscii && xAsciiCode >= lowerAscii) {
- xChars[i] = (char)(xAsciiCode + offset);
- } else {
- xChars[i] = aValue[i];
- }
- }
-
- return new string(xChars);
- }
-
- public static string FastAllocateString(int aLength) {
- return new string(new char[aLength]);
- }
-
- [PlugMethod(IsOptional = true)]
- public static string TrimStart(string aThis, string aSubStr) {
- char[] ci = aThis.ToCharArray();
- char[] di = aSubStr.ToCharArray();
-
- if (aThis.StartsWith(aSubStr)) {
- if (aThis != aSubStr) {
- char[] oi = new char[ci.Length - di.Length];
- for (int i = 0; i < ci.Length - di.Length; i++) {
- oi[i] = ci[i + di.Length];
- }
- return oi.ToString();
- }
-
- return string.Empty;
- }
-
- throw new ArgumentNullException();
- }
-
- public static int CompareOrdinalHelper(string strA, int indexA, int countA, string strB, int indexB, int countB) {
- throw new NotImplementedException();
- }
-
- public static int GetHashCode(string aThis) {
- throw new NotImplementedException("String.GetHashCode()");
- }
- }
-}
diff --git a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Boot.cs b/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Boot.cs
deleted file mode 100644
index 5e2a5e1f19..0000000000
--- a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Boot.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Cosmos.HAL;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.Platform.PC {
- static public class Boot {
- [BootEntry(20)]
- static private void Init() {
- HAL.Globals.DeviceMgr = new DeviceMgr();
- }
- }
-}
diff --git a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Cosmos.Platform.PC.csproj b/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Cosmos.Platform.PC.csproj
deleted file mode 100644
index 9d6790b8b2..0000000000
--- a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Cosmos.Platform.PC.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net6.0
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Cosmos.cfg b/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Cosmos.cfg
deleted file mode 100644
index 99e1a80153..0000000000
--- a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: Platform
\ No newline at end of file
diff --git a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/DeviceMgr.cs b/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/DeviceMgr.cs
deleted file mode 100644
index 352d6ac567..0000000000
--- a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/DeviceMgr.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.Platform.PC {
- public class DeviceMgr : HAL.DeviceMgr {
- public DeviceMgr() {
- var xProcessor = new Devices.Processor();
- Add(xProcessor);
- }
- }
-}
diff --git a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs b/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs
deleted file mode 100644
index 3616041784..0000000000
--- a/source/Kernel-X86/20-Platform/Cosmos.Platform.PC/Devices/Processor.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.Platform.PC.Devices {
- public class Processor : HAL.Devices.Processor {
- public override ulong SetOption(uint aID, ulong aValue = 0) {
- CPU.x86.TempDebug.ShowText('D');
- if (aID == 1) {
- CPU.x86.TempDebug.ShowText('E');
- }
- return 0;
- }
- }
-}
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/Boot.cs b/source/Kernel-X86/30-HAL/Cosmos.HAL/Boot.cs
deleted file mode 100644
index b81e32554d..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/Boot.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.HAL {
- static public class Boot {
- [BootEntry(30)]
- static private void Init() {
- }
- }
-}
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/Cosmos.HAL.csproj b/source/Kernel-X86/30-HAL/Cosmos.HAL/Cosmos.HAL.csproj
deleted file mode 100644
index d44d3abb77..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/Cosmos.HAL.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- net6.0
- true
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/Cosmos.cfg b/source/Kernel-X86/30-HAL/Cosmos.HAL/Cosmos.cfg
deleted file mode 100644
index 8a2a207373..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: HAL
\ No newline at end of file
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs b/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs
deleted file mode 100644
index c6fa430ab8..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/DeviceMgr.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Cosmos.HAL.Devices;
-
-namespace Cosmos.HAL {
- public abstract class DeviceMgr {
- protected readonly List mAll = new List();
- protected readonly IList mAllRO;
- public IList All {
- get { return mAllRO; }
- }
-
- public DeviceMgr() {
- mAllRO = mAll.AsReadOnly();
- }
-
- protected Processor mProcessor;
- public Processor Processor {
- get { return mProcessor; }
- }
-
- public void Add(Devices.Device aDevice) {
- mAll.Add(aDevice);
-
- if (aDevice is Processor) {
- mProcessor = (Processor)aDevice;
- }
- }
- }
-}
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/Devices/Device.cs b/source/Kernel-X86/30-HAL/Cosmos.HAL/Devices/Device.cs
deleted file mode 100644
index 72ca448938..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/Devices/Device.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.HAL.Devices {
- public abstract class Device {
- }
-}
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/Devices/Processor.cs b/source/Kernel-X86/30-HAL/Cosmos.HAL/Devices/Processor.cs
deleted file mode 100644
index 6e9483dfd6..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/Devices/Processor.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.HAL.Devices {
- public abstract class Processor : Device {
- // Generic method that is specific to each CPU ring.
- // Designed to allow limited extra API communication to CPU from HAL.
- // Optionally implemented.
- public virtual UInt64 SetOption(UInt32 aID, UInt64 aValue = 0) {
- return 0;
- }
- }
-}
diff --git a/source/Kernel-X86/30-HAL/Cosmos.HAL/Globals.cs b/source/Kernel-X86/30-HAL/Cosmos.HAL/Globals.cs
deleted file mode 100644
index ac97ca51dd..0000000000
--- a/source/Kernel-X86/30-HAL/Cosmos.HAL/Globals.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Cosmos.HAL {
- static public class Globals {
- static public DeviceMgr DeviceMgr;
- }
-}
diff --git a/source/Kernel-X86/40-System/Cosmos.System/Boot.cs b/source/Kernel-X86/40-System/Cosmos.System/Boot.cs
deleted file mode 100644
index 2e495f0d39..0000000000
--- a/source/Kernel-X86/40-System/Cosmos.System/Boot.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Text;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.System {
- static public class Boot {
- [BootEntry(40)]
- static private void Init() {
- }
-
- static public void TempDebugTest() {
- HAL.Globals.DeviceMgr.Processor.SetOption(1);
- }
- }
-}
diff --git a/source/Kernel-X86/40-System/Cosmos.System/Cosmos.System.csproj b/source/Kernel-X86/40-System/Cosmos.System/Cosmos.System.csproj
deleted file mode 100644
index 838a384f0d..0000000000
--- a/source/Kernel-X86/40-System/Cosmos.System/Cosmos.System.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- net6.0
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/40-System/Cosmos.System/Cosmos.cfg b/source/Kernel-X86/40-System/Cosmos.System/Cosmos.cfg
deleted file mode 100644
index 9c3e57fa51..0000000000
--- a/source/Kernel-X86/40-System/Cosmos.System/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: System
\ No newline at end of file
diff --git a/source/Kernel-X86/50-Application/Boot.cs b/source/Kernel-X86/50-Application/Boot.cs
deleted file mode 100644
index a65ea0838d..0000000000
--- a/source/Kernel-X86/50-Application/Boot.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using IL2CPU.API.Attribs;
-using Cosmos.System;
-
-namespace KernelGen3 {
- static public class Boot {
- [BootEntry]
- static private void Init() {
- Cosmos.System.Boot.TempDebugTest();
-
- while (true) {
- }
- }
- }
-}
diff --git a/source/Kernel-X86/50-Application/Cosmos.cfg b/source/Kernel-X86/50-Application/Cosmos.cfg
deleted file mode 100644
index 5ffa0e0d4a..0000000000
--- a/source/Kernel-X86/50-Application/Cosmos.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-Ring: Application
-DebugRing: Allowed
\ No newline at end of file
diff --git a/source/Kernel-X86/50-Application/GuessKernelGen3.csproj b/source/Kernel-X86/50-Application/GuessKernelGen3.csproj
deleted file mode 100644
index 0140ddc5df..0000000000
--- a/source/Kernel-X86/50-Application/GuessKernelGen3.csproj
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
- net6.0
- true
-
-
-
- X86
- elf
- False
- Source
- User
- False
- False
- ISO
- Pipe: Cosmos\Serial
- True
- MethodFooters
- False
- Serial: COM1
- VMware
- VMware
- Use VMware Player or Workstation to deploy and debug.
- 192.168.0.8
- True
- MethodFooters
- Use VMware Player or Workstation to deploy and debug.
- ISO
- VMware
- False
- Source
- False
- Serial: COM1
- Pipe: Cosmos\Serial
- 192.168.0.8
- bin\Debug\net462\
- False
- False
- True
- MethodFooters
- Use Bochs emulator to deploy and debug.
- ISO
- Bochs
- True
- Source
- False
- Serial: COM1
- Pipe: Cosmos\Serial
- 192.168.0.8
- bin\Debug\net462\
- False
- False
- BootGen3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/Cosmos.Plugs.TapRoot.csproj b/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/Cosmos.Plugs.TapRoot.csproj
deleted file mode 100644
index 7920fe9ff0..0000000000
--- a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/Cosmos.Plugs.TapRoot.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net6.0
- true
- Cosmos.Plugs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/Cosmos.cfg b/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/Cosmos.cfg
deleted file mode 100644
index 96cade3754..0000000000
--- a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/Cosmos.cfg
+++ /dev/null
@@ -1 +0,0 @@
-Ring: Plug
\ No newline at end of file
diff --git a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/System/Console.cs b/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/System/Console.cs
deleted file mode 100644
index f491acc321..0000000000
--- a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/System/Console.cs
+++ /dev/null
@@ -1,812 +0,0 @@
-using System;
-using System.Text;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.Plugs.TapRoot.System {
- [Plug(Target = typeof(global::System.Console))]
- public static class Console {
- //private static ConsoleColor mForeground = ConsoleColor.White;
- //private static ConsoleColor mBackground = ConsoleColor.Black;
-
- //private static Cosmos.System.Console GetConsole()
- //{
- // return mFallbackConsole;
- //}
-
- //public static ConsoleColor get_BackgroundColor()
- //{
- // return mBackground;
- //}
-
- //public static void set_BackgroundColor(ConsoleColor value)
- //{
- // mBackground = value;
- // //Cosmos.HAL.Global.TextScreen.SetColors(mForeground, mBackground);
- // if (GetConsole() != null) GetConsole().Background = value;
- //}
-
- //public static int get_BufferHeight()
- //{
- // WriteLine("Not implemented: get_BufferHeight");
- // return -1;
- //}
-
- //public static void set_BufferHeight(int aHeight)
- //{
- // WriteLine("Not implemented: set_BufferHeight");
- //}
-
- //public static int get_BufferWidth()
- //{
- // WriteLine("Not implemented: get_BufferWidth");
- // return -1;
- //}
-
- //public static void set_BufferWidth(int aWidth)
- //{
- // WriteLine("Not implemented: set_BufferWidth");
- //}
-
- //public static bool get_CapsLock()
- //{
- // return Global.CapsLock;
- //}
-
- //public static int get_CursorLeft()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return 0;
- // }
- // return GetConsole().X;
- //}
-
- //public static void set_CursorLeft(int x)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
-
- // if (x < get_WindowWidth())
- // {
- // xConsole.X = x;
- // }
- // else
- // {
- // WriteLine("x must be lower than the console width!");
- // }
- //}
-
- //public static int get_CursorSize()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return 0;
- // }
- // return xConsole.CursorSize;
- //}
-
- //public static void set_CursorSize(int aSize)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // xConsole.CursorSize = aSize;
- //}
-
- //public static int get_CursorTop()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return 0;
- // }
- // return GetConsole().Y;
- //}
-
- //public static void set_CursorTop(int y)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
-
- // if (y < get_WindowHeight())
- // {
- // xConsole.Y = y;
- // }
- // else
- // {
- // WriteLine("y must be lower than the console height!");
- // }
- //}
-
- //public static bool get_CursorVisible()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // return false;
- // }
- // return GetConsole().CursorVisible;
- //}
-
- //public static void set_CursorVisible(bool value)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // xConsole.CursorVisible = value;
- //}
-
-
- ////public static TextWriter get_Error() {
- //// WriteLine("Not implemented: get_Error");
- //// return null;
- ////}
-
- //public static ConsoleColor get_ForegroundColor()
- //{
- // return mForeground;
- //}
-
- //public static void set_ForegroundColor(ConsoleColor value)
- //{
- // mForeground = value;
- // //Cosmos.HAL.Global.TextScreen.SetColors(mForeground, mBackground);
- // if (GetConsole() != null) GetConsole().Foreground = value;
- //}
-
- ////public static TextReader get_In()
- ////{
- //// WriteLine("Not implemented: get_In");
- //// return null;
- ////}
-
- //public static Encoding get_InputEncoding()
- //{
- // WriteLine("Not implemented: get_InputEncoding");
- // return null;
- //}
-
- //public static void set_InputEncoding(Encoding value)
- //{
- // WriteLine("Not implemented: set_InputEncoding");
- //}
-
- //public static bool get_KeyAvailable()
- //{
- // WriteLine("Not implemented: get_KeyAvailable");
- // return false;
- //}
-
- //public static int get_LargestWindowHeight()
- //{
- // WriteLine("Not implemented: get_LargestWindowHeight");
- // return -1;
- //}
-
- //public static int get_LargestWindowWidth()
- //{
- // WriteLine("Not implemented: get_LargestWindowWidth");
- // return -1;
- //}
-
- //public static bool get_NumberLock()
- //{
- // return Global.NumLock;
- //}
-
- ////public static TextWriter get_Out() {
- //// WriteLine("Not implemented: get_Out");
- //// return null;
- ////}
-
- //public static Encoding get_OutputEncoding()
- //{
- // WriteLine("Not implemented: get_OutputEncoding");
- // return null;
- //}
-
- //public static void set_OutputEncoding(Encoding value)
- //{
- // WriteLine("Not implemented: set_OutputEncoding");
- //}
-
- //public static string get_Title()
- //{
- // WriteLine("Not implemented: get_Title");
- // return string.Empty;
- //}
-
- //public static void set_Title(string value)
- //{
- // WriteLine("Not implemented: set_Title");
- //}
-
- //public static bool get_TreatControlCAsInput()
- //{
- // WriteLine("Not implemented: get_TreatControlCAsInput");
- // return false;
- //}
-
- //public static void set_TreatControlCAsInput(bool value)
- //{
- // WriteLine("Not implemented: set_TreatControlCAsInput");
- //}
-
- //public static int get_WindowHeight()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return 25;
- // }
- // return GetConsole().Rows;
- //}
-
- //public static void set_WindowHeight(int value)
- //{
- // WriteLine("Not implemented: set_WindowHeight");
- //}
-
- //public static int get_WindowLeft()
- //{
- // WriteLine("Not implemented: get_WindowLeft");
- // return -1;
- //}
-
- //public static void set_WindowLeft(int value)
- //{
- // WriteLine("Not implemented: set_WindowLeft");
- //}
-
- //public static int get_WindowTop()
- //{
- // WriteLine("Not implemented: get_WindowTop");
- // return -1;
- //}
-
- //public static void set_WindowTop(int value)
- //{
- // WriteLine("Not implemented: set_WindowTop");
- //}
-
- //public static int get_WindowWidth()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return 85;
- // }
- // return GetConsole().Cols;
- //}
-
- //public static void set_WindowWidth(int value)
- //{
- // WriteLine("Not implemented: set_WindowWidth");
- //}
-
- //// Beep() is pure CIL
-
- //public static void Beep(int aFrequency, int aDuration)
- //{
- // if (aFrequency < 37 || aFrequency > 32767)
- // {
- // throw new ArgumentOutOfRangeException("Frequency must be between 37 and 32767Hz");
- // }
-
- // if (aDuration <= 0)
- // {
- // throw new ArgumentOutOfRangeException("Duration must be more than 0");
- // }
-
- // WriteLine("Not implemented: Beep");
-
- // //var xPIT = Hardware.Global.PIT;
- // //xPIT.EnableSound();
- // //xPIT.T2Frequency = (uint)aFrequency;
- // //xPIT.Wait((uint)aDuration);
- // //xPIT.DisableSound();
- //}
-
- ////TODO: Console uses TextWriter - intercept and plug it instead
- //public static void Clear()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // GetConsole().Clear();
- //}
-
- //// MoveBufferArea(int, int, int, int, int, int) is pure CIL
-
- //public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight,
- // int targetLeft, int targetTop, Char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
- //{
- // WriteLine("Not implemented: MoveBufferArea");
- //}
-
- ////public static Stream OpenStandardError() {
- //// WriteLine("Not implemented: OpenStandardError");
- ////}
-
- ////public static Stream OpenStandardError(int bufferSize) {
- //// WriteLine("Not implemented: OpenStandardError");
- ////}
-
- ////public static Stream OpenStandardInput(int bufferSize) {
- //// WriteLine("Not implemented: OpenStandardInput");
- ////}
-
- ////public static Stream OpenStandardInput() {
- //// WriteLine("Not implemented: OpenStandardInput");
- ////}
-
- ////public static Stream OpenStandardOutput(int bufferSize) {
- //// WriteLine("Not implemented: OpenStandardOutput");
- ////}
-
- ////public static Stream OpenStandardOutput() {
- //// WriteLine("Not implemented: OpenStandardOutput");
- ////}
-
- //public static int Read()
- //{
- // // TODO special cases, if needed, that returns -1
- // KeyEvent xResult;
-
- // if (KeyboardManager.TryReadKey(out xResult))
- // {
- // return xResult.KeyChar;
- // }
- // else
- // {
- // return -1;
- // }
- //}
-
- //public static String ReadLine()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return null;
- // }
- // List chars = new List(32);
- // KeyEvent current;
- // int currentCount = 0;
-
- // while ((current = KeyboardManager.ReadKey()).Key != ConsoleKeyEx.Enter)
- // {
- // if (current.Key == ConsoleKeyEx.NumEnter) break;
- // //Check for "special" keys
- // if (current.Key == ConsoleKeyEx.Backspace) // Backspace
- // {
- // if (currentCount > 0)
- // {
- // int curCharTemp = GetConsole().X;
- // chars.RemoveAt(currentCount - 1);
- // GetConsole().X = GetConsole().X - 1;
-
- // //Move characters to the left
- // for (int x = currentCount - 1; x < chars.Count; x++)
- // {
- // Write(chars[x]);
- // }
-
- // Write(' ');
-
- // GetConsole().X = curCharTemp - 1;
-
- // currentCount--;
- // }
- // continue;
- // }
- // else if (current.Key == ConsoleKeyEx.LeftArrow)
- // {
- // if (currentCount > 0)
- // {
- // GetConsole().X = GetConsole().X - 1;
- // currentCount--;
- // }
- // continue;
- // }
- // else if (current.Key == ConsoleKeyEx.RightArrow)
- // {
- // if (currentCount < chars.Count)
- // {
- // GetConsole().X = GetConsole().X + 1;
- // currentCount++;
- // }
- // continue;
- // }
-
- // if (current.KeyChar == '\0') continue;
-
- // //Write the character to the screen
- // if (currentCount == chars.Count)
- // {
- // chars.Add(current.KeyChar);
- // Write(current.KeyChar);
- // currentCount++;
- // }
- // else
- // {
- // //Insert the new character in the correct location
- // //For some reason, List.Insert() doesn't work properly
- // //so the character has to be inserted manually
- // List temp = new List();
-
- // for (int x = 0; x < chars.Count; x++)
- // {
- // if (x == currentCount)
- // {
- // temp.Add(current.KeyChar);
- // }
-
- // temp.Add(chars[x]);
- // }
-
- // chars = temp;
-
- // //Shift the characters to the right
- // for (int x = currentCount; x < chars.Count; x++)
- // {
- // Write(chars[x]);
- // }
-
- // GetConsole().X -= (chars.Count - currentCount) - 1;
- // currentCount++;
- // }
- // }
- // WriteLine();
-
- // char[] final = chars.ToArray();
- // return new string(final);
- //}
-
- //public static void ResetColor()
- //{
- // set_BackgroundColor(ConsoleColor.Black);
- // set_ForegroundColor(ConsoleColor.White);
- //}
-
- //public static void SetBufferSize(int width, int height)
- //{
- // WriteLine("Not implemented: SetBufferSize");
- //}
-
- //public static void SetCursorPosition(int left, int top)
- //{
- // set_CursorLeft(left);
- // set_CursorTop(top);
- //}
-
- ////public static void SetError(TextWriter newError) {
- //// WriteLine("Not implemented: SetError");
- ////}
-
- ////public static void SetIn(TextReader newIn) {
- //// WriteLine("Not implemented: SetIn");
- ////}
-
- ////public static void SetOut(TextWriter newOut) {
- //// WriteLine("Not implemented: SetOut");
- ////}
-
- //public static void SetWindowPosition(int left, int top)
- //{
- // WriteLine("Not implemented: SetWindowPosition");
- //}
-
- //public static void SetWindowSize(int width, int height)
- //{
- // WriteLine("Not implemented: SetWindowSize");
- //}
-
- //#region Write
-
- //public static void Write(bool aBool)
- //{
- // Write(aBool.ToString());
- //}
-
- //public static void Write(char aChar)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // GetConsole().WriteChar(aChar);
- //}
-
- //public static void Write(char[] aBuffer)
- //{
- // Write(aBuffer, 0, aBuffer.Length);
- //}
-
- ////public static void Write(decimal aBuffer) {
- //// Write("No Decimal.ToString()");
- ////}
-
- //public static void Write(double aDouble)
- //{
- // Write(aDouble.ToString());
- //}
-
- //public static void Write(float aFloat)
- //{
- // Write(aFloat.ToString());
- //}
-
- //public static void Write(int aInt)
- //{
- // Write(aInt.ToString());
- //}
-
- //public static void Write(long aLong)
- //{
- // Write(aLong.ToString());
- //}
-
- //public static void Write(object value)
- //{
- // if (value != null)
- // {
- // Write(value.ToString());
- // }
- //}
-
- //public static void Write(string aText)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // GetConsole().Write(aText);
- //}
-
- //public static void Write(uint aInt)
- //{
- // Write(aInt.ToString());
- //}
-
- //public static void Write(ulong aLong)
- //{
- // Write(aLong.ToString());
- //}
-
- //public static void Write(string format, object arg0)
- //{
- // WriteLine("Not implemented: Write");
- //}
-
- //public static void Write(string format, params object[] arg)
- //{
- // WriteLine("Not implemented: Write");
- //}
-
- //public static void Write(char[] aBuffer, int aIndex, int aCount)
- //{
- // if (aBuffer == null)
- // {
- // throw new ArgumentNullException("aBuffer");
- // }
- // if (aIndex < 0)
- // {
- // throw new ArgumentOutOfRangeException("aIndex");
- // }
- // if (aCount < 0)
- // {
- // throw new ArgumentOutOfRangeException("aCount");
- // }
- // if ((aBuffer.Length - aIndex) < aCount)
- // {
- // throw new ArgumentException();
- // }
- // for (int i = 0; i < aCount; i++)
- // {
- // Write(aBuffer[aIndex + i]);
- // }
- //}
-
- //public static void Write(string format, object arg0, object arg1)
- //{
- // WriteLine("Not implemented: Write");
- //}
-
- //public static void Write(string format, object arg0, object arg1, object arg2)
- //{
- // WriteLine("Not implemented: Write");
- //}
-
- //public static void Write(string format, object arg0, object arg1, object arg2, object arg3)
- //{
- // WriteLine("Not implemented: Write");
- //}
-
- ////You'd expect this to be on System.Console wouldn't you? Well, it ain't so we just rely on Write(object value)
- ////public static void Write(byte aByte) {
- //// Write(aByte.ToString());
- ////}
-
- //#endregion
-
- //public static void WriteLine()
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(bool aBool)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // Write(aBool.ToString());
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(char aChar)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // Write(aChar);
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(char[] aBuffer)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // Write(aBuffer, 0, aBuffer.Length);
- // GetConsole().NewLine();
- //}
-
- ////public static void WriteLine(decimal aDecimal) {
- //// Write(aDecimal);
- //// Global.Console.NewLine();
- ////}
-
- //public static void WriteLine(double aDouble)
- //{
- // Write(aDouble.ToString());
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(float aFloat)
- //{
- // Write(aFloat.ToString());
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(int aInt)
- //{
- // Write(aInt.ToString());
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(long aLong)
- //{
- // Write(aLong.ToString());
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(object value)
- //{
- // if (value != null)
- // {
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // Write(value.ToString());
- // xConsole.NewLine();
- // }
- //}
-
- public static void WriteLine(string aText) {
- }
-
- //public static void WriteLine(uint aInt)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // Write(aInt.ToString());
- // xConsole.NewLine();
- //}
-
- //public static void WriteLine(ulong aLong)
- //{
- // var xConsole = GetConsole();
- // if (xConsole == null)
- // {
- // // for now:
- // return;
- // }
- // Write(aLong.ToString());
- // xConsole.NewLine();
- //}
-
- //public static void WriteLine(string format, object arg0)
- //{
- // WriteLine("Not implemented: WriteLine");
- //}
-
- //public static void WriteLine(string format, params object[] arg)
- //{
- // WriteLine("Not implemented: WriteLine");
- //}
-
- //public static void WriteLine(char[] aBuffer, int aIndex, int aCount)
- //{
- // Write(aBuffer, aIndex, aCount);
- // GetConsole().NewLine();
- //}
-
- //public static void WriteLine(string format, object arg0, object arg1)
- //{
- // WriteLine("Not implemented: WriteLine");
- //}
-
- //public static void WriteLine(string format, object arg0, object arg1, object arg2)
- //{
- // WriteLine("Not implemented: WriteLine");
- //}
-
- //public static void WriteLine(string format, object arg0, object arg1, object arg2, object arg3)
- //{
- // WriteLine("Not implemented: WriteLine");
- //}
-
- }
-}
diff --git a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/System/Environment.cs b/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/System/Environment.cs
deleted file mode 100644
index d0d709fe60..0000000000
--- a/source/Kernel-X86/91-Plugs/Cosmos.Plugs.TapRoot/System/Environment.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using IL2CPU.API.Attribs;
-
-namespace Cosmos.Plugs.TapRoot.System {
- [Plug(Target = typeof(global::System.Environment))]
- public static class Environment {
- // [PlugMethod(Signature = "System_Environment_OSName__System_Environment_get_OSInfo__")]
- // public static int get_OSName() { return 0x82; }
-
- public static string GetResourceFromDefault(string aResource) {
- return "";
- }
-
- public static string GetResourceString(string aResource) {
- return "";
- }
- }
-}
diff --git a/source/TheRingMaster/Program.cs b/source/TheRingMaster/Program.cs
deleted file mode 100644
index 5e8cb4e30d..0000000000
--- a/source/TheRingMaster/Program.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.Loader;
-
-using IL2CPU.API.Attribs;
-
-namespace TheRingMaster
-{
- public class Program
- {
- enum Ring
- {
- External = 0,
- CPU = 10,
- Platform = 20,
- HAL = 30,
- System = 40,
- Application = 50,
- Plug = 91,
- CpuPlug = 92,
- Debug
- }
-
- static Dictionary RingCache = new Dictionary();
- static string KernelDir;
-
- public static void Main(string[] args)
- {
- if (args.Length != 1)
- {
- Console.WriteLine("Usage: theringmaster ");
- return;
- }
-
- var xKernelAssemblyPath = args[0];
-
- if (!File.Exists(xKernelAssemblyPath))
- {
- throw new FileNotFoundException("Kernel Assembly not found! Path: '" + xKernelAssemblyPath + "'");
- }
-
- KernelDir = Path.GetDirectoryName(xKernelAssemblyPath);
- AssemblyLoadContext.Default.Resolving += Default_Resolving;
-
- var xKernelAssembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(xKernelAssemblyPath);
- CheckRings(xKernelAssembly, Ring.Application);
-
- void CheckRings(Assembly aAssembly, Ring aRing, string aSourceAssemblyName = null)
- {
- bool xDebugAllowed = false;
-
- if (!RingCache.TryGetValue(aAssembly, out var xRing))
- {
- var xManifestName = aAssembly.GetManifestResourceNames()
- .Where(n => n == aAssembly.GetName().Name + ".Cosmos.cfg")
- .SingleOrDefault();
-
- if (xManifestName != null)
- {
- Dictionary xCfg;
-
- using (var xManifestStream = aAssembly.GetManifestResourceStream(xManifestName))
- {
- xCfg = ParseCfg(xManifestStream);
- }
-
- if (xCfg == null)
- {
- throw new Exception("Invalid Cosmos configuration! Resource name: " + xManifestName);
- }
-
- xCfg.TryGetValue("Ring", out var xRingName);
-
- if (!Enum.TryParse(xRingName, true, out xRing))
- {
- throw new Exception("Unknown ring! Ring: " + xRingName);
- }
-
- xCfg.TryGetValue("DebugRing", out var xDebugRing);
- xDebugAllowed = xDebugRing.ToLower() == "allowed";
- }
- }
-
- RingCache.Add(aAssembly, xRing);
-
- // Check Rings
-
- bool xValid = false;
-
- // Same rings
- // OR
- // External ring, can be referenced by any ring
- // OR
- // One of the assemblies is Debug
- // OR
- // Debug ring allowed
- if (aRing == xRing || xRing == Ring.External || aRing == Ring.Debug || xRing == Ring.Debug || xDebugAllowed)
- {
- xValid = true;
- }
-
- if (!xValid)
- {
- switch (aRing)
- {
- case Ring.Application when xRing == Ring.System:
- case Ring.System when xRing == Ring.HAL:
- case Ring.Platform when xRing == Ring.CPU:
- case Ring.Platform when xRing == Ring.HAL:
- return;
- }
- }
-
- if (!xValid)
- {
- var xExceptionMessage = "Invalid rings! Source assembly: " + (aSourceAssemblyName ?? "(no assembly)") +
- ", Ring: " + aRing + "; Referenced assembly: " + aAssembly.GetName().Name +
- ", Ring: " + xRing;
-
- throw new Exception(xExceptionMessage);
- }
-
- if (xRing != Ring.CPU && xRing != Ring.CpuPlug)
- {
- foreach (var xModule in aAssembly.Modules)
- {
- // TODO: Check unsafe code
- }
- }
-
- foreach (var xType in aAssembly.GetTypes())
- {
- if (xRing != Ring.Plug)
- {
- if (xType.GetCustomAttribute() != null)
- {
- throw new Exception("Plugs are only allowed in the Plugs ring! Assembly: " + aAssembly.GetName().Name);
- }
- }
- }
-
- foreach (var xReference in aAssembly.GetReferencedAssemblies())
- {
- try
- {
- CheckRings(AssemblyLoadContext.Default.LoadFromAssemblyName(xReference), xRing, aAssembly.GetName().Name);
- }
- catch (FileNotFoundException)
- {
- }
- }
- }
- }
-
- private static Assembly Default_Resolving(AssemblyLoadContext aContext, AssemblyName aAssemblyName)
- {
- Assembly xAssembly = null;
-
- if (ResolveAssemblyForDir(KernelDir, out xAssembly))
- {
- return xAssembly;
- }
-
- //if (ResolveAssemblyForDir(CosmosPaths.Kernel, out xAssembly))
- //{
- // return xAssembly;
- //}
-
- return xAssembly;
-
- bool ResolveAssemblyForDir(string aDir, out Assembly aAssembly)
- {
- aAssembly = null;
-
- var xFiles = Directory.GetFiles(aDir, aAssemblyName.Name + ".*", SearchOption.TopDirectoryOnly);
-
- if (xFiles.Any(f => Path.GetExtension(f) == ".dll"))
- {
- aAssembly = aContext.LoadFromAssemblyPath(xFiles.Where(f => Path.GetExtension(f) == ".dll").Single());
- }
-
- if (xFiles.Any(f => Path.GetExtension(f) == ".exe"))
- {
- aAssembly = aContext.LoadFromAssemblyPath(xFiles.Where(f => Path.GetExtension(f) == ".exe").Single());
- }
-
- return aAssembly != null;
- }
- }
-
- static Dictionary ParseCfg(Stream aStream)
- {
- var xCfg = new Dictionary();
-
- using (var xReader = new StreamReader(aStream))
- {
- while (xReader.Peek() >= 0)
- {
- var xLine = xReader.ReadLine();
-
- if (!xLine.Contains(':') || xLine.Count(c => c == ':') > 1)
- {
- return null;
- }
-
- var xProperty = xLine.Split(':');
- xCfg.Add(xProperty[0].Trim(), xProperty[1].Trim());
- }
- }
-
- return xCfg;
- }
- }
-}
diff --git a/source/TheRingMaster/TheRingMaster.csproj b/source/TheRingMaster/TheRingMaster.csproj
deleted file mode 100644
index d4703a60d8..0000000000
--- a/source/TheRingMaster/TheRingMaster.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- net6.0
- Exe
- Debug;Release;TEST
-
-
-
-
-
-
-
-
diff --git a/source/templates/csharp/CSharpProject.csproj b/source/templates/csharp/CSharpProject.csproj
index 0fc253a378..86947e3838 100644
--- a/source/templates/csharp/CSharpProject.csproj
+++ b/source/templates/csharp/CSharpProject.csproj
@@ -22,6 +22,7 @@
+