Skip to content

Commit

Permalink
fx
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuoya committed Apr 22, 2022
1 parent 9a546ca commit 49c64dd
Show file tree
Hide file tree
Showing 10 changed files with 42,351 additions and 3,900 deletions.
22,287 changes: 22,287 additions & 0 deletions cache/00040000000B8A00.shader

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions cache/00040000000B8A00.shader.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
shader: 103
reference: 121
program: 90
23,813 changes: 19,944 additions & 3,869 deletions cache/0004000000197100.shader

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions cache/0004000000197100.shader.meta
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1
shader: 117
reference: 402
program: 97
shader: 183
reference: 1146
program: 163
56 changes: 56 additions & 0 deletions src/android/app/src/main/assets/accurate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// On the PICA200, "infinity * 0 = 0" but in OpenGL "infinity * 0 = NaN". (infinity = 1.0 / 0.0)

// Pokemon x: mul_s, dot_3, rsq_s
// The Legend of Zelda: Ocarina of Time: mul_s
// Luigi's Mansion: Dark Moon: mul_s, fma_s, rcp_s

[accurate_mul_off]
#define mul_s(x, y) (x * y)
#define mul_3(x, y) (x * y)
#define fma_s(x, y, z) fma(x, y, z)
#define rcp_s(x) (1.0f / x)
#define rsq_s(x) inversesqrt(x)
#define dot_s(x, y) dot(x, y)
#define dot_3(x, y) dot(x, y)

[accurate_mul_fast]
#define mul_s(x, y) mix(x * y, vec4(0.0), isnan(x * y))
#define mul_3(x, y) (x * y)
#define fma_s(x, y, z) (mul_s(x, y) + z)
float rcp_s(float x) {
if (x == 0.0f) return x;
return 1.0f / x;
}
#define rsq_s(x) inversesqrt(x)
#define dot_s(x, y) dot(x, y)
#define dot_3(x, y) dot(x, y)

[accurate_mul_safe]
#define mul_s(x, y) mix(x * y, vec4(0.0), isnan(x * y))
#define mul_3(x, y) mix(x * y, vec3(0.0), isnan(x * y))
#define fma_s(x, y, z) (mul_s(x, y) + z)
float rcp_s(float x) {
if (x == 0.0f) return x;
return 1.0f / x;
}
float rsq_s(float x) {
if (x == 0.0f) return x;
return inversesqrt(x);
}
#define dot_s(x, y) dot(x, y)
#define dot_3(x, y) dot(mul_3(x, y), vec3(1.0))

[accurate_mul_slow]
#define mul_s(x, y) mix(x * y, vec4(0.0), isnan(x * y))
#define mul_3(x, y) mix(x * y, vec3(0.0), isnan(x * y))
#define fma_s(x, y, z) (mul_s(x, y) + z)
float rcp_s(float x) {
if (x == 0.0f) return x;
return 1.0f / x;
}
float rsq_s(float x) {
if (x == 0.0f) return x;
return inversesqrt(x);
}
#define dot_s(x, y) dot(mul_s(x, y), vec4(1.0))
#define dot_3(x, y) dot(mul_3(x, y), vec3(1.0))
33 changes: 29 additions & 4 deletions src/android/app/src/main/assets/config/config-games.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@
0004000000079600 // Jett Rocket II
0004000000112600 // Cut the Rope
0004000000116700 // Cut the Rope
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
00040000000AFC00 // Digimon World Re:Digitize Decode
0004000000125600 // The Legend of Zelda: Majoras Mask 3D
0004000000125500 // The Legend of Zelda: Majoras Mask 3D
Expand All @@ -70,6 +66,10 @@
0004000000030000 // Kid Icarus: Uprising
0004000000030100 // Kid Icarus: Uprising
0004000000030200 // Kid Icarus: Uprising
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
[new_3ds_mode]
000400000F700000 // Xenoblade Chronicles 3D [JPN]
Expand Down Expand Up @@ -105,6 +105,10 @@
0004000000193500 // Terraria
000400000016A900 // Terraria
000400000016A600 // Terraria
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
[use_linear_filter]
00040000001AA200 // Attack On Titan 2
Expand Down Expand Up @@ -133,6 +137,13 @@
0004000000030500 // Super Street Fighter
0004000000032D00 // Super Street Fighter
0004000000033C00 // Super Street Fighter
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
000400000F700800 // The Binding of Isaac: Rebirth [USA]
000400000F701700 // The Binding of Isaac: Rebirth [JPN]
000400000F700900 // The Binding of Isaac: Rebirth [EUR]
[skip_texture_copy]
0004000000030000 // Kid Icarus: Uprising
Expand All @@ -147,6 +158,10 @@
0004000000030600 // Mario Kart 7
0004000000030800 // Mario Kart 7
0004000000030700 // Mario Kart 7
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
[skip_slow_draw]
000400000015CB00 // New Atelier Rorona
Expand Down Expand Up @@ -185,6 +200,12 @@
000400000004A700 // Tales of the Abyss
000400000005D700 // Tales of the Abyss
[disable_direct_display]
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
[skip_cpu_write]
0004000000120900 // Lord of Magna: Maiden Heaven
0004000000164300 // Lord of Magna: Maiden Heaven
Expand Down Expand Up @@ -217,3 +238,7 @@
00040000000BAC00 // Mirror of Fate
000400000009E500 // Mirror of Fate
0004000000096600 // Mirror of Fate
00040000000D0000 // Luigi's Mansion: Dark Moon
0004000000076400 // Luigi's Mansion: Dark Moon
0004000000055F00 // Luigi's Mansion: Dark Moon
0004000000076500 // Luigi's Mansion: Dark Moon
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public final class InputOverlayJoystick implements InputOverlay.InputObject {
private final int[] mAxisIDs = {0, 0};
private final float[] mAxises = {0f, 0f};
private final double[] mAxises = {0, 0};

private Bitmap mOuterBitmap;
private Bitmap mDefaultInnerBitmap;
Expand Down Expand Up @@ -77,31 +77,32 @@ public void onPointerUp(int id, float x, float y) {

private void setJoystickState(float touchX, float touchY) {
if (mPointerId != -1) {
float maxY = mOuterBounds.bottom;
float maxX = mOuterBounds.right;
double maxY = mOuterBounds.bottom;
double maxX = mOuterBounds.right;
touchX -= mOuterBounds.centerX();
maxX -= mOuterBounds.centerX();
touchY -= mOuterBounds.centerY();
maxY -= mOuterBounds.centerY();
mAxises[0] = touchX / maxX;
mAxises[1] = touchY / maxY;
} else {
mAxises[0] = mAxises[1] = 0.0f;
mAxises[0] = mAxises[1] = 0;
}

// Clamp the circle pad input to a circle
float radius = (float) Math.sqrt(mAxises[0] * mAxises[0] + mAxises[1] * mAxises[1]);
if(radius > 1.0f)
{
float angle = (float) Math.atan2(mAxises[1], mAxises[0]);
mAxises[0] = ((float)Math.cos(angle) * 1.0f);
mAxises[1] = ((float)Math.sin(angle) * 1.0f);
double radius = Math.sqrt(mAxises[0] * mAxises[0] + mAxises[1] * mAxises[1]);
if(radius > 1.0) {
double angle = Math.atan2(mAxises[1], mAxises[0]);
mAxises[0] = Math.cos(angle);
mAxises[1] = Math.sin(angle);
}

updateInnerBounds();

NativeLibrary.InputEvent(mAxisIDs[0], mAxises[0]);
NativeLibrary.InputEvent(mAxisIDs[1], mAxises[1]);
double x = 1.0 - (1 - mAxises[0]) * (1 - mAxises[0]);
double y = 1.0 - (1 - mAxises[1]) * (1 - mAxises[1]);
NativeLibrary.InputEvent(mAxisIDs[0], (float)x);
NativeLibrary.InputEvent(mAxisIDs[1], (float)y);
}

public int getButtonId() {
Expand All @@ -125,13 +126,13 @@ private Bitmap getCurrentBitmap() {
}

private void updateInnerBounds() {
float centerX = mOuterBounds.centerX();
float centerY = mOuterBounds.centerY();
float halfWidth = mOuterBounds.width() / 2.0f;
float halfHeight = mOuterBounds.height() / 2.0f;
double centerX = mOuterBounds.centerX();
double centerY = mOuterBounds.centerY();
double halfWidth = mOuterBounds.width() / 2.0;
double halfHeight = mOuterBounds.height() / 2.0;

float x = centerX + mAxises[0] * halfWidth;
float y = centerY + mAxises[1] * halfHeight;
double x = centerX + mAxises[0] * halfWidth;
double y = centerY + mAxises[1] * halfHeight;

if (x > centerX + halfWidth)
x = centerX + halfWidth;
Expand All @@ -143,6 +144,6 @@ private void updateInnerBounds() {
if (y < centerY - halfHeight)
y = centerY - halfHeight;

mInnerBounds.offsetTo((int)(x - mInnerBounds.width() / 2.0f), (int)(y - mInnerBounds.height() / 2.0f));
mInnerBounds.offsetTo((int)(x - mInnerBounds.width() / 2.0), (int)(y - mInnerBounds.height() / 2.0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_reset_setting) {
File ini = new File(CitraDirectory.getConfigFile());
File ini2 = new File(CitraDirectory.getConfigDirectory() + "/config-games.ini");
try {
ini.delete();
ini2.delete();
} catch (Exception e) {
// ignore
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,13 @@ private boolean isMiUiInternational() {
}

private void deleteShaderCache() {
File cache = CitraDirectory.getShaderCacheFile(mGameId);
String dir = CitraDirectory.getUserDirectory() + "/Cache/";
File cache = new File(dir + mGameId + ".cache");
File shader = new File(dir + mGameId + ".shader");
File meta = new File(dir + mGameId + ".shader.meta");
if (cache.exists()) {
shader.delete();
meta.delete();
if (cache.delete()) {
Toast.makeText(this, R.string.delete_success, Toast.LENGTH_SHORT).show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ public static String getApplicationDirectory() {
return getSDMCDirectory() + "/Nintendo 3DS/00000000000000000000000000000000/00000000000000000000000000000000/title";
}

public static File getShaderCacheFile(String programId) {
return new File(getUserDirectory() + "/Cache/" + programId + ".cache");
}

public static void saveInputOverlay(Context context) {
final int[] inputIds = InputOverlay.ResIds;
final String[] inputNames = InputOverlay.ResNames;
Expand Down

0 comments on commit 49c64dd

Please sign in to comment.