This commit is contained in:
yui 2004-08-18 15:42:33 +00:00
parent 0b81e127aa
commit 013487b872
17 changed files with 127 additions and 179 deletions

View File

@ -28,15 +28,15 @@ enum {
#endif
#ifndef STOREINTELDWORD
#define STOREINTELDWORD(a, b) *((a)+0) = (BYTE)((b)); \
*((a)+1) = (BYTE)((b)>>8); \
*((a)+2) = (BYTE)((b)>>16); \
*((a)+3) = (BYTE)((b)>>24)
#define STOREINTELDWORD(a, b) *((a)+0) = (UINT8)((b)); \
*((a)+1) = (UINT8)((b)>>8); \
*((a)+2) = (UINT8)((b)>>16); \
*((a)+3) = (UINT8)((b)>>24)
#endif
#ifndef STOREINTELWORD
#define STOREINTELWORD(a, b) *((a)+0) = (BYTE)((b)); \
*((a)+1) = (BYTE)((b)>>8)
#define STOREINTELWORD(a, b) *((a)+0) = (UINT8)((b)); \
*((a)+1) = (UINT8)((b)>>8)
#endif
#ifndef NELEMENTS

View File

@ -85,7 +85,7 @@ bdsi_exit:
return(ret);
}
BOOL bmpdata_getinfo(const BMPINFO *bi, BMPDATA *inf) {
BRESULT bmpdata_getinfo(const BMPINFO *bi, BMPDATA *inf) {
UINT tmp;
int width;
@ -121,12 +121,12 @@ bdgi_err:
return(FAILURE);
}
BYTE *bmpdata_lzx(int level, int dstsize, const BYTE *dat) {
UINT8 *bmpdata_lzx(int level, int dstsize, const UINT8 *dat) {
BYTE *ret;
BYTE *ptr;
BYTE ctrl;
BYTE bit;
UINT8 *ret;
UINT8 *ptr;
UINT8 ctrl;
UINT8 bit;
UINT mask;
UINT tmp;
int pos;
@ -136,7 +136,7 @@ BYTE *bmpdata_lzx(int level, int dstsize, const BYTE *dat) {
if (dat == NULL) {
return(NULL);
}
ret = (BYTE *)_MALLOC(dstsize, "res");
ret = (UINT8 *)_MALLOC(dstsize, "res");
if (ret == NULL) {
goto lxz_err;
}
@ -174,7 +174,7 @@ lxz_err:
return(ret);
}
BYTE *bmpdata_solvedata(const BYTE *dat) {
UINT8 *bmpdata_solvedata(const UINT8 *dat) {
int dstsize;

View File

@ -1,46 +1,46 @@
#if defined(__GNUC__)
typedef struct {
BYTE bfType[2];
BYTE bfSize[4];
BYTE bfReserved1[2];
BYTE bfReserved2[2];
BYTE bfOffBits[4];
UINT8 bfType[2];
UINT8 bfSize[4];
UINT8 bfReserved1[2];
UINT8 bfReserved2[2];
UINT8 bfOffBits[4];
} __attribute__ ((packed)) BMPFILE;
typedef struct {
BYTE biSize[4];
BYTE biWidth[4];
BYTE biHeight[4];
BYTE biPlanes[2];
BYTE biBitCount[2];
BYTE biCompression[4];
BYTE biSizeImage[4];
BYTE biXPelsPerMeter[4];
BYTE biYPelsPerMeter[4];
BYTE biClrUsed[4];
BYTE biClrImportant[4];
UINT8 biSize[4];
UINT8 biWidth[4];
UINT8 biHeight[4];
UINT8 biPlanes[2];
UINT8 biBitCount[2];
UINT8 biCompression[4];
UINT8 biSizeImage[4];
UINT8 biXPelsPerMeter[4];
UINT8 biYPelsPerMeter[4];
UINT8 biClrUsed[4];
UINT8 biClrImportant[4];
} __attribute__ ((packed)) BMPINFO;
#else
#pragma pack(push, 1)
typedef struct {
BYTE bfType[2];
BYTE bfSize[4];
BYTE bfReserved1[2];
BYTE bfReserved2[2];
BYTE bfOffBits[4];
UINT8 bfType[2];
UINT8 bfSize[4];
UINT8 bfReserved1[2];
UINT8 bfReserved2[2];
UINT8 bfOffBits[4];
} BMPFILE;
typedef struct {
BYTE biSize[4];
BYTE biWidth[4];
BYTE biHeight[4];
BYTE biPlanes[2];
BYTE biBitCount[2];
BYTE biCompression[4];
BYTE biSizeImage[4];
BYTE biXPelsPerMeter[4];
BYTE biYPelsPerMeter[4];
BYTE biClrUsed[4];
BYTE biClrImportant[4];
UINT8 biSize[4];
UINT8 biWidth[4];
UINT8 biHeight[4];
UINT8 biPlanes[2];
UINT8 biBitCount[2];
UINT8 biCompression[4];
UINT8 biSizeImage[4];
UINT8 biXPelsPerMeter[4];
UINT8 biYPelsPerMeter[4];
UINT8 biClrUsed[4];
UINT8 biClrImportant[4];
} BMPINFO;
#pragma pack(pop)
#endif
@ -61,10 +61,10 @@ UINT bmpdata_getdatasize(const BMPINFO *bi);
UINT bmpdata_sethead(BMPFILE *bf, const BMPINFO *bi);
UINT bmpdata_setinfo(BMPINFO *bi, const BMPDATA *inf);
BOOL bmpdata_getinfo(const BMPINFO *bi, BMPDATA *inf);
BRESULT bmpdata_getinfo(const BMPINFO *bi, BMPDATA *inf);
BYTE *bmpdata_lzx(int level, int dstsize, const BYTE *dat);
BYTE *bmpdata_solvedata(const BYTE *dat);
UINT8 *bmpdata_lzx(int level, int dstsize, const UINT8 *dat);
UINT8 *bmpdata_solvedata(const UINT8 *dat);
#ifdef __cplusplus
}

View File

@ -61,7 +61,7 @@ UINT listarray_getitems(LISTARRAY laHandle) {
void *listarray_append(LISTARRAY laHandle, const void *vpItem) {
LISTARRAY laNext;
char *p;
UINT8 *p;
if (laHandle == NULL) {
goto laapp_err;
@ -78,7 +78,7 @@ void *listarray_append(LISTARRAY laHandle, const void *vpItem) {
}
laHandle = laNext;
}
p = (char *)(laHandle + 1);
p = (UINT8 *)(laHandle + 1);
p += laHandle->items * laHandle->listsize;
if (vpItem) {
CopyMemory(p, vpItem, laHandle->listsize);
@ -97,7 +97,7 @@ void *listarray_getitem(LISTARRAY laHandle, UINT num) {
while(laHandle) {
if (num < laHandle->items) {
return((char *)(laHandle + 1) + (laHandle->listsize * num));
return((UINT8 *)(laHandle + 1) + (laHandle->listsize * num));
}
num -= laHandle->items;
laHandle = laHandle->laNext;
@ -112,7 +112,7 @@ UINT listarray_getpos(LISTARRAY laHandle, void *vpItem) {
pos = 0;
while(laHandle) {
char *p = (char *)(laHandle + 1);
UINT8 *p = (UINT8 *)(laHandle + 1);
for (i=0; i<laHandle->items; i++) {
if ((long)p == (long)vpItem) {
return(pos + i);
@ -126,7 +126,7 @@ UINT listarray_getpos(LISTARRAY laHandle, void *vpItem) {
}
void *listarray_enum(LISTARRAY laHandle,
BOOL (*cbProc)(void *vpItem, void *vpArg), void *vpArg) {
BRESULT (*cbProc)(void *vpItem, void *vpArg), void *vpArg) {
UINT i;
@ -135,7 +135,7 @@ void *listarray_enum(LISTARRAY laHandle,
}
while(laHandle) {
char *p = (char *)(laHandle + 1);
UINT8 *p = (UINT8 *)(laHandle + 1);
for (i=0; i<laHandle->items; i++) {
if (cbProc((void *)p, vpArg)) {
return((void *)p);

View File

@ -19,7 +19,7 @@ void *listarray_append(LISTARRAY laHandle, const void *vpItem);
void *listarray_getitem(LISTARRAY laHandle, UINT num);
UINT listarray_getpos(LISTARRAY laHandle, void *vpItem);
void *listarray_enum(LISTARRAY laHandle,
BOOL (*cbProc)(void *vpItem, void *vpArg), void *vpArg);
BRESULT (*cbProc)(void *vpItem, void *vpArg), void *vpArg);
#ifdef __cplusplus
}

View File

@ -619,7 +619,7 @@ int STRCALL milstr_getarg(OEMCHAR *str, OEMCHAR *arg[], int maxarg) {
int ret = 0;
OEMCHAR *p;
BOOL quot;
BRESULT quot;
while(maxarg--) {
quot = FALSE;

View File

@ -1,13 +1,4 @@
typedef struct {
char fname[8];
BYTE terminate;
BYTE extheadsize;
BYTE type;
BYTE reserved;
BYTE size[4];
} MILF_T;
#ifndef STRCALL
#define STRCALL
#endif

View File

@ -1,7 +1,7 @@
#include "compiler.h"
BOOL rect_in(const RECT_T *rect, int x, int y) {
BRESULT rect_in(const RECT_T *rect, int x, int y) {
if ((rect) &&
(rect->left <= x) && (rect->right > x) &&
@ -26,7 +26,7 @@ int rect_num(const RECT_T *rect, int cnt, int x, int y) {
return(-1);
}
BOOL rect_isoverlap(const RECT_T *r1, const RECT_T *r2) {
BRESULT rect_isoverlap(const RECT_T *r1, const RECT_T *r2) {
if ((r1->left >= r2->right) ||
(r1->right <= r2->left) ||

View File

@ -34,9 +34,9 @@ typedef struct {
} UNIRECT;
BOOL rect_in(const RECT_T *rect, int x, int y);
BRESULT rect_in(const RECT_T *rect, int x, int y);
int rect_num(const RECT_T *rect, int cnt, int x, int y);
BOOL rect_isoverlap(const RECT_T *r1, const RECT_T *r2);
BRESULT rect_isoverlap(const RECT_T *r1, const RECT_T *r2);
void rect_enumout(const RECT_T *tag, const RECT_T *base,
void *arg, void (*outcb)(void *arg, const RECT_T *rect));
void rect_add(RECT_T *dst, const RECT_T *src);

View File

@ -332,7 +332,7 @@ BRESULT fddd88_set(FDDFILE fdd, const OEMCHAR *fname) {
short attr;
FILEH fh;
BOOL r;
BRESULT r;
UINT8 ptr[D88_TRACKMAX][4];
UINT i;

View File

@ -1,6 +1,9 @@
#include "compiler.h"
#include "parts.h"
#include "dosio.h"
#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2)
#include "oemtext.h"
#endif
#include "fontmng.h"
#include "font.h"
#include "fontdata.h"
@ -134,12 +137,20 @@ const UINT8 *p;
int height;
UINT8 bit;
int i;
#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2)
OEMCHAR oemwork[4];
#endif
ptr += from * 16;
work[1] = '\0';
while(from < to) {
work[0] = (char)from;
#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2)
oemtext_sjis2oem(oemwork, NELEMENTS(oemwork), work, -1);
dat = fontmng_get(fnt, oemwork);
#else
dat = fontmng_get(fnt, work);
#endif
if (dat) {
width = min(dat->width, 8);
height = min(dat->height, 16);
@ -176,6 +187,9 @@ static void setjis(UINT8 *ptr, void *fnt) {
const UINT8 *p;
UINT bit;
int i;
#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2)
OEMCHAR oemwork[4];
#endif
work[2] = '\0';
for (h=0x21; h<0x7f; h++) {
@ -200,7 +214,12 @@ const UINT8 *p;
sjis = jis2sjis(jis);
work[0] = (char)(sjis >> 8);
work[1] = (char)sjis;
#if defined(OSLANG_UTF8) || defined(OSLANG_UCS2)
oemtext_sjis2oem(oemwork, NELEMENTS(oemwork), work, -1);
dat = fontmng_get(fnt, oemwork);
#else
dat = fontmng_get(fnt, work);
#endif
if (dat) {
width = min(dat->width, 16);
height = min(dat->height, 16);

View File

@ -67,7 +67,7 @@ static void streamprepare(UINT samples) {
#if defined(SUPPORT_WAVEREC)
// ---- wave rec
BOOL sound_recstart(const char *filename) {
BRESULT sound_recstart(const OEMCHAR *filename) {
WAVEWR rec;
@ -166,7 +166,7 @@ static void filltailsample(UINT count) {
// ----
BOOL sound_create(UINT rate, UINT ms) {
BRESULT sound_create(UINT rate, UINT ms) {
UINT samples;
UINT reserve;

View File

@ -21,7 +21,7 @@ extern "C" {
extern SOUNDCFG soundcfg;
BOOL sound_create(UINT rate, UINT ms);
BRESULT sound_create(UINT rate, UINT ms);
void sound_destroy(void);
void sound_reset(void);
@ -35,7 +35,7 @@ const SINT32 *sound_pcmlock(void);
void sound_pcmunlock(const SINT32 *hdl);
#if defined(SUPPORT_WAVEREC)
BOOL sound_recstart(const char *filename);
BRESULT sound_recstart(const OEMCHAR *filename);
void sound_recstop(void);
#endif

View File

@ -636,7 +636,7 @@ int statsave_check(const OEMCHAR *filename, OEMCHAR *buf, UINT size) {
SFFILEH sffh;
int ret;
BOOL done;
BRESULT done;
const SFENTRY *tbl;
const SFENTRY *tblterm;
@ -692,7 +692,7 @@ int statsave_load(const OEMCHAR *filename) {
SFFILEH sffh;
int ret;
BOOL done;
BRESULT done;
const SFENTRY *tbl;
const SFENTRY *tblterm;

View File

@ -11,7 +11,7 @@ typedef struct {
//  ÆÍŠg£<E28099>`
HDC hdcimage;
HBITMAP hBitmap;
BYTE *image;
UINT8 *image;
HFONT hfont;
RECT rect;
int bmpwidth;
@ -73,7 +73,7 @@ void *fontmng_create(int size, UINT type, const OEMCHAR *fontface) {
ret->bmpalign = (((ret->bmpwidth + 31) / 8) & ~3);
bi = (BITMAPINFO *)(((BYTE *)(ret + 1)) + fontalign);
bi = (BITMAPINFO *)(((UINT8 *)(ret + 1)) + fontalign);
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi->bmiHeader.biWidth = ret->bmpwidth;
bi->bmiHeader.biHeight = ret->bmpheight;
@ -132,84 +132,39 @@ void fontmng_destroy(void *hdl) {
}
#if !defined(UNICODE)
// ----
static void getlength1(FNTMNG fhdl, FNTDAT fdat,
const char *string, int length) {
const OEMCHAR *string, int length) {
SIZE fntsize;
if ((fhdl->fonttype & FDAT_PROPORTIONAL) &&
(GetTextExtentPoint32(fhdl->hdcimage, string, length, &fntsize))) {
if (GetTextExtentPoint32(fhdl->hdcimage, string, length, &fntsize)) {
fntsize.cx = min(fntsize.cx, fhdl->bmpwidth);
fdat->width = fntsize.cx;
fdat->pitch = fntsize.cx;
}
else if (length < 2) {
fdat->width = fhdl->fontwidth;
fdat->pitch = (fhdl->fontsize + 1) >> 1;
}
else {
fdat->width = fhdl->fontwidth;
fdat->pitch = fhdl->fontsize;
fdat->pitch = (fhdl->fontsize + 1) >> 1;
}
fdat->height = fhdl->fontheight;
}
static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, const char *string) {
static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, const OEMCHAR *string) {
int leng;
FillRect(fhdl->hdcimage, &fhdl->rect,
(HBRUSH)GetStockObject(BLACK_BRUSH));
leng = strlen(string);
leng = milstr_charsize(string);
TextOut(fhdl->hdcimage, 0, 0, string, leng);
getlength1(fhdl, fdat, string, leng);
}
#else
static void getlength1(FNTMNG fhdl, FNTDAT fdat,
const char *string, int length) {
TCHAR work[4];
int leng;
SIZE fntsize;
BRESULT fontmng_getsize(void *hdl, const OEMCHAR *string, POINT_T *pt) {
if (fhdl->fonttype & FDAT_PROPORTIONAL) {
leng = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, string, -1,
work, NELEMENTS(work)) - 1;
GetTextExtentPoint32(fhdl->hdcimage, work, leng, &fntsize);
fntsize.cx = min(fntsize.cx, fhdl->bmpwidth);
fdat->width = fntsize.cx;
fdat->pitch = fntsize.cx;
}
else if (length < 2) {
fdat->width = fhdl->fontwidth;
fdat->pitch = (fhdl->fontsize + 1) >> 1;
}
else {
fdat->width = fhdl->fontwidth;
fdat->pitch = fhdl->fontsize;
}
fdat->height = fhdl->fontheight;
}
static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, const char *string) {
TCHAR work[4];
int leng;
FillRect(fhdl->hdcimage, &fhdl->rect,
(HBRUSH)GetStockObject(BLACK_BRUSH));
leng = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, string, -1,
work, NELEMENTS(work)) - 1;
TextOut(fhdl->hdcimage, 0, 0, work, leng);
getlength1(fhdl, fdat, string, leng);
}
#endif
BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt) {
char buf[4];
OEMCHAR buf[4];
_FNTDAT fdat;
int width;
int leng;
@ -219,26 +174,17 @@ BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt) {
goto fmgs_exit;
}
buf[2] = '\0';
do {
buf[0] = *string++;
if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) {
buf[1] = *string++;
if (buf[1] == '\0') {
break;
}
leng = 2;
}
else if (buf[0]) {
buf[1] = '\0';
leng = 1;
}
else {
while(1) {
leng = milstr_charsize(string);
if (!leng) {
break;
}
CopyMemory(buf, string, leng * sizeof(OEMCHAR));
buf[leng] = '\0';
string += leng;
getlength1((FNTMNG)hdl, &fdat, buf, leng);
width += fdat.pitch;
} while(1);
}
if (pt) {
pt->x = width;
@ -250,9 +196,9 @@ fmgs_exit:
return(FAILURE);
}
BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) {
BRESULT fontmng_getdrawsize(void *hdl, const OEMCHAR *string, POINT_T *pt) {
char buf[4];
OEMCHAR buf[4];
_FNTDAT fdat;
int width;
int posx;
@ -265,22 +211,14 @@ BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) {
width = 0;
posx = 0;
buf[2] = '\0';
do {
buf[0] = *string++;
if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) {
buf[1] = *string++;
if (buf[1] == '\0') {
break;
}
leng = 2;
}
else if (buf[0]) {
buf[1] = '\0';
leng = 1;
}
else {
while(1) {
leng = milstr_charsize(string);
if (!leng) {
break;
}
CopyMemory(buf, string, leng * sizeof(OEMCHAR));
buf[leng] = '\0';
string += leng;
getlength1((FNTMNG)hdl, &fdat, buf, leng);
width = posx + max(fdat.width, fdat.pitch);
posx += fdat.pitch;
@ -298,13 +236,13 @@ fmgds_exit:
static void fontmng_setpat(FNTMNG fhdl, FNTDAT fdat) {
DWORD remx;
DWORD remy;
BYTE *src;
BYTE *dst;
BYTE *s;
BYTE bit;
BYTE b1 = 0; // for cygwin
UINT remx;
UINT remy;
UINT8 *src;
UINT8 *dst;
UINT8 *s;
UINT8 bit;
UINT8 b1 = 0; // for cygwin
int align;
align = fhdl->bmpalign;
@ -313,7 +251,7 @@ static void fontmng_setpat(FNTMNG fhdl, FNTDAT fdat) {
goto fmsp_end;
}
dst = (BYTE *)(fdat + 1);
dst = (UINT8 *)(fdat + 1);
align *= -1;
remy = fdat->height;
@ -339,7 +277,7 @@ fmsp_end:
// ----
FNTDAT fontmng_get(void *hdl, const char *string) {
FNTDAT fontmng_get(void *hdl, const OEMCHAR *string) {
FNTMNG fhdl;
FNTDAT fdat;

View File

@ -24,9 +24,9 @@ extern "C" {
void *fontmng_create(int size, UINT type, const OEMCHAR *fontface);
void fontmng_destroy(void *hdl);
BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt);
BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt);
FNTDAT fontmng_get(void *hdl, const char *string);
BRESULT fontmng_getsize(void *hdl, const OEMCHAR *string, POINT_T *pt);
BRESULT fontmng_getdrawsize(void *hdl, const OEMCHAR *string, POINT_T *pt);
FNTDAT fontmng_get(void *hdl, const OEMCHAR *string);
#ifdef __cplusplus
}

View File

@ -115,8 +115,8 @@ BEGIN
END
POPUP "&Other"
BEGIN
MENUITEM "&BMP Save", IDM_BMPSAVE
MENUITEM "&OPM LOG", IDM_OPMLOG
MENUITEM "&BMP Save...", IDM_BMPSAVE
MENUITEM "&OPM LOG...", IDM_OPMLOG
MENUITEM "&Clock Disp", IDM_DISPCLOCK
MENUITEM "&Frame Disp", IDM_DISPFRAME
MENUITEM "Joy Re&verse", IDM_JOYX