Diff for /np2/font/font.c between versions 1.4 and 1.10

version 1.4, 2003/11/15 07:10:02 version 1.10, 2011/02/23 10:11:44
Line 1 Line 1
   /**
    * @file        font.c
    * @brief       CGROM and font loader
    *
    * @author      $Author$
    * @date        $Date$
    */
   
 #include        "compiler.h"  #include        "compiler.h"
 #include        "strres.h"  #include        "strres.h"
 #include        "dosio.h"  #include        "dosio.h"
 #include        "memory.h"  #include        "cpucore.h"
 #include        "font.h"  #include        "font.h"
 #include        "fontdata.h"  #include        "fontdata.h"
 #include        "fontmake.h"  #include        "fontmake.h"
   
   
 #ifndef FONTMEMORYBIND  #ifndef FONTMEMORYBIND
         BYTE    __font[0x84000];          UINT8   __font[0x84000];
 #endif  #endif
   
 static const char fonttmpname[] = "font.tmp";  static const OEMCHAR fonttmpname[] = OEMTEXT("font.tmp");
   
   /**
    * Initializes CGROM
    */
   void font_initialize(void) {
   
           ZeroMemory(fontrom, sizeof(fontrom));
           font_setchargraph(FALSE);
   }
   
 void font_init(void) {  /**
    * Builds charactor graphics
    * @param[in] epson If this parameter is FALSE, patched NEC charactor
    */
   void font_setchargraph(BOOL epson) {
   
         BYTE    *p;          UINT8   *p;
         BYTE    *q;          UINT8   *q;
         UINT    i;          UINT    i;
         UINT    j;          UINT    j;
         UINT32  dbit;          UINT32  dbit;
   
         ZeroMemory(fontrom, sizeof(fontrom));  
         p = fontrom + 0x81000;          p = fontrom + 0x81000;
         q = fontrom + 0x82800;          q = fontrom + 0x82000;
         for (i=0; i<256; i++) {          for (i=0; i<256; i++) {
                   q += 8;
                 for (j=0; j<4; j++) {                  for (j=0; j<4; j++) {
                         dbit = 0;                          dbit = 0;
                         if (i & (0x01 << j)) {                          if (i & (0x01 << j)) {
Line 40  void font_init(void) { Line 59  void font_init(void) {
                         q += 2;                          q += 2;
                 }                  }
         }          }
   
           if (!epson) {
                   *(UINT16 *)(fontrom + 0x81000 + (0xf2 * 16)) = 0;
                   fontrom[0x82000 + (0xf2 * 8)] = 0;
           }
 }  }
   
 static BYTE fonttypecheck(const char *fname) {  /**
    * Retrieves the font type of the specified file.
    * @param[in] fname The name of the font file
    * @return font type
    */
   static UINT8 fonttypecheck(const OEMCHAR *fname) {
   
 const char      *p;  const OEMCHAR   *p;
   
         p = file_getext((char *)fname);          p = file_getext(fname);
         if (!file_cmpname(p, str_bmp)) {          if (!file_cmpname(p, str_bmp)) {
                 return(FONTTYPE_PC98);                  return(FONTTYPE_PC98);
         }          }
         p = file_getname((char *)fname);          p = file_getname(fname);
         if (!file_cmpname(p, v98fontname)) {          if (!file_cmpname(p, v98fontname)) {
                 return(FONTTYPE_V98);                  return(FONTTYPE_V98);
         }          }
Line 74  const char *p; Line 103  const char *p;
         return(FONTTYPE_NONE);          return(FONTTYPE_NONE);
 }  }
   
 BYTE font_load(const char *filename, BOOL force) {  /**
    * Loads font files
    * @param[in] filename The name of the font file
    * @param[in] force If this parameter is TRUE, load file always
    *                  If this parameter is FALSE, load when font is not ready
    * @return font type
    */
   UINT8 font_load(const OEMCHAR *filename, BOOL force) {
   
         UINT    i;          UINT    i;
         BYTE    *q;  const UINT8     *p;
 const BYTE      *p;          UINT8   *q;
         UINT    j;          UINT    j;
         char    fname[MAX_PATH];          OEMCHAR fname[MAX_PATH];
         BYTE    type;          UINT8   type;
         BYTE    loading;          UINT8   loading;
   
         if (filename) {          if (filename) {
                 file_cpyname(fname, filename, sizeof(fname));                  file_cpyname(fname, filename, NELEMENTS(fname));
         }          }
         else {          else {
                 fname[0] = '\0';                  fname[0] = '\0';
Line 103  const BYTE *p; Line 139  const BYTE *p;
                 ZeroMemory(q + 0xd80, 0x1000 - 0xd80);                  ZeroMemory(q + 0xd80, 0x1000 - 0xd80);
         }          }
   
         CopyMemory(fontrom + 0x82000, fontdata_8, 0x800);          fontdata_ank8store(fontdata_8, 0, 256);
         p = fontdata_8;          p = fontdata_8;
         q = fontrom + 0x80000;          q = fontrom + 0x80000;
         for (i=0; i<256; i++) {          for (i=0; i<256; i++) {
Line 145  const BYTE *p; Line 181  const BYTE *p;
         loading = fontv98_read(file_getcd(v98fontname), loading);          loading = fontv98_read(file_getcd(v98fontname), loading);
         loading = fontpc88_read(file_getcd(pc88ankname), loading);          loading = fontpc88_read(file_getcd(pc88ankname), loading);
         if (loading & FONTLOAD_16) {          if (loading & FONTLOAD_16) {
                 file_cpyname(fname, file_getcd(fonttmpname), sizeof(fname));                  file_cpyname(fname, file_getcd(fonttmpname), NELEMENTS(fname));
                 if (file_attr(fname) == -1) {                  if (file_attr(fname) == -1) {
                         makepc98bmp(fname);                          makepc98bmp(fname);
                 }                  }
Line 153  const BYTE *p; Line 189  const BYTE *p;
         }          }
         return(type);          return(type);
 }  }
   

Removed from v.1.4  
changed lines
  Added in v.1.10


RetroPC.NET-CVS <cvs@retropc.net>