Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1576894
 поиск   регистрация   авторизация 
 
Группа :: Эмуляторы
Пакет: dosbox

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: dosbox-0.65-loadfont-base.patch


--- dosbox-0.65/configure.in.orig	2006-03-29 18:54:41 +0600
+++ dosbox-0.65/configure.in	2006-09-15 00:50:31 +0600
@@ -199,6 +199,20 @@
   AC_MSG_RESULT(no)
 fi
 
+
+AH_TEMPLATE(ENABLE_LOADABLE_FONTS,[Define it to enable support for loading fonts at startup])
+AC_ARG_ENABLE(fontload,
+    AC_HELP_STRING([--disable-fontload],
+	[Disable support for loading fonts at startup]),,enable_fontload=yes)
+AC_MSG_CHECKING(support for loading fonts at startup) 
+if test x$enable_fontload = xyes ; then 
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(ENABLE_LOADABLE_FONTS,1)
+else 
+  AC_MSG_RESULT(no)
+fi 
+
+
 AH_TEMPLATE(C_SSHOT,[Define to 1 to enable screenshots, requires libpng])
 AC_CHECK_HEADER(png.h,have_png_h=yes,)
 AC_CHECK_LIB(png, png_check_sig, have_png_lib=yes, ,-lz)
--- dosbox-0.65/src/dosbox.cpp.orig	2006-03-28 17:30:52 +0600
+++ dosbox-0.65/src/dosbox.cpp	2006-09-15 00:52:08 +0600
@@ -105,6 +105,9 @@
 void SHELL_Init(void);
 
 void INT10_Init(Section*);
+#ifdef ENABLE_LOADABLE_FONTS
+void INT10_Font_Init(Section*);
+#endif
 
 static LoopHandler * loop;
 
@@ -399,6 +402,14 @@
 	        "                2axis is the default and supports two joysticks.\n"
 	);
 
+#ifdef ENABLE_LOADABLE_FONTS
+
+	secprop->Add_string("font8x8","");
+	secprop->Add_string("font8x14","");
+	secprop->Add_string("font8x16","");
+	secprop->AddInitFunction(&INT10_Font_Init);
+
+#endif
 	secprop->AddInitFunction(&INT10_Init);
 	secprop->AddInitFunction(&MOUSE_Init); //Must be after int10 as it uses CurMode
 	secprop->AddInitFunction(&JOYSTICK_Init);
--- dosbox-0.65/src/ints/int10_fonts.cpp.orig	2006-09-15 00:50:31 +0600
+++ dosbox-0.65/src/ints/int10_fonts.cpp	2006-09-15 00:50:31 +0600
@@ -0,0 +1,75 @@
+/*
+ *  dosbox/src/ints/int10_fonts.cpp  --  part of DOSBox
+ *
+ *  Copyright (C) 2004  Ilya Evseev
+ *
+ *  Loading user-defined fonts at startup.
+ *  Fontname can be passed in configuration file or command line.
+ *
+ *  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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "int10.h"
+#include "setup.h"
+
+#ifdef ENABLE_LOADABLE_FONTS
+
+static void LoadFontFile(Bit8u *destmap, const char *file_name, int nbytes)
+{
+	if (!file_name || !*file_name)
+		return;
+	int fd = open(file_name, O_RDONLY);
+	if (fd < 0)
+		E_Exit("FONT:Can't load font: %s", file_name);
+	int nread = read(fd, destmap, nbytes);
+	if (nread != nbytes)
+		E_Exit("FONT:Invalid font size in file %s: %d bytes, must be %d",
+			file_name, nread, nbytes);
+	close(fd);
+	LOG(LOG_VGAMISC,LOG_NORMAL)("Loaded font from %s", file_name);
+}
+
+static void LoadFont(Section_prop *section, Bit8u *destmap,
+	int font_height, char *cmdarg)
+{
+        std::string file_name;
+	if (control->cmdline->FindString(cmdarg, file_name, true)) {
+		LoadFontFile(destmap, file_name.c_str(), font_height * 256);
+	} else {
+		LoadFontFile(destmap, section->Get_string(cmdarg+1),
+		    font_height * 256);
+	}
+}
+
+void INT10_Font_Init(Section *sec) {
+	MSG_Add("BIOS_CONFIGFILE_HELP",
+		"font8x8  -- file containing user-defined BIOS font 8x8.\n"
+		"font8x14 -- file containing user-defined BIOS font 8x14.\n"
+		"font8x16 -- file containing user-defined BIOS font 8x16.\n"
+	);
+	Section_prop *section = static_cast<Section_prop *>(sec);
+	LoadFont(section, int10_font_08,  8, "-font8x8");
+	LoadFont(section, int10_font_14, 14, "-font8x14");
+	LoadFont(section, int10_font_16, 16, "-font8x16");
+}
+
+#endif  /* ENABLE_LOADABLE_FONTS */
+
+/* EOF */
--- dosbox-0.65/src/ints/Makefile.am.orig	2004-03-31 21:41:58 +0600
+++ dosbox-0.65/src/ints/Makefile.am	2006-09-15 00:50:31 +0600
@@ -4,4 +4,5 @@
 libints_a_SOURCES = mouse.cpp xms.cpp xms.h ems.cpp \
                     int10.cpp int10.h int10_char.cpp int10_memory.cpp int10_misc.cpp int10_modes.cpp \
 		    int10_vesa.cpp int10_pal.cpp int10_put_pixel.cpp \
+		    int10_fonts.cpp \
 		    bios.cpp bios_disk.cpp bios_keyboard.cpp 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005