mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 12:39:16 +08:00
reduced unsafe block.
This commit is contained in:
parent
8711349c19
commit
f09921cd1d
@ -206,25 +206,25 @@ namespace GameRes.Formats.TopCat
|
|||||||
return DecryptOgg (arc, entry);
|
return DecryptOgg (arc, entry);
|
||||||
var header = new byte[0x14];
|
var header = new byte[0x14];
|
||||||
arc.File.View.Read (entry.Offset, header, 0, 0x14);
|
arc.File.View.Read (entry.Offset, header, 0, 0x14);
|
||||||
unsafe
|
if (null == tcda.Key)
|
||||||
{
|
{
|
||||||
fixed (byte* raw = header)
|
foreach (var key in KnownKeys.Values)
|
||||||
{
|
{
|
||||||
int* dw = (int*)raw;
|
int first = signature + key * (tcde.Index + 3);
|
||||||
if (null == tcda.Key)
|
if (0x43445053 == first) // 'SPDC'
|
||||||
{
|
{
|
||||||
foreach (var key in KnownKeys.Values)
|
tcda.Key = key;
|
||||||
{
|
break;
|
||||||
int first = signature + key * (tcde.Index + 3);
|
|
||||||
if (0x43445053 == first) // 'SPDC'
|
|
||||||
{
|
|
||||||
tcda.Key = key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (null != tcda.Key && 0 != tcda.Key.Value)
|
}
|
||||||
|
}
|
||||||
|
if (null != tcda.Key && 0 != tcda.Key.Value)
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
fixed (byte* raw = header)
|
||||||
{
|
{
|
||||||
|
int* dw = (int*)raw;
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
dw[i] += tcda.Key.Value * (tcde.Index + 3 + i);
|
dw[i] += tcda.Key.Value * (tcde.Index + 3 + i);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user