コード例 #1
0
        private void CheckPendant(string dungeonName, Pendant p)
        {
            if ((donePendants & p) == p)
            {
                return;
            }

            if (IsRandomized)
            {
                // This logic might not be entirely correct:
                //
                // We know that we emerged victorious from some fight, but have no idea what pendant/crystal it actually was.
                // However, since pendants and crystals are randomized, this could literally be anything.
                var   pointer = bossRoomFlags[dungeonName];
                short value   = pointer.Deref <short>(Emulator);

                // Is the boss for this room cleared?
                if ((value & 0x0800) == 0x0800)
                {
                    donePendants |= p;
                    Split?.Invoke(this, new SplitEventArgs(currentState, dungeonName));
                }
            }
            else
            {
                if ((Pendants.Current & p) == p)
                {
                    donePendants = Pendants.Current;
                    Split?.Invoke(this, new SplitEventArgs(currentState, dungeonName));
                }
            }
        }
コード例 #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Pendant pendant = await db.Pendants.FindAsync(id);

            db.Pendants.Remove(pendant);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Description,PendantSize")] Pendant pendant)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pendant).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(pendant));
        }
コード例 #4
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Description,PendantSize")] Pendant pendant)
        {
            if (ModelState.IsValid)
            {
                db.Pendants.Add(pendant);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(pendant));
        }
コード例 #5
0
        // GET: Pendants/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pendant pendant = await db.Pendants.FindAsync(id);

            if (pendant == null)
            {
                return(HttpNotFound());
            }
            return(View(pendant));
        }
コード例 #6
0
ファイル: TimeGate.io.cs プロジェクト: woshimj001/MHW-Editor
        public void LoadFile(string targetFile)
        {
            using var reader = new BinaryReader(File.OpenRead(targetFile));

            reader.BaseStream.Seek(6, SeekOrigin.Begin);

            {
                var count = reader.ReadUInt32();
                var arr   = new DateTime[count];
                for (var i = 0; i < count; i++)
                {
                    var timeT = reader.ReadInt64();
                    arr[i] = new DateTime(1970, 1, 1).AddSeconds(timeT);
                }
                times = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new Weapon[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new Weapon {
                        Index          = (ulong)i,
                        unlockTime     = times[reader.ReadByte()],
                        weaponCategory = (WeaponType)reader.ReadByte(),
                        weaponId       = reader.ReadUInt32()
                    };
                }
                weapons = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new Armor[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new Armor {
                        Index      = (ulong)i,
                        unlockTime = times[reader.ReadByte()],
                        armorType  = (ArmorType)reader.ReadByte(),
                        armorId    = reader.ReadUInt32()
                    };
                }
                armors = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new Unk1[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new Unk1 {
                        Index      = (ulong)i,
                        unlockTime = times[reader.ReadByte()],
                        unk1       = reader.ReadUInt32()
                    };
                }
                unk1 = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new Unk2[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new Unk2 {
                        Index      = (ulong)i,
                        unlockTime = times[reader.ReadByte()],
                        unk1       = reader.ReadByte(),
                        unk2       = reader.ReadUInt32()
                    };
                }
                unk2 = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new Pendant[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new Pendant {
                        Index      = (ulong)i,
                        unlockTime = times[reader.ReadByte()],
                        pendantId  = reader.ReadUInt32()
                    };
                }
                pendants = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new ItemTg[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new ItemTg {
                        Index      = (ulong)i,
                        unlockTime = times[reader.ReadByte()],
                        itemId     = reader.ReadUInt32()
                    };
                }
                items = arr.ToList();
            }

            reader.BaseStream.Seek(1, SeekOrigin.Current);

            {
                var count = reader.ReadUInt32();
                var arr   = new Unk3[count];
                for (var i = 0; i < count; i++)
                {
                    arr[i] = new Unk3 {
                        Index      = (ulong)i,
                        unlockTime = times[reader.ReadByte()],
                        unk1       = reader.ReadByte(),
                        unk2       = reader.ReadUInt32()
                    };
                }
                unk3 = arr.ToList();
            }
        }
コード例 #7
0
        public void Update(LiveSplitState state)
        {
            currentState = state;
            if (!FindEmulator() || !IsLegendOfZelda())
            {
                savedFrames  += currentFrames;
                currentFrames = 0;

                return;
            }

            Progress.Update(Emulator);
            Module.Update(Emulator);

            // Try to calculate the game time in terms of emulated frames
            if (IPPU_TotalEmulatedFrames != null)
            {
                IPPU_TotalEmulatedFrames.Update(Emulator);
                uint frames = IPPU_TotalEmulatedFrames.Current;

                if (Module.Old < GameModule.MAX && Module.Current >= GameModule.MAX)
                {
                    // just hit reset, so save the current frames
                    savedFrames  += currentFrames;
                    currentFrames = 0;
                }
                else if (Module.Old >= GameModule.MAX && Module.Current < GameModule.MAX)
                {
                    // LTTP is playing again, the first (few?) frames of initialization aren't relevant to the time
                    savedFrames  -= frames;
                    currentFrames = frames;
                }
                else if (Module.Current < GameModule.MAX)
                {
                    currentFrames = frames;
                }
            }


            // (snes9x) Resetting the emulator will fill the complete RAM with 0x55.
            // However, there's no Module with ID 0x55, so we're prior to real initialization.
            if (Module.Current >= GameModule.MAX)
            {
                return;
            }

            if (IsRandomized && Module.Current > GameModule.LoadFile)
            {
                CheckForItems();
            }

            // Only check for progress if it changed by one, which is normal story progression.
            // If you load a new game, your progress is 0 (and thus this isn't executed);
            // if you load an existing game, you'll start in state 2 or 3, which also won't lead to this being executed.
            if (Progress.Changed && (Progress.Old + 1) == Progress.Current)
            {
                CheckForProgress();
            }

            // The currently active screen changed.
            if (Module.Changed)
            {
                if (Module.Old == GameModule.LoadFile && Module.Current == GameModule.Dungeon)
                {
                    // Did we just start a new game?
                    if (Progress.Current == GameState.Start)
                    {
                        donePendants = 0;
                        doneCrystals = 0;

                        // Make sure we're not counting our passed frames so far as elapsed time
                        savedFrames = -currentFrames;

                        OnNewGame?.Invoke(this, new StateEventArgs(state));
                    }
                }
                else if ((Module.Old == GameModule.GanonVictory || Module.Old == GameModule.Victory) && Module.Old != Module.Current)
                {
                    // we probably finished some dungeon
                    CheckForFinishedDungeon();
                }

                else if (Module.Old == GameModule.GanonEmerges && Module.Current != GameModule.GanonEmerges)
                {
                    Split?.Invoke(this, new SplitEventArgs(currentState, "Ganon's Tower"));
                }

                else if (Module.Old != GameModule.TriforceRoom && Module.Current == GameModule.TriforceRoom)
                {
                    // we're done, time to go home
                    Split?.Invoke(this, new SplitEventArgs(currentState, ALTTPComponent.TRIFORCE));
                }
            }
        }