diff --git a/.github/workflows/build_amd64.yml b/.github/workflows/build_amd64.yml new file mode 100644 index 0000000..90401a4 --- /dev/null +++ b/.github/workflows/build_amd64.yml @@ -0,0 +1,22 @@ +name: Build amd64 + +on: + push: + branches: [ master ] + +jobs: + build_amd64: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install Dependencies + run: sudo apt update && sudo apt install -y git make fakeroot binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabihf dpkg-dev build-essential crossbuild-essential-armhf libgtk-3-dev libjson-glib-dev + - name: Make + run: make + - name: Make DEB + run: make pack + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: gmcpil_latest_amd64.deb + path: gmcpil_*.deb diff --git a/Makefile b/Makefile index 967ba56..c23eef9 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ ARM_STRIP:=arm-linux-gnueabihf-strip ARCH:=$(shell $(CC) -print-multiarch | grep -Eo "arm|aarch|86|x86_64") endif -VERSION:=0.11.0 +VERSION:=0.11.1 OBJS:=$(patsubst %,build/%.o,mcpil config helpers callbacks tabs) MODS:=$(patsubst %,build/lib%.so,multiplayer) diff --git a/README.md b/README.md index 1810d79..6ae8ca8 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ To build gMCPIL, you'll need GCC or Clang for the native and `arm-linux-gnueabih Assuming a Debian-based distro, you can install them with the following command: ```sh # For GCC -sudo apt install gcc gcc-arm-linux-gnueabihf +sudo apt install gcc build-essential gcc-arm-linux-gnueabihf crossbuild-essential-armhf # Libraries and other build dependencies sudo apt install git make libjson-glib-dev libgtk-3-dev dpkg-dev fakeroot diff --git a/res/doc/gmcpil/CHANGELOG.txt b/res/doc/gmcpil/CHANGELOG.txt index 59f134c..f6633bd 100644 --- a/res/doc/gmcpil/CHANGELOG.txt +++ b/res/doc/gmcpil/CHANGELOG.txt @@ -1,3 +1,7 @@ +v0.11.1: + + Internal code changes. + + First official amd64 build. + v0.11.0: + Added option to hide the launcher. + Fixed multiplayer on non-ARM systems. diff --git a/src/mods/multiplayer.c b/src/mods/multiplayer.c index 1ccb202..37d475d 100644 --- a/src/mods/multiplayer.c +++ b/src/mods/multiplayer.c @@ -40,6 +40,19 @@ #include #include +/* I hope this optimizes at least a little bit, or else... */ +#if __GNUC__ +# define unlikely(x) __builtin_expect(!!(x), 0) +#elif defined(__has_builtin) +# if __has_builtin(__builtin_expect) +# define unlikely(x) __builtin_expect(!!(x), 0) +# endif +#endif + +#ifndef unlikely +# define unlikely(x) (x) +#endif + int build_sockaddr(server_t* server) { struct hostent* host; @@ -70,7 +83,8 @@ HOOK(sendto, ssize_t, (int sockfd, const void* buf, size_t len, int flags, const struct sockaddr_in* addr = (struct sockaddr_in*)dest_addr; ensure_sendto(); - if (addr->sin_addr.s_addr == (unsigned int) -1 /* This IS intentional, -1 is the equivalent to the broadcast address. */ && ntohs(addr->sin_port) == 19135) + /* This IS intentional, -1 is the equivalent to the broadcast address. */ + if (unlikely(addr->sin_addr.s_addr == (unsigned int)-1 && ntohs(addr->sin_port) == 19135)) { while (i < 19139) { diff --git a/src/tabs.c b/src/tabs.c index c2f38d2..1820af4 100644 --- a/src/tabs.c +++ b/src/tabs.c @@ -171,13 +171,8 @@ TAB(Multiplayer, "Multiplayer", "Save", multiplayer_cb, { GtkWidget* port_entry; GtkWidget* notice_label; - default_ip = mcpil_config_get_ip(config); - default_port = mcpil_config_get_port(config); - if (default_ip == NULL || default_port == NULL) - { - default_ip = "thebrokenrail.com"; - default_port = "19132"; - } + MCPIL_SET_DEFAULT(ip, "thebrokenrail.com"); + MCPIL_SET_DEFAULT(port, "19132"); ip_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); ip_label = gtk_label_new("IP Address"); @@ -230,7 +225,7 @@ TAB(Settings, "Settings", "Save", settings_cb, { GtkWidget* hide_hbox; GtkWidget* hide_check; - MCPIL_SET_DEFAULT(distance, "Normal"); + MCPIL_SET_DEFAULT(distance, "Short"); MCPIL_SET_DEFAULT(username, "StevePi"); MCPIL_SET_DEFAULT(hud, "simple,fps"); MCPIL_SET_DEFAULT(hide, "TRUE");