git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 7c92845882de7e920e29fc7a652578b607f267d4
parent 7ff3556bc3af05bdc5ca3e469fc479da2ff21bba
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat, 19 Sep 2020 19:31:31 +0300

Merge branch 'master' of https://github.com/LIJI32/SameBoy

Diffstat:
MBootROMs/pb12.c18+++++++++++++++---
MMakefile5+++++
2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/BootROMs/pb12.c b/BootROMs/pb12.c @@ -4,6 +4,7 @@ #include <stdlib.h> #include <unistd.h> #include <assert.h> +#include <err.h> void opts(uint8_t byte, uint8_t *options) { @@ -13,6 +14,17 @@ void opts(uint8_t byte, uint8_t *options) *(options++) = byte & (byte >> 1); } +void write_all(int fd, const void *buf, size_t count) { + while (count) { + ssize_t written = write(fd, buf, count); + if (written < 0) { + err(1, "write"); + } + count -= written; + buf += written; + } +} + int main() { static uint8_t source[0x4000]; @@ -76,15 +88,15 @@ int main() if (bits >= 8) { uint8_t outctl = control >> (bits - 8); assert(outctl != 1); - write(STDOUT_FILENO, &outctl, 1); - write(STDOUT_FILENO, literals, literals_size); + write_all(STDOUT_FILENO, &outctl, 1); + write_all(STDOUT_FILENO, literals, literals_size); bits -= 8; control &= (1 << bits) - 1; literals_size = 0; } } uint8_t end_byte = 1; - write(STDOUT_FILENO, &end_byte, 1); + write_all(STDOUT_FILENO, &end_byte, 1); return 0; } diff --git a/Makefile b/Makefile @@ -106,6 +106,11 @@ ifeq ($(shell $(CC) -x c -c $(NULL) -o $(NULL) -Werror -Wpartial-availability 2> WARNINGS += -Wpartial-availability endif +# GCC's implementation of this warning has false positives, so we skip it +ifneq ($(shell $(CC) --version 2>&1 | grep "gcc"), ) +WARNINGS += -Wno-maybe-uninitialized +endif + CFLAGS += $(WARNINGS) CFLAGS += -std=gnu11 -D_GNU_SOURCE -DVERSION="$(VERSION)" -I. -D_USE_MATH_DEFINES

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.