Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Dev] SMA Editor

Status
Not open for further replies.
Joined
Sep 7, 2010
Messages
431
Reaction score
263
Hi guys, id been away and couldnt release my sma editor. So now, here it is. Its not comlete yet and please let me know any bugs. Beware, there are some :) Using the tool is easy, and if you wanna make a new sma file just copy an existing working one and edit its spawns. Make sure its 256x256 sma file tho (~4mb). Also, dont put stupid values in the editor or your spawns will probably not work.

I want you tho, when making new maps to upload them (and give some description) so that we make a library of working custom maps. This will help a lot the server development in my opinion. When you make something new which youve tested just upload it in this thread.

Known Bugs:
1. Attempting to open a file that doesnt end with .sma throws an exception (just press continue and itll work - the file wont be loaded obviously).

Plans for next version:
1. Some functions to load map images
2. A text-based spawns writer/reader to make easier the process of editing many spawns at once
3. A search function.
4. Better exception handling
5. Better performance (this version loads all spawns in memory, but after all this isnt necessary at all)
6. A drag-and-drop function
7. A preferences menu where you can for instance disable default header checking.
8. A function that generates an empty .sma file (meaning without spawns).

HrxLux deserves some credits for this, i have to admit it. His sma editor ss, even if bragging, was what inspired me.

You may redistribute this, but dont forget to give proper credits.
 

Attachments

You must be registered for see attachments list
Last edited:
Experienced Elementalist
Joined
Nov 30, 2008
Messages
271
Reaction score
0
It works. On most EP 3 ones it says it can't read, either something wrong with it for EP 3 or the EP 3 ones I have have an issue.

What is the window on the right for? It shows weird letters in difference places.
 
Joined
Sep 7, 2010
Messages
431
Reaction score
263
The image shows where the coordinates you put would be in the map (supposing the first byte is for the x axis and the second for the y axis, otherwise the image should be rotated 90 degrees rigth). S stands for starting point and E stands for ending point. About the sma editor inability to load your ep3 files, its probably because they arent in the right format.

The editor must read these:
20 bytes fixed header (look in any ep2 .sma, the first 20 bytes are the header it looks for).
65536 (or 16384 if its for 128x128 map) times the 76 byte long pattern repeated pattern (which is 4980736 bytes for 256x256 or 1245184 bytes for 128x128 maps).
4 bytes which indicate how many spawns are following
60 bytes long spawns (how many spawns it wants depends on the 4 bytes it read before)

I dont know whether the server checks all this stuff but my editor does. If you know c# here is the class deciding whether the file is sma:
Code:
/// <summary>
    /// A class obtaining and containing info concerning sma files.
    /// </summary>
    public class SMAInfo
    {
        public readonly bool isSMA;
        public readonly FileStream fs;
        public readonly int mSize;
        public readonly byte[] Pattern;
        public string fFullPath
        {
            get;
            private set;
        }
        public string fExtension
        {
            get
            {
                return Path.GetExtension(fFullPath);
            }
        }
        public string fName
        {
            get
            {
                return Path.GetFileNameWithoutExtension(fFullPath);
            }
        }
        private int _sCount;
        public int sCount
        {
            get
            {
                return _sCount;
            }
            set
            {
                fs.Lock(mSize - 4, mSize + (value * Default.smaSpawnLength));
                fs.Position = mSize - 4;
                Tools.WriteBigEndian(fs, value);
                _sCount = value;
                fs.SetLength(mSize + (value * Default.smaSpawnLength));
                fs.Unlock(mSize - 4, mSize + (value * Default.smaSpawnLength));
            }
        }
        public SMAInfo(string FilePath)
        {
            isSMA = false;
            if (!FilePath.EndsWith(".sma")) return;
            fFullPath = Path.GetFullPath(FilePath);
            try { fs = File.Open(FilePath, FileMode.Open, FileAccess.ReadWrite); }
            catch (Exception) { return; }
            fs.Lock(0, fs.Length);
            if (fs.Length < ((128 * 128 * Default.smaPatternLength) + Default.smaHeaderLength + 4)) goto Return; //Default.smaPatternLength is 76 in this case
            fs.Position = 0;
            byte[] header = new byte[Default.smaHeaderLength]; //HeaderLength is 20
            fs.Read(header, 0, Default.smaHeaderLength);
            //Removed: if (!header.SequenceEqual<byte>(Default.smaHeader)) goto Return; // Default sma header is the first 20 bytes which can be found in any ep2 .sma file (try the 1001.sma)
            //Pattern = new byte[Default.smaPatternLength];
            //fs.Read(Pattern, 0, Default.smaPatternLength);
            if (fs.Length >= ((256 * 256 * Default.smaPatternLength) + Default.smaHeaderLength + 4)) mSize = ((256 * 256 * Default.smaPatternLength) + Default.smaHeaderLength + 4);
            else if (fs.Length >= ((128 * 128 * Default.smaPatternLength) + Default.smaHeaderLength + 4))  mSize = ((128 * 128 * Default.smaPatternLength) + Default.smaHeaderLength + 4);
            else goto Return;
            fs.Position = mSize - 4;
            _sCount = Tools.ReadBigEndian32(fs);
            if (((_sCount * Default.smaSpawnLength) + mSize) != fs.Length) goto Return;
            isSMA = true; //Only if this command is executed will the sma file be loaded
        Return: // Return Code
            fs.Unlock(0, fs.Length);
            return;
        }
    }

Would you mind sending me the files to examine them ? If they are made by a masangish tool or are from a masangish server then ill edit the editor to read them. I just supposed ep2 and ep3 sma files have the same format (and thats how it should be like).

I hope this helps.
 
Last edited:
Experienced Elementalist
Joined
Nov 30, 2008
Messages
271
Reaction score
0
 
Junior Spellweaver
Joined
Jan 19, 2011
Messages
130
Reaction score
26
Apparently it doesnt work with ep3.3 sma's , checked all my sma's and all of ep3.3 ones throws me "invalid file format or reading the file", also some of ep3.2 wich were updated doesnt werk either.
 
Last edited:
Joined
Sep 7, 2010
Messages
431
Reaction score
263
Just like i suspected it, the smas have a different header (first 3bytes differ only). So i assume depending on the sma tool you use the header may differ. Im gonna disable the header checking and it should work with everything. Note: the image displays the spawns coordinates rotated by 90 degrees. Looks like masang write (y,x) instead of (x,y) but nvm. Also i have the impression boss spawn times are counted in mins whereas normal are in secs.

Just noticed that adding icons was like adding 200kb (uncompressed) !!! But its not much anyway.

Refer to post #1
 
Last edited:
Junior Spellweaver
Joined
Jan 19, 2011
Messages
130
Reaction score
26
Just like i suspected it, the smas have a different header (first 3bytes differ only). So i assume depending on the sma tool you use the header may differ. Im gonna disable the header checking and it should work with everything. Note: the image displays the spawns coordinates rotated by 90 degrees. Looks like masang write (y,x) instead of (x,y) but nvm. Also i have the impression boss spawn times are counted in mins whereas normal are in secs.

Just noticed that adding icons was like adding 200kb (uncompressed) !!! But its not much anyway.

Updated:

Cute one , ill check that in a a sec also didnt you saw that koreans do everything in different way they are koreans at the end :p


Edit:

werks awsome job . (till i find other "bug" :D lol )
 
Last edited:
Initiate Mage
Joined
Dec 29, 2010
Messages
3
Reaction score
0
Just like i suspected it, the smas have a different header (first 3bytes differ only). So i assume depending on the sma tool you use the header may differ. Im gonna disable the header checking and it should work with everything. Note: the image displays the spawns coordinates rotated by 90 degrees. Looks like masang write (y,x) instead of (x,y) but nvm. Also i have the impression boss spawn times are counted in mins whereas normal are in secs.

Just noticed that adding icons was like adding 200kb (uncompressed) !!! But its not much anyway.

Updated:
PanKJ check the archive of the SMA editor 'cause is broken :w00t:
 
Joined
Sep 7, 2010
Messages
431
Reaction score
263
It does work. But when you opened the rar you probably didnt read the comment : "PASS = my forum name". Anyway now posting a newer edition that loads the localization.

Refer to post #1.
 
Last edited:
Initiate Mage
Joined
Dec 29, 2010
Messages
3
Reaction score
0
Thx for the tip but the archive is broken.

We read all the posts :blushing:, we downloaded it 2 times but it give the same error by dezipping.

TY for check
 
Joined
Sep 7, 2010
Messages
431
Reaction score
263
You used win-rar to extract it? Cause i just downloaded it and it works fine. Maybe you should try another directory?

PS: if you already have an existing file with the same name in the folder you try to extract it might not work (ive had this problem once).

If the problem persists post a ss.
 
Last edited:
Initiate Mage
Joined
Dec 29, 2010
Messages
3
Reaction score
0
I tryed with Winrar 7zip and IZarc, same problem. Extract succesfull but if I try to launch the exe write me the same problem.
 
Newbie Spellweaver
Joined
Apr 17, 2011
Messages
33
Reaction score
2
My Computer has. Net 4 installed, but the program doesnt start, too.
Tomorrow I can post the correct error.
 
Newbie Spellweaver
Joined
Apr 17, 2011
Messages
33
Reaction score
2
Sorry, I forgot to repost.
No, it does not work. I uninstalled .net 4 and reinstalled it, no effect.
Error: (Need to translate, so not the original error)
SMA Editor has a problem and must be closed.
If you didn't save you work, datas of this could be lost.
Inform Microsofrt about this Problem
...
...
...
 
Status
Not open for further replies.
Back
Top