Explorar o código

fixes for windows

Dale Weiler %!s(int64=3) %!d(string=hai) anos
pai
achega
37d3a8a861
Modificáronse 2 ficheiros con 19 adicións e 11 borrados
  1. 10 2
      vendor/ENet/enet.odin
  2. 9 9
      vendor/ENet/win32.odin

+ 10 - 2
vendor/ENet/enet.odin

@@ -2,9 +2,17 @@ package ENet
 
 when ODIN_OS == "windows" {
 	when ODIN_ARCH == "amd64" {
-		foreign import ENet "lib/enet64.lib"
+		foreign import ENet {
+			"lib/enet64.lib",
+			"system:Ws2_32.lib",
+			"system:Winmm.lib",
+		}
 	} else {
-		foreign import ENet "lib/enet.lib"
+		foreign import ENet {
+			"lib/enet.lib",
+			"system:Ws2_32.lib",
+			"system:Winmm.lib",
+		}
 	}
 } else {
 	foreign import ENet "system:enet"

+ 9 - 9
vendor/ENet/win32.odin

@@ -4,7 +4,7 @@ package ENet
 // When we implement the appropriate bindings for Windows, the section separated
 // by `{` and `}` here can be removed in favor of using the bindings.
 // {
-foreign WinSock2 import "system:Ws2_32.lib"
+foreign import WinSock2 "system:Ws2_32.lib"
 
 @(private="file", default_calling_convention="c")
 foreign WinSock2 {
@@ -15,7 +15,7 @@ foreign WinSock2 {
 
 @(private="file") FD_SETSIZE :: 64
 
-@(private="file") fs_set :: struct {
+@(private="file") fd_set :: struct {
 	fd_count: u32,
 	fd_array: [FD_SETSIZE]SOCKET,
 }
@@ -44,18 +44,18 @@ foreign WinSock2 {
 	s.fd_count += 1
 }
 
-@(private="file") FD_ZERO proc #force_inline (s: ^fd_set) {
+@(private="file") FD_ZERO :: #force_inline proc (s: ^fd_set) {
 	s.fd_count = 0
 }
 
-@(private="file") FD_ISSET proc #force_inline (fd: SOCKET, s: ^fd_set) -> bool {
+@(private="file") FD_ISSET :: #force_inline proc (fd: SOCKET, s: ^fd_set) -> bool {
 	return __WSAFDIsSet(fd, s) != 0
 }
 // }
 
-Socket :: distinct Socket
+Socket :: distinct SOCKET
 
-SOCKET_NULL :: Socket(~0)
+SOCKET_NULL :: Socket(~uintptr(0))
 
 Buffer :: struct {
 	data:       rawptr,
@@ -69,13 +69,13 @@ SOCKETSET_EMPTY :: #force_inline proc(sockset: ^SocketSet) {
 }
 
 SOCKETSET_ADD :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
-	FD_SET(i32(socket), cast(^fd_set)sockset)
+	FD_SET(SOCKET(socket), cast(^fd_set)sockset)
 }
 
 SOCKETSET_REMOVE :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
-	FD_CLR(i32(socket), cast(^fd_set)sockset)
+	FD_CLR(SOCKET(socket), cast(^fd_set)sockset)
 }
 
 SOCKSET_CHECK :: #force_inline proc(sockset: ^SocketSet, socket: Socket) -> bool {
-	return FD_ISSET(i32(socket), cast(^fd_set)sockset)
+	return FD_ISSET(SOCKET(socket), cast(^fd_set)sockset)
 }