-
Creating your own file extension?
How do you make your own file extension that can be read directly by a specific application that you made.
I am just curious to see how it is done.
Like .psd is for photoshop
What if I wanted to make a .fbs file for example and have my program be able to open this file.
-
Re: Creating your own file extension?
when you save it, save it as filename.psd or filename.fbs
then when you load whatever you are going to load, tell mmf2 to look for that specific extension
-
Re: Creating your own file extension?
Use my Power System Object to register the extension on the system. You can then use the command line of your application to tell what FBS file opened it.
-
Re: Creating your own file extension?
IMO, just because you save a filename extension what you want does not mean it can be read by another application. Save a text file as a bmp, but Paint Shop can not read it. The format of the file must be readable by the application.
Marv
-
Re: Creating your own file extension?
he is just trying to use it for HIS application
if i am understanding the question correctly
-
Re: Creating your own file extension?
Quote:
Originally Posted by Jaffob
Use my Power System Object to register the extension on the system. You can then use the command line of your application to tell what FBS file opened it.
This is the best way to achieve what you want.
stephen1980
-
Re: Creating your own file extension?
I remember a long time ago, I was called an idiot for trying to create my own file formats, simply because I was accused of not knowing that the extension really means nothing. Like mentioned above, the extension wont change the format of the file. In fact if you saved a Bitmap as a Text file and opened the text file in Paint somehow, the picture would still show perfectly fine... in theory. However, again like mentioned above, the philosophy as to why anyone would want to create a file extension, and in all honesty the entire point behind them anymore, is merely to allow a quick call up of the application that can properly recognize the file itself. So if you create a game with a level editor, and you want your level editor to save array files with your own file extension, don't listen to anyone who tells you it's a stupid idea. It gives you the power to set up that persons computer so that if they double click on any file with that unique file extension, it can automatically run your level editor and open the level.
Sorry, nothing I said above is unique even to this own post. I just needed to put my own two cents in, along with the back story as to why. xD
-
Re: Creating your own file extension?
:D i would say your two cents became $2,000,000,000,000
-
Re: Creating your own file extension?
What you say BrandonC is true within the confines of MMF. But in broader terms I don't think it works that way. The odd file extension must be in the format of the application. Of course this could be my gray matter failing me again. MikeB., experimentation is the best solution for your question.
Marv
-
Re: Creating your own file extension?
Wow, I come back and I stir up some heated answers, haha. Hey Jaffob, the power system object rocks!
Thanks for the info guys.
-
Re: Creating your own file extension?
Quote:
Originally Posted by nivram
But in broader terms I don't think it works that way. The odd file extension must be in the format of the application.
That doesn't seem logical. Probably the program is then programmed to not open any other files than those with the correct extension. The file extension doesn't change the content of the file at all, or how it is read by the program, unless it is programmed otherwise.
-
Re: Creating your own file extension?
You can name any file whatever you like, but unless if you have a .fbs file and it simply is a renamed ini file, well there will be a high number of people who will open it and mess around with the values.
If you are using your own file extension, then you should make sure that it is only readable by your application. Encrypt it so nothing else can read it and then your program will decrypt it upon loading it. This is how I do my own files.
-
Re: Creating your own file extension?
Well I see no reason to overcomplicate this using extensions and whatnot, UNLESS you want to register the file format on a user's computer so that it launches your app when double clicking on the file.
However, if all you want to do is create save game files or store data into a format, you can just use the ini or array objects and just specify a different file extension. For instance, if you don't want people accidentally mucking around in your ini files, you can rename it something like "game.sav" and have your app retrieve it through events. If you just use .ini as the extension, then that will automatically open up in notepad for them to edit. But... keep in mind, that if it is still just a basic text file, they can still open up notepad, and choose to open the file and load it for editing. So even if you use a custom file extension, you'll still need to encrypt it if you want to hide the details from the user.
Another thing to consider is that if you are using the extension .ini for your file, that is traditionally settings for a program that a user can manually edit. For instance, in my current game project, I am using a .ini file to store the keybinds for the controls, whether the game should load fullscreen or windowed mode, etc. (of course these settings are selected in an options screen then saved to the .ini). I am not going to encrypt that, since these are basic settings the user can alter manually if they want, even though they can just change it in the options screen. For the save data though, I am most likely going to save that using an array and encrypting it. I plan on just naming the file something like "game1.sav" for instance. I have no reason to register this file format with the user's computer, because I am not having it load into something like a level editor. It's just save progress, scores, items collected, etc.
Edit - I'd even go so far as to say it's just plain bad coding and intrusive on the end user's computer to just start registering file extensions to be associated with your app if you don't have a real need to do so. For instance, I've seen some isometric games that store the level data in .iso format. That is also the file extension for iso disc images for cd burning programs. If you registered the .iso format to be associated with your game, you just then removed it from being associated with the end user's cd burning app. So if you have a need for having files load your app, please take care with what file extensions you are using. Even if you think a file extension you want to use isn't a common one, there are countless applications and games out there that might be using that, and you don't want to go messing around on an end user's computer for no real reason. What might seem like a convenience to you, might actually be an annoyance to the end user.
-
Re: Creating your own file extension?
I don't have time to read this entire debate, but I myself have found it works to change an extension in windows (eg txt to html) and completely change the file type...
I don't think the file extension does this though
-
Re: Creating your own file extension?
Quote:
Originally Posted by RickyRombo
I don't have time to read this entire debate, but I myself have found it works to change an extension in windows (eg txt to html) and completely change the file type...
I don't think the file extension does this though
Well that works because the user's computer already has those file types associated with a program. So while a .txt file will open Notepad, .html files will be associated with either Firefox, Internet Explorer, or whatever their default browser is. So, in that case, renaming the file extension just changes what program will open it. Both .txt and .html files are just basic text files.
-
Re: Creating your own file extension?
File extensions are NOT designed to be a security measure. The only reason files turn up as corrupt in other programs like Notepad is not because they're securely encrypted, but because the file is formatted in a way that is rather complex, for a number of reasons. If it's just storing information, then security might be one of these, but on the other end, it might have to do with a number of other reasons too.
If you're trying to create a save file, then by all means encrypt it, but if you're just doing something like a level editor, there’s no real reason I can see that would make you want to encrypt it. If someone wants to make a third party editor for your game, more power to them. They'll have some work ahead of them though if they intend to make an editor that's capable of reading your file, much less create their own.
This is true for most things, even outside of MMF2. I've opened up my fair share of formats in Notepad and be very surprised at the ease of which it could be edited.
Notepad wins simply because it's extreme simplicity. xD
-
Re: Creating your own file extension?
Quote:
Originally Posted by BrandonC
If you're trying to create a save file, then by all means encrypt it, but if you're just doing something like a level editor, there’s no real reason I can see that would make you want to encrypt it. If someone wants to make a third party editor for your game, more power to them. They'll have some work ahead of them though if they intend to make an editor that's capable of reading your file, much less create their own.
I agree with that. For level editors/level loading, I don't see a reason why you'd really want to encrypt that. If they want to edit it themselves, then by all means let them.
-
Re: Creating your own file extension?
Quote:
Originally Posted by Shawn
I'd even go so far as to say it's just plain bad coding and intrusive on the end user's computer to just start registering file extensions to be associated with your app if you don't have a real need to do so. For instance, I've seen some isometric games that store the level data in .iso format. That is also the file extension for iso disc images for cd burning programs. If you registered the .iso format to be associated with your game, you just then removed it from being associated with the end user's cd burning app. So if you have a need for having files load your app, please take care with what file extensions you are using. Even if you think a file extension you want to use isn't a common one, there are countless applications and games out there that might be using that, and you don't want to go messing around on an end user's computer for no real reason. What might seem like a convenience to you, might actually be an annoyance to the end user.
I agree. This has happened to me before with programs registering extensions to suit their own needs. Very Intrusive and annoying.
stephen1980
-
Re: Creating your own file extension?
That's why it's nice to have something like an installer or even an option that actually makes sure the user running the game or application, wants to change the file extension. It's not any sort of requirement, and you're not doing harm by not asking, but it would benifit the end user a lot more, and make them less likely to turn against anything you make in the future.
-
Re: Creating your own file extension?
I haven't had the chance to test this yet but does the Power System Object allow custom extensions that you can double click to open and run? I know most apps do this so im guessing you can also in MMF?
Also this one might not be possible but some graphics apps allow a registry thing so you can see previews of the project files just like normal images but for the custom format. Could MMF allow to do this some way?
-
Re: Creating your own file extension?
Quote:
Originally Posted by BrandonC
That's why it's nice to have something like an installer or even an option that actually makes sure the user running the game or application, wants to change the file extension. It's not any sort of requirement, and you're not doing harm by not asking, but it would benifit the end user a lot more, and make them less likely to turn against anything you make in the future.
Yeah definitely always include some sort of dialog whether it's an installer or whatever you use asking for a user's permission to do something that would alter their computer or file associations.
-
Re: Creating your own file extension?
Quote:
Originally Posted by Atom
I haven't had the chance to test this yet but does the Power System Object allow custom extensions that you can double click to open and run? I know most apps do this so im guessing you can also in MMF?
Also this one might not be possible but some graphics apps allow a registry thing so you can see previews of the project files just like normal images but for the custom format. Could MMF allow to do this some way?
The YASO object allows you to set an application association with a file extension, and what EXE (Executable file) it opens. If you use this in conjunction with $AppPath to find your game's EXE file, then you can make it so that when you open this file outside of your game, it'll automatically open your game.
I did this in the past, but I can't find the source code for the game I did it to, but I think it has to do with the command line or "files dropped", both of which are under the special condition, then you can use that to make the game automatically go to where it needs to be to load the file, and then actually load the file. I'll get back to on that though.
-
Re: Creating your own file extension?
Quote:
Originally Posted by BrandonC
Quote:
Originally Posted by Atom
I haven't had the chance to test this yet but does the Power System Object allow custom extensions that you can double click to open and run? I know most apps do this so im guessing you can also in MMF?
Also this one might not be possible but some graphics apps allow a registry thing so you can see previews of the project files just like normal images but for the custom format. Could MMF allow to do this some way?
The YASO object allows you to set an application association with a file extension, and what EXE (Executable file) it opens. If you use this in conjunction with $AppPath to find your game's EXE file, then you can make it so that when you open this file outside of your game, it'll automatically open your game.
I did this in the past, but I can't find the source code for the game I did it to, but I think it has to do with the command line or "files dropped", both of which are under the special condition, then you can use that to make the game automatically go to where it needs to be to load the file, and then actually load the file. I'll get back to on that though.
Use the PSO for file extensions. It has a lot more features. You can also parse the command line of your application to find out what file opened it.
-
Re: Creating your own file extension?
I thought your extension would probably be able to do it Jaffob, would it be possible to add a example for this to the Power System Object examples? thanks
-
Re: Creating your own file extension?
Quote:
Originally Posted by Shawn
Quote:
Originally Posted by RickyRombo
I don't have time to read this entire debate, but I myself have found it works to change an extension in windows (eg txt to html) and completely change the file type...
I don't think the file extension does this though
Well that works because the user's computer already has those file types associated with a program. So while a .txt file will open Notepad, .html files will be associated with either Firefox, Internet Explorer, or whatever their default browser is. So, in that case, renaming the file extension just changes what program will open it. Both .txt and .html files are just basic text files.
But if I select "Open with FireFox" it just shows the text file, it doesn't matter if it has an <html> header or anything. It has to be an html to be read as an html (at least on my computer :confused: )
-
Re: Creating your own file extension?
Quote:
Originally Posted by BrandonC
Quote:
Originally Posted by Atom
I haven't had the chance to test this yet but does the Power System Object allow custom extensions that you can double click to open and run? I know most apps do this so im guessing you can also in MMF?
Also this one might not be possible but some graphics apps allow a registry thing so you can see previews of the project files just like normal images but for the custom format. Could MMF allow to do this some way?
The YASO object allows you to set an application association with a file extension, and what EXE (Executable file) it opens. If you use this in conjunction with $AppPath to find your game's EXE file, then you can make it so that when you open this file outside of your game, it'll automatically open your game.
I did this in the past, but I can't find the source code for the game I did it to, but I think it has to do with the command line or "files dropped", both of which are under the special condition, then you can use that to make the game automatically go to where it needs to be to load the file, and then actually load the file. I'll get back to on that though.
I didn't know the YASO object could do that, that is a real benefit. So let's say I made my own "Word" application, and create a .dox file, I can have it where if the user clicks a .dox file it will associate with my application only?
That is something I could use for another app.
-
Re: Creating your own file extension?
Quote:
Originally Posted by RickyRombo
Quote:
Originally Posted by Shawn
Quote:
Originally Posted by RickyRombo
I don't have time to read this entire debate, but I myself have found it works to change an extension in windows (eg txt to html) and completely change the file type...
I don't think the file extension does this though
Well that works because the user's computer already has those file types associated with a program. So while a .txt file will open Notepad, .html files will be associated with either Firefox, Internet Explorer, or whatever their default browser is. So, in that case, renaming the file extension just changes what program will open it. Both .txt and .html files are just basic text files.
But if I select "Open with FireFox" it just shows the text file, it doesn't matter if it has an <html> header or anything. It has to be an html to be read as an html (at least on my computer :confused: )
Well yes, for firefox to load it, it has to have the file extension .html. But an html file is just a regular text file. Doesn't matter what you code it in as long as it's plain text and saved as .html. So .txt isn't going to load as a web page obviously. But that's what I was saying, all you're doing is renaming the file extension of a plain text file to be loaded by the program associated with that particular file extension.
In other words, a web browser just parses a text file (or html file) and uses the HTML code to tell it what to display. Yes, the file has to have the .html extension, but that just tells the web browser how to handle the file in question.
-
Re: Creating your own file extension?
Ah, I misunderstood! :)
Sorry bout that. Hate it when people misunderstand me lol! :D
-
Re: Creating your own file extension?
Quote:
Originally Posted by RickyRombo
Ah, I misunderstood! :)
Sorry bout that. Hate it when people misunderstand me lol! :D
lol no problem. Sometimes things can be misunderstood when we start talking about technical things lol. I probably didn't word what I was trying to say well anyway.
-
Re: Creating your own file extension?
Jaffob, how would I use your PSO object? It the examples don't even work for me (first frame) and I really got interested in this :) lol!
EDIT: Never mind. I think it must be since I don't have devoloper it associates the files with MMF2?
-
Re: Creating your own file extension?
PSO has options for extensions and associations. The "Create/Setup File Type" action will register a file extension on the system. This action is where you give your file extension an icon and a description. You can then add associations (such as "Open" or "Open with Firefox"). Here is where you enter the program to open the extension with.
Hope that helps.
-
Re: Creating your own file extension?
Ok I think I got it - I just need to set the default program now in the Windows Explorer - but how to open the file? eg. a text file to edit box?
-
Re: Creating your own file extension?
You do this using the CommandLine$ expression. The result will contain the path to the file that opened it. For example, say you associate TXT files with your application. Then this association in C:\Folder\myfile.txt is selected. Your application opens. The command line then contains that file path, which you can use to load the file.
I hope that made sense. :)
-
Re: Creating your own file extension?
That gives me "C:\Users\Owner\AppData\Local\Temp\mrt3F31.tmp\std rt.exe"
Never mind i think i got it. But how do I encrypt a text file with the blowfish object, and open it and decrypt it?
-
Re: Creating your own file extension?
Not when another file runs it. Create a simple application with a string. At the start of the frame, set the string to CommandLine$. Build the application.
If you drop any file into the built application, you should see the file's path when your app opens.
-
Re: Creating your own file extension?
How do I use the blowfish object and keep the file type and use it and whatever? I set the key, I encrypted it, now how do i open it?
Wait - There's this: "C:\Users\Owner\AppData\Local\Temp\mrt8CC5.tmp\std rt.exe" "C:\Users\Owner\Documents\MMF2 Files\New Folder\jinglebombs2.txt"
Instead of this:
"C:\Users\Owner\Documents\MMF2 Files\New Folder\jinglebombs2.txt"
How to get rid of?
That all fix! String Parser, But how do you decrypt the string??? It just shows whatever I put in the second parameter for Set Text : DecryptString$( "Blowfish Object", "ricky", Edittext$( "Edit Box" ))How do I use the blowfish object and keep the file type and use it and whatever? I set the key, I encrypted it, now how do i open it?
Wait - There's this: "C:\Users\Owner\AppData\Local\Temp\mrt8CC5.tmp\std rt.exe" "C:\Users\Owner\Documents\MMF2 Files\New Folder\jinglebombs2.txt"
Instead of this:
"C:\Users\Owner\Documents\MMF2 Files\New Folder\jinglebombs2.txt"
How to get rid of?
That all fix! String Parser, But how do you decrypt the string??? It just shows whatever I put in the second parameter for Set Text : DecryptString$( "Blowfish Object", "ricky", Edittext$( "Edit Box" ))
Fixed - I accidently deleted add key event :blush: