A lot of my posts on here, especially the ones where i’m talking about adding support for a new title, will end up with me saying “and then the game sends a request” as if that’s a thing that just happens. It isn’t. Between the game deciding it wants a profile and my server seeing a <call> element there are about four layers of stuff, and i’ve decided that it’s best if i get this out of the way before any newer posts or more confusion.
So this is the layers. What the libraries are, what AVS is, what kbin is, and how the requests are “encrypted”. The scare quotes are doing a lot of work there and we’ll get to why.
Everything here is from reconstructing it against real games and a real server, which is submergeserenade, the C# thing i keep talking about. Nothing here is guesswork. Well, some of it is guesswork that later turned out to be right, which i’d say is not the same thing.
The libraries: what’s actually in the modules folder
Open any e-amusement title’s root directory (or modules/ if you’re some kind of monster) and you’ll see roughly the same cast, regardless of whether the game is from 2012 or yesterday:
avs2-core.dll
avs2-ea3.dll
libavs-win32.dll (older titles)
libavs-win32-ea3.dll (older titles)
gdxg.dll / bm2dx.dll / soundvoltex.dll / ...
The naming shifted somewhere around the AVS 2.14 era: libavs-win32-ea3.dll became avs2-ea3.dll. But they’re the same two things wearing different hats. The important observation is the following split:
- the AVS core is the platform. Filesystem, threading, logging, memory, configuration, and the property-tree API that everything else relies on.
- the ea3 library is the network layer. It knows what e-amusement is, how to talk to it, and how to bring the game up as a networked terminal.
- the game DLL is the only part that differs between titles, and it is enormous compared to the other two. This is the thing i spend all my time in IDA reading.
The game DLL does not implement HTTP. It does not implement encryption. It does not implement the binary format. It calls into ea3 with a property tree and gets a property tree back, and everything between those two points is title-independent. Which is the whole reason a universal server is possible at all: i only had to reverse the transport once, and every game i’ve added since then just reuses the exact same envelope code.
AVS: the platform nobody asked for
AVS stands for, depending on who you ask and how confident they sound, “Arcade Virtual System” or some variation thereof. Konami has never told anyone. What it demonstrably is, is a portability layer: a small operating-system-shaped API that games target instead of targeting Windows directly. Filesystem access goes through AVS. Config goes through AVS. Logging goes through AVS.
The part that matters for the network is the property tree. AVS has a typed, hierarchical data structure made up of nodes, attributes, typed values. This is, to keep it with the trees, the root of what our server is trying to work with. games send property trees, similar to this one:
node = property_node_create(prop, parent, PROPERTY_TYPE_NODE, "pcdata");
property_node_create(prop, node, PROPERTY_TYPE_STR, "name", player_name);
property_node_create(prop, node, PROPERTY_TYPE_S32, "spnum", play_count);
and read them back the same way, one typed field at a time. When i wrote about GITADORA’s gametop.get parser being 264 sequential typed reads with an all-or-nothing failure counter, that is what those reads are. Each one is an AVS property-tree access with an explicit type constant and an explicit buffer size.
This matters for a practical reason. Because the tree is typed at every node, a response isn’t just “the right field names”. It’s the right field names with the right types, and the game will reject s32 where it wanted u8 as readily as it rejects a missing field. Half of my debugging over the last years has been type mismatches that look identical in the logs.
The other thing about AVS, and the thing that makes reading it in IDA miserable, is that it exports everything under obfuscated names. avs2-core.dll exports XCgsqzn00000af and friends, and the games import most of them by ordinal only, so even the useless names don’t make it into the import table. You identify functions by how they’re called: argument count, argument shapes, the type constant in r9d, the buffer size on the stack. I have a mapping table i’ve built up over time and it is one of the more valuable files i own.
The boot entry point is obfuscated the same way, and worse, the symbol changes every AVS version:
| AVS version | boot symbol |
|---|---|
| legacy | ea3_boot |
| 2.13.6.0 | XEb552d500005d |
| 2.14.3.0 | XE7aee11000070 |
| 2.15.8.0 | XE592acd00008c |
| 2.16.x | XEyy2igh000007 |
| 2.17.x | XEmdwapa000024 |
Loaders handle this by reading the DLL’s PE version string, and when that doesn’t match anything known, just brute-forcing it: GetProcAddress every boot symbol in the table until one resolves. Which tells you how much of a security measure this actually is. It’s a speed bump at best, and a “slow down” sign at worst.
I keep calling this obfuscation rather than protection, deliberately. The content protection on these games, you know, the dongle, the RSA, the key hierarchy. That’s all genuinely good, and i say that as someone who wrote their university thesis on it. The network side is not that. It’s a different threat model and Konami clearly knew it.
The game’s identity
Before anything goes on the wire, the runtime needs to know who the game claims to be. This comes out of prop/ea3-config.xml:
pcbid- the board identifier, think of it like windows’ HWID, a unique code for each machine, and we use it for authentication, logging, stats and banshardid- a hardware identifier, again, a serial number derived from stuff in the cabsoftid- the software/licence identifieraccountid- for entitlement checks on konami’s real servers- the software descriptor
model:dest:spec:rev:ext, plus a “security code” derived from it
The bootstrap reads these and shoves them into the AVS environment:
avs_std_setenv("/env/profile/system_id", EA3_PCBID);
avs_std_setenv("/env/profile/hardware_id", EA3_HARDID);
avs_std_setenv("/env/profile/license_id", EA3_SOFTID);
Here’s the thing that took me embarrassingly long to internalise: none of this is cryptographic. There’s no challenge, no signature, no key material bound to the dongle. A pcbid is just a string. If your server accepts the string, the game is in. Defaults like 0100DEADBEEF for hardid exist precisely because nothing checks.
Which is why my server’s BanService works the way it does. It matches on srcid (which is interchangeable with the pcbid) and refuses the request:
if (_bans is not null && await _bans.GetActiveBanAsync(srcId, gameCode) is { } ban)
{
_logger.LogWarning("Rejected {Module}.{Method} from blocked PCBID {SrcId} ({Game}): {Reason}",
module, method, srcId, ban.Game ?? "all games", ban.Reason);
throw new PcbidBannedException(srcId!, ban);
}
That’s the entire enforcement mechanism available to me, because that’s the entire identity the protocol carries. A banned cab changing one line of its config is a new cab, that will get rejected unless it’s also on my server. But i’m fine with this, my server is not a commercial operation, and it never will be. It’s still worth being honest about what the ban actually does.
The transport: HTTP. in the BIG 2026, STILL without TLS
The games speak plain HTTP. Not HTTPS. Current-generation titles, shipping today, POST to port 80 in cleartext-with-extra-steps. The request body is the payload, the response body is the reply, and that’s the whole framing.
Two transforms get applied to every payload, in a fixed order: compress, then encrypt. So what’s on the wire is encrypt(compress(plaintext)) and you unwrap it as decrypt(decompress(wire)). Both are announced in HTTP headers, which is enormously convenient, and extremely insecure and made reconstructing this a lot faster than it had any right to be.
Compression: X-Compress
The header takes none or lz77. Despite the name, it’s LZSS-shaped: a repeating cycle of one 8-bit flag byte followed by up to eight tokens. A set bit means “the next byte is a literal”. A clear bit means “the next two bytes are a back-reference”, packed as pppppppp ppppllll, or, twelve bits of window offset, four bits of length.
My decompressor is a direct transcription of that:
var lookbackFlag = (data[offset] << 8) | data[offset + 1];
var lookbackLength = (lookbackFlag & 0x000F) + 3;
var lookbackOffset = lookbackFlag >> 4;
offset += 2;
The + 3 is because a back-reference shorter than three bytes would cost more than it saves, so the length field is biased.
What i want to point out is my compressor:
private byte[] CompressLZ77(byte[] data)
{
return data;
}
That’s not laziness, or at least it’s not only laziness. Compression is negotiated per-direction, and nothing obliges the server to compress its responses. I never set X-Compress on the way out, so the game never decompresses, so the identity function is a correct implementation. There’s also a nicer trick if you do need to emit a compressed stream during bring-up: emit 0xFF as the flag byte before every group of eight literals. Every bit set, every token a literal, technically a valid LZ77 stream, zero actual compression. Costs you one byte in nine and saves you writing a matcher.
Encryption: RC4, with a key that even the mailman knows
Encryption happens after compression and it’s RC4. Symmetric, so encrypt and decrypt are the same function:
private byte[] DecryptEamuse(byte[] data, byte[] key) => EamuseARC4(data, key);
private byte[] EncryptEamuse(byte[] data, byte[] key) => EamuseARC4(data, key);
The interesting part is the keying. There’s no single static key; every request and every response carries its own, derived from the X-Eamuse-Info header. That header looks like:
X-Eamuse-Info: 1-68d78a3c-4f21
Format is version-seconds-salt: eight hex digits of Unix timestamp, four hex digits of salt. Six raw bytes once you decode them. The per-packet key is then
key = MD5( seconds_bytes || salt_bytes || ENC_KEY )
where ENC_KEY is a fixed 26-byte constant. 6 plus 26 is 32 bytes, MD5’d down to the sixteen-byte RC4 key. Here it is:
var internalKeyHex = "69D74627D985EE2187161570D08D93B12455035B6DF0D8205DF5";
var internalKey = Convert.FromHexString(internalKeyHex);
var combinedKey = new byte[eamuseKey.Length + internalKey.Length];
Array.Copy(eamuseKey, 0, combinedKey, 0, eamuseKey.Length);
Array.Copy(internalKey, 0, combinedKey, eamuseKey.Length, internalKey.Length);
byte[] finalKey;
using (var md5 = System.Security.Cryptography.MD5.Create())
{
finalKey = md5.ComputeHash(combinedKey);
}
return StandardARC4(data, finalKey);
That constant is the same across every title in this lineage. IIDX 21 from 2013 and the game that just shipped a bit ago both use the identical 26 bytes. It has been public in community analysis for over a decade.
And the original, from the ea3 library, is about as small as you’d expect:
int xrpc_crypt(char *packet, size_t packet_len, const char *xeamuse_info) {
char md5_key[16];
char key[32];
if (copy_from_hex(key, 4, xeamuse_info) == -1) return -1;
if (xeamuse_info[8] != '-') return -1;
if (copy_from_hex(key + 4, 2, xeamuse_info + 9) == -1) return -1;
memcpy(key + 6, ENC_KEY, 26);
md5(key, 32, md5_key);
arc4(packet, packet_len, md5_key, 16);
return 0;
}
Generating the header on my side is three lines and one of them is a call to random:
private string GenerateEamuseInfo()
{
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
var random = Random.Shared.Next(0x0000, 0xFFFF);
return $"1-{timestamp:x8}-{random:x4}";
}
The game’s own salt generator is funnier. It’s a linear congruential generator with glibc’s constants, stepped twice per call, with a second generator supplying the top two bytes:
uint32_t PRNG_STATE = 0x41c64e6d;
uint32_t prng() {
int upper = (PRNG_STATE * 0x838c9cda) + 0x6072;
PRNG_STATE = (PRNG_STATE * 0x41c64e6d + 0x3039) * 0x41c64e6d + 0x3039;
return (upper & 0x7fff0000) | (PRNG_STATE >> 0xf & 0xffff);
}
Stepping an LCG twice buys you nothing. This is exactly as predictable as a single LCG of the same width, just with more multiplications. And where a normal LCG throws away the low bits as the least random ones, this keeps them, because it’s using the upper bytes of the state.
None of which matters, and that’s the actual point. The salt doesn’t need to be unpredictable. ENC_KEY is a known constant and the derivation is fully specified by a header the packet carries in cleartext, so anyone who knows the constant decrypts everything. The transport gives you framing and some obfuscation, but gives you zero confidentiality against anyone who can read a wiki page.
Despite dogging on konami pretty hard, i find this genuinely reasonable engineering, incidentally. They spent their crypto budget on the dongle, where they actually needed it, and shipped an obfuscation layer on the network where they didn’t. I’d say that only one of those two decisions has held up, but considering we’re talking about encrypted libraries that should be inside these games, i’d say neither held up.
kbin: XML that went to compression school
Under the envelope, the payload is a document that is logically XML but is carried as a compact binary encoding. Konami binary XML, universally called kbin.
A kbin document opens with four bytes:
| byte | meaning |
|---|---|
| 0 | signature, always 0xA0 |
| 1 | compression flag - 0x42 means node names are packed |
| 2 | string encoding |
| 3 | bitwise complement of byte 2, as a header checksum |
The encodings are Latin-1 (0x00/0x40), ASCII (0x20), EUC-JP (0x60), Shift-JIS (0x80) and UTF-8 (0xA0). EUC-JP and Shift-JIS are there because these are Japanese arcade machines and player names have kanji in them. My server writes Shift-JIS and has a CodePagesEncodingProvider.Instance registration in Program.cs purely because .NET dropped Shift-JIS from the default set.
Detecting kbin in the wild is that first byte pair:
isBinXml = xmlData.Length >= 2 && xmlData[0] == 0xA0 && (xmlData[1] == 0x42 || xmlData[1] == 0x45);
After the header come two length-prefixed sections, big-endian throughout. A node section carrying the structure: elements, attributes, value types, and a data section holding the actual values, which the node section points into by offset. Splitting structure from data is what makes the format both compact and streamable.
Inside the node section, control bytes carry the shape:
| byte | meaning |
|---|---|
0x01 |
open a node |
0x2E |
attribute |
0xBE |
close node |
0xBF |
end of document |
Anything else is a type tag, and the 0x40 bit on a tag flags the value as an array. The tags are the same u8/u16/u32/s32/str/bin/ip4/float/double set that appears as __type annotations in the plaintext XML these games ship on disk. The network protocol and the on-disk manifests share one type system, which is a nice confirmation that you’ve read the format correctly.
Then there’s one of my favourite details in the entire stack. Element and attribute names aren’t stored as text. They’re packed six bits per character, out of a 63-symbol alphabet:
0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz
Four characters in three bytes. This is the “SixBit” packing that the 0x42 header flag announces. And it explains something i’d noticed long before i understood it: Konami’s schemas only ever use those characters in tag names. No hyphens, no dots, no anything outside that alphabet, ever, in any title. Rather elegant, despite everything said so far
The type-plus-sixbit combination is also why a response has to be built structurally rather than as a string. My server has a tiny helper for it:
public static XElement E(string tag, object value, string type)
{
return new XElement(tag, new XAttribute("__type", type)) { Value = Stringify(value) };
}
and the conversion to kbin is one call in the response path:
var writeOptions = new WriteOptions { Compress = true, RepairedPrefix = "_" };
responseData = KbinConverter.Write(responseXml, KnownEncodings.ShiftJIS, writeOptions);
I used to have a hand-rolled KBinXML class doing this. It worked, when it wanted to, and then i found KbinXml.Net on nuget and deleted about eight hundred lines. RepairedPrefix = "_" is there because the sixbit alphabet can’t represent a tag starting with a digit, so the library renames them on the way in and back on the way out.
The message shape, and how a server dispatches
At the top level, every request is a <call>:
<call model="LDJ:J:E:A:2026011300" srcid="0100DEADBEEF">
<IIDX33pc method="get" cid="..."/>
</call>
The model attribute is colon-delimited model:dest:spec:rev:ext:
LDJis the game. IIDX isLDJ, SDVXKFC, DDRMDX, GITADORAM32, DANCERUSHREC.Jis the region, most games run on J for Japan, but sdvx also supports U for USA and K for korea, with minor changes in theEis supposedly the spec type, i’m still figuring that one out. I know it toggles cab type on SDVXAhardware revision, hardly ever seen games with a different letter than A2026011300is the datecode,yyyymmddplus a build number
srcid is the pcbid. Then exactly one child element, whose name is the module and whose method attribute is the operation. A service is the pair (module, method): pcbtracker/alive, services/get, cardmng/inquire, IIDX33pc/get.
So a server dispatches on that pair, and mine does it by rewriting the URL path in middleware before ASP.NET routing ever sees it. Games POST to a bare /core, i peek at the decoded document and turn it into a real route:
var gameRequest = await processor.ProcessRequestAsync(context.Request);
if (!string.IsNullOrEmpty(gameRequest.Module) && gameRequest.Module != "services")
{
var method = string.IsNullOrEmpty(gameRequest.Method) ? "get" : gameRequest.Method;
context.Request.Path = $"{originalPath}/{gameRequest.Model}/{gameRequest.Module}/{method}";
}
/core becomes /core/LDJ/IIDX33pc/get, and from there it’s just a controller:
[HttpPost]
[Route("{gameinfo}/pcbtracker/alive")]
public async Task<IActionResult> Alive(string gameinfo)
Which means adding a service is writing a method with the right route attribute, and every piece of envelope handling below it is already done. That’s the payoff for reversing the transport once.
The datecode gets mapped to a version number in one big switch, because a game’s protocol changes between versions and LDJ alone doesn’t tell you whether you’re talking to IIDX 30 or 33:
"LDJ" => ext switch
{
>= 2025090300 and <= 2026090400 => 33,
>= 2024100900 and <= 2025041500 => 32,
>= 2023101800 and <= 2024082600 => 31,
// ...
}
Those ranges are hand-assembled from every build i’ve ever seen, and every new datecode that shows up is a small manual edit. It’s ugly and i have not found anything better.
Boot, from the server’s side
Put it together and a cab coming online looks like this:
services/get: the game asks for the service directory and gets back a list of<item name= url=>pairs telling it where every other module lives. This is the one hardcoded endpoint; everything after it is wherever this response says it is. My server points nearly all of them at its own/core.pcbtracker/alive: the heartbeat.status="0", anexpire, andecenablewhich is how i implement maintenance mode: flip it to0and every cab on the network politely stops taking credits.facility/get,message/get,package/list: the operator-side furniture. Location, region, shop settings.cardmng/inquire: a card gets tapped, the game asks whether it knows this one, or whether we are meeting someone new for the first time.- the game module:
IIDX33pc/get,galaxywave_gametop/get, whatever this title calls its profile load. This is where all the per-title work lives, and it’s ninety-nine percent of the reversing effort.
Steps 1 through 4 are the same code for every game i support. Step 5 is a new controller, a new service class, and usually a week of staring at IDA.
So what’s actually hard here
Not the transport. The transport is a known constant, MD5, RC4, and a compression format from the 1980s, and once it’s written it never changes. Not kbin either, since that’s a real library now and someone else maintains it.
What’s hard is step 5 every single time. The envelope is universal, the schemas are not, and each title has its own set of several hundred typed fields that must all be present, all correctly typed, and sometimes in the right order, with a parser that returns a single boolean for the whole document. More often than not, you get no error message; the game still gladly boots to attract but breaks everything after it, and you get to figure out which of the countless fields you got wrong.
That’s the part i’ll keep writing posts about. This is the root of all evil.