Skip to content

Commit

Permalink
add many imports and log viewers
Browse files Browse the repository at this point in the history
  • Loading branch information
Duron27 committed Oct 20, 2024
1 parent 9942b37 commit e4bbc84
Show file tree
Hide file tree
Showing 13 changed files with 729 additions and 140 deletions.
87 changes: 28 additions & 59 deletions app/settings.fallback.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
framerate limit = 60
# Maximum rendering framerate.

resolution y = 0
resolution y = 1080
# Hight of screen.

resolution x = 0
resolution x = 2316
# Width of screen.

window mode = 0
Expand Down Expand Up @@ -155,20 +155,20 @@ radial fog = true
# By default, the fog becomes thicker proportionally to your distance from the clipping plane set at the clipping distance, which causes distortion at the edges of the screen. This setting makes the fog use the actual eye point distance (or so called Euclidean distance) to calculate the fog, which makes the fog look less artificial, especially if you have a wide FOV.

[Post Processing]
enabled = true
# Enable Post Processing.

transparent postpass = true
# Transparent depth postpass. Re-renders transparent objects with alpha-clipping forced with a fixed threshold.

enabled = true
# Enable Post Processing.

[GUI]
stretch menu background = false
# Stretch menus, load screens, etc. to the window aspect ratio.

color topic enable = true
# If this setting is true, dialogue topics will have a different color if the topic is specific to the NPC you're talking to or the topic was previously seen. Color can be changed in settings.cfg.

scaling factor = 2.50
scaling factor = 1.0
# Scales GUI window and widget size. (<1.0 is smaller, >1.0 is larger).

font size = 16
Expand All @@ -181,52 +181,27 @@ subtitles = false
allow zooming = false
# Enable zooming on local and global maps.

local map widget size = 512
# Size of local map in GUI window in pixels. (e.g. 256 to 1024).

[Saves]
max quicksaves = 1
# Max amount of stored quicksaves.

autosave = true
# Automatically save the game whenever the player rests.

[Sound]
master volume = 1.0
# Master volume. Controls all other volumes. Volumes are 0.0 for silent and 1.0 for the maximum volume.

footsteps volume = 0.2
# Footsteps volume.

music volume = 0.5
# Music tracks volume.

sfx volume = 1.0
# Sound effects volume.

voice volume = 0.8
# Voice dialog volume.

[Groundcover]
enabled = true
# Enable some special settings for groundcover mods (rendering distance, density). Also enable animation and disable colision for groundcover meshes. Require to load groundcover mods via Groundcovers tab in mod manager.

density = 1.0
# A groundcover density (0.0 <= value <= 1.0), 1.0 means 100% density

rendering distance = 6144.0
# A maximum distance in game units on which groundcover is rendered.

[Navigator]
enable = true
# Enable navigator. When enabled background threads are started to build nav mesh for world geometry. Pathfinding system uses nav mesh to build paths. When disabled only pathgrid is used to build paths. Single-core CPU systems may have big performance impact on exiting interior location and moving across exterior world. May slightly affect performance on multi-core CPU systems. Multi-core CPU systems may have different latency for nav mesh update depending on other settings and system performance. Moving across external world, entering/exiting location produce nav mesh update. NPC and creatures may not be able to find path before nav mesh is built around them. Try to disable this if you want to have old fashioned AI which doesn’t know where to go when you stand behind that stone and casting a firebolt.

async nav mesh updater threads = 1
# Number of background threads to update nav mesh (value >= 1).

write to navmeshdb = false
# Cache navigation mesh tiles to disk.

enable = true
# Enable navigator. When enabled background threads are started to build nav mesh for world geometry. Pathfinding system uses nav mesh to build paths. When disabled only pathgrid is used to build paths. Single-core CPU systems may have big performance impact on exiting interior location and moving across exterior world. May slightly affect performance on multi-core CPU systems. Multi-core CPU systems may have different latency for nav mesh update depending on other settings and system performance. Moving across external world, entering/exiting location produce nav mesh update. NPC and creatures may not be able to find path before nav mesh is built around them. Try to disable this if you want to have old fashioned AI which doesn’t know where to go when you stand behind that stone and casting a firebolt.

[Physics]
async num threads = 1
# How many threads will be spawned to compute physics update in the background. A value of 0 means that the update will be performed in the main thread.
Expand Down Expand Up @@ -270,8 +245,20 @@ gyro vertical sensitivity = 1.0
# Vertical camera axis sensitivity to gyroscope movement.

[Shadows]
enable shadows = false
# Self explanitory.
percentage closer filtering = 1
# Smooth out shadows edges if small resolution is set. Higher values may have significant performance impact.

shadow fade start = 0.9
# The fraction of the limit above at which shadows begin to gradually fade away.

maximum shadow map distance = 8192
# The distance from the camera at which shadows completely disappear.

compute scene bounds = bounds
# Computation method to be used. Bounds (default) for good balance between performance and shadow quality, primitives for better looking shadows or none for no computation.

shadow map resolution = 1024
# The resolution of each individual shadow map. Increasing it significantly improves shadow quality but may have a minor performance impact.

indoor shadows = false
# Due to limitations with Morrowind's data, only actors can cast shadows indoors, which some might feel is distracting.
Expand All @@ -288,28 +275,16 @@ terrain shadows = false
object shadows = false
# Enable shadows for primarily inanimate objects. May have a significant performance impact.

percentage closer filtering = 1
# Smooth out shadows edges if small resolution is set. Higher values may have significant performance impact.

shadow fade start = 0.9
# The fraction of the limit above at which shadows begin to gradually fade away.

maximum shadow map distance = 8192
# The distance from the camera at which shadows completely disappear.

compute scene bounds = bounds
# Computation method to be used. Bounds (default) for good balance between performance and shadow quality, primitives for better looking shadows or none for no computation.

shadow map resolution = 1024
# The resolution of each individual shadow map. Increasing it significantly improves shadow quality but may have a minor performance impact.
enable shadows = false
# Self explanitory.

[Water]
shader = true
# Enable water shader.

refraction = false
# Enable water refraction.

shader = true
# Enable water shader.

refraction scale = 1.0
# By what factor water downscales objects. Only works with water shader and refractions on.

Expand All @@ -318,9 +293,3 @@ sunlight scattering = true

wobbly shores = true
# Fade and wobble water plane edges to avoid harsh shoreline transitions.

reflection detail = 2
# Draw objects on water reflections.

rain ripple detail = 1
# Whether to use fully detailed raindrop ripples. (0, 1, 2). 0 = rings only; 1 = sparse, high detail; 2 = dense, high detail
67 changes: 60 additions & 7 deletions app/src/main/java/org/openmw/EngineActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openmw


import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Process
Expand All @@ -10,26 +11,34 @@ import android.view.KeyEvent
import android.view.View
import android.widget.FrameLayout
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.Icon
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import org.libsdl.app.SDLActivity
import org.openmw.ui.controls.CustomCursorView
import org.openmw.ui.overlay.GameControllerButtons
import org.openmw.ui.overlay.HiddenMenu
import org.openmw.ui.overlay.OverlayUI
import org.openmw.ui.overlay.Thumbstick
import org.openmw.ui.overlay.sendKeyEvent

class EngineActivity : SDLActivity() {
private var customCursorView: CustomCursorView? = null
Expand Down Expand Up @@ -101,6 +110,7 @@ class EngineActivity : SDLActivity() {
val composeViewMenu = findViewById<ComposeView>(R.id.compose_overlayMenu)
composeViewMenu.setContent {
OverlayUI()
HiddenMenu()
}

// Setup Compose overlay for buttons
Expand All @@ -114,13 +124,56 @@ class EngineActivity : SDLActivity() {
// Toggle Custom Cursor Visibility Button
Button(
onClick = { toggleCustomCursor() },
colors = ButtonDefaults.buttonColors(
containerColor = Color.Transparent
),
modifier = Modifier
.size(30.dp)
.size(50.dp)
.align(Alignment.End)
.border(3.dp, Color.Black, shape = CircleShape) // Add border
) {
Text(
text = "M",
color = Color.White,
fontSize = 15.sp,
fontWeight = FontWeight.Bold
)
}
Spacer(modifier = Modifier.width(16.dp))
Button(
onClick = {
onNativeKeyDown(KeyEvent.KEYCODE_F)
sendKeyEvent(KeyEvent.KEYCODE_F)
onNativeKeyUp(KeyEvent.KEYCODE_F)
},
colors = ButtonDefaults.buttonColors(
containerColor = Color.Transparent
),
modifier = Modifier.size(50.dp).border(3.dp, Color.Black, shape = CircleShape)
) {
Text(
text = "W",
color = Color.White,
fontSize = 15.sp,
fontWeight = FontWeight.Bold
)
}
Spacer(modifier = Modifier.width(16.dp))
// Button to perform mouse click
Button(
onClick = {
customCursorView!!.performMouseClick()
},
colors = ButtonDefaults.buttonColors(
containerColor = Color.Transparent
),
modifier = Modifier.size(50.dp).border(3.dp, Color.Black, shape = CircleShape)
) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = "Mouse"
Text(
text = "C",
color = Color.White,
fontSize = 15.sp,
fontWeight = FontWeight.Bold
)
}

Expand Down
67 changes: 52 additions & 15 deletions app/src/main/java/org/openmw/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,25 @@ import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -27,6 +38,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.datastore.preferences.core.edit
Expand All @@ -48,6 +60,11 @@ fun HomeScreen(context: Context, modValues: List<ModValue>, navigateToSettings:
val transparentBlack = Color(alpha = 0.6f, red = 0f, green = 0f, blue = 0f)
val currentContext = LocalContext.current
var savedPath by remember { mutableStateOf<String?>(null) }
val buttonText = if (savedPath.isNullOrEmpty() || savedPath == "Game Files: ") {
"Select Games Files"
} else {
"Game Files: $savedPath"
}

LaunchedEffect(Unit) {
val dataStoreKey = stringPreferencesKey("game_files_uri")
Expand Down Expand Up @@ -80,32 +97,53 @@ fun HomeScreen(context: Context, modValues: List<ModValue>, navigateToSettings:
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
.padding(top = 40.dp, bottom = 80.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Button(onClick = {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
}
openDocumentTreeLauncher.launch(intent)
}) {
Text(text = "Select Games Files", color = Color.White)
}

savedPath?.let {
Text(text = "Game Files: $it", color = Color.White)
Button(
onClick = {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
}
openDocumentTreeLauncher.launch(intent)
},
modifier = Modifier
.fillMaxWidth()
.height(56.dp),
shape = RectangleShape,
colors = ButtonDefaults.buttonColors(
containerColor = Color(alpha = 0.6f, red = 0f, green = 0f, blue = 0f)
)
) {
Text(text = buttonText, color = Color.White)
}
Spacer(modifier = Modifier.width(16.dp))
ModValuesList(modValues)
}
}
}, bottomBar = {
BottomAppBar(
containerColor = transparentBlack,
actions = {
Button(onClick = { navigateToSettings() }) {
Text("OpenMW Settings")
Button(
onClick = { navigateToSettings() },
modifier = Modifier
.size(80.dp)
.background(Color.Transparent),
shape = CircleShape,
colors = ButtonDefaults.buttonColors(
containerColor = Color.Transparent
)
) {
Icon(
imageVector = Icons.Default.Settings, // Make sure you have the correct icon import
contentDescription = "Settings",
modifier = Modifier.size(80.dp),
tint = Color.White
)
}

},
floatingActionButton = {
MyFloatingActionButton(context)
Expand All @@ -126,4 +164,3 @@ fun getAbsolutePathFromUri(context: Context, uri: Uri): String? {
val path = documentFile?.uri?.path?.replace("/tree/primary:", "/storage/emulated/0/")
return path?.substringBeforeLast("document")
}

Loading

0 comments on commit e4bbc84

Please sign in to comment.