mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Symbian Installation File] Parse Symbian OS >= 6.0 options.
This commit is contained in:
@@ -171,6 +171,9 @@ public sealed partial class Symbian
|
|||||||
unused = br.ReadUInt32()
|
unused = br.ReadUInt32()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if((int)attributeExpression.attribute > 0x2000)
|
||||||
|
sb.Append($"option({attributeExpression.attribute - 0x2000}, ENABLED)");
|
||||||
|
else
|
||||||
sb.Append($"{attributeExpression.attribute}");
|
sb.Append($"{attributeExpression.attribute}");
|
||||||
|
|
||||||
attribute = attributeExpression.attribute;
|
attribute = attributeExpression.attribute;
|
||||||
@@ -184,6 +187,10 @@ public sealed partial class Symbian
|
|||||||
unused = br.ReadUInt32()
|
unused = br.ReadUInt32()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(attribute is null)
|
||||||
|
sb.Append($"0x{numberExpression.number:X8}");
|
||||||
|
else if((uint)attribute.Value < 0x2000)
|
||||||
|
{
|
||||||
switch(attribute)
|
switch(attribute)
|
||||||
{
|
{
|
||||||
case Attribute.Manufacturer:
|
case Attribute.Manufacturer:
|
||||||
@@ -261,6 +268,9 @@ public sealed partial class Symbian
|
|||||||
sb.Append($"0x{numberExpression.number:X8}");
|
sb.Append($"0x{numberExpression.number:X8}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sb.Append($"option({attribute.Value - 0x2000}, {(numberExpression.number > 0 ? "ENABLED" : "DISABLED")})");
|
||||||
|
|
||||||
attribute = null;
|
attribute = null;
|
||||||
|
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ public sealed partial class Symbian
|
|||||||
uint currentFile = 0;
|
uint currentFile = 0;
|
||||||
offset = sh.files_ptr;
|
offset = sh.files_ptr;
|
||||||
var conditionLevel = 0;
|
var conditionLevel = 0;
|
||||||
|
_options = new List<OptionRecord>();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -333,6 +334,20 @@ public sealed partial class Symbian
|
|||||||
description.AppendLine();
|
description.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_options.Count > 0)
|
||||||
|
{
|
||||||
|
for(var i = 0; i < _options.Count; i++)
|
||||||
|
{
|
||||||
|
OptionRecord option = _options[i];
|
||||||
|
|
||||||
|
description.AppendFormat("Option {0}:", i + 1).AppendLine();
|
||||||
|
foreach(KeyValuePair<string, string> kvp in option.names)
|
||||||
|
description.AppendFormat("\tName for language {0}: {1}", kvp.Key, kvp.Value).AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
description.AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
if(_conditions.Count > 0)
|
if(_conditions.Count > 0)
|
||||||
{
|
{
|
||||||
description.AppendLine("Conditions:");
|
description.AppendLine("Conditions:");
|
||||||
|
|||||||
@@ -320,6 +320,9 @@ public sealed partial class Symbian
|
|||||||
bool wait, close;
|
bool wait, close;
|
||||||
switch(decodedFileRecords[0].type)
|
switch(decodedFileRecords[0].type)
|
||||||
{
|
{
|
||||||
|
case FileType.File:
|
||||||
|
_conditions.Add(tabulation + $"InstallFileTo(\"{decodedFileRecords[0].destinationName}\")");
|
||||||
|
break;
|
||||||
case FileType.FileText:
|
case FileType.FileText:
|
||||||
switch((FileDetails)((uint)decodedFileRecords[0].details & 0xFF))
|
switch((FileDetails)((uint)decodedFileRecords[0].details & 0xFF))
|
||||||
{
|
{
|
||||||
@@ -444,7 +447,46 @@ public sealed partial class Symbian
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case FileRecordType.Options:
|
case FileRecordType.Options:
|
||||||
throw new NotImplementedException();
|
OptionsLineRecord optionsLineRecord = new()
|
||||||
|
{
|
||||||
|
recordType = (FileRecordType)br.ReadUInt32(),
|
||||||
|
numberOfOptions = br.ReadUInt32()
|
||||||
|
};
|
||||||
|
|
||||||
|
optionsLineRecord.options = new OptionRecord[(int)optionsLineRecord.numberOfOptions];
|
||||||
|
|
||||||
|
for(var i = 0; i < optionsLineRecord.numberOfOptions; i++)
|
||||||
|
{
|
||||||
|
optionsLineRecord.options[i] = new OptionRecord();
|
||||||
|
|
||||||
|
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||||
|
span = buffer;
|
||||||
|
optionsLineRecord.options[i].lengths =
|
||||||
|
MemoryMarshal.Cast<byte, uint>(span)[..languages.Count].ToArray();
|
||||||
|
|
||||||
|
buffer = br.ReadBytes(sizeof(uint) * languages.Count);
|
||||||
|
span = buffer;
|
||||||
|
optionsLineRecord.options[i].pointers =
|
||||||
|
MemoryMarshal.Cast<byte, uint>(span)[..languages.Count].ToArray();
|
||||||
|
|
||||||
|
optionsLineRecord.options[i].names = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
offset = (uint)br.BaseStream.Position;
|
||||||
|
|
||||||
|
for(var j = 0; j < languages.Count; j++)
|
||||||
|
{
|
||||||
|
br.BaseStream.Seek(optionsLineRecord.options[i].pointers[j], SeekOrigin.Begin);
|
||||||
|
buffer = br.ReadBytes((int)optionsLineRecord.options[i].lengths[j]);
|
||||||
|
optionsLineRecord.options[i].names.Add(languages[j], _encoding.GetString(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
br.BaseStream.Seek(offset, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
_options.Add(optionsLineRecord.options[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = (uint)br.BaseStream.Position;
|
||||||
|
break;
|
||||||
case FileRecordType.If:
|
case FileRecordType.If:
|
||||||
conditionLevel--;
|
conditionLevel--;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
// Copyright © 2011-2023 Natalia Portillo
|
// Copyright © 2011-2023 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -316,7 +317,8 @@ public sealed partial class Symbian
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pointer to the option names, array sorted as language records
|
/// Pointer to the option names, array sorted as language records
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint[] strings;
|
public uint[] pointers;
|
||||||
|
public Dictionary<string, string> names;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public sealed partial class Symbian : IArchive
|
|||||||
Encoding _encoding;
|
Encoding _encoding;
|
||||||
ArchiveSupportedFeature _features;
|
ArchiveSupportedFeature _features;
|
||||||
List<DecodedFileRecord> _files;
|
List<DecodedFileRecord> _files;
|
||||||
|
List<OptionRecord> _options;
|
||||||
bool _release6;
|
bool _release6;
|
||||||
Stream _stream;
|
Stream _stream;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user