# HG changeset patch # User John Tsiombikas # Date 1331210237 -7200 # Node ID 06726f0b8cd34bb085cace67c5c6a736921892cb # Parent e3dc7705ad9ca5e1cc2f778244a3245006af998c foo diff -r e3dc7705ad9c -r 06726f0b8cd3 src/comm.c --- a/src/comm.c Wed Mar 07 06:11:51 2012 +0200 +++ b/src/comm.c Thu Mar 08 14:37:17 2012 +0200 @@ -1,6 +1,6 @@ /* gbasys - a gameboy advance hardware abstraction library -Copyright (C) 2005-2012 John Tsiombikas +Copyright (C) 2004-2012 John Tsiombikas This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -r e3dc7705ad9c -r 06726f0b8cd3 src/comm.h --- a/src/comm.h Wed Mar 07 06:11:51 2012 +0200 +++ b/src/comm.h Thu Mar 08 14:37:17 2012 +0200 @@ -1,6 +1,6 @@ /* gbasys - a gameboy advance hardware abstraction library -Copyright (C) 2005-2012 John Tsiombikas +Copyright (C) 2004-2012 John Tsiombikas This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -r e3dc7705ad9c -r 06726f0b8cd3 src/gbasys.h --- a/src/gbasys.h Wed Mar 07 06:11:51 2012 +0200 +++ b/src/gbasys.h Thu Mar 08 14:37:17 2012 +0200 @@ -31,6 +31,7 @@ #include "signal.h" #include "timer.h" #include "term.h" +#include "comm.h" void gba_init(void); diff -r e3dc7705ad9c -r 06726f0b8cd3 src/gfx.c --- a/src/gfx.c Wed Mar 07 06:11:51 2012 +0200 +++ b/src/gfx.c Thu Mar 08 14:37:17 2012 +0200 @@ -1,5 +1,5 @@ /* -Copyright 2004 John Tsiombikas +Copyright 2004-2012 John Tsiombikas This file is part of gbasys, a library for GameBoy Advance development. @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include "gfx.h" #define FRAME_SEL_BIT 0x10 @@ -134,6 +135,42 @@ dma_copy32(3, dst->pixels, src->pixels, words); } +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +void blit(struct pixel_buffer *src, int src_x, int src_y, int src_w, int src_h, + struct pixel_buffer *dst, int dst_x, int dst_y) +{ + int i, pixsize, width, height, dstride, sstride; + unsigned char *dptr, *sptr; + + if(dst->bpp != src->bpp) + return; + + if(src_w <= 0) + src_w = src->x; + if(src_h <= 0) + src_h = src->y; + + width = MIN(src_w, MIN(src->x - src_x, dst->x - dst_x)); + height = MIN(src_h, MIN(src->y - src_y, dst->y - dst_y)); + + if(width <= 0 || height <= 0) + return; + + pixsize = dst->bpp / 8; + dptr = (unsigned char*)dst->pixels + (dst_y * dst->x + dst_x) * pixsize; + sptr = (unsigned char*)src->pixels + (src_y * src->x + src_x) * pixsize; + + dstride = dst->x * pixsize; + sstride = src->x * pixsize; + + for(i=0; iy) diff -r e3dc7705ad9c -r 06726f0b8cd3 src/input.c --- a/src/input.c Wed Mar 07 06:11:51 2012 +0200 +++ b/src/input.c Thu Mar 08 14:37:17 2012 +0200 @@ -1,7 +1,7 @@ /* -Copyright 2004 John Tsiombikas +Copyright 2004-2012 John Tsiombikas -This file is part of libgba, a library for GameBoy Advance development. +This file is part of gbasys, a library for GameBoy Advance development. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -r e3dc7705ad9c -r 06726f0b8cd3 src/input.h --- a/src/input.h Wed Mar 07 06:11:51 2012 +0200 +++ b/src/input.h Thu Mar 08 14:37:17 2012 +0200 @@ -1,7 +1,7 @@ /* -Copyright 2004 John Tsiombikas +Copyright 2004-2012 John Tsiombikas -This file is part of libgba, a library for GameBoy Advance development. +This file is part of gbasys, a library for GameBoy Advance development. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -r e3dc7705ad9c -r 06726f0b8cd3 src/signal.c --- a/src/signal.c Wed Mar 07 06:11:51 2012 +0200 +++ b/src/signal.c Thu Mar 08 14:37:17 2012 +0200 @@ -41,6 +41,7 @@ default_sig_handler[SIGUSR1] = SIG_IGN; default_sig_handler[SIGUSR2] = SIG_IGN; default_sig_handler[SIGIO] = SIG_IGN; + default_sig_handler[SIGTTIN] = SIG_IGN; for(i=0; i +Copyright 2004-2012 John Tsiombikas -This file is part of libgba, a library for GameBoy Advance development. +This file is part of gbasys, a library for GameBoy Advance development. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -r e3dc7705ad9c -r 06726f0b8cd3 src/term.c --- a/src/term.c Wed Mar 07 06:11:51 2012 +0200 +++ b/src/term.c Thu Mar 08 14:37:17 2012 +0200 @@ -46,10 +46,10 @@ if(fp != stdin) panic("getc: only stdin valid"); - save_signal(SIGIO); - signal(SIGIO, noop); + save_signal(SIGTTIN); + signal(SIGTTIN, noop); while(!key_queue->next) pause(); - restore_signal(SIGIO); + restore_signal(SIGTTIN); tmp = key_queue; key_queue = key_queue->next; @@ -77,5 +77,5 @@ key_queue_tail = key; } } - raise(SIGIO); + raise(SIGTTIN); } diff -r e3dc7705ad9c -r 06726f0b8cd3 src/timer.h --- a/src/timer.h Wed Mar 07 06:11:51 2012 +0200 +++ b/src/timer.h Thu Mar 08 14:37:17 2012 +0200 @@ -1,7 +1,7 @@ /* -Copyright 2004 John Tsiombikas +Copyright 2004-2012 John Tsiombikas -This file is part of libgba, a library for GameBoy Advance development. +This file is part of gbasys, a library for GameBoy Advance development. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by