Repository navigation
feat: add a 1920x1080 docked output mode #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+138
−18
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| """Exercise the host and menu's docked output sizes without a game dump.""" | ||
| import argparse | ||
| import os | ||
| import subprocess | ||
| import tempfile | ||
| from pathlib import Path | ||
|
|
||
| ROOT = Path(__file__).resolve().parents[1] | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("--cxx", default="g++") | ||
| args = parser.parse_args() | ||
|
|
||
| host = (ROOT / "host/nn_applet.c").read_text(encoding="utf-8") | ||
| menu = (ROOT / "gpu/vk/vk_menu.cpp").read_text(encoding="utf-8") | ||
| fixture = r''' | ||
| #include <algorithm> | ||
| #include <cassert> | ||
| #include <cstdint> | ||
| #include <cstdio> | ||
| #include <cstdlib> | ||
| #include <cstring> | ||
| #include <iterator> | ||
|
|
||
| using DWORD = unsigned long; | ||
| constexpr int MAX_PATH = 260; | ||
| DWORD hos_game_path_a(char *path, int size) { return snprintf(path, size, "./hookshot.exe"); } | ||
| void hos_log(const char *, ...) {} | ||
| struct { int handheld, output_res; } opts; | ||
| ''' + host[host.index("static int ini_option("):host.index("HLE(_ZN2nn2oe16GetOperationModeEv)")] + menu[ | ||
| menu.index("struct Out {"):menu.index("const char* tx_speed(")] + r''' | ||
| int main(int argc, char **argv) { | ||
| assert(argc == 5); | ||
| const int mode = atoi(argv[1]); | ||
| const unsigned w = atoi(argv[2]), h = atoi(argv[3]); | ||
| assert(output_mode() == mode); | ||
| assert(hos_output_size(0) == w && hos_output_size(1) == h); | ||
| assert(hos_rt_pool_size(305ull << 20) == ((mode == 2 ? 687ull : 305ull) << 20)); | ||
| assert(kLastOutput == 3); | ||
| assert(output_choice(-1) == 0 && output_choice(4) == 0); | ||
| assert(step_output_choice(3, -1) == 3); | ||
| assert(step_output_choice(3, 1) == 0 && step_output_choice(0, -1) == 3); | ||
| assert(step_output_choice(0, 1) == 1 && step_output_choice(1, -1) == 0); | ||
| assert(step_output_choice(1, 1) == 2 && step_output_choice(2, -1) == 1); | ||
| assert(step_output_choice(2, 1) == 2); | ||
| opts.output_res = mode; | ||
| opts.handheld = handheld(); | ||
| assert(strcmp(tx_output_res(mode), argv[4]) == 0); | ||
| unsigned scene_w, scene_h; | ||
| game_size(1.0f, scene_w, scene_h); | ||
| assert(scene_w == (opts.handheld ? 1536 : mode ? w : 2048)); | ||
| assert(scene_h == (opts.handheld ? 864 : mode ? h : 1152)); | ||
| if (mode == 3) assert(strcmp(tx_resolution(2), "75% (1440x810)") == 0); | ||
| } | ||
| ''' | ||
| cases = ( | ||
| (0, 0, None, 0, 2560, 1440, "2048x1152 (game, restart)"), | ||
| (1, 0, None, 1, 2560, 1440, "2560x1440 (restart)"), | ||
| (2, 0, None, 2, 3840, 2160, "3840x2160 (restart)"), | ||
| (3, 0, None, 3, 1920, 1080, "1920x1080 (restart)"), | ||
| (1, 0, "3", 3, 1920, 1080, "1920x1080 (restart)"), | ||
| (3, 1, "3", 0, 2560, 1440, "2048x1152 (game, restart)"), | ||
| (4, 0, None, 0, 2560, 1440, "2048x1152 (game, restart)"), | ||
| ) | ||
| with tempfile.TemporaryDirectory(prefix="output-resolution-") as tmp: | ||
| work = Path(tmp) | ||
| source, exe = work / "fixture.cpp", work / "fixture.exe" | ||
| source.write_text(fixture, encoding="utf-8") | ||
| subprocess.run([args.cxx, "-std=c++17", str(source), "-o", str(exe)], check=True) | ||
| for saved, handheld, override, mode, w, h, label in cases: | ||
| (work / "hookshot_options.ini").write_text(f"output_res={saved}\nhandheld_profile={handheld}\n", encoding="ascii") | ||
| env = os.environ.copy() | ||
| for key in ("HOS_OUTPUT_RES", "HOS_HANDHELD", "HOS_RT_POOL_MB"): | ||
| env.pop(key, None) | ||
| if override is not None: | ||
| env["HOS_OUTPUT_RES"] = override | ||
| subprocess.run([str(exe), str(mode), str(w), str(h), label], cwd=work, env=env, check=True) | ||
| print("PASS: output sizes, menu order, 1080p override, handheld and render-target budgets") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 1080p appended, the menu now cycles 2048x1152 → 2560x1440 → 3840x2160 → 1920x1080, so the smallest size comes after 4K. To keep the saved ids as they are (
3= 1080p) but show the sizes in order, the row could step through a display-order table, e.g.{3, 0, 1, 2}(with Left/Right mapping through it), ortx_output_res/ the row could use a small id↔position mapping. Same for the readme table, which lists it last.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should break away from this int setting now before we add other of other resolutions too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the
kOutputOrdertable does it: Left/Right, wheel and the value halves all go throughset_row, so they step in size order, and the savedoutput_res/HOS_OUTPUT_RESids keep their meaning. Fine with keeping the int setting here, a different format can be its own PR if more sizes come.