Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Apr 25, 2023
2 parents bc77f65 + b199f3c commit 054b2d4
Show file tree
Hide file tree
Showing 56 changed files with 666 additions and 348 deletions.
33 changes: 33 additions & 0 deletions Documentation/HowTo/NullModemCable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Connecting Two Amigas

vAmiga supports two emulator instances to be connected with a null modem cable, allowing the user to run multiplayer games. In this article we will walk through the necessary steps to connect two emulator instances running Battle Chess.

First of all, launch vAmiga, open the configuration window and switch to the Peripherals tab. In this tab you can configure the serial interface:

![Peripherals Tab](images/battlechess1.png "Peripherals Tab")

Now open the serial port popup menu and select *Null Modem Cable* from the options list. This will connect one side of a null modem cable to the serial port of your virtual Amiga. Internally, the null modem cable is emulated using socket connections, which means that the connected Amigas must agree on a common port number to communicate. By default, vAmiga uses port 8080, but you can choose a different port if you like.

![Peripherals Tab](images/battlechess2.png "Peripherals Tab")

As you can see in the screenshot above, a small icon has appeared in the status bar. This indicates that the socket server has been activated and is waiting for another emulator instance to connect.

Now launch another instance of vAmiga and connect the null modem cable the same way.

![Peripherals Tab](images/battlechess3.png "Peripherals Tab")

After the null modem cable has been selected in the second emulator instance, the status icon has changed its shape, indicating that the connection has been established. If the icon looks different on your computer, please check if both emulator instances are listening to the same socket port.

Now it's time to load Battle Chess on both Amigas. The configuration of the null modem cable is quite simple in this game: The the *Settings* menu let's you select the player type for each side of the board.

This is how I configured the first emulator instance. The Amiga controls the blue army, the connected computer controls the red army.

![Battle Chess Setup](images/battlechess4.png "Battle Chess Setup")

The second emulator instance is configured the other way around. The Amiga controls the red soldiers, the connected computer controls the blue ones. After selecting *New Game* from the menu in either emulator instance, it's time to chill. Have fun with two vAmigas fighting each other.

## Troubleshooting

If everything works as expected, the socket connection should be established exactly as described above. If vAmiga refuses to connect, you can display some additional debug information in RetroShell. To do so, open RetroShell by pressing on the corresponding toolbar icon. Inside RetroShell, switch to the *Debugger* by pressing the *Shift + Return*. Now, type `server serial` as shown in the screenshot below. This command displays the current connection status and outputs some statistical information about the transferred data.

![RetroShell](images/battlechess5.png "RetroShell")
Binary file added Documentation/HowTo/images/battlechess1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/HowTo/images/battlechess2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/HowTo/images/battlechess3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/HowTo/images/battlechess4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/HowTo/images/battlechess5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Emulator/Base/CoreComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class CoreComponent : public CoreObject, NoCopy, NoAssign {
* inspection target via Amiga::setInspectionTarget().
*/
void inspect() const;
virtual void _inspect() const { };
virtual void _inspect() const { }

/* Base method for building the class specific getInfo() methods. When the
* emulator is running, the result of the most recent inspection is
Expand Down
2 changes: 0 additions & 2 deletions Emulator/Base/CoreComponentTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ enum_long(OPT)
// Paula audio
OPT_SAMPLING_METHOD,
OPT_FILTER_TYPE,
OPT_FILTER_ACTIVATION,
OPT_AUDPAN,
OPT_AUDVOL,
OPT_AUDVOLL,
Expand Down Expand Up @@ -250,7 +249,6 @@ struct OptionEnum : util::Reflection<OptionEnum, Option>

case OPT_SAMPLING_METHOD: return "SAMPLING_METHOD";
case OPT_FILTER_TYPE: return "FILTER_TYPE";
case OPT_FILTER_ACTIVATION: return "FILTER_ACTIVATION";
case OPT_AUDPAN: return "AUDPAN";
case OPT_AUDVOL: return "AUDVOL";
case OPT_AUDVOLL: return "AUDVOLL";
Expand Down
3 changes: 1 addition & 2 deletions Emulator/Base/Defaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ Defaults::Defaults()
setFallback(OPT_AUTOFIRE_BULLETS, -3);
setFallback(OPT_AUTOFIRE_DELAY, 125);
setFallback(OPT_SAMPLING_METHOD, SMP_NONE);
setFallback(OPT_FILTER_TYPE, FILTER_BUTTERWORTH);
setFallback(OPT_FILTER_ACTIVATION, FILTER_AUTO_ENABLE);
setFallback(OPT_FILTER_TYPE, FILTER_A500);
setFallback(OPT_AUDPAN, { 0, 3 }, 50);
setFallback(OPT_AUDPAN, { 1, 2 }, 350);
setFallback(OPT_AUDVOL, { 0, 1, 2, 3 }, 100);
Expand Down
4 changes: 3 additions & 1 deletion Emulator/Components/Agnus/Agnus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ Agnus::executeUntil(Cycle cycle) {
if (isDue<SLOT_MSE2>(cycle)) {
controlPort2.mouse.serviceMouseEvent <SLOT_MSE2> ();
}
if (isDue<SLOT_RSH>(cycle)) {
retroShell.serviceEvent();
}
if (isDue<SLOT_KEY>(cycle)) {
keyboard.serviceKeyEvent();
}
Expand Down Expand Up @@ -662,7 +665,6 @@ Agnus::eofHandler()
copper.eofHandler();
controlPort1.joystick.eofHandler();
controlPort2.joystick.eofHandler();
retroShell.eofHandler();

// Update statistics
updateStats();
Expand Down
10 changes: 10 additions & 0 deletions Emulator/Components/Agnus/AgnusInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,16 @@ Agnus::eventName(EventSlot slot, EventID id)
}
break;

case SLOT_RSH:

switch (id) {

case EVENT_NONE: return "none";
case RSH_WAKEUP: return "RSH_WAKEUP";
default: return "*** INVALID ***";
}
break;

case SLOT_KEY:

switch (id) {
Expand Down
6 changes: 6 additions & 0 deletions Emulator/Components/Agnus/AgnusTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ enum_long(SLOT)
SLOT_HD3, // Hard drive Hd3
SLOT_MSE1, // Port 1 mouse
SLOT_MSE2, // Port 2 mouse
SLOT_RSH, // Retro Shell
SLOT_KEY, // Auto-typing
SLOT_WBT, // Warp boot
SLOT_SRV, // Remote server manager
Expand Down Expand Up @@ -162,6 +163,7 @@ struct EventSlotEnum : util::Reflection<EventSlotEnum, EventSlot>
case SLOT_HD3: return "HD3";
case SLOT_MSE1: return "MSE1";
case SLOT_MSE2: return "MSE2";
case SLOT_RSH: return "RSH";
case SLOT_KEY: return "KEY";
case SLOT_WBT: return "WBT";
case SLOT_SRV: return "SRV";
Expand Down Expand Up @@ -362,6 +364,10 @@ enum_i8(EventID)
MSE_RELEASE_RIGHT,
MSE_EVENT_COUNT,

// Retro shell
RSH_WAKEUP = 1,
RSH_EVENT_COUNT,

// Auto typing
KEY_PRESS = 1,
KEY_RELEASE,
Expand Down
10 changes: 4 additions & 6 deletions Emulator/Components/Amiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ Amiga::getConfigItem(Option option) const
case OPT_SAMPLING_METHOD:
case OPT_AUDVOLL:
case OPT_AUDVOLR:

case OPT_FILTER_TYPE:

return paula.muxer.getConfigItem(option);

case OPT_BLITTER_ACCURACY:
Expand Down Expand Up @@ -367,8 +368,6 @@ Amiga::getConfigItem(Option option, long id) const

case OPT_AUDPAN:
case OPT_AUDVOL:
case OPT_FILTER_TYPE:
case OPT_FILTER_ACTIVATION:

return paula.muxer.getConfigItem(option, id);

Expand Down Expand Up @@ -621,7 +620,6 @@ Amiga::configure(Option option, i64 value)

case OPT_SAMPLING_METHOD:
case OPT_FILTER_TYPE:
case OPT_FILTER_ACTIVATION:
case OPT_AUDVOLL:
case OPT_AUDVOLR:

Expand Down Expand Up @@ -974,10 +972,10 @@ Amiga::_dump(Category category, std::ostream& os) const

os << tab("Machine type");
os << VideoFormatEnum::key(config.type) << std::endl;
os << tab("Warp boot");
os << dec(config.warpBoot) << " seconds" << std::endl;
os << tab("Warp mode");
os << WarpModeEnum::key(config.warpMode) << std::endl;
os << tab("Warp boot");
os << dec(config.warpBoot) << " seconds" << std::endl;
os << tab("Sync mode");
os << SyncModeEnum::key(config.syncMode);
if (config.syncMode == SYNC_FIXED_FPS) os << " (" << config.proposedFps << " fps)";
Expand Down
1 change: 0 additions & 1 deletion Emulator/Components/Amiga.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ class Amiga : public Thread {
Snapshot *autoSnapshot = nullptr;
Snapshot *userSnapshot = nullptr;


typedef struct { Cycle trigger; i64 payload; } Alarm;
std::vector<Alarm> alarms;

Expand Down
Loading

0 comments on commit 054b2d4

Please sign in to comment.