Commit Graph

1372 Commits

Author SHA1 Message Date
Tyler Wilding a0a4ec7df5 game: fix level select for untranslated languages and fix infinite recursion edge-case in lookup-text! (#3969)
The main bug this fixes is not being able to use level select when your
language isn't translated. Why? Because they use the result from
`lookup-text!` to determine if a menu item should be drawn or not. No
text found, no menu item.

However this uncovered a long-standing bug in my fallback extension to
this code. If you call this function with a text-id that doesnt even
have an english string, it will recursively keep calling itself until it
crashes. Of course the first few tasks in the game are dummies and have
no valid text-id so this had to be fixed.

Should be fixed for all 3 games.
2025-07-02 22:44:02 -04:00
Matt Dallmeyer 0ab252d39d [jak1] Fix speedrun mode bug where loading a save is counted as new run (#3960)
Fixes a small bug introduced in #3902. 

Without this change, whenever you load a save it is treated as if you
started a new game and resets the autosplitter back to 0s.
2025-06-19 17:47:42 +02:00
water111 c08118509b [jak3] Add BRANCH grain, make handler IDs unique (#3950)
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>
2025-06-07 22:34:03 -04:00
Tyler Wilding 77586b7fa9 game: default MSAA to off (#3943)
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.
2025-06-03 23:58:05 -04:00
water111 fce2dad3c0 [jak3] Fix disabling nav (#3941)
This needs a parameter, otherwise it was reading some uninitialized
value. In some cases, the uninitialized value would leave the nav stuff
on, and the marauders would go crazy trying to avoid each other.
2025-06-02 21:51:22 -04:00
SuperSamus 5522c3d500 [high fps] fix blinking in all games (#3759)
Fixes both interval and animation speed. (jak1 previously only had a fix
for the former.)
This should close #3518, and one of the issues of #1499.

The solution is not the cleanest. The results are going to be wrong in
case the FPS doesn't reach the maximum set.
A better solution would be to make `random-time` a float, so that it can
be subtracted by `time-adjust-ratio`, but I don't know if changing a
type for this purpose is allowed here. Tell me if I should do that
instead.

Tested only on jak2.

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2025-06-01 18:50:33 -04:00
Tyler Wilding 23262ce269 g/j2: add hack workaround to prevent atoll-sig mission getting stuck due to NaN bones (#3935)
Related to #3929 

Played through the mission, worked fine. This condition should _never_
be hit under normal circumstances
2025-06-01 18:50:11 -04:00
water111 228dfd82d1 [jak3] Small bug fixes (#3933)
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>
2025-06-01 13:24:28 -04:00
Tyler Wilding b6649d2433 Properly set window size when switching from borderless/fullscreen -> windowed mode (#3923)
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
2025-05-31 18:47:02 -04:00
Alex a6c21a9814 Implement analog stick sensitivity setting, default it to 133% (#3919)
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.~~
2025-05-27 16:01:06 +01:00
Tyler Wilding 85e3203188 g/jak2: don't try to print subtitles that don't exist (non-base language) (#3910)
Fixes #3909 

Long standing issue in Jak 2's subtitles, it's actually kinda incredible
that finnish didn't run into this problem. Later in this code it
accesses the subtitle based on the language-id, and finnish is always
out of bounds -- but it never caused a catastrophic issue.

Polish on the otherhand is much more out of bounds and always causes an
access violation / crash.

Jak 2's subtitle code has no fallback (ie. use english if not
translated) for cutscenes, since they are not defined in the base file
like in Jak 1. This means that an untranslated language will render no
subtitles during cutscenes. Translations are welcome!.

Tested a cutscene in:
- english 
- italian (base game with subtitles)
- finnish (new language, actually is translated)
- polish (new language, not translated)
2025-05-12 22:41:48 -04:00
Tyler Wilding 67f62560af g/j2: change and initialize jak 2 subtitles correctly (#3907)
Fixes #3906

Wasn't an issue on Jak 1 because that game had no original subtitles,
but jak 2's subtitles still go through their original code, which uses
the `*setting-control*` object. This is a regression from when i
recently added all languages to the menu options.

- Update the setting at runtime
- Update the setting at initialization time

This may be an issue in Jak 3 as well if the code was copied over. We'll
fix it when we get there.


![image](https://github.com/user-attachments/assets/19a796a7-a3f3-4872-98f8-7fcbe91b3ec1)

![image](https://github.com/user-attachments/assets/356f751a-5406-41f3-b616-97ece2782a88)
2025-05-09 21:37:05 -04:00
Matt Dallmeyer 4e28bd1eaf [jak1] Speedrun mode misc fixes (#3902)
Fixed up a few things for speedrun mode in Jak 1:
- Changed autosplitter to start run in line with ruleset (first frame
after blackout where jak is touching ground). Also tweaked the
verification text in bottom left to show "Run Started: Yes/No" to go
with this
- Changed speedrun menu button combo to match Jak 2/3 (only need to hold
L1+R1 and press Start/Select, no longer need to hold X)
- Treat speedrun menu via Select the same as Start (no more potential
for funny pause buffer where actors freeze)

warp gate example:

![vlcsnap-2025-04-26-12h03m37s116](https://github.com/user-attachments/assets/3a06c3fe-0c60-4d8d-acaa-ec5f66145491)

![vlcsnap-2025-04-26-12h03m42s642](https://github.com/user-attachments/assets/e12439d4-1664-46a1-bfc0-56c737463603)

already grounded example (run starts once partially out of blackout):

![vlcsnap-2025-04-26-12h04m02s085](https://github.com/user-attachments/assets/71659b45-b599-4ca1-b097-cf736f845933)
2025-04-26 23:23:55 +02:00
Hat Kid c61a69d751 jak3: wip pc progress code (#3898) 2025-04-16 20:57:43 +02:00
Matt Dallmeyer e122941ede Fix pagination for non-dynamic popup menus (speedrun menu) (#3883)
Was testing out adding ILs to the speedrun menu and noticed this wasn't
working properly

(video before the changes)

https://github.com/user-attachments/assets/e1e7f443-60d2-4b15-bc27-a20cbe4442d6

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2025-03-31 15:40:40 -04:00
Tyler Wilding 1f6438e517 deps: update to SDL3 (#3852)
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.


![image](https://github.com/user-attachments/assets/48ff2985-d9ef-417a-b1f2-a25c74595935)

### 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
2025-03-02 16:36:22 -05:00
Tyler Wilding b2289e844c g/j2: persist subtitle language properly, eliminates a crash (#3872)
Fixes #3870
2025-03-01 13:17:38 -05:00
Tyler Wilding 9759841e3b New Crowdin updates - February 2024 (#3857) 2025-02-28 19:31:50 -05:00
water111 23118be428 [jak3] Fix crash in subrails (#3863)
After the change to vector ops, subrails was crashing. This fixes the
crash by fixing a stack type and also marks those new vector op
functions as inline.

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-16 17:40:23 -05:00
water111 2a4d3d7a4a [decompiler] More inline vector functions (#3861)
This adds more recognition for inlined vector functions to the
decompiler, which can clean up a bunch of ugly looking code/`rlet`s.


![image](https://github.com/user-attachments/assets/1f7b4627-81bd-481b-b828-76b9f7ba13b3)

Unfortunately, this changes the numbering of ops in the decomp, since
all the vector instructions get combined in a single "operation" by the
decompiler. I really tried to avoid having this ever happen in the
decompiler and this is one of the few cases where it has. So I had to
update a bunch of type casts.

For that reason I haven't turned this on in Jak 2 yet, although I am
planning to do that at some point. (probably at the same time as porting
back a bunch of jak 3 improvements to jak 2)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-16 15:59:17 -05:00
water111 48cb9bb787 [decompiler] as-type and font method support (#3855)
Add support for `as-type` macro, and detecting inline font methods. This
works in all three games but I've only updated jak 3's goal_src for now.
Eventually I will go back and work through the others, but I want to get
more decompiler features in first.


![image](https://github.com/user-attachments/assets/5c31bf85-97b4-437c-bc4b-dc054e60551e)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-01 21:23:11 -05:00
Hat Kid 710f3ac117 custom levels: etie and build actor support for jak2/3 (#3851)
Custom levels for Jak 2/3 now support envmapped TIE geometry. The TIE
extract was also changed to ignore materials that have the specular flag
set, but are missing a roughness texture.

Jak 2/3 now also support the `build-actor` tool.

The `build-custom-level` and `build-actor` macros now have a few new
options:

- Both now have a `force-run` option (`#f` by default) that, when set to
`#t`, will always run level/art group generation even if the output
files are up to date.
- `build-custom-level` has a `gen-fr3` option (`#t` by default) that,
when set to `#f`, will skip generating the FR3 file for the custom level
and only generate the GOAL level file to skip the potentially slow
process of finding and adding art groups and textures. Useful for when
you want to temporarily edit only the GOAL side of the level (such as
entity placement, etc.).
- `build-actor` has a `texture-bucket` option (default 0) which will
determine what DMA sink group the model will be placed in, which is
useful to determine the draw order of the model. Previously, this was
omitted, resulting in shadows not drawing over custom actors because the
actors were put in a bucket that is drawn after shadows (this behavior
can be restored with `:texture-bucket #f`).
2025-02-01 18:04:26 +01:00
water111 7348e6a4ff [decompiler] Update vector ops, reduce casts (#3849)
Update the decompiler to use the new vf macros.

Also, fix a bunch of silly casting issues where accessing inline fields
with an offset of 0 would be better than a cast:

![image](https://github.com/user-attachments/assets/885bbb07-634f-47b8-99f5-5a947941cdde)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 16:32:58 -05:00
water111 98d6618a8b [decompiler] Detect vector*! (#3846)
Detect use of `vector*!`, which is inlined in jak 2 and jak 3.

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 12:21:28 -05:00
water111 3ee2b4423c [decompiler] Cleanup for Jak 3 (#3845)
This PR does a few cleanups:
- improve method names/comments/flags for `enemy.gc` and a few other
files
- fix `new-stack-matrix0` not working for jak 3
- add `matrix-copy!` detection for jak 3
- add `vector-copy!` detection

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 10:31:29 -05:00
water111 341f6117d5 Fix camera-other (#3843)
There's a feature to draw levels with a different camera matrix. This
uses `camera-temp-other`, `camera-rot-other`, etc instead of
`camera-temp`, `camera-rot`... I assumed that `trans-other` was the
"other" version of `trans`, but it turns out this isn't true -
`trans-other` is combined with `quat-other` and the original camera
matrix.

This fixes the issue by using the translation part of
`inv-camera-rot-other` for othercam levels only. (it works in all cases,
but I didn't want to use it for normal levels since I think it will be
less accurate)

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-18 17:44:38 -05:00
Tyler Wilding 6f093f98ff gsrc: Add convenience macros for masking VF operations (#3824)
Migrates all code, there should be no change in the compilation output
(linter should check this)

At first i was considering making these builtins, which short of a bunch
of code generation, would require some sort of dynamic definition in
`Atoms.cpp`. This isn't hard but, i figured it would be better to keep
it simple and just generate the OG macros.

Fixes https://github.com/open-goal/jak-project/issues/233
2025-01-11 12:16:05 -05:00
Hat Kid e836f09212 jak3: fix error with subtitle speaker names (#3832) 2025-01-07 11:33:05 +01:00
Hat Kid f883b075fd jak3: port anim-tester-x (#3830) 2025-01-05 20:36:26 +01:00
Aloqas fe648ac7c5 jak3 pc subtitles (#3812)
transcribed subtitles for gameplay and model viewer dialogue

---------

Co-authored-by: blahpy <68830177+blahpy@users.noreply.github.com>
2025-01-05 20:27:48 +01:00
water111 e0acc2d15f [jak2, jak3] Unstretch moon and sun (#3822)
Fix the issue where the moon gets wide when using PC aspect ratios


![image](https://github.com/user-attachments/assets/db0ad274-5ee4-4ec3-92b6-650d295f8622)

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-04 12:39:23 -05:00
water111 266b423efa [jak3] Avoid language 255 issue (#3818)
In Jak 3, the default PC settings file would have a language of 255
because it runs before the first settings update. This would cause the
game to crash the second time it is started.

I also added this simple imgui window to see the names of streams in the
"SPU" memory, which has been useful for debugging

![image](https://github.com/user-attachments/assets/0a9d6af7-c423-4d8a-a461-faf45e350f33)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-04 11:39:28 -05:00
Hat Kid 0e5aed329e jak3: fix missing shadow for wings (#3803) 2024-12-14 18:36:53 +01:00
Hat Kid 51d008f9ab decompiler: detect and turn inverse mult to div (#3795)
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2024-12-07 23:10:49 +01:00
Hat Kid 8690104ba0 jak1: add merc version of draw-bones-hud (#3793)
Add a version of `draw-bones-hud` that uses merc to support drawing
foreground HUD elements that use custom models.
2024-12-06 20:25:20 +01:00
Hat Kid e18dbb6256 jak3: fix cloth disappearing after 600 orbs (#3790)
After collecting 600 orbs, cloth systems that didn't have any
`alt-tex-name`s defined would vanish because the `static-cloth-params`
macro doesn't default them to `#f`.
2024-12-02 17:43:41 +01:00
Hat Kid 6a06291e6e jak1, jak2: add get-texture macro (#3778)
Ports the `get-texture` macro added in Jak 3 to Jak 1 and 2.
2024-11-26 11:29:34 +01:00
Hat Kid c263bc2114 custom models: envmap support (#3777)
Custom models and model replacements now support environment mapping.

Also fixed some cases in Jak 3 where tfrags had missing textures
(defaulting to texture 0 from tpage 0, which in Jak 3 is the default eye
texture) and replaced them with more suitable alternatives.

Fixes #3776 


https://github.com/user-attachments/assets/7c11b0de-b254-40cb-9719-11238dfb3d43


![image](https://github.com/user-attachments/assets/4cc60b55-4965-4cb8-b29d-096560e7b3aa)


![image](https://github.com/user-attachments/assets/cb46d0d1-57d7-482c-b235-15d0e633f62c)
2024-11-23 14:32:55 +01:00
Hat Kid 2ff49b9905 jak3: fix ragdolls settling too early (#3775)
`none` methods strike again

Fixes #3774
2024-11-22 02:36:50 +01:00
water111 24ad5515f8 [jak3] workaround for intro crash on screen filter (#3770)
Simple workaround to put an effect in a different bucket. I don't think
there's a difference in the result, but this is just easier to handle on
the PC renderer side.

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-11-17 12:09:22 -05:00
Hat Kid 7543acfb8a jak3: speedrunner mode (#3761)
Base implementation of the popup menu and speedrunner mode in Jak 3.
Autosplitter is untested because I'm on Linux.

Also a couple of other misc changes:

- Model replacements can now have custom bone weights. Needs the "Use
Custom Bone Weights" property (provided by the OpenGOAL Blender plugin)
enabled in Blender.
- Better error message for lump syntax errors in custom level JSON
files.
2024-11-17 06:45:34 +01:00
water111 5e3cb8faa6 [jak3] Fix stack layout for car spawn (#3765)
Fix for cars spawning under ground or in weird places

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-11-16 17:52:14 -05:00
Matt Dallmeyer 2a41bc615e [jak2] Fix bug where spinning into grind doesnt break clasps in dig1 (#3740)
if you sideflip into grind in the digsite mission, the clasps wont break
because it is considered a `board-spin` attack instead of `board`. This
extends the condition to allow for `board-spin` as well.

~~Should I wrap this in an `#if PC_PORT`?~~ done
2024-11-12 20:59:21 +01:00
Hat Kid af5cb9b1cb jak3: subtitle3, vag-player (#3758) 2024-11-12 02:45:16 +01:00
water111 1e530714b7 [jak3] Fix for precd extraction (#3744)
It looks like one of the tie models in this level has bad color data in
the lowest LOD. For now, just skip extracting the lowest lod for this
TIE only.

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-11-03 11:43:27 -05:00
Hat Kid cbb8add81c jak2: fix consite crash (#3743)
Since #3735, loading consite in Jak 2 crashes due to an assert in the
code that handles the PC clut blender DMA. The unused and
half-implemented `kor-transform` texture animation doesn't have any
blenders as the texture names are commented out in the C++ definition
(and it seems that these textures are defined multiple times within
different tpages in the same DGO, leading to errors during startup if
uncommented), leading to a mismatch between the actual qwc in GOAL and
the assumed DMA data size in C++.
2024-11-03 10:45:31 +00:00
Hat Kid 10d7dabfd7 game: move pc-encode-utf8-string to common kmachine code (#3742)
Also adds formatter rules for a couple of macros.
2024-11-03 01:28:48 +01:00
Alex ba9085fee0 [jak2] Correct behavior of hint subtitles toggle (#3741)
Re-uses the existing "hinttitles" toggle that's already there, and makes
it not depend on if the main subtitles are on or not.
2024-11-02 18:28:20 +00:00
water111 1962fbfb51 [jak2,3] Support loading clut blender animated textures to the pool (#3735)
Animated textures that use the clut blender can now upload them to the
texture pool, so they can get read by the eye renderer. This will also
fix darkjak's eyelids in jak 2.


![image](https://github.com/user-attachments/assets/5edbd20d-53c9-42c6-937d-6263823b8b45)

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-10-27 09:21:44 -04:00
Tyler Wilding e144406c16 g/j2: make the turret controls respect the camera settings (#3715)
Fixes #3664
2024-10-19 15:16:40 -04:00