MartySama v5.8 p23 Compatibility Notes
I successfully integrated this Switchbot package into MartySama v5.8 p23.
The package works, but several compatibility adjustments were required to make it fully
stable on this source.
To help anyone using the same base, here are the most important points from my experience.
1. input_main.cpp
One of the most important changes was made inside input_main.cpp.
The original Switchbot() packet handling was not fully compatible with MartySama's packet structure.
During the first tests I experienced:
packet synchronization issues,
buffer_read_proceed errors,
unnecessary syserr logs.
I rewrote the packet handling to match MartySama's original packet flow, and all packet-related issues disappeared.
2. Database Synchronization
The database queries had to be adjusted to properly support the SWITCHBOT window.
Without these changes, Switchbot items could disappear from the client after:
relog,
warp,
character selection,
reconnect.
The items still existed in the database, but they were not synchronized correctly with the client.
After adjusting the database queries, this issue was completely resolved.
3. Switchbot Synchronization
This was the most time-consuming part of the integration.
At first I tried forcing synchronization by adding additional SendSwitchbotUpdate() calls.
Although this looked like a possible solution, on MartySama it introduced new problems such as:
packet synchronization issues,
unstable client updates,
connection problems,
and in some cases even channel crashes.
The most stable solution was to keep MartySama's original synchronization flow and avoid sending unnecessary update packets.
4. Start / Stop Handling
Some sys_err() messages were generated during completely normal user actions.
For example:
pressing Start on an already running slot,
pressing Stop on an inactive slot.
These are not real errors, so I removed the unnecessary sys_err() messages to keep the logs clean.
5. Locale String Parameters
Be careful with the parameter order inside locale strings.
Example:
Bonuschange of %s (Slot: %d) successfully finished.
The source sends the parameters in this order:
%s
%d
If you change the translation to use:
%d
%s
the parameter order no longer matches the source and snprintf() will crash with a SIGSEGV (Segmentation Fault).
If you want a different message format, create a new locale key or modify the source accordingly instead of changing the placeholder order.
6. Testing
The following scenarios were tested successfully:
Multiple Switchbot slots running simultaneously.
Long-term bonus switching.
Warp.
Relog.
Character selection.
Reconnect.
Switch item synchronization.
Bonus completion notifications.
Chat notifications.
PM notifications.
After these adjustments I did not experience any item loss or synchronization issues.
The
system has been stable during long-term testing.
Final Notes
The package itself works well.
However, MartySama has several implementation differences, so I strongly recommend reviewing:
packet handling,
database synchronization,
item synchronization,
instead of simply copying the files.
After making these compatibility adjustments, the package has been stable on MartySama v5.8 p23.
Important
The most difficult part of this integration was item synchronization.
Even if everything appears to work correctly at first, make sure you also test:
Warp
Relog
Character selection
Reconnect
Long-term Switchbot usage
Many synchronization issues only become visible after testing these scenarios.
Do not assume the integration is fully stable until every one of these cases has been verified.