コード例 #1
0
ファイル: Plugin.cs プロジェクト: nakijun/NestorFilesystem
        private void CpuOnBeforeInstructionFetch(object sender, BeforeInstructionFetchEventArgs e)
        {
            if (!hookedMethods.ContainsKey(regs.PC))
            {
                return;
            }

            if (segmentNumber == null &&
                (mappedRam = slotsSystem.GetSlotContents(slotsSystem.GetCurrentSlot(1)) as IMappedRam) != null &&
                ExtractString(0x4000, 14) == "FileSysDriver")
            {
                segmentNumber = mappedRam.GetBlockInBank(1);
            }

            if (segmentNumber != null &&
                mappedRam?.GetBlockInBank(1) == segmentNumber.Value &&
                slotsSystem.GetSlotContents(slotsSystem.GetCurrentSlot(1)) == mappedRam)
            {
                hookedMethods[regs.PC]();
                cpu.ExecuteRet();
            }
        }