char buffer[256];\r
int maxw = (SCREEN_WIDTH - x) / 8;\r
\r
+ if (maxw < 0)\r
+ return;\r
+\r
va_start(args, texto);\r
vsnprintf(buffer, sizeof(buffer), texto, args);\r
va_end(args);\r
\r
- if (maxw > 255)\r
- maxw = 255;\r
+ if (maxw > sizeof(buffer) - 1)\r
+ maxw = sizeof(buffer) - 1;\r
buffer[maxw] = 0;\r
\r
text_out16_(x,y,buffer,menu_text_color);\r
void smalltext_out16(int x, int y, const char *texto, int color)\r
{\r
char buffer[SCREEN_WIDTH/6+1];\r
+ int maxw = (SCREEN_WIDTH - x) / 6;\r
+\r
+ if (maxw < 0)\r
+ return;\r
\r
strncpy(buffer, texto, sizeof(buffer));\r
- buffer[sizeof(buffer) - 1] = 0;\r
+ if (maxw > sizeof(buffer) - 1)\r
+ maxw = sizeof(buffer) - 1;\r
+ buffer[maxw] = 0;\r
\r
smalltext_out16_(x, y, buffer, color);\r
}\r
-
# settings
use_musashi = 1
#use_fame = 1
#use_mz80 = 1
#profile = 1
-fake_in_gp2x = 1
-
+#fake_in_gp2x = 1
-DEFINC = -I../.. -I. -D__GP2X__ -D_UNZIP_SUPPORT -DIO_STATS -DIN_EVDEV # -DBENCHMARK
-GCC = gcc
-STRIP = strip
-AS = gcc
+-include Makefile.local
ifeq "$(profile)" "1"
-COPT_COMMON = -s -O3 -ftracer -fstrength-reduce -Wall -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math -fprofile-generate
-COPT = $(COPT_COMMON)
+CFLAGS += -O3 -Wall
+CFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math
+CFLAGS += -fprofile-generate
else
-COPT = -ggdb -Wall -fno-strict-aliasing # -pg -O3 -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -ffast-math
-COPT_COMMON = $(COPT)
+CFLAGS = -ggdb -Wall
endif
+DEFINES = __GP2X__ _UNZIP_SUPPORT IO_STATS IN_EVDEV
+CFLAGS += -I../.. -I.
# gtk
-COPT += `pkg-config --cflags gtk+-2.0`
+CFLAGS += `pkg-config --cflags gtk+-2.0`
LDFLAGS += `pkg-config --libs gtk+-2.0`
-COPT += `pkg-config --cflags gthread-2.0`
+CFLAGS += `pkg-config --cflags gthread-2.0`
LDFLAGS += `pkg-config --libs gthread-2.0`
# frontend
OBJS += platform/gp2x/main.o platform/gp2x/emu.o platform/gp2x/plat.o usbjoy.o blit.o \
in_evdev.o plat.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
-# platform/gp2x/menu.o
-
-ifeq "$(fake_in_gp2x)" "1"
-DEFINC += -DIN_GP2X -DFAKE_IN_GP2X
-OBJS += platform/gp2x/in_gp2x.o
-endif
# common
OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \
platform/common/readpng.o platform/common/input.o platform/common/mp3_helix.o
+ifeq "$(fake_in_gp2x)" "1"
+DEFINES += IN_GP2X FAKE_IN_GP2X
+OBJS += platform/gp2x/in_gp2x.o
+endif
+
# Pico
OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o
OBJS += unzip/unzip.o unzip/unzip_stream.o
# CPU cores
ifeq "$(use_musashi)" "1"
-DEFINC += -DEMU_M68K
+DEFINES += EMU_M68K
OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
endif
ifeq "$(use_fame)" "1"
-DEFINC += -DEMU_F68K
+DEFINES += EMU_F68K
OBJS += cpu/fame/famec.o
endif
# z80
ifeq "$(use_mz80)" "1"
-DEFINC += -D_USE_MZ80
+DEFINES += _USE_MZ80
OBJS += cpu/mz80/mz80.o
else
-DEFINC += -D_USE_CZ80
+DEFINES += _USE_CZ80
OBJS += cpu/cz80/cz80.o
endif
# misc
endif
OBJS += cpu/musashi/m68kdasm.o
+CFLAGS += $(addprefix -D,$(DEFINES))
+
vpath %.c = ../..
+
DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \
zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
@echo ">>>" $@
- $(GCC) $(COPT) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
+ $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
mkdirs:
mkdir -p $(DIRS)
.c.o:
@echo ">>>" $<
- $(GCC) $(COPT) $(DEFINC) -c $< -o $@
+ $(CC) $(CFLAGS) -c $< -o $@
.s.o:
@echo ">>>" $<
- $(GCC) $(COPT) $(DEFINC) -c $< -o $@
+ $(CC) $(CFLAGS) -c $< -o $@
-pico/sound/ym2612.o : ../../pico/sound/ym2612.c
- @echo ">>>" $@
- $(GCC) $(COPT_COMMON) $(DEFINC) -c $< -o $@
+#pico/sound/ym2612.o : ../../pico/sound/ym2612.c
+# @echo ">>>" $@
+# $(CC) $(CFLAGS) -c $< -o $@
cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
@echo ">>>" $<
- $(GCC) $(COPT) $(DEFINC) -Wno-unused -c $< -o $@
-
+ $(CC) $(CFLAGS) -Wno-unused -c $< -o $@
return 0;
}
+/*
+void gdk_drawable_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+**/
+
+static void size_allocate_event(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
+{
+ gint w, h;
+ gdk_drawable_get_size(gtk_items.window, &w, &h);
+ printf("%dx%d %dx%d\n", allocation->width, allocation->height, w, h);
+}
+
static void *gtk_threadf(void *targ)
{
int argc = 0;
g_signal_connect (G_OBJECT (gtk_items.window), "key_release_event",
G_CALLBACK (key_release_event), NULL);
+ g_signal_connect (G_OBJECT (gtk_items.window), "size_allocate",
+ G_CALLBACK (size_allocate_event), NULL);
+
gtk_container_set_border_width (GTK_CONTAINER (gtk_items.window), 2);
gtk_window_set_title ((GtkWindow *) gtk_items.window, verstring);