SpeedModGenerator2.5 (autosave function)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Izzy
    Snek
    FFR Simfile Author
    • Jan 2003
    • 9195

    #1

    SpeedModGenerator2.5 (autosave function)


    Download http://www.flashflashrevolution.com/...p?songid=39261
    --------------------------------------------------





    So I worked on this today. I started not knowing how to search for a specific file and write to it but I believe I figured it all out. This one only works with 3.9 and 3.95 because I got fed up with trying to make it work for 3.9 and 4.0 while saving. Try it out for me and tell me if it works please. It is generally pretty stable if you aren't completely dumb.
    Last edited by Izzy; 09-22-2009, 01:03 PM.
  • who_cares973
    FFR Player
    • Aug 2006
    • 15407

    #2
    Re: SpeedModGenerator2.5 (autosave function)

    very cool i'll try it out tomorrow

    Comment

    • leonid
      I am leonid
      FFR Simfile Author
      FFR Music Producer
      • Oct 2008
      • 8080

      #3
      Re: SpeedModGenerator2.5 (autosave function)

      Doesn't work on mac
      lame



      Proud member of Team No

      Comment

      • pokelda
        ⁽ ´ཀ`⁾
        FFR Simfile Author
        • Jun 2006
        • 3876

        #4
        Re: SpeedModGenerator2.5 (autosave function)

        i agre, macs are lame

        Comment

        • leonid
          I am leonid
          FFR Simfile Author
          FFR Music Producer
          • Oct 2008
          • 8080

          #5
          Re: SpeedModGenerator2.5 (autosave function)

          i agree with that too



          Proud member of Team No

          Comment

          • Izzy
            Snek
            FFR Simfile Author
            • Jan 2003
            • 9195

            #6
            Re: SpeedModGenerator2.5 (autosave function)

            Here is my horrendous looking code. I'm aware there might be easier or less bulky methods of doing things. I just put down the first thing that came to my head that made it work.

            Code:
            using System;
            using System.ComponentModel;
            using System.Windows.Forms;
            using System.IO;
            
            namespace WindowsFormsApplication1
            {
                public partial class SpeedmodGen : Form
                {
            
                    StreamReader x = new StreamReader("metrics.ini");
                    public int xcount = 1;
                    public int xxcount = 1;
                    public int ccount = 1;
                    public int cccount = 1;
                    public double xstart = 0;
                    public double xend = 0;
                    public double xinc = 0;
                    public int cstart = 0;
                    public int cend = 0;
                    public int cinc = 0;
            
                    public SpeedmodGen()
                    {
                        InitializeComponent();
                    }
            
                    private void pictureBox1_Click(object sender, EventArgs e)
                    {
            
                    }
            
                    private void Go_Click(object sender, EventArgs e)
                    {
                        
                            if (Xstart.Text == "" || Xend.Text == "" || Xinc.Text == "" || Cstart.Text == "" || Cend.Text == "" || Cinc.Text == "")
                            {
                                MessageBox.Show("At least one field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                               
                                xstart = Convert.ToDouble(Xstart.Text);
                                xend = Convert.ToDouble(Xend.Text);
                                xinc = Convert.ToDouble(Xinc.Text);
                                cstart = Convert.ToInt32(Cstart.Text);
                                cend = Convert.ToInt32(Cend.Text);
                                cinc = Convert.ToInt32(Cinc.Text);
                                
                            
                                metrics.Text = "";
                                Language.Text = "";
            
                                for (double i = xstart; i <= xend; i = i + xinc)
                                {
            
                                    xxcount += 1;
                                }
            
            
                                cccount = xxcount;
                                for (int i = cstart; i < cend; i = i + cinc)
                                {
                                    cccount += 1;
                                }
            
            
                                
                                metrics.Text = ("# Player options\r\n");
                                metrics.Text = metrics.Text + ("Speed=" + cccount + "\r\n");
                                metrics.Text = metrics.Text + ("SpeedDefault=mod,1x\r\n");
            
                                for (double i = xstart; i <= xend; i = i + xinc)
                                {
                                    metrics.Text = metrics.Text + ("Speed," + xcount + "=mod," + System.Math.Round(i, 3) + "x;name,x" + System.Math.Round(i, 3) + "\r\n");
                                    xcount += 1;
                                    metrics.Update();
                                }
            
                                ccount = xcount;
                                for (int i = cstart; i <= cend; i = i + cinc)
                                {
                                    metrics.Text = metrics.Text + ("Speed," + ccount + "=mod," + "C" + i + ";name,C" + i + "\r\n");
                                    ccount += 1;
                                    metrics.Update();
                                }
            
                                Language.Text = "";
                                for (double i = xstart; i <= xend; i = i + xinc)
                                {
            
                                    Language.Text = Language.Text + ("x" + System.Math.Round(i, 3) + "=x" + System.Math.Round(i, 3) + "\r\n");
                                    metrics.Update();
            
                                }
                                for (int i = cstart; i <= cend; i = i + cinc)
                                {
                                    Language.Text = Language.Text + ("C" + i + "=C" + i + "\r\n");
                                    metrics.Update();
            
                                }
            
                                xcount = 1;
                                xxcount = 1;
                                ccount = 1;
                                cccount = 1;
                                xstart = 0;
                                xend = 0;
                                xinc = 0;
                                cstart = 0;
                                cend = 0;
                                cinc = 0;
                            }
                    }
            
            
                    private void Clear_Click(object sender, EventArgs e)
                    {
                        Xstart.Text = "";
                        Xend.Text = "";
                        Xinc.Text = "";
                        Cstart.Text = "";
                        Cend.Text = "";
                        Cinc.Text = "";
                        metrics.Text = "";
                        Language.Text = "";
                        filePath.Text = "";
                    }
            
            
                    private void Form1_Load(object sender, EventArgs e)
                    {
                      
                    }
            
                    private void Help_Click(object sender, EventArgs e)
                    {
                        metrics.Text = "";
                        Language.Text = "";
                        metrics.Text = "Created by: Izzy\r\n";
                        metrics.Text = metrics.Text + "http://www.flashflashrevolution.com/profile/Izzy/";
            
            
                        Language.Text = "1) Don't leave any fields blank \r\n";
                        Language.Text = Language.Text + ("2) Don't use any letters \r\n");
                        Language.Text = Language.Text + ("3) Don't make the incriments bigger then the end value \r\n");
                        Language.Text = Language.Text + ("4) It's a good idea to make your values pass through 1x \r\n");
                    }
            
                    private void Save_Click(object sender, EventArgs e)
                    {
                        int screenop = 0;
            
                        xcount = 1;
                        xxcount = 1;
                        ccount = 1;
                        cccount = 1;
                        xstart = 0;
                        xend = 0;
                        xinc = 0;
                        cstart = 0;
                        cend = 0;
                        cinc = 0;
            
                        string num = "0";
            
                        if (filePath.Text == "")
                        {
                            MessageBox.Show("No directory selected. Please browse for a file.", "Error" ,MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else if (filePath.Text.Contains("metrics.ini") == false)
                        {
                            MessageBox.Show("Please select the metrics.ini file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else if (Xstart.Text == "" || Xend.Text == "" || Xinc.Text == "" || Cstart.Text == "" || Cend.Text == "" || Cinc.Text == "")
                        {
                            MessageBox.Show("At least one field is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
            
                        else
                        {
                            StreamReader r = new StreamReader(filePath.Text);
            
                            string line = "";
                            int lines = 0;
                            while ((line = r.ReadLine()) != null)
                            {
                                lines++;
                            }
                            r.Close();
            
                            StreamReader rx = new StreamReader(filePath.Text);
            
                            string[] meh = new string[lines];
                            for (int i = 0; i < meh.Length; i++)
                            {
                                line = rx.ReadLine();
                                meh[i] = line;
                                
                                if (meh[i] == "# Player options")
                                {
                                    num = rx.ReadLine();
            
                                    num = num.Substring(6);
                                }
                            }
                            rx.Close();
            
                            string beh = "";
                            for (int j = 0; j < meh.Length; j++)
                            {
                                beh = meh[j];
                                if (meh[j] == "# Player options")
                                {
                                    meh[j] = " ";
                                }
            
                                if (meh[j] == null)
                                {
                                }
                                else if (beh.Contains("SpeedDefault=mod,"))
                                {
                                    meh[j] = " ";
                                }
                                if (meh[j] == null)
                                {
                                }
                                else if (beh.Contains("Speed,"))
                                {
                                    meh[j] = " ";
                                }
                                if (meh[j] == "[ScreenOptionsMaster]")
                                {
                                    screenop++;
                                    if (screenop >= 2)
                                    {
                                        meh[j] = " ";
                                    }
                                }
            
                            }
                            int blank = 0;
                            for (int o = 0; o < meh.Length; o++)
                            {
                                if (meh[o] == " ")
                                {
                                    blank++;
                                }
            
                            }
                            string[] mah = new string[meh.Length - blank];
            
                            int m = 0;
                            for (int l = 0; l < meh.Length; l++)
                            {
                                if (meh[l] != " ")
                                {
                                    mah[m] = meh[l];
                                    m++;
                                }
            
                            }
                           
            
                            StreamWriter w = File.CreateText(@filePath.Text);
                            for (int x = 0; x < mah.Length -1; x++)
                            {
                                w.WriteLine(mah[x]);
                            }
                            w.Close();
            
                            StreamWriter wx = File.AppendText(@filePath.Text);
            
            
            
                            xstart = Convert.ToDouble(Xstart.Text);
                            xend = Convert.ToDouble(Xend.Text);
                            xinc = Convert.ToDouble(Xinc.Text);
                            cstart = Convert.ToInt32(Cstart.Text);
                            cend = Convert.ToInt32(Cend.Text);
                            cinc = Convert.ToInt32(Cinc.Text);
            
                            for (double i = xstart; i <= xend; i = i + xinc)
                            {
            
                                xxcount += 1;
                            }
            
            
                            cccount = xxcount;
                            for (int i = cstart; i < cend; i = i + cinc)
                            {
                                cccount += 1;
                            }
            
                            wx.WriteLine("[ScreenOptionsMaster]");
                            wx.WriteLine("# Player options");
                            wx.WriteLine("Speed=" + cccount + "");
                            wx.WriteLine("SpeedDefault=mod,1x");
            
                            for (double i = xstart; i <= xend; i = i + xinc)
                            {
                                wx.WriteLine("Speed," + xcount + "=mod," + System.Math.Round(i, 3) + "x;name,x" + System.Math.Round(i, 3));
                                xcount += 1;
                            }
            
                            ccount = xcount;
                            for (int i = cstart; i <= cend; i = i + cinc)
                            {
                                wx.WriteLine("Speed," + ccount + "=mod," + "C" + i + ";name,C" + i);
                                ccount += 1;
                            }
                            wx.Close();
            
                        }
            
                    }
            
                    private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
                    {
            
                    }
            
                    private void Save2_Click(object sender, EventArgs e)
                    {
                        xcount = 1;
                        xxcount = 1;
                        ccount = 1;
                        cccount = 1;
                        xstart = 0;
                        xend = 0;
                        xinc = 0;
                        cstart = 0;
                        cend = 0;
                        cinc = 0;
            
            
                        if (filePath.Text == "")
                        {
                            MessageBox.Show("No directory selected. Please browse for a file.", "Error" ,MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else if (filePath.Text.Contains("english.ini") == false)
                        {
                            MessageBox.Show("Please select the english.ini file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else if (Xstart.Text == "" || Xend.Text == "" || Xinc.Text == "" || Cstart.Text == "" || Cend.Text == "" || Cinc.Text == "")
                        {
                            MessageBox.Show("At least one field is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
            
                        else
                        {
            
                            StreamWriter wx = File.AppendText(@filePath.Text);
            
                            wx.WriteLine("[OptionNames]");
            
                            xstart = Convert.ToDouble(Xstart.Text);
                            xend = Convert.ToDouble(Xend.Text);
                            xinc = Convert.ToDouble(Xinc.Text);
                            cstart = Convert.ToInt32(Cstart.Text);
                            cend = Convert.ToInt32(Cend.Text);
                            cinc = Convert.ToInt32(Cinc.Text);
            
            
                            for (double i = xstart; i <= xend; i = i + xinc)
                            {
            
                                xxcount += 1;
                            }
            
            
                            cccount = xxcount;
                            for (int i = cstart; i < cend; i = i + cinc)
                            {
                                cccount += 1;
                            }
                            for (double i = xstart; i <= xend; i = i + xinc)
                            {
                                xcount += 1;
                            }
                            ccount = xcount;
                            for (int i = cstart; i <= cend; i = i + cinc)
                            {
                                ccount += 1;
                            }
            
                            for (double i = xstart; i <= xend; i = i + xinc)
                            {
                                wx.WriteLine("x" + System.Math.Round(i, 3) + "=x" + System.Math.Round(i, 3));
            
                            }
                            for (int i = cstart; i <= cend; i = i + cinc)
                            {
                                wx.WriteLine("C" + i + "=C" + i);
                            }
            
                            wx.Close();
            
            
                        }
            
                    }
            
                    private void search_Click(object sender, EventArgs e)
                    {
                        OpenFileDialog F = new OpenFileDialog();
                        F.Title = "Search for file";
                        F.InitialDirectory = @"C:\Program Files";
                        F.Filter = "All files (*.*)|*.*";
                        F.FilterIndex = 1;
                        F.RestoreDirectory = true;
                        if (F.ShowDialog() == DialogResult.OK)
                        {
                            filePath.Text = F.FileName;
                        }
                    }
            
            
                }
            }

            Comment

            • xingyguy
              Bagel
              • Apr 2008
              • 266

              #7
              Re: SpeedModGenerator2.5 (autosave function)

              Can you make a mac version?
              My latest simfiles:

              Xenobius: http://www.stepmania.com/download.ph...Xenobius.smzip

              Coward Killing Time: http://www.flashflashrevolution.com/...p?songid=38838

              Minute: http://www.flashflashrevolution.com/...p?songid=35958

              Chaoz Impact: http://www.stepmania.com/download.ph...ozImpact.smzip

              Comment

              • Izzy
                Snek
                FFR Simfile Author
                • Jan 2003
                • 9195

                #8
                Re: SpeedModGenerator2.5 (autosave function)

                I'm sorry, I have no idea how to program apps. Also I do not own a mac computer.

                Comment

                • i love you
                  Live a wonderful life~
                  FFR Simfile Author
                  • Oct 2006
                  • 7313

                  #9
                  Re: SpeedModGenerator2.5 (autosave function)

                  Just downloaded this and it seems pretty stable to me. I really love the auto save feature and the browsing button. Good job Izzy, I will definitely start using this.
                  ===============================
                  The idea that RDCP 3 may come out in the future is a fun thought to have~
                  ===============================

                  Comment

                  • TheLaughingSpaz
                    FFR Player
                    • Apr 2006
                    • 7

                    #10
                    Re: SpeedModGenerator2.5 (autosave function)

                    Originally posted by Izzy
                    I'm sorry, I have no idea how to program apps. Also I do not own a mac computer.
                    Get Monodevelop, compile against Mono, and distribute that executable to the Mac and Linux people. Mac and Linux people will have to download the latest version of Mono. WinForms support in Mono may or may not be wonky. This is a fairly simple app, so hopefully it'll work.

                    Comment

                    • leonid
                      I am leonid
                      FFR Simfile Author
                      FFR Music Producer
                      • Oct 2008
                      • 8080

                      #11
                      Re: SpeedModGenerator2.5 (autosave function)

                      For mac users, I just wrote a Ruby script that generates speedmods.

                      Download and unzip THIS FILE, open up terminal, go to the folder where speedmodgen.rb is located, and type following command:
                      Code:
                      ruby speedmodgen.rb (xmod start) (xmod end) (xmod increment) (cmod start) (cmod end) (cmod increment)
                      
                      <usage example>
                      ruby speedmodgen.rb 1 10 0.25 200 800 20

                      *xmod increment rate should be at least 0.001, and cmod increment rate at least 1

                      Then the script will generate two files: english and metric
                      Open up those files, copy the content, and paste onto appropriate location at english.ini and metric.ini.

                      No fancy GUI or anything, but this script works at least.


                      Here's the source code.

                      Code:
                      if $*.size < 6
                      	puts "Usage: #$0 Xmod_start Xmod_end Xmod_increment Cmod_start Cmod_end Cmod_increment"
                      	exit
                      end
                      
                      xstart, xend, xinc, cstart, cend, cinc = $*.map{|i|i.to_f}
                      
                      if xinc < 0.001
                      	puts "Xmod increment rate should be at least 0.001"
                      	exit
                      end	
                      
                      if cinc < 1
                      	puts "Cmod increment rate should be at least 1"
                      	exit
                      end
                      
                      xnum = [((xend-xstart)/xinc).to_i + 1, 0].max
                      cnum = [((cend-cstart)/cinc).to_i + 1, 0].max
                      xmod = xstart
                      cmod = cstart
                      
                      met = File.open("metric","w")
                      eng = File.open("english","w")
                      
                      met.puts"[ScreenOptionsMaster]"
                      met.puts"# Player options"
                      met.puts"Speed=#{xnum+cnum}"
                      met.puts"SpeedDefault=mod,1x"
                      
                      eng.puts"[OptionNames]"
                      eng.puts"# Menu option entry text"
                      
                      1.upto(xnum) do |i|
                      	mline="Speed,%d=mod,%.3fx;name,x%.3f"%[i,xmod,xmod]
                      	eline="x%.3f=x%.3f"%[xmod,xmod]
                      	met.puts mline.gsub /\.?0+(x|$)/,'\1'
                      	eng.puts eline.gsub /\.?0+(=|$)/,'\1'
                      	xmod += xinc
                      end
                      1.upto(cnum) do |i|
                      	met.puts"Speed,%d=mod,C%d;name,C%d"%[i+xnum,cmod,cmod]
                      	eng.puts"C%d=C%d"%[cmod,cmod]
                      	cmod += cinc
                      end



                      If you are windows user, just use Izzy's program since it's much more convenient to use than this one.
                      Last edited by leonid; 09-21-2009, 01:44 PM.



                      Proud member of Team No

                      Comment

                      • jugglinguy
                        Use me as a porta-potty
                        • Dec 2006
                        • 4319

                        #12
                        Re: SpeedModGenerator2.5 (autosave function)

                        Or if you're on mac, you could always: http://splashbeats.com/

                        No autosave but :P
                        Originally posted by Jem
                        Jem is my name. No one else is the same!

                        You're Aja Leith of the Holograms! You're very exotic, intelligent and sophisticated.

                        Comment

                        • Magic_V2
                          RobMagic
                          • Jun 2006
                          • 638

                          #13
                          Re: SpeedModGenerator2.5 (autosave function)

                          Good job Izzy I'm sure many people will want this.

                          Comment

                          • leonid
                            I am leonid
                            FFR Simfile Author
                            FFR Music Producer
                            • Oct 2008
                            • 8080

                            #14
                            Re: SpeedModGenerator2.5 (autosave function)

                            Originally posted by jugglinguy
                            Or if you're on mac, you could always: http://splashbeats.com/

                            No autosave but :P
                            Damn I'd just use that one
                            Why did I write ruby script lmao



                            Proud member of Team No

                            Comment

                            • Izzy
                              Snek
                              FFR Simfile Author
                              • Jan 2003
                              • 9195

                              #15
                              Re: SpeedModGenerator2.5 (autosave function)

                              Nice one. =)

                              Comment

                              Working...