Commit Graph

95 Commits

Author SHA1 Message Date
dingusdev 8cbbb2ed50 Initial preparation for a release 2024-04-15 07:01:51 -07:00
Mihai Parparita fc6a4872d6 Ensure that NVRAM is persisted when exiting the debugger after an abort
The SIGABRT handler is not invoked by the abort() call in the loguru
fatal handler, but either way it's not necessary (it does its own abort).

Switch to explicitly cleaning up the machine object, which as a side
effect in the destructor chain will persist the NVRAM.
2024-03-20 12:16:10 +01: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
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 a9fd2453a4 Make assertion messages more visible when we drop into the debugger.
Log output may be sent to a file, ensure that the reason why we're
aborting execution is visible.
2023-10-19 07:50:58 -07:00
Mihai Parparita 5a5ae9fd16 Exit with a non-0 exit code if there are errors
More correct behavior (and makes the Infinite Mac wrapper not close
the emulated Mac, which it does when it thinks there was a graceful
shutdown).
2023-10-18 23:14:15 -07:00
dingusdev 4364c89fd4 Slight clean-up for execution type 2023-06-19 22:36:27 -07:00
Maxim Poliakovski a7f4d418fc main: fix interpreter invokation. 2023-04-17 02:24:31 +02:00
Maxim Poliakovski f1c898b17e Initial host event manager. 2023-04-02 03:01:13 +02:00
Maxim Poliakovski c0078ce97d Refactor MachineBase and MachineFactory classes.
Adding new machines is much easier now.
A significant amount of duplicated code has been reduced.
2022-07-18 20:27:34 +02:00
dingusdev 86bc91028d Removed non-functioning interpreter code 2022-03-02 19:22:13 -07:00
Maxim Poliakovski c0cd6eb38f Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
Maxim Poliakovski e052eb4a87 Merge branch 'atirage-hacks'. 2021-09-25 23:16:38 +02:00
Maxim Poliakovski 5b54cd69ef ppcmmu: better fatal error handling with ABORT_F. 2021-09-25 19:13:40 +02:00
Maxim Poliakovski 84e111290f Fix includes for loguru and SDL. 2021-09-16 00:46:38 +02:00
Maxim Poliakovski ea5b0d9f52 atirage: framebuffer rendering and various improvements. 2021-09-11 21:02:46 +02:00
Maxim Poliakovski c5f45c6f9a SIGINT invokes the built-in debugger. 2021-08-22 17:34:23 +02:00
Maxim Poliakovski 089645e830 Implement SoftTLB for writes. 2021-08-22 17:34:23 +02:00
Maxim Poliakovski 31b5290ac9 New profiler API. 2021-04-14 01:27:07 +02:00
Maxim Poliakovski b81de4af48 ppcexec: initialize interpreter lookup tables. 2020-11-14 03:05:41 +01:00
dingusdev dc58386237 Started re-refactoring opcode retrieval 2020-10-17 14:30:37 -07:00
dingusdev 6cc88d3b02 Started a timing mechanism 2020-10-15 21:10:17 -07:00
dingusdev 4c0c32c02c Initial cleanup for the help print-outs 2020-10-13 20:20:44 -07:00
Maxim Poliakovski 90b2eb712a Implement CLI list subcommand. 2020-10-13 04:24:54 +02:00
Maxim Poliakovski c81c00f918 Make properties overridable from the command line. 2020-10-09 12:25:12 +02:00
dingusdev 0ca03be001 Fixed booting up to emulator 2020-10-04 09:58:21 -07:00
dingusdev 55ea643974 Full directory name
Makes VS2019 happier
2020-09-25 17:54:14 -07:00
Maxim Poliakovski 599659495b Initial CLI11 integration. 2020-09-26 02:38:22 +02:00
dingusdev 4ccfb5d527 Finished the proof-of-concept machine presets 2020-08-31 22:20:47 -07:00
dingusdev 4f59407cd0 Repair code for powermacg3 presets 2020-08-30 16:14:58 -07:00
dingusdev 2f2c9aadcb Typo fix 2020-08-29 17:49:50 -07:00
dingusdev d21515d964 Fixed RAM check and help prompts 2020-08-29 16:20:22 -07:00
dingusdev b28549825d Started work on machine-specific configs 2020-08-29 11:11:06 -07:00
dingusdev 14ef7564cd CLI fixes - RAM and GFXMEM work better 2020-08-25 20:07:02 -07:00
dingusdev f04ce09a7d Clean-up + further command line options 2020-08-23 09:24:52 -07:00
dingusdev 2869755819 Initial work for configuration 2020-08-22 11:05:08 -07:00
Maxim Poliakovski 39a643aff6 Merge branch 'machines'
Also disable SDL for now because it produces build errors.
2020-06-03 18:21:51 +02:00
Waqar Ahmed 0ab9380be3 clang-format everything 2020-05-12 23:55:45 +05:00
Maxim Poliakovski f7d67a91e0 New AWAC and sound server implementation. 2020-05-08 23:12:04 +02:00
dingusdev 82c4a5dbcf Slight cleanup 2020-03-26 12:38:00 -07:00
dingusdev 4e41af21e8 Started config file reading 2020-03-26 12:32:24 -07:00
dingusdev 60ffa5bfac Initial attempt at fixing SDL2 building for Windows 2020-03-22 20:15:12 -07:00
Maxim Poliakovski 945e63bdb2 Implement DMA push method for sound. 2020-03-19 15:09:24 +01:00
Maxim Poliakovski 822f6cafd2 Create machine factory.
It manages various hardware configurations referred to as machines.
2020-03-13 23:09:36 +01:00
dingusdev 354409812e Updating files with proper licensing header 2020-02-28 09:04:28 -07:00
dingusdev c8611dc293 Code cleanup + procedures for cleanup 2020-02-27 21:03:01 -07:00
dingusdev 51739520b5 Small formatting + logging fixes 2020-02-27 18:41:02 -07:00
dingusdev d7c0a731f4 Found a message I missed. 2020-02-26 21:43:19 -07:00