diff --git a/README.TXT b/README.TXT index ea012de3e..173cccd62 100644 --- a/README.TXT +++ b/README.TXT @@ -1,10 +1,17 @@ ================ -= FROSTED DOOM = += fbDOOM = ================ -Port of original DOOM to Frosted operating system. -Frosted does not yet have a framebuffer nor sound driver, -so for the moment, it just compiles and links... +Adaptation of the original DOOM +to be easily portable to framebuffer devices with minimal depenencies. +Runs on: +* Plain desktop Linux framebuffer, +* Siglent SSA 3021X Spectrum Analyzer, +* Frosted OS + +To build (example): +* cd fbdoom +* make CROSS_COMPILE=arm-linux-gnueabihf- Original readme diff --git a/frosted-doom/Makefile b/fbdoom/Makefile similarity index 64% rename from frosted-doom/Makefile rename to fbdoom/Makefile index 038ae011a..b627c3311 100644 --- a/frosted-doom/Makefile +++ b/fbdoom/Makefile @@ -5,7 +5,7 @@ # $Log:$ # -ARM?=1 +CROSS_COMPILE ?= #arm-linux-gnueabihf- ifeq ($(V),1) VB='' @@ -13,24 +13,12 @@ else VB=@ endif -ifeq ($(ARM),1) - CROSS_COMPILE = arm-frosted-eabi- - OBJS+=$(OBJDIR)/i_video_fbdev.o - CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ffunction-sections -fdata-sections -mcpu=cortex-m3 - CFLAGS+=-DCORE_M3 -D__frosted__ - # COMPILER FLAGS -- No gcc libraries - CFLAGS+=-nostartfiles - # COMPILER FLAGS -- GOT/PIC - CFLAGS+=-fPIC -mlong-calls -fno-common -msingle-pic-base -mno-pic-data-is-text-relative -Wstack-usage=1024 - # LINKER FLAGS - LDFLAGS+=-fPIC -mlong-calls -fno-common -Wl,-elf2flt -lgloss -else - CFLAGS+=-m32 -fsanitize=address -Wunused-const-variable=0 - LIBS+=-lXext -lX11 -lnsl -lm -lSDL - OBJS+=$(OBJDIR)/i_video.o -endif +#LIBS+=-lXext -lX11 -lnsl -lm -lSDL +#CFLAGS+=-Wunused-const-variable=0 +#CFLAGS+=-fsanitize=address +OBJS+=$(OBJDIR)/i_video_fbdev.o -CC= $(CROSS_COMPILE)gcc # gcc or g++ +CC=$(CROSS_COMPILE)gcc # gcc or g++ CFLAGS+=-ggdb3 -Os LDFLAGS+=-Wl,--gc-sections CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM @@ -38,7 +26,7 @@ LIBS+=-lm -lc # subdirectory for objects OBJDIR=build -OUTPUT=fdoom +OUTPUT=fbdoom SRC_DOOM = i_main.o dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_file_stdc_unbuffered.o w_main.o w_wad.o z_zone.o OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM)) @@ -57,7 +45,6 @@ $(OUTPUT): $(OBJS) -o $(OUTPUT) $(LIBS) -Wl,-Map,$(OUTPUT).map @echo [Size] -$(CROSS_COMPILE)size $(OUTPUT) - -$(CROSS_COMPILE)flthdr $(OUTPUT) $(OBJS): | $(OBJDIR) @@ -71,7 +58,3 @@ $(OBJDIR)/%.o: %.c print: @echo OBJS: $(OBJS) -############################################################# -# -############################################################# - diff --git a/frosted-doom/am_map.c b/fbdoom/am_map.c similarity index 100% rename from frosted-doom/am_map.c rename to fbdoom/am_map.c diff --git a/frosted-doom/am_map.h b/fbdoom/am_map.h similarity index 100% rename from frosted-doom/am_map.h rename to fbdoom/am_map.h diff --git a/frosted-doom/config.h b/fbdoom/config.h similarity index 100% rename from frosted-doom/config.h rename to fbdoom/config.h diff --git a/frosted-doom/d_englsh.h b/fbdoom/d_englsh.h similarity index 100% rename from frosted-doom/d_englsh.h rename to fbdoom/d_englsh.h diff --git a/frosted-doom/d_event.c b/fbdoom/d_event.c similarity index 100% rename from frosted-doom/d_event.c rename to fbdoom/d_event.c diff --git a/frosted-doom/d_event.h b/fbdoom/d_event.h similarity index 100% rename from frosted-doom/d_event.h rename to fbdoom/d_event.h diff --git a/frosted-doom/d_items.c b/fbdoom/d_items.c similarity index 100% rename from frosted-doom/d_items.c rename to fbdoom/d_items.c diff --git a/frosted-doom/d_items.h b/fbdoom/d_items.h similarity index 100% rename from frosted-doom/d_items.h rename to fbdoom/d_items.h diff --git a/frosted-doom/d_iwad.c b/fbdoom/d_iwad.c similarity index 100% rename from frosted-doom/d_iwad.c rename to fbdoom/d_iwad.c diff --git a/frosted-doom/d_iwad.h b/fbdoom/d_iwad.h similarity index 100% rename from frosted-doom/d_iwad.h rename to fbdoom/d_iwad.h diff --git a/frosted-doom/d_loop.c b/fbdoom/d_loop.c similarity index 100% rename from frosted-doom/d_loop.c rename to fbdoom/d_loop.c diff --git a/frosted-doom/d_loop.h b/fbdoom/d_loop.h similarity index 100% rename from frosted-doom/d_loop.h rename to fbdoom/d_loop.h diff --git a/frosted-doom/d_main.c b/fbdoom/d_main.c similarity index 100% rename from frosted-doom/d_main.c rename to fbdoom/d_main.c diff --git a/frosted-doom/d_main.h b/fbdoom/d_main.h similarity index 100% rename from frosted-doom/d_main.h rename to fbdoom/d_main.h diff --git a/frosted-doom/d_mode.c b/fbdoom/d_mode.c similarity index 100% rename from frosted-doom/d_mode.c rename to fbdoom/d_mode.c diff --git a/frosted-doom/d_mode.h b/fbdoom/d_mode.h similarity index 100% rename from frosted-doom/d_mode.h rename to fbdoom/d_mode.h diff --git a/frosted-doom/d_net.c b/fbdoom/d_net.c similarity index 100% rename from frosted-doom/d_net.c rename to fbdoom/d_net.c diff --git a/frosted-doom/d_player.h b/fbdoom/d_player.h similarity index 100% rename from frosted-doom/d_player.h rename to fbdoom/d_player.h diff --git a/frosted-doom/d_textur.h b/fbdoom/d_textur.h similarity index 100% rename from frosted-doom/d_textur.h rename to fbdoom/d_textur.h diff --git a/frosted-doom/d_think.h b/fbdoom/d_think.h similarity index 100% rename from frosted-doom/d_think.h rename to fbdoom/d_think.h diff --git a/frosted-doom/d_ticcmd.h b/fbdoom/d_ticcmd.h similarity index 100% rename from frosted-doom/d_ticcmd.h rename to fbdoom/d_ticcmd.h diff --git a/frosted-doom/deh_main.h b/fbdoom/deh_main.h similarity index 100% rename from frosted-doom/deh_main.h rename to fbdoom/deh_main.h diff --git a/frosted-doom/deh_misc.h b/fbdoom/deh_misc.h similarity index 100% rename from frosted-doom/deh_misc.h rename to fbdoom/deh_misc.h diff --git a/frosted-doom/deh_str.h b/fbdoom/deh_str.h similarity index 100% rename from frosted-doom/deh_str.h rename to fbdoom/deh_str.h diff --git a/frosted-doom/doom.h b/fbdoom/doom.h similarity index 100% rename from frosted-doom/doom.h rename to fbdoom/doom.h diff --git a/frosted-doom/doomdata.h b/fbdoom/doomdata.h similarity index 100% rename from frosted-doom/doomdata.h rename to fbdoom/doomdata.h diff --git a/frosted-doom/doomdef.c b/fbdoom/doomdef.c similarity index 100% rename from frosted-doom/doomdef.c rename to fbdoom/doomdef.c diff --git a/frosted-doom/doomdef.h b/fbdoom/doomdef.h similarity index 100% rename from frosted-doom/doomdef.h rename to fbdoom/doomdef.h diff --git a/frosted-doom/doomfeatures.h b/fbdoom/doomfeatures.h similarity index 100% rename from frosted-doom/doomfeatures.h rename to fbdoom/doomfeatures.h diff --git a/frosted-doom/doomkeys.h b/fbdoom/doomkeys.h similarity index 100% rename from frosted-doom/doomkeys.h rename to fbdoom/doomkeys.h diff --git a/frosted-doom/doomstat.c b/fbdoom/doomstat.c similarity index 100% rename from frosted-doom/doomstat.c rename to fbdoom/doomstat.c diff --git a/frosted-doom/doomstat.h b/fbdoom/doomstat.h similarity index 100% rename from frosted-doom/doomstat.h rename to fbdoom/doomstat.h diff --git a/frosted-doom/doomtype.h b/fbdoom/doomtype.h similarity index 100% rename from frosted-doom/doomtype.h rename to fbdoom/doomtype.h diff --git a/frosted-doom/dstrings.c b/fbdoom/dstrings.c similarity index 100% rename from frosted-doom/dstrings.c rename to fbdoom/dstrings.c diff --git a/frosted-doom/dstrings.h b/fbdoom/dstrings.h similarity index 100% rename from frosted-doom/dstrings.h rename to fbdoom/dstrings.h diff --git a/frosted-doom/dummy.c b/fbdoom/dummy.c similarity index 100% rename from frosted-doom/dummy.c rename to fbdoom/dummy.c diff --git a/frosted-doom/f_finale.c b/fbdoom/f_finale.c similarity index 100% rename from frosted-doom/f_finale.c rename to fbdoom/f_finale.c diff --git a/frosted-doom/f_finale.h b/fbdoom/f_finale.h similarity index 100% rename from frosted-doom/f_finale.h rename to fbdoom/f_finale.h diff --git a/frosted-doom/f_wipe.c b/fbdoom/f_wipe.c similarity index 100% rename from frosted-doom/f_wipe.c rename to fbdoom/f_wipe.c diff --git a/frosted-doom/f_wipe.h b/fbdoom/f_wipe.h similarity index 100% rename from frosted-doom/f_wipe.h rename to fbdoom/f_wipe.h diff --git a/frosted-doom/g_game.c b/fbdoom/g_game.c similarity index 100% rename from frosted-doom/g_game.c rename to fbdoom/g_game.c diff --git a/frosted-doom/g_game.h b/fbdoom/g_game.h similarity index 100% rename from frosted-doom/g_game.h rename to fbdoom/g_game.h diff --git a/frosted-doom/gusconf.c b/fbdoom/gusconf.c similarity index 100% rename from frosted-doom/gusconf.c rename to fbdoom/gusconf.c diff --git a/frosted-doom/gusconf.h b/fbdoom/gusconf.h similarity index 100% rename from frosted-doom/gusconf.h rename to fbdoom/gusconf.h diff --git a/frosted-doom/hu_lib.c b/fbdoom/hu_lib.c similarity index 100% rename from frosted-doom/hu_lib.c rename to fbdoom/hu_lib.c diff --git a/frosted-doom/hu_lib.h b/fbdoom/hu_lib.h similarity index 100% rename from frosted-doom/hu_lib.h rename to fbdoom/hu_lib.h diff --git a/frosted-doom/hu_stuff.c b/fbdoom/hu_stuff.c similarity index 100% rename from frosted-doom/hu_stuff.c rename to fbdoom/hu_stuff.c diff --git a/frosted-doom/hu_stuff.h b/fbdoom/hu_stuff.h similarity index 100% rename from frosted-doom/hu_stuff.h rename to fbdoom/hu_stuff.h diff --git a/frosted-doom/i_cdmus.c b/fbdoom/i_cdmus.c similarity index 100% rename from frosted-doom/i_cdmus.c rename to fbdoom/i_cdmus.c diff --git a/frosted-doom/i_cdmus.h b/fbdoom/i_cdmus.h similarity index 100% rename from frosted-doom/i_cdmus.h rename to fbdoom/i_cdmus.h diff --git a/frosted-doom/i_endoom.c b/fbdoom/i_endoom.c similarity index 100% rename from frosted-doom/i_endoom.c rename to fbdoom/i_endoom.c diff --git a/frosted-doom/i_endoom.h b/fbdoom/i_endoom.h similarity index 100% rename from frosted-doom/i_endoom.h rename to fbdoom/i_endoom.h diff --git a/frosted-doom/i_joystick.c b/fbdoom/i_joystick.c similarity index 100% rename from frosted-doom/i_joystick.c rename to fbdoom/i_joystick.c diff --git a/frosted-doom/i_joystick.h b/fbdoom/i_joystick.h similarity index 100% rename from frosted-doom/i_joystick.h rename to fbdoom/i_joystick.h diff --git a/frosted-doom/i_main.c b/fbdoom/i_main.c similarity index 100% rename from frosted-doom/i_main.c rename to fbdoom/i_main.c diff --git a/frosted-doom/i_oplmusic.c b/fbdoom/i_oplmusic.c similarity index 100% rename from frosted-doom/i_oplmusic.c rename to fbdoom/i_oplmusic.c diff --git a/frosted-doom/i_pcsound.c b/fbdoom/i_pcsound.c similarity index 100% rename from frosted-doom/i_pcsound.c rename to fbdoom/i_pcsound.c diff --git a/frosted-doom/i_scale.c b/fbdoom/i_scale.c similarity index 100% rename from frosted-doom/i_scale.c rename to fbdoom/i_scale.c diff --git a/frosted-doom/i_scale.h b/fbdoom/i_scale.h similarity index 100% rename from frosted-doom/i_scale.h rename to fbdoom/i_scale.h diff --git a/frosted-doom/i_sdlmusic.c b/fbdoom/i_sdlmusic.c similarity index 100% rename from frosted-doom/i_sdlmusic.c rename to fbdoom/i_sdlmusic.c diff --git a/frosted-doom/i_sdlsound.c b/fbdoom/i_sdlsound.c similarity index 100% rename from frosted-doom/i_sdlsound.c rename to fbdoom/i_sdlsound.c diff --git a/frosted-doom/i_sound.c b/fbdoom/i_sound.c similarity index 100% rename from frosted-doom/i_sound.c rename to fbdoom/i_sound.c diff --git a/frosted-doom/i_sound.h b/fbdoom/i_sound.h similarity index 100% rename from frosted-doom/i_sound.h rename to fbdoom/i_sound.h diff --git a/frosted-doom/i_sound_dummy.c b/fbdoom/i_sound_dummy.c similarity index 100% rename from frosted-doom/i_sound_dummy.c rename to fbdoom/i_sound_dummy.c diff --git a/frosted-doom/i_swap.h b/fbdoom/i_swap.h similarity index 100% rename from frosted-doom/i_swap.h rename to fbdoom/i_swap.h diff --git a/frosted-doom/i_system.c b/fbdoom/i_system.c similarity index 100% rename from frosted-doom/i_system.c rename to fbdoom/i_system.c diff --git a/frosted-doom/i_system.h b/fbdoom/i_system.h similarity index 100% rename from frosted-doom/i_system.h rename to fbdoom/i_system.h diff --git a/frosted-doom/i_timer.c b/fbdoom/i_timer.c similarity index 100% rename from frosted-doom/i_timer.c rename to fbdoom/i_timer.c diff --git a/frosted-doom/i_timer.h b/fbdoom/i_timer.h similarity index 100% rename from frosted-doom/i_timer.h rename to fbdoom/i_timer.h diff --git a/frosted-doom/i_video.c b/fbdoom/i_video.c similarity index 100% rename from frosted-doom/i_video.c rename to fbdoom/i_video.c diff --git a/frosted-doom/i_video.h b/fbdoom/i_video.h similarity index 100% rename from frosted-doom/i_video.h rename to fbdoom/i_video.h diff --git a/frosted-doom/i_video_fbdev.c b/fbdoom/i_video_fbdev.c similarity index 70% rename from frosted-doom/i_video_fbdev.c rename to fbdoom/i_video_fbdev.c index 0ea662770..a460981e6 100644 --- a/frosted-doom/i_video_fbdev.c +++ b/fbdoom/i_video_fbdev.c @@ -45,12 +45,13 @@ rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $"; #include #include #include +#include #include +//#define CMAP256 -#define FB_WIDTH (480) -#define FB_HEIGHT (272) -#define FB_BPP_RGB565 (16) +struct fb_var_screeninfo fb = {}; +int fb_scaling = 1; struct color { uint32_t b:8; @@ -105,7 +106,6 @@ int usemouse = 0; int vanilla_keyboard_mapping = true; - typedef struct { byte r; @@ -117,38 +117,56 @@ typedef struct static uint16_t rgb565_palette[256]; -// Last touch state - -//static touch_state_t last_touch_state; - -// Last button state +void cmap_to_rgb565(uint16_t * out, uint8_t * in, int in_pixels) +{ + int i, j; + struct color c; + uint16_t r, g, b; -//static bool last_button_state; + for (i = 0; i < in_pixels; i++) + { + c = colors[*in]; + r = ((uint16_t)(c.r >> 3)) << 11; + g = ((uint16_t)(c.g >> 2)) << 5; + b = ((uint16_t)(c.b >> 3)) << 0; + *out = (r | g | b); + + in++; + for (j = 0; j < fb_scaling; j++) { + out++; + } + } +} -// run state +void cmap_to_fb(uint8_t * out, uint8_t * in, int in_pixels) +{ + int i, j, k; + struct color c; + uint32_t pix; + uint16_t r, g, b; -//static bool run; + for (i = 0; i < in_pixels; i++) + { + c = colors[*in]; /* R:8 G:8 B:8 format! */ + r = (uint16_t)(c.r >> (8 - fb.red.length)); + g = (uint16_t)(c.g >> (8 - fb.green.length)); + b = (uint16_t)(c.b >> (8 - fb.blue.length)); + pix = r << fb.red.offset; + pix |= g << fb.green.offset; + pix |= b << fb.blue.offset; + + for (k = 0; k < fb_scaling; k++) { + for (j = 0; j < fb.bits_per_pixel/8; j++) { + *out = (pix >> (j*8)); + out++; + } + } + in++; + } +} void I_InitGraphics (void) { -// gfx_image_t keys_img; -// gfx_coord_t coords; -// -// gfx_init_img (&keys_img, 40, 320, GFX_PIXEL_FORMAT_RGB565, RGB565_BLACK); -// keys_img.pixel_data = (uint8_t*)img_keys; -// gfx_init_img_coord (&coords, &keys_img); -// -// gfx_draw_img (&keys_img, &coords); -// lcd_refresh (); -// -// gfx_draw_img (&keys_img, &coords); -// lcd_refresh (); - - X_width = SCREENWIDTH; - X_height = SCREENHEIGHT; - - printf("I_InitGraphics: w x h: %d x %d\n", X_width, X_height); - /* Open fbdev file descriptor */ fd_fb = open("/dev/fb0", O_RDWR); if (fd_fb < 0) @@ -157,11 +175,25 @@ void I_InitGraphics (void) exit(-1); } + /* fetch framebuffer info */ + ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb); + /* change params if needed */ + //ioctl(fd_fb, FBIOPUT_VSCREENINFO, &fb); + printf("I_InitGraphics: framebuffer: x_res: %d, y_res: %d, x_virtual: %d, y_virtual: %d, bpp: %d, grayscale: %d\n", + fb.xres, fb.yres, fb.xres_virtual, fb.yres_virtual, fb.bits_per_pixel, fb.grayscale); + + printf("I_InitGraphics: framebuffer: RGBA: %d%d%d%d, red_off: %d, green_off: %d, blue_off: %d, transp_off: %d\n", + fb.red.length, fb.green.length, fb.blue.length, fb.transp.length, fb.red.offset, fb.green.offset, fb.blue.offset, fb.transp.offset); + + printf("I_InitGraphics: DOOM screen size: w x h: %d x %d\n", SCREENWIDTH, SCREENHEIGHT); + fb_scaling = fb.xres / SCREENWIDTH; + if (fb.yres / SCREENHEIGHT < fb_scaling) + fb_scaling = fb.yres / SCREENHEIGHT; + printf("I_InitGraphics: Auto-scaling factor: %d\n", fb_scaling); + /* Allocate screen to draw to */ - //screen_pixels = malloc(X_width * X_height); - // I_VideoBuffer = (byte*)Z_Malloc (SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL); // For DOOM to draw on - I_VideoBuffer_FB = (byte*)Z_Malloc (FB_WIDTH * FB_HEIGHT, PU_STATIC, NULL); // For a single write() syscall to fbdev + I_VideoBuffer_FB = (byte*)malloc(fb.xres * fb.yres * (fb.bits_per_pixel/8)); // For a single write() syscall to fbdev screenvisible = true; } @@ -169,7 +201,7 @@ void I_InitGraphics (void) void I_ShutdownGraphics (void) { Z_Free (I_VideoBuffer); - Z_Free (I_VideoBuffer_FB); + free(I_VideoBuffer_FB); } void I_StartFrame (void) @@ -362,15 +394,18 @@ void I_UpdateNoBlit (void) void I_FinishUpdate (void) { -#define CMAP256 int y; int x_offset, y_offset, x_offset_end; unsigned char *line_in, *line_out; /* Offsets in case FB is bigger than DOOM */ - y_offset = (FB_HEIGHT - SCREENHEIGHT + 1) / 2; - x_offset = (FB_WIDTH - SCREENWIDTH + 1) / 2; - x_offset_end = (FB_WIDTH - SCREENWIDTH - x_offset); + /* 600 = fb heigt, 200 screenheight */ + /* 600 = fb heigt, 200 screenheight */ + /* 2048 =fb width, 320 screenwidth */ + y_offset = (((fb.yres - (SCREENHEIGHT * fb_scaling)) * fb.bits_per_pixel/8)) / 2; + x_offset = (((fb.xres - (SCREENWIDTH * fb_scaling)) * fb.bits_per_pixel/8)) / 2; // XXX: siglent FB hack: /4 instead of /2, since it seems to handle the resolution in a funny way + //x_offset = 0; + x_offset_end = ((fb.xres - (SCREENWIDTH * fb_scaling)) * fb.bits_per_pixel/8) - x_offset; /* DRAW SCREEN */ line_in = (unsigned char *) I_VideoBuffer; @@ -380,20 +415,27 @@ void I_FinishUpdate (void) while (y--) { - line_out += x_offset; + int i; + for (i = 0; i < fb_scaling; i++) { + line_out += x_offset; #ifdef CMAP256 - memcpy(line_out, line_in, SCREENWIDTH); /* FB_WIDTH is bigger than Doom SCREENWIDTH... */ + for (fb_scaling == 1) { + memcpy(line_out, line_in, SCREENWIDTH); /* fb_width is bigger than Doom SCREENWIDTH... */ + } else { + //XXX FIXME fb_scaling support! + } #else - cmap_to_rgb565(line_out, line_in, SCREENWIDTH); + //cmap_to_rgb565((void*)line_out, (void*)line_in, SCREENWIDTH); + cmap_to_fb((void*)line_out, (void*)line_in, SCREENWIDTH); #endif + line_out += (SCREENWIDTH * fb_scaling * (fb.bits_per_pixel/8)) + x_offset_end; + } line_in += SCREENWIDTH; - line_out += SCREENWIDTH + x_offset_end; } /* Start drawing from y-offset */ - lseek(fd_fb, y_offset * FB_WIDTH, SEEK_SET); - write(fd_fb, I_VideoBuffer_FB, SCREENHEIGHT * FB_WIDTH); /* draw only portion used by doom + x-offsets */ - + lseek(fd_fb, y_offset * fb.xres, SEEK_SET); + write(fd_fb, I_VideoBuffer_FB, (SCREENHEIGHT * fb_scaling * (fb.bits_per_pixel/8)) * fb.xres); /* draw only portion used by doom + x-offsets */ } // @@ -428,6 +470,10 @@ void I_SetPalette (byte* palette) // palette += 3; //} + + /* performance boost: + * map to the right pixel format over here! */ + for (i=0; i<256; ++i ) { colors[i].a = 0; colors[i].r = gammatable[usegamma][*palette++]; @@ -436,7 +482,7 @@ void I_SetPalette (byte* palette) } /* Set new color map in kernel framebuffer driver */ - ioctl(fd_fb, IOCTL_FB_PUTCMAP, colors); + //XXX FIXME ioctl(fd_fb, IOCTL_FB_PUTCMAP, colors); } // Given an RGB value, find the closest matching palette index. diff --git a/frosted-doom/icon.c b/fbdoom/icon.c similarity index 100% rename from frosted-doom/icon.c rename to fbdoom/icon.c diff --git a/frosted-doom/info.c b/fbdoom/info.c similarity index 100% rename from frosted-doom/info.c rename to fbdoom/info.c diff --git a/frosted-doom/info.h b/fbdoom/info.h similarity index 100% rename from frosted-doom/info.h rename to fbdoom/info.h diff --git a/frosted-doom/m_argv.c b/fbdoom/m_argv.c similarity index 100% rename from frosted-doom/m_argv.c rename to fbdoom/m_argv.c diff --git a/frosted-doom/m_argv.h b/fbdoom/m_argv.h similarity index 100% rename from frosted-doom/m_argv.h rename to fbdoom/m_argv.h diff --git a/frosted-doom/m_bbox.c b/fbdoom/m_bbox.c similarity index 100% rename from frosted-doom/m_bbox.c rename to fbdoom/m_bbox.c diff --git a/frosted-doom/m_bbox.h b/fbdoom/m_bbox.h similarity index 100% rename from frosted-doom/m_bbox.h rename to fbdoom/m_bbox.h diff --git a/frosted-doom/m_cheat.c b/fbdoom/m_cheat.c similarity index 100% rename from frosted-doom/m_cheat.c rename to fbdoom/m_cheat.c diff --git a/frosted-doom/m_cheat.h b/fbdoom/m_cheat.h similarity index 100% rename from frosted-doom/m_cheat.h rename to fbdoom/m_cheat.h diff --git a/frosted-doom/m_config.c b/fbdoom/m_config.c similarity index 100% rename from frosted-doom/m_config.c rename to fbdoom/m_config.c diff --git a/frosted-doom/m_config.h b/fbdoom/m_config.h similarity index 100% rename from frosted-doom/m_config.h rename to fbdoom/m_config.h diff --git a/frosted-doom/m_controls.c b/fbdoom/m_controls.c similarity index 100% rename from frosted-doom/m_controls.c rename to fbdoom/m_controls.c diff --git a/frosted-doom/m_controls.h b/fbdoom/m_controls.h similarity index 100% rename from frosted-doom/m_controls.h rename to fbdoom/m_controls.h diff --git a/frosted-doom/m_fixed.c b/fbdoom/m_fixed.c similarity index 100% rename from frosted-doom/m_fixed.c rename to fbdoom/m_fixed.c diff --git a/frosted-doom/m_fixed.h b/fbdoom/m_fixed.h similarity index 100% rename from frosted-doom/m_fixed.h rename to fbdoom/m_fixed.h diff --git a/frosted-doom/m_menu.c b/fbdoom/m_menu.c similarity index 100% rename from frosted-doom/m_menu.c rename to fbdoom/m_menu.c diff --git a/frosted-doom/m_menu.h b/fbdoom/m_menu.h similarity index 100% rename from frosted-doom/m_menu.h rename to fbdoom/m_menu.h diff --git a/frosted-doom/m_misc.c b/fbdoom/m_misc.c similarity index 100% rename from frosted-doom/m_misc.c rename to fbdoom/m_misc.c diff --git a/frosted-doom/m_misc.h b/fbdoom/m_misc.h similarity index 100% rename from frosted-doom/m_misc.h rename to fbdoom/m_misc.h diff --git a/frosted-doom/m_random.c b/fbdoom/m_random.c similarity index 100% rename from frosted-doom/m_random.c rename to fbdoom/m_random.c diff --git a/frosted-doom/m_random.h b/fbdoom/m_random.h similarity index 100% rename from frosted-doom/m_random.h rename to fbdoom/m_random.h diff --git a/frosted-doom/memio.c b/fbdoom/memio.c similarity index 100% rename from frosted-doom/memio.c rename to fbdoom/memio.c diff --git a/frosted-doom/memio.h b/fbdoom/memio.h similarity index 100% rename from frosted-doom/memio.h rename to fbdoom/memio.h diff --git a/frosted-doom/net_client.h b/fbdoom/net_client.h similarity index 100% rename from frosted-doom/net_client.h rename to fbdoom/net_client.h diff --git a/frosted-doom/net_dedicated.h b/fbdoom/net_dedicated.h similarity index 100% rename from frosted-doom/net_dedicated.h rename to fbdoom/net_dedicated.h diff --git a/frosted-doom/net_defs.h b/fbdoom/net_defs.h similarity index 100% rename from frosted-doom/net_defs.h rename to fbdoom/net_defs.h diff --git a/frosted-doom/net_gui.h b/fbdoom/net_gui.h similarity index 100% rename from frosted-doom/net_gui.h rename to fbdoom/net_gui.h diff --git a/frosted-doom/net_io.h b/fbdoom/net_io.h similarity index 100% rename from frosted-doom/net_io.h rename to fbdoom/net_io.h diff --git a/frosted-doom/net_loop.h b/fbdoom/net_loop.h similarity index 100% rename from frosted-doom/net_loop.h rename to fbdoom/net_loop.h diff --git a/frosted-doom/net_packet.h b/fbdoom/net_packet.h similarity index 100% rename from frosted-doom/net_packet.h rename to fbdoom/net_packet.h diff --git a/frosted-doom/net_query.h b/fbdoom/net_query.h similarity index 100% rename from frosted-doom/net_query.h rename to fbdoom/net_query.h diff --git a/frosted-doom/net_sdl.h b/fbdoom/net_sdl.h similarity index 100% rename from frosted-doom/net_sdl.h rename to fbdoom/net_sdl.h diff --git a/frosted-doom/net_server.h b/fbdoom/net_server.h similarity index 100% rename from frosted-doom/net_server.h rename to fbdoom/net_server.h diff --git a/frosted-doom/p_ceilng.c b/fbdoom/p_ceilng.c similarity index 100% rename from frosted-doom/p_ceilng.c rename to fbdoom/p_ceilng.c diff --git a/frosted-doom/p_doors.c b/fbdoom/p_doors.c similarity index 100% rename from frosted-doom/p_doors.c rename to fbdoom/p_doors.c diff --git a/frosted-doom/p_enemy.c b/fbdoom/p_enemy.c similarity index 100% rename from frosted-doom/p_enemy.c rename to fbdoom/p_enemy.c diff --git a/frosted-doom/p_floor.c b/fbdoom/p_floor.c similarity index 100% rename from frosted-doom/p_floor.c rename to fbdoom/p_floor.c diff --git a/frosted-doom/p_inter.c b/fbdoom/p_inter.c similarity index 100% rename from frosted-doom/p_inter.c rename to fbdoom/p_inter.c diff --git a/frosted-doom/p_inter.h b/fbdoom/p_inter.h similarity index 100% rename from frosted-doom/p_inter.h rename to fbdoom/p_inter.h diff --git a/frosted-doom/p_lights.c b/fbdoom/p_lights.c similarity index 100% rename from frosted-doom/p_lights.c rename to fbdoom/p_lights.c diff --git a/frosted-doom/p_local.h b/fbdoom/p_local.h similarity index 100% rename from frosted-doom/p_local.h rename to fbdoom/p_local.h diff --git a/frosted-doom/p_map.c b/fbdoom/p_map.c similarity index 100% rename from frosted-doom/p_map.c rename to fbdoom/p_map.c diff --git a/frosted-doom/p_maputl.c b/fbdoom/p_maputl.c similarity index 100% rename from frosted-doom/p_maputl.c rename to fbdoom/p_maputl.c diff --git a/frosted-doom/p_mobj.c b/fbdoom/p_mobj.c similarity index 100% rename from frosted-doom/p_mobj.c rename to fbdoom/p_mobj.c diff --git a/frosted-doom/p_mobj.h b/fbdoom/p_mobj.h similarity index 100% rename from frosted-doom/p_mobj.h rename to fbdoom/p_mobj.h diff --git a/frosted-doom/p_plats.c b/fbdoom/p_plats.c similarity index 100% rename from frosted-doom/p_plats.c rename to fbdoom/p_plats.c diff --git a/frosted-doom/p_pspr.c b/fbdoom/p_pspr.c similarity index 100% rename from frosted-doom/p_pspr.c rename to fbdoom/p_pspr.c diff --git a/frosted-doom/p_pspr.h b/fbdoom/p_pspr.h similarity index 100% rename from frosted-doom/p_pspr.h rename to fbdoom/p_pspr.h diff --git a/frosted-doom/p_saveg.c b/fbdoom/p_saveg.c similarity index 100% rename from frosted-doom/p_saveg.c rename to fbdoom/p_saveg.c diff --git a/frosted-doom/p_saveg.h b/fbdoom/p_saveg.h similarity index 100% rename from frosted-doom/p_saveg.h rename to fbdoom/p_saveg.h diff --git a/frosted-doom/p_setup.c b/fbdoom/p_setup.c similarity index 100% rename from frosted-doom/p_setup.c rename to fbdoom/p_setup.c diff --git a/frosted-doom/p_setup.h b/fbdoom/p_setup.h similarity index 100% rename from frosted-doom/p_setup.h rename to fbdoom/p_setup.h diff --git a/frosted-doom/p_sight.c b/fbdoom/p_sight.c similarity index 100% rename from frosted-doom/p_sight.c rename to fbdoom/p_sight.c diff --git a/frosted-doom/p_spec.c b/fbdoom/p_spec.c similarity index 100% rename from frosted-doom/p_spec.c rename to fbdoom/p_spec.c diff --git a/frosted-doom/p_spec.h b/fbdoom/p_spec.h similarity index 100% rename from frosted-doom/p_spec.h rename to fbdoom/p_spec.h diff --git a/frosted-doom/p_switch.c b/fbdoom/p_switch.c similarity index 100% rename from frosted-doom/p_switch.c rename to fbdoom/p_switch.c diff --git a/frosted-doom/p_telept.c b/fbdoom/p_telept.c similarity index 100% rename from frosted-doom/p_telept.c rename to fbdoom/p_telept.c diff --git a/frosted-doom/p_tick.c b/fbdoom/p_tick.c similarity index 100% rename from frosted-doom/p_tick.c rename to fbdoom/p_tick.c diff --git a/frosted-doom/p_tick.h b/fbdoom/p_tick.h similarity index 100% rename from frosted-doom/p_tick.h rename to fbdoom/p_tick.h diff --git a/frosted-doom/p_user.c b/fbdoom/p_user.c similarity index 100% rename from frosted-doom/p_user.c rename to fbdoom/p_user.c diff --git a/frosted-doom/r_bsp.c b/fbdoom/r_bsp.c similarity index 100% rename from frosted-doom/r_bsp.c rename to fbdoom/r_bsp.c diff --git a/frosted-doom/r_bsp.h b/fbdoom/r_bsp.h similarity index 100% rename from frosted-doom/r_bsp.h rename to fbdoom/r_bsp.h diff --git a/frosted-doom/r_data.c b/fbdoom/r_data.c similarity index 100% rename from frosted-doom/r_data.c rename to fbdoom/r_data.c diff --git a/frosted-doom/r_data.h b/fbdoom/r_data.h similarity index 100% rename from frosted-doom/r_data.h rename to fbdoom/r_data.h diff --git a/frosted-doom/r_defs.h b/fbdoom/r_defs.h similarity index 100% rename from frosted-doom/r_defs.h rename to fbdoom/r_defs.h diff --git a/frosted-doom/r_draw.c b/fbdoom/r_draw.c similarity index 100% rename from frosted-doom/r_draw.c rename to fbdoom/r_draw.c diff --git a/frosted-doom/r_draw.h b/fbdoom/r_draw.h similarity index 100% rename from frosted-doom/r_draw.h rename to fbdoom/r_draw.h diff --git a/frosted-doom/r_local.h b/fbdoom/r_local.h similarity index 100% rename from frosted-doom/r_local.h rename to fbdoom/r_local.h diff --git a/frosted-doom/r_main.c b/fbdoom/r_main.c similarity index 100% rename from frosted-doom/r_main.c rename to fbdoom/r_main.c diff --git a/frosted-doom/r_main.h b/fbdoom/r_main.h similarity index 100% rename from frosted-doom/r_main.h rename to fbdoom/r_main.h diff --git a/frosted-doom/r_plane.c b/fbdoom/r_plane.c similarity index 100% rename from frosted-doom/r_plane.c rename to fbdoom/r_plane.c diff --git a/frosted-doom/r_plane.h b/fbdoom/r_plane.h similarity index 100% rename from frosted-doom/r_plane.h rename to fbdoom/r_plane.h diff --git a/frosted-doom/r_segs.c b/fbdoom/r_segs.c similarity index 100% rename from frosted-doom/r_segs.c rename to fbdoom/r_segs.c diff --git a/frosted-doom/r_segs.h b/fbdoom/r_segs.h similarity index 100% rename from frosted-doom/r_segs.h rename to fbdoom/r_segs.h diff --git a/frosted-doom/r_sky.c b/fbdoom/r_sky.c similarity index 100% rename from frosted-doom/r_sky.c rename to fbdoom/r_sky.c diff --git a/frosted-doom/r_sky.h b/fbdoom/r_sky.h similarity index 100% rename from frosted-doom/r_sky.h rename to fbdoom/r_sky.h diff --git a/frosted-doom/r_state.h b/fbdoom/r_state.h similarity index 100% rename from frosted-doom/r_state.h rename to fbdoom/r_state.h diff --git a/frosted-doom/r_things.c b/fbdoom/r_things.c similarity index 100% rename from frosted-doom/r_things.c rename to fbdoom/r_things.c diff --git a/frosted-doom/r_things.h b/fbdoom/r_things.h similarity index 100% rename from frosted-doom/r_things.h rename to fbdoom/r_things.h diff --git a/frosted-doom/s_sound.c b/fbdoom/s_sound.c similarity index 100% rename from frosted-doom/s_sound.c rename to fbdoom/s_sound.c diff --git a/frosted-doom/s_sound.h b/fbdoom/s_sound.h similarity index 100% rename from frosted-doom/s_sound.h rename to fbdoom/s_sound.h diff --git a/frosted-doom/sha1.c b/fbdoom/sha1.c similarity index 100% rename from frosted-doom/sha1.c rename to fbdoom/sha1.c diff --git a/frosted-doom/sha1.h b/fbdoom/sha1.h similarity index 100% rename from frosted-doom/sha1.h rename to fbdoom/sha1.h diff --git a/frosted-doom/sounds.c b/fbdoom/sounds.c similarity index 100% rename from frosted-doom/sounds.c rename to fbdoom/sounds.c diff --git a/frosted-doom/sounds.h b/fbdoom/sounds.h similarity index 100% rename from frosted-doom/sounds.h rename to fbdoom/sounds.h diff --git a/frosted-doom/st_lib.c b/fbdoom/st_lib.c similarity index 100% rename from frosted-doom/st_lib.c rename to fbdoom/st_lib.c diff --git a/frosted-doom/st_lib.h b/fbdoom/st_lib.h similarity index 100% rename from frosted-doom/st_lib.h rename to fbdoom/st_lib.h diff --git a/frosted-doom/st_stuff.c b/fbdoom/st_stuff.c similarity index 100% rename from frosted-doom/st_stuff.c rename to fbdoom/st_stuff.c diff --git a/frosted-doom/st_stuff.h b/fbdoom/st_stuff.h similarity index 100% rename from frosted-doom/st_stuff.h rename to fbdoom/st_stuff.h diff --git a/frosted-doom/statdump.c b/fbdoom/statdump.c similarity index 100% rename from frosted-doom/statdump.c rename to fbdoom/statdump.c diff --git a/frosted-doom/statdump.h b/fbdoom/statdump.h similarity index 100% rename from frosted-doom/statdump.h rename to fbdoom/statdump.h diff --git a/frosted-doom/stubs.c b/fbdoom/stubs.c similarity index 100% rename from frosted-doom/stubs.c rename to fbdoom/stubs.c diff --git a/frosted-doom/tables.c b/fbdoom/tables.c similarity index 100% rename from frosted-doom/tables.c rename to fbdoom/tables.c diff --git a/frosted-doom/tables.h b/fbdoom/tables.h similarity index 100% rename from frosted-doom/tables.h rename to fbdoom/tables.h diff --git a/frosted-doom/v_patch.h b/fbdoom/v_patch.h similarity index 100% rename from frosted-doom/v_patch.h rename to fbdoom/v_patch.h diff --git a/frosted-doom/v_video.c b/fbdoom/v_video.c similarity index 100% rename from frosted-doom/v_video.c rename to fbdoom/v_video.c diff --git a/frosted-doom/v_video.h b/fbdoom/v_video.h similarity index 100% rename from frosted-doom/v_video.h rename to fbdoom/v_video.h diff --git a/frosted-doom/w_checksum.c b/fbdoom/w_checksum.c similarity index 100% rename from frosted-doom/w_checksum.c rename to fbdoom/w_checksum.c diff --git a/frosted-doom/w_checksum.h b/fbdoom/w_checksum.h similarity index 100% rename from frosted-doom/w_checksum.h rename to fbdoom/w_checksum.h diff --git a/frosted-doom/w_file.c b/fbdoom/w_file.c similarity index 100% rename from frosted-doom/w_file.c rename to fbdoom/w_file.c diff --git a/frosted-doom/w_file.h b/fbdoom/w_file.h similarity index 100% rename from frosted-doom/w_file.h rename to fbdoom/w_file.h diff --git a/frosted-doom/w_file_stdc.c b/fbdoom/w_file_stdc.c similarity index 100% rename from frosted-doom/w_file_stdc.c rename to fbdoom/w_file_stdc.c diff --git a/frosted-doom/w_file_stdc_unbuffered.c b/fbdoom/w_file_stdc_unbuffered.c similarity index 100% rename from frosted-doom/w_file_stdc_unbuffered.c rename to fbdoom/w_file_stdc_unbuffered.c diff --git a/frosted-doom/w_main.c b/fbdoom/w_main.c similarity index 100% rename from frosted-doom/w_main.c rename to fbdoom/w_main.c diff --git a/frosted-doom/w_main.h b/fbdoom/w_main.h similarity index 100% rename from frosted-doom/w_main.h rename to fbdoom/w_main.h diff --git a/frosted-doom/w_merge.h b/fbdoom/w_merge.h similarity index 100% rename from frosted-doom/w_merge.h rename to fbdoom/w_merge.h diff --git a/frosted-doom/w_wad.c b/fbdoom/w_wad.c similarity index 100% rename from frosted-doom/w_wad.c rename to fbdoom/w_wad.c diff --git a/frosted-doom/w_wad.h b/fbdoom/w_wad.h similarity index 100% rename from frosted-doom/w_wad.h rename to fbdoom/w_wad.h diff --git a/frosted-doom/wi_stuff.c b/fbdoom/wi_stuff.c similarity index 100% rename from frosted-doom/wi_stuff.c rename to fbdoom/wi_stuff.c diff --git a/frosted-doom/wi_stuff.h b/fbdoom/wi_stuff.h similarity index 100% rename from frosted-doom/wi_stuff.h rename to fbdoom/wi_stuff.h diff --git a/frosted-doom/z_zone.c b/fbdoom/z_zone.c similarity index 100% rename from frosted-doom/z_zone.c rename to fbdoom/z_zone.c diff --git a/frosted-doom/z_zone.h b/fbdoom/z_zone.h similarity index 100% rename from frosted-doom/z_zone.h rename to fbdoom/z_zone.h