Add native Durak, poker, blackjack, roulette, Buckshot and billiards scenes with animation assets and regression tests. Improve arrival, city, hall, profiles, shops, audio and exit handling; remove the portable C game core and refresh shipping executables.
43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
"""Verify the shipped object's modal layout, rather than a stale preview."""
|
|
import struct
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def coff_function(data, name):
|
|
_, section_count, _, symbol_at, symbol_count, optional_size, _ = struct.unpack_from('<HHIIIHH', data)
|
|
strings = symbol_at + symbol_count * 18
|
|
index = 0
|
|
while index < symbol_count:
|
|
at = symbol_at + index * 18
|
|
zero, offset = struct.unpack_from('<II', data, at)
|
|
if zero == 0:
|
|
end = data.index(0, strings + offset)
|
|
symbol = data[strings + offset:end].decode('ascii')
|
|
else:
|
|
symbol = data[at:at + 8].split(b'\0', 1)[0].decode('ascii')
|
|
value, section = struct.unpack_from('<Ih', data, at + 8)
|
|
if symbol == name:
|
|
assert 1 <= section <= section_count
|
|
section_at = 20 + optional_size + (section - 1) * 40
|
|
raw_size, raw_at = struct.unpack_from('<II', data, section_at + 16)
|
|
assert value < raw_size
|
|
return data[raw_at + value:raw_at + min(value + 256, raw_size)]
|
|
index += 1 + data[at + 17]
|
|
raise AssertionError('Function not found: ' + name)
|
|
|
|
|
|
def main():
|
|
data = (ROOT / 'build/graphics/poker.obj').read_bytes()
|
|
code = coff_function(data, '_RenderUnavailable3D@0')
|
|
# stdcall pushes: height=20, width=64, y=135, x=128; label x=132.
|
|
assert bytes.fromhex('6a14 6a40 6887000000 6880000000') in code, 'Stale close-button bounds'
|
|
assert bytes.fromhex('688e000000 6884000000') in code, 'Stale label anchor'
|
|
assert (132 - 128) * 2 == 8
|
|
assert (128 + 64 - (132 + 7 * 8)) * 2 == 8
|
|
print('PASS: shipping MASM modal button has 8px label margins on both sides')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|