forked from wheremyfoodat/Panda3DS
-
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.
- Loading branch information
1 parent
3f9c8d8
commit 62880f0
Showing
37 changed files
with
1,245 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Android Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
x64: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Fetch submodules | ||
run: git submodule update --init --recursive | ||
|
||
- name: Setup Vulkan SDK | ||
uses: humbletim/[email protected] | ||
with: | ||
vulkan-query-version: latest | ||
vulkan-use-cache: true | ||
vulkan-components: Vulkan-Headers, Vulkan-Loader, SPIRV-Tools, Glslang | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' # See 'Supported distributions' for available options | ||
java-version: '17' | ||
|
||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/build -DBUILD_HYDRA_CORE=1 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DENABLE_VULKAN=0 | ||
|
||
- name: Build | ||
run: | | ||
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
mv ./build/libAlber.so ./src/pandroid/app/src/main/jniLibs/x86_64/ | ||
cd src/pandroid | ||
./gradlew assembleDebug | ||
cd ../.. | ||
- name: Upload executable | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Android APK (x86-64) | ||
path: './src/pandroid/app/build/outputs/apk/debug/app-debug.apk' | ||
|
||
arm64: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Fetch submodules | ||
run: git submodule update --init --recursive | ||
|
||
- name: Setup Vulkan SDK | ||
uses: humbletim/[email protected] | ||
with: | ||
vulkan-query-version: latest | ||
vulkan-use-cache: true | ||
vulkan-components: Vulkan-Headers, Vulkan-Loader, SPIRV-Tools, Glslang | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' # See 'Supported distributions' for available options | ||
java-version: '17' | ||
|
||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/build -DBUILD_HYDRA_CORE=1 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DENABLE_VULKAN=0 -DCMAKE_CXX_FLAGS="-march=armv8.1-a+crypto" | ||
|
||
- name: Build | ||
run: | | ||
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
mv ./build/libAlber.so ./src/pandroid/app/src/main/jniLibs/arm64-v8a/ | ||
cd src/pandroid | ||
./gradlew assembleDebug | ||
cd ../.. | ||
- name: Upload executable | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Android APK (arm64) | ||
path: './src/pandroid/app/build/outputs/apk/debug/app-debug.apk' | ||
|
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,118 @@ | ||
diff --git a/src/host_shaders/opengl_display.frag b/src/host_shaders/opengl_display.frag | ||
index 612671c8..1937f711 100644 | ||
--- a/src/host_shaders/opengl_display.frag | ||
+++ b/src/host_shaders/opengl_display.frag | ||
@@ -1,4 +1,5 @@ | ||
-#version 410 core | ||
+#version 300 es | ||
+precision mediump float; | ||
in vec2 UV; | ||
out vec4 FragColor; | ||
|
||
diff --git a/src/host_shaders/opengl_display.vert b/src/host_shaders/opengl_display.vert | ||
index 990e2f80..6917c23c 100644 | ||
--- a/src/host_shaders/opengl_display.vert | ||
+++ b/src/host_shaders/opengl_display.vert | ||
@@ -1,4 +1,4 @@ | ||
-#version 410 core | ||
+#version 300 es | ||
out vec2 UV; | ||
|
||
void main() { | ||
diff --git a/src/host_shaders/opengl_fragment_shader.frag b/src/host_shaders/opengl_fragment_shader.frag | ||
index f6fa6c55..b0850438 100644 | ||
--- a/src/host_shaders/opengl_fragment_shader.frag | ||
+++ b/src/host_shaders/opengl_fragment_shader.frag | ||
@@ -1,4 +1,5 @@ | ||
-#version 410 core | ||
+#version 300 es | ||
+precision mediump float; | ||
|
||
in vec3 v_tangent; | ||
in vec3 v_normal; | ||
@@ -27,7 +28,7 @@ uniform bool u_depthmapEnable; | ||
uniform sampler2D u_tex0; | ||
uniform sampler2D u_tex1; | ||
uniform sampler2D u_tex2; | ||
-uniform sampler1DArray u_tex_lighting_lut; | ||
+// uniform sampler1DArray u_tex_lighting_lut; | ||
|
||
uniform uint u_picaRegs[0x200 - 0x48]; | ||
|
||
@@ -145,9 +146,15 @@ vec4 tevCalculateCombiner(int tev_id) { | ||
#define RR_LUT 6u | ||
|
||
float lutLookup(uint lut, uint light, float value) { | ||
- if (lut >= FR_LUT && lut <= RR_LUT) lut -= 1; | ||
- if (lut == SP_LUT) lut = light + 8; | ||
- return texture(u_tex_lighting_lut, vec2(value, lut)).r; | ||
+ // if (lut >= FR_LUT && lut <= RR_LUT) lut -= 1; | ||
+ // if (lut == SP_LUT) lut = light + 8; | ||
+ // return texture(u_tex_lighting_lut, vec2(value, lut)).r; | ||
+ return 0.0; | ||
+} | ||
+ | ||
+uint bitfieldExtract(uint val, int off, int size) { | ||
+ uint mask = uint((1 << size) - 1); | ||
+ return uint(val >> off) & mask; | ||
} | ||
|
||
vec3 regToColor(uint reg) { | ||
diff --git a/src/host_shaders/opengl_vertex_shader.vert b/src/host_shaders/opengl_vertex_shader.vert | ||
index a25d7a6d..5967ccd6 100644 | ||
--- a/src/host_shaders/opengl_vertex_shader.vert | ||
+++ b/src/host_shaders/opengl_vertex_shader.vert | ||
@@ -1,4 +1,4 @@ | ||
-#version 410 core | ||
+#version 300 es | ||
|
||
layout(location = 0) in vec4 a_coords; | ||
layout(location = 1) in vec4 a_quaternion; | ||
@@ -20,7 +20,7 @@ out vec2 v_texcoord2; | ||
flat out vec4 v_textureEnvColor[6]; | ||
flat out vec4 v_textureEnvBufferColor; | ||
|
||
-out float gl_ClipDistance[2]; | ||
+// out float gl_ClipDistance[2]; | ||
|
||
// TEV uniforms | ||
uniform uint u_textureEnvColor[6]; | ||
@@ -93,6 +93,6 @@ void main() { | ||
); | ||
|
||
// There's also another, always-on clipping plane based on vertex z | ||
- gl_ClipDistance[0] = -a_coords.z; | ||
- gl_ClipDistance[1] = dot(clipData, a_coords); | ||
+ // gl_ClipDistance[0] = -a_coords.z; | ||
+ // gl_ClipDistance[1] = dot(clipData, a_coords); | ||
} | ||
diff --git a/third_party/opengl/opengl.hpp b/third_party/opengl/opengl.hpp | ||
index f368f573..5ead7f63 100644 | ||
--- a/third_party/opengl/opengl.hpp | ||
+++ b/third_party/opengl/opengl.hpp | ||
@@ -520,21 +520,21 @@ namespace OpenGL { | ||
static void enableBlend() { glEnable(GL_BLEND); } | ||
static void disableBlend() { glDisable(GL_BLEND); } | ||
static void enableLogicOp() { glEnable(GL_COLOR_LOGIC_OP); } | ||
- static void disableLogicOp() { glDisable(GL_COLOR_LOGIC_OP); } | ||
+ static void disableLogicOp() { /* glDisable(GL_COLOR_LOGIC_OP); */ } | ||
static void enableDepth() { glEnable(GL_DEPTH_TEST); } | ||
static void disableDepth() { glDisable(GL_DEPTH_TEST); } | ||
static void enableStencil() { glEnable(GL_STENCIL_TEST); } | ||
static void disableStencil() { glDisable(GL_STENCIL_TEST); } | ||
|
||
- static void enableClipPlane(GLuint index) { glEnable(GL_CLIP_DISTANCE0 + index); } | ||
- static void disableClipPlane(GLuint index) { glDisable(GL_CLIP_DISTANCE0 + index); } | ||
+ static void enableClipPlane(GLuint index) { /* glEnable(GL_CLIP_DISTANCE0 + index); */ } | ||
+ static void disableClipPlane(GLuint index) { /* glDisable(GL_CLIP_DISTANCE0 + index); */ } | ||
|
||
static void setDepthFunc(DepthFunc func) { glDepthFunc(static_cast<GLenum>(func)); } | ||
static void setColourMask(GLboolean r, GLboolean g, GLboolean b, GLboolean a) { glColorMask(r, g, b, a); } | ||
static void setDepthMask(GLboolean mask) { glDepthMask(mask); } | ||
|
||
// TODO: Add a proper enum for this | ||
- static void setLogicOp(GLenum op) { glLogicOp(op); } | ||
+ static void setLogicOp(GLenum op) { /* glLogicOp(op); */ } | ||
|
||
enum Primitives { | ||
Triangle = GL_TRIANGLES, |
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
19 changes: 0 additions & 19 deletions
19
src/pandroid/app/src/main/java/com/panda3ds/pandroid/PandaGlSurfaceView.java
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/BaseActivity.java
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,6 @@ | ||
package com.panda3ds.pandroid.app; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
public class BaseActivity extends AppCompatActivity { | ||
} |
56 changes: 56 additions & 0 deletions
56
src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/GameActivity.java
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,56 @@ | ||
package com.panda3ds.pandroid.app; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.KeyEvent; | ||
import android.view.MotionEvent; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.CheckBox; | ||
import android.widget.CompoundButton; | ||
import android.widget.FrameLayout; | ||
import android.widget.Toast; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.panda3ds.pandroid.AlberDriver; | ||
import com.panda3ds.pandroid.R; | ||
import com.panda3ds.pandroid.utils.Constants; | ||
import com.panda3ds.pandroid.view.PandaGlSurfaceView; | ||
import com.panda3ds.pandroid.view.PandaLayoutController; | ||
import com.panda3ds.pandroid.view.controller.ControllerLayout; | ||
|
||
public class GameActivity extends BaseActivity { | ||
private PandaGlSurfaceView pandaSurface; | ||
private PandaLayoutController controllerLayout; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
Intent intent = getIntent(); | ||
if(!intent.hasExtra(Constants.EXTRA_PATH)){ | ||
|
||
setContentView(new FrameLayout(this)); | ||
Toast.makeText(this, "INVALID ROM PATH", Toast.LENGTH_LONG).show(); | ||
finish(); | ||
return; | ||
} | ||
|
||
pandaSurface = new PandaGlSurfaceView(this, intent.getStringExtra(Constants.EXTRA_PATH));; | ||
|
||
setContentView(R.layout.game_activity); | ||
|
||
((FrameLayout)findViewById(R.id.panda_gl_frame)) | ||
.addView(pandaSurface, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); | ||
|
||
controllerLayout = findViewById(R.id.controller_layout); | ||
controllerLayout.initialize(); | ||
|
||
((CheckBox)findViewById(R.id.hide_screen_controller)) | ||
.setOnCheckedChangeListener((buttonView, isChecked) -> { | ||
controllerLayout.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE); | ||
}); | ||
} | ||
} |
Oops, something went wrong.