Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Thu Apr 10, 2014 3:29 pm

I'm trying to get the latest SGDK to work under Linux. The holdup seems to be related to rescomp, there are some TurboC specific calls (stricmp, etc), which I was able to work through.

I've got that compiled and running, but running rescomp complains about missing appack. What is appack exactly?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu Apr 10, 2014 3:54 pm

It will be really great if you can share the fixes you made to get rescomp to compile on linux, i never realized that stricmp was not standard method ;)

Also appack is the aplib packer and i use it to compress resources. Initially i wanted to provide sources for it but i had some troubles to compile it... I will give more time on that next time.

You can find the library and the source here :
http://ibsensoftware.com/download.html

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Thu Apr 10, 2014 8:31 pm

Stef wrote:i never realized that stricmp was not standard method ;)
For some weird reason, it's stricmp in some places and strcasecmp in others :/

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Apr 11, 2014 8:42 pm

Ah yeah, already saw that... if that is the only change it will be easy ;)

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Apr 12, 2014 3:16 pm

This patch should allow compiling rescomp in gcc. There might be a better way to detect specifically the gcc compiler instead of just linux in the preprocessor, but this should work.

Code: Select all

Index: inc/tools.h
===================================================================
--- inc/tools.h (revision 176)
+++ inc/tools.h (working copy)
@@ -1,6 +1,11 @@
 #ifndef _TOOLS_H_
 #define _TOOLS_H_
 
+#if __linux
+#define stricmp strcasecmp
+#define strnicmp strncasecmp
+#define strupr toupper
+#endif
 
 #define FALSE           0
 #define TRUE            1

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Apr 12, 2014 3:20 pm

Makefile for rescomp (from cbp2make):

Code: Select all

#------------------------------------------------------------------------------#
# This makefile was generated by 'cbp2make' tool rev.147                       #
#------------------------------------------------------------------------------#


WORKDIR = `pwd`

CC = gcc
CXX = g++
AR = ar
LD = g++
WINDRES = windres

INC =
CFLAGS = -Wall
RESINC =
LIBDIR =
LIB =
LDFLAGS =

INC_DEBUG = $(INC)
CFLAGS_DEBUG = $(CFLAGS) -g
RESINC_DEBUG = $(RESINC)
RCFLAGS_DEBUG = $(RCFLAGS)
LIBDIR_DEBUG = $(LIBDIR)
LIB_DEBUG = $(LIB)
LDFLAGS_DEBUG = $(LDFLAGS)
OBJDIR_DEBUG = out
DEP_DEBUG =
OUT_DEBUG = out/rescomp

INC_RELEASE = $(INC)
CFLAGS_RELEASE = $(CFLAGS) -O2
RESINC_RELEASE = $(RESINC)
RCFLAGS_RELEASE = $(RCFLAGS)
LIBDIR_RELEASE = $(LIBDIR)
LIB_RELEASE = $(LIB)
LDFLAGS_RELEASE = $(LDFLAGS) -s
OBJDIR_RELEASE = out
DEP_RELEASE =
OUT_RELEASE = out/rescomp

OBJ_DEBUG = $(OBJDIR_DEBUG)/src/snd_tools.o $(OBJDIR_DEBUG)/src/bin.o $(OBJDIR_DEBUG)/src/bitmap.o $(OBJDIR_DEBUG)/src/image.o $(OBJDIR_DEBUG)/src/img_tools.o $(OBJDIR_DEBUG)/src/libpng.o $(OBJDIR_DEBUG)/src/map.o $(OBJDIR_DEBUG)/src/palette.o $(OBJDIR_DEBUG)/src/pcm.o $(OBJDIR_DEBUG)/src/rescomp.o $(OBJDIR_DEBUG)/src/spr_tools.o $(OBJDIR_DEBUG)/src/sprite.o $(OBJDIR_DEBUG)/src/tfmmusic.o $(OBJDIR_DEBUG)/src/tile_tools.o $(OBJDIR_DEBUG)/src/tileset.o $(OBJDIR_DEBUG)/src/tools.o $(OBJDIR_DEBUG)/src/vgmmusic.o $(OBJDIR_DEBUG)/src/wav.o

OBJ_RELEASE = $(OBJDIR_RELEASE)/src/snd_tools.o $(OBJDIR_RELEASE)/src/bin.o $(OBJDIR_RELEASE)/src/bitmap.o $(OBJDIR_RELEASE)/src/image.o $(OBJDIR_RELEASE)/src/img_tools.o $(OBJDIR_RELEASE)/src/libpng.o $(OBJDIR_RELEASE)/src/map.o $(OBJDIR_RELEASE)/src/palette.o $(OBJDIR_RELEASE)/src/pcm.o $(OBJDIR_RELEASE)/src/rescomp.o $(OBJDIR_RELEASE)/src/spr_tools.o $(OBJDIR_RELEASE)/src/sprite.o $(OBJDIR_RELEASE)/src/tfmmusic.o $(OBJDIR_RELEASE)/src/tile_tools.o $(OBJDIR_RELEASE)/src/tileset.o $(OBJDIR_RELEASE)/src/tools.o $(OBJDIR_RELEASE)/src/vgmmusic.o $(OBJDIR_RELEASE)/src/wav.o

all: debug release

clean: clean_debug clean_release

before_debug:
        test -d out || mkdir -p out
        test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src

after_debug:

debug: before_debug out_debug after_debug

out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG)
        $(LD) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG)  $(LDFLAGS_DEBUG) $(LIB_DEBUG)  

$(OBJDIR_DEBUG)/src/snd_tools.o: src/snd_tools.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/snd_tools.c -o $(OBJDIR_DEBUG)/src/snd_tools.o

$(OBJDIR_DEBUG)/src/bin.o: src/bin.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/bin.c -o $(OBJDIR_DEBUG)/src/bin.o

$(OBJDIR_DEBUG)/src/bitmap.o: src/bitmap.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/bitmap.c -o $(OBJDIR_DEBUG)/src/bitmap.o 

$(OBJDIR_DEBUG)/src/image.o: src/image.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/image.c -o $(OBJDIR_DEBUG)/src/image.o   

$(OBJDIR_DEBUG)/src/img_tools.o: src/img_tools.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/img_tools.c -o $(OBJDIR_DEBUG)/src/img_tools.o

$(OBJDIR_DEBUG)/src/libpng.o: src/libpng.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/libpng.c -o $(OBJDIR_DEBUG)/src/libpng.o 

$(OBJDIR_DEBUG)/src/map.o: src/map.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/map.c -o $(OBJDIR_DEBUG)/src/map.o

$(OBJDIR_DEBUG)/src/palette.o: src/palette.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/palette.c -o $(OBJDIR_DEBUG)/src/palette.o

$(OBJDIR_DEBUG)/src/pcm.o: src/pcm.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/pcm.c -o $(OBJDIR_DEBUG)/src/pcm.o

$(OBJDIR_DEBUG)/src/rescomp.o: src/rescomp.c
        $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/rescomp.c -o $(OBJDIR_DEBUG)/src/rescomp.o

$(OBJDIR_RELEASE)/src/spr_tools.o: src/spr_tools.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/spr_tools.c -o $(OBJDIR_RELEASE)/src/spr_tools.o

$(OBJDIR_RELEASE)/src/sprite.o: src/sprite.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/sprite.c -o $(OBJDIR_RELEASE)/src/sprite.o

$(OBJDIR_RELEASE)/src/tfmmusic.o: src/tfmmusic.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tfmmusic.c -o $(OBJDIR_RELEASE)/src/tfmmusic.o

$(OBJDIR_RELEASE)/src/tile_tools.o: src/tile_tools.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tile_tools.c -o $(OBJDIR_RELEASE)/src/tile_tools.o

$(OBJDIR_RELEASE)/src/tileset.o: src/tileset.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tileset.c -o $(OBJDIR_RELEASE)/src/tileset.o

$(OBJDIR_RELEASE)/src/tools.o: src/tools.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/tools.c -o $(OBJDIR_RELEASE)/src/tools.o

$(OBJDIR_RELEASE)/src/vgmmusic.o: src/vgmmusic.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/vgmmusic.c -o $(OBJDIR_RELEASE)/src/vgmmusic.o

$(OBJDIR_RELEASE)/src/wav.o: src/wav.c
        $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/wav.c -o $(OBJDIR_RELEASE)/src/wav.o 

clean_release:
        rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
        rm -rf out
        rm -rf $(OBJDIR_RELEASE)/src

.PHONY: before_debug after_debug clean_debug before_release after_release clean_release

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Apr 12, 2014 3:35 pm

Thanks for changes and makefile !
I included the changes for the methods (i did my own strupper method using toupper()). For the makefile, as i plan to eventually add some files in future i will try to get a generic one (don't need to add file in makefile each time). Anyway compilation is pretty easy, just compile all C files and link them, done ;)

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Apr 12, 2014 6:21 pm

Awesome! I've managed to compile apLib into appack and include that into the linux build environment, so I'm further along. However, when I try to compile any of the samples, I run into some issues. For instance, the joytest example give me an error:

Code: Select all

src/main.c: In function ‘main’:
src/main.c:16:34: error: ‘TileSet’ has no member named ‘palette’
If I look at the definition of TileSet, this does not seem to have palette as a member.

Code: Select all

typedef struct
{
    u16 compression;
    u16 numTile;
    u32 *tiles;
} TileSet;


Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Apr 12, 2014 7:57 pm

Don't worry, it just looks like some of the sample are outdated ! Unbelievable i did not noticed it before. Actually for some reason my "rebuild" command did not worked as expected and so i never saw the problem...

Glad you got aplib to compile ! Though i am using a custom aplib now i am thinking about it. It just remove the header aplib identifier to gain some bytes. I guess it's easy to modify it for that, this modification was done by r57shell i believe.

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Apr 12, 2014 9:59 pm

Stef wrote: Glad you got aplib to compile ! Though i am using a custom aplib now i am thinking about it. It just remove the header aplib identifier to gain some bytes. I guess it's easy to modify it for that, this modification was done by r57shell i believe.

Ahh, so that's probably why the graphics look corrupted then. Do you have a patch against the aplib I can apply?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Apr 13, 2014 9:41 am

Unfortunately i just got the exe file from this topic :
viewtopic.php?t=703&postdays=0&postorder=asc&start=15

I tried to look into the sources file of aplib and it looks like that making some changes in the aPsafe_pack method (the 32 bit or 64 bit version depending the one you use) should do the work. Basically you have to remove all the header useless information but i don't know if that is as easy.
Also there is still some aprt i don't understand, it looks like the base aP_pack(..) method is not in the source (i can't find it at least).
Maybe the best easiest way would be to ask r57shell for modified sources.
I will include them in the next SGDK version to avoid any problem, something you can do is to replace my unpack method in tools_a.s method with the usual aplib 68k unpack code in the meantime.

bioloid
Very interested
Posts: 170
Joined: Fri May 18, 2012 8:22 pm

Post by bioloid » Sun Apr 27, 2014 3:49 pm

no more int main(int hard) ? to know if it requires to destroy things.
I'm updating sgdk to play a bit :)

edit: ok, it's here, just got a warning.

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Apr 27, 2014 10:17 pm

I've pulled in those changes to appack and now I can get the samples to work correctly! I've included that as part of the linux dev environment project.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Apr 28, 2014 10:33 am

Nice news ! Thanks for updating the linux dev environement =)
By the way i should definitely add a link to this Linux version on the SGDK homepage, if you agree :)

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Tue Apr 29, 2014 12:08 am

Yes, that would be great!

Post Reply