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

Finish w_046 and import data #1511

Merged
merged 3 commits into from
Aug 15, 2024
Merged

Conversation

joshlory
Copy link
Contributor

@joshlory joshlory commented Aug 14, 2024

@bismurphy
Copy link
Collaborator

Any reason for creating the new Ext for weapon 46?

I was able to do a find and replace to make it all use the normal ext.weapon and it seems to match just as well:
https://decomp.me/scratch/nR04G


a1 = var_i >> 1;
a0 = a1 + 1;
var_a0 = D_146000_8017ABD0[a0 - ((a0 / 16) * 0x10)];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern is a0 % 16. This comes up somewhat rarely but it's nice to be able to recognize it. You have it in a couple other places too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helpful, thank you! Worth opening an issue on https://github.com/matt-kempster/m2c/issues to identify more of these automatically?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know anything about m2c but sure, if you would want to open an issue I don't see why that would be a problem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshlory
Copy link
Contributor Author

Any reason for creating the new Ext for weapon 46?

Ah I modified ET_Weapon in the context before copying it to a new ET_WeaponUnk046 struct. I wasn't able to get it matching with the existing struct.

@bismurphy
Copy link
Collaborator

Any reason for creating the new Ext for weapon 46?

Ah I modified ET_Weapon in the context before copying it to a new ET_WeaponUnk046 struct. I wasn't able to get it matching with the existing struct.

Got it, silly me, should have checked on that.

Sad that it doesn't match up, these weapons are super weird. Looks good then, at least for now while we're still learning weapons. Once we get all the weapons decompiled hopefully we can find a unified solution to the Ext problem for them.

Copy link
Owner

@Xeeynamo Xeeynamo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Since you imported the data, could you link this weapon? There is an example here: https://github.com/Xeeynamo/sotn-decomp/pull/1493/files

Comment on lines 8 to 10
extern u16* g_WeaponCluts[];
extern s32 g_HandId;
#include "shared.h"
Copy link
Owner

@Xeeynamo Xeeynamo Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extern u16* g_WeaponCluts[];
extern s32 g_HandId;
#include "shared.h"
#include "shared.h"

you should be able to delete these two lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they're referenced in shared.h — should I move the includes down below the data defines?

...but I can get rid of these lines!

extern u16 D_146000_8017A2B0[];
extern u16 D_146000_8017A530[];
extern u16 D_146000_8017A670[];
extern u16 D_146000_8017A3F0[];

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you would need to move shared.h right before static void EntityWeaponAttack(Entity* self) like the PR I linked above

Not sure about the extern u16 D_146000_*, you should be able to delete them!

@joshlory
Copy link
Contributor Author

In order to get the linking working I had to decompile the last EntityWeaponAttack func in the file. Should be good to go hopefully!

@joshlory joshlory changed the title Decompile func_ptr_80170004_w_046 and import data Finish w_046 and import data Aug 15, 2024
@joshlory joshlory force-pushed the func_ptr_80170004_w_046 branch from 11afc59 to b38ca7e Compare August 15, 2024 06:43
@sozud sozud merged commit 6c4e63f into Xeeynamo:master Aug 15, 2024
15 checks passed
@joshlory joshlory deleted the func_ptr_80170004_w_046 branch August 16, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants