Commit Graph

36 Commits

Author SHA1 Message Date
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
Mihai Parparita
35c86ad6bf Clean up #includes
Result of running IWYU (https://include-what-you-use.org/) and
applying most of the suggestions about unncessary includes and
forward declarations.

Was motivated by observing that <thread> was being included in
ppcopcodes.cpp even though it was unused (found while researching
the use of threads), but seems generally good to help with build
times and correctness.
2023-11-03 00:33:47 -07:00
Mihai Parparita
1f7edfdb3b Make Emscripten build not depend on SDL2 or cubeb
While Emscripten has an SDL compabtility layer, it assumes that the
code is executing in the main browser process (and thus has access to
them DOM). The Infinite Mac project runs emulators in a worker thread
(for better performance) and has a custom API for the display, sound,
input, etc. Similarly, it does not need the cross-platform sound support
from cubeb, there there is a sound API as well.

This commit makes SDL (*_sdl.cpp) and cubeb-based (*_cubeb.cpp) code be
skipped when targeting Emscripten, and instead *_js.cpp files are used
instead (this is the cross-platform convention used by Chromium[^1], and
could be extended for other targets).

For hostevents.cpp and soundserver.cpp the entire file was replaced,
whereas for videoctrl.cpp there was enough shared logic that it was
kept, and the platform-specific bits were moved behind a Display class
that can have per-platform implementations. For cases where we need
additional private fields in the platform-specific classes, we use
a PIMPL pattern.

The *_js.cpp files with implementations are not included in this
commit, since they are closely tied to the Infinite Mac project, and
will live in its fork of DingusPPC.

[^1]: https://www.chromium.org/developers/design-documents/conventions-and-patterns-for-multi-platform-development/
2023-10-25 22:25:53 -07:00
joevt
5294a8b71c Fix compiler warnings: unused variables. 2023-01-11 01:17:12 -08:00
joevt
64fec88436 Fix compiler warnings: cast loses precision.
Use explicit cast when converting large integer types to smaller integer types when it is known that the most significant bytes are not required.
For pcidevice, check the ROM file size before casting to int. We'll allow expansion ROM sizes up to 4MB but usually they are 64K, sometimes 128K, rarely 256K.
for machinefactory, change the type to size_t so that it can correctly get the size of files that are larger than 4GB; it already checks the file size is 4MB before we need to cast to uint32_t.
For floppyimg, check the image size before casting to int. For raw images, only allow files up to 2MB. For DiskCopy42 images, it already checks the file size, so do the cast after that.
2023-01-11 01:17:12 -08:00
Maxim Poliakovski
78528a1a16 floppyimg: correct format for MFM DC42 images. 2022-12-12 02:27:42 +01:00
Maxim Poliakovski
df02f5053b floppyimg: initial support for Disk Copy 4.2 images. 2022-12-11 23:00:52 +01:00
Maxim Poliakovski
4f05d3dae6 swim3: implement reading the Step register. 2022-11-18 18:06:46 +01:00
Maxim Poliakovski
d96351763f swim3: emulate on-chip 1 us timer. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski
a4ff58e9ee New floppy access logic with improved timing. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski
9835b96e87 floppyimg: assume raw image by default. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski
76e0fab33a superdrive: implement eject disk command. 2022-11-17 18:03:18 +01:00
Maxim Poliakovski
585c5fd4ca Guess low-level floppy disk format based on image size.
Also add fdd_fmt property for manually specifying disk
format.
2022-11-17 18:03:18 +01:00
Maxim Poliakovski
3a5c61797c
Revert "PCI fixes" 2022-09-02 23:24:06 +00:00
joevt
24ecdbe75b Allow non-HFS/MFS raw floppies
Such as FAT formatted floppies which should be readable in Open Firmware (when floppy support is updated to work in Open Firmware).
2022-09-02 03:39:50 -07:00
joevt
b76bfedf4b Remove unnecessary linefeeds from log
To remove blank lines in the dingusppc.log file or in the console output when -d is used.
2022-08-14 05:26:56 -07:00
Maxim Poliakovski
b9fb0b9c5f Switch fdd_wr_prot to BinProperty. 2022-07-19 23:48:17 +02:00
Maxim Poliakovski
439029cafe swim3: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
dingusdev
80a4864a92 Floppy disk write protection 2022-02-24 07:33:30 -07:00
Maxim Poliakovski
689fe51d80 Add required includes for gcc. 2022-02-17 00:50:37 +01:00
Maxim Poliakovski
2ce2cae48c SWIM3: implement disk reading. 2022-02-15 15:55:16 +01:00
Maxim Poliakovski
2525398b6e SWIM3: add support for floppy DMA. 2022-02-15 15:53:18 +01:00
Maxim Poliakovski
e91843034b Superdrive: method for retrieving disk data. 2022-02-15 15:49:12 +01:00
Maxim Poliakovski
9da4a9ec6a SWIM3: respect interrupt enable flag in mode register. 2022-02-14 23:06:07 +01:00
Maxim Poliakovski
54107b2aac SWIM3: track seeking and header reading. 2022-02-13 03:07:32 +01:00
Maxim Poliakovski
8d8cecbaba Superdrive: implement track seeking. 2022-02-13 03:05:55 +01:00
Maxim Poliakovski
9f3f46603f AMIC: handle SWIM3 interrupts. 2022-02-07 23:10:17 +01:00
Maxim Poliakovski
c77155199b Superdrive: report track zero status. 2022-02-07 23:05:58 +01:00
Maxim Poliakovski
1872eca44f SWIM3: implement head stepping. 2022-02-07 23:05:58 +01:00
Maxim Poliakovski
9aaf441625 Superdrive: more commands and status requests. 2022-02-07 15:05:57 +01:00
Maxim Poliakovski
b9fbd9b7c9 Superdrive: support for inserting of virtual disks. 2022-02-06 21:23:20 +01:00
Maxim Poliakovski
5e2f2b12e4 Properly connect Superdrive to SWIM3 and machines. 2022-02-06 15:23:30 +01:00
Maxim Poliakovski
dea863b6e6 Superdrive: support disk-in-drive status. 2022-02-06 03:25:35 +01:00
Maxim Poliakovski
9a0c340712 Basic SWIM3 and Superdrive emulation. 2021-12-12 21:40:04 +01:00
Maxim Poliakovski
793335d9b8 Clean up includes. 2021-12-05 20:01:57 +01:00
Maxim Poliakovski
f39188beb1 Initial support for floppy disk images. 2021-12-04 14:22:02 +01:00