Login
User Name:

Password:



Register

Forgot your password?
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
SWRFUSS 1.4
Author: Various
Submitted by: Samson
Users Online
Sogou, AhrefsBot

Members: 0
Guests: 33
Stats
Files
Topics
Posts
Members
Newest Member
488
3,788
19,631
595
Khonsu

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » Dev-C++
Forum Rules | Mark all | Recent Posts

Dev-C++
< Newer Topic :: Older Topic > An experiment

Pages:<< prev 1 next >>
Post is unread #1 Sep 17, 2005 8:14 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Just for the heck of it, I took a copy of SmaugFUSS 1.6 fresh off the grill, downloaded a copy of Dev-C++ from Sourceforge, and began prodding it into submission.

After a bit of tweaking, I realized it wasn't going to like the standard Makefile and compiling it without modifying one wasn't going to work either. This is what I have:

# Project: SmaugFUSS
# Makefile created by Dev-C++ 4.9.9.2

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  = 
OBJ  = src/o/update.o src/o/act_comm.o src/o/act_info.o src/o/act_move.o src/o/act_obj.o src/o/act_wiz.o src/o/ban.o src/o/boards.o src/o/build.o src/o/clans.o src/o/color.o src/o/comm.o src/o/comments.o src/o/const.o src/o/db.o src/o/deity.o src/o/fight.o src/o/handler.o src/o/hashstr.o src/o/hotboot.o src/o/imc.o src/o/imm_host.o src/o/interp.o src/o/magic.o src/o/makeobjs.o src/o/mapout.o src/o/mccp.o src/o/md5.o src/o/misc.o src/o/mpxset.o src/o/mud_comm.o src/o/mud_prog.o src/o/planes.o src/o/player.o src/o/polymorph.o src/o/reset.o src/o/save.o src/o/services.o src/o/shops.o src/o/skills.o src/o/special.o src/o/tables.o src/o/track.o $(RES)
LINKOBJ  = src/o/update.o src/o/act_comm.o src/o/act_info.o src/o/act_move.o src/o/act_obj.o src/o/act_wiz.o src/o/ban.o src/o/boards.o src/o/build.o src/o/clans.o src/o/color.o src/o/comm.o src/o/comments.o src/o/const.o src/o/db.o src/o/deity.o src/o/fight.o src/o/handler.o src/o/hashstr.o src/o/hotboot.o src/o/imc.o src/o/imm_host.o src/o/interp.o src/o/magic.o src/o/makeobjs.o src/o/mapout.o src/o/mccp.o src/o/md5.o src/o/misc.o src/o/mpxset.o src/o/mud_comm.o src/o/mud_prog.o src/o/planes.o src/o/player.o src/o/polymorph.o src/o/reset.o src/o/save.o src/o/services.o src/o/shops.o src/o/skills.o src/o/special.o src/o/tables.o src/o/track.o $(RES)
LIBS =  -L"C:/Dev-Cpp/lib"  
INCS =  -I"C:/Dev-Cpp/include" 
CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include" 
BIN  = area/smaug.exe
CXXFLAGS = $(CXXINCS)  
CFLAGS = $(INCS) -DIMC -DIMCSMAUG
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before area/smaug.exe all-after


clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CC) $(LINKOBJ) -o "area\smaug.exe" $(LIBS)

src/o/update.o: src/update.c
	$(CC) -c src/update.c -o src/o/update.o $(CFLAGS)

src/o/act_comm.o: src/act_comm.c
	$(CC) -c src/act_comm.c -o src/o/act_comm.o $(CFLAGS)

src/o/act_info.o: src/act_info.c
	$(CC) -c src/act_info.c -o src/o/act_info.o $(CFLAGS)

src/o/act_move.o: src/act_move.c
	$(CC) -c src/act_move.c -o src/o/act_move.o $(CFLAGS)

src/o/act_obj.o: src/act_obj.c
	$(CC) -c src/act_obj.c -o src/o/act_obj.o $(CFLAGS)

src/o/act_wiz.o: src/act_wiz.c
	$(CC) -c src/act_wiz.c -o src/o/act_wiz.o $(CFLAGS)

src/o/ban.o: src/ban.c
	$(CC) -c src/ban.c -o src/o/ban.o $(CFLAGS)

src/o/boards.o: src/boards.c
	$(CC) -c src/boards.c -o src/o/boards.o $(CFLAGS)

src/o/build.o: src/build.c
	$(CC) -c src/build.c -o src/o/build.o $(CFLAGS)

src/o/clans.o: src/clans.c
	$(CC) -c src/clans.c -o src/o/clans.o $(CFLAGS)

src/o/color.o: src/color.c
	$(CC) -c src/color.c -o src/o/color.o $(CFLAGS)

src/o/comm.o: src/comm.c
	$(CC) -c src/comm.c -o src/o/comm.o $(CFLAGS)

src/o/comments.o: src/comments.c
	$(CC) -c src/comments.c -o src/o/comments.o $(CFLAGS)

src/o/const.o: src/const.c
	$(CC) -c src/const.c -o src/o/const.o $(CFLAGS)

src/o/db.o: src/db.c
	$(CC) -c src/db.c -o src/o/db.o $(CFLAGS)

src/o/deity.o: src/deity.c
	$(CC) -c src/deity.c -o src/o/deity.o $(CFLAGS)

src/o/fight.o: src/fight.c
	$(CC) -c src/fight.c -o src/o/fight.o $(CFLAGS)

src/o/handler.o: src/handler.c
	$(CC) -c src/handler.c -o src/o/handler.o $(CFLAGS)

src/o/hashstr.o: src/hashstr.c
	$(CC) -c src/hashstr.c -o src/o/hashstr.o $(CFLAGS)

src/o/hotboot.o: src/hotboot.c
	$(CC) -c src/hotboot.c -o src/o/hotboot.o $(CFLAGS)

src/o/imc.o: src/imc.c
	$(CC) -c src/imc.c -o src/o/imc.o $(CFLAGS)

src/o/imm_host.o: src/imm_host.c
	$(CC) -c src/imm_host.c -o src/o/imm_host.o $(CFLAGS)

src/o/interp.o: src/interp.c
	$(CC) -c src/interp.c -o src/o/interp.o $(CFLAGS)

src/o/magic.o: src/magic.c
	$(CC) -c src/magic.c -o src/o/magic.o $(CFLAGS)

src/o/makeobjs.o: src/makeobjs.c
	$(CC) -c src/makeobjs.c -o src/o/makeobjs.o $(CFLAGS)

src/o/mapout.o: src/mapout.c
	$(CC) -c src/mapout.c -o src/o/mapout.o $(CFLAGS)

src/o/mccp.o: src/mccp.c
	$(CC) -c src/mccp.c -o src/o/mccp.o $(CFLAGS)

src/o/md5.o: src/md5.c
	$(CC) -c src/md5.c -o src/o/md5.o $(CFLAGS)

src/o/misc.o: src/misc.c
	$(CC) -c src/misc.c -o src/o/misc.o $(CFLAGS)

src/o/mpxset.o: src/mpxset.c
	$(CC) -c src/mpxset.c -o src/o/mpxset.o $(CFLAGS)

src/o/mud_comm.o: src/mud_comm.c
	$(CC) -c src/mud_comm.c -o src/o/mud_comm.o $(CFLAGS)

src/o/mud_prog.o: src/mud_prog.c
	$(CC) -c src/mud_prog.c -o src/o/mud_prog.o $(CFLAGS)

src/o/planes.o: src/planes.c
	$(CC) -c src/planes.c -o src/o/planes.o $(CFLAGS)

src/o/player.o: src/player.c
	$(CC) -c src/player.c -o src/o/player.o $(CFLAGS)

src/o/polymorph.o: src/polymorph.c
	$(CC) -c src/polymorph.c -o src/o/polymorph.o $(CFLAGS)

src/o/reset.o: src/reset.c
	$(CC) -c src/reset.c -o src/o/reset.o $(CFLAGS)

src/o/save.o: src/save.c
	$(CC) -c src/save.c -o src/o/save.o $(CFLAGS)

src/o/services.o: src/services.c
	$(CC) -c src/services.c -o src/o/services.o $(CFLAGS)

src/o/shops.o: src/shops.c
	$(CC) -c src/shops.c -o src/o/shops.o $(CFLAGS)

src/o/skills.o: src/skills.c
	$(CC) -c src/skills.c -o src/o/skills.o $(CFLAGS)

src/o/special.o: src/special.c
	$(CC) -c src/special.c -o src/o/special.o $(CFLAGS)

src/o/tables.o: src/tables.c
	$(CC) -c src/tables.c -o src/o/tables.o $(CFLAGS)

src/o/track.o: src/track.c
	$(CC) -c src/track.c -o src/o/track.o $(CFLAGS)


It has compiled everything up to the imc.c file, which I am not able to make into a conditional compile so it's forcing it to run through it. I am stopped by the following:


C:\Codebases\Smaug\SmaugFUSS\src\imc.c In function `ipv4_connect': 4825
C:\Codebases\Smaug\SmaugFUSS\src\imc.c `F_GETFL' undeclared (first use in this function)
(Each undeclared identifier is reported only once
for each function it appears in.)
4826 C:\Codebases\Smaug\SmaugFUSS\src\imc.c `F_SETFL' undeclared (first use in this function)
4826 C:\Codebases\Smaug\SmaugFUSS\src\imc.c `O_NONBLOCK' undeclared (first use in this function)
4835 C:\Codebases\Smaug\SmaugFUSS\src\imc.c `EINPROGRESS' undeclared (first use in this function)
C:\Codebases\Smaug\SmaugFUSS\Makefile.devcc [Build Error] [src/o/imc.o] Error 1


The offending code:
   r = fcntl( desc, F_GETFL, 0 );
   if( r < 0 || fcntl( desc, F_SETFL, O_NONBLOCK | r ) < 0 )
   {
      perror( "imc_connect: fcntl" );
      close( desc );
      return -1;
   }

   if( connect( desc, ( struct sockaddr * )&sa, sizeof( sa ) ) < 0 )
   {
      if( errno != EINPROGRESS )
      {
         perror( "connect" );
         close( desc );
         return -1;
      }
   }
   return desc;


The purpose of the offending block of code is to setup a non-blocking socket connection to the imc server. This works perfectly as is under Linux, Debian, and BSD. Even in Cygwin of all places, I think.

Anyone know how to make this work? Let alone used Dev-C++ to compile SmaugFUSS in? :P

Post is unread #2 Sep 17, 2005 8:26 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Heh, and just like that, Remcon found something that fixed it :)

#ifdef WIN32
   r = 1;
   if( ioctlsocket( desc, FIONBIO, &r ) == SOCKET_ERROR )
   {
      perror( "imc_connect: ioctlsocket failed" );
      close( desc );
      return;
   }
#else
   r = fcntl( desc, F_GETFL, 0 );
   if( r < 0 || fcntl( desc, F_SETFL, O_NONBLOCK | r ) < 0 )
   {
      perror( "imc_connect: fcntl" );
      close( desc );
      return -1;
   }
#endif

   if( connect( desc, ( struct sockaddr * )&sa, sizeof( sa ) ) < 0 )
   {
      if( errno != EINPROGRESS )
      {
         perror( "connect" );
         close( desc );
         return -1;
      }
   }
   return desc;

Post is unread #3 Sep 17, 2005 10:13 pm   Last edited Jan 15, 2006 11:49 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Ok, after some more fiddling I managed to figure out what all it needed to get up and compiled and running using Dev-C++ as the environment.

There is a project file now found in the main SmaugFUSS directory after being untarred. You will need to use that to load the project up. It should specify the customized makefile also in the same directory with it to be used. If it doesn't, you need to make sure it does. It will not compile properly without it.

This support will be considered experimental for now. People unfamiliar with the Dev-C++ environment probably should not be attempting to use it for this. Not like I was all that familiar with it either, but hey.

Some things to be aware of:

1. The IMC support will compile in regardless. Haven't figured out how to do the conditional compile for that.

2. On the same token, IMC will not connect. It gets an error in the ipv4_connect function when trying. Something about a file or directory not found? Any clues on that one would be helpful.

3. Hotboot is not working. Trying to do a hotboot will only cause you grief since it will fail and you will be disconnected. So don't even mention it unless you are offering to fix it. I don't know how.

4. Supposedly the smaug.exe can be run as a service but I have not figured out what commands to do for that so for now clicking on it will run it in the console window ( command line ) and spam all it's log output there.

5. I do not know specifically how to give it a different port, so it will always default to binding port 4000 which should be fine in most circumstances anyway.

This is my first venture into an environment that doesn't behave like Linux, so be gentle :)

Post is unread #4 Sep 19, 2005 1:39 pm   
Go to the top of the page
Go to the bottom of the page

Noplex
Apprentice
GroupMembers
Posts62
JoinedAug 30, 2005

 
Do you have a copy of the changes you made to get this running? I'm going to start coding up something for the Realms of Despair in a few days and I needed a copy of SMAUG that would compile under Dev C++. I'll take a stab at getting Hotboot working, but I think we decided long ago that it doesn't work on Windows simply because you can't copy over applications that are currently running. There's really no point to it, but I'll take a stab. SMAUG can run as a service, I had it working at one point, but that was before I started to use you as a host long ago ;) (and it might have been with SMAUGwiz as well).

The command line should work the same way, no, it doesn't use WinMain as the calling point does it? If that's the case, LPSTR is simply the command line minus argument count. So you're going to need to parse through it, and split it up, etc. Its a pretty big pain in the ass, but I think I might have a object class lying around that does that already.

IPv4 should work fine for IMC2, I had mine working on Windows and Linux. It might just be the matter of changing some of the file paths for the stuff, but once again, shoot me a copy and I'll look into it. I'm having a little bit of host problems right now (Paypal cancelled my subscription when I switched from a debit card to a credit card) but you can email to my comcast address: jbellone at comcast dot net.

Post is unread #5 Sep 19, 2005 6:24 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
The currently available SmaugFUSS 1.6 package contains all of the Dev-C++ changes needed. They are marked in source by WIN32 tags. The project file and custom Makefile are also included in the package.

Post is unread #6 Feb 8, 2006 10:17 pm   
Go to the top of the page
Go to the bottom of the page

Legion

GroupMembers
Posts4
JoinedFeb 8, 2006

 
Hm. Everything was working fine, but just one thing. My version of Dev-C++ does not have Z-lib installed. Did yours ? and if so, which version ? and if not, how would I go about adding it ?

Post is unread #7 Feb 9, 2006 7:12 am   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Try the package updater. I think it's part of the community devpaks. But it does need to be installed separately.

Post is unread #8 Feb 15, 2006 4:48 am   
Go to the top of the page
Go to the bottom of the page

enderandrew

GroupMembers
Posts8
JoinedFeb 8, 2006

 
Can you make a diff/patch file of these changes so we can apply them to other similiar (or already heavily modified) codebases?

Post is unread #9 Feb 15, 2006 8:15 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Making a diff wouldn't be possible to do actually since I don't keep archived copies of older versions around. But you should be able to spot the differences easily enough. They're all marked by WIN32 tags in the code.

Post is unread #10 Feb 15, 2006 10:38 pm   
Go to the top of the page
Go to the bottom of the page

Legion

GroupMembers
Posts4
JoinedFeb 8, 2006

 
*bangs his head on his desk*

Alright. I compile it now, but while it produces .o files, it doesn't produce an executable.

Pages:<< prev 1 next >>