Skip to content

Commit

Permalink
✨ Begin PNG impl
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Mar 13, 2024
1 parent bcddf15 commit a373fd0
Show file tree
Hide file tree
Showing 12 changed files with 876 additions and 7 deletions.
5 changes: 5 additions & 0 deletions SRC/Aura_OS/Aura_OS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\wallpaper-1.png" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\auralogo_white.bmp" />
<EmbeddedResource Include="Resources\error.bmp" />
<EmbeddedResource Include="Resources\Tetris.gb" />
<EmbeddedResource Include="Resources\wallpaper-1.bmp" />
<EmbeddedResource Include="Resources\wallpaper-1.png" />
<EmbeddedResource Include="Resources\wallpaper-2.bmp" />
</ItemGroup>

Expand Down
6 changes: 6 additions & 0 deletions SRC/Aura_OS/Files.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class Files
[ManifestResourceStream(ResourceName = "Aura_OS.Resources.wallpaper-1.bmp")]
public static byte[] Wallpaper;

[ManifestResourceStream(ResourceName = "Aura_OS.Resources.wallpaper-1.png")]
public static byte[] WallpaperPng;

[ManifestResourceStream(ResourceName = "Aura_OS.Resources.wallpaper-2.bmp")]
public static byte[] Wallpaper2;

Expand Down Expand Up @@ -52,6 +55,9 @@ public static void LoadFiles()
Kernel.wallpaper1 = new Bitmap(Files.Wallpaper);
CustomConsole.WriteLineOK("wallpaper-1.bmp wallpaper loaded.");

Kernel.wallpaper1png = new Png(Files.WallpaperPng);
CustomConsole.WriteLineOK("wallpaper-1.png wallpaper loaded.");

Kernel.wallpaper2 = new Bitmap(Files.Wallpaper2);
CustomConsole.WriteLineOK("wallpaper-2.bmp wallpaper loaded.");

Expand Down
1 change: 1 addition & 0 deletions SRC/Aura_OS/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static bool NetworkConnected
public static Bitmap CosmosLogo;

public static Bitmap wallpaper1;
public static Png wallpaper1png;
public static Bitmap wallpaper2;
public static Bitmap auralogo_white;

Expand Down
2 changes: 1 addition & 1 deletion SRC/Aura_OS/Properties/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Aura_OS
{
public class VersionInfo
{
public static string revision = "130320241316";
public static string revision = "130320241712";
}
}
Binary file added SRC/Aura_OS/Resources/wallpaper-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SRC/Aura_OS/Resources/wallpaper-1.png.bak
Binary file not shown.
98 changes: 98 additions & 0 deletions SRC/Aura_OS/System/Compression/BinaryReader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
namespace CosmosGL.System
{
public class BinaryReader
{
private int _pos = 0;
private byte[] _data;

public BinaryReader(byte[] data)
{
_data = data;
}

public int Seek(int pos)
{
var oldPos = _pos;
_pos = pos;
return oldPos;
}

public int Tell()
{
return _pos;
}

public byte GetUint8()
{
return _data[_pos++];
}

public ushort GetUint16()
{
return (ushort)(((GetUint8() << 8) | GetUint8()) >> 0);
}

public uint GetUint32()
{
return (uint)GetInt32();
}

public short GetInt16()
{
// var result = GetUint16();
// if ((result & 0x8000) == 1)
// {
// result -= (1 << 16);
// }
// return result;

return (short)GetUint16();
}

public int GetInt32()
{
return ((GetUint8() << 24) |
(GetUint8() << 16) |
(GetUint8() << 8) |
(GetUint8()));
}

public short GetFword()
{
return GetInt16();
}

public int Get2Dot14()
{
return GetInt16() / (1 << 14);
}

public int GetFixed()
{
return GetInt32() / (1 << 16);
}

public string GetString(int length)
{
var result = "";
for (var i = 0; i < length; i++)
{
result += (char)GetUint8();
}
return result;
}

public void GetDate()
{
GetUint32();
GetUint32();
/* var macTime = GetUint32() * 0x100000000 + GetUint32();
return new DateTime(macTime, DateTimeKind.Utc);*/
}

public char GetChar()
{
return (char)GetUint8();
}
}
}
Loading

0 comments on commit a373fd0

Please sign in to comment.