Exemple #1
0
                public ScreenListItem GetAssociatedItem(Romulus.PatchSegment segment)
                {
                    int level, screen;

                    GetSegmentIndex(segment, out level, out screen);
                    return(this[level, screen]);
                }
Exemple #2
0
                public void GetSegmentIndex(Romulus.PatchSegment segment, out int level, out int screen)
                {
                    int index = segment.PatchOffset - ScreenPatchID_0;

                    if (index < 0)
                    {
                        throw new ArgumentException("Specified segment is not a screen segment");
                    }

                    for (int iLevel = 0; iLevel < rom.Levels.Count; iLevel++)
                    {
                        var levelData = rom.Levels[(LevelIndex)iLevel];

                        if (index >= levelData.Screens.Count)
                        {
                            // If screen is not in this level, keep looking
                            index -= levelData.Screens.Count;
                        }
                        else
                        {
                            level  = iLevel;
                            screen = index;
                            return;
                        }
                    }

                    throw new ArgumentException("segment patch offset not a valid screen id");
                }
Exemple #3
0
            private void ApplyGeneralPatch(byte[] assembledBytes, Romulus.PatchSegment seg)
            {
                for (int i = 0; i < outputRom.Levels.Count; i++)
                {
                    var level = outputRom.Levels[(LevelIndex)i];

                    //var screenDataBank = level.Screens.DataBank;
                    int startOfBank, bankSize;
                    level.Format.GetGeneralAsmInsertionBank(out startOfBank, out bankSize);
                    int endOfBank           = startOfBank + bankSize;
                    int startOfGeneralPatch = endOfBank - seg.Length;

                    Array.Copy(assembledBytes, seg.Start, outputRom.data, startOfGeneralPatch, seg.Length);
                }
            }
Exemple #4
0
 public static bool IsScreenPatch(Romulus.PatchSegment segment)
 {
     return(segment.PatchOffset >= ScreenPatchID_0);
 }