from typing import Tuple


def int_(buffer: bytes, offset: int = 0) -> Tuple[int, int]:
    """
    Unpack signed int from Starbound save file.

    :param buffer: Starbound save file
    :param offset: position in Starbound save file
    :return: int, new offset
    """
    value = 0
    while True:
        tmp = buffer[offset]
        value = (value << 7) | (tmp & 127)
        offset += 1
        if not tmp & 128:
            break
    if value & 1:
        value = -((value >> 1) + 1)
    else:
        value >>= 1
    return value, offset