Repository navigation
Add Portal Stories: Mel (experimental, macOS) - #52
Zertrox123 wants to merge 8 commits into
Conversation
Sealed macOS system volumes (such as /System/Library/Fonts) commonly have 64-bit inode numbers. Returning EOVERFLOW from 32-bit stat broke guests that ignore stat errors when probing system fonts; truncating st_ino to 32 bits matches how games use it as an opaque identifier.
… out of step Non-PIC code sections with inline jump tables (such as Bink in Portal Stories: Mel's valve_avi.so and engine.so) can push objdump's linear sweep out of step across the next function entry. Add LazyInsns._resync to decode a short image-relative window from a missed entry while keeping already-decoded instructions.
…ameprep: non-PIE, game_lib_dirs and system_libs - Accept STB_GNU_UNIQUE (10) bindings in Elf.exports() so libstdc++.so.6 exports template statics such as std::string's empty representation. - Collect data_ptrs across all executable code sections (excluding .init, .fini and .plt*), not only .text, so Bink function tables are picked up. - Keep base 0 for non-PIE ET_EXEC main executables in gameprep. - Support game_lib_dirs (relative to game_root) and system_libs (resolved from system_lib_dir) in gameprep.
Extract vtable slots and stack word counts from the i386 flat functions of an older libsteam_api.so (SDK 1.40, for which no arm64 dylib exists), cross-check against Steamworks.NET 20.1.0 signatures, and call the host interface vtable slots directly. Handle SteamUtils009::GetCSERIPPort and SteamClient017::GetISteamUnifiedMessages in virtual_bridge, and regenerate steam_generated.c and steam_stub_generated.c.
Portal Stories: Mel's 2021 Linux shaderapivk.so was compiled with 32-bit WORD in its D3D9 headers, widening D3DVERTEXELEMENT9 to 12 bytes (u32 Stream and Offset). Detect the 8-byte vs 12-byte D3DDECL_END sentinel unambiguously using Stream, Offset and D3DDECLTYPE_UNUSED (avoiding collisions when 12*2k == 8*3k), convert to 8-byte elements for libd3d9metal, and convert back in GetDeclaration. Ignore SetGammaRamp when the 32-bit-WORD ramp layout is active.
…_getc/putc shims Bridge FreeType FT_Bitmap_New, FT_Bitmap_Convert and FT_Bitmap_Done for vguimatsurface bitmap font conversion, add fortified __recv_chk, __wcscpy_chk and __wcsncat_chk, and alias glibc _IO_getc/_IO_putc to fgetc/fputc.
Add the mel game profile (Steam app 317400, Linux depot 317404, macOS only), Bink indirect call roots (config/mel-roots.json), .ico to .icns conversion in make_app.py, setup.sh support (including SHA-256-verified Debian bullseye i386 libstdc++.so.6 and libgcc_s.so.1 extraction), uninstall.sh, Installer.swift, tests and docs/mel.md.
- d3d9_decl: probe the active 8- or 12-byte format first so 12-byte declarations near a page end do not scan 512 bytes ahead in 8-byte steps. - __wcsncat_chk: check null src and 32-bit guest address wraparound before scanning, matching wlen. - gameprep: expanduser() on system_lib_dir and report a missing system library explicitly. - make_app: do not copy a raw .ico file as portal2.icns when sips is absent. - setup.sh: resolve absolute .deb paths before cd into temp dir and download via a .part file before SHA-256 verification.
|
Thanks for the PR! I'm currently testing this. |
|
No problem ! We can speak in French if you want :D |
|
Merci pour ce travail ! J'ai pu compiler Mel depuis la branche sur un Mac Apple Silicon et jouer quelques minutes, aucun problème à signaler en jeu. Quelques points à corriger avant la fusion :
Une question : maintenant que |
kanapitsas
left a comment
There was a problem hiding this comment.
Changements demandés pour les trois points du commentaire ci-dessus, surtout le premier (l'installation par download_depot s'arrête faute de platform/). La question sur config/mel-roots.json n'est pas bloquante.
Summary
Adds experimental macOS support for Portal Stories: Mel (Steam app 317400, mod
portal_stories, Linux engine depot 317404) alongside Portal 2, Half-Life 2 and Portal.Note: the first two commits (
statinode truncation andLazyInsns._resync) are also proposed independently in #51 so they can be reviewed/merged separately if preferred.Key changes
tools/elfprep.py,tools/gameprep.py):STB_GNU_UNIQUE(10) exports forlibstdc++.so.6template statics.data_ptrsacross all executable code sections (excluding.init,.fini,.plt*), picking up Bink function tables inBINK*sections ofengine.soandvalve_avi.so.0for non-PIEET_EXECmain executables (Mel'sportal2_linuxis linked at0x08048000).game_lib_dirs(portal_stories/bin, relative togame_root) andsystem_libs(libstdc++.so.6,libgcc_s.so.1fromsystem_lib_dir).tools/gen_steam.py,runtime/steam.c, regeneratedsteam_generated.candsteam_stub_generated.c):libsteam_api.so(disassemble_i386), cross-checked against Steamworks.NET 20.1.0 signatures, and call the host vtable slots directly.SteamUtils009::GetCSERIPPort(slot 7) andSteamClient017::GetISteamUnifiedMessages(slot 24) invirtual_bridge.runtime/d3d9.c):D3DVERTEXELEMENT9arrays from Mel's 2021 DXVK-native headers (32-bitWORD), matchingStream == 0xff && Offset == 0 && Type == D3DDECLTYPE_UNUSEDunambiguously so even element counts (12 * 2k == 8 * 3k) are never misread as 8-byte arrays, and convert to/from 8-byte elements ind3d9_declandGetDeclaration.runtime/fonts.c,runtime/fortify.c,runtime/wchar.c,runtime/libc.c):FT_Bitmap_New,FT_Bitmap_Convert,FT_Bitmap_Done,__recv_chk,__wcscpy_chk,__wcsncat_chk,_IO_getc,_IO_putc.tools/games.py,tools/make_app.py,config/mel-roots.json,setup.sh,uninstall.sh,installer/Installer.swift,docs/mel.md,docs/steam.md,README.md):melgame profile (ios=False), 100 Bink indirect call roots inconfig/mel-roots.json,.icoto.icnsconversion viasipsinmake_app.py, SHA-256-verified Debian bullseye i386libstdc++6/libgcc-s1download insetup.sh, and documentation.Testing
make check(223 Python tests, 265 C checks inabi-smoke) and./build/abi-smoke-ubsanpass on macOS Apple Silicon, including new unit tests for 64-bit inodestat,LazyInsns._resync,gameprep(ET_EXEC,game_lib_dirs,system_libs),disassemble_i386, 12-byted3d9_decl(2 elements + end at offset 24),FT_Bitmap_Convert, andsetup.sh/uninstall.sh/games.py.--releaseon Apple Silicon):sp_a1_tramride,sp_a2_underbounce,sp_a3_paint_fling,sp_a4_overgrownon Metal andsp_a2_underbounceon OpenGL (P2_RENDERER=opengl) with no traps or crashes.saveandloadround-trip insp_a2_underbounceand inspected in-game screenshots of the menu, chamber and reloaded save.~/Applications/Portal Stories Mel Natif.appwith converted.icnsicon.Known limits
--iosis rejected formel).