trying improve ftedroid and fix the issue with opera+file urls.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4558 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5f1ec064dc
commit
591b848148
10 changed files with 95 additions and 28 deletions
|
@ -93,8 +93,8 @@ endif
|
|||
USER_TARGET:=$(FTE_TARGET)
|
||||
|
||||
#make droid-rel doesn't get the right stuff
|
||||
#add an autoexec file. its only small.
|
||||
DROID_PACKSU?= $(BASE_DIR)/droid/autoexec.cfg
|
||||
#add a small default config file. its only small.
|
||||
DROID_PACKSU?= $(BASE_DIR)/droid/fte.cfg
|
||||
ANDROID_NDK_ROOT?=~/android-ndk-r8e
|
||||
ANDROID_HOME?=~/android-sdk-linux
|
||||
ANT?=ant
|
||||
|
|
|
@ -3748,7 +3748,7 @@ void Host_DoRunFile(hrf_t *f)
|
|||
char *ext;
|
||||
|
||||
#ifdef WEBCLIENT
|
||||
if (!strncmp(f->fname, "http://", 7) && !f->srcfile)
|
||||
if ((!strncmp(f->fname, "http://", 7) || !strncmp(f->fname, "https://", 8)) && !f->srcfile)
|
||||
{
|
||||
if (!(f->flags & HRF_OPENED))
|
||||
{
|
||||
|
@ -3869,6 +3869,7 @@ void Host_DoRunFile(hrf_t *f)
|
|||
|
||||
if (!f->srcfile)
|
||||
{
|
||||
Con_Printf("Unable to open %s\n", f->fname);
|
||||
f->flags |= HRF_ABORT;
|
||||
Host_DoRunFile(f);
|
||||
return;
|
||||
|
@ -3897,8 +3898,11 @@ void Host_DoRunFile(hrf_t *f)
|
|||
if (f->dstfile)
|
||||
{
|
||||
//do a real diff.
|
||||
if (VFS_GETLEN(f->srcfile) != VFS_GETLEN(f->dstfile))
|
||||
if (f->srcfile->seekingisabadplan || VFS_GETLEN(f->srcfile) != VFS_GETLEN(f->dstfile))
|
||||
{
|
||||
//if we can't seek, or the sizes differ, just assume that the file is modified.
|
||||
haschanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len = VFS_GETLEN(f->srcfile);
|
||||
|
@ -3908,8 +3912,8 @@ void Host_DoRunFile(hrf_t *f)
|
|||
VFS_READ(f->srcfile, sbuf, len);
|
||||
VFS_READ(f->dstfile, dbuf, len);
|
||||
haschanged = memcmp(sbuf, dbuf, len);
|
||||
VFS_SEEK(f->srcfile, 0);
|
||||
}
|
||||
VFS_SEEK(f->srcfile, 0);
|
||||
VFS_CLOSE(f->dstfile);
|
||||
f->dstfile = NULL;
|
||||
}
|
||||
|
@ -3963,10 +3967,36 @@ void Host_DoRunFile(hrf_t *f)
|
|||
//if file is specified, takes full ownership of said file, including destruction.
|
||||
qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file)
|
||||
{
|
||||
hrf_t *f = Z_Malloc(sizeof(*f) + nlen);
|
||||
hrf_t *f;
|
||||
#ifdef _WIN32
|
||||
//win32 file urls are basically fucked, so defer to the windows api.
|
||||
char utf8[MAX_OSPATH*3];
|
||||
if (nlen >= 7 && !strncmp(fname, "file://", 7))
|
||||
{
|
||||
qboolean Sys_ResolveFileURL(const char *inurl, int inlen, char *out, int outlen);
|
||||
if (!Sys_ResolveFileURL(fname, nlen, utf8, sizeof(utf8)))
|
||||
{
|
||||
Con_Printf("Cannot resolve file url\n");
|
||||
return false;
|
||||
}
|
||||
fname = utf8;
|
||||
nlen = strlen(fname);
|
||||
}
|
||||
#else
|
||||
//unix file urls are fairly consistant.
|
||||
if (nlen >= 8 && !strncmp(fname, "file:///", 8))
|
||||
{
|
||||
fname += 7;
|
||||
nlen -= 7;
|
||||
}
|
||||
#endif
|
||||
|
||||
f = Z_Malloc(sizeof(*f) + nlen);
|
||||
memcpy(f->fname, fname, nlen);
|
||||
f->fname[nlen] = 0;
|
||||
|
||||
Con_Printf("Opening external file: %s\n", f->fname);
|
||||
|
||||
Host_DoRunFile(f);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1896,9 +1896,13 @@ static void MP_GameCommand_f(void)
|
|||
if (!gamecommand)
|
||||
return;
|
||||
|
||||
if (setjmp(mp_abort))
|
||||
return;
|
||||
inmenuprogs++;
|
||||
pr_globals = PR_globals(menu_world.progs, PR_CURRENT);
|
||||
(((string_t *)pr_globals)[OFS_PARM0] = PR_TempString(menu_world.progs, Cmd_Args()));
|
||||
PR_ExecuteProgram (menu_world.progs, gamecommand);
|
||||
inmenuprogs--;
|
||||
}
|
||||
|
||||
void MP_CoreDump_f(void)
|
||||
|
|
|
@ -965,6 +965,31 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (QDECL *func)(
|
|||
return Sys_EnumerateFiles2(fullmatch, start, start, func, parm, spath);
|
||||
}
|
||||
|
||||
//wide only. we let the windows api sort out the mess of file urls. system-wide consistancy.
|
||||
qboolean Sys_ResolveFileURL(const char *inurl, int inlen, char *out, int outlen)
|
||||
{
|
||||
char *cp;
|
||||
wchar_t wurl[MAX_PATH];
|
||||
wchar_t local[MAX_PATH];
|
||||
DWORD grr;
|
||||
static HRESULT (WINAPI *pPathCreateFromUrlW)(PCWSTR pszUrl, PWSTR pszPath, DWORD *pcchPath, DWORD dwFlags);
|
||||
if (!pPathCreateFromUrlW)
|
||||
pPathCreateFromUrlW = Sys_GetAddressForName(Sys_LoadLibrary("Shlwapi.dll", NULL), "PathCreateFromUrlW");
|
||||
if (!pPathCreateFromUrlW)
|
||||
return false;
|
||||
|
||||
//need to make a copy, because we can't terminate the inurl easily.
|
||||
cp = malloc(inlen+1);
|
||||
memcpy(cp, inurl, inlen);
|
||||
cp[inlen] = 0;
|
||||
widen(wurl, sizeof(wurl), cp);
|
||||
free(cp);
|
||||
grr = sizeof(local)/sizeof(wchar_t);
|
||||
if (FAILED(pPathCreateFromUrlW(wurl, local, &grr, 0)))
|
||||
return false;
|
||||
narrowen(out, outlen, local);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
|
|
@ -2193,7 +2193,7 @@ const gamemode_info_t gamemode_info[] = {
|
|||
|
||||
{"-doom", "doom", "FTE-Doom", {"doom.wad"}, NULL, {"*doom.wad", "ftedoom"}, "Doom"},
|
||||
{"-doom2", "doom2", "FTE-Doom2", {"doom2.wad"}, NULL, {"*doom2.wad", "ftedoom"}, "Doom2"},
|
||||
{"-doom3", "doom3", "FTE-Doom3", {"doom3.wad"}, NULL, {"*doom2.wad", "ftedoom"}, "Doom2"},
|
||||
{"-doom3", "doom3", "FTE-Doom3", {"doom3.wad"}, NULL, {"based3", "ftedoom3"},"Doom3"},
|
||||
|
||||
//for the luls
|
||||
{"-diablo2", NULL, "FTE-Diablo2", {"d2music.mpq"}, NULL, {"**.mpq", "fted2"}, "Diablo 2"},
|
||||
|
|
|
@ -28,6 +28,7 @@ typedef struct {
|
|||
unsigned int offset;
|
||||
} vfsw32file_t;
|
||||
|
||||
//outlen is the size of out in _BYTES_.
|
||||
wchar_t *widen(wchar_t *out, size_t outlen, const char *utf8)
|
||||
{
|
||||
wchar_t *ret = out;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
// FTEDroid autoexec.cfg
|
||||
// [Spike: file supplied by mushi]
|
||||
// i [mushi] believe this is more user friendly, at least to spectate a qtv (which, i believe, will be the most used feature of ftedroid.
|
||||
|
||||
|
||||
// (for reference) creating links on the console:
|
||||
// ^[sometext\join\127.0.0.1:27500^] can be used to connect to some server
|
||||
// ^[sometext\observe\127.0.0.1:27500^] can be used to observe some server (not qtv)
|
||||
|
||||
|
||||
echo Possible keys to bind: {"APP"}, {"MENU"}, {"SEARCH"}, {"POWER"}, {"VOLUP"}, {"VOLDOWN"}
|
||||
|
||||
|
||||
bind mouse1 +attack //left area of the screen
|
||||
bind mouse2 +jump //right area of the screen
|
||||
bind menu "toggleconsole" //is there a better "key" to toggle the console??
|
||||
|
||||
bind volup +showteamscores
|
||||
// bind voldown +jump //removed because on most android devices power+voldown takes a screenshot
|
||||
|
||||
vid_conautoscale "3" //doesn't seem to work on autoexec. just on exec.
|
12
engine/droid/fte.cfg
Normal file
12
engine/droid/fte.cfg
Normal file
|
@ -0,0 +1,12 @@
|
|||
// file supplied by mushi
|
||||
|
||||
bind mouse1 +attack //left area of the screen
|
||||
bind mouse2 +jump //right area of the screen
|
||||
bind menu "toggleconsole"
|
||||
bind volup +showteamscores
|
||||
// bind voldown +jump //removed because on most android devices power+voldown takes a screenshot
|
||||
|
||||
// Appearance settings
|
||||
brightness "0.2"
|
||||
contrast "1.2"
|
||||
vid_conautoscale "4" // Text/Menu size. 2 is the default. 4 is bigger
|
|
@ -627,7 +627,19 @@ public class FTEDroidActivity extends Activity
|
|||
sendKey(false, mapKey(keyCode, uc), uc);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs)
|
||||
{
|
||||
Log.d(TAG, "onCreateInputConnection");
|
||||
|
||||
BaseInputConnection fic = new BaseInputConnection(this, false);
|
||||
outAttrs.actionLabel = null;
|
||||
outAttrs.inputType = InputType.TYPE_NULL;
|
||||
outAttrs.imeOptions = EditorInfo.IME_ACTION_NEXT;
|
||||
return fic;
|
||||
}
|
||||
*/
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -535,6 +535,10 @@ void Mod_Init (qboolean initial)
|
|||
Mod_RegisterModelFormatMagic(NULL, "Doom PWad Map", (('D'<<24)+('A'<<16)+('W'<<8)+'P'), Mod_LoadDoomLevel);
|
||||
#endif
|
||||
|
||||
#ifdef MAP_PROC
|
||||
Mod_RegisterModelFormatText(NULL, "Doom3 (cm)", "CM", D3_LoadMap_CollisionMap);
|
||||
#endif
|
||||
|
||||
//q1-based formats
|
||||
Mod_RegisterModelFormatMagic(NULL, "Quake1 2PSB Map(bsp)", BSPVERSION_LONG1, Mod_LoadBrushModel);
|
||||
Mod_RegisterModelFormatMagic(NULL, "Quake1 BSP2 Map(bsp)", BSPVERSION_LONG2, Mod_LoadBrushModel);
|
||||
|
|
Loading…
Reference in a new issue