327 sprintf_s(msg,
sizeof msg,
"Networking::FrameMove (displaystage %i)", displaystage);
337 sprintf_s(msg,
sizeof msg,
"Global cloud convection received: %ux%u revision %llu",
338 cloudSnapshot->mips.front().width,cloudSnapshot->mips.front().height,
339 static_cast<unsigned long long>(cloudSnapshot->revision));
355 if (
p->length && (
p->data[0] == ID_CONNECTION_REQUEST_ACCEPTED ||
356 p->data[0] == ID_DISCONNECTION_NOTIFICATION ||
p->data[0] == ID_CONNECTION_LOST))
360 if (
p->data[0] == ID_CONNECTION_REQUEST_ACCEPTED)
367 if (
p->data[0] == ID_SND_RECEIPT_ACKED)
371 std::uint32_t receipt;
372 memcpy(&receipt,
p->data + 1,
sizeof receipt);
379 switch (displaystage)
384 case ID_CONNECTION_REQUEST_ACCEPTED:
388 rakPeer->SetOccasionalPing(
true);
389 rakPeer->SetTimeoutTime(30000, RakNet::UNASSIGNED_SYSTEM_ADDRESS);
393 case ID_USER_PACKET_ENUM:
395 switch (
p->length - 1)
400 memcpy_s(&datapacket,
sizeof SServerPacket, &
p->data[1],
p->length - 1);
401 switch (datapacket.
type)
407 const float average_ping =
static_cast<float>(
rakPeer->GetAveragePing(
serverC)) * 0.001f;
411 Trace(
"Configuration received!");
412 sprintf_s(msg,
sizeof msg,
" g_UniverseTime: %f", datapacket.
f_x);
414 sprintf_s(msg,
sizeof msg,
" ping to server: %f", average_ping);
416 sprintf_s(msg,
sizeof msg,
" server says: %f", datapacket.
f_y);
418 sprintf_s(msg,
sizeof msg,
" adjustment: %f", average_ping * 0.5f);
420 sprintf_s(msg,
sizeof msg,
" f_Uphours: %f", datapacket.
f_z);
441 if (datapacket.
f_y == 4.0f)
451 sprintf_s(msg,
sizeof msg,
"Unexpected conclusion Y type: %.0f", datapacket.
f_y);
459 const float average_ping =
static_cast<float>(
rakPeer->GetAveragePing(
serverC)) * 0.001f;
464 sprintf_s(msg,
sizeof msg,
"Received facility CPOC revolutionProgress %.3f with ping adjustment %.3fs",
465 datapacket.
f_x, average_ping * 0.5f);
467 sprintf_s(msg,
sizeof msg,
"Received facility TAC revolutionProgress %.3f with ping adjustment %.3fs",
468 datapacket.
f_y, average_ping * 0.5f);
470 sprintf_s(msg,
sizeof msg,
"Received facility YSP revolutionProgress %.3f with ping adjustment %.3fs",
471 datapacket.
f_z, average_ping * 0.5f);
483 sprintf_s(msg,
sizeof msg,
"STATUS_SPLASH autopatcher expecting total bytes: %i",
patchbytes);
490 sprintf_s(msg,
sizeof msg,
"STATUS_SPLASH unknown SServerPacket packet type: %i", datapacket.
type);
501 memcpy_s(&datapacket,
sizeof SPacketBig, &
p->data[1],
p->length - 1);
502 switch (datapacket.
type)
509 Trace(
"Patching finished!");
515 int patchDateError = 0;
516 unsigned long patchDateOsError = 0;
519 char newpatchdate[99];
520 sprintf_s(newpatchdate,
sizeof newpatchdate,
"STATUS_SPLASH autopatcher patchdate.txt now: %s",
game->
config.
patchdate);
525 char patchDateErrorMessage[199];
526 sprintf_s(patchDateErrorMessage,
sizeof patchDateErrorMessage,
527 "Could not save patchdate.txt after retrying (CRT %i, Windows %lu); continuing and will retry next startup.",
528 patchDateError, patchDateOsError);
534 Trace(
"The Rise binaries have been updated and must be restarted!");
535 MessageBox(
Rendering::ClientWindow(), L
"The Rise binaries have been updated and must be restarted!", L
"Finished Patching", MB_ICONINFORMATION | MB_OK);
545 sprintf_s(msg,
sizeof msg,
"STATUS_SPLASH unknown SPacketBig packet type: %i", datapacket.
type);
553 sprintf_s(msg,
sizeof msg,
"STATUS_SPLASH unknown packet length: %i",
p->length - 1);
560 case ID_CONNECTION_ATTEMPT_FAILED:
561 case ID_NO_FREE_INCOMING_CONNECTIONS:
563 const RakNet::ConnectionAttemptResult result =
Connect();
564 if (result != RakNet::ConnectionAttemptResult::CONNECTION_ATTEMPT_STARTED)
568 if (
p->data[0] == ID_CONNECTION_ATTEMPT_FAILED)
582 const char actionCode =
p->data[1];
585 char pathAndFileName[128];
586 memcpy_s(pathAndFileName,
sizeof pathAndFileName - 1, &
p->data[2],
sizeof pathAndFileName - 1);
587 pathAndFileName[
sizeof pathAndFileName - 1] =
'\0';
590 const int fileLength =
p->length - 130;
595 sprintf_s(msg,
sizeof msg,
"Autopatcher delete: %s", pathAndFileName);
598 const int result = _unlink(pathAndFileName);
599 if (result == -1 && errno != ENOENT)
601 sprintf_s(msg,
sizeof msg,
"Autopatcher could not delete file \"%s\": %i", pathAndFileName, errno);
607 sprintf_s(msg,
sizeof msg,
"Autopatcher add/update bytes %i: %s", fileLength, pathAndFileName);
610 if (strcmp(pathAndFileName,
"Rise.exe") == 0)
613 strcpy_s(pathAndFileName, 128,
"Rise1.exe");
615 if (_stricmp(pathAndFileName,
"CrashHandler.exe") == 0)
618 strcpy_s(pathAndFileName, 128,
"CrashHandler1.exe");
620 if (_stricmp(pathAndFileName,
"steam_api64.dll") == 0)
623 strcpy_s(pathAndFileName, 128,
"steam_api641.dll");
625 if (strcmp(pathAndFileName,
"steam_api.dll") == 0)
628 strcpy_s(pathAndFileName, 128,
"steam_api1.dll");
630 if (strcmp(pathAndFileName,
"bass.dll") == 0)
633 strcpy_s(pathAndFileName, 128,
"bass1.dll");
635 if (strcmp(pathAndFileName,
"bass_fx.dll") == 0)
638 strcpy_s(pathAndFileName, 128,
"bass_fx1.dll");
640 if (strcmp(pathAndFileName,
"RakNet.dll") == 0)
643 strcpy_s(pathAndFileName, 128,
"RakNet1.dll");
645 if (strcmp(pathAndFileName,
"discord_partner_sdk.dll") == 0)
648 strcpy_s(pathAndFileName, 128,
"discord_partner_sdk1.dll");
650 if (strcmp(pathAndFileName,
"FreeTrackClient.dll") == 0)
653 strcpy_s(pathAndFileName, 128,
"FreeTrackClient1.dll");
656 const size_t pathLen = strlen(pathAndFileName);
657 for (
size_t endIndex = 1; endIndex < pathLen; ++endIndex)
659 if (pathAndFileName[endIndex] ==
'\\')
661 pathAndFileName[endIndex] = 0;
662 _mkdir(pathAndFileName);
663 pathAndFileName[endIndex] =
'\\';
668 _sopen_s(&file, pathAndFileName, _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY | _O_SEQUENTIAL, _SH_DENYNO, _S_IWRITE);
673 case EACCES: sprintf_s(msg,
sizeof msg,
"Autopatcher could not access file \"%s\": EACCES", pathAndFileName);
break;
674 case EEXIST: sprintf_s(msg,
sizeof msg,
"Autopatcher could not access file \"%s\": EEXIST", pathAndFileName);
break;
675 case EINVAL: sprintf_s(msg,
sizeof msg,
"Autopatcher could not access file \"%s\": EINVAL", pathAndFileName);
break;
676 case EMFILE: sprintf_s(msg,
sizeof msg,
"Autopatcher could not access file \"%s\": EMFILE", pathAndFileName);
break;
677 case ENOENT: sprintf_s(msg,
sizeof msg,
"Autopatcher could not access file \"%s\": ENOENT", pathAndFileName);
break;
678 default: sprintf_s(msg,
sizeof msg,
"Autopatcher could not access file \"%s\": %i", pathAndFileName, errno);
683 _write(file, &
p->data[130], fileLength);
691 Trace(
"Got MOTD through ID_USER_PACKET_HELP!");
693 memcpy_s(newchat,
sizeof newchat, &
p->data[1],
sizeof newchat);
699 size_t startOfLine = 0;
700 size_t lastGoodSpaceIndex = 0;
701 const size_t newchatLen = wcslen(newchat);
702 for (
size_t i = 0; i < newchatLen - startOfLine; i++)
704 size_t i1 = newchatLen - startOfLine - 1;
707 wcscpy_s(tempStr, 510, &newchat[startOfLine]);
721 if (rect.right < 210 && i != i1)
723 if (tempStr[i] == L
' ' || tempStr[i] == L
'\xff01' || tempStr[i] == L
'\x3002' || tempStr[i] == L
'\xff0c')
724 lastGoodSpaceIndex = i;
729 if (lastGoodSpaceIndex != 0 && i != i1)
731 if (tempStr[lastGoodSpaceIndex] == L
' ')
732 tempStr[lastGoodSpaceIndex] = 0;
734 tempStr[lastGoodSpaceIndex + 1] = 0;
739 if (lastGoodSpaceIndex != 0)
740 startOfLine += lastGoodSpaceIndex + 1;
742 startOfLine += wcslen(tempStr) + 1;
744 lastGoodSpaceIndex = 0;
750 case ID_RAKVOICE_DATA:
755 sprintf_s(msg,
sizeof msg,
"STATUS_SPLASH unknown packet ID: %i",
p->data[0]);
766 case ID_USER_PACKET_ENUM:
768 switch (
p->length - 1)
773 memcpy_s(&datapacket,
sizeof SServerPacket, &
p->data[1],
p->length - 1);
774 switch (datapacket.
type)
780 if (datapacket.
array == 0 || datapacket.
array == 3)
805 if (datapacket.
array == 0)
809 outpacket.
f_x = 0.0f;
810 outpacket.
f_y = 0.0f;
811 outpacket.
f_z = 0.0f;
812 outpacket.
f_w = 0.0f;
818 else if (datapacket.
array == 4)
821 if (datapacket.
f_x == 0.0f)
823 if (datapacket.
f_y == 1.0f)
828 if (datapacket.
f_z == 1.0f)
830 else if (datapacket.
f_z == 2.0f)
832 else if (datapacket.
f_z == 3.0f)
834 else if (datapacket.
f_z == 4.0f)
836 else if (datapacket.
f_z == 6.0f)
838 else if (datapacket.
f_z == 9.0f)
842 else if (datapacket.
f_x == 1.0f)
844 if (datapacket.
f_y == 1.0f)
849 if (datapacket.
f_z == 5.0f)
853 else if (datapacket.
f_x == 2.0f)
855 if (datapacket.
f_y == 1.0f)
860 if (datapacket.
f_z == 2.0f)
862 else if (datapacket.
f_z == 3.0f)
864 else if (datapacket.
f_z == 6.0f)
866 else if (datapacket.
f_z == 7.0f)
870 else if (datapacket.
f_x == 3.0f)
890 memcpy_s(&datapacket,
sizeof(
SPacketBig), &
p->data[1],
p->length - 1);
891 switch (datapacket.
type)
903 swprintf_s(str, 199, L
"%S", datapacket.msg);
913 swprintf_s(str, 199, L
"%S", datapacket.msg);
984 if (command.
name ==
"UnloadCargoBay")
988 outpacket.
f_x = 0.0f;
989 outpacket.
f_y =
static_cast<float>(command.
ivalues[0]);
990 outpacket.
f_z = 0.0f;
991 outpacket.
f_w =
static_cast<float>(command.
ivalues[1]);
997 else if (command.
name ==
"UpdateMfdPage")
1005 else if (command.
name ==
"EventSelectTarget")
1015 sprintf_s(msg,
sizeof msg,
"Networking::FrameMove END (displaystage %i)", displaystage);
1023 sprintf_s(msg,
sizeof msg,
"Networking::RakNetMessageHandler (type %i)", packet->data[0]);
1026 switch (packet->data[0])
1030 if (packet->length < 5)
break;
1032 memcpy(&index, packet->data + 1,
sizeof index);
1038 packet->data + 5, packet->length - 5, GetTickCount64());
1046 sprintf_s(msg,
sizeof msg,
"m_pddsLogos[%i]", index);
1051 case ID_RAKVOICE_DATA:
1053 if (packet->length <= 1)
1060 Trace(
"Received audio data (voice samples on immigration)! Playing...");
1081 Trace(
"Received audio data! Playing...");
1089 Trace(
"ID_USER_PACKET_SUPER received!");
1092 sprintf_s(msg,
sizeof msg,
"Rejected SUPER packet size %u; expected %u", packet->length,
static_cast<unsigned int>(
sizeof(
SSuperPacket) + 1));
1098 memcpy_s(&datapacket,
sizeof datapacket, &packet->data[1],
sizeof datapacket);
1100 const bool invalidMotion =
1115 sprintf_s(msg,
sizeof msg,
"Rejected SUPER packet metadata ref %i parent %i slot %u vehicle %u motion %i",
1123 sprintf_s(msg,
sizeof msg,
" Our reference %i!", datapacket.
reference);
1184#pragma region Old ship type = 9 data
1186 int vehicleType, allegiance;
1187 unsigned int vehicleId;
1188 char bitstring[16], trimcolor[8];
1193 sprintf_s(msg,
sizeof msg,
"Released m_pddsHullDynamicTexture slot %i!", 0);
1196 sprintf_s(msg,
sizeof msg,
"m_pddsHullDynamicTexture[%i]", 0);
1203 char logofile[9] = {
"_" };
1204 const int results = sscanf_s(datapacket.
oldShipData,
"%[^,],%[^,],%d,%[^,],%[^,],%[^,],%d,%u,%d,%d,%[^\n]",
1205 playerships[0].
IVR, 6, bitstring,
static_cast<unsigned>(
sizeof bitstring), &vehicleType,
ourcockpit.
owner, 13, trimcolor, 8, logofile, 9, &reference, &vehicleId, &allegiance, &
ourcockpit.
ownerId,
playerships[0].
hullname, 23);
1210 sprintf_s(msg,
sizeof msg,
"Could only parse %i of 10 required (11 optional) items from type 9 data SUPER_PACKET!", results);
1232 sprintf_s(hexcolor, 11,
"0x00%s", &trimcolor[1]);
1251 sprintf_s(msg,
sizeof msg,
"ship data IVR %s vehicleId %i slot %i",
playerships[0].IVR, vehicleId, 0);
1291 if (bitstring[12] ==
'1' && !
playerships[0].battleRoyale)
1294 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Vehicle slot %i (%s) is now a participant (type 9)!", 0,
playerships[0].IVR);
1297 else if (bitstring[12] ==
'0' &&
playerships[0].battleRoyale)
1300 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Vehicle slot %i (%s) was eliminated (type 9)!", 0,
playerships[0].IVR);
1377 westEntrance.left = -948; westEntrance.right = -648;
1378 westEntrance.bottom = -336; westEntrance.top = -114;
1381 westHall.left = -648; westHall.right = 350;
1382 westHall.bottom = -336; westHall.top = -114;
1385 bay1.left = 350; bay1.right = 650;
1386 bay1.bottom = -336; bay1.top = -114;
1389 hall2.left = 650; hall2.right = 1350;
1390 hall2.bottom = -336; hall2.top = -114;
1393 bay2.left = 1350; bay2.right = 1650;
1394 bay2.bottom = -336; bay2.top = -114;
1397 hall3.left = 1650; hall3.right = 2350;
1398 hall3.bottom = -336; hall3.top = -114;
1401 bay3.left = 2350; bay3.right = 2650;
1402 bay3.bottom = -336; bay3.top = -114;
1405 eastHall.left = 2650; eastHall.right = 3670;
1406 eastHall.bottom = -336; eastHall.top = -114;
1409 eastEntrance.left = 3670; eastEntrance.right = 3970;
1410 eastEntrance.bottom = -336; eastEntrance.top = -114;
1419 platform.left = -7801; platform.right = -7350;
1420 platform.bottom = -8182; platform.top = 8182;
1422 platform.left += margin;
1423 platform.right -= margin;
1424 platform.bottom += margin;
1425 platform.top -= margin;
1457 const LONG buffer = 31;
1458 const LONG centerX = 0;
1459 const LONG centerY = -129;
1462 livingRoom.left = -1042 + buffer + centerX; livingRoom.right = 100 - buffer + centerX;
1463 livingRoom.top = 739 - buffer + centerY; livingRoom.bottom = 51 + buffer + centerY;
1466 hall.left = -100 + buffer + centerX; hall.right = 100 - buffer + centerX;
1467 hall.top = 51 + buffer + centerY; hall.bottom = -862 + buffer + centerY;
1470 hallToKitchen.left = -124 - buffer + centerX; hallToKitchen.right = -100 + buffer + centerX;
1471 hallToKitchen.top = -662 - buffer + centerY; hallToKitchen.bottom = -862 + buffer + centerY;
1474 northKitchen.left = -1042 + buffer + centerX; northKitchen.right = -124 - buffer + centerX;
1475 northKitchen.top = -662 - buffer + centerY; northKitchen.bottom = -968 + buffer + centerY;
1478 middleKitchen.left = -932 + buffer + centerX; middleKitchen.right = -124 - buffer + centerX;
1479 middleKitchen.top = -968 + buffer + centerY; middleKitchen.bottom = -1115 - buffer + centerY;
1482 leftKitchen.left = -932 + centerX; leftKitchen.right = -589 + buffer + centerX;
1483 leftKitchen.top = -1115 - buffer + centerY; leftKitchen.bottom = -1456 + centerY;
1486 rightKitchen.left = -589 + buffer + centerX; rightKitchen.right = -124 - buffer + centerX;
1487 rightKitchen.top = -1115 - buffer + centerY; rightKitchen.bottom = -1573 + buffer + centerY;
1490 foyer.left = -124 - buffer + centerX; foyer.right = 100 - buffer + centerX;
1491 foyer.top = -1373 - buffer + centerY; foyer.bottom = -1573 + buffer + centerY;
1493 RECT livingToBedroom;
1494 livingToBedroom.left = -825 + buffer + centerX; livingToBedroom.right = -659 - buffer + centerX;
1495 livingToBedroom.top = 51 + buffer + centerY; livingToBedroom.bottom = 27 - buffer + centerY;
1498 northBedroom.left = -903 + buffer + centerX; northBedroom.right = -547 + centerX;
1499 northBedroom.top = 27 - buffer + centerY; northBedroom.bottom = -106 + centerY;
1502 midBedroom.left = -903 + buffer + centerX; midBedroom.right = -442 + centerX;
1503 midBedroom.top = -106 + centerY; midBedroom.bottom = -255 + centerY;
1506 dresser.left = -903 + buffer + centerX; dresser.right = -684 + centerX;
1507 dresser.top = -255 + centerY; dresser.bottom = -321 + centerY;
1510 southBedroom.left = -684 + centerX; southBedroom.right = -183 + centerX;
1511 southBedroom.top = -255 + centerY; southBedroom.bottom = -387 + buffer + centerY;
1514 bedToBath.left = -632 + buffer + centerX; bedToBath.right = -495 - buffer + centerX;
1515 bedToBath.top = -387 + centerY; bedToBath.bottom = -556 + centerY;
1518 toilet.left = -495 - buffer + centerX; toilet.right = -396 + centerX;
1519 toilet.top = -411 - buffer + centerY; toilet.bottom = -523 + centerY;
1522 shower.left = -396 + centerX; shower.right = -252 - buffer + centerX;
1523 shower.top = -411 - buffer + centerY; shower.bottom = -638 + buffer + centerY;
1541 foyer.left = 1195; foyer.right = 1876;
1542 foyer.top = -979; foyer.bottom = -2022;
1545 frontHall.left = 1195; frontHall.right = 2190;
1546 frontHall.top = -456; frontHall.bottom = -979;
1549 kitchen.left = 2190; kitchen.right = 2591;
1550 kitchen.top = -911; kitchen.bottom = -1886;
1553 leftHall.left = 1195; leftHall.right = 1517;
1554 leftHall.top = 484; leftHall.bottom = -456;
1557 centerHall.left = 1517; centerHall.right = 2190;
1558 centerHall.top = 135; centerHall.bottom = -103;
1561 rightHall.left = 2018; rightHall.right = 2190;
1562 rightHall.top = 484; rightHall.bottom = -456;
1565 backHall.left = 1195; backHall.right = 2190;
1566 backHall.top = 889; backHall.bottom = 484;
1568 RECT elevatorStaging;
1569 elevatorStaging.left = 1195; elevatorStaging.right = 1969;
1570 elevatorStaging.top = 1658; elevatorStaging.bottom = 889;
1573 link.left = 1969; link.right = 2190;
1574 link.top = 1658; link.bottom = 1105;
1577 sneak.left = 2117; sneak.right = 2190;
1578 sneak.top = 1165; sneak.bottom = 889;
1581 garden.left = 2190; garden.right = 2669;
1582 garden.top = 1474; garden.bottom = 972;
1665#pragma region Things the server persists about our vehicle
1711 sprintf_s(msg,
sizeof msg,
"Found a flap setting %zu (%.0f degrees)", i,
ourcockpit.
flapSettings.at(i).degrees);
1735#pragma region Things that are not saved on the server that need to be persisted!
1751#pragma region Things that are not saved on the server that need to be reset!
1782 for (
short i = 0; i <
MAX_SCAN; i++)
1821 sprintf_s(msg,
sizeof msg,
"Rejected malformed vehicle telemetry length %u (expected %zu)",
1828 memcpy_s(&datapacket,
sizeof datapacket, &packet->data[1],
sizeof datapacket);
1831 sprintf_s(msg,
sizeof msg,
"Rejected vehicle telemetry slot/flag %u/%u", datapacket.
array, datapacket.
onlyOne);
1836 const unsigned char slot = datapacket.
array;
1841 sprintf_s(msg,
sizeof msg,
"Rejected vehicle telemetry with invalid frame metadata for slot %u", slot);
1858 datapacket.
velocity.x - barycentric.x,
1859 datapacket.
velocity.y - barycentric.y,
1860 datapacket.
velocity.z - barycentric.z};
1873 static_cast<double>(datapacket.
tx) / 127.0,
1874 static_cast<double>(datapacket.
ty) / 127.0,
1875 static_cast<double>(datapacket.
tz) / 127.0};
1878 static_cast<double>(datapacket.
rolldeflect) / 127.0,
1879 static_cast<double>(datapacket.
yawdeflect) / 127.0};
1893 if (!ApplyImmediateContainedVehicleTelemetry(slot, snapshot))
1906 sprintf_s(msg,
sizeof msg,
"Rejected vehicle telemetry slot %u sequence %u (reason %u)",
1907 slot, datapacket.
sequence,
static_cast<unsigned>(acceptance));
1915 sprintf_s(msg,
sizeof msg,
"Buffered telemetry before metadata for slot %u", slot);
1928 case ID_USER_PACKET_ENUM:
1930 sprintf_s(msg,
sizeof msg,
"RakNetMessageHandler ID_USER_PACKET_ENUM (size %i)", packet->length - 1);
1933 switch (packet->length - 1)
1938 memcpy_s(&datapacket,
sizeof SServerPacket, &packet->data[1], packet->length - 1);
1940 sprintf_s(msg,
sizeof msg,
"SServerPacket %i %.1f %.1f %.1f %.1f %i", datapacket.
type, datapacket.
f_x, datapacket.
f_y, datapacket.
f_z, datapacket.
f_w, datapacket.
array);
1943 switch (datapacket.
type)
1947 if (datapacket.
array == 255)
1958 sprintf_s(msg,
sizeof msg,
"Server sent dock assignment (%.0f, %.0f)", datapacket.
f_x, datapacket.
f_y);
1968 if (datapacket.
f_y == 0.0f)
1970 sprintf_s(msg,
sizeof msg,
"Server sent data conclusion (ourshipC %.0f, g_bEnabled %i)", datapacket.
f_x,
g_bEnabled);
1978 outpacket.
f_x = 1.0f;
1979 outpacket.
f_y = 0.0f;
1980 outpacket.
f_z = 0.0f;
1981 outpacket.
f_w = 0.0f;
1990 wcscpy_s(deviceMessage.
name, 160, deviceInstance.tszInstanceName);
1991 deviceMessage.
deviceType = LOBYTE(deviceInstance.dwDevType);
1992 deviceMessage.
deviceSubtype = HIBYTE(deviceInstance.dwDevType);
2124#pragma warning( disable : 4309 )
2126#pragma warning( disable : 4309 )
2127 memcpy_s(&newdata[1],
sizeof SDeviceMessage, &deviceMessage,
sizeof deviceMessage);
2140 DWORD bufferSize = 78;
2141 GetUserNameA(bigpacket.msg, &bufferSize);
2142 bigpacket.
array = 0;
2143 bigpacket.
inarray =
static_cast<unsigned char>(GetActiveProcessorCount(ALL_PROCESSOR_GROUPS));
2150 GetComputerNameA(bigpacket.msg, &bufferSize);
2151 MEMORYSTATUSEX statex;
2152 statex.dwLength =
sizeof statex;
2153 GlobalMemoryStatusEx(&statex);
2154 bigpacket.
array =
static_cast<unsigned char>(round(
static_cast<double>(statex.ullTotalPhys) / 1073741824));
2155 bigpacket.
inarray =
static_cast<unsigned char>(round(
static_cast<double>(statex.ullAvailPhys) / 1073741824));
2156 bigpacket.
ship =
static_cast<unsigned char>(statex.dwMemoryLoad);
2160 outpacket.
type = 32;
2167 else if (datapacket.
f_y == 2.0f)
2169 if (datapacket.
f_x == 1.0f)
2173 outpacket.
f_x = 0.0f;
2174 outpacket.
f_y = 0.0f;
2175 outpacket.
f_z = 0.0f;
2176 outpacket.
f_w = 0.0f;
2179 else if (datapacket.
f_x == 0.0f ||
2180 datapacket.
f_x == 2.0f ||
2181 datapacket.
f_x == 3.0f)
2184 if (datapacket.
f_x == 0.0f)
2186 else if (datapacket.
f_x == 2.0f)
2188 else if (datapacket.
f_x == 3.0f)
2192 else if (datapacket.
f_y == 3.0f)
2199 sprintf_s(msg,
sizeof msg,
"Unexpected conclusion Y type: %.0f", datapacket.
f_y);
2206 sprintf_s(msg,
sizeof msg,
"Type 4 received payload %.1f, fuel %.1f (%.1f), utilization %.1f",
2207 datapacket.
f_y, datapacket.
f_x, datapacket.
f_w, datapacket.
f_z);
2229 sprintf_s(msg,
sizeof msg,
"Rejected removal for invalid scanner slot %u", datapacket.
array);
2234 if (!std::isfinite(datapacket.
f_x) || datapacket.
f_x < 0.0f || datapacket.
f_x > 65535.0f ||
2235 std::floor(datapacket.
f_x) != datapacket.
f_x)
2241 const auto sequence =
static_cast<unsigned short>(datapacket.
f_x);
2246 const unsigned short delta =
static_cast<unsigned short>(sequence - telemetryMetrics.
lastAcceptedSequence);
2247 if (delta == 0 || delta > 32767)
2249 sprintf_s(msg,
sizeof msg,
"Rejected stale removal for slot %u sequence %u (last %u)",
2256 sprintf_s(msg,
sizeof msg,
"Server removed slot %i (vehicleId %i) from our scanner!", datapacket.
array,
playerships[datapacket.
array].
vehicleId);
2280 sprintf_s(msg,
sizeof msg,
"Released m_pddsHullDynamicTexture slot %i!", datapacket.
array);
2283 sprintf_s(msg,
sizeof msg,
"m_pddsHullDynamicTexture[%i]", datapacket.
array);
2303 contact.dihvSequence = datapacket.
f_x;
2304 if (contact.dihvComing)
2305 contact.dihvAnimate = datapacket.
f_x < 2.0f ? 0 : 64;
2307 contact.dihvAnimate = datapacket.
f_x <= 0.0f ? 63 : 64;
2315 switch (datapacket.
array)
2318 MessageBoxW(
nullptr, L
"We are applying a patch to the game server. Please try connecting again in a minute or two.", L
"Server Upgrading!", MB_ICONERROR | MB_OK);
2321 MessageBoxW(
nullptr, L
"You have been kicked from the server. Contact support@risetvp for more information.", L
"Session Disconnected!", MB_ICONERROR | MB_OK);
2324 MessageBoxW(
nullptr, L
"Sorry, we require a valid email address in order to play Rise: The Vieneo Province.", L
"Account Terminated!", MB_ICONERROR | MB_OK);
2335 sprintf_s(msg,
sizeof msg,
"Dock status: %i power %.0f evac %.0f", datapacket.
array, datapacket.
f_x, datapacket.
f_y);
2344 if (datapacket.
f_y == 1.0f)
2357 int ordinal =
static_cast<int>(datapacket.
f_y);
2366 sprintf_s(msg,
sizeof msg,
"Event %.0f from server for slot %i!", datapacket.
f_w, datapacket.
array);
2404 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Vehicle slot %i (%s) is now a participant!", datapacket.
array,
playerships[datapacket.
array].
IVR);
2410 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Vehicle slot %i (%s) was eliminated!", datapacket.
array,
playerships[datapacket.
array].
IVR);
2433 sprintf_s(msg,
sizeof msg,
"Achievement ID %.0f level %.0f", datapacket.
f_x, datapacket.
f_y);
2436 if (datapacket.
f_x == 15.0f)
2440 else if (datapacket.
f_x == 17.0f && datapacket.
f_z == 14.0f)
2445 else if (datapacket.
f_x == 18.0f)
2450 else if (datapacket.
f_x == 2.0f)
2455 else if (datapacket.
f_x == 57.0f)
2474 !std::isfinite(datapacket.
f_y) || !std::isfinite(datapacket.
f_z) || !std::isfinite(datapacket.
f_w))
2481 const int newReference =
static_cast<int>(datapacket.
f_x);
2482 const int newParentSlot =
static_cast<int>(datapacket.
f_y);
2483 if (datapacket.
f_x !=
static_cast<float>(newReference) || newReference <=
REF_ENUMMIN ||
2485 (newParentSlot < 0 || newParentSlot >=
MAX_SCAN || newParentSlot == datapacket.
array)))
2492 sprintf_s(msg,
sizeof msg,
"Change reference of vehicle %i slot %i from %i to %i",
2541 sprintf_s(msg,
sizeof msg,
"Error! Type 17 tried to clear bay %i", datapacket.
array);
2548 if (bayVehicleId != 0)
2550 sprintf_s(msg,
sizeof msg,
"Removed cargo from bay %i", datapacket.
array);
2572 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Ignored an old map packet sequence %i (%i)", datapacket.
array,
battleRoyaleSequence);
2579 if (datapacket.
f_z != 0.0f)
2593 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Updated map packet, battle in progress (%i)!", datapacket.
array);
2599 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Shutting down battle based on map packet!");
2613 float r = floorf(datapacket.
f_w / 10000.0f);
2614 datapacket.
f_w -= r * 10000.0f;
2615 float g = floorf(datapacket.
f_w / 100.0f);
2616 datapacket.
f_w -= g * 100.0f;
2617 float b = floorf(datapacket.
f_w);
2619 sprintf_s(msg,
sizeof msg,
"Firework: r%.0f g%.0f b%.0f ", r, g, b);
2623 if (r >= g && r >= b)
2625 const float f_temp = 255.0f / r;
2626 r *= f_temp; g *= f_temp; b *= f_temp;
2628 else if (g >= r && g >= b)
2630 const float f_temp = 255.0f / g;
2631 r *= f_temp; g *= f_temp; b *= f_temp;
2633 else if (b >= r && b >= g)
2635 const float f_temp = 255.0f / b;
2636 r *= f_temp; g *= f_temp; b *= f_temp;
2639 sprintf_s(msg,
sizeof msg,
"-> r%.0f g%.0f b%.0f ", r, g, b);
2655 sprintf_s(msg,
sizeof msg,
"Fireworks! Distance: %.3f", f_temp);
2660 f_temp = 1.0f - f_temp;
2662 const float inverse_f_temp = 1.0f - f_temp;
2663 float delay = inverse_f_temp * 14.88201975f;
2666 sqrtf(f_temp), 1,
true);
2669 sqrtf(f_temp), 1,
true);
2693 ?
static_cast<size_t>(datapacket.
f_x) + 1 : 0;
2694 if (datapacket.
array)
2696 sprintf_s(msg,
sizeof msg,
"TURNBYTURN Got a turn-by-turn type %i: %.0fm (%.0fs)", datapacket.
array, datapacket.
f_z, datapacket.
f_w);
2703 Trace(
"TURNBYTURN Got a turn-by-turn CLEAR from the server!");
2714 switch (
static_cast<short>(datapacket.
f_z))
2718 const auto tab =
static_cast<short>(datapacket.
f_x);
2719 const auto channel =
static_cast<unsigned char>(datapacket.
f_y);
2721 sprintf_s(msg,
sizeof msg,
"Got new channel for tab %i: %i", tab, channel);
2747 const int radiocut =
static_cast<int>(datapacket.
f_y);
2748 if (datapacket.
array)
2751 const int carrier =
static_cast<int>(datapacket.
f_x);
2791 sprintf_s(msg,
sizeof msg,
"Type 35 airframeTempCelsius %.1f airIceAccumulationMm %.1f pressureMb %.1f groundIceAccumulationMm %.1f",
2792 datapacket.
f_x, datapacket.
f_y, datapacket.
f_z, datapacket.
f_w);
2803 if (datapacket.
array)
2813 Trace(
"Current waypoint packet received!");
2829 if (!std::isfinite(datapacket.
f_x) || !std::isfinite(datapacket.
f_y)
2830 || datapacket.
f_x<-32768 || datapacket.
f_x>32767 || datapacket.
f_y<-32768 || datapacket.
f_y>32767
2831 || floorf(datapacket.
f_x)!=datapacket.
f_x || floorf(datapacket.
f_y)!=datapacket.
f_y
2832 || !std::isfinite(datapacket.
f_z) || datapacket.
f_z<0 || datapacket.
f_z>2
2833 || floorf(datapacket.
f_z)!=datapacket.
f_z || !std::isfinite(datapacket.
f_w)
2834 || datapacket.
f_w<0 ||
double(datapacket.
f_w)>=2147483648.0)
break;
2836 static_cast<short>(datapacket.
f_y),
static_cast<int>(datapacket.
f_w),
static_cast<int>(datapacket.
f_z));
2841 sprintf_s(msg,
sizeof msg,
"Unexpected SServerPacket type: %i", datapacket.
type);
2851 memcpy_s(&bigdatapacket,
sizeof SPacketBig, &packet->data[1], packet->length - 1);
2853 sprintf_s(msg,
sizeof msg,
"SPacketBig %i %i", bigdatapacket.
type, bigdatapacket.
array);
2856 switch (bigdatapacket.
type)
2861 bigdatapacket.msg,
sizeof bigdatapacket.msg);
2872 _wcsupr_s(bigdatapacket.str,
sizeof bigdatapacket.str);
2881 sprintf_s(msg,
sizeof msg,
"Radio Station URL %i: %s", bigdatapacket.
array, bigdatapacket.msg);
2893 strcpy_s(outpacket.msg,
sizeof outpacket.msg, bigdatapacket.msg);
2895 outpacket.
array = 0;
2900 sprintf_s(
prompt,
sizeof prompt,
"%s", bigdatapacket.msg);
2914 sprintf_s(msg,
sizeof msg,
"AddPlayer %i %s", bigdatapacket.
array, bigdatapacket.msg);
2925 sprintf_s(msg,
sizeof msg,
"Error in SetWindowText: %d", GetLastError());
2947 unsigned char load_type;
2948 unsigned short load_quantity;
2949 int weightLbs, fuel_tank;
2950 const int elem = sscanf_s(bigdatapacket.msg,
"%hd,%[^,],%hhd,%hhd,%hd,%[^,],%d,%d,%[^,],%d,%d,%[^,],%d,%d,%[^,]",
2953 &weightLbs, &bitstring, 4,
2954 &fuel_tank, &pilot, &modeAC.
hullname, 23);
2957 Trace(bigdatapacket.msg);
2961 sprintf_s(msg,
sizeof msg,
"Could not parse ARJ (looking for 14 or 15) but %i elements...", elem);
2969 modeX.
weightLbs =
static_cast<float>(weightLbs);
2970 modeX.
fuel_tank =
static_cast<float>(fuel_tank);
2971 modeX.
pilot = pilot;
2973 modeAC.
tow = bitstring[0] ==
'1';
2974 modeAC.
reposess = bitstring[1] ==
'1';
2975 modeAC.
stolen = bitstring[2] ==
'1';
2989 sprintf_s(msg,
sizeof msg,
"Invalid bay %i for cargo data type 8...", bay);
3003 sprintf_s(msg,
sizeof msg,
"Rejected type 9 metadata slot %u parent %u vehicleId %i",
3009 char metadataText[
sizeof bigdatapacket.msg + 1] = {};
3010 memcpy_s(metadataText,
sizeof metadataText, bigdatapacket.msg,
sizeof bigdatapacket.msg);
3011 Trace(metadataText);
3013 char bitstring[16] = {}, trimcolor[8] = {};
3014 char incomingIvr[7] = {};
3015 char incomingHullName[23] = {};
3016 int incomingTotalWeightLbs = 0;
3021 char logofile[9] = {
"_" };
3022 const int results = sscanf_s(metadataText,
"%[^,],%[^,],%d,%d,%[^,],%[^,],%d,%d,%d,%[^\n]",
3023 incomingIvr,
static_cast<unsigned>(
sizeof incomingIvr), bitstring,
static_cast<unsigned>(
sizeof bitstring), &vehicleType, &incomingTotalWeightLbs,
3024 trimcolor, 8, logofile, 9, &reference, &flapdown, &spoilersUp, incomingHullName, 23);
3029 sprintf_s(msg,
sizeof msg,
"Could only parse %i of 9 required (10th optional) items from type 9 data!", results);
3033 if (reference <= REF_ENUMMIN || reference >=
REF_ENUMMAX ||
3035 incomingTotalWeightLbs < 0 || strnlen_s(bitstring,
sizeof bitstring) < 14 ||
3039 sprintf_s(msg,
sizeof msg,
"Rejected type 9 reference %i for slot %u", reference, bigdatapacket.
array);
3044 const unsigned char slot = bigdatapacket.
array;
3053 if (identityChanged)
3065 vehicle.
tx = vehicle.
ty = vehicle.
tz = 0.0f;
3078 strcpy_s(vehicle.
IVR,
sizeof vehicle.
IVR, incomingIvr);
3086 sprintf_s(msg,
sizeof msg,
"Released m_pddsHullDynamicTexture slot %i!", bigdatapacket.
array);
3089 sprintf_s(msg,
sizeof msg,
"m_pddsHullDynamicTexture[%i]", bigdatapacket.
array);
3113 sprintf_s(hexcolor, 11,
"0x00%s", &trimcolor[1]);
3118 sprintf_s(msg,
sizeof msg,
"ship data IVR %s vehicleId %i slot %i parent %i bay %i",
3161 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Vehicle slot %i (%s) is now a participant (type 9)!", bigdatapacket.
array,
playerships[bigdatapacket.
array].
IVR);
3167 sprintf_s(msg,
sizeof msg,
"BATTLE ROYALE - Vehicle slot %i (%s) was eliminated (type 9)!", bigdatapacket.
array,
playerships[bigdatapacket.
array].
IVR);
3183 sprintf_s(msg,
sizeof msg,
"Initialized after telemetry received (%i)...", bigdatapacket.
array);
3192 sprintf_s(msg,
sizeof msg,
"Got alignment data packet about playerIndex %i: %s", bigdatapacket.
array,
game->
GUI->
player[bigdatapacket.
array].
callsign);
3194 Trace(bigdatapacket.msg);
3209 Trace(
"Got our damage control...");
3263 if (bigdatapacket.inventory.personalobjecttype[i])
3266 inventoryHelper.
type = bigdatapacket.inventory.personalobjecttype[i];
3267 inventoryHelper.
subtype = bigdatapacket.inventory.personalobjectsubtype[i];
3276 if (bigdatapacket.inventory.vehicleobjecttype[i])
3279 inventoryHelper.
type = bigdatapacket.inventory.vehicleobjecttype[i];
3280 inventoryHelper.
subtype = bigdatapacket.inventory.vehicleobjectsubtype[i];
3282 if (inventoryHelper.
type == 1 && inventoryHelper.
subtype == 13)
3290 sprintf_s(msg,
sizeof msg,
"Received personal inventory packet for dexterity (%i): %.1f", bigdatapacket.inventory.statDex,
ourcockpit.
dexterity);
3321 const int fields = sscanf_s(bigdatapacket.msg,
"%i,%f,%f,%f,%f,%f,%31[^\n]",
3324 sprintf_s(msg,
sizeof msg,
"TURNBYTURN Node: %s", bigdatapacket.msg);
3337 Trace(bigdatapacket.msg);
3344 sscanf_s(bigdatapacket.msg,
"%[^,],%[^,],%hhd,%[^,],%d,%hd,%hd,%d,%[^\n]",
3345 modeAC.
IVR, 6, bitstring,
static_cast<unsigned>(
sizeof bitstring), &modeAC.
type, modeAC.
owner, 13, &modeAC.
ownerId, &parentId, &modeAC.
vehicleId, &modeAC.
allegiance, modeAC.
hullname, 23);
3350 if (parentId != modeAC.
vehicleId && parentId != 0)
3352 Trace(
"Calling game->bus->Scanner.Get(parentId)");
3354 Trace(
"Getting scandata from parent_s_scan");
3356 Trace(
"Getting modeAC from parent_s_scan_data");
3358 Trace(
"Setting location from parent");
3360 Trace(
"Setting reference from parent");
3366 Trace(
"Calling game->bus->Scanner.Get(vehicleId)");
3372 Trace(
"Analyzing bitstring");
3374 if (bitstring[0] ==
'1')
3378 if (bitstring[1] ==
'1')
3382 if (bitstring[2] ==
'1')
3387 Trace(
"Calling InsertUpdateModeAC");
3389 Trace(
"Calling InsertUpdateParent");
3408 sprintf_s(msg,
sizeof msg,
"Unexpected SPacketBig type: %i stage %i", bigdatapacket.
type,
game->
displaystage);
3418 memcpy_s(&hugedatapacket,
sizeof SPacketHuge, &
p->data[1],
p->length - 1);
3420 sprintf_s(msg,
sizeof msg,
"SPacketHuge %i", hugedatapacket.
type);
3423 switch (hugedatapacket.
type)
3511 sprintf_s(file,
sizeof file,
"meshes\\mining1.dix");
3513 sprintf_s(file,
sizeof file,
"meshes\\farm1.dix");
3515 sprintf_s(file,
sizeof file,
"meshes\\town1.dix");
3517 sprintf_s(file,
sizeof file,
"meshes\\airfield.dix");
3519 sprintf_s(file,
sizeof file,
"meshes\\refinery.dix");
3523 _sopen_s(&handle, file, _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
3526 sprintf_s(msg,
sizeof msg,
"Peer failed to load \"%s\"!", file);
3530 unsigned short filecomponents;
3531 _lseek(handle, 0, SEEK_SET);
3532 _read(handle, &filecomponents, 2);
3534 std::vector<short> buildingIds;
3537 for (
long r = 0; r < filecomponents; r++)
3539 unsigned char type = 0;
3547 _lseek(handle, r * 100L + 99L + 58L + 4L, SEEK_SET);
3548 _read(handle, &type, 1);
3550 _lseek(handle, r * 100L + 99L + 91L + 4L, SEEK_SET);
3551 _read(handle, &attachto, 1);
3553 if (std::find(buildingIds.begin(), buildingIds.end(), attachto) != buildingIds.end())
3556 buildingIds.emplace_back(attachto);
3767 sprintf_s(msg,
sizeof msg,
"Unknown building component type: %i", type);
3791 modeAC.
vehicleId = hugedatapacket.scanData.vehicle_id;
3792 modeAC.
reference =
static_cast<char>(hugedatapacket.scanData.reference);
3793 strcpy_s(modeAC.
IVR, 6, hugedatapacket.scanData.IVR);
3794 modeAC.
allegiance = hugedatapacket.scanData.allegiance;
3795 strcpy_s(modeAC.
hullname, 23, hugedatapacket.scanData.hullname);
3796 modeAC.
location.x = hugedatapacket.scanData.positionx;
3797 modeAC.
location.y = hugedatapacket.scanData.positiony;
3798 modeAC.
location.z = hugedatapacket.scanData.positionz;
3799 strcpy_s(modeAC.
owner, 13, hugedatapacket.scanData.owner);
3800 modeAC.
ownerId = hugedatapacket.scanData.ownerId;
3801 modeAC.
reposess = hugedatapacket.scanData.reposess;
3802 modeAC.
stolen = hugedatapacket.scanData.stolen;
3803 modeAC.
tow = hugedatapacket.scanData.tow;
3804 modeAC.
type = hugedatapacket.scanData.
type;
3810 if (hugedatapacket.scanData.loadQuantityHasValue)
3811 modeX.
load_quantity = hugedatapacket.scanData.load_quantity;
3812 strcpy_s(modeX.
load_dest, 20, hugedatapacket.scanData.load_dest);
3813 if (hugedatapacket.scanData.loadTypeHasValue)
3814 modeX.
load_type = hugedatapacket.scanData.load_type;
3815 if (hugedatapacket.scanData.weightLbsHasValue)
3816 modeX.
weightLbs = hugedatapacket.scanData.weightLbs;
3817 if (hugedatapacket.scanData.pilotHasValue)
3818 modeX.
pilot = hugedatapacket.scanData.pilot;
3822 for (
short t = 0; t <
MAX_SCAN; t++)
3837 sprintf_s(msg,
sizeof msg,
"Unknown HUGE packet type: %i", hugedatapacket.
type);
3867 memcpy_s(&datapacket,
sizeof SWeaponPacket, &packet->data[1], packet->length - 1);
3869 sprintf_s(msg,
sizeof msg,
"SWeaponPacket %i %i %i", datapacket.
type, datapacket.
status, datapacket.
array);
3884 memcpy(&datapacket, packet->data + 1,
sizeof datapacket);
3889 sprintf_s(msg,
sizeof msg,
"Received dynamic change for %i,%i", datapacket.
tcp.
u, datapacket.
tcp.
v);
3895 if (t >= 0 && t < 64 && s >= 0 && s < 64)
3898 if (
gridarray[t][s].buildzoneOrdinal != -1)
3902 sprintf_s(msg,
sizeof msg,
"SRenderPoint released VB slot %i!",
gridarray[t][s].buildzoneOrdinal);
3909 Trace(
"There was no building or RTS at that location before");
3924 memcpy(&datapacket, packet->data + 1,
sizeof datapacket);
3925 if (datapacket.
side < 1 || datapacket.
side > 4)
break;
3933 sprintf_s(msg,
sizeof msg,
"Received 1.3 data edge %i:%i,%i+(%+i,%+i)=(%i,%i)", datapacket.
side - 1, datapacket.
tcp.
u, datapacket.
tcp.
v, ewadjust, nsadjust,
game->
viewscreen->
ptrGrid->
tcp.
u,
game->
viewscreen->
ptrGrid->
tcp.
v);
3942 switch (datapacket.
side)
3946 news = 0 - nsadjust;
3947 if (news >= 0 && news < 64)
3949 sprintf_s(msg,
sizeof msg,
"Proc SRV north row %i: ", news);
3950 for (
short t = 0; t < 64; t++)
3952 newt = t - ewadjust;
3953 if (newt >= 0 && newt < 64)
3956 sprintf_s(append,
sizeof append,
"%2i ", newt);
3957 strcat_s(msg,
sizeof msg, append);
3961 strcat_s(msg,
sizeof msg,
"XX ");
3966 Trace(
"Proc SRV row no longer applies!");
3972 news = 63 - nsadjust;
3973 if (news >= 0 && news < 64)
3975 sprintf_s(msg,
sizeof msg,
"Proc SRV sourth row %i: ", news);
3976 for (
short t = 0; t < 64; t++)
3978 newt = t - ewadjust;
3979 if (newt >= 0 && newt < 64)
3982 sprintf_s(append,
sizeof append,
"%2i ", newt);
3983 strcat_s(msg,
sizeof msg, append);
3987 strcat_s(msg,
sizeof msg,
"XX ");
3992 Trace(
"Proc SRV row no longer applies!");
3998 newt = 63 - ewadjust;
3999 if (newt >= 0 && newt < 64)
4001 sprintf_s(msg,
sizeof msg,
"Proc SRV east column %i: ", newt);
4002 for (
short s = 0; s < 64; s++)
4004 news = s - nsadjust;
4005 if (news >= 0 && news < 64)
4008 sprintf_s(append,
sizeof append,
"%2i ", news);
4009 strcat_s(msg,
sizeof msg, append);
4013 strcat_s(msg,
sizeof msg,
"XX ");
4018 Trace(
"Proc SRV column no longer applies!");
4024 newt = 0 - ewadjust;
4025 if (newt >= 0 && newt < 64)
4027 sprintf_s(msg,
sizeof msg,
"Proc SRV west column %i: ", newt);
4028 for (
short s = 0; s < 64; s++)
4030 news = s - nsadjust;
4031 if (news >= 0 && news < 64)
4034 sprintf_s(append,
sizeof append,
"%2i ", news);
4035 strcat_s(msg,
sizeof msg, append);
4039 strcat_s(msg,
sizeof msg,
"XX ");
4044 Trace(
"Proc SRV column no longer applies!");
4072 auto datapacket = std::make_unique<SRenderGrid>();
4073 memcpy(datapacket.get(), packet->data + 1,
sizeof *datapacket);
4091 memcpy_s(&datapacket,
sizeof SRenderBuilding, &packet->data[1], packet->length - 1);
4100 Trace(
"SRenderBuilding ignored before terrain request; whole grid will refresh buildings");
4107 sprintf_s(msg,
sizeof msg,
"Received SRenderBuilding type %i @ u%i v%i (%i,%i) power %i", datapacket.
type, datapacket.
tcp.
u, datapacket.
tcp.
v, t, s, datapacket.
powered);
4114 if (t >= 0 && t < 64 && s >= 0 && s < 64)
4116 if (
gridarray[t][s].buildzoneOrdinal != -1)
4120 sprintf_s(msg,
sizeof msg,
" SRenderBuilding released VB slot %i!",
gridarray[t][s].buildzoneOrdinal);
4134 Trace(
" SRenderBuilding is somewhere on grid, stored!");
4139 sprintf_s(msg,
sizeof msg,
" Grid center u%i v%i cube %i ready %i pending %i",
4149 if (t > 15 && t < 48 && s > 15 && s < 48)
4153 Trace(
" SRenderBuilding grid level is initialized, OK!");
4160 Trace(
" SRenderBuilding type in bounds, OK!");
4163 Trace(
" SRenderBuilding layout is user-generated and real, OK!");
4169 Trace(
" SRenderBuilding is an airfield and layout4 changed!");
4172 for (
short tt = 16; tt < 48; tt++)
4174 for (
short ss = 16; ss < 48; ss++)
4183 Trace(
" SRenderBuilding must be gov, OK!");
4186 for (
short tt = 16; tt < 48; tt++)
4188 for (
short ss = 16; ss < 48; ss++)
4197 sprintf_s(msg,
sizeof msg,
" SRenderBuilding type (%i) out-of-bounds (or %i), sorry!",
gridarray[t][s].type,
gridarray[t][s].buildzoneOrdinal);
4203 Trace(
" SRenderBuilding stored; waiting for initial terrain grid");
4208 Trace(
" SRenderBuilding not in patch data, OK!");
4224 memcpy_s(&datapacket,
sizeof SPacketMenu, &
p->data[1],
p->length - 1);
4229 sprintf_s(msg,
sizeof msg,
"Received menu for level %i", datapacket.
menuLevel);
4256 sprintf_s(msg,
sizeof msg,
"Unknown packet size: %d",
p->length - 1);
4266 memcpy_s(&chat,
sizeof SVerbiage, &packet->data[1], packet->length - 1);
4267 sprintf_s(msg,
sizeof msg,
"Got verbiage: %i", chat.
id);
4281 memcpy_s(chat,
sizeof chat, &packet->data[3], source_size);
4283 if (packet->data[2] == 255)
4285 else if (packet->data[2] == 254)
4299 case ID_DISCONNECTION_NOTIFICATION:
4306 case ID_CONNECTION_LOST:
4309 MessageBoxW(
nullptr, L
"Reliable packets cannot be delivered to the game server. Please check your connection and try again.", L
"Disconnected from server!", MB_ICONERROR | MB_OK);
4315 case ID_CONNECTION_ATTEMPT_FAILED:
4322 case ID_NO_FREE_INCOMING_CONNECTIONS:
4345 case ID_CONNECTION_REQUEST_ACCEPTED:
4346 Trace(
"ID_CONNECTION_REQUEST_ACCEPTED");
4351 sprintf_s(msg,
sizeof msg,
"Unknown packet ID %i",
p->data[0]);