Preserve data across the Straywild transition

This commit is contained in:
Alexander Sellite 2026-08-25 22:18:20 -04:00
parent 737d1cf2e0
commit 98a27e2f53
28 changed files with 577 additions and 94 deletions

View file

@ -81,6 +81,7 @@ signal shop_backdrop_visibility_changed(is_visible: bool)
signal virtual_pointer_mode_changed(is_active: bool)
signal social_prompt_accepted
signal social_prompt_declined
signal data_root_changed
const VIRTUAL_MOUSE_INPUT_OWNER: StringName = &"controller_virtual_mouse"
const EMOTE_RADIAL_CAMERA_OWNER: StringName = &"emote_radial_menu"
@ -271,6 +272,8 @@ func _ready() -> void:
_pause_settings_panel.crisp_reset_focus_requested.connect(
crisp_reset_focus_requested.emit
)
_title_settings_panel.data_root_changed.connect(data_root_changed.emit)
_pause_settings_panel.data_root_changed.connect(data_root_changed.emit)
if not Input.joy_connection_changed.is_connected(
_on_controller_connection_changed
):

View file

@ -40,6 +40,7 @@ signal opened
signal crisp_reset_focus_requested
signal panel_visibility_changed(is_visible: bool)
signal navigation_transition_started
signal data_root_changed
enum PresentationMode {
TITLE_EMBEDDED,
@ -612,6 +613,7 @@ func _refresh_data_page() -> void:
%DataStorageMode.text = "storage mode: " + _data_root.storage_mode_text()
%ChangeDataFolder.disabled = (
_data_root.override_active
or _presentation_mode != PresentationMode.TITLE_EMBEDDED
or (_network_session != null and _network_session.is_session_active())
)
var fingerprint: String = (
@ -668,6 +670,9 @@ func _choose_data_folder() -> void:
if _data_root == null or _data_root.override_active:
_feedback.text = "the data folder is externally managed."
return
if _presentation_mode != PresentationMode.TITLE_EMBEDDED:
_feedback.text = "return to title to change the data folder."
return
if _network_session != null and _network_session.is_session_active():
_feedback.text = "return to title to change the data folder."
return
@ -684,6 +689,12 @@ func _choose_data_folder() -> void:
func _change_data_folder(path: String) -> void:
if (
_presentation_mode != PresentationMode.TITLE_EMBEDDED
or (_network_session != null and _network_session.is_session_active())
):
_feedback.text = "return to title to change the data folder."
return
var result: Dictionary = PortableDataMigration.migrate_active_to(
_data_root, path
)
@ -697,9 +708,7 @@ func _change_data_folder(path: String) -> void:
).to_lower()
_refresh_data_page()
return
_feedback.text = "data folder changed. straywild will close safely."
_refresh_data_page()
get_tree().call_deferred("quit")
_complete_data_root_change("data folder changed.")
else:
_feedback.text = str(
result.get("message", "could not change the data folder.")
@ -717,8 +726,7 @@ func _show_existing_data_folder_choice(path: String) -> void:
dialog.add_button("replace selected data", false, "replace")
dialog.confirmed.connect(func() -> void:
if _data_root.use_existing_root(path):
_feedback.text = "data folder changed. straywild will close safely."
get_tree().call_deferred("quit")
_complete_data_root_change("data folder changed.")
else:
_feedback.text = _data_root.error_message
dialog.queue_free()
@ -733,7 +741,7 @@ func _show_existing_data_folder_choice(path: String) -> void:
result.get("message", "could not replace selected data.")
)
if bool(result.get("ok", false)):
get_tree().call_deferred("quit")
_complete_data_root_change(_feedback.text.to_lower())
dialog.queue_free()
)
_interface_fonts.apply_utility_theme(dialog)
@ -744,6 +752,12 @@ func _show_existing_data_folder_choice(path: String) -> void:
)
func _complete_data_root_change(message: String) -> void:
_feedback.text = message
_refresh_data_page()
data_root_changed.emit()
func _choose_identity_export(identity_type: String) -> void:
if not _identity_operation_allowed():
return

View file

@ -243,6 +243,11 @@ func reopen_to_menu() -> void:
_set_title_bubbles_interactive(true)
func refresh_after_data_root_change() -> void:
_save_slots_page.refresh_page()
_refresh_save_inspection()
func open_join_game_page(endpoint: String = "") -> void:
_cancel_title_entry_transition()
_awaiting_start_input = false