ModKeen 2 + Fin2Bmp Windows/Linux port: LModKeen 2

ModKeen mods Tiles and Sprites in all episodes of Commander Keen.
User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Wed Apr 04, 2007 5:27 pm

The filename normalizing script is here. Instead of adding extra code to ModKeen, I decided to write a separate UNIX shell script file.

If you need to download it, save the following link to a file:
http://shadowm2006.sitesled.com/src/normalize_filenames

Code:

Code: Select all

#!/bin/sh
## ------------------------------------------------------------------------------------
## normalize_filenames - Converts all filenames of a dir in a case-sensitive
##                       volume to what LModKeen expects
##
## Copyright (c)2007 by Ignacio R. Morelle "Shadow Master". (shadowm2006@gmail.com)
## for LModKeen II
##
## Original code Copyright (c)2002-2004 Andrew Durdin. (andy@durdin.net)
## Keen Dreams support added by MultiMANIA. (multimania@gmail.com)
## Linux port code, reviewed Keen Dreams support and FIN2BMP integration
## by Shadow Master.
##
## This software is provided 'as-is', without any express or implied warranty.
## In no event will the authors be held liable for any damages arising from
## the use of this software.
## Permission is granted to anyone to use this software for any purpose, including
## commercial applications, and to alter it and redistribute it freely, subject
## to the following restrictions:
##    1. The origin of this software must not be misrepresented; you must not
##       claim that you wrote the original software. If you use this software in
##       a product, an acknowledgment in the product documentation would be
##       appreciated but is not required.
##    2. Altered source versions must be plainly marked as such, and must not be
##       misrepresented as being the original software.
##    3. This notice may not be removed or altered from any source distribution.
## ------------------------------------------------------------------------------------


normalize_keen123 ()
{
	if [ -e ./egagraph.ck$episode ]; then
		mv ./egagraph.ck$episode ./EGAGRAPH.CK$episode
	fi
	if [ -e ./egalatch.ck$episode ]; then
		mv ./egalatch.ck$episode ./EGALATCH.CK$episode
	fi
	if [ -e ./egasprit.ck$episode ]; then
		mv ./egasprit.ck$episode ./EGASPRIT.CK$episode
	fi
	if [ -e ./finale.ck$episode ]; then
		mv ./finale.ck$episode ./FINALE.CK$episode
	fi
	if [ -e ./sounds.ck$episode ]; then
		mv ./sounds.ck$episode ./SOUNDS.CK$episode
	fi
	if [ -e ./preview2.ck1 ]; then
		mv ./preview2.ck1 ./PREVIEW2.CK1
	fi
	if [ -e ./preview3.ck1 ]; then
		mv ./preview3.ck1 ./PREVIEW3.CK1
	fi

	return 0
}

normalize_keen456 ()
{
	if [ -e ./audio.ck$episode ]; then
		mv ./audio.ck$episode ./AUDIO.CK$episode
	fi
	if [ -e ./config.ck$episode ]; then
		mv ./config.ck$episode ./CONFIG.CK$episode
	fi
	if [ -e ./egagraph.ck$episode ]; then
		mv ./egagraph.ck$episode ./EGAGRAPH.CK$episode
	fi	
	if [ -e ./egahead.ck$episode ]; then
		mv ./egahead.ck$episode ./EGAHEAD.CK$episode
	fi	
	if [ -e ./gamemaps.ck$episode ]; then
		mv ./gamemaps.ck$episode ./GAMEMAPS.CK$episode
	fi

	if [ $episode != 6 ]; then
		exe_eganame="KEEN${episode}E.EXE"
		exe_cganame="KEEN${episode}C.EXE"
		exe_eganame_l="keen${episode}e.exe"
		exe_cganame_l="keen${episode}c.exe"
	else
		exe_eganame="KEEN6.EXE"
		exe_cganame="KEEN6C.EXE"
		exe_eganame_l="keen6.exe"
		exe_cganame_l="keen6c.exe"
	fi

	if [ -e ./$exe_eganame_l ]; then
		mv ./$exe_eganame_l ./$exe_eganame
	fi
	if [ -e ./$exe_cganame_l ]; then
		mv ./$exe_cganame_l ./$exe_cganame
	fi

	return 0
}

declare episode

if [[ "$1" = "-h" || "$1" = "--help" ]]; then
	echo "Usage:"
	echo "   normalize_filenames [episode number]"
	echo "Note: episode number is D for Keen Dreams."
	exit 0
fi

if [[ "$1" = "1" || "$1" = "keen1" || "$1" = "KEEN1" ]]; then
	episode=1
elif [[ "$1" = "2" || "$1" = "keen2" || "$1" = "KEEN2" ]]; then
	episode=2
elif [[ "$1" = "3" || "$1" = "keen3" || "$1" = "KEEN3" ]]; then
	episode=3
elif [[ "$1" = "4" || "$1" = "keen4" || "$1" = "KEEN4" ]]; then
	episode=4
elif [[ "$1" = "5" || "$1" = "keen5" || "$1" = "KEEN5" ]]; then
	episode=5
elif [[ "$1" = "6" || "$1" = "keen6" || "$1" = "KEEN6" ]]; then
	episode=6
elif [[ "$1" = "D" || "$1" = "kdreams" || "$1" = "KDREAMS" || "$1" = "keend" || "$1" = "KEEND" ]]; then
	episode=7
else
	echo "No episode number given!"
	exit -1
fi

case $episode in
	1) normalize_keen123 ;;
	2) normalize_keen123 ;;
	3) normalize_keen123 ;;
	4) normalize_keen456 ;;
	5) normalize_keen456 ;;
	6) normalize_keen456 ;;
esac

echo "Done! Now you can run ModKeen."
Loooooooooooooong. Isn't it?

User avatar
XkyRauh
Posts: 1113
Joined: Sun Aug 31, 2003 9:14 pm
Location: San Diego, California

Post by XkyRauh » Wed Apr 04, 2007 10:35 pm

Long, but systematic. :) Cheers.

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

LModKeen II beta4 preannouncement

Post by Shadow Master » Mon Apr 09, 2007 7:40 pm

Yes, the 4th beta of LModKeen II is coming. New features:

- Builds for Windows using the Mingw32 cross-compiler for Linux -- a Win32 exe (ready-to-use) will be included with the final package. And yes, this has been tested. Outputs some extra garbage to console, but Keen data handling is OK.
- Adds Bio Menace support (in progress).
- More code optimizations.
- Will add Dangerous Dave support as soon as Levellass remembers my request.
- The makefiles for Linux and Mingw32 will work ON ANY SYSTEM with no modifications (warning: the mingw32 makefile will require slight modifications).
- Enhances miscellaenous stuff.

That's all. I'm sure you guys will be happy with the feature noted above in bold font. No more WindowsUpdate Syndrome with ModKeen, you'll be able to run it natively from Windows as you did with z-1 Win32 port of ModKeen 1. Remember, the difference between his and my port is simple: mine is port of ModKeen 2.0.1. :)

Levellass also mentioned something about Shadow Knights support. Could she help me? >:) And if somebody knows if Dangerous Dave 3 uses the Keen engine code, please tell me. Its files are named in a similar way to Keen4's files.

And yes, this version will include a free (as in "free beer") toaster. A windows9x-nuclear-bomb assembling pack is avaiable under request too.

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Thu Apr 19, 2007 3:17 pm

I decided to use the beta-3 source code for a definitive LModKeen II release, with bugfixes and the Win32 and Linux makefiles I made recently. I only have one bug to fix for the release, and it's about the Win32 console output. For example:

Code: Select all

Importing bitmaps: 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%...
That's the strange output of the Windows build. I think I introduced a bug or two in the Win32 console code while reusing existing code (Meta engine v0.1.1 source code, copyright (c) 2006-2007 by myself). It should be easy to fix, but for the mean time, this project needs a new name.

I named it "LModkeen" because of "Linux", but now it is also the second unofficial Win32 ModKeen. I need "ideas" for the L.

Ah, Bio-Menace, Shadow Knights, Dangerous Dave 2 and Keen Dreams support won't be in this release, wait for LModKeen 3.0.

EDIT: I should've said two bugs. The other one is on the filename normalizer script. I didn't include a line for renaming one of the EGAsomething.CKx files on Keen 1-3.

EDIT2: Levellass, know that I shall fill your email inbox with spam messages until you help me with DD2 and SK support!!

User avatar
adurdin
Site Founder
Posts: 546
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin » Thu Apr 19, 2007 7:50 pm

Shadow Master wrote:for the mean time, this project needs a new name.

I named it "LModkeen" because of "Linux", but now it is also the second unofficial Win32 ModKeen. I need "ideas" for the L.
Loony? Light? Lapwing? Lollipop? :)

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Fri May 04, 2007 5:59 pm

I wrote down the production name for this application in my copybook. I didn't bring it today though.

Well. I have only one, ONE bug to solve before releasing LModKeen II. And it is about Win32 console support (I think I mentioned it before). I don't have enough time and I can't find the cause of this problem.

Any volunteers with Mingw32 to write a better Makefile based in the current one (which is for Mingw32's Linux cross-compiler) and find and fix the bug that causes me this horrendous headache? Please. :) If anyone wants to help me with this, post here and I'll reply with the link to the lmodkeen2-rc1 zip file for you to download.

I'm more enthusiastic currently about LModKeen 3, with the improved Keen Dreams, new Bio Menace, Dangerous Dave and Shadow Knights support, plus it will be C++ based in order to re-modularize old stuff.

User avatar
Malvineous
Posts: 103
Joined: Sat Mar 13, 2004 12:54 am
Location: Brisbane, Australia
Contact:

Filename case

Post by Malvineous » Sun May 06, 2007 1:08 am

Just saw your post about fixing the case of filenames. I have this problem fairly often so I thought you might be interested in a more generic script I came up with. Save the code in a file called "namelower", make it executable and put it in the path and then you can do stuff like this:

$ cd keen1
$ namelower *

And it will make each filename in the directory lowercase. The script is here:

Code: Select all

#!/bin/sh

if [ "$1" == "" ]; then
  echo "namelower - rename a given file so that its filename contains only"
  echo "            lowercase characters."
  echo ""
  echo "Usage: namelower file1 [file2...]"
  echo ""
fi

while [ "$1" != "" ]; do
  FILENAME=$1
  LOWERFILE=`strlower "${FILENAME}"`
  if [ "$FILENAME" != "$LOWERFILE" ]; then
    # File is not already lowercase
    if [ -a "$LOWERFILE" ]; then
      echo "namelower: skipping ${FILENAME}, lowercase file already exists." > /dev/stderr
    else
      mv "$FILENAME" "$LOWERFILE"
    fi
  fi
  shift
done
and it uses a command called "strlower" which needs to be compiled separately because I couldn't find an existing utility that did it (and it was far too slow doing the case conversion in the shell script.)

Code: Select all

#include <ctype.h>
#include <stdio.h>

char *strlower(char *str)
{
  char *str1 = str;
  while (*str != 0)
    *str++ = tolower(*str);
  return str1;
}

int main(int argc, char *argv[])
{
  if (argc >= 2)
    printf("%s\n", strlower(argv[1]));
  return 0;
}
Compile it with something like "gcc -o strlower strlower.c && strip strlower" Make sure you put it in your path too (/usr/local/bin is a good place for both) and it should be ready to go.

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Mon May 07, 2007 5:38 pm

Perhaps I should hack it so that it converts lower to upper. I need upper, not lowercase names :p

When I decided to convert all names in ModKeen's code to uppercase, I was thinking about something I read/heard about sometime ago. Old DOS systems store 8.3 *uppercase* filenames in the File Allocation Table. I'm not sure, but I think I saw proof of it by viewing an IMA file with a hex editor.

User avatar
Malvineous
Posts: 103
Joined: Sat Mar 13, 2004 12:54 am
Location: Brisbane, Australia
Contact:

Post by Malvineous » Mon May 07, 2007 10:32 pm

You're more than welcome to change it as you see fit, but when was the last time you saw uppercase names on a Linux filesystem??? Sure, FAT filesystems store names in uppercase, but the Linux FAT driver converts them to lowercase anyway...

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Tue May 08, 2007 2:12 pm

I'll fix that strange decission in the LModKeen 2.5 release. I'll also include a proper filename normalizer in the enxt release.

I release now LModKeen 2:
- Source code & binaries: http://shadowm2006.sitesled.com/src/lmo ... l1.tar.bz2
- Windows binary: http://shadowm2006.sitesled.com/lmodkee ... -win32.zip

This version is now the first Windows port of ModKeen 2.0.1. Includes integrated (automatically used) FIN2BMP functionality. This is also the second Linux port of ModKeen.2.0.1.

Have fun!

EDIT: if you hesitate to download it because of the supposedly unresolvable bug I mentioned above, well, I inform you that I resolved it after 4 hours of research and tests with Windows 98 and Wine. :P

HOWEVER, I still need volunteers for writing a Win32 native Mingw32 makefile, and the MacOS X port if someone's interested in it (it should require a new makefile, nothing more, or ncurses doesn't run on Mac OS X?).

User avatar
grafix
Posts: 199
Joined: Fri Oct 29, 2004 8:38 am

Post by grafix » Tue May 08, 2007 5:47 pm

I wouldn't mind helping out with the OS X port, since I've already managed to compile LModKeen 1 and 2 on my Mac. The makefile will need a complete rewrite, though - is it being generated by Eclipse at the moment? It won't work for me, so I just run gcc manually.

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Tue May 08, 2007 7:00 pm

It's generated by Eclipse, yes, although I replaced some parts so that it's not dependent on my own computer.

It builds fine on a Linux machine that doesn't have Eclipse installed, so I'm 100% sure that the provided makefile is ok.

EDIT: Ah, mac! Disregard the text abovev.

User avatar
Shadow Master
Posts: 129
Joined: Fri Oct 20, 2006 3:14 pm
Location: Santiago, Chile
Contact:

Post by Shadow Master » Tue May 22, 2007 7:50 pm

Well, this project's (LModKeen) still maintained by me, however, there are bad news: it's name is no longer LModKeen.

Why? Because I initially named it LModKeen after "Linux's ModKeen". However, some people convinced me to port it to the Windows platform later, and the result (Lmodkeen 2) is not only a Linux port, but also a Windows port. So it's name should've been "LWModKeen" (Linux+Windows ModKeen) or something like that. Plus the enhancements and stuff that are coming with the versions 2.2 and 3.0, I decided to change its name to "EModKeen", the "Enhanced ModKeen".

So, this is another pre-announcement, but it's for EModKeen versions 2.1 and 2.9. The deadline should be around December of this year; now that the community has a stable Windows Modkeen 2.0.1 (Lmk 2, my little present for you all), and it's gaining some users, it's time to modernize the existing utilities, and with utilities I mean ModKeen 2.0.1, TEDSetup, Fin2BMP. All of them have been exhaustively tested, used and perhaps even abused, so it's time to integrate all of them into a single tool... EModKeen.

Starting from now, the version numbering system will be the same as most open-source software, thus 2.0, 2.2, 2.4, 2.6 and so on, are for stable (final-user) releases. 2.1, 2.3, 2.5, etc., stand for unstable releases that should not be used by final users. By "final users" I mean all those who actually want to create a mod. The unstable releases are just for me, the testers and those who want to study other mods, etc.

EModKeen 2.1.x are the alpha and beta versions for EModKeen 2.2, while 2.9.x are the alpha and betas for EModKeen 3.

What's coming soon in EModKeen 2.2 then?

- Will use only lowercase filenames (sorry Linux LModKeen users... if any; you'll have to rename your stuff with a provided script).
- TED Setup integrated for semi-transparent import/export operations on Keen: Galaxy mods. Semi- because I might add a new command line parameter in order to avoid confusion, such as --prepmaps.
- Separate carmackization.
- Keen Dreams support is really, really supposed to be finished for this one.
- Audio.ckx -> audiohed.ckx + audiot.ckx operation might be added, but I can't promise anything about it. (At least I already know where the audiodct.ckx contents are stored in the exe.)

And in EModKeen 3:

- Everything noted above.
- Bio Menace and Dangerous Dave 2 support.
- Everything ported to C++ for extensibility, portability, usability, etc.

Any comments, suggestions and spam for pressing me to do all this before December, go to shadowm 2006 at gm@il d0tz c0mz.

levellass
Posts: 2893
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass » Wed May 23, 2007 5:24 am

*Gasp!*

Emo'd Keen!


This sounds great; it'll remove all those other now uneeded applications!

User avatar
ckguy
Posts: 464
Joined: Tue Oct 14, 2003 11:20 am
Location: Providence, RI, US
Contact:

Post by ckguy » Wed May 23, 2007 11:27 am

Sounds really nice!

[edit:] Woohoo, my 314th post!

Post Reply