Lockjaw on Linux

Thread in 'Discussion' started by d0nk, 30 Oct 2007.

  1. d0nk

    d0nk Unregistered

    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

    Code:
    ./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:
    Code:
    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:
    Code:
    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! [​IMG]
     
  2. 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!
     
  3. 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:


    Code:
    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...
     
  4. tepples

    tepples Lockjaw developer

    403 this:


    /bin/ksh


    /bin/sh

    Code:
    /bi[b][/b]n/sh
     
  5. Code:
    403 this:
    
    /bi[b][/b]n/sh
    
    /bi[[b][/b]b][/b]n/sh
    Doesn't work in code boxes... [​IMG]
     
  6. tepples

    tepples Lockjaw developer

    n is n

    Code:
    /bin/sh
    Homograph Attack!

    Code:
    /bn/sh
    /bi?/sh
    /bi?/sh
    /b??n/sh
    /?n/sh
    /bin/?h
    /bin/s?
    /bin/s?
    
     
  7. In Soviet Russia, /?n/sh runs you?
     
  8. d0nk

    d0nk Unregistered

    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... [​IMG]
     

  9. 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?
     

  10. But wasn't the last one involving Wine? I think this is different enough to merit a new topic.
     
  11. I thought there were like 3 of these topics already.
     
  12. tepples

    tepples Lockjaw developer

Share This Page