PDA

View Full Version : Lockjaw on Linux


d0nk
10-30-2007, 02:03 AM
Hello everyone. I've been playing lockjaw quite a bit lately, then today in class I was wanting to play (boring lecture), but I was in linux (I dual boot my laptop, and linux lasts FAR longer on battery than windows).


I'm running Ubuntu 7.10 Gutsy Gibbon on an HP laptop, by the way.


I took a look at the libs that tepples used in lockjaw, and made sure to get them. The libraries that I needed were: [note, there are more, but these covered the dependencies]

libvorbis-dev liballegro4.2-dev libaldum1

I needed to download and compile JPGalleg (I used the link on tepples' site). Compiling JPGalleg was simple

./fix unix
make
sudo make install


Once I did that, I needed to edit the makefile to be more "linux friendly" Here is a shortened version:
EXE := lj
CFLAGS := -Wall -O2 -std=gnu99 -DWITH_REPLAY=1 -DHAS_FPU
CC := gcc
LD := gcc
LDFLAGS := -Wall -s
srcdir := src
objdir := obj/linux

MUSICOBJS := $(objdir)/ljvorbis.o
MUSICLIBS := -laldmb -ldumb -lvorbisfile -lvorbis -logg

LDLIBS := -ljpgal -lalleg

DEPOBJS := $(objdir)/ljpc.o $(objdir)/lj.o $(objdir)/ljplay.o $(objdir)/pcjoy.o $(objdir)/gimmicks.o $(objdir)/wktables.o $(objdir)/options.o $(objdir)/debrief.o $(objdir)/macro.o $(objdir)/ljreplay.o $(objdir)/ljmusic.o $(objdir)/old_pc_options.o $(objdir)/pcsound.o $(MUSICOBJS)

.PHONY: linux win32 clean all

# Scripts to coordinate building the PC, GBA, and DS versions

linux: $(EXE)
all: $(EXE) lj.gba lj.nds

# Content of executable

$(EXE): $(DEPOBJS) $(OTHEROBJS)
   $(LD) $(LDFLAGS) $^ $(MUSICLIBS) $(LDLIBS) -o $@

# Compilation rules
$(objdir)/%.o: $(srcdir)/%.c
   $(CC) $(CFLAGS) -MMD -c -o $@ $<
   @cp $(objdir)/$*.d $(objdir)/$*.P; \
   sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
   -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
   rm -f $(objdir)/$*.d

# Header dependencies
-include $(DEPOBJS:%.o=%.P)

# Cleanup rules
clean:
   -rm $(objdir)/*.o
   -rm $(objdir)/*.P
   -rm $(EXE)


The above may need some tweaking, I tried to chop out the linux relevant stuff only. I have my makefile set up for compiling both the windows bin and the linux bin, so it differs a bit.

To compile, simply:
mkdir object/linux  # this directory will be needed...
make


The final step is to copy the DAT files from the windows/gba/nds binary .zip file to your source directory.


Then in under 10 minutes I was playing my favorite tetrimino stacking game, under my favorite OS. The default theme and sounds work, not sure if BGM plays, as I had my volume set really low. Skins should work too.


Thanks for a great game, tepples! http://www.tetrisconcept.net/forum/images/smilies/icon_biggrin.gif

statikeffeck
10-30-2007, 07:07 PM
wow! I didn't think it was this easy to install on Linux. I'll try this when I get home from work later.


Thanks: d0nk and tepples!

Pineapple
10-31-2007, 01:09 AM
Some things to clarify after reading this:


It isn't clear from your summary, but you will also likely need libaldmb-dev (which nicely depends on liballegro4.2-dev). libjpgalleg is not a standard library, and will need to be compiled manually on some distros (although I've heard that Gentoo has this library already).


The main change that is needed to the makefile is to remove the reference to windres, which is only used to apply an icon to the executable. The other changes that may be desired are to remove .exe from the executable name, and to give it its own folder for the object files. The -mwindows option is also unnecessary. The stripped version that you've pasted looks to also have the compile options for the DS and GBA versions removed. I don't know (and haven't yet explored) the possibility of getting these to run under Linux, but I may do at some point...


Music should work, as long as sound normally works on your system, and as long as the music file is found.


Lockjaw expects several files (lj.dat lj.ini lj-keys.* and the default images) to be in the current folder, which can cause some problems if you try to launch it in the traditional way. Thw simple work-around is to create a launcher script that moves to the correct folder and then launches it from there. Something like this should work if the forum will let me post it:


There seems to be a serious problem. The forum will give me a 403 whenever I include the string "/ova/fu" (ROT13 it to see what I would like to write, but it should be fairly guessable anyway)

This also isn't the first thread about LJ on Linux. But in the tradition of these forums, I doubt it will be the last...

tepples
10-31-2007, 01:16 AM
403 this:


/bin/ksh


/bin/sh

/bin/sh

Pineapple
10-31-2007, 01:17 AM
403 this:

/bin/sh

/bin/sh
Doesn't work in code boxes... http://www.tetrisconcept.net/forum/images/smilies/icon_sad.gif

tepples
10-31-2007, 01:27 AM
n is n

/bin/sh

Homograph Attack!

/b¡n/sh
/bi?/sh
/bi?/sh
/b??n/sh
/?n/sh
/bin/?h
/bin/s?
/bin/s?

Pineapple
10-31-2007, 01:32 AM
In Soviet Russia, /?n/sh runs you?

d0nk
10-31-2007, 03:42 AM
One issue I came across today is that skins don't work. I suspect that this is due to the way files/paths are accessed (I'm guessing \\ vs. /). Maybe I'll make a patch for it when i get around to it... http://www.tetrisconcept.net/forum/images/smilies/icon_biggrin.gif

statikeffeck
10-31-2007, 05:57 AM
This also isn't the first thread about LJ on Linux. But in the tradition of these forums, I doubt it will be the last...


I'll take those suggestions into account... but don't you think it is a little hard to find different topics when there is only one category: General?

Caithness
10-31-2007, 09:46 PM
This also isn't the first thread about LJ on Linux. But in the tradition of these forums, I doubt it will be the last...


But wasn't the last one involving Wine? I think this is different enough to merit a new topic.

kotetsu213
10-31-2007, 10:02 PM
I thought there were like 3 of these topics already.­

tepples
10-31-2007, 10:19 PM
Search (http://www.tetrisconcept.net/forum/search.php) linux AND lockjaw, display results as posts, found the following:

Lardarse first expresses interest (http://www.tetrisconcept.net/forum/viewtopic.php?p=4971#4971) reivilo reports failure of the Windows executable on Wine (http://www.tetrisconcept.net/forum/viewtopic.php?p=8780#8780) Lardarse replies to reivilo's report (http://www.tetrisconcept.net/forum/viewtopic.php?p=8786&highlight=linux+lockjaw#8786) tr3 reports success in compiling and running (http://www.tetrisconcept.net/forum/viewtopic.php?p=10770#10770) Big Grizzle compiles it, but it fails to find the datafile (http://www.tetrisconcept.net/forum/viewtopic.php?p=10920&highlight=linux+lockjaw#10920)