Add track recovery, fix Arctic Land bridge & 9-map sim/render, harden security & optimize runtime

- Add manual track recovery (R / Backspace / Gamepad Back), document controls in README.md, fix Track 8 (Arctic Land) bridge jump/clearance physics, and fix Track 5 respawn invincibility & Track 6 off-track AI recovery across all 9 maps
- Verify 9-map sector morphing, combat (swept projectiles/LOS), pitstop chargers, and overpass/bridge surface sampling
- Fix Overpass Bottom (-Y) diagonal split and AO, add TerrainChunk frustum culling, O(1) 3D Classic uPaletteLut, atlas gutter/bleed UVs, cached uniform locations, and reusable render scratch buffers
- Harden VFS path traversal, RNC decompression bombs/truncated headers, asset/WAV parsers, GameConfig, save loaders, CLI args, and FLIC lifecycle
- Optimize 48 kHz OPL3/SoundFont synthesis (trig LUTs, cached envelopes/filters), 64-bit XMI ticks, and audio parameter/thread safety
- Add security, rendering, physics, and gameplay regression tests across all test suites
This commit is contained in:
Luxferre committed 2026-12-01 18:50:29 +02:00
1 parent 5c2ac8e70f
commit db788a2739
50 files changed
+3522 -1100

No files matched your search

+20 -8
View File
@@ -36,7 +36,8 @@ void XmidiPlayer::process_tick(IMidiSynth& synth) {
const auto& evs = seq_->events;
// Fast-forward controller/program/pitch-bend setup before requested start_tick
if (pending_start_tick_ > 0) {
while (event_cursor_ < evs.size() && evs[event_cursor_].tick < pending_start_tick_) {
while (event_cursor_ < evs.size() &&
static_cast<uint64_t>(evs[event_cursor_].tick) < pending_start_tick_) {
const auto& ev = evs[event_cursor_++];
if (ev.status == 0xFFu) continue;
uint8_t hi = ev.status & 0xF0u;
@@ -73,7 +74,8 @@ void XmidiPlayer::process_tick(IMidiSynth& synth) {
};
// Fire events at or before current_tick_
while (event_cursor_ < evs.size() && evs[event_cursor_].tick <= current_tick_) {
while (event_cursor_ < evs.size() &&
static_cast<uint64_t>(evs[event_cursor_].tick) <= current_tick_) {
const auto& ev = evs[event_cursor_++];
if (ev.status == 0xFFu) {
continue;
@@ -100,15 +102,25 @@ void XmidiPlayer::process_tick(IMidiSynth& synth) {
}
synth.note_on(ch, ev.data1, ev.data2);
if (ev.duration_ticks > 0) {
PendingNoteOff* slot = nullptr;
PendingNoteOff* oldest = &note_offs_[0];
for (auto& n : note_offs_) {
if (!n.active) {
n.active = true;
n.off_tick = current_tick_ + ev.duration_ticks;
n.channel = ch;
n.key = ev.data1;
slot = &n;
break;
}
if (n.off_tick < oldest->off_tick) {
oldest = &n;
}
}
if (!slot) {
synth.note_off(oldest->channel, oldest->key);
slot = oldest;
}
slot->active = true;
slot->off_tick = current_tick_ + static_cast<uint64_t>(ev.duration_ticks);
slot->channel = ch;
slot->key = ev.data1;
}
}
break;
@@ -163,7 +175,7 @@ void XmidiPlayer::process_tick(IMidiSynth& synth) {
}
++current_tick_;
if (event_cursor_ >= evs.size() && current_tick_ > seq_->total_ticks) {
if (event_cursor_ >= evs.size() && current_tick_ > static_cast<uint64_t>(seq_->total_ticks)) {
if (loop_) {
synth.all_notes_off();
event_cursor_ = 0;
@@ -177,7 +189,7 @@ void XmidiPlayer::process_tick(IMidiSynth& synth) {
}
void XmidiPlayer::render(float* stereo_out, int frames, IMidiSynth& synth) {
if (!playing_ || !seq_) return;
if (!stereo_out || frames <= 0 || !playing_ || !seq_) return;
int offset = 0;
while (offset < frames && playing_) {