Skip to content

Comments

Misc Reforged additions#233

Open
ividyon wants to merge 2 commits intovswarte:mainfrom
ividyon:feat/reforged-additions
Open

Misc Reforged additions#233
ividyon wants to merge 2 commits intovswarte:mainfrom
ividyon:feat/reforged-additions

Conversation

@ividyon
Copy link
Contributor

@ividyon ividyon commented Feb 16, 2026

Shoving this PR in here with a bunch of random crap I've been adding over time to work on the Reforged DLL.

Probably garbage and needs a review

#[derive(Debug, Error)]
pub enum ChrAsmError {
#[error("Invalid slot index")]
InvalidIndex,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might as well have this store the slot enum and index. May save someone some debugging headache down the line.

Comment on lines +77 to +78
gaitem_lookup_result_get_gaitem_ins_by_category: 0x6727e0,
gaitem_get_swordarts_param_id_for_weapon: 0x674060,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You shouldn't add stuff to this directly... you'll need to add a pattern to mapper-profile.toml to locate it in a way that's hopefully robust across patches and languages, and then use the binary-mapper executable to regenerate the RVA files.

@nex3 nex3 added the eldenring label Feb 17, 2026
Co-authored-by: Natalie Weizenbaum <nex342@gmail.com>
@axd1x8a
Copy link
Collaborator

axd1x8a commented Feb 18, 2026

We don't need all these ParamLookupResult because this type only exists as result of param lookup functions (and we don't use any of them)

@axd1x8a
Copy link
Collaborator

axd1x8a commented Feb 18, 2026

also functions like get_sword_arts_param_id_for_weapon can be reimplemented in few lines of code, it's just lookup into CSGaitemImp

@axd1x8a
Copy link
Collaborator

axd1x8a commented Feb 18, 2026

actually, we don't even need them, because no one will ever get this GaitemLookupResult unless they are hooking lookup functions

@ividyon
Copy link
Contributor Author

ividyon commented Feb 18, 2026

actually, we don't even need them, because no one will ever get this GaitemLookupResult unless they are hooking lookup functions

That is exactly what I am doing

@axd1x8a
Copy link
Collaborator

axd1x8a commented Feb 18, 2026

This code should be part of the mod then

@ividyon
Copy link
Contributor Author

ividyon commented Feb 18, 2026

Explain to me the logic of arbitrarily omitting classes used by the actual game, in a library that exists to assist people who mod the game, which typically involves hooking functions which make use of those classes

#[repr(C)]
pub struct GaitemLookupResult {
pub gaitem_handle: GaitemHandle,
_pad: [u8; 4],
Copy link
Owner

Choose a reason for hiding this comment

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

This padding can be removed without changing the offset of gaitem_ins I think. We generally don't put down padding anymore


impl GaitemLookupResult {
// Retrieves a valid CSGaitemIns from a GaitemHandle if it matches item_category.
fn get_gaitem_ins_by_category(&self, handle: &GaitemHandle, item_category: ItemCategory) -> Option<&CSGaitemIns> {
Copy link
Owner

Choose a reason for hiding this comment

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

Is this something that can currently be done with existing code instead? If not we should change the param structures to allow for it.

At any rate, we should prob remove these until we have consensus on helpers (you can impl these fns on your own end with an Ext trait in the meanwhile).

Copy link
Collaborator

Choose a reason for hiding this comment

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

also, this should be GaitemCategory, not ItemCategory

Copy link
Collaborator

Choose a reason for hiding this comment

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

Update:
this function is not by_category it just validates that category is the same as handle category.
This makes it exactly the same as CSGaitemImp::gaitem_ins_by_handle

Image

self.get_arrow_by_slot(self.equipment.selected_slots.left_bolt_slot)
.expect(&*ChrAsmError::InvalidIndex.to_string())
}
pub fn get_right_weapon_by_slot(&self, slot: u32) -> Result<GaitemHandle, ChrAsmError> {
Copy link
Owner

Choose a reason for hiding this comment

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

We can make the slot param an enum to ensure no value greater than 2 is passed in. This way we can remove the error handling entirely.


impl GaitemLookupResult {
// Retrieves a valid CSGaitemIns from a GaitemHandle if it matches item_category.
fn get_gaitem_ins_by_category(&self, handle: &GaitemHandle, item_category: ItemCategory) -> Option<&CSGaitemIns> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update:
this function is not by_category it just validates that category is the same as handle category.
This makes it exactly the same as CSGaitemImp::gaitem_ins_by_handle

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants