public static void StopRender_NET()
 {
     Hooks.BIZHAWK_STOPRECORDAV();
 }
Exemple #2
0
        private static void OnMessageReceived(object sender, NetCoreEventArgs e)
        {
            try
            {
                // This is where you implement interaction.
                // Warning: Any error thrown in here will be caught by NetCore and handled by being displayed in the console.

                var message         = e.message;
                var simpleMessage   = message as NetCoreSimpleMessage;
                var advancedMessage = message as NetCoreAdvancedMessage;

                ConsoleEx.WriteLine(message.Type);
                switch (message.Type)                 //Handle received messages here
                {
                case RTCV.NetCore.Commands.Remote.AllSpecSent:
                {
                    if (VanguardCore.FirstConnect)
                    {
                        SyncObjectSingleton.FormExecute(() =>
                            {
                                VanguardCore.LoadDefaultAndShowBizhawkForm();
                            });
                        VanguardCore.FirstConnect = false;
                    }
                }
                break;

                case RTCV.NetCore.Commands.Basic.SaveSavestate:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        e.setReturnValue(VanguardCore.SaveSavestate_NET(advancedMessage.objectValue as string));
                    });
                    break;

                case RTCV.NetCore.Commands.Basic.LoadSavestate:
                {
                    var cmd      = advancedMessage.objectValue as object[];
                    var path     = cmd[0] as string;
                    var location = (StashKeySavestateLocation)cmd[1];
                    SyncObjectSingleton.FormExecute(() =>
                        {
                            e.setReturnValue(VanguardCore.LoadSavestate_NET(path, location));
                        });
                    break;
                }

                case RTCV.NetCore.Commands.Remote.LoadROM:
                {
                    var fileName = advancedMessage.objectValue as String;
                    SyncObjectSingleton.FormExecute(() =>
                        {
                            VanguardCore.LoadRom_NET(fileName);
                        });
                }
                break;

                case RTCV.NetCore.Commands.Remote.CloseGame:
                {
                    SyncObjectSingleton.FormExecute(() =>
                        {
                            Hooks.CLOSE_GAME(true);
                        });
                }
                break;

                case RTCV.NetCore.Commands.Remote.DomainGetDomains:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        e.setReturnValue(Hooks.GetInterfaces());
                    });
                    break;

                case RTCV.NetCore.Commands.Remote.KeySetSyncSettings:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        Hooks.BIZHAWK_GETSET_SYNCSETTINGS = (string)advancedMessage.objectValue;
                    });
                    break;

                case RTCV.NetCore.Commands.Remote.KeySetSystemCore:
                {
                    var cmd        = advancedMessage.objectValue as object[];
                    var systemName = (string)cmd[0];
                    var systemCore = (string)cmd[1];
                    SyncObjectSingleton.FormExecute(() =>
                        {
                            Hooks.BIZHAWK_SET_SYSTEMCORE(systemName, systemCore);
                        });
                }
                break;

                case RTCV.NetCore.Commands.Remote.OpenHexEditor:
                    SyncObjectSingleton.FormExecute(() => Hooks.BIZHAWK_OPEN_HEXEDITOR());
                    break;

                case RTCV.NetCore.Commands.Emulator.GetRealtimeAPI:
                    e.setReturnValue(VanguardCore.RTE_API);
                    break;

                case RTCV.NetCore.Commands.Emulator.GetScreenshot:
                    e.setReturnValue(Hooks.BIZHAWK_GET_SCREENSHOT());
                    break;

                case RTCV.NetCore.Commands.Emulator.OpenHexEditorAddress:
                {
                    var    temp    = advancedMessage.objectValue as object[];
                    string domain  = (string)temp[0];
                    long   address = (long)temp[1];

                    MemoryDomainProxy mdp = MemoryDomains.GetProxy(domain, address);
                    long realAddress      = MemoryDomains.GetRealAddress(domain, address);

                    SyncObjectSingleton.FormExecute(() =>
                        {
                            Hooks.BIZHAWK_OPEN_HEXEDITOR_ADDRESS(mdp, realAddress);
                        });

                    break;
                }

                case RTCV.NetCore.Commands.Remote.EventEmuMainFormClose:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        Hooks.BIZHAWK_MAINFORM_CLOSE();
                    });
                    break;

                case RTCV.NetCore.Commands.Remote.RenderStart:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        BizhawkRender.StartRender_NET();
                    });
                    break;

                case RTCV.NetCore.Commands.Remote.RenderStop:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        BizhawkRender.StopRender_NET();
                    });
                    break;

                case RTCV.NetCore.Commands.Remote.EventEmuStarted:
                    //if (RTC_StockpileManager.BackupedState == null)
                    //S.GET<RTC_Core_Form>().AutoCorrupt = false;


                    //Todo
                    //RTC_NetcoreImplementation.SendCommandToBizhawk(new RTC_Command("REMOTE_PUSHVMDS) { objectValue = MemoryDomains.VmdPool.Values.Select(it => (it as VirtualMemoryDomain).Proto).ToArray() }, true, true);

                    //Thread.Sleep(100);

                    //		if (RTC_StockpileManager.BackupedState != null)
                    //			S.GET<RTC_MemoryDomains_Form>().RefreshDomainsAndKeepSelected(RTC_StockpileManager.BackupedState.SelectedDomains.ToArray());

                    //		if (S.GET<RTC_Core_Form>().cbUseGameProtection.Checked)
                    //			RTC_GameProtection.Start();

                    break;

                case RTCV.NetCore.Commands.Remote.IsNormalAdvance:
                    e.setReturnValue(Hooks.isNormalAdvance);
                    break;

                case RTCV.NetCore.Commands.Remote.EventCloseEmulator:
                    Environment.Exit(-1);
                    break;
                }
            }
            catch (Exception ex)
            {
                VanguardCore.ShowErrorDialog(ex, true);
            }
        }