diff --git a/Makefile b/Makefile index 9e12564..9567edf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ LDFLAGS = $(shell pkg-config --libs sdl2 r_util r_io) CFLAGS = -Wall -I include/ $(shell pkg-config --cflags sdl2 r_util r_io) +all: sdl/pixbuf.o io/timers.o + +sdl/pixbuf.o: + gcc -c sdl/pixbuf.c -o sdl/pixbuf.o $(CFLAGS) + io/timers.o: gcc -c io/timers.c -o io/timers.o $(CFLAGS) diff --git a/sdl/pixbuf.c b/sdl/pixbuf.c index c1d9bf2..3c62273 100644 --- a/sdl/pixbuf.c +++ b/sdl/pixbuf.c @@ -19,7 +19,7 @@ GBPixBuf *gb_pix_buf_new (SDL_Renderer *renderer, ut16 w, ut16 h) { } pb->texture = SDL_CreateTexture (renderer, SDL_PIXELFORMAT_ARGB32, SDL_TEXTUREACCESS_TARGET, w, h); - if (!texture) { + if (!pb->texture) { free (pb->buf); free (pb); return NULL; @@ -46,7 +46,7 @@ void gb_pix_buf_set_pixel (GBPixBuf *pb, ut16 x, ut16 y, ut8 pixval) { const ut32 bytepos = bitpos >> 3; const ut32 shl = bitpos & 0x6; pixval = pixval & 0x3; - const ut8 mask = ~(0x3 << shl) + const ut8 mask = ~(0x3 << shl); pb->buf[bytepos] = (pb->buf[bytepos] & mask) | (pixval << shl); SDL_Texture *target = SDL_GetRenderTarget (pb->renderer); SDL_SetRenderTarget (pb->renderer, pb->texture);