Server Help

Misc User Apps - Fixed Subbill No more high CPU stress, always 0% CPU Usage.

fatrolls - Mon Apr 07, 2014 7:12 pm
Post subject: Fixed Subbill No more high CPU stress, always 0% CPU Usage.
Patched Subbill.exe v0.23
Patched offset 0x00000B53 from 0x00 to 0x0A

Seems I reverted it back to Original Subbill before someone patched it before me to 0x00

Which just changes
Sleep(0);
to
Sleep(10);

Why would you want to Sleep for 0 anyways it doesn't do anything afaik.

Takes about 2,4 Megs of Memory not too bad.
Also did you know that the original Subbill is pretty good to use as permanent solution could support over millions of logins without storing them in one risky file User.dat,

All you have to enable is ODBC data source which connects to SQL Server. (I think it's Microsoft SQL Server).

Has SQL commands such as
Code: Show/Hide

INSERT INTO Usage (ServerID,PlayerCount,UsageStamp) VALUES (%d,%d,%s)
INSERT INTO Usage (ServerID,PlayerCount,UsageStamp) VALUES (0,%d,%s)
UPDATE Users SET Banner='%s' WHERE UserID=%d
INSERT INTO Security (UserID,ServerID,MessageText,MessageTime) VALUES (-1,%d,'%s',%s)
INSERT INTO Security (UserID,ServerID,MessageText,MessageTime) VALUES (%d,%d,'%s',%s)
INSERT INTO Messages (FromUserID,ToUserID,ServerID,MessageText,MessageTime) VALUES (%d,%d,%d,'%s',%s)
UPDATE Users SET Squad='%s' WHERE UserID=%d
INSERT INTO Squads (SquadName,SquadPassword,SquadCreatorID) VALUES ('%s','%s',%d)
UPDATE Users SET Squad='' WHERE UserID=%d
UPDATE Users SET Squad='' WHERE Squad='%s'
DELETE FROM Squads WHERE SquadName='%s'
UPDATE Users SET Squad='' WHERE Alias='%s' AND Squad='%s'
UPDATE Squads SET SquadPassword='%s' WHERE SquadName='%s'
UPDATE Users SET Password='%s' WHERE UserID=%d


There is 2 SQL Procdures (Which may be hard to recreate.)
Code: Show/Hide

EXECUTE StandardUserLogOut @pUserID=%d,@pDeltaSeconds=%d,@pLastMachineID=%d,@pLastTimeZoneBias=%d,@pLastIP='%s',@pServerID=%d,@pReason=%d,@pPacketLossS2C=%d,@pPacketLossC2S=%d,@pPing=%d,@pLatency=%d,@pZoneData=0x%sFF,@pScoreID=%d

EXECUTE StandardScoreUpdate @pZoneData=0x%sFF,@pScoreID=%d,@pUserID=%d


Seems the sql files were either lost or never got transfered from Virgin Entertainment.

It contains for squad commands the message *UNKNOWN* which is the same as in SSC makes me think SSC Biller is just a patched Subbill for SSC Billing server.
Cheese - Mon Apr 07, 2014 8:36 pm
Post subject:
1) who are u
2) how long have u played this game
3) why do u seem to know what you are doing
4) why do u have a compulsive disorder of some kind
fatrolls - Mon Apr 07, 2014 9:52 pm
Post subject:
I like perfecting things as far as I can. You know who I am I seen you on distension in tw. I usually played/hanged out in EG since 2001 I even got my name on some of the bases I made there ages ago in EG.

Other then that I'm just trying to help out
Cheese - Tue Apr 08, 2014 1:53 am
Post subject:
well i hope u are legit because u seem to know what u are doing
Cheese - Tue Apr 08, 2014 5:33 pm
Post subject:
if you ever start working on subgame:

an extremely huge problem with subgame is that there is a traffic limiter that crashes the zone if a sysop sends commands too quickly

talk to jabjabjab ingame for extra info, he thinks he found a hex offset or something awhile back
cycad - Thu Apr 10, 2014 12:12 am
Post subject:
fatrolls wrote:
Why would you want to Sleep for 0 anyways it doesn't do anything afaik.

It's a thread yield.

fatrolls wrote:
It contains for squad commands the message *UNKNOWN* which is the same as in SSC makes me think SSC Biller is just a patched Subbill for SSC Billing server.

Probably, I have 0x407DC0 labelled as ODBC_ExecuteQuery, which in the binary we have returns 0. PriitK probably patched it to execute the query. He also probably patched 0x407DB0 to initialize the database and database connection, which I labelled as ODBC_Connect. These functions belong to an ODBC class, which contains other related functions.

In the build we have, preprocessor options were probably defined to prevent generation of the ODBC function bodies.

Who knows what other pieces are incomplete or missing, though.
cycad - Thu Apr 10, 2014 12:26 am
Post subject:
Cheese wrote:
if you ever start working on subgame:

an extremely huge problem with subgame is that there is a traffic limiter that crashes the zone if a sysop sends commands too quickly

This is pretty easy to patch, such as at https://github.com/cycad/SubGame-Addon, but the real issue is that PriitK is unwilling/unresponsive to using any patched server (or client for that matter). This unfortunately leads to patches having no impact.
CypherJF - Thu Apr 10, 2014 8:16 am
Post subject:
cycad wrote:
[..]


This is pretty easy to patch, such as at https://github.com/cycad/SubGame-Addon, but the real issue is that PriitK is unwilling/unresponsive to using any patched server (or client for that matter). This unfortunately leads to patches having no impact.


I remember working with this when you sent it to me a while ago but I guess I was looking to see if it was possible for more call backs to be added for all the game events (detect if a player dies, spawns, moves, etc). Conceptually this is interesting but not knowing asm to know how to further expand on it (or if it's even possible) leaves it to very limited use?
cycad - Thu Apr 10, 2014 3:28 pm
Post subject:
CypherJF wrote:
I remember working with this when you sent it to me a while ago but I guess I was looking to see if it was possible for more call backs to be added for all the game events (detect if a player dies, spawns, moves, etc). Conceptually this is interesting but not knowing asm to know how to further expand on it (or if it's even possible) leaves it to very limited use?

I don't want to threadjack but yes, adding hooks anywhere takes some specialized knowledge. Needed hooks can be added by me or other reversers fairly easily, which could then be exported cleanly to plugins via the API, found in libaddon.hpp. There's only a few events but many others could be added quickly. I've reversed large portions of subgame2.exe off and on over the last 8 years or so. Based on that reversing work it's easy to make patches since it provides the roadmap to what is going on in the binary's assembly. If you don't have a roadmap adding hooks is an impossibility.

At this point with modern tools I wouldn't be surprised if it were entirely possible to decompile the original binaries into assembly-based projects, which at that point relevant portions of code could be rewritten by hand in C, or even decompiled automatically with tools like Hex-Rays.

This could be done with for the biller or even the client, too. I'll post more on this in another thread.
fatrolls - Thu Apr 10, 2014 10:06 pm
Post subject:
cycad wrote:
It's a thread yield.


Haha a thread yield you say? using a simple Sleep call how does that work? Either way whatever it's purpose it keeps CPU in high usage, have you figured out a way around patching just maybe a missing INI settings or some command line parameter the prevents the CPU from spiking? I don't think they would of used these biller servers if they made the CPU burn like this or maybe it ran differently/just right on slow windows 95 computers.

Haha as far as bragging goes i'm one of the few people that actually have a rare pdb files for subgame and subbill, although they are old dated with Nov,10,1997 and seem to not match properly in some areas they still give a good insight funny story how I found em I used to be using altavista as my search engine I was looking for what everyone was talking about back then Twister and I found some site back then I remember it had a bunch of zone settings in one file as well as twister in another file and other file were just server+biller repack of some sort and to my surprise I didn't understand what those pdb files did back then but I kept it all, the files themselves seem useless for continuum though. If you are lucky enough to figure out the website you maybe able to get them from archive.org
fatrolls - Sat Apr 26, 2014 12:18 pm
Post subject:
I'd like to correct you on thread yield idea you had cycad.

subgame and subbill were both made for Windows 95 this is back when threads / threading didn't even exist they did have multi-tasking though.

The way subgame seems to be completely single threaded the Sleep(0); was probably required for Windows 95 multi-tasking so the application doesn't hog the whole system up. Kinda like DoEvents() in Visual Basic I think.

There is no CreateThread API's and yeah that api only existed since Windows XP.

It also spawns other programs in the background like tracert and has the ability to spawn itself for multiple zones and to just run remote tools.

Such as this example:
In a batch file type

Code: Show/Hide

subgame2 /SPAWN notepad


you could use that to open notepad using subgame2

/SPAWN command runs cmd.exe or command.com whichever your OS supports with a /c flag

I don't think the /SPAWN command was used for anything else then spawning other subgame servers.

you could use

Code: Show/Hide

subgame2 /SPAWN subgame2


this will spawn 2 subgame2 servers in one command prompt probably not to have too much command prompt windows on the screen, it will still run 2 processes.

I was thinking that subgame2 was like httpd (apache) where it spawns a bunch of processes of itself for multiple connections, but that will have a hard time synchronizing stuff only thing it spawns is the tracert program which is used for the command *trace

Also I wonder I'm checking out the Subspace CD server files and I can't seem to find the tracert.exe executable even though the command exists in the subgame.exe I guess they forgot to include it and everytime someone did the trace command the subgame.exe would crash haha.

Seems the official tracert.exe was never leaked and was remade by PriitK luckily it doesn't seem too important biggrin.gif
Cheese - Sat Apr 26, 2014 6:46 pm
Post subject:
is it possible whatever compiler he was using saw the 0 in sleep(0) and optimized away the entire thing because 0 < 1
cycad - Tue Apr 29, 2014 9:08 am
Post subject:
Sleep(0) being a yield is documented behavior of the API call, I'm not sure why you think it's an "idea" I had. CreateThread and threading both existed in Windows 95.

tracert.exe is a program for tracing network hops that comes standard with Windows.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group