fivem icon indicating copy to clipboard operation
fivem copied to clipboard

feat(extra-natives-rdr3): Add interior natives

Open Identity-labs opened this issue 2 months ago • 4 comments

Goal of this PR

Port interior-related natives from FiveM to RDR3, enabling interior debugging and manipulation capabilities in RedM. This includes adding comprehensive interior archetype debugging, room/portal management, and reflection probe support specifically for RDR3.

How is this PR achieving the goal

Unified Codebase:

  • Integrated InteriorExtraNatives.cpp from FiveM into RDR3 component via component.lua to eliminate code duplication
  • Used conditional compilation (#ifdef GTA_FIVE / #elif IS_RDR3) to handle platform-specific differences
  • Implemented clean accessor pattern with DECLARE_ACCESSOR macro for consistent API across platforms

RDR3-Specific Structures:

  • Added InteriorProxy::Impl1491 struct with correct memory offsets for RDR3
  • Implemented CReflectionProbe struct based on game file data analysis
  • Updated CMloRoomDef to include reflectionProbes field for RDR3

Enhanced Debugging:

  • Added comprehensive INTERIOR_DEBUG native with archetype info, position/rotation, entities extents
  • Implemented systematic offset testing to verify correct struct layouts
  • Added 256-byte memory dumps for both archetype and proxy structures

Ported Natives from FiveM:

Core Interior Natives:

  • GET_INTERIOR_ROTATION
  • GET_INTERIOR_ENTITIES_EXTENTS

Room Natives:

  • GET_INTERIOR_ROOM_COUNT
  • GET_INTERIOR_ROOM_INDEX_BY_HASH
  • GET_INTERIOR_ROOM_NAME
  • GET_INTERIOR_ROOM_FLAG
  • SET_INTERIOR_ROOM_FLAG
  • GET_INTERIOR_ROOM_EXTENTS
  • SET_INTERIOR_ROOM_EXTENTS
  • GET_INTERIOR_ROOM_TIMECYCLE
  • SET_INTERIOR_ROOM_TIMECYCLE

Portal Natives:

  • GET_INTERIOR_PORTAL_COUNT
  • GET_INTERIOR_PORTAL_CORNER_POSITION
  • SET_INTERIOR_PORTAL_CORNER_POSITION
  • GET_INTERIOR_PORTAL_ROOM_FROM
  • SET_INTERIOR_PORTAL_ROOM_FROM
  • GET_INTERIOR_PORTAL_ROOM_TO
  • SET_INTERIOR_PORTAL_ROOM_TO
  • GET_INTERIOR_PORTAL_FLAG
  • SET_INTERIOR_PORTAL_FLAG
  • GET_INTERIOR_PORTAL_ENTITY_COUNT
  • GET_INTERIOR_PORTAL_ENTITY_ARCHETYPE
  • GET_INTERIOR_PORTAL_ENTITY_FLAG
  • SET_INTERIOR_PORTAL_ENTITY_FLAG
  • GET_INTERIOR_PORTAL_ENTITY_POSITION
  • GET_INTERIOR_PORTAL_ENTITY_ROTATION

New RDR3-Specific Natives:

Reflection Probe Getters:

  • GET_INTERIOR_ROOM_REFLECTION_PROBE_COUNT
  • GET_INTERIOR_ROOM_REFLECTION_PROBE_EXTENTS
  • GET_INTERIOR_ROOM_REFLECTION_PROBE_CENTER_OFFSET
  • GET_INTERIOR_ROOM_REFLECTION_PROBE_INFLUENCE_EXTENTS
  • GET_INTERIOR_ROOM_REFLECTION_PROBE_ROTATION
  • GET_INTERIOR_ROOM_REFLECTION_PROBE_PRIORITY
  • GET_INTERIOR_ROOM_REFLECTION_PROBE_GUID

Reflection Probe Setters:

  • SET_INTERIOR_ROOM_REFLECTION_PROBE_EXTENTS
  • SET_INTERIOR_ROOM_REFLECTION_PROBE_CENTER_OFFSET
  • SET_INTERIOR_ROOM_REFLECTION_PROBE_INFLUENCE_EXTENTS
  • SET_INTERIOR_ROOM_REFLECTION_PROBE_ROTATION
  • SET_INTERIOR_ROOM_REFLECTION_PROBE_PRIORITY

This PR applies to the following area(s)

  • RedM
  • Natives

Successfully tested on

Game builds: RDR3 Build 1491

Platforms: Windows

Checklist

  • [x] Code compiles and has been tested successfully.
  • [x] Code explains itself well and/or is documented.
  • [x] My commit message explains what the changes do and what they are for.
  • [x] No extra compilation warnings are added by these changes.

Fixes issues

N/A - New feature implementation

Example of usage with dolu_tool image

Identity-labs avatar Oct 17 '25 10:10 Identity-labs

I have added apiset: client on reflection probe native

Identity-labs avatar Oct 17 '25 13:10 Identity-labs

dolu_tool.zip Edited dolu_tool, with stub to avoid errors with non compatible natives You can start the menu with dolu command

Identity-labs avatar Oct 17 '25 13:10 Identity-labs

Native definitions look good now.

Please fix the compile errors for V, will review then.

radium-cfx avatar Oct 21 '25 14:10 radium-cfx

I have fixed the GET_INTERIOR_PROXY macro for V, compiler was not happy with return type sorry :) Both are ok now

Edit: screen in game on fivem image

Identity-labs avatar Oct 21 '25 15:10 Identity-labs