Jump to content

Editing textures when they are .MBM files


Recommended Posts

Thanks for all your help, but still no luck. What's really weird is that the MBM2PNG works perfectly with your described method, using the same method with MUEDIT doesn't. I'm going to give it a try on another machine, Windows 7 x64. The one I'm currently using is Windows 8 x64. I don't think it's a problem with MUEDIT either, just windows fun :)

Link to comment
Share on other sites

Thanks for all your help, but still no luck. What's really weird is that the MBM2PNG works perfectly with your described method, using the same method with MUEDIT doesn't. I'm going to give it a try on another machine, Windows 7 x64. The one I'm currently using is Windows 8 x64. I don't think it's a problem with MUEDIT either, just windows fun :)

If you want, I've got a newer version of MUEDIT. It does the same as the "old" one, but now you can optionally specify the "find" and "replace" strings on the command line.

Grab it here: http://www.hobbytent.com/other/files/muedit.zip

The default is "find .mbm, change to .png", but you can change either one or both. For example, if you wanted to use TARGA textures instead, you could type:

muedit model.mu .mbm .tga

Or to change the PNG back to MBM without a hex editor:

muedit model.mu .png .mbm

There is also the option to override the signature check and the "backup already exists" check, in case you know that you want to replace a backup.

Edited by Krupski
Link to comment
Share on other sites

That version works, thanks heaps Krupski, awesome work mate :)

I'm glad it works... and I'm perplexed why this one works and the old one doesn't. All the new code does basically is add a few more options. The basic "guts" of the program are the same.

One thing that I did (and this may be the key), I strip out path names before displaying them. That is, if your input filename is:

C:\Program Files\KSP_win\GameData\Squad\Parts\Engine\liquidEngine1-2\model.mu

The path ("C:\Program Files\KSP_win\GameData\Squad\Parts\Engine\liquidEngine1-2\") is stripped out and only "model.mu" displayed.

This is only for the status and error message displays - internally the full string is used.

In older versions, I only looked for the forward slash "/" (like what Linux and Mac use). Windows would not match a forward slash, so the path would not be stripped.

The newest version looks for "/" OR "\" so that paths are stripped the same for any platform.

This is the changed code:

Old


while (ofs--) {
if (argv[0][ofs] == '/') {
ofs++;
break;
}
}

New


while (ofs--) {
if ( (argv[0][ofs] == '/') [COLOR=#0000ff][B]|| (argv[0][ofs] == '\\')[/B][/COLOR]) {
ofs++;
break;
}
}

I seriously doubt that this is the reason it now works....... regardless I'm glad it DOES work, and if there's anything else I can do for you, please let me know.

-- Roger

Link to comment
Share on other sites

That version works, thanks heaps Krupski, awesome work mate :)

OK, I found out what the problem was (and why your path appeared in the filename string).

The buffers that hold the various filenames I allocated with a size of "BUFSIZ" which, in C, is a size that's "optimal for disk I/O in the OS".

In Linux (the OS I use), "BUFSIZ" is 8K (8192 bytes). On a hunch, I checked what the definition of "BUFSIZ" was in DOS/Windows.

Well, it's only 512 bytes (1/2 K) !!!!!!!!

That's why the program messed up for you. When you passed those long path names to MUEDIT in your batch file, your buffer overflowed and whatever was in ram right after the buffer became part of your filename!

So, I fixed that and use 8192 rather than "BUFSIZ". Please discard any copies of MBM2PNG and MUEDIT that you have and download this one:

http://www.hobbytent.com/other/files/png_package.zip

Both MBM2PNG and MUEDIT are in the ZIP package (as well as the source code for both).

The files you have now may be working, but it's just random luck. Sooner or later you will run into the problem again. So, scrap those files and use these new fixed ones.

-- Roger

Link to comment
Share on other sites

Sweet, thanks Krupski. Downloaded, you should chuck it back up on SpacePort, this is one of the most useful things I ever found on there.

Cheers

Thanks! Yes I'm going to update the program here as well. I still need to add the README files to the zip archive, as well as edit them to reflect the changes.

Good luck, and if there's anything else I can do for you, let me know.

-- Roger

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...