Some monitors are very specific about their reported refresh rates:
```
[54:37] [debug] [DISPLAY]: Skipping 640x480 as it requires 360.11hz but the monitor is currently set to 360hz
```
The current code truncated the display mode, but would compare against
the reported refresh rate. As per the log, they are obviously not equal.
- Retain the float component and only round it off when sending the
value to GOAL
- Make the comparison more generous, +/- 1.0hz
Fixes#3151 by applying the same fix as #2686 to another Mips2C
function.
Tested by mashing Jak's body into the bad collision walls for 30 minutes
without a single crash.
When building the eye texture, the background is first set to the top
corner of the iris texture.
A long, long time ago, I implemented this by peeking at the data in the
texture itself. This doesn't work if the iris texture is animated since
the texture will only on the GPU.
To fix this, this PR changes the eye renderer to draw a square over the
entire eye texture using iris texture's top corner, avoiding the need
for getting the texture data on the CPU. I don't remember why I didn't
do this in the first place, but this seems better in every way.
Also `input_data` in TexturePool not being initialized, which was
leading to hard-to-debug crashes when it was randomly initialized to a
sometimes invalid but non-null pointer.
Co-authored-by: water111 <awaterford1111445@gmail.com>
Two changes that fix some Jak 3 audio bugs.
In some areas, sound effects would seem to cut off randomly. This was
caused by the sound code reusing IDs, but overlord didn't realize. It
would try to kill a sound effect by ID that had already died, and the ID
was reassigned to a new sound. To fix this, I made the handle IDs always
increment. I also tested starting the ID at large numbers and confirmed
that worked.
I also added support for the BRANCH grain. This makes the
`wastelander-shot` and possibly other sound effects work. It doesn't
support all the features, but this is probably enough.
Fun fact: the wastelander shot is supposed to have 7 variations, but you
always get the same one because they set the sound mask wrong.
I added a line you can uncomment if you want to experience the other 6
variations.
---------
Co-authored-by: water111 <awaterford1111445@gmail.com>
There's a suspicion that MSAA might be what causes the black screen
problem for some users, additionally this can cause perf issues for
people with really bad PCs so this is probably a better default.
Needs testing before merging, i think this is all inclusive though.
This should solve the issue where buttons are held down until you push
them the same time. This would cause the cars in jak 3 to not move until
you pushed square/circle and "released" the brake.
Co-authored-by: water111 <awaterford1111445@gmail.com>
When the `dp-bipedal`s get blown up by the nuke gun, their bones go to
NaNs on the last frame. The shadow renderer doesn't handle this well and
draws all possible triangles as single tris. This overflows the vif
`unpack` field and triggered an assert when sizes inside the shadow
renderer weren't consistent.
My guess is that this works on the real game either because:
- their shadow renderer draws garbage data, but you can't tell because
the screen is white from the nuke
- no NaN on PS2 means that the shadow renderer behaved differently, not
using all single tris.
As a workaround, if the bones are NaN, the shadow renderer treats them
as 0, meaning there is no shadow drawn.
---------
Co-authored-by: water111 <awaterford1111445@gmail.com>
Fixes the pillars being transparent (but is a bit of a hack), the desert
sand not having texture filtering, and the "No memory card" on the title
screen with debug mode off.
---------
Co-authored-by: water111 <awaterford1111445@gmail.com>
Prior to SDL3, borderless windows were kinda a hack, they cleaned all of
that up. The side-effect of that is that the C++ code keeps track of the
current window size (it does this for framebuffer sizing, but also to
set the size of the window).
This is now an issue because SDL is properly firing events when you
change to borderless mode, so our window size gets updated to the size
of the entire monitor. When you switch to windowed mode from borderless,
it now seems like it didn't work (it did, its just still taking up the
entire screen).
This could be better cleaned up if more settings are extracted out of
GOAL and put into C++ so they can be managed and accessed where they
belong. But for now, this is a minimally invasive fix.
Fixes#3917
This is a simple multiplier to the gamepad axis input value received
from SDL events. Normally the values it provides cannot satisfy the
square range of the stick input. This is usually fine but it might play
differently with different controllers and compared to consoles,
especially considering the DualShock 1/2 have automatic calibration
which works in mysterious ways. The setting is there so any user can
adjust it for their controllers.
Saved to and loaded from the input-settings.json file.
133% matches PCSX2's default setting and is generally a good value to
map the square stick range within most modern(ish) controllers' circular
stick motion.
Progress menu option added to Jak 1 and 2. Setting can be changed from
50% all the way to 200%.
~~Renamed the analog deadzone options to stick deadzone since they don't
apply to the other analog buttons and only the (analog, yes) sticks.~~
For dualsense controllers, when the game exits we explicitly clear any
trigger effects. This was happening after SDL was already terminated, so
the hardware handles were already lost.
From a practical standpoint though, this mostly just cleans up logs.
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
Used a PR since many things can't be changed using Crowdin, such as
timings.
Same team as the italian Jak 1 translation.
This PR won't include subtitles, which will be included later on in a
separate PR, once things will be worked on.
Still needs to be revised by the team.
---------
Co-authored-by: pex93 <44973506+pex93@users.noreply.github.com>
Co-authored-by: Francesco <107510301+XedoIT@users.noreply.github.com>
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
Kind of silly fix.
The cloth update function sometimes runs before the "setup" is done
(`need-setup` is set), which divides by zero in a bunch of places. This
fix prevents NaNs from spreading during this time.
Co-authored-by: water111 <awaterford1111445@gmail.com>