Skip to content

Commit

Permalink
0. Added app ICON
Browse files Browse the repository at this point in the history
1. Corrected the ID list and re-added
2. Changed to key-item display and values to hex values.
4. Allow user to sort item list
5. + Delete monsters
6. Fixed hex string negative sign validation
7. Added monster egg fragments: Oroshi kirin, Molten tigrex, Puzzle dragon (fire zinogre), white monoblos
8. Move resource files to resource.
  • Loading branch information
secXsQuared1995 authored and secXsQuared1995 committed Oct 21, 2016
1 parent a684fea commit a9e982a
Show file tree
Hide file tree
Showing 15 changed files with 776 additions and 192 deletions.
3 changes: 1 addition & 2 deletions MHSEC-G/MHSEC-G/BugCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public enum ErrorCode

// Faciltiy Item
ITEM_NO_CORRESPONDENCE = 0x21,
ITEM_MAPPING_CORRUPTED = 0x22,
ITEM_MAPPING_DNE = 0x23,
ITEM_MAPPING_CORRUPTED = 0x22

}
public static void bug_check(ErrorCode error_code, string error_message)
Expand Down
25 changes: 10 additions & 15 deletions MHSEC-G/MHSEC-G/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ public uint offset
{
get { return _offset; }
}

private readonly Model _model;

public string name
{
get {
string name = "Unknown";
string name = _offset >= OFFSETA_FIRST_KEY_ITEM ? "Key Item [" + id.ToString("X4") + "]" : "Unknown";
if (OFFSET_NAME_MAPPING.ContainsKey(_offset))
{
name = OFFSET_NAME_MAPPING[_offset];
Expand Down Expand Up @@ -76,9 +77,7 @@ public static List<Item> read_all_items(Model model)
List<Item> ret = new List<Item>();
for (uint offset = OFFSETA_ITEM_BOX; offset < OFFSETA_ITEM_BOX_END; offset += SIZE_ITEM)
{
string name = "Unknown";
uint item_id = Model.byte_to_uint16_le(buffer, offset + OFFSETR_ITEM_ID);

if (item_id == 0)
{
// if not obtained yet
Expand All @@ -88,7 +87,8 @@ public static List<Item> read_all_items(Model model)
// continue
continue;
}

// if we know the id to the offset, just set it
Model.write_uint16_le(model.save_file, offset + OFFSETR_ITEM_ID, OFFSET_ID_MAPPING[offset]);
}
else
{
Expand All @@ -99,7 +99,8 @@ public static List<Item> read_all_items(Model model)
if (item_id != OFFSET_ID_MAPPING[offset])
{
// correct to the correct id
// BugCheck.bug_check(BugCheck.ErrorCode.ITEM_NO_CORRESPONDENCE, "Item offset " + offset.ToString("X") + " and item ID " + item_id.ToString("X") + " do not correspond.");
// don't bug_check since too many people's files are broken
// TODO: BugCheck.bug_check(BugCheck.ErrorCode.ITEM_NO_CORRESPONDENCE, "Item offset " + offset.ToString("X") + " and item ID " + item_id.ToString("X") + " do not correspond.");
Model.write_uint16_le(model.save_file, offset + OFFSETR_ITEM_ID, OFFSET_ID_MAPPING[offset]);
}
}
Expand All @@ -113,15 +114,8 @@ public static List<Item> read_all_items(Model model)
public static void read_item_mappings()
{
string line;
System.IO.StreamReader file = null;
StringReader file = new StringReader(Properties.Resources.idmap);

if (!File.Exists(ID_MAPPING_FILE_NAME))
{
BugCheck.bug_check(BugCheck.ErrorCode.ITEM_MAPPING_DNE,
"Cannot find mapping file " + ID_MAPPING_FILE_NAME);
}

file = new System.IO.StreamReader(ID_MAPPING_FILE_NAME);
while ((line = file.ReadLine()) != null)
{
if (line.Length == 0)
Expand All @@ -130,11 +124,12 @@ public static void read_item_mappings()
string[] eachline = line.Split('\t');
if (eachline.Length != 3)
{

BugCheck.bug_check(BugCheck.ErrorCode.ITEM_MAPPING_CORRUPTED, "Invalid mapping file line:\n" + line);
}

OFFSET_ID_MAPPING.Add(UInt32.Parse(eachline[0], System.Globalization.NumberStyles.HexNumber), UInt32.Parse(eachline[1], System.Globalization.NumberStyles.HexNumber));
OFFSET_NAME_MAPPING.Add(UInt32.Parse(eachline[0], System.Globalization.NumberStyles.HexNumber), eachline[2]);
OFFSET_ID_MAPPING.Add(uint.Parse(eachline[0], System.Globalization.NumberStyles.HexNumber), uint.Parse(eachline[1], System.Globalization.NumberStyles.HexNumber));
OFFSET_NAME_MAPPING.Add(uint.Parse(eachline[0], System.Globalization.NumberStyles.HexNumber), eachline[2]);
}

file.Close();
Expand Down
27 changes: 19 additions & 8 deletions MHSEC-G/MHSEC-G/MHSEC-G.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\MainIcon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -79,6 +83,12 @@
<Compile Include="Model.cs" />
<Compile Include="Monster.cs" />
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Talisman.cs" />
<Compile Include="ViewModel.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
Expand All @@ -97,30 +107,28 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="Resources\monster_null_template.bin" />
</ItemGroup>
<ItemGroup>
<Resource Include="idmap.txt" />
<Resource Include="Resources\idmap.txt" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
Expand All @@ -139,6 +147,9 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\MainIcon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Loading

0 comments on commit a9e982a

Please sign in to comment.