NoPssDrm/app/src/main/java/com/psmreborn/nopsmdrm/MainActivity.java

107 lines
3.5 KiB
Java
Raw Normal View History

2024-04-20 13:57:35 +00:00
package com.psmreborn.nopsmdrm;
2024-04-27 12:53:24 +00:00
2024-04-20 13:57:35 +00:00
import android.app.Activity;
2024-04-22 00:51:55 +00:00
import android.app.AlertDialog;
2024-04-28 12:52:34 +00:00
import android.content.Context;
2024-04-22 00:51:55 +00:00
import android.content.DialogInterface;
2024-04-28 12:52:34 +00:00
import android.content.Intent;
import android.net.Uri;
import android.net.wifi.WifiManager;
2024-04-20 13:57:35 +00:00
import android.os.Bundle;
2024-04-28 12:52:34 +00:00
import android.os.Environment;
import android.os.Handler;
2024-04-27 12:53:24 +00:00
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
2024-04-20 13:57:35 +00:00
import android.view.View;
2024-04-22 00:51:55 +00:00
import com.psmreborn.nopsmdrm.pscertified.PlayStationCertified;
import com.psmreborn.nopsmdrm.pscertified.PsCertificatesInstaller;
2024-04-28 12:52:34 +00:00
import java.io.File;
2024-04-27 22:42:14 +00:00
2024-04-20 13:57:35 +00:00
public class MainActivity extends Activity {
2024-04-27 22:42:14 +00:00
2024-04-28 12:52:34 +00:00
/*
2024-04-27 12:53:24 +00:00
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.activity_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection.
switch (item.getItemId()) {
case R.id.accIdentifer:
return true;
case R.id.accEmail:
return true;
case R.id.accPassword:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
2024-04-28 12:52:34 +00:00
*/
2024-04-20 13:57:35 +00:00
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Helper.setContext(this);
(new Startup(this)).execute();
}
@Override
public void onBackPressed(){
finish();
2024-04-27 12:53:24 +00:00
System.exit(0);
super.onBackPressed();
2024-04-20 13:57:35 +00:00
}
2024-04-27 12:53:24 +00:00
2024-04-28 12:52:34 +00:00
private void psCertifiedAlert(){
new AlertDialog.Builder((Activity)this)
.setTitle("PS Certification Missing")
.setMessage("Your device appears to not be\"PlayStation Certified\"\nDo you want to certify it?\n(Warning: modifies /system/)")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
(new PsCertificatesInstaller(MainActivity.this)).execute();
}
})
.setNegativeButton("No", null).show();
}
2024-04-20 13:57:35 +00:00
public void installStart(View view) {
2024-04-22 00:51:55 +00:00
PlayStationCertified playStationCertified = new PlayStationCertified(this);
if(!playStationCertified.isPlaystationCertified()){
2024-04-28 12:52:34 +00:00
psCertifiedAlert();
2024-04-22 00:51:55 +00:00
}
else {
(new NoPsmDrmInstaller(this)).execute();
}
2024-04-20 13:57:35 +00:00
}
2024-04-28 12:52:34 +00:00
public void dumpAllRifs(View view){
String rifOutput = new File(Environment.getExternalStorageDirectory(), "psm").getAbsolutePath();
new AlertDialog.Builder((Activity)this)
.setTitle("Backup licenses")
.setMessage("This will show a black screen for awhile\nthen a PlayStation Mobile game will start\nOnce the game starts, a backup of all your PSM licenses can be found at\n\""+rifOutput+"\"\nDo you want to do this?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DumpAllRifs.setDumpAllFlagAndStartPsm(MainActivity.this);
}
})
.setNegativeButton("No", null).show();
}
2024-04-20 13:57:35 +00:00
}