mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
dataarea didn't work, let's try offset
This commit is contained in:
@@ -449,23 +449,8 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the roms from the machine
|
// Get the roms from the machine
|
||||||
long dataAreaSize = -1;
|
|
||||||
switch (subreader.Name)
|
switch (subreader.Name)
|
||||||
{
|
{
|
||||||
case "dataarea":
|
|
||||||
if (xtr.GetAttribute("size") == null)
|
|
||||||
{
|
|
||||||
dataAreaSize = -1;
|
|
||||||
}
|
|
||||||
else if (xtr.GetAttribute("size") != null && xtr.GetAttribute("size").Contains("0x"))
|
|
||||||
{
|
|
||||||
dataAreaSize = Convert.ToInt64(xtr.GetAttribute("size"), 16);
|
|
||||||
}
|
|
||||||
else if (xtr.GetAttribute("size") != null)
|
|
||||||
{
|
|
||||||
Int64.TryParse(xtr.GetAttribute("size"), out dataAreaSize);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "rom":
|
case "rom":
|
||||||
case "disk":
|
case "disk":
|
||||||
// If the rom is nodump, skip it
|
// If the rom is nodump, skip it
|
||||||
@@ -475,16 +460,8 @@ namespace SabreTools.Helper
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the size was in the dataarea, use that instead
|
|
||||||
long size = -1;
|
|
||||||
if (dataAreaSize != -1)
|
|
||||||
{
|
|
||||||
size = dataAreaSize;
|
|
||||||
dataAreaSize = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Take care of hex-sized files
|
// Take care of hex-sized files
|
||||||
|
long size = -1;
|
||||||
if (xtr.GetAttribute("size") != null && xtr.GetAttribute("size").Contains("0x"))
|
if (xtr.GetAttribute("size") != null && xtr.GetAttribute("size").Contains("0x"))
|
||||||
{
|
{
|
||||||
size = Convert.ToInt64(xtr.GetAttribute("size"), 16);
|
size = Convert.ToInt64(xtr.GetAttribute("size"), 16);
|
||||||
@@ -493,6 +470,22 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
Int64.TryParse(xtr.GetAttribute("size"), out size);
|
Int64.TryParse(xtr.GetAttribute("size"), out size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Take care of hex-sized offsets
|
||||||
|
long offset = -1;
|
||||||
|
if (xtr.GetAttribute("offset") != null && xtr.GetAttribute("offset").Contains("0x"))
|
||||||
|
{
|
||||||
|
offset = Convert.ToInt64(xtr.GetAttribute("offset"), 16);
|
||||||
|
}
|
||||||
|
else if (xtr.GetAttribute("offset") != null)
|
||||||
|
{
|
||||||
|
Int64.TryParse(xtr.GetAttribute("offset"), out offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add offset if possible
|
||||||
|
if (offset > 0)
|
||||||
|
{
|
||||||
|
size += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize the hashes from null, hex sizes, and "true blank" strings
|
// Sanitize the hashes from null, hex sizes, and "true blank" strings
|
||||||
|
|||||||
Reference in New Issue
Block a user