Commit Graph

40 Commits

Author SHA1 Message Date
dingusdev
284f58dec4 Continued build fixing 2024-03-16 19:24:40 -07:00
dingusdev
da9770c99b Attempted build fix 2024-03-16 13:45:28 -07:00
joevt
266d45e13a timermanager: Make immediate timer more immediate. 2024-03-16 11:46:40 -07:00
joevt
703662cb5b timermanager: Add some thread safety. 2024-03-16 11:46:30 -07:00
joevt
833f74dce6 timemanager: Remove unnecessary parameter. 2024-03-16 11:36:41 -07:00
joevt
014aa90462 timemanager: Remove timer minimum timeout. 2024-03-16 11:36:25 -07:00
joevt
f5dcaebbf8 timemanager: 0 is also < a positive integer. 2024-03-16 11:36:10 -07:00
Maxim Poliakovski
54ce23d0a8 platinum: cleanup non-DWORD register reads. 2024-03-12 17:29:19 +01:00
Maxim Poliakovski
3c7ce3de8b
Merge pull request #62 from mihaip/upstream-cuda-restart
Add support for the CUDA_RESTART_SYSTEM command
2024-03-08 15:25:02 +01:00
dingusdev
e56d4e63f4
Merge pull request #76 from mihaip/upstream-mouse-grab2
Add a basic mouse grab mode
2024-03-08 07:10:10 -07:00
Mihai Parparita
57e6e90002 Add support for the CUDA_RESTART_SYSTEM command
There are cases where when it's necessary (e.g. given uninitialized NVRAM,
the Beige G3 with the 10.2 install CD inserted will update the boot
device and restart to boot from it).

Restart support was done by wrapping the ppc_exec function in a loop and
checking for a restart power off reason. We also need to disconnect all
event listeners, since they will be recreated when the machine is
re-initialized.
2024-03-07 23:32:23 -08:00
joevt
177098c957 debugger: Fix interrupt signal.
Typing Control-C in Terminal app causes an interrupt signal that should enter the DPPC debugger but this only worked once since the signal handler never returned. Even if the signal handler reenabled the signal somehow, it calls enter_debugger recursively which is strange since the earlier calls to enter_debugger would never return.

Now the signal handler just sets a flag (power_on) which can be used to exit any loop (emulator loops, stepping loops, disassembly loops, dumping loops).

Main always calls enter_debugger now which calls the ppc_exec loop. The power_on flag will exit the ppc_exec loop to return to the debugger. Recursion of enter_debugger is eliminated except for calls to loguru's ABORT_F.

An enum power_off_reason is used to indicate why the power_on flag is set to false and to determine what happens next.
2024-03-02 12:57:02 -07:00
joevt
7fc92e236b Fix extract_bits and insert_bits.
(1 << len) is actually 1 when len is (sizeof(T)*8) so we need to special case that. len is usually constant so the compare won't be compiled.
2024-03-02 06:54:58 -07:00
joevt
3062a29b78 Add clear_bit and set_bit. 2024-03-02 06:54:45 -07:00
Mihai Parparita
bfbf4cb453 Add a basic mouse grab mode
Take 2 of 587eb48f61. We now implement
this at the SDL level, which works cross-platform and allows us to
ensure that the guest never gets the Control-G event.
2024-02-29 22:58:50 -08:00
dingusdev
7eb2fd23c3 Fixing typos 2023-12-01 14:04:26 -07:00
dingusdev
07030378c8 Non-US keyboard support started
This is quite unfinished, but should get some of the major targets started.
2023-12-01 10:23:41 -07:00
Maxim Poliakovski
f814822ca3 timermanager: support for timers that expire immediately. 2023-11-15 19:01:54 +01:00
Mihai Parparita
73272b28dd Implement the ADB keyboard
Besides generating KeyboardEvents in the SDL event handler and
returning the key state in the register 0 reads of the AdbKeyboard
device, we also needed to generalize the ADB bus polling a bit. We now
check all devices that have the service request bit set, instead of
hardcoding the mouse.

The SDL key event -> ADB raw key code mapping is based on BasiliskII/
SheepShaver's, but cleaned up a bit.
2023-10-11 23:43:20 -07: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
Mihai Parparita
838ccdd7b4 Fix for building on with GCC on ARM
The x86intrin.h intrinsics header is not available in that case.
2023-10-18 23:13:05 -07:00
dingusdev
a7601c36bd Started work on keyboard input 2023-08-01 22:43:11 -07:00
Maxim Poliakovski
b4b41a47b2 hostevents: dispatch mouse button events. 2023-08-01 23:57:16 +02:00
Maxim Poliakovski
ddf139a659 Extend TimerManager API a bit. 2023-08-01 17:36:29 +02:00
Maxim Poliakovski
6b8fe50f50 hostevents: add prost-processing signal. 2023-08-01 17:21:17 +02:00
Maxim Poliakovski
6fa6b4d4dc Rework the EventManager to use CoreSignal. 2023-07-27 02:40:32 +02:00
Maxim Poliakovski
6efe6f13a9 Add new CoreSignal class. 2023-07-27 02:38:21 +02:00
Maxim Poliakovski
f1c898b17e Initial host event manager. 2023-04-02 03:01:13 +02:00
Maxim Poliakovski
e01fea87a9 More bitops. 2023-04-02 03:01:13 +02:00
Maxim Poliakovski
31db015105 pcihost: refactor data access helpers. 2023-01-31 23:20:31 +01:00
joevt
19adb54cd8 Fix compiler warnings.
These were detected by github Actions but not by Xcode.
2023-01-11 01:17:13 -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
98ccef732f TimerManager: more microseconds related constants. 2022-11-17 18:03:18 +01:00
joevt
6f0d3b48ba Fix TBR range
Fixed an issue where TBR doesn't have full 64-bit range. The original calculation was 64 bit and ended with a ÷ 10^9. This means the max for the upper 32 bits is 2^32/10^9 = 4. The solution is to use a multiplication method that supports a 96 bit product. core/mathutils.h contains functions for that. TBR driving frequency is assumed to be less than 1 GHz. Some minor modification is required for future > 1 GHz support.
2022-09-15 21:22:37 -07:00
Maxim Poliakovski
b47de8b042 Implement MPC601 style RTC. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
8f528184b8 Fix compilation with gcc, part 1. 2022-02-16 23:52:43 +01:00
Maxim Poliakovski
0d3fd01fef Improve emulation of the VIA timers. 2022-02-13 03:02:17 +01:00
Maxim Poliakovski
25a4fd1107 Allow adding timers from timer callbacks. 2022-02-05 17:10:57 +01:00
Maxim Poliakovski
339db4a078 Add timers management. 2022-01-10 17:56:24 +01:00