mirror of
https://github.com/Gericom/EveryFileExplorer.git
synced 2025-06-19 09:25:42 -04:00
More CSAR stuff, implemented CPOI and CPAT for NKM
This commit is contained in:
parent
bba8440fe0
commit
aa4665925a
@ -5,10 +5,11 @@ using System.Text;
|
||||
using LibEveryFileExplorer.Files;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace _3DS.NintendoWare.SND
|
||||
{
|
||||
public class CSAR : FileFormat<CSAR.CSARIdentifier>
|
||||
public class CSAR : FileFormat<CSAR.CSARIdentifier>, IViewable
|
||||
{
|
||||
public CSAR(byte[] Data)
|
||||
{
|
||||
@ -16,7 +17,15 @@ namespace _3DS.NintendoWare.SND
|
||||
try
|
||||
{
|
||||
Header = new CSARHeader(er);
|
||||
//TODO!
|
||||
foreach (var v in Header.Sections)
|
||||
{
|
||||
er.BaseStream.Position = v.Offset;
|
||||
switch (v.Id)
|
||||
{
|
||||
case 0x2000: Strings = new STRG(er); break;
|
||||
case 0x2001: Infos = new INFO(er); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -24,6 +33,11 @@ namespace _3DS.NintendoWare.SND
|
||||
}
|
||||
}
|
||||
|
||||
public Form GetDialog()
|
||||
{
|
||||
return new Form();
|
||||
}
|
||||
|
||||
public CSARHeader Header;
|
||||
public class CSARHeader
|
||||
{
|
||||
@ -75,6 +89,7 @@ namespace _3DS.NintendoWare.SND
|
||||
{
|
||||
Signature = er.ReadString(Encoding.ASCII, 4);
|
||||
if (Signature != "STRG") throw new SignatureNotCorrectException(Signature, "STRG", er.BaseStream.Position - 4);
|
||||
SectionSize = er.ReadUInt32();
|
||||
long basepos = er.BaseStream.Position;
|
||||
StringTableSignature = er.ReadUInt32();
|
||||
StringTableOffset = er.ReadUInt32();
|
||||
@ -85,7 +100,7 @@ namespace _3DS.NintendoWare.SND
|
||||
StringTable = new STRGStringTable(er);
|
||||
|
||||
er.BaseStream.Position = basepos + PatriciaTreeOffset;
|
||||
//TODO!
|
||||
PatriciaTree = new STRGPatriciaTree(er);
|
||||
}
|
||||
public String Signature;
|
||||
public UInt32 SectionSize;
|
||||
@ -120,6 +135,7 @@ namespace _3DS.NintendoWare.SND
|
||||
{
|
||||
NTStringSignature = er.ReadUInt32();
|
||||
StringOffset = er.ReadUInt32();
|
||||
StringLength = er.ReadUInt32();
|
||||
}
|
||||
public UInt32 NTStringSignature;//0x1F01
|
||||
public UInt32 StringOffset;//Relative to start of this block
|
||||
@ -127,7 +143,149 @@ namespace _3DS.NintendoWare.SND
|
||||
}
|
||||
public String[] Strings;
|
||||
}
|
||||
public STRGPatriciaTree PatriciaTree;
|
||||
public class STRGPatriciaTree
|
||||
{
|
||||
public STRGPatriciaTree(EndianBinaryReader er)
|
||||
{
|
||||
RootNodeIndex = er.ReadUInt32();
|
||||
NrNodes = er.ReadUInt32();
|
||||
Nodes = new PatriciaTreeNode[NrNodes];
|
||||
for (int i = 0; i < NrNodes; i++) Nodes[i] = new PatriciaTreeNode(er);
|
||||
}
|
||||
public UInt32 RootNodeIndex;
|
||||
public UInt32 NrNodes;
|
||||
public PatriciaTreeNode[] Nodes;
|
||||
public class PatriciaTreeNode
|
||||
{
|
||||
public PatriciaTreeNode(EndianBinaryReader er)
|
||||
{
|
||||
IsLeaf = er.ReadUInt16() == 1;
|
||||
Bit = er.ReadUInt16();
|
||||
Left = er.ReadUInt32();
|
||||
Right = er.ReadUInt32();
|
||||
StringID = er.ReadUInt32();
|
||||
NodeID = er.ReadUInt32();
|
||||
}
|
||||
public Boolean IsLeaf;//2
|
||||
public UInt16 Bit;
|
||||
public UInt32 Left;
|
||||
public UInt32 Right;
|
||||
public UInt32 StringID;
|
||||
public UInt32 NodeID;
|
||||
}
|
||||
}
|
||||
}
|
||||
public INFO Infos;
|
||||
public class INFO
|
||||
{
|
||||
public INFO(EndianBinaryReader er)
|
||||
{
|
||||
Signature = er.ReadString(Encoding.ASCII, 4);
|
||||
if (Signature != "INFO") throw new SignatureNotCorrectException(Signature, "INFO", er.BaseStream.Position - 4);
|
||||
SectionSize = er.ReadUInt32();
|
||||
long basepos = er.BaseStream.Position;
|
||||
SoundInfoSignature = er.ReadUInt32();
|
||||
SoundInfoOffset = er.ReadUInt32();
|
||||
SoundGroupInfoSignature = er.ReadUInt32();
|
||||
SoundGroupInfoOffset = er.ReadUInt32();
|
||||
BankInfoSignature = er.ReadUInt32();
|
||||
BankInfoOffset = er.ReadUInt32();
|
||||
WaveArchiveInfoSignature = er.ReadUInt32();
|
||||
WaveArchiveInfoOffset = er.ReadUInt32();
|
||||
GroupInfoSignature = er.ReadUInt32();
|
||||
GroupInfoOffset = er.ReadUInt32();
|
||||
PlayerInfoSignature = er.ReadUInt32();
|
||||
PlayerInfoOffset = er.ReadUInt32();
|
||||
FileInfoSignature = er.ReadUInt32();
|
||||
FileInfoOffset = er.ReadUInt32();
|
||||
SoundArchivePlayerInfoSignature = er.ReadUInt32();
|
||||
SoundArchivePlayerInfoOffset = er.ReadUInt32();
|
||||
|
||||
er.BaseStream.Position = basepos + SoundInfoOffset;
|
||||
SoundInfo = new INFOInfoBlock<INFOSoundInfoEntry>(er);
|
||||
}
|
||||
public String Signature;
|
||||
public UInt32 SectionSize;
|
||||
public UInt32 SoundInfoSignature;
|
||||
public UInt32 SoundInfoOffset;
|
||||
public UInt32 SoundGroupInfoSignature;
|
||||
public UInt32 SoundGroupInfoOffset;
|
||||
public UInt32 BankInfoSignature;
|
||||
public UInt32 BankInfoOffset;
|
||||
public UInt32 WaveArchiveInfoSignature;
|
||||
public UInt32 WaveArchiveInfoOffset;
|
||||
public UInt32 GroupInfoSignature;
|
||||
public UInt32 GroupInfoOffset;
|
||||
public UInt32 PlayerInfoSignature;
|
||||
public UInt32 PlayerInfoOffset;
|
||||
public UInt32 FileInfoSignature;
|
||||
public UInt32 FileInfoOffset;
|
||||
public UInt32 SoundArchivePlayerInfoSignature;
|
||||
public UInt32 SoundArchivePlayerInfoOffset;
|
||||
|
||||
public class INFOInfoBlock<T> where T : INFOInfoBlockEntry, new()
|
||||
{
|
||||
public INFOInfoBlock(EndianBinaryReader er)
|
||||
{
|
||||
long basepos = er.BaseStream.Position;
|
||||
NrEntries = er.ReadUInt32();
|
||||
ReferenceTableEntries = new ReferenceTableEntry[NrEntries];
|
||||
for (int i = 0; i < NrEntries; i++) ReferenceTableEntries[i] = new ReferenceTableEntry(er);
|
||||
Entries = new T[NrEntries];
|
||||
for (int i = 0; i < NrEntries; i++)
|
||||
{
|
||||
Entries[i] = new T();
|
||||
Entries[i].Read(er);
|
||||
}
|
||||
}
|
||||
public UInt32 NrEntries;
|
||||
public ReferenceTableEntry[] ReferenceTableEntries;
|
||||
public class ReferenceTableEntry
|
||||
{
|
||||
public ReferenceTableEntry(EndianBinaryReader er)
|
||||
{
|
||||
Signature = er.ReadUInt32();
|
||||
Offset = er.ReadUInt32();
|
||||
}
|
||||
public UInt32 Signature;
|
||||
public UInt32 Offset;
|
||||
}
|
||||
public T[] Entries;
|
||||
}
|
||||
|
||||
public abstract class INFOInfoBlockEntry
|
||||
{
|
||||
public abstract void Read(EndianBinaryReader er);
|
||||
}
|
||||
|
||||
public INFOInfoBlock<INFOSoundInfoEntry> SoundInfo;
|
||||
public class INFOSoundInfoEntry : INFOInfoBlockEntry
|
||||
{
|
||||
public override void Read(EndianBinaryReader er)
|
||||
{
|
||||
FileID = er.ReadUInt32();
|
||||
PlayerID = er.ReadUInt32();
|
||||
Volume = er.ReadByte();
|
||||
Padding = er.ReadBytes(3);
|
||||
|
||||
SpecificInfoSignature = er.ReadUInt32();
|
||||
SpecificInfoOffset = er.ReadUInt32();
|
||||
}
|
||||
public UInt32 FileID;
|
||||
public UInt32 PlayerID;
|
||||
public Byte Volume;
|
||||
public Byte[] Padding;//3
|
||||
|
||||
public UInt32 SpecificInfoSignature;
|
||||
public UInt32 SpecificInfoOffset;
|
||||
|
||||
public INFOSoundInfoParameterArray Parameters;
|
||||
public class INFOSoundInfoParameterArray
|
||||
{
|
||||
public UInt32 Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CSARIdentifier : FileFormatIdentifier
|
||||
|
@ -40,6 +40,14 @@ namespace LibEveryFileExplorer.GameData
|
||||
|
||||
public abstract ListViewItem GetListViewItem();
|
||||
|
||||
protected static String GetHexReverse(sbyte Value)
|
||||
{
|
||||
return (Value & 0xFF).ToString("X2");
|
||||
}
|
||||
protected static String GetHexReverse(byte Value)
|
||||
{
|
||||
return Value.ToString("X2");
|
||||
}
|
||||
protected static String GetHexReverse(short Value)
|
||||
{
|
||||
return BitConverter.ToString(BitConverter.GetBytes(Value)).Replace("-", "");
|
||||
|
@ -39,6 +39,8 @@ namespace MarioKart.MKDS
|
||||
case "KTP2": KartPointSecond = new KTP2(er); break;
|
||||
case "KTPC": KartPointCannon = new KTPC(er); break;
|
||||
case "KTPM": KartPointMission = new KTPM(er); break;
|
||||
case "CPOI": CheckPoint = new CPOI(er); break;
|
||||
case "CPAT": CheckPointPath = new CPAT(er); break;
|
||||
default:
|
||||
//throw new Exception("Unknown Section: " + sig);
|
||||
continue;
|
||||
@ -655,6 +657,177 @@ namespace MarioKart.MKDS
|
||||
}
|
||||
}
|
||||
|
||||
public CPOI CheckPoint;
|
||||
public class CPOI : GameDataSection<CPOI.CPOIEntry>
|
||||
{
|
||||
public CPOI() { Signature = "CPOI"; }
|
||||
public CPOI(EndianBinaryReader er)
|
||||
{
|
||||
Signature = er.ReadString(Encoding.ASCII, 4);
|
||||
if (Signature != "CPOI") throw new SignatureNotCorrectException(Signature, "CPOI", er.BaseStream.Position - 4);
|
||||
NrEntries = er.ReadUInt32();
|
||||
for (int i = 0; i < NrEntries; i++) Entries.Add(new CPOIEntry(er));
|
||||
}
|
||||
|
||||
public override String[] GetColumnNames()
|
||||
{
|
||||
return new String[] {
|
||||
"ID",
|
||||
"X1", "Z1", "X2", "Z2",
|
||||
"Sine", "Cosine",
|
||||
"Distance",
|
||||
"Next Section", "Current Section",
|
||||
"Key Point",
|
||||
"Respawn",
|
||||
"?"
|
||||
};
|
||||
}
|
||||
|
||||
public class CPOIEntry : GameDataSectionEntry
|
||||
{
|
||||
public CPOIEntry()
|
||||
{
|
||||
UpdateSinCos();
|
||||
NextSection = -1;
|
||||
CurrentSection = -1;
|
||||
KeyPointID = -1;
|
||||
}
|
||||
public CPOIEntry(EndianBinaryReader er)
|
||||
{
|
||||
Point1 = new Vector2(er.ReadFx32(), er.ReadFx32());
|
||||
Point2 = new Vector2(er.ReadFx32(), er.ReadFx32());
|
||||
Sine = er.ReadFx32();
|
||||
Cosine = er.ReadFx32();
|
||||
Distance = er.ReadFx32();
|
||||
NextSection = er.ReadInt16();
|
||||
CurrentSection = er.ReadInt16();
|
||||
KeyPointID = er.ReadInt16();
|
||||
RespawnID = er.ReadByte();
|
||||
Unknown = er.ReadByte();
|
||||
}
|
||||
|
||||
public override ListViewItem GetListViewItem()
|
||||
{
|
||||
ListViewItem m = new ListViewItem("");
|
||||
m.SubItems.Add(Point1.X.ToString("#####0.############"));
|
||||
m.SubItems.Add(Point1.Y.ToString("#####0.############"));
|
||||
|
||||
m.SubItems.Add(Point2.X.ToString("#####0.############"));
|
||||
m.SubItems.Add(Point2.Y.ToString("#####0.############"));
|
||||
|
||||
m.SubItems.Add(Sine.ToString("#####0.############"));
|
||||
m.SubItems.Add(Cosine.ToString("#####0.############"));
|
||||
m.SubItems.Add(Distance.ToString("#####0.############"));
|
||||
|
||||
m.SubItems.Add(NextSection.ToString());
|
||||
m.SubItems.Add(CurrentSection.ToString());
|
||||
m.SubItems.Add(KeyPointID.ToString());
|
||||
m.SubItems.Add(RespawnID.ToString());
|
||||
m.SubItems.Add(GetHexReverse(Unknown));
|
||||
return m;
|
||||
}
|
||||
|
||||
public Vector2 Point1 { get; set; }
|
||||
public Vector2 Point2 { get; set; }
|
||||
public Single Sine { get; private set; }
|
||||
public Single Cosine { get; private set; }
|
||||
public Single Distance { get; set; }
|
||||
public Int16 NextSection { get; set; }
|
||||
public Int16 CurrentSection { get; set; }
|
||||
public Int16 KeyPointID { get; set; }
|
||||
public Byte RespawnID { get; set; }
|
||||
public Byte Unknown { get; set; }
|
||||
|
||||
public void UpdateSinCos()
|
||||
{
|
||||
double a = Math.Atan((Point1.Y - Point2.Y) / (Point1.X - Point2.X));
|
||||
Sine = (float)Math.Sin(Math.Abs(a));
|
||||
Cosine = (float)Math.Cos(Math.Abs(a));
|
||||
if ((Point1.Y - Point2.Y) > 0) Sine = 0 - Sine;
|
||||
if ((Point1.Y - Point2.X) < 0) Cosine = 0 - Cosine;
|
||||
}
|
||||
|
||||
public void UpdateDistance(CPOIEntry Next)
|
||||
{
|
||||
UpdateSinCos();
|
||||
Next.UpdateSinCos();
|
||||
Distance =
|
||||
Next.Cosine * Next.Point2.Y + Next.Sine * Next.Point2.X + 0.5f -
|
||||
Cosine * Point1.Y - Sine * Point1.X + 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CPAT CheckPointPath;
|
||||
public class CPAT : GameDataSection<CPAT.CPATEntry>
|
||||
{
|
||||
public CPAT() { Signature = "CPAT"; }
|
||||
public CPAT(EndianBinaryReader er)
|
||||
{
|
||||
Signature = er.ReadString(Encoding.ASCII, 4);
|
||||
if (Signature != "CPAT") throw new SignatureNotCorrectException(Signature, "CPAT", er.BaseStream.Position - 4);
|
||||
NrEntries = er.ReadUInt32();
|
||||
for (int i = 0; i < NrEntries; i++) Entries.Add(new CPATEntry(er));
|
||||
}
|
||||
|
||||
public override String[] GetColumnNames()
|
||||
{
|
||||
return new String[] {
|
||||
"ID",
|
||||
"Start",
|
||||
"Length",
|
||||
"Next",
|
||||
"Next",
|
||||
"Next",
|
||||
"Previous",
|
||||
"Previous",
|
||||
"Previous",
|
||||
"Order"
|
||||
};
|
||||
}
|
||||
|
||||
public class CPATEntry : GameDataSectionEntry
|
||||
{
|
||||
public CPATEntry()
|
||||
{
|
||||
GoesTo = new sbyte[] { -1, -1, -1 };
|
||||
ComesFrom = new sbyte[] { -1, -1, -1 };
|
||||
}
|
||||
public CPATEntry(EndianBinaryReader er)
|
||||
{
|
||||
StartIndex = er.ReadInt16();
|
||||
Length = er.ReadInt16();
|
||||
GoesTo = er.ReadSBytes(3);
|
||||
ComesFrom = er.ReadSBytes(3);
|
||||
SectionOrder = er.ReadInt16();
|
||||
}
|
||||
|
||||
public override ListViewItem GetListViewItem()
|
||||
{
|
||||
ListViewItem m = new ListViewItem("");
|
||||
m.SubItems.Add(StartIndex.ToString());
|
||||
m.SubItems.Add(Length.ToString());
|
||||
|
||||
m.SubItems.Add(GoesTo[0].ToString());
|
||||
m.SubItems.Add(GoesTo[1].ToString());
|
||||
m.SubItems.Add(GoesTo[2].ToString());
|
||||
|
||||
m.SubItems.Add(ComesFrom[0].ToString());
|
||||
m.SubItems.Add(ComesFrom[1].ToString());
|
||||
m.SubItems.Add(ComesFrom[2].ToString());
|
||||
|
||||
m.SubItems.Add(SectionOrder.ToString());
|
||||
return m;
|
||||
}
|
||||
|
||||
public Int16 StartIndex { get; set; }
|
||||
public Int16 Length { get; set; }
|
||||
public SByte[] GoesTo { get; set; }//3
|
||||
public SByte[] ComesFrom { get; set; }//3
|
||||
public Int16 SectionOrder { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class NKMDIdentifier : FileFormatIdentifier
|
||||
{
|
||||
public override string GetCategory()
|
||||
|
@ -11,6 +11,9 @@ using Tao.OpenGl;
|
||||
using System.Drawing.Imaging;
|
||||
using LibEveryFileExplorer._3D;
|
||||
using LibEveryFileExplorer;
|
||||
using LibEveryFileExplorer.UI;
|
||||
using LibEveryFileExplorer.GameData;
|
||||
using MarioKart.MKDS;
|
||||
|
||||
namespace MarioKart.UI
|
||||
{
|
||||
@ -68,54 +71,16 @@ namespace MarioKart.UI
|
||||
KCL = v[0].FileFormat;
|
||||
}
|
||||
|
||||
if (NKMD.ObjectInformation != null)
|
||||
{
|
||||
TabPage p = new TabPage("OBJI");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.OBJI.OBJIEntry>(NKMD.ObjectInformation) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.Path != null)
|
||||
{
|
||||
TabPage p = new TabPage("PATH");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.PATH.PATHEntry>(NKMD.Path) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.Point != null)
|
||||
{
|
||||
TabPage p = new TabPage("POIT");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.POIT.POITEntry>(NKMD.Point) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.KartPointStart != null)
|
||||
{
|
||||
TabPage p = new TabPage("KTPS");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.KTPS.KTPSEntry>(NKMD.KartPointStart) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.KartPointJugem != null)
|
||||
{
|
||||
TabPage p = new TabPage("KTPJ");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.KTPJ.KTPJEntry>(NKMD.KartPointJugem) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.KartPointSecond != null)
|
||||
{
|
||||
TabPage p = new TabPage("KTP2");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.KTP2.KTP2Entry>(NKMD.KartPointSecond) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.KartPointCannon != null)
|
||||
{
|
||||
TabPage p = new TabPage("KTPC");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.KTPC.KTPCEntry>(NKMD.KartPointCannon) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.KartPointMission != null)
|
||||
{
|
||||
TabPage p = new TabPage("KTPM");
|
||||
p.Controls.Add(new LibEveryFileExplorer.UI.GameDataSectionViewer<MKDS.NKMD.KTPM.KTPMEntry>(NKMD.KartPointMission) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
if (NKMD.ObjectInformation != null) AddTab<NKMD.OBJI.OBJIEntry>("OBJI", NKMD.ObjectInformation);
|
||||
if (NKMD.Path != null) AddTab<NKMD.PATH.PATHEntry>("PATH", NKMD.Path);
|
||||
if (NKMD.Point != null) AddTab<NKMD.POIT.POITEntry>("POIT", NKMD.Point);
|
||||
if (NKMD.KartPointStart != null) AddTab<NKMD.KTPS.KTPSEntry>("KTPS", NKMD.KartPointStart);
|
||||
if (NKMD.KartPointJugem != null) AddTab<NKMD.KTPJ.KTPJEntry>("KTPJ", NKMD.KartPointJugem);
|
||||
if (NKMD.KartPointSecond != null) AddTab<NKMD.KTP2.KTP2Entry>("KTP2", NKMD.KartPointSecond);
|
||||
if (NKMD.KartPointCannon != null) AddTab<NKMD.KTPC.KTPCEntry>("KTPC", NKMD.KartPointCannon);
|
||||
if (NKMD.KartPointMission != null) AddTab<NKMD.KTPM.KTPMEntry>("KTPM", NKMD.KartPointMission);
|
||||
if (NKMD.CheckPoint != null) AddTab<NKMD.CPOI.CPOIEntry>("CPOI", NKMD.CheckPoint);
|
||||
if (NKMD.CheckPointPath != null) AddTab<NKMD.CPAT.CPATEntry>("CPAT", NKMD.CheckPointPath);
|
||||
|
||||
Bitmap b3 = OBJI.OBJ_2D01;
|
||||
System.Resources.ResourceSet s = OBJI.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, false, false);
|
||||
@ -144,6 +109,13 @@ namespace MarioKart.UI
|
||||
Render();
|
||||
}
|
||||
|
||||
private void AddTab<T>(String Name, GameDataSection<T> Section) where T : GameDataSectionEntry, new()
|
||||
{
|
||||
TabPage p = new TabPage(Name);
|
||||
p.Controls.Add(new GameDataSectionViewer<T>(Section) { Dock = DockStyle.Fill });
|
||||
tabControl1.TabPages.Add(p);
|
||||
}
|
||||
|
||||
float min = -8192f;
|
||||
float max = 8192f;
|
||||
byte[] pic;
|
||||
@ -548,70 +520,53 @@ namespace MarioKart.UI
|
||||
|
||||
Gl.glEnd();
|
||||
|
||||
/*if (cPOIToolStripMenuItem.Checked)
|
||||
//if (cPOIToolStripMenuItem.Checked)
|
||||
{
|
||||
if (!picking)
|
||||
{
|
||||
Gl.glBegin(Gl.GL_LINES);
|
||||
foreach (MKDS_Course_Modifier.MKDS.NKM.CPOIEntry o in File.CPOI)
|
||||
foreach (var o in NKMD.CheckPoint.Entries)
|
||||
{
|
||||
Gl.glColor3f(0, 170f / 255f, 0);
|
||||
//Gl.glColor3f(0.5f, 0.5f, 0.5f);
|
||||
Gl.glVertex2f(o.Position1.X, o.Position1.Y);
|
||||
Gl.glVertex2f(o.Point1.X, o.Point1.Y);
|
||||
Gl.glColor3f(170f / 255f, 0, 0);//181f / 255f, 230f / 255f, 29f / 255f);
|
||||
//Gl.glColor3f(1, 1, 1);
|
||||
Gl.glVertex2f(o.Position2.X, o.Position2.Y);
|
||||
Gl.glVertex2f(o.Point2.X, o.Point2.Y);
|
||||
}
|
||||
for (int j = 0; j < File.CPAT.NrEntries; j++)
|
||||
for (int j = 0; j < NKMD.CheckPointPath.Entries.Count; j++)
|
||||
{
|
||||
if (File.CPOI.NrEntries < File.CPAT[j].StartIdx + File.CPAT[j].Length) break;
|
||||
for (int i = File.CPAT[j].StartIdx; i < File.CPAT[j].StartIdx + File.CPAT[j].Length - 1; i++)
|
||||
if (NKMD.CheckPoint.Entries.Count < NKMD.CheckPointPath[j].StartIndex + NKMD.CheckPointPath[j].Length) break;
|
||||
for (int i = NKMD.CheckPointPath[j].StartIndex; i < NKMD.CheckPointPath.Entries[j].StartIndex + NKMD.CheckPointPath[j].Length - 1; i++)
|
||||
{
|
||||
Gl.glColor3f(0, 170f / 255f, 0);
|
||||
Gl.glVertex2f(File.CPOI[i].Position1.X, File.CPOI[i].Position1.Y);
|
||||
Gl.glVertex2f(File.CPOI[i + 1].Position1.X, File.CPOI[i + 1].Position1.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[i].Point1.X, NKMD.CheckPoint[i].Point1.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[i + 1].Point1.X, NKMD.CheckPoint[i + 1].Point1.Y);
|
||||
Gl.glColor3f(170f / 255f, 0, 0);
|
||||
Gl.glVertex2f(File.CPOI[i].Position2.X, File.CPOI[i].Position2.Y);
|
||||
Gl.glVertex2f(File.CPOI[i + 1].Position2.X, File.CPOI[i + 1].Position2.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[i].Point2.X, NKMD.CheckPoint[i].Point2.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[i + 1].Point2.X, NKMD.CheckPoint[i + 1].Point2.Y);
|
||||
}
|
||||
|
||||
if (File.CPAT[j].GoesTo1 != -1)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (NKMD.CheckPointPath[j].GoesTo[i] == -1 || NKMD.CheckPointPath[j].GoesTo[i] >= NKMD.CheckPointPath.Entries.Count) continue;
|
||||
Gl.glColor3f(0, 170f / 255f, 0);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position1.X, File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position1.Y);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[File.CPAT[j].GoesTo1].StartIdx].Position1.X, File.CPOI[File.CPAT[File.CPAT[j].GoesTo1].StartIdx].Position1.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[NKMD.CheckPointPath[j].StartIndex + NKMD.CheckPointPath[j].Length - 1].Point1.X, NKMD.CheckPoint[NKMD.CheckPointPath[j].StartIndex + NKMD.CheckPointPath[j].Length - 1].Point1.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[NKMD.CheckPointPath[NKMD.CheckPointPath[j].GoesTo[i]].StartIndex].Point1.X, NKMD.CheckPoint[NKMD.CheckPointPath[NKMD.CheckPointPath[j].GoesTo[i]].StartIndex].Point1.Y);
|
||||
Gl.glColor3f(170f / 255f, 0, 0);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position2.X, File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position2.Y);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[File.CPAT[j].GoesTo1].StartIdx].Position2.X, File.CPOI[File.CPAT[File.CPAT[j].GoesTo1].StartIdx].Position2.Y);
|
||||
}
|
||||
if (File.CPAT[j].GoesTo2 != -1)
|
||||
{
|
||||
Gl.glColor3f(0, 170f / 255f, 0);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position1.X, File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position1.Y);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[File.CPAT[j].GoesTo2].StartIdx].Position1.X, File.CPOI[File.CPAT[File.CPAT[j].GoesTo2].StartIdx].Position1.Y);
|
||||
Gl.glColor3f(170f / 255f, 0, 0);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position2.X, File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position2.Y);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[File.CPAT[j].GoesTo2].StartIdx].Position2.X, File.CPOI[File.CPAT[File.CPAT[j].GoesTo2].StartIdx].Position2.Y);
|
||||
}
|
||||
if (File.CPAT[j].GoesTo3 != -1)
|
||||
{
|
||||
Gl.glColor3f(0, 170f / 255f, 0);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position1.X, File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position1.Y);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[File.CPAT[j].GoesTo3].StartIdx].Position1.X, File.CPOI[File.CPAT[File.CPAT[j].GoesTo3].StartIdx].Position1.Y);
|
||||
Gl.glColor3f(170f / 255f, 0, 0);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position2.X, File.CPOI[File.CPAT[j].StartIdx + File.CPAT[j].Length - 1].Position2.Y);
|
||||
Gl.glVertex2f(File.CPOI[File.CPAT[File.CPAT[j].GoesTo3].StartIdx].Position2.X, File.CPOI[File.CPAT[File.CPAT[j].GoesTo3].StartIdx].Position2.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[NKMD.CheckPointPath[j].StartIndex + NKMD.CheckPointPath[j].Length - 1].Point2.X, NKMD.CheckPoint[NKMD.CheckPointPath[j].StartIndex + NKMD.CheckPointPath[j].Length - 1].Point2.Y);
|
||||
Gl.glVertex2f(NKMD.CheckPoint[NKMD.CheckPointPath[NKMD.CheckPointPath[j].GoesTo[i]].StartIndex].Point2.X, NKMD.CheckPoint[NKMD.CheckPointPath[NKMD.CheckPointPath[j].GoesTo[i]].StartIndex].Point2.Y);
|
||||
}
|
||||
}
|
||||
Gl.glEnd();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Gl.glBegin(Gl.GL_POINTS);
|
||||
objidx = 1;
|
||||
/*if (cPOIToolStripMenuItem.Checked)
|
||||
//if (cPOIToolStripMenuItem.Checked)
|
||||
{
|
||||
foreach (MKDS_Course_Modifier.MKDS.NKM.CPOIEntry o in File.CPOI)
|
||||
foreach (var o in NKMD.CheckPoint.Entries)
|
||||
{
|
||||
if (!picking)
|
||||
{
|
||||
@ -621,7 +576,7 @@ namespace MarioKart.UI
|
||||
{
|
||||
Gl.glColor4f(Color.FromArgb(objidx | (21 << 18)).R / 255f, Color.FromArgb(objidx | (21 << 18)).G / 255f, Color.FromArgb(objidx | (21 << 18)).B / 255f, 1);
|
||||
}
|
||||
Gl.glVertex2f(o.Position1.X, o.Position1.Y);
|
||||
Gl.glVertex2f(o.Point1.X, o.Point1.Y);
|
||||
if (!picking)
|
||||
{
|
||||
Gl.glColor3f(170f / 255f, 0, 0);//181f / 255f, 230f / 255f, 29f / 255f);
|
||||
@ -631,9 +586,9 @@ namespace MarioKart.UI
|
||||
Gl.glColor4f(Color.FromArgb(objidx | (22 << 18)).R / 255f, Color.FromArgb(objidx | (22 << 18)).G / 255f, Color.FromArgb(objidx | (22 << 18)).B / 255f, 1);
|
||||
objidx++;
|
||||
}
|
||||
Gl.glVertex2f(o.Position2.X, o.Position2.Y);
|
||||
Gl.glVertex2f(o.Point2.X, o.Point2.Y);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
Gl.glEnd();
|
||||
//Gl.glEnable(Gl.GL_LINE_SMOOTH);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user