Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/android/cpp/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ int showFpsCounter = 0;
int buttonScale = 5;
int buttonSpacing = 10;
int vibrateStrength = 1;
int showButtons = 1;
int keyBinds[12] = {};

std::string ndsPath = "", gbaPath = "";
Expand Down Expand Up @@ -92,6 +93,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_com_hydra_noods_FileBrowser_loadSetti
Setting("screenFilter", &screenFilter, false),
Setting("micEnable", &micEnable, false),
Setting("showFpsCounter", &showFpsCounter, false),
Setting("showButtons", &showButtons, false),
Setting("buttonScale", &buttonScale, false),
Setting("buttonSpacing", &buttonSpacing, false),
Setting("vibrateStrength", &vibrateStrength, false),
Expand Down Expand Up @@ -395,6 +397,11 @@ extern "C" JNIEXPORT jint JNICALL Java_com_hydra_noods_SettingsMenu_getShowFpsCo
return showFpsCounter;
}

extern "C" JNIEXPORT jint JNICALL Java_com_hydra_noods_SettingsMenu_getShowButtons(JNIEnv* env, jobject obj)
{
return showButtons;
}

extern "C" JNIEXPORT jint JNICALL Java_com_hydra_noods_SettingsMenu_getButtonScale(JNIEnv* env, jobject obj)
{
return buttonScale;
Expand Down Expand Up @@ -485,6 +492,11 @@ extern "C" JNIEXPORT void JNICALL Java_com_hydra_noods_SettingsMenu_setShowFpsCo
showFpsCounter = value;
}

extern "C" JNIEXPORT void JNICALL Java_com_hydra_noods_SettingsMenu_setShowButtons(JNIEnv* env, jobject obj, jint value)
{
showButtons = value;
}

extern "C" JNIEXPORT void JNICALL Java_com_hydra_noods_SettingsMenu_setButtonScale(JNIEnv* env, jobject obj, jint value)
{
buttonScale = value;
Expand Down
12 changes: 12 additions & 0 deletions src/android/java/com/hydra/noods/NooActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public boolean onOptionsItemSelected(MenuItem item)
switch (item.getItemId())
{
case R.id.controls_action:

// Toggle hiding the on-screen buttons

if (showingButtons = !showingButtons)
{
for (int i = 0; i < 6; i++)
Expand All @@ -154,6 +156,8 @@ public boolean onOptionsItemSelected(MenuItem item)
layout.removeView(buttons[i]);
}
return true;



case R.id.save_action:
final boolean gba = isGbaMode();
Expand Down Expand Up @@ -322,6 +326,14 @@ public void updateButtons()
layout.addView(buttons[i]);
initButtons = false;
}

// Remove buttons from layout if disabled
if (SettingsMenu.getShowButtons() == 0)
{
for (int i = 0; i < 6; i++)
layout.removeView(buttons[i]);
showingButtons = false;
}
}

private boolean canEnableMic()
Expand Down
4 changes: 4 additions & 0 deletions src/android/java/com/hydra/noods/SettingsMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ protected void onCreate(Bundle savedInstanceState)
editor.putBoolean("screen_filter", (getScreenFilter() == 0) ? false : true);
editor.putBoolean("mic_enable", (getMicEnable() == 0) ? false : true);
editor.putBoolean("show_fps_counter", (getShowFpsCounter() == 0) ? false : true);
editor.putBoolean("show_buttons", (getShowButtons() == 0) ? false : true);
editor.putInt("button_scale", getButtonScale());
editor.putInt("button_spacing", getButtonSpacing());
editor.putInt("vibrate_strength", getVibrateStrength());
Expand Down Expand Up @@ -125,6 +126,7 @@ public void onBackPressed()
setScreenFilter(prefs.getBoolean("screen_filter", true) ? 1 : 0);
setMicEnable(prefs.getBoolean("mic_enable", false) ? 1 : 0);
setShowFpsCounter(prefs.getBoolean("show_fps_counter", false) ? 1 : 0);
setShowButtons(prefs.getBoolean("show_buttons", false) ? 1 : 0);
setButtonScale(prefs.getInt("button_scale", 5));
setButtonSpacing(prefs.getInt("button_spacing", 10));
setVibrateStrength(prefs.getInt("vibrate_strength", 1));
Expand All @@ -149,6 +151,7 @@ public void onBackPressed()
public static native int getScreenFilter();
public static native int getMicEnable();
public static native int getShowFpsCounter();
public static native int getShowButtons();
public static native int getButtonScale();
public static native int getButtonSpacing();
public static native int getVibrateStrength();
Expand All @@ -167,6 +170,7 @@ public void onBackPressed()
public static native void setScreenFilter(int value);
public static native void setMicEnable(int value);
public static native void setShowFpsCounter(int value);
public static native void setShowButtons(int value);
public static native void setButtonScale(int value);
public static native void setButtonSpacing(int value);
public static native void setVibrateStrength(int value);
Expand Down
7 changes: 7 additions & 0 deletions src/android/res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@
app:key="show_fps_counter"
app:title="Show FPS Counter"
app:iconSpaceReserved="false"
app:allowDividerAbove="true"
app:allowDividerBelow="true" />

<SwitchPreferenceCompat
app:key="show_buttons"
app:title="Show On-Screen Buttons"
app:iconSpaceReserved="false"
app:allowDividerAbove="true" />
</PreferenceCategory>

Expand Down