forked from neobrain/citra
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
step keep class blorp hrm debug log (squashed) more testing sometimes, it's the little details that matter most bleep blorp blorp bleep trying to get view binding testing... black screen debugging not quite
- Loading branch information
Showing
704 changed files
with
361,788 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/android/app/src/main/java/org/citra/citra_emu/LeiaHelper3D.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package org.citra.citra_emu | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import android.graphics.SurfaceTexture | ||
import android.util.AttributeSet | ||
import android.util.Log | ||
import android.view.Surface | ||
import android.widget.Toast | ||
import com.leia.core.LogLevel | ||
import com.leia.sdk.LeiaSDK | ||
import com.leia.sdk.views.InputViewsAsset | ||
import com.leia.sdk.views.InterlacedSurfaceView | ||
import org.citra.citra_emu.vendor.simongellis.leia.webxr.LeiaTextureRenderer | ||
import org.citra.citra_emu.vendor.simongellis.leia.webxr.RendererImpl | ||
|
||
class LeiaSurfaceView(context: Context, attrs: AttributeSet) : InterlacedSurfaceView(context, attrs) { | ||
private val textureRenderer = LeiaTextureRenderer() | ||
private val asset = InputViewsAsset(RendererImpl(textureRenderer)) | ||
|
||
// constructor(context: Context?) : this(context, null) | ||
// constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) | ||
|
||
fun init() { | ||
Log.i("LeiaHelper3D: LeiaSurfaceView","init") | ||
setViewAsset(asset) | ||
} | ||
|
||
fun setSurfaceListener(surfaceListener: LeiaHelper3D.SurfaceListener) { | ||
val surfaceAsset = InputViewsAsset.createEmptySurfaceForVideo { | ||
surfaceTexture: SurfaceTexture? -> | ||
Log.d("SurfaceListener", "createEmptySurfaceForVideo -> calling onSurfaceChanged") | ||
surfaceListener.onSurfaceChanged(Surface(surfaceTexture)) | ||
} | ||
setViewAsset(surfaceAsset) | ||
} | ||
|
||
fun addTexture(texture: SurfaceTexture, transform: FloatArray) { | ||
Log.d("SurfaceListener", "addTexture") | ||
textureRenderer.addTexture(texture, transform) | ||
} | ||
} | ||
|
||
class LeiaHelper3D { | ||
|
||
fun interface SurfaceListener { | ||
fun onSurfaceChanged(surface: Surface) | ||
} | ||
|
||
companion object { | ||
fun init(application: Application) { | ||
try { | ||
val initArgs = LeiaSDK.InitArgs().apply { | ||
platform.app = application | ||
platform.logLevel = LogLevel.Trace | ||
} | ||
val leiaSDK = LeiaSDK.createSDK(initArgs) | ||
leiaSDK.startFaceTracking(false) | ||
} catch (e: Exception) { | ||
Log.e("MainApp", "Failed to initialize LeiaSDK: ${e.message}") | ||
Toast.makeText(application, "Failed to initialize LeiaSDK", Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
|
||
fun update3dMode(surfaceView: InterlacedSurfaceView, enable3dMode: Boolean, hasFocus: Boolean) { | ||
surfaceView.config.use { config -> | ||
config.setNumTiles(if (enable3dMode) 2 else 1, 1) | ||
} | ||
|
||
val leiaSDK = LeiaSDK.getInstance() | ||
leiaSDK?.let { | ||
it.startFaceTracking(enable3dMode && hasFocus) | ||
it.enableBacklight(enable3dMode && hasFocus) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...id/app/src/main/java/org/citra/citra_emu/vendor/simongellis/leia/webxr/LeiaSurfaceView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.citra.citra_emu.vendor.simongellis.leia.webxr | ||
|
||
import android.content.Context | ||
import android.graphics.SurfaceTexture | ||
import android.util.AttributeSet | ||
import android.util.Log | ||
import com.leia.sdk.views.InputViewsAsset | ||
import com.leia.sdk.views.InterlacedSurfaceView | ||
|
||
class LeiaSurfaceView(context: Context, attrs: AttributeSet) : InterlacedSurfaceView(context, attrs) { | ||
private val textureRenderer = LeiaTextureRenderer() | ||
private val asset = InputViewsAsset(RendererImpl(textureRenderer)) | ||
|
||
init { | ||
Log.i("LeiaSurfaceView", "init") | ||
setViewAsset(asset) | ||
} | ||
|
||
fun addTexture(texture: SurfaceTexture, transform: FloatArray) { | ||
textureRenderer.addTexture(texture, transform) | ||
} | ||
} |
Oops, something went wrong.