mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-16 01:51:17 +00:00
* Expand Aerolib catalog from nids.csv and wire socket/net NID handlers Load authoritative NID pairs from scripts/nids.csv with ps5_names fallback. Replace mislabeled kernel zero stubs with socket/connect/bind/getsockname HLE and sceNet byte-order exports backed by the CSV symbol names. * Add inet_pton, htons, and bzero kernel compat with CSV NIDs Wire libc network helpers using authoritative NID names from nids.csv instead of synthetic Gst* exports used on the crt-loader branch. * Fix REUSE annotation for scripts/nids.csv * Drop bundled nids.csv; extend ps5_names and regenerate Aerolib Remove scripts/nids.csv from the repository and fold csv-only symbol names into scripts/ps5_names.txt so Aerolib keeps the full catalog via name2nid.
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
# Copyright (C) 2026 SharpEmu Emulator Project
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
import hashlib
|
|
import struct
|
|
from base64 import b64encode as base64enc
|
|
from binascii import unhexlify as uhx
|
|
from pathlib import Path
|
|
|
|
NAMES = 'scripts/ps5_names.txt'
|
|
OUTPUT = 'src/SharpEmu.HLE/Aerolib/aerolib.bin'
|
|
|
|
def name2nid(name):
|
|
symbol = hashlib.sha1(name.encode() + uhx('518D64A635DED8C1E6B039B1C3E55230')).digest()
|
|
id_val = struct.unpack('<Q', symbol[:8])[0]
|
|
nid = base64enc(uhx('%016x' % id_val), b'+-').rstrip(b'=')
|
|
return nid.decode('utf-8')
|
|
|
|
def generate():
|
|
names_path = Path(NAMES)
|
|
output_path = Path(OUTPUT)
|
|
|
|
entries = []
|
|
with open(names_path, 'r', encoding='utf-8') as f:
|
|
for line in f:
|
|
name = line.strip()
|
|
if name:
|
|
nid = name2nid(name)
|
|
entries.append((nid, name))
|
|
|
|
print(f"Found {len(entries)} entries")
|
|
|
|
data = bytearray()
|
|
data.extend(struct.pack('<I', len(entries)))
|
|
|
|
for nid, name in entries:
|
|
nid_bytes = nid.encode('utf-8')
|
|
name_bytes = name.encode('utf-8')
|
|
data.append(len(nid_bytes))
|
|
data.extend(nid_bytes)
|
|
data.extend(struct.pack('<H', len(name_bytes)))
|
|
data.extend(name_bytes)
|
|
|
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
with open(output_path, 'wb') as f:
|
|
f.write(data)
|
|
|
|
print(f"Generated: {output_path} ({len(data):,} bytes)")
|
|
print(f"Total entries: {len(entries)}")
|
|
|
|
if __name__ == "__main__":
|
|
generate()
|