.sm to .dwi converter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Silvuh
    quit
    FFR Simfile Author
    FFR Music Producer
    • Apr 2005
    • 938

    #16
    Re: .sm to .dwi converter

    So I'd actually be doing something with my time, I started going through some lessons in Ruby a few days ago. The first original script I made was to count left- and right-hand arrows in a simfile to check global bias.

    Then I saw your Lua script and found it interesting how nice all the stuff with the tables and fields look. I'm wondering, though, what does the most recent version of your script look like? I'd like to see how you fixed the latest version you've linked to.

    Arf, but, so I thought I'd try to make one in Ruby ... I've worked a couple days, and here's where I am.

    It looks really chunky, some of the stuff I did is convoluted, I didn't put comments to say what any of the weird stuff does, (and it certainly doesn't look as nice as yours) ... but it's worked for the .sm, .ds, and .ssc files I've tried ... as long as they have only one difficulty and only tap steps. This will only be used for files for FFR, so I didn't try to do anything more.

    The code:
    Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.


    The executable:
    MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.


    Throw dwi.exe into the folder with the file you wish to convert, double-click/run it, and watch a .dwi file magically appear out of nowhere.
    I'm sooo not like trying to "steal your thunder" or however you say it, so I'm sorry if this irks you like even the slightest bit, me just doing this after you've been working so hard and you know and sorry and uwrawrf
    EDIT: I realized the script had a mistake in it like three weeks ago (used ' instead of ` for opening 192nds) but didn't bother to fix it for this, because like one person downloaded it when I posted it, and I didn't think anyone else would. But I saw it got a second download, so I just uploaded a fix. The batchdwi executable in my second post has already been fixed.
    Last edited by Silvuh; 08-18-2013, 03:34 PM.

    Comment

    • Xiz
      TWG Chaos
      FFR Simfile Author
      • Feb 2012
      • 3399

      #17
      Re: .sm to .dwi converter

      Not sure how I can help, but if you do need any let me know.

      You are a champ for taking this on.

      Comment

      • Charu
        Snivy! Dohoho!
        FFR Simfile Author
        • Mar 2006
        • 6207

        #18
        Re: .sm to .dwi converter

        Hey, thanks to the both of ya. I can see how this could help for steppers who don't use 3.9.


        Originally posted by JohnRedWolf87
        Charu the red-nosed Snivy
        Had a very shiny nose
        And if you ever saw it
        You could even say it glows

        All of the other Snivies
        Used to laugh and call him names
        They never let poor Charu
        Join in any Snivy games

        (Click the arrow to see the rest)


        Originally posted by Vendetta21
        All in all I would say that Charu not only won this game, his play made me reconsider how I play it.

        Comment

        • Fission
          no
          FFR Simfile Author
          • Jan 2004
          • 1850

          #19
          Re: .sm to .dwi converter

          for those who are interested, here is a pastebin of the source:

          Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.


          some things might be a little sloppy, and i'll work on improving them later. i just wanted to write something that works for now.

          this will successfully convert a file named "test.sm" to "test.dwi". this assumes, like silvuh's script, no holds, mines, etc.

          i have yet to implement directory searching. going to work on that soon. after that, i'm going to add recursive conversion from a root directory to convert a whole bunch of files at once. that way, everybody can send .sm files to batches instead of having to convert to .dwis
          Last edited by Fission; 07-18-2013, 09:32 PM.

          Comment

          • Xiz
            TWG Chaos
            FFR Simfile Author
            • Feb 2012
            • 3399

            #20
            Re: .sm to .dwi converter

            Requesting sticky

            Comment

            • Fission
              no
              FFR Simfile Author
              • Jan 2004
              • 1850

              #21
              Re: .sm to .dwi converter

              haha, it's not quite done yet. it will work if you have lua installed on your pc, but i really want to make this a standalone executable.

              going to edit the op with what i have so far in terms of code from now on and my future direction.
              Last edited by Fission; 07-18-2013, 09:47 PM.

              Comment

              • TC_Halogen
                Rhythm game specialist.
                FFR Simfile Author
                FFR Music Producer
                • Feb 2008
                • 19376

                #22
                Re: .sm to .dwi converter

                Originally posted by Fission
                for those who are interested, here is a pastebin of the source:

                Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.


                some things might be a little sloppy, and i'll work on improving them later. i just wanted to write something that works for now.

                this will successfully convert a file named "test.sm" to "test.dwi". this assumes, like silvuh's script, no holds, mines, etc.

                i have yet to implement directory searching. going to work on that soon. after that, i'm going to add recursive conversion from a root directory to convert a whole bunch of files at once. that way, everybody can send .sm files to batches instead of having to convert to .dwis
                I love you.

                Comment

                • sticklydude
                  r.i.p. tiny hippo
                  FFR Simfile Author
                  • Jan 2007
                  • 2165

                  #23
                  Re: .sm to .dwi converter

                  This is excellent. The .dwi format has never made sense to me. Keep it up 8)

                  Comment

                  • Zaevod
                    FFR Player
                    • Apr 2013
                    • 385

                    #24
                    Re: .sm to .dwi converter

                    Awesome! I was actually thinking about making one myself.
                    https://soundcloud.com/zaevod/the-glimpse

                    Comment

                    • Silvuh
                      quit
                      FFR Simfile Author
                      FFR Music Producer
                      • Apr 2005
                      • 938

                      #25
                      Re: .sm to .dwi converter

                      Originally posted by Fission
                      i'm going to add recursive conversion from a root directory to convert a whole bunch of files at once. that way, everybody can send .sm files to batches instead of having to convert to .dwis
                      Ohh, I didn't even think about that! Yeah, it would definitely be more convenient to be able to convert all batch files at once than having to make everyone convert their own files before sending them in.

                      I added the following lines to my script: ("..." is where all the old scripty stuff goes)
                      Code:
                      Dir.glob("**").each do |folder|
                          next if folder =~ /.*\..{1,2}[^\)]$/
                          Dir.chdir(folder)
                      ...
                          Dir.chdir("..")
                      end
                      These lines makes the old script loop through each folder in the directory ... so it now works for batches if you put the .exe in the song superfolder.

                      Here's the new executable:
                      MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.


                      Extra notes: It only searches one directory down. The "next if" line is so the script skips any file with any two- or three-character extension without skipping anything ending with ")" (as all files in the batch should; it won't confuse a file with stepartist "asdfk.as" as not being a directory.) Without this line, the script would break when it tries to enter "batchdwi.exe".

                      I don't know how to make the executable show a pop-up if it catches something that FFR doesn't support in a file, but that should be something the stepartist should check before sending the file in.

                      ... And I don't know how to search directories and files and stuff in Lua, but here's an explanation of what I did in Ruby in case it helps:
                      Code:
                      filearray = Dir.glob("*.{sm,ds,ssc}")
                      simfile = open(filearray[0]).read()
                      dwifile = File.new("#{filearray[0].sub(/\..+/, "")}.dwi", 'w')
                      This Dir.glob expression saves the file name of every .sm, .ds, and .ssc file in the folder into an array. The next line opens the first entry in the array and reads it (so it will read a .ds file if no .sm is present and only read one file). The next line creates the .dwi file, naming it by substituting the file extension of the simfile with nothing and sticking ".dwi" onto it.
                      Last edited by Silvuh; 07-26-2013, 02:53 PM.

                      Comment

                      • Choofers
                        FFR Player
                        FFR Music Producer
                        • Dec 2008
                        • 6205

                        #26
                        Re: .sm to .dwi converter

                        if I remember VB, I'd convert this to a standalone but the only thing I'm working with is powershell lol

                        can you package powershell scripts?

                        Comment

                        • Fission
                          no
                          FFR Simfile Author
                          • Jan 2004
                          • 1850

                          #27
                          Re: .sm to .dwi converter

                          Originally posted by Silvuh
                          I don't know how to make the executable show a pop-up if it catches something that FFR doesn't support in a file, but that should be something the stepartist should check before sending the file in.
                          i'm not really worried about this yet. in terms of lua, my approach is probably going to be something along the lines of returning data about the conversion process in a lua table to c and using c to handle said data.

                          Originally posted by Silvuh
                          ... And I don't know how to search directories and files and stuff in Lua


                          lua doesn't offer as extensive of a file io library as ruby because it is designed to only include what is maximally portable. luafilesystem isn't quite as portable as the base io libraries, so that's why it isn't included in the standard lua libraries. it will offer all of the functionality i need, though.

                          Comment

                          • Fission
                            no
                            FFR Simfile Author
                            • Jan 2004
                            • 1850

                            #28
                            Re: .sm to .dwi converter

                            updated op. removed some silly unnecessary code and cleaned up some of the structure. going to work on compiling luafilesystem into a c library in the near future.
                            Last edited by Fission; 08-4-2013, 04:41 AM.

                            Comment

                            • Fission
                              no
                              FFR Simfile Author
                              • Jan 2004
                              • 1850

                              #29
                              Re: .sm to .dwi converter

                              updated op with new version of the script. recursive searching and converting should work now. going to work on getting a standalone executable out now.

                              Comment

                              • Wayward Vagabond
                                Confirmed Heartbreaker
                                FFR Simfile Author
                                • Jul 2012
                                • 5866

                                #30
                                Re: .sm to .dwi converter

                                i'll be waiting for that .exe

                                Comment

                                Working...