trying something new

This commit is contained in:
Michael Becker 2019-12-08 03:55:37 -05:00
parent 7ae8ab9b9b
commit 98961780dc
No known key found for this signature in database
GPG Key ID: 389DFF5D73781A12
6 changed files with 249 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<UniversalEditor Version="4.0">
<Associations>
<Association>
<Filters>
<Filter Title="Nintendo 64 Z64 ROM">
<FileNameFilters>
<FileNameFilter>*.z64</FileNameFilter>
</FileNameFilters>
</Filter>
</Filters>
<ObjectModels>
<ObjectModel TypeName="UniversalEditor.ObjectModels.Executable.ExecutableObjectModel" />
</ObjectModels>
<DataFormats>
<DataFormat TypeName="UniversalEditor.DataFormats.Executable.Nintendo.N64.Z64DataFormat" />
</DataFormats>
</Association>
</Associations>
</UniversalEditor>

View File

@ -659,6 +659,7 @@
<Content Include="Editors\Multimedia3D\Model\Shaders\Default\default_vtx.glsl" />
<Content Include="Editors\Multimedia3D\Model\Shaders\Default\default_frg.glsl" />
<Content Include="Extensions\FileSystem\Associations\InstallShield\PKG.uexml" />
<Content Include="Extensions\GameDeveloper\Extensions\Nintendo\Associations\Z64.uexml" />
</ItemGroup>
<ItemGroup>
<Content Include="Configuration\Application.upl" />
@ -684,6 +685,8 @@
<Folder Include="Extensions\GameDeveloper\Associations\FileSystem\CRI\" />
<Folder Include="Extensions\GameDeveloper\Associations\Database\" />
<Folder Include="Extensions\GameDeveloper\Associations\Database\CRI\" />
<Folder Include="Extensions\GameDeveloper\Extensions\Nintendo\" />
<Folder Include="Extensions\GameDeveloper\Extensions\Nintendo\Associations\" />
</ItemGroup>
<ItemGroup>
<Content Include="Extensions\SoftwareDeveloper\Templates\Project\Software Development\Arduino\Images\Blink.xcf" />

View File

@ -0,0 +1,107 @@
//
// N64CountryCode.cs
//
// Author:
// Mike Becker <alcexhim@gmail.com>
//
// Copyright (c) 2019 Mike Becker
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace UniversalEditor.DataFormats.Executable.Nintendo.N64
{
public enum N64CountryCode : byte
{
/// <summary>
/// Beta - '7'
/// </summary>
Beta = 0x37,
/// <summary>
/// Asian (NTSC) - 'A'
/// </summary>
Asian = 0x41,
/// <summary>
/// Brazilian - 'B'
/// </summary>
Brazilian = 0x42,
/// <summary>
/// Chinese - 'C'
/// </summary>
Chinese,
/// <summary>
/// German - 'D'
/// </summary>
German = 0x44,
/// <summary>
/// North America - 'E'
/// </summary>
NorthAmerica = 0x45,
/// <summary>
/// French - 'F'
/// </summary>
French = 0x46,
/// <summary>
/// LodgeNet Gateway64 (NTSC) - 'G'
/// </summary>
Gateway64NTSC = 0x47,
/// <summary>
/// Dutch - 'H'
/// </summary>
Dutch = 0x48,
/// <summary>
/// Italian - 'I'
/// </summary>
Italian = 0x49,
/// <summary>
/// Japanese - 'J'
/// </summary>
Japanese = 0x4A,
/// <summary>
/// Korean - 'K'
/// </summary>
Korean = 0x4B,
/// <summary>
/// LodgeNet Gateway64 (PAL) - 'L'
/// </summary>
Gateway64PAL = 0x4C,
/// <summary>
/// Canadian ('N')
/// </summary>
Canadian = 0x4E,
/// <summary>
/// European (basic spec) - 'P'
/// </summary>
EuropeanBasic = 0x50,
/// <summary>
/// Spanish - 'S'
/// </summary>
Spanish = 0x53,
/// <summary>
/// Australian - 'U'
/// </summary>
Australian = 0x55,
/// <summary>
/// Scandinavian - 'W'
/// </summary>
Scandinavian = 0x57,
/// <summary>
/// European - 'X'
/// </summary>
European1 = 0x58,
/// <summary>
/// European - 'Y'
/// </summary>
European2 = 0x59
}
}

View File

@ -0,0 +1,32 @@
//
// N64MediaFormat.cs
//
// Author:
// Mike Becker <alcexhim@gmail.com>
//
// Copyright (c) 2019 Mike Becker
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace UniversalEditor.DataFormats.Executable.Nintendo.N64
{
public enum N64MediaFormat : uint
{
CartridgeExpandable = 67,
SixtyFourDD = 68,
SixtyFourDDExpansion = 69,
Cartridge = 78,
Aleck64 = 90
}
}

View File

@ -0,0 +1,81 @@
//
// Z64DataFormat.cs
//
// Author:
// Mike Becker <alcexhim@gmail.com>
//
// Copyright (c) 2019 Mike Becker
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.Executable;
namespace UniversalEditor.DataFormats.Executable.Nintendo.N64
{
public class Z64DataFormat : DataFormat
{
private static DataFormatReference _dfr = null;
protected override DataFormatReference MakeReferenceInternal()
{
if (_dfr == null)
{
_dfr = base.MakeReferenceInternal();
_dfr.Capabilities.Add(typeof(ExecutableObjectModel), DataFormatCapabilities.All);
}
return _dfr;
}
protected override void LoadInternal(ref ObjectModel objectModel)
{
ExecutableObjectModel exe = (objectModel as ExecutableObjectModel);
Reader reader = Accessor.Reader;
byte endiannessIndicator = reader.ReadByte();
byte initialPI_BSB_DOM1_LAT_REG = reader.ReadByte();
if (endiannessIndicator == 0x80 && initialPI_BSB_DOM1_LAT_REG == 0x37)
{
reader.Endianness = Endianness.BigEndian;
}
else if (endiannessIndicator == 0x37 && initialPI_BSB_DOM1_LAT_REG == 0x80)
{
reader.Endianness = Endianness.LittleEndian;
}
byte initialPI_BSD_DOM1_PWD_REG = reader.ReadByte();
byte initialPI_BSB_DOM1_PGS_REG = reader.ReadByte();
uint clockRateOverride = reader.ReadUInt32();
uint programCounter = reader.ReadUInt32();
uint releaseAddress = reader.ReadUInt32();
uint crc1 = reader.ReadUInt32();
uint crc2 = reader.ReadUInt32();
ulong unknown1 = reader.ReadUInt64(); // zero
string imageName = reader.ReadFixedLengthString(20).TrimNull().Trim();
uint unknown2 = reader.ReadUInt32(); // zero
N64MediaFormat mediaformat = (N64MediaFormat) reader.ReadUInt32();
string cartridgeID = reader.ReadFixedLengthString(2);
N64CountryCode countryCode = (N64CountryCode) reader.ReadByte();
byte version = reader.ReadByte();
byte[] bootloader = reader.ReadBytes(4032);
exe.Sections.Add("bootloader", bootloader);
}
protected override void SaveInternal(ObjectModel objectModel)
{
throw new NotImplementedException();
}
}
}

View File

@ -51,6 +51,9 @@
<Compile Include="DataFormats\FileSystem\Nintendo\Optical\NintendoOpticalDiscRegionCode.cs" />
<Compile Include="DataFormats\FileSystem\Nintendo\Optical\NintendoOpticalDiscSystemType.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DataFormats\Executable\Nintendo\N64\Z64DataFormat.cs" />
<Compile Include="DataFormats\Executable\Nintendo\N64\N64MediaFormat.cs" />
<Compile Include="DataFormats\Executable\Nintendo\N64\N64CountryCode.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
@ -66,6 +69,9 @@
<Name>UniversalEditor.Plugins.Executable</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="DataFormats\Executable\Nintendo\N64\" />
</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.