mirror of
https://github.com/open-goal/jak-project
synced 2026-06-02 18:19:07 -04:00
1f6438e517
This PR updates to SDL3, and with it, adds a handful of new features. Everything seems to work but I'm going to look over the code once last time before merging, some of the API changes are hard to spot. Fixes #2773 ### Pressure sensitivity support for DS3 Controllers SDL3 adds pressure sensitivity support for DS3 controllers on windows. I have not tested on linux. The option is disabled by default. On windows you will need https://docs.nefarius.at/projects/DsHidMini/ and to be using SXS mode. ### DualSense and Xbox One Trigger Effects If enabled, Jak 2 will have certain trigger effects. They are: - xbox1: - small vibrate when collecting dark eco - big vibrate when changing to dark jak - vibrate when shooting gun, proportional to gun type - ps5: - resistance when changing to dark jak - different gun shooting effects - red (resistance) - yellow (weapon trigger) - blue (vibrates) - purple (less resistance) > **Gun Shooting effects are only enabled if the new "Swap R1 and R2" option is enabled** There are more effects that could be used in `dualsense_effects.cpp`, but I only exposed the ones I needed to OpenGOAL. If a modder wants to use some of the others and wires them up end-to-end, please consider contributing that upstream. ### New ImGUI Menu Added new imgui options for selecting the active controller, for those people that struggle to select the initial controller.  ### Testing The highlights of what I tested successfully: - display - [x] all mode switch permutations - [x] launch with all modes saved - [x] switch monitors / unplug monitor that was active, how does it handle it - [x] load with alternate monitor saved and all modes - [x] allowing hidpi doesnt break macos - controls - [x] keyboard and mouse still work - [x] pressure sensitivity on linux
122 lines
3.8 KiB
CMake
Vendored
Generated
122 lines
3.8 KiB
CMake
Vendored
Generated
package @ANDROID_MANIFEST_PACKAGE@;
|
|
|
|
import android.app.Activity;
|
|
import android.app.AlertDialog;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
|
|
import org.libsdl.app.SDL;
|
|
import org.libsdl.app.SDLActivity;
|
|
|
|
import android.widget.Button;
|
|
import android.widget.EditText;
|
|
import android.widget.TextView;
|
|
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.LayoutInflater;
|
|
|
|
public class SDLEntryTestActivity extends Activity {
|
|
|
|
public String MODIFY_ARGUMENTS = "@ANDROID_MANIFEST_PACKAGE@.MODIFY_ARGUMENTS";
|
|
boolean isModifyingArguments;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
Log.v("SDL", "SDLEntryTestActivity onCreate");
|
|
super.onCreate(savedInstanceState);
|
|
|
|
String intent_action = getIntent().getAction();
|
|
Log.v("SDL", "SDLEntryTestActivity intent.action = " + intent_action);
|
|
|
|
if (intent_action == MODIFY_ARGUMENTS) {
|
|
isModifyingArguments = true;
|
|
createArgumentLayout();
|
|
} else {
|
|
startChildActivityAndFinish();
|
|
}
|
|
}
|
|
|
|
protected void createArgumentLayout() {
|
|
LayoutInflater inflater = getLayoutInflater();
|
|
View view = inflater.inflate(R.layout.arguments_layout, null);
|
|
setContentView(view);
|
|
|
|
Button button = (Button)requireViewById(R.id.arguments_start_button);
|
|
button.setOnClickListener(new View.OnClickListener() {
|
|
public void onClick(View v) {
|
|
startChildActivityAndFinish();
|
|
}
|
|
});
|
|
}
|
|
|
|
protected String[] getArguments() {
|
|
if (!isModifyingArguments) {
|
|
return new String[0];
|
|
}
|
|
EditText editText = (EditText)findViewById(R.id.arguments_edit);
|
|
String text = editText.getText().toString();
|
|
String new_text = text.replace("[ \t]*[ \t\n]+[ \t]+", "\n").strip();
|
|
Log.v("SDL", "text = " + text + "\n becomes \n" + new_text);
|
|
return new_text.split("\n", 0);
|
|
}
|
|
|
|
@Override
|
|
protected void onStart() {
|
|
Log.v("SDL", "SDLEntryTestActivity onStart");
|
|
super.onStart();
|
|
}
|
|
|
|
@Override
|
|
protected void onResume() {
|
|
Log.v("SDL", "SDLEntryTestActivity onResume");
|
|
super.onResume();
|
|
}
|
|
|
|
@Override
|
|
protected void onPause() {
|
|
Log.v("SDL", "SDLEntryTestActivity onPause");
|
|
super.onPause();
|
|
}
|
|
|
|
@Override
|
|
protected void onStop() {
|
|
Log.v("SDL", "SDLEntryTestActivity onStop");
|
|
super.onStop();
|
|
}
|
|
|
|
@Override
|
|
protected void onDestroy() {
|
|
Log.v("SDL", "SDLEntryTestActivity onDestroy");
|
|
super.onDestroy();
|
|
}
|
|
|
|
@Override
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
Log.v("SDL", "SDLEntryTestActivity onRestoreInstanceState");
|
|
super.onRestoreInstanceState(savedInstanceState);
|
|
EditText editText = (EditText)findViewById(R.id.arguments_edit);
|
|
editText.setText(savedInstanceState.getCharSequence("args", ""), TextView.BufferType.EDITABLE);
|
|
}
|
|
|
|
@Override
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
Log.v("SDL", "SDLEntryTestActivity onSaveInstanceState");
|
|
EditText editText = (EditText)findViewById(R.id.arguments_edit);
|
|
outState.putCharSequence("args", editText.getText());
|
|
super.onSaveInstanceState(outState);
|
|
}
|
|
|
|
private void startChildActivityAndFinish() {
|
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
|
intent.setClassName("@ANDROID_MANIFEST_PACKAGE@", "@ANDROID_MANIFEST_PACKAGE@.SDLTestActivity");
|
|
intent.putExtra("arguments", getArguments());
|
|
startActivity(intent);
|
|
finish();
|
|
}
|
|
}
|