-
Notifications
You must be signed in to change notification settings - Fork 0
feat: harden static host integration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -650,6 +650,31 @@ int main(int argc, char **argv) | |
| input.stickY = 0.0f; | ||
| } | ||
|
|
||
| if (frame_is_sane(frame)) { | ||
| float poseX = frame->link.position[0]; | ||
| float poseY = frame->link.position[1]; | ||
| float poseZ = frame->link.position[2]; | ||
|
|
||
| ok &= expect_result("freeze before clean pose", | ||
| oot_engine_link_freeze(engine, 1u), | ||
| OOT_ENGINE_RESULT_OK); | ||
| ok &= expect_result("clean Link pose", oot_engine_link_set_pose( | ||
| engine, poseX, poseY, poseZ, 0x1234), | ||
| OOT_ENGINE_RESULT_OK); | ||
| ok &= expect_result("clean pose frame", | ||
| oot_engine_step(engine, &input, &frame), | ||
| OOT_ENGINE_RESULT_OK); | ||
| ok &= frame_is_sane(frame) && | ||
| fabsf(frame->link.velocity[0]) < 0.001f && | ||
| fabsf(frame->link.velocity[1]) < 0.001f && | ||
| fabsf(frame->link.velocity[2]) < 0.001f && | ||
| fabsf(frame->link.linearVelocity) < 0.001f && | ||
| frame->link.faceAngle == 0x1234; | ||
| ok &= expect_result("unfreeze after clean pose", | ||
| oot_engine_link_freeze(engine, 0u), | ||
| OOT_ENGINE_RESULT_OK); | ||
|
Comment on lines
+658
to
+675
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Verify the reset after unfreezing Link. Because the only post-pose step runs while Link is still frozen, the test does not verify behavior after normal simulation resumes. Keep this assertion, then unfreeze Link and add a follow-up step that checks the expected position and velocity. Otherwise stale 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| ok &= expect_result("child age", oot_engine_link_set_age(engine, OOT_AGE_CHILD), | ||
| OOT_ENGINE_RESULT_OK); | ||
| ok &= expect_result("stale target", oot_engine_target_move( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * Copyright (C) 2026 Cycl0o0 | ||
| */ | ||
|
|
||
| #include "liboot_engine.h" | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| /* These signatures are intentionally host-local. Only the global symbol names | ||
| * matter: liboot's static archive must not define the unprefixed fallbacks. */ | ||
| void osCreateMesgQueue(void) | ||
| { | ||
| } | ||
|
|
||
| int32_t osSendMesg(void) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| int32_t osRecvMesg(void) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| void guPerspective(void) | ||
| { | ||
| } | ||
|
|
||
| void guMtxF2L(void) | ||
| { | ||
| } | ||
|
|
||
| void guMtxIdent(void) | ||
| { | ||
| } | ||
|
|
||
| void guMtxIdentF(void) | ||
| { | ||
| } | ||
|
|
||
| /* SM64 ports expose these names with floating-point return values. OoT's | ||
| * libultra functions return signed fixed-point values, so accidentally | ||
| * resolving either call to the host is an ABI mismatch, not just a duplicate | ||
| * implementation. */ | ||
| float sins(int16_t angle) | ||
| { | ||
| (void)angle; | ||
| return -0.25f; | ||
| } | ||
|
|
||
| float coss(int16_t angle) | ||
| { | ||
| (void)angle; | ||
| return -0.5f; | ||
| } | ||
|
|
||
| int16_t liboot_internal_sins(uint16_t angle); | ||
| int16_t liboot_internal_coss(uint16_t angle); | ||
|
|
||
| int main(void) | ||
| { | ||
| if (oot_engine_api_version() != OOT_ENGINE_API_VERSION) { | ||
| return 1; | ||
| } | ||
| if (liboot_internal_sins(0x4000u) < 32760 || | ||
| liboot_internal_coss(0u) < 32760) { | ||
| return 2; | ||
| } | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Cycl0o0/liboot
Length of output: 152
🏁 Script executed:
Repository: Cycl0o0/liboot
Length of output: 50372
🏁 Script executed:
Repository: Cycl0o0/liboot
Length of output: 13288
🏁 Script executed:
Repository: Cycl0o0/liboot
Length of output: 2076
Check the complete static archive
The test references only
oot_engine_api_version()fromsrc/liboot_engine.c. The fallback definitions are in separate archive members fromsrc/shim/fake_play.candsrc/shim/stubs.c. Force complete archive inclusion, or inspectliboot.afor unprefixed definitions.🤖 Prompt for AI Agents