Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 18 | Rev 20 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #include "pd/net.h" |
1 | #include "pd/net.h" |
| 2 | 2 | ||
| 3 | #include "brender.h" |
3 | #include "brender/brender.h" |
| 4 | #include "dr_types.h" |
4 | #include "dr_types.h" |
| 5 | #include "errors.h" |
5 | #include "errors.h" |
| 6 | #include "globvrpb.h" |
6 | #include "globvrpb.h" |
| 7 | #include "harness/config.h" |
7 | #include "harness/config.h" |
| 8 | #include "harness/hooks.h" |
8 | #include "harness/hooks.h" |
| Line 53... | Line 53... | ||
| 53 | struct sockaddr_in gLast_received_addr; |
53 | struct sockaddr_in gLast_received_addr; |
| 54 | int gSocket; |
54 | int gSocket; |
| 55 | 55 | ||
| 56 | #define MESSAGE_HEADER_STR "CW95MSG" |
56 | #define MESSAGE_HEADER_STR "CW95MSG" |
| 57 | #define JOINABLE_GAMES_CAPACITY 16 |
57 | #define JOINABLE_GAMES_CAPACITY 16 |
| 58 | - | ||
| 59 | DR_STATIC_ASSERT(offsetof(tNet_message, pd_stuff_so_DO_NOT_USE) == 0); |
- | |
| 60 | DR_STATIC_ASSERT(offsetof(tNet_message, magic_number) == 4); |
- | |
| 61 | DR_STATIC_ASSERT(offsetof(tNet_message, guarantee_number) == 8); |
- | |
| 62 | DR_STATIC_ASSERT(offsetof(tNet_message, sender) == 12); |
- | |
| 63 | DR_STATIC_ASSERT(offsetof(tNet_message, version) == 16); |
- | |
| 64 | DR_STATIC_ASSERT(offsetof(tNet_message, senders_time_stamp) == 20); |
- | |
| 65 | DR_STATIC_ASSERT(offsetof(tNet_message, num_contents) == 24); |
- | |
| 66 | DR_STATIC_ASSERT(offsetof(tNet_message, overall_size) == 26); |
- | |
| 67 | DR_STATIC_ASSERT(offsetof(tNet_message, contents) == 28); |
- | |
| 68 | 58 | ||
| 69 | // IDA: void __cdecl ClearupPDNetworkStuff() |
59 | // IDA: void __cdecl ClearupPDNetworkStuff() |
| 70 | void ClearupPDNetworkStuff(void) { |
60 | void ClearupPDNetworkStuff(void) { |
| 71 | LOG_TRACE("()"); |
61 | LOG_TRACE("()"); |
| 72 | NOT_IMPLEMENTED(); |
62 | NOT_IMPLEMENTED(); |
| Line 648... | Line 638... | ||
| 648 | int PDNetSendMessageToAddress(tNet_game_details* pDetails, tNet_message* pMessage, void* pAddress) { |
638 | int PDNetSendMessageToAddress(tNet_game_details* pDetails, tNet_message* pMessage, void* pAddress) { |
| 649 | char str[256]; |
639 | char str[256]; |
| 650 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pAddress); |
640 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pAddress); |
| 651 | 641 | ||
| 652 | NetNowIPXLocalTarget2String(str, (struct sockaddr_in*)pAddress); |
642 | NetNowIPXLocalTarget2String(str, (struct sockaddr_in*)pAddress); |
| - | 643 | if (pDetails->pd_net_info.addr_in.sin_port == 0) { |
|
| - | 644 | int i = 0; |
|
| - | 645 | } |
|
| 653 | 646 | ||
| 654 | if (sendto(gSocket, (const char*)pMessage, pMessage->overall_size, 0, (const struct sockaddr*)pAddress, sizeof(struct sockaddr)) == -1) { |
647 | if (sendto(gSocket, (const char*)pMessage, pMessage->overall_size, 0, (const struct sockaddr*)pAddress, sizeof(struct sockaddr)) == -1) { |
| 655 | dr_dprintf("PDNetSendMessageToAddress(): Error on sendto() - WSAGetLastError=%d", WSAGetLastError()); |
648 | dr_dprintf("PDNetSendMessageToAddress(): Error on sendto() - WSAGetLastError=%d", WSAGetLastError()); |
| 656 | NetDisposeMessage(pDetails, pMessage); |
649 | NetDisposeMessage(pDetails, pMessage); |
| 657 | return 1; |
650 | return 1; |