Android原生和平精英帧率调整

最近做项目需求是这样的,通过修改和平精英的配置文件,让低端手机拥有高配的帧率,120帧率

整体代码

File file=new File(path2);
        if(!file.exists()){
            boolean flag=FileUtils.createFile(path,"EnjoyCJZC.ini");
            Log.e("old",flag+"");
            FileUtils.writeToFile("[FansSwitcher]\n" +
                    "\n" +
                    "+CVars=r.PUBGMaxSupportQualityLevel=2\n" +
                    "\n" +
                    "+CVars=r.PUBGDeviceFPSLow=6\n" +
                    "\n" +
                    "+CVars=r.PUBGDeviceFPSMid=6\n" +
                    "\n" +
                    "+CVars=r.PUBGDeviceFPSHigh=6\n" +
                    "\n" +
                    "+CVars=r.PUBGDeviceFPSHDR=6\n" +
                    "\n" +
                    "+CVars=r.PUBGMSAASupport=1\n" +
                    "\n" +
                    "+CVars=r.PUBGLDR=1",path,"EnjoyCJZC.ini");
            Utilities.TOAST(getActivity(),"修改成功");
            Intent intent = getActivity().getPackageManager().getLaunchIntentForPackage("com.tencent.tmgp.pubgmhd");
            if (intent != null) {
                intent.putExtra("type", "test");
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                getActivity().startActivity(intent);
            }
        }


1、创建文件夹

/**
     * 创建文件
     *
     * @param filePath 文件地址
     * @param fileName 文件名
     * @return
     */
    public static boolean createFile(String filePath, String fileName) {

        String strFilePath = filePath + fileName;

        File file = new File(filePath);
        if (!file.exists()) {
/** 注意这里是 mkdirs()方法 可以创建多个文件夹 */
            file.mkdirs();
        }

        File subfile = new File(strFilePath);

        if (!subfile.exists()) {
            try {
                boolean b = subfile.createNewFile();
                return b;
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            return true;
        }
        return false;
    }

2、写文件的方法

 /**
     * 向文件中添加内容
     *
     * @param strcontent 内容
     * @param filePath   地址
     * @param fileName   文件名
     */
    public static void writeToFile(String strcontent, String filePath, String fileName) {
//生成文件夹之后,再生成文件,不然会出错
        String strFilePath = filePath + fileName;
// 每次写入时,都换行写

        File subfile = new File(strFilePath);


        RandomAccessFile raf = null;
        try {
/** 构造函数 第二个是读写方式 */
            raf = new RandomAccessFile(subfile, "rw");
/** 将记录指针移动到该文件的最后 */
            raf.seek(subfile.length());
/** 向文件末尾追加内容 */
            raf.write(strcontent.getBytes());

            raf.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值