Results 1 to 7 of 7

Thread: Any interest in this?

  1. #1
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts

    Any interest in this?

    Hey guys,

    I managed to reduce the footprint of the cod2 server files to a whopping 325 meg, using some dirty, dirty libcod tricks.

    Anyone interested in this?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following 3 Users Say Thank You to IzNoGoD For This Useful Post:

    voron00 (26th March 2016),Whiskas (26th March 2016),YuriJurek (26th March 2016)

  3. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Just to clarify: this modification works with sv_pure 1 as well, clients wont need to download anything
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. #3
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Click image for larger version. 

Name:	tumblr_m81ogfNtuT1qltwxqo1_r2_500.gif 
Views:	109 
Size:	348.4 KB 
ID:	1043

    10char
    sudo apt-get rekt

  5. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Firstly, add this to your libcod.cpp:
    PHP Code:

    cHook 
    *hook_fs_restart;

    int fs_restart(int a1)
    {
        
    a1 1337;
        *(
    int*)0x844020C 1337;
        
    hook_fs_restart->unhook();
        
    int (*sig)(int a1);
        *(
    int *)&sig hook_fs_restart->from;
        
    int ret sig(a1);
        
    hook_fs_restart->hook();
        for(
    int= *(int**)0x849FD68!= NULL= *(int**)i)
        {
            if(*(
    char**)(i+1))
            {
                if(!
    strncmp((char*)(*((int *)1) + 512), "main"4))
                {
                    
    chariwdname = (char*)(*((int *)1) + 256);
                    
    intchecksum = (int*)(*((int *)1) + 772);
                    
    intchecksump = (int*)(*((int *)1) + 776);
                    if(!
    strncmp(iwdname"iw_00"5))
                        *
    checksum 178615151;
                    else if(!
    strncmp(iwdname"iw_03"5))
                        *
    checksum 1659111092;
                    else if(!
    strncmp(iwdname"iw_04"5))
                        *
    checksum = -1652414412;
                    else if(!
    strncmp(iwdname"iw_05"5))
                        *
    checksum 1842349204;
                    else if(!
    strncmp(iwdname"iw_06"5))
                        *
    checksum 1053665859;
                    else if(!
    strncmp(iwdname"iw_07"5))
                        *
    checksum 1046874969;
                    else if(!
    strncmp(iwdname"iw_08"5))
                        *
    checksum 1101180720;
                    else if(!
    strncmp(iwdname"iw_09"5))
                        *
    checksum = -621896007;
                    else if(!
    strncmp(iwdname"iw_10"5))
                        *
    checksum 1334775335;
                    else if(!
    strncmp(iwdname"iw_11"5))
                        *
    checksum = -1980843666;
                    else if(!
    strncmp(iwdname"iw_12"5))
                        *
    checksum = -1333623355;
                    else if(!
    strncmp(iwdname"iw_13"5))
                        *
    checksum 780394069;
                    else if(!
    strncmp(iwdname"iw_14"5))
                        *
    checksum = -1449716526;
                    else if(!
    strncmp(iwdname"iw_15"5))
                        *
    checksum 181429573;
                    if(!
    strncmp(iwdname"iw_00"5))
                        *
    checksump = -611799356;
                    else if(!
    strncmp(iwdname"iw_03"5))
                        *
    checksump = -2036896789;
                    else if(!
    strncmp(iwdname"iw_04"5))
                        *
    checksump = -1238585410;
                    else if(!
    strncmp(iwdname"iw_05"5))
                        *
    checksump 456204364;
                    else if(!
    strncmp(iwdname"iw_06"5))
                        *
    checksump = -1435860022;
                    else if(!
    strncmp(iwdname"iw_07"5))
                        *
    checksump 508398181;
                    else if(!
    strncmp(iwdname"iw_08"5))
                        *
    checksump = -125161610;
                    else if(!
    strncmp(iwdname"iw_09"5))
                        *
    checksump = -1575356890;
                    else if(!
    strncmp(iwdname"iw_10"5))
                        *
    checksump = -1120125128;
                    else if(!
    strncmp(iwdname"iw_11"5))
                        *
    checksump 1355810507;
                    else if(!
    strncmp(iwdname"iw_12"5))
                        *
    checksump 1210336806;
                    else if(!
    strncmp(iwdname"iw_13"5))
                        *
    checksump = -1718123365;
                    else if(!
    strncmp(iwdname"iw_14"5))
                        *
    checksump = -2049617909;
                    else if(!
    strncmp(iwdname"iw_15"5))
                        *
    checksump = -914322415;
                }
            }
        }
        return 
    ret;

    And this on the proper spot:
    PHP Code:
                hook_fs_restart = new cHook(0x80A337A, (int) fs_restart);
                
    hook_fs_restart->hook(); 
    Then, extract all your iwds (excluding the localized_english ones and iw_01 and iw_02, which contain sp maps only anyway). Extract them all to a different folder (extract iw_00 to a folder named iw_00 etc)
    Then, run this python3 script from the root of that folder:
    PHP Code:
    import os

    startdir 
    os.getcwd()

    for 
    subdir in os.listdir(startdir):
        
    iwddir os.path.join(startdirsubdir)
        for 
    src_dirdirsfiles in os.walk(iwddir):
            for 
    file in files:
                if(
    file.endswith(".iwi") or file.endswith(".mp3") or file.endswith(".wav") or file.endswith(".dds") or file.endswith(".d3dprt") or file.endswith(".hlsl") or file.endswith(".tga") or file.endswith(".jpg") or file.endswith(".rmb") or file.endswith(".roq") or file.endswith(".spd") or file.endswith(".tech") or file.endswith(".techset") or file.endswith(".tmp") or file.endswith(".tga0")):
                    
    os.remove(os.path.join(src_dirfile))
                    
    open(os.path.join(src_dirfile), 'a').close() 
    Then manually remove the sp maps from your folders (iw_00 and iw_03 contain some)

    Then, run this .bat script from the root of your extraction folder:
    PHP Code:
    for /%%d in (*.*) do "C:\program files\7-zip\7z.exe" -tzip "%%d.iwd" ".\%%d\*" 
    This should give you the iwds required. Then, extract all localized_english iwds into a single folder and delete everything except for the localizedstrings folder. Pack this folder into localized_english_iw99.iwd.

    Now your iwds are ready.



    Few things to note:
    - To make sv_pure 1 work I had to un-randomize the checksumfeed. This means your server will be a little less secure against malicious players trying to join with modified iwd files (the 1337 is replacing the checksumfeed)
    - iw_15 has a different checksum in patch 1.2. For patch 1.2 either backtrace what i did or just keep the file unmodified. Remove the iw_15 lines from the libcod.cpp as well for 1.2
    - As most people will be running their servers without modified iwds, i strongly suggest to either not merge this into the libcod code, or to let it be controlled by some cvar.
    - If you have any problem with this code, you should just run your cod server unmodified.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. The Following 4 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (27th March 2016),maxdamage99 (26th July 2016),vesicant (11th April 2022),voron00 (26th March 2016)

  7. #5
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    What is the improvement compared to regular server? Speed, traffic?

  8. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Just hdd usage.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  9. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Follow-up on this: it caused some issues with custom maps, giving clients a iwd mismatch error. Might investigate some time in the future.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •