Fix compilation on Windows

This commit is contained in:
Azamat H. Hackimov
2024-06-03 17:03:17 +03:00
parent 6057694b56
commit a295b047f0
5 changed files with 17 additions and 9 deletions

View File

@@ -620,7 +620,7 @@ typedef void (*dp_EndGame_fp)();
dp_EndGame_fp DLLdp_EndGame;
#endif
typedef int (*nw_Asyncgethostbyname_fp)(uint32_t *ip, int command, char *hostname);
typedef int (*nw_Asyncgethostbyname_fp)(uint32_t *ip, int command, const char *hostname);
nw_Asyncgethostbyname_fp DLLnw_Asyncgethostbyname;
typedef int (*nw_ReccomendPPS_fp)();
@@ -640,7 +640,9 @@ MultiLoadSettings_fp DLLMultiLoadSettings;
typedef void *(*NetworkReceiveCallback)(uint8_t *data, int len, network_address *from);
typedef int (*nw_RegisterCallback_fp)(void *nfp, uint8_t id);
typedef void (*HandleGamePacket_fp)(uint8_t *data, int len, network_address *from);
typedef int (*nw_RegisterCallback_fp)(HandleGamePacket_fp, uint8_t id);
nw_RegisterCallback_fp DLLnw_RegisterCallback;
typedef NetworkReceiveCallback (*nw_UnRegisterCallback_fp)(uint8_t id);

View File

@@ -211,7 +211,12 @@ void ChttpGet::PrepSocket(char *URL) {
return;
}
make_nonblocking(m_DataSock);
#ifdef WIN32
unsigned long arg = 1;
ioctlsocket(m_DataSock, FIONBIO, &arg);
#else // WIN32
fcntl(m_DataSock, F_SETFL, fcntl(m_DataSock, F_GETFL, 0) | O_NONBLOCK);
#endif
char *pURL = URL;
if (strnicmp(URL, "http:", 5) == 0) {

View File

@@ -13,9 +13,9 @@ set_target_properties(Parallax_Online PROPERTIES OUTPUT_NAME "Parallax Online")
target_link_libraries(Parallax_Online PRIVATE
ddio
inetfile
# $<$<PLATFORM_ID:Windows>:
# ws2_32
# >
$<$<PLATFORM_ID:Windows>:
ws2_32
>
)
add_custom_target(Parallax_Online_Hog

View File

@@ -161,7 +161,7 @@ int ConnectToChatServer(const char *serveraddr, int16_t chat_port, char *nicknam
#ifdef WIN32
unsigned long arg = 1;
ioctlsocket(sock, FIONBIO, &arg);
ioctlsocket(Chatsock, FIONBIO, &arg);
#else // WIN32
fcntl(Chatsock, F_SETFL, fcntl(Chatsock, F_GETFL, 0) | O_NONBLOCK);
#endif

View File

@@ -907,7 +907,8 @@ int LoginMasterTracker() {
break;
case 4:
#ifdef WIN32
ShellExecute(NULL, "open", MTADDNEWURL, NULL, NULL, SW_SHOW);
// TODO: reacivate for site opening
// ShellExecute(NULL, "open", MTADDNEWURL, NULL, NULL, SW_SHOW);
#endif
break;
case UID_OK: {
@@ -2334,7 +2335,7 @@ int MTVersionCheck() {
// Specify the correct path
DLLddio_MakePath(fulldllpath, DLLLocalD3Dir, "mtav.dll", NULL);
if (!DLLmod_LoadModule(&MTAVDLLHandle, fulldllpath)) {
if (!DLLmod_LoadModule(&MTAVDLLHandle, fulldllpath, MODF_LAZY)) {
DLLmprintf(0, "Unable to load Mastertracker Auto version update DLL (mtav.dll)\n");
// Try restoring a backup of the DLL
DLLddio_MakePath(szolddll, DLLLocalD3Dir, "mtav.dll", NULL);