Add support for built-in mods and convert D-Pad to a built-in mod (#567)

* Add embedded mod (using mm_recomp_draw_distance as an example).

* Update runtime after merge

* Experiment with removing the D-Pad.

* Add event needed for dpad as mod, revert remaining changes in built-in patches for dpad

* Add built-in dpad mod, add remaining event calls to input.c

* Add built-in mods readme

---------

Co-authored-by: Dario <dariosamo@gmail.com>
This commit is contained in:
Wiseguy
2025-04-24 23:00:53 -04:00
committed by GitHub
parent 93b5b84b51
commit 2600e47b69
10 changed files with 212 additions and 1468 deletions

View File

@@ -388,6 +388,27 @@ endif()
build_vertex_shader(Zelda64Recompiled "shaders/InterfaceVS.hlsl" "shaders/InterfaceVS.hlsl")
build_pixel_shader(Zelda64Recompiled "shaders/InterfacePS.hlsl" "shaders/InterfacePS.hlsl")
# Embed all .nrm files in the "mods" directory
file(GLOB NRM_FILES "${CMAKE_SOURCE_DIR}/mods/*.nrm")
set(GENERATED_NRM_SOURCES "")
foreach(NRM_FILE ${NRM_FILES})
get_filename_component(NRM_NAME ${NRM_FILE} NAME_WE)
set(OUT_C "${CMAKE_CURRENT_BINARY_DIR}/mods/${NRM_NAME}.c")
set(OUT_H "${CMAKE_CURRENT_BINARY_DIR}/mods/${NRM_NAME}.h")
add_custom_command(
OUTPUT ${OUT_C} ${OUT_H}
COMMAND file_to_c ${NRM_FILE} ${NRM_NAME} ${OUT_C} ${OUT_H}
DEPENDS ${NRM_FILE}
)
list(APPEND GENERATED_NRM_SOURCES ${OUT_C})
endforeach()
target_sources(Zelda64Recompiled PRIVATE ${GENERATED_NRM_SOURCES})
target_sources(Zelda64Recompiled PRIVATE ${SOURCES})
set_property(TARGET Zelda64Recompiled PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")

6
mods/BUILTIN_MODS.md Normal file
View File

@@ -0,0 +1,6 @@
# Built-in Mods
This folder contains mods that are built into the Zelda 64: Recompiled project. Built-in mods behave like normal mods but are present in a clean installation of the project. They can be updated or downgraded by placing the .nrm file for the mod in the appdata mods folder in the same way a normal mod would be, which overrides the built-in version with the manually installed version.
The list of built-in mods is as follows:
* Majora's Mask: Recompiled D-Pad Mod - https://github.com/Zelda64Recomp/MMRecompDpadMod

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 955 B

File diff suppressed because it is too large Load Diff

View File

@@ -92,9 +92,6 @@ typedef enum {
"\t.popsection\n"); \
extern u8 identifier[]
void draw_dpad(PlayState* play);
void draw_dpad_icons(PlayState* play);
void View_ApplyInterpolate(View* view, s32 mask, bool reset_interpolation_state);
void set_camera_skipped(bool skipped);

View File

@@ -487,10 +487,8 @@ RECOMP_PATCH void Interface_Draw(PlayState* play) {
Magic_DrawMeter(play);
// @recomp Draw the D-Pad and its item icons as well as the autosave icon if the game is unpaused.
// @recomp Draw the autosave icon if the game is unpaused.
if (pauseCtx->state != PAUSE_STATE_MAIN) {
draw_dpad(play);
draw_dpad_icons(play);
draw_autosave_icon(play);
}

View File

@@ -38,6 +38,8 @@
#include "../../patches/sound.h"
#include "../../patches/misc_funcs.h"
#include "mods/mm_recomp_dpad_builtin.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@@ -617,6 +619,8 @@ int main(int argc, char** argv) {
recomp::register_game(game);
}
recomp::mods::register_embedded_mod("mm_recomp_dpad_builtin", { (const uint8_t*)(mm_recomp_dpad_builtin), std::size(mm_recomp_dpad_builtin)});
REGISTER_FUNC(recomp_get_window_resolution);
REGISTER_FUNC(recomp_get_target_aspect_ratio);
REGISTER_FUNC(recomp_get_target_framerate);