2020-02-19 00:12:15 +00:00
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
// Aaru Data Preservation Suite
|
2020-02-19 00:12:15 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Filename : Info.cs
|
2020-02-19 00:12:15 +00:00
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Component : Common Apple file systems.
|
2020-02-19 00:12:15 +00:00
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2020-02-19 00:12:15 +00:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System.Text;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.Helpers;
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
// Information from Inside Macintosh
|
|
|
|
|
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
2022-03-07 07:36:44 +00:00
|
|
|
static partial class AppleCommon
|
2020-02-19 00:12:15 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
internal static string GetBootBlockInformation(byte[] bbSector, Encoding encoding)
|
2020-02-19 00:12:15 +00:00
|
|
|
{
|
2024-05-01 04:05:22 +01:00
|
|
|
if(bbSector is null || bbSector.Length < 0x100) return null;
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
BootBlock bb = Marshal.ByteArrayToStructureBigEndian<BootBlock>(bbSector);
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(bb.bbID != BB_MAGIC) return null;
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var sb = new StringBuilder();
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendLine(Localization.Boot_Block);
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((bb.bbVersion & 0x8000) > 0)
|
|
|
|
|
{
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendLine(Localization.Boot_block_is_in_new_format);
|
2020-02-19 00:42:34 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((bb.bbVersion & 0x4000) > 0)
|
|
|
|
|
{
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendLine(Localization.Boot_block_should_be_executed);
|
2020-02-19 00:42:34 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((bb.bbVersion & 0x2000) > 0)
|
2023-10-03 23:22:08 +01:00
|
|
|
{
|
2024-05-01 04:05:22 +01:00
|
|
|
sb.AppendFormat(Localization
|
|
|
|
|
.System_heap_will_be_extended_by_0_bytes_and_a_1_fraction_of_the_available_RAM,
|
|
|
|
|
bb.bbSysHeapExtra,
|
|
|
|
|
bb.bbSysHeapFract)
|
|
|
|
|
.AppendLine();
|
2023-10-03 23:22:08 +01:00
|
|
|
}
|
2020-02-19 00:42:34 +00:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2024-05-01 04:05:22 +01:00
|
|
|
else if((bb.bbVersion & 0xFF) == 0x0D) sb.AppendLine(Localization.Boot_block_should_be_executed);
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
switch(bb.bbPageFlags)
|
|
|
|
|
{
|
|
|
|
|
case > 0:
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendLine(Localization.Allocate_secondary_sound_buffer_at_boot);
|
2022-11-13 19:38:03 +00:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case < 0:
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendLine(Localization.Allocate_secondary_sound_and_video_buffers_at_boot);
|
2022-11-13 19:38:03 +00:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
sb.AppendFormat(Localization.System_filename_0, StringHandlers.PascalToString(bb.bbSysName, encoding))
|
|
|
|
|
.AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
sb.AppendFormat(Localization.Finder_filename_0, StringHandlers.PascalToString(bb.bbShellName, encoding))
|
|
|
|
|
.AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
sb.AppendFormat(Localization.Debugger_filename_0, StringHandlers.PascalToString(bb.bbDbg1Name, encoding))
|
|
|
|
|
.AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
sb.AppendFormat(Localization.Disassembler_filename_0, StringHandlers.PascalToString(bb.bbDbg2Name, encoding))
|
|
|
|
|
.AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendFormat(Localization.Startup_screen_filename_0,
|
2024-05-01 04:05:22 +01:00
|
|
|
StringHandlers.PascalToString(bb.bbScreenName, encoding))
|
|
|
|
|
.AppendLine();
|
2022-11-28 02:59:53 +00:00
|
|
|
|
|
|
|
|
sb.AppendFormat(Localization.First_program_to_execute_at_boot_0,
|
2024-05-01 04:05:22 +01:00
|
|
|
StringHandlers.PascalToString(bb.bbHelloName, encoding))
|
|
|
|
|
.AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
sb.AppendFormat(Localization.Clipboard_filename_0, StringHandlers.PascalToString(bb.bbScrapName, encoding))
|
|
|
|
|
.AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
sb.AppendFormat(Localization.Maximum_opened_files_0, bb.bbCntFCBs * 4).AppendLine();
|
|
|
|
|
sb.AppendFormat(Localization.Event_queue_size_0, bb.bbCntEvts).AppendLine();
|
|
|
|
|
sb.AppendFormat(Localization.Heap_size_with_128KiB_of_RAM_0_bytes, bb.bb128KSHeap).AppendLine();
|
|
|
|
|
sb.AppendFormat(Localization.Heap_size_with_256KiB_of_RAM_0_bytes, bb.bb256KSHeap).AppendLine();
|
2022-11-28 02:59:53 +00:00
|
|
|
sb.AppendFormat(Localization.Heap_size_with_512KiB_of_RAM_or_more_0_bytes, bb.bbSysHeapSize).AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
return sb.ToString();
|
2020-02-19 00:12:15 +00:00
|
|
|
}
|
|
|
|
|
}
|