mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Decode PCMCIA device tags from image info in GUI.
This commit is contained in:
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -1622,6 +1622,8 @@
|
||||
<e p="tabDvdInfo.xeto.cs" t="Include" />
|
||||
<e p="tabDvdWritableInfo.xeto" t="Include" />
|
||||
<e p="tabDvdWritableInfo.xeto.cs" t="Include" />
|
||||
<e p="tabPcmciaInfo.xeto" t="Include" />
|
||||
<e p="tabPcmciaInfo.xeto.cs" t="Include" />
|
||||
<e p="tabScsiInfo.xeto" t="Include" />
|
||||
<e p="tabScsiInfo.xeto.cs" t="Include" />
|
||||
<e p="tabXboxInfo.xeto" t="Include" />
|
||||
|
||||
@@ -156,27 +156,6 @@
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabPcmcia" Text="PCMCIA" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem HorizontalAlignment="Left" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treePcmcia"
|
||||
SelectedItemChanged="OnTreePcmciaSelectedItemChanged"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtPcmciaCis" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnSavePcmciaCis" Text="Save PCMCIA CIS to file"
|
||||
Click="OnBtnSavePcmciaCis"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabPlextor" Text="Plextor" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||
|
||||
@@ -86,86 +86,9 @@ namespace DiscImageChef.Gui.Panels
|
||||
|
||||
if(devInfo.IsPcmcia)
|
||||
{
|
||||
tabPcmcia.Visible = true;
|
||||
|
||||
TreeGridItemCollection cisList = new TreeGridItemCollection();
|
||||
|
||||
treePcmcia.Columns.Add(new GridColumn {HeaderText = "CIS", DataCell = new TextBoxCell(0)});
|
||||
|
||||
treePcmcia.AllowMultipleSelection = false;
|
||||
treePcmcia.ShowHeader = false;
|
||||
treePcmcia.DataStore = cisList;
|
||||
|
||||
Tuple[] tuples = CIS.GetTuples(devInfo.Cis);
|
||||
if(tuples != null)
|
||||
foreach(Tuple tuple in tuples)
|
||||
{
|
||||
string tupleCode;
|
||||
string tupleDescription;
|
||||
|
||||
switch(tuple.Code)
|
||||
{
|
||||
case TupleCodes.CISTPL_NULL:
|
||||
case TupleCodes.CISTPL_END: continue;
|
||||
case TupleCodes.CISTPL_DEVICEGEO:
|
||||
case TupleCodes.CISTPL_DEVICEGEO_A:
|
||||
tupleCode = "Device Geometry Tuples";
|
||||
tupleDescription = CIS.PrettifyDeviceGeometryTuple(tuple);
|
||||
break;
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
tupleCode = "Manufacturer Identification Tuple";
|
||||
tupleDescription = CIS.PrettifyManufacturerIdentificationTuple(tuple);
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
tupleCode = "Level 1 Version / Product Information Tuple";
|
||||
tupleDescription = CIS.PrettifyLevel1VersionTuple(tuple);
|
||||
break;
|
||||
case TupleCodes.CISTPL_ALTSTR:
|
||||
case TupleCodes.CISTPL_BAR:
|
||||
case TupleCodes.CISTPL_BATTERY:
|
||||
case TupleCodes.CISTPL_BYTEORDER:
|
||||
case TupleCodes.CISTPL_CFTABLE_ENTRY:
|
||||
case TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
|
||||
case TupleCodes.CISTPL_CHECKSUM:
|
||||
case TupleCodes.CISTPL_CONFIG:
|
||||
case TupleCodes.CISTPL_CONFIG_CB:
|
||||
case TupleCodes.CISTPL_DATE:
|
||||
case TupleCodes.CISTPL_DEVICE:
|
||||
case TupleCodes.CISTPL_DEVICE_A:
|
||||
case TupleCodes.CISTPL_DEVICE_OA:
|
||||
case TupleCodes.CISTPL_DEVICE_OC:
|
||||
case TupleCodes.CISTPL_EXTDEVIC:
|
||||
case TupleCodes.CISTPL_FORMAT:
|
||||
case TupleCodes.CISTPL_FORMAT_A:
|
||||
case TupleCodes.CISTPL_FUNCE:
|
||||
case TupleCodes.CISTPL_FUNCID:
|
||||
case TupleCodes.CISTPL_GEOMETRY:
|
||||
case TupleCodes.CISTPL_INDIRECT:
|
||||
case TupleCodes.CISTPL_JEDEC_A:
|
||||
case TupleCodes.CISTPL_JEDEC_C:
|
||||
case TupleCodes.CISTPL_LINKTARGET:
|
||||
case TupleCodes.CISTPL_LONGLINK_A:
|
||||
case TupleCodes.CISTPL_LONGLINK_C:
|
||||
case TupleCodes.CISTPL_LONGLINK_CB:
|
||||
case TupleCodes.CISTPL_LONGLINK_MFC:
|
||||
case TupleCodes.CISTPL_NO_LINK:
|
||||
case TupleCodes.CISTPL_ORG:
|
||||
case TupleCodes.CISTPL_PWR_MGMNT:
|
||||
case TupleCodes.CISTPL_SPCL:
|
||||
case TupleCodes.CISTPL_SWIL:
|
||||
case TupleCodes.CISTPL_VERS_2:
|
||||
tupleCode = $"Undecoded tuple ID {tuple.Code}";
|
||||
tupleDescription = $"Undecoded tuple ID {tuple.Code}";
|
||||
break;
|
||||
default:
|
||||
tupleCode = $"0x{(byte)tuple.Code:X2}";
|
||||
tupleDescription = $"Found unknown tuple ID 0x{(byte)tuple.Code:X2}";
|
||||
break;
|
||||
}
|
||||
|
||||
cisList.Add(new TreeGridItem {Values = new object[] {tupleCode, tupleDescription}});
|
||||
}
|
||||
else DicConsole.DebugWriteLine("Device-Info command", "PCMCIA CIS returned no tuples");
|
||||
tabPcmciaInfo tabPcmciaInfo = new tabPcmciaInfo();
|
||||
tabPcmciaInfo.LoadData(devInfo.Cis);
|
||||
tabInfos.Pages.Add(tabPcmciaInfo);
|
||||
}
|
||||
|
||||
if(devInfo.AtaIdentify != null || devInfo.AtapiIdentify != null)
|
||||
|
||||
@@ -563,6 +563,16 @@ namespace DiscImageChef.Gui.Panels
|
||||
tabXboxInfo tabXboxInfo = new tabXboxInfo();
|
||||
tabXboxInfo.LoadData(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector);
|
||||
tabInfos.Pages.Add(tabXboxInfo);
|
||||
|
||||
byte[] pcmciaCis = null;
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS))
|
||||
pcmciaCis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS);
|
||||
|
||||
tabPcmciaInfo tabPcmciaInfo = new tabPcmciaInfo();
|
||||
tabPcmciaInfo.LoadData(pcmciaCis);
|
||||
tabInfos.Pages.Add(tabPcmciaInfo);
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
|
||||
53
DiscImageChef.Gui/Tabs/tabPcmciaInfo.xeto
Normal file
53
DiscImageChef.Gui/Tabs/tabPcmciaInfo.xeto
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ============================================================================
|
||||
//
|
||||
// Filename : pnlDeviceInfo.xeto
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Device information panel.
|
||||
//
|
||||
// ==[ Description ] ==========================================================
|
||||
//
|
||||
// Defines the structure for the device information panel.
|
||||
//
|
||||
// ==[ License ] ==============================================================
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 General public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ============================================================================
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
-->
|
||||
<TabPage Text="PCMCIA" Visible="False" xmlns="http://schema.picoe.ca/eto.forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem HorizontalAlignment="Left" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treePcmcia" SelectedItemChanged="OnTreePcmciaSelectedItemChanged"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtPcmciaCis" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnSavePcmciaCis" Text="Save PCMCIA CIS to file" Click="OnBtnSavePcmciaCis"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
170
DiscImageChef.Gui/Tabs/tabPcmciaInfo.xeto.cs
Normal file
170
DiscImageChef.Gui/Tabs/tabPcmciaInfo.xeto.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : pnlDeviceInfo.xeto.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Device information.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Implements the device information panel.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 General public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.PCMCIA;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
|
||||
|
||||
namespace DiscImageChef.Gui.Panels
|
||||
{
|
||||
public class tabPcmciaInfo : TabPage
|
||||
{
|
||||
byte[] cis;
|
||||
|
||||
public tabPcmciaInfo()
|
||||
{
|
||||
XamlReader.Load(this);
|
||||
}
|
||||
|
||||
internal void LoadData(byte[] pcmciaCis)
|
||||
{
|
||||
if(pcmciaCis == null) return;
|
||||
|
||||
cis = pcmciaCis;
|
||||
Visible = true;
|
||||
|
||||
TreeGridItemCollection cisList = new TreeGridItemCollection();
|
||||
|
||||
treePcmcia.Columns.Add(new GridColumn {HeaderText = "CIS", DataCell = new TextBoxCell(0)});
|
||||
|
||||
treePcmcia.AllowMultipleSelection = false;
|
||||
treePcmcia.ShowHeader = false;
|
||||
treePcmcia.DataStore = cisList;
|
||||
|
||||
Tuple[] tuples = CIS.GetTuples(cis);
|
||||
if(tuples != null)
|
||||
foreach(Tuple tuple in tuples)
|
||||
{
|
||||
string tupleCode;
|
||||
string tupleDescription;
|
||||
|
||||
switch(tuple.Code)
|
||||
{
|
||||
case TupleCodes.CISTPL_NULL:
|
||||
case TupleCodes.CISTPL_END: continue;
|
||||
case TupleCodes.CISTPL_DEVICEGEO:
|
||||
case TupleCodes.CISTPL_DEVICEGEO_A:
|
||||
tupleCode = "Device Geometry Tuples";
|
||||
tupleDescription = CIS.PrettifyDeviceGeometryTuple(tuple);
|
||||
break;
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
tupleCode = "Manufacturer Identification Tuple";
|
||||
tupleDescription = CIS.PrettifyManufacturerIdentificationTuple(tuple);
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
tupleCode = "Level 1 Version / Product Information Tuple";
|
||||
tupleDescription = CIS.PrettifyLevel1VersionTuple(tuple);
|
||||
break;
|
||||
case TupleCodes.CISTPL_ALTSTR:
|
||||
case TupleCodes.CISTPL_BAR:
|
||||
case TupleCodes.CISTPL_BATTERY:
|
||||
case TupleCodes.CISTPL_BYTEORDER:
|
||||
case TupleCodes.CISTPL_CFTABLE_ENTRY:
|
||||
case TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
|
||||
case TupleCodes.CISTPL_CHECKSUM:
|
||||
case TupleCodes.CISTPL_CONFIG:
|
||||
case TupleCodes.CISTPL_CONFIG_CB:
|
||||
case TupleCodes.CISTPL_DATE:
|
||||
case TupleCodes.CISTPL_DEVICE:
|
||||
case TupleCodes.CISTPL_DEVICE_A:
|
||||
case TupleCodes.CISTPL_DEVICE_OA:
|
||||
case TupleCodes.CISTPL_DEVICE_OC:
|
||||
case TupleCodes.CISTPL_EXTDEVIC:
|
||||
case TupleCodes.CISTPL_FORMAT:
|
||||
case TupleCodes.CISTPL_FORMAT_A:
|
||||
case TupleCodes.CISTPL_FUNCE:
|
||||
case TupleCodes.CISTPL_FUNCID:
|
||||
case TupleCodes.CISTPL_GEOMETRY:
|
||||
case TupleCodes.CISTPL_INDIRECT:
|
||||
case TupleCodes.CISTPL_JEDEC_A:
|
||||
case TupleCodes.CISTPL_JEDEC_C:
|
||||
case TupleCodes.CISTPL_LINKTARGET:
|
||||
case TupleCodes.CISTPL_LONGLINK_A:
|
||||
case TupleCodes.CISTPL_LONGLINK_C:
|
||||
case TupleCodes.CISTPL_LONGLINK_CB:
|
||||
case TupleCodes.CISTPL_LONGLINK_MFC:
|
||||
case TupleCodes.CISTPL_NO_LINK:
|
||||
case TupleCodes.CISTPL_ORG:
|
||||
case TupleCodes.CISTPL_PWR_MGMNT:
|
||||
case TupleCodes.CISTPL_SPCL:
|
||||
case TupleCodes.CISTPL_SWIL:
|
||||
case TupleCodes.CISTPL_VERS_2:
|
||||
tupleCode = $"Undecoded tuple ID {tuple.Code}";
|
||||
tupleDescription = $"Undecoded tuple ID {tuple.Code}";
|
||||
break;
|
||||
default:
|
||||
tupleCode = $"0x{(byte)tuple.Code:X2}";
|
||||
tupleDescription = $"Found unknown tuple ID 0x{(byte)tuple.Code:X2}";
|
||||
break;
|
||||
}
|
||||
|
||||
cisList.Add(new TreeGridItem {Values = new object[] {tupleCode, tupleDescription}});
|
||||
}
|
||||
else DicConsole.DebugWriteLine("Device-Info command", "PCMCIA CIS returned no tuples");
|
||||
}
|
||||
|
||||
protected void OnTreePcmciaSelectedItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(!(treePcmcia.SelectedItem is TreeGridItem item)) return;
|
||||
|
||||
txtPcmciaCis.Text = item.Values[1] as string;
|
||||
}
|
||||
|
||||
protected void OnBtnSavePcmciaCis(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog dlgSaveBinary = new SaveFileDialog();
|
||||
dlgSaveBinary.Filters.Add(new FileFilter {Extensions = new[] {"*.bin"}, Name = "Binary"});
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
|
||||
if(result != DialogResult.Ok) return;
|
||||
|
||||
FileStream saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(cis, 0, cis.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
#pragma warning disable 169
|
||||
#pragma warning disable 649
|
||||
TreeGridView treePcmcia;
|
||||
TextArea txtPcmciaCis;
|
||||
Button btnSavePcmciaCis;
|
||||
#pragma warning restore 169
|
||||
#pragma warning restore 649
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace DiscImageChef.Gui.Panels
|
||||
{
|
||||
public class tabXboxInfo : TabPage
|
||||
{
|
||||
byte[] XboxSecuritySector;
|
||||
byte[] xboxSecuritySector;
|
||||
|
||||
public tabXboxInfo()
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace DiscImageChef.Gui.Panels
|
||||
internal void LoadData(XgdInfo xgdInfo, byte[] dmi, byte[] securitySector,
|
||||
SS.SecuritySector? decodedSecuritySector)
|
||||
{
|
||||
XboxSecuritySector = securitySector;
|
||||
xboxSecuritySector = securitySector;
|
||||
|
||||
if(xgdInfo != null)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ namespace DiscImageChef.Gui.Panels
|
||||
|
||||
protected void OnBtnSaveXboxSsClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(XboxSecuritySector);
|
||||
SaveElement(xboxSecuritySector);
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
|
||||
Reference in New Issue
Block a user