mirror of
https://github.com/libretro/NP2kai.git
synced 2024-10-07 06:43:29 +00:00
replace max/min to np2max/np2min
This commit is contained in:
parent
279dfc17d6
commit
f3883702ee
@ -49,8 +49,8 @@ const BYTE *q;
|
||||
ctrl = ptr;
|
||||
*ptr++ = 0x00;
|
||||
}
|
||||
back = min(pos, maxhis);
|
||||
rem = min(datasize - pos, maxlen);
|
||||
back = np2min(pos, maxhis);
|
||||
rem = np2min(datasize - pos, maxlen);
|
||||
minback = back;
|
||||
minr = rem;
|
||||
while(back) {
|
||||
|
@ -23,7 +23,7 @@ void *textout_open(const char *filename, int bufsize) {
|
||||
if (fh == NULL) {
|
||||
goto toope_exit;
|
||||
}
|
||||
bufsize = max(bufsize, 256);
|
||||
bufsize = np2max(bufsize, 256);
|
||||
to = (TEXTOUT)_MALLOC(sizeof(_TEXTOUT) + bufsize, filename);
|
||||
if (to == NULL) {
|
||||
goto toope_exit;
|
||||
|
@ -53,11 +53,11 @@ typedef signed char BOOL;
|
||||
#define MAX_PATH 256
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ZeroMemory
|
||||
|
@ -147,7 +147,7 @@ static void bios_reinitbyswitch(void) {
|
||||
}
|
||||
mem[MEMB_BIOS_FLAG1] = biosflag;
|
||||
extmem = pccore.extmem;
|
||||
extmem = min(extmem, 14);
|
||||
extmem = np2min(extmem, 14);
|
||||
mem[MEMB_EXPMMSZ] = (UINT8)(extmem << 3);
|
||||
if (pccore.extmem >= 15) {
|
||||
mem[0x0594] = pccore.extmem - 15;
|
||||
|
@ -36,9 +36,9 @@ static REG8 bios0x1f_90(void) {
|
||||
leng = LOW16(CPU_CX - 1) + 1;
|
||||
// TRACEOUT(("move %.8x %.8x %.4x", srcbase + srcaddr, dstbase + dstaddr, leng));
|
||||
do {
|
||||
l = min(leng, sizeof(work));
|
||||
l = min(l, srclimit - srcaddr);
|
||||
l = min(l, dstlimit - dstaddr);
|
||||
l = np2min(leng, sizeof(work));
|
||||
l = np2min(l, srclimit - srcaddr);
|
||||
l = np2min(l, dstlimit - dstaddr);
|
||||
if (!l) {
|
||||
CPU_A20EN(FALSE);
|
||||
goto p90_err2;
|
||||
|
@ -65,7 +65,7 @@ static REG8 sxsibios_write(UINT type, SXSIDEV sxsi) {
|
||||
if (!ret) {
|
||||
addr = (CPU_ES << 4) + CPU_BP;
|
||||
while(size) {
|
||||
r = min(size, sxsi->size);
|
||||
r = np2min(size, sxsi->size);
|
||||
MEML_READS(addr, work, r);
|
||||
ret = sxsi_write(CPU_AL, pos, work, r);
|
||||
if (ret >= 0x20) {
|
||||
@ -96,7 +96,7 @@ static REG8 sxsibios_read(UINT type, SXSIDEV sxsi) {
|
||||
if (!ret) {
|
||||
addr = (CPU_ES << 4) + CPU_BP;
|
||||
while(size) {
|
||||
r = min(size, sxsi->size);
|
||||
r = np2min(size, sxsi->size);
|
||||
ret = sxsi_read(CPU_AL, pos, work, r);
|
||||
if (ret >= 0x20) {
|
||||
break;
|
||||
|
@ -54,7 +54,7 @@ static const UINT8 cdrom_inquiry[] = {
|
||||
|
||||
static void senddata(IDEDRV drv, UINT size, UINT limit) {
|
||||
|
||||
size = min(size, limit);
|
||||
size = np2min(size, limit);
|
||||
drv->sc = IDEINTR_IO;
|
||||
drv->cy = size;
|
||||
drv->status &= ~(IDESTAT_BSY|IDESTAT_DMRD|IDESTAT_SERV|IDESTAT_CHK);
|
||||
@ -561,7 +561,7 @@ static void atapi_cmd_mode_sense(IDEDRV drv) {
|
||||
p2a = defval_pagecode_2a;
|
||||
ptr = defval_pagecode_0f;
|
||||
}
|
||||
CopyMemory(p, ptr, min((leng - cnt), PC_0F_SIZE));
|
||||
CopyMemory(p, ptr, np2min((leng - cnt), PC_0F_SIZE));
|
||||
p[4] = (p2a[4] & 1); // byte04 bit0 = Audioplay supported?
|
||||
p[4] |= ((p2a[6] & 2) << 6); // byte04 bit7 = lock state?
|
||||
p[4] |= ((p2a[5] & 4) << 2); // byte04 bit4 = R-W supported?
|
||||
@ -587,7 +587,7 @@ static void atapi_cmd_mode_sense(IDEDRV drv) {
|
||||
else {
|
||||
ptr = defval_pagecode_01;
|
||||
}
|
||||
CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_01_SIZE));
|
||||
CopyMemory(drv->buf + cnt, ptr, np2min((leng - cnt), PC_01_SIZE));
|
||||
cnt += PC_01_SIZE;
|
||||
if (cnt > leng) {
|
||||
goto length_exceeded;
|
||||
@ -604,7 +604,7 @@ static void atapi_cmd_mode_sense(IDEDRV drv) {
|
||||
else {
|
||||
ptr = defval_pagecode_0d;
|
||||
}
|
||||
CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_0D_SIZE));
|
||||
CopyMemory(drv->buf + cnt, ptr, np2min((leng - cnt), PC_0D_SIZE));
|
||||
cnt += PC_0D_SIZE;
|
||||
if (cnt > leng) {
|
||||
goto length_exceeded;
|
||||
@ -621,7 +621,7 @@ static void atapi_cmd_mode_sense(IDEDRV drv) {
|
||||
else {
|
||||
ptr = defval_pagecode_0e;
|
||||
}
|
||||
CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_0E_SIZE));
|
||||
CopyMemory(drv->buf + cnt, ptr, np2min((leng - cnt), PC_0E_SIZE));
|
||||
cnt += PC_0E_SIZE;
|
||||
if (cnt > leng) {
|
||||
goto length_exceeded;
|
||||
@ -639,7 +639,7 @@ static void atapi_cmd_mode_sense(IDEDRV drv) {
|
||||
else {
|
||||
ptr = defval_pagecode_2a;
|
||||
}
|
||||
CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_2A_SIZE));
|
||||
CopyMemory(drv->buf + cnt, ptr, np2min((leng - cnt), PC_2A_SIZE));
|
||||
cnt += PC_2A_SIZE;
|
||||
if (cnt > leng) {
|
||||
goto length_exceeded;
|
||||
@ -848,7 +848,7 @@ static void atapi_cmd_readtoc(IDEDRV drv) {
|
||||
switch (format) {
|
||||
case 0: // track info
|
||||
//datasize = (tracks * 8) + 10;
|
||||
strack = min(max(1U, strack), (tracks+1)); // special case: 0 = 1sttrack, 0xaa = leadout
|
||||
strack = np2min(np2max(1U, strack), (tracks+1)); // special case: 0 = 1sttrack, 0xaa = leadout
|
||||
datasize = ((tracks - strack + 1U) * 8U) + 10;
|
||||
drv->buf[0] = (UINT8)(datasize >> 8);
|
||||
drv->buf[1] = (UINT8)(datasize >> 0);
|
||||
|
@ -500,7 +500,7 @@ void ct1741_dma(NEVENTITEM item)
|
||||
// “]‘—<E28098>`
|
||||
rem = cs4231.bufsize - cs4231.bufdatas;
|
||||
pos = (cs4231.bufpos + cs4231.bufdatas) & (DMA_BUFSIZE -1);
|
||||
size = min(rem, DMA_BUFSIZE - pos);
|
||||
size = np2min(rem, DMA_BUFSIZE - pos);
|
||||
r = dmac_getdatas(dsp_info.dma.chan, (UINT8*)(dsp_info.dma.buf.b16 + pos), size);
|
||||
// }
|
||||
if ((dsp_info.dma.chan->leng.w) && (dsp_info.freq)) {
|
||||
|
@ -1264,7 +1264,7 @@ static SINT32 sampcount2_n = 0;
|
||||
return(FAILURE);
|
||||
}
|
||||
while(count) {
|
||||
r = min(count, drv->dabufrem * samplen_n / samplen_d);
|
||||
r = np2min(count, drv->dabufrem * samplen_n / samplen_d);
|
||||
if (r) {
|
||||
count -= r;
|
||||
ptr = drv->dabuf + 2352 - (drv->dabufrem * 4);
|
||||
@ -1345,7 +1345,7 @@ static SINT32 sampcount2_n = 0;
|
||||
// return(FAILURE);
|
||||
// }
|
||||
// while(count) {
|
||||
// r = min(count, drv->dabufrem * samplen);
|
||||
// r = np2min(count, drv->dabufrem * samplen);
|
||||
// if (r) {
|
||||
// count -= r;
|
||||
// ptr = drv->dabuf + 2352 - (drv->dabufrem * 4);
|
||||
@ -1418,7 +1418,7 @@ static SINT32 sampcount2_n = 0;
|
||||
// return(FAILURE);
|
||||
// }
|
||||
// while(count) {
|
||||
// r = min(count, drv->dabufrem * sampbias);
|
||||
// r = np2min(count, drv->dabufrem * sampbias);
|
||||
// if (r) {
|
||||
// count -= r;
|
||||
// ptr = drv->dabuf + 2352 - drv->dabufrem * 4;
|
||||
|
@ -40,7 +40,7 @@ static UINT scsicmd_datain(SXSIDEV sxsi, UINT8 *cdb) {
|
||||
// Page code = cdb[2];
|
||||
length = cdb[4];
|
||||
if (length) {
|
||||
CopyMemory(scsiio.data, hdd_inquiry, min(length, 0x20));
|
||||
CopyMemory(scsiio.data, hdd_inquiry, np2min(length, 0x20));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -114,7 +114,7 @@ static UINT getcatfilename(const ZIPCAT *cat, char *filename, UINT size) {
|
||||
}
|
||||
size = size - 1;
|
||||
fnamesize = LOADINTELWORD(cat->filenamesize);
|
||||
size = min(size, fnamesize);
|
||||
size = np2min(size, fnamesize);
|
||||
if (size) {
|
||||
CopyMemory(filename, cat + 1, size);
|
||||
}
|
||||
@ -157,7 +157,7 @@ static UINT method0_read(ARCFH arcfh, void *buffer, UINT size) {
|
||||
|
||||
m0 = (METHOD0 *)arcfh;
|
||||
rsize = m0->size - m0->pos;
|
||||
rsize = min(rsize, size);
|
||||
rsize = np2min(rsize, size);
|
||||
if (rsize == 0) {
|
||||
return(0);
|
||||
}
|
||||
@ -271,11 +271,11 @@ static UINT method8read(METHOD8 *m8, void *buffer, UINT size) {
|
||||
long fpos;
|
||||
|
||||
r = m8->dstsize - m8->dstpos;
|
||||
size = min(size, r);
|
||||
size = np2min(size, r);
|
||||
ptr = (UINT8 *)buffer;
|
||||
while(size) {
|
||||
dstrem = NELEMENTS(m8->dst) - m8->stream.avail_out - m8->pos;
|
||||
r = min(dstrem, size);
|
||||
r = np2min(dstrem, size);
|
||||
if (r) {
|
||||
if (buffer != NULL) {
|
||||
CopyMemory(ptr, m8->dst + m8->pos, r);
|
||||
@ -295,7 +295,7 @@ static UINT method8read(METHOD8 *m8, void *buffer, UINT size) {
|
||||
// TRACEOUT(("try decompress"));
|
||||
if (m8->stream.avail_in == 0) {
|
||||
r = m8->srcsize - m8->srcpos;
|
||||
r = min(r, NELEMENTS(m8->src));
|
||||
r = np2min(r, NELEMENTS(m8->src));
|
||||
if (r == 0) {
|
||||
break;
|
||||
}
|
||||
@ -575,7 +575,7 @@ static BRESULT getziphdrpos(FILEH fh, long *hdrpos) {
|
||||
bufrem = 0;
|
||||
while(fpos > 0) {
|
||||
rsize = NELEMENTS(buf) - bufrem;
|
||||
rsize = (UINT)(min(fpos, (long)rsize));
|
||||
rsize = (UINT)(np2min(fpos, (long)rsize));
|
||||
fpos -= rsize;
|
||||
r = bufrem;
|
||||
while(r) {
|
||||
|
@ -40,7 +40,7 @@ UINT bmpdata_sethead(BMPFILE *bf, const BMPINFO *bi) {
|
||||
bit = LOADINTELWORD(bi->biBitCount);
|
||||
if (bit < 8) {
|
||||
pal = LOADINTELDWORD(bi->biClrUsed);
|
||||
pal = min(pal, (UINT)(1 << bit));
|
||||
pal = np2min(pal, (UINT)(1 << bit));
|
||||
ret += pal * 4;
|
||||
}
|
||||
if (bf) {
|
||||
@ -156,7 +156,7 @@ UINT8 *bmpdata_lzx(int level, int dstsize, const UINT8 *dat) {
|
||||
tmp |= *dat++;
|
||||
pos = -1 - (tmp >> level);
|
||||
leng = (tmp & mask) + 1;
|
||||
leng = min(leng, dstsize);
|
||||
leng = np2min(leng, dstsize);
|
||||
dstsize -= leng;
|
||||
while(leng--) {
|
||||
*ptr = *(ptr + pos);
|
||||
|
@ -755,7 +755,7 @@ BRESULT profile_read(const OEMCHAR *lpAppName, const OEMCHAR *lpKeyName, const O
|
||||
}
|
||||
else
|
||||
{
|
||||
nSize = min(nSize, pfp.cchString + 1);
|
||||
nSize = np2min(nSize, pfp.cchString + 1);
|
||||
milstr_ncpy(lpReturnedString, pfp.lpString, nSize);
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -781,7 +781,7 @@ int profile_readint(const OEMCHAR *lpAppName, const OEMCHAR *lpKeyName, int nDef
|
||||
}
|
||||
else
|
||||
{
|
||||
nSize = min(NELEMENTS(szBuffer), pfp.cchString + 1);
|
||||
nSize = np2min(NELEMENTS(szBuffer), pfp.cchString + 1);
|
||||
milstr_ncpy(szBuffer, pfp.lpString, nSize);
|
||||
return (int)milstr_solveINT(szBuffer);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void rect_enumout(const RECT_T *tag, const RECT_T *base,
|
||||
if ((tag != NULL) && (base != NULL) && (outcb != NULL)) {
|
||||
// base.top -> tag.top
|
||||
rect.top = base->top;
|
||||
rect.bottom = min(tag->top, base->bottom);
|
||||
rect.bottom = np2min(tag->top, base->bottom);
|
||||
if (rect.top < rect.bottom) {
|
||||
rect.left = base->left;
|
||||
rect.right = base->right;
|
||||
@ -54,14 +54,14 @@ void rect_enumout(const RECT_T *tag, const RECT_T *base,
|
||||
}
|
||||
|
||||
// -> tag.bottom
|
||||
rect.bottom = min(tag->bottom, base->bottom);
|
||||
rect.bottom = np2min(tag->bottom, base->bottom);
|
||||
if (rect.top < rect.bottom) {
|
||||
rect.left = base->left;
|
||||
rect.right = min(tag->left, base->right);
|
||||
rect.right = np2min(tag->left, base->right);
|
||||
if (rect.left < rect.right) {
|
||||
outcb(arg, &rect);
|
||||
}
|
||||
rect.left = max(tag->right, base->left);
|
||||
rect.left = np2max(tag->right, base->left);
|
||||
rect.right = base->right;
|
||||
if (rect.left < rect.right) {
|
||||
outcb(arg, &rect);
|
||||
|
@ -283,7 +283,7 @@ const UINT8 *p;
|
||||
ret = SUCCESS;
|
||||
p = (UINT8 *)buffer;
|
||||
while(size) {
|
||||
wsize = min(size, tf->bufrem);
|
||||
wsize = np2min(size, tf->bufrem);
|
||||
if (wsize) {
|
||||
CopyMemory(tf->buf + tf->bufpos, p, wsize);
|
||||
p += wsize;
|
||||
@ -310,7 +310,7 @@ const UINT8 *p;
|
||||
ret = SUCCESS;
|
||||
p = (UINT8 *)buffer;
|
||||
while(size) {
|
||||
wsize = min(size, tf->bufrem);
|
||||
wsize = np2min(size, tf->bufrem);
|
||||
if (wsize) {
|
||||
q = tf->buf + (tf->bufpos * sizeof(UINT16));
|
||||
CopyMemory(q, p, wsize * sizeof(UINT16));
|
||||
|
@ -225,7 +225,7 @@ UINT wavefile_write(WAVEFILEH hWave, const void *lpBuffer, UINT cbBuffer)
|
||||
}
|
||||
while (cbBuffer)
|
||||
{
|
||||
UINT nSize = min(hWave->nRemain, cbBuffer);
|
||||
UINT nSize = np2min(hWave->nRemain, cbBuffer);
|
||||
memcpy(hWave->lpCurrent, lpBuffer, nSize);
|
||||
lpBuffer = ((UINT8 *)lpBuffer) + nSize;
|
||||
cbBuffer -= nSize;
|
||||
|
@ -122,10 +122,10 @@ static void writeseg(const OEMCHAR *fname, UINT32 addr, UINT limit) {
|
||||
if (fh == FILEH_INVALID) {
|
||||
return;
|
||||
}
|
||||
limit = min(limit, 0xffff);
|
||||
limit = np2min(limit, 0xffff);
|
||||
limit++;
|
||||
while(limit) {
|
||||
size = min(limit, sizeof(buf));
|
||||
size = np2min(limit, sizeof(buf));
|
||||
MEML_READS(addr, buf, size);
|
||||
file_write(fh, buf, size);
|
||||
addr += size;
|
||||
|
@ -128,14 +128,14 @@ void debugwriteseg(const OEMCHAR *fname, const descriptor_t *sd,
|
||||
if (limit <= addr) {
|
||||
return;
|
||||
}
|
||||
size = min(limit - addr, size - 1) + 1;
|
||||
size = np2min(limit - addr, size - 1) + 1;
|
||||
fh = file_create_c(fname);
|
||||
if (fh == FILEH_INVALID) {
|
||||
return;
|
||||
}
|
||||
addr += sd->u.seg.segbase;
|
||||
while(size) {
|
||||
limit = min(size, sizeof(buf));
|
||||
limit = np2min(size, sizeof(buf));
|
||||
MEML_READS(addr, buf, limit);
|
||||
file_write(fh, buf, limit);
|
||||
addr += limit;
|
||||
|
@ -337,7 +337,7 @@ REG8 sec2048_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
}
|
||||
|
||||
while(size) {
|
||||
rsize = min(size, 2048);
|
||||
rsize = np2min(size, 2048);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -372,7 +372,7 @@ REG8 sec2352_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
if (file_seek(fh, fpos, FSEEK_SET) != fpos) {
|
||||
return(0xd0);
|
||||
}
|
||||
rsize = min(size, 2048);
|
||||
rsize = np2min(size, 2048);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -407,7 +407,7 @@ REG8 sec2448_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
if (file_seek(fh, fpos, FSEEK_SET) != fpos) {
|
||||
return(0xd0);
|
||||
}
|
||||
rsize = min(size, 2048);
|
||||
rsize = np2min(size, 2048);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -459,7 +459,7 @@ REG8 sec_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
if (file_seek(fh, fpos, FSEEK_SET) != fpos) {
|
||||
return(0xd0);
|
||||
}
|
||||
rsize = min(size, 2048);
|
||||
rsize = np2min(size, 2048);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -573,7 +573,7 @@ BRESULT setsxsidev(SXSIDEV sxsi, const OEMCHAR *path, const _CDTRK *trk, UINT tr
|
||||
}
|
||||
ZeroMemory(cdinfo, sizeof(_CDINFO));
|
||||
cdinfo->fh = fh;
|
||||
trks = min(trks, NELEMENTS(cdinfo->trk) - 1);
|
||||
trks = np2min(trks, NELEMENTS(cdinfo->trk) - 1);
|
||||
CopyMemory(cdinfo->trk, trk, trks * sizeof(_CDTRK));
|
||||
|
||||
#ifdef TOCLOGOUT
|
||||
@ -724,4 +724,4 @@ sxsiope_err1:
|
||||
return(FAILURE);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -692,7 +692,7 @@ static BOOL dlglist_append(MENUDLG dlg, DLGHDL hdl, const OEMCHAR* arg) {
|
||||
if (barsize >= 8) {
|
||||
barsize *= hdl->c.dl.dispmax;
|
||||
barsize /= hdl->prmcnt;
|
||||
barsize = max(barsize, 6);
|
||||
barsize = np2max(barsize, 6);
|
||||
if (!hdl->c.dl.scrollbar) {
|
||||
dlglist_drawall(hdl);
|
||||
dlglist_setbtn(hdl, 0);
|
||||
|
@ -351,7 +351,7 @@ static BRESULT wndopenbase(MENUSYS *sys) {
|
||||
goto wopn0_err;
|
||||
}
|
||||
if (sys->style & MENUSTYLE_BOTTOM) {
|
||||
vram->posy = max(0, menuvram->height - height);
|
||||
vram->posy = np2max(0, menuvram->height - height);
|
||||
}
|
||||
menuvram_caption(vram, &mrect, sys->icon, sys->title);
|
||||
menubase_setrect(vram, NULL);
|
||||
@ -502,7 +502,7 @@ static BRESULT childopn(MENUSYS *sys, int depth, int pos) {
|
||||
wnd = sys->wnd + depth;
|
||||
if ((menu->flag & MENUS_CTRLMASK) == MENUS_POPUP) {
|
||||
parent.left = sys->popupx;
|
||||
parent.top = max(sys->popupy, wnd->vram->height);
|
||||
parent.top = np2max(sys->popupy, wnd->vram->height);
|
||||
parent.right = parent.left;
|
||||
parent.bottom = parent.top;
|
||||
dir = 0;
|
||||
@ -586,8 +586,8 @@ static BRESULT childopn(MENUSYS *sys, int depth, int pos) {
|
||||
parent.top = parent.bottom - height;
|
||||
}
|
||||
}
|
||||
wnd->vram->posx = min(parent.left, menubase.width - width);
|
||||
wnd->vram->posy = min(parent.top, menubase.height - height);
|
||||
wnd->vram->posx = np2min(parent.left, menubase.width - width);
|
||||
wnd->vram->posy = np2min(parent.top, menubase.height - height);
|
||||
wnd->items = items;
|
||||
wnd->focus = -1;
|
||||
sys->depth++;
|
||||
|
@ -160,7 +160,7 @@ const UINT8 *p;
|
||||
}
|
||||
}
|
||||
}
|
||||
c = min(cnt, width);
|
||||
c = np2min(cnt, width);
|
||||
cnt -= c;
|
||||
width -= c;
|
||||
if (pix) {
|
||||
@ -225,7 +225,7 @@ const UINT8 *p;
|
||||
}
|
||||
cnt += c;
|
||||
}
|
||||
c = min(cnt, width);
|
||||
c = np2min(cnt, width);
|
||||
cnt -= c;
|
||||
width -= c;
|
||||
if (!pix) {
|
||||
@ -378,7 +378,7 @@ const UINT8 *p;
|
||||
}
|
||||
}
|
||||
}
|
||||
c = min(cnt, width);
|
||||
c = np2min(cnt, width);
|
||||
cnt -= c;
|
||||
width -= c;
|
||||
if (pix) {
|
||||
@ -444,7 +444,7 @@ const UINT8 *p;
|
||||
}
|
||||
cnt += c;
|
||||
}
|
||||
c = min(cnt, width);
|
||||
c = np2min(cnt, width);
|
||||
cnt -= c;
|
||||
width -= c;
|
||||
if (!pix) {
|
||||
@ -585,7 +585,7 @@ static void vramlzxsolve(UINT8 *ptr, int size, const UINT8 *dat) {
|
||||
tmp |= *dat++;
|
||||
pos = -1 - (tmp >> level);
|
||||
leng = (tmp & mask) + 1;
|
||||
leng = min(leng, size);
|
||||
leng = np2min(leng, size);
|
||||
size -= leng;
|
||||
while(leng--) {
|
||||
*ptr = *(ptr + pos);
|
||||
|
@ -99,12 +99,12 @@ void vram_zerofill(VRAMHDL hdl, const RECT_T *rect) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
pos = max(rect->left, 0);
|
||||
pos = np2max(rect->left, 0);
|
||||
ptr = pos;
|
||||
width = min(rect->right, hdl->width) - pos;
|
||||
pos = max(rect->top, 0);
|
||||
width = np2min(rect->right, hdl->width) - pos;
|
||||
pos = np2max(rect->top, 0);
|
||||
ptr += pos * hdl->width;
|
||||
height = min(rect->bottom, hdl->height) - pos;
|
||||
height = np2min(rect->bottom, hdl->height) - pos;
|
||||
if ((width > 0) && (height > 0)) {
|
||||
p = hdl->ptr;
|
||||
p += ptr * hdl->xalign;
|
||||
@ -185,12 +185,12 @@ void vram_fill(VRAMHDL hdl, const RECT_T *rect, UINT32 color, UINT8 alpha) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
pos = max(rect->left, 0);
|
||||
pos = np2max(rect->left, 0);
|
||||
ptr = pos;
|
||||
width = min(rect->right, hdl->width) - pos;
|
||||
pos = max(rect->top, 0);
|
||||
width = np2min(rect->right, hdl->width) - pos;
|
||||
pos = np2max(rect->top, 0);
|
||||
ptr += pos * hdl->width;
|
||||
height = min(rect->bottom, hdl->height) - pos;
|
||||
height = np2min(rect->bottom, hdl->height) - pos;
|
||||
if ((width > 0) && (height > 0)) {
|
||||
p = hdl->ptr;
|
||||
p += ptr * hdl->xalign;
|
||||
@ -308,12 +308,12 @@ void vram_filldat(VRAMHDL hdl, const RECT_T *rect, UINT32 color) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
pos = max(rect->left, 0);
|
||||
pos = np2max(rect->left, 0);
|
||||
ptr = pos;
|
||||
width = min(rect->right, hdl->width) - pos;
|
||||
pos = max(rect->top, 0);
|
||||
width = np2min(rect->right, hdl->width) - pos;
|
||||
pos = np2max(rect->top, 0);
|
||||
ptr += pos * hdl->width;
|
||||
height = min(rect->bottom, hdl->height) - pos;
|
||||
height = np2min(rect->bottom, hdl->height) - pos;
|
||||
if ((width > 0) && (height > 0)) {
|
||||
p = hdl->ptr;
|
||||
p += ptr * hdl->xalign;
|
||||
@ -386,12 +386,12 @@ void vram_fillalpha(VRAMHDL hdl, const RECT_T *rect, UINT8 alpha) {
|
||||
FillMemory(hdl->alpha, hdl->scrnsize, alpha);
|
||||
}
|
||||
else {
|
||||
pos = max(rect->left, 0);
|
||||
pos = np2max(rect->left, 0);
|
||||
ptr = pos;
|
||||
width = min(rect->right, hdl->width) - pos;
|
||||
pos = max(rect->top, 0);
|
||||
width = np2min(rect->right, hdl->width) - pos;
|
||||
pos = np2max(rect->top, 0);
|
||||
ptr += pos * hdl->width;
|
||||
height = min(rect->bottom, hdl->height) - pos;
|
||||
height = np2min(rect->bottom, hdl->height) - pos;
|
||||
if ((width > 0) && (height > 0)) {
|
||||
p = hdl->alpha + ptr;
|
||||
remain = height;
|
||||
@ -463,12 +463,12 @@ void vram_fillex(VRAMHDL hdl, const RECT_T *rect, UINT32 color, UINT8 alpha) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
pos = max(rect->left, 0);
|
||||
pos = np2max(rect->left, 0);
|
||||
ptr = pos;
|
||||
width = min(rect->right, hdl->width) - pos;
|
||||
pos = max(rect->top, 0);
|
||||
width = np2min(rect->right, hdl->width) - pos;
|
||||
pos = np2max(rect->top, 0);
|
||||
ptr += pos * hdl->width;
|
||||
height = min(rect->bottom, hdl->height) - pos;
|
||||
height = np2min(rect->bottom, hdl->height) - pos;
|
||||
if ((width > 0) && (height > 0)) {
|
||||
p = hdl->ptr;
|
||||
p += ptr * hdl->xalign;
|
||||
@ -618,10 +618,10 @@ BRESULT vram_cliprect(RECT_T *clip, const VRAMHDL vram, const RECT_T *rct) {
|
||||
(rct->left >= vram->width) || (rct->top >= vram->height)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
clip->left = max(rct->left, 0);
|
||||
clip->top = max(rct->top, 0);
|
||||
clip->right = min(rct->right, vram->width);
|
||||
clip->bottom = min(rct->bottom, vram->height);
|
||||
clip->left = np2max(rct->left, 0);
|
||||
clip->top = np2max(rct->top, 0);
|
||||
clip->right = np2min(rct->right, vram->width);
|
||||
clip->bottom = np2min(rct->bottom, vram->height);
|
||||
if ((clip->top >= clip->bottom) || (clip->left >= clip->right)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
@ -637,10 +637,10 @@ BRESULT vram_cliprectex(RECT_T *clip, const VRAMHDL vram, const RECT_T *rct) {
|
||||
if (rct == NULL) {
|
||||
return(SUCCESS);
|
||||
}
|
||||
clip->left = max(clip->left, rct->left);
|
||||
clip->top = max(clip->top, rct->top);
|
||||
clip->right = min(clip->right, rct->right);
|
||||
clip->bottom = min(clip->bottom, rct->bottom);
|
||||
clip->left = np2max(clip->left, rct->left);
|
||||
clip->top = np2max(clip->top, rct->top);
|
||||
clip->right = np2min(clip->right, rct->right);
|
||||
clip->bottom = np2min(clip->bottom, rct->bottom);
|
||||
if ((clip->left >= clip->right) || (clip->top >= clip->bottom)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ static BRESULT cpyrect(MIX_RECT *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
}
|
||||
r->srcpos = 0;
|
||||
if (rct) {
|
||||
width = min(rct->right, src->width);
|
||||
width = np2min(rct->right, src->width);
|
||||
if (rct->left >= 0) {
|
||||
r->srcpos += rct->left;
|
||||
width -= rct->left;
|
||||
@ -37,7 +37,7 @@ static BRESULT cpyrect(MIX_RECT *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
else {
|
||||
p.x -= rct->left;
|
||||
}
|
||||
height = min(rct->bottom, src->height);
|
||||
height = np2min(rct->bottom, src->height);
|
||||
if (rct->top >= 0) {
|
||||
r->srcpos += rct->top * src->width;
|
||||
height -= rct->top;
|
||||
@ -52,10 +52,10 @@ static BRESULT cpyrect(MIX_RECT *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
}
|
||||
|
||||
r->dstpos = 0;
|
||||
r->width = min(width + p.x, dst->width);
|
||||
r->width = np2min(width + p.x, dst->width);
|
||||
if (p.x > 0) {
|
||||
r->dstpos += p.x;
|
||||
r->width = min(r->width, dst->width) - p.x;
|
||||
r->width = np2min(r->width, dst->width) - p.x;
|
||||
}
|
||||
else {
|
||||
r->srcpos -= p.x;
|
||||
@ -64,10 +64,10 @@ static BRESULT cpyrect(MIX_RECT *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
return(FAILURE);
|
||||
}
|
||||
|
||||
r->height = min(height + p.y, dst->height);
|
||||
r->height = np2min(height + p.y, dst->height);
|
||||
if (p.y > 0) {
|
||||
r->dstpos += p.y * dst->width;
|
||||
r->height = min(r->height, dst->height) - p.y;
|
||||
r->height = np2min(r->height, dst->height) - p.y;
|
||||
}
|
||||
else {
|
||||
r->srcpos -= p.y * src->width;
|
||||
@ -100,10 +100,10 @@ static BRESULT mixrect(MIX_RECT *r, const VRAMHDL dst, const RECT_T *rct,
|
||||
(rct->left >= dst->width) || (rct->top >= dst->height)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
s.left = max(rct->left, 0);
|
||||
s.top = max(rct->top, 0);
|
||||
s.right = min(rct->right, dst->width);
|
||||
s.bottom = min(rct->bottom, dst->height);
|
||||
s.left = np2max(rct->left, 0);
|
||||
s.top = np2max(rct->top, 0);
|
||||
s.right = np2min(rct->right, dst->width);
|
||||
s.bottom = np2min(rct->bottom, dst->height);
|
||||
if ((s.top >= s.bottom) || (s.left >= s.right)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
@ -117,11 +117,11 @@ static BRESULT mixrect(MIX_RECT *r, const VRAMHDL dst, const RECT_T *rct,
|
||||
}
|
||||
if (pos < 0) {
|
||||
r->srcpos -= pos * src->width;
|
||||
r->height = min(src->height + pos, s.bottom - s.top);
|
||||
r->height = np2min(src->height + pos, s.bottom - s.top);
|
||||
}
|
||||
else {
|
||||
r->dstpos += pos * dst->width;
|
||||
r->height = min(s.bottom - s.top - pos, src->height);
|
||||
r->height = np2min(s.bottom - s.top - pos, src->height);
|
||||
}
|
||||
if (r->height <= 0) {
|
||||
return(FAILURE);
|
||||
@ -133,11 +133,11 @@ static BRESULT mixrect(MIX_RECT *r, const VRAMHDL dst, const RECT_T *rct,
|
||||
}
|
||||
if (pos < 0) {
|
||||
r->srcpos -= pos;
|
||||
r->width = min(src->width + pos, s.right - s.left);
|
||||
r->width = np2min(src->width + pos, s.right - s.left);
|
||||
}
|
||||
else {
|
||||
r->dstpos += pos;
|
||||
r->width = min(s.right - s.left - pos, src->width);
|
||||
r->width = np2min(s.right - s.left - pos, src->width);
|
||||
}
|
||||
if (r->width <= 0) {
|
||||
return(FAILURE);
|
||||
@ -179,7 +179,7 @@ static BRESULT cpyrectex(MIXRECTEX *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
|
||||
r->srcpos = 0;
|
||||
if (rct) {
|
||||
width = min(rct->right, src->width);
|
||||
width = np2min(rct->right, src->width);
|
||||
if (rct->left >= 0) {
|
||||
r->srcpos += rct->left;
|
||||
width -= rct->left;
|
||||
@ -187,7 +187,7 @@ static BRESULT cpyrectex(MIXRECTEX *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
else {
|
||||
p.x -= rct->left;
|
||||
}
|
||||
height = min(rct->bottom, src->height);
|
||||
height = np2min(rct->bottom, src->height);
|
||||
if (rct->top >= 0) {
|
||||
r->srcpos += rct->top * src->width;
|
||||
height -= rct->top;
|
||||
@ -203,12 +203,12 @@ static BRESULT cpyrectex(MIXRECTEX *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
|
||||
r->orgpos = 0;
|
||||
r->dstpos = 0;
|
||||
dstwidth = min(dst->width, org->width);
|
||||
r->width = min(width + p.x, dstwidth);
|
||||
dstwidth = np2min(dst->width, org->width);
|
||||
r->width = np2min(width + p.x, dstwidth);
|
||||
if (p.x > 0) {
|
||||
r->orgpos += p.x;
|
||||
r->dstpos += p.x;
|
||||
r->width = min(r->width, dstwidth) - p.x;
|
||||
r->width = np2min(r->width, dstwidth) - p.x;
|
||||
}
|
||||
else {
|
||||
r->srcpos -= p.x;
|
||||
@ -217,12 +217,12 @@ static BRESULT cpyrectex(MIXRECTEX *r, const VRAMHDL dst, const POINT_T *pt,
|
||||
return(FAILURE);
|
||||
}
|
||||
|
||||
dstheight = min(dst->height, org->height);
|
||||
r->height = min(height + p.y, dstheight);
|
||||
dstheight = np2min(dst->height, org->height);
|
||||
r->height = np2min(height + p.y, dstheight);
|
||||
if (p.y > 0) {
|
||||
r->orgpos += p.y * org->width;
|
||||
r->dstpos += p.y * dst->width;
|
||||
r->height = min(r->height, dstheight) - p.y;
|
||||
r->height = np2min(r->height, dstheight) - p.y;
|
||||
}
|
||||
else {
|
||||
r->srcpos -= p.y * src->width;
|
||||
@ -245,8 +245,8 @@ static BRESULT mixrectex(MIXRECTEX *r, const VRAMHDL dst, const VRAMHDL org,
|
||||
(dst->bpp != org->bpp) || (dst->bpp != src->bpp)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
dstwidth = min(dst->width, org->width);
|
||||
dstheight = min(dst->height, org->height);
|
||||
dstwidth = np2min(dst->width, org->width);
|
||||
dstheight = np2min(dst->height, org->height);
|
||||
r->srcpos = 0;
|
||||
if (rct == NULL) {
|
||||
s.left = 0;
|
||||
@ -261,10 +261,10 @@ static BRESULT mixrectex(MIXRECTEX *r, const VRAMHDL dst, const VRAMHDL org,
|
||||
(rct->left >= dstwidth) || (rct->top >= dstheight)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
s.left = max(rct->left, 0);
|
||||
s.top = max(rct->top, 0);
|
||||
s.right = min(rct->right, dstwidth);
|
||||
s.bottom = min(rct->bottom, dstheight);
|
||||
s.left = np2max(rct->left, 0);
|
||||
s.top = np2max(rct->top, 0);
|
||||
s.right = np2min(rct->right, dstwidth);
|
||||
s.bottom = np2min(rct->bottom, dstheight);
|
||||
if ((s.top >= s.bottom) || (s.left >= s.right)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
@ -280,12 +280,12 @@ static BRESULT mixrectex(MIXRECTEX *r, const VRAMHDL dst, const VRAMHDL org,
|
||||
}
|
||||
if (pos < 0) {
|
||||
r->srcpos -= pos * src->width;
|
||||
r->height = min(src->height + pos, s.bottom - s.top);
|
||||
r->height = np2min(src->height + pos, s.bottom - s.top);
|
||||
}
|
||||
else {
|
||||
r->orgpos += pos * org->width;
|
||||
r->dstpos += pos * dst->width;
|
||||
r->height = min(s.bottom - s.top - pos, src->height);
|
||||
r->height = np2min(s.bottom - s.top - pos, src->height);
|
||||
}
|
||||
if (r->height <= 0) {
|
||||
return(FAILURE);
|
||||
@ -297,12 +297,12 @@ static BRESULT mixrectex(MIXRECTEX *r, const VRAMHDL dst, const VRAMHDL org,
|
||||
}
|
||||
if (pos < 0) {
|
||||
r->srcpos -= pos;
|
||||
r->width = min(src->width + pos, s.right - s.left);
|
||||
r->width = np2min(src->width + pos, s.right - s.left);
|
||||
}
|
||||
else {
|
||||
r->orgpos += pos;
|
||||
r->dstpos += pos;
|
||||
r->width = min(s.right - s.left - pos, src->width);
|
||||
r->width = np2min(s.right - s.left - pos, src->width);
|
||||
}
|
||||
if (r->width <= 0) {
|
||||
return(FAILURE);
|
||||
@ -983,10 +983,10 @@ const UINT8 *p;
|
||||
|
||||
do {
|
||||
p = pbase;
|
||||
ystep = min(mr->height, dot);
|
||||
ystep = np2min(mr->height, dot);
|
||||
x = mr->width;
|
||||
do {
|
||||
xstep = min(x, dot);
|
||||
xstep = np2min(x, dot);
|
||||
xstep2 = xstep * 2;
|
||||
q = qbase;
|
||||
yy = ystep;
|
||||
@ -1032,10 +1032,10 @@ const UINT8 *p;
|
||||
dstep = (dst->yalign * dot) - (mr->width * 2);
|
||||
|
||||
do {
|
||||
ystep = min(mr->height, dot);
|
||||
ystep = np2min(mr->height, dot);
|
||||
x = mr->width;
|
||||
do {
|
||||
xstep = min(x, dot);
|
||||
xstep = np2min(x, dot);
|
||||
xstep2 = xstep * 2;
|
||||
r = q;
|
||||
yy = ystep;
|
||||
@ -1647,10 +1647,10 @@ const UINT8 *p;
|
||||
|
||||
do {
|
||||
p = pbase;
|
||||
ystep = min(mr->height, dot);
|
||||
ystep = np2min(mr->height, dot);
|
||||
x = mr->width;
|
||||
do {
|
||||
xstep = min(x, dot);
|
||||
xstep = np2min(x, dot);
|
||||
xstep3 = xstep * 3;
|
||||
q = qbase;
|
||||
yy = ystep;
|
||||
@ -1696,10 +1696,10 @@ const UINT8 *p;
|
||||
dstep = (dst->yalign * dot) - (mr->width * 3);
|
||||
|
||||
do {
|
||||
ystep = min(mr->height, dot);
|
||||
ystep = np2min(mr->height, dot);
|
||||
x = mr->width;
|
||||
do {
|
||||
xstep = min(x, dot);
|
||||
xstep = np2min(x, dot);
|
||||
xstep3 = xstep * 3;
|
||||
r = q;
|
||||
yy = ystep;
|
||||
@ -2453,10 +2453,10 @@ static BRESULT txtrect(VRAMHDL dst, const FNTDAT fnt, const POINT_T *pt,
|
||||
pos = pt->y - rct->top;
|
||||
if (pos < 0) {
|
||||
r->srcpos -= pos * fnt->width;
|
||||
r->height = min(fnt->height + pos, rct->bottom - rct->top);
|
||||
r->height = np2min(fnt->height + pos, rct->bottom - rct->top);
|
||||
}
|
||||
else {
|
||||
r->height = min(rct->bottom - rct->top - pos, fnt->height);
|
||||
r->height = np2min(rct->bottom - rct->top - pos, fnt->height);
|
||||
}
|
||||
if (r->height <= 0) {
|
||||
return(FAILURE);
|
||||
@ -2465,10 +2465,10 @@ static BRESULT txtrect(VRAMHDL dst, const FNTDAT fnt, const POINT_T *pt,
|
||||
pos = pt->x - rct->left;
|
||||
if (pos < 0) {
|
||||
r->srcpos -= pos;
|
||||
r->width = min(fnt->width + pos, rct->right - rct->left);
|
||||
r->width = np2min(fnt->width + pos, rct->right - rct->left);
|
||||
}
|
||||
else {
|
||||
r->width = min(rct->right - rct->left - pos, fnt->width);
|
||||
r->width = np2min(rct->right - rct->left - pos, fnt->width);
|
||||
}
|
||||
if (r->width <= 0) {
|
||||
return(FAILURE);
|
||||
|
@ -46,7 +46,7 @@ static BRESULT writezero(FILEH fh, FILELEN size) {
|
||||
|
||||
ZeroMemory(work, sizeof(work));
|
||||
while(size) {
|
||||
wsize = min(size, sizeof(work));
|
||||
wsize = np2min(size, sizeof(work));
|
||||
if (file_write(fh, work, (UINT)wsize) != wsize) {
|
||||
return(FAILURE);
|
||||
}
|
||||
@ -78,7 +78,7 @@ static BRESULT writehddiplex2(FILEH fh, UINT ssize, FILELEN tsize, int blank, in
|
||||
tsize -= sizeof(work);
|
||||
ZeroMemory(work, sizeof(work));
|
||||
while(tsize) {
|
||||
size = min(tsize, sizeof(work));
|
||||
size = np2min(tsize, sizeof(work));
|
||||
tsize -= size;
|
||||
if (file_write(fh, work, (UINT)size) != size) {
|
||||
return(FAILURE);
|
||||
|
@ -210,7 +210,7 @@ static REG8 sec2048_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
return(0xd0);
|
||||
}
|
||||
while(size) {
|
||||
rsize = min(size, 2048);
|
||||
rsize = np2min(size, 2048);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -273,7 +273,7 @@ static REG8 sec2352_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
if (file_seek(fh, fpos, FSEEK_SET) != fpos) {
|
||||
return(0xd0);
|
||||
}
|
||||
rsize = min(size, 2048);
|
||||
rsize = np2min(size, 2048);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -359,7 +359,7 @@ static BRESULT openimg(SXSIDEV sxsi, const OEMCHAR *path,
|
||||
cdinfo->fh = fh;
|
||||
cdinfo->type = type;
|
||||
if ((trk != NULL) && (trks != 0)) {
|
||||
trks = min(trks, NELEMENTS(cdinfo->trk) - 1);
|
||||
trks = np2min(trks, NELEMENTS(cdinfo->trk) - 1);
|
||||
CopyMemory(cdinfo->trk, trk, trks * sizeof(_CDTRK));
|
||||
}
|
||||
else {
|
||||
|
@ -58,7 +58,7 @@ static REG8 hdd_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size) {
|
||||
return(0xd0);
|
||||
}
|
||||
while(size) {
|
||||
rsize = min(size, sxsi->size);
|
||||
rsize = np2min(size, sxsi->size);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
if (file_read(fh, buf, rsize) != rsize) {
|
||||
return(0xd0);
|
||||
@ -88,7 +88,7 @@ static REG8 hdd_write(SXSIDEV sxsi, FILEPOS pos, const UINT8 *buf, UINT size) {
|
||||
return(0xd0);
|
||||
}
|
||||
while(size) {
|
||||
wsize = min(size, sxsi->size);
|
||||
wsize = np2min(size, sxsi->size);
|
||||
CPU_REMCLOCK -= wsize;
|
||||
if (file_write(fh, buf, wsize) != wsize) {
|
||||
return(0x70);
|
||||
@ -124,7 +124,7 @@ static REG8 hdd_format(SXSIDEV sxsi, FILEPOS pos) {
|
||||
for (i=0; i<sxsi->sectors; i++) {
|
||||
size = sxsi->size;
|
||||
while(size) {
|
||||
wsize = min(size, sizeof(work));
|
||||
wsize = np2min(size, sizeof(work));
|
||||
size -= wsize;
|
||||
CPU_REMCLOCK -= wsize;
|
||||
if (file_write(fh, work, wsize) != wsize) {
|
||||
|
@ -128,7 +128,7 @@ static REG8 hdd_read(SXSIDEV sxsi, FILEPOS pos, UINT8 *buf, UINT size)
|
||||
{
|
||||
UINT rsize;
|
||||
|
||||
rsize = min(size, sxsi->size);
|
||||
rsize = np2min(size, sxsi->size);
|
||||
CPU_REMCLOCK -= rsize;
|
||||
|
||||
if (!(*p->f4)(p->pv, pos, rsize, buf))
|
||||
@ -164,7 +164,7 @@ static REG8 hdd_write(SXSIDEV sxsi, FILEPOS pos, const UINT8 *buf, UINT size)
|
||||
{
|
||||
UINT wsize;
|
||||
|
||||
wsize = min(size, sxsi->size);
|
||||
wsize = np2min(size, sxsi->size);
|
||||
CPU_REMCLOCK -= wsize;
|
||||
|
||||
if (!(*p->f5)(p->pv, pos, wsize, buf))
|
||||
@ -208,7 +208,7 @@ static REG8 hdd_format(SXSIDEV sxsi, FILEPOS pos)
|
||||
{
|
||||
UINT wsize;
|
||||
|
||||
wsize = min(size, sizeof(work));
|
||||
wsize = np2min(size, sizeof(work));
|
||||
size -= wsize;
|
||||
CPU_REMCLOCK -= wsize;
|
||||
|
||||
@ -294,4 +294,4 @@ sxsiope_err:
|
||||
return (FAILURE);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -156,8 +156,8 @@ const UINT8 *p;
|
||||
dat = fontmng_get(fnt, work);
|
||||
#endif
|
||||
if (dat) {
|
||||
width = min(dat->width, 8);
|
||||
height = min(dat->height, 16);
|
||||
width = np2min(dat->width, 8);
|
||||
height = np2min(dat->height, 16);
|
||||
p = (UINT8 *)(dat + 1);
|
||||
q = ptr;
|
||||
while(height > 0) {
|
||||
@ -231,8 +231,8 @@ const UINT8 *p;
|
||||
dat = fontmng_get(fnt, work);
|
||||
#endif
|
||||
if (dat) {
|
||||
width = min(dat->width, 16);
|
||||
height = min(dat->height, 16);
|
||||
width = np2min(dat->width, 16);
|
||||
height = np2min(dat->height, 16);
|
||||
p = (UINT8 *)(dat + 1);
|
||||
q = ptr;
|
||||
while(height > 0) {
|
||||
|
@ -340,7 +340,7 @@ const UINT8 *palptr;
|
||||
(bmpdata_getinfo(bi, &inf) != SUCCESS) || (inf.bpp != 4)) {
|
||||
return(FAILURE);
|
||||
}
|
||||
pals = min(LOADINTELDWORD(bi->biClrUsed), 16);
|
||||
pals = np2min(LOADINTELDWORD(bi->biClrUsed), 16);
|
||||
|
||||
src = (UINT8 *)bf + (LOADINTELDWORD(bf->bfOffBits));
|
||||
bmpalign = bmpdata_getalign(bi);
|
||||
|
@ -327,7 +327,7 @@ static BRESULT read_data(UINT num, UINT32 pos, UINT size, UINT seg, UINT off) {
|
||||
return(FAILURE);
|
||||
}
|
||||
while(size) {
|
||||
r = min(size, sizeof(work));
|
||||
r = np2min(size, sizeof(work));
|
||||
if (file_read(fh, work, r) != r) {
|
||||
return(FAILURE);
|
||||
}
|
||||
@ -358,7 +358,7 @@ static BRESULT write_data(UINT num, UINT32 pos, UINT size, UINT seg, UINT off) {
|
||||
}
|
||||
else {
|
||||
do {
|
||||
r = min(size, sizeof(work));
|
||||
r = np2min(size, sizeof(work));
|
||||
MEMR_READS(seg, off, work, r);
|
||||
if (file_write(fh, work, r) != r) {
|
||||
return(FAILURE);
|
||||
|
@ -371,7 +371,7 @@ static UINT8 GetOpnaNote(const OPNACTL *k, UINT16 wFNum)
|
||||
}
|
||||
|
||||
nKey += nOct * 12;
|
||||
return (int)(min(nKey, 127));
|
||||
return (int)(np2min(nKey, 127));
|
||||
}
|
||||
|
||||
static void opnakeyoff(KEYDISP *keydisp, OPNACTL *k, UINT nChannel)
|
||||
@ -540,7 +540,7 @@ static UINT8 GetPSGNote(const PSGCTL *k, UINT16 nTone)
|
||||
{
|
||||
}
|
||||
nKey += nOct * 12;
|
||||
return (int)(min(nKey, 127));
|
||||
return (int)(np2min(nKey, 127));
|
||||
}
|
||||
|
||||
static void psgmix(KEYDISP *keydisp, PSGCTL *k)
|
||||
@ -704,7 +704,7 @@ static UINT8 GetOpl3Note(const OPL3CTL *k, UINT16 wFNum)
|
||||
}
|
||||
|
||||
nKey += nOct * 12;
|
||||
return (int)(min(nKey, 127));
|
||||
return (int)(np2min(nKey, 127));
|
||||
}
|
||||
|
||||
static void opl3keyoff(KEYDISP *keydisp, OPL3CTL *k, UINT nChannel)
|
||||
@ -970,7 +970,7 @@ static UINT getdispkeys(const KEYDISP *keydisp)
|
||||
keys = 0;
|
||||
break;
|
||||
}
|
||||
return min(keys, KEYDISP_CHMAX);
|
||||
return np2min(keys, KEYDISP_CHMAX);
|
||||
}
|
||||
|
||||
static void clearrect(CMNVRAM *vram, int x, int y, int cx, int cy)
|
||||
@ -1296,7 +1296,7 @@ BOOL keydisp_paint(CMNVRAM *vram, BOOL redraw)
|
||||
}
|
||||
vram->ptr += vram->xalign + vram->yalign;
|
||||
keys = (vram->height - 1) / KEYDISP_KEYCY;
|
||||
keys = min(keys, getdispkeys(&s_keydisp));
|
||||
keys = np2min(keys, getdispkeys(&s_keydisp));
|
||||
for (i = 0, p = s_keydisp.ch; i < keys; i++, p++)
|
||||
{
|
||||
draw |= draw1ch(vram, s_keydisp.framepast, p);
|
||||
|
@ -52,7 +52,7 @@ static void info_cpu(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) {
|
||||
UINT family;
|
||||
|
||||
#if defined(CPU_FAMILY)
|
||||
family = min(CPU_FAMILY, 6);
|
||||
family = np2min(CPU_FAMILY, 6);
|
||||
#else
|
||||
family = (CPU_TYPE & CPUTYPE_V30)?1:2;
|
||||
#endif
|
||||
|
@ -209,7 +209,7 @@ void i286c_setextsize(UINT32 size) {
|
||||
CPU_EXTMEM = extmem;
|
||||
CPU_EXTMEMSIZE = size;
|
||||
CPU_EXTMEMBASE = CPU_EXTMEM - 0x100000;
|
||||
CPU_EXTLIMIT16 = min(size + 0x100000, 0xf00000);
|
||||
CPU_EXTLIMIT16 = np2min(size + 0x100000, 0xf00000);
|
||||
#if defined(CPU_EXTLIMIT)
|
||||
CPU_EXTLIMIT = size + 0x100000;
|
||||
#endif
|
||||
|
@ -261,7 +261,7 @@ I286FN v30shift_ea8_data8(void) { // C0: shift EA8, DATA8
|
||||
}
|
||||
}
|
||||
else {
|
||||
cl = max(cl, 9);
|
||||
cl = np2max(cl, 9);
|
||||
}
|
||||
sft_e8cl_table[(op >> 3) & 7](madr, cl);
|
||||
return;
|
||||
@ -279,7 +279,7 @@ I286FN v30shift_ea8_data8(void) { // C0: shift EA8, DATA8
|
||||
}
|
||||
}
|
||||
else {
|
||||
cl = max(cl, 9);
|
||||
cl = np2max(cl, 9);
|
||||
}
|
||||
sft_r8cl_table[(op >> 3) & 7](out, cl);
|
||||
}
|
||||
@ -311,7 +311,7 @@ I286FN v30shift_ea16_data8(void) { // C1: shift EA16, DATA8
|
||||
}
|
||||
}
|
||||
else { // shift
|
||||
cl = max(cl, 17);
|
||||
cl = np2max(cl, 17);
|
||||
}
|
||||
sft_e16cl_table[(op >> 3) & 7](madr, cl);
|
||||
return;
|
||||
@ -329,7 +329,7 @@ I286FN v30shift_ea16_data8(void) { // C1: shift EA16, DATA8
|
||||
}
|
||||
}
|
||||
else { // shift
|
||||
cl = max(cl, 17);
|
||||
cl = np2max(cl, 17);
|
||||
}
|
||||
sft_r16cl_table[(op >> 3) & 7](out, cl);
|
||||
}
|
||||
@ -385,7 +385,7 @@ I286FN v30shift_ea8_cl(void) { // D2: shift EA8, cl
|
||||
}
|
||||
}
|
||||
else {
|
||||
cl = max(cl, 9);
|
||||
cl = np2max(cl, 9);
|
||||
}
|
||||
sft_e8cl_table[(op >> 3) & 7](madr, cl);
|
||||
return;
|
||||
@ -403,7 +403,7 @@ I286FN v30shift_ea8_cl(void) { // D2: shift EA8, cl
|
||||
}
|
||||
}
|
||||
else {
|
||||
cl = max(cl, 9);
|
||||
cl = np2max(cl, 9);
|
||||
}
|
||||
sft_r8cl_table[(op >> 3) & 7](out, cl);
|
||||
}
|
||||
@ -435,7 +435,7 @@ I286FN v30shift_ea16_cl(void) { // D3: shift EA16, cl
|
||||
}
|
||||
}
|
||||
else { // shift
|
||||
cl = max(cl, 17);
|
||||
cl = np2max(cl, 17);
|
||||
}
|
||||
sft_e16cl_table[(op >> 3) & 7](madr, cl);
|
||||
return;
|
||||
@ -453,7 +453,7 @@ I286FN v30shift_ea16_cl(void) { // D3: shift EA16, cl
|
||||
}
|
||||
}
|
||||
else { // shift
|
||||
cl = max(cl, 17);
|
||||
cl = np2max(cl, 17);
|
||||
}
|
||||
sft_r16cl_table[(op >> 3) & 7](out, cl);
|
||||
}
|
||||
|
@ -1069,7 +1069,7 @@ void MEMCALL meml_reads(UINT32 address, void *dat, UINT leng) {
|
||||
else {
|
||||
while(leng) {
|
||||
size = 0x1000 - (address & 0xfff);
|
||||
size = min(size, leng);
|
||||
size = np2min(size, leng);
|
||||
memp_reads(physicaladdr(address, FALSE), dat, size);
|
||||
address += size;
|
||||
dat = ((UINT8 *)dat) + size;
|
||||
@ -1088,7 +1088,7 @@ void MEMCALL meml_writes(UINT32 address, const void *dat, UINT leng) {
|
||||
else {
|
||||
while(leng) {
|
||||
size = 0x1000 - (address & 0xfff);
|
||||
size = min(size, leng);
|
||||
size = np2min(size, leng);
|
||||
memp_writes(physicaladdr(address, TRUE), dat, size);
|
||||
address += size;
|
||||
dat = ((UINT8 *)dat) + size;
|
||||
@ -1161,10 +1161,10 @@ void MEMCALL memr_reads(UINT seg, UINT off, void *dat, UINT leng) {
|
||||
off = LOW16(off);
|
||||
addr = (seg << 4) + off;
|
||||
rem = 0x10000 - off;
|
||||
size = min(leng, rem);
|
||||
size = np2min(leng, rem);
|
||||
if (CPU_STAT_PAGING) {
|
||||
rem = 0x1000 - (addr & 0xfff);
|
||||
size = min(size, rem);
|
||||
size = np2min(size, rem);
|
||||
addr = physicaladdr(addr, FALSE);
|
||||
}
|
||||
memp_reads(addr, dat, size);
|
||||
@ -1184,10 +1184,10 @@ void MEMCALL memr_writes(UINT seg, UINT off, const void *dat, UINT leng) {
|
||||
off = LOW16(off);
|
||||
addr = (seg << 4) + off;
|
||||
rem = 0x10000 - off;
|
||||
size = min(leng, rem);
|
||||
size = np2min(leng, rem);
|
||||
if (CPU_STAT_PAGING) {
|
||||
rem = 0x1000 - (addr & 0xfff);
|
||||
size = min(size, rem);
|
||||
size = np2min(size, rem);
|
||||
addr = physicaladdr(addr, TRUE);
|
||||
}
|
||||
memp_writes(addr, dat, size);
|
||||
|
@ -93,7 +93,7 @@ ia32_setextsize(UINT32 size)
|
||||
CPU_EXTMEM = extmem;
|
||||
CPU_EXTMEMSIZE = size;
|
||||
CPU_EXTMEMBASE = CPU_EXTMEM - 0x100000;
|
||||
CPU_EXTLIMIT16 = min(size + 0x100000, 0xf00000);
|
||||
CPU_EXTLIMIT16 = np2min(size + 0x100000, 0xf00000);
|
||||
CPU_EXTLIMIT = size + 0x100000;
|
||||
}
|
||||
else {
|
||||
|
@ -91,7 +91,7 @@ UINT dmac_getdatas(DMACH dmach, UINT8 *buf, UINT size) {
|
||||
UINT32 addr;
|
||||
UINT i;
|
||||
|
||||
leng = min(dmach->leng.w, size);
|
||||
leng = np2min(dmach->leng.w, size);
|
||||
if (leng) {
|
||||
addr = dmach->adrs.d; // + mask
|
||||
if (!(dmach->mode & 0x20)) { // dir +
|
||||
@ -431,4 +431,4 @@ void dmac_detach(REG8 device) {
|
||||
//if (ch < 5)
|
||||
dmacset(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ void keystat_tblset(REG8 ref, const UINT8 *key, UINT cnt) {
|
||||
|
||||
if ((ref >= NKEY_USER) && (ref < (NKEY_USER + NKEY_USERKEYS))) {
|
||||
nkey = (NKEYM *)(nkeytbl.user + (ref - NKEY_USER));
|
||||
cnt = min(cnt, 15);
|
||||
cnt = np2min(cnt, 15);
|
||||
}
|
||||
else if (ref < NKEY_SYSTEM) {
|
||||
nkey = (NKEYM *)(nkeytbl.key + ref);
|
||||
cnt = min(cnt, 3);
|
||||
cnt = np2min(cnt, 3);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
@ -600,4 +600,4 @@ void keystat_forcerelease(REG8 data) {
|
||||
|
||||
keycode = cnvnewcode((REG8)(data & 0x7f));
|
||||
keystat_releasekey(keycode);
|
||||
}
|
||||
}
|
||||
|
10
lio/gline.c
10
lio/gline.c
@ -126,7 +126,7 @@ static void gline(const _GLIO *lio, const LINEPT *lp, UINT16 pat) {
|
||||
if (d2 < 0) {
|
||||
d2 = 0 - d2;
|
||||
}
|
||||
d1 = max(d1, d2) & 15;
|
||||
d1 = np2max(d1, d2) & 15;
|
||||
pat = (UINT16)((pat >> d1) | (pat << (16 - d1)));
|
||||
|
||||
csrw = (y1 * 40) + (x1 >> 4) + ((x1 & 0xf) << 20);
|
||||
@ -213,10 +213,10 @@ static void gbox(const _GLIO *lio, const LINEPT *lp, UINT8 *tile, UINT leng) {
|
||||
(y1 > lio->draw.y2) || (y2 < lio->draw.y1)) {
|
||||
return;
|
||||
}
|
||||
x1 = max(x1, lio->draw.x1);
|
||||
y1 = max(y1, lio->draw.y1);
|
||||
x2 = min(x2, lio->draw.x2);
|
||||
y2 = min(y2, lio->draw.y2);
|
||||
x1 = np2max(x1, lio->draw.x1);
|
||||
y1 = np2max(y1, lio->draw.y1);
|
||||
x2 = np2min(x2, lio->draw.x2);
|
||||
y2 = np2min(y2, lio->draw.y2);
|
||||
|
||||
csrw = 0;
|
||||
if (lio->draw.flag & LIODRAW_UPPER) {
|
||||
|
@ -148,13 +148,13 @@ void lio_updatedraw(GLIO lio) {
|
||||
lio->draw.palmax = 1 << colorbit;
|
||||
|
||||
tmp = (SINT16)LOADINTELWORD(lio->work.viewx1);
|
||||
lio->draw.x1 = max(tmp, 0);
|
||||
lio->draw.x1 = np2max(tmp, 0);
|
||||
tmp = (SINT16)LOADINTELWORD(lio->work.viewy1);
|
||||
lio->draw.y1 = max(tmp, 0);
|
||||
lio->draw.y1 = np2max(tmp, 0);
|
||||
tmp = (SINT16)LOADINTELWORD(lio->work.viewx2);
|
||||
lio->draw.x2 = min(tmp, 639);
|
||||
lio->draw.x2 = np2min(tmp, 639);
|
||||
tmp = (SINT16)LOADINTELWORD(lio->work.viewy2);
|
||||
lio->draw.y2 = min(tmp, maxline);
|
||||
lio->draw.y2 = np2min(tmp, maxline);
|
||||
if (!gdcs.access) {
|
||||
lio->draw.base = 0;
|
||||
lio->draw.bank = 0;
|
||||
|
4
pccore.c
4
pccore.c
@ -216,9 +216,9 @@ static void pccore_set(const NP2CFG *pConfig)
|
||||
{
|
||||
extsize = np2cfg.EXTMEM;
|
||||
#if defined(CPUCORE_IA32)
|
||||
extsize = min(extsize, 230);
|
||||
extsize = np2min(extsize, 230);
|
||||
#else
|
||||
extsize = min(extsize, 13);
|
||||
extsize = np2min(extsize, 13);
|
||||
#endif
|
||||
}
|
||||
pccore.extmem = extsize;
|
||||
|
@ -58,11 +58,11 @@ typedef unsigned char BOOL;
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
@ -289,7 +289,7 @@ static void AnkSetFontHeader(FNTMNG _this, FNTDAT fdat, int width)
|
||||
}
|
||||
else
|
||||
{
|
||||
fdat->width = max(width, _this->fontsize >> 1);
|
||||
fdat->width = np2max(width, _this->fontsize >> 1);
|
||||
fdat->pitch = (_this->fontsize >> 1) + 1;
|
||||
fdat->height = _this->fontsize;
|
||||
}
|
||||
@ -372,8 +372,8 @@ static void TTFSetFontHeader(FNTMNG _this, FNTDAT fdat, const SDL_Surface *s)
|
||||
|
||||
if (s)
|
||||
{
|
||||
width = min(s->w, _this->ptsize);
|
||||
height = min(s->h, _this->ptsize);
|
||||
width = np2min(s->w, _this->ptsize);
|
||||
height = np2min(s->h, _this->ptsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -621,7 +621,7 @@ BRESULT fontmng_getdrawsize(void *hdl, const char *lpString, POINT_T *pt)
|
||||
break;
|
||||
}
|
||||
GetLength1(_this, &fontData, c);
|
||||
nWidth = nPosX + max(fontData.width, fontData.pitch);
|
||||
nWidth = nPosX + np2max(fontData.width, fontData.pitch);
|
||||
nPosX += fontData.pitch;
|
||||
}
|
||||
if (pt)
|
||||
|
@ -57,11 +57,11 @@ typedef signed char BOOL;
|
||||
#define MAX_PATH 256
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ZeroMemory
|
||||
|
@ -107,11 +107,11 @@ typedef signed char TCHAR;
|
||||
#define MAX_PATH 4096
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ZeroMemory
|
||||
|
@ -75,23 +75,23 @@ static BRESULT calcdrawrect(SDL_Surface *surface,
|
||||
dr->width = scrnsurf.width;
|
||||
dr->height = scrnsurf.height;
|
||||
#else /* __LIBRETRO__ */
|
||||
dr->width = max(scrnmng.width, s->width);
|
||||
dr->height = max(scrnmng.height, s->height);
|
||||
dr->width = np2max(scrnmng.width, s->width);
|
||||
dr->height = np2max(scrnmng.height, s->height);
|
||||
#endif /* __LIBRETRO__ */
|
||||
if (rt) {
|
||||
pos = max(rt->left, 0);
|
||||
pos = np2max(rt->left, 0);
|
||||
dr->srcpos += pos;
|
||||
dr->dstpos += pos * dr->xalign;
|
||||
dr->width = min(rt->right, dr->width) - pos;
|
||||
dr->width = np2min(rt->right, dr->width) - pos;
|
||||
|
||||
pos = max(rt->top, 0);
|
||||
pos = np2max(rt->top, 0);
|
||||
#if defined(__LIBRETRO__)
|
||||
dr->srcpos += pos * scrnsurf.width;
|
||||
#else /* __LIBRETRO__ */
|
||||
dr->srcpos += pos * s->width;
|
||||
#endif /* __LIBRETRO__ */
|
||||
dr->dstpos += pos * dr->yalign;
|
||||
dr->height = min(rt->bottom, dr->height) - pos;
|
||||
dr->height = np2min(rt->bottom, dr->height) - pos;
|
||||
}
|
||||
if ((dr->width <= 0) || (dr->height <= 0)) {
|
||||
return(FAILURE);
|
||||
@ -344,8 +344,8 @@ const SCRNSURF *scrnmng_surflock(void) {
|
||||
scrnsurf.yalign = scrnmng.vram->yalign;
|
||||
scrnsurf.bpp = scrnmng.vram->bpp;
|
||||
}
|
||||
scrnsurf.width = max(scrnstat.width, 640);
|
||||
scrnsurf.height = max(scrnstat.height, 400);
|
||||
scrnsurf.width = np2max(scrnstat.width, 640);
|
||||
scrnsurf.height = np2max(scrnstat.height, 400);
|
||||
scrnsurf.extend = 0;
|
||||
return(&scrnsurf);
|
||||
#endif /* __LIBRETRO__ */
|
||||
@ -359,8 +359,8 @@ static void draw_onmenu(void) {
|
||||
|
||||
rt.left = 0;
|
||||
rt.top = 0;
|
||||
rt.right = min(scrnsurf.width, 640);
|
||||
rt.bottom = min(scrnsurf.height, 400);
|
||||
rt.right = np2min(scrnsurf.width, 640);
|
||||
rt.bottom = np2min(scrnsurf.height, 400);
|
||||
|
||||
if (calcdrawrect( &dr, &rt) == SUCCESS)
|
||||
draw(dr);
|
||||
@ -377,8 +377,8 @@ const UINT8 *a;
|
||||
|
||||
rt.left = 0;
|
||||
rt.top = 0;
|
||||
rt.right = min(scrnstat.width, 640);
|
||||
rt.bottom = min(scrnstat.height, 400);
|
||||
rt.right = np2min(scrnstat.width, 640);
|
||||
rt.bottom = np2min(scrnstat.height, 400);
|
||||
#if defined(NP2_SIZE_QVGA)
|
||||
rt.right >>= 1;
|
||||
rt.bottom >>= 1;
|
||||
|
@ -1237,7 +1237,7 @@ sdlaudio_callback(void *userdata, unsigned char *stream, int len)
|
||||
int length;
|
||||
const SINT32 *src;
|
||||
|
||||
length = min(len, (int)(SNDSZ * 2 * sizeof(SINT16)));
|
||||
length = np2min(len, (int)(SNDSZ * 2 * sizeof(SINT16)));
|
||||
src = sound_pcmlock();
|
||||
if (src) {
|
||||
satuation_s16(soundbuf, src, length);
|
||||
|
@ -84,11 +84,11 @@ typedef unsigned short WORD;
|
||||
#define MAX_PATH MAXPATHLEN
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ZeroMemory
|
||||
|
@ -104,11 +104,11 @@ typedef SINT32 FILELEN;
|
||||
#include "lstarray.h"
|
||||
#include "trace.h"
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ZeroMemory
|
||||
|
@ -107,7 +107,7 @@ ssize_t CTty::Read(LPVOID lpcvData, ssize_t nDataSize)
|
||||
return -1;
|
||||
}
|
||||
|
||||
DWORD dwReadLength = min(stat.cbInQue, static_cast<DWORD>(nDataSize));
|
||||
DWORD dwReadLength = np2min(stat.cbInQue, static_cast<DWORD>(nDataSize));
|
||||
if (dwReadLength == 0)
|
||||
{
|
||||
return 0;
|
||||
|
@ -265,7 +265,7 @@ void SOUNDCALL adpcm_getpcm(ADPCM ad, SINT32 *pcm, UINT count) {
|
||||
if (ad->play == 0) {
|
||||
goto adpcmstop;
|
||||
}
|
||||
samp += ad->out0 * min(remain, ad->pertim);
|
||||
samp += ad->out0 * np2min(remain, ad->pertim);
|
||||
remain -= ad->pertim;
|
||||
} while(remain > 0);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ const BPEVENT *bev;
|
||||
do {
|
||||
if (clk >= (1 << 16)) {
|
||||
r = clk >> 16;
|
||||
r = min(r, count);
|
||||
r = np2min(r, count);
|
||||
clk -= r << 16;
|
||||
count -= r;
|
||||
if (bp->lastenable) {
|
||||
|
@ -52,7 +52,7 @@ const UINT8 *ptr2;
|
||||
pos12 += cs->step12;
|
||||
} while(--count);
|
||||
|
||||
leng = min(leng, (pos12 >> 12));
|
||||
leng = np2min(leng, (pos12 >> 12));
|
||||
cs->bufdatas -= (leng << 0);
|
||||
cs->bufpos = (cs->bufpos + (leng << 0)) & CS4231_BUFMASK;
|
||||
cs->pos12 = pos12 & ((1 << 12) - 1);
|
||||
@ -97,7 +97,7 @@ const UINT8 *ptr2;
|
||||
pos12 += cs->step12;
|
||||
} while(--count);
|
||||
|
||||
leng = min(leng, (pos12 >> 12));
|
||||
leng = np2min(leng, (pos12 >> 12));
|
||||
cs->bufdatas -= (leng << 1);
|
||||
cs->bufpos = (cs->bufpos + (leng << 1)) & CS4231_BUFMASK;
|
||||
cs->pos12 = pos12 & ((1 << 12) - 1);
|
||||
@ -139,7 +139,7 @@ const UINT8 *ptr2;
|
||||
pos12 += cs->step12;
|
||||
} while(--count);
|
||||
|
||||
leng = min(leng, (pos12 >> 12));
|
||||
leng = np2min(leng, (pos12 >> 12));
|
||||
cs->bufdatas -= (leng << 1);
|
||||
cs->bufpos = (cs->bufpos + (leng << 1)) & CS4231_BUFMASK;
|
||||
cs->pos12 = pos12 & ((1 << 12) - 1);
|
||||
@ -184,7 +184,7 @@ const UINT8 *ptr2;
|
||||
pos12 += cs->step12;
|
||||
} while(--count);
|
||||
|
||||
leng = min(leng, (pos12 >> 12));
|
||||
leng = np2min(leng, (pos12 >> 12));
|
||||
cs->bufdatas -= (leng << 2);
|
||||
cs->bufpos = (cs->bufpos + (leng << 2)) & CS4231_BUFMASK;
|
||||
cs->pos12 = pos12 & ((1 << 12) - 1);
|
||||
@ -226,7 +226,7 @@ const UINT8 *ptr2;
|
||||
pos12 += cs->step12;
|
||||
} while(--count);
|
||||
|
||||
leng = min(leng, (pos12 >> 12));
|
||||
leng = np2min(leng, (pos12 >> 12));
|
||||
cs->bufdatas -= (leng << 1);
|
||||
cs->bufpos = (cs->bufpos + (leng << 1)) & CS4231_BUFMASK;
|
||||
cs->pos12 = pos12 & ((1 << 12) - 1);
|
||||
@ -271,7 +271,7 @@ const UINT8 *ptr2;
|
||||
pos12 += cs->step12;
|
||||
} while(--count);
|
||||
|
||||
leng = min(leng, (pos12 >> 12));
|
||||
leng = np2min(leng, (pos12 >> 12));
|
||||
cs->bufdatas -= (leng << 2);
|
||||
cs->bufpos = (cs->bufpos + (leng << 2)) & CS4231_BUFMASK;
|
||||
cs->pos12 = pos12 & ((1 << 12) - 1);
|
||||
|
@ -34,7 +34,7 @@ static _SMP_OUT *FUNC_NOR(GETSND trk, _SMP_OUT *pcm, _SMP_OUT *pcmterm) {
|
||||
_SMP_IN *samp;
|
||||
UINT size;
|
||||
|
||||
size = min(trk->remain, (UINT)(pcmterm - pcm));
|
||||
size = np2min(trk->remain, (UINT)(pcmterm - pcm));
|
||||
trk->remain -= size;
|
||||
samp = (_SMP_IN *)trk->buf;
|
||||
do {
|
||||
|
@ -34,7 +34,7 @@ static _SMP_OUT *FUNC_NOR(GETSND trk, _SMP_OUT *pcm, _SMP_OUT *pcmterm) {
|
||||
_SMP_IN *samp;
|
||||
UINT size;
|
||||
|
||||
size = min(trk->remain, (UINT)((pcmterm - pcm) / 2));
|
||||
size = np2min(trk->remain, (UINT)((pcmterm - pcm) / 2));
|
||||
trk->remain -= size;
|
||||
samp = (_SMP_IN *)trk->buf;
|
||||
do {
|
||||
|
@ -75,7 +75,7 @@ static UINT pcm_dec(GETSND snd, void *dst) {
|
||||
|
||||
UINT size;
|
||||
|
||||
size = min(snd->blocksize, snd->datsize);
|
||||
size = np2min(snd->blocksize, snd->datsize);
|
||||
if (size) {
|
||||
CopyMemory(dst, snd->datptr, size);
|
||||
snd->datptr += size;
|
||||
@ -91,7 +91,7 @@ static UINT pcm_dec(GETSND snd, UINT8 *dst) {
|
||||
UINT cnt;
|
||||
UINT8 *src;
|
||||
|
||||
size = min(snd->blocksize, snd->datsize);
|
||||
size = np2min(snd->blocksize, snd->datsize);
|
||||
if (size) {
|
||||
if (snd->bit == 16) {
|
||||
cnt = size >> 1;
|
||||
@ -164,7 +164,7 @@ static UINT msa_dec(GETSND snd, SINT16 *dst) {
|
||||
SINT32 outdata;
|
||||
|
||||
buf = snd->datptr; // ワーク使ってません。
|
||||
size = min(snd->datsize, snd->blocksize);
|
||||
size = np2min(snd->datsize, snd->blocksize);
|
||||
snd->datptr += size;
|
||||
snd->datsize -= size;
|
||||
|
||||
@ -531,7 +531,7 @@ BRESULT getwave_open(GETSND snd, UINT8 *ptr, UINT size) {
|
||||
ptr += pos;
|
||||
size -= pos;
|
||||
datasize = LOADINTELDWORD(head->size);
|
||||
size = min(size, datasize);
|
||||
size = np2min(size, datasize);
|
||||
|
||||
switch(format) {
|
||||
case 0x01: // PCM
|
||||
|
@ -118,7 +118,7 @@ const SINT16 *s;
|
||||
flag = t->flag;
|
||||
vol = t->volume;
|
||||
do {
|
||||
r = min(srem, drem);
|
||||
r = np2min(srem, drem);
|
||||
switch(flag & (PMIXFLAG_L | PMIXFLAG_R)) {
|
||||
case PMIXFLAG_L:
|
||||
for (j=0; j<r; j++) {
|
||||
|
@ -23,7 +23,7 @@ void SOUNDCALL psggen_getpcm(PSGGEN psg, SINT32 *pcm, UINT count) {
|
||||
UINT noise;
|
||||
|
||||
if ((psg->mixer & 0x3f) == 0) {
|
||||
count = min(count, psg->puchicount);
|
||||
count = np2min(count, psg->puchicount);
|
||||
psg->puchicount -= count;
|
||||
}
|
||||
if (count == 0) {
|
||||
|
@ -398,7 +398,7 @@ const UINT8 *d;
|
||||
if (sampdat < 0) {
|
||||
sampdat *= -1;
|
||||
}
|
||||
sampmax = max(sampmax, sampdat);
|
||||
sampmax = np2max(sampmax, sampdat);
|
||||
} while(--cnt);
|
||||
layer->volume = 32768 * 128 / sampmax;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ static void VERMOUTHCL key_on(MIDIHDL hdl, CHANNEL ch, int key, int vel) {
|
||||
if (!(v2->phase & (VOICE_ON | VOICE_REL))) {
|
||||
vol = v2->envleft;
|
||||
if ((v2->flag & VOICE_MIXMASK) == VOICE_MIXNORMAL) {
|
||||
vol = max(vol, v2->envright);
|
||||
vol = np2max(vol, v2->envright);
|
||||
}
|
||||
if (volmin > vol) {
|
||||
volmin = vol;
|
||||
@ -716,7 +716,7 @@ static void VERMOUTHCL _allresetmidi(MIDIHDL hdl)
|
||||
|
||||
VEXTERN UINT VEXPORT midiout_getver(char *string, UINT leng) {
|
||||
|
||||
leng = min(leng, sizeof(vermouthver));
|
||||
leng = np2min(leng, sizeof(vermouthver));
|
||||
CopyMemory(string, vermouthver, leng);
|
||||
return((MIDIOUT_VERSION << 8) | 0x00);
|
||||
}
|
||||
@ -729,8 +729,8 @@ VEXTERN MIDIHDL VEXPORT midiout_create(MIDIMOD mod, UINT worksize) {
|
||||
if (mod == NULL) {
|
||||
return(NULL);
|
||||
}
|
||||
worksize = min(worksize, 512U);
|
||||
worksize = max(worksize, 16384U);
|
||||
worksize = np2min(worksize, 512U);
|
||||
worksize = np2max(worksize, 16384U);
|
||||
size = sizeof(_MIDIHDL);
|
||||
size += sizeof(SINT32) * 2 * worksize;
|
||||
size += sizeof(_SAMPLE) * worksize;
|
||||
@ -1079,7 +1079,7 @@ static UINT VERMOUTHCL preparepcm(MIDIHDL hdl, UINT size) {
|
||||
UINT rem;
|
||||
|
||||
ret = 0;
|
||||
size = min(size, hdl->worksize);
|
||||
size = np2min(size, hdl->worksize);
|
||||
buf = hdl->sampbuf;
|
||||
ZeroMemory(buf, size * 2 * sizeof(SINT32));
|
||||
v = VOICEHDLPTR(hdl);
|
||||
|
@ -59,7 +59,7 @@ BOOL dispsync_renewalhorizontal(void) {
|
||||
}
|
||||
scrnxmax = cr + 2;
|
||||
if ((scrnxpos + scrnxmax) > 80) {
|
||||
scrnxmax = min(scrnxmax, 80);
|
||||
scrnxmax = np2min(scrnxmax, 80);
|
||||
scrnxpos = 80 - scrnxmax;
|
||||
}
|
||||
scrnxpos <<= 3;
|
||||
|
@ -136,7 +136,7 @@ void maketextgrph(int plane, int text_renewal, int grph_renewal) {
|
||||
|
||||
ppage = (plane)?VRAM_STEP:0;
|
||||
gbit = 0x01010101 << plane;
|
||||
ymax = min(dsync.textymax, dsync.grphymax);
|
||||
ymax = np2min(dsync.textymax, dsync.grphymax);
|
||||
q = np2_vram[plane] + dsync.textvad;
|
||||
wait1 = 0;
|
||||
TEXT_LRcnt = 0;
|
||||
@ -394,7 +394,7 @@ void maketextgrph40(int plane, int text_renewal, int grph_renewal) {
|
||||
|
||||
ppage = (plane)?VRAM_STEP:0;
|
||||
gbit = 0x01010101 << plane;
|
||||
ymax = min(dsync.textymax, dsync.grphymax);
|
||||
ymax = np2min(dsync.textymax, dsync.grphymax);
|
||||
q = np2_vram[plane] + dsync.textvad;
|
||||
wait1 = 0;
|
||||
TEXT_LRcnt = 0;
|
||||
|
@ -554,7 +554,7 @@ const PALNUM *s;
|
||||
STOREINTELWORD(bitbuf + 7, sd->height); // cy
|
||||
bitbuf[9] = 0; // noninterlace
|
||||
|
||||
bpp = max(bpp, 2);
|
||||
bpp = np2max(bpp, 2);
|
||||
bitbuf[10] = (UINT8)bpp;
|
||||
if (file_write(fh, bitbuf, 11) != 11) {
|
||||
goto sswg_err4;
|
||||
|
@ -165,7 +165,7 @@ void CComMidiOutVst::Process32(SINT32* lpBuffer, UINT nBufferCount)
|
||||
}
|
||||
|
||||
UINT nSize = m_nBlockSize - m_nIndex;
|
||||
nSize = min(nSize, nBufferCount);
|
||||
nSize = np2min(nSize, nBufferCount);
|
||||
nBufferCount -= nSize;
|
||||
float** output = m_output.GetBuffer();
|
||||
do
|
||||
|
@ -125,6 +125,13 @@ typedef signed __int64 SINT64;
|
||||
#define LABEL __declspec(naked)
|
||||
#define RELEASE(x) if (x) {(x)->Release(); (x) = NULL;}
|
||||
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN64)
|
||||
#define OPNGENX86
|
||||
#endif
|
||||
|
@ -163,7 +163,7 @@ void CDebugUtyAsm::ReadMemory(UINT nOffset, unsigned char* lpBuffer, UINT cbBuff
|
||||
{
|
||||
while (cbBuffer)
|
||||
{
|
||||
const UINT nLimit = min(nOffset + cbBuffer, 0x10000);
|
||||
const UINT nLimit = np2min(nOffset + cbBuffer, 0x10000);
|
||||
const UINT nSize = nLimit - nOffset;
|
||||
|
||||
if (!m_buffer.empty())
|
||||
|
@ -274,8 +274,8 @@ void CConfigureDlg::OnOK()
|
||||
}
|
||||
|
||||
UINT nMultiple = GetDlgItemInt(IDC_MULTIPLE, NULL, FALSE);
|
||||
nMultiple = max(nMultiple, 1);
|
||||
nMultiple = min(nMultiple, 256);
|
||||
nMultiple = np2max(nMultiple, 1);
|
||||
nMultiple = np2min(nMultiple, 256);
|
||||
if (np2cfg.multiple != nMultiple)
|
||||
{
|
||||
np2cfg.multiple = nMultiple;
|
||||
@ -332,8 +332,8 @@ void CConfigureDlg::OnOK()
|
||||
}
|
||||
|
||||
UINT nBuffer = GetDlgItemInt(IDC_SOUND_BUFFER, NULL, FALSE);
|
||||
nBuffer = max(nBuffer, 40);
|
||||
nBuffer = min(nBuffer, 1000);
|
||||
nBuffer = np2max(nBuffer, 40);
|
||||
nBuffer = np2min(nBuffer, 1000);
|
||||
if (np2cfg.delayms != static_cast<UINT16>(nBuffer))
|
||||
{
|
||||
np2cfg.delayms = static_cast<UINT16>(nBuffer);
|
||||
@ -438,8 +438,8 @@ void CConfigureDlg::SetClock(UINT nMultiple)
|
||||
{
|
||||
nMultiple = GetDlgItemInt(IDC_MULTIPLE, NULL, FALSE);
|
||||
}
|
||||
nMultiple = max(nMultiple, 1);
|
||||
nMultiple = min(nMultiple, 256);
|
||||
nMultiple = np2max(nMultiple, 1);
|
||||
nMultiple = np2min(nMultiple, 256);
|
||||
|
||||
const UINT nClock = (nBaseClock / 100) * nMultiple;
|
||||
|
||||
|
@ -466,8 +466,8 @@ protected:
|
||||
virtual void OnOK()
|
||||
{
|
||||
UINT nSize = GetDlgItemInt(IDC_HDDSIZE, NULL, FALSE);
|
||||
nSize = max(nSize, m_nHddMinSize);
|
||||
nSize = min(nSize, m_nHddMaxSize);
|
||||
nSize = np2max(nSize, m_nHddMinSize);
|
||||
nSize = np2min(nSize, m_nHddMaxSize);
|
||||
m_nHddSize = nSize;
|
||||
CDlgProc::OnOK();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ UINT MT32Sound::Mix(SINT32* lpBuffer, UINT cchBuffer)
|
||||
while (cchBuffer)
|
||||
{
|
||||
SINT16 sSamples[512 * 2];
|
||||
const UINT nLength = min(cchBuffer, 512);
|
||||
const UINT nLength = np2min(cchBuffer, 512);
|
||||
(*m_fnMix)(sSamples, nLength);
|
||||
for (UINT i = 0; i < nLength; i++)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ static void getlength1(FNTMNG fhdl, FNTDAT fdat,
|
||||
SIZE fntsize;
|
||||
|
||||
if (GetTextExtentPoint32(fhdl->hdcimage, string, length, &fntsize)) {
|
||||
fntsize.cx = min(fntsize.cx, fhdl->bmpwidth);
|
||||
fntsize.cx = np2min(fntsize.cx, fhdl->bmpwidth);
|
||||
fdat->width = fntsize.cx;
|
||||
fdat->pitch = fntsize.cx;
|
||||
}
|
||||
@ -230,7 +230,7 @@ BRESULT fontmng_getdrawsize(void *hdl, const OEMCHAR *string, POINT_T *pt) {
|
||||
buf[leng] = '\0';
|
||||
string += leng;
|
||||
getlength1((FNTMNG)hdl, &fdat, buf, leng);
|
||||
width = posx + max(fdat.width, fdat.pitch);
|
||||
width = posx + np2max(fdat.width, fdat.pitch);
|
||||
posx += fdat.pitch;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ void CExtRom::Close()
|
||||
UINT CExtRom::Read(LPVOID lpBuffer, UINT cbBuffer)
|
||||
{
|
||||
UINT nLength = m_nSize - m_nPointer;
|
||||
nLength = min(nLength, cbBuffer);
|
||||
nLength = np2min(nLength, cbBuffer);
|
||||
if (nLength)
|
||||
{
|
||||
if (lpBuffer)
|
||||
|
@ -46,7 +46,7 @@ std::tstring LoadTString(UINT uID)
|
||||
}
|
||||
|
||||
UINT nLength = pRes[dwPos++];
|
||||
nLength = min(nLength, (dwResSize - dwPos));
|
||||
nLength = np2min(nLength, (dwResSize - dwPos));
|
||||
|
||||
#if defined(_UNICODE)
|
||||
|
||||
|
@ -366,8 +366,8 @@ void RecodeVideo::Update()
|
||||
}
|
||||
(*fnMix)(m_pWork8, p, q);
|
||||
|
||||
const int nWidth = min(dsync.scrnxmax, VIDEO_WIDTH);
|
||||
const int nHeight = min(dsync.scrnymax, VIDEO_HEIGHT);
|
||||
const int nWidth = np2min(dsync.scrnxmax, VIDEO_WIDTH);
|
||||
const int nHeight = np2min(dsync.scrnymax, VIDEO_HEIGHT);
|
||||
p = m_pWork8;
|
||||
q = m_pWork24 + (VIDEO_WIDTH * nHeight * 3);
|
||||
for (int y = 0; y < nHeight; y++)
|
||||
|
@ -167,8 +167,8 @@ static void renewalclientsize(BOOL winloc) {
|
||||
int tmpcy;
|
||||
WINLOCEX wlex;
|
||||
|
||||
width = min(scrnstat.width, ddraw.width);
|
||||
height = min(scrnstat.height, ddraw.height);
|
||||
width = np2min(scrnstat.width, ddraw.width);
|
||||
height = np2min(scrnstat.height, ddraw.height);
|
||||
|
||||
extend = 0;
|
||||
|
||||
@ -187,7 +187,7 @@ static void renewalclientsize(BOOL winloc) {
|
||||
case FSCRNMOD_ASPECTFIX8:
|
||||
scrnwidth = (ddraw.width << 3) / width;
|
||||
scrnheight = (ddraw.height << 3) / height;
|
||||
multiple = min(scrnwidth, scrnheight);
|
||||
multiple = np2min(scrnwidth, scrnheight);
|
||||
scrnwidth = (width * multiple) >> 3;
|
||||
scrnheight = (height * multiple) >> 3;
|
||||
break;
|
||||
@ -240,7 +240,7 @@ static void renewalclientsize(BOOL winloc) {
|
||||
switch(fscrnmod) {
|
||||
default:
|
||||
case FSCRNMOD_NORESIZE:
|
||||
tmpcy = min(tmpcy, height);
|
||||
tmpcy = np2min(tmpcy, height);
|
||||
ddraw.rectclip.bottom = tmpcy;
|
||||
break;
|
||||
|
||||
@ -263,7 +263,7 @@ static void renewalclientsize(BOOL winloc) {
|
||||
multiple = scrnstat.multiple;
|
||||
if (!(ddraw.scrnmode & SCRNMODE_ROTATE)) {
|
||||
if ((np2oscfg.paddingx) && (multiple == 8)) {
|
||||
extend = min(scrnstat.extend, ddraw.extend);
|
||||
extend = np2min(scrnstat.extend, ddraw.extend);
|
||||
}
|
||||
scrnwidth = (width * multiple) >> 3;
|
||||
scrnheight = (height * multiple) >> 3;
|
||||
@ -283,7 +283,7 @@ static void renewalclientsize(BOOL winloc) {
|
||||
}
|
||||
else {
|
||||
if ((np2oscfg.paddingy) && (multiple == 8)) {
|
||||
extend = min(scrnstat.extend, ddraw.extend);
|
||||
extend = np2min(scrnstat.extend, ddraw.extend);
|
||||
}
|
||||
scrnwidth = (height * multiple) >> 3;
|
||||
scrnheight = (width * multiple) >> 3;
|
||||
@ -345,8 +345,8 @@ static void clearoutofrect(const RECT *target, const RECT *base) {
|
||||
primsurf->Blt(&rect, NULL, NULL, DDBLT_COLORFILL, &ddbf);
|
||||
}
|
||||
|
||||
rect.top = max(base->top, target->top);
|
||||
rect.bottom = min(base->bottom, target->bottom);
|
||||
rect.top = np2max(base->top, target->top);
|
||||
rect.bottom = np2min(base->bottom, target->bottom);
|
||||
if (rect.top < rect.bottom) {
|
||||
rect.left = base->left;
|
||||
rect.right = target->left;
|
||||
@ -1199,9 +1199,9 @@ void scrnmng_entersizing(void) {
|
||||
scrnsizing.by = (np2oscfg.paddingy * 2) +
|
||||
(rectwindow.bottom - rectwindow.top) -
|
||||
(rectclient.bottom - rectclient.top);
|
||||
cx = min(scrnstat.width, ddraw.width);
|
||||
cx = np2min(scrnstat.width, ddraw.width);
|
||||
cx = (cx + 7) >> 3;
|
||||
cy = min(scrnstat.height, ddraw.height);
|
||||
cy = np2min(scrnstat.height, ddraw.height);
|
||||
cy = (cy + 7) >> 3;
|
||||
if (!(ddraw.scrnmode & SCRNMODE_ROTATE)) {
|
||||
scrnsizing.cx = cx;
|
||||
@ -1234,7 +1234,7 @@ void scrnmng_sizing(UINT side, RECT *rect) {
|
||||
else {
|
||||
height = 16;
|
||||
}
|
||||
mul = min(width, height);
|
||||
mul = np2min(width, height);
|
||||
if (mul <= 0) {
|
||||
mul = 1;
|
||||
}
|
||||
@ -1388,4 +1388,4 @@ void scrnmng_bltwab() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -340,8 +340,8 @@ void CKeyDisplayWnd::OnDraw(BOOL redraw)
|
||||
RECT draw;
|
||||
draw.left = 0;
|
||||
draw.top = 0;
|
||||
draw.right = min(KEYDISP_WIDTH, rect.right - rect.left);
|
||||
draw.bottom = min(KEYDISP_HEIGHT, rect.bottom - rect.top);
|
||||
draw.right = np2min(KEYDISP_WIDTH, rect.right - rect.left);
|
||||
draw.bottom = np2min(KEYDISP_HEIGHT, rect.bottom - rect.top);
|
||||
if ((draw.right <= 0) || (draw.bottom <= 0))
|
||||
{
|
||||
return;
|
||||
|
@ -199,8 +199,8 @@ void CMemDebugWnd::OnDraw(BOOL redraw)
|
||||
RECT draw;
|
||||
draw.left = 0;
|
||||
draw.top = 0;
|
||||
draw.right = min(m_nWidth, rect.right - rect.left);
|
||||
draw.bottom = min(m_nHeight, rect.bottom - rect.top);
|
||||
draw.right = np2min(m_nWidth, rect.right - rect.left);
|
||||
draw.bottom = np2min(m_nHeight, rect.bottom - rect.top);
|
||||
CMNVRAM* vram = m_dd2.Lock();
|
||||
if (vram)
|
||||
{
|
||||
|
@ -217,8 +217,8 @@ void CSoftKeyboardWnd::OnDraw(BOOL redraw)
|
||||
RECT draw;
|
||||
draw.left = 0;
|
||||
draw.top = 0;
|
||||
draw.right = min(m_nWidth, rect.right - rect.left);
|
||||
draw.bottom = min(m_nHeight, rect.bottom - rect.top);
|
||||
draw.right = np2min(m_nWidth, rect.right - rect.left);
|
||||
draw.bottom = np2min(m_nHeight, rect.bottom - rect.top);
|
||||
CMNVRAM* vram = m_dd2.Lock();
|
||||
if (vram)
|
||||
{
|
||||
|
@ -128,11 +128,11 @@ typedef guint16 WORD;
|
||||
#define MAX_PATH MAXPATHLEN
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#ifndef np2max
|
||||
#define np2max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef np2min
|
||||
#define np2min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ZeroMemory
|
||||
|
@ -264,7 +264,7 @@ fontmng_getdrawsize(void *hdl, const char *str, POINT_T *pt)
|
||||
memcpy(buf, str, len * sizeof(char));
|
||||
buf[len] = '\0';
|
||||
getlength1(fhdl, &fdat, buf, len);
|
||||
width = posx + max(fdat.width, fdat.pitch);
|
||||
width = posx + np2max(fdat.width, fdat.pitch);
|
||||
posx += fdat.pitch;
|
||||
}
|
||||
}
|
||||
|
@ -128,8 +128,8 @@ renewal_client_size(void)
|
||||
int scrnheight;
|
||||
int multiple;
|
||||
|
||||
width = min(scrnstat.width, drawmng.width);
|
||||
height = min(scrnstat.height, drawmng.height);
|
||||
width = np2min(scrnstat.width, drawmng.width);
|
||||
height = np2min(scrnstat.height, drawmng.height);
|
||||
extend = 0;
|
||||
|
||||
if (drawmng.scrnmode & SCRNMODE_FULLSCREEN) {
|
||||
@ -155,7 +155,7 @@ renewal_client_size(void)
|
||||
multiple = scrnstat.multiple;
|
||||
if (!(drawmng.scrnmode & SCRNMODE_ROTATE)) {
|
||||
if ((np2oscfg.paddingx > 0) && (multiple == SCREEN_DEFMUL)) {
|
||||
extend = min(scrnstat.extend, drawmng.extend);
|
||||
extend = np2min(scrnstat.extend, drawmng.extend);
|
||||
}
|
||||
scrnwidth = (width * multiple) / SCREEN_DEFMUL;
|
||||
scrnheight = (height * multiple) / SCREEN_DEFMUL;
|
||||
@ -170,7 +170,7 @@ renewal_client_size(void)
|
||||
drawmng.scrn.top = np2oscfg.paddingy;
|
||||
} else {
|
||||
if ((np2oscfg.paddingy > 0) && (multiple == SCREEN_DEFMUL)) {
|
||||
extend = min(scrnstat.extend, drawmng.extend);
|
||||
extend = np2min(scrnstat.extend, drawmng.extend);
|
||||
}
|
||||
scrnwidth = (height * multiple) / SCREEN_DEFMUL;
|
||||
scrnheight = (width * multiple) / SCREEN_DEFMUL;
|
||||
@ -217,8 +217,8 @@ clear_out_of_rect(const RECT_T *target, const RECT_T *base)
|
||||
rect.left, rect.top, rect.right, rect.bottom);
|
||||
}
|
||||
|
||||
rect.top = max(base->top, target->top);
|
||||
rect.bottom = min(base->bottom, target->bottom);
|
||||
rect.top = np2max(base->top, target->top);
|
||||
rect.bottom = np2min(base->bottom, target->bottom);
|
||||
if (rect.top < rect.bottom) {
|
||||
rect.left = base->left;
|
||||
rect.right = target->left;
|
||||
|
Loading…
Reference in New Issue
Block a user