Пример #1
0
 public PokeSysBotMini(LiveHeXVersion lv)
 {
     Version   = lv;
     BoxStart  = RamOffsets.GetB1S1Offset(lv);
     SlotSize  = RamOffsets.GetSlotSize(lv);
     SlotCount = RamOffsets.GetSlotCount(lv);
     GapSize   = RamOffsets.GetGapSize(lv);
 }
Пример #2
0
 public PokeSysBotMini(LiveHeXVersion lv, InjectorCommunicationType ict)
 {
     Version   = lv;
     com       = RamOffsets.GetCommunicator(lv, ict);
     BoxStart  = RamOffsets.GetB1S1Offset(lv);
     SlotSize  = RamOffsets.GetSlotSize(lv);
     SlotCount = RamOffsets.GetSlotCount(lv);
     GapSize   = RamOffsets.GetGapSize(lv);
 }
Пример #3
0
 public static int GetB1S1Offset(LiveHeXVersion lv)
 {
     return(lv switch
     {
         LiveHeXVersion.LGPE_v102 => 0x53586c30,
         LiveHeXVersion.SWSH_Orion => 0x4293D8B0,
         LiveHeXVersion.SWSH_Rigel1 => 0x4506D890,
         _ => 0x4506D890
     });
Пример #4
0
        private void SetTrainerData(SaveFile sav, LiveHeXVersion lv)
        {
            var size = RamOffsets.GetTrainerBlockSize(lv);
            var ofs  = RamOffsets.GetTrainerBlockOffset(lv);

            // Check and set trainerdata based on ISaveBlock interfaces
            if (sav is ISaveBlock8Main s8)
            {
                Remote.Bot.ReadBytes(ofs, size).CopyTo(s8.MyStatus.Data);
            }
            else if (sav is SAV7b slgpe)
            {
                Remote.Bot.ReadBytes(ofs, size).CopyTo(slgpe.Blocks.Status.Data);
            }
        }
Пример #5
0
 /// <summary>
 /// Check if a special form needs to be open to handle the block
 /// </summary>
 /// <param name="sb">saveblock</param>
 /// <param name="lv">LiveHeX version being edited</param>
 /// <param name="value">string value of the form to open</param>
 /// <returns>Boolean indicating if a special form needs to be opened</returns>
 public static bool IsSpecialBlock(this string block, LiveHeXVersion lv, out string value)
 {
     value = string.Empty;
     if (LPBasic.SupportedVersions.Contains(lv))
     {
         return(LPBasic.SpecialBlocks.TryGetValue(block, out value));
     }
     if (LPBDSP.SupportedVersions.Contains(lv))
     {
         return(LPBDSP.SpecialBlocks.TryGetValue(block, out value));
     }
     if (LPPLA.SupportedVersions.Contains(lv))
     {
         return(LPPLA.SpecialBlocks.TryGetValue(block, out value));
     }
     return(false);
 }
Пример #6
0
        private void SetTrainerData(SaveFile sav, LiveHeXVersion lv)
        {
            // Check and set trainerdata based on ISaveBlock interfaces
            byte[] dest;
            int    startofs = 0;

            switch (sav)
            {
            case ISaveBlock8Main s8:
                dest     = s8.MyStatus.Data;
                startofs = s8.MyStatus.Offset;
                break;

            case ISaveBlock7Main s7:
                dest     = s7.MyStatus.Data;
                startofs = s7.MyStatus.Offset;
                break;

            case ISaveBlock6Main s6:
                dest     = s6.Status.Data;
                startofs = s6.Status.Offset;
                break;

            case SAV7b slgpe:
                dest     = slgpe.Blocks.Status.Data;
                startofs = slgpe.Blocks.Status.Offset;
                break;

            default:
                dest = Array.Empty <byte>();
                break;
            }

            if (dest.Length == 0)
            {
                return;
            }

            var ofs  = RamOffsets.GetTrainerBlockOffset(lv);
            var data = Remote.Bot.com.ReadBytes(ofs, RamOffsets.GetTrainerBlockSize(lv));

            data.CopyTo(dest, startofs);
        }
Пример #7
0
        private void SetTrainerData(SaveFile sav, LiveHeXVersion lv)
        {
            // Check and set trainerdata based on ISaveBlock interfaces
            byte[] dest = sav switch
            {
                ISaveBlock8Main s8 => s8.MyStatus.Data,
                ISaveBlock7Main s7 => s7.MyStatus.Data,
                ISaveBlock6Core s6 => s6.Status.Data,
                SAV7b slgpe => slgpe.Blocks.Status.Data,
                   _ => Array.Empty <byte>()
            };

            if (dest.Length == 0)
            {
                return;
            }

            var ofs  = RamOffsets.GetTrainerBlockOffset(lv);
            var data = Remote.Bot.com.ReadBytes(ofs, dest.Length);

            data.CopyTo(dest, 0);
        }