Partial work towards c-gear

Getting this out of my changes list, still very WIP
This commit is contained in:
Kaphotics
2016-10-23 12:46:32 -07:00
parent 14550828ed
commit e3d7a7ebce

View File

@@ -46,7 +46,7 @@ private void B_ImportPNG_Click(object sender, EventArgs e)
}
catch (Exception ex)
{
Util.Error("An unexpected error has occurred.", ex);
Util.Error(ex.Message);
}
}
private void B_ExportPNG_Click(object sender, EventArgs e)
@@ -109,6 +109,8 @@ private void B_Save_Click(object sender, EventArgs e)
if (bgdata.SequenceEqual(new byte[CGearBackground.SIZE_CGB]))
return;
// Data present
bgdata = CGearBackground.CGBtoPSK(bgdata, SAV.B2W2);
Array.Copy(bgdata, 0, Main.SAV.Data, SAV.CGearDataOffset, bgdata.Length);
@@ -120,6 +122,11 @@ private void B_Save_Click(object sender, EventArgs e)
ushort skinchkval = SaveUtil.ccitt16(skinchkdata);
BitConverter.GetBytes(skinchkval).CopyTo(Main.SAV.Data, SAV.CGearDataOffset + bgdata.Length + 0x112);
// Indicate in the save file that data is present
BitConverter.GetBytes((ushort)0xC21E).CopyTo(Main.SAV.Data, 0x19438);
Main.SAV.Data[SAV.CGearInfoOffset + 0x26] = 1; // data present
BitConverter.GetBytes(chk).CopyTo(Main.SAV.Data, SAV.CGearInfoOffset + 0x24);