Misc tweaks

no functional change
This commit is contained in:
Kurt 2024-03-20 09:42:28 -05:00
parent cc7f96951f
commit 95eb008125
4 changed files with 22 additions and 8 deletions

View file

@ -35,7 +35,7 @@ public static class QRPKM
return
[
string.Join(" ", header),
string.Join(' ', header),
sb.ToString(),
IVs + " " + EVs,
];

View file

@ -17,11 +17,16 @@ public sealed class PokeBlock3Case
public byte[] Write()
{
byte[] result = new byte[Count*PokeBlock3.SIZE];
for (int i = 0; i < Blocks.Length; i++)
Blocks[i].SetBlock(result.AsSpan(i * PokeBlock3.SIZE));
Write(result);
return result;
}
public void Write(Span<byte> result)
{
for (int i = 0; i < Blocks.Length; i++)
Blocks[i].SetBlock(result.Slice(i * PokeBlock3.SIZE, PokeBlock3.SIZE));
}
public void DeleteAll()
{
foreach (var b in Blocks)

View file

@ -916,8 +916,7 @@ public partial class Main : Form
{
if (ModifierKeys == Keys.Control || s3.IsCorruptPokedexFF())
{
GameVersion[] g = [GameVersion.R, GameVersion.S, GameVersion.E, GameVersion.FR, GameVersion.LG];
var games = g.Select(z => GameInfo.VersionDataSource.First(v => v.Value == (int)z));
var games = GetGameList([GameVersion.R, GameVersion.S, GameVersion.E, GameVersion.FR, GameVersion.LG]);
var msg = string.Format(MsgFileLoadVersionDetect, $"3 ({s3.Version})");
using var dialog = new SAV_GameSelect(games, msg, MsgFileLoadSaveSelectVersion);
dialog.ShowDialog();
@ -941,8 +940,7 @@ public partial class Main : Form
string fr = GameInfo.GetVersionName(GameVersion.FR);
string lg = GameInfo.GetVersionName(GameVersion.LG);
string dual = "{1}/{2} " + MsgFileLoadVersionDetect;
GameVersion[] g = [GameVersion.FR, GameVersion.LG];
var games = g.Select(z => GameInfo.VersionDataSource.First(v => v.Value == (int)z));
var games = GetGameList([GameVersion.FR, GameVersion.LG]);
var msg = string.Format(dual, "3", fr, lg);
using var dialog = new SAV_GameSelect(games, msg, MsgFileLoadSaveSelectVersion);
dialog.ShowDialog();
@ -953,6 +951,17 @@ public partial class Main : Form
}
return true;
static ComboItem[] GetGameList(ReadOnlySpan<GameVersion> g)
{
var result = new ComboItem[g.Length];
for (int i = 0; i < g.Length; i++)
{
int id = (int)g[i];
result[i] = GameInfo.VersionDataSource.First(v => v.Value == id);
}
return result;
}
}
public static void SetCountrySubRegion(ComboBox CB, string type)

View file

@ -80,7 +80,7 @@ public partial class SAV_BlockDump8 : Form
{
var block = CurrentBlock;
L_Detail_R.Text = GetBlockSummary(block);
RTB_Hex.Text = string.Join(" ", block.Data.Select(z => $"{z:X2}"));
RTB_Hex.Text = string.Join(' ', block.Data.Select(z => $"{z:X2}"));
var blockName = Metadata.GetBlockName(block, out var obj);
if (blockName != null)