Old 07-18-2013, 10:34 PM   #21
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default 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 at 10:47 PM..
Fission is offline   Reply With Quote
Old 07-18-2013, 10:42 PM   #22
TC_Halogen
Rhythm game specialist.
Simfile JudgeFFR Simfile AuthorFFR Music ProducerD8 Godly KeysmasherFFR Veteran
 
TC_Halogen's Avatar
 
Join Date: Feb 2008
Location: Bel Air, Maryland
Age: 29
Posts: 18,849
Send a message via AIM to TC_Halogen Send a message via Skype™ to TC_Halogen
Default Re: .sm to .dwi converter

Quote:
Originally Posted by Fission View Post
for those who are interested, here is a pastebin of the source:

http://pastebin.com/MHJtWLXA

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.
TC_Halogen is offline   Reply With Quote
Old 07-18-2013, 11:20 PM   #23
sticklydude
r.i.p. tiny hippo
FFR Simfile AuthorFFR Veteran
 
sticklydude's Avatar
 
Join Date: Jan 2007
Location: far away from you, FL
Age: 27
Posts: 2,165
Send a message via Skype™ to sticklydude
Default Re: .sm to .dwi converter

This is excellent. The .dwi format has never made sense to me. Keep it up 8)
sticklydude is offline   Reply With Quote
Old 07-19-2013, 06:29 AM   #24
Zaevod
FFR Player
 
Zaevod's Avatar
 
Join Date: Apr 2013
Age: 29
Posts: 385
Default Re: .sm to .dwi converter

Awesome! I was actually thinking about making one myself.
Zaevod is offline   Reply With Quote
Old 07-19-2013, 01:16 PM   #25
Silvuh
quit
Retired StaffFFR Simfile AuthorFFR Music ProducerFFR Veteran
 
Silvuh's Avatar
 
Join Date: Apr 2005
Location: anywhere but here
Posts: 938
Default Re: .sm to .dwi converter

Quote:
Originally Posted by Fission View Post
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:
http://www.mediafire.com/download/kk.../batchdwi2.zip

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 at 03:53 PM..
Silvuh is offline   Reply With Quote
Old 07-19-2013, 01:55 PM   #26
Choofers
FFR Player
 
Join Date: Dec 2008
Age: 30
Posts: 6,205
Default 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?
__________________
Choofers is offline   Reply With Quote
Old 07-19-2013, 02:05 PM   #27
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

Quote:
Originally Posted by Silvuh View Post
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.

Quote:
Originally Posted by Silvuh View Post
... And I don't know how to search directories and files and stuff in Lua
http://keplerproject.github.io/luafilesystem/

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.
Fission is offline   Reply With Quote
Old 07-19-2013, 05:32 PM   #28
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default 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 at 05:41 AM..
Fission is offline   Reply With Quote
Old 08-4-2013, 05:41 AM   #29
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default 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.
Fission is offline   Reply With Quote
Old 08-4-2013, 07:57 AM   #30
Wayward Vagabond
Confirmed Heartbreaker
FFR Simfile AuthorFFR Veteran
 
Wayward Vagabond's Avatar
 
Join Date: Jul 2012
Age: 32
Posts: 5,721
Default Re: .sm to .dwi converter

i'll be waiting for that .exe
__________________
Wayward Vagabond is offline   Reply With Quote
Old 08-4-2013, 02:44 PM   #31
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

updated op with standalone executable. i haven't ran this through a very extensive battery of tests, but please let me know right away if it doesn't convert a file with no holds, mines, etc. properly.

Last edited by Fission; 08-4-2013 at 02:46 PM..
Fission is offline   Reply With Quote
Old 08-4-2013, 04:03 PM   #32
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

discovered a bug thanks to tosh

"—" in filenames will cause the converter to crash on certain language locales. i suspect there are more characters that will cause this behavior. i will look for a solution later.
Fission is offline   Reply With Quote
Old 08-5-2013, 01:21 AM   #33
Choofers
FFR Player
 
Join Date: Dec 2008
Age: 30
Posts: 6,205
Default Re: .sm to .dwi converter

I can't think of why that would cause a crash... is that a standard ascii character?
__________________
Choofers is offline   Reply With Quote
Old 08-5-2013, 01:38 AM   #34
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

you raise a good point. it is a standard ascii character, so i'm confused as to why it's even an issue if that's the case.

maybe all of the appropriate windows updates aren't applied? not sure right now. will think on it some more.
Fission is offline   Reply With Quote
Old 08-5-2013, 04:57 PM   #35
Choofers
FFR Player
 
Join Date: Dec 2008
Age: 30
Posts: 6,205
Default Re: .sm to .dwi converter

edit: https://en.wikipedia.org/wiki/Extended_ASCII

tosh, try converting an sm file with any character above 127 on this table
http://www.ascii-code.com/
__________________

Last edited by Choofers; 08-5-2013 at 05:06 PM..
Choofers is offline   Reply With Quote
Old 08-9-2013, 02:20 AM   #36
tosh
My Name is Boobs
FFR Veteran
 
tosh's Avatar
 
Join Date: Jul 2003
Location: Virginia
Age: 29
Posts: 911
Default Re: .sm to .dwi converter

Quote:
Originally Posted by Choofers View Post
edit: https://en.wikipedia.org/wiki/Extended_ASCII

tosh, try converting an sm file with any character above 127 on this table
http://www.ascii-code.com/
Just noticed this.

I've only tried a few, but most of them didn't work. Some of the ones that worked were , , and . I'm running on a Japanese locale, so I'm kinda surprised didn't work.
tosh is offline   Reply With Quote
Old 08-9-2013, 11:06 AM   #37
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

i am not 100% certain, but i think i discovered the cause of this.

lua doesn't support UTF by default. on a japanese locale, for instance, the characters you are having trouble with aren't in the ascii set of characters, so they need to use UTF. i found a fix for this, and will work on it tonight.
Fission is offline   Reply With Quote
Old 08-19-2013, 10:17 PM   #38
rCaliberGX
D7 Elite Keymasher
FFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
rCaliberGX's Avatar
 
Join Date: Jun 2012
Location: Ontario, Canada
Posts: 2,336
Default Re: .sm to .dwi converter

yeah sorry for putting it in the batch thread

so when i put it in the same folder and run, the converter opens and closes in an instant but there's no output.

edit: nvm i found why it didn't show. my sm installation is in program files, and output is in the compatibility files section. it has to be run in administrator mode for output to be in the song folder.
rCaliberGX is offline   Reply With Quote
Old 08-19-2013, 10:20 PM   #39
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

phew. glad you figured it out :D.

i'll add a note about that to the OP in case anybody else runs into that pitfall. thanks for discovering that. guess that's something else i should investigate; i don't think i'll be able to find a work-around for that though.

Last edited by Fission; 08-19-2013 at 10:31 PM..
Fission is offline   Reply With Quote
Old 08-26-2013, 12:03 PM   #40
Fission
Banned
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Join Date: Jan 2004
Age: 30
Posts: 1,778
Send a message via Skype™ to Fission
Default Re: .sm to .dwi converter

i'm planning on completely writing the entire script using the penlight lua libraries. in particular, most of the .sm file parsing will be done in the method described in http://stevedonovan.github.io/Penlig...guration_Files. i have spent a lot of time writing my own file parsing when most of the work was already done for me, so i'm just going to use it.

this is going to allow me to convert between .dwi and .sm formats a lot easier so i can write a converter that goes the other direction (.dwi -> .sm) and will allow the converter to be configurable with a configuration file.

also, i created a gist for this script that i'll update the op with when i'm at home so i can give real-time updates as to what i'm doing.

Last edited by Fission; 08-26-2013 at 12:06 PM..
Fission is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 12:47 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution