Skip to content

Commit

Permalink
Sept vanilla (#24)
Browse files Browse the repository at this point in the history
* improve `send-event` for jak 2  (#2828)

Fixes #2825

* [jak2] Work-in-progress texture animations (#2819)

* [jak2] speed up the sky texture animation (#2829)

This saved about 1.6 ms per frame in the city for me (~1.3 saved from
not doing sky twice, 0.3 saved in format lookup tables).

The big texture animator is about 1.0 ms.

![image](https://github.com/open-goal/jak-project/assets/48171810/c7bc7743-308c-4425-ad14-118e2d483fad)

* Added bound check for blend vertex count (#2830)

Co-authored-by: animalstyletaco <animalstyletaco95@gmail.com>

* Get the project compiling on Apple Silicon macOS natively (arm64) (#2827)

I havn't tested it yet, but I can almost guarantee that atleast `goalc`
will not work in the slightest!

But the project is atleast fully compiling. My hope is to start
translating some AVX to NEON next / get `goalc` working...eventually.

* [jak2] More texture animations (#2831)

Added framework to do texture animations entirely in C++. Currently only
works on relatively simple ones, and doesn't handle updating all
parameters - only the speeds.

Connected texture animations to merc and tfrag for skull gems, dark
bomb, and scrolling conveyors.

Cleaned up Tfragment/Tfrag3, which used to be two classes. This was one
of the first C++ renderers, so it had a weird design.

* CI: Periodic Controller Database Update (#2832)

Co-authored-by: OpenGOALBot <OpenGOALBot@users.noreply.github.com>

* [jak2] Fix overlord related crash (#2834)

This fixes the crash reported in
open-goal/jak-project#2833

There was a memory bug here for a long time where our array of `VagCmd`
in `iso_queue.cpp` was too small. This caused GetVagCommand to return
bogus pointers, and sound code would write over other parts of memory.

* [jak2] More progress on texture animations (#2835)

- Add security wall animation
- Add waterfall animations
- Add lava animations
- Update layer values from the game to fix the security wall
- Remove leftover debug in `level.gc` that would break level-specific
animations on the second time you visited the level
- Optionally load animated slot textures to the pool so generic can use
them (fixes skull gems in UI)

* [jak2] Add static textures for the progress menu (#2838)

The progress menu loads its icon textures from a .STR file that we were
previously ignoring.

This change:
- updates the decompiler so it can process a .STR file containing a
texture
- adds a feature to force an entire page to always be loaded in the PC
renderer by putting all textures in the GAME.FR3 file.
- regenerates the texture offset map file for jak 2 with these new
textures

For now, I've just put the icon textures in GAME.FR3. The downside is
that these will always stay on the GPU, using up VRAM even when they
aren't needed. But the entire GAME.FR3 file is under 3 MB so I think
it's ok.


![image](https://github.com/open-goal/jak-project/assets/48171810/39f075b5-7cc5-4168-872a-33026342afab)

* game: add a clear text label for how to hide the top bar (#2845)

* [jak2] Fix dark jak anim and low res skull gems (#2842)

Fixes skull gems using a low resolution texture.

Fixes issue where jak in cutscenes is dark after watching oracle-level-1
(and likely other bugs with texture animations getting stuck)

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>

* [jak2] make progress menu work for widescreen + various other fixes (#2843)

Lots of manual fixes to make the text and other UI elements in the
progress fit within the small 4x3 view.


![image](https://cdn.discordapp.com/attachments/995787558816595968/1132986451664056423/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133064077460131840/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133074288564510780/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133117633898762280/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133117633470922842/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133135949610627225/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133146823968706621/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133153504417042593/image.png)

I've also changed the select start menus to not have that giant space in
each option. It's behind a toggle in the code right now.

![image](https://cdn.discordapp.com/attachments/995787558816595968/1133146382006489138/image.png)

Additionally:
- fixed city billboard particles
- fix stadium crash from original game
- fix an accidental regression

* Fix small buzz motor not vibrating correctly (#2846)

* fix stad-samos regression from refactor (#2796) + change imgui toggle to left-alt and make it customizable (#2848)

* [jak2] More texture animations, and fixes (#2847)

* Fix possible crash when loading files (#2850)

There was a single static path buffer being shared between multiple file
i/o threads. So sometimes you would end up using the wrong path for the
file, and getting size/data for the wrong file.

I think the original reason to have this buffer was just me being lazy
when we changed how project paths works a long time ago. It was a bad
idea in the first place.

* [jak1] Fix ice walking animation bug and crash (#2851)

This should fix a crash and animation bug in snowy. The way to trigger
the bug:
- go on ice
- move forward slowly
- stop moving forward. Reach zero speed when the frame number isn't
between 30 and 35 of the ice walking animation
- Due to this bug, the animation gets stuck at frame 60
- Take damage (due to normal lurker or ice lurker)
- Sidekick eye animation crashes because a frame number is NaN.

* [jak2] graphic options menu proof of concept (#2849)

![imagem](https://github.com/open-goal/jak-project/assets/7569514/b8eaa0b6-7c51-4bd8-96ac-5fb2e0d08c4a)

![imagem](https://github.com/open-goal/jak-project/assets/7569514/d2742cef-98d4-43e4-a48d-cc1996e41612)

(The "Custom" option does not do anything right now.)

* `force-actors?` -> `ps2-actor-vis?` (#2852)

supersedes #2839

* [jak2] workaround for missing yakow textures (#2854)

The yakow texture is actually missing from the real game too. 

This adds a special case in the extractor to replace it with a
similar-ish fur texture:

![image](https://github.com/open-goal/jak-project/assets/48171810/db429e70-e5c5-4302-824a-238e94cf3d69)

* [jak2] fix transparent shrub blending (#2853)

![image](https://github.com/open-goal/jak-project/assets/48171810/ae4d40bf-b061-45af-ba20-c546fc935f11)

Should probably wait until the release just in case. But I'm 99% sure
this line was just a mistake in the original implementation.

* [jak2] Fix ocean culling when using camera-other (#2858)

When drawing the spinning palace, there's a terrible hack that lets some
stuff be drawn with different camera matrices.

The ocean is drawn with camera-other (which spins), but was being culled
with camera (doesn't spin). This changes ocean to use the right camera
matrix.

Note that the ocean is special when it comes to camera-other - it always
uses camera-other if there is one. Other uses are set per-level and
should already be handled correctly.

* [jak2] fix compile error (#2862)

not sure how this passed tests....

* [jak2] use current buffer for blit-displays (#2855)

This changes how `BlitDisplays.cpp` works so it looks at the current
render buffer, rather than the back buffer.

This approach is a bit faster because we avoid copying the back buffer
on every single frame.
It also removes the black frames when the transition starts/stops.

The remaining issues are:
- there's still a single frame of weirdness with the sprite glow
renderer.
- when changing resolutions, it doesn't work super well.

* [jak2] disable envmap when it should be (#2864)

In jak 2, there's an option to disable envmap. It's used on krew
holograms, hiphog trophies, and baron bosses in palace/tomb.

* [gfx] Clean up background renderer matrices, fix "hole covers" (#2866)

The way we got/stored background matrices is a bit weird and full of
leftovers from the first attempts at porting renderers. This doesn't
work well with the Jak 2 "other camera" system where some stuff is
rendered with a different camera matrix.

This cleans most of it up. The exception is that the collide mesh
renderer and the additional sprite culling I added still need to peek at
some cached camera matrices.

This fixes the problem where etie uses the wrong matrices for "other
camera" levels. Now the "hole covers" go in the holes in the background
of the throne room.

![image](https://github.com/open-goal/jak-project/assets/48171810/73a88f7b-05d4-4e9c-bb34-5b45efffcb69)

* ci: strip binaries in their respective runners (#2868)

* New Crowdin updates (#2869)

* fix texture anim shader on macOS (#2870)

* fix collision renderer filters not working (#2872)

fixes #2867

* [goalc] Sign extend objects when loading them (#2863)

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>

* Anim Tester X - Quality of Life improvements (#2682)

Co-authored-by: Tyler Wilding <xTVaser@users.noreply.github.com>
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>

* Basic hash table and jump table (#1837)

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>

* github: update issue templates, move general feature requests to discussions preferably (#2879)

* jak1: start a new game correctly when speedrunner mode is enabled (#2873)

* formatter: support formatting bindings, for example in a `let` (#2883)

* [jak2] get new cheats working (#2885)

* [jak2] progress: make custom aspect ratio menu (#2888)

New menu for setting a custom aspect ratio.


![image](https://github.com/open-goal/jak-project/assets/7569514/33f81bc4-0219-4aba-b4ed-81394e4e4ceb)

![image](https://github.com/open-goal/jak-project/assets/7569514/9ddc3059-3ddf-4b35-afa5-11b9005e087c)

![image](https://github.com/open-goal/jak-project/assets/7569514/f3a16342-b38d-4082-ac18-1f82db349191)

![image](https://github.com/open-goal/jak-project/assets/7569514/69963cfe-2963-44f8-bde9-c0205c467d6c)

* CI: Periodic Controller Database Update (#2889)

Updating Controller Database

Co-authored-by: OpenGOALBot <OpenGOALBot@users.noreply.github.com>

* [jak2] prepare `scf-get-territory` usage (#2890)

* log: rotate log files with timestamps and add flag to disable ANSI colors (#2886)

Rotates the log files with a timestamp instead of copying all files and
incrementing an integer. Increases the amount of info you have when
looking at user's log files (ie. when looking at all the files, the file
creation dates are accurate).


![image](https://github.com/open-goal/jak-project/assets/13153231/61bcdf51-f0f6-4eee-b1e5-140aede5d19e)

Also simplifies the API for setting the log file, and `gk` logs are now
game specific with `jak1` or `jak2`. Which should be useful going
forward.

Lastly, added a flag to all CLIs to disable ansi colors for people that
want to do so. Though at the same time, there is finally a workaround in
jenkins to fix ANSI colors in the truncated log view -- so I'm not sure
why anyone would want to get rid of the color information. You can even
setup text editors to display the color info making log parsing much
easier. Fixes #1917

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>

* custom levels: fix crash when more than one ambient is present (#2891)

* log: don't recursively iterate when rotating log files (#2892)

* cleanup our cmake and build warnings (#2876)

* cmake: fix regression for building SDL statically (#2894)

* input: fix double press issue when assigning a bind (#2895)

* Update test-zone.jsonc to use lowercase for nickname (#2896)

* [jak1] Fix texture-related custom level crash (#2898)

Force FR3 file name for custom levels to be uppercase, fixes the crash
described in
open-goal/jak-project#2534
and 
open-goal/jak-project#2897

* [shrub] Fix bug with gs-prim settings (#2899)

Fix the bug described in
open-goal/jak-project#2882 where some shrubs
are transparent when they shouldn't be. The problem was that we never
carefully looked at the settings in `gs-prim`, which has a bit to
enable/disable alpha blending entirely. Now it should be correct for
both jak 1 and jak 2. To see this change, you'll need to re-extract.

Also adds a setting to disable saving texture .pngs, to speed up
decompilation. I left it on for jak 1 (to avoid confusion for texture
swapping(, but off for jak 2 for now.

* [glow] fix clipping bug (#2902)

Now you can be blinded by the sun:

![image](https://github.com/open-goal/jak-project/assets/48171810/caf3903c-8333-4daa-89ba-ff83ca7d6b2f)

* log: ensure the `log/` directory exists (#2904)

* 989snd: implement SetVolPan for midi sounds (#2905)

Fixes #2820

* [jak 2] bigmap, fix texture filtering on map icons (#2906)

![image](https://github.com/open-goal/jak-project/assets/48171810/4c285f31-c874-424a-8510-d181ba0f88d5)


![image](https://github.com/open-goal/jak-project/assets/48171810/6baa29ef-df92-435e-ad2f-9a42d56e6f17)

and the minimap has filtering now:

![image](https://github.com/open-goal/jak-project/assets/48171810/7cb2b0c9-5c86-426e-b028-dddcc3d649f7)

It's mostly implemented in C++ using the texture animator.

* [jak2] fix bad blerc on objects with warp (#2907)

fixes the weird mirror offset stuff

![image](https://github.com/open-goal/jak-project/assets/48171810/9a36c0bd-7350-46d7-b14f-d2f876582b03)

* [jak2] music player cheat menu (#2900)

* [jak2] small minor fixes (#2909)

- fix deci2 hang when closing the game in retail mode.
- change bigmap to always filter because the pixels look really ugly.
- don't start the game in fullscreen by default if we're debugging.

* [jak2] fix bug in direct in texture handler (#2910)

* handle texture of 0 in extract_tie (#2911)

Fixes texture difference shown in issue
open-goal/jak-project#2908

* [jak2] fix glow sprite flickering (#2912)

oops, forgot to set `glDepthMask`, so sometimes it was enabled, and the
drawing for the clear was writing into the depth buffer.
Fixes open-goal/jak-project#2735

* Fix alpha test > vs >= (minimap arrow fix) (#2913)

Fixes open-goal/jak-project#2814

Previously we didn't handle `GREATER` vs `GEQUAL` correctly. I just left
this as a TODO by accident.


![image](https://github.com/open-goal/jak-project/assets/48171810/bfa7bd98-e40e-4850-af9c-ed6954c00958)

* [jak2] Support Japanese Subtitles (#2914)

![image](https://github.com/open-goal/jak-project/assets/48171810/7b5edd00-4193-47ab-92f6-8f270edbcafe)

* [jak2] Support `draw-raw-image` (#2915)

![image](https://github.com/open-goal/jak-project/assets/48171810/9a94ea6e-99b8-4589-8210-86e63df31dd6)


![image](https://github.com/open-goal/jak-project/assets/48171810/e441225b-214c-46b9-ad01-0160590d30ba)

* [jak2] widescreen fix for splash/jp subtitles (#2916)

* [jak2] fix a few silly texture bugs (#2917)

Fix an issue where the commit sha would not use the right blending mode
if `draw-raw-image` is running at the same time.
Fix an issue where japanese subtitles would accidentally overwrite other
textures, leading to random textures missing. (in particular, glows
would disappear after watching a cutscene with the subtitles on)

* jak1: Consolidate art-elts into a single file as is done in jak 2 (#2887)

Fixes #2167

Reduces test flakiness if ran on multiple threads and gets rid of a few
hundred files from the source tree

I believe this also makes #1434 irrelevant and it can be closed.

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>

* [jak 2] Clouds V2, Clean up texture animator (#2921)

Some general improvements for the texture animator:
- Clouds are special cased, saving about 1 ms per frame
- Adjusting the amount of clouds now actually works.
- Fixed an issue with the brightness of clouds, and the way that they
fade out around the edges.

* [jak2] Toxic Slime texture animations (#2922)

https://github.com/open-goal/jak-project/assets/48171810/85e68808-09bf-4f74-a16a-6310e2b81cd3

* [jak2] Fix depth testing issues on glow sprites (#2923)

https://github.com/open-goal/jak-project/assets/48171810/0d3064f9-3f27-4be1-b6a4-55fdfb681313

Fixes open-goal/jak-project#2328

* [jak2] a few more subtitles + L1/R1 to move *much* faster through debug menu (#2925)

* [jak2] fill in a lot of flags for decomp + mouse macros (#2927)

Also changed the default type of enums to `int64` (same as `int`).

* [jak2] minimap improvements (#2929)

Smoothens minimap icon motion and fixes the target icon being squished
depending on the angle it's facing.

* g/j1: add support for missing polish alphabet characters (#2931)

* ckernel: fix file paths for art groups and tpages (#2932)

* custom levels: add support for packing models and textures into the FR3 file (#2936)

* [jak2] fix bugs with incorrect music playing sometimes (#2938)

- fixes flava and mode not being correct after a new music starts
playback by setting them every frame (there is at most 1 frame where
it's wrong).
- fixes city pursuit theme not playing if the city alarm was triggered
while the music wasn't playing yet.

* various subtitle editor fixes (#2941)

- fix speaker names and time frames being uneditable in Jak 1
- added toggle to auto-selected a newly created scene as current
- changed the subtitle summary format slightly.
- current scene's name now appears in the UI

* ci: macOS build with big sur to increase compatibility (#2944)

* New Crowdin updates (#2945)

* Placeholder strings for future Jak 2 features + minor subtitle editor fixes (#2943)

* [extractor] fix territory being set to wrong value (#2946)

Also fixes a minor issue where the JP sound bank wouldn't work (Jak 1).

Fixes #2793

* [sprite3] fix max sprite number being wrong (#2949)

I don't think this fixes anything, but the number was wrong so might as
well fix it.

* [jak2] fix bug in `outro-port` script (#2952)

* [jak2] higher resolution cloud textures (#2951)

Adds a new "hires" sky texture animation that makes the sky use 512x512
textures instead of 128x128. The clouds have higher detail, are slightly
more noisy, and are considerably less blocky. There is also a less
noticeable "dot crawl" effect.


![image](https://cdn.discordapp.com/attachments/995787558816595968/1146960820320878643/image.png)

![image](https://cdn.discordapp.com/attachments/995787558816595968/1146960819750449264/image.png)

* [sprite] Adjust allocation randomization (#2953)

This tries to match the original behavior of the sprite allocation
"randomness", which should reduce the number of very empty sprite blocks
sent to C++.

* fix input viewer merge, build binares

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
Co-authored-by: water111 <48171810+water111@users.noreply.github.com>
Co-authored-by: animalstyletaco <mcc-108@hotmail.com>
Co-authored-by: animalstyletaco <animalstyletaco95@gmail.com>
Co-authored-by: Tyler Wilding <xTVaser@users.noreply.github.com>
Co-authored-by: OpenGOAL Bot <99294829+OpenGOALBot@users.noreply.github.com>
Co-authored-by: OpenGOALBot <OpenGOALBot@users.noreply.github.com>
Co-authored-by: Luminar Light <18116946+LuminarLight@users.noreply.github.com>
Co-authored-by: Brent Hickey <brent.hickey@icloud.com>
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
Co-authored-by: Matt Dallmeyer <mattdallmeyer@gmail.com>
Co-authored-by: Ziemas <ziemas@ziemas.se>
  • Loading branch information
14 people authored Sep 3, 2023
1 parent 1e1f855 commit a3bdd18
Show file tree
Hide file tree
Showing 899 changed files with 14,640 additions and 9,785 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/macos-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
build:
name: Intel
runs-on: macos-12
runs-on: macos-11
timeout-minutes: 120

env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
Expand All @@ -37,7 +37,8 @@ jobs:
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v2.1.0
with:
cache_key: macos-12-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}
cache_key: macos-11-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }}

buildcache_tag: v0.28.1

- name: CMake Generation
Expand Down Expand Up @@ -73,4 +74,4 @@ jobs:
./build/goalc/goalc
./build/decompiler/extractor
./build/game/gk
./build/lsp/lsp
./build/lsp/lsp
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,3 @@ build_third_party_lib(zydis Zydis)
if(WIN32)
build_third_party_lib(mman mman)
endif()
string(REPLACE " ${THIRDPARTY_IGNORED_WARNINGS} " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

4 changes: 4 additions & 0 deletions common/goos/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ void Interpreter::set_global_variable_to_symbol(const std::string& name, const s
set_global_variable_by_name(name, sym);
}

void Interpreter::set_global_variable_to_int(const std::string& name, int value) {
set_global_variable_by_name(name, Object::make_integer(value));
}

/*!
* Get arguments being passed to a form. Don't evaluate them. There are two modes, "varargs" and
* "not varargs". With varargs enabled, any number of unnamed and named arguments can be given.
Expand Down
1 change: 1 addition & 0 deletions common/goos/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Interpreter {
bool get_global_variable_by_name(const std::string& name, Object* dest);
void set_global_variable_by_name(const std::string& name, const Object& value);
void set_global_variable_to_symbol(const std::string& name, const std::string& value);
void set_global_variable_to_int(const std::string& name, int value);
Object eval(Object obj, const std::shared_ptr<EnvironmentObject>& env);
Object intern(const std::string& name);
HeapObject* intern_ptr(const std::string& name);
Expand Down
4 changes: 3 additions & 1 deletion common/math/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class Vector {
}

template <typename... Args>
explicit Vector(Args... args) : m_data{T(args)...} {}
constexpr Vector(Args... args) : m_data{T(args)...} {
static_assert(sizeof...(args) == Size, "Incorrect number of args");
}

T* begin() { return &m_data[0]; }
T* end() { return &m_data[Size]; }
Expand Down
2 changes: 2 additions & 0 deletions common/texture/texture_slots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ std::vector<std::string> jak2_slots = {
"fort-roboscreen-dest",
"squid-env-rim-dest",
"krew-holo-dest",
"cas-toxic-slime-dest",
"cas-toxic-slime-scroll-dest",
};

}
Expand Down
4 changes: 2 additions & 2 deletions common/type_system/defenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ std::string symbol_string(const goos::Object& obj) {
EnumType* parse_defenum(const goos::Object& defenum,
TypeSystem* ts,
DefinitionMetadata* symbol_metadata) {
// default enum type will be int32.
TypeSpec base_type = ts->make_typespec("int32");
// default enum type will be int64
TypeSpec base_type = ts->make_typespec("int64");
bool is_bitfield = false;
std::unordered_map<std::string, s64> entries;

Expand Down
2 changes: 0 additions & 2 deletions common/util/FileUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ bool dgo_header_is_compressed(const std::vector<u8>& data);
std::vector<u8> decompress_dgo(const std::vector<u8>& data_in);
FILE* open_file(const fs::path& path, const std::string& mode);
std::vector<fs::path> find_files_in_dir(const fs::path& dir, const std::regex& pattern);
std::vector<fs::path> find_files_in_dir(const fs::path& dir, const std::regex& pattern);
std::vector<fs::path> find_files_recursively(const fs::path& base_dir, const std::regex& pattern);
std::vector<fs::path> find_directories_in_dir(const fs::path& base_dir);
std::vector<fs::path> sort_filepaths(const std::vector<fs::path>& paths, const bool aescending);
std::vector<fs::path> sort_filepaths(const std::vector<fs::path>& paths, const bool aescending);
/// Will overwrite the destination if it exists
void copy_file(const fs::path& src, const fs::path& dst);
std::string make_screenshot_filepath(const GameVersion game_version, const std::string& name = "");
Expand Down
8 changes: 8 additions & 0 deletions common/util/FontUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ static std::vector<ReplaceInfo> s_replace_info_jak1 = {
{"A~Y~-21H~-5Vº~Z", "Å"},
{"N~Y~-6Hº~Z~+10H", ""},
{"O~Y~-16H~-1V/~Z", "Ø"},
{"A~Y~-6H~+3V,~Z", "Ą"},
{"E~Y~-6H~+2V,~Z", "Ę"},
{"L~Y~-16H~+0V/~Z", "Ł"},
{"Z~Y~-21H~-5Vº~Z", "Ż"},

// tildes
{"N~Y~-22H~-4V<TIL>~Z", "Ñ"},
Expand All @@ -558,6 +562,10 @@ static std::vector<ReplaceInfo> s_replace_info_jak1 = {
{"I~Y~-19H~-5V'~Z", "Í"},
{"O~Y~-22H~-4V'~Z", "Ó"},
{"U~Y~-24H~-3V'~Z", "Ú"},
{"C~Y~-21H~-5V'~Z", "Ć"},
{"N~Y~-21H~-5V'~Z", "Ń"},
{"S~Y~-21H~-5V'~Z", "Ś"},
{"Z~Y~-21H~-5V'~Z", "Ź"},

// double acute accents
{"O~Y~-28H~-4V'~-9H'~Z", "Ő"}, // custom
Expand Down
29 changes: 28 additions & 1 deletion custom_levels/test-zone/test-zone.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,24 @@
// The base actor id for your custom level. If you have multiple levels this should be unique!
"base_id": 100,

"ambients": [],
// All art groups you want to use in your custom level. Will add their models and corresponding textures to the FR3 file.
// Note: You will still have to add them to your level's .gd file.
"art_groups": ["plat-ag"],

// Ambients you want to use in your custom level. Ambients can be used for various things like changing the music variation (flava),
// adding ambient sounds, level name hints, etc.
"ambients": [
{
"trans": [-21.6238, 20.0496, 17.1191, 10.0],
"bsphere": [-21.6238, 20.0496, 17.1191, 15.0],
"lump": {
"name": "test-ambient",
"type": "'hint",
"text-id": ["int32", 557], // text id for the "POWER CELL" text
"play-mode": "'notice"
}
}
],

"actors" : [
{
Expand Down Expand Up @@ -70,6 +87,16 @@
"lump": {
"name":"test-eco"
}
},
{
"trans": [-7.41, 3.5, 28.42], // translation
"etype": "plat", // actor type
"game_task": 0, // associated game task (for powercells, etc)
"quat": [0, 0, 0, 1], // quaternion
"bsphere": [-7.41, 3.5, 28.42, 10], // bounding sphere
"lump": {
"name": "test-plat"
}
}
]
}
1 change: 1 addition & 0 deletions custom_levels/test-zone/testzone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
("TSZ.DGO"
("static-screen.o"
"test-zone.go"
"plat-ag.go"
))
4 changes: 4 additions & 0 deletions decompiler/IR2/Form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,10 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
return "cpad-pressed?";
case FixedOperatorKind::CPAD_HOLD_P:
return "cpad-hold?";
case FixedOperatorKind::MOUSE_PRESSED_P:
return "mouse-pressed?";
case FixedOperatorKind::MOUSE_HOLD_P:
return "mouse-hold?";
case FixedOperatorKind::VECTOR_LENGTH:
return "vector-length";
case FixedOperatorKind::VECTOR_PLUS_FLOAT_TIMES:
Expand Down
141 changes: 101 additions & 40 deletions decompiler/IR2/FormExpressionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4732,6 +4732,72 @@ enum first:
return nullptr;
}

FormElement* try_make_logtest_mouse_macro(Form* in, FormPool& pool) {
/*
(defmacro mouse-pressed ()
`(-> *mouse* button0-rel 0)
)
(defmacro mouse-hold ()
`(-> *mouse* button0-abs 0)
)
(defmacro mouse-pressed? (&rest buttons)
`(logtest? (mouse-pressed) (mouse-buttons ,@buttons))
)
(defmacro mouse-hold? (&rest buttons)
`(logtest? (mouse-hold) (mouse-buttons ,@buttons))
)
*/
auto static const mouse_matcher = Matcher::op(
GenericOpMatcher::fixed(FixedOperatorKind::LOGTEST),
{Matcher::deref(Matcher::symbol("*mouse*"), false,
{DerefTokenMatcher::any_string(2), DerefTokenMatcher::integer(0)}),
Matcher::op_with_rest(GenericOpMatcher::func(Matcher::constant_token("mouse-buttons")),
{})});
auto static const mouse_matcher_inv = Matcher::op(
GenericOpMatcher::fixed(FixedOperatorKind::LOGTEST),
{Matcher::op_with_rest(GenericOpMatcher::func(Matcher::constant_token("mouse-buttons")), {}),
Matcher::deref(Matcher::symbol("*mouse*"), false,
{DerefTokenMatcher::any_string(2), DerefTokenMatcher::integer(0)})});

bool inv_match = false;
auto mr = match(mouse_matcher, in);
if (!mr.matched) {
mr = match(mouse_matcher_inv, in);
inv_match = true;
}
if (mr.matched) {
enum { ABS, REL, NIL } t = NIL;
if (mr.maps.strings.at(2) == "button0-abs") {
t = ABS;
} else if (mr.maps.strings.at(2) == "button0-rel") {
t = REL;
}

printf("t is %d\n", t);
if (t != NIL) {
auto logtest_elt = dynamic_cast<GenericElement*>(in->at(0));
if (logtest_elt) {
auto buttons_form = logtest_elt->elts().at(inv_match ? 0 : 1);
std::vector<Form*> v;
GenericElement* butts =
dynamic_cast<GenericElement*>(buttons_form->at(0)); // the form with the buttons itself
if (butts) {
v = butts->elts();
}

return pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(t == ABS ? FixedOperatorKind::MOUSE_HOLD_P
: FixedOperatorKind::MOUSE_PRESSED_P),
v);
}
}
}
return nullptr;
}

FormElement* try_make_logtest_cpad_macro(Form* in, FormPool& pool) {
/*
(defmacro cpad-pressed (pad-idx)
Expand Down Expand Up @@ -4798,6 +4864,22 @@ FormElement* try_make_logtest_cpad_macro(Form* in, FormPool& pool) {
}
return nullptr;
}

FormElement* convert_logtest_to_fancy_macro(FormPool& pool, Form* logtest_form) {
auto as_cpad_macro = try_make_logtest_cpad_macro(logtest_form, pool);
if (as_cpad_macro) {
return as_cpad_macro;
}
auto as_mouse_macro = try_make_logtest_mouse_macro(logtest_form, pool);
if (as_mouse_macro) {
return as_mouse_macro;
}
auto focus_test_macro = try_make_focus_test_macro(logtest_form, pool);
if (focus_test_macro) {
return focus_test_macro;
}
return nullptr;
}
} // namespace

FormElement* ConditionElement::make_zero_check_generic(const Env& env,
Expand Down Expand Up @@ -4849,17 +4931,11 @@ FormElement* ConditionElement::make_zero_check_generic(const Env& env,
auto as_logtest = try_make_nonzero_logtest(source_forms.at(0), pool);
if (as_logtest) {
auto logtest_form = pool.alloc_single_form(nullptr, as_logtest);
auto as_cpad_macro = try_make_logtest_cpad_macro(logtest_form, pool);
if (as_cpad_macro) {
logtest_form = pool.alloc_single_form(nullptr, as_cpad_macro);
return pool.alloc_element<GenericElement>(
GenericOperator::make_compare(IR2_Condition::Kind::FALSE), logtest_form);
}
auto focus_test_macro = try_make_focus_test_macro(logtest_form, pool);
if (focus_test_macro) {
logtest_form = pool.alloc_single_form(nullptr, focus_test_macro);
auto fancy_form = convert_logtest_to_fancy_macro(pool, logtest_form);
if (fancy_form) {
return pool.alloc_element<GenericElement>(
GenericOperator::make_compare(IR2_Condition::Kind::FALSE), logtest_form);
GenericOperator::make_compare(IR2_Condition::Kind::FALSE),
pool.alloc_single_form(nullptr, fancy_form));
}
return pool.alloc_element<GenericElement>(
GenericOperator::make_compare(IR2_Condition::Kind::FALSE), logtest_form);
Expand Down Expand Up @@ -4899,15 +4975,12 @@ FormElement* ConditionElement::make_nonzero_check_generic(const Env& env,
auto as_logtest = try_make_nonzero_logtest(source_forms.at(0), pool);
if (as_logtest) {
auto logtest_form = pool.alloc_single_form(nullptr, as_logtest);
auto as_cpad_macro = try_make_logtest_cpad_macro(logtest_form, pool);
if (as_cpad_macro) {
return as_cpad_macro;
}
auto focus_test_macro = try_make_focus_test_macro(logtest_form, pool);
if (focus_test_macro) {
return focus_test_macro;
auto fancy_form = convert_logtest_to_fancy_macro(pool, logtest_form);
if (fancy_form) {
return fancy_form;
} else {
return as_logtest;
}
return as_logtest;
}

return pool.alloc_element<GenericElement>(GenericOperator::make_compare(m_kind), source_forms);
Expand Down Expand Up @@ -6080,17 +6153,11 @@ void ConditionalMoveFalseElement::push_to_stack(const Env& env, FormPool& pool,
auto as_logtest = try_make_nonzero_logtest(popped.at(1), pool);
if (as_logtest) {
auto logtest_form = pool.alloc_single_form(nullptr, as_logtest);
auto as_cpad_macro = try_make_logtest_cpad_macro(logtest_form, pool);
if (as_cpad_macro) {
val = pool.alloc_single_form(nullptr, as_cpad_macro);
}
if (!val) {
auto focus_test_macro = try_make_focus_test_macro(logtest_form, pool);
if (focus_test_macro) {
val = pool.alloc_single_form(nullptr, focus_test_macro);
} else {
val = pool.alloc_single_form(nullptr, as_logtest);
}
auto fancy_form = convert_logtest_to_fancy_macro(pool, logtest_form);
if (fancy_form) {
val = pool.alloc_single_form(nullptr, fancy_form);
} else {
val = logtest_form;
}
}
} else {
Expand All @@ -6099,17 +6166,11 @@ void ConditionalMoveFalseElement::push_to_stack(const Env& env, FormPool& pool,
auto logtest_form = pool.alloc_single_form(nullptr, as_logtest);
auto not_form = pool.form<GenericElement>(
GenericOperator::make_compare(IR2_Condition::Kind::FALSE), logtest_form);
auto as_cpad_macro = try_make_logtest_cpad_macro(not_form, pool);
if (as_cpad_macro) {
val = pool.alloc_single_form(nullptr, as_cpad_macro);
}
if (!val) {
auto focus_test_macro = try_make_focus_test_macro(not_form, pool);
if (focus_test_macro) {
val = pool.alloc_single_form(nullptr, focus_test_macro);
} else {
val = not_form;
}
auto fancy_form = convert_logtest_to_fancy_macro(pool, not_form);
if (fancy_form) {
val = pool.alloc_single_form(nullptr, fancy_form);
} else {
val = not_form;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions decompiler/IR2/IR2_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ enum class FixedOperatorKind {
SEND_EVENT,
CPAD_PRESSED_P,
CPAD_HOLD_P,
MOUSE_PRESSED_P,
MOUSE_HOLD_P,
FOCUS_TEST,
INVALID
};
Expand Down
6 changes: 6 additions & 0 deletions decompiler/analysis/insert_lets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ FormElement* rewrite_as_send_event(LetElement* in,
if (enum_ts) {
param_val = cast_to_bitfield_enum(enum_ts, pool, env, val);
}
} else if (param_idx == 2 && param_values.at(0)->to_string(env) == "'darkjak" &&
msg_str == "'change-mode") {
auto enum_ts = env.dts->ts.try_enum_lookup("darkjak-stage");
if (enum_ts) {
param_val = cast_to_bitfield_enum(enum_ts, pool, env, val);
}
}
}
// if we didn't cast
Expand Down
Loading

0 comments on commit a3bdd18

Please sign in to comment.