Skip to content

Commit

Permalink
make fesl global
Browse files Browse the repository at this point in the history
  • Loading branch information
anzz1 committed Oct 26, 2023
1 parent 57711a2 commit f18d410
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ LPHOSTENT __stdcall hk_gethostbyname(const char* name) {
char s[512];
if (name && gs_copy_string(s, name))
return ogethostbyname(s);
else if (name && fesl_copy_string(s, name))
return ogethostbyname(s);
else
return ogethostbyname(name);
}
Expand Down
6 changes: 0 additions & 6 deletions include/game_bfme2.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ LPHOSTENT __stdcall bfme2_hk_gethostbyname(const char* name) {
return ogethostbyname("motd.openspy.net");
else if (name && !__strcmp(name, "na.llnet.eadownloads.ea.com"))
return ogethostbyname("motd.openspy.net");
else if (name && !__strcmp(name, "bfme.fesl.ea.com"))
return ogethostbyname("bfme.fesl.openspy.net");
else if (name && !__strcmp(name, "bfme2.fesl.ea.com"))
return ogethostbyname("bfme2.fesl.openspy.net");
else if (name && !__strcmp(name, "bfme2-ep1-pc.fesl.ea.com"))
return ogethostbyname("bfme2-ep1-pc.fesl.openspy.net");
else
return hk_gethostbyname(name);
}
Expand Down
12 changes: 12 additions & 0 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,18 @@ __forceinline static int gs_copy_string(char* dst, const char* src) {
return 0;
}

__forceinline static int fesl_copy_string(char* dst, const char* src) {
char* p = __stristr(src, "fesl.ea.com");
if (p) {
p += 5;
unsigned int len = (((p-src) > 500) ? 500 : (p-src));
__strncpy(dst, src, len);
__strcpy(dst+len, "openspy.net");
return 1;
}
return 0;
}

#ifndef _WIN64
__forceinline static BOOL IsWow64(void) {
void* fnIsWow64Process;
Expand Down

0 comments on commit f18d410

Please sign in to comment.