Пример #1
0
        public CorruptCloudGameData(StashKey key)
        {
            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            fileHash = Global.Game.Hash;

            originalFileName = GlobalWin.MainForm.CurrentlyOpenRom;

            if (originalFileName.IndexOf("\\") != -1)
            {
                originalFileName = originalFileName.Substring(originalFileName.LastIndexOf("\\") + 1);
            }

            originalGameName   = PathManager.FilesystemSafeName(Global.Game);
            originalGameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName);

            if (key.ParentKey == null)
            {
                originalKey = key.Key;
            }
            else
            {
                originalKey = key.ParentKey;
            }


            string originalSavestateFilename = key.GameName + "." + key.ParentKey + ".timejump.State"; // get savestate name

            originalSavestate = File.ReadAllBytes(RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + originalSavestateFilename);

            originalKey = RTC_Core.GetRandomKey();
        }
Пример #2
0
        public StashKey(String _key, String _parentkey, BlastLayer _blastlayer)
        {
            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            Key        = _key;
            ParentKey  = _parentkey;
            blastlayer = _blastlayer;
            RomFile    = GlobalWin.MainForm.CurrentlyOpenRom;
            GameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName);
            GameName   = PathManager.FilesystemSafeName(Global.Game);

            MemoryZones.AddRange(RTC_MemoryZones.SelectedDomains);
        }
Пример #3
0
        public static void LOAD_GAME_DONE()
        {
            if (DisableRTC)
            {
                return;
            }

            //RTC_HellgenieEngine.ClearCheats();
            //RTC_PipeEngine.ClearPipes();

            //Glitch Harvester warning for archives

            string uppercaseFilename = GlobalWin.MainForm.CurrentlyOpenRom.ToUpper();

            if (RTC_Core.ghForm.Visible && (uppercaseFilename.Contains(".ZIP") || uppercaseFilename.Contains(".7Z")))
            {
                MessageBox.Show($"The rom {RTC_Extensions.getShortFilenameFromPath(uppercaseFilename)} is in an archive and can't be added to a Stockpile");
            }

            //Load Game vars into RTC_Core
            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            RTC_StockpileManager.currentGameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName);
            RTC_StockpileManager.currentGameName   = PathManager.FilesystemSafeName(Global.Game);
            RTC_Core.lastOpenRom = GlobalWin.MainForm.CurrentlyOpenRom;
            RTC_RPC.RefreshPlugin();


            //prepare memory domains in advance on bizhawk side
            RTC_MemoryDomains.RefreshDomains(false);


            if (RTC_StockpileManager.currentGameName != lastGameName)
            {
                RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.REMOTE_EVENT_LOADGAMEDONE_NEWGAME));
            }
            else
            {
                RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.REMOTE_EVENT_LOADGAMEDONE_SAMEGAME));
            }



            lastGameName = RTC_StockpileManager.currentGameName;

            //RTC_Restore.SaveRestore();

            RTC_NetCore.HugeOperationEnd();
        }
Пример #4
0
        public bool CheckCompatibility()
        {
            if (Global.Emulator is NullEmulator)
            {
                return(false);
            }


            if (fileHash != Global.Game.Hash)
            {
                PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                      Global.Config.PathEntries[Global.Game.System, "Base"];

                string currentFilename = GlobalWin.MainForm.CurrentlyOpenRom;

                if (currentFilename.IndexOf("\\") != -1)
                {
                    currentFilename = currentFilename.Substring(currentFilename.LastIndexOf("\\") + 1);
                }

                string cctext =
                    "RTC has detected that loaded game doesn't match the game from the savestate: \n" +
                    "\n" +
                    "Original hash: " + fileHash + "\n" +
                    "Current hash: " + Global.Game.Hash + "\n" +
                    "\n" +
                    "Original name: " + originalGameName + "\n" +
                    "Current name: " + PathManager.FilesystemSafeName(Global.Game) + "\n" +
                    "\n" +
                    "Original system: " + originalGameSystem + "\n" +
                    "Current system: " + RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName) + "\n" +
                    "\n" +
                    "Original filename: " + originalFileName + "\n" +
                    "Current filename: " + currentFilename + "\n" +
                    "\n" +
                    "If you press OK, RTC will try to load it anyway.";


                if (MessageBox.Show(cctext, "CorruptCloud Compatibility Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #5
0
        public static void LOAD_GAME_DONE()
        {
            if (!RTC_Core.isLoaded)
            {
                return;
            }

            if (RTC_Core.currentGameName == lastGameName)
            {
                RTC_MemoryZones.RefreshAndKeepDomains();
            }

            RTC_HellgenieEngine.ClearCheats();


            //Load Game vars into RTC_Core
            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            RTC_Core.currentGameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName);
            RTC_Core.currentGameName   = PathManager.FilesystemSafeName(Global.Game);
            RTC_Core.lastOpenRom       = GlobalWin.MainForm.CurrentlyOpenRom;
            RTC_RPC.RefreshPlugin();

            if (RTC_Core.currentGameName != lastGameName)
            {
                RTC_TimeStack.Reset();
                RTC_MemoryZones.AutoSelectDomains();
            }

            if (RTC_MemoryZones.pendingSelectedDomains != null)
            {
                RTC_MemoryZones.setSelectedDomains(RTC_MemoryZones.pendingSelectedDomains);
                RTC_MemoryZones.pendingSelectedDomains = null;
            }
            lastGameName = RTC_Core.currentGameName;

            //RTC_Restore.SaveRestore();

            RTC_RPC.SendToKillSwitch("UNFREEZE");
        }
Пример #6
0
        public bool LoadState(string _key, string GameSystem, string GameName)
        {
            string Key;
            bool   GameHasChanged = false;
            string TheoricalSaveStateFilename;

            if (_key == "btn")
            {
                Key = btnParentKeys[Convert.ToInt32(currentSelectedState)];

                GlobalWin.Sound.StopSound();

                if (ChangeGameWarning(btnAttachedRom[Convert.ToInt32(currentSelectedState)]))
                {
                    RTC_Core.LoadRom(btnAttachedRom[Convert.ToInt32(currentSelectedState)]);
                    GameHasChanged = true;
                }
                else
                {
                    GlobalWin.Sound.StartSound();
                    return(false);
                }

                GlobalWin.Sound.StartSound();
            }
            else if (_key == null)
            {
                RTC_Restore.SaveRestore();
                return(false);
            }
            else
            {
                Key = _key;
            }


            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            if (!GameHasChanged)
            {
                TheoricalSaveStateFilename = RTC_Core.bizhawkDir + "\\" + GameSystem + "\\State\\" + GameName + "." + Key + ".timejump.State";
            }
            else
            {
                TheoricalSaveStateFilename = RTC_Core.bizhawkDir + "\\" + RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName) + "\\State\\" + PathManager.FilesystemSafeName(Global.Game) + "." + Key + ".timejump.State";
            }


            if (File.Exists(TheoricalSaveStateFilename))
            {
                RTC_Core.LoadStateCorruptorSafe(Key + ".timejump", null);
            }
            else
            {
                GlobalWin.Sound.StopSound();
                MessageBox.Show("Error loading savestate (File not found)");
                GlobalWin.Sound.StartSound();
                return(false);
            }

            RTC_Restore.SaveRestore();
            return(true);
        }
Пример #7
0
        public static bool LoadState_NET(StashKey sk, bool ReloadRom = true)
        {
            if (sk == null)
            {
                return(false);
            }

            StashKey.setCore(sk);
            string GameSystem     = sk.SystemName;
            string GameName       = sk.GameName;
            string Key            = sk.ParentKey;
            bool   GameHasChanged = false;
            string TheoricalSaveStateFilename;

            RTC_Core.StopSound();

            if (ReloadRom)
            {
                string ss = null;
                RTC_Core.LoadRom_NET(sk.RomFilename);

                //If the syncsettings are different, update them and load it again. Otheriwse, leave as is
                if (sk.SyncSettings != (ss = StashKey.getSyncSettings_NET(ss)))
                {
                    StashKey.putSyncSettings_NET(sk);
                    RTC_Core.LoadRom_NET(sk.RomFilename);
                }
                GameHasChanged = true;
            }



            RTC_Core.StartSound();


            PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ??
                                  Global.Config.PathEntries[Global.Game.System, "Base"];

            if (!GameHasChanged)
            {
                TheoricalSaveStateFilename = RTC_Core.bizhawkDir + "\\" + GameSystem + "\\State\\" + GameName + "." + Key + ".timejump.State";
            }
            else
            {
                TheoricalSaveStateFilename = RTC_Core.bizhawkDir + "\\" + RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName) + "\\State\\" + PathManager.FilesystemSafeName(Global.Game) + "." + Key + ".timejump.State";
            }


            if (File.Exists(TheoricalSaveStateFilename))
            {
                RTC_Core.LoadSavestate_NET(Key);
            }
            else
            {
                RTC_Core.StopSound();
                MessageBox.Show($"Error loading savestate : (File {Key + ".timejump"} not found)");
                RTC_Core.StartSound();
                return(false);
            }

            return(true);
        }