8 Commits

Author SHA1 Message Date
Mihai Parparita
a1d945a61f Revert unintentional change to imgfile_sdl.cpp
Did not mean to include this in #127
2024-12-02 22:50:03 -08:00
Mihai Parparita
b759f25d87 ppc: Use a unified opcode lookup table
Instead of a primary opcode lookup table with 64 entries and a few
smaller tables with 4-2048 entries, use a single 64 * 2048 (128K)
entry table to dispatch opcodes.

Helps with performance, since we avoid the function call overhead for
some frequently-used instructions (e.g. branch, integer, floating point).
Saves ~2 seconds from the time to Welcome to Macintosh (same measurement
methodology as #125)

Secondarily also makes opcode registration/decoding a bit more uniform,
and scannable, since it's now all in initialize_ppc_opcode_table.
2024-11-30 20:37:26 +01:00
Mihai Parparita
08fa2f887d Make ImgFile ignore operations before the file is opened
Before f65f9b9845ddf0a4050213cc36ef43c9c852a6c7 this would happen
automatically (since the stream member was always valid). It's now a
unique_ptr that's only initialized when the file is opened, so we need
to add guards for all the operations.
2024-11-25 22:37:37 +01:00
dingusdev
c8e2a4d921 Avoid flush on web ports 2024-11-24 15:32:47 -07:00
Rairii
aeac232e12 imgfile_sdl: Flush on write. 2024-11-15 07:54:49 -07:00
Mihai Parparita
f65f9b9845 Add a deterministic execution mode
Adds support for a --deterministic command-line option that makes
repeated runs the same:
- Keyboard and mouse input is ignored
- The sound server does a periodic pull from the DMA channel (so that
  it gets drained), but only does so via a periodic timer (instead of
  being driven by a cubeb callback, which could arrive at different
  times)
- Disk image writes are disabled (reads of a modified area still
  work via an in-memory copy)
- NVRAM writes are disabled
- The current time that ViaCuda initializes the guest OS is always the
  same.

This makes execution exactly the same each time, which should
make debugging of more subtle issues easier.

To validate that the deterministic mode is working, I've added a
periodic log of the current "time" (measured in cycle count), PC
and opcode. When comparing two runs with --log-no-uptime, the generated
log files are identical.
2024-11-09 22:48:06 -08:00
Mihai Parparita
38669fd83b Switch ImgFile to using uint64_t explicitly
size_t and off_t are 32-bit values in Emscripten, which causes issues
with disk images larger than 4GB. Use the explicit type (which is more
consistent with the rest of the codebase anyway).
2024-07-22 21:48:57 -07:00
Mihai Parparita
d4c9db7fcf Move disk image reading to be behind an ImgFile class
Allows different implementations for different platforms (the JS
build relies on browser APIs to stream disk images over the network).

Setting aside the JS build, this also reduces some code duplication.
2023-11-09 21:49:28 -08:00