Commit Graph
39 Commits
Author SHA1 Message Date
joevt a3b248ea3d ppcemu: Use ppc_off_reason setter.
Makes things slightly cleaner and helps debugging. Changes to
ppc_off_reason can be logged.
2026-08-09 21:04:04 -07:00
dingusdev 213dd4c16e Update copyright info further 2026-01-30 08:12:04 -07:00
joevt 140c9adb0c hostevents_sdl: Fix INTERNATIONAL3 for non-Japan. 2026-01-30 15:40:15 +01:00
Maxim Poliakovski e75ee8d32a Update copyright year. 2026-01-30 12:15:00 +01:00
joevt fc0777c45f display: Fix display size changes in full screen.
Fix virtual display resolution change while in full screen mode.

Switching resolutions should keep the same full screen mode (integer,
full, no bars) unless a custom scale (using the zoom keys Control-- or
Control-+) has been selected.

Control-F is for switching forward through the full screen modes. Add
Control-Shift-F for switching backward through the full screen modes.
This allows reducing full screen mode without going through not full
screen mode.
2025-07-03 07:04:43 -07:00
joevt 0f8876f348 viacuda: Post key events at startup.
Keys that are held down too early are ignored which makes it difficult
perform some tasks at startup:
- Shift key to disable extensions.
- Command-Option-O-F to enter Open Firmware.
- Command-Option-P-R to reset nvram.
- Capslock to boot MkLinux or Copland.

This change hopes to grab all the keys being pressed and post events for
all of them when the ADB bus is ready.
2025-06-29 06:49:15 -07:00
joevt dbadbb4cce hostevents_sdl: Remove superfluous semicolons. 2025-06-29 06:48:51 -07:00
joevt 23b142008f hostevents_sdl: Use key mods from the SDL key event.
No reason to call SDL_GetModState separately.
2025-06-29 06:48:40 -07:00
joevt d3e0b743bb hostevents_sdl: Add key for entering debugger.
Because Control-C (sigint) in terminal window isn't always reliable (for
example, release version launched from Xcode).
2025-06-29 06:48:33 -07:00
joevt 91410f3690 hostevents_sdl: Control-L toggles max logging. 2025-06-29 06:48:23 -07:00
joevt 3f830eb5b5 hostevents_sdl: Ignore repeat events.
SDL2 will send a key down event multiple times (with the repeat flag
set) after the first key down event for the same key.
2025-06-27 18:57:35 -07:00
joevt 7ed8bda0fe adbkeyboard: Support Device Handler ID 3.
Device Handler ID 3 returns separate key codes for the right control,
option, and shift keys.
2025-06-27 18:55:55 -07:00
joevt 7b7dc90158 hostevents: Add keyboard_locale.
Add a keyboard locale field instead of passing it as a parameter to
poll_events.
2025-06-27 18:54:01 -07:00
joevt f2f048d435 hostevents: Fix mouse grab for multiple displays.
Create a mouse grab toggle event to toggle the mouse grab using the current window. After the toggle event is transmitted, transmit a mouse grab changed event so that all windows can update their title.
2025-05-03 06:04:07 -07:00
joevt 72ef266d07 display: Update grabbed mouse when resizing.
If the window's size is reduced such that the grabbed mouse is no longer inside the window, then a mouse click will go to another app. Therefore, check the mouse position and update if necessary every time the window changes size.
2025-04-23 06:56:25 -07:00
joevt 47c66666bb display: Add zoom and fullscreen no letterbox.
Added a third full screen mode which removes letterbox or pillarbox black bars.
Added Control-- and control-+ to decrease or increase the scale by a factor of 2^(1/8). This means the scale doubles or halves after pressing the same key 8 times.

drawable_w and drawable_h are floating point so that scaling is reversible (i.e. scaling from 100% to 800% and back to 100% gives 100% instead of 99 or 101%).
default_scale_x

Handle switching host resolution between Retina (HiDPI) and Low resolution modes. This involves updating the window scale factor.

Add window scale factor to window title.
2025-04-22 06:36:04 -07:00
joevt e82d9d1522 Add Full Screen modes.
A display begins in Windowed mode.
1) Press Control-F once to use full screen mode with integer scaling. If this mode is the same size as full screen mode then it is skipped.
2) Press Control-F again to use full screen mode. Smooth Scaling should be used for this mode if the scaling is not integer. Look at the Mac OS 7/8/9 window stripes to see the problem.
3) Press Control-F a third time to get back to windowed mode.

Fixed a bug where Control-S (Toggle Smooth Scaling mode) did not immediately update the display.

These keys only affect the current display.
2025-04-19 05:38:37 -07:00
joevt 1340fbedb8 hostevends_sdl: Check all modifier keys.
When checking if certain modifier keys are being pressed, also make sure that all other modifier keys are not being pressed.
2025-04-18 18:51:47 -07:00
joevt 36c7c807a4 display: Add update_window_title and window event.
update_window_title can be used to update statistics about the display (such as display resolution) or about DingusPPC in general (such as "mouse grabbed" status).

A DPPC_WINDOWEVENT_MOUSE_GRAB_CHANGED window event is added so that Display::handle_events can update the "mouse grabbed" indicator in each display window. The event handler doesn't check the window ID because the status should be reflected in all windows.

The SDL_WINDOWEVENT_SIZE_CHANGED event causes the window to update the display resolution indicator.

In the future, we might add indicators for HD and CD and floppy disk activity, etc. They will be handled by a window event handler or a general DPPC event handler.
2025-04-18 07:20:49 -07:00
Rairii 61a8402f84 hostevents_sdl: Ralt+delete to ctrl+alt+del.
"Right Option + Forward Delete" is translated to "Control + Right Option + Backspace".
2025-04-18 07:20:46 -07:00
joevt 28c50a2018 hostevents: Spaces. 2025-04-04 20:52:05 -07:00
dingusdev 8de2c9dafc Start i18n 2025-01-29 21:14:36 -07:00
Mihai Parparita fc13f6870b Enable HiDPI mode for SDL and ensure that we use nearest-neighbor scaling
Avoids blurriness on macOS hosts with Retina displays.

Smooth scaling can be toggled back on via control-S
2024-11-09 15:48:00 -08:00
Keith Kaisershot d23f21b391 sdl: handle gamepad events
Add new GamepadButton enum with bits corresponding to AppleJack button bits.
Both the AppleJack controller and the SDL GameController coincidentally define
one d-pad, two shoulder buttons, four face buttons, and three system buttons.
This makes mapping modern game controllers to the AppleJack straightforward.
2024-10-06 23:28:05 -07:00
joevt f09710a5f7 viacuda: Do shutdown.
Shutdown will enter the debugger or quit depending on the execution mode.
Quit is different from shutdown since it is triggered outside the guest by using the host Quit menu item.
2024-08-31 18:09:12 -07:00
dingusdev 2a8e5538b2 Partially addressing Issue #109
It'll be better to use a keycode file in the future. This will hopefully do for now.
2024-08-04 15:02:48 -07:00
dyharlan 7ba7bff3d5 Do not test for equality when checking if ctrl is pressed.
The initial change I committed worked fine before.
2024-07-11 10:38:57 +08:00
dingusdev 40b537767d Update hostevents_sdl.cpp
A further fix by dyharlan to fix the mouse grabbing
2024-07-10 07:51:23 -07:00
dyharlan 0267fc82c9 fix indent of change 2024-07-10 19:03:37 +08:00
dyharlan c4022f466f Fix modstate bug preventing mousegrab 2024-07-10 18:54:05 +08:00
joevt 59fba285b5 adbmouse: Add tablet and more bits and buttons.
Add absolute coordinates for tablets. Absolute coordinates is relative to window so it can't work for multiple displays? Doesn't work for single display without mouse driver modification.
Add arbitrary number of buttons. Previously, only one mouse button was supported.
Add arbitrary number of bits. Previously, only 7 bits per axis was supported which is good enough for relative movement but not absolute movement.
2024-05-06 06:49:15 -07: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
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 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
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