alliedmodders / stripper-source

Stripper:Source
Other
64 stars 16 forks source link

Stripper breaks '\n' in entities. #2

Closed BotoX closed 9 years ago

BotoX commented 9 years ago

There are a few zombie escape maps which make use of newlines in game_text entities like this:

entity
{
    "id" "2708531"
    "origin" "-13026 14610 8"
    "y" ".3"
    "x" ".05"
    "targetname" "Knife_Frost_HudHint"
    "spawnflags" "0"
    "message" "Name: Frost Magick 
Description: Ice Age ! 
Effect: Slow Humans 
Duration: 4 Secs 
Cooldown: 90 Secs"
    "holdtime" "7"
    "fxtime" "0.5"
    "fadeout" "2"
    "fadein" ".02"
    "effect" "2"
    "color2" "128 255 255"
    "color" "0 255 255"
    "channel" "4"
    "classname" "game_text"
}

If stripper is loaded the message will either not work at all or cut off after the first newline.

I was trying to fix this myself but it seems like I am unable to compile stripper, since there are also no instructions on how to do so. I made a build directory, changed the paths in the AMBuildScript to reflect the real paths of the sdk, ran CC=gcc CXX=gcc python3 ../configure.py --enable-optimize and then python3 build.py It seemed to compile a few things and create the package with all the correct files. Yet stripper wouldn't load with the following error message: Failed to load plugin addons/stripper/bin/stripper_mm (Could not find LoadStripper function).

BotoX commented 9 years ago

Issue fixed by changing parsers.cpp SetEntityList(const char *ents)

    size_t _tmpsize = 0;
    size_t pos = 0;
    char in_string = 0;
    for (size_t i=0; i<len; i++)
    {
        if (ents[i] == '"')
            in_string ^= 1;

        if ((ents[i] == '\n' || ents[i] == '\r') && !in_string)
        {
            /* check if we should expand the buffer */
            if (i-pos+1 >= _tmpsize)
            {

For some reason I am still unable to build the stripper.16.css.so, getting Failed to load plugin addons/stripper/bin/stripper_mm (Could not find LoadStripper function). But thankfully the stripper.core.so works.

It doesn't seem to introduce any new bugs, at least on ze_FFXII_Westersand_v8beta6 which is a really big map that uses a lot of advanced stuff. diff from the two dumps: https://p.botox.bz/raw/udag

BotoX commented 9 years ago

Since the maintainer of this repo seems to be inactive I'll post the compiled version of this fix: https://i.botox.bz/stripper.core.so in case somebody needs this.

ghost commented 9 years ago

And why no pull request? :cry: Better as precompiled binary with no source.

BotoX commented 9 years ago

I am was unsure about my solution to fix this issue, and since it only changes two lines I was too lazy to make it a pull request, I guess I will make one now that you mentioned it. (If you read my issue there is source lol)

Drifter321 commented 9 years ago

Didnt know not replying within 2 days (during the work week) was being inactive.

BotoX commented 9 years ago

Sorry, I tried contacting you via IRC (where you seemed to be rather active as far as I remember) and you didn't respond to me, that's why :v