Add Subway Scores edition (#2643)

* Add Subway Scores edition

* Changing the offsets handling

Simply use the block offset as the base and add them to it. Also allow edition on B2W2.
This commit is contained in:
Egzon Qukovci Jusufi
2020-01-19 04:31:36 +01:00
committed by Kurt
parent 63ea57436f
commit ab5016bf7d
4 changed files with 1186 additions and 142 deletions

View File

@@ -12,5 +12,111 @@ public int BP
get => BitConverter.ToUInt16(Data, Offset);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset);
}
// Normal
public int SinglePast
{
get => BitConverter.ToUInt16(Data, Offset + 0x08);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x08);
}
public int SingleRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x1A);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x1A);
}
public int DoublePast
{
get => BitConverter.ToUInt16(Data, Offset + 0x0A);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x0A);
}
public int DoubleRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x1C);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x1C);
}
public int MultiNPCPast
{
get => BitConverter.ToUInt16(Data, Offset + 0x0C);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x0C);
}
public int MultiNPCRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x1E);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x1E);
}
public int MultiFriendsPast
{
get => BitConverter.ToUInt16(Data, Offset + 0x0E);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x0E);
}
public int MultiFriendsRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x20);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x20);
}
// Super Check
public int SuperCheck
{
get => BitConverter.ToUInt16(Data, Offset + 0x04);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x04);
}
// Super
public int SuperSinglePast
{
get => BitConverter.ToUInt16(Data, Offset + 0x12);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x12);
}
public int SuperSingleRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x24);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x24);
}
public int SuperDoublePast
{
get => BitConverter.ToUInt16(Data, Offset + 0x14);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x14);
}
public int SuperDoubleRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x26);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x26);
}
public int SuperMultiNPCPast
{
get => BitConverter.ToUInt16(Data, Offset + 0x16);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x16);
}
public int SuperMultiNPCRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x28);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x28);
}
public int SuperMultiFriendsPast
{
get => BitConverter.ToUInt16(Data, Offset + 0x18);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x18);
}
public int SuperMultiFriendsRecord
{
get => BitConverter.ToUInt16(Data, Offset + 0x2A);
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Offset + 0x2A);
}
// TODO: Wifi??
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,7 @@ public SAV_Misc5(SaveFile sav)
ReadEntralink();
else TC_Misc.Controls.Remove(TAB_Entralink);
LoadForest();
ReadSubway();
}
private void B_Cancel_Click(object sender, EventArgs e)
@@ -35,10 +36,11 @@ private void B_Save_Click(object sender, EventArgs e)
if (SAV is SAV5B2W2)
SaveEntralink();
SaveForest();
SaveSubway();
Origin.CopyChangesFrom(SAV);
Close();
}
private ComboBox[] cbr;
private int ofsFly;
private int[] FlyDestC;
@@ -712,5 +714,117 @@ private void SetForms(EntreeSlot slot)
var list = FormConverter.GetFormList(slot.Species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
CB_Form.DataSource = new BindingSource(list, null);
}
// Subway
private BattleSubway5 sw;
private void ReadSubway()
{
sw = SAV.BattleSubway;
int swSuperCheck;
// Figure out the Super Checks
swSuperCheck = sw.SuperCheck;
if (swSuperCheck == 0x00)
{
CHK_SuperSingle.Checked = CHK_SuperDouble.Checked = CHK_SuperMulti.Checked = false;
}
else if (swSuperCheck >= 0x70) // 0x70 or anything else means all super enabled
{
CHK_SuperSingle.Checked = CHK_SuperDouble.Checked = CHK_SuperMulti.Checked = true;
}
else
{
if (swSuperCheck == 0x10 || swSuperCheck == 0x30 || swSuperCheck == 0x50)
{
CHK_SuperSingle.Checked = true;
}
if (swSuperCheck == 0x20 || swSuperCheck == 0x30 || swSuperCheck == 0x60)
{
CHK_SuperDouble.Checked = true;
}
if (swSuperCheck == 0x40 || swSuperCheck == 0x50 || swSuperCheck == 0x60)
{
CHK_SuperMulti.Checked = true;
}
}
// Normal
// Single
NUD_SinglePast.Value = sw.SinglePast;
NUD_SingleRecord.Value = sw.SingleRecord;
// Double
NUD_DoublePast.Value = sw.DoublePast;
NUD_DoubleRecord.Value = sw.DoubleRecord;
// Multi NPC
NUD_MultiNpcPast.Value = sw.MultiNPCPast;
NUD_MultiNpcRecord.Value = sw.MultiNPCRecord;
// Multi Friends
NUD_MultiFriendsPast.Value = sw.MultiFriendsPast;
NUD_MultiFriendsRecord.Value = sw.MultiFriendsRecord;
// Super
// Single
NUD_SSinglePast.Value = sw.SuperSinglePast;
NUD_SSingleRecord.Value = sw.SuperSingleRecord;
// Double
NUD_SDoublePast.Value = sw.SuperDoublePast;
NUD_SDoubleRecord.Value = sw.SuperDoubleRecord;
// Multi NPC
NUD_SMultiNpcPast.Value = sw.SuperMultiNPCPast;
NUD_SMultiNpcRecord.Value = sw.SuperMultiNPCRecord;
// Multi Friends
NUD_SMultiFriendsPast.Value = sw.SuperMultiFriendsPast;
NUD_SMultiFriendsRecord.Value = sw.SuperMultiFriendsRecord;
}
private void SaveSubway()
{
// Save Super Checks
sw.SuperCheck = ((CHK_SuperSingle.Checked ? 0x10 : 0x00) + (CHK_SuperDouble.Checked ? 0x20 : 0x00) + (CHK_SuperMulti.Checked ? 0x40 : 0x00));
// Normal
// Single
sw.SinglePast = (int)NUD_SinglePast.Value;
sw.SingleRecord = (int)NUD_SingleRecord.Value;
// Double
sw.DoublePast = (int)NUD_DoublePast.Value;
sw.DoubleRecord = (int)NUD_DoubleRecord.Value;
// Multi NPC
sw.MultiNPCPast = (int)NUD_MultiNpcPast.Value;
sw.MultiNPCRecord = (int)NUD_MultiNpcRecord.Value;
// Multi Friends
sw.MultiFriendsPast = (int)NUD_MultiFriendsPast.Value;
sw.MultiFriendsRecord = (int)NUD_MultiFriendsRecord.Value;
// Super
// Single
sw.SuperSinglePast = (int)NUD_SSinglePast.Value;
sw.SuperSingleRecord = (int)NUD_SSingleRecord.Value;
// Double
sw.SuperDoublePast = (int)NUD_SDoublePast.Value;
sw.SuperDoubleRecord = (int)NUD_SDoubleRecord.Value;
// Multi NPC
sw.SuperMultiNPCPast = (int)NUD_SMultiNpcPast.Value;
sw.SuperMultiNPCRecord = (int)NUD_SMultiNpcRecord.Value;
// Multi Friends
sw.SuperMultiFriendsPast = (int)NUD_SMultiFriendsPast.Value;
sw.SuperMultiFriendsRecord = (int)NUD_SMultiFriendsRecord.Value;
}
}
}

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="TipExpB.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="TipExpW.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
</root>