Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/CORE_LIBRARY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Core titles in the library

The N64 internal-resolution menu offers 1x, 2x and 3x for every title, in both
platform and title settings. A previously saved or explicit higher numeric
scale is resolved to 3x when the hub launches N64. This shared player policy
does not change other systems' scales or the core's developer diagnostics.
The internal-resolution menu uses the values declared by the selected core,
in both platform and title settings. Current n64lle cores offer 1x, 2x, 3x
and 4x. The launcher preserves the selected scale, including an explicit
`--opt video.internal_resolution=4x`; it does not silently lower resolution
for performance. Stored values no longer declared by the core are omitted
with a warning; explicit invalid values remain the core's validation error.

A **core title** plays inside the hub's own window through an rcore core
(Retro-Runtime `docs/CORE_LINK.md`), instead of being spawned as its own program. This page covers
Expand Down
16 changes: 0 additions & 16 deletions src/hub/hub_core_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@

namespace retcomm::hub {

std::string player_core_option_value(const std::string& platform, const std::string& key,
const std::string& value) {
if (platform != "n64" || key != "video.internal_resolution") return value;
const auto scale = [](const std::string& text) -> unsigned {
if (text.size() < 2 || text.back() != 'x') return 0;
unsigned result = 0;
for (std::size_t i = 0; i + 1 < text.size(); ++i) {
if (text[i] < '0' || text[i] > '9') return 0;
result = result * 10 + static_cast<unsigned>(text[i] - '0');
if (result > 64) return 0;
}
return result;
};
return scale(value) > 3 ? "3x" : value;
}

namespace {

namespace corelink = ::retro::corelink;
Expand Down
6 changes: 0 additions & 6 deletions src/hub/hub_core_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ struct CoreOptionDecl {
std::string description;
};

// Shared player-facing limits apply to both the menu and launch options.
// N64 currently offers at most 3x; the core's diagnostic scales remain available
// to developer tools. Other platforms/options and non-scale values pass through.
std::string player_core_option_value(const std::string& platform, const std::string& key,
const std::string& value);

struct CoreInputDecl {
std::uint32_t button = 0; // one RCORE_PAD_* bit, or 0
std::uint32_t axis = 0; // RCORE_AXIS_* + 1, or 0
Expand Down
7 changes: 1 addition & 6 deletions src/hub/hub_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11120,8 +11120,6 @@ void apply_player_settings(retcomm::hub::PlayArgs& args, const fs::path& data_di
drop(title, "this title's");
}
args.options = retcomm::hub::layer_core_options(plat, title, args.options);
for (auto& [key, value] : args.options)
value = retcomm::hub::player_core_option_value(platform, key, value);
}

// A runner from before seats 2-4 took a Transfer Pak (no transfer_pak_seats
Expand Down Expand Up @@ -11619,8 +11617,7 @@ void draw_core_option_row(CoreSettingsPage& p, const retcomm::hub::CoreOptionDec
std::string inherited = o.has_default ? o.default_value : std::string();
if (p.title_scope)
if (const auto it = p.plat_opts.find(o.key); it != p.plat_opts.end()) inherited = it->second;
const std::string requested = set ? own->second : inherited;
const std::string cur = retcomm::hub::player_core_option_value(p.platform, o.key, requested);
const std::string cur = set ? own->second : inherited;
const std::string label = o.label.empty() ? o.key : o.label;
const char* inherit_word = p.title_scope ? "All titles" : "Default";

Expand All @@ -11638,8 +11635,6 @@ void draw_core_option_row(CoreSettingsPage& p, const retcomm::hub::CoreOptionDec
layer.erase(o.key);
for (const std::string& v : o.values) {
if (p.title_scope && v == kTitleDeclaredValue) continue;
if (retcomm::hub::player_core_option_value(p.platform, o.key, v) != v)
continue;
const bool chosen = (set || p.title_scope) && v == cur;
if (ImGui::Selectable(v.c_str(), chosen)) layer[o.key] = v;
if (chosen) ImGui::SetItemDefaultFocus();
Expand Down
20 changes: 9 additions & 11 deletions tests/hub_core_settings_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ void test_options(const fs::path& dir) {
std::string err;
check(save_core_options(dir, "n64", "pokemonstadiumtest_game", v, &err), "options save");
check(load_core_options(dir, "n64", "pokemonstadiumtest_game") == v, "options round-trip");
const std::map<std::string, std::string> four_x{{"video.internal_resolution", "4x"}};
check(save_core_options(dir, "n64", "resolution-test", four_x, &err), "4x options save");
const auto stored = load_core_options(dir, "n64", "resolution-test");
check(stored == four_x && layer_core_options({}, stored, {}).at("video.internal_resolution") == "4x",
"stored N64 4x remains 4x at launch");
check(layer_core_options({{"video.internal_resolution", "2x"}},
{{"video.internal_resolution", "3x"}}, four_x)
.at("video.internal_resolution") == "4x",
"explicit N64 4x wins over platform and title scales");
check(!save_core_options(dir, "n64", "t", {{"k", "a\nb"}}, &err),
"a value with a newline refused");
}
Expand Down Expand Up @@ -613,17 +622,6 @@ int main(int argc, char** argv) {
test_display(dir);
test_n64lle_mods(dir);
test_n64lle_options(dir);
check(player_core_option_value("n64", "video.internal_resolution", "4x") == "3x",
"N64 stored or explicit 4x launches at 3x");
check(player_core_option_value("n64", "video.internal_resolution", "6x") == "3x",
"N64 higher diagnostic scales are not player choices");
for (const std::string& value : {"1x", "2x", "3x", "title", "bad", "99999999999999999x"})
check(player_core_option_value("n64", "video.internal_resolution", value) == value,
"N64 lower scales and non-scale values pass through");
check(player_core_option_value("psx", "video.internal_resolution", "4x") == "4x",
"other platforms retain their own scales");
check(player_core_option_value("n64", "video.supersampling", "4x") == "4x",
"unrelated options retain their own choices");
test_transfer_pak(dir);
test_tpak_library(dir);
{
Expand Down
Loading