コード例 #1
0
 private FlagType GetFlag(int pc)
 {
     snesData.Data.RomBytes[pc].Lock.EnterReadLock();
     try
     {
         return(snesData.GetFlag(pc));
     }
     finally
     {
         snesData.Data.RomBytes[pc].Lock.ExitReadLock();
     }
 }
コード例 #2
0
    // return true if we modified this address
    private bool ProcessUsageMapAddress(int snesOffset)
    {
        var pc = snesData.ConvertSnesToPc(snesOffset);

        // branch predictor may optimize this
        if (pc == -1 || pc >= snesData.GetRomSize())
        {
            return(false);
        }

        var flags = (BsnesPlusUsage)usageMap[snesOffset];

        // no information available
        if (flags == 0)
        {
            return(false);
        }

        // skip if there is something already set..
        if (snesData.GetFlag(pc) != FlagType.Unreached)
        {
            return(false);
        }

        // opcode: 0x30, operand: 0x20
        if (flags.HasFlag(BsnesPlusUsage.UsageExec))
        {
            snesData.SetFlag(pc, FlagType.Operand);

            if (flags.HasFlag(BsnesPlusUsage.UsageOpcode))
            {
                prevFlags = ((int)flags & 3) << 4;
                snesData.SetFlag(pc, FlagType.Opcode);
            }

            snesData.SetMxFlags(pc, prevFlags);
            return(true);
        }

        if (!flags.HasFlag(BsnesPlusUsage.UsageRead))
        {
            return(false);
        }

        snesData.SetFlag(pc, FlagType.Data8Bit);
        return(true);
    }