Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - QwazyWabbit

Pages: 1 2 3 4 5 6 7 8 9 [10] 11 12 13 14 15 16 17 18 19 20 ... 81
136
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 24, 2016, 11:53:07 AM »
Beav,
Here's the Windows DLL, it does not require the redistributable runtime msvcr100.dll, it's lib-linked so it should run even if you don't have VS2010 or the runtime DLL installed on your system.

137
/dev/random / Re: The Strange and Interesting Thread
« on: May 23, 2016, 04:22:46 PM »
I'm not surprised. When the grade becomes the goal, the method to get the grade becomes secondary.

By now, the financial stakes are so high that students cannot afford to fail or they lose all ability to pay back their student loans. I expect the same thing is going on in America. I seem to recall something about a US Senator or someone in national office plagiarizing his dissertation... can't recall who now.

I wonder what would happen if they turned IBM's Watson AI loose on every published dissertation or scientific paper.

138
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 09:01:33 PM »
Quote from: beaver{KEA} on May 22, 2016, 05:30:12 PM
Quote from: beaver{KEA} on May 22, 2016, 05:30:12 PM
Tested q2pro on Windows talking to r1q2 server on Windows and it displays OK. I don't have an easy way to set up a Linux server just now.

I think those are single-quotes, not commas. This needs more testing.

I'd like you to remove the \n in the

safe_cprintf(ent, PRINT_HIGH, "%s - '%s'   \n", maplist->mapname, maplist->mapnick);

in Cmd_MapVote function and rebuild to be sure it's not a server problem... this will revert the change and make the mapvote list spammy on the console again. It's the only thing that changed the way the list is displayed.

I'm wondering about the map list file... could there be something in that file that's creating blank strings that the loader is seeing? Zip up your maplist file and attach it. I want to see it directly.

i deleted the \n from
g_cmds.c
remade the .so replaced it.
b.ut still same output nothing changed

i guess i deleted the wrong /n
did it again deleted the right one this time and now mapvote still works but does not display any list at all in console
----------------------------------------
just to be certain.
i re cloned from bitbucket
removed the /n
and no maplist output displays in console

\n not /n there are never /n in printf statements and I found several of them in the old TMG code.
I pushed the change to the repo, pull it again and recompile, that way we know exactly what's changed and can compare results.

I pushed another change. It expands the maplist to 256 and ought to fix that oldframe message on r1q2 clients. I think there's a way to turn it off because I don't see it on my b8012 or b7904 clients, if I can find the command I'll post it.

Two questions: are 256 maps enough now? Are there 256 CTF compatible maps in existence?

139
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 04:26:59 PM »
I use VS2010 so everything is done in the IDE. I have not saved a make file for it and I removed the VS project files from the git repo. I'll add them back in and keep them up to date.

My debug setup is somewhat unconventional because I don't start the DLL from a mixed engine/dll project, I build the dll in its own project and copy the files to the mod directory in a post-build command. When the debugger starts it starts whatever engine I choose and the command line tells the engine what mod to run. It was the most straightforward way I could come up with to build several mods without a lot of setup.

140
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 01:51:22 PM »
Tested q2pro on Windows talking to r1q2 server on Windows and it displays OK. I don't have an easy way to set up a Linux server just now.

I think those are single-quotes, not commas. This needs more testing.

I'd like you to remove the \n in the

safe_cprintf(ent, PRINT_HIGH, "%s - '%s'   \n", maplist->mapname, maplist->mapnick);

in Cmd_MapVote function and rebuild to be sure it's not a server problem... this will revert the change and make the mapvote list spammy on the console again. It's the only thing that changed the way the list is displayed.

I'm wondering about the map list file... could there be something in that file that's creating blank strings that the loader is seeing? Zip up your maplist file and attach it. I want to see it directly.

141
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 12:48:04 PM »
Quote from: beaver{KEA} on May 22, 2016, 08:36:48 AM
Quote from: beaver{KEA} on May 22, 2016, 08:36:48 AM
made a short list. and only last map displays in console
Quote
andaction "DoJo MoJo"
baricade "Baricade"
fortsup "FortSupreme"
mactf05 "mirror"
gymctf2 "gymctf2"
nxctf4 "Heartless"
ul_ctf2 "instantBlues"
marics_ctf21 "VariationBlues"
lmctf39 "LMCTFBlues"



I see what you are saying but I am unable to duplicate it here. I used your long and short lists and it displays correctly here in my r1q2 client. Let me test with q2pro and see if it's a client-side thing.

142
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 12:44:10 PM »
Quote from: beaver{KEA} on May 22, 2016, 08:01:55 AM
Quote from: beaver{KEA} on May 22, 2016, 08:01:55 AM
im just curious.
 if those 128 values were something higher. could i put more than 128 maps?
also is there such a thing as varchar? in this language?

There is no such thing as varchar in C.

In C you must manage the size of strings yourself. If you say char array[10]; then you can put 10 characters into that array. To be a string in C it must terminate with '\0' so that means 9 'printable' chars plus the nul. There is no such thing as a C string type and if you put more than 10 chars into it you have overflowed the array and the results are undefined -- the program can, and probably will, malfunction. This is where bugs live.

It's hard to say about that 128 array. Looking at the code, it's only used in one place and the actual maplist file is managed elsewhere in s_map.c and s_map.h and the size is managed dynamically. I see some strangeness going on between the maplist loading there and the actual map vote system. Let me look into this more deeply.

143
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 12:02:37 PM »
Quote from: beaver{KEA} on May 22, 2016, 07:33:00 AM
Quote from: beaver{KEA} on May 22, 2016, 07:33:00 AM
im struggling through it all dont know anything about linux.
running 64 bit version os cent os 6.
i guess i got all the 32 bit libraries installed or whatever i needed to make everything work.

i cloned it this time.

after cloning do i just move the gamei386.so file into the ctf folder where i run my mod? or do i need to move all those object files too?

Good, if it's running you must have installed the 32-bit libraries correctly.
FYI, the instructions for adding the 32-bit libs are at the top of the makefile.

Yes, just move/copy the .so to the mod folder, you don't care about the object files.

144
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 22, 2016, 04:44:47 AM »
Post your map file, I'm not sure why that list should be wrong or where those commas should be coming from.

As for the messages in console, no, they won't crash the server but I've removed them in the changes yesterday, pull the code again and rebuild.

I hope you cloned the repository. Once cloned, all you need do to keep up is "git pull".

145
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 17, 2016, 12:09:16 PM »
That was easier to fix than I expected it would be. Try it out and see how it looks.

146
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 15, 2016, 09:35:06 PM »
Quote from: beaver{KEA} on May 15, 2016, 10:18:18 AM
Quote from: beaver{KEA} on May 15, 2016, 10:18:18 AM
just tried it out! the mapvote works perfect first try!

thank you! i can now convert my windows machine to linux!

i wasnt able to get map rotation to work properly ether or highscores working. nether are very important.

i do wish i could get wallfly setup on my server eventually.

but i will test  this new build out n see how it all goes!

Cool! Always nice when it works right the first time.
I looked at map voting and it looked broken to me, I have not touched the functionality at all so it's good to know it works at this stage.

I haven't looked at map rotation or highscores at all yet.
I've been re-stacking the code to be a little more organized so that any changes will be coherent going forward. Headers are all jumbled up and declarations are thrown around all over the place. I had a fun learning curve with GIT to get over as well.

I just found a bug that crashes the server involving the menu when you're dead. I'm tracking it down now.


147
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 14, 2016, 05:20:15 PM »
Hey all,
I have been granted access to the repository at https://bitbucket.org/jwaggoner/tmg
and after some general learning curve difficulties changing over from my local SVN repository to the git system, I've updated the code there and you can now clone the latest changes. It should all be good in Linux and Windows.

Caution: the VS project files might need tweaking for your local setup, I didn't put the mod in my ctf folder.

If you spot a bug, let me know.

QW

148
0x1337c0de / Re: Unsequenced modification and access to 'n'
« on: May 13, 2016, 09:42:17 PM »
That's very interesting, OS X is based on FreeBSD. The compiler version will have the most influence of course. What version compiler does he have and what version OS?

The convert_string function is in g_utils.c in the TMG mod. You can copy-paste the code from here into your copy. The archive I posted May 7 has the bug, the one I posted May 8 has a version of my replacement and should work correctly.

149
0x1337c0de / Unsequenced modification and access to 'n'
« on: May 12, 2016, 01:28:14 AM »
While hacking TMG mod I found this little gem:

Code: [Select]
// From QDevels, posted by outlaw
void convert_string(char *src, char start, char end, char add, char *dest)
{
    int n = -1;
    while ((dest[++n] = src[n]))
        if ((dest[n] >= start) && (dest[n] <= end) && (dest[n] != '\n'))
            dest[n] += add;
}

/* Examples of convert_string usage
 {
 char  text[] = "abcdefgABCDEFG1234567\n\0";
 convert_string(text, 'a', 'z', ('A'-'a'), text); // a -> A
my_bprintf (PRINT_CHAT, "text = %s\n", text);
 convert_string(text, 'A', 'Z', ('a'-'A'), text); // A -> a
my_bprintf (PRINT_CHAT, "text = %s\n", text);
 convert_string(text, 0, 127, 128, text); // white -> green
my_bprintf (PRINT_CHAT, "text = %s\n", text);
 convert_string(text, 128, 255, -128, text); // green -> white
my_bprintf (PRINT_CHAT, "text = %s\n", text);
 }
 */

What first caught my eye was the warning from the compiler per the subject line but second was the fun and exciting int n = -1; initialization. OK, so we're being really 1337 coder and were starting the index off below the array bounds of dest and the ++n is going to make it 0 before it puts the value of src[n] into the destination.... or does it?

The warning is about that dest[++n] thing. This is a reliance on undefined behavior in C and it can be a nasty bug. It will work fine in one platform and fail in another and it can take some time to fix if it's buried deep enough. As it was, Microsoft Visual Studio 2010 likes it and it works. It also works on Ubuntu and GCC 4.8.4 but it doesn't work on OS X, using clang/LLVM. Since Microsoft is migrating to using clang on their compiler suite you can expect this function will break when compiled on the new tools or in their Azure cloud. It may also fail on newer versions of GCC on other Linux distributions.

OK, so how to fix it? Answer: pointers instead of array indexes.

Code: [Select]
/**
 Replace characters in destination string.
 Parameter 'add' is added to each character found in source and result is placed in dest.
 Parameters 'start' and 'end' specify character range to replace.
 Source text must be a valid C string.
*/
//QwazyWabbit// A pointer version to eliminate undefined behavior.
void convert_string(char *src, char start, char end, char add, char *dest)
{
while ((*dest = *src)) {
if ((*dest >= start) && (*dest <= end) && (*dest != '\n'))
*dest += add;
src++, dest++;
}
}

In keeping with the existing 1337ness of the code, I made good use of the comma operator. :)

If your projects contain this original Qdevels/outlaw function I urge you replace it ASAP. You'll know the old one is broken when your Q2 strings and chats suddenly become blank when you port your mod instead of green or white.

In addition, I offer the following wrapper functions to use in place of the rather complicated direct uses of the 'convert_string' function:

Code: [Select]
/**
 Set msb in specified string characters, copying them to destination.
 Text must be a valid C string.
 Source and destination can be the same.
 If dest == NULL the action occurs in-place.
 */
void highlight_text (char *src, char *dest)
{
if (dest == NULL)
dest = src;
convert_string(src, 0, 127, 128, dest); // white -> green
}

/**
 Clear msb in specified string characters, copying them to destination.
 Text must be a valid C string.
 Source and destination can be the same.
 If dest == NULL the action occurs in-place.
 */
void white_text (char *src, char *dest)
{
if (dest == NULL)
dest = src;
convert_string(src, 128, 255, -128, dest); // green -> white
}

/**
 Make text uppercase.
 Text must be a valid C string.
 Source and destination can be the same.
 If dest == NULL the action occurs in-place.
 */
void toupper_text(char *src, char *dest)
{
if (dest == NULL)
dest = src;
convert_string(src, 'a', 'z', ('A'-'a'), dest); // a -> A
}

/**
 Make text lowercase.
 Text must be a valid C string.
 Source and destination can be the same string.
 If dest == NULL the action occurs in-place.
 */
void tolower_text(char *src, char *dest)
{
if (dest == NULL)
dest = src;
convert_string(src, 'A', 'Z', ('a'-'A'), dest); // A -> a
}


Testbed code:

Code: [Select]
#include <stdio.h>

int main(int argc, const char * argv[])
{
char otext[] = "abcdefgABCDEFG1234567";
char text[]  = "abcdefgABCDEFG1234567\n";
char target[sizeof text];

toupper_text(otext, target); // a -> A
printf ("otext   = %s\n", otext);
printf ("target  = %s\n", target);
toupper_text(text, NULL); // a -> A
printf ("text    = %s\n", text);

tolower_text(otext, target); // A -> a
printf ("otext   = %s\n", otext);
printf ("target  = %s\n", target);
tolower_text(text, NULL); // A -> a
printf ("text    = %s\n", text);

highlight_text(otext, target); // white -> green
printf ("otext   = %s\n", otext);
printf ("target  = %s\n", target);
highlight_text(text, NULL); // white -> green
printf ("text    = %s\n", text);

white_text(target, otext); // green -> white
printf ("target  = %s\n", target);
printf ("otext   = %s\n", otext);
white_text(text, NULL); // green -> white
printf ("text    = %s\n", text);

return 0;
}

150
Trouble Shooting / Re: Help setting up Railwarz CTF Linux Server
« on: May 08, 2016, 09:32:05 PM »
You're welcome. I've enjoyed hacking this mod a bit.

Here's another updated zip file.

This version compiles cleanly on Linux, OS X and Windows.
I also fixed the timeleft and GetTime functions that were a little kluged.

The convert_string function contained a dependency on undefined behavior that was spotted by clang on OS X. The function failed on OS X. I don't have a Linux server so I don't know if it was broken in Linux like it was on Mac. I rewrote it so it works properly on all platforms and added some wrapper functions that might be useful.

Fixed some buffer overflows that were glaringly obvious.
Any warnings or errors you get now will be your own. :)

Pages: 1 2 3 4 5 6 7 8 9 [10] 11 12 13 14 15 16 17 18 19 20 ... 81