Skip to content

Commit

Permalink
ObbExtractor: Close ZipFile After Use, Add Debug Info on Screen Like …
Browse files Browse the repository at this point in the history
…MiceWine Commit, and Selected DXVK/WineD3D, Small Changes on Floating File Manager (Avoid close it), Small Changes That I don't remember
  • Loading branch information
KreitinnSoftware committed Aug 31, 2024
1 parent f853185 commit b46c491
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.micewine.emu.BuildConfig
import com.micewine.emu.R
import com.micewine.emu.activities.GeneralSettings.Companion.BOX64_DYNAREC_ALIGNED_ATOMICS_KEY
import com.micewine.emu.activities.GeneralSettings.Companion.BOX64_DYNAREC_BIGBLOCK_KEY
Expand Down Expand Up @@ -453,6 +454,8 @@ class MainActivity : AppCompatActivity() {

setupWinePrefix(File("$homeDir/.wine"))

fileManagerCwd = fileManagerDefaultDir

setupDone = true
}
}
Expand All @@ -469,6 +472,7 @@ class MainActivity : AppCompatActivity() {
var setupDone: Boolean = false
var enableRamCounter: Boolean = false
var enableCpuCounter: Boolean = false
var enableDebugInfo: Boolean = false
var appLang: String? = null
var box64DynarecBigblock: String? = null
var box64DynarecStrongmem: String? = null
Expand All @@ -494,6 +498,7 @@ class MainActivity : AppCompatActivity() {
var fileManagerDefaultDir: String = "$homeDir/.wine/dosdevices"
var fileManagerCwd: String = fileManagerDefaultDir
var selectedFile: String = ""
var miceWineVersion: String = "MiceWine (git-${BuildConfig.GIT_SHORT_SHA})"
private var selectedResolution: String? = ""

var selectedFragment = "HomeFragment"
Expand All @@ -503,6 +508,7 @@ class MainActivity : AppCompatActivity() {
const val ACTION_SELECT_FILE_MANAGER = "com.micewine.emu.ACTION_SELECT_FILE_MANAGER"
const val RAM_COUNTER_KEY = "ramCounter"
const val CPU_COUNTER_KEY = "cpuCounter"
const val ENABLE_DEBUG_INFO_KEY = "debugInfo"

fun setupWinePrefix(winePrefix: File) {
if (!winePrefix.exists()) {
Expand Down Expand Up @@ -573,8 +579,9 @@ class MainActivity : AppCompatActivity() {
selectedMesaVkWsiPresentMode = preferences.getString(SELECTED_MESA_VK_WSI_PRESENT_MODE_KEY, "mailbox")
selectedTuDebugPreset = preferences.getString(SELECTED_TU_DEBUG_PRESET_KEY, "noconform")
selectedResolution = preferences.getString(DISPLAY_RESOLUTION_KEY, "1280x720")
enableRamCounter = preferences.getBoolean(RAM_COUNTER_KEY, false)
enableRamCounter = preferences.getBoolean(RAM_COUNTER_KEY, true)
enableCpuCounter = preferences.getBoolean(CPU_COUNTER_KEY, false)
enableDebugInfo = preferences.getBoolean(ENABLE_DEBUG_INFO_KEY, true)
}

fun copyAssets(activity: Activity, filename: String, outputPath: String) {
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/com/micewine/emu/adapters/AdapterFiles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.micewine.emu.R
import com.micewine.emu.activities.MainActivity.Companion.ACTION_SELECT_FILE_MANAGER
Expand All @@ -31,7 +30,11 @@ class AdapterFiles(private val fileList: List<FileList>, private val context: Co
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val sList = fileList[position]

holder.fileName.text = sList.file.name
if (fileManagerCwd == fileManagerDefaultDir) {
holder.fileName.text = sList.file.name.uppercase()
} else {
holder.fileName.text = sList.file.name
}

if (sList.file.isDirectory) {
holder.icon.setImageResource(R.drawable.ic_folder)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/micewine/emu/core/ObbExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ object ObbExtractor {
Thread.sleep(100)
}

zipFile.close()

progressBarValue = 0
} catch (e: IOException) {
e.printStackTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.micewine.emu.activities.GeneralSettings.Companion.DISPLAY_RESOLUTION_
import com.micewine.emu.activities.GeneralSettings.Companion.SPINNER
import com.micewine.emu.activities.GeneralSettings.Companion.SWITCH
import com.micewine.emu.activities.MainActivity.Companion.CPU_COUNTER_KEY
import com.micewine.emu.activities.MainActivity.Companion.ENABLE_DEBUG_INFO_KEY
import com.micewine.emu.activities.MainActivity.Companion.RAM_COUNTER_KEY
import com.micewine.emu.adapters.AdapterSettingsPreferences
import com.micewine.emu.adapters.AdapterSettingsPreferences.SettingsListSpinner
Expand Down Expand Up @@ -53,10 +54,13 @@ class DisplaySettingsFragment : Fragment() {
SPINNER, "1280x720", DISPLAY_RESOLUTION_KEY)

addToAdapter(R.string.enableRamCounter, R.string.enableRamCounterDescription, arrayOf(""),
SWITCH, "false", RAM_COUNTER_KEY)
SWITCH, "true", RAM_COUNTER_KEY)

addToAdapter(R.string.enableCPUCounter, R.string.enableCPUCounterDescription, arrayOf(""),
SWITCH, "false", CPU_COUNTER_KEY)

addToAdapter(R.string.enableDebugInfo, R.string.enableDebugInfoDescription, arrayOf(""),
SWITCH, "true", ENABLE_DEBUG_INFO_KEY)
}

private fun addToAdapter(titleId: Int, descriptionId: Int, valuesArray: Array<String>, type: Int, defaultValue: String, keyId: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class FloatingFileManagerFragment: DialogFragment() {
.setView(view)
.create()

isCancelable = false

Thread {
while (customRootFSPath == null) {
Thread.sleep(16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import com.micewine.emu.activities.MainActivity.Companion.selectedDXVK
import com.micewine.emu.activities.MainActivity.Companion.selectedWineD3D
import com.micewine.emu.activities.MainActivity.Companion.totalCpuUsage

class HWInfoView @JvmOverloads constructor (context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0): View(context, attrs, defStyleAttr) {
class OnScreenInfoView @JvmOverloads constructor (context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0): View(context, attrs, defStyleAttr) {
private val paint: Paint = Paint().apply {
textSize = 30F
strokeWidth = 8F
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_emulation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
android:visibility="visible">
</com.micewine.emu.LorieView>

<com.micewine.emu.views.HWInfoView
<com.micewine.emu.views.OnScreenInfoView
android:id="@+id/hwView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="visible">
</com.micewine.emu.views.HWInfoView>
</com.micewine.emu.views.OnScreenInfoView>

<com.micewine.emu.views.OverlayView
android:id="@+id/overlayView"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@
<string name="executeExe">Executar</string>
<string name="creatingWinePrefix">Criando Prefixo Wine…</string>
<string name="select_rootfs_file">Selecione arquivo da RootFS</string>
<string name="enableDebugInfo">Ativa/Desativa Info de Debug</string>
<string name="enableDebugInfoDescription">Ativa ou Desativa Info de Debug na Tela</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,6 @@
<string name="executeExe">Execute</string>
<string name="creatingWinePrefix">Creating Wine Prefix…</string>
<string name="select_rootfs_file">Select RootFS File</string>
<string name="enableDebugInfo">Enable/Disable Debug Info</string>
<string name="enableDebugInfoDescription">Enable or Disable Debug Info on Screen</string>
</resources>

0 comments on commit b46c491

Please sign in to comment.