Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Commit

Permalink
Fixes, optimizations(?) and amd64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
torralbaalla committed Jun 26, 2021
1 parent 5567362 commit ce78bd5
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 11 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build_amd64.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions res/doc/gmcpil/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
16 changes: 15 additions & 1 deletion src/mods/multiplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
#include <libreborn.h>
#include <servers.h>

/* 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;
Expand Down Expand Up @@ -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)
{
Expand Down
11 changes: 3 additions & 8 deletions src/tabs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit ce78bd5

Please sign in to comment.