Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Apps
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-06 20:57:28 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-06 20:57:28 +0300
commit3a7111a4c8cb629e0c96dfb50842fb4ef3979eed (patch)
tree86162e035b96d8a7d5fa719afcdf703f63fa65db /Apps
parent90bbb7552e5aaa9c99d23c4aa89ccac91f5669bb (diff)
New settings for SNES
Diffstat (limited to 'Apps')
-rw-r--r--Apps/NesMiniApplication.cs9
-rw-r--r--Apps/SnesGame.cs57
2 files changed, 61 insertions, 5 deletions
diff --git a/Apps/NesMiniApplication.cs b/Apps/NesMiniApplication.cs
index a96f7b67..ed626e9f 100644
--- a/Apps/NesMiniApplication.cs
+++ b/Apps/NesMiniApplication.cs
@@ -362,8 +362,13 @@ namespace com.clusterrr.hakchi_gui
Graphics gr;
// Just keep aspect ratio
- const int maxX = 204;
- const int maxY = 204;
+ int maxX = 204;
+ int maxY = 204;
+ if (ConfigIni.ConsoleType == MainForm.ConsoleType.SNES || ConfigIni.ConsoleType == MainForm.ConsoleType.SuperFamicom)
+ {
+ maxX = 228;
+ maxY = 228;
+ }
if ((double)image.Width / (double)image.Height > (double)maxX / (double)maxY)
outImage = new Bitmap(maxX, (int)((double)maxY * (double)image.Height / (double)image.Width));
else
diff --git a/Apps/SnesGame.cs b/Apps/SnesGame.cs
index 6b1a1383..f6a89fbd 100644
--- a/Apps/SnesGame.cs
+++ b/Apps/SnesGame.cs
@@ -170,6 +170,57 @@ namespace com.clusterrr.hakchi_gui
rawRomData = result;
}
+ public SfromHeader1 ReadSfromHeader1()
+ {
+ foreach (var f in Directory.GetFiles(GamePath, "*.sfrom"))
+ {
+ var sfrom = File.ReadAllBytes(f);
+ var sfromHeader1 = SfromHeader1.Read(sfrom, 0);
+ return sfromHeader1;
+ }
+ throw new Exception(".sfrom file not found");
+ }
+
+ public SfromHeader2 ReadSfromHeader2()
+ {
+ foreach (var f in Directory.GetFiles(GamePath, "*.sfrom"))
+ {
+ var sfrom = File.ReadAllBytes(f);
+ var sfromHeader1 = SfromHeader1.Read(sfrom, 0);
+ var sfromHeader2 = SfromHeader2.Read(sfrom, (int)sfromHeader1.Header2);
+ return sfromHeader2;
+ }
+ throw new Exception(".sfrom file not found");
+ }
+
+ public void WriteSfromHeader1(SfromHeader1 sfromHeader1)
+ {
+ foreach (var f in Directory.GetFiles(GamePath, "*.sfrom"))
+ {
+ var sfrom = File.ReadAllBytes(f);
+ var data = sfromHeader1.GetBytes();
+ Array.Copy(data, 0, sfrom, 0, data.Length);
+ File.WriteAllBytes(f, sfrom);
+ return;
+ }
+ throw new Exception(".sfrom file not found");
+ }
+
+ public void WriteSfromHeader2(SfromHeader2 sfromHeader2)
+ {
+ foreach (var f in Directory.GetFiles(GamePath, "*.sfrom"))
+ {
+ var sfrom = File.ReadAllBytes(f);
+ var sfromHeader1 = SfromHeader1.Read(sfrom, 0);
+ var data = sfromHeader2.GetBytes();
+ Array.Copy(data, 0, sfrom, (int)sfromHeader1.Header2, data.Length);
+ File.WriteAllBytes(f, sfrom);
+ return;
+ }
+ throw new Exception(".sfrom file not found");
+ }
+
+
[StructLayout(LayoutKind.Sequential)]
private struct SnesRomHeader
{
@@ -217,7 +268,7 @@ namespace com.clusterrr.hakchi_gui
[StructLayout(LayoutKind.Sequential)]
- private struct SfromHeader1
+ public struct SfromHeader1
{
[MarshalAs(UnmanagedType.U4)]
public uint Uknown1_0x00000100;
@@ -283,7 +334,7 @@ namespace com.clusterrr.hakchi_gui
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- private struct SfromHeader2
+ public struct SfromHeader2
{
[MarshalAs(UnmanagedType.U1)] // 0x00
public byte FPS;
@@ -352,7 +403,7 @@ namespace com.clusterrr.hakchi_gui
}
}
- private enum SnesRomType { LoRom = 0x14, HiRom = 0x15 };
+ public enum SnesRomType { LoRom = 0x14, HiRom = 0x15 };
}
}