Skip to content

Commit 6e59515

Browse files
committed
improve serverlist
1 parent 2ffe7d0 commit 6e59515

File tree

189 files changed

+165077
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+165077
-109
lines changed

buglist.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
- [x] alt tab is near to impossible - fixed by libsdl1.2-compat
22
- [x] cannot use touchpad whilst keyboard held down - fixed by xinput --set-prop 13 287 0 // libinput Disable While Typing Enabled (287): 1
33
- [x] cannot paste into console
4-
- [ ] serverlist
4+
- [x] serverlist
55
- [x] replace menus/video.cfg gl_driver with libGL.so.1, was actually drivers/drivers.txt
66
- [ ] failed command checksum for playername
7-
- [ ] compile libsdl1.2-compat like did with libbsd
7+
- [ ] compile libsdl1.2-compat like did with libbsd
8+
- [ ] fix cursor possibly?

build-context/makefile

+18-4
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,41 @@
44

55
CC=g++
66

7+
INSTALL_DIR=$(HOME)/.loki/sof-runtime/
8+
9+
BINARY=test.so
10+
711
OBJS= \
812
../obj/clipboard.o \
913
../obj/commands.o \
10-
../obj/exe.o \
14+
../obj/exe_shared.o \
15+
../obj/exe_server.o \
16+
../obj/exe_client.o \
1117
../obj/fn_sigs.o \
1218
../obj/game.o \
1319
../obj/main.o \
1420
../obj/serverlist.o \
1521
../obj/util.o
1622

17-
CFLAGS=-m32 -fpic -fpermissive -w -D _GNU_SOURCE -I ../hdr
23+
CFLAGS=-m32 -fpic -fpermissive -w -D _GNU_SOURCE -D_inline=inline -I ../hdr
1824
LDFLAGS= -m32 -shared -lX11 -o ../out/test.so
1925

20-
../out/test.so: $(OBJS)
26+
# run recipe if binary does not exist
27+
$(INSTALL_DIR)$(BINARY): ../out/$(BINARY)
28+
cp $^ $@
29+
30+
../out/$(BINARY): $(OBJS)
2131
$(CC) $(LDFLAGS) $(OBJS) -o ../out/test.so
2232

2333
../obj/clipboard.o : ../src/clipboard.cpp
2434
$(CC) $(CFLAGS) -c $^ -o $@
2535
../obj/commands.o : ../src/commands.cpp
2636
$(CC) $(CFLAGS) -c $^ -o $@
27-
../obj/exe.o : ../src/exe.cpp
37+
../obj/exe_shared.o : ../src/exe_shared.cpp
38+
$(CC) $(CFLAGS) -c $^ -o $@
39+
../obj/exe_server.o : ../src/exe_server.cpp
40+
$(CC) $(CFLAGS) -c $^ -o $@
41+
../obj/exe_client.o : ../src/exe_client.cpp
2842
$(CC) $(CFLAGS) -c $^ -o $@
2943
../obj/fn_sigs.o : ../src/fn_sigs.cpp
3044
$(CC) $(CFLAGS) -c $^ -o $@

hdr/common.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
#include <sstream>
88

99
#include "engine.h"
10+
11+
1012
#include "fn_sigs.h"
1113

14+
15+
1216
// util.h
1317
extern void error(const char* message);
1418
extern void hexdump(void *addr_start, void *addr_end);
@@ -20,7 +24,6 @@ extern void memoryAdjust(void * addr, int size, unsigned char val);
2024
extern void NetadrToSockadr (netadr_t *a, struct sockaddr_in *s);
2125
extern void SockadrToNetadr (struct sockaddr_in *s, netadr_t *a);
2226

23-
2427
// serverlist.h
2528
extern void GetServerList(void);
2629
extern void my_SendToMasters(void * arg1,void * arg2);

hdr/engine.h

+154-57
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,165 @@
1-
typedef int bool;
2-
typedef void edict_t;
3-
typedef void usercmd_t;
4-
typedef int qboolean;
5-
typedef unsigned char byte;
6-
7-
typedef enum {NA_LOOPBACK, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX} netadrtype_t;
8-
typedef enum {NS_CLIENT, NS_SERVER} netsrc_t;
9-
typedef struct netadr_s
10-
{
11-
netadrtype_t type; //0
12-
byte ip[4]; //4
13-
byte ipx[10]; //8
14-
15-
unsigned short port; //12
16-
// char * description; //14
17-
} netadr_t;
18-
19-
typedef struct game_export_s {
20-
// the init function will only be called when a game starts,
21-
// not each time a level is loaded. Persistant data for clients
22-
// and the server can be allocated in init
23-
int APIVERSION;
24-
void (*Init) (void);
25-
void (*Shutdown) (void);
26-
27-
// each new level entered will cause a call to SpawnEntities
28-
void (*SpawnEntities) (char *mapname, char *entstring, char *spawnpoint);
1+
/*typedef char bool;
2+
#define false 0x00
3+
#define true 0x01
4+
*/
5+
#pragma once
296

30-
// Read/Write Game is for storing persistant cross level information
31-
// about the world state and the clients.
32-
// WriteGame is called every time a level is exited.
33-
// ReadGame is called on a loadgame.
34-
void (*WriteGame) (bool autosave);
35-
bool (*ReadGame) (bool autosave);
7+
extern unsigned int * ghoulmain;
8+
extern unsigned int * clientinst;
9+
extern unsigned int * objinst;
3610

37-
// ReadLevel is called after the default map information has been
38-
// loaded with SpawnEntities
39-
void (*WriteLevel) (void);
40-
void (*ReadLevel) (void);
4111

42-
void (*ClientThink) (edict_t *ent, usercmd_t *cmd);
43-
qboolean (*ClientConnect) (edict_t *ent, char *userinfo);
12+
extern char SOFREESP[32768];
13+
#include "../src/Game/gamecpp/q_shared.h"
4414

45-
//NEW
46-
void (*ClientPreConnect) (void*);
4715

48-
void (*ClientUserinfoChanged) (edict_t *ent, char *userinfo, bool not_first_time);
4916

50-
void (*ClientDisconnect) (edict_t *ent);
51-
void (*ClientBegin) (edict_t *ent);
17+
typedef void client_t;
5218

53-
void (*ClientCommand) (edict_t *ent);
54-
void (*ResetCTFTeam) (edict_t *ent);
55-
56-
int (*GameAllowASave) (void);
19+
typedef int MatrixType;
20+
typedef void (*xcommand_t) (void);
21+
typedef struct cmd_function_s
22+
{
23+
struct cmd_function_s *next;
24+
char *name;
25+
xcommand_t function;
26+
} cmd_function_t;
5727

58-
void (*SavesLeft) (void);
59-
void (*GetGameStats) (void);
6028

61-
void (*UpdateInven) (void);
62-
const char *(*GetDMGameName) (void);
29+
typedef enum
30+
{
31+
cs_free, // can be reused for a new connection
32+
cs_zombie, // client has been disconnected, but don't reuse
33+
// connection for a couple seconds
34+
cs_connected, // has been assigned to a client_t, but not in game yet
35+
cs_spawned // client is fully in game
36+
} client_state_t;
37+
38+
enum ScriptConditionT
39+
{
40+
COND_READY,
41+
COND_COMPLETED,
42+
COND_SUSPENDED,
43+
COND_WAIT_ALL,
44+
COND_WAIT_ANY,
45+
COND_WAIT_TIME,
46+
};
47+
48+
//WHY I HAVE TO DO THIS LOL WAHT IS THIS NONSENSE!! XD
49+
#include "../src/Game/qcommon/configstring.h"
50+
51+
52+
#define stget(e,x) *(unsigned int*)(e+x)
53+
#define stset(e,x,v) *(unsigned int*)(e+x) = v
54+
55+
56+
#define SV_CONFIGSTRINGS 0x203A2374
57+
58+
59+
#define SV_CLIENT 0x203FEC94 //pointer to current player being parsed
60+
#define CLIENT_BASE 0x20396EEC
61+
#define SIZE_OF_CLIENT 0xd2ac
62+
#define CLIENT_USERINFO 0x04
63+
#define CLIENT_ENT 0x298
64+
#define CLIENT_NETMESSAGE 0x52b5 //could be wrong i think its 0x52b4
65+
#define CLIENT_NETCHAN 0x526C
66+
#define CLIENT_NETCHAN_IP 0x5284
67+
#define CLIENT_MSEC
68+
69+
#define STUFFTEXT 0xD
70+
71+
#define GCLIENT_BASE 0x5015D6C4
72+
#define SIZE_OF_GCLIENT 0x600
73+
#define GCLIENT_PS_BOD 0x7C
74+
#define GCLIENT_TEAM 0x324
75+
#define GCLIENT_INV 0x34C
76+
#define GCLIENT_BODY 0x354
77+
#define GCLIENT_GHOSTED 0x554
78+
#define GCLIENT_PERS_SPECTATOR 0x2DC
79+
#define GCLIENT_PERS_NETNAME 0x2CC
80+
#define GCLIENT_PERS_CONNECTED 0x2F8
81+
#define GCLIENT_RESP_SPECTATOR 0x320
82+
#define GCLIENT_RESP_SCORE 0x308
83+
#define GCLINT_RESP_ENTERFRAME 0x304
84+
#define GCLIENT_PING 0xC8
85+
#define GCLIENT_SHOWSCORES 0x470
86+
#define GCLIENT_MOVESCALE 0x348 //other movescale is 26 offset , doesnt set
87+
#define GCLIENT_CHASETARGET 0x328
88+
89+
#define GCLIENT_LATCHED_BUTTONS 0x484
90+
#define GCLIENT_BUTTONS 0x47C
91+
92+
93+
#define SIZE_OF_EDICT 0x464
94+
#define EDICT_BASE 0x5015CCA0
95+
96+
#define EDICT_GCLIENT 0x74
97+
#define EDICT_HEALTH 0x2EC
98+
#define EDICT_SOLID 0x158
99+
#define EDICT_CLASSNAME 0x1B4
100+
#define EDICT_TARGETNAME 0x1C8
101+
#define EDICT_SCRIPT 0x454
102+
#define EDICT_S_ORIGIN 0x4
103+
#define EDICT_S_ANGLES 0x10
104+
#define EDICT_INUSE 0x78
105+
#define EDICT_GHOULINST 0x164
106+
#define EDICT_PS_GUN 0x6C
107+
#define EDICT_CLIPMASK 0x15C
108+
#define EDICT_MINS 0x11C
109+
#define EDICT_MAXS 0x128
110+
#define EDICT_MODEL 0x1A4
111+
#define EDICT_S_SKINNUM 0x30
112+
#define EDICT_ENEMY 0x3240
113+
#define EDICT_CTFFLAGS 0x3CC
114+
#define EDICT_SURFACETYPE 0x3C0
115+
#define EDICT_MATERIAL 0x31C
116+
#define EDICT_TOUCH 0x2C0
117+
#define EDICT_USE 0x2C4
118+
#define EDICT_PLUSE 0x2C8
119+
#define EDICT_PAIN 0x2CC
120+
#define EDICT_DIE 0x2D0
121+
#define EDICT_THINK 0x2B8
122+
#define EDICT_NEXTTHINK 0x2B4
123+
#define EDICT_FLAGS 0x1A0
124+
#define EDICT_COUNT 0x318
125+
#define EDICT_DELAY 0x364
126+
#define EDICT_OWNER 0x160
127+
128+
129+
130+
#define CSCRIPT_SCRIPTCONDITION 0x108
131+
132+
#include "../src/Game/gamecpp/g_local.h"
133+
134+
135+
// #include "../src/Game/gamecpp/g_obj.h"
136+
137+
extern bool GhoulGetInst(int slot);
138+
extern void GhoulSetTint(float r,float g,float b,float alpha);
139+
extern void GhoulSetTintOnAll(float r,float g,float b,float alpha);
140+
extern void GhoulAddNoteCallBack(IGhoulCallBack *c,GhoulID Token=0);
141+
extern GhoulID GhoulFindSequence(const char *Filename);
142+
extern bool GhoulPlay(GhoulID Seq,float Now,float PlayPos,bool Restart,IGhoulInst::EndCondition ec, bool MatchCurrentPos, bool reverseAnim);
143+
extern unsigned int * ghoulmain;
144+
extern unsigned int * clientinst;
145+
extern void GhoulGetXform(Matrix4 *m);
146+
extern void GhoulSetXform(Matrix4 *m);
147+
extern unsigned short GhoulFindPart(const char * partname);
148+
extern bool GhoulGetObject(void);
149+
extern bool GhoulInstFromID(unsigned short ID);
150+
extern void PrintFunctionAddr(void);
151+
extern bool GhoulBoltMatrix(float Time,Matrix4 &m,unsigned short GhoulID,MatrixType kind,bool ToRoot);
152+
extern void GhoulBoundBox(float Time,const Matrix4 &ToWorld,Vect3 &mins,Vect3 &maxs,GhoulID Part,bool Accurate);
153+
extern ggObjC *GhoulFindObject(const char* name, const char* subname, bool allSkins=true, const char *skinname=NULL, const char *basefile=NULL, bool dontMakeNew=false);
154+
extern ggObjC *GhoulFindObjectSmall(IGhoulObj *curObject);
155+
extern GhoulID GhoulFindNoteToken(const char *Token);
156+
157+
//from matrix.cpp lol i modified it for these, from gutils.cpp lol sofsdk
158+
extern void EntToWorldMatrix(vec3_t org, vec3_t angles, Matrix4 &m);
159+
extern int GetGhoulPosDir(vec3_t sourcePos, vec3_t sourceAng, GhoulID partID, vec3_t pos, vec3_t dir, vec3_t right, vec3_t up);
160+
extern void Vec3AddAssign(vec3_t value, vec3_t addTo);
161+
// extern void VectorCopy(vec3_t in, vec3_t out);
162+
extern void VectorScale (vec3_t in, vec_t scale, vec3_t out);
163+
extern void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
63164

64-
byte (*GetCinematicFreeze) (void);
65-
void (*SetCinematicFreeze) (byte cf);
66165

67-
float (*RunFrame) (int serverframe);
68-
} game_export_t;

hdr/fn_sigs.h

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ extern void (*orig_CL_PingServers)(void);
1515
extern void my_menu_AddServer(netadr_t addr,char *data);
1616
extern void (*orig_menu_AddServer)(netadr_t addr,char *data);
1717

18+
extern void my_SND_Load(void); //s_nosound doesn't work because null pointers hanging.
19+
extern void (*orig_SND_Load)(void); //use s_initsound 0?
20+
1821

1922
// --Shared--
2023

@@ -34,6 +37,9 @@ extern void my_Cmd_RemoveCommand(char * cmd);
3437
extern void (*orig_Com_Printf) (char *msg, ...);
3538
extern void my_Com_Printf(char *msg,...);
3639

40+
//Cvar_Get
41+
extern cvar_t *(*orig_Cvar_Get)(const char * name, const char * value, int flags, cvarcommand_t command = NULL);
42+
3743
// Clipboard
3844
// {E8 DIRECT OVERRIDE}
3945
extern char *my_Sys_GetClipboardData(void);

out/test.so

15.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)