Esempio n. 1
0
        /// <summary>
        /// Creates an instance of the AssemblyEditorViewModel. This is the view model associated
        /// with the editing of all assembly files, and contains a list of individual assembly file view models.
        /// </summary>
        /// <param name="viewId">The ID of the parent view. Used to make active view requests.</param>
        /// <param name="msgMgr">The message manager used to send messages to other views.</param>
        public AssemblyEditorViewModel(int viewId, MessageManager msgMgr) :
            base(msgMgr)
        {
            m_ViewId         = viewId;
            m_Disassembler   = new DisassemblyManager();
            m_OpenViewModels = new ObservableCollection <AssemblyFileViewModel>();

            m_Assembler               = new RiscVAssembler();
            m_AssembleFileCmd         = new RelayCommand <AssemblyCommandParams>(param => AssembleFile(param), false);
            m_NewFileCmd              = new RelayCommand(() => CreateNewFile(), true);
            m_OpenFileCmd             = new RelayCommand <string>((fileName) => OpenFile(fileName), true);
            m_SaveFileCmd             = new RelayCommand <string>((fileName) => SaveFile(fileName), true);
            m_CloseFileCmd            = new RelayCommand <int>(param => CloseFile(param), false);
            m_DisassembleAndImportCmd = new RelayCommand <string>(param => DisassembleAndImportFile(param), true);
            m_ChangeActiveIdxCmd      = new RelayCommand <int>(param => ActiveFileIndex = param, true);
            m_OpenPreferencesCmd      = new RelayCommand(
                () =>
            {
                BroadcastMessage(new BasicMessage(MessageType.ShowOptionsRequest));
            },
                true
                );

            CreateNewFile();
        }
Esempio n. 2
0
 public AssemblyFileViewModel(string compiledFileName, DisassemblyManager disassembler)
 {
     m_AreAnyChangesUnsaved = false;
     m_LoggerVm             = new LoggerViewModel();
     m_FileErrors           = new ObservableCollection <AssemblyException>();
     m_UnderlyingFile       = disassembler.DiassembleCompiledFile(compiledFileName, m_LoggerVm.Logger);
 }
Esempio n. 3
0
        private void StroopMainForm_Load(object sender, EventArgs e)
        {
            // Temp: Remove "Other" tab
#if RELEASE
            tabControlMain.TabPages.Remove(tabPageExpressions);
#endif

            // Create new manager context
            var currentContext = new ManagerContext();
            ManagerContext.Current = currentContext;

            Config.Stream                  = new ProcessStream();
            Config.Stream.OnUpdate        += OnUpdate;
            Config.Stream.FpsUpdated      += _sm64Stream_FpsUpdated;
            Config.Stream.OnDisconnect    += _sm64Stream_OnDisconnect;
            Config.Stream.WarnReadonlyOff += _sm64Stream_WarnReadonlyOff;
            Config.Stream.OnClose         += _sm64Stream_OnClose;

            currentContext.DisassemblyManager = _disManager = new DisassemblyManager(tabPageDisassembly);
            currentContext.ScriptManager      = _scriptManager = new ScriptManager(_scriptParser, checkBoxUseRomHack);
            currentContext.HackManager        = _hackManager = new HackManager(_romHacks, Config.ObjectAssociations.SpawnHacks, tabPageHacks);

            // Create map manager
            MapGui mapGui = new MapGui();
            mapGui.GLControl                   = glControlMap;
            mapGui.MapIdLabel                  = labelMapId;
            mapGui.MapNameLabel                = labelMapName;
            mapGui.MapSubNameLabel             = labelMapSubName;
            mapGui.PuValueLabel                = labelMapPuValue;
            mapGui.QpuValueLabel               = labelMapQpuValue;
            mapGui.MapIconSizeTrackbar         = trackBarMapIconSize;
            mapGui.MapZoomTrackbar             = trackBarMapZoom;
            mapGui.MapShowInactiveObjects      = checkBoxMapShowInactive;
            mapGui.MapShowMario                = checkBoxMapShowMario;
            mapGui.MapShowHolp                 = checkBoxMapShowHolp;
            mapGui.MapShowIntendedNextPosition = checkBoxMapShowIntendedNextPosition;
            mapGui.MapShowCamera               = checkBoxMapShowCamera;
            mapGui.MapShowFloorTriangle        = checkBoxMapShowFloor;
            mapGui.MapShowCeilingTriangle      = checkBoxMapShowCeiling;
            currentContext.MapManager          = _mapManager = new MapManager(_mapAssoc, mapGui);
            currentContext.ModelManager        = _modelManager = new ModelManager(tabPageModel);

            currentContext.ActionsManager      = _actionsManager = new ActionsManager(_actionsData, noTearFlowLayoutPanelActions, tabPageActions);
            currentContext.WaterManager        = _waterManager = new WaterManager(_waterData, noTearFlowLayoutPanelWater);
            currentContext.InputManager        = _inputManager = new InputManager(_inputData, tabPageInput, NoTearFlowLayoutPanelInput, _inputImageGui);
            currentContext.MarioManager        = _marioManager = new MarioManager(_marioData, tabPageMario, NoTearFlowLayoutPanelMario, _mapManager);
            currentContext.HudManager          = _hudManager = new HudManager(_hudData, tabPageHud, NoTearFlowLayoutPanelHud);
            currentContext.MiscManager         = _miscManager = new MiscManager(_miscData, NoTearFlowLayoutPanelMisc, tabPageMisc);
            currentContext.CameraManager       = _cameraManager = new CameraManager(_cameraData, tabPageCamera, NoTearFlowLayoutPanelCamera);
            currentContext.TriangleManager     = _triangleManager = new TriangleManager(tabPageTriangles, _triangleData, NoTearFlowLayoutPanelTriangles);
            currentContext.DebugManager        = _debugManager = new DebugManager(_debugData, tabPageDebug, noTearFlowLayoutPanelDebug);
            currentContext.PuManager           = _puManager = new PuManager(groupBoxPuController);
            currentContext.FileManager         = _fileManager = new FileManager(_fileData, tabPageFile, noTearFlowLayoutPanelFile, _fileImageGui);
            currentContext.QuarterFrameManager = _quarterFrameManager = new DataManager(_quarterFrameData, noTearFlowLayoutPanelQuarterFrame);
            currentContext.CameraHackManager   = _cameraHackManager = new CamHackManager(_camHackData, tabPageCamHack, noTearFlowLayoutPanelCamHack);
            currentContext.ObjectManager       = _objectManager = new ObjectManager(_objectData, tabPageObjects, NoTearFlowLayoutPanelObject);
            currentContext.OptionsManager      = _optionsManager = new OptionsManager(tabPageOptions);
            currentContext.TestingManager      = _testingManager = new TestingManager(tabPageTesting);

            // Create Object Slots
            _slotManagerGui.TabControl          = tabControlMain;
            _slotManagerGui.LockLabelsCheckbox  = checkBoxObjLockLabels;
            _slotManagerGui.FlowLayoutContainer = NoTearFlowLayoutPanelObjects;
            _slotManagerGui.SortMethodComboBox  = comboBoxSortMethod;
            _slotManagerGui.LabelMethodComboBox = comboBoxLabelMethod;
            currentContext.ObjectSlotManager    = _objectSlotManager = new ObjectSlotsManager(_objectManager,
                                                                                              _slotManagerGui, _mapManager, _miscManager, _modelManager, tabControlMain);

            SetupViews();

            _resizing = false;
            labelVersionNumber.Text = _version;

            // Collect garbage, we are fully loaded now!
            GC.Collect();
            GC.WaitForPendingFinalizers();

            // Load process
            buttonRefresh_Click(this, new EventArgs());
            panelConnect.Location = new Point();
            panelConnect.Size     = this.Size;
        }
Esempio n. 4
0
        private void StroopMainForm_Load(object sender, EventArgs e)
        {
            // Temp: Remove "Other" tab
#if RELEASE
            tabControlMain.TabPages.Remove(tabPageExpressions);
#endif

            _sm64Stream           = new ProcessStream();
            _sm64Stream.OnUpdate += OnUpdate;

            _disManager    = new DisassemblyManager(this, richTextBoxDissasembly, maskedTextBoxDisStart, _sm64Stream, buttonDisGo);
            _scriptManager = new ScriptManager(_sm64Stream, _scriptParser, checkBoxUseRomHack);
            _hackManager   = new HackManager(_sm64Stream, _romHacks, checkedListBoxHacks);

            // Create map manager
            MapGui mapGui = new MapGui();
            mapGui.GLControl              = glControlMap;
            mapGui.MapIdLabel             = labelMapId;
            mapGui.MapNameLabel           = labelMapName;
            mapGui.MapSubNameLabel        = labelMapSubName;
            mapGui.PuValueLabel           = labelMapPuValue;
            mapGui.QpuValueLabel          = labelMapQpuValue;
            mapGui.MapIconSizeTrackbar    = trackBarMapIconSize;
            mapGui.MapZoomTrackbar        = trackBarMapZoom;
            mapGui.MapShowInactiveObjects = checkBoxMapShowInactive;
            mapGui.MapShowMario           = checkBoxMapShowMario;
            mapGui.MapShowObjects         = checkBoxMapShowObj;
            mapGui.MapShowHolp            = checkBoxMapShowHolp;
            mapGui.MapShowCamera          = checkBoxMapShowCamera;
            mapGui.MapShowFloorTriangle   = checkBoxMapShowFloor;
            _mapManager = new MapManager(_sm64Stream, _mapAssoc, _objectAssoc, mapGui);

            _marioManager    = new MarioManager(_sm64Stream, _marioData, panelMarioBorder, flowLayoutPanelMario, _mapManager);
            _hudManager      = new HudManager(_sm64Stream, _hudData, tabPageHud);
            _miscManager     = new MiscManager(_sm64Stream, _miscData, flowLayoutPanelMisc, groupBoxPuController);
            _cameraManager   = new CameraManager(_sm64Stream, _cameraData, panelCameraBorder, flowLayoutPanelCamera);
            _triangleManager = new TriangleManager(_sm64Stream, tabPageTriangles, _triangleData);
            _debugManager    = new DebugManager();

            // Create object manager
            var objectGui = new ObjectDataGui()
            {
                ObjectBorderPanel     = panelObjectBorder,
                ObjectFlowLayout      = flowLayoutPanelObject,
                ObjectImagePictureBox = pictureBoxObject,
                ObjAddressLabelValue  = labelObjAddValue,
                ObjAddressLabel       = labelObjAdd,
                ObjBehaviorLabel      = labelObjBhvValue,
                ObjectNameTextBox     = textBoxObjName,
                ObjSlotIndexLabel     = labelObjSlotIndValue,
                ObjSlotPositionLabel  = labelObjSlotPosValue,
                CloneButton           = buttonObjClone,
                MoveMarioToButton     = buttonObjGoTo,
                MoveToMarioButton     = buttonObjRetrieve,
                UnloadButton          = buttonObjUnload
            };
            _objectManager = new ObjectManager(_sm64Stream, _objectAssoc, _objectData, objectGui);

            // Create options manager
            var optionGui = new OptionsGui();
            optionGui.CheckBoxStartFromOne = checkBoxStartSlotIndexOne;
            _optionsManager = new OptionsManager(optionGui);

            // Create Object Slots
            _slotManagerGui.TabControl                  = tabControlMain;
            _slotManagerGui.LockLabelsCheckbox          = checkBoxObjLockLabels;
            _slotManagerGui.MapObjectToggleModeComboBox = comboBoxMapToggleMode;
            _slotManagerGui.FlowLayoutContainer         = flowLayoutPanelObjects;
            _slotManagerGui.SortMethodComboBox          = comboBoxSortMethod;
            _slotManagerGui.LabelMethodComboBox         = comboBoxLabelMethod;
            _objectSlotManager = new ObjectSlotsManager(_sm64Stream, _objectAssoc, _objectManager, _slotManagerGui, _mapManager, _miscManager);

            SetupViews();

            _resizing               = false;
            _defaultSplitValue      = splitContainerMain.SplitterDistance;
            labelVersionNumber.Text = _version;

            // Load process
            var processes = GetAvailableProcesses();
            if (processes.Count == 1)
            {
                if (MessageBox.Show(String.Format("Found process \"{0}\". Connect?", processes[0].ProcessName),
                                    "Process Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var processSelect = new ProcessSelection(processes[0]);
                    comboBoxProcessSelection.Items.Add(processSelect);
                    comboBoxProcessSelection.SelectedIndex = 0;
                }
            }
        }