init some ports
This commit is contained in:
parent
39d6fde32d
commit
bb5f269f99
14 changed files with 123 additions and 228 deletions
|
|
@ -3,7 +3,17 @@ project(gquake)
|
|||
|
||||
file(GLOB SOURCES src/*.c)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
if(PS2)
|
||||
set(GL ps2gl)
|
||||
|
||||
set(CMAKE_EXECUTABLE_SUFFIX .elf)
|
||||
elseif(VITA)
|
||||
set(GL vitaGL)
|
||||
else()
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
set(GL OpenGL::GL)
|
||||
endif()
|
||||
|
||||
set(MILSKO "/usr/local")
|
||||
option(TRY_SDL2 "Try SDL2" ON)
|
||||
|
|
@ -11,13 +21,48 @@ option(TRY_SDL2 "Try SDL2" ON)
|
|||
add_executable(gquake ${SOURCES})
|
||||
target_include_directories(gquake PRIVATE include)
|
||||
target_compile_definitions(gquake PRIVATE GL_EXT_SHARED GLQUAKE)
|
||||
target_link_libraries(gquake PRIVATE OpenGL::GL)
|
||||
target_link_libraries(gquake PRIVATE ${GL})
|
||||
|
||||
find_package(SDL2 OPTIONAL)
|
||||
if(SDL2_FOUND AND TRY_SDL2)
|
||||
if(PSP)
|
||||
target_link_libraries(gquake PRIVATE SDL2main pspsdk pspnet cglue)
|
||||
|
||||
create_pbp_file(TARGET gquake
|
||||
TITLE "GQuake")
|
||||
elseif(PS2)
|
||||
target_link_libraries(gquake PRIVATE SDL2main stdc++ ps2stuff dma -ldebug)
|
||||
|
||||
add_custom_command(TARGET gquake POST_BUILD
|
||||
COMMAND rm -rf gquake
|
||||
COMMAND mkdir -p gquake
|
||||
COMMAND cp gquake.elf gquake/GQUAKE.ELF
|
||||
COMMAND cp -rf ${CMAKE_SOURCE_DIR}/id1 gquake/
|
||||
COMMAND echo "BOOT2 = cdrom0:\\\\GQUAKE.ELF" > gquake/SYSTEM.CNF
|
||||
COMMAND genisoimage -udf -o gquake.iso gquake
|
||||
)
|
||||
elseif(VITA)
|
||||
include(${VITASDK}/share/vita.cmake)
|
||||
|
||||
target_link_libraries(gquake PRIVATE SDL2main stdc++ vitashark SceShaccCg_stub SceKernelDmacMgr_stub mathneon)
|
||||
|
||||
vita_create_self(gquake.self gquake)
|
||||
vita_create_vpk(gquake.vpk PYRT10000 gquake.self
|
||||
FILE ${CMAKE_SOURCE_DIR}/id1 sce_sys/id1
|
||||
)
|
||||
else()
|
||||
target_link_libraries(gquake PRIVATE m)
|
||||
endif()
|
||||
|
||||
set(FOUND OFF)
|
||||
|
||||
if(NOT FOUND AND TRY_SDL2)
|
||||
find_package(SDL2)
|
||||
target_compile_definitions(gquake PRIVATE USE_SDL2)
|
||||
target_link_libraries(gquake PRIVATE SDL2::SDL2)
|
||||
else()
|
||||
|
||||
set(FOUND ON)
|
||||
endif()
|
||||
|
||||
if(NOT FOUND)
|
||||
target_compile_definitions(gquake PRIVATE USE_MILSKO USE_MINIAUDIO)
|
||||
target_include_directories(gquake PRIVATE ${MILSKO}/include)
|
||||
target_link_directories(gquake PRIVATE ${MILSKO}/src ${MILSKO}/lib)
|
||||
|
|
|
|||
|
|
@ -29,12 +29,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL2
|
||||
#include <SDL_opengl.h>
|
||||
#else
|
||||
#ifndef __APPLE__
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#else
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _EE
|
||||
#define glFinish(...) {}
|
||||
#define glDepthRange(...) {}
|
||||
#define glColor3ub(r,g,b) glColor3f((r) / 255.0, (g) / 255.0, (b) / 255.0)
|
||||
#elif defined(__vita__)
|
||||
#define glDrawBuffer(...) {}
|
||||
#endif
|
||||
|
||||
void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
||||
|
|
|
|||
8
include/port.h
Normal file
8
include/port.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#if defined(_PSP) || defined(_EE) || defined(__vita__)
|
||||
#include <sys/socket.h>
|
||||
|
||||
typedef socklen_t SOCKLEN_T;
|
||||
#define NO_FCNTL
|
||||
#else
|
||||
typedef int SOCKLEN_T;
|
||||
#endif
|
||||
|
|
@ -355,3 +355,5 @@ void Port_Step(void);
|
|||
void Port_GrabPointer(int toggle);
|
||||
void Port_Shutdown(void);
|
||||
void Port_SwapBuffer(void);
|
||||
|
||||
#include "port.h"
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ int Sys_FileWrite (int handle, void *data, int count);
|
|||
int Sys_FileTime (char *path);
|
||||
void Sys_mkdir (char *path);
|
||||
|
||||
//
|
||||
// memory protection
|
||||
//
|
||||
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length);
|
||||
|
||||
//
|
||||
// system IO
|
||||
//
|
||||
|
|
|
|||
4
src/gl.c
4
src/gl.c
|
|
@ -336,6 +336,10 @@ void VID_Init(unsigned char *palette)
|
|||
int MajorVersion, MinorVersion;
|
||||
int actualWidth, actualHeight;
|
||||
|
||||
#ifdef _PSP
|
||||
width = 480, height = 272;
|
||||
#endif
|
||||
|
||||
fullscreen = qtrue;
|
||||
|
||||
mouse_avail = 1;
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ typedef struct
|
|||
byte conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)];
|
||||
qpic_t *conback = (qpic_t *)&conback_buffer;
|
||||
|
||||
int gl_lightmap_format = 4;
|
||||
int gl_solid_format = 3;
|
||||
int gl_alpha_format = 4;
|
||||
int gl_lightmap_format = GL_RGBA;
|
||||
int gl_solid_format = GL_RGB;
|
||||
int gl_alpha_format = GL_RGBA;
|
||||
|
||||
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
||||
int gl_filter_max = GL_LINEAR;
|
||||
|
|
@ -390,6 +390,10 @@ void Draw_Init (void)
|
|||
strstr((char *)gl_renderer, "Glide"))
|
||||
Cvar_Set ("gl_max_size", "256");
|
||||
|
||||
#ifdef _PSP
|
||||
Cvar_Set("gl_max_size", "512");
|
||||
#endif
|
||||
|
||||
Cmd_AddCommand ("gl_texturemode", &Draw_TextureMode_f);
|
||||
|
||||
// load the console background and the charset
|
||||
|
|
@ -851,7 +855,7 @@ void GL_Set2D (void)
|
|||
glDisable (GL_CULL_FACE);
|
||||
glDisable (GL_BLEND);
|
||||
glEnable (GL_ALPHA_TEST);
|
||||
// glDisable (GL_ALPHA_TEST);
|
||||
//glDisable (GL_ALPHA_TEST);
|
||||
|
||||
glColor4f (1,1,1,1);
|
||||
}
|
||||
|
|
@ -1040,7 +1044,7 @@ static unsigned scaled[1024*512]; // [512*256];
|
|||
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||
}
|
||||
#else
|
||||
texels += scaled_width * scaled_height;
|
||||
texels += scaled_width * scaled_height;
|
||||
|
||||
if (scaled_width == width && scaled_height == height)
|
||||
{
|
||||
|
|
@ -1054,7 +1058,7 @@ texels += scaled_width * scaled_height;
|
|||
else
|
||||
GL_ResampleTexture (data, width, height, scaled, scaled_width, scaled_height);
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||
glTexImage2D (GL_TEXTURE_2D, samples, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||
if (mipmap)
|
||||
{
|
||||
int miplevel;
|
||||
|
|
|
|||
|
|
@ -563,16 +563,20 @@ void R_DrawAliasModel (entity_t *e)
|
|||
glShadeModel (GL_SMOOTH);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
#ifndef _PSP
|
||||
if (gl_affinemodels.value)
|
||||
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||
#endif
|
||||
|
||||
R_SetupAliasFrame (currententity->frame, paliashdr);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
glShadeModel (GL_FLAT);
|
||||
#ifndef _PSP
|
||||
if (gl_affinemodels.value)
|
||||
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
#endif
|
||||
|
||||
glPopMatrix ();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,30 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifdef BAN_TEST
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined (NeXT)
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#define AF_INET 2 /* internet */
|
||||
struct in_addr
|
||||
{
|
||||
union
|
||||
{
|
||||
struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
|
||||
struct { unsigned short s_w1,s_w2; } S_un_w;
|
||||
unsigned long S_addr;
|
||||
} S_un;
|
||||
};
|
||||
#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
|
||||
struct sockaddr_in
|
||||
{
|
||||
short sin_family;
|
||||
unsigned short sin_port;
|
||||
struct in_addr sin_addr;
|
||||
char sin_zero[8];
|
||||
};
|
||||
char *inet_ntoa(struct in_addr in);
|
||||
unsigned long inet_addr(const char *cp);
|
||||
#endif
|
||||
#endif // BAN_TEST
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#ifndef __vita__
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
|
|
@ -77,7 +79,11 @@ int UDP_Init (void)
|
|||
return -1;
|
||||
|
||||
// determine my name & address
|
||||
#ifdef _EE
|
||||
strcpy(buff, "PS2");
|
||||
#else
|
||||
gethostname(buff, MAXHOSTNAMELEN);
|
||||
#endif
|
||||
local = gethostbyname(buff);
|
||||
myAddr = *(int *)local->h_addr_list[0];
|
||||
|
||||
|
|
@ -149,11 +155,13 @@ int UDP_OpenSocket (int port)
|
|||
|
||||
#ifdef _WIN32
|
||||
if (ioctl (newsocket, FIONBIO, (u_long*)&_qtrue) == -1)
|
||||
goto ErrorReturn;
|
||||
#elif defined(_PSP) || defined(__vita__)
|
||||
if(setsockopt(newsocket, SOL_SOCKET, SO_NONBLOCK, (char*)_qtrue, sizeof(_qtrue)) == -1)
|
||||
#elif defined(_EE)
|
||||
#else
|
||||
if (ioctl (newsocket, FIONBIO, (char *)&_qtrue) == -1)
|
||||
goto ErrorReturn;
|
||||
#endif
|
||||
goto ErrorReturn;
|
||||
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
|
|
@ -251,8 +259,11 @@ int UDP_CheckNewConnections (void)
|
|||
if (net_acceptsocket == -1)
|
||||
return -1;
|
||||
|
||||
#if defined(_PSP) || defined(_EE) || defined(__vita__)
|
||||
#else
|
||||
if (ioctl (net_acceptsocket, FIONREAD, &available) == -1)
|
||||
Sys_Error ("UDP: ioctlsocket (FIONREAD) failed\n");
|
||||
#endif
|
||||
if (available)
|
||||
return net_acceptsocket;
|
||||
return -1;
|
||||
|
|
@ -262,7 +273,7 @@ int UDP_CheckNewConnections (void)
|
|||
|
||||
int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr)
|
||||
{
|
||||
int addrlen = sizeof (struct qsockaddr);
|
||||
SOCKLEN_T addrlen = sizeof (struct qsockaddr);
|
||||
int ret;
|
||||
|
||||
ret = recvfrom (socket, buf, len, 0, (struct sockaddr *)addr, &addrlen);
|
||||
|
|
@ -350,7 +361,7 @@ int UDP_StringToAddr (char *string, struct qsockaddr *addr)
|
|||
|
||||
int UDP_GetSocketAddr (int socket, struct qsockaddr *addr)
|
||||
{
|
||||
int addrlen = sizeof(struct qsockaddr);
|
||||
SOCKLEN_T addrlen = sizeof(struct qsockaddr);
|
||||
unsigned int a;
|
||||
|
||||
Q_memset(addr, 0, sizeof(struct qsockaddr));
|
||||
|
|
|
|||
22
src/proc.sh
22
src/proc.sh
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh
|
||||
cat $1.log | grep -oE 'implicit declaration of function ‘[^’]+’' >/dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
F=`cat $1.log | grep -oE 'implicit declaration of function ‘[^’]+’' | sed -E 's/implicit declaration of function .(.+).$/\1/g'`
|
||||
for i in $F; do
|
||||
echo "Finding $i"
|
||||
new=true
|
||||
for sym in `cat implicit_list`; do
|
||||
if [ "$sym" = "$i" ]; then
|
||||
new=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
if $new; then
|
||||
echo "$i" >> implicit_list
|
||||
SYM="`grep -oE "^[ \\t]*(struct )?[^ ]+ $i.+[ \\t]*\$" *.c | cut -d":" -f2`"
|
||||
if [ ! "x$SYM" = "x" ]; then
|
||||
echo "$SYM;" >> include/glquake_implicit.h
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
131
src/quake.rc
131
src/quake.rc
|
|
@ -1,131 +0,0 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON2 ICON DISCARDABLE "quake.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG1 DIALOGEX 0, 0, 62, 21
|
||||
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP
|
||||
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
|
||||
FONT 16, "Times New Roman", 0, 0, 0x1
|
||||
BEGIN
|
||||
CTEXT "Starting Quake...",IDC_STATIC,4,6,54,8
|
||||
END
|
||||
|
||||
IDD_PROGRESS DIALOGEX 0, 0, 333, 45
|
||||
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
|
||||
WS_VISIBLE
|
||||
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Creating 15 bit inverse palette. This is only done once, so just be patient for the next 30-60 seconds.",
|
||||
IDC_STATIC,7,19,319,10
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,29,
|
||||
319,11
|
||||
LTEXT "Starting Quake...",IDC_STATIC,7,4,54,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_DIALOG1, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 4
|
||||
RIGHTMARGIN, 58
|
||||
TOPMARGIN, 6
|
||||
BOTTOMMARGIN, 16
|
||||
HORZGUIDE, 6
|
||||
HORZGUIDE, 16
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_STRING1 "MilskoQuake"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
|
@ -659,6 +659,7 @@ void R_DrawParticles (void)
|
|||
#ifdef GLQUAKE
|
||||
vec3_t up, right;
|
||||
float scale;
|
||||
byte* c;
|
||||
|
||||
GL_Bind(particletexture);
|
||||
glEnable (GL_BLEND);
|
||||
|
|
@ -717,7 +718,9 @@ void R_DrawParticles (void)
|
|||
scale = 1;
|
||||
else
|
||||
scale = 1 + scale * 0.004;
|
||||
glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
|
||||
|
||||
c = (byte *)&d_8to24table[(int)p->color];
|
||||
glColor3ub (c[0], c[1], c[2]);
|
||||
glTexCoord2f (0,0);
|
||||
glVertex3fv (p->org);
|
||||
glTexCoord2f (1,0);
|
||||
|
|
|
|||
43
src/sys.c
43
src/sys.c
|
|
@ -1,3 +1,5 @@
|
|||
#include "port.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -8,13 +10,10 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "quakedef.h"
|
||||
|
|
@ -118,7 +117,9 @@ static char end2[] =
|
|||
void Sys_Quit (void)
|
||||
{
|
||||
Host_Shutdown();
|
||||
#ifndef NO_FCNTL
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY);
|
||||
#endif
|
||||
#if 0
|
||||
if (registered.value)
|
||||
printf("%s", end2);
|
||||
|
|
@ -142,7 +143,9 @@ void Sys_Error (char *error, ...)
|
|||
char string[1024];
|
||||
|
||||
// change stdin to non blocking
|
||||
#ifndef NO_FCNTL
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY);
|
||||
#endif
|
||||
|
||||
va_start (argptr,error);
|
||||
vsprintf (string,error,argptr);
|
||||
|
|
@ -209,7 +212,9 @@ int Sys_FileOpenWrite (char *path)
|
|||
{
|
||||
int handle;
|
||||
|
||||
#if 0
|
||||
umask (0);
|
||||
#endif
|
||||
|
||||
handle = open(path,O_RDWR | O_CREAT | O_TRUNC
|
||||
, 0666);
|
||||
|
|
@ -353,7 +358,6 @@ void Sys_LowFPPrecision (void)
|
|||
|
||||
int main (int c, char **v)
|
||||
{
|
||||
|
||||
double time, oldtime, newtime;
|
||||
quakeparms_t parms;
|
||||
extern int vcrFile;
|
||||
|
|
@ -386,7 +390,9 @@ int main (int c, char **v)
|
|||
// caching is disabled by default, use -cachedir to enable
|
||||
// parms.cachedir = cachedir;
|
||||
|
||||
#ifndef NO_FCNTL
|
||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY);
|
||||
#endif
|
||||
|
||||
Host_Init(&parms);
|
||||
|
||||
|
|
@ -395,8 +401,10 @@ int main (int c, char **v)
|
|||
if (COM_CheckParm("-nostdout"))
|
||||
nostdout = 1;
|
||||
else {
|
||||
#ifndef NO_FCNTL
|
||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY);
|
||||
printf ("Milsko Quake -- Version %0.3f\n", LINUX_VERSION);
|
||||
#endif
|
||||
printf ("Generic Quake -- Version %0.3f\n", LINUX_VERSION);
|
||||
}
|
||||
|
||||
oldtime = Sys_FloatTime () - 0.1;
|
||||
|
|
@ -430,28 +438,3 @@ int main (int c, char **v)
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_MakeCodeWriteable
|
||||
================
|
||||
*/
|
||||
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||
{
|
||||
|
||||
int r;
|
||||
unsigned long addr;
|
||||
int psize = getpagesize();
|
||||
|
||||
addr = (startaddr & ~(psize-1)) - psize;
|
||||
|
||||
// fprintf(stderr, "writable code %lx(%lx)-%lx, length=%lx\n", startaddr,
|
||||
// addr, startaddr+length, length);
|
||||
|
||||
r = mprotect((char*)addr, length + startaddr - addr + psize, 7);
|
||||
|
||||
if (r < 0)
|
||||
Sys_Error("Protection change failed\n");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue