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

FdsGame.cs « Apps - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4045f667e8448d7a3b9dd6e37243970a15c0cae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma warning disable 0108
using System;
using System.Drawing;
using System.Text;

namespace com.clusterrr.hakchi_gui
{
    public class FdsGame : NesMiniApplication
    {
        const string DefaultArgs = "--guest-overscan-dimensions 0,0,9,3 --initial-fadein-durations 10,2 --volume 75 --enable-armet --fds-auto-disk-side-switch-on-keypress";
        const char Prefix = 'D';

        public override string GoogleSuffix
        {
            get
            {
                return "(fds | nes | famicom)";
            }
        }

        public FdsGame(string path, bool ignoreEmptyConfig = false)
            : base(path, ignoreEmptyConfig)
        {
        }

        public static bool Patch(string inputFileName, ref byte[] rawRomData, ref char prefix, ref string application, ref string outputFileName, ref string args, ref Image cover, ref byte saveCount, ref uint crc32)
        {
            FindPatch(ref rawRomData, inputFileName, crc32);
            if (Encoding.ASCII.GetString(rawRomData, 0, 3) == "FDS") // header? cut it!
            {
                var fdsDataNoHeader = new byte[rawRomData.Length - 0x10];
                Array.Copy(rawRomData, 0x10, fdsDataNoHeader, 0, fdsDataNoHeader.Length);
                rawRomData = fdsDataNoHeader;
                crc32 = CRC32(rawRomData);
                // Try to find patch again, using new CRC
                FindPatch(ref rawRomData, inputFileName,  crc32);
            }
            if (ConfigIni.ConsoleType == MainForm.ConsoleType.NES || ConfigIni.ConsoleType == MainForm.ConsoleType.Famicom)
                application = "/bin/clover-kachikachi-wr";
            else
                application = "/bin/nes";
            args = DefaultArgs;
            return true;
        }
    }
}