Announcement

Collapse
No announcement yet.

COMPILE: Linux Port

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    struct MapPointData and struct TileUtility

    Anyone know why struct MapPointData and struct TileUtility are defined twice? Once in gs/outcom/IMapPointData.h and once in gs/world/MapPoint.h

    The only difference is the size of the map points. 16 bits in IMapPointData.h (plus padding).

    Mike

    Comment


    • #62
      Re: struct MapPointData and struct TileUtility

      Originally posted by closms
      Anyone know why struct MapPointData and struct TileUtility are defined twice?
      Silly me. MapPointData in IMapPointData has a z component. I'm going to rename it to MapPointData3

      Mike

      Comment


      • #63
        The one with a z component is probably a leftover of CTP1, where it was used for the space layer.

        Comment


        • #64
          Glad to see you around closms

          BTW, could you email me with the CVS server address and an active account so I can log in?

          Comment


          • #65
            Hi,

            i'd also to help out with the linux port, although my time is quite limited until end of march...

            Here comes a short description about me as on sign up thread:

            SECTION: programming, coder, linux port
            COMPILER: gcc 3.3.2
            BACKGROUND: about 6 years experience in c++, 4 years using gnu tools (e.g. autoconf, automake, libtool, make, etc.)
            AVAILABILITY: pending, quite limited until end of march (a few hours per weekend until then)

            areas of interest: native linux port

            Well, another dreaming would be keeping the codebase of the windows and linux port in sync, forming a multiplatform build.
            By having same codebase, we could ensure compability for savegames and multiplayer code (e.g. by common use of sdl, openal, and anet and using #ifdef conditionals for the hopefully rare cases where os dependent code needs to be used).

            Well, a few questions are open, though:
            What tools are intended for use despite make, gcc, sdl, anet and openal (those i found mentioned within the threads)?
            Are there any coding guidelines (e.g. style, naming, etc.)?
            Is e.g. the use of autoconf/automake/libtool planned, or do we kiss by using plain gnu Makefiles and selecting simplicity over portability/configurability?

            Well, i'd be happy if i got a cvs account to introduce myself to the current source changes, but i'd even be glad if we get it running on linux...

            Ciao
            Holger

            Comment


            • #66
              anet 0.10 gcc 3.3 patch

              Hi,

              with strict aliasing, type punning (sharing one adress among different typed references) gives warnings when using gcc 3.3. This applies also e.g. to (void **)
              casts of references to references of any non-void type.
              Together with -Werror, compile of anet fails.

              Additionally, gcc3.3 does not like strings which do not end in the same line.

              The patch below fixes those problems:
              - typeref changed to voidref, where typeref was not needed
              - where typeref is needed, voidref was introduced as a temporary and the reference to that voidref was passed
              - strings were corrected to end in the same line

              Ciao
              Holger
              Attached Files

              Comment


              • #67
                Originally posted by Keygen

                BTW, could you email me with the CVS server address and an active account so I can log in?
                Hi Keygen,

                I sent you the info to get on the cvs server a while back. Haven't heard anything, just want to make sure that you got it.

                Mike

                Comment


                • #68
                  closms, I haven't received anything yet.

                  Try marc13@otenet.gr if not already.

                  Comment


                  • #69
                    cvs address.

                    e-mail me the cvs server address.

                    Comment


                    • #70
                      Re: cvs address.

                      Originally posted by killertux
                      e-mail me the cvs server address.
                      Hi killertux. I'm glad to see more interest in the linux port. You need to download the original source distribution (the .exe file) and use wine to unpack it so you can agree to the EULA. After you've done that send me an email (closson@cs.ualberta.ca) and I'll set you up with an account.

                      Mike

                      Comment


                      • #71
                        Start of COM-replacement

                        Hi,

                        i have done some tests on the mm-concept i wrote and implemented a few test classes. After it was ready i noticed a big issue:
                        If you pass the pointer of a superclass of a class to a method, it does AddRef() and Release correctly. But when it comes to destruction of the object, only the destructor of the superclass and its superclasses is called. I realized it when i finally got the plugin system working, using a superclass CTP2Plugin for returning loaded plugin instances.
                        So i restarted implementation with a similar scheme (abstract classes as interfaces, statically compiled in type ids).
                        Here is a test program which shows how interfaces can be used (similar to com or any other object model):
                        Code:
                        #include "ctp2_config.h"
                        #include "ctp2_os_types.h"
                        
                        #include "IC2Interface.hpp"
                        #include "IC2Test.hpp"
                        #include "C2Factory.hpp"
                        
                        #include 
                        
                        int main(int argc, char **argv)
                        {
                          IC2Factory *factory = new C2Factory();
                          IC2Interface *iface = 0;
                          C2FactoryStatus fst = factory->createInstance(C2CID_C2Test,
                                                                        &iface);
                          if (factory_OK == fst) {
                            void *obj = 0;
                            C2IQueryStatus ist = iface->QueryInterface(C2IID_IC2Test,
                                                                       &obj);
                            if (qst_OK == ist) {
                              IC2Test *test = (IC2Test *) obj;
                              test->test();
                              iface->Release();
                            }
                            iface->Release();
                          }
                        
                          std::cout << "Test" << std::endl;
                        
                          delete factory;
                          factory = 0;
                        
                          return 0;
                        }
                        There will be a global factory pointer theC2PluginFactory, which can be used to create instances of registered classes, mainly plugins. It will replace the C2Factory without notice; C2PluginFactory will also be able to load classes from plugins. It will be initialized when main() is entered and destroyed when the program terminates.
                        A plugin will contain the following C functions and must have a corresponding C2ClassId with creation code statically implemented within C2PluginFactory::createInstance().
                        Code:
                        IC2Interface ctp2plugin_create_instance(IC2PluginFactory *caller, void *data);
                        void ctp2plugin_delete_instance(IC2Interface *instance);
                        const C2ClassID ctp2plugin_get_classid();
                        const char *ctp2plugin_get_upn();
                        The following picture contains a prerelease of the corresponding interface design (hope it is in sync with its implementation so far),
                        including the first interfaces (mapgen plugins) to implement next.
                        Not interfaced classes (i.e. classes not derived from abstract classes) will use a simple new/delete mechanism as suggested by Fromafar. When the plugin loading mechanism is reimplemented, too, i'll commit the changes to cvs, and start with adapting mapgen to that and getting things to compile.

                        Ciao
                        Holger

                        PS: Image is a zipped png, upload failed due to image size (916x647).
                        Attached Files

                        Comment


                        • #72
                          Re: Start of COM-replacement

                          Originally posted by ctplinuxfan
                          Hi,

                          i have done some tests on the mm-concept i wrote and implemented a few test classes. .....
                          Hi Holger, this looks great! Please keep in mind that we would like to merge the windows version and the linux version someday, so anything to make that easier is encouraged.

                          I'm not a COM expert, so I trust you know what you're doing .

                          Mike

                          Comment


                          • #73
                            C2OM base done/Refactoring needed?

                            Hi,

                            the basics of the com replacement are implemented, i named it c2om...
                            The replacement supports components linked to the executable and components as shared libraries.

                            The changes made in branch com_rewrite_alpha so far:
                            * Added base/* (factory + id constants headers + stub plugin header)
                            * Added config/* autoconf related stuff
                            * Added include/* common headers for os related stuff
                            * Added test/base/* test cases for c2om

                            I needed to rename ctpdb.y to ctpdb_yacc.y and ctpdb.l to ctpdb_lex.l to resolve naming conflicts within autoconf. Perhaps the same needs to be done for the slic parser.

                            Beyond that, the following parts are autoconfed and compile:
                            * base
                            * mapgen
                            * gs/dbgen
                            * test/base

                            So theoretically, we have working map plugins. The rest needs to be autoconfd, too.

                            One ugly thing is the build dependency tree: You cannot simply make a whole subdir, but have to jump back and forth.
                            For now i thought of removing the SUBDIRS entry within Makefile.am and running make -C dir for the needed targets, if dir does not fit into a sequential run through all subdirectories.

                            Ciao
                            Holger

                            PS: Ah, making under linux: first change to ctp2_code, then run:
                            config/bootstrap && ./configure && make

                            Plugin mechanism changed (forgot the argument parameters).
                            Function prototypes are in base/ctp2plugin_prototype.h
                            Code:
                            const C2FactoryStatus ctp2plugin_create_instance(
                                                               class IC2Interface **iface,
                                                               class IC2PluginFactory *pf,
                                                               const uint32 argc, void **argv);
                            void ctp2plugin_delete_instance(class IC2Interface *iface);
                            const C2ClassID ctp2plugin_get_classid();
                            const char * ctp2plugin_get_upn();
                            I made smaller changes to the base framework (changing most arguments to const references, because calls then need no stack copies and code runs faster).
                            The IC2Factory derives from IC2Interface now (because a plugin containing multiple components needs to pass a creation factory with ctp2plugin_createInstance(...)).

                            Attached the changes to the base interfaces.
                            Attached Files

                            Comment


                            • #74
                              Hi,

                              i just added sdl sound implementation to civctp, leaving cdrom volume open (on linux possibly an ioctl SOUND_MIXER_WRITE_CD, on windows: don't know ).

                              So SDL sound and music (cdrom) works under windows and the sound stuff compiles at least under linux...

                              Ciao
                              Holger

                              PS: Changes to the related files between activision code, linux code and the sdl addition got already merged into cvs.

                              I might be busy for a moment; as soon as i can spend some time i'll merge the plugin replacement into HEAD (hope i need not to merge between 4 revisions like it was the case for sdl implementation )

                              Comment


                              • #75
                                Progress Report.

                                Hello All,

                                Well, I guess you could say that the first milestone has been reached. All the code now compiles!

                                I'm working on getting a binary built, as far as a know, these are the issues relating to that.

                                1. For calls to windows specific code, do we reimplement, or use wine.
                                2. You can't pass non-pod (Plain Old Data) data types to a variable length argument list function. So I guess the most straight forward way is to pass a pointer to the object.
                                3. SDL classes for graphics and sound (thanks to Holger!)

                                btw, gcc v3.0 _cannot_ compile some of the stl code in ctp2. I'm using gcc 3.2.2.

                                Also, Johannes Sixt has been working by himself on porting this to linux as well. He can start the game, create cities, etc. Excellent work! We sent me a patch against the original source. I will drop the patch into cvs (I probably won't apply it). So to Johannes!

                                Mike

                                Comment

                                Working...
                                X