1
0
Fork 0
forked from fte/fteqw

Merge branch 'fhomolka-rip_npapi'

This commit is contained in:
Marco Cawthorne 2023-07-14 18:44:29 -07:00
commit bd34d352d1
Signed by: eukara
GPG key ID: CE2032F0A2882A22
24 changed files with 18 additions and 5125 deletions

View file

@ -477,7 +477,6 @@ ELSE()
# engine/client/sys_droid.c
# engine/client/sys_linux.c
# engine/client/sys_morphos.c
# engine/client/sys_npfte.c
# engine/client/sys_plugfte.c
# engine/client/sys_sdl.c
# engine/client/sys_xdk.c

View file

@ -236,9 +236,6 @@ export NATIVE_PLUGINS="qi ezhud xmpp irc"
if [ "$BUILD_ANDROID" != "n" ]; then
NATIVE_PLUGINS="$PLUGINS_DROID" build "Android" android droid-rel
fi
#if [ "$BUILD_WIN32" != "n" ]; then
# build "NPFTE" npfte npfte-rel
#fi
if [ "$BUILD_DOS" == "y" ]; then
#no networking makes dedicated servers useless. and only a crappy sw renderer is implemented right now.
#the qcc might be useful to someone though!

File diff suppressed because it is too large Load diff

View file

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FTEQW</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>CC=mingw32-gcc</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/FTEQW/GLDebug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>gl-dbg</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View file

@ -722,7 +722,6 @@ DX7SDK=-I./libs/dxsdk7/include/
GLCFLAGS?=-DGLQUAKE
D3DCFLAGS?=-DD3D9QUAKE -DD3D11QUAKE
VKCFLAGS?=-DVKQUAKE
NPFTECFLAGS=-DNPFTE
CLIENT_OBJS = \
textedit.o \
@ -1394,12 +1393,6 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
GLB_DIR=gl_mgw$(BITS)
GLCL_DIR=glcl_mgw$(BITS)
NPFTE_OBJS=httpclient.o image.o sys_win_threads.o sys_npfte.o sys_axfte.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START)
NPFTE_DLL_NAME=../npfte$(BITS).dll
NPFTE_LDFLAGS=-Wl,--enable-stdcall-fixup $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -loleaut32 -luuid -lstdc++ -shared -Wl,--subsystem,windows
NPFTE_CFLAGS=$(NPFTECFLAGS) $(W32_CFLAGS) -DMULTITHREAD
NPFTEB_DIR=npfte_mgw$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidnt.o gl_videgl.o $(WINDOWS_OBJS)
M_EXE_NAME=../$(EXE_NAME)$(BITS)$(EXEPOSTFIX)
MCL_EXE_NAME=../$(EXE_NAME)cl$(BITS)$(EXEPOSTFIX)
@ -1516,12 +1509,6 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
endif
QCC_DIR=linqcc$(BITS)
NPFTE_OBJS=httpclient.o image.o sys_linux_threads.o sys_npfte.o sys_axfte.o sys_plugfte.o
NPFTE_DLL_NAME=../npfte$(BITS).so
NPFTE_LDFLAGS=-shared -Wl,-z,defs -ldl -lpthread
NPFTE_CFLAGS=$(NPFTECFLAGS) $(W32_CFLAGS) -DMULTITHREAD -fPIC -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG
NPFTEB_DIR=npfte_linux$(BITS)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_pulse.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
GL_EXE_NAME=../$(EXE_NAME)-gl$(BITS)
@ -1821,7 +1808,6 @@ releases:
# -$(MAKE) FTE_TARGET=win32 relcl
-$(MAKE) droid-rel
-$(MAKE) web-rel
-$(MAKE) FTE_TARGET=win32 npfte-rel
autoconfig: clean
/bin/bash makeconfig.sh y
@ -1841,9 +1827,6 @@ $(OUT_DIR)/resources.o : winquake.rc
$(DO_WINDRES)
$(OUT_DIR)/fteqcc.o : fteqcc.rc
$(DO_WINDRES)
#npAPI stuff requires some extra resources
$(OUT_DIR)/npplug.o : ftequake/npplug.rc
$(DO_WINDRES)
#$(OUT_DIR)/%.d: %.c
@ -2137,14 +2120,13 @@ help:
@-echo "'glcl-???' (currently broken)"
@-echo "'droid-???' (cross compiles Android package)"
@-echo "'web-???' (compiles javascript/emscripten page)"
@-echo "'npfte-???' (cross compiles QuakeTV Firefox/Netscape browser plugin)"
@-echo ""
@-echo "Cross targets can be specified with FTE_TARGET=blah"
@-echo "linux32, linux64 specify specific x86 archs"
@-echo "SDL - Attempt to use sdl for the current target"
@-echo "win32 - Mingw compile for win32"
@-echo "vc - Attempts to use msvc8+ to compile. Note: uses profile guided optimisations. You must build+run the relevent profile target before a release target will compile properly. Debug doesn't care."
@-echo "android, npfte, targets explicitly cross compile, and should generally not be given an FTE_TARGET."
@-echo "android targets explicitly cross compile, and should generally not be given an FTE_TARGET."
clean:
-rm -f -r $(RELEASE_DIR)
@ -2163,34 +2145,6 @@ distclean: clean
-rm -f -r libs/SDL2-$(SDL2VER)
#################################################
#npfte
npfte-tmprel: reldir
@$(MAKE) $(OUT_DIR)/$(EXE_NAME) OUT_DIR="$(OUT_DIR)" WCFLAGS="$(NPFTE_CFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(NPFTE_LDFLAGS) $(LDFLAGS) $(RELEASE_LDFLAGS)" OBJS="NPFTE_OBJS"
npfte-tmpdbg: debugdir
@$(MAKE) $(OUT_DIR)/$(EXE_NAME) OUT_DIR="$(OUT_DIR)" WCFLAGS="$(NPFTE_CFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(NPFTE_LDFLAGS) $(LDFLAGS) $(DEBUG_LDFLAGS)" OBJS="NPFTE_OBJS"
npfte-rel:
-@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)w32" EXE_NAME="../npfte.dll" PRECOMPHEADERS="" FTE_TARGET=win32
-@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)l32" EXE_NAME="../npfte32.so" PRECOMPHEADERS="" FTE_TARGET=linux32
-@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)l64" EXE_NAME="../npfte64.so" PRECOMPHEADERS="" FTE_TARGET=linux64
-cp $(RELEASE_DIR)/npfte.dll npfte/plugins
-cp $(RELEASE_DIR)/npfte32.so npfte/plugins
-cp $(RELEASE_DIR)/npfte64.so npfte/plugins
cd npfte && zip $(abspath $(RELEASE_DIR)/npfte.xpi) install.rdf plugins/npfte.dll plugins/npfte32.so plugins/npfte64.so
rm -rf /tmp/npfte
mkdir /tmp/npfte
cp $(RELEASE_DIR)/npfte.dll /tmp/npfte
cp ./npfte/manifest.json /tmp/npfte
-cd $(RELEASE_DIR)/ && ../npfte/crxmake.sh /tmp/npfte ../npfte/chrome.pem
rm -rf /tmp/npfte
npfte-dbg:
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)w32" EXE_NAME="../npfte.dll" PRECOMPHEADERS="" FTE_TARGET=win32
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)l32" EXE_NAME="../npfte32.so" PRECOMPHEADERS="" FTE_TARGET=linux32
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)l64" EXE_NAME="../npfte64.so" PRECOMPHEADERS="" FTE_TARGET=linux64
npfte-profile:
@$(MAKE) npfte-tmp TYPE=_npfte-profile OUT_DIR="$(PROFILE_DIR)/$(NPFTEB_DIR)"
#################################################
#webgl helpers

View file

@ -1567,9 +1567,7 @@ static void VARGS png_onerror(png_structp png_ptr, png_const_charp error_msg)
static void VARGS png_onwarning(png_structp png_ptr, png_const_charp warning_msg)
{
struct pngerr *err = qpng_get_error_ptr(png_ptr);
#ifndef NPFTE
Con_DPrintf("libpng %s: %s\n", err->fname, warning_msg);
#endif
}
qbyte *ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean force_rgb32)
@ -1792,7 +1790,6 @@ error:
#ifndef NPFTE
int Image_WritePNG (const char *filename, enum fs_relative fsroot, int compression, void **buffers, int numbuffers, qintptr_t bufferstride, int width, int height, enum uploadfmt fmt, qboolean writemetadata)
{
char name[MAX_OSPATH];
@ -2035,7 +2032,6 @@ err:
Con_Printf("File error writing %s\n", filename);
return false;
}
#endif
#endif
@ -2453,7 +2449,6 @@ badjpeg:
}
/*end read*/
#ifndef NPFTE
/*begin write*/
@ -2664,7 +2659,6 @@ qboolean screenshotJPEG(char *filename, enum fs_relative fsroot, int compression
return ret;
}
#endif
#endif
#ifdef IMAGEFMT_PCX
/*

View file

@ -1294,9 +1294,7 @@ static void R_RegisterBuiltinRenderers(void)
R_RegisterRenderer(NULL, &fbdevrendererinfo); //direct stuff that doesn't interact well with the system should always be low priority
}
#endif
#ifndef NPQTV
R_RegisterRenderer(NULL, &dedicatedrendererinfo);
#endif
#ifdef HEADLESSQUAKE
{
extern rendererinfo_t headlessrenderer;

View file

@ -1,842 +0,0 @@
//as of firefox 52(march 2017), firefox no longer supports npapi (except for flash, the buggiest of them all, stupid stupid)
//chrome 42 disabled support by default, and completely removed by 45 (sept 2015).
//no browser with > 1% market share can actually use this.
#include "quakedef.h"
#include "winquake.h"
#define bool int //we ain't c++ (grr microsoft stdbool.h gief!)
#ifdef _WIN32
#ifndef _WINDOWS
#define _WINDOWS //stupid GCC
#endif
#else
#define XP_UNIX
#define MOZ_X11
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#endif
#include "../libs/npapi/npupp.h"
#include "sys_plugfte.h"
/*work around absolute crapness in the npapi headers*/
#define Q_STRINGZ_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
NPString str = { _val, strlen(_val) }; \
(_v).type = NPVariantType_String; \
(_v).value.stringValue = str; \
NP_END_MACRO
#undef STRINGZ_TO_NPVARIANT
#define STRINGZ_TO_NPVARIANT Q_STRINGZ_TO_NPVARIANT
#define Q_STRINGN_TO_NPVARIANT(_val, _len, _v) \
NP_BEGIN_MACRO \
NPString str = { _val, _len }; \
(_v).type = NPVariantType_String; \
(_v).value.stringValue = str; \
NP_END_MACRO
#undef STRINGN_TO_NPVARIANT
#define STRINGN_TO_NPVARIANT Q_STRINGN_TO_NPVARIANT
#define FIREFOX_BUGS_OVER_25MB
//TODO: player name input (before allowing them to join)
//TODO: fix active gl context (per thread, and we hijacked the browser's thread)
NPNetscapeFuncs *browserfuncs;
#ifdef _WIN32
#ifndef GetWindowLongPtr
#define GetWindowLongPtr GetWindowLong
#endif
#ifndef SetWindowLongPtr
#define SetWindowLongPtr SetWindowLong
#define LONG_PTR LONG
#endif
#ifndef GWLP_WNDPROC
#define GWLP_WNDPROC GWL_WNDPROC
#endif
#ifndef GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#endif
#endif
qboolean NPFTE_BeginDownload(void *ctx, struct pipetype *ftype, char *url)
{
return NPERR_NO_ERROR==browserfuncs->geturlnotify(ctx, url, NULL, ftype);
}
void NPFTE_StatusChanged(void *sysctx)
{ //potentially called from another thread
NPP instance = sysctx;
struct contextpublic *pub = instance->pdata;
#ifdef _WIN32
InvalidateRgn(pub->oldwnd, NULL, FALSE);
#endif
}
#ifdef _WIN32
void DrawWndBack(struct context *ctx, HWND hWnd, HDC hdc, PAINTSTRUCT *p)
{
int width, height;
HBITMAP bmp = Plug_GetSplashBack(ctx, hdc, &width, &height);
if (bmp)
{
HDC memDC;
RECT irect;
memDC = CreateCompatibleDC(hdc);
SelectObject(memDC, bmp);
GetClientRect(hWnd, &irect);
StretchBlt(hdc, irect.left, irect.top, irect.right-irect.left,irect.bottom-irect.top, memDC, 0, 0, width, height, SRCCOPY);
SelectObject(memDC, NULL);
DeleteDC(memDC);
Plug_ReleaseSplashBack(ctx, bmp);
}
else
PatBlt(hdc, p->rcPaint.left, p->rcPaint.top, p->rcPaint.right-p->rcPaint.left,p->rcPaint.bottom-p->rcPaint.top,PATCOPY);
}
LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct context *ctx;
struct contextpublic *pub;
ctx = (struct context *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (!ctx)
return DefWindowProc(hWnd, msg, wParam, lParam);
pub = (struct contextpublic*)ctx;
switch(msg)
{
case WM_USER:
/*if the plugin is somewhere in video code, the plugin might depend upon us being able to respond to window messages*/
/* while(ctx->queuedstreams)
{
struct qstream *strm;
strm = ctx->queuedstreams;
ctx->queuedstreams = strm->next;
if (!browserfuncs->geturlnotify(ctx->nppinstance, strm->url, NULL, strm->type))
{
VS_DebugLocation(__FILE__, __LINE__, "Starting Download %s", strm->url);
if (strm->type->wait == WAIT_YES)
ctx->waitingfordatafiles++;
}
free(strm);
}
*/
return TRUE;
case WM_ERASEBKGND:
return FALSE;
case WM_PAINT:
if (*pub->statusmessage)
{
HDC hdc;
PAINTSTRUCT paint;
unsigned int progress;
unsigned int total;
progress = pub->dldone;
total = pub->dlsize;
hdc = BeginPaint(hWnd, &paint);
DrawWndBack(ctx, hWnd, hdc, &paint);
SetBkMode(hdc, TRANSPARENT);
TextOutA(hdc, 0, 0, pub->statusmessage, strlen(pub->statusmessage));
EndPaint(hWnd, &paint);
return TRUE;
}
else if (pub->downloading)
{
HDC hdc;
PAINTSTRUCT paint;
char s[32];
unsigned int progress;
unsigned int total;
progress = pub->dldone;
total = pub->dlsize;
hdc = BeginPaint(hWnd, &paint);
DrawWndBack(ctx, hWnd, hdc, &paint);
SetBkMode(hdc, TRANSPARENT);
TextOutA(hdc, 0, 0, "Downloading Data, please wait", 16);
if (!progress && !total)
sprintf(s, "connecting");
else if (total)
sprintf(s, "%i bytes (%i%%)", progress, (int)((100.0f*progress)/total));
else
sprintf(s, "%i bytes", progress);
TextOutA(hdc, 0, 32, s, strlen(s));
EndPaint(hWnd, &paint);
return TRUE;
}
else
{
HDC hdc;
PAINTSTRUCT paint;
char *s;
hdc = BeginPaint(hWnd, &paint);
DrawWndBack(ctx, hWnd, hdc, &paint);
SetBkMode(hdc, TRANSPARENT);
if (!pub->running)
{
s = "Click to activate";
TextOutA(hdc, 0, 0, s, strlen(s));
if (pub->availver)
{
s = "Your plugin may be incompatible";
TextOutA(hdc, 0, 32, s, strlen(s));
s = "A newer version is available. Your version is dated " __DATE__ ".";
TextOutA(hdc, 0, 48, s, strlen(s));
}
}
EndPaint(hWnd, &paint);
return TRUE;
}
break;
case WM_LBUTTONDOWN:
SetActiveWindow(hWnd);
if (!Plug_StartContext(ctx))
Plug_StopContext(NULL, false);
break;
default:
break;
}
//I would call the previous wndproc... but that crashes firefox
return DefWindowProc(hWnd, msg, wParam, lParam);
}
#else
static struct
{
void *x11;
void *xt;
//X11 funcs
int (*XSelectInput)(Display *display, Window w, long event_mask);
//Xt funcs
Widget (*XtWindowToWidget)(Display *display, Window window);
void (*XtAddEventHandler)(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data);
} x;
qboolean x_initlibs(void)
{
static dllfunction_t xt_funcs[] =
{
{(void**)&x.XtWindowToWidget, "XtWindowToWidget"},
{(void**)&x.XtAddEventHandler, "XtAddEventHandler"},
{NULL, NULL}
};
static dllfunction_t x11_funcs[] =
{
{(void**)&x.XSelectInput, "XSelectInput"},
{NULL, NULL}
};
if (!x.xt)
x.xt = Sys_LoadLibrary("libXt", xt_funcs);
if (!x.xt)
{
Con_Printf("Please install the appropriate libXt for your browser's cpu archetecture\n");
return false;
}
if (!x.x11)
x.x11 = Sys_LoadLibrary("libX11", x11_funcs);
if (!x.x11)
{
Con_Printf("Please install the appropriate libX11 for your browser's cpu archetecture\n");
return false;
}
return true;
}
#endif
static const struct browserfuncs npfte_browserfuncs =
{
NPFTE_BeginDownload,
NPFTE_StatusChanged
};
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc, char* argn[],
char* argv[], NPSavedData* saved)
{
int i;
struct context *ctx;
if (!instance || instance->pdata)
{
return NPERR_INVALID_INSTANCE_ERROR;
}
if (mode != NP_EMBED && mode != NP_FULL)
{
return NPERR_INVALID_PLUGIN_ERROR;
}
// browserfuncs->setvalue(instance, NPPVpluginWindowBool, (void*)FALSE);
// browserfuncs->setvalue(instance, NPPVpluginTransparentBool, (void*)TRUE);
ctx = Plug_CreateContext(instance, &npfte_browserfuncs);
instance->pdata = ctx;
if (!ctx)
{
return NPERR_OUT_OF_MEMORY_ERROR;
}
//parse out the properties
for (i = 0; i < argc; i++)
{
Plug_SetString(ctx, Plug_FindProp(ctx, argn[i]), argv[i]);
}
return NPERR_NO_ERROR;
}
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save)
{
struct context *ctx = instance->pdata;
struct contextpublic *pub = (struct contextpublic *)ctx;
if (!ctx)
return NPERR_INVALID_INSTANCE_ERROR;
#ifdef _WIN32
if (pub->oldwnd)
{
if (pub->oldproc)
SetWindowLongPtr(pub->oldwnd, GWLP_WNDPROC, (LONG_PTR)pub->oldproc);
SetWindowLongPtr(pub->oldwnd, GWLP_USERDATA, (LONG_PTR)NULL);
}
#endif
Plug_DestroyContext(ctx);
instance->pdata = NULL;
return NPERR_NO_ERROR;
}
#ifdef MOZ_X11
static void myxteventcallback (Widget w, XtPointer closure, XEvent *event, Boolean *cont)
{
switch(event->type)
{
case MotionNotify:
// Con_Printf("Motion Mouse event\n");
break;
case ButtonPress:
if (event->xbutton.button == 1)
{
if (!Plug_StartContext(closure))
Plug_StopContext(NULL, false);
}
break;
default:
// Con_Printf("other event (%i)\n", event->type);
break;
}
}
#endif
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window)
{
struct context *ctx = instance->pdata;
struct contextpublic *pub = (struct contextpublic*)ctx;
#ifdef _WIN32
WNDPROC p;
if (!ctx)
return NPERR_INVALID_INSTANCE_ERROR;
//if the window changed
if (Plug_ChangeWindow(ctx, window->window, 0, 0, window->width, window->height))
{
//we switched window?
if (pub->oldwnd && pub->oldproc)
{
SetWindowLongPtr(pub->oldwnd, GWLP_WNDPROC, (LONG_PTR)pub->oldproc);
}
pub->oldproc = NULL;
p = (WNDPROC)GetWindowLongPtr(window->window, GWLP_WNDPROC);
if (p != MyPluginWndProc)
pub->oldproc = p;
pub->oldwnd = window->window;
SetWindowLongPtr(window->window, GWLP_WNDPROC, (LONG_PTR)MyPluginWndProc);
SetWindowLongPtr(window->window, GWLP_USERDATA, (LONG_PTR)ctx);
}
InvalidateRgn(window->window, NULL, FALSE);
#endif
#ifdef MOZ_X11
Window wnd = (Window)window->window;
NPSetWindowCallbackStruct *ws = window->ws_info;
Widget xtw = x.XtWindowToWidget (ws->display, wnd);
x.XSelectInput(ws->display, wnd, ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|EnterWindowMask);
x.XtAddEventHandler(xtw, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, FALSE, myxteventcallback, ctx);
if (Plug_ChangeWindow(ctx, window->window, 0, 0, window->width, window->height))
{
}
#endif
return NPERR_NO_ERROR;
}
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16* stype)
{
return NPERR_NO_ERROR;
/* struct context *ctx = instance->pdata;
struct qstream *qstr;
stream->pdata = qstr = malloc(sizeof(*qstr) + strlen(stream->url));
memset(qstr, 0, sizeof(*qstr));
strcpy(qstr->url, stream->url);
Plug_LockPlugin(ctx, true);
qstr->next = ctx->activestreams;
if (qstr->next)
qstr->next->prev = qstr;
ctx->activestreams = qstr;
Plug_LockPlugin(ctx, false);
if (!stream->notifyData)
{
//choose source type based on mime type
if (!strncmp(type, "text/x-quaketvident", 5))
stream->notifyData = &QTVFileDescriptor;
else if (!strcmp(type, "application/x-multiviewdemo"))
stream->notifyData = &DemoFileDescriptor;
//well that failed, try choosing based on extension
else if (!strcmp(COM_FileExtension(stream->url), "qtv"))
stream->notifyData = &QTVFileDescriptor;
else
return NPERR_INVALID_PARAM;
}
qstr->type = stream->notifyData;
if (qstr->type->needseeking)
{
*stype = NP_ASFILEONLY; //everything is a download
#ifdef FIREFOX_BUGS_OVER_25MB
*stype = NP_NORMAL;
qstr->pipe = FS_OpenTemp();
#endif
}
else
{
*stype = NP_NORMAL;
qstr->pipe = VFSPIPE_Open();
}
return NPERR_NO_ERROR;*/
}
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason)
{
return NPERR_NO_ERROR;
/* struct context *ctx = instance->pdata;
struct qstream *qstr = stream->pdata;
if (!qstr) //urm, got canceled before it finished downloading?
return NPERR_NO_ERROR;
if (qstr->type->wait == WAIT_YES)
{
ctx->waitingfordatafiles--;
}
if (qstr->next)
qstr->next->prev = qstr->prev;
if (qstr->prev)
qstr->prev->next = qstr->next;
else
ctx->activestreams = qstr->next;
if (qstr->type->wait == WAIT_NONACTIVE)
{
Plug_LockPlugin(ctx, true);
qstr->type->completionfunc(ctx, qstr->pipe, qstr->url);
Plug_LockPlugin(ctx, false);
}
else
{
qstr->next = ctx->donestreams;
ctx->donestreams = qstr;
}
if (qstr && qstr->type && qstr->type->wait)
{
InvalidateRgn(ctx->window.window, NULL, FALSE);
}
return NPERR_NO_ERROR;*/
}
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream)
{
return 8192;
/* struct qstream *qstr = stream->pdata;
vfsfile_t *pipe = qstr?qstr->pipe:NULL;
if (pipe && pipe->seekingisabadplan)
return 1024*1024 - VFS_GETLEN(pipe);
else
return 8192;*/
}
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer)
{
return len;
/* int bytes = NPP_WriteReady(instance, stream);
struct context *ctx = instance->pdata;
struct qstream *qstr = stream->pdata;
if (qstr && qstr->type && qstr->type->wait)
{
qstr->offset = offset;
qstr->size = stream->end;
InvalidateRgn(ctx->window.window, NULL, FALSE);
}
if (!qstr || !qstr->pipe)
return bytes;
//we're not meant to read more bytes than we said we could read.
if (len > bytes)
len = bytes;
return VFS_WRITE(qstr->pipe, buffer, len);*/
}
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname)
{
return;
/* struct qstream *qstr = stream->pdata;
if (!qstr)
return;
if (qstr->pipe)
VFS_CLOSE(qstr->pipe);
qstr->pipe = VFSOS_Open(fname, "rb");
*/
}
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint)
{
//we don't support printing.
//paper and ink doesn't give a good frame rate.
return;
}
int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event)
{
// MessageBox(NULL, "NPP_HandleEvent", "npapi", 0);
return NPERR_NO_ERROR;
}
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData)
{
}
struct npscript
{
NPObject obj;
struct context *ctx;
};
NPObject *npscript_allocate(NPP npp, NPClass *aClass)
{
struct npscript *obj;
obj = malloc(sizeof(*obj));
obj->obj._class = aClass;
obj->obj.referenceCount = 1;
obj->ctx = npp->pdata;
return (NPObject*)obj;
}
void npscript_deallocate(NPObject *npobj)
{
free(npobj);
}
void npscript_invalidate(NPObject *npobj)
{
struct npscript *obj = (struct npscript *)npobj;
obj->ctx = NULL;
}
bool npscript_hasMethod(NPObject *npobj, NPIdentifier name)
{
NPUTF8 *mname;
mname = browserfuncs->utf8fromidentifier(name);
return false;
}
bool npscript_invoke(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
return false;
}
bool npscript_invokeDefault(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
return false;
}
bool npscript_hasProperty(NPObject *npobj, NPIdentifier name)
{
struct npscript *obj = (struct npscript *)npobj;
NPUTF8 *pname;
pname = browserfuncs->utf8fromidentifier(name);
if (Plug_FindProp(obj->ctx, pname))
return true;
return false;
}
bool npscript_getProperty(NPObject *npobj, NPIdentifier name, NPVariant *result)
{
struct npscript *obj = (struct npscript *)npobj;
struct context *ctx = obj->ctx;
NPUTF8 *pname;
int prop;
bool success = false;
const char *strval;
int intval;
float floatval;
pname = browserfuncs->utf8fromidentifier(name);
Plug_LockPlugin(ctx, true);
prop = Plug_FindProp(obj->ctx, pname);
if (prop >= 0)
{
if (Plug_GetString(ctx, prop, &strval))
{
char *ns;
int len;
len = strlen(strval);
if (!len)
{
STRINGN_TO_NPVARIANT(NULL, 0, *result);
success = true;
}
else
{
ns = browserfuncs->memalloc(len+1);
if (ns)
{
memcpy(ns, strval, len+1);
STRINGZ_TO_NPVARIANT(ns, *result);
success = true;
}
}
Plug_GotString(strval);
}
else if (Plug_GetInteger(ctx, prop, &intval))
{
INT32_TO_NPVARIANT(intval, *result);
success = true;
}
else if (Plug_GetFloat(ctx, prop, &floatval))
{
DOUBLE_TO_NPVARIANT(floatval, *result);
success = true;
}
}
Plug_LockPlugin(ctx, false);
return success;
}
bool npscript_setProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value)
{
struct npscript *obj = (struct npscript *)npobj;
struct context *ctx = obj->ctx;
NPUTF8 *pname;
NPString str;
int prop;
bool success = false;
pname = browserfuncs->utf8fromidentifier(name);
Plug_LockPlugin(ctx, true);
prop = Plug_FindProp(obj->ctx, pname);
if (prop >= 0)
{
success = true;
if (NPVARIANT_IS_STRING(*value))
{
char *t = NULL;
str = NPVARIANT_TO_STRING(*value);
if (str.utf8characters[str.utf8length] != 0)
{
t = malloc(str.utf8length+1);
memcpy(t, str.utf8characters, str.utf8length);
t[str.utf8length] = 0;
str.utf8characters = t;
}
Plug_SetString(ctx, prop, str.utf8characters);
if (t)
free(t);
}
else if (NPVARIANT_IS_INT32(*value))
Plug_SetInteger(ctx, prop, NPVARIANT_TO_INT32(*value));
else if (NPVARIANT_IS_BOOLEAN(*value))
Plug_SetInteger(ctx, prop, NPVARIANT_TO_BOOLEAN(*value));
else if (NPVARIANT_IS_DOUBLE(*value))
Plug_SetFloat(ctx, prop, NPVARIANT_TO_DOUBLE(*value));
else
success = false;
}
Plug_LockPlugin(ctx, false);
return success;
}
bool npscript_removeProperty(NPObject *npobj, NPIdentifier name)
{
return false;
}
bool npscript_enumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
{
return false;
}
bool npscript_construct(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
return false;
}
NPClass npscript_class =
{
NP_CLASS_STRUCT_VERSION,
npscript_allocate,
npscript_deallocate,
npscript_invalidate,
npscript_hasMethod,
npscript_invoke,
npscript_invokeDefault,
npscript_hasProperty,
npscript_getProperty,
npscript_setProperty,
npscript_removeProperty,
npscript_enumerate,
npscript_construct
};
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
switch(variable)
{
case NPPVpluginScriptableNPObject:
*(void**)value = browserfuncs->createobject(instance, &npscript_class);
return NPERR_NO_ERROR;
default:
return NPERR_INVALID_PARAM;
}
return NPERR_NO_ERROR;
}
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value)
{
switch(variable)
{
default:
return NPERR_INVALID_PARAM;
}
return NPERR_NO_ERROR;
}
NPError OSCALL NP_Shutdown(void)
{
/* if (contextlist)
{ //the browser isn't meant to call this when there's still instances left...
return NPERR_GENERIC_ERROR;
}
*/
return NPERR_NO_ERROR;
}
NPError OSCALL NP_GetValue(void *instance, NPPVariable variable, void *value)
{
if (value == NULL)
return NPERR_INVALID_PARAM;
switch(variable)
{
case NPPVpluginNameString:
*(char**)value = FULLENGINENAME;
break;
case NPPVpluginDescriptionString:
*(char**)value = FULLENGINENAME;
break;
default:
return NPERR_INVALID_PARAM;
}
return NPERR_NO_ERROR;
}
NPError OSCALL NP_GetEntryPoints (NPPluginFuncs* pFuncs)
{
if (pFuncs->size < sizeof(NPPluginFuncs))
return NPERR_INVALID_FUNCTABLE_ERROR;
pFuncs->size = sizeof(NPPluginFuncs);
pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
pFuncs->newp = NPP_New;
pFuncs->destroy = NPP_Destroy;
pFuncs->setwindow = NPP_SetWindow;
pFuncs->newstream = NPP_NewStream;
pFuncs->destroystream = NPP_DestroyStream;
pFuncs->asfile = NPP_StreamAsFile;
pFuncs->writeready = NPP_WriteReady;
pFuncs->write = NPP_Write;
pFuncs->print = NPP_Print;
pFuncs->event = NPP_HandleEvent;
pFuncs->urlnotify = NPP_URLNotify;
pFuncs->javaClass = NULL;
pFuncs->getvalue = NPP_GetValue;
pFuncs->setvalue = NPP_SetValue;
return NPERR_NO_ERROR;
}
#ifdef _WIN32
NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs)
{
Plug_GetFuncs(1);
browserfuncs = pFuncs;
return NPERR_NO_ERROR;
}
#else
NPError OSCALL NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs)
{
NPError err;
Plug_GetFuncs(1);
browserfuncs = aNPNFuncs;
err = NP_GetEntryPoints(aNPPFuncs);
if (err != NPERR_NO_ERROR)
return err;
if (!x_initlibs())
return NPERR_MODULE_LOAD_FAILED_ERROR;
return NPERR_NO_ERROR;
}
#endif
char *NP_GetMIMEDescription(void)
{
return
"text/x-quaketvident:qtv:QTV Stream Description"
";"
"application/x-multiviewdemo:mvd:Multiview Demo"
";"
"application/x-fteplugin:fmf:FTE Engine Plugin"
;
}

View file

@ -411,7 +411,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SQL
#endif
#if defined(AVAIL_GZDEC) && (!defined(AVAIL_ZLIB) || defined(NPFTE) || defined(NO_ZLIB))
#if defined(AVAIL_GZDEC) && (!defined(AVAIL_ZLIB) || defined(NO_ZLIB))
//gzip needs zlib to work (pk3s can still contain non-compressed files)
#undef AVAIL_GZDEC
#endif
@ -428,20 +428,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef PACKAGE_DZIP
#endif
//fix things a little...
#ifdef NPQTV
#define NPFTE
#undef NPQTV
#endif
#ifdef NPFTE
/*plugins require threads and stuff now, and http download support*/
#ifndef MULTITHREAD
#define MULTITHREAD
#define WEBCLIENT
#endif
#undef SUBSERVERS
#endif
#if (defined(NOLOADERTHREAD) || !defined(MULTITHREAD)) && defined(LOADERTHREAD)
#undef LOADERTHREAD
#endif
@ -463,13 +449,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#endif
#ifdef NPFTE
#undef TEXTEDITOR
#undef WEBSERVER //http server
#undef FTPSERVER //ftp server
#undef FTPCLIENT //ftp client.
#endif
#ifndef AVAIL_ZLIB
#undef SUPPORT_ICE //depends upon zlib's crc32 for fingerprinting. I cba writing my own.
#endif

View file

@ -5529,7 +5529,7 @@ qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *base
return true;
}
#if !defined(NPFTE) && defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
#if defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
if (allowprompts && poshname && *gamename && !COM_CheckParm("-manifest"))
{
if (Sys_DoDirectoryPrompt(basepath, basepathlen, poshname, gamename))
@ -5689,7 +5689,7 @@ qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *base
}
}
#if !defined(NPFTE) && defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
#if defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
if (allowprompts && poshname && *gamename && !COM_CheckParm("-manifest"))
{
if (Sys_DoDirectoryPrompt(basepath, basepathlen, poshname, gamename))
@ -7610,18 +7610,11 @@ static qboolean FS_GetBestHomeDir(ftemanifest_t *manifest)
}
}
#ifdef NPFTE
if (!*com_homepath)
Q_snprintfz(com_homepath, sizeof(com_homepath), "/%s/", HOMESUBDIR);
//as a browser plugin, always use their home directory
return true;
#else
/*would it not be better to just check to see if we have write permission to the basedir?*/
if (winver >= 0x6) // Windows Vista and above
usehome = true; // always use home directory by default, as Vista+ mimics this behavior anyway
else if (winver >= 0x5) // Windows 2000/XP/2003
usehome = true; //might as well follow this logic. We use .manifest stuff to avoid getting redirected to obscure locations, so access rights is all that is relevant, not whether we're an admin or not.
#endif
if (usehome && manifest)
{

View file

@ -200,10 +200,6 @@ void *Sys_CreateMutexNamed(char *file, int line);
void Sys_Sleep(double seconds);
#ifdef NPFTE
qboolean NPQTV_Sys_Startup(int argc, char *argv[]);
void NPQTV_Sys_MainLoop(void);
#endif
#define UPD_OFF 0
#define UPD_STABLE 1

View file

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h"
#include <conio.h>
#if (defined(_DEBUG) || defined(DEBUG)) && !defined(NPFTE)
#if (defined(_DEBUG) || defined(DEBUG))
#if !defined(_MSC_VER) || _MSC_VER > 1200
#define CATCHCRASH
#endif

View file

@ -1440,9 +1440,7 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
{
int temp;
qboolean stat;
#ifndef NPFTE
MSG msg;
#endif
// HDC hdc;
vrsetup_t setup = {sizeof(setup)};
@ -1623,7 +1621,6 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
// Who knows if it helps, but it probably doesn't hurt
SetForegroundWindow (mainwindow);
#ifndef NPFTE
/*I don't like this, but if we */
Sleep (100);
while (PeekMessage (&msg, mainwindow, 0, 0, PM_REMOVE))
@ -1632,7 +1629,6 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
DispatchMessage (&msg);
}
Sleep (100);
#endif
SetWindowPos (mainwindow, HWND_TOP, 0, 0, 0, 0,
SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW |

View file

@ -6,9 +6,7 @@
#include "fs.h"
#if defined(WEBCLIENT)
#ifndef NPFTE
static struct dl_download *activedownloads;
#endif
#if defined(FTE_TARGET_WEB)
@ -148,10 +146,6 @@ typedef struct cookie_s
} cookie_t;
cookie_t *cookies;
#ifdef NPFTE
#define Z_Malloc malloc
#define Z_Free free
#endif
//set a specific cookie.
void Cookie_Feed(char *domain, int secure, char *name, char *value)
@ -284,12 +278,8 @@ void Cookie_Regurgitate(char *domain, int secure, char *buffer, size_t buffersiz
struct http_dl_ctx_s {
// struct dl_download *dlctx;
#ifndef NPFTE
vfsfile_t *stream;
SOCKET sock; //so we can wait on it when multithreaded.
#else
SOCKET sock; //FIXME: support https.
#endif
char *buffer;
@ -317,15 +307,9 @@ void HTTP_Cleanup(struct dl_download *dl)
struct http_dl_ctx_s *con = dl->ctx;
dl->ctx = NULL;
#ifndef NPFTE
if (con->stream)
VFS_CLOSE(con->stream);
con->stream = NULL;
#else
if (con->sock != INVALID_SOCKET)
closesocket(con->sock);
con->sock = INVALID_SOCKET;
#endif
free(con->buffer);
free(con);
@ -413,7 +397,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
switch(con->state)
{
case HC_REQUESTING:
#ifndef NPFTE
ammount = VFS_WRITE(con->stream, con->buffer, con->bufferused);
if (!ammount)
return true;
@ -423,19 +407,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
dl->replycode = VFSError_To_HTTP(ammount);
return false;
}
#else
ammount = send(con->sock, con->buffer, con->bufferused, 0);
if (!ammount)
return false;
if (ammount < 0)
{
if (neterrno() != NET_EWOULDBLOCK)
return false;
return true;
}
#endif
con->bufferused -= ammount;
memmove(con->buffer, con->buffer+ammount, con->bufferused);
@ -447,7 +418,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (con->bufferlen - con->bufferused < 1530)
ExpandBuffer(con, 1530);
#ifndef NPFTE
ammount = VFS_READ(con->stream, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15);
if (!ammount)
return true;
@ -457,17 +427,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
dl->replycode = VFSError_To_HTTP(ammount);
return false;
}
#else
ammount = recv(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15, 0);
if (!ammount)
return false;
if (ammount < 0)
{
if (neterrno() != NET_EWOULDBLOCK)
return false;
return true;
}
#endif
con->bufferused+=ammount;
con->buffer[con->bufferused] = '\0';
@ -686,7 +645,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (!dl->file)
{
#ifndef NPFTE
if (*dl->localname)
{
FS_CreatePath(dl->localname, dl->fsroot);
@ -694,7 +652,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
}
else
dl->file = FS_OpenTemp();
#endif
if (!dl->file)
{
if (*dl->localname)
@ -725,21 +683,11 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (con->bufferlen - con->bufferused < 1530)
ExpandBuffer(con, 1530);
#ifndef NPFTE
ammount = VFS_READ(con->stream, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1);
if (ammount == 0)
return true; //no data yet
else if (ammount < 0)
ammount = 0; //error (EOF?)
#else
ammount = recv(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1, 0);
if (ammount < 0)
{
if (neterrno() != NET_EWOULDBLOCK)
return false;
return true;
}
#endif
con->bufferused+=ammount;
@ -886,12 +834,6 @@ firstread:
void HTTPDL_Establish(struct dl_download *dl)
{
#ifdef NPFTE
unsigned long _true = true;
struct sockaddr_qstorage serveraddr;
int addressfamily;
int addresssize;
#endif
struct http_dl_ctx_s *con;
qboolean https = false;
@ -935,7 +877,6 @@ void HTTPDL_Establish(struct dl_download *dl)
dl->status = DL_RESOLVING;
#ifndef NPFTE
con->sock = INVALID_SOCKET;
con->stream = NULL;
con->secure = false;
@ -968,53 +909,6 @@ void HTTPDL_Establish(struct dl_download *dl)
dl->status = DL_FAILED;
return;
}
#else
con->secure = false;
if (https || !NET_StringToSockaddr(con->server, 80, &serveraddr, &addressfamily, &addresssize))
{
dl->status = DL_FAILED;
return;
}
dl->status = DL_QUERY;
if ((con->sock = socket (addressfamily, SOCK_STREAM, IPPROTO_TCP)) == -1)
{
dl->status = DL_FAILED;
return;
}
//don't bother binding. its optional.
//FIXME: make the connect call with a non-blocking socket.
//FIXME: use a vfsfile_t instead of a direct socket to support https
//not yet blocking.
if (connect(con->sock, (struct sockaddr *)&serveraddr, addresssize) == -1)
{
int err = neterrno();
switch(err)
{
case NET_EACCES:
Con_Printf("HTTP: connect(%s): access denied. Check firewall.\n", con->server);
break;
case NET_ETIMEDOUT:
Con_Printf("HTTP: connect(%s): timed out.\n", con->server);
break;
default:
Con_Printf("HTTP: connect(%s): %s", con->server, strerror(neterrno()));
break;
}
dl->status = DL_FAILED;
return;
}
if (ioctlsocket (con->sock, FIONBIO, &_true) == -1) //now make it non blocking.
{
dl->status = DL_FAILED;
return;
}
#endif
#ifdef COOKIECOOKIECOOKIE
Cookie_Regurgitate(con->server, con->secure, cookies, sizeof(cookies));
#endif
@ -1227,7 +1121,6 @@ qboolean DataScheme_Decode(struct dl_download *dl)
if (!dl->file)
{
#ifndef NPFTE
if (*dl->localname)
{
FS_CreatePath(dl->localname, dl->fsroot);
@ -1235,7 +1128,6 @@ qboolean DataScheme_Decode(struct dl_download *dl)
}
else
dl->file = FS_OpenTemp();
#endif
if (!dl->file)
{
if (*dl->localname)
@ -1290,7 +1182,7 @@ qboolean DL_Decide(struct dl_download *dl)
#ifdef MULTITHREAD
static unsigned int dlthreads = 0;
#define MAXDOWNLOADTHREADS 4
#if defined(LOADERTHREAD) && !defined(NPFTE)
#if defined(LOADERTHREAD)
static void HTTP_Wake_Think(void *ctx, void *data, size_t a, size_t b)
{
dlthreads--;
@ -1305,25 +1197,14 @@ static int DL_Thread_Work(void *arg)
{
if (!dl->poll(dl))
{
#ifdef NPFTE
//the plugin doesn't have a download loop
if (dl->notifycomplete)
{
dl->notifycomplete(dl);
dl->notifycomplete = NULL;
}
if (dl->file)
VFS_CLOSE(dl->file);
#else
if (dl->status != DL_FAILED && dl->status != DL_FINISHED)
dl->status = DL_FAILED;
#endif
break;
}
}
dl->threadenable = false;
#if defined(LOADERTHREAD) && !defined(NPFTE)
#if defined(LOADERTHREAD)
COM_AddWork(WG_MAIN, HTTP_Wake_Think, NULL, NULL, 0, 0);
#endif
return 0;
@ -1345,7 +1226,7 @@ qboolean DL_CreateThread(struct dl_download *dl, vfsfile_t *file, void (*NotifyF
dl->notifycomplete = NotifyFunction;
dl->threadenable = true;
#if defined(LOADERTHREAD) && !defined(NPFTE)
#if defined(LOADERTHREAD)
if (dlthreads < 4)
#endif
{
@ -1385,7 +1266,7 @@ struct dl_download *DL_Create(const char *url)
newdl->poll = DL_Decide;
newdl->fsroot = FS_GAMEONLY;
newdl->sizelimit = 0x80000000u; //some sanity limit.
#if !defined(NPFTE) && !defined(SERVERONLY)
#if !defined(SERVERONLY)
newdl->qdownload.method = DL_HTTP;
#endif
@ -1403,7 +1284,6 @@ void DL_Close(struct dl_download *dl)
{
struct dl_download **link = NULL;
#ifndef NPFTE
for (link = &activedownloads; *link; link = &(*link)->next)
{
if (*link == dl)
@ -1412,9 +1292,8 @@ void DL_Close(struct dl_download *dl)
break;
}
}
#endif
#if !defined(NPFTE) && !defined(SERVERONLY)
#if !defined(SERVERONLY)
if (cls.download == &dl->qdownload)
cls.download = NULL;
#endif
@ -1440,7 +1319,6 @@ void DL_Close(struct dl_download *dl)
free(dl);
}
#ifndef NPFTE
void DL_DeThread(void)
{
#ifdef MULTITHREAD
@ -1639,7 +1517,6 @@ void HTTP_CL_Terminate(void)
Cookie_Monster();
#endif
}
#endif
#endif /*WEBCLIENT*/

View file

@ -1,16 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBANzHsq7OxZkTaHNZ/
/3Pf5bKt2D8K+Ahekwb/jw+BS2FtuRLV+8ffCVcgbAlWG5Bqxuk+y/xdzP5Rf2ria
sKGDkSyGiVB2JqDN4RIhsj1JfpBTKAl6/k4Wz+xzU5G4Ri/c7k9YnIvbXlad9N+YT
xjDR5pfdJMtGlnavuTVm8XGzFAgMBAAECgYEAyn6Kv1Q83ep0GaCJb3R6VIa3bMe9
QkPSVK40H3LO8vK6TWdhTpv1FJtlA3ctRWsLkj5eeJmiuFPAQyqrCOooTbPzfu/OV
t63bcxLGJ7CThJN/cWft6ISMWRurSgo6dequmph3ssHyWPWhQpoy/7+RbgUgKrvpK
0PUEs1xal/dKECQQD5kEMCeOS21DMeNobtTThEkKO83TXMEbH78i6sWK1LmD19t1A
Ni6HEWIVLSkmyY8ygR7A0Axejuf6ycEUdpkqZAkEA4nlk4D0BnJaP7ESq6NIY5Qzb
TsSCh870EuRrSpBy00BewXEUpRfz20o0XtB5k7jU2cNuvXN/D5CYo8KJAcCbDQJBA
LCJtF1TV7dddKuyts+3CE64Ypt/gEbTXax0LUANmskW8Ki1vBNY6x4R4HjaHDftER
twmtywM1DGib2AXeQTdkECQQDHGS+szxUuo1KtxIR4H9QQ8aePbMTQPglm3nbQW4M
G4u0qpI4gwZj5bRfzTtXDH1fIhb5CQVovxc/bD7fA2aG1AkEAgjDCxZhkqSP95ZUY
Zp3YgrFjC5Sin+oYz7xkfl1IrP4GQt9EJBXzO+UMSufeZfzKxS/BXNECNnxx5wOdZ
+KsUw==
-----END PRIVATE KEY-----

View file

@ -1,42 +0,0 @@
#!/bin/bash -e
#
# Purpose: Pack a Chromium extension directory into crx format
if test $# -ne 2; then
echo "Usage: crxmake.sh <extension dir> <pem path>"
exit 1
fi
dir=$1
key=$2
name=$(basename "$dir")
crx="$name.crx"
pub="$name.pub"
sig="$name.sig"
zip="$name.zip"
trap 'rm -f "$pub" "$sig" "$zip"' EXIT
# zip up the crx dir
cwd=$(pwd -P)
(cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)
# signature
openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig"
# public key
openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null
byte_swap () {
# Take "abcdefgh" and return it as "ghefcdab"
echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}"
}
crmagic_hex="4372 3234" # Cr24
version_hex="0200 0000" # 2
pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}')))
sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}')))
(
echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p
cat "$pub" "$sig" "$zip"
) > "$crx"
echo "Wrote $crx"

View file

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>npfte@fteqw.com</em:id>
<em:name>FTE Browser Plugin</em:name>
<em:version>0.1</em:version>
<em:type>2</em:type>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.0</em:minVersion>
<em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:unpack>true</em:unpack>
<em:creator>The FTE Contributors</em:creator>
<em:description>Run quake in your browser and stuff!</em:creator>
<em:homepageURL>http://fteqw.com/</em:creator>
</Description>
</RDF>

View file

@ -1,8 +0,0 @@
{
"name": "FTE Quakeworld Embedded Browser Plugin",
"version": "1",
"description": "FTEQW by the ForeThought Entertainment team, a Windows only free open source engine that supports Quake(tm) 1 (QuakeWorld/NetQuake), Quake 2(tm), Hexen 2(tm), Quake 3(tm) etc via way of NPAPI many browsers support like Safari, Chrome & Firefox",
"plugins": [
{ "path": "npfte.dll", "public": true }
]
}

View file

@ -1,4 +1,4 @@
There are multiple ways to embed a program into a browser. The 'web'/emscripten port, the npapi port, and the activex port.
There are multiple ways to embed a program into a browser. The 'web'/emscripten port, and the activex port.
Quick start with browser-servers:
(this uses webrtc, which should give low latency but is incompatible with native servers at this time.)
@ -61,93 +61,3 @@ Yes, what you can legally run is limited.
Custom maps do not need to be named in manifests as they will just be downloaded from the game server automatically anyway. They will be redownloaded if the page is refreshed, yes, but this can also be good for people still working on their maps...
The rest of this file is outdated.
Embedding using npapi(no longer supported by any major browser) or ActiveX (deprecated and not supported in Edge):
<object type="text/x-quaketvident" classid="clsid:7d676c9f-fb84-40b6-b3ff-e10831557eeb">
<param name="paramname" value="paramvalue">
<object type="text/x-quaketvident">
<param name="paramname" value="paramvalue">
Insert your 'no-plugin' text here. Be sure to include links to download a copy of one.
</object>
</object>
Two objects. Yes, I know. Evil. But yeah. Firefox will ignore any objects with a classid, and internet exploder won't have a clue what it is if it doesn't have a classid. bah.
Yes, you need to specify the params twice.
You probably want to name them too.
Any supported param is also supported as a field usable from javascript. There's no distinction between them.
Supported fields/params.
bool running: true if active. false if its not running. setting this field will start up quake or shut it down.
string startserver: the server that will be used when the engine starts up.
string server: the current server. if not running, maps to startserver instead. (server=foo; running = true; will result in the plugin going to that server in all cases)
string playername: the name cvar. requires running.
string skin: the string cvar. requires running.
string team: the team cvar. requires running.
string topcolor: the topcolor cvar. requires running
string bottomcolor: the topcolor cvar. requires running
string password: the password cvar. requires running
not supported. string spectator: the spectator cvar. requires running
string mapsrc: the cl_download_mapsrc cvar. Should be empty or a url like: http://bigfoot.morphos-team.net/misc/quakemaps/
if set, its a url that contains a load of bsp files that can be downloaded via http instead of grabbing them off the server.
string fullscreen: vid_fullscreen.
string datadownload: specifies a url to obtain mod data from.
Can contain multiple space-separated entries.
Each entry must have a pak or pk3 file name, followed by a colon, followed by a url that contains a zip file.
Each file should be moddir/pakname.pak for instance.
string game: specifies the actual game+mod to use.
The first entry can be:
quake/q1/qw: quake1
quake2/q2: quake2
quake3/q3: quake3
halflife/hl: half-life (not really supported, but you may have a TC mod that just wants halflife maps)
hexen2/h2: hexen2
nexuiz: nexuiz... moving target. sorry.
Any of the above will tell the plugin to hunt for the given game on the user's hard drive, and to then use that as a base dir, with the relevent game's basedir(s) loaded.
Any other option will be taken as only that base gamedir in an obscure place in the user's profile.
Additional gamedirs can be named, separated by spaces. These are additional mod dirs which will always be loaded despite the user's/server's choice of gamedir.
string curver: read only. Returns the current version of the plugin.
string availver: Tells the plugin what the most recent version of the plugin is. Basically it will cause the plugin to show a warning whenever its not running.
string splash: This is a url to a jpeg/png image to be shown when the plugin is not active.
string stream: when set, (including via stream="foo";running=true;) this will direct the plugin to begin playing a qtv stream.
string map: when set and running, the plugin will change map and use its own server. overrides startserver when not running.
stuff that may be supported at some point
connType: describes how the plugin should connect. join/qtv/observe/map
join: server? gah

View file

@ -93,7 +93,7 @@ make $THREADS FTE_TARGET=linux32 >> $BUILDLOGFOLDER/linux32.txt 2>> $BUILDLOGFOL
cp $SVNFOLDER/* $BUILDFOLDER/linux_32bit/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making Windows\n"
make $THREADS FTE_TARGET=win32 sv-rel gl-rel mingl-rel npqtv-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
make $THREADS FTE_TARGET=win32 sv-rel gl-rel mingl-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
cp $SVNFOLDER/* $BUILDFOLDER/win32/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making MorphOS\n"

View file

@ -93,7 +93,7 @@ make $THREADS FTE_TARGET=linux32 CC="ccache gcc -m32" >> $BUILDLOGFOLDER/linux32
cp $SVNFOLDER/* $BUILDFOLDER/linux_32bit/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making Windows\n"
make $THREADS FTE_TARGET=win32 CC="ccache i586-mingw32msvc-gcc" sv-rel gl-rel mingl-rel npqtv-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
make $THREADS FTE_TARGET=win32 CC="ccache i586-mingw32msvc-gcc" sv-rel gl-rel mingl-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
cp $SVNFOLDER/* $BUILDFOLDER/win32/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making MorphOS\n"

View file

@ -94,7 +94,7 @@ make $THREADS FTE_TARGET=linux32 >> $BUILDLOGFOLDER/linux32.txt 2>> $BUILDLOGFOL
cp $SVNFOLDER/* $BUILDFOLDER/linux_32bit/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making Windows\n"
make $THREADS FTE_TARGET=win32 sv-rel gl-rel mingl-rel npqtv-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
make $THREADS FTE_TARGET=win32 sv-rel gl-rel mingl-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
cp $SVNFOLDER/* $BUILDFOLDER/win32/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making MorphOS\n"

View file

@ -93,7 +93,7 @@ make $THREADS FTE_TARGET=linux32 CC="ccache gcc -m32" >> $BUILDLOGFOLDER/linux32
cp $SVNFOLDER/* $BUILDFOLDER/linux_32bit/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making Windows\n"
make $THREADS FTE_TARGET=win32 CC="ccache i586-mingw32msvc-gcc" WINDRES="i586-mingw32msvc-windres" STRIP="i586-mingw32msvc-strip" sv-rel gl-rel mingl-rel npqtv-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
make $THREADS FTE_TARGET=win32 CC="ccache i586-mingw32msvc-gcc" WINDRES="i586-mingw32msvc-windres" STRIP="i586-mingw32msvc-strip" sv-rel gl-rel mingl-rel >> $BUILDLOGFOLDER/win32.txt 2>> $BUILDLOGFOLDER/win32.txt
cp $SVNFOLDER/* $BUILDFOLDER/win32/ >> /dev/null 2>> /dev/null
make clean >> /dev/null
echo "Making MorphOS\n"

View file

@ -21,7 +21,7 @@ MACOSX=$(ls -1 /home/moodles/htdocs/macosx_tiger_10.4/ | wc -l)
# known count when all binaries build
LIN32TOTAL=24 #4 compilers (GCC, ICC, CLANG & LLVM) * 3 targets (sv, mingl, gl) * 2 (SDL versions)
LIN64TOTAL=6 #2 compilers (GCC, CLANG) * 3 targets (sv, mingl, gl)
WIN32TOTAL=7 #1 compiler (MinGW32) * 3 targets (sv, mingl, gl) * 2 (SDL versions) + 1 firefox plugin (npqtv)
WIN32TOTAL=7 #1 compiler (MinGW32) * 3 targets (sv, mingl, gl) * 2 (SDL versions)
MORPHTOTAL=2 #1 compiler (GCC based by bigfoot) * 2 targets (gl, mingl)
MACOSTOTAL=6 #2 compilers (10.4 x86 and ppc) * 3 targets (gl, mingl, sv)