Skip to content

Commit 0973b2e

Browse files
committed
Zegs32 why did you grab from my sav editor 😭
1 parent d2649b0 commit 0973b2e

3 files changed

Lines changed: 40 additions & 26 deletions

File tree

.idea/other.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/mokkachocolata/pcsimulatorsaveeditorandroidport/MainActivity2.kt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -610,26 +610,19 @@ class MainActivity2 : AppCompatActivity() {
610610

611611
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
612612
when (keyCode) {
613-
KeyEvent.KEYCODE_ENTER -> {
614-
if (event?.isCtrlPressed == true) {
613+
KeyEvent.KEYCODE_ENTER ->
614+
if (event?.isCtrlPressed == true)
615615
findViewById<Button>(R.id.decryptencrypt).performClick()
616-
}
617-
}
618-
KeyEvent.KEYCODE_F1 -> {
616+
KeyEvent.KEYCODE_F1 ->
619617
startActivity(Intent(applicationContext, HelpActivity::class.java))
620-
}
621-
KeyEvent.KEYCODE_INSERT -> {
618+
KeyEvent.KEYCODE_INSERT ->
622619
menus.performIdentifierAction(R.id.insert, 0)
623-
}
624-
KeyEvent.KEYCODE_F2 -> {
620+
KeyEvent.KEYCODE_F2 ->
625621
menus.performIdentifierAction(R.id.saveoptions, 0)
626-
}
627-
KeyEvent.KEYCODE_F3 -> {
622+
KeyEvent.KEYCODE_F3 ->
628623
menus.performIdentifierAction(R.id.dump, 0)
629-
}
630-
KeyEvent.KEYCODE_F4 -> {
624+
KeyEvent.KEYCODE_F4 ->
631625
menus.performIdentifierAction(R.id.clear, 0)
632-
}
633626
}
634627
return super.onKeyUp(keyCode, event)
635628
}
@@ -666,6 +659,21 @@ class MainActivity2 : AppCompatActivity() {
666659
@SuppressLint("SetTextI18n")
667660
override fun onOptionsItemSelected(item: MenuItem): Boolean {
668661
when (item.itemId) {
662+
R.id.explorer -> {
663+
val text = input.text.toString()
664+
if (text.lines().size < 2) return false
665+
val jsonObject = JSONObject(text.lines()[1])
666+
val itemArray = jsonObject.getJSONArray("itemData")
667+
val lists = arrayListOf<String>()
668+
for (i in 0 until itemArray.length()) {
669+
val item = itemArray.getJSONObject(i)
670+
val spawnId = item.getString("spawnId")
671+
lists.add(spawnId)
672+
}
673+
dialog("Object Browser", null, null, {_,_->}, null, "Close", lists.toTypedArray()) {_, i ->
674+
675+
}
676+
}
669677
R.id.mods -> {
670678
val globals = JsePlatform.standardGlobals()
671679
val utilClass = PCSimulatorSaveEditorUtilClass()
@@ -679,7 +687,7 @@ class MainActivity2 : AppCompatActivity() {
679687
val mods = arrayListOf<Mod>()
680688
val files = arrayListOf<File>()
681689
if (directoryList != null) {
682-
for (fil in directoryList) {
690+
for (fil in directoryList)
683691
if (!fil.isDirectory && fil.extension == "pcssemod") {
684692
val contents = JSONObject(readTextFromUri(fil.toUri()))
685693
val mod = Mod(
@@ -697,7 +705,6 @@ class MainActivity2 : AppCompatActivity() {
697705
mods.add(mod)
698706
files.add(fil)
699707
}
700-
}
701708
}
702709
val strArray = arrayListOf<String>()
703710
for (mod in mods.toTypedArray()) {
@@ -728,10 +735,7 @@ class MainActivity2 : AppCompatActivity() {
728735
|This project is neither associated, affiliated, nor endorsed by Intel or AMD.
729736
|""".trimMargin(), {_,_->}, null // This way we won't get into trouble
730737
)
731-
R.id.help -> {
732-
System.gc()
733-
startActivity(Intent(applicationContext, HelpActivity::class.java))
734-
}
738+
R.id.help -> startActivity(Intent(applicationContext, HelpActivity::class.java))
735739
R.id.repo -> startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/BeboKhouja/PCSimulatorSaveEditorAndroidPort")))
736740
R.id.discord -> startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://discord.gg/GXRECJjhVr")))
737741
R.id.clear -> {
@@ -769,7 +773,6 @@ class MainActivity2 : AppCompatActivity() {
769773
}
770774
R.id.insert -> {
771775
val text = input.text.toString()
772-
if (text.lines().size < 2) return false
773776
val jsonObject = JSONObject(text.lines()[1])
774777
val lines = text.lines()
775778
val itemArray = jsonObject.getJSONArray("itemData")
@@ -904,9 +907,8 @@ class MainActivity2 : AppCompatActivity() {
904907
}
905908
}
906909
}
907-
for (i in 0 until json.length()) {
910+
for (i in 0 until json.length())
908911
addObjectFromJson(json.getJSONObject(i))
909-
}
910912
dialog(resources.getString(R.string.insert), null, null, null, itemListJson.toTypedArray()) { _, i ->
911913
handleClickJson(i)
912914
}
@@ -1086,9 +1088,7 @@ class MainActivity2 : AppCompatActivity() {
10861088
return@setOnDragListener true
10871089
}
10881090

1089-
else -> {
1090-
return@setOnDragListener false
1091-
}
1091+
else -> return@setOnDragListener false
10921092
}
10931093
}
10941094
}

app/src/main/res/menu/menu.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
<item
3131
android:id="@+id/saveoptions"
3232
android:title="@string/options" />
33+
<item
34+
android:id="@+id/explorer"
35+
android:title="Object Browser" />
3336
<item
3437
android:id="@+id/dump"
3538
android:title="@string/dumper" />

0 commit comments

Comments
 (0)