Skip to content

Commit

Permalink
Merge pull request #24 from MuertoGB/203-development
Browse files Browse the repository at this point in the history
203 merge to main
  • Loading branch information
MuertoGB authored Dec 15, 2024
2 parents 5e62021 + ab7220a commit 93a81c5
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 86 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@
<a href="#version-115">V1.1.5</a> •
<a href="#version-200">V2.0.0</a> •
<a href="#version-201">V2.0.1</a> •
<a href="#version-202">V2.0.2</a>
<a href="#version-202">V2.0.2</a> •
<a href="#version-203">V2.0.3</a>
</p>

## Version 2.0.3

### Bugs

- Resolved an issue where pressing `Alt + F4` would incorrectly open the settings window before closing the application or active window as expected.
- Resolved an issue where certain APFS capable firmware incorrectly reported the driver as not found. This was caused by an oversight in LZMA header verification logic (thanks reformatt @ badcaps).

## Version 2.0.2

### Enhancements
Expand Down
8 changes: 4 additions & 4 deletions files/app/version.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<data>
<MET>
<VersionString>2.0.2</VersionString>
<Build>241205.2155</Build>
<ReleaseDate>20241205</ReleaseDate>
<VersionString>2.0.3</VersionString>
<Build>241215.0400</Build>
<ReleaseDate>20241215</ReleaseDate>
<Channel>Stable</Channel>
<SHA256>e7a75a8a4c0b0b8afceb9cfb29375b58685290e817323f51d3fad3bf09df8721</SHA256>
<SHA256>1f890b94b6f9cc03d5dbb44980a473f5353cef3afd236af05bb5fb886c1666a6</SHA256>
</MET>
</data>
10 changes: 5 additions & 5 deletions src/mefit/Common/LzmaCoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ internal static bool IsValidLzmaHeader(byte[] sourcebuffer)
return false;
}

int iDictSize = BitConverter.ToInt32(sourcebuffer, 1);
int nDictSize = BitConverter.ToInt32(sourcebuffer, 1);

bool IsPow2(int i)
{
{
return (i > 0) && ((i & (i - 1)) == 0);
}

if (iDictSize <= 0 || iDictSize > 0x800000 || !IsPow2(iDictSize))
if (nDictSize <= 0 || !IsPow2(nDictSize))
{
// Invalid dictionary size.
Console.WriteLine($"{nameof(IsValidLzmaHeader)}: Invalid dictionary size: {iDictSize}");
// Invalid dictionary size <= 0 or not a power of 2.
Console.WriteLine($"{nameof(IsValidLzmaHeader)}: Invalid dictionary size: {nDictSize}");
return false;
}

Expand Down
12 changes: 12 additions & 0 deletions src/mefit/Firmware/EFI/EFIROM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,12 @@ internal static ApfsCapable GetIsApfsCapable(byte[] sourcebuffer)
if (BinaryTools.GetBaseAddress(
sourcebuffer, Guids.ApfsDxeGuid, (int)FlashDescriptor.BiosBase, (int)FlashDescriptor.BiosLimit) != -1)
{
Console.Write(" > Standard LZMA GUID found");
return ApfsCapable.Yes;
}

Console.WriteLine(" > Looking for a compressed LZMA DXE GUID");

// Look for a compressed volume GUID.
int iLzmaBase = FindLzmaBase(
sourcebuffer,
Expand All @@ -907,6 +910,7 @@ internal static ApfsCapable GetIsApfsCapable(byte[] sourcebuffer)
// No compressed DXE volume was found.
if (iLzmaBase == -1)
{
Console.WriteLine(" > No compressed LZMA DXE GUID was found");
return ApfsCapable.No;
}

Expand All @@ -919,22 +923,28 @@ internal static ApfsCapable GetIsApfsCapable(byte[] sourcebuffer)
// Determine the end of the LZMA GUID section.
int iLzmaLimit = iLzmaBase + iLength;

Console.WriteLine(" > Looking for a valid LZMA header");

// Search for a valid LZMA header (with 3 attempts).
int iLzmaSignatureBase = FindValidLzmaHeader(sourcebuffer, iLzmaBase, iLzmaLimit, maxattempts: 3);

if (iLzmaSignatureBase == -1)
{
Console.WriteLine(" > Valid LZMA header not found");
// Couldn't locate a valid LZMA header.
return ApfsCapable.No;
}

Console.WriteLine(" > Decompressing LZMA DXE archive");

// Decompress the LZMA volume.
byte[] dDecompressed = LzmaCoder.DecompressBytes(
BinaryTools.GetBytesBaseLimit(sourcebuffer, iLzmaSignatureBase, iLzmaLimit));

// There was an issue decompressing the volume (Error saved to './mefit.log').
if (dDecompressed == null)
{
Console.WriteLine(" > bDecompressed was empty.");
return ApfsCapable.Unknown;
}

Expand All @@ -944,10 +954,12 @@ internal static ApfsCapable GetIsApfsCapable(byte[] sourcebuffer)
// Search the decompressed volume for the APFS DXE GUID.
if (BinaryTools.GetBaseAddress(dDecompressed, Guids.ApfsDxeGuid) == -1)
{
Console.WriteLine(" > No APFS GUID found in decompressed archive");
// The APFS DXE GUID was not found in the compressed volume.
return ApfsCapable.No;
}

Console.WriteLine(" > An APFS GUID was found in the decompressed archive");
// The APFS DXE GUID was present in the compressed volume.
return ApfsCapable.Yes;
}
Expand Down
39 changes: 0 additions & 39 deletions src/mefit/Forms/frmEfiRom.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/mefit/Forms/frmEfiRom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ private void frmEfiRom_DragDrop(object sender, DragEventArgs e)
#region KeyDown Events
private void frmEfiRom_KeyDown(object sender, KeyEventArgs e)
{
// Check if the Alt key is pressed
if (e.Alt && e.KeyCode == Keys.F4)
{
// Let the system handle Alt+F4 to close the window
e.Handled = false;
return;
}

// Handle individual keys (F12, ESC) without modifiers.
switch (e.KeyCode)
{
Expand Down Expand Up @@ -222,7 +230,6 @@ private void frmEfiRom_KeyDown(object sender, KeyEventArgs e)
case Keys.N:
cbxCensor.Checked = !cbxCensor.Checked;
break;

}
}
}
Expand Down
54 changes: 27 additions & 27 deletions src/mefit/Forms/frmEfiRom.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down
8 changes: 8 additions & 0 deletions src/mefit/Forms/frmSocRom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ private void frmSocRom_DragDrop(object sender, DragEventArgs e)
#region KeyDown Events
private void frmSocRom_KeyDown(object sender, KeyEventArgs e)
{
// Check if the Alt key is pressed
if (e.Alt && e.KeyCode == Keys.F4)
{
// Let the system handle Alt+F4 to close the window
e.Handled = false;
return;
}

// Handle individual keys (F12, ESC) without modifiers.
switch (e.KeyCode)
{
Expand Down
8 changes: 8 additions & 0 deletions src/mefit/Forms/frmStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ private void frmStartup_DragDrop(object sender, DragEventArgs e)
#region KeyDown Events
private void frmStartup_KeyDown(object sender, KeyEventArgs e)
{
// Check if the Alt key is pressed
if (e.Alt && e.KeyCode == Keys.F4)
{
// Let the system handle Alt+F4 to close the window
e.Handled = false;
return;
}

// Handle individual keys (F1, F2, F12) without modifiers.
switch (e.KeyCode)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mefit/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal readonly struct ApplicationUrls
internal readonly struct ApplicationVersions
{
internal const string LZMA_SDK_VERSION = "24.08";
internal const string CURRENT_BUILD = "241205.2155";
internal const string CURRENT_BUILD = "241215.0400";
internal const string CURRENT_CHANNEL = "Stable";
}
#endregion
Expand Down
4 changes: 2 additions & 2 deletions src/mefit/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2")]
[assembly: AssemblyFileVersion("2.0.2")]
[assembly: AssemblyVersion("2.0.3")]
[assembly: AssemblyFileVersion("2.0.3")]
[assembly: NeutralResourcesLanguage("en-GB")]
4 changes: 2 additions & 2 deletions src/mefit/UI/Controls/METContextMenuStrip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ internal class METContextMenuStrip : ContextMenuStrip
public METContextMenuStrip()
{
Renderer = new METMenuRenderer();
BackColor = Color.FromArgb(20, 20, 20);
ForeColor = Color.FromArgb(255, 255, 255);
BackColor = Color.FromArgb(10, 10, 10);
ForeColor = Color.White;
Font = new Font("Segoe UI", 10.2f, FontStyle.Regular);
ShowImageMargin = false;
}
Expand Down
Binary file modified stream/images/application/startup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions stream/manifests/version.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<data>
<MET>
<VersionString>2.0.2</VersionString>
<Build>241205.2155</Build>
<ReleaseDate>20241205</ReleaseDate>
<VersionString>2.0.3</VersionString>
<Build>241215.0400</Build>
<ReleaseDate>20241215</ReleaseDate>
<Channel>Stable</Channel>
<SHA256>e7a75a8a4c0b0b8afceb9cfb29375b58685290e817323f51d3fad3bf09df8721</SHA256>
<SHA256>1f890b94b6f9cc03d5dbb44980a473f5353cef3afd236af05bb5fb886c1666a6</SHA256>
</MET>
</data>

0 comments on commit 93a81c5

Please sign in to comment.