Repository navigation
convert to byond-scan and fix a lot of shit - #112
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccaaeac251
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
(lazy ai review)
Reviewed for regressions and newly introduced bugs only. I couldn't check the binary-level claims (calling conventions, struct offsets, recipe patterns) without the BYOND binaries, so those are taken as given. The rest looked right to me, including the hook result cleanup, the debug server reconnect/shutdown rework, and the auxcov type_id fix.
1. auxtools/src/lib.rs:85-98: one failed auxtools_init disables auxtools until the process exits, across world reboots and auxtools_full_shutdown.
I know the latch is deliberate (#27, and the new test says so). Two cases where it regresses something that worked before:
- Failures that only apply to one world. A compile-time
#[hook]whose proc isn't in the loaded .dmb fails withProcNotFound. So does a library's own#[init(partial)]returningErr. Before, the next world retried partial init, so a reboot into a fixed .dmb (a TGS deployment, for example) recovered without restarting DreamDaemon. Now every later world gets the cachedFAILED (...)until the process restarts. auxtools_full_shutdown. It takes the library back toInitLevel::Full. WithPIN_DLLon by default, the DLL and thisOnceLockstay loaded, so a later init can never retry either.
The error path already runs clear_hooks() / clear_procs(), the same cleanup auxtools_shutdown does, so retrying after a failed partial init looks safe. One option is to latch only full-stage failures (symbol resolution, pin_dll, hooks::init, run_full_init) and let the shutdown entry points clear anything else. That would need something resettable, like Mutex<Option<String>>, instead of OnceLock.
2. Heads-up, not a bug: these public API removals will break downstream crates, so it's worth saying so in the PR description.
Removed: auxtools::sigscan and its #[macro_export] macros (signature!, signatures!, find_signature(s)!, find_signature(s)_result!, version_dependent_signature!, universal_signature!, …), auxtools::BYONDCORE, and auxtools_impl::convert_signature.
Also changed: Proc::entry went from a public field to a method, so Proc can no longer be built with a struct literal. List::is_list is no longer a const fn, and it now calls into BYOND, so it only works after init.
Anything that depends on this repo by git and uses these will stop compiling. find_recipe plus the byond_scan re-export covers what sigscan did. A pub const BYONDCORE: &str = byond_scan::MODULE_NAME; shim would cost nothing.
big pr here lol
closes #106
fixes #19
closes #27
likely fixes #44, now covered by a test
closes #65
fixes #87
byond-scan
sigscanmodule andsignatures!macros are gone, useauxtools::find_recipeinsteadlinux fixes
Proc::calland by name withValue::call. there's a test for it now. this is prolly what Libraries using auxtools are not able to call procs that the libraries themselves are hooked into, but only on linux. #44 was, but i couldn't run the test against the old code to prove itList::removeworks on every supported build (BYOND changed how that function takes its arguments at 516.1674)List::lenreturns the right numberother fixes
New()is the common case: every hookedNew()that returned a string, list or datum leaked one reference per callProc::callpasses the sameproc_typeBYOND's own direct calls do (2, was 0). with 0, a..()with no parent proc could return garbageset_bytecodedoesn't overwrite the field next to the bytecode pointer anymorecall_datum_proc_by_namewith a bad proc name gives you an error instead of killing the processtry/catchworksProcdoesn't go stale when BYOND moves its proc table, which happens whenever DM code makes a new verb withnew /some/verb(dest, "name"). this was the random debugger crash in extremely high suspended procs force proc array reallocation #87.Proc::entryis a method now instead of a field, soproc.entrybecomesproc.entry(). aProcalso can't be written out as a struct literal anymore, get one fromProc::find,Proc::find_overrideorProc::from_id. it still can't be sent to another thread, same as beforeauxtools_initstays failed. every later call returns the same error and does nothing, instead of running setup again on top of the half-finished first try (that's where doubled procs and "Proc is already hooked" came from). any hooks the failed init already registered get removed too (an error in auxtools_init should prevent future auxtools_init calls from doing stuff #27)byond_ffi_fn!works from other crates now. it was exported but pointed at a private module, so it never compiled outside auxtoolsHookFailureandProcHookare exported now.Proc::hookhands back aHookFailure, but other crates couldn't name the type, so they couldn't tell "already hooked" from "proc not found"debug server
#disdoesn't remove and re-add the proc's breakpoints to read itenable_debuggingtwice is an error instead of running the server twice per instruction/alistshows as/alist {len = N}and expands to its real key/value pairs. it used to show a/listwith wrong or empty rows/vectorexpands tox,y,z,lenandsize, and a/pixloctox,y,z,step_x,step_yandloc, and a/calleetoproc,file,line,src,usr,argsandcaller. they used to be a single line with nothing to expand. a callee only expands while its proc is still runningcargo run -p debug_test(needsBYOND_PATH). only run on windows 1685, 1687 and 1688 and linux 1687 so farlists
List::is_listasks BYOND's ownislist(), soverbs,filters,/alistetc. count as lists. it isn't aconst fnanymore/alistsupport:List::is_alistandList::alist_pairs, which gives every key and value in the orderfor (var/k in A)does. numbers are keys in an alist, not positions, so walking one withget(1..=len)doesn't work.get,setandlenwork on alists. auxtools finds BYOND's alist table at init now (alist_table_ptrandalist_table_count), so an unsupported build fails there if it doesn't match. you can't create an alist from Rust yet, only read and write ones DM gives youraw types
raw_typeswere checked against the 516.1688 binaries and the byond-re notes, on both platformsExecutionContextis the real size now (152 bytes on Windows, 148 on Linux, was 164). everything afteriterator_indexwas 4 bytes off.iterator_filtered_typeis gone, useiterator_filter_type,iterator_filter_bitflagsanditerator_kindProcInstancehasoverride_depthProcEntryis 44 bytes andStringEntryis 32, they were each 4 short.StringEntryhasencodingandis_proc_nameAssociativeListEntry.coloris au8(same layout)VariableNameIdTablehas its two fields the other way round on Linuxtested on