Revert recent changes, do not unpack assets, disable path check

This commit is contained in:
mittorn 2015-09-08 00:59:55 +07:00
parent f0fd46bb60
commit 1f330cb1a8
3 changed files with 7 additions and 46 deletions

View file

@ -113,8 +113,6 @@ public class Settings {
File d = new File(dir);
if (!d.exists())
d.mkdirs();
else
return; // Note: if you move it back to <datadir>/files, disable this as it may exist
AssetManager assetManager = ctx.getAssets();
String[] files = null;

View file

@ -4,7 +4,6 @@ import in.celest.xash3d.hl.R;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@ -132,16 +131,11 @@ public class TouchControlsEditing {
}
});
//String png = activity.getFilesDir() + "/" + ci.image + ".png";
//Log.d(TAG,"png = " + png);
//BitmapDrawable bm = new BitmapDrawable(png);
try
{
image.setImageDrawable(Drawable.createFromStream(context.getAssets().open(ci.image + ".png"), null));
}
catch(Exception e)
{
}
String png = activity.getFilesDir() + "/" + ci.image + ".png";
Log.d(TAG,"png = " + png);
BitmapDrawable bm = new BitmapDrawable(png);
image.setImageDrawable(bm);
return convertView;
}

View file

@ -222,41 +222,10 @@ public class SDLActivity extends Activity {
String basedir = intent.getStringExtra("basedir");
if(basedir == null)
basedir = mPref.getString("basedir","/sdcard/xash/");
try
{
int i = Arrays.asList(mArgv).indexOf("-game");
if(i != -1)
mControlsDir = basedir + "/" + mArgv[i+1] + "/controls/";
}
catch(Exception e)
{
mControlsDir = null;
}
if(mControlsDir == null)
mControlsDir = basedir + "/" + gamedir + "/controls/";
File d = new File(mControlsDir);
if(!d.exists())
mControlsDir = basedir + "/controls/";
d = new File(basedir+"/"+gamedir+"/");
if(!d.exists())
{
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
dlgAlert.setMessage("Game path \""+basedir+"/"+gamedir+"/"+"\" not exist!\n"
+ "Please check mod name and game path in launcher or place game resourses to \""+basedir+"\".");
dlgAlert.setTitle("Xash Error");
dlgAlert.setPositiveButton("Exit",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close current activity
SDLActivity.mSingleton.finish();
}
});
dlgAlert.setCancelable(false);
dlgAlert.create().show();
return;
}
mControlsDir = getFilesDir() + "/";
setenv("XASH3D_BASEDIR", basedir, true);
setenv("XASH3D_ENGLIBDIR", getFilesDir().getParentFile().getPath() + "/lib", true);
setenv("XASH3D_GAMELIBDIR", gamelibdir, true);