Skip to content
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

lunchbox_override_pickup_type's function patch is incompatible with Windows #22

Open
nosoop opened this issue Jun 13, 2020 · 3 comments
Labels
open season Someone else want to take care of this? platform-specific This doesn't work on every platform

Comments

@nosoop
Copy link
Owner

nosoop commented Jun 13, 2020

The branching method used by the Windows version of the game is different from the Linux binary — it uses a default switch case for item_healthammokit.

Linux has a register hold a pointer to the default case string and replaces it with one of the other entity classnames on some if statements. For that platform, we reroute the default case to our string and bypass the jumps altogether.

There's a few ways to go about supporting this on Windows:

  1. Patch every mov operation to point to our string
  2. Patch the jump table to our own so every case lands on a singular case, which can then be replaced

At the moment none of my paying clients need this function on Windows, so it's low-priority for me.

@nosoop nosoop added open season Someone else want to take care of this? platform-specific This doesn't work on every platform labels Jun 13, 2020
@nosoop
Copy link
Owner Author

nosoop commented Jun 22, 2020

This is also related to the following load failure:

L 06/22/2020 - 01:16:02: [SM] Exception reported: Invalid Handle 0
L 06/22/2020 - 01:16:02: [SM] Blaming: custom-attr-starter-pack\lunchbox_override_pickup_type.smx
L 06/22/2020 - 01:16:02: [SM] Call stack trace:
L 06/22/2020 - 01:16:02: [SM] [0] DHookEnableDetour
L 06/22/2020 - 01:16:02: [SM] [1] Line 25, scripting\lunchbox_override_pickup_type.sp::O nPluginStart
L 06/22/2020 - 01:16:02: [SM] Unable to load plugin "custom-attr-starter-pack\lunchbox_override_pickup_type.smx": Error detected in plugin startup (see error logs)

CTFLunchbox::SecondaryAttack() is only used within that plugin, so there is currently no point in setting up a proper signature for it at this time.

@nosoop
Copy link
Owner Author

nosoop commented Feb 23, 2021

Or we could just patch before the switch jump and force it the next case and patch that. Simple enough.

@samuuuuuuuu
Copy link

L 08/23/2022 - 14:03:09: [SM] Exception reported: Failed to create detour CTFLunchBox::SecondaryAttack()
L 08/23/2022 - 14:03:09: [SM] Blaming: lunchbox_override_pickup_type.smx
L 08/23/2022 - 14:03:09: [SM] Call stack trace:
L 08/23/2022 - 14:03:09: [SM] [0] SetFailState
L 08/23/2022 - 14:03:09: [SM] [1] Line 26, scripting/lunchbox_override_pickup_type.sp::OnPluginStart
L 08/23/2022 - 14:03:09: [SM] Unable to load plugin "lunchbox_override_pickup_type.smx": Error detected in plugin startup (see error logs)

(running on windows 10)
genuine anger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open season Someone else want to take care of this? platform-specific This doesn't work on every platform
Projects
None yet
Development

No branches or pull requests

2 participants