Beispiel #1
0
        static unsafe void Main(string[] args)
        {
#if FAMISTUDIO_WINDOWS
            try
            {
                // This is only supported in Windows 8.1+.
                SetProcessDpiAwareness(1 /*Process_System_DPI_Aware*/);
            }
            catch { }
#endif

            Settings.Load();
            Cursors.Initialize();
            RenderTheme.Initialize();
            PlatformUtils.Initialize();

#if FAMISTUDIO_WINDOWS
            PerformanceCounter.Initialize();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#endif

            var famiStudio = new FamiStudio(args.Length > 0 ? args[0] : null);
            famiStudio.Run();

            Settings.Save();
        }
Beispiel #2
0
        public unsafe ExportDialog(FamiStudio famistudio)
        {
            int width  = 600;
            int height = PlatformUtils.IsLinux ? 650 : (PlatformUtils.IsMacOS ? 630 : 550);

            dialog = new MultiPropertyDialog("Export Songs", width, height, 200);
            dialog.SetVerb("Export");
            app     = famistudio;
            project = app.Project;

            for (int i = 0; i < (int)ExportFormat.Max; i++)
            {
                var format = (ExportFormat)i;
                var page   = dialog.AddPropertyPage(ExportFormatNames[i], ExportIcons[i]);
                CreatePropertyPage(page, format);
            }

            // Hide a few formats we don't care about on mobile.
            dialog.SetPageVisible((int)ExportFormat.Midi, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.Text, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.FamiTracker, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.FamiStudioMusic, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.FamiStudioSfx, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.FamiTone2Music, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.FamiTone2Sfx, PlatformUtils.IsDesktop);
            dialog.SetPageVisible((int)ExportFormat.Share, PlatformUtils.IsMobile);

            if (PlatformUtils.IsDesktop)
            {
                UpdateMidiInstrumentMapping();
            }
        }
Beispiel #3
0
        static unsafe void Main(string[] args)
        {
#if FAMISTUDIO_WINDOWS
            try
            {
                // This is only supported in Windows 8.1+.
                SetProcessDpiAwareness(1 /*Process_System_DPI_Aware*/);
            }
            catch { }

            if (!PlatformUtils.IsVS2015RuntimeInstalled())
            {
                if (MessageBox.Show("You seem to be missing the VS 2015 C++ Runtime which is required to run FamiStudio, would you like to visit the FamiStudio website for instruction on how to install it?", "Missing Component", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Utils.OpenUrl("https://famistudio.org/doc/#windows");
                }

                return;
            }

            if (!XAudio2Stream.TryDetectXAudio2())
            {
                if (MessageBox.Show("You seem to be missing parts of DirectX which is required to run FamiStudio, would you like to visit the FamiStudio website for instruction on how to install it?", "Missing Component", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Utils.OpenUrl("https://famistudio.org/doc/#windows");
                }

                return;
            }
#endif

            Settings.Load();
            PlatformUtils.Initialize();
            RenderTheme.Initialize();
            NesApu.InitializeNoteTables();

#if FAMISTUDIO_WINDOWS
            WinUtils.Initialize();
            PerformanceCounter.Initialize();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#elif FAMISTUDIO_LINUX
            LinuxUtils.SetProcessName("FamiStudio");
#endif

            var cli = new CommandLineInterface(args);

            if (!cli.Run())
            {
                var famiStudio = new FamiStudio(args.Length > 0 ? args[0] : null);
                famiStudio.Run();
            }

            Settings.Save();

#if FAMISTUDIO_LINUX
            // We sometimes gets stuck here on Linux, lets abort.
            Environment.Exit(0);
#endif
        }
Beispiel #4
0
        public unsafe TransformDialog(FamiStudio famistudio)
        {
            app    = famistudio;
            dialog = new MultiPropertyDialog(550, 500);

            for (int i = 0; i < (int)TransformOperation.Max; i++)
            {
                var section = (TransformOperation)i;
                var page    = dialog.AddPropertyPage(ConfigSectionNames[i], "Clean");
                CreatePropertyPage(page, section);
            }
        }
Beispiel #5
0
        public FamiStudioForm(FamiStudio famistudio)
        {
            this.famistudio = famistudio;

            timer.Tick    += timer_Tick;
            timer.Interval = 4;
            timer.Start();

            InitializeComponent();

            var scaling = Direct2DTheme.MainWindowScaling;

            toolbar.Height = (int)(toolbar.Height * scaling);
            tableLayout.RowStyles[0].Height = (int)(tableLayout.RowStyles[0].Height * scaling);
            projectExplorer.Width           = (int)(projectExplorer.Width * scaling);
        }
Beispiel #6
0
        public unsafe TransformDialog(Rectangle mainWinRect, FamiStudio famistudio)
        {
            int width  = 450;
            int height = 400;
            int x      = mainWinRect.Left + (mainWinRect.Width - width) / 2;
            int y      = mainWinRect.Top + (mainWinRect.Height - height) / 2;

            app    = famistudio;
            dialog = new MultiPropertyDialog(x, y, width, height);

            for (int i = 0; i < (int)TransformOperation.Max; i++)
            {
                var section = (TransformOperation)i;
                var page    = dialog.AddPropertyPage(ConfigSectionNames[i], "Clean");
                CreatePropertyPage(page, section);
            }
        }
Beispiel #7
0
        static unsafe void Main(string[] args)
        {
#if FAMISTUDIO_WINDOWS
            try
            {
                // This is only supported in Windows 8.1+.
                SetProcessDpiAwareness(1 /*Process_System_DPI_Aware*/);
            }
            catch { }
#endif

            Settings.Load();
            RenderTheme.Initialize();
            PlatformUtils.Initialize();
            Cursors.Initialize();
            FamiStudioTempoUtils.Initialize();
            NesApu.InitializeNoteTables();

#if FAMISTUDIO_WINDOWS
            WinUtils.Initialize();
            PerformanceCounter.Initialize();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#endif
#if FAMISTUDIO_LINUX
            LinuxUtils.SetProcessName("FamiStudio");
#endif

            var cli = new CommandLineInterface(args);

            if (!cli.Run())
            {
                var famiStudio = new FamiStudio(args.Length > 0 ? args[0] : null);
                famiStudio.Run();
            }

            Settings.Save();

#if FAMISTUDIO_LINUX
            // We sometimes gets stuck here on Linux, lets abort.
            Environment.Exit(0);
#endif
        }
Beispiel #8
0
        public FamiStudioForm(FamiStudio famistudio)
        {
            Cursors.Initialize();

            this.famistudio = famistudio;

            timer.Tick    += timer_Tick;
            timer.Interval = 4;
            timer.Start();

            InitializeComponent();

            var scaling = Direct2DTheme.MainWindowScaling;

            toolbar.Height = (int)(toolbar.Height * scaling);
            tableLayout.RowStyles[0].Height = (int)(tableLayout.RowStyles[0].Height * scaling);
            projectExplorer.Width           = (int)(projectExplorer.Width * scaling);

            try
            {
                using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop"))
                {
                    if (key != null)
                    {
                        Object o = key.GetValue("MouseWheelRouting");
                        if (o != null)
                        {
                            mouseWheelRouting = (int)(o) != 0;
                        }
                    }
                }
            }
            catch
            {
            }
        }
        public MobileProjectDialog(FamiStudio fami, string title, bool save, bool allowStorage = true)
        {
            famistudio = fami;
            saveMode   = save;

            dialog = new PropertyDialog(title, 100);
            dialog.SetVerb(save ? "Save" : "Open");

            // User files.
            var userProjectsDir = PlatformUtils.UserProjectsDirectory;

            Directory.CreateDirectory(userProjectsDir);

            userProjects.AddRange(Directory.GetFiles(userProjectsDir, "*.fms"));
            for (int i = 0; i < userProjects.Count; i++)
            {
                userProjects[i] = Path.GetFileNameWithoutExtension(userProjects[i]);
            }

            var hasUserProjects = userProjects != null && userProjects.Count > 0;
            var newProjectName  = (string)null;

            if (save)
            {
                userProjects.Add("Save to a New Project.");

                // Generate unique name
                for (int i = 1; ; i++)
                {
                    newProjectName = $"NewProject{i}";
                    if (userProjects.Find(p => p.ToLower() == newProjectName.ToLower()) == null)
                    {
                        break;
                    }
                }
            }
            else
            {
                // Demo songs.
                var assembly = Assembly.GetExecutingAssembly();
                var files    = assembly.GetManifestResourceNames();

                foreach (var file in files)
                {
                    if (file.ToLowerInvariant().EndsWith(".fms"))
                    {
                        // Filename will be in the for 'FamiStudio.Ducktales.fms'.
                        var trimmedFilename = Path.GetFileNameWithoutExtension(file.Substring(file.IndexOf('.') + 1));
                        demoProjects.Add(trimmedFilename);
                    }
                }
            }

            dialog.Properties.AddRadioButtonList("User Projects", userProjects.ToArray(), userProjects.Count - 1, save ? UserProjectSaveTooltip : UserProjectLoadTooltip); // 0

            if (save)
            {
                dialog.Properties.AddTextBox("New Project Name", newProjectName, 0, "Enter the name of the new project."); // 1
                dialog.Properties.AddButton("Delete Selected Project", "Delete");                                          // 2
                dialog.Properties.SetPropertyEnabled(1, true);
                dialog.Properties.SetPropertyEnabled(2, false);
                dialog.Properties.AddLabel("Note", "To export your project to your device's storage or to share them (email, messaging, etc.), please use the 'Share' option from the Export dialog."); // 3
            }
            else
            {
                dialog.Properties.AddRadioButtonList("Demo Projects", demoProjects.ToArray(), hasUserProjects ? -1 : 0, DemoProjectLoadTooltip); // 1
                if (allowStorage)
                {
                    dialog.Properties.AddButton("Open project from storage", "Open From Storage", StorageTooltip); // 2
                }
            }

            dialog.Properties.PropertyClicked += Properties_PropertyClicked;
            dialog.Properties.PropertyChanged += Properties_PropertyChanged;
            dialog.Properties.Build();
        }
Beispiel #10
0
 public MobileProjectDialog(FamiStudio fami, string title, bool save, bool allowStorage = true)
 {
 }
Beispiel #11
0
        static unsafe void Main(string[] args)
        {
#if FAMISTUDIO_WINDOWS
            try
            {
                // This is only supported in Windows 8.1+.
                SetProcessDpiAwareness(1 /*Process_System_DPI_Aware*/);
            }
            catch { }

            if (!PlatformUtils.IsVS2015RuntimeInstalled())
            {
                // MATTT : Update this message + link to 2019 runtime!
                if (MessageBox.Show("You seem to be missing the VS 2019 C++ Runtime which is required to run FamiStudio, would you like to visit the FamiStudio website for instruction on how to install it?", "Missing Component", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    PlatformUtils.OpenUrl("https://famistudio.org/doc/install/#windows");
                }

                return;
            }

            if (!XAudio2Stream.TryDetectXAudio2())
            {
                if (MessageBox.Show("You seem to be missing parts of DirectX which is required to run FamiStudio, would you like to visit the FamiStudio website for instruction on how to install it?", "Missing Component", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    PlatformUtils.OpenUrl("https://famistudio.org/doc/install/#windows");
                }

                return;
            }
#endif

            Init.InitializeBaseSystems();

#if FAMISTUDIO_WINDOWS
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#if !DEBUG
            if (Settings.IsPortableMode)
            {
                WinUtils.AssociateExtension(".fms", Assembly.GetExecutingAssembly().Location, "FamiStudio Project", "FamiStudio Project");
            }
#endif
#elif FAMISTUDIO_LINUX
            LinuxUtils.SetProcessName("FamiStudio");
#endif

            var cli = new CommandLineInterface(args);

            if (!cli.Run())
            {
                var famiStudio = new FamiStudio();
                famiStudio.Initialize(args.Length > 0 ? args[0] : null);
                famiStudio.Run();
            }

            Settings.Save();

#if FAMISTUDIO_LINUX
            // We sometimes gets stuck here on Linux, lets abort.
            Environment.Exit(0);
#endif
        }