mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@582 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5dbcf7cdbc
commit
b27a43ff2a
12 changed files with 101 additions and 7 deletions
|
@ -132,6 +132,8 @@ void wm_setapptitle(char *name);
|
||||||
// baselayer.c
|
// baselayer.c
|
||||||
int baselayer_init();
|
int baselayer_init();
|
||||||
|
|
||||||
|
void makeasmwriteable(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -111,9 +111,12 @@ CDECLENDSET MACRO numparams:REQ
|
||||||
CDECLEND numparams
|
CDECLEND numparams
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
CODE SEGMENT PUBLIC USE32 'CODE'
|
||||||
ASSUME cs:CODE,ds:CODE
|
ASSUME cs:CODE,ds:CODE
|
||||||
|
|
||||||
|
PUBLIC _dep_begin
|
||||||
|
_dep_begin:
|
||||||
|
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
PUBLIC _sethlinesizes
|
PUBLIC _sethlinesizes
|
||||||
_sethlinesizes:
|
_sethlinesizes:
|
||||||
|
@ -2660,5 +2663,7 @@ pentiumpro:
|
||||||
pop ebx ;JBF
|
pop ebx ;JBF
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
PUBLIC _dep_end
|
||||||
|
_dep_end:
|
||||||
CODE ENDS
|
CODE ENDS
|
||||||
END
|
END
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
;CPU 586
|
;CPU 586
|
||||||
|
|
||||||
SECTION .data
|
SECTION .text
|
||||||
|
|
||||||
%ifdef UNDERSCORES
|
%ifdef UNDERSCORES
|
||||||
%define asm1 _asm1
|
%define asm1 _asm1
|
||||||
|
@ -79,6 +79,8 @@ SECTION .data
|
||||||
%define stretchhline _stretchhline
|
%define stretchhline _stretchhline
|
||||||
%define mmxoverlay _mmxoverlay
|
%define mmxoverlay _mmxoverlay
|
||||||
|
|
||||||
|
%define dep_begin _dep_begin
|
||||||
|
%define dep_end _dep_end
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
; Some macros to help make cdecl calling easier to manage
|
; Some macros to help make cdecl calling easier to manage
|
||||||
|
@ -225,6 +227,10 @@ SECTION .data
|
||||||
GLOBAL stretchhline
|
GLOBAL stretchhline
|
||||||
GLOBAL mmxoverlay
|
GLOBAL mmxoverlay
|
||||||
|
|
||||||
|
GLOBAL dep_begin
|
||||||
|
GLOBAL dep_end
|
||||||
|
|
||||||
|
dep_begin:
|
||||||
|
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
sethlinesizes:
|
sethlinesizes:
|
||||||
|
@ -2749,3 +2755,4 @@ pentiumpro:
|
||||||
pop ebx ;JBF
|
pop ebx ;JBF
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
dep_end:
|
||||||
|
|
|
@ -39,9 +39,12 @@ EXTRN _espbak : dword
|
||||||
EXTRN _pow2char : near
|
EXTRN _pow2char : near
|
||||||
EXTRN _pow2long : near
|
EXTRN _pow2long : near
|
||||||
|
|
||||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
CODE SEGMENT PUBLIC USE32 'CODE'
|
||||||
ASSUME cs:CODE,ds:CODE
|
ASSUME cs:CODE,ds:CODE
|
||||||
|
|
||||||
|
PUBLIC _dep_begin
|
||||||
|
_dep_begin:
|
||||||
|
|
||||||
ALIGN 16
|
ALIGN 16
|
||||||
PUBLIC sethlinesizes_
|
PUBLIC sethlinesizes_
|
||||||
sethlinesizes_:
|
sethlinesizes_:
|
||||||
|
@ -2416,5 +2419,7 @@ pentiumpro:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
PUBLIC _dep_end
|
||||||
|
_dep_end:
|
||||||
CODE ENDS
|
CODE ENDS
|
||||||
END
|
END
|
||||||
|
|
|
@ -5543,6 +5543,8 @@ int preinitengine(void)
|
||||||
Bfree(spritesmooth);
|
Bfree(spritesmooth);
|
||||||
spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype));
|
spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype));
|
||||||
|
|
||||||
|
makeasmwriteable();
|
||||||
|
|
||||||
if ((e = Bgetenv("BUILD_NOP6")) != NULL)
|
if ((e = Bgetenv("BUILD_NOP6")) != NULL)
|
||||||
if (!Bstrcasecmp(e, "TRUE")) {
|
if (!Bstrcasecmp(e, "TRUE")) {
|
||||||
Bprintf("Disabling P6 optimizations.\n");
|
Bprintf("Disabling P6 optimizations.\n");
|
||||||
|
|
|
@ -1669,3 +1669,39 @@ static int buildkeytranslationtable(void)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined _WIN32
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# include <windows.h>
|
||||||
|
#elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||||
|
# include <sys/mman.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void makeasmwriteable(void)
|
||||||
|
{
|
||||||
|
#ifndef ENGINE_USING_A_C
|
||||||
|
extern int dep_begin, dep_end;
|
||||||
|
# if defined _WIN32
|
||||||
|
DWORD oldprot;
|
||||||
|
if (!VirtualProtect((LPVOID)&dep_begin, (SIZE_T)&dep_end - (SIZE_T)&dep_begin, PAGE_EXECUTE_READWRITE, &oldprot)) {
|
||||||
|
initprint("Error making code writeable\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
# elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||||
|
int pagesize;
|
||||||
|
size_t dep_begin_page;
|
||||||
|
pagesize = sysconf(_SC_PAGE_SIZE);
|
||||||
|
if (pagesize == -1) {
|
||||||
|
initprintf("Error getting system page size\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dep_begin_page = ((size_t)&dep_begin) & ~(pagesize-1);
|
||||||
|
if (mprotect((const void *)dep_begin_page, (size_t)&dep_end - dep_begin_page, PROT_READ|PROT_WRITE) < 0) {
|
||||||
|
initprintf("Error making code writeable (errno=%d)\n", errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
# error Don't know how to unprotect the self-modifying assembly on this platform!
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -3802,3 +3802,17 @@ static LPTSTR GetWindowsErrorMsg(DWORD code)
|
||||||
return lpMsgBuf;
|
return lpMsgBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// makeasmwriteable() -- removes write protection from the self-modifying assembly code
|
||||||
|
//
|
||||||
|
void makeasmwriteable(void)
|
||||||
|
{
|
||||||
|
#ifndef ENGINE_USING_A_C
|
||||||
|
extern int dep_begin, dep_end;
|
||||||
|
DWORD oldprot;
|
||||||
|
|
||||||
|
if (!VirtualProtect((LPVOID)&dep_begin, (SIZE_T)&dep_end - (SIZE_T)&dep_begin, PAGE_EXECUTE_READWRITE, &oldprot)) {
|
||||||
|
ShowErrorBox("Problem making code writeable");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -825,7 +825,8 @@ enum spriteflags {
|
||||||
SPRITE_FLAG_NOSHADE = 4,
|
SPRITE_FLAG_NOSHADE = 4,
|
||||||
SPRITE_FLAG_PROJECTILE = 8,
|
SPRITE_FLAG_PROJECTILE = 8,
|
||||||
SPRITE_FLAG_DECAL = 16,
|
SPRITE_FLAG_DECAL = 16,
|
||||||
SPRITE_FLAG_BADGUY = 32
|
SPRITE_FLAG_BADGUY = 32,
|
||||||
|
SPRITE_FLAG_NOPAL = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
extern short spritecache[MAXTILES][3];
|
extern short spritecache[MAXTILES][3];
|
||||||
|
|
|
@ -6719,7 +6719,7 @@ void animatesprites(long x,long y,int a,long smoothratio)
|
||||||
|
|
||||||
PALONLY:
|
PALONLY:
|
||||||
|
|
||||||
if (sector[sect].floorpal && sector[sect].floorpal < g_NumPalettes)
|
if (sector[sect].floorpal && sector[sect].floorpal < g_NumPalettes && !checkspriteflags(t->owner,SPRITE_FLAG_NOPAL))
|
||||||
t->pal = sector[sect].floorpal;
|
t->pal = sector[sect].floorpal;
|
||||||
|
|
||||||
if (s->owner == -1) continue;
|
if (s->owner == -1) continue;
|
||||||
|
@ -6760,7 +6760,7 @@ PALONLY:
|
||||||
else t->picnum += T1;
|
else t->picnum += T1;
|
||||||
t->shade -= 6;
|
t->shade -= 6;
|
||||||
|
|
||||||
if (sector[sect].floorpal && sector[sect].floorpal < g_NumPalettes)
|
if (sector[sect].floorpal && sector[sect].floorpal < g_NumPalettes && !checkspriteflags(t->owner,SPRITE_FLAG_NOPAL))
|
||||||
t->pal = sector[sect].floorpal;
|
t->pal = sector[sect].floorpal;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6771,7 +6771,7 @@ PALONLY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (sector[sect].floorpal && sector[sect].floorpal < g_NumPalettes)
|
if (sector[sect].floorpal && sector[sect].floorpal < g_NumPalettes && !checkspriteflags(t->owner,SPRITE_FLAG_NOPAL))
|
||||||
t->pal = sector[sect].floorpal;
|
t->pal = sector[sect].floorpal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,6 +436,8 @@ static const char *keyw[] =
|
||||||
"headspritesect", // 306
|
"headspritesect", // 306
|
||||||
"prevspritesect", // 307
|
"prevspritesect", // 307
|
||||||
"nextspritesect", // 308
|
"nextspritesect", // 308
|
||||||
|
"spritenopal", // 309
|
||||||
|
"getkeyname", // 310
|
||||||
"<null>"
|
"<null>"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3300,6 +3302,7 @@ static int parsecommand(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case CON_DRAGPOINT:
|
case CON_DRAGPOINT:
|
||||||
|
case CON_GETKEYNAME:
|
||||||
transmultvars(3);
|
transmultvars(3);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -3372,6 +3375,7 @@ static int parsecommand(void)
|
||||||
case CON_SPRITESHADOW:
|
case CON_SPRITESHADOW:
|
||||||
case CON_SPRITENVG:
|
case CON_SPRITENVG:
|
||||||
case CON_SPRITENOSHADE:
|
case CON_SPRITENOSHADE:
|
||||||
|
case CON_SPRITENOPAL:
|
||||||
case CON_PRECACHE:
|
case CON_PRECACHE:
|
||||||
{
|
{
|
||||||
if (parsing_state || parsing_actor)
|
if (parsing_state || parsing_actor)
|
||||||
|
@ -3403,6 +3407,9 @@ static int parsecommand(void)
|
||||||
case CON_SPRITENOSHADE:
|
case CON_SPRITENOSHADE:
|
||||||
spriteflags[*scriptptr] |= SPRITE_FLAG_NOSHADE;
|
spriteflags[*scriptptr] |= SPRITE_FLAG_NOSHADE;
|
||||||
break;
|
break;
|
||||||
|
case CON_SPRITENOPAL:
|
||||||
|
spriteflags[*scriptptr] |= SPRITE_FLAG_NOPAL;
|
||||||
|
break;
|
||||||
case CON_PRECACHE:
|
case CON_PRECACHE:
|
||||||
spritecache[*scriptptr][0] = j;
|
spritecache[*scriptptr][0] = j;
|
||||||
transnum(LABEL_DEFINE);
|
transnum(LABEL_DEFINE);
|
||||||
|
|
|
@ -788,5 +788,7 @@ enum keywords
|
||||||
CON_HEADSPRITESECT, // 306
|
CON_HEADSPRITESECT, // 306
|
||||||
CON_PREVSPRITESECT, // 307
|
CON_PREVSPRITESECT, // 307
|
||||||
CON_NEXTSPRITESECT, // 308
|
CON_NEXTSPRITESECT, // 308
|
||||||
|
CON_SPRITENOPAL, // 309
|
||||||
|
CON_GETKEYNAME, // 310
|
||||||
END
|
END
|
||||||
};
|
};
|
||||||
|
|
|
@ -4385,6 +4385,19 @@ static int parse(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CON_GETKEYNAME:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
int i = GetGameVarID(*insptr++, g_i, g_p), f=GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
|
||||||
|
j=GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
|
||||||
|
if (fta_quotes[i] != NULL && f < NUMGAMEFUNCTIONS && j < 2)
|
||||||
|
Bstrcpy(fta_quotes[i], KB_ScanCodeToString(ud.config.KeyboardKeys[f][j]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CON_MYOSX:
|
case CON_MYOSX:
|
||||||
case CON_MYOSPALX:
|
case CON_MYOSPALX:
|
||||||
case CON_MYOS:
|
case CON_MYOS:
|
||||||
|
|
Loading…
Reference in a new issue