Commit graph

131 commits

Author SHA1 Message Date
Tyler Wilding 8b7e0bde53
game: ensure the default game-size is also valid when initializing the pc-settings.gc file (#3624)
Some checks failed
Build / 🖥️ Windows (push) Has been cancelled
Build / 🐧 Linux (push) Has been cancelled
Build / 🍎 MacOS (push) Has been cancelled
Inform Pages Repo / Generate Documentation (push) Has been cancelled
Lint / 📝 Formatting (push) Has been cancelled
Lint / 📝 Required Checks (push) Has been cancelled
Lint / 📝 Optional Checks (push) Has been cancelled
Also saves out the default `pc-settings.gc` file so it's less confusing
_and_ so we can request it from users to actually see what it's doing.

The fix in the last release was only to fix bad `game-size` values when
_loading_ the file. But if you don't have a file, it picks a default.

Right now it picks that default by:
1. Your largest reported resolution
2. If that fails, the one that is currently set

In reality this scenario can never really happen (if you have a set
resolution, it will be one of the reported ones). However what can
happen is for SDL to be misinformed by bad display/monitor drivers/the
OS and be given "supported" resolutions that aren't actually supported.
For example some users have a 4K resolution as their highest, despite
them using a 1080p monitor.

The solution is to not blindly assume the largest resolution is valid,
instead use the one the user already has set.

I'm also now filtering out resolutions by refresh rate, as perhaps this
also caused a problem. ie. the monitor supports a resolution if the
refresh rate is lowered, but it's currently set high (at 144hz for
example).
2024-08-03 14:57:07 -04:00
Tyler Wilding d819d6da05
game: cleanup some display settings related code, forbid invalid game-size resolutions (#3601)
Some checks failed
Lint / 📝 Optional Checks (push) Has been cancelled
Build / 🖥️ Windows (push) Has been cancelled
Build / 🐧 Linux (push) Has been cancelled
Build / 🍎 MacOS (push) Has been cancelled
Inform Pages Repo / Generate Documentation (push) Has been cancelled
Lint / 📝 Formatting (push) Has been cancelled
Lint / 📝 Required Checks (push) Has been cancelled
Fixes https://github.com/open-goal/jak-project/issues/3563

These users have the following spamming in logs:
> OpenGL error 0x502 S8246 T824C: GL_INVALID_OPERATION error generated.
Source and destination dimensions must be identical with the current
filtering modes.

And the solution is to correctly set their game-size. The way this
change accomplishes that is by confirming whether or not the set
`game-size` is a valid resolution informed by SDL, if not, it defaults
to the monitor's currently set display mode's resolution.

This also moves the selected display id, and the display mode into the
C++ settings -- closer to where it's actually managed and used. I'm
tempted to do this eventually for the resolutions as well but that stuff
is much more burdensome. This hopefully simplifies debugging, reduces
startup flickering, and removes back-and-forth complexity. Hopefully
this makes debugging display related problems easier. It also adds a
bunch more logging to the related code.
2024-07-27 22:29:14 -04:00
water111 e81431bd21
[wip] Jak 3 Overlord (#3567)
Some checks are pending
Build / 🖥️ Windows (push) Waiting to run
Build / 🐧 Linux (push) Waiting to run
Build / 🍎 MacOS (push) Waiting to run
Inform Pages Repo / Generate Documentation (push) Waiting to run
Lint / 📝 Required Checks (push) Waiting to run
Lint / 📝 Optional Checks (push) Waiting to run
Lint / 📝 Formatting (push) Waiting to run
2024-07-26 09:42:28 -04:00
water111 807ca7465f
fix c++ compiler warnings, extract_merc assert (#3488)
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2024-05-03 17:29:18 +01:00
Tyler Wilding a021c392ec
game: allow overriding the config directory location (#3477)
This is primarily driven for proper mod-support. Mods would like to
isolate their settings and saves (potentially) and that is currently
done by find-and-replacing code before building. Bad!

Additionally, this has the side-effect of allowing for portable
installations of the game so, win-win.

Testing in progress, i'll merge once it is ready.
2024-04-28 15:29:20 -04:00
Tyler Wilding fee0a435fc
extractor: support extracting using a folder path (#3422)
Patching up the extractor while working on the launcher, fixes:
- makes it so you can compile successfully given a folder path
(currently assumes your project path contains `iso_data`)
- ignore `buildinfo.json` from validation code.
- fixes an edge-case that could recursively fill up your entire
hard-drive!
- allows overriding the decompilation configuration via flag
- adds a way to specify where the ISO should be extracted to
2024-04-28 15:02:29 -04:00
Hat Kid 93afb02cf4
decomp3: spawn target, add merc and particle buckets and some temporary hacks (#3445)
This includes all the collision stuff needed to spawn `target`,
decompiles the sparticle code and adds some of the PC hacks needed for
merc to run (it doesn't work quite right and looks bad, likely due to a
combination of code copied from Jak 2 and the time of day hacks).

There are a bunch of temporary hacks (see commits) in place to prevent
the game from crashing quite as much, but it is still extremely prone to
doing so due to lots of missing functions/potentially bad decomp.

---------

Co-authored-by: water <awaterford111445@gmail.com>
2024-04-05 00:07:39 -04:00
Tyler Wilding 0626862a8c
Fix issues with camera movement with controller when mouse tracking is also enabled (#3409)
Fixes #3408
2024-03-07 23:35:38 -05:00
Tyler Wilding 60db0e5ef9
deps: update fmt to latest version (#3403)
This updates `fmt` to the latest version and moves to just being a copy
of their repo to make updating easier (no editing their cmake / figuring
out which files to minimally include).

The motivation for this is now that we switched to C++ 20, there were a
ton of deprecated function usages that is going away in future compiler
versions. This gets rid of all those warnings.
2024-03-05 22:11:52 -05:00
Tyler Wilding d1a6c60eb8
game: disable keyboard input by default, give users a way to enable it via the imgui menu (#3295)
It was narrowed down recently that a lot of people have issues with the
controller input because of Steam Input working as intended. Steam Input
can be configured to replicate controller inputs as keyboard inputs (for
example, pressing X on your controller presses Enter on the keyboard).

This results in the problem of "jumping pauses the game" and similar
issues. This is a consequence of the intended behaviour of the game
listening to all input sources at the same time.

Since the vast majority of players are using controllers over keyboards,
it makes sense to disable the keyboard input by default to solve this
problem. However that makes things awkward for users that want to use
the keyboard (how do they enable the setting). The solution is a new
imgui option in the settings menu:
![Screenshot 2024-01-07
141224](https://github.com/open-goal/jak-project/assets/13153231/6f9ffa2d-be7a-433d-b698-15b70210e97e)

**Known issue that I don't care about** -- in Jak 1's menu code, since
the flags are controlled by pointers to values instead of a lambda like
in jak 2, the menu won't update live with the imgui option. This has no
functional impact and I don't care enough to fix it.

I also made the pc-settings.gc file persist on first load if the file
wasn't found. Hopefully this helps diagnose the support issues related
to the black screen.

# Why not just ignore the keyboard inputs for a period of time?

This won't work, the keyboard is polled every frame. Therefore if you
hold down the X button on your controller, steam is continuously
signaling that `Enter` is held down on the keyboard.

Yes it would be possible to completely disable the keyboard while the
controller is being used, but this defeats the purpose of creating an
input system that allows multiple input sources at the same time.

With an explicit option, not only can the user decide the behaviour they
want (do they want the keyboard ignored or simultaneously listened to)
but we avoid breaking strange edge-cases in usage leading to never
ending complexity:
- ie. imagine steam input sends events to the mouse, well you can't
disable the mouse while using the keyboard because most times people are
using mouse and keyboard
- ie. a user that wants to hold a direction with the keyboard and press
buttons on the controller in tandem (something i frequently do while
TAS'ing, to move in a perfect straight line)
2024-02-23 18:19:07 -05:00
Tyler Wilding 7ae1b4bf1c
g/j2: properly wireup mouse settings, properly detect when the mouse has stopped moving (#3383)
- Wired up the menu settings to change the settings in game, not just on
boot
- Removed all the duplication in the game options menu code
- Fixed the mouse code so that it properly brings the virtual analog
stick back to neutral when the mouse stops
- Extended the sensitivity min/max for those that want to ensure the
slightest movement maxes out virtual analog stick.
2024-02-23 14:44:40 -05:00
Tyler Wilding 1cc20508e9
tracing: add some more startup related events and a new --profile-until-event flag (#3385)
While trying to narrow down why sometimes SDL takes 20-40seconds to
initialize I built up some more profiling features.

TLDR - I still don't know why SDL is taking a long time but I've
narrowed it down to it initializing the `GAME_CONTROLLER` subsystem.
This isn't unprecedented, I found numerous github issues and articles
suggesting this is the problem:

![image](https://github.com/open-goal/jak-project/assets/13153231/1853326b-7a40-458e-87a0-f7a9f44781e3)

I imagine it is hardware/OS related on some level, there are even some
recent commits in SDL that have made it worse on certain platforms. I've
had this problem myself so I will hope to get it again soon so i can
debug where in the SDL code the delay occurs and make a proper bug
report. Hopefully this helps but it's not yet confirmed -
https://github.com/open-goal/jak-project/pull/3384
2024-02-23 14:44:17 -05:00
water111 4f537d4a71
[jak3] Set up ckernel (#3308)
This sets up the C Kernel for Jak 3, and makes it possible to build and
load code built with `goalc --jak3`.

There's not too much interesting here, other than they switched to a
system where symbol IDs (unique numbers less than 2^14) are generated at
compile time, and those get included in the object file itself.

This is kind of annoying, since it means all tools that produce a GOAL
object file need to work together to assign unique symbol IDs. And since
the symbol IDs can't conflict, and are only a number between 0 and 2^14,
you can't just hash and hope for no collisions.

We work around this by ignoring the IDs and re-assigning our own. I
think this is very similar to what the C Kernel did on early builds of
Jak 3 which supported loading old format level files, which didn't have
the IDs included.

As far as I can tell, this shouldn't cause any problems. It defeats all
of their fancy tricks to save memory by not storing the symbol string,
but we don't care.
2024-01-16 19:24:02 -05:00
Tyler Wilding a80cff9a4c
game: Fix issues related to remapping with SDL axii's (ie. triggers) (#3294)
This was just not implemented end to end. There are still two notable
issues, one that I can live with, one I need to narrow down eventually:
1. Rebinding confirm buttons with trigger (ie. X) behaviour is not 100%
as it should be. I fixed it enough that I can live with it but it's
still not proper. The difficulty is that unlike a button it will
re-trigger the pressed state on the journey back to neutral (aka
unpressed).
2. If you change the bind for the confirm button, then reset your
bindings, the next confirm input is eaten. This is unrelated to these
changes but I briefly looked into it and was unable to find the root
cause.
2024-01-09 16:50:58 -05:00
ManDude 974f5931de
[jak2] add resolutions menu (#3238) 2023-12-03 08:11:18 +00:00
SuperSamus 37069e2f8e
[jak2] Fix "Select controller" (#3191)
Co-authored-by: Martino Fontana <tinozzo123@gmail.com>
2023-12-02 15:20:26 -05:00
Tyler Wilding 8b3b96761d
g/j2: Integrate highscores with Speedrun.com/JakSpeedruns.com when speedrunner mode is enabled (#3037) 2023-10-11 20:43:55 -04:00
Tyler Wilding 8ce31e5a4c
input: fix double press issue when assigning a bind (#2895) 2023-08-09 22:50:02 -04:00
water111 6f244b11ef
[jak2] Work-in-progress texture animations (#2819) 2023-07-14 18:17:54 -04:00
Tyler Wilding c87db7e670
i18n: subtitle code cleanup and update new subtitle JSON files to be compatible with Crowdin (#2802)
The main thing that was done here was to slightly modify the new
subtitle-v2 JSON schema to be more similar to the existing one so that
it can properly be used in Crowdin.

Draft while I double-check the diff myself

Along the way the following was also done (among other things):
- got rid of as much duplication as was feasible in the serialization
and editor code
- separated the text serialization code from the subtitle code for
better organization
- simplified "base language" in the editor. The new subtitle format has
built-in support for defining a base language so the editor doesn't have
to be used as a crutch. Also, cutscenes only defined in the base come
first in the list now as that is generally the order you'd work from
(what you havn't done first)
- got rid of the GOAL subtitle format code completely
- switched jak 2 text translations to the JSON format as well
- found a few mistakes in the jak 1 subtitle metadata files
- added a couple minor features to the editor
- consolidate and removed complexity, ie. recently all jak 1 hints were
forced to the `named` type, so I got rid of the two types as there isn't
a need anymore.
- removed subtitle editor groups for jak 1, the only reason they existed
was so when the GOAL file was manually written out they were somewhat
organized, the editor has a decent filter control, there's no need for
them.
- removed the GOAL -> JSON python script helper, it's been a month or so
and no one has come forward with existing translations that they need
help with migrating. If they do need it, the script will be in the git
history.

I did some reasonably through testing in Jak1/Jak 2 and everything
seemed to work. But more testing is always a good idea.

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2023-07-09 02:53:39 +01:00
ManDude 4185123bd8
fix mouse mispositioning when letterboxed (#2818)
Not sure if this is the best way to go about it.

Fixes #2259
2023-07-08 23:05:03 +01:00
Tyler Wilding 6faa7530f9
input: Hopefully make keyboard/mouse handling more consistent (#2807)
The current event-based approach is very difficult to get right, and it
depends on no events ever being missed. This changes the keyboard/mouse
handling code to a polling-based approach.

Other fixes:
- an issue where modifier keys were not able to be successfully bound
(like Left Shift to `X`)
- improves cursor hiding (except when you use the start menu, this seems
like an SDL issue, see comment)
- Better discarding of kb/mouse inputs when imgui intercepts input
- properly swap bindings when an already set key is assigned, even if it
crosses the distinction of an analog vs normal button

Fixes #2800
2023-07-08 10:45:56 -04:00
Tyler Wilding 436bac83ec
game: Improve OpenGL version detection and make requirement errors more obvious to the user (#2787) 2023-06-30 21:05:58 -04:00
Tyler Wilding 10934f6746
d/j2: Some work on the SQL editors (#2771) 2023-06-25 16:51:46 -04:00
water111 2fc943977f
[jak2] GOAL side texture animation stuff (#2766)
It turns out we didn't decompile any of this stuff yet.
2023-06-24 10:11:47 -04:00
Tyler Wilding 679986e79f
sdl: safer code to resolve intermittent controller crashes related to disconnections (#2755) 2023-06-23 15:35:32 -04:00
Tyler Wilding 95904903a6
sdl: only call SDL video functions from the gfx thread (#2748)
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2023-06-19 16:32:39 -04:00
BreakPoints 1512c6bd9c
sdl: Directly use Windows DPI scaling hint, not SDL (#2730)
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2023-06-17 12:40:25 -04:00
BreakPoints 756fcc3e4d
SDL: Hint to Windows that we handle DPI scaling (#2729) 2023-06-13 21:45:57 -04:00
water111 ad5cec1bb4
[jak2] Floating point blerc (#2715)
This moves the blerc math from mips2c to the Merc2 renderer, and uses
floats instead.

We could potentially do this on the GPU, which would be even faster, but
this isn't that slow in the first place.
2023-06-11 12:35:08 -04:00
water111 3bb6bd0e3a
[jak2] fix missing drill crane center part (#2692)
We were forcing the drill crane to draw at lod 0, but we should have
listened to the game and drawn it at lod 1.
2023-06-05 18:56:26 -04:00
Tyler Wilding e9f9869849
input: fix some mistakes in the default keyboard binds (#2697) 2023-06-05 18:26:29 -04:00
Tyler Wilding bdaf088d4b
game: Migrate from GLFW to SDL2 & attempt to rewrite / simplify display and input code (#2397)
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2023-06-04 15:34:37 -04:00
Tyler Wilding 5e987cc0e2
jak2: overlord rework (#2544)
Fixes #2545
Fixes #2546
Fixes #2547
Fixes #2548
Fixes #2549
Fixes #2550
Fixes #2551
Fixes #2552
Fixes #2553
Fixes #2554
Fixes #2555
Fixes #2556
Fixes #2557
Fixes #2558
Fixes #2559
Fixes #2560
Fixes #2561
Fixes #2562
Fixes #2563
Fixes #2564
Fixes #2565
Fixes #2567
Fixes #2566
Fixes #2568
Fixes #2569
Fixes #2570
Fixes #2522
Fixes #2571

---------

Co-authored-by: water <awaterford111445@gmail.com>
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2023-04-29 16:13:57 -04:00
Tyler Wilding a264b6539b
game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00
Tyler Wilding 216e73b61f
CI: Add a macOS Github runner (#2064) 2022-12-22 18:12:59 -05:00
water111 73561f10a3
support c++ tools on macos (#2063)
Running reference tests/decompiler should now be possible on macos
(arm). Most of the changes were just cleaning up places where we were
sloppy with ifdefs, but there were two interesting ones:
- `Printer.cpp` was updated to not use a recursive function for printing
lists, to avoid stack overflow
- I replaced xxhash with another version of the same library that
supports arm (the one that comes in zstd). The interface is C instead of
C++ but it's not bad to use. I confirmed that the extractor succeeds on
jak 1 iso so it looks like this gives us the same results as the old
library.
2022-12-22 17:12:05 -05:00
Tyler Wilding 9c631e11fe
offline-test: Partition by DGO and colorize/condense output (#2045)
This solves two main problems:
- the looming threat of running out of memory since every thread would
consume duplicate (and probably not needed) resources
- though I will point out, jak 2's offline tests seem to hardly use any
memory even with 400+ files, duplicated across many threads. Where as
jak 1 does indeed use tons more memory. So I think there is something
going on besides just the source files
- condense the output so it's much easier to see what is happening / how
close the test is to completing.
- one annoying thing about the multiple thread change was errors were
typically buried far in the middle of the output, this fixes that
- refactors the offline test code in general to be a lot more modular

The pretty printing is not enabled by default, run with `-p` or
`--pretty-print` if you want to use it


https://user-images.githubusercontent.com/13153231/205513212-a65c20d4-ce36-44f6-826a-cd475505dbf9.mp4
2022-12-22 13:41:33 -05:00
Tyler Wilding 4d751af38e
logs: replace every fmt::print with a lg call instead (#1368)
Favors the `lg` namespace over `fmt` directly, as this will output the
logs to a file / has log levels.

I also made assertion errors go to a file, this unfortunately means
importing `lg` and hence `fmt` which was attempted to be avoided before.
But I'm not sure how else to do this aspect without re-inventing the
file logging.

We have a lot of commented out prints as well that we should probably
cleanup at some point / switch them to trace level and default to `info`
level.

I noticed the pattern of disabling debug logs behind some boolean,
something to consider cleaning up in the future -- if our logs were more
structured (knowing where they are coming from) then a lot this
boilerplate could be eliminated.

Closes #1358
2022-10-01 11:58:36 -04:00
animalstyletaco f86cc1a31f
Ast/kbm remapper update (#1800)
* Reverted default keyboard camera controls to IJKL and fixed bug where use mouse would always be set as false

* Fixed inverse axis on Right Y axis analog keyboard control

* Fixed newpad unit test, fixed variable typo, and fixed MapAnalog typo in newpad.h

Co-authored-by: animalstyletaco <animalstyletaco95@gmail.com>
2022-08-26 11:59:11 -04:00
water111 b388aa7b71
add option to disable mouse hiding (#1782)
* add option to disable mouse hiding

* write setting
2022-08-21 19:00:13 -04:00
animalstyletaco 375e9c7713
Added first working instance of controller/keyboard re-mapper (#1702)
* Added First working instance of controller/keyboard re-mapper

* Fixed clang formatting issues

* Updated newpad.cpp to inverse analog y-axis to make json labelling consistent

* Added mouse sensitivity options for X and Y axis in json, removed scroll mouse support, and other changes requested in feedback

* Added option to have ImGui debug menu appear on start up and remove hard coded set_imgui_visible calls

* Added newpad unit tests and updated function names to better describe intended functionalities

* Fixed formatting issue in newpad unit test

* Removed rumble unit test new pad

* Fixed codacy static analysis issues

* Fixed Linux build issues

* Implemented github feedback

* Implemented updated github feedback

* Fixed formatting errors

* Updated Pad::CheckPadIdx

* Implemented changes based on latest github feedback

* Implemented changes based on github feedback

Co-authored-by: animalstyletaco <animalstyletaco95@gmail.com>
2022-08-19 11:28:06 -04:00
Matt Dallmeyer bbfdd45de0
Support 4 controllers (#1751)
* Detects all controllers properly on boot now

* warn -> info

* linting

* add comments to deftype changes
2022-08-14 17:21:38 -04:00
Ziemas 2acc5250f8
Run IOP Vblank handler on the IOP thread (#1752) 2022-08-14 17:21:02 -04:00
Ziemas 2313d35800
Implement IOP semaphores. (#1747)
* IOP: Rename exitThread, too close to ExitThread.

* IOP: Implement Semaphores
2022-08-14 13:51:00 -04:00
ManDude 5148523917
more small cleanupses (#1722)
* reduce max supersampling options in progress menu

* cleanup knuth rng file

* save & load cheats

* allow keyboard controls when cpad is connected

* ignore key presses when imgui is being used

* save settings when quitting game
2022-08-03 21:51:13 -04:00
Ziemas f8bc883d48
Implement scheduling of IOP threads. (#1689)
* Use sleepthread in RPC loop

* Keep a pointer to current IOP thread

* Implement IOP thread scheduling based on priority

And implement DelayThread as an actual delay.

* Run IOP flat out

* Use information from scheduler in wait_run_iop

* Lock sif mutex in set_rpc_queue

* always use kernel dispatch with wait_run

* Loop in dispatch until no thread is ready

* Use timestamp for next wakeup

instead of duration

* Wrap IOP thread entrypoints for safety

Libco threads are not supposed to return from their entrypoint

* Use a queue for IOP thread wakeups from EE thread
2022-07-26 21:15:37 -04:00
Ziemas 47f7335541
Set thread names of system threads (#1697)
Set thread names
2022-07-23 10:27:42 -04:00
Ziemas 1012020035
Use libco for cooperative threading in overlord (#1684)
* IopThreadRecord -> IopThread

* add libco

* Use cooperative threading for IOP threads

* Ugly solution for overlord start

Needs to run in a thread

* Clean out thread shutdown logic

* Update comments
2022-07-22 11:54:27 -04:00
water111 28a2ecdfd3
[jak2] goalc supports multiple projects (#1619)
* [jak2] goalc supports multiple projects

* disable deci2 server if not debugging
2022-07-06 21:18:08 -04:00