Example #1
0
        //[CoreConstructor("GB", "GBC")]
        public GBHawkLink4x(CoreComm comm, GameInfo game_A, byte[] rom_A, GameInfo game_B, byte[] rom_B, GameInfo game_C, byte[] rom_C, GameInfo game_D, byte[] rom_D, /*string gameDbFn,*/ object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            Link4xSettings     = (GBLink4xSettings)settings ?? new GBLink4xSettings();
            Link4xSyncSettings = (GBLink4xSyncSettings)syncSettings ?? new GBLink4xSyncSettings();
            _controllerDeck    = new GBHawkLink4xControllerDeck(GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName,
                                                                GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName);

            var tempSetA = new GBHawk.GBHawk.GBSettings();
            var tempSetB = new GBHawk.GBHawk.GBSettings();
            var tempSetC = new GBHawk.GBHawk.GBSettings();
            var tempSetD = new GBHawk.GBHawk.GBSettings();

            var tempSyncA = new GBHawk.GBHawk.GBSyncSettings();
            var tempSyncB = new GBHawk.GBHawk.GBSyncSettings();
            var tempSyncC = new GBHawk.GBHawk.GBSyncSettings();
            var tempSyncD = new GBHawk.GBHawk.GBSyncSettings();

            tempSyncA.ConsoleMode = Link4xSyncSettings.ConsoleMode_A;
            tempSyncB.ConsoleMode = Link4xSyncSettings.ConsoleMode_B;
            tempSyncC.ConsoleMode = Link4xSyncSettings.ConsoleMode_C;
            tempSyncD.ConsoleMode = Link4xSyncSettings.ConsoleMode_D;

            tempSyncA.GBACGB = Link4xSyncSettings.GBACGB;
            tempSyncB.GBACGB = Link4xSyncSettings.GBACGB;
            tempSyncC.GBACGB = Link4xSyncSettings.GBACGB;
            tempSyncD.GBACGB = Link4xSyncSettings.GBACGB;

            tempSyncA.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_A;
            tempSyncB.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_B;
            tempSyncC.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_C;
            tempSyncD.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_D;
            tempSyncA.RTCOffset      = Link4xSyncSettings.RTCOffset_A;
            tempSyncB.RTCOffset      = Link4xSyncSettings.RTCOffset_B;
            tempSyncC.RTCOffset      = Link4xSyncSettings.RTCOffset_C;
            tempSyncD.RTCOffset      = Link4xSyncSettings.RTCOffset_D;

            A = new GBHawk.GBHawk(comm, game_A, rom_A, tempSetA, tempSyncA);
            B = new GBHawk.GBHawk(comm, game_B, rom_B, tempSetB, tempSyncB);
            C = new GBHawk.GBHawk(comm, game_C, rom_C, tempSetC, tempSyncC);
            D = new GBHawk.GBHawk(comm, game_D, rom_D, tempSetD, tempSyncD);

            ser.Register <IVideoProvider>(this);
            ser.Register <ISoundProvider>(this);

            _tracer = new TraceBuffer {
                Header = A.cpu.TraceHeader
            };
            ser.Register(_tracer);

            ServiceProvider = ser;

            _aStates = A.ServiceProvider.GetService <IStatable>();
            _bStates = B.ServiceProvider.GetService <IStatable>();
            _cStates = C.ServiceProvider.GetService <IStatable>();
            _dStates = D.ServiceProvider.GetService <IStatable>();

            SetupMemoryDomains();

            HardReset();
        }
        public GBHawkLink4x(CoreLoadParameters <GBLink4xSettings, GBLink4xSyncSettings> lp)
        {
            if (lp.Roms.Count != 4)
            {
                throw new InvalidOperationException("Wrong number of roms");
            }

            var ser = new BasicServiceProvider(this);

            Link4xSettings     = (GBLink4xSettings)lp.Settings ?? new GBLink4xSettings();
            Link4xSyncSettings = (GBLink4xSyncSettings)lp.SyncSettings ?? new GBLink4xSyncSettings();
            _controllerDeck    = new GBHawkLink4xControllerDeck(GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName,
                                                                GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName);

            var tempSetA = new GBHawk.GBHawk.GBSettings();
            var tempSetB = new GBHawk.GBHawk.GBSettings();
            var tempSetC = new GBHawk.GBHawk.GBSettings();
            var tempSetD = new GBHawk.GBHawk.GBSettings();

            var tempSyncA = new GBHawk.GBHawk.GBSyncSettings();
            var tempSyncB = new GBHawk.GBHawk.GBSyncSettings();
            var tempSyncC = new GBHawk.GBHawk.GBSyncSettings();
            var tempSyncD = new GBHawk.GBHawk.GBSyncSettings();

            tempSyncA.ConsoleMode = Link4xSyncSettings.ConsoleMode_A;
            tempSyncB.ConsoleMode = Link4xSyncSettings.ConsoleMode_B;
            tempSyncC.ConsoleMode = Link4xSyncSettings.ConsoleMode_C;
            tempSyncD.ConsoleMode = Link4xSyncSettings.ConsoleMode_D;

            tempSyncA.GBACGB = Link4xSyncSettings.GBACGB;
            tempSyncB.GBACGB = Link4xSyncSettings.GBACGB;
            tempSyncC.GBACGB = Link4xSyncSettings.GBACGB;
            tempSyncD.GBACGB = Link4xSyncSettings.GBACGB;

            tempSyncA.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_A;
            tempSyncB.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_B;
            tempSyncC.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_C;
            tempSyncD.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_D;
            tempSyncA.RTCOffset      = Link4xSyncSettings.RTCOffset_A;
            tempSyncB.RTCOffset      = Link4xSyncSettings.RTCOffset_B;
            tempSyncC.RTCOffset      = Link4xSyncSettings.RTCOffset_C;
            tempSyncD.RTCOffset      = Link4xSyncSettings.RTCOffset_D;

            A = new GBHawk.GBHawk(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, tempSetA, tempSyncA);
            B = new GBHawk.GBHawk(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, tempSetB, tempSyncB);
            C = new GBHawk.GBHawk(lp.Comm, lp.Roms[2].Game, lp.Roms[2].RomData, tempSetC, tempSyncC);
            D = new GBHawk.GBHawk(lp.Comm, lp.Roms[3].Game, lp.Roms[3].RomData, tempSetD, tempSyncD);

            ser.Register <IVideoProvider>(this);
            ser.Register <ISoundProvider>(this);

            _tracer = new TraceBuffer {
                Header = A.cpu.TraceHeader
            };
            ser.Register(_tracer);

            ServiceProvider = ser;

            _aStates = A.ServiceProvider.GetService <IStatable>();
            _bStates = B.ServiceProvider.GetService <IStatable>();
            _cStates = C.ServiceProvider.GetService <IStatable>();
            _dStates = D.ServiceProvider.GetService <IStatable>();

            SetupMemoryDomains();

            HardReset();
        }
Example #3
0
        //[CoreConstructor("GB", "GBC")]
        public GBHawkLink4x(CoreComm comm, GameInfo game_A, byte[] rom_A, GameInfo game_B, byte[] rom_B, GameInfo game_C, byte[] rom_C, GameInfo game_D, byte[] rom_D, /*string gameDbFn,*/ object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            Link4xSettings     = (GBLink4xSettings)settings ?? new GBLink4xSettings();
            Link4xSyncSettings = (GBLink4xSyncSettings)syncSettings ?? new GBLink4xSyncSettings();
            _controllerDeck    = new GBHawkLink4xControllerDeck(GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName,
                                                                GBHawkLink4xControllerDeck.DefaultControllerName, GBHawkLink4xControllerDeck.DefaultControllerName);

            CoreComm = comm;

            var temp_set_A = new GBHawk.GBHawk.GBSettings();
            var temp_set_B = new GBHawk.GBHawk.GBSettings();
            var temp_set_C = new GBHawk.GBHawk.GBSettings();
            var temp_set_D = new GBHawk.GBHawk.GBSettings();

            var temp_sync_A = new GBHawk.GBHawk.GBSyncSettings();
            var temp_sync_B = new GBHawk.GBHawk.GBSyncSettings();
            var temp_sync_C = new GBHawk.GBHawk.GBSyncSettings();
            var temp_sync_D = new GBHawk.GBHawk.GBSyncSettings();

            temp_sync_A.ConsoleMode = Link4xSyncSettings.ConsoleMode_A;
            temp_sync_B.ConsoleMode = Link4xSyncSettings.ConsoleMode_B;
            temp_sync_C.ConsoleMode = Link4xSyncSettings.ConsoleMode_C;
            temp_sync_D.ConsoleMode = Link4xSyncSettings.ConsoleMode_D;

            temp_sync_A.GBACGB = Link4xSyncSettings.GBACGB;
            temp_sync_B.GBACGB = Link4xSyncSettings.GBACGB;
            temp_sync_C.GBACGB = Link4xSyncSettings.GBACGB;
            temp_sync_D.GBACGB = Link4xSyncSettings.GBACGB;

            temp_sync_A.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_A;
            temp_sync_B.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_B;
            temp_sync_C.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_C;
            temp_sync_D.RTCInitialTime = Link4xSyncSettings.RTCInitialTime_D;
            temp_sync_A.RTCOffset      = Link4xSyncSettings.RTCOffset_A;
            temp_sync_B.RTCOffset      = Link4xSyncSettings.RTCOffset_B;
            temp_sync_C.RTCOffset      = Link4xSyncSettings.RTCOffset_C;
            temp_sync_D.RTCOffset      = Link4xSyncSettings.RTCOffset_D;

            A = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify)
            {
                CoreFileProvider = comm.CoreFileProvider
            },
                                  game_A, rom_A, temp_set_A, temp_sync_A);

            B = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify)
            {
                CoreFileProvider = comm.CoreFileProvider
            },
                                  game_B, rom_B, temp_set_B, temp_sync_B);

            C = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify)
            {
                CoreFileProvider = comm.CoreFileProvider
            },
                                  game_C, rom_C, temp_set_C, temp_sync_C);

            D = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify)
            {
                CoreFileProvider = comm.CoreFileProvider
            },
                                  game_D, rom_D, temp_set_D, temp_sync_D);

            ser.Register <IVideoProvider>(this);
            ser.Register <ISoundProvider>(this);

            _tracer = new TraceBuffer {
                Header = A.cpu.TraceHeader
            };
            ser.Register <ITraceable>(_tracer);

            ServiceProvider = ser;

            SetupMemoryDomains();

            HardReset();
        }