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
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ jobs:
- name: Triangles the engine lost, in the Game view and Render buffers
if: runner.os == 'Linux'
run: LIBGL_ALWAYS_SOFTWARE=1 xvfb-run -a -s "-screen 0 1600x960x24" python3 tests/renderlostcheck.py build/splashedit
- name: Play with 4 consoles through the relay, grid and Network view
if: runner.os == 'Linux'
run: LIBGL_ALWAYS_SOFTWARE=1 xvfb-run -a -s "-screen 0 1600x960x24" python3 tests/relayviewcheck.py build/splashedit
- name: Far scenery pops in, warned with its fog fix
if: runner.os == 'Linux'
run: LIBGL_ALWAYS_SOFTWARE=1 xvfb-run -a -s "-screen 0 1600x960x24" python3 tests/farpopcheck.py build/splashedit
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ add_library(splasheditdoc STATIC
src/editor/lua_editor.cpp
src/editor/play.cpp
src/editor/linkplay.cpp
src/editor/relay.cpp
src/editor/model_import.cpp
src/editor/project.cpp
src/editor/serial.cpp
Expand Down
9 changes: 7 additions & 2 deletions src/editor/play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ PlayTools loadPlayTools(const fs::path& file) {
else if (key == "overlay_perf") t.overlayPerf = value == "1";
else if (key == "overlay_rooms") t.overlayRooms = value == "1";
else if (key == "boot_logo") t.bootLogo = value != "0";
else if (key == "players") t.players = value == "2" ? 2 : 1;
else if (key == "players") {
char* end = nullptr;
const long n = std::strtol(value.c_str(), &end, 10);
t.players = value.empty() || *end ? 1 : int(std::clamp<long>(n, 1, kMaxPlayers));
} else if (key == "relay") t.relay = value == "1";
}
return t;
}
Expand All @@ -61,7 +65,8 @@ bool savePlayTools(const fs::path& file, const PlayTools& t) {
<< "overlay_perf=" << (t.overlayPerf ? 1 : 0) << "\n"
<< "overlay_rooms=" << (t.overlayRooms ? 1 : 0) << "\n"
<< "boot_logo=" << (t.bootLogo ? 1 : 0) << "\n"
<< "players=" << (t.players == 2 ? 2 : 1) << "\n";
<< "players=" << std::clamp(t.players, 1, kMaxPlayers) << "\n"
<< "relay=" << (t.relay ? 1 : 0) << "\n";
return bool(out);
}

Expand Down
13 changes: 10 additions & 3 deletions src/editor/play.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ struct PlayTools {
std::string port; // Run on hardware: a serial port, or tcp:HOST:PORT
bool overlayPerf = false, overlayRooms = false;
bool bootLogo = true;
// Play boots 1 console, or 2 linked over SIO1 (editor/linkplay.hh).
// Play boots 1 console, or 2 to kMaxPlayers linked ones. 2 are linked
// to each other over SIO1 (editor/linkplay.hh) unless `relay` is on;
// 3 or more always go through the editor's relay (editor/relay.hh).
int players = 1;
bool relay = false;
};
inline constexpr int kMaxPlayers = 10;
// Whether a Play with these tools runs its consoles through the relay.
inline bool usesRelay(const PlayTools& t) { return t.players >= 3 || (t.players == 2 && t.relay); }

// key=value lines: redux=, psxsplash=, bios=, disc=, port=, overlay_perf=,
// overlay_rooms=, boot_logo= (1 or 0), players= (1 or 2). A missing file or
// key reads as empty or off, but boot_logo as on and players as 1.
// overlay_rooms=, boot_logo= (1 or 0), players= (1 to kMaxPlayers, clamped),
// relay= (1 or 0). A missing file or key reads as empty or off, but boot_logo
// as on and players as 1 (also for a value that is not a number).
PlayTools loadPlayTools(const std::filesystem::path& file);
bool savePlayTools(const std::filesystem::path& file, const PlayTools& tools);

Expand Down
Loading
Loading