mirror of
https://github.com/BanjoRecomp/BanjoRecomp
synced 2026-06-10 12:22:19 -04:00
Note saving (#30)
* WIP note saving implementation * Fix note saving affecting other files * Prevent note collection in demo playback for safety * Cache note saving enabled while in the lair or file select to prevent it changing in levels with notes * Prevent "Grunty's magic" note dialog from being shown if note saving is enabled * Implement dynamically spawned note saving * Properly clear loaded save extension data when score status is cleared * Hook up menu for note saving
This commit is contained in:
@@ -239,6 +239,7 @@ bool save_general_config(const std::filesystem::path& path) {
|
||||
config_json["camera_invert_mode"] = banjo::get_camera_invert_mode();
|
||||
config_json["analog_cam_mode"] = banjo::get_analog_cam_mode();
|
||||
config_json["analog_camera_invert_mode"] = banjo::get_analog_camera_invert_mode();
|
||||
config_json["note_saving_mode"] = banjo::get_note_saving_mode();
|
||||
config_json["debug_mode"] = banjo::get_debug_mode_enabled();
|
||||
|
||||
return save_json_with_backups(path, config_json);
|
||||
@@ -253,6 +254,7 @@ void set_general_settings_from_json(const nlohmann::json& config_json) {
|
||||
banjo::set_camera_invert_mode(from_or_default(config_json, "camera_invert_mode", banjo::CameraInvertMode::InvertY));
|
||||
banjo::set_analog_cam_mode(from_or_default(config_json, "analog_cam_mode", banjo::AnalogCamMode::Off));
|
||||
banjo::set_analog_camera_invert_mode(from_or_default(config_json, "analog_camera_invert_mode", banjo::CameraInvertMode::InvertNone));
|
||||
banjo::set_note_saving_mode(from_or_default(config_json, "note_saving_mode", banjo::NoteSavingMode::On));
|
||||
banjo::set_debug_mode_enabled(from_or_default(config_json, "debug_mode", false));
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,10 @@ extern "C" void recomp_get_analog_cam_enabled(uint8_t* rdram, recomp_context* ct
|
||||
_return<s32>(ctx, banjo::get_analog_cam_mode() == banjo::AnalogCamMode::On);
|
||||
}
|
||||
|
||||
extern "C" void recomp_get_note_saving_enabled(uint8_t* rdram, recomp_context* ctx) {
|
||||
_return<s32>(ctx, banjo::get_note_saving_mode() == banjo::NoteSavingMode::On);
|
||||
}
|
||||
|
||||
extern "C" void recomp_get_camera_inputs(uint8_t* rdram, recomp_context* ctx) {
|
||||
float* x_out = _arg<0, float*>(rdram, ctx);
|
||||
float* y_out = _arg<1, float*>(rdram, ctx);
|
||||
|
||||
+2
-1
@@ -349,7 +349,8 @@ std::vector<recomp::GameEntry> supported_games = {
|
||||
.internal_name = "Banjo-Kazooie",
|
||||
.game_id = u8"bk.n64.us.1.0",
|
||||
.mod_game_id = "bk",
|
||||
.save_type = recomp::SaveType::Eep4k,
|
||||
// Eep16k instead of Eep4k to have room for extra save file data.
|
||||
.save_type = recomp::SaveType::Eep16k,
|
||||
.is_enabled = false,
|
||||
.decompression_routine = banjo::decompress_bk,
|
||||
.has_compressed_code = true,
|
||||
|
||||
@@ -238,6 +238,7 @@ struct ControlOptionsContext {
|
||||
banjo::CameraInvertMode camera_invert_mode;
|
||||
banjo::AnalogCamMode analog_cam_mode;
|
||||
banjo::CameraInvertMode analog_camera_invert_mode;
|
||||
banjo::NoteSavingMode note_saving_mode;
|
||||
};
|
||||
|
||||
ControlOptionsContext control_options_context;
|
||||
@@ -325,6 +326,17 @@ void banjo::set_analog_cam_mode(banjo::AnalogCamMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
banjo::NoteSavingMode banjo::get_note_saving_mode() {
|
||||
return control_options_context.note_saving_mode;
|
||||
}
|
||||
|
||||
void banjo::set_note_saving_mode(banjo::NoteSavingMode mode) {
|
||||
control_options_context.note_saving_mode = mode;
|
||||
if (general_model_handle) {
|
||||
general_model_handle.DirtyVariable("note_saving_mode");
|
||||
}
|
||||
}
|
||||
|
||||
banjo::CameraInvertMode banjo::get_analog_camera_invert_mode() {
|
||||
return control_options_context.analog_camera_invert_mode;
|
||||
}
|
||||
@@ -830,6 +842,7 @@ public:
|
||||
bind_option(constructor, "camera_invert_mode", &control_options_context.camera_invert_mode);
|
||||
bind_option(constructor, "analog_cam_mode", &control_options_context.analog_cam_mode);
|
||||
bind_option(constructor, "analog_camera_invert_mode", &control_options_context.analog_camera_invert_mode);
|
||||
bind_option(constructor, "note_saving_mode", &control_options_context.note_saving_mode);
|
||||
|
||||
general_model_handle = constructor.GetModelHandle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user