From 61fd25fa51d82ed583616b6a5531a9795461db8f Mon Sep 17 00:00:00 2001
From: Bottersnike "
+ proto = TEMPLATES + "/" + PAGES_BASE + "/proto"
+ for base, _, files in os.walk(proto):
+ prefix = base[len(proto):].replace("\\", "/").strip("/")
+ if prefix:
+ prefix = prefix.replace("/", ".") + "."
+ for i in files:
+ delim = "_" if prefix else "."
+ href = f"{ROOT}/proto{base[len(proto):]}/{i}"
+ output += f"
"
+
@app.route("/styles.css")
def styles():
return send_from_directory(".", "styles.css")
+@app.route("/tango.css")
+def tango():
+ return send_from_directory(".", "tango.css")
-for base, folders, files in os.walk("images"):
- for name in files:
- def handler(base, name):
- def handler():
- return send_from_directory(base, name)
- return handler
- local_base = base.replace("\\", "/").strip(".").strip("/")
- route = local_base + "/" + name
- if not route.startswith("/"):
- route = "/" + route
+for i in STATIC:
+ for base, _, files in os.walk(i):
+ for name in files:
+ def handler(base, name):
+ def handler():
+ return send_from_directory(base, name)
+ return handler
+ local_base = base.replace("\\", "/").strip(".").strip("/")
+ route = local_base + "/" + name
+ if not route.startswith("/"):
+ route = "/" + route
- handler = handler(base, name)
- handler.__name__ == route
- app.add_url_rule(route, route, handler)
+ handler = handler(base, name)
+ handler.__name__ == route
+ app.add_url_rule(route, route, handler)
-TEMPLATES = "templates"
-PAGES_BASE = "pages"
-for base, folders, files in os.walk(TEMPLATES + "/" + PAGES_BASE):
+
+for base, _, files in os.walk(TEMPLATES + "/" + PAGES_BASE):
if ".git" in base:
continue
if base.startswith(TEMPLATES):
@@ -36,7 +77,11 @@ for base, folders, files in os.walk(TEMPLATES + "/" + PAGES_BASE):
if name.endswith(".html"):
def handler(base, name):
def handler():
- return render_template(os.path.join(base, name).strip("/").replace("\\", "/"), ROOT=os.environ.get("EA_ROOT"))
+ return render_template(
+ os.path.join(base, name).strip("/").replace("\\", "/"),
+ ROOT=ROOT,
+ generate_xrpc_list=generate_xrpc_list
+ )
return handler
local_base = base.replace("\\", "/").strip(".").strip("/")
@@ -54,26 +99,27 @@ for base, folders, files in os.walk(TEMPLATES + "/" + PAGES_BASE):
app.add_url_rule(route, route, handler)
-from flask import url_for
-def has_no_empty_params(rule):
- defaults = rule.defaults if rule.defaults is not None else ()
- arguments = rule.arguments if rule.arguments is not None else ()
- return len(defaults) >= len(arguments)
-@app.route("/site-map")
-def site_map():
- links = []
- for rule in app.url_map.iter_rules():
- # Filter out rules we can't navigate to in a browser
- # and rules that require parameters
- if "GET" in rule.methods and has_no_empty_params(rule):
- url = url_for(rule.endpoint, **(rule.defaults or {}))
- links.append((url, rule.endpoint))
- return str(links)
+# from flask import url_for
+# def has_no_empty_params(rule):
+# defaults = rule.defaults if rule.defaults is not None else ()
+# arguments = rule.arguments if rule.arguments is not None else ()
+# return len(defaults) >= len(arguments)
+# @app.route("/site-map")
+# def site_map():
+# links = []
+# for rule in app.url_map.iter_rules():
+# if "GET" in rule.methods and has_no_empty_params(rule):
+# url = url_for(rule.endpoint, **(rule.defaults or {}))
+# links.append((url, rule.endpoint))
+# return str(links)
+
if __name__ == '__main__':
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.config['DEBUG'] = True
- server = Server(app.wsgi_app)
- server.watch("templates")
- server.serve(port=3000)
\ No newline at end of file
+ app.run(debug=True, port=3000, host="0.0.0.0")
+
+ # server = Server(app.wsgi_app)
+ # server.watch(".")
+ # server.serve(port=3000)
\ No newline at end of file
diff --git a/styles.css b/styles.css
index 357e06b..0ab7986 100644
--- a/styles.css
+++ b/styles.css
@@ -14,6 +14,7 @@ table {
overflow-x: auto;
display: block;
}
+
table.code {
font-family: monospace;
}
@@ -28,9 +29,11 @@ td {
padding: 2px;
min-width: 32px;
}
+
table:not(.code) td {
padding: 2px 6px;
}
+
table.code td {
text-align: center;
}
@@ -54,13 +57,16 @@ code {
border-radius: 4px;
word-break: break-word;
}
-td > code {
+
+td>code {
word-break: normal;
}
-code > a {
+
+code>a {
color: inherit;
}
-pre > code {
+
+pre>code, .highlight {
display: block;
word-break: normal;
border-radius: 4px;
@@ -72,6 +78,14 @@ pre > code {
line-height: 1.4;
width: min-content;
}
+
+pre>.highlight {
+ margin-bottom: -16px;
+}
+.highlight>pre {
+ margin: 0;
+}
+
pre {
max-width: 100%;
overflow-x: auto;
@@ -90,4 +104,4 @@ details {
margin: 4px 0;
overflow-x: auto;
max-width: 100%;
-}
+}
\ No newline at end of file
diff --git a/tango.css b/tango.css
new file mode 100644
index 0000000..b0ec841
--- /dev/null
+++ b/tango.css
@@ -0,0 +1,77 @@
+.highlight .hll { background-color: #ffffcc }
+.highlight { background: #f8f8f8; }
+.highlight .c { color: #8f5902; font-style: italic } /* Comment */
+.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
+.highlight .g { color: #000000 } /* Generic */
+.highlight .k { color: #204a87; font-weight: bold } /* Keyword */
+.highlight .l { color: #000000 } /* Literal */
+.highlight .n { color: #000000 } /* Name */
+.highlight .o { color: #ce5c00; font-weight: bold } /* Operator */
+.highlight .x { color: #000000 } /* Other */
+.highlight .p { color: #000000; font-weight: bold } /* Punctuation */
+.highlight .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */
+.highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */
+.highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */
+.highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #a40000 } /* Generic.Deleted */
+.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #ef2929 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #000000; font-style: italic } /* Generic.Output */
+.highlight .gp { color: #8f5902 } /* Generic.Prompt */
+.highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
+.highlight .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */
+.highlight .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #204a87; font-weight: bold } /* Keyword.Type */
+.highlight .ld { color: #000000 } /* Literal.Date */
+.highlight .m { color: #0000cf; font-weight: bold } /* Literal.Number */
+.highlight .s { color: #4e9a06 } /* Literal.String */
+.highlight .na { color: #c4a000 } /* Name.Attribute */
+.highlight .nb { color: #204a87 } /* Name.Builtin */
+.highlight .nc { color: #000000 } /* Name.Class */
+.highlight .no { color: #000000 } /* Name.Constant */
+.highlight .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */
+.highlight .ni { color: #ce5c00 } /* Name.Entity */
+.highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #000000 } /* Name.Function */
+.highlight .nl { color: #f57900 } /* Name.Label */
+.highlight .nn { color: #000000 } /* Name.Namespace */
+.highlight .nx { color: #000000 } /* Name.Other */
+.highlight .py { color: #000000 } /* Name.Property */
+.highlight .nt { color: #204a87; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #000000 } /* Name.Variable */
+.highlight .ow { color: #204a87; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
+.highlight .mb { color: #0000cf; font-weight: bold } /* Literal.Number.Bin */
+.highlight .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */
+.highlight .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */
+.highlight .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */
+.highlight .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */
+.highlight .sa { color: #4e9a06 } /* Literal.String.Affix */
+.highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */
+.highlight .sc { color: #4e9a06 } /* Literal.String.Char */
+.highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */
+.highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #4e9a06 } /* Literal.String.Double */
+.highlight .se { color: #4e9a06 } /* Literal.String.Escape */
+.highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */
+.highlight .si { color: #4e9a06 } /* Literal.String.Interpol */
+.highlight .sx { color: #4e9a06 } /* Literal.String.Other */
+.highlight .sr { color: #4e9a06 } /* Literal.String.Regex */
+.highlight .s1 { color: #4e9a06 } /* Literal.String.Single */
+.highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */
+.highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
+.highlight .fm { color: #000000 } /* Name.Function.Magic */
+.highlight .vc { color: #000000 } /* Name.Variable.Class */
+.highlight .vg { color: #000000 } /* Name.Variable.Global */
+.highlight .vi { color: #000000 } /* Name.Variable.Instance */
+.highlight .vm { color: #000000 } /* Name.Variable.Magic */
+.highlight .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
\ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index 4fc4436..32a6068 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -8,6 +8,7 @@
"
+ output += prefix + i.replace(".html", delim + "%s")
+ output += "
', f.read())
+ output += "
"
+ for j in headers:
+ output += f"
"
+ return output + ""
+ output += prefix + i.replace(".html", delim + j)
+ output += "
import binascii
+ {% highlight 'python' %}
+import binascii
from Crypto.Cipher import DES3
-KEY = b"" # Check the DES section for this
+KEY = b"" # Check the DES section for this
_KEY = bytes(i * 2 for i in KEY) # Preprocess the key
ALPHABET = "0123456789ABCDEFGHJKLMNPRSTUWXYZ"
def enc_des(uid):
-cipher = DES3.new(_KEY, DES3.MODE_CBC, iv=b'\0' * 8)
-return cipher.encrypt(uid)
+ cipher = DES3.new(_KEY, DES3.MODE_CBC, iv=b'\0' * 8)
+ return cipher.encrypt(uid)
def dec_des(uid):
-cipher = DES3.new(_KEY, DES3.MODE_CBC, iv=b'\0' * 8)
-return cipher.decrypt(uid)
+ cipher = DES3.new(_KEY, DES3.MODE_CBC, iv=b'\0' * 8)
+ return cipher.decrypt(uid)
def checksum(data):
@@ -38,79 +39,79 @@ return chk
def pack_5(data):
-data = "".join(f"{i:05b}" for i in data)
-if len(data) % 8 != 0:
- data += "0" * (8 - (len(data) % 8))
-return bytes(int(data[i:i+8], 2) for i in range(0, len(data), 8))
+ data = "".join(f"{i:05b}" for i in data)
+ if len(data) % 8 != 0:
+ data += "0" * (8 - (len(data) % 8))
+ return bytes(int(data[i:i+8], 2) for i in range(0, len(data), 8))
def unpack_5(data):
-data = "".join(f"{i:08b}" for i in data)
-if len(data) % 5 != 0:
- data += "0" * (5 - (len(data) % 5))
-return bytes(int(data[i:i+5], 2) for i in range(0, len(data), 5))
+ data = "".join(f"{i:08b}" for i in data)
+ if len(data) % 5 != 0:
+ data += "0" * (5 - (len(data) % 5))
+ return bytes(int(data[i:i+5], 2) for i in range(0, len(data), 5))
def to_konami_id(uid):
-assert len(uid) == 16, "UID must be 16 bytes"
+ assert len(uid) == 16, "UID must be 16 bytes"
-if uid.upper().startswith("E004"):
- card_type = 1
-elif uid.upper().startswith("0"):
- card_type = 2
-else:
- raise ValueError("Invalid UID prefix")
+ if uid.upper().startswith("E004"):
+ card_type = 1
+ elif uid.upper().startswith("0"):
+ card_type = 2
+ else:
+ raise ValueError("Invalid UID prefix")
-kid = binascii.unhexlify(uid)
-assert len(kid) == 8, "ID must be 8 bytes"
+ kid = binascii.unhexlify(uid)
+ assert len(kid) == 8, "ID must be 8 bytes"
-out = bytearray(unpack_5(enc_des(kid[::-1]))[:13]) + b'\0\0\0'
+ out = bytearray(unpack_5(enc_des(kid[::-1]))[:13]) + b'\0\0\0'
-out[0] ^= card_type
-out[13] = 1
-for i in range(1, 14):
- out[i] ^= out[i - 1]
-out[14] = card_type
-out[15] = checksum(out)
+ out[0] ^= card_type
+ out[13] = 1
+ for i in range(1, 14):
+ out[i] ^= out[i - 1]
+ out[14] = card_type
+ out[15] = checksum(out)
-return "".join(ALPHABET[i] for i in out)
+ return "".join(ALPHABET[i] for i in out)
def to_uid(konami_id):
-if konami_id[14] == "1":
- card_type = 1
-elif konami_id[14] == "2":
- card_type = 2
-else:
- raise ValueError("Invalid ID")
+ if konami_id[14] == "1":
+ card_type = 1
+ elif konami_id[14] == "2":
+ card_type = 2
+ else:
+ raise ValueError("Invalid ID")
-assert len(konami_id) == 16, f"ID must be 16 characters"
-assert all(i in ALPHABET for i in konami_id), "ID contains invalid characters"
-card = [ALPHABET.index(i) for i in konami_id]
-assert card[11] % 2 == card[12] % 2, "Parity check failed"
-assert card[13] == card[12] ^ 1, "Card invalid"
-assert card[15] == checksum(card), "Checksum failed"
+ assert len(konami_id) == 16, f"ID must be 16 characters"
+ assert all(i in ALPHABET for i in konami_id), "ID contains invalid characters"
+ card = [ALPHABET.index(i) for i in konami_id]
+ assert card[11] % 2 == card[12] % 2, "Parity check failed"
+ assert card[13] == card[12] ^ 1, "Card invalid"
+ assert card[15] == checksum(card), "Checksum failed"
-for i in range(13, 0, -1):
- card[i] ^= card[i - 1]
+ for i in range(13, 0, -1):
+ card[i] ^= card[i - 1]
-card[0] ^= card_type
+ card[0] ^= card_type
-card_id = dec_des(pack_5(card[:13])[:8])[::-1]
-card_id = binascii.hexlify(card_id).decode().upper()
+ card_id = dec_des(pack_5(card[:13])[:8])[::-1]
+ card_id = binascii.hexlify(card_id).decode().upper()
-if card_type == 1:
- assert card_id[:4] == "E004", "Invalid card type"
-elif card_type == 2:
- assert card_id[0] == "0", "Invalid card type"
-return card_id
+ if card_type == 1:
+ assert card_id[:4] == "E004", "Invalid card type"
+ elif card_type == 2:
+ assert card_id[0] == "0", "Invalid card type"
+ return card_id
if __name__ == "__main__":
-assert to_konami_id("0000000000000000") == "007TUT8XJNSSPN2P", "To KID failed"
-assert to_uid("007TUT8XJNSSPN2P") == "0000000000000000", "From KID failed"
-assert to_uid(to_konami_id("000000100200F000")) == "000000100200F000", "Roundtrip failed"
-
+ assert to_konami_id("0000000000000000") == "007TUT8XJNSSPN2P", "To KID failed"
+ assert to_uid("007TUT8XJNSSPN2P") == "0000000000000000", "From KID failed"
+ assert to_uid(to_konami_id("000000100200F000")) == "000000100200F000", "Roundtrip failed"
+{% endhighlight %}
e-Amusement cards use 16 digit IDs. KONAMI IDs are also 16 digits. Are they related? Yes! In fact, KONAMI IDs are derived from the ID stored on the e-Amusement card.
@@ -195,7 +196,7 @@ card[0] ^= card_typeHaha well you see we can actually cheat and use string manipulation. Wasteful? Incredibly. Efficient? Not at all. Quick and easy? Yup!
-def pack_5(data):
+ {% highlight "python" %}def pack_5(data):
data = "".join(f"{i:05b}" for i in data)
if len(data) % 8 != 0:
data += "0" * (8 - (len(data) % 8))
@@ -205,7 +206,7 @@ def unpack_5(data):
data = "".join(f"{i:08b}" for i in data)
if len(data) % 5 != 0:
data += "0" * (5 - (len(data) % 5))
- return bytes(int(data[i:i+5], 2) for i in range(0, len(data), 5))
+ return bytes(int(data[i:i+5], 2) for i in range(0, len(data), 5)){% endhighlight %}
If your language of choice allows this, and you don't care for efficiency, this can be a great time-saver towards get something working. Truth be told my local implementation originally used the Bemani method (it was a line-for-line port, after all), switched to the second method, then I opted for this hacky @@ -272,7 +273,7 @@ card[15] = checksum(card) Either way, my python port didn't do any cleaning up, because we can just use a DES library.
DES_KEYMAP = [
+ {% highlight "python" %}DES_KEYMAP = [
[0x02080008, 0x02082000, 0x00002008, 0x00000000, 0x02002000, 0x00080008, 0x02080000, 0x02082008, 0x00000008, 0x02000000, 0x00082000, 0x00002008, 0x00082008, 0x02002008, 0x02000008, 0x02080000, 0x00002000, 0x00082008, 0x00080008, 0x02002000, 0x02082008, 0x02000008, 0x00000000, 0x00082000, 0x02000000, 0x00080000, 0x02002008, 0x02080008, 0x00080000, 0x00002000, 0x02082000, 0x00000008, 0x00080000, 0x00002000, 0x02000008, 0x02082008, 0x00002008, 0x02000000, 0x00000000, 0x00082000, 0x02080008, 0x02002008, 0x02002000, 0x00080008, 0x02082000, 0x00000008, 0x00080008, 0x02002000, 0x02082008, 0x00080000, 0x02080000, 0x02000008, 0x00082000, 0x00002008, 0x02002008, 0x02080000, 0x00000008, 0x02082000, 0x00082008, 0x00000000, 0x02000000, 0x02080008, 0x00002000, 0x00082008],
[0x08000004, 0x00020004, 0x00000000, 0x08020200, 0x00020004, 0x00000200, 0x08000204, 0x00020000, 0x00000204, 0x08020204, 0x00020200, 0x08000000, 0x08000200, 0x08000004, 0x08020000, 0x00020204, 0x00020000, 0x08000204, 0x08020004, 0x00000000, 0x00000200, 0x00000004, 0x08020200, 0x08020004, 0x08020204, 0x08020000, 0x08000000, 0x00000204, 0x00000004, 0x00020200, 0x00020204, 0x08000200, 0x00000204, 0x08000000, 0x08000200, 0x00020204, 0x08020200, 0x00020004, 0x00000000, 0x08000200, 0x08000000, 0x00000200, 0x08020004, 0x00020000, 0x00020004, 0x08020204, 0x00020200, 0x00000004, 0x08020204, 0x00020200, 0x00020000, 0x08000204, 0x08000004, 0x08020000, 0x00020204, 0x00000000, 0x00000200, 0x08000004, 0x08000204, 0x08020200, 0x08020000, 0x00000204, 0x00000004, 0x08020004],
[0x80040100, 0x01000100, 0x80000000, 0x81040100, 0x00000000, 0x01040000, 0x81000100, 0x80040000, 0x01040100, 0x81000000, 0x01000000, 0x80000100, 0x81000000, 0x80040100, 0x00040000, 0x01000000, 0x81040000, 0x00040100, 0x00000100, 0x80000000, 0x00040100, 0x81000100, 0x01040000, 0x00000100, 0x80000100, 0x00000000, 0x80040000, 0x01040100, 0x01000100, 0x81040000, 0x81040100, 0x00040000, 0x81040000, 0x80000100, 0x00040000, 0x81000000, 0x00040100, 0x01000100, 0x80000000, 0x01040000, 0x81000100, 0x00000000, 0x00000100, 0x80040000, 0x00000000, 0x81040000, 0x01040100, 0x00000100, 0x01000000, 0x81040100, 0x80040100, 0x00040000, 0x81040100, 0x80000000, 0x01000100, 0x80040100, 0x80040000, 0x00040100, 0x01040000, 0x81000100, 0x80000100, 0x01000000, 0x81000000, 0x01040100],
@@ -461,7 +462,7 @@ def load_key(key):
key_data = bytearray(24)
for i in range(24):
key_data[i] = 2 * key[i % len(key)]
- des3_setkey(KEY_DATA, key_data)
+ des3_setkey(KEY_DATA, key_data){% endhighlight %}
This site intentionally looks not-great. I don't feel like changing that, and honestly quite like the - aesthetic.
{% endblock %} \ No newline at end of file diff --git a/templates/pages/packet.html b/templates/pages/packet.html index 051cbc9..bc77e27 100644 --- a/templates/pages/packet.html +++ b/templates/pages/packet.html @@ -2,8 +2,8 @@ {% block body %}eAmuse uses XML for its application layer payloads*. This XML is either verbatim, or in a custom packed binary
- format.
*Newer games use JSON, but this page is about XML.
e-Amusement uses XML for its application layer payloads. This XML is either verbatim, or in a custom packed binary + format.
__count
attribute indicating how many items are in the array. Binary blobs additionally have
a __size
attribute indicating their length (this is notably not present on strings, however).
It is perhaps simpler to illustrate with an example, so:
-<?xml version='1.0' encoding='UTF-8'?>
-<call model="KFC:J:A:A:2019020600" srcid="1000" tag="b0312077">
- <eventlog method="write">
- <retrycnt __type="u32" />
- <data>
- <eventid __type="str">G_CARDED</eventid>
- <eventorder __type="s32">5</eventorder>
- <pcbtime __type="u64">1639669516779</pcbtime>
- <gamesession __type="s64">1</gamesession>
- <strdata1 __type="str" />
- <strdata2 __type="str" />
- <numdata1 __type="s64">1</numdata1>
- <numdata2 __type="s64" />
- <locationid __type="str">ea</locationid>
- </data>
- </eventlog>
-</call>
+{% highlight 'xml' %} + ++ +{% endhighlight %}+ ++ + G_CARDED +5 +1639669516779 +1 ++ + 1 ++ ea + +
Arrays are encoded by concatenating every value together, with spaces between them. Data types that have multiple values, are serialized similarly.
Therefore, an element storing an array of 3u8
([(1, 2, 3), (4, 5, 6)]
) would look like
this
<demo __type="3u8" __count="2">1 2 3 4 5 6</demo>
+{% highlight 'xml' %} +1 2 3 4 5 6 +{% endhighlight %}
Besides this, this is otherwise a rather standard XML.
This is indexed using the following function, which maps the above encoding IDs to 1, 2, 3, 4 and 5 respectively.
-char* xml_get_encoding_name(uint encoding_id) {
+ {% highlight "c" %}char* xml_get_encoding_name(uint encoding_id) {
return ENCODING_NAME_TABLE[((encoding_id & 0xe0) >> 5) * 4];
-}
+}{% endhighlight %}
While validating ~E
isn't technically required, it acts as a useful assertion that the packet being
parsed is valid.
While the intuitive way to understand the packing algorithm is via chunks and buckets, a far more efficient implementation can be made that uses three pointers. Rather than try to explain in words, hopefully this python implementation should suffice as explanation: -
class Packer:
+ {% highlight "python" %}class Packer:
def __init__(self, offset=0):
self._word_cursor = offset
self._short_cursor = offset
@@ -873,7 +877,7 @@
def notify_skipped(self, no_bytes):
for _ in range(math.ceil(no_bytes / 4)):
- self.request_allocation(4)
+ self.request_allocation(4){% endhighlight %}
diff --git a/templates/pages/proto/apsmanager.html b/templates/pages/proto/apsmanager.html
index b753aba..f0f08f0 100644
--- a/templates/pages/proto/apsmanager.html
+++ b/templates/pages/proto/apsmanager.html
@@ -3,11 +3,11 @@
apsmanager
apsmanager.getstat
<call ...>
- <apsmanager method="getstat" model*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
<response>
- <apsmanager status="status" />
-</response>
+{% highlight "cxml" %}{% endblock %} \ No newline at end of file diff --git a/templates/pages/proto/cardmng.html b/templates/pages/proto/cardmng.html index ea7af74..59a336b 100644 --- a/templates/pages/proto/cardmng.html +++ b/templates/pages/proto/cardmng.html @@ -46,9 +46,9 @@+ {% endhighlight %}+
Request information about a card that has been inserted or touched against a reader.
<call ...>
- <cardmng method="inquire" cardid="" cardtype="" update="" model*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
update |
@@ -56,9 +56,9 @@
<response>
- <cardmng status="status" refid="" dataid="" pcode="" newflag="" binded="" expired=" ecflag="" useridflag="" extidflag="" lastupdate="" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
To handle this request, we first must lookup if this cardid
has ever been seen by our servers
before. If not, we abort with a 112
status. Otherwise, we proceeed to check if this card has been
seen for this specific game. If we have never seen this card used on this game, it is possible this card was
@@ -92,9 +92,9 @@
cardmng.getrefid
Register a new card to this server.
<call ...>
- <cardmng method="getrefid" cardtype="" cardid=" newflag="" passwd="" model*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
newflag |
@@ -107,9 +107,9 @@
<response>
- <cardmng status="status" refid="" dataid="" pcode="" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
refid |
@@ -128,32 +128,32 @@
refid |
@@ -166,47 +166,47 @@
<response>
- <cardmng status="status" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
If the pin is valid, status should be 0
. Otherwise, 116
.
cardmng.getkeepspan
<call ...>
- <cardmng method="getkeepspan" model*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
<response>
- <cardmng status="status" keepspan="" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
cardmng.getkeepremain
<call ...>
- <cardmng method="getkeepremain" refid="" model*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
<response>
- <cardmng status="status" keepremain="" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
cardmng.getdatalist
<call ...>
- <cardmng method="getdatalist" refid="" model*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
<response>
- <cardmng status="status">
- <item[]>
- <mcode __type="str" />
- <dataid __type="str" />
- <regtime __type="str" />
- <lasttime __type="str" />
- <exptime __type="str" />
- <expflag __type="u8" />
- </item[]>
- </cardmng>
-</response>
+{% highlight "cxml" %}{% endblock %} \ No newline at end of file diff --git a/templates/pages/proto/dlstatus.html b/templates/pages/proto/dlstatus.html index 9ea8144..806d383 100644 --- a/templates/pages/proto/dlstatus.html +++ b/templates/pages/proto/dlstatus.html @@ -3,32 +3,32 @@+ {% endhighlight %}+ +- +
++ + + + + +
dlstatus
dlstatus.done
<call ...>
- <dlstatus method="done">
- <url>
- <param __type="str" />
- </url>
- <name __type="str" />
- <size __type="s32" />
- </dlstatus>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + ++ +
<response>
- <dlstatus status="status">
- <progress __type="s32" />
- </dlstatus>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ + +
dlstatus.progress
<call ...>
- <dlstatus method="progress" />
- <progress __type="s32" />
- </dlstatus>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ + +
<response>
- <dlstatus status="status" />
-</response>
+{% highlight "cxml" %}{% endblock %} \ No newline at end of file diff --git a/templates/pages/proto/eacoin.html b/templates/pages/proto/eacoin.html index ac90e1d..d978c02 100644 --- a/templates/pages/proto/eacoin.html +++ b/templates/pages/proto/eacoin.html @@ -3,178 +3,178 @@+ {% endhighlight %}+
eacoin
eacoin.checkin
<call ...>
- <eacoin method="checkin">
- <cardtype __type="str" />
- <cardid __type="str" />
- <passwd __type="str" />
- <ectype __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + + +
<response>
- <eacoin status="status">
- <sequence __type="s16" />
- <acstatus __type="u8" />
- <acid __type="str" />
- <acname __type="str" />
- <balance __type="s32" />
- <sessid __type="str" />
- </eacoin>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + + + + +
eacoin.checkout
<call ...>
- <eacoin method="checkout">
- <sessid __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <eacoin status="status" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
eacoin.consume
<call ...>
- <eacoin method="consume" esid="">
- <sessid __type="str" />
- <sequence __type="s16" />
- <payment __type="s32" />
- <service __type="s16" />
- <itemtype __type="str" />
- <detail __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + + + + +
<response>
- <eacoin status="status">
- <acstatus __type="u8" />
- <autocharge __type="u8" />
- <balance __type="s32" />
- </eacoin>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + +
eacoin.getbalance
<call ...>
- <eacoin method="getbalance">
- <sessid __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <eacoin status="status">
- <acstatus __type="u8" />
- <balance __type="s32" />
- </eacoin>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ +
eacoin.getecstatus
<call ...>
- <eacoin method="getecstatus" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
<response>
- <eacoin status="status">
- <ectype __type="str" />
- <ecstatus __type="u8" />
- </eacoin>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ +
eacoin.touch
<call ...>
- <eacoin method="touch">
- <sessid __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <eacoin status="status" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
eacoin.opchpass
<call ...>
- <eacoin method="opchpass">
- <passwd __type="str" />
- <newpasswd __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ +
<response>
- <eacoin status="status" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
eacoin.opcheckin
<call ...>
- <eacoin method="opcheckin">
- <passwd __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <eacoin status="status">
- <sessid __type="str" />
- </eacoin>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
eacoin.opcheckout
<call ...>
- <eacoin method="opcheckout">
- <sessid __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <eacoin status="status" />
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+
eacoin.getlog
<call ...>
- <eacoin method="getlog">
- <sessid __type="str" />
- <logtype __type="str" />
- <ectype __type="str" />
- <target __type="str" />
- <perpage __type="s16" />
- <page __type="s16" />
- <sesstype __type="str" />
- </eacoin>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + + + + + +
<response>
- <eacoin status="status">
- <processing __type="u8" />
- <topic>
- <sumdate __type="str" />
- <sumfrom __type="str" />
- <sumto __type="str" />
+{% highlight "cxml" %}
+
+
+
+
+
+
- <today __type="s32" />
- <average __type="s32" />
- <total __type="s32" />
- </topic>
- <summary>
- <items __type="s32" />
- </summary>
- <history>
- <item[]>
- <date __type="str" />
- <consume __type="s32" />
- <service __type="s32" />
- <cardtype __type="str" />
- <cardno __type="str" />
- <title __type="str" />
- <systemid __type="str" />
- </item[]>
- </history>
- </eacoin>
-</response>
+ esign
esign.request
<call ...>
- <esign method="request">
+{% highlight "cxml" %}
+
placeholder
- </esign>
-</call>
+
+{% endhighlight %}
<response>
- <esign status="status">
+{% highlight "cxml" %}
+
placeholder
- </esign>
-</response>
+
+{% endhighlight %}
{% endblock %}
\ No newline at end of file
diff --git a/templates/pages/proto/esoc.html b/templates/pages/proto/esoc.html
index e38cc9c..9887f91 100644
--- a/templates/pages/proto/esoc.html
+++ b/templates/pages/proto/esoc.html
@@ -3,28 +3,28 @@
esoc
esoc.read
<call ...>
- <esoc method="read">
- <senddata />
- </esoc>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <esoc status="status">
- <recvdata />
- </esoc>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
Go figure.
esoc.write
<call ...>
- <esoc method="write">
- <senddata />
- </esoc>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++
<response>
- <esoc status="status" />
-</response>
+{% highlight "cxml" %}{% endblock %} \ No newline at end of file diff --git a/templates/pages/proto/eventlog.html b/templates/pages/proto/eventlog.html index 2c67e21..bba7daa 100644 --- a/templates/pages/proto/eventlog.html +++ b/templates/pages/proto/eventlog.html @@ -3,22 +3,22 @@+ {% endhighlight %}+
eventlog
eventlog.write
<call ...>
- <eventlog method="write">
- <retrycnt __type="u32" />
- <data>
- <eventid __type="str" />
- <eventorder __type="s32" />
- <pcbtime __type="u64" />
- <gamesession __type="s64" />
- <strdata1 __type="str" />
- <strdata2 __type="str" />
- <numdata1 __type="s64" />
- <numdata2 __type="s64" />
- <locationid __type="str" />
- </data>
- </eventlog>
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ + + + + + + + + + + +
Event ID list:
G_GAMED
T_OTDEMO
<response>
- <eventlog status="status">
- <gamesession __type="s64" />
- <logsendflg __type="s32" />
- <logerrlevel __type="s32" />
- <evtidnosendflg __type="s32" />
- </eventlog>
-</response>
+{% highlight "cxml" %}{% endblock %} \ No newline at end of file diff --git a/templates/pages/proto/facility.html b/templates/pages/proto/facility.html index 6536380..36b674b 100644 --- a/templates/pages/proto/facility.html +++ b/templates/pages/proto/facility.html @@ -3,66 +3,66 @@+ {% endhighlight %}+ ++ + + +
facility
facility.get
<call ...>
- <facility method="get" privateip*="" encoding*="" />
-</call>
+{% highlight "cxml" %}+ {% endhighlight %}+
<response>
- <facility expire=""\ status="status">
- <calendar*>
- <year __type="s16" />
- <holiday __type="s16" />
- </calendar>
- <location>
- <id __type="str" />
- <country __type="str" />
- <region __type="str" />
- <name __type="str" />
- <type __type="u8" />
- <countryname __type="str" />
- <countryjname __type="str" />
- <regionname __type="str" />
- <regionjname __type="str" />
- <customercode __type="str" />
- <companycode __type="str" />
- <latitude __type="s32" />
- <longitude __type="s32" />
- <accuracy __type="u8" />
- </location>
- <line>
- <id __type="str" />
- <class __type="u8" />
- </line>
- <portfw>
- <globalip __type="ip4" />
- <globalport __type="s16" />
- <privateport __type="s16" />
- </portfw>
- <public>
- <flag __type="u8" />1</ flag>
- <name __type="str" />
- <latitude __type="str">0<latitude>
- <longitude __type="str">0<longitude>
- </public>
- <share>
- <eapass*>
- <valid __type="?" />
- </eapass>
- <eacoin>
- <notchamount __type="s32" />
- <notchcount __type="s32" />
- <supplylimit __type="s32">100000<supplylimit>
- </eacoin>
- <url>
- <eapass __type="str">www.ea-pass.konami.net<eapass>
- <arcadefan __type="str">www.konami.jp/am<arcadefan>
- <konaminetdx __type="str">http://am.573.jp<konaminetdx>
- <konamiid __type="str">http://id.konami.jp<konamiid>
- <eagate __type="str">http://eagate.573.jp<eagate>
- </url>
- </share>
- </facility>
-</response>
+{% highlight "cxml" %}+ {% endhighlight %}+ ++ ++ + + ++ + + + + + + + + + + + + + + ++ + + ++ + + + +1 flag> + + 0 + 0 + + ++ ++ + ++ + 100000 + + +www.ea-pass.konami.net + www.konami.jp/am + http://am.573.jp + http://id.konami.jp + http://eagate.573.jp +
I'm not totally sure what type share/eapass/valid
is meant to be, but it's optional, so I'd
suggest just not bothering and leaving it out :).