Beispiel #1
0
    public static void TestStrats()
    {
        Dictionary <RbyIntroSequence, ushort> redIntros = new Dictionary <RbyIntroSequence, ushort>()
        {
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xA7CB },
            { new RbyIntroSequence(RbyStrat.Pal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xB5B8 },
            { new RbyIntroSequence(RbyStrat.NoPalAB, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x88E9 },
            { new RbyIntroSequence(RbyStrat.PalHold, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x9BD5 },
            { new RbyIntroSequence(RbyStrat.PalAB, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x91E1 },
            { new RbyIntroSequence(RbyStrat.PalRel, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xABC0 },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfWait, RbyStrat.Hop0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x25B3 },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop1, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x4B9C },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop2, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xEC47 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop3, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x56B1 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop4, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x687A },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop5, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x7656 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop6, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x97C7 },
        };

        Dictionary <RbyIntroSequence, ushort> yellowIntros = new Dictionary <RbyIntroSequence, ushort>()
        {
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x046E },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfWait, RbyStrat.Intro0, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xB535 },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro1, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x4261 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro2, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x1FCC },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro3, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xD3C3 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro4, RbyStrat.TitleSkip, RbyStrat.NewGame), 0x6B98 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro5, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xE5F1 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Intro6, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xD82A },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.IntroWait, RbyStrat.TitleSkip, RbyStrat.NewGame), 0xE24E },
        };

        TestIntros(new Red(true), "red", redIntros);
        TestIntros(new Yellow(true), "yellow", yellowIntros);

        void TestIntros(Rby gb, string gameName, Dictionary <RbyIntroSequence, ushort> intros)
        {
            foreach (var i in intros)
            {
                RbyIntroSequence intro       = i.Key;
                ushort           expectedTid = i.Value;
                Console.Write(gameName + "_" + intro.ToString() + " ... ");
                gb.HardReset();
                intro.Execute(gb);
                gb.RunUntil("PrintLetterDelay");
                ushort readTid = gb.CpuReadBE <ushort>("wPlayerID");
                if (expectedTid == readTid)
                {
                    Console.WriteLine("OK");
                }
                else
                {
                    Console.WriteLine("FAILURE (expected=0x{0:x4}; read=0x{1:x4})", expectedTid, readTid);
                }
            }
        }
    }
Beispiel #2
0
    public static void TIDManips()
    {
        Dictionary <RbyIntroSequence, ushort> redIntros = new Dictionary <RbyIntroSequence, ushort>()
        {
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xA7CB },
            { new RbyIntroSequence(RbyStrat.Pal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xB5B8 },
            { new RbyIntroSequence(RbyStrat.NoPalAB, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x88E9 },
            { new RbyIntroSequence(RbyStrat.PalHold, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x9BD5 },
            { new RbyIntroSequence(RbyStrat.PalAB, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x91E1 },
            { new RbyIntroSequence(RbyStrat.PalRel, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xABC0 },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfWait, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x25B3 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x856F },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop1, RbyStrat.Title0, RbyStrat.NewGame), 0x4B9C },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop2, RbyStrat.Title0, RbyStrat.NewGame), 0xEC47 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop3, RbyStrat.Title0, RbyStrat.NewGame), 0x56B1 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop4, RbyStrat.Title0, RbyStrat.NewGame), 0x687A },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop5, RbyStrat.Title0, RbyStrat.NewGame), 0x7656 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop6, RbyStrat.Title0, RbyStrat.NewGame), 0x97C7 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfWait, RbyStrat.Hop0Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x4D0B },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop1Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xD2BF },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop2Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xEBED },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop3Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x4260 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop4Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xD965 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop5Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x0C0D },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title1, RbyStrat.NewGame), 0xBC9B },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title2, RbyStrat.NewGame), 0xDDAC },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title3, RbyStrat.NewGame), 0xE4BC },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title4, RbyStrat.NewGame), 0x2FA8 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title5, RbyStrat.NewGame), 0x0747 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title6, RbyStrat.NewGame), 0x1542 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title7, RbyStrat.NewGame), 0x664B },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0Scroll, RbyStrat.NewGame), 0xF93E },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title1Scroll, RbyStrat.NewGame), 0x32F9 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title2Scroll, RbyStrat.NewGame), 0x7FD5 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title3Scroll, RbyStrat.NewGame), 0x1642 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title4Scroll, RbyStrat.NewGame), 0x227A },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title5Scroll, RbyStrat.NewGame), 0x8490 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title6Scroll, RbyStrat.NewGame), 0xAA83 },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x35A7 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title1Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x1948 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title2Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x0018 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title3Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xCB0B },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title4Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x8858 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title5Reset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xAD4F },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0Usb, RbyStrat.CsReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x7BAB },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title1Usb, RbyStrat.CsReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x763F },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title2Usb, RbyStrat.CsReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xE79F },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title3Usb, RbyStrat.CsReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xF656 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title4Usb, RbyStrat.CsReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x858F },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.Backout, RbyStrat.Title0, RbyStrat.NewGame), 0x0AEE },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.Options, RbyStrat.NewGame), 0x9B10 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.Options, RbyStrat.Options, RbyStrat.NewGame), 0xBE2C },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.OptionsReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0xC880 },

            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGameReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x5638 },
            { new RbyIntroSequence(RbyStrat.NoPal, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame, RbyStrat.OakReset, RbyStrat.GfSkip, RbyStrat.Hop0, RbyStrat.Title0, RbyStrat.NewGame), 0x67C6 },

            { new RbyIntroSequence("red_nopal_gfskip_hop0_title0_backout_title0_backout_title0_backout_title0_backout_title0_backout_title0_backout_title0_backout_title0_opt(backout)_newgame"), 0xFC7D },
            { new RbyIntroSequence("red_nopal_gfreset_gfreset_gfreset_gfreset_gfreset_gfskip_hop0_title0_newgame"), 0x0715 },
            { new RbyIntroSequence("red_pal(ab)_gfskip_hop0_title0_backout_title0_ngreset_gfskip_hop0_title0_newgame"), 0x3399 },
        };

        Dictionary <RbyIntroSequence, ushort> yellowIntros = new Dictionary <RbyIntroSequence, ushort>()
        {
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x046E },
            { new RbyIntroSequence(RbyStrat.GfWait, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0xB535 },

            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro1, RbyStrat.Title, RbyStrat.NewGame), 0x4261 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro2, RbyStrat.Title, RbyStrat.NewGame), 0x1FCC },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro3, RbyStrat.Title, RbyStrat.NewGame), 0xD3C3 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro4, RbyStrat.Title, RbyStrat.NewGame), 0x6B98 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro5, RbyStrat.Title, RbyStrat.NewGame), 0xE5F1 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro6, RbyStrat.Title, RbyStrat.NewGame), 0xD82A },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.IntroWait, RbyStrat.Title, RbyStrat.NewGame), 0xE24E },

            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x012D },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro1Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x9127 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro2Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0xD98B },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro3Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x4025 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro4Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0xC78E },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro5Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x9CD3 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro6Reset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x3ECC },

            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.TitleReset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x62CC },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.TitleUsb, RbyStrat.CsReset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0xC7D4 },

            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.Backout, RbyStrat.Title, RbyStrat.NewGame), 0xF22B },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGameReset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x8398 },
            { new RbyIntroSequence(RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame, RbyStrat.OakReset, RbyStrat.GfSkip, RbyStrat.Intro0, RbyStrat.Title, RbyStrat.NewGame), 0x6B9B },

            { new RbyIntroSequence("yellow_gfskip_intro0_title_backout_title_backout_title_backout_title_backout_title_backout_title_backout_title_backout_title_backout_title_backout_title_backout_title_backout_title_newgame"), 0x3BB9 },
            { new RbyIntroSequence("yellow_gfreset_gfreset_gfreset_gfreset_gfreset_gfreset_gfreset_gfskip_intro0_title_newgame"), 0xCF68 },
            { new RbyIntroSequence("yellow_gfreset_gfreset_gfskip_intro0_title_ngreset_gfskip_intro0_title_ngreset_gfskip_intro0_title_ngreset_gfskip_intro0_title_newgame"), 0xD457 },
        };

        Red    red    = new Red();
        Yellow yellow = new Yellow();

        TestIntros(red, "red", redIntros);
        TestIntros(yellow, "yellow", yellowIntros);

        void TestIntros(Rby gb, string gameName, Dictionary <RbyIntroSequence, ushort> intros)
        {
            foreach (var i in intros)
            {
                RbyIntroSequence intro       = i.Key;
                ushort           expectedTid = i.Value;
                Test(gameName + "_" + intro.ToString(), () => {
                    intro.Execute(gb);
                    gb.RunUntil("PrintLetterDelay");
                    ushort readTid = gb.CpuReadBE <ushort>("wPlayerID");
                    return(string.Format("${0:x4}", expectedTid), string.Format("${0:x4}", readTid));
                });
            }