File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33on :
44 push :
55 pull_request :
6+ workflow_dispatch : {}
67
78jobs :
89 build :
@@ -12,15 +13,26 @@ jobs:
1213 os : [
1314 [macos-latest, arm64],
1415 [macos-15-intel, x86_64],
15- [ubuntu-latest, x86_64]
16+ [ubuntu-latest, x86_64],
17+ [windows-latest, x86_64],
1618 ]
1719
1820 steps :
1921 - uses : actions/checkout@v4
2022
23+ - name : Install MSYS2 packages
24+ if : matrix.os[0] == 'windows-latest'
25+ uses : msys2/setup-msys2@v2
26+ with :
27+ msystem : MINGW32
28+ install : |
29+ base-devel mingw-w64-i686-gcc
30+ update : true
31+
2132 - name : Compile native versions
2233 run : |
23- make --debug
34+ make -j $(getconf _NPROCESSORS_ONLN) clean
35+ make -j $(getconf _NPROCESSORS_ONLN) all
2436
2537 - name : Get short SHA
2638 id : slug
4456
4557 - name : Compile windows version with cross-compilator
4658 run : |
47- make -f Makefile.mingw32 --trace
59+ make -f Makefile.mingw32 -j $(getconf _NPROCESSORS_ONLN) clean
60+ make -f Makefile.mingw32 -j $(getconf _NPROCESSORS_ONLN) all
4861
4962 - name : Get short SHA
5063 id : slug
Original file line number Diff line number Diff line change 1212 CFLAGS += -O2
1313 endif
1414
15- ifneq "MINGW" "$(findstring MINGW,$(MSYSTEM))"
16- LIBS = -lpthread
17- else
15+ ifeq ($(OS),Windows_NT)
1816 LIBS = -lwsock32
17+ else
18+ LIBS = -lpthread
1919 endif
2020
2121 ifeq "x$(PREFIX)" "x"
2222 PREFIX = $(PS2DEV )
2323 endif
2424
25- ifeq "MINGW" "$(findstring MINGW,$(MSYSTEM))"
25+ ifeq ($(OS),Windows_NT)
2626 all :
2727 $(MAKE ) -f Makefile.mingw32 all
2828
Original file line number Diff line number Diff line change 5656 // Check to make sure a command was actually supplied.
5757 if (argc < 0 ) { printf ("Error: No command was supplied.\n" ); print_usage (); return -1 ; }
5858
59- #ifdef _WIN32
60-
61- // Startup network, under windows.
62- if (network_startup () < 0 ) { printf ("Error: Could not start up winsock.\n" ); return 1 ; }
63-
64- #endif
59+ // Startup network
60+ if (network_startup () < 0 ) { printf ("Error: Could not startup network.\n" ); return 1 ; }
6561
6662 // Connect to the ps2netfs server.
6763 if (ps2netfs_connect (hostname ) < 0 ) { printf ("Error: Could not connect to the ps2netfs server. (%s)\n" , hostname ); return -1 ; }
Original file line number Diff line number Diff line change 1313 // NETWORK FUNCTIONS //
1414 ///////////////////////
1515
16- #ifdef _WIN32
1716 int network_startup (void ) {
17+ #ifdef _WIN32
1818 WSADATA wsaData ;
1919
2020 // Start up winsock.
2121 if (WSAStartup (MAKEWORD (2 , 0 ), & wsaData ) != 0 ) { return -1 ; }
2222
23+ #endif
2324 // End function.
2425 return 0 ;
25-
2626 }
27- #endif
2827
2928 int network_connect (char * hostname , int port , int type ) { int sock = -1 ;
3029 struct sockaddr_in sockaddr ;
Original file line number Diff line number Diff line change 1212 // NETWORK FUNCTIONS //
1313 ///////////////////////
1414
15- #ifdef _WIN32
1615 int network_startup (void );
17- #endif
1816
1917 int network_connect (char * hostname , int port , int type );
2018
Original file line number Diff line number Diff line change 55 #include <unistd.h>
66 #include "utility.h"
77 #include "ps2link.h"
8- #ifdef _WIN32
98 #include "network.h"
10- #endif
119
1210 char hostname [256 ] = { "192.168.0.10" };
1311
6563 // Check to make sure a command was actually supplied.
6664 if (argc < 0 ) { printf ("Error: No command was supplied.\n" ); print_usage (); return -1 ; }
6765
68- #ifdef _WIN32
69-
70- // Startup network, under windows.
71- if (network_startup () < 0 ) { printf ("Error: Could not start up winsock.\n" ); return 1 ; }
72-
73- #endif
66+ // Startup network.
67+ if (network_startup () < 0 ) { printf ("Error: Could not startup network.\n" ); return 1 ; }
7468
7569 // Connect to the ps2link server.
7670 if (ps2link_connect (hostname ) < 0 ) { printf ("Error: Could not connect to the ps2link server. (%s)\n" , hostname ); return -1 ; }
Original file line number Diff line number Diff line change 1414#else
1515 #include <windows.h>
1616 #define sleep (x ) Sleep(x * 1000)
17+ #define pause () while (1) { Sleep(600000); }
1718#endif
1819
1920 #include "network.h"
6869 command_socket = network_connect (hostname , 0x4712 , SOCK_DGRAM );
6970
7071 // Delay for a moment to let ps2link finish setup.
71- #ifdef _WIN32
72- Sleep (1 );
73- #else
7472 sleep (1 );
75- #endif
7673
7774 // End function.
7875 return 0 ;
8784 // If no timeout was given, timeout immediately.
8885 if (timeout == 0 ) { return 0 ; }
8986
90- // If timeout was never, loop forever.
91- if (timeout < 0 ) { for (;;) { sleep ( 600 ); } }
87+ // If timeout was never, wait forever.
88+ if (timeout < 0 ) { pause (); }
9289
9390 // Increment the timeout counter until timeout is reached.
9491 while (ps2link_counter ++ < timeout ) { sleep (1 ); };
9996 }
10097
10198 int ps2link_disconnect (void ) {
102-
99+ // Kill created threads.
100+ pthread_cancel (request_thread_id );
101+ pthread_cancel (console_thread_id );
102+
103103 // Disconnect from the command port.
104104 if (network_disconnect (command_socket ) < 0 ) { return -1 ; }
105105
You can’t perform that action at this time.
0 commit comments