Cleanups #2 for RetroFen

This commit is contained in:
twinaphex 2012-10-20 04:32:21 +02:00
parent e515b9ab96
commit f9c22658e9
26 changed files with 2 additions and 59597 deletions

View File

@ -91,11 +91,8 @@ MEDNAFEN_SOURCES := $(MEDNAFEN_DIR)/cdrom/cdromif.cpp \
$(MEDNAFEN_DIR)/memory.cpp \
$(MEDNAFEN_DIR)/mempatcher.cpp \
$(MEDNAFEN_DIR)/video/video.cpp \
$(MEDNAFEN_DIR)/video/text.cpp \
$(MEDNAFEN_DIR)/video/font-data.cpp \
$(MEDNAFEN_DIR)/video/Deinterlacer.cpp \
$(MEDNAFEN_DIR)/video/surface.cpp \
$(MEDNAFEN_DIR)/video/resize.cpp \
$(MEDNAFEN_DIR)/string/escape.cpp \
$(MEDNAFEN_DIR)/string/ConvertUTF.cpp \
$(MEDNAFEN_DIR)/sound/Blip_Buffer.cpp \

View File

@ -843,8 +843,6 @@ int MDFNI_Initialize(const char *basedir, const std::vector<MDFNSetting> &Driver
MDFNI_SetBaseDirectory(basedir);
MDFN_InitFontData();
// Generate dynamic settings
for(unsigned int i = 0; i < MDFNSystems.size(); i++)
{

View File

@ -1156,8 +1156,10 @@ pscpu_timestamp_t PS_GPU::Update(const pscpu_timestamp_t sys_timestamp)
char buffer[256];
trio_snprintf(buffer, sizeof(buffer), _("VIDEO STANDARD MISMATCH"));
#ifndef __LIBRETRO__
DrawTextTrans(surface->pixels + ((DisplayRect->h / 2) - (13 / 2)) * surface->pitch32, surface->pitch32 << 2, DisplayRect->w, (UTF8*)buffer,
surface->MakeColor(0x00, 0xFF, 0x00), true, MDFN_FONT_6x13_12x13);
#endif
}
else
{

View File

@ -28,7 +28,6 @@
#include "general.h"
#include "state.h"
#include "video.h"
#include "video/resize.h"
#define RLSB MDFNSTATE_RLSB //0x80000000

View File

@ -2,8 +2,6 @@
#define __MDFN_VIDEO_H
#include "video/surface.h"
#include "video/primitives.h"
#include "video/text.h"
#include <algorithm>

View File

@ -1,43 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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 "../mednafen.h"
//#include "font-data.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
typedef struct
{
uint16_t glyph_num;
uint8_t data[13 * 2];
} font12x13;
font12x13 FontData12x13[]=
{
#ifdef WANT_INTERNAL_CJK
#include "font12x13.h"
#else
#endif
};
const int FontData12x13_Size = sizeof(FontData12x13);

View File

@ -1,43 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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 "../mednafen.h"
//#include "font-data.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
typedef struct
{
uint16_t glyph_num;
uint8_t data[18 * 3];
} font18x18;
font18x18 FontData18x18[]=
{
#ifdef WANT_INTERNAL_CJK
#include "font18x18.h"
#else
#endif
};
const int FontData18x18_Size = sizeof(FontData18x18);

View File

@ -1,46 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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 "../mednafen.h"
#include "font-data.h"
const font4x5 FontData4x5[] =
{
#include "font4x5.h"
};
const font5x7 FontData5x7[] =
{
#include "font5x7.h"
};
const font6x13 FontData6x13[] =
{
#include "font6x13.h"
};
const font9x18 FontData9x18[]=
{
#include "font9x18.h"
};
const int FontData4x5_Size = sizeof(FontData4x5);
const int FontData5x7_Size = sizeof(FontData5x7);
const int FontData6x13_Size = sizeof(FontData6x13);
const int FontData9x18_Size = sizeof(FontData9x18);

View File

@ -1,63 +0,0 @@
// Note: The size of each these structs shouldn't exceed 256 bytes(current worst-case is about 56 bytes with the 18x18 font).
typedef struct
{
uint16 glyph_num;
uint8 data[5];
} font4x5;
typedef struct
{
uint16 glyph_num;
uint8 data[7];
} font5x7;
typedef struct
{
uint16 glyph_num;
uint8 data[13];
} font6x13;
typedef struct
{
uint16 glyph_num;
uint8 data[18 * 2];
} font9x18;
extern const font4x5 FontData4x5[];
extern const font5x7 FontData5x7[];
extern const font6x13 FontData6x13[];
extern const font9x18 FontData9x18[];
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint16_t glyph_num;
uint8_t data[13 * 2];
} font12x13;
typedef struct
{
uint16 glyph_num;
uint8 data[18 * 3];
} font18x18;
extern font12x13 FontData12x13[];
extern font18x18 FontData18x18[];
extern const int FontData12x13_Size;
extern const int FontData18x18_Size;
#ifdef __cplusplus
} /* extern "C" */
#endif
extern const int FontData4x5_Size;
extern const int FontData5x7_Size;
extern const int FontData6x13_Size;
extern const int FontData9x18_Size;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,195 +0,0 @@
{ 0x0020, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x0021, { 0x40, 0x40, 0x40, 0x00, 0x40, }},
{ 0x0022, { 0xA0, 0xA0, 0x00, 0x00, 0x00, }},
{ 0x0023, { 0xA0, 0xE0, 0xA0, 0xE0, 0xA0, }},
{ 0x0024, { 0x40, 0xC0, 0xA0, 0x60, 0x40, }},
{ 0x0025, { 0xA0, 0x20, 0x40, 0x80, 0xA0, }},
{ 0x0026, { 0x40, 0xA0, 0x40, 0xA0, 0x60, }},
{ 0x0027, { 0x40, 0x40, 0x00, 0x00, 0x00, }},
{ 0x0028, { 0x20, 0x40, 0x40, 0x40, 0x20, }},
{ 0x0029, { 0x80, 0x40, 0x40, 0x40, 0x80, }},
{ 0x002A, { 0x00, 0xA0, 0x40, 0xA0, 0x00, }},
{ 0x002B, { 0x00, 0x40, 0xE0, 0x40, 0x00, }},
{ 0x002C, { 0x00, 0x00, 0x00, 0x00, 0x40, }},
{ 0x002D, { 0x00, 0x00, 0xE0, 0x00, 0x00, }},
{ 0x002E, { 0x00, 0x00, 0x00, 0x00, 0x40, }},
{ 0x002F, { 0x20, 0x40, 0x40, 0x40, 0x80, }},
{ 0x0030, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x0031, { 0x40, 0xC0, 0x40, 0x40, 0xE0, }},
{ 0x0032, { 0xE0, 0x20, 0x40, 0x80, 0xE0, }},
{ 0x0033, { 0xE0, 0x20, 0x60, 0x20, 0xE0, }},
{ 0x0034, { 0xA0, 0xA0, 0xE0, 0x20, 0x20, }},
{ 0x0035, { 0xE0, 0x80, 0xE0, 0x20, 0xE0, }},
{ 0x0036, { 0xE0, 0x80, 0xE0, 0xA0, 0xE0, }},
{ 0x0037, { 0xE0, 0x20, 0x40, 0x40, 0x40, }},
{ 0x0038, { 0x40, 0xA0, 0x40, 0xA0, 0x40, }},
{ 0x0039, { 0x40, 0xA0, 0x60, 0x20, 0xC0, }},
{ 0x003A, { 0x00, 0x40, 0x00, 0x40, 0x00, }},
{ 0x003B, { 0x00, 0x40, 0x00, 0x00, 0x40, }},
{ 0x003C, { 0x20, 0x40, 0x80, 0x40, 0x20, }},
{ 0x003D, { 0x00, 0xE0, 0x00, 0xE0, 0x00, }},
{ 0x003E, { 0x80, 0x40, 0x20, 0x40, 0x80, }},
{ 0x003F, { 0xE0, 0x20, 0x40, 0x00, 0x40, }},
{ 0x0040, { 0xE0, 0xA0, 0xA0, 0x80, 0xE0, }},
{ 0x0041, { 0x40, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x0042, { 0xC0, 0xA0, 0xC0, 0xA0, 0xC0, }},
{ 0x0043, { 0x60, 0x80, 0x80, 0x80, 0x60, }},
{ 0x0044, { 0xC0, 0xA0, 0xA0, 0xA0, 0xC0, }},
{ 0x0045, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x0046, { 0xE0, 0x80, 0xC0, 0x80, 0x80, }},
{ 0x0047, { 0xE0, 0x80, 0xA0, 0xA0, 0xE0, }},
{ 0x0048, { 0xA0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x0049, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x004A, { 0x20, 0x20, 0x20, 0xA0, 0x40, }},
{ 0x004B, { 0xA0, 0xA0, 0xC0, 0xA0, 0xA0, }},
{ 0x004C, { 0x80, 0x80, 0x80, 0x80, 0xE0, }},
{ 0x004D, { 0xA0, 0xE0, 0xA0, 0xA0, 0xA0, }},
{ 0x004E, { 0x20, 0xA0, 0xE0, 0xA0, 0x80, }},
{ 0x004F, { 0x40, 0xA0, 0xA0, 0xA0, 0x40, }},
{ 0x0050, { 0xE0, 0xA0, 0xE0, 0x80, 0x80, }},
{ 0x0051, { 0xE0, 0xA0, 0xE0, 0xE0, 0x20, }},
{ 0x0052, { 0xC0, 0xA0, 0xC0, 0xA0, 0xA0, }},
{ 0x0053, { 0x60, 0x80, 0x40, 0x20, 0xC0, }},
{ 0x0054, { 0xE0, 0x40, 0x40, 0x40, 0x40, }},
{ 0x0055, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x0056, { 0xA0, 0xA0, 0xA0, 0x40, 0x40, }},
{ 0x0057, { 0xA0, 0xA0, 0xA0, 0xE0, 0xA0, }},
{ 0x0058, { 0xA0, 0xA0, 0x40, 0xA0, 0xA0, }},
{ 0x0059, { 0xA0, 0xA0, 0x40, 0x40, 0x40, }},
{ 0x005A, { 0xE0, 0x20, 0x40, 0x80, 0xE0, }},
{ 0x005B, { 0x60, 0x40, 0x40, 0x40, 0x60, }},
{ 0x005C, { 0x80, 0x40, 0x40, 0x40, 0x20, }},
{ 0x005D, { 0xC0, 0x40, 0x40, 0x40, 0xC0, }},
{ 0x005E, { 0x40, 0xA0, 0x00, 0x00, 0x00, }},
{ 0x005F, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x0060, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x0061, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x0062, { 0xE0, 0xA0, 0xC0, 0xA0, 0xE0, }},
{ 0x0063, { 0xE0, 0x80, 0x80, 0x80, 0xE0, }},
{ 0x0064, { 0xC0, 0xA0, 0xA0, 0xA0, 0xC0, }},
{ 0x0065, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x0066, { 0xE0, 0x80, 0xC0, 0x80, 0x80, }},
{ 0x0067, { 0xE0, 0x80, 0xA0, 0xA0, 0xE0, }},
{ 0x0068, { 0xA0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x0069, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x006A, { 0x20, 0x20, 0x20, 0xA0, 0xE0, }},
{ 0x006B, { 0xA0, 0xA0, 0xC0, 0xA0, 0xA0, }},
{ 0x006C, { 0x80, 0x80, 0x80, 0x80, 0xE0, }},
{ 0x006D, { 0xA0, 0xE0, 0xA0, 0xA0, 0xA0, }},
{ 0x006E, { 0x20, 0xA0, 0xE0, 0xA0, 0x80, }},
{ 0x006F, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x0070, { 0xE0, 0xA0, 0xE0, 0x80, 0x80, }},
{ 0x0071, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x0072, { 0xC0, 0xA0, 0xC0, 0xA0, 0xA0, }},
{ 0x0073, { 0xE0, 0x80, 0xE0, 0x20, 0xE0, }},
{ 0x0074, { 0xE0, 0x40, 0x40, 0x40, 0x40, }},
{ 0x0075, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x0076, { 0xA0, 0xA0, 0xA0, 0xA0, 0x40, }},
{ 0x0077, { 0xA0, 0xA0, 0xA0, 0xE0, 0xA0, }},
{ 0x0078, { 0xA0, 0xA0, 0x40, 0xA0, 0xA0, }},
{ 0x0079, { 0xA0, 0xA0, 0x40, 0x40, 0x40, }},
{ 0x007A, { 0xE0, 0x20, 0x40, 0x80, 0xE0, }},
{ 0x007B, { 0x60, 0x40, 0xC0, 0x40, 0x60, }},
{ 0x007C, { 0x40, 0x40, 0x40, 0x40, 0x40, }},
{ 0x007D, { 0xC0, 0x40, 0x60, 0x40, 0xC0, }},
{ 0x007E, { 0xC0, 0x60, 0x00, 0x00, 0x00, }},
{ 0x00A0, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x00A1, { 0x40, 0x00, 0x40, 0x40, 0x40, }},
{ 0x00A2, { 0x40, 0xE0, 0x80, 0xE0, 0x40, }},
{ 0x00A3, { 0x20, 0x40, 0xE0, 0x40, 0xE0, }},
{ 0x00A4, { 0xA0, 0xE0, 0xA0, 0xE0, 0xA0, }},
{ 0x00A5, { 0xA0, 0xA0, 0x40, 0xE0, 0x40, }},
{ 0x00A6, { 0x40, 0x40, 0x00, 0x40, 0x40, }},
{ 0x00A7, { 0xE0, 0xC0, 0xE0, 0x60, 0xE0, }},
{ 0x00A8, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x00A9, { 0x00, 0xE0, 0x80, 0xE0, 0x00, }},
{ 0x00AA, { 0x00, 0xC0, 0xE0, 0x00, 0x00, }},
{ 0x00AB, { 0x00, 0x20, 0x40, 0x20, 0x00, }},
{ 0x00AD, { 0x00, 0x00, 0xE0, 0x00, 0x00, }},
{ 0x00AE, { 0x00, 0xE0, 0xC0, 0xA0, 0x00, }},
{ 0x00AF, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x00B0, { 0x00, 0xC0, 0xC0, 0x00, 0x00, }},
{ 0x00B1, { 0x40, 0xE0, 0x40, 0x00, 0xE0, }},
{ 0x00B2, { 0xC0, 0xC0, 0x00, 0x00, 0x00, }},
{ 0x00B3, { 0xC0, 0xC0, 0x00, 0x00, 0x00, }},
{ 0x00B4, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x00B5, { 0x00, 0x00, 0xA0, 0xA0, 0xE0, }},
{ 0x00B6, { 0xE0, 0xA0, 0xE0, 0x20, 0x20, }},
{ 0x00B7, { 0x00, 0x00, 0x40, 0x00, 0x00, }},
{ 0x00B8, { 0x00, 0x00, 0x00, 0x00, 0x40, }},
{ 0x00B9, { 0x40, 0x40, 0x00, 0x00, 0x00, }},
{ 0x00BA, { 0x00, 0xC0, 0xC0, 0x00, 0x00, }},
{ 0x00BB, { 0x00, 0x80, 0x40, 0x80, 0x00, }},
{ 0x00BF, { 0x40, 0x00, 0x40, 0x80, 0xE0, }},
{ 0x00C0, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00C1, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00C2, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00C3, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00C4, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00C5, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00C7, { 0xE0, 0x80, 0x80, 0x80, 0xE0, }},
{ 0x00C8, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00C9, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00CA, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00CB, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00CC, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00CD, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00CE, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00CF, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00D1, { 0x20, 0xA0, 0xE0, 0xA0, 0x80, }},
{ 0x00D2, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00D3, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00D4, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00D5, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00D6, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00D7, { 0x00, 0xA0, 0x40, 0xA0, 0x00, }},
{ 0x00D9, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00DA, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00DB, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00DC, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00DD, { 0xA0, 0xA0, 0x40, 0x40, 0x40, }},
{ 0x00DF, { 0xE0, 0xA0, 0xC0, 0xA0, 0xE0, }},
{ 0x00E0, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00E1, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00E2, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00E3, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00E4, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00E5, { 0xE0, 0xA0, 0xE0, 0xA0, 0xA0, }},
{ 0x00E7, { 0xE0, 0x80, 0x80, 0x80, 0xE0, }},
{ 0x00E8, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00E9, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00EA, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00EB, { 0xE0, 0x80, 0xC0, 0x80, 0xE0, }},
{ 0x00EC, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00ED, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00EE, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00EF, { 0xE0, 0x40, 0x40, 0x40, 0xE0, }},
{ 0x00F1, { 0x20, 0xA0, 0xE0, 0xA0, 0x80, }},
{ 0x00F2, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00F3, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00F4, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00F5, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00F6, { 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00F7, { 0x40, 0x00, 0xE0, 0x00, 0x40, }},
{ 0x00F9, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00FA, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00FB, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00FC, { 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, }},
{ 0x00FD, { 0xA0, 0xA0, 0x40, 0x40, 0x40, }},
{ 0x00FF, { 0xA0, 0xA0, 0x40, 0x40, 0x40, }},
{ 0x0178, { 0xA0, 0xA0, 0x40, 0x40, 0x40, }},
{ 0x0192, { 0x60, 0x40, 0xE0, 0x40, 0xC0, }},
{ 0x02C6, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x02C9, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x02DA, { 0xC0, 0xC0, 0x00, 0x00, 0x00, }},
{ 0x02DC, { 0x00, 0x00, 0x00, 0x00, 0x00, }},
{ 0x037E, { 0x00, 0x40, 0x00, 0x00, 0x40, }},
{ 0x03BC, { 0x00, 0x00, 0xA0, 0xA0, 0xE0, }},
{ 0x2013, { 0x00, 0x00, 0xE0, 0x00, 0x00, }},
{ 0x2014, { 0x00, 0x00, 0xE0, 0x00, 0x00, }},
{ 0x201A, { 0x00, 0x00, 0x00, 0x00, 0x40, }},
{ 0x201E, { 0x00, 0x00, 0x00, 0xA0, 0xA0, }},
{ 0x2022, { 0x00, 0x60, 0x60, 0x00, 0x00, }},
{ 0x2026, { 0x00, 0x00, 0x00, 0x00, 0xA0, }},
{ 0x2122, { 0xC0, 0xC0, 0x00, 0x00, 0x00, }},
{ 0x22C5, { 0x00, 0x00, 0x40, 0x00, 0x00, }},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,189 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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 "video-common.h"
#include <zlib.h>
#include "png.h"
#include "../mednafen-endian.h"
void PNGWrite::WriteChunk(FileWrapper &pngfile, uint32 size, const char *type, const uint8 *data)
{
uint32 crc;
uint8 tempo[4];
MDFN_en32msb(tempo, size);
pngfile.write(tempo, 4);
pngfile.write(type, 4);
if(size)
pngfile.write(data, size);
crc = crc32(0, (uint8 *)type, 4);
if(size)
crc = crc32(crc,data,size);
MDFN_en32msb(tempo, crc);
pngfile.write(tempo, 4);
}
// int MDFN_SavePNGSnapshot(const char *fname, const MDFN_Surface *src, const MDFN_Rect *rect, const MDFN_Rect *LineWidths)
PNGWrite::~PNGWrite()
{
}
PNGWrite::PNGWrite(const char *path, const MDFN_Surface *src, const MDFN_Rect &rect, const MDFN_Rect *LineWidths) : ownfile(path, FileWrapper::MODE_WRITE_SAFE)
{
WriteIt(ownfile, src, rect, LineWidths);
}
#if 0
PNGWrite::PNGWrite(FileWrapper &pngfile, const MDFN_Surface *src, const MDFN_Rect &rect, const MDFN_Rect *LineWidths)
{
WriteIt(pngfile, src, rect, LineWidths);
}
#endif
void PNGWrite::WriteIt(FileWrapper &pngfile, const MDFN_Surface *src, const MDFN_Rect &rect, const MDFN_Rect *LineWidths)
{
uLongf compmemsize;
int png_width;
if(LineWidths[0].w != ~0)
{
png_width = 0;
for(int y = 0; y < rect.h; y++)
{
if(LineWidths[rect.y + y].w > png_width)
png_width = LineWidths[rect.y + y].w;
}
}
else
png_width = rect.w;
if(!rect.h)
throw(MDFN_Error(0, "Refusing to save a zero-height PNG."));
if(!png_width)
throw(MDFN_Error(0, "Refusing to save a zero-width PNG."));
compmemsize = (uLongf)( (rect.h * (png_width + 1) * 3 * 1.001 + 1) + 12 );
compmem.resize(compmemsize);
{
static uint8 header[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
pngfile.write(header, 8);
}
{
uint8 chunko[13];
MDFN_en32msb(&chunko[0], png_width); // Width
MDFN_en32msb(&chunko[4], rect.h); // Height
chunko[8]=8; // 8 bits per sample(24 bits per pixel)
chunko[9]=2; // Color type; RGB triplet
chunko[10]=0; // compression: deflate
chunko[11]=0; // Basic adapative filter set(though none are used).
chunko[12]=0; // No interlace.
WriteChunk(pngfile, 13, "IHDR", chunko);
}
// pHYs chunk
#if 0
{
uint8 chunko[9];
uint32 ppx, ppy;
//ppx = png_width / MDFNGameInfo->nominal_width;
//ppy = 1; //rect->h / rect->h
ppx = png_width;
ppy = MDFNGameInfo->nominal_width;
MDFN_en32msb(&chunko[0], ppx);
MDFN_en32msb(&chunko[4], ppy);
//printf("%08x %08x, %04x %04x\n", ppx, ppy, *(uint32 *)&chunko[0], *(uint32 *)&chunko[4]);
chunko[8] = 0;
WriteChunk(pngfile, 9, "pHYs", chunko);
}
#endif
{
uint8 *tmp_inc;
tmp_buffer.resize((png_width * 3 + 1) * rect.h);
tmp_inc = &tmp_buffer[0];
for(int y = 0; y < rect.h; y++)
{
*tmp_inc = 0;
tmp_inc++;
int line_width = rect.w;
int x_base = rect.x;
if(LineWidths[0].w != ~0)
{
line_width = LineWidths[y + rect.y].w;
x_base = LineWidths[y + rect.y].x;
}
for(int x = 0; x < line_width; x++)
{
int r, g, b;
if(src->format.bpp == 16)
src->DecodeColor(src->pixels16[(y + rect.y) * src->pitchinpix + (x + x_base)], r, g, b);
else
src->DecodeColor(src->pixels[(y + rect.y) * src->pitchinpix + (x + x_base)], r, g, b);
tmp_inc[0] = r;
tmp_inc[1] = g;
tmp_inc[2] = b;
tmp_inc += 3;
}
for(int x = line_width; x < png_width; x++)
{
tmp_inc[0] = tmp_inc[1] = tmp_inc[2] = 0;
tmp_inc += 3;
}
}
if(compress(&compmem[0], &compmemsize, &tmp_buffer[0], rect.h * (png_width * 3 + 1)) != Z_OK)
{
throw(MDFN_Error(0, "zlib error")); // TODO: verbosify
}
WriteChunk(pngfile, compmemsize, "IDAT", &compmem[0]);
}
WriteChunk(pngfile, 0, "IEND", 0);
}

View File

@ -1,31 +0,0 @@
#ifndef __MDFN_PNG_H
#define __MDFN_PNG_H
#include "../video.h"
#include "../FileWrapper.h"
class PNGWrite
{
public:
PNGWrite(const char *path, const MDFN_Surface *src, const MDFN_Rect &rect, const MDFN_Rect *LineWidths);
#if 0
PNGWrite(FileWrapper &pngfile, const MDFN_Surface *src, const MDFN_Rect &rect, const MDFN_Rect *LineWidths);
#endif
~PNGWrite();
static void WriteChunk(FileWrapper &pngfile, uint32 size, const char *type, const uint8 *data);
private:
void WriteIt(FileWrapper &pngfile, const MDFN_Surface *src, const MDFN_Rect &rect, const MDFN_Rect *LineWidths);
FileWrapper ownfile;
std::vector<uint8> compmem;
std::vector<uint8> tmp_buffer;
};
#endif

View File

@ -1,79 +0,0 @@
#include "video-common.h"
void MDFN_DrawRectangle(uint32 *XBuf, int pitch, int xpos, int ypos, uint32 color, uint32 width, uint32 height)
{
uint32 x;
uint32 y;
XBuf += pitch * ypos + xpos;
/* Draw top and bottom horiz */
for(x=0;x<width;x++)
{
XBuf[x] = color;
XBuf[x + (height-1) * pitch] = color;
}
for(y=0;y<height;y++)
{
XBuf[y * pitch] = color;
XBuf[y * pitch + width-1] = color;
}
}
void MDFN_DrawRectangleAlpha(uint32 *XBuf, int pitch, int xpos, int ypos, uint32 color, uint32 alpha_color, uint32 width, uint32 height)
{
uint32 x;
uint32 y;
XBuf += pitch * ypos + xpos;
/* Draw top and bottom horiz */
for(x=0;x<width;x++)
{
XBuf[x] = color;
XBuf[x + (height-1) * pitch] = color;
}
for(y=0;y<height;y++)
{
XBuf[y * pitch] = color;
XBuf[y * pitch + width-1] = color;
}
/* Now draw inner transparency area. */
XBuf += 1 + 1 * pitch;
for(y=0;y<height-2;y++)
for(x=0;x<width-2;x++)
{
XBuf[y*pitch+x] = alpha_color; //MK_COLORA(0x00, 0x00, 0x00, 0x80);
}
}
void MDFN_DrawRectangleFill(uint32 *XBuf, int pitch, int xpos, int ypos, uint32 color, uint32 fillcolor, uint8 width, uint8 height)
{
int x;
int y;
XBuf += pitch * ypos + xpos;
/* Draw top and bottom horiz */
for(x=0;x<width;x++)
{
XBuf[x] = color;
XBuf[x + (height-1) * pitch] = color;
}
for(y=0;y<height;y++)
{
XBuf[y * pitch] = color;
XBuf[y * pitch + width-1] = color;
}
/* Now draw innerarea. */
XBuf += 1 + 1 * pitch;
for(y=0;y<height-2;y++)
for(x=0;x<width-2;x++)
{
XBuf[y*pitch+x] = fillcolor;
}
}

View File

@ -1,8 +0,0 @@
#ifndef __MDFN_VIDEO_PRIMITIVES_H
#define __MDFN_VIDEO_PRIMITIVES_H
void MDFN_DrawRectangle(uint32 *XBuf, int pitch, int xpos, int ypos, uint32 color, uint32 width, uint32 height);
void MDFN_DrawRectangleAlpha(uint32 *XBuf, int pitch, int xpos, int ypos, uint32 color, uint32 alpha_color, uint32 width, uint32 height);
void MDFN_DrawRectangleFill(uint32 *XBuf, int pitch, int xpos, int ypos, uint32 color, uint32 fillcolor, uint8 width, uint8 height);
#endif

View File

@ -1,156 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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
*/
// I don't think this code works entirely correctly for reducing image size.
// Also, it won't interpolate quite correctly when resizing vertically and there are multiple horizontal resolutions(represented
// by LineWidths).
#include "video-common.h"
#include <math.h>
#define INT(x) ((int)(x))
#define FRACT(x) ((x) - floor(x))
#define READ_PIXEL(src_x, src_y, components) \
{ \
double source_components[2][2][4]; \
\
for(unsigned int xc = 0; xc < 2; xc++) \
{ \
for(unsigned int yc = 0; yc < 2; yc++) \
{ \
uint32 tmp; \
uint32 eff_x = (int)(src_x) + xc, eff_y = (int)(src_y) + yc; \
if(eff_x >= x_ip_limit) eff_x = x_ip_limit - 1; \
if(eff_y >= y_ip_limit) eff_y = y_ip_limit - 1; \
tmp = pixels[eff_x + eff_y * src->pitch32]; \
source_components[xc][yc][0] = (tmp >> 0) & 0xFF; \
source_components[xc][yc][1] = (tmp >> 8) & 0xFF; \
source_components[xc][yc][2] = (tmp >> 16) & 0xFF; \
source_components[xc][yc][3] = (tmp >> 24) & 0xFF; \
} \
} \
\
for(unsigned int i = 0; i < 4; i++) \
{ \
components[i] += (1.0 - FRACT(src_y)) * (source_components[0][0][i] * (1.0 - FRACT(src_x)) + (source_components[1][0][i] * FRACT(src_x))); \
components[i] += FRACT(src_y) * (source_components[0][1][i] * (1.0 - FRACT(src_x)) + (source_components[1][1][i] * FRACT(src_x))); \
} \
}
bool MDFN_ResizeSurface(const MDFN_Surface *src, const MDFN_Rect *src_rect, const MDFN_Rect *LineWidths, MDFN_Surface *dest, const MDFN_Rect *dest_rect)
{
double src_x_inc, src_y_inc;
double src_x, src_y;
uint32 *pixels = src->pixels;
uint32 x_ip_limit, y_ip_limit;
//printf("%ld, %d %d, %d %d\n", (long)pixels, src_rect->w, dest_rect->w, src_rect->h, dest_rect->h);
src_x_inc = (double)src_rect->w / dest_rect->w;
src_y_inc = (double)src_rect->h / dest_rect->h;
x_ip_limit = src_rect->x + src_rect->w;
y_ip_limit = src_rect->y + src_rect->h;
src_y = src_rect->y;
for(int32 y = 0; y < dest_rect->h; y++)
{
uint32 *dest_pix = dest->pixels + dest_rect->x + (dest_rect->y + y) * dest->pitch32;
bool ZeroDimensionSource = false;
if(src_rect->h == 0)
{
ZeroDimensionSource = true;
}
else
{
if(LineWidths)
{
src_x = LineWidths[INT(src_y)].x;
src_x_inc = (double)LineWidths[INT(src_y)].w / dest_rect->w;
x_ip_limit = LineWidths[INT(src_y)].x + LineWidths[INT(src_y)].w;
if(LineWidths[INT(src_y)].w == 0)
ZeroDimensionSource = true;
}
else
{
src_x = src_rect->x;
if(src_rect->w == 0)
ZeroDimensionSource = true;
}
}
if(ZeroDimensionSource)
{
puts("All Hail Lelouch!");
for(int32 x = 0; x < dest_rect->w; x++)
dest_pix[x] = 0;
}
else for(int32 x = 0; x < dest_rect->w; x++)
{
double components[4] = {0, 0, 0, 0};
double div_fib = 1;
//printf("%d %d, %d %d\n", (int)src_x, (int)src_y, x_ip_limit, y_ip_limit);
READ_PIXEL(src_x, src_y, components);
if(INT(src_x_inc) > 1)
{
for(double subx = 1; subx < (INT(src_x_inc) - 1); subx++)
{
READ_PIXEL(INT(src_x) + subx, INT(src_y), components);
div_fib++;
}
READ_PIXEL(src_x + src_x_inc - 1, src_y, components);
div_fib++;
}
if(INT(src_y_inc) > 1)
{
for(double suby = 1; suby < (INT(src_y_inc) - 1); suby++)
{
READ_PIXEL(INT(src_x), INT(src_y) + suby, components);
div_fib++;
}
READ_PIXEL(src_x, src_y + src_y_inc - 1, components);
div_fib++;
}
for(unsigned int i = 0; i < 4; i++)
{
components[i] /= div_fib;
if(components[i] < 0) components[i] = 0;
if(components[i] > 255) components[i] = 255;
}
dest_pix[x] = ((int)components[0] << 0) | ((int)components[1] << 8) | ((int)components[2] << 16) | ((int)components[3] << 24);
src_x += src_x_inc;
}
src_y += src_y_inc;
}
return(TRUE);
}

View File

@ -1,2 +0,0 @@
bool MDFN_ResizeSurface(const MDFN_Surface *src, const MDFN_Rect *src_rect, const MDFN_Rect *LineWidths, MDFN_Surface *dest, const MDFN_Rect *dest_rect);

View File

@ -1,121 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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 "../mednafen.h"
#include "selblur.h"
#include <math.h>
#if 0
static INLINE void GetSourcePixel(const SelBlurImage *spec, int32 x, int32 y, unsigned int &r, unsigned int &g, unsigned int &b)
{
uint32 pixel = spec->source[x + y * spec->source_pitch32];
r = (pixel >> spec->red_shift) & 0xFF;
g = (pixel >> spec->green_shift) & 0xFF;
b = (pixel >> spec->blue_shift) & 0xFF;
}
static INLINE void SetDestPixel(const SelBlurImage *spec, int32 x, int32 y, const unsigned int r, const unsigned int g, const unsigned int b)
{
spec->dest[x + y * spec->dest_pitch32] = (r << spec->red_shift) | (g << spec->green_shift) | (b << spec->blue_shift);
}
#endif
#define GetSourcePixel(_x, _y, _r, _g, _b) { uint32 mypixel = source[_x + _y * source_pitch32]; _r = (mypixel >> red_shift) & 0xFF; \
_g = (mypixel >> green_shift) & 0xFF; _b = (mypixel >> blue_shift) & 0xFF; }
#define SetDestPixel(_x, _y, _r, _g, _b) dest[_x + _y * dest_pitch32] = (_r << red_shift) | (_g << green_shift) | (_b << blue_shift);
void MDFN_SelBlur(SelBlurImage *spec)
{
unsigned int red_shift = spec->red_shift;
unsigned int green_shift = spec->green_shift;
unsigned int blue_shift = spec->blue_shift;
uint32 *dest = spec->dest;
uint32 *source = spec->source;
uint32 source_pitch32 = spec->source_pitch32;
uint32 dest_pitch32 = spec->dest_pitch32;
uint8 r_thresh[512];
uint8 g_thresh[512];
uint8 b_thresh[512];
for(int i = 0; i < 512; i++)
{
if((unsigned int)abs(i - 256) <= spec->red_threshold)
r_thresh[i] = 0;
else r_thresh[i] = 8;
if((unsigned int)abs(i - 256) <= spec->green_threshold)
g_thresh[i] = 0;
else g_thresh[i] = 8;
if((unsigned int)abs(i - 256) <= spec->blue_threshold)
b_thresh[i] = 0;
else b_thresh[i] = 8;
}
for(int32 y = 0; y < spec->height; y++)
{
int32 y_min, y_max;
y_min = y - spec->radius;
if(y_min < 0) y_min = 0;
y_max = y + spec->radius;
if(y_max >= spec->height) y_max = spec->height - 1;
for(int32 x = 0; x < spec->width; x++)
{
unsigned int red, green, blue;
unsigned int red_blur, green_blur, blue_blur;
unsigned int blurdiv = 0;
GetSourcePixel(x, y, red, green, blue);
red_blur = green_blur = blue_blur = 0;
for(int32 y_sub = y_min; y_sub <= y_max; y_sub++)
{
int32 x_magic, x_min, x_max;
x_magic = spec->radius - abs(y - y_sub);
x_min = x - x_magic;
x_max = x + x_magic;
if(x_max >= spec->width) x_max = spec->width - 1;
if(x_min < 0) x_min = 0;
for(int32 x_sub = x_min; x_sub <= x_max; x_sub++)
{
unsigned int red_other, green_other, blue_other;
unsigned int smashing;
GetSourcePixel(x_sub, y_sub, red_other, green_other, blue_other);
smashing = r_thresh[256 + red_other - red] | g_thresh[256 + green_other - green] | b_thresh[256 + blue_other - blue];
red_blur += red_other >> smashing;
green_blur += green_other >> smashing;
blue_blur += blue_other >> smashing;
blurdiv += 1 >> smashing;
}
}
SetDestPixel(x, y, red_blur / blurdiv , green_blur / blurdiv, blue_blur / blurdiv);
}
}
}

View File

@ -1,29 +0,0 @@
#ifndef __MDFN_SELBLUR_H
#define __MDFN_SELBLUR_H
#include "../video.h"
typedef struct
{
unsigned int red_threshold; // 0 - 255
unsigned int green_threshold;
unsigned int blue_threshold;
int32 radius;
uint32 *source;
uint32 source_pitch32;
uint32 *dest;
uint32 dest_pitch32;
int32 width;
int32 height;
uint32 red_shift;
uint32 green_shift;
uint32 blue_shift;
} SelBlurImage;
void MDFN_SelBlur(SelBlurImage *spec);
#endif

View File

@ -1,327 +0,0 @@
/* Mednafen - Multi-system Emulator
*
* 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 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 "video-common.h"
#include "../string/ConvertUTF.h"
#include "font-data.h"
typedef struct
{
uint8 glyph_width;
uint8 glyph_height;
int8 extension;
uint8 entry_bsize;
const uint8 *base_ptr;
} FontDescriptor_t;
static FontDescriptor_t FontDescriptors[_MDFN_FONT_COUNT] =
{
#ifdef WANT_INTERNAL_CJK
{ 9, 18, MDFN_FONT_18x18, sizeof(FontData9x18[0]), &FontData9x18[0].data[0] },
{ 5, 7, -1, sizeof(FontData5x7[0]), &FontData5x7[0].data[0] },
{ 4, 5, -1, sizeof(FontData4x5[0]), &FontData4x5[0].data[0] },
{ 6, 13, MDFN_FONT_12x13, sizeof(FontData6x13[0]), &FontData6x13[0].data[0] },
{ 12, 13, -1, sizeof(FontData12x13[0]), &FontData12x13[0].data[0] },
{ 18, 18, -1, sizeof(FontData18x18[0]), &FontData18x18[0].data[0] },
#else
{ 9, 18, -1, sizeof(FontData9x18[0]), &FontData9x18[0].data[0] },
{ 5, 7, -1, sizeof(FontData5x7[0]), &FontData5x7[0].data[0] },
{ 4, 5, -1, sizeof(FontData4x5[0]), &FontData4x5[0].data[0] },
{ 6, 13, -1, sizeof(FontData6x13[0]), &FontData6x13[0].data[0] },
#endif
};
static uint16 FontDataIndexCache[_MDFN_FONT_COUNT][65536];
void MDFN_InitFontData(void)
{
unsigned int x;
unsigned int inx;
memset(FontDataIndexCache, 0xFF, sizeof(FontDataIndexCache));
for(inx=x=0;x<65536;x++)
{
if(inx < (FontData4x5_Size / sizeof(font4x5)) && FontData4x5[inx].glyph_num == x)
{
FontDataIndexCache[MDFN_FONT_4x5][x] = inx;
inx++;
}
}
for(inx=x=0;x<65536;x++)
{
if(inx < (FontData5x7_Size / sizeof(font5x7)) && FontData5x7[inx].glyph_num == x)
{
FontDataIndexCache[MDFN_FONT_5x7][x] = inx;
inx++;
}
}
for(inx=x=0;x<65536;x++)
{
if(inx < (FontData6x13_Size / sizeof(font6x13)) && FontData6x13[inx].glyph_num == x)
{
FontDataIndexCache[MDFN_FONT_6x13_12x13][x] = inx;
inx++;
}
}
for(inx=x=0;x<65536;x++)
{
if(inx < (FontData9x18_Size / sizeof(font9x18)) && FontData9x18[inx].glyph_num == x)
{
FontDataIndexCache[MDFN_FONT_9x18_18x18][x] = inx;
inx++;
}
}
#ifdef WANT_INTERNAL_CJK
for(inx=x=0;x<65536;x++)
{
if(inx < (FontData12x13_Size / sizeof(font12x13)) && FontData12x13[inx].glyph_num == x)
{
FontDataIndexCache[MDFN_FONT_12x13][x] = inx;
inx++;
}
}
for(inx=x=0;x<65536;x++)
{
if(inx < (FontData18x18_Size / sizeof(font18x18)) && FontData18x18[inx].glyph_num == x)
{
FontDataIndexCache[MDFN_FONT_18x18][x] = inx;
inx++;
}
}
#endif
}
size_t utf32_strlen(UTF32 *s)
{
size_t ret = 0;
while(*s++) ret++;
return(ret);
}
static void DrawTextSub(const UTF32 *utf32_buf, uint32 &slen, const uint8 **glyph_ptrs, uint8 *glyph_width, uint8 *glyph_ov_width, uint32 &pixwidth, uint32 which_font)
{
pixwidth = 0;
for(uint32 x = 0; x < slen; x++)
{
uint32 thisglyph = utf32_buf[x] & 0xFFFF;
bool GlyphFound = FALSE;
uint32 recurse_which_font = which_font;
while(!GlyphFound)
{
if(FontDataIndexCache[recurse_which_font][thisglyph] != 0xFFFF)
{
glyph_ptrs[x] = FontDescriptors[recurse_which_font].base_ptr + (FontDescriptors[recurse_which_font].entry_bsize * FontDataIndexCache[recurse_which_font][thisglyph]);
glyph_width[x] = FontDescriptors[recurse_which_font].glyph_width;
GlyphFound = TRUE;
}
else if(FontDescriptors[recurse_which_font].extension != -1)
recurse_which_font = FontDescriptors[recurse_which_font].extension;
else
break;
}
if(!GlyphFound)
{
glyph_ptrs[x] = FontDescriptors[which_font].base_ptr + (FontDescriptors[which_font].entry_bsize * FontDataIndexCache[which_font][(unsigned char)'?']);
glyph_width[x] = FontDescriptors[which_font].glyph_width;
}
if((thisglyph >= 0x0300 && thisglyph <= 0x036F) || (thisglyph >= 0xFE20 && thisglyph <= 0xFE2F))
glyph_ov_width[x] = 0;
else
glyph_ov_width[x] = glyph_width[x];
pixwidth += (((x + 1) == slen) ? glyph_width[x] : glyph_ov_width[x]);
}
}
uint32 GetTextPixLength(const UTF8 *msg, uint32 which_font)
{
uint32 slen;
uint32 pixwidth;
uint32 max_glyph_len = strlen((char *)msg);
const uint8 *glyph_ptrs[max_glyph_len];
uint8 glyph_width[max_glyph_len];
uint8 glyph_ov_width[max_glyph_len];
const UTF8 *src_begin = (UTF8 *)msg;
UTF32 utf32_buf[max_glyph_len];
UTF32 *tstart = utf32_buf;
ConvertUTF8toUTF32(&src_begin, (UTF8*)msg + max_glyph_len, &tstart, &tstart[max_glyph_len], lenientConversion);
slen = (tstart - utf32_buf);
DrawTextSub(utf32_buf, slen, glyph_ptrs, glyph_width, glyph_ov_width, pixwidth, which_font);
return(pixwidth);
}
uint32 GetTextPixLength(const UTF32 *msg, uint32 which_font)
{
uint32 slen;
uint32 pixwidth;
uint32 max_glyph_len = utf32_strlen((UTF32 *)msg);
const uint8 *glyph_ptrs[max_glyph_len];
uint8 glyph_width[max_glyph_len];
uint8 glyph_ov_width[max_glyph_len];
slen = utf32_strlen((UTF32 *)msg);
DrawTextSub((UTF32*)msg, slen, glyph_ptrs, glyph_width, glyph_ov_width, pixwidth, which_font);
return(pixwidth);
}
static uint32 DoRealDraw(uint32 *dest, uint32 pitch, uint32 width_limit, uint32 fgcolor, int centered, uint32 slen, uint32 pixwidth,
uint32 glyph_height, const uint8 *glyph_ptrs[], const uint8 glyph_width[], const uint8 glyph_ov_width[], const uint32 ex_offset = 0)
{
pitch /= sizeof(uint32);
if(centered)
{
int32 poot = width_limit - pixwidth;
if(poot < 0)
poot = 0;
dest += poot / 2;
}
#if 0
// TODO to prevent writing past width
// Shadow support kludge
//
if(width_limit < ex_offset)
return(0);
dest += ex_offset + pitch;
width_limit -= ex_offset;
//
//
#endif
pixwidth = 0;
for(uint32 n = 0; n < slen; n++)
{
const uint8 *src_glyph = glyph_ptrs[n];
uint32 gy_mul = (glyph_width[n] >> 3) + 1;
uint32 gw = glyph_width[n];
if((pixwidth + gw) > width_limit)
{
if(pixwidth > width_limit) // Prooooobably shouldn't happen, but just in case.
gw = 0;
else
gw = width_limit - pixwidth;
}
if((pixwidth + glyph_ov_width[n]) > width_limit)
slen = n + 1; // Break out
for(uint32 gy = 0; gy < glyph_height; gy++)
{
for(uint32 gx = 0; gx < gw; gx++)
{
if((src_glyph[gy * gy_mul + (gx >> 3)] << (gx & 0x7)) & 0x80)
dest[gy * pitch + gx] = fgcolor;
}
}
dest += glyph_ov_width[n];
pixwidth += ((n + 1) == slen) ? gw : glyph_ov_width[n];
}
if(pixwidth > width_limit)
pixwidth = width_limit;
return(pixwidth);
}
// FIXME/TODO: maximum text pixel width should be signed, not unsigned.
uint32 DrawTextTrans(uint32 *dest, int pitch, uint32 width, const UTF8 *msg, uint32 fgcolor, int centered, uint32 which_font)
{
uint32 slen;
uint32 pixwidth;
uint32 max_glyph_len = strlen((char *)msg);
const uint8 *glyph_ptrs[max_glyph_len];
uint8 glyph_width[max_glyph_len];
uint8 glyph_ov_width[max_glyph_len];
const UTF8 *src_begin = (UTF8 *)msg;
UTF32 utf32_buf[max_glyph_len];
UTF32 *tstart = utf32_buf;
ConvertUTF8toUTF32(&src_begin, (UTF8*)msg + max_glyph_len, &tstart, &tstart[max_glyph_len], lenientConversion);
slen = (tstart - utf32_buf);
DrawTextSub(utf32_buf, slen, glyph_ptrs, glyph_width, glyph_ov_width, pixwidth, which_font);
return(DoRealDraw(dest, pitch, width, fgcolor, centered, slen, pixwidth, FontDescriptors[which_font].glyph_height, glyph_ptrs, glyph_width, glyph_ov_width));
}
uint32 DrawTextTrans(uint32 *dest, int pitch, uint32 width, const UTF32 *msg, uint32 fgcolor, int centered, uint32 which_font)
{
uint32 slen;
uint32 pixwidth;
uint32 max_glyph_len = utf32_strlen((UTF32 *)msg);
const uint8 *glyph_ptrs[max_glyph_len];
uint8 glyph_width[max_glyph_len];
uint8 glyph_ov_width[max_glyph_len];
slen = utf32_strlen((UTF32 *)msg);
DrawTextSub((UTF32*)msg, slen, glyph_ptrs, glyph_width, glyph_ov_width, pixwidth, which_font);
return(DoRealDraw(dest, pitch, width, fgcolor, centered, slen, pixwidth, FontDescriptors[which_font].glyph_height, glyph_ptrs, glyph_width, glyph_ov_width));
}
uint32 DrawTextTransShadow(uint32 *dest, int pitch, uint32 width, const UTF8 *textmsg, uint32 fgcolor, uint32 shadcolor, int centered, uint32 which_font)
{
DrawTextTrans(dest + 1 + (pitch >> 2), pitch, width, textmsg, shadcolor, centered, which_font);
return(DrawTextTrans(dest, pitch, width, textmsg, fgcolor, centered, which_font));
}
uint32 DrawTextTransShadow(uint32 *dest, int pitch, uint32 width, const std::string &textmsg, uint32 fgcolor, uint32 shadcolor, int centered, uint32 which_font)
{
const char *tmp = textmsg.c_str();
DrawTextTrans(dest + 1 + (pitch >> 2), pitch, width, (const UTF8 *)tmp, shadcolor, centered, which_font);
return(DrawTextTrans(dest, pitch, width, (const UTF8 *)tmp, fgcolor, centered, which_font));
}
#if 0
uint32 DrawText(MDFN_Surface *surface, const MDFN_Rect &rect, const char *textmsg, uint32 color,
bool centered, uint32 which_font)
{
MDFN_Rect tr = rect;
if(tr.w < 0 || tr.h < 0)
return;
if((tr.x + tr.w) > surface->w)
tr.w = surface->w - tr.x;
if((tr.y + tr.h) > surface->h)
tr.h = surface->h - tr.y;
}
#endif

View File

@ -1,31 +0,0 @@
#ifndef __MDFN_VIDEO_TEXT_H
#define __MDFN_VIDEO_TEXT_H
enum
{
// If the order of these constants is changed, you must also update the array of FontDescriptor
// in text.cpp.
MDFN_FONT_9x18_18x18 = 0,
MDFN_FONT_5x7,
MDFN_FONT_4x5,
MDFN_FONT_6x13_12x13,
#ifdef WANT_INTERNAL_CJK
MDFN_FONT_12x13,
MDFN_FONT_18x18,
#endif
_MDFN_FONT_COUNT
};
uint32 GetTextPixLength(const UTF8 *msg, uint32 which_font = MDFN_FONT_9x18_18x18);
uint32 GetTextPixLength(const UTF32 *msg, uint32 which_font = MDFN_FONT_9x18_18x18);
uint32 DrawTextTrans(uint32 *dest, int pitch, uint32 width, const UTF8 *textmsg, uint32 fgcolor, int centered, uint32 which_font = MDFN_FONT_9x18_18x18);
uint32 DrawTextTrans(uint32 *dest, int pitch, uint32 width, const UTF32 *textmsg, uint32 fgcolor, int centered, uint32 which_font = MDFN_FONT_9x18_18x18);
uint32 DrawTextTransShadow(uint32 *dest, int pitch, uint32 width, const UTF8 *textmsg, uint32 fgcolor, uint32 shadcolor,int centered, uint32 which_font = MDFN_FONT_9x18_18x18);
uint32 DrawTextTransShadow(uint32 *dest, int pitch, uint32 width, const std::string &textmsg, uint32 fgcolor, uint32 shadcolor,int centered, uint32 which_font = MDFN_FONT_9x18_18x18);
#endif

View File

@ -25,8 +25,6 @@
#include <trio/trio.h>
#include "png.h"
void MDFN_DispMessage(const char *format, ...) throw()
{
va_list ap;