MODEL.MU file hacker - Files
last update: Tuesday, 19 November 2013
=====================================
README-muedit  - This document
muedit         - precompiled for your convenience (Linux 32 bit)
muedit64       - precompiled for your convenience (Linux 64 bit)
muedit.exe     - precompiled for your convenience (Windows)
gpl-3.0.txt    - General Public License

Sorry, I don't have a MAC, so I wasn't able to provide a precompiled executable
for you Apple users. Maybe someone with a MAC can compile this and upload it?


Quick start
=====================================
This program converts modifies "model.mu" files by changing the internal
texture filenames from (typically) "modelxxx.mbm" to "modelxxx.png". This
change allows KSP to utilize PNG texture image files instead of the original
MBM files. This program is used in conjunction with "mbm2png".

To use, simply copy the appropriate executable to your computer, then type

C:\> muedit model.mu (press enter)
 - or -
C:\> muedit (press enter)

If you specify a filename, it will be used. If not, the program will ask you
for it.

You can change filename extensions to something other than the defaults simply by
specifying them on the command line. For example, to change the ".mbm" extensions
to ".tga" (Targa), type this:

C:\> muedit model.mu .mbm .tga

Note that if you specify new extensions, you must specify both of them, in the order:

C:\> muedit (filename) (extension to find) (extension to replace it with)

If you do not specify alternate extensions, then the defaults "find .mbm" and "change
to .png" will be used.

Of course, both the "find" and "replace" names must be the same length. If they are
different lengths, an error will be generated. If there is an error, the original
file will not be modified, the new file will not be created and the backup will
not be created.

The program will run, edit the file, then generate a small report like this:

muedit.exe: Report:
--------------------------------------------------------
Checked the signature of model.mu (match) 0xFF2A0100
Backed up the original file model.mu to model.mu.bak
Changed 5 occurrences of .mbm to .png in file model.mu
Wrote updated file model.mu to disk


What the program does (and does not do)
=====================================
(1) It will NOT modify the original MU file.
(2) It will check for a valid MU file by looking for the 0xFF2A0100 magic number.
(3) It will create a backup of the original file with ".bak" appended to the name.
(4) It will refuse to overwrite an existing backup file. Delete the backup recreate it.
    This is a safety feature to prevent accidental overwrite of an edited MU file.
(5) You may override the check for a valid file signature (not recommended).
(6) You may override the refusal to overwrite the backup file (not recommended).
(7) You may specify extensions to find and/or replace to override the defaults.

In any case, always make a backup copy of files before you edit them!


Copyright information - muedit
=====================================
muedit - edits "model.mu" files by finding all occurrences of
"texturename.mbm" and changing them to "texturename.png" so that
the Kerbal Space Program will utilize user modified PNG texture
files rather than stock MBM files. A backup of "model.mu" is made.

(c) 2013 roger a. krupski <rakrupski@verizon.net>
Last update 25 september 2013

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

########################################
# One of these       BANG, ZOOM!       #
#   days Alice...       Straight to    #
#                  ^        the Mun!   #
#                 /_\                  #
#                /___\                 #
#                |   |                 #
#                |___|                 #
#                |   |                 #
#                | K |                 #
#                | S |                 #
#                | P |                 #
#                |___|                 #
#                |   |                 #
#               /--|--\                #
#              /- #|#- \               #
#          ___    ###   ___   Wait     #
#          ||_|   ###  |_||   for      #
#          || |    #   | ||   me!      #
#          ||      #     ||            #
#          ||      #     ||   \O/      #
#          ||            ||    |       #
#          ||            ||   / \      #
#    =============================     #
########################################

Enjoy!! -- Roger

Changes since initial upload:
=============================================================================
25 sep 2013
* initial release
=============================================================================
03 oct 2013
* Fixed a small bug.
=============================================================================
19 nov 2013
* Fixed a major bug (Windows version only). Filename buffer was too small and
  overflowed when long path names were used. The Linux version did not have
  this problem.
* Added the ability to change the default "find" and "replace" extensions so
  that other changes could be made (such as changing "PNG" back to "MBM", or
  changing MBM to TGA, etc...
* Added the ability to override the file signature (magic number) check.
* Added the ability to override the program's refusal to overwrite an already
  existing backup file.
=============================================================================
